* Reapply "selfdrive/car: ban imports from external modules" (#32993) This reverts commit 626d78ec548fe19acfdf3c2c3e063fac3b257dc6. * controls will just use controls * also these * ignore old-commit-hash: d684d8f0f6900d80a2a1618099b0b8e19e6492a2
This commit is contained in:
44
.importlinter
Normal file
44
.importlinter
Normal file
@@ -0,0 +1,44 @@
|
||||
[importlinter]
|
||||
root_packages =
|
||||
openpilot
|
||||
|
||||
[importlinter:contract:1]
|
||||
name = Forbid imports from openpilot.selfdrive.car to openpilot.system
|
||||
type = forbidden
|
||||
source_modules =
|
||||
openpilot.selfdrive.car
|
||||
forbidden_modules =
|
||||
openpilot.system
|
||||
openpilot.body
|
||||
openpilot.docs
|
||||
openpilot.msgq
|
||||
openpilot.panda
|
||||
openpilot.rednose
|
||||
openpilot.release
|
||||
openpilot.teleoprtc
|
||||
openpilot.tinygrad
|
||||
ignore_imports =
|
||||
openpilot.selfdrive.car.card -> openpilot.common.realtime
|
||||
openpilot.selfdrive.car.card -> openpilot.selfdrive.controls.lib.events
|
||||
openpilot.selfdrive.car.interfaces -> openpilot.selfdrive.controls.lib.events
|
||||
openpilot.selfdrive.car.tests.test_models -> openpilot.tools.lib.logreader
|
||||
openpilot.selfdrive.car.tests.test_models -> openpilot.selfdrive.car.card
|
||||
openpilot.selfdrive.car.tests.test_models -> openpilot.tools.lib.route
|
||||
openpilot.selfdrive.car.tests.test_models -> openpilot.system.hardware.hw
|
||||
openpilot.selfdrive.car.tests.test_models -> openpilot.selfdrive.test.helpers
|
||||
openpilot.selfdrive.car.isotp_parallel_query -> openpilot.common.swaglog
|
||||
openpilot.selfdrive.car.fw_versions -> openpilot.common.swaglog
|
||||
openpilot.selfdrive.car.disable_ecu -> openpilot.common.swaglog
|
||||
openpilot.selfdrive.car.vin -> openpilot.common.swaglog
|
||||
openpilot.selfdrive.car.ecu_addrs -> openpilot.common.swaglog
|
||||
openpilot.selfdrive.car.car_helpers -> openpilot.common.swaglog
|
||||
openpilot.selfdrive.car.car_helpers -> openpilot.system.version
|
||||
openpilot.selfdrive.car.ford.carcontroller -> openpilot.selfdrive.controls.lib.drive_helpers
|
||||
openpilot.selfdrive.car.gm.interface -> openpilot.selfdrive.controls.lib.drive_helpers
|
||||
openpilot.selfdrive.car.honda.carcontroller -> openpilot.selfdrive.controls.lib.drive_helpers
|
||||
openpilot.selfdrive.car.interfaces -> openpilot.selfdrive.controls.lib.drive_helpers
|
||||
openpilot.selfdrive.car.tests.test_car_interfaces -> openpilot.selfdrive.controls.lib.latcontrol_angle
|
||||
openpilot.selfdrive.car.tests.test_car_interfaces -> openpilot.selfdrive.controls.lib.longcontrol
|
||||
openpilot.selfdrive.car.tests.test_car_interfaces -> openpilot.selfdrive.controls.lib.latcontrol_torque
|
||||
openpilot.selfdrive.car.tests.test_car_interfaces -> openpilot.selfdrive.controls.lib.latcontrol_pid
|
||||
unmatched_ignore_imports_alerting = warn
|
||||
@@ -96,3 +96,10 @@ repos:
|
||||
rev: 0.29.0
|
||||
hooks:
|
||||
- id: check-github-workflows
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: import-linter
|
||||
name: import linter
|
||||
entry: lint-imports
|
||||
language: system
|
||||
pass_filenames: false
|
||||
|
||||
@@ -73,6 +73,7 @@ docs = [
|
||||
testing = [
|
||||
"coverage",
|
||||
"hypothesis ==6.47.*",
|
||||
"import-linter",
|
||||
"mypy",
|
||||
"pre-commit",
|
||||
"pytest",
|
||||
|
||||
@@ -11,6 +11,7 @@ from openpilot.common.numpy_fast import clip, interp
|
||||
from openpilot.common.utils import Freezable
|
||||
from openpilot.selfdrive.car.docs_definitions import CarDocs
|
||||
|
||||
DT_CTRL = 0.01 # car state and control loop timestep (s)
|
||||
|
||||
# kg of standard extra cargo to count for drive, gas, etc...
|
||||
STD_CARGO_KG = 136.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import numpy as np
|
||||
|
||||
from openpilot.common.realtime import DT_CTRL
|
||||
from opendbc.can.packer import CANPacker
|
||||
from openpilot.selfdrive.car import DT_CTRL
|
||||
from openpilot.selfdrive.car.body import bodycan
|
||||
from openpilot.selfdrive.car.body.values import SPEED_FROM_RPM
|
||||
from openpilot.selfdrive.car.interfaces import CarControllerBase
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import math
|
||||
from cereal import car
|
||||
from openpilot.common.realtime import DT_CTRL
|
||||
from openpilot.selfdrive.car import get_safety_config
|
||||
from openpilot.selfdrive.car import DT_CTRL, get_safety_config
|
||||
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
|
||||
from openpilot.selfdrive.car.body.values import SPEED_FROM_RPM
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@ from cereal import car
|
||||
from panda import ALTERNATIVE_EXPERIENCE
|
||||
|
||||
from openpilot.common.params import Params
|
||||
from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper, DT_CTRL
|
||||
from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper
|
||||
|
||||
from openpilot.selfdrive.pandad import can_list_to_can_capnp
|
||||
from openpilot.selfdrive.car import DT_CTRL
|
||||
from openpilot.selfdrive.car.car_helpers import get_car, get_one_can
|
||||
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
|
||||
from openpilot.selfdrive.controls.lib.events import Events
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from opendbc.can.packer import CANPacker
|
||||
from openpilot.common.realtime import DT_CTRL
|
||||
from openpilot.selfdrive.car import apply_meas_steer_torque_limits
|
||||
from openpilot.selfdrive.car import DT_CTRL, apply_meas_steer_torque_limits
|
||||
from openpilot.selfdrive.car.chrysler import chryslercan
|
||||
from openpilot.selfdrive.car.chrysler.values import RAM_CARS, CarControllerParams, ChryslerFlags
|
||||
from openpilot.selfdrive.car.interfaces import CarControllerBase
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from cereal import car
|
||||
from openpilot.common.conversions import Conversions as CV
|
||||
from openpilot.common.numpy_fast import interp
|
||||
from openpilot.common.realtime import DT_CTRL
|
||||
from opendbc.can.packer import CANPacker
|
||||
from openpilot.selfdrive.car import apply_driver_steer_torque_limits
|
||||
from openpilot.selfdrive.car import DT_CTRL, apply_driver_steer_torque_limits
|
||||
from openpilot.selfdrive.car.gm import gmcan
|
||||
from openpilot.selfdrive.car.gm.values import DBC, CanBus, CarControllerParams, CruiseButtons
|
||||
from openpilot.selfdrive.car.interfaces import CarControllerBase
|
||||
|
||||
@@ -2,8 +2,8 @@ from collections import namedtuple
|
||||
|
||||
from cereal import car
|
||||
from openpilot.common.numpy_fast import clip, interp
|
||||
from openpilot.common.realtime import DT_CTRL
|
||||
from opendbc.can.packer import CANPacker
|
||||
from openpilot.selfdrive.car import DT_CTRL
|
||||
from openpilot.selfdrive.car.honda import hondacan
|
||||
from openpilot.selfdrive.car.honda.values import CruiseButtons, VISUAL_HUD, HONDA_BOSCH, HONDA_BOSCH_RADARLESS, HONDA_NIDEC_ALT_PCM_ACCEL, CarControllerParams
|
||||
from openpilot.selfdrive.car.interfaces import CarControllerBase
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from cereal import car
|
||||
from openpilot.common.conversions import Conversions as CV
|
||||
from openpilot.common.numpy_fast import clip
|
||||
from openpilot.common.realtime import DT_CTRL
|
||||
from opendbc.can.packer import CANPacker
|
||||
from openpilot.selfdrive.car import apply_driver_steer_torque_limits, common_fault_avoidance
|
||||
from openpilot.selfdrive.car import DT_CTRL, apply_driver_steer_torque_limits, common_fault_avoidance
|
||||
from openpilot.selfdrive.car.hyundai import hyundaicanfd, hyundaican
|
||||
from openpilot.selfdrive.car.hyundai.hyundaicanfd import CanBus
|
||||
from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, Buttons, CarControllerParams, CANFD_CAR, CAR
|
||||
|
||||
@@ -13,8 +13,7 @@ from openpilot.common.basedir import BASEDIR
|
||||
from openpilot.common.conversions import Conversions as CV
|
||||
from openpilot.common.simple_kalman import KF1D, get_kalman_gain
|
||||
from openpilot.common.numpy_fast import clip
|
||||
from openpilot.common.realtime import DT_CTRL
|
||||
from openpilot.selfdrive.car import apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, STD_CARGO_KG
|
||||
from openpilot.selfdrive.car import DT_CTRL, apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, STD_CARGO_KG
|
||||
from openpilot.selfdrive.car.values import PLATFORMS
|
||||
from openpilot.selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX, get_friction
|
||||
from openpilot.selfdrive.controls.lib.events import Events
|
||||
|
||||
@@ -6,8 +6,7 @@ import importlib
|
||||
from parameterized import parameterized
|
||||
|
||||
from cereal import car, messaging
|
||||
from openpilot.common.realtime import DT_CTRL
|
||||
from openpilot.selfdrive.car import gen_empty_fingerprint
|
||||
from openpilot.selfdrive.car import DT_CTRL, gen_empty_fingerprint
|
||||
from openpilot.selfdrive.car.car_helpers import interfaces
|
||||
from openpilot.selfdrive.car.fingerprints import all_known_cars
|
||||
from openpilot.selfdrive.car.fw_versions import FW_VERSIONS, FW_QUERY_CONFIGS
|
||||
|
||||
@@ -5,7 +5,7 @@ from parameterized import parameterized_class
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
from openpilot.common.realtime import DT_CTRL
|
||||
from openpilot.selfdrive.car import DT_CTRL
|
||||
from openpilot.selfdrive.car.car_helpers import interfaces
|
||||
from openpilot.selfdrive.car.fingerprints import all_known_cars
|
||||
from openpilot.selfdrive.car.interfaces import get_torque_params
|
||||
|
||||
@@ -12,14 +12,13 @@ from parameterized import parameterized_class
|
||||
from cereal import messaging, log, car
|
||||
from openpilot.common.basedir import BASEDIR
|
||||
from openpilot.common.params import Params
|
||||
from openpilot.common.realtime import DT_CTRL
|
||||
from openpilot.selfdrive.car import gen_empty_fingerprint
|
||||
from openpilot.selfdrive.car.card import Car
|
||||
from openpilot.selfdrive.car import DT_CTRL, gen_empty_fingerprint
|
||||
from openpilot.selfdrive.car.fingerprints import all_known_cars, MIGRATION
|
||||
from openpilot.selfdrive.car.car_helpers import FRAME_FINGERPRINT, interfaces
|
||||
from openpilot.selfdrive.car.honda.values import CAR as HONDA, HondaFlags
|
||||
from openpilot.selfdrive.car.tests.routes import non_tested_cars, routes, CarTestRoute
|
||||
from openpilot.selfdrive.car.values import Platform
|
||||
from openpilot.selfdrive.car.card import Car
|
||||
from openpilot.selfdrive.test.helpers import read_segment_list
|
||||
from openpilot.system.hardware.hw import DEFAULT_DOWNLOAD_CACHE_ROOT
|
||||
from openpilot.tools.lib.logreader import LogReader, internal_source, openpilotci_source
|
||||
|
||||
@@ -4,9 +4,9 @@ from cereal import car
|
||||
from openpilot.common.conversions import Conversions as CV
|
||||
from openpilot.common.numpy_fast import mean
|
||||
from openpilot.common.filter_simple import FirstOrderFilter
|
||||
from openpilot.common.realtime import DT_CTRL
|
||||
from opendbc.can.can_define import CANDefine
|
||||
from opendbc.can.parser import CANParser
|
||||
from openpilot.selfdrive.car import DT_CTRL
|
||||
from openpilot.selfdrive.car.interfaces import CarStateBase
|
||||
from openpilot.selfdrive.car.toyota.values import ToyotaFlags, CAR, DBC, STEER_THRESHOLD, NO_STOP_TIMER_CAR, \
|
||||
TSS2_CAR, RADAR_ACC_CAR, EPS_SCALE, UNSUPPORTED_DSU_CAR
|
||||
|
||||
@@ -2,8 +2,7 @@ from cereal import car
|
||||
from opendbc.can.packer import CANPacker
|
||||
from openpilot.common.numpy_fast import clip
|
||||
from openpilot.common.conversions import Conversions as CV
|
||||
from openpilot.common.realtime import DT_CTRL
|
||||
from openpilot.selfdrive.car import apply_driver_steer_torque_limits
|
||||
from openpilot.selfdrive.car import DT_CTRL, apply_driver_steer_torque_limits
|
||||
from openpilot.selfdrive.car.interfaces import CarControllerBase
|
||||
from openpilot.selfdrive.car.volkswagen import mqbcan, pqcan
|
||||
from openpilot.selfdrive.car.volkswagen.values import CANBUS, CarControllerParams, VolkswagenFlags
|
||||
|
||||
Reference in New Issue
Block a user