Skip to content

Commit

Permalink
mypy.
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Feb 4, 2024
1 parent 0dd42a5 commit 673a4a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pymodbus/transport/stub.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""ModbusProtocol network stub."""
from __future__ import annotations

from typing import Callable

from pymodbus.transport.transport import CommParams, ModbusProtocol


Expand All @@ -11,7 +13,7 @@ def __init__(
self,
params: CommParams,
is_server: bool,
handler: callable | None = None,
handler: Callable[[bytes], bytes] | None = None,
) -> None:
"""Initialize a stub instance."""
self.stub_handle_data = handler if handler else self.dummy_handler
Expand Down
4 changes: 3 additions & 1 deletion test/test_network.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Test transport."""
from __future__ import annotations

import asyncio

import pytest
Expand Down Expand Up @@ -48,7 +50,7 @@ def local_handle_data(data: bytes) -> bytes | None:
# 6 return 6 + 6 (wrong order
# 8 return 7 + half 8
# 9 return second half 8 + 9
if addr in (2, 5):
if addr in {2, 5}:
old_data = response
response = None
elif addr == 3:
Expand Down

0 comments on commit 673a4a4

Please sign in to comment.