Skip to content

Commit dfc4bd8

Browse files
authored
Black corrections. (#986)
1 parent e1b2a18 commit dfc4bd8

File tree

13 files changed

+38
-38
lines changed

13 files changed

+38
-38
lines changed

examples/client_sync.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def run_sync_client(modbus_calls=None):
134134
"tcp": ["socket", 5020],
135135
"udp": ["socket", 5020],
136136
"serial": ["rtu", "/dev/ptyp0"],
137-
"tls": ["tls", 5020]
137+
"tls": ["tls", 5020],
138138
}
139139
FORMAT = "%(asctime)-15s %(levelname)-8s %(module)-15s:%(lineno)-8s %(message)s"
140140
logging.basicConfig(format=FORMAT)
@@ -143,7 +143,9 @@ def run_sync_client(modbus_calls=None):
143143

144144
def get_commandline():
145145
"""Read and validate command line arguments"""
146-
parser = argparse.ArgumentParser(description="Connect/disconnect a synchronous client.")
146+
parser = argparse.ArgumentParser(
147+
description="Connect/disconnect a synchronous client."
148+
)
147149
parser.add_argument(
148150
"--comm",
149151
choices=["tcp", "udp", "serial", "tls"],
@@ -164,7 +166,7 @@ def get_commandline():
164166
)
165167
parser.add_argument(
166168
"--port",
167-
help='the port to use',
169+
help="the port to use",
168170
type=int,
169171
)
170172
args = parser.parse_args()

examples/client_sync_extended_calls.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ def execute_diagnostic_requests(client):
105105
assert rr and not rr.isError() # test that calls was OK
106106

107107
_logger.info("Running ForceListenOnlyModeRequest")
108-
rr = client.execute(ForceListenOnlyModeRequest(unit=UNIT)) # does not send a response
108+
rr = client.execute(
109+
ForceListenOnlyModeRequest(unit=UNIT)
110+
) # does not send a response
109111
assert rr and not rr.isError() # test that calls was OK
110112

111113
_logger.info("Running ClearCountersRequest")

examples/common/async_asyncio_client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,7 @@ def start_loop(loop):
179179
def run_with_no_loop():
180180
"""Create a loop."""
181181
_logger.debug("---------------------RUN_WITH_NO_LOOP-----------------")
182-
loop, client = ModbusClient( # pylint: disable=unpacking-non-sequence
183-
port=5020
184-
)
182+
loop, client = ModbusClient(port=5020) # pylint: disable=unpacking-non-sequence
185183
loop.run_until_complete(start_async_test(client.protocol))
186184
loop.close()
187185
_logger.debug("--------DONE RUN_WITH_NO_LOOP-------------")

examples/contrib/deviceinfo_showcase_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ def run_sync_client():
9595
log.debug(rr)
9696

9797
print("Device Information : ")
98-
for key in information.keys(): # pylint: disable=consider-iterating-dictionary,consider-using-dict-items
98+
for (
99+
key
100+
) in (
101+
information.keys()
102+
): # pylint: disable=consider-iterating-dictionary,consider-using-dict-items
99103
print(key, information[key])
100104

101105
# ----------------------------------------------------------------------- #

examples/modbus_forwarder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ def get_commandline():
6060
)
6161
parser.add_argument(
6262
"--port",
63-
help='the port to use',
63+
help="the port to use",
6464
type=int,
6565
)
6666
parser.add_argument(
6767
"--port_client",
68-
help='the port to use',
68+
help="the port to use",
6969
type=int,
7070
)
7171
args = parser.parse_args()

examples/server_sync.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,8 @@ def setup_sync_server():
103103
ir=datablock,
104104
),
105105
0x03: ModbusSlaveContext(
106-
di=datablock,
107-
co=datablock,
108-
hr=datablock,
109-
ir=datablock,
110-
zero_mode=True
111-
)
106+
di=datablock, co=datablock, hr=datablock, ir=datablock, zero_mode=True
107+
),
112108
}
113109
else:
114110
context = ModbusSlaveContext(
@@ -180,7 +176,7 @@ def run_server():
180176
StartSerialServer(
181177
context=store, # Data storage
182178
identity=identity, # server identify
183-
timeout=.005, # waiting time for request to complete
179+
timeout=0.005, # waiting time for request to complete
184180
port=port, # serial port
185181
custom_functions=[], # allow custom handling
186182
framer=FRAMERS[framer], # The framer strategy to use
@@ -208,7 +204,7 @@ def run_server():
208204
handler=None, # handler for each session
209205
allow_reuse_address=True, # allow the reuse of an address
210206
certfile=None, # The cert file path for TLS (used if sslctx is None)
211-
sslctx=None, # The SSLContext to use for TLS (default None and auto create)
207+
sslctx=None, # The SSLContext to use for TLS (default None and auto create)
212208
keyfile=None, # The key file path for TLS (used if sslctx is None)
213209
password=None, # The password for for decrypting the private key file
214210
reqclicert=False, # Force the sever request client"s certificate
@@ -233,7 +229,7 @@ def run_server():
233229
"tcp": ("socket", 5020),
234230
"udp": ("socket", 5020),
235231
"serial": ("rtu", "/dev/ptyp0"),
236-
"tls": ("tls", 5020)
232+
"tls": ("tls", 5020),
237233
}
238234
FORMAT = "%(asctime)-15s %(levelname)-8s %(module)-15s:%(lineno)-8s %(message)s"
239235
logging.basicConfig(format=FORMAT)
@@ -263,7 +259,7 @@ def get_commandline():
263259
)
264260
parser.add_argument(
265261
"--port",
266-
help='the port to use',
262+
help="the port to use",
267263
type=int,
268264
)
269265
parser.add_argument(
@@ -274,7 +270,7 @@ def get_commandline():
274270
)
275271
parser.add_argument(
276272
"--slaves",
277-
help='(server only) number of slaves to respond to',
273+
help="(server only) number of slaves to respond to",
278274
type=int,
279275
)
280276
args = parser.parse_args()

pymodbus/client/asynchronous/tls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AsyncModbusTLSClient: # pylint: disable=too-few-public-methods
1616
from pymodbus.client.asynchronous.tls import AsyncModbusTLSClient
1717
"""
1818

19-
def __new__( # pylint: disable=too-many-arguments
19+
def __new__(
2020
cls,
2121
host="127.0.0.1",
2222
port=Defaults.TLSPort,

pymodbus/client/sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def _handle_abrupt_socket_close(self, size, data, duration):
360360

361361
def is_socket_open(self):
362362
"""Check if socket is open."""
363-
return (self.socket is not None)
363+
return self.socket is not None
364364

365365
def __str__(self):
366366
"""Build a string representation of the connection.

pymodbus/datastore/store.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ def reset(self):
8888
"""Reset the datastore to the initialized default value."""
8989
self.values = [ # pylint: disable=attribute-defined-outside-init
9090
self.default_value
91-
] * len(
92-
self.values
93-
)
91+
] * len(self.values)
9492

9593
def validate(self, address, count=1):
9694
"""Check to see if the request is in range.

pymodbus/diag_message.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ def decode(self, data):
6060
(
6161
self.sub_function_code, # pylint: disable=attribute-defined-outside-init
6262
self.message,
63-
) = struct.unpack(
64-
">HH", data
65-
)
63+
) = struct.unpack(">HH", data)
6664

6765
def get_response_pdu_size(self):
6866
"""Get response pdu size.

0 commit comments

Comments
 (0)