From 8b63dd20918364f197b3b34ded8a49cbde827d76 Mon Sep 17 00:00:00 2001 From: Alex <52292902+alexrudd2@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:11:58 -0500 Subject: [PATCH] Eliminate more implicit optional (#1871) --- pymodbus/client/serial.py | 1 - pymodbus/client/tcp.py | 3 +-- pymodbus/client/tls.py | 3 +-- pymodbus/client/udp.py | 3 +-- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/pymodbus/client/serial.py b/pymodbus/client/serial.py index 3191fa7c1..0a582abc5 100644 --- a/pymodbus/client/serial.py +++ b/pymodbus/client/serial.py @@ -167,7 +167,6 @@ def __init__( **kwargs: Any, ) -> None: """Initialize Modbus Serial Client.""" - self.transport = None kwargs["use_sync"] = True super().__init__( framer, diff --git a/pymodbus/client/tcp.py b/pymodbus/client/tcp.py index 8aa172750..9a196e75a 100644 --- a/pymodbus/client/tcp.py +++ b/pymodbus/client/tcp.py @@ -149,7 +149,6 @@ def __init__( if "CommType" not in kwargs: kwargs["CommType"] = CommType.TCP kwargs["use_sync"] = True - self.transport = None super().__init__( framer, host=host, @@ -160,7 +159,7 @@ def __init__( self.socket = None @property - def connected(self): + def connected(self) -> bool: """Connect internal.""" return self.socket is not None diff --git a/pymodbus/client/tls.py b/pymodbus/client/tls.py index bc667749d..1dbd54031 100644 --- a/pymodbus/client/tls.py +++ b/pymodbus/client/tls.py @@ -156,7 +156,6 @@ def __init__( **kwargs: Any, ): """Initialize Modbus TLS Client.""" - self.transport = None super().__init__( host, CommType=CommType.TLS, port=port, framer=framer, **kwargs ) @@ -166,7 +165,7 @@ def __init__( self.params.server_hostname = server_hostname @property - def connected(self): + def connected(self) -> bool: """Connect internal.""" return self.transport is not None diff --git a/pymodbus/client/udp.py b/pymodbus/client/udp.py index 6d7c7cad1..885c6bae8 100644 --- a/pymodbus/client/udp.py +++ b/pymodbus/client/udp.py @@ -151,7 +151,6 @@ def __init__( ) -> None: """Initialize Modbus UDP Client.""" kwargs["use_sync"] = True - self.transport = None super().__init__( framer, port=port, @@ -164,7 +163,7 @@ def __init__( self.socket = None @property - def connected(self): + def connected(self) -> bool: """Connect internal.""" return self.socket is not None