Skip to content

Commit

Permalink
pylint.
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Jun 22, 2024
1 parent a69d25f commit 7c5b075
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions examples/client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def setup_async_client(description=None, cmdline=None):
server=False, description=description, cmdline=cmdline
)
_logger.info("### Create client object")
client = None
if args.comm == "tcp":
client = modbusClient.AsyncModbusTcpClient(
args.host,
Expand Down
1 change: 1 addition & 0 deletions examples/client_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def setup_sync_client(description=None, cmdline=None):
cmdline=cmdline,
)
_logger.info("### Create client object")
client = None
if args.comm == "tcp":
client = modbusClient.ModbusTcpClient(
args.host,
Expand Down
2 changes: 2 additions & 0 deletions examples/server_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def setup_server(description=None, context=None, cmdline=None):
args = helper.get_commandline(server=True, description=description, cmdline=cmdline)
if context:
args.context = context
datablock = None
if not args.context:
_logger.info("### Create datastore")
# The datastores only respond to the addresses that are initialized
Expand Down Expand Up @@ -153,6 +154,7 @@ async def run_async_server(args):
"""Run server."""
txt = f"### start ASYNC server, listening on {args.port} - {args.comm}"
_logger.info(txt)
server = None
if args.comm == "tcp":
address = (args.host if args.host else "", args.port if args.port else None)
server = await StartAsyncTcpServer(
Expand Down
1 change: 1 addition & 0 deletions examples/server_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def run_sync_server(args):
"""Run server."""
txt = f"### start SYNC server, listening on {args.port} - {args.comm}"
_logger.info(txt)
server = None
if args.comm == "tcp":
address = ("", args.port) if args.port else None
server = StartTcpServer(
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/framer/socket_framer.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def decode_data(self, data):
}
return {}

def frameProcessIncomingPacket(self, single, callback, slave, tid=None, **kwargs): # noqa: C901
def frameProcessIncomingPacket(self, single, callback, slave, tid=None, **kwargs):
"""Process new packet pattern.
This takes in a new request packet, adds it to the current
Expand Down
2 changes: 1 addition & 1 deletion test/sub_client/test_client_sync.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Test client sync."""
import socket
from itertools import count
from test.conftest import mockSocket
from unittest import mock

import pytest
Expand All @@ -22,6 +21,7 @@
ModbusSocketFramer,
ModbusTlsFramer,
)
from test.conftest import mockSocket


# ---------------------------------------------------------------------------#
Expand Down
2 changes: 1 addition & 1 deletion test/sub_function_codes/test_bit_read_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* Read Coils
"""
import struct
from test.conftest import MockContext

from pymodbus.bit_read_message import (
ReadBitsRequestBase,
Expand All @@ -16,6 +15,7 @@
ReadDiscreteInputsRequest,
)
from pymodbus.pdu import ModbusExceptions
from test.conftest import MockContext


res = [True] * 21
Expand Down
3 changes: 1 addition & 2 deletions test/sub_function_codes/test_bit_write_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
* Read/Write Discretes
* Read Coils
"""
from test.conftest import FakeList, MockContext

from pymodbus.bit_write_message import (
WriteMultipleCoilsRequest,
WriteMultipleCoilsResponse,
WriteSingleCoilRequest,
WriteSingleCoilResponse,
)
from pymodbus.pdu import ModbusExceptions
from test.conftest import FakeList, MockContext


# ---------------------------------------------------------------------------#
Expand Down
3 changes: 1 addition & 2 deletions test/sub_function_codes/test_register_read_messages.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""Test register read messages."""
from test.conftest import FakeList, MockContext

from pymodbus.pdu import ModbusExceptions
from pymodbus.register_read_message import (
ReadHoldingRegistersRequest,
Expand All @@ -12,6 +10,7 @@
ReadWriteMultipleRegistersRequest,
ReadWriteMultipleRegistersResponse,
)
from test.conftest import FakeList, MockContext


TEST_MESSAGE = b"\x06\x00\x0a\x00\x0b\x00\x0c"
Expand Down
3 changes: 1 addition & 2 deletions test/sub_function_codes/test_register_write_messages.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""Test register write messages."""
from test.conftest import MockContext, MockLastValuesContext

from pymodbus.payload import BinaryPayloadBuilder, Endian
from pymodbus.pdu import ModbusExceptions
from pymodbus.register_write_message import (
Expand All @@ -11,6 +9,7 @@
WriteSingleRegisterRequest,
WriteSingleRegisterResponse,
)
from test.conftest import MockContext, MockLastValuesContext


# ---------------------------------------------------------------------------#
Expand Down
3 changes: 1 addition & 2 deletions test/test_file_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* Read/Write Discretes
* Read Coils
"""
from test.conftest import MockContext

from pymodbus.file_message import (
FileRecord,
ReadFifoQueueRequest,
Expand All @@ -18,6 +16,7 @@
WriteFileRecordResponse,
)
from pymodbus.pdu import ModbusExceptions
from test.conftest import MockContext # pylint: disable=wrong-import-order


TEST_MESSAGE = b"\x00\n\x00\x08\x00\x01\x00\x02\x00\x03\x00\x04"
Expand Down

0 comments on commit 7c5b075

Please sign in to comment.