Skip to content

Commit cf75a30

Browse files
Declare RS485 write result explicitly
1 parent fe98834 commit cf75a30

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎stubs/pyserial/@tests/stubtest_allowlist.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ serial.serialjava # No Java Communications API implementation found
1010
# but at runtime they are normal arguments that don't have consistent names.
1111
serial.serialutil.SerialBase.readinto
1212
serial.rfc2217.Serial.write
13-
serial.rs485.RS485.write
1413
serial.urlhandler.protocol_cp2110.Serial.write
1514
serial.urlhandler.protocol_loop.Serial.write
1615
serial.urlhandler.protocol_socket.Serial.write

‎stubs/pyserial/serial/rs485.pyi‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from _typeshed import ReadableBuffer
2+
13
import serial
24

35
class RS485Settings:
@@ -15,4 +17,5 @@ class RS485Settings:
1517
delay_before_rx: float | None = None,
1618
) -> None: ...
1719

18-
class RS485(serial.Serial): ...
20+
class RS485(serial.Serial):
21+
def write(self, b: ReadableBuffer) -> None: ...

‎stubs/pyserial/serial/threaded/__init__.pyi‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class ReaderThread(threading.Thread, Generic[_P]):
4242
protocol: _P
4343
def __init__(self, serial_instance: Serial, protocol_factory: Callable[[], _P]) -> None: ...
4444
def stop(self) -> None: ...
45+
# RS485.write discards the underlying byte count and returns None.
4546
def write(self, data: ReadableBuffer) -> int | None: ...
4647
def close(self) -> None: ...
4748
def connect(self) -> tuple[Self, _P]: ...

0 commit comments

Comments
 (0)