Skip to content

Commit

Permalink
Improve types for messages
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrudd2 committed Feb 25, 2024
1 parent bf59f3c commit 4ba6a30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pymodbus/file_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Currently none of these messages are implemented
"""
from __future__ import annotations

__all__ = [
"FileRecord",
Expand Down Expand Up @@ -147,7 +148,7 @@ def execute(self, _context):
# TODO do some new context operation here # pylint: disable=fixme
# if file number, record number, or address + length
# is too big, return an error.
files = []
files: list[FileRecord] = []
return ReadFileRecordResponse(files)


Expand Down
3 changes: 1 addition & 2 deletions pymodbus/mei_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def __init__(self, read_code=None, information=None, **kwargs):
self.conformity = 0x83 # I support everything right now
self.next_object_id = 0x00
self.more_follows = MoreData.NOTHING
self.space_left = None
self.space_left = 253 - 6

def _encode_object(self, object_id, data):
"""Encode object."""
Expand All @@ -170,7 +170,6 @@ def encode(self):
packet = struct.pack(
">BBB", self.sub_function_code, self.read_code, self.conformity
)
self.space_left = 253 - 6
objects = b""
try:
for object_id, data in iter(self.information.items()):
Expand Down

0 comments on commit 4ba6a30

Please sign in to comment.