The current code has a check if fc_as_hex in self._write_fc:. If this check fails, it means the function was called with a Modbus function code which isn't a write.
This will never happen normally. If there is bad calling code, a confusing NameError is thrown because self.result is undefined.
This PR makes the check explicit (and solves another mypy error). An alternative is to simply delete the check.
See https://github.com/pymodbus-dev/pymodbus/pull/1599 for background.
The current code has a check
if fc_as_hex in self._write_fc:
. If this check fails, it means the function was called with a Modbus function code which isn't a write.This will never happen normally. If there is bad calling code, a confusing
NameError
is thrown becauseself.result
is undefined.This PR makes the check explicit (and solves another
mypy
error). An alternative is to simply delete the check.