Skip to content

Commit b864066

Browse files
committed
Fix some outstanding pylint issues (or disable the checks)
1 parent 0528a6f commit b864066

10 files changed

Lines changed: 17 additions & 17 deletions

File tree

meshtastic/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ def initParser():
12601260
help="Request telemetry from a node. "
12611261
"You need pass the destination ID as argument with '--dest'. "
12621262
"For repeaters, the nodeNum is required.",
1263-
action="store_true",
1263+
action="store_true",
12641264
)
12651265

12661266
parser.add_argument(

meshtastic/globals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def getInstance():
2424
def __init__(self):
2525
"""Constructor for the Globals CLass"""
2626
if Globals.__instance is not None:
27-
raise Exception("This class is a singleton")
27+
raise Exception("This class is a singleton") # pylint: disable=W0719
2828
else:
2929
Globals.__instance = self
3030
self.args = None

meshtastic/mesh_interface.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
BROADCAST_ADDR,
2424
BROADCAST_NUM,
2525
LOCAL_ADDR,
26-
OUR_APP_VERSION,
2726
ResponseHandler,
2827
protocols,
2928
publishingThread,
@@ -440,7 +439,7 @@ def sendTelemetry(self, destinationId=BROADCAST_ADDR, wantResponse=False):
440439
destinationId = int(destinationId[1:], 16)
441440
else:
442441
destinationId = int(destinationId)
443-
442+
444443
self.sendData(
445444
r,
446445
destinationId=destinationId,
@@ -469,7 +468,7 @@ def onResponseTelemetry(self, p):
469468
)
470469
if telemetry.device_metrics.air_util_tx is not None:
471470
print(f"Transmit air utilization: {telemetry.device_metrics.air_util_tx:.2f}%")
472-
471+
473472
elif p["decoded"]["portnum"] == 'ROUTING_APP':
474473
if p["decoded"]["routing"]["errorReason"] == 'NO_RESPONSE':
475474
our_exit("No response from node. At least firmware 2.1.22 is required on the destination node.")
@@ -556,7 +555,7 @@ def waitForTraceRoute(self, waitFactor):
556555
success = self._timeout.waitForTraceRoute(waitFactor, self._acknowledgment)
557556
if not success:
558557
raise Exception("Timed out waiting for traceroute")
559-
558+
560559
def waitForTelemetry(self):
561560
"""Wait for telemetry"""
562561
success = self._timeout.waitForTelemetry(self._acknowledgment)

meshtastic/node.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def onResponseRequestSettings(self, p):
115115
print(f"{str(camel_to_snake(field))}:\n{str(config_values)}")
116116

117117
def requestConfig(self, configType):
118+
"""Request the config from the node via admin message"""
118119
if self == self.iface.localNode:
119120
onResponse = None
120121
else:
@@ -688,9 +689,6 @@ def onResponseRequestChannel(self, p):
688689
logging.debug(f"Received channel {stripnl(c)}")
689690
index = c.index
690691

691-
# for stress testing, we can always download all channels
692-
fastChannelDownload = True
693-
694692
if index >= 8 - 1:
695693
logging.debug("Finished downloading channels")
696694

@@ -703,6 +701,7 @@ def onResponseRequestChannel(self, p):
703701
self._requestChannel(index + 1)
704702

705703
def onAckNak(self, p):
704+
"""Informative handler for ACK/NAK responses"""
706705
if p["decoded"]["routing"]["errorReason"] != "NONE":
707706
print(
708707
f'Received a NAK, error reason: {p["decoded"]["routing"]["errorReason"]}'

meshtastic/stream_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, debugOut=None, noProto=False, connectNow=True):
3232
"""
3333

3434
if not hasattr(self, "stream") and not noProto:
35-
raise Exception(
35+
raise Exception( # pylint: disable=W0719
3636
"StreamInterface is now abstract (to update existing code create SerialInterface instead)"
3737
)
3838
self._rxBuf = bytes() # empty

meshtastic/tests/test_main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
tunnelMain,
2424
)
2525

26-
from ..channel_pb2 import Channel
26+
from ..channel_pb2 import Channel # pylint: disable=E0611
2727

2828
# from ..ble_interface import BLEInterface
2929
from ..node import Node
@@ -388,7 +388,7 @@ def test_main_onConnected_exception(capsys):
388388
Globals.getInstance().set_args(sys.argv)
389389

390390
def throw_an_exception(junk):
391-
raise Exception("Fake exception.")
391+
raise Exception("Fake exception.") # pylint: disable=W0719
392392

393393
iface = MagicMock(autospec=SerialInterface)
394394
with patch("meshtastic.serial_interface.SerialInterface", return_value=iface):

meshtastic/tests/test_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import pytest
88

99
# from ..admin_pb2 import AdminMessage
10-
from ..channel_pb2 import Channel
10+
from ..channel_pb2 import Channel # pylint: disable=E0611
1111
from ..node import Node
1212
from ..serial_interface import SerialInterface
1313

meshtastic/tests/test_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def test_catchAndIgnore(caplog):
177177
"""Test catchAndIgnore() does not actually throw an exception, but just logs"""
178178

179179
def some_closure():
180-
raise Exception("foo")
180+
raise Exception("foo") # pylint: disable=W0719
181181

182182
with caplog.at_level(logging.DEBUG):
183183
catchAndIgnore("something", some_closure)

meshtastic/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def stripnl(s):
109109

110110
def fixme(message):
111111
"""Raise an exception for things that needs to be fixed"""
112-
raise Exception(f"FIXME: {message}")
112+
raise Exception(f"FIXME: {message}") # pylint: disable=W0719
113113

114114

115115
def catchAndIgnore(reason, closure):
@@ -193,7 +193,7 @@ def waitForTraceRoute(self, waitFactor, acknowledgment, attr="receivedTraceRoute
193193
return True
194194
time.sleep(self.sleepInterval)
195195
return False
196-
196+
197197
def waitForTelemetry(self, acknowledgment):
198198
"""Block until telemetry response is received. Returns True if telemetry response has been received."""
199199
self.reset()

meshtastic/version.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
"""Version lookup utilities, isolated for cleanliness"""
12
import sys
23
try:
34
from importlib.metadata import version
45
except:
56
import pkg_resources
67

78
def get_active_version():
9+
"""Get the currently active version using importlib, or pkg_resources if we must"""
810
if "importlib.metadata" in sys.modules:
911
return version("meshtastic")
1012
else:
11-
return pkg_resources.get_distribution("meshtastic").version
13+
return pkg_resources.get_distribution("meshtastic").version # pylint: disable=E0601

0 commit comments

Comments
 (0)