diff --git a/pymodbus/client/base.py b/pymodbus/client/base.py index 119999a88..87da6ceb5 100644 --- a/pymodbus/client/base.py +++ b/pymodbus/client/base.py @@ -206,7 +206,7 @@ def _handle_response(self, reply, **_kwargs): def build_response(self, tid): """Return a deferred response for the current request.""" - my_future = asyncio.Future() + my_future: asyncio.Future = asyncio.Future() if not self.transport: self.raise_future(my_future, ConnectionException("Client is not connected")) else: diff --git a/pymodbus/client/tcp.py b/pymodbus/client/tcp.py index b4a8fdc1d..425aa4528 100644 --- a/pymodbus/client/tcp.py +++ b/pymodbus/client/tcp.py @@ -53,6 +53,8 @@ async def run(): Please refer to :ref:`Pymodbus internals` for advanced usage. """ + socket: socket.socket | None + def __init__( self, host: str, @@ -131,6 +133,8 @@ async def run(): Remark: There are no automatic reconnect as with AsyncModbusTcpClient """ + socket: socket.socket | None + def __init__( self, host: str, @@ -219,7 +223,7 @@ def recv(self, size): else: recv_size = size - data = [] + data: list[bytes] = [] data_length = 0 time_ = time.time() end = time_ + timeout diff --git a/pymodbus/client/udp.py b/pymodbus/client/udp.py index 19cf94c83..24851c21d 100644 --- a/pymodbus/client/udp.py +++ b/pymodbus/client/udp.py @@ -137,6 +137,8 @@ async def run(): Remark: There are no automatic reconnect as with AsyncModbusUdpClient """ + socket: socket.socket | None + def __init__( self, host: str, diff --git a/pymodbus/server/async_io.py b/pymodbus/server/async_io.py index 0d86721c0..86c627d95 100644 --- a/pymodbus/server/async_io.py +++ b/pymodbus/server/async_io.py @@ -49,7 +49,7 @@ def __init__(self, owner): self.running = False self.receive_queue = asyncio.Queue() self.handler_task = None # coroutine to be run on asyncio loop - self.framer: ModbusFramer = None + self.framer: ModbusFramer def _log_exception(self): """Show log exception."""