fix pylint warnings

This commit is contained in:
Mike Kinney
2021-12-06 23:01:34 -08:00
parent b7c155e710
commit 6d2a187d38
7 changed files with 26 additions and 17 deletions

View File

@@ -171,4 +171,3 @@ protocols = {
portnums_pb2.PortNum.REMOTE_HARDWARE_APP: KnownProtocol(
"remotehw", remote_hardware_pb2.HardwareMessage)
}

View File

@@ -1,3 +1,5 @@
""" Bluetooth interface
"""
import logging
import pygatt

View File

@@ -1,17 +1,19 @@
""" Mesh Interface class
"""
import sys
import random
import time
import logging
import timeago
from typing import AnyStr
import threading
from datetime import datetime
import timeago
from tabulate import tabulate
import google.protobuf.json_format
from pubsub import pub
from google.protobuf.json_format import MessageToJson
from datetime import datetime
from . import portnums_pb2, mesh_pb2
@@ -438,11 +440,13 @@ class MeshInterface:
failmsg = None
# Check for app too old
if self.myInfo.min_app_version > OUR_APP_VERSION:
failmsg = "This device needs a newer python client, please \"pip install --upgrade meshtastic\". For more information see https://tinyurl.com/5bjsxu32"
failmsg = "This device needs a newer python client, please \"pip install --upgrade meshtastic\". "\
"For more information see https://tinyurl.com/5bjsxu32"
# check for firmware too old
if self.myInfo.max_channels == 0:
failmsg = "This version of meshtastic-python requires device firmware version 1.2 or later. For more information see https://tinyurl.com/5bjsxu32"
failmsg = "This version of meshtastic-python requires device firmware version 1.2 or later. "\
"For more information see https://tinyurl.com/5bjsxu32"
if failmsg:
self.failure = Exception(failmsg)

View File

@@ -1,4 +1,5 @@
""" Remote hardware
"""
from pubsub import pub
from . import portnums_pb2, remote_hardware_pb2
@@ -28,7 +29,8 @@ class RemoteHardwareClient:
ch = iface.localNode.getChannelByName("gpio")
if not ch:
raise Exception(
"No gpio channel found, please create on the sending and receive nodes to use this (secured) service (--ch-add gpio --info then --seturl)")
"No gpio channel found, please create on the sending and receive nodes "\
"to use this (secured) service (--ch-add gpio --info then --seturl)")
self.channelIndex = ch.index
pub.subscribe(

View File

@@ -1,8 +1,10 @@
""" Serial interface class
"""
import logging
import serial
import platform
import os
import stat
import serial
from .stream_interface import StreamInterface
from .util import findPorts

View File

@@ -1,16 +1,14 @@
""" Stream Interface base class
"""
import logging
import threading
import time
import traceback
import serial
import timeago
from tabulate import tabulate
from .mesh_interface import MeshInterface
from .util import stripnl
from .__init__ import LOCAL_ADDR, BROADCAST_NUM
START1 = 0x94
@@ -87,9 +85,9 @@ class StreamInterface(MeshInterface):
self.stream.write(b)
self.stream.flush()
def _readBytes(self, len):
def _readBytes(self, length):
"""Read an array of bytes from our stream"""
return self.stream.read(len)
return self.stream.read(length)
def _sendToRadioImpl(self, toRadio):
"""Send a ToRadio protobuf to the device"""
@@ -129,7 +127,7 @@ class StreamInterface(MeshInterface):
if ptr == 0: # looking for START1
if c != START1:
self._rxBuf = empty # failed to find start
if self.debugOut != None:
if self.debugOut is not None:
try:
self.debugOut.write(b.decode("utf-8"))
except:

View File

@@ -1,3 +1,5 @@
""" TCPInterface class for interfacing with http endpoint
"""
import logging
import socket
from typing import AnyStr
@@ -45,6 +47,6 @@ class TCPInterface(StreamInterface):
"""Write an array of bytes to our stream and flush"""
self.socket.send(b)
def _readBytes(self, len):
def _readBytes(self, length):
"""Read an array of bytes from our stream"""
return self.socket.recv(len)
return self.socket.recv(length)