Skip to content

Commit 5d44e2f

Browse files
authored
Active pylint missing-docstring. (#850)
1 parent 016d97a commit 5d44e2f

File tree

19 files changed

+42
-8
lines changed

19 files changed

+42
-8
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ fail-on=
8181
enable=
8282
attribute-defined-outside-init,
8383
fixme,
84+
missing-docstring,
8485
protected-access,
8586
too-few-public-methods,
8687
useless-suppression
@@ -89,7 +90,6 @@ disable=
8990
duplicate-code,
9091
invalid-name,
9192
logging-too-many-args,
92-
missing-docstring,
9393
use-symbolic-message-instead,
9494
format # handled by black
9595

examples/common/async_tornado_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def on_done(f):
4747

4848

4949
def _print(value):
50+
""" Internal print. """
5051
if hasattr(value, "bits"):
5152
result = value.bits
5253
elif hasattr(value, "registers"):

examples/common/async_tornado_client_serial.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def on_done(f):
5454

5555

5656
def _print(value):
57+
""" Internal print """
5758
if hasattr(value, "bits"):
5859
result = value.bits
5960
elif hasattr(value, "registers"):

examples/contrib/thread_safe_datastore.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def __init__(self):
5151
self.writer = False # is there a current writer
5252

5353
def __is_pending_writer(self):
54+
""" Internal is pending writer. """
5455
return (self.writer # if there is a current writer
5556
or (self.queue # or if there is a waiting writer
5657
and (self.queue[0] != self.read_condition)))

pymodbus/__init__.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"""
1212

1313
import logging as __logging
14+
from logging import NullHandler as __null
1415
import pymodbus.version as __version
1516
__version__ = __version.version.short()
1617
__author__ = 'Galen Collins'
@@ -19,11 +20,4 @@
1920
#---------------------------------------------------------------------------#
2021
# Block unhandled logging
2122
#---------------------------------------------------------------------------#
22-
try:
23-
from logging import NullHandler as __null
24-
except ImportError:
25-
class __null(__logging.Handler): # pylint: disable=invalid-name
26-
def emit(self, record):
27-
pass
28-
2923
__logging.getLogger(__name__).addHandler(__null())

pymodbus/client/asynchronous/async_io/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ def _create_protocol(self):
270270
return protocol
271271

272272
async def _connect(self):
273+
""" Internal connect. """
273274
_logger.debug('Connecting.')
274275
try:
275276
transport, protocol = await self.loop.create_connection(
@@ -311,6 +312,7 @@ def protocol_lost_connection(self, protocol):
311312

312313

313314
async def _reconnect(self):
315+
""" Internal reconnect. """
314316
txt = f"Waiting {self.delay_ms} ms before next connection attempt."
315317
_logger.debug(txt)
316318
await asyncio.sleep(self.delay_ms / 1000)
@@ -528,6 +530,7 @@ def _create_protocol(self, host=None, port=0):
528530

529531

530532
async def _connect(self):
533+
""" Internal connect. """
531534
_logger.debug('Connecting.')
532535
try:
533536
endpoint = await self.loop.create_datagram_endpoint(
@@ -571,6 +574,7 @@ def protocol_lost_connection(self, protocol):
571574
'callback called while not connected.')
572575

573576
async def _reconnect(self):
577+
""" Internal reconnect. """
574578
txt = f"Waiting {self.delay_ms} ms before next connection attempt."
575579
_logger.debug(txt)
576580
await asyncio.sleep(self.delay_ms / 1000)
@@ -705,12 +709,14 @@ def stop(self):
705709
self.protocol.transport.close()
706710

707711
def _create_protocol(self):
712+
""" Internal create protocol. """
708713
protocol = self.protocol_class(framer=self.framer)
709714
protocol.factory = self
710715
return protocol
711716

712717
@property
713718
def _connected(self):
719+
""" Internal connected. """
714720
return self._connected_event.is_set()
715721

716722
async def connect(self):

pymodbus/client/sync.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def trace(self, writeable):
144144
self._debugfd = writeable
145145

146146
def _dump(self, data):
147+
""" Internal dump. """
147148
fd = self._debugfd if self._debugfd else sys.stdout
148149
try:
149150
fd.write(hexlify_packets(data))
@@ -218,6 +219,7 @@ def close(self):
218219
self.socket = None
219220

220221
def _check_read_buffer(self):
222+
""" Internal check read buffer. """
221223
time_ = time.time()
222224
end = time_ + self.timeout
223225
data = None
@@ -656,6 +658,7 @@ def close(self):
656658
self.socket = None
657659

658660
def _in_waiting(self):
661+
""" Internal _in_waiting. """
659662
in_waiting = ("in_waiting" if hasattr(
660663
self.socket, "in_waiting") else "inWaiting")
661664

@@ -699,6 +702,7 @@ def _send(self, request):
699702
return 0
700703

701704
def _wait_for_data(self):
705+
""" Internal wait for data. """
702706
size = 0
703707
more_data = False
704708
if self.timeout is not None and self.timeout:

pymodbus/client/sync_diag.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def _recv(self, size):
130130
raise ConnectionException from exc
131131

132132
def _log_delayed_response(self, result_len, size, delay):
133+
""" Internal log delayed response. """
133134
if not size and result_len > 0:
134135
_logger.info(self.timelimit_read_msg, delay, result_len)
135136
elif ((not result_len) or (size and result_len < size)) and delay >= self.timeout:

pymodbus/datastore/database/sql_datastore.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def _build_set(self, type, offset, values, prefix=''): # pylint: disable=no-self
131131
return result
132132

133133
def _check(self, type, offset, values): #NOSONAR pylint: disable=unused-argument,redefined-builtin
134+
""" Internal check. """
134135
result = self._get(type, offset, count=1)
135136
return False if len(result) > 0 else True # pylint: disable=simplifiable-if-expression
136137

pymodbus/datastore/store.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ def getValues(self, address, count=1):
262262
return [self.values[i] for i in range(address, address + count)]
263263

264264
def _process_values(self, values):
265+
""" Internal process values. """
265266
def _process_as_dict(values):
266267
for idx, val in iter(values.items()):
267268
if isinstance(val, (list, tuple)):

0 commit comments

Comments
 (0)