Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ jobs:
run: |
uv run pylint --recursive=y examples pymodbus test

- name: mypy
- name: Type check with zuban
if: matrix.run_lint == true
run: |
uv run mypy pymodbus examples
uv run zuban check pymodbus examples

- name: ruff
if: matrix.run_lint == true
Expand Down
2 changes: 1 addition & 1 deletion check_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT
codespell
ruff check --fix --exit-non-zero-on-fix .
pylint --recursive=y examples pymodbus test
mypy pymodbus examples
zuban pymodbus examples
pytest -x --cov --numprocesses auto
echo "Ready to push"
2 changes: 1 addition & 1 deletion examples/custom_msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CustomModbusResponse(ModbusPDU):
def __init__(self, values: list[int] | None = None, device_id=1, transaction=0):
"""Initialize."""
super().__init__(dev_id=device_id, transaction_id=transaction)
self.values = values or []
self.values: list[int] = values or []

def encode(self):
"""Encode response pdu.
Expand Down
2 changes: 1 addition & 1 deletion examples/server_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def setup_server(description=None, context=None, cmdline=None):
elif args.store == "sparse": # pragma: no cover
# Continuing, or use a sparse DataBlock which can have gaps
datablock = lambda : ModbusSparseDataBlock({0x00: 0, 0x05: 1}) # pylint: disable=unnecessary-lambda-assignment
else: # args.store == "factory" # pragma: no cover
elif args.store == "factory" or True: # pragma: no cover # pylint: disable=condition-evals-to-constant
# Alternately, use the factory methods to initialize the DataBlocks
# or simply do not pass them to have them initialized to 0x00 on the
# full address range::
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/datastore/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def __init__(self, devices=None, single=True):
:param single: Set to true to treat this as a single context
"""
self.single = single
self._devices = devices or {} # type: ignore[var-annotated, unused-ignore]
self._devices: dict = devices or {}
if self.single:
self._devices = {0: self._devices}

Expand Down
2 changes: 1 addition & 1 deletion pymodbus/pdu/mei_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __init__(self, read_code: int | None = None, information: dict[int, Any] | N
"""Initialize a new instance."""
super().__init__(transaction_id=transaction_id, dev_id=dev_id)
self.read_code = read_code or DeviceInformation.BASIC
self.information = information or {}
self.information: dict[int, Any] = information or {}
self.number_of_objects = 0
self.conformity = 0x83 # I support everything right now
self.next_object_id = 0x00
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/transport/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def generate_ssl(
)
return new_sslctx

def copy(self) -> CommParams:
def copy(self: CommParams) -> CommParams:
"""Create a copy."""
return copy.copy(self)

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ development = [
"build>=1.2.2",
"codespell>=2.3.0",
"coverage>=7.10.7",
"mypy>=1.18.2",
"pylint>=4.0.0",
"pytest>=8.4.2",
"pytest-asyncio>=1.2.0",
Expand All @@ -70,7 +69,8 @@ development = [
"ruff>=0.13.1",
"twine>=6.2.0",
"types-Pygments",
"types-pyserial"
"types-pyserial",
"zuban>=0.3.0"
]
all = [
"pymodbus[serial, simulator, documentation, development]"
Expand Down