diff --git a/openpilot/common/gpio.py b/openpilot/common/gpio.py index 8f025a2daf..5f4295e7bd 100644 --- a/openpilot/common/gpio.py +++ b/openpilot/common/gpio.py @@ -27,16 +27,6 @@ def gpio_read(pin: int) -> bool | None: return val -def gpio_export(pin: int) -> None: - if os.path.isdir(f"/sys/class/gpio/gpio{pin}"): - return - - try: - with open("/sys/class/gpio/export", 'w') as f: - f.write(str(pin)) - except Exception: - print(f"Failed to export gpio {pin}") - @cache def get_irq_action(irq: int) -> list[str]: try: diff --git a/openpilot/common/utils.py b/openpilot/common/utils.py index a73d2b8226..28b3782a4c 100644 --- a/openpilot/common/utils.py +++ b/openpilot/common/utils.py @@ -5,7 +5,6 @@ import contextlib import subprocess import time import functools -from subprocess import Popen, PIPE, TimeoutExpired import zstandard as zstd LOG_COMPRESSION_LEVEL = 10 # little benefit up to level 15. level ~17 is a small step change @@ -157,20 +156,6 @@ def run_cmd_default(cmd: list[str], default: str = "", cwd=None, env=None) -> st return default -@contextlib.contextmanager -def managed_proc(cmd: list[str], env: dict[str, str]): - proc = Popen(cmd, env=env, stdout=PIPE, stderr=PIPE) - try: - yield proc - finally: - if proc.poll() is None: - proc.terminate() - try: - proc.wait(timeout=5) - except TimeoutExpired: - proc.kill() - - def tabulate(tabular_data, headers=(), tablefmt="simple", floatfmt="g", stralign="left", numalign=None): rows = [list(row) for row in tabular_data] diff --git a/openpilot/selfdrive/controls/lib/drive_helpers.py b/openpilot/selfdrive/controls/lib/drive_helpers.py index 35ca45e56e..c350cff632 100644 --- a/openpilot/selfdrive/controls/lib/drive_helpers.py +++ b/openpilot/selfdrive/controls/lib/drive_helpers.py @@ -4,7 +4,6 @@ from openpilot.common.realtime import DT_CTRL, DT_MDL MIN_SPEED = 1.0 CONTROL_N = 17 -CAR_ROTATION_RADIUS = 0.0 # This is a turn radius smaller than most cars can achieve MAX_CURVATURE = 0.2 MIN_STABLE_DELAY = 0.3 diff --git a/openpilot/selfdrive/test/helpers.py b/openpilot/selfdrive/test/helpers.py index 71cdcee5e7..aa949edf70 100644 --- a/openpilot/selfdrive/test/helpers.py +++ b/openpilot/selfdrive/test/helpers.py @@ -105,17 +105,6 @@ def with_processes(processes, init_time=0, ignore_stopped=None): return wrapper -def noop(*args, **kwargs): - pass - - -def read_segment_list(segment_list_path): - with open(segment_list_path) as f: - seg_list = f.read().splitlines() - - return [(platform[2:], segment) for platform, segment in zip(seg_list[::2], seg_list[1::2], strict=True)] - - @contextlib.contextmanager def http_server_context(handler, setup=None): host = '127.0.0.1' @@ -133,32 +122,3 @@ def http_server_context(handler, setup=None): server.shutdown() server.server_close() t.join() - - -def with_http_server(func, handler=http.server.BaseHTTPRequestHandler, setup=None): - @wraps(func) - def inner(*args, **kwargs): - with http_server_context(handler, setup) as (host, port): - return func(*args, f"http://{host}:{port}", **kwargs) - return inner - - -def DirectoryHttpServer(directory) -> type[http.server.SimpleHTTPRequestHandler]: - # creates an http server that serves files from directory - class Handler(http.server.SimpleHTTPRequestHandler): - API_NO_RESPONSE = False - API_BAD_RESPONSE = False - - def do_GET(self): - if self.API_NO_RESPONSE: - return - - if self.API_BAD_RESPONSE: - self.send_response(500, "") - return - super().do_GET() - - def __init__(self, *args, **kwargs): - super().__init__(*args, directory=str(directory), **kwargs) - - return Handler diff --git a/openpilot/tools/lib/auth_config.py b/openpilot/tools/lib/auth_config.py index 954225d4d3..cc29b3ba1a 100644 --- a/openpilot/tools/lib/auth_config.py +++ b/openpilot/tools/lib/auth_config.py @@ -21,10 +21,3 @@ def set_token(token): os.makedirs(Paths.config_root(), exist_ok=True) with atomic_write(os.path.join(Paths.config_root(), 'auth.json'), overwrite=True) as f: json.dump({'access_token': token}, f) - - -def clear_token(): - try: - os.unlink(os.path.join(Paths.config_root(), 'auth.json')) - except FileNotFoundError: - pass