Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Hint for write_registers value parameter wrong? #2308

Closed
rauberdaniel opened this issue Sep 7, 2024 · 2 comments · Fixed by #2309
Closed

Type Hint for write_registers value parameter wrong? #2308

rauberdaniel opened this issue Sep 7, 2024 · 2 comments · Fixed by #2309

Comments

@rauberdaniel
Copy link
Contributor

BinaryPayloadBuilder.build(…) returns list[bytes]

def build(self) -> list[bytes]:

but ModbusTcpClient.write_registers(…) expects list[int] as values argument

def write_registers(self, address: int, values: list[int], slave: int = 1, skip_encode: bool = False) -> T:

According to my tests, write_registers however actually expects list[bytes] so I think this type hint there is wrong? Can anybody confirm or deny that?

@janiversen
Copy link
Collaborator

I will take a look.

@janiversen
Copy link
Collaborator

You are right it should be list[bytes], while write_register expects an int.

You are welcome to make a pull request if you want, otherwise I will correct it when I get around to it,
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants