The following issues were found
selfdrive/debug/uiview.py
2 issues
Line: 3
Column: 1
#!/usr/bin/env python3
import time
import cereal.messaging as messaging
from selfdrive.manager.process_config import managed_processes
if __name__ == "__main__":
services = ['controlsState', 'deviceState', 'pandaState'] # the services needed to be spoofed to start ui offroad
procs = ['camerad', 'ui', 'modeld', 'calibrationd']
Reported by Pylint.
Line: 3
Column: 1
#!/usr/bin/env python3
import time
import cereal.messaging as messaging
from selfdrive.manager.process_config import managed_processes
if __name__ == "__main__":
services = ['controlsState', 'deviceState', 'pandaState'] # the services needed to be spoofed to start ui offroad
procs = ['camerad', 'ui', 'modeld', 'calibrationd']
Reported by Pylint.
tools/zookeeper/__init__.py
2 issues
Line: 5
Column: 1
# Python library to control Zookeeper
import ft4222
import ft4222.I2CMaster
DEBUG = False
INA231_ADDR = 0x40
Reported by Pylint.
Line: 6
Column: 1
# Python library to control Zookeeper
import ft4222
import ft4222.I2CMaster
DEBUG = False
INA231_ADDR = 0x40
INA231_REG_CONFIG = 0x00
Reported by Pylint.
common/ffi_wrapper.py
2 issues
Line: 14
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b108_hardcoded_tmp_directory.html
else:
return ".so"
def ffi_wrap(name, c_code, c_header, tmpdir="/tmp/ccache", cflags="", libraries=None):
if libraries is None:
libraries = []
cache = name + "_" + hashlib.sha1(c_code.encode('utf-8')).hexdigest()
try:
Reported by Bandit.
Line: 18
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5
if libraries is None:
libraries = []
cache = name + "_" + hashlib.sha1(c_code.encode('utf-8')).hexdigest()
try:
os.mkdir(tmpdir)
except OSError:
pass
Reported by Bandit.
selfdrive/hardware/pc/hardware.py
2 issues
Line: 3
Column: 1
import random
from cereal import log
from selfdrive.hardware.base import HardwareBase, ThermalConfig
NetworkType = log.DeviceState.NetworkType
NetworkStrength = log.DeviceState.NetworkStrength
Reported by Pylint.
Line: 27
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random
print("uninstall")
def get_imei(self, slot):
return "%015d" % random.randint(0, 1 << 32)
def get_serial(self):
return "cccccccc"
def get_subscriber_info(self):
Reported by Bandit.
selfdrive/thermald/power_monitoring.py
2 issues
Line: 6
Column: 1
import time
from statistics import mean
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
Reported by Pylint.
Line: 128
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random
# On a charging EON with black panda, or drawing more than 400mA out of a white/grey one
# Only way to get the power draw is to turn off charging for a few sec and check what the discharging rate is
# We shouldn't do this very often, so make sure it has been some long-ish random time interval
self.next_pulsed_measurement_time = now + random.randint(120, 180)
return
else:
# Do nothing
return
Reported by Bandit.
selfdrive/test/process_replay/compare_logs.py
2 issues
Line: 6
Column: 1
import os
import sys
import numbers
import dictdiffer
from collections import Counter
if "CI" in os.environ:
def tqdm(x):
return x
Reported by Pylint.
Line: 13
Column: 3
def tqdm(x):
return x
else:
from tqdm import tqdm # type: ignore
from tools.lib.logreader import LogReader
EPSILON = sys.float_info.epsilon
Reported by Pylint.
selfdrive/car/chrysler/carcontroller.py
2 issues
Line: 5
Column: 1
from selfdrive.car.chrysler.chryslercan import create_lkas_hud, create_lkas_command, \
create_wheel_buttons
from selfdrive.car.chrysler.values import CAR, CarControllerParams
from opendbc.can.packer import CANPacker
class CarController():
def __init__(self, dbc_name, CP, VM):
self.apply_steer_last = 0
self.ccframe = 0
Reported by Pylint.
Line: 5
Column: 1
from selfdrive.car.chrysler.chryslercan import create_lkas_hud, create_lkas_command, \
create_wheel_buttons
from selfdrive.car.chrysler.values import CAR, CarControllerParams
from opendbc.can.packer import CANPacker
class CarController():
def __init__(self, dbc_name, CP, VM):
self.apply_steer_last = 0
self.ccframe = 0
Reported by Pylint.
selfdrive/car/mazda/carcontroller.py
2 issues
Line: 3
Column: 1
from selfdrive.car.mazda import mazdacan
from selfdrive.car.mazda.values import CarControllerParams, Buttons
from opendbc.can.packer import CANPacker
from selfdrive.car import apply_std_steer_torque_limits
class CarController():
def __init__(self, dbc_name, CP, VM):
self.apply_steer_last = 0
self.packer = CANPacker(dbc_name)
Reported by Pylint.
Line: 3
Column: 1
from selfdrive.car.mazda import mazdacan
from selfdrive.car.mazda.values import CarControllerParams, Buttons
from opendbc.can.packer import CANPacker
from selfdrive.car import apply_std_steer_torque_limits
class CarController():
def __init__(self, dbc_name, CP, VM):
self.apply_steer_last = 0
self.packer = CANPacker(dbc_name)
Reported by Pylint.
selfdrive/car/tesla/carcontroller.py
2 issues
Line: 3
Column: 1
from common.numpy_fast import clip, interp
from selfdrive.car.tesla.teslacan import TeslaCAN
from opendbc.can.packer import CANPacker
from selfdrive.car.tesla.values import CANBUS, CarControllerParams
class CarController():
def __init__(self, dbc_name, CP, VM):
self.CP = CP
self.last_angle = 0
Reported by Pylint.
Line: 3
Column: 1
from common.numpy_fast import clip, interp
from selfdrive.car.tesla.teslacan import TeslaCAN
from opendbc.can.packer import CANPacker
from selfdrive.car.tesla.values import CANBUS, CarControllerParams
class CarController():
def __init__(self, dbc_name, CP, VM):
self.CP = CP
self.last_angle = 0
Reported by Pylint.
tools/replay/can_replay.py
2 issues
Line: 5
Column: 1
import os
import time
import threading
from tqdm import tqdm
os.environ['FILEREADER_CACHE'] = '1'
from common.realtime import config_realtime_process, Ratekeeper, DT_CTRL
from selfdrive.boardd.boardd import can_capnp_to_can_list
Reported by Pylint.
Line: 12
Column: 1
from common.realtime import config_realtime_process, Ratekeeper, DT_CTRL
from selfdrive.boardd.boardd import can_capnp_to_can_list
from tools.lib.logreader import LogReader
from panda import Panda
try:
from panda_jungle import PandaJungle # pylint: disable=import-error
except Exception:
PandaJungle = None # type: ignore
Reported by Pylint.