Linter: remove pylint (#29611)

remove pylint
pull/29604/head
Justin Newberry 2 years ago committed by GitHub
parent ede9f2cda5
commit 1ee6ed4b16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      common/kalman/simple_kalman.py
  2. 2
      common/logging_extra.py
  3. 2
      common/params.py
  4. 4
      common/realtime.py
  5. 1
      common/transformations/coordinates.py
  6. 1
      common/transformations/orientation.py
  7. 4
      common/window.py
  8. 1
      docs/conf.py
  9. 2
      scripts/pyqt_demo.py
  10. 2
      selfdrive/boardd/boardd.py
  11. 1
      selfdrive/car/tests/test_models.py
  12. 2
      selfdrive/controls/tests/test_cruise_speed.py
  13. 2
      selfdrive/controls/tests/test_startup.py
  14. 2
      selfdrive/debug/toyota_eps_factor.py
  15. 4
      selfdrive/locationd/models/car_kf.py
  16. 4
      selfdrive/locationd/models/gnss_kf.py
  17. 6
      selfdrive/manager/process.py
  18. 2
      selfdrive/modeld/tests/tf_test/pb_loader.py
  19. 1
      selfdrive/modeld/tests/timing/benchmark.py
  20. 1
      selfdrive/monitoring/test_monitoring.py
  21. 4
      selfdrive/test/ciui.py
  22. 4
      selfdrive/test/openpilotci.py
  23. 4
      selfdrive/test/profiling/lib.py
  24. 2
      selfdrive/test/profiling/profiler.py
  25. 2
      selfdrive/test/test_valgrind_replay.py
  26. 6
      selfdrive/test/update_ci_routes.py
  27. 4
      selfdrive/thermald/thermald.py
  28. 4
      selfdrive/tombstoned.py
  29. 2
      selfdrive/ui/qt/python_helpers.py
  30. 2
      system/hardware/tici/hardware.py
  31. 2
      system/micd.py
  32. 1
      system/ubloxd/tests/ublox.py
  33. 1
      system/ubloxd/tests/ubloxd.py
  34. 4
      tools/bodyteleop/bodyav.py
  35. 2
      tools/camerastream/compressed_vipc.py
  36. 2
      tools/gpstest/fuzzy_testing.py
  37. 4
      tools/gpstest/rpc_server.py
  38. 2
      tools/lib/auth.py
  39. 1
      tools/lib/framereader.py
  40. 2
      tools/lib/url_file.py
  41. 2
      tools/replay/lib/ui_helpers.py
  42. 4
      tools/replay/ui.py
  43. 1
      tools/replay/unlog_ci_segment.py
  44. 2
      tools/sim/bridge.py
  45. 2
      tools/sim/lib/can.py
  46. 4
      tools/sim/lib/manual_ctrl.py
  47. 2
      tools/webcam/front_mount_helper.py
  48. 2
      tools/webcam/warp_vis.py

@ -1,4 +1,3 @@
# pylint: skip-file
from openpilot.common.kalman.simple_kalman_impl import KF1D as KF1D
assert KF1D
import numpy as np

@ -197,7 +197,7 @@ class SwagLogger(logging.Logger):
filename = os.path.normcase(co.co_filename)
# TODO: is this pylint exception correct?
if filename == _srcfile: # pylint: disable=comparison-with-callable
if filename == _srcfile:
f = f.f_back
continue
sinfo = None

@ -1,5 +1,5 @@
from openpilot.common.params_pyx import Params, ParamKeyType, UnknownKeyName, put_nonblocking, \
put_bool_nonblocking # pylint: disable=no-name-in-module, import-error
put_bool_nonblocking
assert Params
assert ParamKeyType
assert UnknownKeyName

@ -30,12 +30,12 @@ class Priority:
def set_realtime_priority(level: int) -> None:
if not PC:
os.sched_setscheduler(0, os.SCHED_FIFO, os.sched_param(level)) # pylint: disable=no-member
os.sched_setscheduler(0, os.SCHED_FIFO, os.sched_param(level))
def set_core_affinity(cores: List[int]) -> None:
if not PC:
os.sched_setaffinity(0, cores) # pylint: disable=no-member
os.sched_setaffinity(0, cores)
def config_realtime_process(cores: Union[int, List[int]], priority: int) -> None:

@ -1,4 +1,3 @@
# pylint: skip-file
from openpilot.common.transformations.orientation import numpy_wrap
from openpilot.common.transformations.transformations import (ecef2geodetic_single,
geodetic2ecef_single)

@ -1,4 +1,3 @@
# pylint: skip-file
import numpy as np
from typing import Callable

@ -1,6 +1,6 @@
import sys
import pygame # pylint: disable=import-error
import cv2 # pylint: disable=import-error
import pygame
import cv2
class Window:
def __init__(self, w, h, caption="window", double=False, halve=False):

@ -1,5 +1,4 @@
# type: ignore
# pylint: skip-file
# Configuration file for the Sphinx documentation builder.
#

@ -1,6 +1,6 @@
#!/usr/bin/env python3
from PyQt5.QtWidgets import QApplication, QLabel # pylint: disable=no-name-in-module, import-error
from PyQt5.QtWidgets import QApplication, QLabel
from openpilot.selfdrive.ui.qt.python_helpers import set_main_window

@ -1,5 +1,3 @@
# pylint: skip-file
# Cython, now uses scons to build
from openpilot.selfdrive.boardd.boardd_api_impl import can_list_to_can_capnp
assert can_list_to_can_capnp

@ -1,5 +1,4 @@
#!/usr/bin/env python3
# pylint: disable=E1101
import capnp
import os
import importlib

@ -52,7 +52,7 @@ class TestCruiseSpeed(unittest.TestCase):
@parameterized_class(('pcm_cruise',), [(False,)])
class TestVCruiseHelper(unittest.TestCase):
def setUp(self):
self.CP = car.CarParams(pcmCruise=self.pcm_cruise) # pylint: disable=E1101
self.CP = car.CarParams(pcmCruise=self.pcm_cruise)
self.v_cruise_helper = VCruiseHelper(self.CP)
self.reset_cruise_speed_state()

@ -6,7 +6,7 @@ from parameterized import parameterized
from cereal import log, car
import cereal.messaging as messaging
from openpilot.common.params import Params
from openpilot.selfdrive.boardd.boardd_api_impl import can_list_to_can_capnp # pylint: disable=no-name-in-module,import-error
from openpilot.selfdrive.boardd.boardd_api_impl import can_list_to_can_capnp
from openpilot.selfdrive.car.fingerprints import _FINGERPRINTS
from openpilot.selfdrive.car.toyota.values import CAR as TOYOTA
from openpilot.selfdrive.car.mazda.values import CAR as MAZDA

@ -2,7 +2,7 @@
import sys
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model # pylint: disable=import-error
from sklearn import linear_model
from openpilot.selfdrive.car.toyota.values import STEER_THRESHOLD
from openpilot.tools.lib.route import Route

@ -15,7 +15,7 @@ if __name__ == '__main__': # Generating sympy
import sympy as sp
from rednose.helpers.ekf_sym import gen_code
else:
from rednose.helpers.ekf_sym_pyx import EKF_sym_pyx # pylint: disable=no-name-in-module, import-error
from rednose.helpers.ekf_sym_pyx import EKF_sym_pyx
i = 0
@ -160,7 +160,7 @@ class CarKalman(KalmanFilter):
gen_code(generated_dir, name, f_sym, dt, state_sym, obs_eqs, dim_state, dim_state, global_vars=global_vars)
def __init__(self, generated_dir, steer_ratio=15, stiffness_factor=1, angle_offset=0, P_initial=None): # pylint: disable=super-init-not-called
def __init__(self, generated_dir, steer_ratio=15, stiffness_factor=1, angle_offset=0, P_initial=None):
dim_state = self.initial_x.shape[0]
dim_state_err = self.P_initial.shape[0]
x_init = self.initial_x

@ -11,8 +11,8 @@ if __name__ == '__main__': # Generating sympy
import sympy as sp
from rednose.helpers.ekf_sym import gen_code
else:
from rednose.helpers.ekf_sym_pyx import EKF_sym_pyx # pylint: disable=no-name-in-module,import-error
from rednose.helpers.ekf_sym import EKF_sym # pylint: disable=no-name-in-module,import-error
from rednose.helpers.ekf_sym_pyx import EKF_sym_pyx
from rednose.helpers.ekf_sym import EKF_sym
class States():

@ -8,7 +8,7 @@ from typing import Optional, Callable, List, ValuesView
from abc import ABC, abstractmethod
from multiprocessing import Process
from setproctitle import setproctitle # pylint: disable=no-name-in-module
from setproctitle import setproctitle
from cereal import car, log
import cereal.messaging as messaging
@ -96,7 +96,7 @@ class ManagerProcess(ABC):
fn = WATCHDOG_FN + str(self.proc.pid)
with open(fn, "rb") as f:
# TODO: why can't pylint find struct.unpack?
self.last_watchdog_time = struct.unpack('Q', f.read())[0] # pylint: disable=no-member
self.last_watchdog_time = struct.unpack('Q', f.read())[0]
except Exception:
pass
@ -261,7 +261,7 @@ class DaemonProcess(ManagerProcess):
pass
cloudlog.info(f"starting daemon {self.name}")
proc = subprocess.Popen(['python', '-m', self.module], # pylint: disable=subprocess-popen-preexec-fn
proc = subprocess.Popen(['python', '-m', self.module],
stdin=open('/dev/null'),
stdout=open('/dev/null', 'w'),
stderr=open('/dev/null', 'w'),

@ -1,6 +1,6 @@
#!/usr/bin/env python3
import sys
import tensorflow as tf # pylint: disable=import-error
import tensorflow as tf
with open(sys.argv[1], "rb") as f:
graph_def = tf.compat.v1.GraphDef()

@ -1,6 +1,5 @@
#!/usr/bin/env python3
# type: ignore
# pylint: skip-file
import os
import time

@ -54,7 +54,6 @@ always_false = [False] * int(TEST_TIMESPAN / DT_DMON)
# TODO: this only tests DriverStatus
class TestMonitoring(unittest.TestCase):
# pylint: disable=no-member
def _run_seq(self, msgs, interaction, engaged, standstill):
DS = DriverStatus()
events = []

@ -5,8 +5,8 @@ import subprocess
signal.signal(signal.SIGINT, signal.SIG_DFL)
signal.signal(signal.SIGTERM, signal.SIG_DFL)
from PyQt5.QtCore import QTimer # pylint: disable=no-name-in-module, import-error
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel # pylint: disable=no-name-in-module, import-error
from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel
from openpilot.selfdrive.ui.qt.python_helpers import set_main_window
class Window(QWidget):

@ -24,13 +24,13 @@ def get_sas_token():
return sas_token
def upload_bytes(data, name):
from azure.storage.blob import BlockBlobService # pylint: disable=import-error
from azure.storage.blob import BlockBlobService
service = BlockBlobService(account_name="commadataci", sas_token=get_sas_token())
service.create_blob_from_bytes("openpilotci", name, data)
return BASE_URL + name
def upload_file(path, name):
from azure.storage.blob import BlockBlobService # pylint: disable=import-error
from azure.storage.blob import BlockBlobService
service = BlockBlobService(account_name="commadataci", sas_token=get_sas_token())
service.create_blob_from_path("openpilotci", name, path)
return BASE_URL + name

@ -34,7 +34,7 @@ class PubSocket():
class SubMaster(messaging.SubMaster):
def __init__(self, msgs, trigger, services, check_averag_freq=False): # pylint: disable=super-init-not-called
def __init__(self, msgs, trigger, services, check_averag_freq=False):
self.frame = 0
self.data = {}
self.ignore_alive = []
@ -87,5 +87,5 @@ class SubMaster(messaging.SubMaster):
class PubMaster(messaging.PubMaster):
def __init__(self): # pylint: disable=super-init-not-called
def __init__(self):
self.sock = defaultdict(PubSocket)

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import os
import sys
import cProfile # pylint: disable=import-error
import cProfile
import pprofile
import pyprof2calltree

@ -53,7 +53,7 @@ class TestValgrind(unittest.TestCase):
os.chdir(os.path.join(BASEDIR, cwd))
# Run valgrind on a process
command = "valgrind --leak-check=full " + arg
p = subprocess.Popen(command, stderr=subprocess.PIPE, shell=True, preexec_fn=os.setsid) # pylint: disable=W1509
p = subprocess.Popen(command, stderr=subprocess.PIPE, shell=True, preexec_fn=os.setsid)
while not self.replay_done:
time.sleep(0.1)

@ -3,13 +3,13 @@ from functools import lru_cache
import sys
import subprocess
from tqdm import tqdm
from azure.storage.blob import BlockBlobService # pylint: disable=import-error
from azure.storage.blob import BlockBlobService
from openpilot.selfdrive.car.tests.routes import routes as test_car_models_routes
from openpilot.selfdrive.locationd.test.test_laikad import UBLOX_TEST_ROUTE, QCOM_TEST_ROUTE
from openpilot.selfdrive.test.process_replay.test_processes import source_segments as replay_segments
from xx.chffr.lib import azureutil # pylint: disable=import-error
from xx.chffr.lib.storage import _DATA_ACCOUNT_PRODUCTION, _DATA_ACCOUNT_CI, _DATA_BUCKET_PRODUCTION # pylint: disable=import-error
from xx.chffr.lib import azureutil
from xx.chffr.lib.storage import _DATA_ACCOUNT_PRODUCTION, _DATA_ACCOUNT_CI, _DATA_BUCKET_PRODUCTION
SOURCES = [
(_DATA_ACCOUNT_PRODUCTION, _DATA_BUCKET_PRODUCTION),

@ -118,8 +118,8 @@ def hw_state_thread(end_event, hw_queue):
# Log modem version once
if AGNOS and ((modem_version is None) or (modem_nv is None)):
modem_version = HARDWARE.get_modem_version() # pylint: disable=assignment-from-none
modem_nv = HARDWARE.get_modem_nv() # pylint: disable=assignment-from-none
modem_version = HARDWARE.get_modem_version()
modem_nv = HARDWARE.get_modem_nv()
if (modem_version is not None) and (modem_nv is not None):
cloudlog.event("modem version", version=modem_version, nv=modem_nv)

@ -38,7 +38,7 @@ def clear_apport_folder():
def get_apport_stacktrace(fn):
try:
cmd = f'apport-retrace -s <(cat <(echo "Package: openpilot") "{fn}")'
return subprocess.check_output(cmd, shell=True, encoding='utf8', timeout=30, executable='/bin/bash') # pylint: disable=unexpected-keyword-arg
return subprocess.check_output(cmd, shell=True, encoding='utf8', timeout=30, executable='/bin/bash')
except subprocess.CalledProcessError:
return "Error getting stacktrace"
except subprocess.TimeoutExpired:
@ -95,7 +95,7 @@ def report_tombstone_apport(fn):
try:
sig_num = int(line.strip().split(': ')[-1])
message += " (" + signal.Signals(sig_num).name + ")" # pylint: disable=no-member
message += " (" + signal.Signals(sig_num).name + ")"
except ValueError:
pass

@ -1,7 +1,7 @@
import os
from cffi import FFI
import sip # pylint: disable=import-error
import sip
from openpilot.common.ffi_wrapper import suffix
from openpilot.common.basedir import BASEDIR

@ -97,7 +97,7 @@ def get_device_type():
class Tici(HardwareBase):
@cached_property
def bus(self):
import dbus # pylint: disable=import-error
import dbus
return dbus.SystemBus()
@cached_property

@ -85,7 +85,7 @@ class Mic:
def micd_thread(self):
# sounddevice must be imported after forking processes
import sounddevice as sd # pylint: disable=import-outside-toplevel
import sounddevice as sd
with sd.InputStream(channels=1, samplerate=SAMPLE_RATE, callback=self.callback) as stream:
cloudlog.info(f"micd stream started: {stream.samplerate=} {stream.channels=} {stream.dtype=} {stream.device=}")

@ -1,5 +1,4 @@
#!/usr/bin/env python3
# pylint: skip-file
'''
UBlox binary protocol handling

@ -1,6 +1,5 @@
#!/usr/bin/env python3
# type: ignore
# pylint: skip-file
from openpilot.selfdrive.locationd.test import ublox
import struct

@ -90,12 +90,12 @@ class WebClientSpeaker(MediaBlackhole):
self.buffer.write(bio)
async def start(self):
for track, task in self._MediaBlackhole__tracks.items(): # pylint: disable=access-member-before-definition
for track, task in self._MediaBlackhole__tracks.items():
if task is None:
self._MediaBlackhole__tracks[track] = asyncio.ensure_future(self.consume(track))
async def stop(self):
for task in self._MediaBlackhole__tracks.values(): # pylint: disable=access-member-before-definition
for task in self._MediaBlackhole__tracks.values():
if task is not None:
task.cancel()
self._MediaBlackhole__tracks = {}

@ -26,7 +26,7 @@ def decoder(addr, vipc_server, vst, nvidia, debug=False):
if nvidia:
os.environ["NV_LOW_LATENCY"] = "3" # both bLowLatency and CUVID_PKT_ENDOFPICTURE
sys.path += os.environ["LD_LIBRARY_PATH"].split(":")
import PyNvCodec as nvc # pylint: disable=import-error
import PyNvCodec as nvc
nvDec = nvc.PyNvDecoder(W, H, nvc.PixelFormat.NV12, nvc.CudaVideoCodec.HEVC, 0)
cc1 = nvc.ColorspaceConversionContext(nvc.ColorSpace.BT_709, nvc.ColorRange.JPEG)

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import argparse
import multiprocessing
import rpyc # pylint: disable=import-error
import rpyc
from collections import defaultdict
from helper import download_rinex, exec_LimeGPS_bin

@ -4,8 +4,8 @@ import shutil
from datetime import datetime
from collections import defaultdict
import rpyc # pylint: disable=import-error
from rpyc.utils.server import ThreadedServer # pylint: disable=import-error
import rpyc
from rpyc.utils.server import ThreadedServer
#from openpilot.common.params import Params
import cereal.messaging as messaging

@ -54,7 +54,7 @@ class ClientRedirectHandler(BaseHTTPRequestHandler):
self.end_headers()
self.wfile.write(b'Return to the CLI to continue')
def log_message(self, *args): # pylint: disable=redefined-builtin
def log_message(self, *args):
pass # this prevent http server from dumping messages to stdout

@ -1,4 +1,3 @@
# pylint: skip-file
import json
import os
import pickle

@ -1,5 +1,3 @@
# pylint: skip-file
import os
import time
import tempfile

@ -3,7 +3,7 @@ from typing import Any, Dict, Tuple
import matplotlib.pyplot as plt
import numpy as np
import pygame # pylint: disable=import-error
import pygame
from matplotlib.backends.backend_agg import FigureCanvasAgg

@ -3,9 +3,9 @@ import argparse
import os
import sys
import cv2 # pylint: disable=import-error
import cv2
import numpy as np
import pygame # pylint: disable=import-error
import pygame
import cereal.messaging as messaging
from openpilot.common.numpy_fast import clip

@ -1,5 +1,4 @@
#!/usr/bin/env python3
# pylint: skip-file
import argparse
import bisect

@ -8,7 +8,7 @@ import time
from multiprocessing import Process, Queue
from typing import Any
import carla # pylint: disable=import-error
import carla
import numpy as np
import pyopencl as cl
import pyopencl.array as cl_array

@ -2,7 +2,7 @@
import cereal.messaging as messaging
from opendbc.can.packer import CANPacker
from opendbc.can.parser import CANParser
from openpilot.selfdrive.boardd.boardd_api_impl import can_list_to_can_capnp # pylint: disable=no-name-in-module,import-error
from openpilot.selfdrive.boardd.boardd_api_impl import can_list_to_can_capnp
from openpilot.selfdrive.car import crc8_pedal
packer = CANPacker("honda_civic_touring_2016_can_generated")

@ -135,8 +135,8 @@ def wheel_poll_thread(q: 'Queue[str]') -> NoReturn:
print('%d buttons found: %s' % (num_buttons, ', '.join(button_map)))
# Enable FF
import evdev # pylint: disable=import-error
from evdev import ecodes, InputDevice # pylint: disable=import-error
import evdev
from evdev import ecodes, InputDevice
device = evdev.list_devices()[0]
evtdev = InputDevice(device)
val = 24000

@ -18,7 +18,7 @@ webcam_intrinsics = np.array([
cam_id = 2
if __name__ == "__main__":
import cv2 # pylint: disable=import-error
import cv2
trans_webcam_to_eon_front = np.dot(eon_dcam_intrinsics, np.linalg.inv(webcam_intrinsics))

@ -23,7 +23,7 @@ webcam_intrinsics = np.array([
[ 0., 0., 1.]])
if __name__ == "__main__":
import cv2 # pylint: disable=import-error
import cv2
trans_webcam_to_eon_rear = np.dot(eon_intrinsics, np.linalg.inv(webcam_intrinsics))
trans_webcam_to_eon_front = np.dot(eon_dcam_intrinsics, np.linalg.inv(webcam_intrinsics))
print("trans_webcam_to_eon_rear:\n", trans_webcam_to_eon_rear)

Loading…
Cancel
Save