mirror of
https://github.com/meshtastic/python.git
synced 2026-01-18 04:37:59 -05:00
fix linter warnings
This commit is contained in:
@@ -1044,7 +1044,6 @@ def common():
|
||||
for x in BLEInterface.scan():
|
||||
print(f"Found: name='{x.name}' address='{x.address}'")
|
||||
meshtastic.util.our_exit("BLE scan finished", 0)
|
||||
return
|
||||
elif args.ble:
|
||||
client = BLEInterface(args.ble_dest, debugOut=logfile, noProto=args.noproto, noNodes=args.no_nodes)
|
||||
elif args.host:
|
||||
@@ -1122,7 +1121,7 @@ def addConnectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParse
|
||||
"--ble-dest",
|
||||
help="The BLE device address or name to connect to",
|
||||
default=None,
|
||||
)
|
||||
)
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
@@ -9,10 +9,9 @@ from threading import Thread
|
||||
from typing import Optional
|
||||
|
||||
from bleak import BleakClient, BleakScanner, BLEDevice
|
||||
from print_color import print
|
||||
import print_color
|
||||
|
||||
from meshtastic.mesh_interface import MeshInterface
|
||||
from meshtastic.util import our_exit
|
||||
|
||||
SERVICE_UUID = "6ba1b218-15a8-461f-9fa8-5dcae273eafd"
|
||||
TORADIO_UUID = "f75c76d2-129e-4dad-a1dd-7866124401e7"
|
||||
@@ -27,8 +26,6 @@ class BLEInterface(MeshInterface):
|
||||
class BLEError(Exception):
|
||||
"""An exception class for BLE errors."""
|
||||
|
||||
pass
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
address: Optional[str],
|
||||
@@ -85,15 +82,15 @@ class BLEInterface(MeshInterface):
|
||||
async def log_radio_handler(self, _, b): # pylint: disable=C0116
|
||||
log_radio = b.decode("utf-8").replace("\n", "")
|
||||
if log_radio.startswith("DEBUG"):
|
||||
print(log_radio, color="cyan", end=None)
|
||||
print_color.print(log_radio, color="cyan", end=None)
|
||||
elif log_radio.startswith("INFO"):
|
||||
print(log_radio, color="white", end=None)
|
||||
print_color.print(log_radio, color="white", end=None)
|
||||
elif log_radio.startswith("WARN"):
|
||||
print(log_radio, color="yellow", end=None)
|
||||
print_color.print(log_radio, color="yellow", end=None)
|
||||
elif log_radio.startswith("ERROR"):
|
||||
print(log_radio, color="red", end=None)
|
||||
print_color.print(log_radio, color="red", end=None)
|
||||
else:
|
||||
print(log_radio, end=None)
|
||||
print_color.print(log_radio, end=None)
|
||||
|
||||
@staticmethod
|
||||
def scan() -> list[BLEDevice]:
|
||||
@@ -122,7 +119,7 @@ class BLEInterface(MeshInterface):
|
||||
if address:
|
||||
addressed_devices = list(
|
||||
filter(
|
||||
lambda x: address == x.name or address == x.address,
|
||||
lambda x: address in (x.name, x.address),
|
||||
addressed_devices,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user