Skip to content

Commit

Permalink
Eliminate implicit optional for other_modem
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrudd2 committed Nov 12, 2023
1 parent 675f28c commit 53e2569
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pymodbus/transport/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def __init__(self, protocol: ModbusProtocol, listen: int | None = None) -> None:
asyncio.DatagramTransport.__init__(self)
asyncio.Transport.__init__(self)
self.protocol: ModbusProtocol = protocol
self.other_modem: NullModem = None
self.other_modem: NullModem
self.listen = listen
self.manipulator: Callable[[bytes], list[bytes]] | None = None
self._is_closing = False
Expand Down Expand Up @@ -590,10 +590,10 @@ def close(self) -> None:
if self.connections:
with suppress(KeyError):
del self.connections[self]
if self.other_modem:
self.other_modem.other_modem = None
if hasattr(self, "other_modem"):
del self.other_modem.other_modem
self.other_modem.close()
self.other_modem = None
del self.other_modem
if self.protocol:
self.protocol.connection_lost(None)

Expand Down

0 comments on commit 53e2569

Please sign in to comment.