Skip to content

Commit

Permalink
pre-commit run --all-files
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrudd2 committed Oct 17, 2023
1 parent f25e30d commit 6922fad
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 24 deletions.
22 changes: 8 additions & 14 deletions pymodbus/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,20 @@ def dict_property(store, index):
getter = lambda self: store( # pylint: disable=unnecessary-lambda-assignment
self
)[index]
setter = (
lambda self, value: store( # pylint: disable=unnecessary-lambda-assignment
self
).__setitem__(index, value)
)
setter = lambda self, value: store( # pylint: disable=unnecessary-lambda-assignment
self
).__setitem__(index, value)
elif isinstance(store, str):
getter = lambda self: self.__getattribute__( # pylint: disable=unnecessary-dunder-call,unnecessary-lambda-assignment
store
)[
index
]
)[index]
setter = lambda self, value: self.__getattribute__( # pylint: disable=unnecessary-dunder-call,unnecessary-lambda-assignment
store
).__setitem__(
index, value
)
).__setitem__(index, value)
else:
getter = lambda self: store[ # pylint: disable=unnecessary-lambda-assignment
index
]
getter = (
lambda self: store[index] # pylint: disable=unnecessary-lambda-assignment
)
setter = lambda self, value: store.__setitem__( # pylint: disable=unnecessary-lambda-assignment
index, value
)
Expand Down
3 changes: 1 addition & 2 deletions test/sub_messages/test_register_read_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def setup_method(self):
ReadWriteMultipleRegistersRequest(
write_registers=0xAB,
**arguments,
): b"\x00\x01\x00\x05\x00\x01\x00"
b"\x01\x02\x00\xAB",
): b"\x00\x01\x00\x05\x00\x01\x00" b"\x01\x02\x00\xAB",
}
self.response_read = {
ReadRegistersResponseBase(self.values): TEST_MESSAGE,
Expand Down
8 changes: 4 additions & 4 deletions test/sub_server/test_server_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,13 @@ async def test_async_udp_server_serve_forever_twice(self):

async def test_async_udp_server_roundtrip(self):
"""Test sending and receiving data on udp socket"""
expected_response = b"\x01\x00\x00\x00\x00\x05\x01\x03\x02\x00\x11" # value of 17 as per context
expected_response = (
b"\x01\x00\x00\x00\x00\x05\x01\x03\x02\x00\x11"
) # value of 17 as per context
BasicClient.dataTo = TEST_DATA # slave 1, read register
BasicClient.done = asyncio.Future()
await self.start_server(do_udp=True)
random_port = self.server.transport._sock.getsockname()[ # pylint: disable=protected-access
1
]
random_port = self.server.transport._sock.getsockname()[1] # pylint: disable=protected-access
transport, _ = await self.loop.create_datagram_endpoint(
BasicClient, remote_addr=("127.0.0.1", random_port)
)
Expand Down
6 changes: 2 additions & 4 deletions test/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ def test_calculate_expected_response_length(self):
self._tm.client = mock.MagicMock()
self._tm.client.framer = mock.MagicMock()
self._tm._set_adu_size() # pylint: disable=protected-access
assert (
not self._tm._calculate_response_length( # pylint: disable=protected-access
0
)
assert not self._tm._calculate_response_length( # pylint: disable=protected-access
0
)
self._tm.base_adu_size = 10
assert (
Expand Down

0 comments on commit 6922fad

Please sign in to comment.