Skip to content

Commit b14f325

Browse files
authored
Activate pylint enable=all, to give max. control. (#872)
1 parent 18aa463 commit b14f325

File tree

18 files changed

+60
-55
lines changed

18 files changed

+60
-55
lines changed

.pylintrc

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,14 @@ fail-on=
7878
# confidence=
7979

8080
# Enable/Disable the message/report/category/checker with the given id(s).
81-
enable=
82-
attribute-defined-outside-init,
83-
fixme,
84-
invalid-name,
85-
missing-docstring,
86-
no-self-use,
87-
protected-access,
88-
too-few-public-methods,
81+
enable=all
8982

9083
disable=
91-
duplicate-code,
92-
logging-too-many-args,
93-
use-symbolic-message-instead,
94-
useless-suppression,
95-
format # handled by black
84+
duplicate-code, # TBD
85+
file-ignored, # ONLY to be used with extreme care.
86+
format, # NOT wanted, handled by black
87+
locally-disabled, # NOT wanted
88+
suppressed-message, # NOT wanted
9689

9790

9891
[REPORTS]

doc/api/pydoc/build.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/usr/bin/env python3 # pylint: disable-all
1+
#!/usr/bin/env python3
2+
# pylint: skip-file
23
"""Pydoc sub-class for generating documentation for entire packages.
34
45
Taken from: http://pyopengl.sourceforge.net/pydoc/OpenGLContext.pydoc.pydoc2.html

examples/common/async_asyncio_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ def run_with_not_running_loop():
131131
loop = asyncio.new_event_loop()
132132
assert not loop.is_running() # nosec
133133
asyncio.set_event_loop(loop)
134-
new_loop, client = ModbusClient(schedulers.ASYNC_IO, # NOSONAR pylint: disable=unpacking-non-sequence
135-
port=5020, loop=loop)
134+
new_loop, client = ModbusClient( # NOSONAR pylint: disable=unpacking-non-sequence
135+
schedulers.ASYNC_IO,
136+
port=5020, loop=loop)
136137
loop.run_until_complete(start_async_test(client.protocol))
137138
loop.close()
138139
_logger.debug("--------------RUN_WITH_NOT_RUNNING_LOOP---------------")

examples/contrib/concurrent_client.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,19 @@ def _client_worker_process(factory, input_queue, output_queue, is_shutdown):
8787
:param output_queue: The queue to place client responses
8888
:param is_shutdown: Condition variable marking process shutdown
8989
"""
90-
log.info("starting up worker : %s", threading.current_thread())
90+
txt = f"starting up worker : {threading.current_thread()}"
91+
log.info(txt)
9192
my_client = factory()
9293
while not is_shutdown.is_set():
9394
try:
9495
workitem = input_queue.get(timeout=1)
95-
log.debug("dequeue worker request: %s", workitem)
96+
txt = f"dequeue worker request: {workitem}"
97+
log.debug(txt)
9698
if not workitem:
9799
continue
98100
try:
99-
log.debug("executing request on thread: %s", workitem)
101+
txt = f"executing request on thread: {workitem}"
102+
log.debug(txt)
100103
result = my_client.execute(workitem.request)
101104
output_queue.put(WorkResponse(False, workitem.work_id, result))
102105
except Exception as exc: # pylint: disable=broad-except
@@ -106,7 +109,8 @@ def _client_worker_process(factory, input_queue, output_queue, is_shutdown):
106109
workitem.work_id, exc))
107110
except Exception: # nosec pylint: disable=broad-except
108111
pass
109-
log.info("request worker shutting down: %s", threading.current_thread())
112+
txt = f"request worker shutting down: {threading.current_thread()}"
113+
log.info(txt)
110114

111115

112116
def _manager_worker_process(output_queue, my_futures, is_shutdown):
@@ -124,12 +128,14 @@ def _manager_worker_process(output_queue, my_futures, is_shutdown):
124128
:param futures: The mapping of tid -> future
125129
:param is_shutdown: Condition variable marking process shutdown
126130
"""
127-
log.info("starting up manager worker: %s", threading.current_thread())
131+
txt = f"starting up manager worker: {threading.current_thread()}"
132+
log.info(txt)
128133
while not is_shutdown.is_set():
129134
try:
130135
workitem = output_queue.get()
131136
my_future = my_futures.get(workitem.work_id, None)
132-
log.debug("dequeue manager response: %s", workitem)
137+
txt = f"dequeue manager response: {workitem}"
138+
log.debug(txt)
133139
if not my_future:
134140
continue
135141
if workitem.is_exception:
@@ -227,7 +233,8 @@ def execute_silently(self, request):
227233

228234
def client_factory():
229235
"""Client factory."""
230-
log.debug("creating client for: %s", threading.current_thread())
236+
txt = f"creating client for: {threading.current_thread()}"
237+
log.debug(txt)
231238
my_client = ModbusTcpClient('127.0.0.1', port=5020)
232239
my_client.connect()
233240
return client
@@ -238,6 +245,7 @@ def client_factory():
238245
futures = [client.read_coils(i * 8, 8) for i in range(10)]
239246
log.info("waiting on futures to complete")
240247
for future in futures:
241-
log.info("future result: %s", future.result(timeout=1))
248+
txt = f"future result: {future.result(timeout=1)}"
249+
log.info(txt)
242250
finally:
243251
client.shutdown()

pymodbus/client/asynchronous/factory/serial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def io_loop_factory(port=None, framer=None, **kwargs):
7070
"""
7171
from tornado.ioloop import IOLoop # pylint: disable=import-outside-toplevel
7272
from pymodbus.client.asynchronous.tornado import ( # pylint: disable=import-outside-toplevel
73-
AsyncModbusSerialClient as Client) # pylint: disable=import-outside-toplevel
73+
AsyncModbusSerialClient as Client)
7474

7575
ioloop = IOLoop()
7676
protocol = EventLoopThread("ioloop", ioloop.start, ioloop.stop)

pymodbus/client/asynchronous/tornado/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,7 @@ def _on_receive(fd, events):
416416

417417
if self.timeout:
418418
self.timeout_handle = self.io_loop.add_timeout( # pylint: disable=attribute-defined-outside-init
419-
time.time() + self.timeout,
420-
_on_timeout) # pylint: disable=attribute-defined-outside-init
419+
time.time() + self.timeout, _on_timeout)
421420
self._send_packet(packet, callback=_on_write_done)
422421

423422
return response

pymodbus/device.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,13 @@ def __str__(self):
275275
# -------------------------------------------------------------------------#
276276
# Properties
277277
# -------------------------------------------------------------------------#
278-
VendorName = dict_property(lambda s: s.__data, 0) # NOSONAR pylint: disable=protected-access,invalid-name
279-
ProductCode = dict_property(lambda s: s.__data, 1) # NOSONAR pylint: disable=protected-access,invalid-name
280-
MajorMinorRevision = dict_property(lambda s: s.__data, 2) # NOSONAR pylint: disable=protected-access,invalid-name
281-
VendorUrl = dict_property(lambda s: s.__data, 3) # NOSONAR pylint: disable=protected-access,invalid-name
282-
ProductName = dict_property(lambda s: s.__data, 4) # NOSONAR pylint: disable=protected-access,invalid-name
283-
ModelName = dict_property(lambda s: s.__data, 5) # NOSONAR pylint: disable=protected-access,invalid-name
284-
UserApplicationName = dict_property(lambda s: s.__data, 6) # NOSONAR pylint: disable=protected-access,invalid-name
278+
VendorName = dict_property(lambda s: s.__data, 0) # NOSONAR pylint: disable=protected-access
279+
ProductCode = dict_property(lambda s: s.__data, 1) # NOSONAR pylint: disable=protected-access
280+
MajorMinorRevision = dict_property(lambda s: s.__data, 2) # NOSONAR pylint: disable=protected-access
281+
VendorUrl = dict_property(lambda s: s.__data, 3) # NOSONAR pylint: disable=protected-access
282+
ProductName = dict_property(lambda s: s.__data, 4) # NOSONAR pylint: disable=protected-access
283+
ModelName = dict_property(lambda s: s.__data, 5) # NOSONAR pylint: disable=protected-access
284+
UserApplicationName = dict_property(lambda s: s.__data, 6) # NOSONAR pylint: disable=protected-access
285285

286286

287287
class DeviceInformationFactory(Singleton): # pylint: disable=too-few-public-methods

pymodbus/diag_message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def decode(self, data):
5757
5858
:param data: The data to decode into the function code
5959
"""
60-
self.sub_function_code, self.message = struct.unpack('>HH', data) # pylint: disable=W0201
60+
self.sub_function_code, self.message = struct.unpack('>HH', data) # noqa E501 pylint: disable=attribute-defined-outside-init
6161

6262
def get_response_pdu_size(self):
6363
"""Get response pdu size.

pymodbus/factory.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ class ServerDecoder(IModbusDecoder):
166166
def __init__(self):
167167
"""Initialize the client lookup tables."""
168168
functions = set(f.function_code for f in self.__function_table)
169-
self.__lookup = dict([(f.function_code, f) for f in self.__function_table]) # pylint: disable=R1717
169+
self.__lookup = dict( # pylint: disable=consider-using-dict-comprehension
170+
[(f.function_code, f) for f in self.__function_table])
170171
self.__sub_lookup = dict((f, {}) for f in functions)
171172
for f in self.__sub_function_table:
172173
self.__sub_lookup[f.function_code][f.sub_function_code] = f

pymodbus/payload.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,9 @@ def bit_chunks(cls, coils, size=8):
311311
return chunks
312312

313313
@classmethod
314-
def fromCoils(cls, coils, byteorder=Endian.Little, wordorder=Endian.Big): # NOSONAR pylint: disable=C0103,W0613
314+
def fromCoils(cls, # NOSONAR pylint: disable=invalid-name
315+
coils, byteorder=Endian.Little,
316+
wordorder=Endian.Big): # NOSONAR pylint: disable=unused-argument
315317
"""Initialize a payload decoder with the result of reading of coils.
316318
317319
The coils are treated as a list of bit(boolean) values.

0 commit comments

Comments
 (0)