pylint cleanups

This commit is contained in:
William Stearns committed 2024-10-10 23:49:20 -04:00
1 parent 58d9039a04
commit 0da405168f
5 files changed
+10 -8

No files matched your search

+2 -1
View File
@@ -1046,7 +1046,8 @@ def export_config(interface) -> str:
else:
configObj["module_config"] = prefs
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
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
config_txt += yaml.dump(configObj)
print(config_txt)
return config_txt
+1 -1
View File
@@ -7,7 +7,7 @@ import struct
import time
import io
from threading import Thread
from typing import List, Optional, Tuple
from typing import List, Optional
import google.protobuf
from bleak import BleakClient, BleakScanner, BLEDevice
+2 -2
View File
@@ -6,10 +6,10 @@ import threading
import time
import traceback
import serial # type: ignore[import-untyped]
from typing import Optional, cast
import serial # type: ignore[import-untyped]
from meshtastic.mesh_interface import MeshInterface
from meshtastic.util import is_windows11, stripnl
+2 -2
View File
@@ -49,7 +49,7 @@ class TCPInterface(StreamInterface):
"""Shutdown the socket.
Note: Broke out this line so the exception could be unit tested.
"""
if socket:
if self.socket: #mian: please check that this should be "if self.socket:"
cast(socket.socket, self.socket).shutdown(socket.SHUT_RDWR)
def myConnect(self) -> None:
@@ -82,4 +82,4 @@ class TCPInterface(StreamInterface):
if self.socket:
return self.socket.recv(length)
else:
return None
return None
+3 -2
View File
@@ -366,7 +366,8 @@ def convert_mac_addr(val: bytes) -> Union[str, bytes]:
val - base64 encoded value (ex: '/c0gFyhb'))
returns: a string formatted like a mac address (ex: 'fd:cd:20:17:28:5b')
"""
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?
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?
val_as_bytes: bytes = base64.b64decode(val)
return hexstr(val_as_bytes)
return val
@@ -650,7 +651,7 @@ def check_if_newer_version() -> Optional[str]:
try:
parsed_act_version = pkg_version.parse(act_version)
parsed_pypi_version = pkg_version.parse(pypi_version)
#Note: if handed "None" when we can't download the pypi_version,
#Note: if handed "None" when we can't download the pypi_version,
#this gets a TypeError:
#"TypeError: expected string or bytes-like object, got 'NoneType'"
#Handle that below?