Fix some pylint complaints

This commit is contained in:
Ian McEwen
2024-12-27 09:40:17 -07:00
parent 7cc18e9df6
commit 57f0598082
2 changed files with 7 additions and 8 deletions

View File

@@ -7,7 +7,6 @@
import argparse
import datetime
import sys
import time
import meshtastic
import meshtastic.serial_interface
@@ -42,7 +41,7 @@ else:
with meshtastic.serial_interface.SerialInterface(args.port, debugOut=d) as iface:
if args.cmd == 'create':
p = iface.sendWaypoint(
id=int(args.id),
waypoint_id=int(args.id),
name=args.name,
description=args.description,
expire=int(datetime.datetime.fromisoformat(args.expire).timestamp()),

View File

@@ -720,14 +720,14 @@ class MeshInterface: # pylint: disable=R0902
name,
description,
expire: int,
id: Optional[int] = None,
waypoint_id: Optional[int] = None,
latitude: float = 0.0,
longitude: float = 0.0,
destinationId: Union[int, str] = BROADCAST_ADDR,
wantAck: bool = True,
wantResponse: bool = False,
channelIndex: int = 0,
):
): # pylint: disable=R0913
"""
Send a waypoint packet to some other node (normally a broadcast)
@@ -738,14 +738,14 @@ class MeshInterface: # pylint: disable=R0902
w.name = name
w.description = description
w.expire = expire
if id is None:
if waypoint_id is None:
# Generate a waypoint's id, NOT a packet ID.
# same algorithm as https://github.com/meshtastic/js/blob/715e35d2374276a43ffa93c628e3710875d43907/src/meshDevice.ts#L791
seed = secrets.randbits(32)
w.id = math.floor(seed * math.pow(2, -32) * 1e9)
logging.debug(f"w.id:{w.id}")
else:
w.id = id
w.id = waypoint_id
if latitude != 0.0:
w.latitude_i = int(latitude * 1e7)
logging.debug(f"w.latitude_i:{w.latitude_i}")
@@ -773,7 +773,7 @@ class MeshInterface: # pylint: disable=R0902
def deleteWaypoint(
self,
id: int,
waypoint_id: int,
destinationId: Union[int, str] = BROADCAST_ADDR,
wantAck: bool = True,
wantResponse: bool = False,
@@ -788,7 +788,7 @@ class MeshInterface: # pylint: disable=R0902
can be used to track future message acks/naks.
"""
p = mesh_pb2.Waypoint()
p.id = id
p.id = waypoint_id
p.expire = 0
if wantResponse: