Linter: remove pylint (#29611)

remove pylint
old-commit-hash: 1ee6ed4b16
This commit is contained in:
Justin Newberry 2023-08-24 16:30:54 -07:00 committed by GitHub
parent 630b440536
commit c4f322ce2d
48 changed files with 52 additions and 67 deletions

View File

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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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)

View File

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

View File

@ -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):

View File

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

View File

@ -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

View File

@ -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

View File

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

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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():

View File

@ -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'),

View File

@ -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()

View File

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

View File

@ -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 = []

View File

@ -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):

View File

@ -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

View File

@ -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)

View File

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

View File

@ -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)

View File

@ -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),

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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=}")

View File

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

View File

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

View File

@ -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 = {}

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

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

View File

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

View File

@ -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

View File

@ -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

View File

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

View File

@ -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

View File

@ -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")

View File

@ -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

View File

@ -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))

View File

@ -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)