From be80779b31271a6c6700973bc94458e7e7493b52 Mon Sep 17 00:00:00 2001 From: Alex Ruddick Date: Mon, 19 Feb 2024 12:16:20 -0600 Subject: [PATCH 1/2] re-order imports with ruff --- pymodbus_repl/client/helper.py | 1 - pymodbus_repl/client/main.py | 14 +++++++------- pymodbus_repl/server/main.py | 4 ++-- tests/__init__.py | 1 + 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pymodbus_repl/client/helper.py b/pymodbus_repl/client/helper.py index 95bedeb..30caf31 100644 --- a/pymodbus_repl/client/helper.py +++ b/pymodbus_repl/client/helper.py @@ -12,7 +12,6 @@ from prompt_toolkit import print_formatted_text from prompt_toolkit.formatted_text import HTML, PygmentsTokens from pygments.lexers.data import JsonLexer - from pymodbus.payload import BinaryPayloadDecoder, Endian diff --git a/pymodbus_repl/client/main.py b/pymodbus_repl/client/main.py index 0da234f..de61a59 100644 --- a/pymodbus_repl/client/main.py +++ b/pymodbus_repl/client/main.py @@ -11,15 +11,8 @@ from prompt_toolkit.lexers import PygmentsLexer from prompt_toolkit.styles import Style from pygments.lexers.python import PythonLexer - from pymodbus import __version__ as pymodbus_version from pymodbus.exceptions import ParameterException -from pymodbus_repl.client.completer import ( - CmdCompleter, - has_selected_completion, -) -from pymodbus_repl.client.helper import CLIENT_ATTRIBUTES, Result -from pymodbus_repl.client.mclient import ModbusSerialClient, ModbusTcpClient from pymodbus.transaction import ( ModbusAsciiFramer, ModbusBinaryFramer, @@ -27,6 +20,13 @@ ModbusSocketFramer, ) +from pymodbus_repl.client.completer import ( + CmdCompleter, + has_selected_completion, +) +from pymodbus_repl.client.helper import CLIENT_ATTRIBUTES, Result +from pymodbus_repl.client.mclient import ModbusSerialClient, ModbusTcpClient + _logger = logging.getLogger() diff --git a/pymodbus_repl/server/main.py b/pymodbus_repl/server/main.py index c15b838..f1cfd13 100644 --- a/pymodbus_repl/server/main.py +++ b/pymodbus_repl/server/main.py @@ -10,17 +10,17 @@ from pathlib import Path import typer - from pymodbus import pymodbus_apply_logging_config from pymodbus.framer.socket_framer import ModbusSocketFramer from pymodbus.logging import Log -from pymodbus_repl.server.cli import run_repl from pymodbus.server.reactive.default_config import DEFAULT_CONFIG from pymodbus.server.reactive.main import ( DEFAULT_FRAMER, ReactiveServer, ) +from pymodbus_repl.server.cli import run_repl + CANCELLED_ERROR = asyncio.exceptions.CancelledError CONTEXT_SETTING = {"allow_extra_args": True, "ignore_unknown_options": True} diff --git a/tests/__init__.py b/tests/__init__.py index e69de29..a8e0472 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1 @@ +"""Dummy.""" From e1bd30e86d9e4485eebdf1cbd7283c4d6590e5cb Mon Sep 17 00:00:00 2001 From: Alex Ruddick Date: Mon, 19 Feb 2024 23:06:49 -0600 Subject: [PATCH 2/2] fix tests --- tests/__init__.py | 1 - tests/test_repl_client.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 tests/__init__.py diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index a8e0472..0000000 --- a/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Dummy.""" diff --git a/tests/test_repl_client.py b/tests/test_repl_client.py index 5f39650..0058c28 100755 --- a/tests/test_repl_client.py +++ b/tests/test_repl_client.py @@ -1,9 +1,10 @@ """Test client sync.""" from contextlib import suppress -from pymodbus.repl.client.main import _process_args from pymodbus.server.reactive.default_config import DEFAULT_CONFIG +from pymodbus_repl.client.main import _process_args + def test_repl_default_config(): """Test default config can be loaded."""