diff --git a/pyproject.toml b/pyproject.toml index 1c7d857652..b4a795accc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -167,7 +167,7 @@ build-backend = "poetry.core.masonry.api" # https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml [tool.ruff] -select = ["E", "F", "W", "PIE", "C4", "ISC", "RUF100", "A", "B"] +select = ["E", "F", "W", "PIE", "C4", "ISC", "RUF100", "A", "B", "TID251"] ignore = ["W292", "E741", "E402", "C408", "ISC003", "B027", "B024"] line-length = 160 target-version="py311" @@ -180,3 +180,9 @@ exclude = [ "third_party", ] flake8-implicit-str-concat.allow-multiline=false +[tool.ruff.flake8-tidy-imports.banned-api] +"selfdrive".msg = "Use openpilot.selfdrive" +"common".msg = "Use openpilot.common" +"system".msg = "Use openpilot.system" +"third_party".msg = "Use openpilot.third_party" +"tools".msg = "Use openpilot.tools" \ No newline at end of file diff --git a/selfdrive/athena/athenad.py b/selfdrive/athena/athenad.py index 4817691af8..899605d989 100755 --- a/selfdrive/athena/athenad.py +++ b/selfdrive/athena/athenad.py @@ -40,7 +40,7 @@ from openpilot.system.loggerd.xattr_cache import getxattr, setxattr from openpilot.selfdrive.statsd import STATS_DIR from openpilot.system.swaglog import cloudlog from openpilot.system.version import get_commit, get_origin, get_short_branch, get_version -from selfdrive.hardware.hw import Paths +from openpilot.selfdrive.hardware.hw import Paths # TODO: use socket constant when mypy recognizes this as a valid attribute diff --git a/selfdrive/athena/tests/test_athenad.py b/selfdrive/athena/tests/test_athenad.py index bef622a75e..f4c229188e 100755 --- a/selfdrive/athena/tests/test_athenad.py +++ b/selfdrive/athena/tests/test_athenad.py @@ -21,7 +21,7 @@ from openpilot.selfdrive.athena import athenad from openpilot.selfdrive.athena.athenad import MAX_RETRY_COUNT, dispatcher from openpilot.selfdrive.athena.tests.helpers import MockWebsocket, MockParams, MockApi, EchoSocket, with_http_server from cereal import messaging -from selfdrive.hardware.hw import Paths +from openpilot.selfdrive.hardware.hw import Paths class TestAthenadMethods(unittest.TestCase): diff --git a/selfdrive/controls/tests/test_leads.py b/selfdrive/controls/tests/test_leads.py index bd8baf096e..268d9c47a7 100755 --- a/selfdrive/controls/tests/test_leads.py +++ b/selfdrive/controls/tests/test_leads.py @@ -3,8 +3,8 @@ import unittest import cereal.messaging as messaging -from selfdrive.test.process_replay import replay_process_with_name -from selfdrive.car.toyota.values import CAR as TOYOTA +from openpilot.selfdrive.test.process_replay import replay_process_with_name +from openpilot.selfdrive.car.toyota.values import CAR as TOYOTA class TestLeads(unittest.TestCase): diff --git a/system/swaglog.py b/system/swaglog.py index 8130aeb0fb..ba81318234 100644 --- a/system/swaglog.py +++ b/system/swaglog.py @@ -8,7 +8,7 @@ from logging.handlers import BaseRotatingHandler import zmq from openpilot.common.logging_extra import SwagLogger, SwagFormatter, SwagLogFileFormatter -from system.hardware.hw import Paths +from openpilot.system.hardware.hw import Paths def get_file_handler():