pymodbus-dev / pymodbus

A full modbus protocol written in python
Other
2.18k stars 895 forks source link

Fix incorrect bytearray type hint in diagnostics query #1983

Closed alexrudd2 closed 5 months ago

alexrudd2 commented 5 months ago

(I'm trying pyright and it seems to be stricter than mypy)

Since #1638 it has not been possible to pass a bytearray to diag_query_data.

Note:

>>> msg = bytearray()
>>> type(msg)
<class 'bytearray'>
>>> isinstance(msg, bytes)
False

Also, re-enable DiagnasticStatusResponse enconding test, although it doesn't actually test much, ha.

alexrudd2 commented 5 months ago

Yeah, it's clear nobody has used those functions in years (ever?), so it's a safe starting point to experiment (again) with type checks,