Skip to content

Commit 0da4051

Browse files
pylint cleanups
1 parent 58d9039 commit 0da4051

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

meshtastic/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,8 @@ def export_config(interface) -> str:
10461046
else:
10471047
configObj["module_config"] = prefs
10481048

1049-
config_txt = "# start of Meshtastic configure yaml\n" #checkme - "config" (now changed to config_out) was used as a string here and a Dictionary above
1049+
config_txt = "# start of Meshtastic configure yaml\n" #checkme - "config" (now changed to config_out)
1050+
#was used as a string here and a Dictionary above
10501051
config_txt += yaml.dump(configObj)
10511052
print(config_txt)
10521053
return config_txt

meshtastic/ble_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import time
88
import io
99
from threading import Thread
10-
from typing import List, Optional, Tuple
10+
from typing import List, Optional
1111

1212
import google.protobuf
1313
from bleak import BleakClient, BleakScanner, BLEDevice

meshtastic/stream_interface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import time
77
import traceback
88

9-
import serial # type: ignore[import-untyped]
10-
119
from typing import Optional, cast
1210

11+
import serial # type: ignore[import-untyped]
12+
1313
from meshtastic.mesh_interface import MeshInterface
1414
from meshtastic.util import is_windows11, stripnl
1515

meshtastic/tcp_interface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _socket_shutdown(self) -> None:
4949
"""Shutdown the socket.
5050
Note: Broke out this line so the exception could be unit tested.
5151
"""
52-
if socket:
52+
if self.socket: #mian: please check that this should be "if self.socket:"
5353
cast(socket.socket, self.socket).shutdown(socket.SHUT_RDWR)
5454

5555
def myConnect(self) -> None:
@@ -82,4 +82,4 @@ def _readBytes(self, length) -> Optional[bytes]:
8282
if self.socket:
8383
return self.socket.recv(length)
8484
else:
85-
return None
85+
return None

meshtastic/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ def convert_mac_addr(val: bytes) -> Union[str, bytes]:
366366
val - base64 encoded value (ex: '/c0gFyhb'))
367367
returns: a string formatted like a mac address (ex: 'fd:cd:20:17:28:5b')
368368
"""
369-
if not re.match("[0-9a-f]{2}([-:]?)[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$", val): #FIXME - does the regex have to be bytes too to match val since val is bytes?
369+
if not re.match("[0-9a-f]{2}([-:]?)[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$", val): #FIXME - does the regex have to be bytes too to
370+
#match val since val is bytes?
370371
val_as_bytes: bytes = base64.b64decode(val)
371372
return hexstr(val_as_bytes)
372373
return val
@@ -650,7 +651,7 @@ def check_if_newer_version() -> Optional[str]:
650651
try:
651652
parsed_act_version = pkg_version.parse(act_version)
652653
parsed_pypi_version = pkg_version.parse(pypi_version)
653-
#Note: if handed "None" when we can't download the pypi_version,
654+
#Note: if handed "None" when we can't download the pypi_version,
654655
#this gets a TypeError:
655656
#"TypeError: expected string or bytes-like object, got 'NoneType'"
656657
#Handle that below?

0 commit comments

Comments
 (0)