The following issues were found
pyextra/acados_template/generate_c_code_constraint.py
55 issues
Line: 35
Column: 1
#
import os
from casadi import *
from .utils import ALLOWED_CASADI_VERSIONS, is_empty, casadi_length, casadi_version_warning
def generate_c_code_constraint( model, con_name, is_terminal, opts ):
casadi_version = CasadiMeta.version()
Reported by Pylint.
Line: 36
Column: 1
import os
from casadi import *
from .utils import ALLOWED_CASADI_VERSIONS, is_empty, casadi_length, casadi_version_warning
def generate_c_code_constraint( model, con_name, is_terminal, opts ):
casadi_version = CasadiMeta.version()
casadi_opts = dict(mex=False, casadi_int='int', casadi_real='double')
Reported by Pylint.
Line: 40
Column: 22
def generate_c_code_constraint( model, con_name, is_terminal, opts ):
casadi_version = CasadiMeta.version()
casadi_opts = dict(mex=False, casadi_int='int', casadi_real='double')
if casadi_version not in (ALLOWED_CASADI_VERSIONS):
casadi_version_warning(casadi_version)
Reported by Pylint.
Line: 50
Column: 22
x = model.x
p = model.p
if isinstance(x, casadi.MX):
symbol = MX.sym
else:
symbol = SX.sym
if is_terminal:
Reported by Pylint.
Line: 51
Column: 18
p = model.p
if isinstance(x, casadi.MX):
symbol = MX.sym
else:
symbol = SX.sym
if is_terminal:
con_h_expr = model.con_h_expr_e
Reported by Pylint.
Line: 53
Column: 18
if isinstance(x, casadi.MX):
symbol = MX.sym
else:
symbol = SX.sym
if is_terminal:
con_h_expr = model.con_h_expr_e
con_phi_expr = model.con_phi_expr_e
# create dummy u, z
Reported by Pylint.
Line: 107
Column: 34
else:
fun_name = con_name + '_constr_h_fun_jac_uxt_zt'
jac_ux_t = transpose(jacobian(con_h_expr, vertcat(u,x)))
jac_z_t = jacobian(con_h_expr, z)
constraint_fun_jac_tran = Function(fun_name, [x, u, z, p], \
[con_h_expr, jac_ux_t, jac_z_t])
constraint_fun_jac_tran.generate(fun_name, casadi_opts)
Reported by Pylint.
Line: 107
Column: 24
else:
fun_name = con_name + '_constr_h_fun_jac_uxt_zt'
jac_ux_t = transpose(jacobian(con_h_expr, vertcat(u,x)))
jac_z_t = jacobian(con_h_expr, z)
constraint_fun_jac_tran = Function(fun_name, [x, u, z, p], \
[con_h_expr, jac_ux_t, jac_z_t])
constraint_fun_jac_tran.generate(fun_name, casadi_opts)
Reported by Pylint.
Line: 107
Column: 55
else:
fun_name = con_name + '_constr_h_fun_jac_uxt_zt'
jac_ux_t = transpose(jacobian(con_h_expr, vertcat(u,x)))
jac_z_t = jacobian(con_h_expr, z)
constraint_fun_jac_tran = Function(fun_name, [x, u, z, p], \
[con_h_expr, jac_ux_t, jac_z_t])
constraint_fun_jac_tran.generate(fun_name, casadi_opts)
Reported by Pylint.
Line: 108
Column: 23
fun_name = con_name + '_constr_h_fun_jac_uxt_zt'
jac_ux_t = transpose(jacobian(con_h_expr, vertcat(u,x)))
jac_z_t = jacobian(con_h_expr, z)
constraint_fun_jac_tran = Function(fun_name, [x, u, z, p], \
[con_h_expr, jac_ux_t, jac_z_t])
constraint_fun_jac_tran.generate(fun_name, casadi_opts)
if opts['generate_hess']:
Reported by Pylint.
tools/sim/lib/keyboard_ctrl.py
53 issues
Line: 67
Column: 6
if __name__ == '__main__':
from multiprocessing import Process, Queue
q: Queue[str] = Queue()
p = Process(target=test, args=(q,))
p.daemon = True
p.start()
keyboard_poll_thread(q)
Reported by Pylint.
Line: 38
Column: 26
termios.tcsetattr(STDIN_FD, termios.TCSADRAIN, old_settings)
return ch
def keyboard_poll_thread(q: 'Queue[str]'):
while True:
c = getch()
# print("got %s" % c)
if c == '1':
q.put("cruise_up")
Reported by Pylint.
Line: 60
Column: 10
q.put("quit")
break
def test(q: 'Queue[str]') -> NoReturn:
while True:
print([q.get_nowait() for _ in range(q.qsize())] or None)
time.sleep(0.25)
if __name__ == '__main__':
Reported by Pylint.
Line: 1
Column: 1
import sys
import termios
import time
from termios import (BRKINT, CS8, CSIZE, ECHO, ICANON, ICRNL, IEXTEN, INPCK,
ISTRIP, IXON, PARENB, VMIN, VTIME)
from typing import NoReturn
# Indexes for termios list.
IFLAG = 0
Reported by Pylint.
Line: 19
Column: 1
STDIN_FD = sys.stdin.fileno()
def getch() -> str:
old_settings = termios.tcgetattr(STDIN_FD)
try:
# set
mode = old_settings.copy()
mode[IFLAG] &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON)
Reported by Pylint.
Line: 20
Column: 1
STDIN_FD = sys.stdin.fileno()
def getch() -> str:
old_settings = termios.tcgetattr(STDIN_FD)
try:
# set
mode = old_settings.copy()
mode[IFLAG] &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON)
#mode[OFLAG] &= ~(OPOST)
Reported by Pylint.
Line: 21
Column: 1
def getch() -> str:
old_settings = termios.tcgetattr(STDIN_FD)
try:
# set
mode = old_settings.copy()
mode[IFLAG] &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON)
#mode[OFLAG] &= ~(OPOST)
mode[CFLAG] &= ~(CSIZE | PARENB)
Reported by Pylint.
Line: 23
Column: 1
old_settings = termios.tcgetattr(STDIN_FD)
try:
# set
mode = old_settings.copy()
mode[IFLAG] &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON)
#mode[OFLAG] &= ~(OPOST)
mode[CFLAG] &= ~(CSIZE | PARENB)
mode[CFLAG] |= CS8
mode[LFLAG] &= ~(ECHO | ICANON | IEXTEN)
Reported by Pylint.
Line: 24
Column: 1
try:
# set
mode = old_settings.copy()
mode[IFLAG] &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON)
#mode[OFLAG] &= ~(OPOST)
mode[CFLAG] &= ~(CSIZE | PARENB)
mode[CFLAG] |= CS8
mode[LFLAG] &= ~(ECHO | ICANON | IEXTEN)
mode[CC][VMIN] = 1
Reported by Pylint.
Line: 26
Column: 1
mode = old_settings.copy()
mode[IFLAG] &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON)
#mode[OFLAG] &= ~(OPOST)
mode[CFLAG] &= ~(CSIZE | PARENB)
mode[CFLAG] |= CS8
mode[LFLAG] &= ~(ECHO | ICANON | IEXTEN)
mode[CC][VMIN] = 1
mode[CC][VTIME] = 0
termios.tcsetattr(STDIN_FD, termios.TCSAFLUSH, mode)
Reported by Pylint.
selfdrive/monitoring/dmonitoringd.py
51 issues
Line: 2
Column: 1
#!/usr/bin/env python3
from cereal import car
from common.params import Params
import cereal.messaging as messaging
from selfdrive.controls.lib.events import Events
from selfdrive.monitoring.driver_monitor import DriverStatus
from selfdrive.locationd.calibrationd import Calibration
Reported by Pylint.
Line: 3
Column: 1
#!/usr/bin/env python3
from cereal import car
from common.params import Params
import cereal.messaging as messaging
from selfdrive.controls.lib.events import Events
from selfdrive.monitoring.driver_monitor import DriverStatus
from selfdrive.locationd.calibrationd import Calibration
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python3
from cereal import car
from common.params import Params
import cereal.messaging as messaging
from selfdrive.controls.lib.events import Events
from selfdrive.monitoring.driver_monitor import DriverStatus
from selfdrive.locationd.calibrationd import Calibration
Reported by Pylint.
Line: 5
Column: 1
from cereal import car
from common.params import Params
import cereal.messaging as messaging
from selfdrive.controls.lib.events import Events
from selfdrive.monitoring.driver_monitor import DriverStatus
from selfdrive.locationd.calibrationd import Calibration
def dmonitoringd_thread(sm=None, pm=None):
Reported by Pylint.
Line: 6
Column: 1
from common.params import Params
import cereal.messaging as messaging
from selfdrive.controls.lib.events import Events
from selfdrive.monitoring.driver_monitor import DriverStatus
from selfdrive.locationd.calibrationd import Calibration
def dmonitoringd_thread(sm=None, pm=None):
if pm is None:
Reported by Pylint.
Line: 7
Column: 1
import cereal.messaging as messaging
from selfdrive.controls.lib.events import Events
from selfdrive.monitoring.driver_monitor import DriverStatus
from selfdrive.locationd.calibrationd import Calibration
def dmonitoringd_thread(sm=None, pm=None):
if pm is None:
pm = messaging.PubMaster(['driverMonitoringState'])
Reported by Pylint.
Line: 53
Column: 44
driver_status.get_pose(sm['driverState'], sm['liveCalibration'].rpyCalib, sm['carState'].vEgo, sm['controlsState'].enabled)
# Block engaging after max number of distrations
if driver_status.terminal_alert_cnt >= driver_status.settings._MAX_TERMINAL_ALERTS or \
driver_status.terminal_time >= driver_status.settings._MAX_TERMINAL_DURATION:
events.add(car.CarEvent.EventName.tooDistracted)
# Update events from driver state
driver_status.update(events, driver_engaged, sm['controlsState'].enabled, sm['carState'].standstill)
Reported by Pylint.
Line: 54
Column: 39
# Block engaging after max number of distrations
if driver_status.terminal_alert_cnt >= driver_status.settings._MAX_TERMINAL_ALERTS or \
driver_status.terminal_time >= driver_status.settings._MAX_TERMINAL_DURATION:
events.add(car.CarEvent.EventName.tooDistracted)
# Update events from driver state
driver_status.update(events, driver_engaged, sm['controlsState'].enabled, sm['carState'].standstill)
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
from cereal import car
from common.params import Params
import cereal.messaging as messaging
from selfdrive.controls.lib.events import Events
from selfdrive.monitoring.driver_monitor import DriverStatus
from selfdrive.locationd.calibrationd import Calibration
Reported by Pylint.
Line: 10
Column: 1
from selfdrive.locationd.calibrationd import Calibration
def dmonitoringd_thread(sm=None, pm=None):
if pm is None:
pm = messaging.PubMaster(['driverMonitoringState'])
if sm is None:
sm = messaging.SubMaster(['driverState', 'liveCalibration', 'carState', 'controlsState', 'modelV2'], poll=['driverState'])
Reported by Pylint.
selfdrive/camerad/test/test_exposure.py
48 issues
Line: 8
Column: 1
import os
import numpy as np
from selfdrive.test.helpers import with_processes
from selfdrive.camerad.snapshot.snapshot import get_snapshots
from selfdrive.hardware import EON, TICI
TEST_TIME = 45
Reported by Pylint.
Line: 9
Column: 1
import numpy as np
from selfdrive.test.helpers import with_processes
from selfdrive.camerad.snapshot.snapshot import get_snapshots
from selfdrive.hardware import EON, TICI
TEST_TIME = 45
REPEAT = 5
Reported by Pylint.
Line: 11
Column: 1
from selfdrive.test.helpers import with_processes
from selfdrive.camerad.snapshot.snapshot import get_snapshots
from selfdrive.hardware import EON, TICI
TEST_TIME = 45
REPEAT = 5
os.environ["SEND_ROAD"] = "1"
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
import time
import unittest
import os
import numpy as np
from selfdrive.test.helpers import with_processes
from selfdrive.camerad.snapshot.snapshot import get_snapshots
Reported by Pylint.
Line: 19
Column: 1
os.environ["SEND_ROAD"] = "1"
os.environ["SEND_DRIVER"] = "1"
if TICI:
os.environ["SEND_WIDE_ROAD"] = "1"
class TestCamerad(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not (EON or TICI):
Reported by Pylint.
Line: 21
Column: 1
if TICI:
os.environ["SEND_WIDE_ROAD"] = "1"
class TestCamerad(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not (EON or TICI):
raise unittest.SkipTest
Reported by Pylint.
Line: 22
Column: 1
os.environ["SEND_WIDE_ROAD"] = "1"
class TestCamerad(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not (EON or TICI):
raise unittest.SkipTest
def _numpy_rgb2gray(self, im):
Reported by Pylint.
Line: 23
Column: 1
class TestCamerad(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not (EON or TICI):
raise unittest.SkipTest
def _numpy_rgb2gray(self, im):
ret = np.clip(im[:,:,2] * 0.114 + im[:,:,1] * 0.587 + im[:,:,0] * 0.299, 0, 255).astype(np.uint8)
Reported by Pylint.
Line: 24
Column: 1
class TestCamerad(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not (EON or TICI):
raise unittest.SkipTest
def _numpy_rgb2gray(self, im):
ret = np.clip(im[:,:,2] * 0.114 + im[:,:,1] * 0.587 + im[:,:,0] * 0.299, 0, 255).astype(np.uint8)
return ret
Reported by Pylint.
Line: 25
Column: 1
@classmethod
def setUpClass(cls):
if not (EON or TICI):
raise unittest.SkipTest
def _numpy_rgb2gray(self, im):
ret = np.clip(im[:,:,2] * 0.114 + im[:,:,1] * 0.587 + im[:,:,0] * 0.299, 0, 255).astype(np.uint8)
return ret
Reported by Pylint.
pyextra/acados_template/generate_c_code_explicit_ode.py
45 issues
Line: 35
Column: 1
#
import os
from casadi import *
from .utils import ALLOWED_CASADI_VERSIONS, is_empty, casadi_version_warning
def generate_c_code_explicit_ode( model, opts ):
casadi_version = CasadiMeta.version()
Reported by Pylint.
Line: 36
Column: 1
import os
from casadi import *
from .utils import ALLOWED_CASADI_VERSIONS, is_empty, casadi_version_warning
def generate_c_code_explicit_ode( model, opts ):
casadi_version = CasadiMeta.version()
casadi_opts = dict(mex=False, casadi_int='int', casadi_real='double')
Reported by Pylint.
Line: 40
Column: 22
def generate_c_code_explicit_ode( model, opts ):
casadi_version = CasadiMeta.version()
casadi_opts = dict(mex=False, casadi_int='int', casadi_real='double')
if casadi_version not in (ALLOWED_CASADI_VERSIONS):
casadi_version_warning(casadi_version)
Reported by Pylint.
Line: 60
Column: 27
nx = x.size()[0]
nu = u.size()[0]
if isinstance(f_expl, casadi.MX):
symbol = MX.sym
elif isinstance(f_expl, casadi.SX):
symbol = SX.sym
else:
raise Exception("Invalid type for f_expl! Possible types are 'SX' and 'MX'. Exiting.")
Reported by Pylint.
Line: 61
Column: 18
nu = u.size()[0]
if isinstance(f_expl, casadi.MX):
symbol = MX.sym
elif isinstance(f_expl, casadi.SX):
symbol = SX.sym
else:
raise Exception("Invalid type for f_expl! Possible types are 'SX' and 'MX'. Exiting.")
## set up functions to be exported
Reported by Pylint.
Line: 62
Column: 29
if isinstance(f_expl, casadi.MX):
symbol = MX.sym
elif isinstance(f_expl, casadi.SX):
symbol = SX.sym
else:
raise Exception("Invalid type for f_expl! Possible types are 'SX' and 'MX'. Exiting.")
## set up functions to be exported
Sx = symbol('Sx', nx, nx)
Reported by Pylint.
Line: 63
Column: 18
if isinstance(f_expl, casadi.MX):
symbol = MX.sym
elif isinstance(f_expl, casadi.SX):
symbol = SX.sym
else:
raise Exception("Invalid type for f_expl! Possible types are 'SX' and 'MX'. Exiting.")
## set up functions to be exported
Sx = symbol('Sx', nx, nx)
Sp = symbol('Sp', nx, nu)
Reported by Pylint.
Line: 74
Column: 20
fun_name = model_name + '_expl_ode_fun'
## Set up functions
expl_ode_fun = Function(fun_name, [x, u, p], [f_expl])
vdeX = jtimes(f_expl,x,Sx)
vdeP = jacobian(f_expl,u) + jtimes(f_expl,x,Sp)
fun_name = model_name + '_expl_vde_forw'
Reported by Pylint.
Line: 76
Column: 12
## Set up functions
expl_ode_fun = Function(fun_name, [x, u, p], [f_expl])
vdeX = jtimes(f_expl,x,Sx)
vdeP = jacobian(f_expl,u) + jtimes(f_expl,x,Sp)
fun_name = model_name + '_expl_vde_forw'
expl_vde_forw = Function(fun_name, [x, Sx, Sp, u, p], [f_expl, vdeX, vdeP])
Reported by Pylint.
Line: 77
Column: 12
expl_ode_fun = Function(fun_name, [x, u, p], [f_expl])
vdeX = jtimes(f_expl,x,Sx)
vdeP = jacobian(f_expl,u) + jtimes(f_expl,x,Sp)
fun_name = model_name + '_expl_vde_forw'
expl_vde_forw = Function(fun_name, [x, Sx, Sp, u, p], [f_expl, vdeX, vdeP])
Reported by Pylint.
pyextra/acados_template/generate_c_code_implicit_ode.py
44 issues
Line: 35
Column: 1
#
import os
from casadi import *
from .utils import ALLOWED_CASADI_VERSIONS, is_empty, casadi_length, casadi_version_warning
def generate_c_code_implicit_ode( model, opts ):
casadi_version = CasadiMeta.version()
Reported by Pylint.
Line: 36
Column: 1
import os
from casadi import *
from .utils import ALLOWED_CASADI_VERSIONS, is_empty, casadi_length, casadi_version_warning
def generate_c_code_implicit_ode( model, opts ):
casadi_version = CasadiMeta.version()
casadi_opts = dict(mex=False, casadi_int='int', casadi_real='double')
Reported by Pylint.
Line: 40
Column: 22
def generate_c_code_implicit_ode( model, opts ):
casadi_version = CasadiMeta.version()
casadi_opts = dict(mex=False, casadi_int='int', casadi_real='double')
if casadi_version not in (ALLOWED_CASADI_VERSIONS):
casadi_version_warning(casadi_version)
generate_hess = opts["generate_hess"]
Reported by Pylint.
Line: 63
Column: 19
nz = casadi_length(z)
## generate jacobians
jac_x = jacobian(f_impl, x)
jac_xdot = jacobian(f_impl, xdot)
jac_u = jacobian(f_impl, u)
jac_z = jacobian(f_impl, z)
## generate hessian
Reported by Pylint.
Line: 64
Column: 19
## generate jacobians
jac_x = jacobian(f_impl, x)
jac_xdot = jacobian(f_impl, xdot)
jac_u = jacobian(f_impl, u)
jac_z = jacobian(f_impl, z)
## generate hessian
x_xdot_z_u = vertcat(x, xdot, z, u)
Reported by Pylint.
Line: 65
Column: 19
## generate jacobians
jac_x = jacobian(f_impl, x)
jac_xdot = jacobian(f_impl, xdot)
jac_u = jacobian(f_impl, u)
jac_z = jacobian(f_impl, z)
## generate hessian
x_xdot_z_u = vertcat(x, xdot, z, u)
Reported by Pylint.
Line: 66
Column: 19
jac_x = jacobian(f_impl, x)
jac_xdot = jacobian(f_impl, xdot)
jac_u = jacobian(f_impl, u)
jac_z = jacobian(f_impl, z)
## generate hessian
x_xdot_z_u = vertcat(x, xdot, z, u)
if isinstance(x, casadi.MX):
Reported by Pylint.
Line: 69
Column: 18
jac_z = jacobian(f_impl, z)
## generate hessian
x_xdot_z_u = vertcat(x, xdot, z, u)
if isinstance(x, casadi.MX):
symbol = MX.sym
else:
symbol = SX.sym
Reported by Pylint.
Line: 71
Column: 22
## generate hessian
x_xdot_z_u = vertcat(x, xdot, z, u)
if isinstance(x, casadi.MX):
symbol = MX.sym
else:
symbol = SX.sym
multiplier = symbol('multiplier', nx + nz)
Reported by Pylint.
Line: 72
Column: 18
x_xdot_z_u = vertcat(x, xdot, z, u)
if isinstance(x, casadi.MX):
symbol = MX.sym
else:
symbol = SX.sym
multiplier = symbol('multiplier', nx + nz)
Reported by Pylint.
selfdrive/ui/tests/test_sounds.py
43 issues
Line: 5
Column: 1
import time
import subprocess
from cereal import log, car
import cereal.messaging as messaging
from selfdrive.test.helpers import phone_only, with_processes
from common.realtime import DT_CTRL
from selfdrive.hardware import HARDWARE
Reported by Pylint.
Line: 6
Column: 1
import subprocess
from cereal import log, car
import cereal.messaging as messaging
from selfdrive.test.helpers import phone_only, with_processes
from common.realtime import DT_CTRL
from selfdrive.hardware import HARDWARE
AudibleAlert = car.CarControl.HUDControl.AudibleAlert
Reported by Pylint.
Line: 7
Column: 1
from cereal import log, car
import cereal.messaging as messaging
from selfdrive.test.helpers import phone_only, with_processes
from common.realtime import DT_CTRL
from selfdrive.hardware import HARDWARE
AudibleAlert = car.CarControl.HUDControl.AudibleAlert
Reported by Pylint.
Line: 8
Column: 1
from cereal import log, car
import cereal.messaging as messaging
from selfdrive.test.helpers import phone_only, with_processes
from common.realtime import DT_CTRL
from selfdrive.hardware import HARDWARE
AudibleAlert = car.CarControl.HUDControl.AudibleAlert
SOUNDS = {
Reported by Pylint.
Line: 9
Column: 1
import cereal.messaging as messaging
from selfdrive.test.helpers import phone_only, with_processes
from common.realtime import DT_CTRL
from selfdrive.hardware import HARDWARE
AudibleAlert = car.CarControl.HUDControl.AudibleAlert
SOUNDS = {
# sound: total writes
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
import time
import subprocess
from cereal import log, car
import cereal.messaging as messaging
from selfdrive.test.helpers import phone_only, with_processes
from common.realtime import DT_CTRL
from selfdrive.hardware import HARDWARE
Reported by Pylint.
Line: 3
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
#!/usr/bin/env python3
import time
import subprocess
from cereal import log, car
import cereal.messaging as messaging
from selfdrive.test.helpers import phone_only, with_processes
from common.realtime import DT_CTRL
from selfdrive.hardware import HARDWARE
Reported by Bandit.
Line: 9
Column: 1
import cereal.messaging as messaging
from selfdrive.test.helpers import phone_only, with_processes
from common.realtime import DT_CTRL
from selfdrive.hardware import HARDWARE
AudibleAlert = car.CarControl.HUDControl.AudibleAlert
SOUNDS = {
# sound: total writes
Reported by Pylint.
Line: 26
Column: 1
AudibleAlert.chimeWarningRepeat: 468,
}
def get_total_writes():
audio_flinger = subprocess.check_output('dumpsys media.audio_flinger', shell=True, encoding='utf-8').strip()
write_lines = [l for l in audio_flinger.split('\n') if l.strip().startswith('Total writes')]
return sum([int(l.split(':')[1]) for l in write_lines])
@phone_only
Reported by Pylint.
Line: 27
Column: 1
}
def get_total_writes():
audio_flinger = subprocess.check_output('dumpsys media.audio_flinger', shell=True, encoding='utf-8').strip()
write_lines = [l for l in audio_flinger.split('\n') if l.strip().startswith('Total writes')]
return sum([int(l.split(':')[1]) for l in write_lines])
@phone_only
def test_sound_card_init():
Reported by Pylint.
selfdrive/camerad/test/test_camerad.py
42 issues
Line: 6
Column: 1
import time
import unittest
import cereal.messaging as messaging
from selfdrive.test.helpers import with_processes
# only tests for EON and TICI
from selfdrive.hardware import EON, TICI
Reported by Pylint.
Line: 7
Column: 1
import unittest
import cereal.messaging as messaging
from selfdrive.test.helpers import with_processes
# only tests for EON and TICI
from selfdrive.hardware import EON, TICI
TEST_TIMESPAN = 30 # random.randint(60, 180) # seconds
Reported by Pylint.
Line: 10
Column: 1
from selfdrive.test.helpers import with_processes
# only tests for EON and TICI
from selfdrive.hardware import EON, TICI
TEST_TIMESPAN = 30 # random.randint(60, 180) # seconds
SKIP_FRAME_TOLERANCE = 0
LAG_FRAME_TOLERANCE = 2 # ms
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
import time
import unittest
import cereal.messaging as messaging
from selfdrive.test.helpers import with_processes
# only tests for EON and TICI
Reported by Pylint.
Line: 23
Column: 1
}
if TICI:
CAMERAS["driverCameraState"] = FPS_BASELINE
CAMERAS["wideRoadCameraState"] = FPS_BASELINE
class TestCamerad(unittest.TestCase):
@classmethod
def setUpClass(cls):
Reported by Pylint.
Line: 24
Column: 1
if TICI:
CAMERAS["driverCameraState"] = FPS_BASELINE
CAMERAS["wideRoadCameraState"] = FPS_BASELINE
class TestCamerad(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not (EON or TICI):
Reported by Pylint.
Line: 26
Column: 1
CAMERAS["driverCameraState"] = FPS_BASELINE
CAMERAS["wideRoadCameraState"] = FPS_BASELINE
class TestCamerad(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not (EON or TICI):
raise unittest.SkipTest
Reported by Pylint.
Line: 27
Column: 1
CAMERAS["wideRoadCameraState"] = FPS_BASELINE
class TestCamerad(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not (EON or TICI):
raise unittest.SkipTest
@with_processes(['camerad'])
Reported by Pylint.
Line: 28
Column: 1
class TestCamerad(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not (EON or TICI):
raise unittest.SkipTest
@with_processes(['camerad'])
def test_frame_packets(self):
Reported by Pylint.
Line: 29
Column: 1
class TestCamerad(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not (EON or TICI):
raise unittest.SkipTest
@with_processes(['camerad'])
def test_frame_packets(self):
print("checking frame pkts continuity")
Reported by Pylint.
site_scons/site_tools/cython.py
42 issues
Line: 2
Column: 1
import re
import SCons
from SCons.Action import Action
from SCons.Scanner import Scanner
pyx_from_import_re = re.compile(r'^from\s+(\S+)\s+cimport', re.M)
pyx_import_re = re.compile(r'^cimport\s+(\S+)', re.M)
cdef_import_re = re.compile(r'^cdef extern from\s+.(\S+).:', re.M)
Reported by Pylint.
Line: 3
Column: 1
import re
import SCons
from SCons.Action import Action
from SCons.Scanner import Scanner
pyx_from_import_re = re.compile(r'^from\s+(\S+)\s+cimport', re.M)
pyx_import_re = re.compile(r'^cimport\s+(\S+)', re.M)
cdef_import_re = re.compile(r'^cdef extern from\s+.(\S+).:', re.M)
Reported by Pylint.
Line: 4
Column: 1
import re
import SCons
from SCons.Action import Action
from SCons.Scanner import Scanner
pyx_from_import_re = re.compile(r'^from\s+(\S+)\s+cimport', re.M)
pyx_import_re = re.compile(r'^cimport\s+(\S+)', re.M)
cdef_import_re = re.compile(r'^cdef extern from\s+.(\S+).:', re.M)
Reported by Pylint.
Line: 11
Column: 25
cdef_import_re = re.compile(r'^cdef extern from\s+.(\S+).:', re.M)
def pyx_scan(node, env, path, arg=None):
contents = node.get_text_contents()
# from <module> cimport ...
matches = pyx_from_import_re.findall(contents)
# cimport <module>
Reported by Pylint.
Line: 11
Column: 31
cdef_import_re = re.compile(r'^cdef extern from\s+.(\S+).:', re.M)
def pyx_scan(node, env, path, arg=None):
contents = node.get_text_contents()
# from <module> cimport ...
matches = pyx_from_import_re.findall(contents)
# cimport <module>
Reported by Pylint.
Line: 53
Column: 27
env['BUILDERS']['Cython'] = cython
return cython
def cython_suffix_emitter(env, source):
return "$CYTHONCFILESUFFIX"
def generate(env):
env["CYTHON"] = "cythonize"
env["CYTHONCOM"] = "$CYTHON $CYTHONFLAGS $SOURCE"
Reported by Pylint.
Line: 53
Column: 32
env['BUILDERS']['Cython'] = cython
return cython
def cython_suffix_emitter(env, source):
return "$CYTHONCFILESUFFIX"
def generate(env):
env["CYTHON"] = "cythonize"
env["CYTHONCOM"] = "$CYTHON $CYTHONFLAGS $SOURCE"
Reported by Pylint.
Line: 71
Column: 12
create_builder(env)
def exists(env):
return True
Reported by Pylint.
Line: 1
Column: 1
import re
import SCons
from SCons.Action import Action
from SCons.Scanner import Scanner
pyx_from_import_re = re.compile(r'^from\s+(\S+)\s+cimport', re.M)
pyx_import_re = re.compile(r'^cimport\s+(\S+)', re.M)
cdef_import_re = re.compile(r'^cdef extern from\s+.(\S+).:', re.M)
Reported by Pylint.
Line: 11
Column: 1
cdef_import_re = re.compile(r'^cdef extern from\s+.(\S+).:', re.M)
def pyx_scan(node, env, path, arg=None):
contents = node.get_text_contents()
# from <module> cimport ...
matches = pyx_from_import_re.findall(contents)
# cimport <module>
Reported by Pylint.
selfdrive/logcatd/tests/test_logcatd_android.py
41 issues
Line: 29
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b605_start_process_with_a_shell.html
if msg in sent_msgs:
continue
sent_msgs[msg] = ''.join([random.choice(string.ascii_letters) for _ in range(random.randrange(2, 20))])
os.system(f"log -t '{sent_msgs[msg]}' '{msg}'")
time.sleep(1)
msgs = messaging.drain_sock(sock)
for m in msgs:
self.assertTrue(m.valid)
Reported by Bandit.
Line: 8
Column: 1
import time
import unittest
import cereal.messaging as messaging
from selfdrive.test.helpers import with_processes
class TestLogcatdAndroid(unittest.TestCase):
@with_processes(['logcatd'])
Reported by Pylint.
Line: 9
Column: 1
import unittest
import cereal.messaging as messaging
from selfdrive.test.helpers import with_processes
class TestLogcatdAndroid(unittest.TestCase):
@with_processes(['logcatd'])
def test_log(self):
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
import os
import random
import string
import time
import unittest
import cereal.messaging as messaging
from selfdrive.test.helpers import with_processes
Reported by Pylint.
Line: 11
Column: 1
import cereal.messaging as messaging
from selfdrive.test.helpers import with_processes
class TestLogcatdAndroid(unittest.TestCase):
@with_processes(['logcatd'])
def test_log(self):
sock = messaging.sub_sock("androidLog", conflate=False)
Reported by Pylint.
Line: 13
Column: 1
class TestLogcatdAndroid(unittest.TestCase):
@with_processes(['logcatd'])
def test_log(self):
sock = messaging.sub_sock("androidLog", conflate=False)
# make sure sockets are ready
time.sleep(1)
Reported by Pylint.
Line: 14
Column: 1
class TestLogcatdAndroid(unittest.TestCase):
@with_processes(['logcatd'])
def test_log(self):
sock = messaging.sub_sock("androidLog", conflate=False)
# make sure sockets are ready
time.sleep(1)
messaging.drain_sock(sock)
Reported by Pylint.
Line: 14
Column: 3
class TestLogcatdAndroid(unittest.TestCase):
@with_processes(['logcatd'])
def test_log(self):
sock = messaging.sub_sock("androidLog", conflate=False)
# make sure sockets are ready
time.sleep(1)
messaging.drain_sock(sock)
Reported by Pylint.
Line: 15
Column: 1
@with_processes(['logcatd'])
def test_log(self):
sock = messaging.sub_sock("androidLog", conflate=False)
# make sure sockets are ready
time.sleep(1)
messaging.drain_sock(sock)
Reported by Pylint.
Line: 18
Column: 1
sock = messaging.sub_sock("androidLog", conflate=False)
# make sure sockets are ready
time.sleep(1)
messaging.drain_sock(sock)
for _ in range(random.randint(2, 10)):
# write some log messages
sent_msgs = {}
Reported by Pylint.