Skip to content

Commit 6194e41

Browse files
committed
fix linter warnings
1 parent 532ca54 commit 6194e41

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

meshtastic/__main__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,6 @@ def common():
10441044
for x in BLEInterface.scan():
10451045
print(f"Found: name='{x.name}' address='{x.address}'")
10461046
meshtastic.util.our_exit("BLE scan finished", 0)
1047-
return
10481047
elif args.ble:
10491048
client = BLEInterface(args.ble_dest, debugOut=logfile, noProto=args.noproto, noNodes=args.no_nodes)
10501049
elif args.host:
@@ -1122,7 +1121,7 @@ def addConnectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParse
11221121
"--ble-dest",
11231122
help="The BLE device address or name to connect to",
11241123
default=None,
1125-
)
1124+
)
11261125

11271126
return parser
11281127

meshtastic/ble_interface.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
from typing import Optional
1010

1111
from bleak import BleakClient, BleakScanner, BLEDevice
12-
from print_color import print
12+
import print_color
1313

1414
from meshtastic.mesh_interface import MeshInterface
15-
from meshtastic.util import our_exit
1615

1716
SERVICE_UUID = "6ba1b218-15a8-461f-9fa8-5dcae273eafd"
1817
TORADIO_UUID = "f75c76d2-129e-4dad-a1dd-7866124401e7"
@@ -27,8 +26,6 @@ class BLEInterface(MeshInterface):
2726
class BLEError(Exception):
2827
"""An exception class for BLE errors."""
2928

30-
pass
31-
3229
def __init__(
3330
self,
3431
address: Optional[str],
@@ -85,15 +82,15 @@ def from_num_handler(self, _, b): # pylint: disable=C0116
8582
async def log_radio_handler(self, _, b): # pylint: disable=C0116
8683
log_radio = b.decode("utf-8").replace("\n", "")
8784
if log_radio.startswith("DEBUG"):
88-
print(log_radio, color="cyan", end=None)
85+
print_color.print(log_radio, color="cyan", end=None)
8986
elif log_radio.startswith("INFO"):
90-
print(log_radio, color="white", end=None)
87+
print_color.print(log_radio, color="white", end=None)
9188
elif log_radio.startswith("WARN"):
92-
print(log_radio, color="yellow", end=None)
89+
print_color.print(log_radio, color="yellow", end=None)
9390
elif log_radio.startswith("ERROR"):
94-
print(log_radio, color="red", end=None)
91+
print_color.print(log_radio, color="red", end=None)
9592
else:
96-
print(log_radio, end=None)
93+
print_color.print(log_radio, end=None)
9794

9895
@staticmethod
9996
def scan() -> list[BLEDevice]:
@@ -122,7 +119,7 @@ def find_device(self, address: Optional[str]) -> BLEDevice:
122119
if address:
123120
addressed_devices = list(
124121
filter(
125-
lambda x: address == x.name or address == x.address,
122+
lambda x: address in (x.name, x.address),
126123
addressed_devices,
127124
)
128125
)

0 commit comments

Comments
 (0)