pymodbus-dev / pymodbus

A full modbus protocol written in python
Other
2.16k stars 891 forks source link

Reorganize datastore inheritance #2055

Closed alexrudd2 closed 4 months ago

alexrudd2 commented 4 months ago

This solves 8 more mypy errors, including a real problem in ModbusSparseDataBlock.

The method default() (inherited from ModbusBaseDataBlock) does not make any sense for a sparse datastore, where self.values is a dictionary. If called, it will break the implementation. ==> Move it to ModbusSequentialDataBlock.

Also, reset() is defined in ModbusBaseDataBlock but overridden by ModbusSparseDataBlock. ==> Move it also to ModbusSequentialDataBlock.