Skip to content

Commit d734df5

Browse files
committed
Pass 6.
1 parent 957da5a commit d734df5

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

pymodbus/pdu/decoders.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,13 @@
1212
class DecodePDU:
1313
"""Decode pdu requests/responses (server/client)."""
1414

15-
_pdu_sub_class_table: set[tuple[type[ModbusPDU], type[ModbusPDU]]] = set()
1615
pdu_table: dict[int, tuple[type[ModbusPDU], type[ModbusPDU]]] = {}
1716
pdu_sub_table: dict[int, dict[int, tuple[type[ModbusPDU], type[ModbusPDU]]]] = {}
1817

1918

2019
def __init__(self, is_server: bool) -> None:
2120
"""Initialize function_tables."""
2221
self.pdu_inx = 0 if is_server else 1
23-
inx = 0 if is_server else 1
24-
self.sub_lookup: dict[int, dict[int, type[ModbusPDU]]] = {}
25-
for f in self._pdu_sub_class_table:
26-
if (function_code := f[inx].function_code) not in self.sub_lookup:
27-
self.sub_lookup[function_code] = {f[inx].sub_function_code: f[inx]}
28-
else:
29-
self.sub_lookup[function_code][f[inx].sub_function_code] = f[inx]
3022

3123
def lookupPduClass(self, data: bytes) -> type[ModbusPDU] | None:
3224
"""Use `function_code` to determine the class of the PDU."""
@@ -58,7 +50,6 @@ def add_sub_pdu(cls, req: type[ModbusPDU], resp: type[ModbusPDU]):
5850
if req.function_code not in cls.pdu_sub_table:
5951
cls.pdu_sub_table[req.function_code] = {}
6052
cls.pdu_sub_table[req.function_code][req.sub_function_code] = (req, resp)
61-
cls._pdu_sub_class_table.add((req, resp))
6253

6354
def register(self, custom_class: type[ModbusPDU]) -> None:
6455
"""Register a function and sub function class with the decoder."""

0 commit comments

Comments
 (0)