Skip to content

Commit

Permalink
Ignore all remaining implicit optional
Browse files Browse the repository at this point in the history
Co-Authored-By: Sam Bull <[email protected]>
  • Loading branch information
alexrudd2 and Dreamsorcerer committed Nov 12, 2023
1 parent e3b8e89 commit 3a1d46a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pymodbus/transport/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ def __init__(
self.is_server = is_server
self.is_closing = False

self.transport: asyncio.BaseTransport = None
self.loop: asyncio.AbstractEventLoop = None
self.transport: asyncio.BaseTransport = None # type: ignore[assignment]
self.loop: asyncio.AbstractEventLoop = None # type: ignore[assignment]
self.recv_buffer: bytes = b""
self.call_create: Callable[[], Coroutine[Any, Any, Any]] = lambda: None
self.call_create: Callable[[], Coroutine[Any, Any, Any]] = lambda: None # type: ignore[assignment, return-value]
if self.is_server:
self.active_connections: dict[str, ModbusProtocol] = {}
else:
Expand Down Expand Up @@ -415,7 +415,7 @@ def transport_close(self, intern: bool = False, reconnect: bool = False) -> None
if hasattr(self.transport, "abort"):
self.transport.abort()
self.transport.close()
self.transport = None
self.transport = None # type: ignore[assignment]
self.recv_buffer = b""
if self.is_server:
for _key, value in self.active_connections.items():
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/transport/transport_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def close(self, exc: Exception | None = None) -> None:
else:
self.async_loop.remove_reader(self.sync_serial.fileno())
self.sync_serial.close()
self.sync_serial = None
self.sync_serial = None # type: ignore[assignment]
if exc:
with contextlib.suppress(Exception):
self._protocol.connection_lost(exc)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ overgeneral-exceptions = "builtins.Exception"
bad-functions = "map,input"

[tool.mypy]
strict_optional = false
strict_optional = true
show_error_codes = true
local_partial_types = true
strict_equality = true
Expand Down

0 comments on commit 3a1d46a

Please sign in to comment.