Skip to content

Commit

Permalink
Fix some pylint complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmcorvidae committed Dec 27, 2024
1 parent 7cc18e9 commit 57f0598
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions examples/waypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import argparse
import datetime
import sys
import time

import meshtastic
import meshtastic.serial_interface
Expand Down Expand Up @@ -42,7 +41,7 @@
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()),
Expand Down
12 changes: 6 additions & 6 deletions meshtastic/mesh_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,14 +720,14 @@ def sendWaypoint(
name,
description,
expire: int,

Check warning on line 722 in meshtastic/mesh_interface.py

View check run for this annotation

Codecov / codecov/patch

meshtastic/mesh_interface.py#L721-L722

Added lines #L721 - L722 were not covered by tests
id: Optional[int] = None,
waypoint_id: Optional[int] = None,
latitude: float = 0.0,
longitude: float = 0.0,
destinationId: Union[int, str] = BROADCAST_ADDR,

Check warning on line 726 in meshtastic/mesh_interface.py

View check run for this annotation

Codecov / codecov/patch

meshtastic/mesh_interface.py#L725-L726

Added lines #L725 - L726 were not covered by tests
wantAck: bool = True,
wantResponse: bool = False,
channelIndex: int = 0,
):
): # pylint: disable=R0913
"""
Send a waypoint packet to some other node (normally a broadcast)
Expand All @@ -738,14 +738,14 @@ def sendWaypoint(
w.name = name

Check warning on line 738 in meshtastic/mesh_interface.py

View check run for this annotation

Codecov / codecov/patch

meshtastic/mesh_interface.py#L736-L738

Added lines #L736 - L738 were not covered by tests
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}")

Check warning on line 751 in meshtastic/mesh_interface.py

View check run for this annotation

Codecov / codecov/patch

meshtastic/mesh_interface.py#L744-L751

Added lines #L744 - L751 were not covered by tests
Expand Down Expand Up @@ -773,7 +773,7 @@ def sendWaypoint(

def deleteWaypoint(
self,
id: int,
waypoint_id: int,
destinationId: Union[int, str] = BROADCAST_ADDR,
wantAck: bool = True,

Check warning on line 778 in meshtastic/mesh_interface.py

View check run for this annotation

Codecov / codecov/patch

meshtastic/mesh_interface.py#L774-L778

Added lines #L774 - L778 were not covered by tests
wantResponse: bool = False,
Expand All @@ -788,7 +788,7 @@ def deleteWaypoint(
can be used to track future message acks/naks.
"""
p = mesh_pb2.Waypoint()
p.id = id
p.id = waypoint_id

Check warning on line 791 in meshtastic/mesh_interface.py

View check run for this annotation

Codecov / codecov/patch

meshtastic/mesh_interface.py#L785-L791

Added lines #L785 - L791 were not covered by tests
p.expire = 0

if wantResponse:

Check warning on line 794 in meshtastic/mesh_interface.py

View check run for this annotation

Codecov / codecov/patch

meshtastic/mesh_interface.py#L793-L794

Added lines #L793 - L794 were not covered by tests
Expand Down

0 comments on commit 57f0598

Please sign in to comment.