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 |
|---|---|---|---|---|---|---|---|---|
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/torchsso/utils/inv_cupy.py | torchsso/utils/inv_cupy.py | import numpy
import scipy
import torch
try:
import cupy
from cupy import cuda
from cupy.cuda import cublas
from cupy.cuda import device
from cupy.linalg import util
if cuda.cusolver_enabled:
from cupy.cuda import cusolver
from torchsso.utils.cupy import to_cupy, from_cupy
except:
... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/torchsso/utils/chainer_communicators/_utility.py | torchsso/utils/chainer_communicators/_utility.py | import warnings
import numpy
try:
import cupy
from torchsso.utils.cupy import to_cupy
except:
pass
# print("No cupy detected")
from chainer.backends import cuda
import torch
class Packer(object):
def __init__(self):
self.unpack_kernel = cupy.ElementwiseKernel(
'raw T vec, i... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/torchsso/utils/chainer_communicators/__init__.py | torchsso/utils/chainer_communicators/__init__.py | import numpy as np
def create_communicator(communicator_name='pure_nccl',
mpi_comm=None,
rsv_comm_dtype=np.float32,
agv_comm_dtype=np.float32,
use_hiercoll=False,
dims=None,
... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/torchsso/utils/chainer_communicators/pure_nccl_communicator.py | torchsso/utils/chainer_communicators/pure_nccl_communicator.py | import itertools
import math
from mpi4py import MPI
import numpy as np
import cupy
import chainer
from chainermn.communicators import _memory_utility
from chainermn.communicators import _communication_utility
from chainermn import nccl
try:
from hiercoll.hiernccl import HierNcclCommunicator
_hiercoll_avai... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/torchsso/utils/chainer_communicators/base.py | torchsso/utils/chainer_communicators/base.py | from chainermn.communicators import mpi_communicator_base
import warnings
from torchsso.utils.chainer_communicators import _utility
class KFACCommunicatorBase(mpi_communicator_base.MpiCommunicatorBase):
def __init__(self, mpi_comm):
super(KFACCommunicatorBase, self).__init__(mpi_comm)
self.indic... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/torchsso/autograd/samplegrad.py | torchsso/autograd/samplegrad.py | from contextlib import contextmanager
import torch
import torch.nn as nn
import torch.nn.functional as F
@contextmanager
def save_sample_grads(model: nn.Module):
handles = []
for module in model.children():
params = list(module.parameters())
params = [p for p in params if p.requires_grad]
... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/torchsso/autograd/__init__.py | torchsso/autograd/__init__.py | from torchsso.autograd.samplegrad import * # NOQA
| python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/classification/main.py | examples/classification/main.py | import os
import argparse
from importlib import import_module
import shutil
import json
import torch
import torch.nn.functional as F
from torchvision import datasets, transforms, models
import torchsso
from torchsso.optim import SecondOrderOptimizer, VIOptimizer
from torchsso.utils import Logger
DATASET_CIFAR10 = 'CI... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/classification/models/lenet.py | examples/classification/models/lenet.py | import torch.nn as nn
import torch.nn.functional as F
from torchsso.utils.accumulator import TensorAccumulator
class LeNet5(nn.Module):
def __init__(self, num_classes=10):
super().__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linear(16 *... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/classification/models/alexnet.py | examples/classification/models/alexnet.py | '''AlexNet for CIFAR10. FC layers are removed. Paddings are adjusted.
Without BN, the start learning rate should be 0.01
(c) YANG, Wei
'''
import torch.nn as nn
import torch.nn.functional as F
from torchsso.utils.accumulator import TensorAccumulator
__all__ = ['alexnet', 'alexnet_mcdropout']
class AlexNet(nn.Modul... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/classification/models/vgg.py | examples/classification/models/vgg.py | '''VGG11/13/16/19 in Pytorch.'''
import torch
import torch.nn as nn
cfg = {
'VGG11': [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'],
'VGG13': [64, 64, 'M', 128, 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'],
'VGG16': [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/classification/models/mlp.py | examples/classification/models/mlp.py | import torch
import torch.nn as nn
import torch.nn.functional as F
__all__ = ['mlp']
class MLP(nn.Module):
def __init__(self, num_classes=10):
super().__init__()
n_hid = 1000
n_out = 10
self.l1 = nn.Linear(28*28, n_hid)
self.l2 = nn.Linear(n_hid, n_hid)
self.l3 = ... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/classification/models/resnet.py | examples/classification/models/resnet.py | '''ResNet in PyTorch.
For Pre-activation ResNet, see 'preact_resnet.py'.
Reference:
[1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
Deep Residual Learning for Image Recognition. arXiv:1512.03385
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
expansi... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/classification/models/__init__.py | examples/classification/models/__init__.py | from .vgg import *
from .lenet import *
from .resnet import *
from .alexnet import *
from .mlp import *
| python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/distributed/classification/main.py | examples/distributed/classification/main.py | import os
import argparse
from importlib import import_module
import shutil
import json
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import datasets, transforms, models
import torchsso
from torchsso.optim import DistributedFirstOrderOptimizer, DistributedSecondOrderOp... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/distributed/classification/models/lenet.py | examples/distributed/classification/models/lenet.py | import torch.nn as nn
import torch.nn.functional as F
from torchsso.utils.accumulator import TensorAccumulator
class LeNet5(nn.Module):
def __init__(self, num_classes=10):
super().__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linear(16 *... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/distributed/classification/models/alexnet.py | examples/distributed/classification/models/alexnet.py | '''AlexNet for CIFAR10. FC layers are removed. Paddings are adjusted.
Without BN, the start learning rate should be 0.01
(c) YANG, Wei
'''
import torch.nn as nn
import torch.nn.functional as F
from torchsso.utils.accumulator import TensorAccumulator
__all__ = ['alexnet', 'alexnet_mcdropout']
class AlexNet(nn.Modul... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/distributed/classification/models/vgg.py | examples/distributed/classification/models/vgg.py | '''VGG11/13/16/19 in Pytorch.'''
import torch.nn as nn
import torch.nn.functional as F
from torchsso.utils.accumulator import TensorAccumulator
cfg = {
'VGG11': [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'],
'VGG13': [64, 64, 'M', 128, 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'],... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/distributed/classification/models/resnet.py | examples/distributed/classification/models/resnet.py | '''ResNet in PyTorch.
For Pre-activation ResNet, see 'preact_resnet.py'.
Reference:
[1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
Deep Residual Learning for Image Recognition. arXiv:1512.03385
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
expansi... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/distributed/classification/models/resnet_b.py | examples/distributed/classification/models/resnet_b.py | import torch.nn as nn
import torch.utils.model_zoo as model_zoo
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152', 'resnext50_32x4d', 'resnext101_32x8d']
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://do... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/distributed/classification/models/resnext.py | examples/distributed/classification/models/resnext.py | '''ResNeXt in PyTorch.
See the paper "Aggregated Residual Transformations for Deep Neural Networks" for more details.
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class Block(nn.Module):
'''Grouped convolution block.'''
expansion = 2
def __init__(self, in_planes, cardinality=32... | python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
cybertronai/pytorch-sso | https://github.com/cybertronai/pytorch-sso/blob/d16173236728fdd1e943bc3b61243bfb28f95348/examples/distributed/classification/models/__init__.py | examples/distributed/classification/models/__init__.py | from .vgg import *
from .lenet import *
from .resnet import *
from .resnext import *
from .alexnet import *
| python | MIT | d16173236728fdd1e943bc3b61243bfb28f95348 | 2026-01-05T07:09:14.666019Z | false |
shaonianzhentan/ha_cloud_music | https://github.com/shaonianzhentan/ha_cloud_music/blob/663c9a32bcdc5be0777e62628b3e2d75085f3351/custom_components/ha_cloud_music/media_player.py | custom_components/ha_cloud_music/media_player.py | import logging, time, datetime
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.event import async_track_time_interval
from homeassistant.components.media_player import Medi... | python | MIT | 663c9a32bcdc5be0777e62628b3e2d75085f3351 | 2026-01-05T07:09:19.229805Z | false |
shaonianzhentan/ha_cloud_music | https://github.com/shaonianzhentan/ha_cloud_music/blob/663c9a32bcdc5be0777e62628b3e2d75085f3351/custom_components/ha_cloud_music/http_api.py | custom_components/ha_cloud_music/http_api.py | import json, aiohttp
from urllib.parse import urlparse
# 全局请求头
HEADERS = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.50'
}
# 获取cookie
async def http_cookie(url):
COOKIES = {'os': 'osx'}
jar = aiohttp.Cookie... | python | MIT | 663c9a32bcdc5be0777e62628b3e2d75085f3351 | 2026-01-05T07:09:19.229805Z | false |
shaonianzhentan/ha_cloud_music | https://github.com/shaonianzhentan/ha_cloud_music/blob/663c9a32bcdc5be0777e62628b3e2d75085f3351/custom_components/ha_cloud_music/http.py | custom_components/ha_cloud_music/http.py | import base64
import requests
from urllib.parse import parse_qsl, quote
from homeassistant.components.http import HomeAssistantView
from aiohttp import web
from .models.music_info import MusicSource
from .manifest import manifest
DOMAIN = manifest.domain
class HttpView(HomeAssistantView):
url = "/cloud_music/url... | python | MIT | 663c9a32bcdc5be0777e62628b3e2d75085f3351 | 2026-01-05T07:09:19.229805Z | false |
shaonianzhentan/ha_cloud_music | https://github.com/shaonianzhentan/ha_cloud_music/blob/663c9a32bcdc5be0777e62628b3e2d75085f3351/custom_components/ha_cloud_music/cloud_music.py | custom_components/ha_cloud_music/cloud_music.py | import uuid, time, logging, os, hashlib, aiohttp, requests, base64
from urllib.parse import quote
from homeassistant.helpers.network import get_url
from .http_api import http_get, http_cookie
from .models.music_info import MusicInfo, MusicSource
from homeassistant.helpers.storage import STORAGE_DIR
from homeassistant.u... | python | MIT | 663c9a32bcdc5be0777e62628b3e2d75085f3351 | 2026-01-05T07:09:19.229805Z | false |
shaonianzhentan/ha_cloud_music | https://github.com/shaonianzhentan/ha_cloud_music/blob/663c9a32bcdc5be0777e62628b3e2d75085f3351/custom_components/ha_cloud_music/browse_media.py | custom_components/ha_cloud_music/browse_media.py | """Support for media browsing."""
from enum import Enum
import logging, os, random, time
from urllib.parse import urlparse, parse_qs, parse_qsl, quote
from homeassistant.helpers.json import save_json
from custom_components.ha_cloud_music.http_api import http_get
from .utils import parse_query
from homeassistant.compon... | python | MIT | 663c9a32bcdc5be0777e62628b3e2d75085f3351 | 2026-01-05T07:09:19.229805Z | false |
shaonianzhentan/ha_cloud_music | https://github.com/shaonianzhentan/ha_cloud_music/blob/663c9a32bcdc5be0777e62628b3e2d75085f3351/custom_components/ha_cloud_music/const.py | custom_components/ha_cloud_music/const.py | PLATFORMS = ["media_player"] | python | MIT | 663c9a32bcdc5be0777e62628b3e2d75085f3351 | 2026-01-05T07:09:19.229805Z | false |
shaonianzhentan/ha_cloud_music | https://github.com/shaonianzhentan/ha_cloud_music/blob/663c9a32bcdc5be0777e62628b3e2d75085f3351/custom_components/ha_cloud_music/utils.py | custom_components/ha_cloud_music/utils.py | from urllib.parse import parse_qsl, quote
def parse_query(url_query):
query = parse_qsl(url_query)
data = {}
for item in query:
data[item[0]] = item[1]
return data | python | MIT | 663c9a32bcdc5be0777e62628b3e2d75085f3351 | 2026-01-05T07:09:19.229805Z | false |
shaonianzhentan/ha_cloud_music | https://github.com/shaonianzhentan/ha_cloud_music/blob/663c9a32bcdc5be0777e62628b3e2d75085f3351/custom_components/ha_cloud_music/__init__.py | custom_components/ha_cloud_music/__init__.py | from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.const import CONF_URL
import asyncio
from .const import PLATFORMS
from .manifest import manifest
from .http import HttpView
from .cloud_music import ... | python | MIT | 663c9a32bcdc5be0777e62628b3e2d75085f3351 | 2026-01-05T07:09:19.229805Z | false |
shaonianzhentan/ha_cloud_music | https://github.com/shaonianzhentan/ha_cloud_music/blob/663c9a32bcdc5be0777e62628b3e2d75085f3351/custom_components/ha_cloud_music/manifest.py | custom_components/ha_cloud_music/manifest.py | import os
from homeassistant.util.json import load_json
def custom_components_path(file_path):
return os.path.abspath('./custom_components/' + file_path)
class Manifest():
def __init__(self, domain):
self.domain = domain
self.manifest_path = custom_components_path(f'{domain}/manifest.json')
... | python | MIT | 663c9a32bcdc5be0777e62628b3e2d75085f3351 | 2026-01-05T07:09:19.229805Z | false |
shaonianzhentan/ha_cloud_music | https://github.com/shaonianzhentan/ha_cloud_music/blob/663c9a32bcdc5be0777e62628b3e2d75085f3351/custom_components/ha_cloud_music/config_flow.py | custom_components/ha_cloud_music/config_flow.py | from __future__ import annotations
from typing import Any
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow, OptionsFlow, ConfigEntry
from homeassistant.data_entry_flow import FlowResult
from homeassistant.const import CONF_URL, CONF_USERNAME, CONF_PASSWORD
from homeassistant.helpers.storag... | python | MIT | 663c9a32bcdc5be0777e62628b3e2d75085f3351 | 2026-01-05T07:09:19.229805Z | false |
shaonianzhentan/ha_cloud_music | https://github.com/shaonianzhentan/ha_cloud_music/blob/663c9a32bcdc5be0777e62628b3e2d75085f3351/custom_components/ha_cloud_music/models/music_info.py | custom_components/ha_cloud_music/models/music_info.py | import enum
class MusicSource(enum.Enum):
URL = 1
XIMALAYA = 2
PLAYLIST = 3
DJRADIO = 4
ARTISTS = 5
CLOUD = 6
class MusicInfo:
def __init__(self, id, song, singer, album, duration, url, picUrl, source) -> None:
self._id = id
self._song = song
self._singer = singer... | python | MIT | 663c9a32bcdc5be0777e62628b3e2d75085f3351 | 2026-01-05T07:09:19.229805Z | false |
Dev-shrm07/SkyNetMEC | https://github.com/Dev-shrm07/SkyNetMEC/blob/0789e6a1b1a7f755e584f4d4feecae169854427d/code/train.py | code/train.py | from uav_env import UAVTASKENV
import random
import numpy as np
from buffer import Buffer
from helperclass import MADDPG
import matplotlib.pyplot as plt
#training of the agents in the environment using MADDPG
#function to concatenate states of each agent for the critic
def obs_list_to_state_vector(observation):
... | python | MIT | 0789e6a1b1a7f755e584f4d4feecae169854427d | 2026-01-05T07:09:19.356005Z | false |
Dev-shrm07/SkyNetMEC | https://github.com/Dev-shrm07/SkyNetMEC/blob/0789e6a1b1a7f755e584f4d4feecae169854427d/code/helperclass.py | code/helperclass.py | import tensorflow as tf
import tensorflow.keras.losses as kloss
from agents import Agent
class MADDPG:
#initialize agents for the environments with their parameters leanring rates etc
def __init__(self, actor_dims, critic_dims, n_agents, n_actions,
scenario='simple', alpha=0.01, beta=0.01, fc... | python | MIT | 0789e6a1b1a7f755e584f4d4feecae169854427d | 2026-01-05T07:09:19.356005Z | false |
Dev-shrm07/SkyNetMEC | https://github.com/Dev-shrm07/SkyNetMEC/blob/0789e6a1b1a7f755e584f4d4feecae169854427d/code/networks.py | code/networks.py | import tensorflow as tf
import os
#critic Network
class CriticNetwork(tf.keras.Model):
def __init__(self, beta, input_dims, fc1_dims, fc2_dims, n_agents, n_actions, name, chkpt_dir):
super(CriticNetwork, self).__init__()
self.chkpt_file = os.path.join(chkpt_dir, name)
self.fc1 = tf.keras.... | python | MIT | 0789e6a1b1a7f755e584f4d4feecae169854427d | 2026-01-05T07:09:19.356005Z | false |
Dev-shrm07/SkyNetMEC | https://github.com/Dev-shrm07/SkyNetMEC/blob/0789e6a1b1a7f755e584f4d4feecae169854427d/code/test.py | code/test.py | from uav_env import UAVTASKENV
import random
import numpy as np
from buffer import Buffer
from helperclass import MADDPG
import matplotlib.pyplot as plt
#testing of the agents in the environment using MADDPG
#testing the weights
#function to concatenate states of each agent for the critic
def obs_list_to_state_vector... | python | MIT | 0789e6a1b1a7f755e584f4d4feecae169854427d | 2026-01-05T07:09:19.356005Z | false |
Dev-shrm07/SkyNetMEC | https://github.com/Dev-shrm07/SkyNetMEC/blob/0789e6a1b1a7f755e584f4d4feecae169854427d/code/buffer.py | code/buffer.py | import numpy as np
class Buffer:
#initialize the buffer class with size, batch size, seperate initilization for each actor's memory
def __init__(self, max_size, critic_dims, actor_dims,
n_actions, n_agents, batch_size):
self.mem_size = max_size
self.mem_cntr = 0
self.n_agen... | python | MIT | 0789e6a1b1a7f755e584f4d4feecae169854427d | 2026-01-05T07:09:19.356005Z | false |
Dev-shrm07/SkyNetMEC | https://github.com/Dev-shrm07/SkyNetMEC/blob/0789e6a1b1a7f755e584f4d4feecae169854427d/code/uav_env.py | code/uav_env.py |
import numpy as np
import random
import matplotlib.pyplot as plt
import math
class UAVTASKENV():
def __init__(self, c1, c2):
#initializing UAV fog server cordinates and data for each UAV task and other variables
self.k = plt.subplots()
self.fig = self.k[0]
self.ax = self.k[1]
self.cluster1 ... | python | MIT | 0789e6a1b1a7f755e584f4d4feecae169854427d | 2026-01-05T07:09:19.356005Z | false |
Dev-shrm07/SkyNetMEC | https://github.com/Dev-shrm07/SkyNetMEC/blob/0789e6a1b1a7f755e584f4d4feecae169854427d/code/agents.py | code/agents.py | from networks import ActorNetwork, CriticNetwork
import tensorflow as tf
import numpy
#agent class
#each agent will have two actor and two critic networks
#actor will define the action for a given state
#critic will decide the Q values for that state and action pairs
#target networks for stability in training using so... | python | MIT | 0789e6a1b1a7f755e584f4d4feecae169854427d | 2026-01-05T07:09:19.356005Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/conftest.py | conftest.py | import contextlib
import gc
import os
import pytest
import random
from openpilot.common.prefix import OpenpilotPrefix
from openpilot.system.manager import manager
from openpilot.system.hardware import TICI, HARDWARE
# TODO: pytest-cpp doesn't support FAIL, and we need to create test translations in sessionstart
# pen... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/zoro_description.py | third_party/acados/acados_template/zoro_description.py | # Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright not... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/acados_sim.py | third_party/acados/acados_template/acados_sim.py | # -*- coding: future_fstrings -*-
#
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/acados_model.py | third_party/acados/acados_template/acados_model.py | #
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/utils.py | third_party/acados/acados_template/utils.py | # -*- coding: future_fstrings -*-
#
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/builders.py | third_party/acados/acados_template/builders.py | # -*- coding: future_fstrings -*-
#
# Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren,
# Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor,
# Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan,
# Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Di... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/__init__.py | third_party/acados/acados_template/__init__.py | #
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/acados_sim_solver.py | third_party/acados/acados_template/acados_sim_solver.py | # -*- coding: future_fstrings -*-
#
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/acados_ocp_solver.py | third_party/acados/acados_template/acados_ocp_solver.py | # -*- coding: future_fstrings -*-
#
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | true |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/acados_ocp.py | third_party/acados/acados_template/acados_ocp.py | # -*- coding: future_fstrings -*-
#
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | true |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/casadi_function_generation.py | third_party/acados/acados_template/casadi_function_generation.py | #
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/gnsf/detect_affine_terms_reduce_nonlinearity.py | third_party/acados/acados_template/gnsf/detect_affine_terms_reduce_nonlinearity.py | #
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/gnsf/detect_gnsf_structure.py | third_party/acados/acados_template/gnsf/detect_gnsf_structure.py | #
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/gnsf/reformulate_with_invertible_E_mat.py | third_party/acados/acados_template/gnsf/reformulate_with_invertible_E_mat.py | #
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/gnsf/determine_trivial_gnsf_transcription.py | third_party/acados/acados_template/gnsf/determine_trivial_gnsf_transcription.py | #
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/gnsf/check_reformulation.py | third_party/acados/acados_template/gnsf/check_reformulation.py | #
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/gnsf/reformulate_with_LOS.py | third_party/acados/acados_template/gnsf/reformulate_with_LOS.py | #
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/gnsf/__init__.py | third_party/acados/acados_template/gnsf/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/gnsf/structure_detection_print_summary.py | third_party/acados/acados_template/gnsf/structure_detection_print_summary.py | #
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/third_party/acados/acados_template/gnsf/determine_input_nonlinearity_function.py | third_party/acados/acados_template/gnsf/determine_input_nonlinearity_function.py | #
# Copyright (c) The acados authors.
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright n... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/cereal/services.py | cereal/services.py | #!/usr/bin/env python3
from typing import Optional
class Service:
def __init__(self, should_log: bool, frequency: float, decimation: Optional[int] = None):
self.should_log = should_log
self.frequency = frequency
self.decimation = decimation
_services: dict[str, tuple] = {
# service: (should_log, fre... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/cereal/__init__.py | cereal/__init__.py | import os
import capnp
from importlib.resources import as_file, files
capnp.remove_import_hook()
with as_file(files("cereal")) as fspath:
CEREAL_PATH = fspath.as_posix()
log = capnp.load(os.path.join(CEREAL_PATH, "log.capnp"))
car = capnp.load(os.path.join(CEREAL_PATH, "car.capnp"))
custom = capnp.load(os.pat... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/cereal/messaging/__init__.py | cereal/messaging/__init__.py | # must be built with scons
from msgq.ipc_pyx import Context, Poller, SubSocket, PubSocket, SocketEventHandle, toggle_fake_events, \
set_fake_prefix, get_fake_prefix, delete_fake_prefix, wait_for_one_event
from msgq.ipc_pyx import MultiplePublishersError, IpcError
from msgq import fake_ev... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/cereal/messaging/tests/test_messaging.py | cereal/messaging/tests/test_messaging.py | import os
import capnp
import multiprocessing
import numbers
import random
import threading
import time
from parameterized import parameterized
import pytest
from cereal import log, car
import cereal.messaging as messaging
from cereal.services import SERVICE_LIST
events = [evt for evt in log.Event.schema.union_fields... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/cereal/messaging/tests/test_pub_sub_master.py | cereal/messaging/tests/test_pub_sub_master.py | import random
import time
from typing import Sized, cast
import cereal.messaging as messaging
from cereal.messaging.tests.test_messaging import events, random_sock, random_socks, \
random_bytes, random_carstate, assert_carstate, \
... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/cereal/messaging/tests/test_services.py | cereal/messaging/tests/test_services.py | import os
import tempfile
from typing import Dict
from parameterized import parameterized
import cereal.services as services
from cereal.services import SERVICE_LIST
class TestServices:
@parameterized.expand(SERVICE_LIST.keys())
def test_services(self, s):
service = SERVICE_LIST[s]
assert service.freque... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/cereal/messaging/tests/__init__.py | cereal/messaging/tests/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/scripts/disable-powersave.py | scripts/disable-powersave.py | #!/usr/bin/env python3
from openpilot.system.hardware import HARDWARE
if __name__ == "__main__":
HARDWARE.set_power_save(False)
| python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/scripts/__init__.py | scripts/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/scripts/waste.py | scripts/waste.py | #!/usr/bin/env python3
import os
import time
import numpy as np
from multiprocessing import Process
from setproctitle import setproctitle
def waste(core):
os.sched_setaffinity(0, [core,])
m1 = np.zeros((200, 200)) + 0.8
m2 = np.zeros((200, 200)) + 1.2
i = 1
st = time.monotonic()
j = 0
while 1:
if (... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/scripts/add/events_ko.py | scripts/add/events_ko.py | #!/usr/bin/env python3
import bisect
import math
import os
from enum import IntEnum
from collections.abc import Callable
from cereal import log, car
import cereal.messaging as messaging
from openpilot.common.conversions import Conversions as CV
from openpilot.common.params import Params
from openpilot.common.git impor... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | true |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/scripts/add/amplifier_c3xl.py | scripts/add/amplifier_c3xl.py | #!/usr/bin/env python3
import time
from smbus2 import SMBus
from collections import namedtuple
# https://datasheets.maximintegrated.com/en/ds/MAX98089.pdf
AmpConfig = namedtuple('AmpConfig', ['name', 'value', 'register', 'offset', 'mask'])
EQParams = namedtuple('EQParams', ['K', 'k1', 'k2', 'c1', 'c2'])
def configs_... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/scripts/add/events_zh.py | scripts/add/events_zh.py | #!/usr/bin/env python3
import bisect
import math
import os
from enum import IntEnum
from collections.abc import Callable
from cereal import log, car
import cereal.messaging as messaging
from openpilot.common.conversions import Conversions as CV
from openpilot.common.git import get_short_branch
from openpilot.common.pa... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | true |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/release/release_files.py | release/release_files.py | #!/usr/bin/env python3
import os
import re
from pathlib import Path
HERE = os.path.abspath(os.path.dirname(__file__))
ROOT = HERE + "/.."
blacklist = [
".git/",
".github/workflows/",
"matlab.*.md",
# no LFS or submodules in release
".lfsconfig",
".gitattributes",
".git$",
".gitmodules",
]
# gets yo... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/version.py | system/version.py | #!/usr/bin/env python3
from dataclasses import dataclass
from functools import cache
import json
import os
import pathlib
import subprocess
from openpilot.common.basedir import BASEDIR
from openpilot.common.swaglog import cloudlog
from openpilot.common.git import get_commit, get_origin, get_branch, get_short_branch, g... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/logmessaged.py | system/logmessaged.py | #!/usr/bin/env python3
import zmq
from typing import NoReturn
import cereal.messaging as messaging
from openpilot.common.logging_extra import SwagLogFileFormatter
from openpilot.system.hardware.hw import Paths
from openpilot.common.swaglog import get_file_handler
from openpilot.common.params import Params
def main()... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/sentry.py | system/sentry.py | """Install exception handler for process crash."""
import sentry_sdk
from enum import Enum
from sentry_sdk.integrations.threading import ThreadingIntegration
from openpilot.common.params import Params
from openpilot.system.athena.registration import is_registered_device
from openpilot.system.hardware import HARDWARE, ... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/__init__.py | system/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/micd.py | system/micd.py | #!/usr/bin/env python3
import numpy as np
from functools import cache
import threading
from cereal import messaging
from openpilot.common.realtime import Ratekeeper
from openpilot.common.retry import retry
from openpilot.common.swaglog import cloudlog
RATE = 10
FFT_SAMPLES = 1600 # 100ms
REFERENCE_SPL = 2e-5 # newto... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/statsd.py | system/statsd.py | #!/usr/bin/env python3
import os
import zmq
import time
import uuid
from pathlib import Path
from collections import defaultdict
from datetime import datetime, UTC
from typing import NoReturn
from openpilot.common.params import Params
from cereal.messaging import SubMaster
from openpilot.system.hardware.hw import Path... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/tombstoned.py | system/tombstoned.py | #!/usr/bin/env python3
import datetime
import os
import re
import shutil
import signal
import subprocess
import time
import glob
from typing import NoReturn
import openpilot.system.sentry as sentry
from openpilot.system.hardware.hw import Paths
from openpilot.common.swaglog import cloudlog
from openpilot.system.versio... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/timed.py | system/timed.py | #!/usr/bin/env python3
import datetime
import subprocess
import time
from typing import NoReturn
import cereal.messaging as messaging
from openpilot.common.time_helpers import min_date, system_time_valid
from openpilot.common.swaglog import cloudlog
from openpilot.common.params import Params
from openpilot.common.gps ... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/athena/registration.py | system/athena/registration.py | #!/usr/bin/env python3
import time
import json
import jwt
from pathlib import Path
from datetime import datetime, timedelta, UTC
from openpilot.common.api import api_get
from openpilot.common.params import Params
from openpilot.common.spinner import Spinner
from openpilot.selfdrive.selfdrived.alertmanager import set_o... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/athena/manage_athenad.py | system/athena/manage_athenad.py | #!/usr/bin/env python3
import time
from multiprocessing import Process
from openpilot.common.params import Params
from openpilot.system.manager.process import launcher
from openpilot.common.swaglog import cloudlog
from openpilot.system.hardware import HARDWARE
from openpilot.system.version import get_build_metadata
... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/athena/athenad.py | system/athena/athenad.py | #!/usr/bin/env python3
from __future__ import annotations
import base64
import hashlib
import io
import json
import os
import queue
import random
import select
import socket
import sys
import tempfile
import threading
import time
from dataclasses import asdict, dataclass, replace
from datetime import datetime
from fun... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/athena/__init__.py | system/athena/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/athena/tests/test_registration.py | system/athena/tests/test_registration.py | import json
from Crypto.PublicKey import RSA
from pathlib import Path
from openpilot.common.params import Params
from openpilot.system.athena.registration import register, UNREGISTERED_DONGLE_ID
from openpilot.system.athena.tests.helpers import MockResponse
from openpilot.system.hardware.hw import Paths
class TestRe... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/athena/tests/test_athenad.py | system/athena/tests/test_athenad.py | import pytest
from functools import wraps
import json
import multiprocessing
import os
import requests
import shutil
import time
import threading
import queue
from dataclasses import asdict, replace
from datetime import datetime, timedelta
from websocket import ABNF
from websocket._exceptions import WebSocketConnectio... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/athena/tests/helpers.py | system/athena/tests/helpers.py | import http.server
import socket
class MockResponse:
def __init__(self, json, status_code):
self.json = json
self.text = json
self.status_code = status_code
class EchoSocket:
def __init__(self, port):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.bind(('127.0.0.... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/athena/tests/test_athenad_ping.py | system/athena/tests/test_athenad_ping.py | import pytest
import subprocess
import threading
import time
from typing import cast
from openpilot.common.params import Params
from openpilot.common.timeout import Timeout
from openpilot.system.athena import athenad
from openpilot.system.manager.helpers import write_onroad_params
from openpilot.system.hardware import... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/athena/tests/__init__.py | system/athena/tests/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/tests/test_logmessaged.py | system/tests/test_logmessaged.py | import glob
import os
import time
import cereal.messaging as messaging
from openpilot.system.manager.process_config import managed_processes
from openpilot.system.hardware.hw import Paths
from openpilot.common.swaglog import cloudlog, ipchandler
class TestLogmessaged:
def setup_method(self):
# clear the IPC bu... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/tests/__init__.py | system/tests/__init__.py | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false | |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/hardware/esim.py | system/hardware/esim.py | #!/usr/bin/env python3
import argparse
import time
from openpilot.system.hardware import HARDWARE
if __name__ == '__main__':
parser = argparse.ArgumentParser(prog='esim.py', description='manage eSIM profiles on your comma device', epilog='comma.ai')
parser.add_argument('--backend', choices=['qmi', 'at'], default... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/hardware/hardwared.py | system/hardware/hardwared.py | #!/usr/bin/env python3
import fcntl
import os
import json
import queue
import struct
import threading
import time
from collections import OrderedDict, namedtuple
from pathlib import Path
import psutil
import cereal.messaging as messaging
from cereal import log
from cereal.services import SERVICE_LIST
from openpilot.c... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/hardware/hw.py | system/hardware/hw.py | import os
import platform
from pathlib import Path
from openpilot.system.hardware import PC
DEFAULT_DOWNLOAD_CACHE_ROOT = "/tmp/comma_download_cache"
class Paths:
@staticmethod
def comma_home() -> str:
return os.path.join(str(Path.home()), ".comma" + os.environ.get("OPENPILOT_PREFIX", ""))
@staticmethod
... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/hardware/power_monitoring.py | system/hardware/power_monitoring.py | import time
import threading
from openpilot.common.params import Params
from openpilot.system.hardware import HARDWARE
from openpilot.common.swaglog import cloudlog
from openpilot.system.statsd import statlog
CAR_VOLTAGE_LOW_PASS_K = 0.011 # LPF gain for 45s tau (dt/tau / (dt/tau + 1))
# While driving, a battery cha... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/hardware/fan_controller.py | system/hardware/fan_controller.py | #!/usr/bin/env python3
import numpy as np
from abc import ABC, abstractmethod
from openpilot.common.realtime import DT_HW
from openpilot.common.swaglog import cloudlog
from openpilot.common.pid import PIDController
class BaseFanController(ABC):
@abstractmethod
def update(self, cur_temp: float, ignition: bool) -> ... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/hardware/__init__.py | system/hardware/__init__.py | import os
from typing import cast
from openpilot.system.hardware.base import HardwareBase
from openpilot.system.hardware.tici.hardware import Tici
from openpilot.system.hardware.pc.hardware import Pc
TICI = os.path.isfile('/TICI')
AGNOS = os.path.isfile('/AGNOS')
PC = not TICI
if TICI:
HARDWARE = cast(HardwareBas... | python | MIT | b0eab6e8de2d57522b657426fbb794f2d736c75c | 2026-01-05T07:04:53.428285Z | false |
ajouatom/openpilot | https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/system/hardware/base.py | system/hardware/base.py | import os
from abc import abstractmethod, ABC
from dataclasses import dataclass, fields
from cereal import log
NetworkType = log.DeviceState.NetworkType
class LPAError(RuntimeError):
pass
class LPAProfileNotFoundError(LPAError):
pass
@dataclass
class Profile:
iccid: str
nickname: str
enabled: bool
prov... | 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.