repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/sim/bridge/metadrive/metadrive_world.py | tools/sim/bridge/metadrive/metadrive_world.py | import ctypes
import functools
import multiprocessing
import numpy as np
import time
from multiprocessing import Pipe, Array
from openpilot.tools.sim.bridge.common import QueueMessage, QueueMessageType
from openpilot.tools.sim.bridge.metadrive.metadrive_process import (metadrive_process, metadrive_simulation_state,
... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/sim/bridge/metadrive/metadrive_bridge.py | tools/sim/bridge/metadrive/metadrive_bridge.py | import math
from multiprocessing import Queue
from metadrive.component.sensors.base_camera import _cuda_enable
from metadrive.component.map.pg_map import MapGenerateMethod
from openpilot.tools.sim.bridge.common import SimulatorBridge
from openpilot.tools.sim.bridge.metadrive.metadrive_common import RGBCameraRoad, RGB... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/sim/tests/test_sim_bridge.py | tools/sim/tests/test_sim_bridge.py | import os
import subprocess
import time
import pytest
from multiprocessing import Queue
from cereal import messaging
from openpilot.common.basedir import BASEDIR
from openpilot.tools.sim.bridge.common import QueueMessageType
SIM_DIR = os.path.join(BASEDIR, "tools/sim")
class TestSimBridgeBase:
@classmethod
def ... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/sim/tests/conftest.py | tools/sim/tests/conftest.py | import pytest
def pytest_addoption(parser):
parser.addoption("--test_duration", action="store", default=60, type=int, help="Seconds to run metadrive drive")
@pytest.fixture
def test_duration(request):
return request.config.getoption("--test_duration")
| python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/sim/tests/__init__.py | tools/sim/tests/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/sim/tests/test_metadrive_bridge.py | tools/sim/tests/test_metadrive_bridge.py | import pytest
import warnings
# Since metadrive depends on pkg_resources, and pkg_resources is deprecated as an API
warnings.filterwarnings("ignore", category=DeprecationWarning)
from openpilot.tools.sim.bridge.metadrive.metadrive_bridge import MetaDriveBridge
from openpilot.tools.sim.tests.test_sim_bridge import Tes... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/sim/lib/simulated_sensors.py | tools/sim/lib/simulated_sensors.py | import time
from cereal import log
import cereal.messaging as messaging
from openpilot.common.realtime import DT_DMON
from openpilot.tools.sim.lib.camerad import Camerad
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from openpilot.tools.sim.lib.common import World, SimulatorState
class SimulatedSensors:
"... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/sim/lib/common.py | tools/sim/lib/common.py | import math
import multiprocessing
import numpy as np
from abc import ABC, abstractmethod
from collections import namedtuple
W, H = 1928, 1208
vec3 = namedtuple("vec3", ["x", "y", "z"])
class GPSState:
def __init__(self):
self.latitude = 0
self.longitude = 0
self.altitude = 0
def from_xy(self, xy)... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/sim/lib/manual_ctrl.py | tools/sim/lib/manual_ctrl.py | #!/usr/bin/env python3
# set up wheel
import array
import os
import struct
from fcntl import ioctl
from typing import NoReturn
from openpilot.tools.sim.bridge.common import control_cmd_gen
# Iterate over the joystick devices.
print('Available devices:')
for fn in os.listdir('/dev/input'):
if fn.startswith('js'):
... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/sim/lib/keyboard_ctrl.py | tools/sim/lib/keyboard_ctrl.py | import sys
import termios
import time
from multiprocessing import Queue
from termios import (BRKINT, CS8, CSIZE, ECHO, ICANON, ICRNL, IEXTEN, INPCK,
ISTRIP, IXON, PARENB, VMIN, VTIME)
from typing import NoReturn
from openpilot.tools.sim.bridge.common import QueueMessage, control_cmd_gen
# Indexe... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/sim/lib/simulated_car.py | tools/sim/lib/simulated_car.py | import traceback
import cereal.messaging as messaging
from opendbc.can.packer import CANPacker
from opendbc.can.parser import CANParser
from opendbc.car.honda.values import HondaSafetyFlags
from openpilot.common.params import Params
from openpilot.selfdrive.pandad.pandad_api_impl import can_list_to_can_capnp
from open... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/sim/lib/__init__.py | tools/sim/lib/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/sim/lib/camerad.py | tools/sim/lib/camerad.py | import numpy as np
import os
import pyopencl as cl
import pyopencl.array as cl_array
from msgq.visionipc import VisionIpcServer, VisionStreamType
from cereal import messaging
from openpilot.common.basedir import BASEDIR
from openpilot.tools.sim.lib.common import W, H
class Camerad:
"""Simulates the camerad daemon"... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/car_porting/auto_fingerprint.py | tools/car_porting/auto_fingerprint.py | #!/usr/bin/env python3
import argparse
from collections import defaultdict
from openpilot.selfdrive.debug.format_fingerprints import format_brand_fw_versions
from opendbc.car.fingerprints import MIGRATION
from opendbc.car.fw_versions import MODEL_TO_BRAND, match_fw_to_car
from openpilot.tools.lib.logreader import Log... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/car_porting/test_car_model.py | tools/car_porting/test_car_model.py | #!/usr/bin/env python3
import argparse
import sys
import unittest # noqa: TID251
from opendbc.car.tests.routes import CarTestRoute
from openpilot.selfdrive.car.tests.test_models import TestCarModel
from openpilot.tools.lib.route import SegmentRange
def create_test_models_suite(routes: list[CarTestRoute]) -> unittest... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/replay/ui.py | tools/replay/ui.py | #!/usr/bin/env python3
import argparse
import os
import sys
import cv2
import numpy as np
import pygame
import cereal.messaging as messaging
from openpilot.common.basedir import BASEDIR
from openpilot.common.transformations.camera import DEVICE_CAMERAS
from openpilot.tools.replay.lib.ui_helpers import (UP,
... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/replay/rp_visualization.py | tools/replay/rp_visualization.py | #!/usr/bin/env python3
import argparse
import os
import sys
import numpy as np
import rerun as rr
import cereal.messaging as messaging
from openpilot.common.basedir import BASEDIR
from openpilot.tools.replay.lib.rp_helpers import (UP, rerunColorPalette,
get_blank_lid_overlay,
... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/replay/__init__.py | tools/replay/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/replay/unlog_ci_segment.py | tools/replay/unlog_ci_segment.py | #!/usr/bin/env python3
import argparse
import bisect
import select
import sys
import termios
import time
import tty
from collections import defaultdict
import cereal.messaging as messaging
from openpilot.tools.lib.framereader import FrameReader
from openpilot.tools.lib.logreader import LogReader
from openpilot.tools.... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/replay/can_replay.py | tools/replay/can_replay.py | #!/usr/bin/env python3
import argparse
import os
import time
import usb1
import threading
os.environ['FILEREADER_CACHE'] = '1'
from openpilot.common.realtime import config_realtime_process, Ratekeeper, DT_CTRL
from openpilot.selfdrive.pandad import can_capnp_to_list
from openpilot.tools.lib.logreader import LogReader... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/replay/lib/rp_helpers.py | tools/replay/lib/rp_helpers.py | import numpy as np
from openpilot.selfdrive.controls.radard import RADAR_TO_CAMERA
# Color palette used for rerun AnnotationContext
rerunColorPalette = [(96, "red", (255, 0, 0)),
(100, "pink", (255, 36, 0)),
(124, "yellow", (255, 255, 0)),
(230, "vibrantpi... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/replay/lib/ui_helpers.py | tools/replay/lib/ui_helpers.py | import itertools
from typing import Any
import matplotlib.pyplot as plt
import numpy as np
import pygame
from matplotlib.backends.backend_agg import FigureCanvasAgg
from openpilot.common.transformations.camera import get_view_frame_from_calib_frame
from openpilot.selfdrive.controls.radard import RADAR_TO_CAMERA
RE... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/replay/lib/__init__.py | tools/replay/lib/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/rerun/run.py | tools/rerun/run.py | #!/usr/bin/env python3
import sys
import argparse
import multiprocessing
import rerun as rr
import rerun.blueprint as rrb
from functools import partial
from collections import defaultdict
from cereal.services import SERVICE_LIST
from openpilot.tools.rerun.camera_reader import probe_packet_info, CameraReader, CameraCo... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/rerun/camera_reader.py | tools/rerun/camera_reader.py | import tqdm
import subprocess
import multiprocessing
from enum import StrEnum
from functools import partial
from collections import namedtuple
from openpilot.tools.lib.framereader import ffprobe
CameraConfig = namedtuple("CameraConfig", ["qcam", "fcam", "ecam", "dcam"])
class CameraType(StrEnum):
qcam = "qcamera"
... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/webcam/camera.py | tools/webcam/camera.py | import av
class Camera:
def __init__(self, cam_type_state, stream_type, camera_id):
try:
camera_id = int(camera_id)
except ValueError: # allow strings, ex: /dev/video0
pass
self.cam_type_state = cam_type_state
self.stream_type = stream_type
self.cur_frame_id = 0
self.container = ... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/webcam/camerad.py | tools/webcam/camerad.py | #!/usr/bin/env python3
import threading
import os
from collections import namedtuple
from msgq.visionipc import VisionIpcServer, VisionStreamType
from cereal import messaging
from openpilot.tools.webcam.camera import Camera
from openpilot.common.realtime import Ratekeeper
WIDE_CAM = os.getenv("WIDE_CAM")
CameraType ... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/plotjuggler/test_plotjuggler.py | tools/plotjuggler/test_plotjuggler.py | import os
import glob
import signal
import subprocess
import time
from openpilot.common.basedir import BASEDIR
from openpilot.common.timeout import Timeout
from openpilot.tools.plotjuggler.juggle import DEMO_ROUTE, install
PJ_DIR = os.path.join(BASEDIR, "tools/plotjuggler")
class TestPlotJuggler:
def test_demo(se... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/plotjuggler/juggle.py | tools/plotjuggler/juggle.py | #!/usr/bin/env python3
import os
import sys
import platform
import shutil
import subprocess
import tarfile
import tempfile
import requests
import argparse
from functools import partial
from opendbc.car.fingerprints import MIGRATION
from openpilot.common.basedir import BASEDIR
from openpilot.common.swaglog import cloud... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/camerastream/compressed_vipc.py | tools/camerastream/compressed_vipc.py | #!/usr/bin/env python3
import av
import os
import sys
import argparse
import numpy as np
import multiprocessing
import time
import signal
import cereal.messaging as messaging
from msgq.visionipc import VisionIpcServer, VisionStreamType
V4L2_BUF_FLAG_KEYFRAME = 8
# start encoderd
# also start cereal messaging bridge... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/joystick/joystick_control.py | tools/joystick/joystick_control.py | #!/usr/bin/env python3
import os
import argparse
import threading
import numpy as np
from inputs import UnpluggedError, get_gamepad
from cereal import messaging
from openpilot.common.params import Params
from openpilot.common.realtime import Ratekeeper
from openpilot.system.hardware import HARDWARE
from openpilot.tool... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/joystick/joystickd.py | tools/joystick/joystickd.py | #!/usr/bin/env python3
import math
import numpy as np
from cereal import messaging, car
from opendbc.car.vehicle_model import VehicleModel
from openpilot.common.realtime import DT_CTRL, Ratekeeper
from openpilot.common.params import Params
from openpilot.common.swaglog import cloudlog
LongCtrlState = car.CarControl.... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/tuning/measure_steering_accuracy.py | tools/tuning/measure_steering_accuracy.py | #!/usr/bin/env python3
# type: ignore
import os
import time
import argparse
import signal
from collections import defaultdict
import cereal.messaging as messaging
from openpilot.tools.lib.logreader import LogReader
def sigint_handler(signal, frame):
exit(0)
signal.signal(signal.SIGINT, sigint_handler)
class Steer... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/framereader.py | tools/lib/framereader.py | import json
import os
import pickle
import struct
import subprocess
import threading
from enum import IntEnum
from functools import wraps
import numpy as np
from lru import LRU
import _io
from openpilot.tools.lib.cache import cache_path_for_file_path, DEFAULT_CACHE_DIR
from openpilot.tools.lib.exceptions import DataU... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/api.py | tools/lib/api.py | import os
import requests
API_HOST = os.getenv('API_HOST', 'https://api.commadotai.com')
class CommaApi:
def __init__(self, token=None):
self.session = requests.Session()
self.session.headers['User-agent'] = 'OpenpilotTools'
if token:
self.session.headers['Authorization'] = 'JWT ' + token
def re... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/kbhit.py | tools/lib/kbhit.py | #!/usr/bin/env python3
import sys
import termios
import atexit
from select import select
class KBHit:
def __init__(self) -> None:
''' Creates a KBHit object that you can call to do various keyboard things.
'''
self.stdin_fd = sys.stdin.fileno()
self.set_kbhit_terminal()
def set_kbhit_terminal(se... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/logreader.py | tools/lib/logreader.py | #!/usr/bin/env python3
import bz2
from functools import cache, partial
import multiprocessing
import capnp
import enum
import os
import pathlib
import sys
import tqdm
import urllib.parse
import warnings
import zstandard as zstd
from collections.abc import Callable, Iterable, Iterator
from urllib.parse import parse_qs,... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/openpilotcontainers.py | tools/lib/openpilotcontainers.py | #!/usr/bin/env python3
from openpilot.tools.lib.azure_container import AzureContainer
OpenpilotCIContainer = AzureContainer("commadataci", "openpilotci")
DataCIContainer = AzureContainer("commadataci", "commadataci")
DataProdContainer = AzureContainer("commadata2", "commadata2")
| python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/url_file.py | tools/lib/url_file.py | import logging
import os
import socket
import time
from hashlib import sha256
from urllib3 import PoolManager, Retry
from urllib3.response import BaseHTTPResponse
from urllib3.util import Timeout
from openpilot.common.file_helpers import atomic_write_in_dir
from openpilot.system.hardware.hw import Paths
# Cache chunk... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/comma_car_segments.py | tools/lib/comma_car_segments.py | import os
import requests
# Forks with additional car support can fork the commaCarSegments repo on huggingface or host the LFS files themselves
COMMA_CAR_SEGMENTS_REPO = os.environ.get("COMMA_CAR_SEGMENTS_REPO", "https://huggingface.co/datasets/commaai/commaCarSegments")
COMMA_CAR_SEGMENTS_BRANCH = os.environ.get("C... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/vidindex.py | tools/lib/vidindex.py | #!/usr/bin/env python3
import argparse
import os
import struct
from enum import IntEnum
from openpilot.tools.lib.filereader import FileReader
DEBUG = int(os.getenv("DEBUG", "0"))
# compare to ffmpeg parsing
# ffmpeg -i <input.hevc> -c copy -bsf:v trace_headers -f null - 2>&1 | grep -B4 -A32 '] 0 '
# H.265 specifica... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/route.py | tools/lib/route.py | import os
import re
from functools import cache
from urllib.parse import urlparse
from collections import defaultdict
from itertools import chain
from openpilot.tools.lib.auth_config import get_token
from openpilot.tools.lib.api import CommaApi
from openpilot.tools.lib.helpers import RE
QLOG_FILENAMES = ['qlog', 'qlo... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/bootlog.py | tools/lib/bootlog.py | import functools
import re
from openpilot.tools.lib.auth_config import get_token
from openpilot.tools.lib.api import CommaApi
from openpilot.tools.lib.helpers import RE
@functools.total_ordering
class Bootlog:
def __init__(self, url: str):
self._url = url
r = re.search(RE.BOOTLOG_NAME, url)
if not r:
... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/exceptions.py | tools/lib/exceptions.py | class DataUnreadableError(Exception):
pass
| python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/github_utils.py | tools/lib/github_utils.py | import base64
import requests
from http import HTTPMethod
class GithubUtils:
def __init__(self, api_token, data_token, owner='commaai', api_repo='openpilot', data_repo='ci-artifacts'):
self.OWNER = owner
self.API_REPO = api_repo
self.DATA_REPO = data_repo
self.API_TOKEN = api_token
self.DATA_TOKE... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/helpers.py | tools/lib/helpers.py | # regex patterns
class RE:
DONGLE_ID = r'(?P<dongle_id>[a-f0-9]{16})'
TIMESTAMP = r'(?P<timestamp>[0-9]{4}-[0-9]{2}-[0-9]{2}--[0-9]{2}-[0-9]{2}-[0-9]{2})'
LOG_ID_V2 = r'(?P<count>[a-f0-9]{8})--(?P<uid>[a-z0-9]{10})'
LOG_ID = fr'(?P<log_id>(?:{TIMESTAMP}|{LOG_ID_V2}))'
ROUTE_NAME = fr'(?P<route_name>{DONGLE_ID... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/openpilotci.py | tools/lib/openpilotci.py | from openpilot.tools.lib.openpilotcontainers import OpenpilotCIContainer
def get_url(*args, **kwargs):
return OpenpilotCIContainer.get_url(*args, **kwargs)
def upload_file(*args, **kwargs):
return OpenpilotCIContainer.upload_file(*args, **kwargs)
def upload_bytes(*args, **kwargs):
return OpenpilotCIContainer.u... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/live_logreader.py | tools/lib/live_logreader.py | import os
from cereal import log as capnp_log, messaging
from cereal.services import SERVICE_LIST
from openpilot.tools.lib.logreader import LogIterable, RawLogIterable
ALL_SERVICES = list(SERVICE_LIST.keys())
def raw_live_logreader(services: list[str] = ALL_SERVICES, addr: str = '127.0.0.1') -> RawLogIterable:
if... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/sanitizer.py | tools/lib/sanitizer.py | # Utilities for sanitizing routes of only essential data for testing car ports and doing validation.
from openpilot.tools.lib.logreader import LogIterable, LogMessage
def sanitize_vin(vin: str):
# (last 6 digits of vin are serial number https://en.wikipedia.org/wiki/Vehicle_identification_number)
VIN_SENSITIVE =... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/__init__.py | tools/lib/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/filereader.py | tools/lib/filereader.py | import os
import posixpath
import socket
from urllib.parse import urlparse
from openpilot.tools.lib.url_file import URLFile
DATA_ENDPOINT = os.getenv("DATA_ENDPOINT", "http://data-raw.comma.internal/")
def internal_source_available(url=DATA_ENDPOINT):
if os.path.isdir(url):
return True
try:
hostname = ... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/azure_container.py | tools/lib/azure_container.py | import os
from datetime import datetime, timedelta, UTC
from functools import lru_cache
from pathlib import Path
from typing import IO
TOKEN_PATH = Path("/data/azure_token")
@lru_cache
def get_azure_credential():
if "AZURE_TOKEN" in os.environ:
return os.environ["AZURE_TOKEN"]
elif TOKEN_PATH.is_file():
... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/cache.py | tools/lib/cache.py | import os
import urllib.parse
DEFAULT_CACHE_DIR = os.getenv("CACHE_ROOT", os.path.expanduser("~/.commacache"))
def cache_path_for_file_path(fn, cache_dir=DEFAULT_CACHE_DIR):
dir_ = os.path.join(cache_dir, "local")
os.makedirs(dir_, exist_ok=True)
fn_parsed = urllib.parse.urlparse(fn)
if fn_parsed.scheme == ''... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/auth_config.py | tools/lib/auth_config.py | import json
import os
from openpilot.system.hardware.hw import Paths
class MissingAuthConfigError(Exception):
pass
def get_token():
try:
with open(os.path.join(Paths.config_root(), 'auth.json')) as f:
auth = json.load(f)
return auth['access_token']
except Exception:
return None
def set_t... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/auth.py | tools/lib/auth.py | #!/usr/bin/env python3
"""
Usage::
usage: auth.py [-h] [{google,apple,github,jwt}] [jwt]
Login to your comma account
positional arguments:
{google,apple,github,jwt}
jwt
optional arguments:
-h, --help show this help message and exit
Examples::
./auth.py # Log in with google accou... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/log_time_series.py | tools/lib/log_time_series.py | import numpy as np
def flatten_type_dict(d, sep="/", prefix=None):
res = {}
if isinstance(d, dict):
for key, val in d.items():
if prefix is None:
res.update(flatten_type_dict(val, prefix=key))
else:
res.update(flatten_type_dict(val, prefix=prefix + sep + key))
return res
elif... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/tests/test_caching.py | tools/lib/tests/test_caching.py | import http.server
import os
import shutil
import socket
import pytest
from openpilot.selfdrive.test.helpers import http_server_context
from openpilot.system.hardware.hw import Paths
from openpilot.tools.lib.url_file import URLFile
class CachingTestRequestHandler(http.server.BaseHTTPRequestHandler):
FILE_EXISTS = ... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/tests/test_readers.py | tools/lib/tests/test_readers.py | import pytest
import requests
import tempfile
from collections import defaultdict
import numpy as np
from openpilot.tools.lib.framereader import FrameReader
from openpilot.tools.lib.logreader import LogReader
class TestReaders:
@pytest.mark.skip("skip for bandwidth reasons")
def test_logreader(self):
def _ch... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/tests/test_route_library.py | tools/lib/tests/test_route_library.py | from collections import namedtuple
from openpilot.tools.lib.route import SegmentName
class TestRouteLibrary:
def test_segment_name_formats(self):
Case = namedtuple('Case', ['input', 'expected_route', 'expected_segment_num', 'expected_data_dir'])
cases = [ Case("a2a0ccea32023010|2023-07-27--13-01-19", "a2a0... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/tests/test_logreader.py | tools/lib/tests/test_logreader.py | import capnp
import contextlib
import io
import shutil
import tempfile
import os
import pytest
import requests
from parameterized import parameterized
from cereal import log as capnp_log
from openpilot.tools.lib.logreader import LogIterable, LogReader, comma_api_source, parse_indirect, ReadMode, InternalUnavailableEx... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/tests/__init__.py | tools/lib/tests/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/lib/tests/test_comma_car_segments.py | tools/lib/tests/test_comma_car_segments.py | import pytest
import requests
from opendbc.car.fingerprints import MIGRATION
from openpilot.tools.lib.comma_car_segments import get_comma_car_segments_database, get_url
from openpilot.tools.lib.logreader import LogReader
from openpilot.tools.lib.route import SegmentRange
@pytest.mark.skip(reason="huggingface is flaky... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/bodyteleop/web.py | tools/bodyteleop/web.py | import asyncio
import dataclasses
import json
import logging
import os
import ssl
import subprocess
import pyaudio
import wave
from aiohttp import web
from aiohttp import ClientSession
from openpilot.common.basedir import BASEDIR
from openpilot.system.webrtc.webrtcd import StreamRequestBody
from openpilot.common.para... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/longitudinal_maneuvers/generate_report.py | tools/longitudinal_maneuvers/generate_report.py | #!/usr/bin/env python3
import argparse
import base64
import io
import os
import math
import pprint
import webbrowser
from collections import defaultdict
from pathlib import Path
import matplotlib.pyplot as plt
from tabulate import tabulate
from openpilot.tools.lib.logreader import LogReader
from openpilot.system.hardw... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tools/longitudinal_maneuvers/maneuversd.py | tools/longitudinal_maneuvers/maneuversd.py | #!/usr/bin/env python3
import numpy as np
from dataclasses import dataclass
from cereal import messaging, car
from opendbc.car.common.conversions import Conversions as CV
from openpilot.common.realtime import DT_MDL
from openpilot.common.params import Params
from openpilot.common.swaglog import cloudlog
@dataclass
c... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/setup.py | rednose_repo/setup.py | import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
setup(
name='rednose',
version='0.0.1',
url='https://github.com/commaai/rednose',
author='comma.ai',
author_email='harald@comma.ai',
packages=find_packages(),
platforms='any',
license='MIT',
packa... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/site_scons/site_tools/rednose_filter.py | rednose_repo/site_scons/site_tools/rednose_filter.py | import platform
from SCons.Script import Dir, File
def compile_single_filter(env, target, filter_gen_script, output_dir, extra_gen_artifacts, script_deps):
generated_src_files = [File(f) for f in [f'{output_dir}/{target}.cpp', f'{output_dir}/{target}.h']]
extra_generated_files = [File(f'{output_dir}/{x}') for x ... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/site_scons/site_tools/cython.py | rednose_repo/site_scons/site_tools/cython.py | 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)
def pyx_scan(node, env, path, arg=None):
... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/rednose/__init__.py | rednose_repo/rednose/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/rednose/helpers/ekf_sym.py | rednose_repo/rednose/helpers/ekf_sym.py | import os
import logging
from bisect import bisect_right
import numpy as np
import sympy as sp
from numpy import dot
from rednose.helpers.sympy_helpers import sympy_into_c
from rednose.helpers import TEMPLATE_DIR, load_code
from rednose.helpers.chi2_lookup import chi2_ppf
def solve(a, b):
if a.shape[0] == 1 and a... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/rednose/helpers/chi2_lookup.py | rednose_repo/rednose/helpers/chi2_lookup.py | import os
import numpy as np
def gen_chi2_ppf_lookup(max_dim=200):
from scipy.stats import chi2
table = np.zeros((max_dim, 98))
for dim in range(1, max_dim):
table[dim] = chi2.ppf(np.arange(.01, .99, .01), dim)
np.save('chi2_lookup_table', table)
def chi2_ppf(p, dim):
table = np.load(os.path.dirname... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/rednose/helpers/kalmanfilter.py | rednose_repo/rednose/helpers/kalmanfilter.py | from typing import Any
import numpy as np
class KalmanFilter:
name = "<name>"
initial_x = np.zeros((0, 0))
initial_P_diag = np.zeros((0, 0))
Q = np.zeros((0, 0))
obs_noise: dict[int, Any] = {}
# Should be initialized when initializating a KalmanFilter implementation
filter = None
@property
def x(... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/rednose/helpers/__init__.py | rednose_repo/rednose/helpers/__init__.py | import os
import platform
from cffi import FFI
TEMPLATE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'templates'))
def write_code(folder, name, code, header):
if not os.path.exists(folder):
os.mkdir(folder)
with open(os.path.join(folder, f"{name}.cpp"), 'w', encoding='utf-8') as f:
... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/rednose/helpers/sympy_helpers.py | rednose_repo/rednose/helpers/sympy_helpers.py | import sympy as sp
import numpy as np
# TODO: remove code duplication between openpilot.common.orientation
def quat2rot(quats):
quats = np.array(quats)
input_shape = quats.shape
quats = np.atleast_2d(quats)
Rs = np.zeros((quats.shape[0], 3, 3))
q0 = quats[:, 0]
q1 = quats[:, 1]
q2 = quats[:, 2]
q3 = qu... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/examples/test_kinematic_kf.py | rednose_repo/examples/test_kinematic_kf.py | import pytest
import os
import numpy as np
from .kinematic_kf import KinematicKalman, ObservationKind, States
GENERATED_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), 'generated'))
class TestKinematic:
def test_kinematic_kf(self):
np.random.seed(0)
kf = KinematicKalman(GENERATED_DIR)
#... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/examples/kinematic_kf.py | rednose_repo/examples/kinematic_kf.py | #!/usr/bin/env python3
import sys
import numpy as np
import sympy as sp
from rednose.helpers.kalmanfilter import KalmanFilter
if __name__ == '__main__': # generating sympy code
from rednose.helpers.ekf_sym import gen_code
else:
from rednose.helpers.ekf_sym_pyx import EKF_sym_pyx # pylint: disable=no-name-in-mod... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/examples/live_kf.py | rednose_repo/examples/live_kf.py | #!/usr/bin/env python3
import sys
import numpy as np
from rednose.helpers import KalmanError
if __name__ == '__main__': # Generating sympy
import sympy as sp
from rednose.helpers.sympy_helpers import euler_rotate, quat_matrix_r, quat_rotate
from rednose.helpers.ekf_sym import gen_code
else:
from rednose.help... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/examples/test_compare.py | rednose_repo/examples/test_compare.py | #!/usr/bin/env python3
import pytest
import os
import sys
import sympy as sp
import numpy as np
if __name__ == '__main__': # generating sympy code
from rednose.helpers.ekf_sym import gen_code
else:
from rednose.helpers.ekf_sym_pyx import EKF_sym_pyx # pylint: disable=no-name-in-module
from rednose.helpers.ekf_s... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/rednose_repo/examples/__init__.py | rednose_repo/examples/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/setup.py | tinygrad_repo/setup.py | #!/usr/bin/env python3
from pathlib import Path
from setuptools import setup
directory = Path(__file__).resolve().parent
with open(directory / 'README.md', encoding='utf-8') as f:
long_description = f.read()
testing_minimal = [
"numpy",
"torch==2.8.0",
"pytest",
"pytest-xdist",
"pytest-timeout",
"hypot... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/sz.py | tinygrad_repo/sz.py | #!/usr/bin/env python3
import os, sys
import token
import tokenize
import itertools
from tabulate import tabulate
TOKEN_WHITELIST = [token.OP, token.NAME, token.NUMBER, token.STRING]
def is_docstring(t):
return t.type == token.STRING and t.string.startswith('"""') and t.line.strip().startswith('"""')
def is_js_tok... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/gradient.py | tinygrad_repo/tinygrad/gradient.py | from typing import cast
import math, dataclasses
from tinygrad.uop.ops import UOp, PatternMatcher, UPat, Ops, all_metadata
from tinygrad.helpers import argsort
def reduce_gradient(ctx:UOp, ret:UOp):
def to_inp_shape(x): return x.reshape(x.shape+(1,)*(len(ret.src[0].shape)-len(x.shape))).expand(ret.src[0].shape)
if... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/dtype.py | tinygrad_repo/tinygrad/dtype.py | from __future__ import annotations
from typing import Final, ClassVar, Callable, Literal
import math, struct, ctypes, functools
from dataclasses import dataclass, fields
from tinygrad.helpers import getenv, prod
from enum import Enum, auto
class InvalidTypeMetaClass(type):
instance:None|InvalidType = None
def __ca... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/helpers.py | tinygrad_repo/tinygrad/helpers.py | from __future__ import annotations
import os, functools, platform, time, re, contextlib, operator, hashlib, pickle, sqlite3, tempfile, pathlib, string, ctypes, sys, gzip, getpass
import urllib.request, subprocess, shutil, math, types, copyreg, inspect, importlib, decimal
from dataclasses import dataclass, field
from ty... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/__init__.py | tinygrad_repo/tinygrad/__init__.py | import os
if int(os.getenv("TYPED", "0")):
from typeguard import install_import_hook
install_import_hook(__name__)
from tinygrad.tensor import Tensor # noqa: F401
from tinygrad.engine.jit import TinyJit # noqa: F401
from tinygrad.uop.ops import UOp
Va... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/tensor.py | tinygrad_repo/tinygrad/tensor.py | # inspired by https://github.com/karpathy/micrograd/blob/master/micrograd/engine.py
from __future__ import annotations
import time, math, itertools, functools, struct, sys, inspect, pathlib, string, hashlib, weakref
from contextlib import ContextDecorator
from typing import Callable, ClassVar, Sequence, cast, get_args,... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | true |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/device.py | tinygrad_repo/tinygrad/device.py | from __future__ import annotations
from dataclasses import dataclass, replace
from collections import defaultdict
from typing import Any, Generic, TypeVar, Iterator, Sequence, cast
import importlib, inspect, functools, pathlib, os, platform, contextlib, sys, re, atexit, pickle, decimal
from tinygrad.helpers import CI, ... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/renderer/cstyle.py | tinygrad_repo/tinygrad/renderer/cstyle.py | from typing import Literal, Callable, cast
import os, math, sys
from collections import defaultdict, Counter
from tinygrad.codegen.opt import tc
from tinygrad.uop.ops import GroupOp, Ops, UOp, PatternMatcher, UPat, sint_to_uop
from tinygrad.helpers import strip_parens, getenv, prod, dedup, AMX, CPU_COUNT
from tinygrad.... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/renderer/ptx.py | tinygrad_repo/tinygrad/renderer/ptx.py | from typing import cast, Callable
import struct
from collections import defaultdict
from tinygrad.codegen.opt import tc
from tinygrad.uop.ops import Ops, UOp, PatternMatcher, UPat, GroupOp, sint_to_uop
from tinygrad.dtype import dtypes, DType, PtrDType, AddrSpace
from tinygrad.renderer import Renderer
from tinygrad.ren... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/renderer/__init__.py | tinygrad_repo/tinygrad/renderer/__init__.py | from __future__ import annotations
from typing import Callable, cast, TYPE_CHECKING
import functools
from dataclasses import dataclass, field
from tinygrad.helpers import to_function_name, dedup, prod
from tinygrad.uop.ops import Ops, UOp, sym_infer, sint, Variable, ssimplify, GroupOp, PatternMatcher
from tinygrad.dtyp... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/renderer/wgsl.py | tinygrad_repo/tinygrad/renderer/wgsl.py | from tinygrad.dtype import DType, PtrDType, dtypes, AddrSpace
from tinygrad.uop.ops import UOp, Ops, PatternMatcher, UPat
from tinygrad.renderer.cstyle import CStyleLanguage, base_rewrite, extra_pm
from tinygrad.helpers import strip_parens
def sign_extend(val:UOp, sext_am:int):
return (UOp.where((val >> (sext_am - 1... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/renderer/llvmir.py | tinygrad_repo/tinygrad/renderer/llvmir.py | from typing import cast
import math, struct, sys
from tinygrad.codegen.opt import tc
from tinygrad.renderer import Renderer
from tinygrad.renderer.cstyle import AMDRenderer
from tinygrad.uop.decompositions import xexp2, xlog2
from tinygrad.uop.ops import UOp, PatternMatcher, UPat, Ops, GroupOp, sint_to_uop
from tinygra... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/uop/spec.py | tinygrad_repo/tinygrad/uop/spec.py | from typing import cast, Callable
from tinygrad.uop.ops import PatternMatcher, UPat, GroupOp, Ops, UOp, print_uops, python_alu, graph_rewrite, AxisType
from tinygrad.dtype import DType, ImageDType, dtypes, PtrDType, AddrSpace, Invalid
from tinygrad.helpers import all_same, prod, DEBUG, ContextVar, Context, cpu_profile
... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/uop/ops.py | tinygrad_repo/tinygrad/uop/ops.py | from __future__ import annotations
from typing import Any, Callable, cast, TYPE_CHECKING, Type, Sequence
import sys, time, functools, itertools, math, operator, hashlib, os, types, pickle, pathlib, inspect, weakref, collections
from dataclasses import dataclass, field
from enum import Enum, auto
from tinygrad.uop impor... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | true |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/uop/mathtraits.py | tinygrad_repo/tinygrad/uop/mathtraits.py | from tinygrad.uop import Ops
from tinygrad.helpers import T
from tinygrad.dtype import dtypes
class MathTrait:
# required to implement
def alu(self:T, op:Ops, *src) -> T: raise NotImplementedError
def const_like(self:T, b) -> T: raise NotImplementedError
# great functions you get!
def ufix(self, x): return ... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/uop/symbolic.py | tinygrad_repo/tinygrad/uop/symbolic.py | # all of symbolic lives here now
from typing import cast
import math, operator, struct, functools
from collections import defaultdict
from tinygrad.uop.ops import Ops, PatternMatcher, UPat, UOp, GroupOp, exec_alu
from tinygrad.dtype import ConstType, dtypes, PtrDType, AddrSpace, can_safe_cast, Invalid
from tinygrad.hel... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | true |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/uop/decompositions.py | tinygrad_repo/tinygrad/uop/decompositions.py | from typing import Callable
import math, functools
from tinygrad.dtype import dtypes, DType, promo_lattice
from tinygrad.device import is_dtype_supported
from tinygrad.helpers import polyN, DISABLE_FAST_IDIV
from tinygrad.uop.ops import UOp, UPat, Ops, PatternMatcher
TRANSCENDENTAL_DTYPES = (dtypes.float16, dtypes.flo... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/uop/__init__.py | tinygrad_repo/tinygrad/uop/__init__.py | from enum import auto, IntEnum, Enum
# wrapper around IntEnum that preserves Enum.__str__ and makes auto() unique across all FastEnum subclasses
class FastEnum(IntEnum):
def __str__(self): return Enum.__str__(self)
@staticmethod
def _generate_next_value_(_, __, ___, last_values): return 1 + max([0, *last_values,... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/uop/upat.py | tinygrad_repo/tinygrad/uop/upat.py | from typing import Any, Callable
import itertools, inspect, functools, types
from tinygrad.helpers import partition, dedup, Context
from tinygrad.uop.ops import UPat, UPatAny, UOp, Ops, PatternMatcher, graph_rewrite, deconstruct_function
class UPatCompileError(Exception): pass
# **** UPat compiled ****
def _get_clau... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/tinygrad_repo/tinygrad/apps/llm.py | tinygrad_repo/tinygrad/apps/llm.py | from __future__ import annotations
import sys, argparse, typing, re, itertools, unicodedata
from tinygrad import Tensor, nn, UOp, TinyJit, getenv, helpers
def gpt2_decode_vocab(voc: dict[str, int]): # https://github.com/openai/gpt-2/blob/9b63575ef42771a015060c964af2c3da4cf7c8ab/src/encoder.py#L9
c2b = { chr(cp): cp ... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.