Skip to content

Commit

Permalink
Pin python 3.13.0 and update ruff. (#2487)
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen authored Dec 7, 2024
1 parent cadbec7 commit 7572508
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ['3.9', '3.10', '3.11', '3.12', "3.13"]
python: ['3.9', '3.10', '3.11', '3.12', "3.13.0"]
include:
- python: '3.9'
run_lint: true
- python: '3.13'
- python: '3.13.0'
run_doc: true
run_lint: true
- os: macos-latest
Expand Down
32 changes: 7 additions & 25 deletions examples/message_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,40 +93,22 @@ def check_errors(self, decoder, message):
def report(self, message):
"""Print the message information."""
print(
"%-15s = %s" # pylint: disable=consider-using-f-string
% (
"name",
message.__class__.__name__,
)
f"{'name':.15s} = {message.__class__.__name__}"
)
for k_dict, v_dict in message.__dict__.items():
if isinstance(v_dict, dict):
print("%-15s =" % k_dict) # pylint: disable=consider-using-f-string
print(f"{k_dict:.15s} =")
for k_item, v_item in v_dict.items():
print(
" %-12s => %s" # pylint: disable=consider-using-f-string
% (k_item, v_item)
print(f" {k_item:.12s} => {v_item}"
)
elif isinstance(v_dict, collections.abc.Iterable):
print("%-15s =" % k_dict) # pylint: disable=consider-using-f-string
print(f"{k_dict:.15s} =")
value = str([int(x) for x in v_dict])
for line in textwrap.wrap(value, 60):
print(
"%-15s . %s" # pylint: disable=consider-using-f-string
% ("", line)
)
print(f"{' ':.15s} . {line}")
else:
print(
"%-15s = %s" # pylint: disable=consider-using-f-string
% (k_dict, hex(v_dict))
)
print(
"%-15s = %s" # pylint: disable=consider-using-f-string
% (
"documentation",
message.__doc__,
)
)
print(f"{k_dict:.15s} = {hex(v_dict)}")
print("{'documentation':.15s} = {message.__doc__}")


# -------------------------------------------------------------------------- #
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"ExceptionResponse",
"FramerType",
"ModbusException",
"pymodbus_apply_logging_config",
"__version__",
"__version_full__",
"pymodbus_apply_logging_config",
]

from pymodbus.exceptions import ModbusException
Expand Down
4 changes: 2 additions & 2 deletions pymodbus/datastore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
__all__ = [
"ModbusBaseSlaveContext",
"ModbusSequentialDataBlock",
"ModbusSparseDataBlock",
"ModbusSlaveContext",
"ModbusServerContext",
"ModbusSimulatorContext",
"ModbusSlaveContext",
"ModbusSparseDataBlock",
]

from pymodbus.datastore.context import (
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/datastore/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ def loop_validate(self, address, end_address, fx_write):
i = address
while i < end_address:
reg = self.registers[i]
if fx_write and not reg.access or reg.type == CellType.INVALID:
if (fx_write and not reg.access) or reg.type == CellType.INVALID:
return False
if not self.type_exception:
i += 1
Expand Down
4 changes: 2 additions & 2 deletions pymodbus/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@


__all__ = [
"ModbusPlusStatistics",
"ModbusDeviceIdentification",
"DeviceInformationFactory",
"ModbusDeviceIdentification",
"ModbusPlusStatistics",
]

import struct
Expand Down
8 changes: 4 additions & 4 deletions pymodbus/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"""

__all__ = [
"ModbusIOException",
"ParameterException",
"NotImplementedException",
"ConnectionException",
"NoSuchSlaveException",
"InvalidMessageReceivedException",
"MessageRegisterException",
"ModbusIOException",
"NoSuchSlaveException",
"NotImplementedException",
"ParameterException",
]


Expand Down
6 changes: 3 additions & 3 deletions pymodbus/framer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Framer."""
__all__ = [
"FramerBase",
"FramerType",
"FramerAscii",
"FramerBase",
"FramerRTU",
"FramerSocket",
"FramerTLS"
"FramerTLS",
"FramerType"
]

from pymodbus.framer.ascii import FramerAscii
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""

__all__ = [
"get_simulator_commandline",
"ModbusSerialServer",
"ModbusSimulatorServer",
"ModbusTcpServer",
Expand All @@ -20,6 +19,7 @@
"StartTcpServer",
"StartTlsServer",
"StartUdpServer",
"get_simulator_commandline",
]

from pymodbus.server.async_io import (
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/transport/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Transport."""
__all__ = [
"NULLMODEM_HOST",
"CommParams",
"CommType",
"ModbusProtocol",
"NULLMODEM_HOST",
]

from pymodbus.transport.transport import (
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ repl = [

simulator = [
"aiohttp>=3.8.6;python_version<'3.12'",
"aiohttp>=3.10.5;python_version>='3.12'"
"aiohttp>=3.10.6;python_version>='3.12'"
]
documentation = [
"recommonmark>=0.7.1",
Expand All @@ -72,7 +72,7 @@ development = [
"pytest-timeout>=2.3.1",
"pytest-xdist>=3.6.1",
"pytest-aiohttp>=1.0.5",
"ruff>=0.5.3",
"ruff>=0.8.2",
"twine>=5.1.1",
"types-Pygments",
"types-pyserial"
Expand Down

0 comments on commit 7572508

Please sign in to comment.