From 20fa04140cb40dee0bcb3a6f9b4a94e88fad00c4 Mon Sep 17 00:00:00 2001 From: Alex Ruddick Date: Sun, 16 Mar 2025 18:39:51 -0500 Subject: [PATCH 1/2] Use extend-exclude instead of exclude --- pyproject.toml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index dec560b14..504063104 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -255,11 +255,8 @@ skip = "./build,./doc/source/_static,venv,.venv,.git,htmlcov,CHANGELOG.rst,.mypy ignore-words-list = "asend" [tool.ruff] -target-version="py38" -exclude = [ - "venv", - ".venv", - ".git", +target-version="py39" +extend-exclude = [ "build", "doc", "contrib" From bff408bf197d3732cab10d27499b6757609e7895 Mon Sep 17 00:00:00 2001 From: Alex Ruddick Date: Sun, 16 Mar 2025 19:11:25 -0500 Subject: [PATCH 2/2] dict.fromkeys() --- pymodbus/datastore/simulator.py | 2 +- pymodbus/pdu/device.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pymodbus/datastore/simulator.py b/pymodbus/datastore/simulator.py index 42e7ecb02..cd77a1e18 100644 --- a/pymodbus/datastore/simulator.py +++ b/pymodbus/datastore/simulator.py @@ -219,7 +219,7 @@ def handle_type_string(self, start, stop, value, action, action_parameters): def handle_setup_section(self): """Load setup section.""" layout = Label.try_get(Label.setup, self.config) - self.runtime.fc_offset = {key: 0 for key in range(25)} + self.runtime.fc_offset = dict.fromkeys(range(25), 0) size_co = Label.try_get(Label.co_size, layout) size_di = Label.try_get(Label.di_size, layout) size_hr = Label.try_get(Label.hr_size, layout) diff --git a/pymodbus/pdu/device.py b/pymodbus/pdu/device.py index 51c9a0213..2db85e485 100644 --- a/pymodbus/pdu/device.py +++ b/pymodbus/pdu/device.py @@ -367,7 +367,7 @@ class ModbusCountersHandler: .. note:: I threw the event counter in here for convenience """ - __data = {i: 0x0000 for i in range(9)} + __data = dict.fromkeys(range(9), 0x00) __names = [ "BusMessage", "BusCommunicationError", @@ -401,7 +401,7 @@ def update(self, values): def reset(self): """Clear all of the system counters.""" - self.__data = {i: 0x0000 for i in range(9)} + self.__data = dict.fromkeys(range(9), 0x00) def summary(self): """Return a summary of the counters current status.