diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 5f1797e..3c1828d 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -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 diff --git a/meshtastic/ble_interface.py b/meshtastic/ble_interface.py index a3d076d..16d1997 100644 --- a/meshtastic/ble_interface.py +++ b/meshtastic/ble_interface.py @@ -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 diff --git a/meshtastic/stream_interface.py b/meshtastic/stream_interface.py index 471111b..abaef4a 100644 --- a/meshtastic/stream_interface.py +++ b/meshtastic/stream_interface.py @@ -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 diff --git a/meshtastic/tcp_interface.py b/meshtastic/tcp_interface.py index cff92ba..791b8c2 100644 --- a/meshtastic/tcp_interface.py +++ b/meshtastic/tcp_interface.py @@ -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 \ No newline at end of file + return None diff --git a/meshtastic/util.py b/meshtastic/util.py index fce9256..d7fd352 100644 --- a/meshtastic/util.py +++ b/meshtastic/util.py @@ -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?