diff --git a/stubs/pyserial/serial/rfc2217.pyi b/stubs/pyserial/serial/rfc2217.pyi index b7e751c14b06..39275b8b7e8f 100644 --- a/stubs/pyserial/serial/rfc2217.pyi +++ b/stubs/pyserial/serial/rfc2217.pyi @@ -183,5 +183,5 @@ class PortManager: def telnet_send_option(self, action: bytes, option: bytes) -> None: ... def rfc2217_send_subnegotiation(self, option: bytes, value: bytes = b"") -> None: ... def check_modem_lines(self, force_notification: bool = False) -> None: ... - def escape(self, data: bytes) -> Generator[bytes, None, None]: ... - def filter(self, data: bytes) -> Generator[bytes, None, None]: ... + def escape(self, data: bytes) -> Generator[bytes]: ... + def filter(self, data: bytes) -> Generator[bytes]: ... diff --git a/stubs/pyserial/serial/serialutil.pyi b/stubs/pyserial/serial/serialutil.pyi index 913fb4b16048..3b6f84adee50 100644 --- a/stubs/pyserial/serial/serialutil.pyi +++ b/stubs/pyserial/serial/serialutil.pyi @@ -149,4 +149,4 @@ class SerialBase(io.RawIOBase): def send_break(self, duration: float = 0.25) -> None: ... def read_all(self) -> bytes | None: ... def read_until(self, expected: bytes = b"\n", size: int | None = None) -> bytes: ... - def iread_until(self, expected: bytes = ..., size: int | None = ...) -> Generator[bytes, None, None]: ... + def iread_until(self, expected: bytes = ..., size: int | None = ...) -> Generator[bytes]: ... diff --git a/stubs/pyserial/serial/tools/list_ports.pyi b/stubs/pyserial/serial/tools/list_ports.pyi index d40bb08961be..be96fdc686fb 100644 --- a/stubs/pyserial/serial/tools/list_ports.pyi +++ b/stubs/pyserial/serial/tools/list_ports.pyi @@ -2,10 +2,12 @@ import re import sys from collections.abc import Generator +from serial.tools.list_ports_common import ListPortInfo + if sys.platform == "win32": from serial.tools.list_ports_windows import comports as comports else: from serial.tools.list_ports_posix import comports as comports -def grep(regexp: str | re.Pattern[str], include_links: bool = False) -> Generator[tuple[str, str, str], None, None]: ... +def grep(regexp: str | re.Pattern[str], include_links: bool = False) -> Generator[ListPortInfo]: ... def main() -> None: ... diff --git a/stubs/pyserial/serial/tools/list_ports_windows.pyi b/stubs/pyserial/serial/tools/list_ports_windows.pyi index dc499e238ae3..b5ba02fc7714 100644 --- a/stubs/pyserial/serial/tools/list_ports_windows.pyi +++ b/stubs/pyserial/serial/tools/list_ports_windows.pyi @@ -74,5 +74,5 @@ if sys.platform == "win32": depth: int = 0, last_serial_number: str | None = None, ) -> str: ... - def iterate_comports() -> Generator[ListPortInfo, None, None]: ... + def iterate_comports() -> Generator[ListPortInfo]: ... def comports(include_links: bool = False) -> list[ListPortInfo]: ... diff --git a/stubs/pyserial/serial/urlhandler/protocol_spy.pyi b/stubs/pyserial/serial/urlhandler/protocol_spy.pyi index e1454586fabe..9020d7e07690 100644 --- a/stubs/pyserial/serial/urlhandler/protocol_spy.pyi +++ b/stubs/pyserial/serial/urlhandler/protocol_spy.pyi @@ -3,8 +3,8 @@ from typing import TextIO, type_check_only import serial -def sixteen(data: bytes) -> Generator[tuple[str, str] | tuple[None, None], None, None]: ... -def hexdump(data: bytes) -> Generator[tuple[int, str], None, None]: ... +def sixteen(data: bytes) -> Generator[tuple[str, str] | tuple[None, None]]: ... +def hexdump(data: bytes) -> Generator[tuple[int, str]]: ... @type_check_only class _Formatter: def rx(self, data: bytes) -> None: ...