Skip to content

Commit 5ea7cd4

Browse files
authored
Merge branch 'main' into ruff
2 parents e8c5205 + 3c841cd commit 5ea7cd4

File tree

6 files changed

+456
-409
lines changed

6 files changed

+456
-409
lines changed

poetry.lock

Lines changed: 443 additions & 368 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pymodbus_repl/client/main.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from pymodbus.exceptions import ParameterException
1515
from pymodbus.transaction import (
1616
ModbusAsciiFramer,
17-
ModbusBinaryFramer,
1817
ModbusRtuFramer,
1918
ModbusSocketFramer,
2019
)
@@ -222,26 +221,11 @@ def run(self):
222221
@click.group("pymodbus-repl")
223222
@click.version_option(str(pymodbus_version), message=TITLE)
224223
@click.option("--verbose", is_flag=True, default=False, help="Verbose logs")
225-
@click.option(
226-
"--broadcast-support",
227-
is_flag=True,
228-
default=False,
229-
help="Support broadcast messages",
230-
)
231-
@click.option(
232-
"--retry-on-empty", is_flag=True, default=False, help="Retry on empty response"
233-
)
234-
@click.option(
235-
"--retry-on-error", is_flag=True, default=False, help="Retry on error response"
236-
)
237224
@click.option("--retries", default=3, help="Retry count")
238225
@click.pass_context
239226
def main(
240227
ctx,
241228
verbose,
242-
broadcast_support,
243-
retry_on_empty,
244-
retry_on_error,
245229
retries,
246230
):
247231
"""Run Main."""
@@ -253,9 +237,6 @@ def main(
253237
logging.basicConfig(format=use_format)
254238
_logger.setLevel(logging.DEBUG)
255239
ctx.obj = {
256-
"broadcast_enable": broadcast_support,
257-
"retry_on_empty": retry_on_empty,
258-
"retry_on_invalid": retry_on_error,
259240
"retries": retries,
260241
}
261242

@@ -381,8 +362,6 @@ def serial( # pylint: disable=too-many-arguments
381362
framer = ModbusAsciiFramer
382363
elif method == "rtu":
383364
framer = ModbusRtuFramer
384-
elif method == "binary":
385-
framer = ModbusBinaryFramer
386365
elif method == "socket":
387366
framer = ModbusSocketFramer
388367
else:

pymodbus_repl/client/mclient.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pymodbus.client import ModbusSerialClient as _ModbusSerialClient
77
from pymodbus.client import ModbusTcpClient as _ModbusTcpClient
88
from pymodbus.client.base import ModbusBaseSyncClient as _ModbusBaseSyncClient
9-
from pymodbus.diag_message import (
9+
from pymodbus.pdu.diag_message import (
1010
ChangeAsciiInputDelimiterRequest,
1111
ClearCountersRequest,
1212
ClearOverrunCountRequest,
@@ -27,11 +27,11 @@
2727
ReturnSlaveNoResponseCountRequest,
2828
)
2929
from pymodbus.exceptions import ModbusIOException
30-
from pymodbus.mei_message import (
30+
from pymodbus.pdu.mei_message import (
3131
ReadDeviceInformationRequest,
3232
ReadDeviceInformationResponse,
3333
)
34-
from pymodbus.other_message import (
34+
from pymodbus.pdu.other_message import (
3535
GetCommEventCounterRequest,
3636
GetCommEventCounterResponse,
3737
GetCommEventLogRequest,
@@ -42,7 +42,7 @@
4242
ReportSlaveIdResponse,
4343
)
4444
from pymodbus.pdu import ExceptionResponse, ModbusExceptions
45-
from pymodbus.register_write_message import MaskWriteRegisterResponse
45+
from pymodbus.pdu.register_write_message import MaskWriteRegisterResponse
4646

4747

4848
def make_response_dict(resp):

pymodbus_repl/lib/reactive.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
)
3838
from pymodbus.transaction import (
3939
ModbusAsciiFramer,
40-
ModbusBinaryFramer,
4140
ModbusRtuFramer,
4241
ModbusSocketFramer,
4342
ModbusTlsFramer,
@@ -56,8 +55,7 @@
5655
"rtu": ModbusRtuFramer,
5756
"tls": ModbusTlsFramer,
5857
"udp": ModbusSocketFramer,
59-
"ascii": ModbusAsciiFramer,
60-
"binary": ModbusBinaryFramer,
58+
"ascii": ModbusAsciiFramer
6159
}
6260

6361
DEFAULT_MANIPULATOR = {

pymodbus_repl/server/main.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import typer
1414
from pymodbus import pymodbus_apply_logging_config
15-
from pymodbus.framer.socket_framer import ModbusSocketFramer
15+
from pymodbus.transaction import ModbusSocketFramer
1616
from pymodbus.logging import Log
1717
from typing_extensions import Annotated
1818

@@ -44,12 +44,11 @@ class ModbusServerTypes(str, Enum):
4444
class ModbusFramerTypes(str, Enum):
4545
"""Framer types."""
4646

47-
# ["socket", "rtu", "tls", "ascii", "binary"]
47+
# ["socket", "rtu", "tls", "ascii"]
4848
socket = "socket" # pylint: disable=invalid-name
4949
rtu = "rtu" # pylint: disable=invalid-name
5050
tls = "tls" # pylint: disable=invalid-name
5151
ascii = "ascii" # pylint: disable=invalid-name
52-
binary = "binary" # pylint: disable=invalid-name
5352

5453

5554
def _completer(incomplete: str, valid_values: List[str]) -> List[str]:
@@ -62,13 +61,13 @@ def _completer(incomplete: str, valid_values: List[str]) -> List[str]:
6261

6362

6463
def framers(incomplete: str) -> List[str]:
65-
"""Return an autocompleted list of supported clouds."""
66-
_framers = ["socket", "rtu", "tls", "ascii", "binary"]
64+
"""Return an autocompleted list of supported servers."""
65+
_framers = ["socket", "rtu", "tls", "ascii"]
6766
return _completer(incomplete, _framers)
6867

6968

7069
def servers(incomplete: str) -> List[str]:
71-
"""Return an autocompleted list of supported clouds."""
70+
"""Return an autocompleted list of supported servers."""
7271
_servers = ["tcp", "serial", "tls", "udp"]
7372
return _completer(incomplete, _servers)
7473

@@ -101,9 +100,6 @@ def server(
101100
ctx: typer.Context,
102101
host: str = typer.Option("localhost", "--host", help="Host address"),
103102
web_port: int = typer.Option(8080, "--web-port", help="Web app port"),
104-
broadcast_support: bool = typer.Option(
105-
False, "-b", help="Support broadcast messages"
106-
),
107103
repl: bool = typer.Option(True, help="Enable/Disable repl for server"),
108104
verbose: bool = typer.Option(
109105
False, help="Run with debug logs enabled for pymodbus"
@@ -116,8 +112,7 @@ def server(
116112
ctx.obj = {
117113
"repl": repl,
118114
"host": host,
119-
"web_port": web_port,
120-
"broadcast_enable": broadcast_support,
115+
"web_port": web_port
121116
}
122117

123118

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[tool.poetry]
22
name = "pymodbus_repl"
3-
version = "2.0.3"
3+
version = "2.0.4"
44
description = "REPL (Read-Eval-Print Loop) tool for working with Modbus devices using the Pymodbus library."
55
authors = ["dhoomakethu <[email protected]>"]
66
readme = "README.md"
77
packages = [{include = "pymodbus_repl"}]
88
repository = "https://github.com/pymodbus-dev/repl"
99

1010
[tool.poetry.dependencies]
11-
python = "^3.8"
11+
python = ">=3.9.0,<4.0"
1212
typer = {extras = ["all"], version = "^0.9.0"}
1313
prompt-toolkit = "^3.0.43"
1414
pygments = "^2.17.2"

0 commit comments

Comments
 (0)