text stringlengths 185 73.3k | repo stringlengths 7 100 | path stringlengths 4 146 | language stringclasses 7
values | hash stringlengths 16 16 | score float64 7 8.5 | stars int64 0 237k |
|---|---|---|---|---|---|---|
"""
title: Sources
description: Opens source-view in AI-Hub
icon_url: data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBmaWxsPSJjdXJyZW50Q29sb3IiIGQ9Ik0xNS43NSAxM2EuNzUuNzUgMCAwIDAtLjc1LS43NUg5YS43NS43NSAwIDAgMCAwIDEuNWg2YS43... | bbvch-ai/aihub-core | infra/configs/openwebui/functions/source_action.py | .py | d5f458cfe6d04272 | 7.54 | 11 |
"""
title: Tracing
description: Opens tracing-view in AI-Hub
icon_url: data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBmaWxsPSJjdXJyZW50Q29sb3IiIGQ9Ik0xOCAxNmgtLjU4bC0uODEtLjgxQTcuMDcgNy4wNyAwIDAgMCAxOCAxMWMwLTMuODctMy4xMy0... | bbvch-ai/aihub-core | infra/configs/openwebui/functions/tracing_action.py | .py | d4e4c68fb9b7db45 | 7.54 | 11 |
"""Validate built distribution artifacts before publishing to PyPI.
Run against a ``dist/`` directory of wheels and sdists. Two hard checks per artifact:
1. **Namespace integrity** — the shared ``swiss_ai_hub`` namespace MUST remain a PEP 420
native namespace. Any distribution that ships ``swiss_ai_hub/__init_... | bbvch-ai/aihub-core | infra/release/check_dist.py | .py | dedf9ed348aca43d | 7.54 | 11 |
"""Guards on the shipped profile templates.
The credential assertions are the reason this file exists. `Form.to_template_data` filters on
`get_configurable_fields()`, which walks top-level fields only, so the entire nested `imap` group — password included —
is serialized into the discovery event and rendered in the Ad... | bbvch-ai/aihub-core | packages/agent/app/email_classification_agent/tests/test_templates.py | .py | 841aa109e524af08 | 8.04 | 11 |
import sys
import time
import requests
from requests.exceptions import HTTPError
from http import HTTPStatus
from bs4 import BeautifulSoup, Tag
import os
import json
from google import genai
from pydantic import BaseModel, Field
from typing import List
# Replace with your actual Google Cloud API Key
API_KEY = os.envir... | ruvasqm/awesome-vzla | scrape.py | .py | 38a784afab193a88 | 7.42 | 6 |
from enum import Enum
class MatchingMode(Enum):
SPECIFIC = 0
WHOLE = 1
class KnownError:
"""A known error pattern identified by a unique ID and a regex."""
def __init__(self, error_id: str, pattern: str, mode: MatchingMode) -> None:
self.error_id = error_id
self.pattern = pattern
... | DepTyCheck/verilog-model | ci/runner/common/error_types.py | .py | b14c6865e85b08a1 | 7.45 | 7 |
import re
from typing import Protocol
from common.error_types import ErrorMatchInTest, FoundMatch, MatchingMode, UnexpectedError
from common.logger import get_logger
from common.tool_error_regex import ToolErrorRegex
class ErrorMatcherProtocol(Protocol):
"""
Any object that can match tool output against know... | DepTyCheck/verilog-model | ci/runner/common/handle_errors.py | .py | 77a42f260d6512fb | 7.45 | 7 |
import re
from typing import List
from common.error_file_parser import ErrorFile, parse_error_files
from common.error_types import FoundMatch, IgnoredError, KnownError, MatchingMode
from common.logger import get_logger
class IgnoredErrorsList:
def __init__(self, dir_path: str, tool: str, regex_list=None):
... | DepTyCheck/verilog-model | ci/runner/common/ignored_errors_list.py | .py | d499cbc6b37ce105 | 7.45 | 7 |
"""
Generic GitHub-Flavored Markdown table builder.
Usage:
from common.markdown_table import build_markdown_table
table = build_markdown_table(
headers=["Name", "Value", "Score"],
rows=[["foo", "bar", "42"]],
alignments=["left", "left", "right"],
title="Results",
)
Column ... | DepTyCheck/verilog-model | ci/runner/common/markdown_table.py | .py | 9bde500c2997465c | 7.45 | 7 |
# ci/runner/common/per_file_report.py
"""
Canonical per-file JSON schema, writer, loader, and outcome helper.
Schema (top level):
{
"tool_name", "tool_version", "tool_commit", "model_commit", "run_date",
"files": [
{
"filename": str,
"commands": [
{
"command": str,
"outc... | DepTyCheck/verilog-model | ci/runner/common/per_file_report.py | .py | 07af0d684f6edf4f | 7.45 | 7 |
# ci/runner/common/run_tool_command.py
from dataclasses import dataclass, field
from common.command_config import CommandConfig
from common.command_output import CommandOutput
from common.error_types import KnownError
from common.handle_errors import ErrorMatcherProtocol
from common.per_file_report import MatchRecord
... | DepTyCheck/verilog-model | ci/runner/common/run_tool_command.py | .py | 282db4ad5367205f | 7.45 | 7 |
# ci/runner/common/tests/test_command_result.py
import unittest
from common.command_config import CommandConfig
from common.error_types import MatchingMode
from common.ignored_errors_list import IgnoredErrorsList
from common.run_command import ExecutionResult
from common.run_tool_command import CommandResult, MatchRec... | DepTyCheck/verilog-model | ci/runner/common/tests/test_command_result.py | .py | 9a164911754a5ea6 | 7.95 | 7 |
# ci/runner/common/tests/test_nvc_segv_regex.py
import unittest
from common.error_types import MatchingMode
from common.ignored_errors_list import IgnoredErrorsList
# Parentheses around the libc path must be escaped; otherwise they form a
# capturing group and the literal '(' / ')' in the crash dump are not matched.
... | DepTyCheck/verilog-model | ci/runner/common/tests/test_nvc_segv_regex.py | .py | 8ea2c1e4434fad66 | 7.95 | 7 |
from __future__ import annotations
import time
import math
import datetime
from concurrent.futures import ThreadPoolExecutor, as_completed
import click
from scipy.stats import norm
from scipy.optimize import brentq
from tabulate import tabulate
from bbroker.settings import ex, ensure_markets
from bbroker.ext_order_mgr... | aviatorBeijing/binance_options | src/bbroker/straddle_calc.py | .py | 4ea59674c0d00a56 | 7.48 | 8 |
import os,datetime
import pandas as pd
from butil.butils import get_binance_index
def cunit(contract):
# https://www.binance.com/en/support/faq/binance-options-contract-specifications-cdee5d43b70d4d2386980d41786a8533
sz = 0
if contract.startswith( 'BTC-' ) or \
contract.startswith( 'ETH-' ) or \
... | aviatorBeijing/binance_options | src/brisk/bfee.py | .py | 00b781e4dce87118 | 7.48 | 8 |
import os,datetime
import ccxt
import pandas as pd
DEBUG = os.getenv("expo", None)
DATADIR=os.getenv('USER_HOME','/home/ubuntu')+'/data/binance/options'
if not os.path.exists( DATADIR):
try:
os.makedirs( DATADIR )
except Exception as e:
print('*** Make sure set the "USER_HOME" directory for te... | aviatorBeijing/binance_options | src/butil/butils.py | .py | 56d3d4783b90bbeb | 7.48 | 8 |
import numpy as np
import scipy.stats as scs
import datetime
np.set_printoptions(suppress=True)
"""
Black-Schole-Merton Theory (BSM)
European-style Options
"""
def get_maturity(contract):
fds = contract.split('-')
ts = datetime.datetime.strptime('20'+fds[1], '%Y%m%d') + datetime.timedelta(hours=8) # Settle ... | aviatorBeijing/binance_options | src/butil/options_calculator.py | .py | fc87bb1573cd4b97 | 7.48 | 8 |
import pandas as pd
import numpy as np
import datetime
APPROX_DAILY_TRADING_HOURS = 24
APPROX_BDAYS_PER_MONTH = 21
APPROX_BDAYS_PER_YEAR = 365
APPROX_MINUTES_PER_YEAR = APPROX_BDAYS_PER_YEAR * APPROX_DAILY_TRADING_HOURS * 12
MONTHS_PER_YEAR = 12
WEEKS_PER_YEAR = 52
QTRS_PER_YEAR = 4
MINUTELY = 'minutely'
DAILY = 'd... | aviatorBeijing/binance_options | src/butil/portfolio_stats.py | .py | e93ae46db89ef62e | 7.48 | 8 |
# https://michaelhly.com/solana-py/
import aiohttp
import asyncio
import json
from asyncstdlib import enumerate
from solana.rpc.websocket_api import connect
from solders.pubkey import Pubkey
from solana.rpc.api import Client
ENDPOINT='wss://api.mainnet-beta.solana.com/' #wss://api.devnet.solana.com
RPC_ENDPOINT = "... | aviatorBeijing/binance_options | src/dex/tx_wss.py | .py | 54735f1c525d9673 | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
"""
Harmony format streaming parser for gpt-oss models.
Uses the official openai-harmony package for robust parsing.
Harmony protocol uses special tokens to structure messages:
- <|start|>: Begin message header
- <|channel|>: Mark channel type
- <|message|>: Transition to content... | Mizistein/omlx | omlx/adapter/harmony.py | .py | ff0c1f2384534928 | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
"""Authentication utilities for the oMLX admin panel.
This module provides session-based authentication using signed tokens
and API key verification for admin panel access.
"""
import os
import secrets
from typing import Optional
from fastapi import HTTPException, Request
from f... | Mizistein/omlx | omlx/admin/auth.py | .py | 90763aac4141d1ce | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
"""Benchmark execution logic for oMLX admin panel.
Provides single-request and continuous-batching benchmarks with
real-time progress reporting via SSE events.
"""
import asyncio
import json
import logging
import time
import uuid
from dataclasses import dataclass, field
from typi... | Mizistein/omlx | omlx/admin/benchmark.py | .py | 47c83b106f7a5e6f | 7.48 | 8 |
#!/usr/bin/env python3
"""Build script for Tailwind CSS compilation.
Downloads Tailwind v3 standalone CLI if needed and compiles CSS.
Requires no Node.js installation.
Usage:
cd omlx/omlx/admin
python build_css.py # Build minified CSS
python build_css.py --watch # Watch mode for development
"""
... | Mizistein/omlx | omlx/admin/build_css.py | .py | 750ca93f96c9f0d3 | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
"""HuggingFace model downloader for oMLX admin panel.
Downloads models from HuggingFace Hub using huggingface_hub's snapshot_download
with directory-size-based progress polling.
"""
import asyncio
import enum
import logging
import shutil
import time
import uuid
from dataclasses i... | Mizistein/omlx | omlx/admin/hf_downloader.py | .py | 8cc3e2ef3a08252b | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
"""
Anthropic API adapter for oMLX.
This adapter handles conversion between Anthropic Messages API format and the
internal request/response format used by the inference engine.
"""
import json
import uuid
from typing import Any, List, Optional
from .base import (
BaseAdapter... | Mizistein/omlx | omlx/api/adapters/anthropic.py | .py | 387c75fcdd91afa2 | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
"""
OpenAI API adapter for oMLX.
This adapter handles conversion between OpenAI API format and the internal
request/response format used by the inference engine.
"""
import json
import time
import uuid
from typing import Any, List, Optional
from .base import (
BaseAdapter,
... | Mizistein/omlx | omlx/api/adapters/openai.py | .py | 15d18402de11e666 | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
"""
Utility functions for the Embeddings API.
Provides:
- Base64 encoding for embeddings
- Dimension truncation with renormalization
- Token counting for usage statistics
"""
import base64
import math
import struct
from typing import Any, List, Union
def encode_embedding_base64... | Mizistein/omlx | omlx/api/embedding_utils.py | .py | 0d734167b3f08abb | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
"""
MCP (Model Context Protocol) API routes.
This module provides FastAPI routes for MCP tool management:
- GET /v1/mcp/tools - List available MCP tools
- GET /v1/mcp/servers - List MCP server status
- POST /v1/mcp/execute - Execute an MCP tool
"""
from fastapi import APIRouter, ... | Mizistein/omlx | omlx/api/mcp_routes.py | .py | 0e1ada61c5a21eb7 | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
"""Shared models and utilities for API responses."""
import time
import uuid
from enum import Enum
from pydantic import BaseModel
class IDPrefix(str, Enum):
"""Prefixes for generated IDs."""
CHAT_COMPLETION = "chatcmpl"
COMPLETION = "cmpl"
MESSAGE = "msg"
E... | Mizistein/omlx | omlx/api/shared_models.py | .py | ac3ba08c7c1bd463 | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
"""
Factory for creating cache instances from configuration.
This module provides a unified way to instantiate cache components
based on configuration settings.
Note: oMLX only supports paged SSD-based caching. Memory KV cache is managed
by mlx-lm's BatchGenerator. When paged SSD... | Mizistein/omlx | omlx/cache/factory.py | .py | 1466dccd212fb9ca | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
"""
Hybrid cache configuration for models with mixed cache types.
This module provides configuration classes for models that use different
cache types across layers (e.g., Qwen3-Next with ArraysCache + KVCache).
"""
from dataclasses import dataclass, field
from typing import Any,... | Mizistein/omlx | omlx/cache/hybrid_cache.py | .py | e3ef392696e0e65b | 7.48 | 8 |
# SPDX-License-Identifier: Apache-2.0
"""
Cache Recovery Manager for oMLX.
This module handles error recovery for cache corruption and other cache-related
failures, enabling the scheduler to continue processing after encountering errors.
"""
import gc
import logging
from typing import TYPE_CHECKING, Any, Dict, List, ... | Mizistein/omlx | omlx/cache/recovery.py | .py | 7823811c69068dcd | 7.48 | 8 |
#!/usr/bin/env python3
"""MindRouter Web Search MCP Server.
Exposes MindRouter's /v1/search endpoint as an MCP tool so agentic
systems (Claude Code, CoWork, Cursor, etc.) can search the web.
Usage:
pip install "mcp[cli]" httpx
export MINDROUTER_API_KEY=mr2_your_key_here
python server.py
Configure in Clau... | ui-insight/MindRouter | agentic_ai/mcp/search/server.py | .py | 4ce04a28c3d0e28a | 7.64 | 18 |
"""Session deactivation guard.
Dashboard/chat sessions are signed cookies valid for up to 7 days, and
until 2.9.5 nothing re-checked ``users.is_active`` after login — a
deactivated (or deleted) user's existing session kept working until the
cookie expired. This raw-ASGI middleware closes that gap: any request
carryin... | ui-insight/MindRouter | backend/app/core/session_guard.py | .py | 4d7c285c765f52d1 | 7.64 | 18 |
from sympy import Matrix, symbols
import re
def calculate_dynamics_and_derivatives(x_dim, u_dim, f_vector):
"""
计算动力学方程及其导数。
参数:
- x_dim: 状态变量的数量
- u_dim: 控制变量的数量
- f_vector: 状态方程向量(SymPy 矩阵)
返回:
- 显式雅可比矩阵、隐式雅可比矩阵
"""
# 定义状态变量、控制变量和 x_dot 符号
x = Matrix(symbols(f'x:{x_dim}'... | VincentWong3/generate-c-code-from-python | python/calc_jacobian_and_hessian.py | .py | ab2bece1400febc7 | 7.45 | 7 |
from sympy import Matrix, symbols, cos, sin, tan
import sympy as sp
import re
from string import Template
import os
def parse_expression(expr):
"""
Recursively parses a SymPy expression to a C++ code string, handling powers and mathematical functions.
Parameters:
- expr: SymPy expression.
Returns... | VincentWong3/generate-c-code-from-python | python/generate_function_c_code.py | .py | 842ccb62b198028a | 7.45 | 7 |
# coding:utf-8
import os
import datetime
import requests
import urllib.parse
from pyquery import PyQuery as pq
def scrape_url(url):
''' Scrape github trending url
'''
HEADERS = {
'User-Agent' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20100101 Firefox/11.0',
'Accept' ... | ZonghaoLi777/githubTrending | scraper.py | .py | 0d8e44cccd800737 | 7.57 | 13 |
#!/usr/bin/env python3
"""stat_collector.py
Purpose:
This is a thin command-line wrapper around `scarab_stats.stat_aggregator.write_experiment_csv_numpy()`.
Why this script exists:
- It provides a stable CLI for users and for Slurm jobs.
- All heavy lifting (descriptor expansion, parsing, CSV writing, postproce... | litz-lab/scarab-infra | scarab_stats/stat_collector.py | .py | 60f199e652e033b9 | 7.65 | 19 |
from gather_cluster_results import *
import os, sys
import subprocess
from time import sleep
import shutil
# pip install plotly==5.18.0
import plotly.graph_objects as go
# ref: https://stackoverflow.com/a/13197763
class cd:
"""Context manager for changing the current working directory"""
def __init__(self, new... | litz-lab/scarab-infra | scripts/deprecated/plot_warmup.py | .py | 4d0cafa3ab6a7b13 | 7.65 | 19 |
#!/usr/bin/python3
"""Content-addressed docker image identity for scarab-infra.
The image tag used to be the scarab-infra git hash. That made every infra
commit mint a new tag for byte-identical image content: the tag had to be
materialised on each node, either by retagging a local base image or -- when
that base was ... | litz-lab/scarab-infra | scripts/image_identity.py | .py | a9c32daeea449d93 | 7.65 | 19 |
#include <rclcpp/rclcpp.hpp>
#include <rclcpp/executors/single_threaded_executor.hpp>
// rosbag2_transport
#include <rosbag2_transport/player.hpp>
#include <rosbag2_transport/play_options.hpp>
#include <rosbag2_storage/storage_options.hpp>
#include <nav_msgs/msg/odometry.hpp>
#include <nav_msgs/msg/occupancy_grid.hpp... | litz-lab/scarab-infra | workloads/autoware/crosswalk_velocity/src/crosswalk_test.cpp | .cpp | 215f882aa010f544 | 7.15 | 19 |
#include <memory>
#include <string>
#include <atomic>
#include <cstdint>
#include <iostream>
#include <random>
#include "rclcpp/rclcpp.hpp"
#include "sensor_msgs/msg/point_cloud2.hpp"
#include "tier4_perception_msgs/msg/detected_objects_with_feature.hpp"
#include "autoware/euclidean_cluster/voxel_grid_based_euclidean_... | litz-lab/scarab-infra | workloads/autoware/euclidean_cluster/src/cluster_test_node.cpp | .cpp | 8d7b67d5a3eaa270 | 7.15 | 19 |
"""Bootstrap Azathoth runtime composition for the command-line application."""
from azathoth.cli.configuration import CliRuntimeConfiguration
from azathoth.providers import (
LanguageModelRegistry,
ModelCatalog,
ModelCatalogLoader,
OpenRouterConfiguration,
OpenRouterModelRegistryLoader,
SQLiteM... | EldritchInc/azathoth | src/azathoth/cli/bootstrap.py | .py | 6d81bddbdbe9a0be | 7.42 | 6 |
"""Configuration for bootstrapping the Azathoth CLI runtime."""
import os
from collections.abc import Mapping
from dataclasses import dataclass
from pathlib import Path
from pydantic import SecretStr
DEFAULT_DATABASE = Path("azathoth.db")
DATABASE_ENVIRONMENT_VARIABLE = "AZATHOTH_DATABASE"
OPENROUTER_API_KEY_ENVIR... | EldritchInc/azathoth | src/azathoth/cli/configuration.py | .py | b341c4d6d8c9e09b | 7.42 | 6 |
"""Event-backed context models used during Azathoth executions."""
from datetime import UTC, datetime
from uuid import UUID, uuid4
from pydantic import BaseModel, ConfigDict, Field, JsonValue
def utc_now() -> datetime:
"""Return the current time as a timezone-aware UTC datetime."""
return datetime.now(UTC)... | EldritchInc/azathoth | src/azathoth/context/models.py | .py | 9c46f1f10be96cf6 | 7.42 | 6 |
"""Domain models describing reusable evaluation benchmarks."""
from uuid import UUID, uuid4
from pydantic import BaseModel, ConfigDict, Field, JsonValue, model_validator
from azathoth.evaluation.models import ExpectedOutcome
class BenchmarkCase(BaseModel):
"""One input and expected outcome in an evaluation ben... | EldritchInc/azathoth | src/azathoth/evaluation/benchmark.py | .py | 6d162f22cca7a12d | 7.42 | 6 |
"""Immutable catalogs of reusable benchmark datasets."""
from uuid import UUID
from pydantic import BaseModel, ConfigDict
from azathoth.evaluation.benchmark import BenchmarkDataset
class BenchmarkCatalog(BaseModel):
"""Immutable inventory of configured benchmark datasets."""
model_config = ConfigDict(
... | EldritchInc/azathoth | src/azathoth/evaluation/benchmark_catalog.py | .py | ed78b52cc2140fca | 7.42 | 6 |
"""Reconstruct benchmark catalogs from durable repositories."""
from azathoth.evaluation.benchmark_catalog import BenchmarkCatalog
from azathoth.evaluation.benchmark_repository import BenchmarkRepository
class BenchmarkCatalogLoader:
"""Load immutable benchmark catalogs from repository state."""
def __init_... | EldritchInc/azathoth | src/azathoth/evaluation/benchmark_catalog_loader.py | .py | 80899238aebb161f | 7.42 | 6 |
"""Persistence contracts for reusable benchmark datasets."""
from typing import Protocol
from uuid import UUID
from azathoth.evaluation.benchmark import BenchmarkDataset
class BenchmarkRepository(Protocol):
"""Persist and retrieve reusable benchmark datasets."""
def save(
self,
dataset: Ben... | EldritchInc/azathoth | src/azathoth/evaluation/benchmark_repository.py | .py | e1449a0f41eaa206 | 7.42 | 6 |
"""Deterministic exact-value evaluator."""
from pydantic import JsonValue
from azathoth.evaluation.models import (
EvaluationEvidence,
EvaluationResult,
EvaluationStatus,
ExpectedOutcome,
)
from azathoth.evaluation.protocols import EvaluatorMetadata
class ExactMatchEvaluator:
"""Evaluate outputs... | EldritchInc/azathoth | src/azathoth/evaluation/exact.py | .py | 7159e460eb6fb697 | 7.42 | 6 |
"""Deterministic in-memory persistence for benchmark datasets."""
from uuid import UUID
from azathoth.evaluation.benchmark import BenchmarkDataset
from azathoth.evaluation.benchmark_repository import BenchmarkRepository
class InMemoryBenchmarkRepository:
"""Store immutable benchmark datasets in insertion order.... | EldritchInc/azathoth | src/azathoth/evaluation/memory_benchmark_repository.py | .py | 1fc0a6a5ccf9c0a5 | 7.42 | 6 |
"""Domain models describing expected outcomes and completed evaluations."""
from enum import StrEnum
from uuid import UUID, uuid4
from pydantic import (
BaseModel,
ConfigDict,
Field,
JsonValue,
model_validator,
)
class OutcomeComparison(StrEnum):
"""The broad comparison method appropriate fo... | EldritchInc/azathoth | src/azathoth/evaluation/models.py | .py | ab7afb04eab45a2e | 7.42 | 6 |
"""Protocols implemented by Azathoth evaluators."""
from typing import Protocol
from pydantic import BaseModel, ConfigDict, Field, JsonValue
from azathoth.evaluation.models import EvaluationResult, ExpectedOutcome
class EvaluatorMetadata(BaseModel):
"""Stable identifying information for an evaluator."""
m... | EldritchInc/azathoth | src/azathoth/evaluation/protocols.py | .py | ba7f6c733d184ed4 | 7.42 | 6 |
"""SQLite persistence for reusable benchmark datasets."""
import sqlite3
from pathlib import Path
from uuid import UUID
from azathoth.evaluation.benchmark import BenchmarkDataset
class SQLiteBenchmarkRepository:
"""Persist immutable benchmark datasets in SQLite."""
def __init__(
self,
datab... | EldritchInc/azathoth | src/azathoth/evaluation/sqlite_benchmark_repository.py | .py | d2d59993ff2b1306 | 7.42 | 6 |
"""Execution services for running strategies against structured context."""
from collections.abc import Callable
from datetime import UTC, datetime
from typing import TypeAlias
from azathoth.context import Context, ContextEvent
from azathoth.execution.models import ExecutionResult
from azathoth.strategies import Stra... | EldritchInc/azathoth | src/azathoth/execution/executor.py | .py | b5baf940d1c8237c | 7.42 | 6 |
"""Immutable catalogs of reusable goals."""
from uuid import UUID
from pydantic import BaseModel, ConfigDict
from azathoth.goals.models import Goal
class GoalCatalog(BaseModel):
"""Immutable inventory of configured goals."""
model_config = ConfigDict(
frozen=True,
)
goals: tuple[
... | EldritchInc/azathoth | src/azathoth/goals/catalog.py | .py | d3aa6e6e43091e46 | 7.42 | 6 |
"""Reconstruct goal catalogs from durable repositories."""
from azathoth.goals.catalog import GoalCatalog
from azathoth.goals.repository import GoalRepository
class GoalCatalogLoader:
"""Load immutable goal catalogs from repository state."""
def __init__(
self,
repository: GoalRepository,
... | EldritchInc/azathoth | src/azathoth/goals/catalog_loader.py | .py | 864cf0d89ed5e621 | 7.42 | 6 |
"""Deterministic in-memory persistence for reusable goals."""
from uuid import UUID
from azathoth.goals.models import Goal
from azathoth.goals.repository import GoalRepository
class InMemoryGoalRepository:
"""Store immutable goals in insertion order."""
def __init__(
self,
) -> None:
se... | EldritchInc/azathoth | src/azathoth/goals/memory_repository.py | .py | 5749268db803847c | 7.42 | 6 |
"""Persistence contracts for reusable goals."""
from typing import Protocol
from uuid import UUID
from azathoth.goals.models import Goal
class GoalRepository(Protocol):
"""Persist and retrieve reusable goals."""
def save(
self,
goal: Goal,
) -> None:
"""Persist one goal."""
... | EldritchInc/azathoth | src/azathoth/goals/repository.py | .py | a3dbeebd8b7d5e36 | 7.42 | 6 |
"""SQLite persistence for reusable goals."""
import sqlite3
from pathlib import Path
from uuid import UUID
from azathoth.goals.models import Goal
class SQLiteGoalRepository:
"""Persist immutable goals in SQLite."""
def __init__(
self,
database: str | Path,
) -> None:
self._datab... | EldritchInc/azathoth | src/azathoth/goals/sqlite_repository.py | .py | 02b7b1786c657470 | 7.42 | 6 |
"""Orchestration services for running strategy experiments."""
from collections.abc import Sequence
from typing import Protocol
from azathoth.evaluation import Evaluator
from azathoth.optimization.models import (
OptimizationExample,
OptimizationRun,
StrategyScorecard,
)
from azathoth.optimization.runner ... | EldritchInc/azathoth | src/azathoth/optimization/experiment.py | .py | 1952f73025c386ce | 7.42 | 6 |
"""Reference workflow optimization through cheaper model substitution."""
from uuid import UUID
from azathoth.optimization.model_substitution import (
generate_model_substitutions,
)
from azathoth.optimization.workflow import (
WorkflowOptimizationResult,
)
from azathoth.providers import (
LanguageModelRe... | EldritchInc/azathoth | src/azathoth/optimization/model_substitution_optimizer.py | .py | 19e5bbcdc4341a16 | 7.42 | 6 |
"""Deterministic ranking of candidate strategy scorecards."""
from collections.abc import Sequence
from azathoth.optimization.models import (
RankedStrategy,
StrategyRanking,
StrategyScorecard,
)
class StrategyRanker:
"""Rank candidate strategies using recorded experiment evidence."""
def rank(... | EldritchInc/azathoth | src/azathoth/optimization/ranking.py | .py | 1116090bb09945df | 7.42 | 6 |
"""Replay workflow optimization."""
from azathoth.optimization.workflow import (
WorkflowOptimizationResult,
)
from azathoth.workflows.candidate import (
WorkflowCandidate,
)
from azathoth.workflows.experiment import (
WorkflowExperimentResult,
)
class ReplayWorkflowOptimizer:
"""Produce a new genera... | EldritchInc/azathoth | src/azathoth/optimization/replay.py | .py | 4d14c1fa0c3bc8f7 | 7.42 | 6 |
"""Orchestration services for executing and evaluating strategies."""
from collections.abc import Callable
from datetime import UTC, datetime
from typing import Protocol, TypeAlias
from azathoth.context import Context
from azathoth.evaluation import Evaluator
from azathoth.execution import ExecutionResult, StrategyEx... | EldritchInc/azathoth | src/azathoth/optimization/runner.py | .py | 22d5cdf0c8e4d8b8 | 7.42 | 6 |
"""Workflow optimization session models."""
from pydantic import (
BaseModel,
ConfigDict,
Field,
InstanceOf,
model_validator,
)
from azathoth.optimization.workflow import WorkflowOptimizationResult
from azathoth.workflows.candidate import WorkflowCandidate
class WorkflowOptimizationSession(BaseM... | EldritchInc/azathoth | src/azathoth/optimization/session.py | .py | 070784875fb26e08 | 7.42 | 6 |
"""Workflow optimization session orchestration."""
from typing import Protocol
from azathoth.context import Context
from azathoth.evaluation import (
Evaluator,
ExpectedOutcome,
)
from azathoth.optimization.session import WorkflowOptimizationSession
from azathoth.optimization.workflow import WorkflowOptimizer... | EldritchInc/azathoth | src/azathoth/optimization/session_runner.py | .py | 39520dc6c354cb91 | 7.42 | 6 |
"""Workflow optimization models and contracts."""
from typing import Protocol
from pydantic import (
BaseModel,
ConfigDict,
Field,
InstanceOf,
)
from azathoth.workflows.candidate import (
WorkflowCandidate,
)
from azathoth.workflows.experiment import (
WorkflowExperimentResult,
)
class Work... | EldritchInc/azathoth | src/azathoth/optimization/workflow.py | .py | d751cd16f8f5da17 | 7.42 | 6 |
# session_state_manager.py
import streamlit as st
import streamlit_analytics2
import pandas as pd
import random
import string
# Get available languages from translation file
TRANSLATIONS_DF = pd.read_csv('translation.csv')
AVAILABLE_LANGUAGES = [col for col in TRANSLATIONS_DF.columns if col not in ['KEY VALUE']]
def... | pvpiv/pogo_search_string | session_state_manager.py | .py | 4307c892b1013052 | 7.48 | 8 |
"""Spatial environment discretisation for SIMPL.
The ``Environment`` manages the spatial grid over which receptive fields
are defined. It supports arbitrary dimensionality (1-D through n-D) and
provides coordinate arrays, discretised meshgrids, and plotting helpers.
Dimension naming convention:
* 1-D: ``['x']``
* 2... | TomGeorge1234/SIMPL | src/simpl/environment.py | .py | f82bbde9594efc08 | 7.63 | 17 |
"""Shared fixtures for SIMPL test suite."""
import jax
import pytest
from simpl.utils import load_demo_data
_HAS_METAL = any(d.platform == "METAL" for d in jax.devices())
@pytest.fixture(autouse=True)
def _force_cpu_on_metal(request):
"""When running on Apple Metal, force CPU for tests marked ``cpu_only``.
... | TomGeorge1234/SIMPL | tests/conftest.py | .py | 495c6cac3ce02b0e | 8.13 | 17 |
"""Tests for simpl.cli."""
import subprocess
import sys
from pathlib import Path
import pytest
from simpl.cli import _NOTEBOOK_NAME, demo, main
class TestDemo:
def test_downloads_notebook_from_local_source(self, tmp_path, monkeypatch):
"""When run from an editable install, copies from the local source ... | TomGeorge1234/SIMPL | tests/test_cli.py | .py | ce67821792538bde | 7.13 | 17 |
"""Test that the MkDocs documentation builds without errors."""
import subprocess
import sys
import pytest
@pytest.mark.docs
def test_mkdocs_build():
"""mkdocs build --strict must exit cleanly."""
pytest.importorskip("mkdocs", reason="mkdocs not installed")
result = subprocess.run(
[sys.executab... | TomGeorge1234/SIMPL | tests/test_docs.py | .py | f39ddc8fe4a47c05 | 7.13 | 17 |
"""Tests for simpl.kde."""
import jax.numpy as jnp
import numpy as np
import pytest
from simpl.kde import (
decode_observations,
gaussian_kernel,
kde,
kde_angular,
poisson_log_likelihood,
poisson_log_likelihood_maps,
)
class TestGaussianKernel:
def test_peak_at_same_point(self):
... | TomGeorge1234/SIMPL | tests/test_kde.py | .py | ed4ad0a14a680237 | 8.13 | 17 |
"""Tests for simpl.utils."""
import jax.numpy as jnp
import jax.random as random
import numpy as np
import pytest
import xarray as xr
from simpl.utils import (
_AVAILABLE_DEMO_DATA,
_bin_indices_minuspi_pi,
_circular_conv_fft_1d,
_circular_mean_and_variance,
_estimate_kernel_bandwidth,
_wrap_m... | TomGeorge1234/SIMPL | tests/test_utils.py | .py | c2faf2c9a0ee1169 | 7.13 | 17 |
"""
The core functionality of SCARIF
the units used in this function:
- carbon cost: KgCO2e
- dram,ssd,hdd-size: GB
- year: 20xx
- chip area: mm^2
"""
import os
from ACT.logic_model import Fab_Logic
class predictor:
"""
Predictor used for server-level carbon cost estimation
"""
def ... | arc-research-lab/SCARIF | SCARIF_class.py | .py | 73b46a3e18e7e709 | 7.6 | 15 |
"""
Update rtb-api data from Forbes real-time billionaires API.
Generates:
- api/list/rtb/{date} — daily ranked list
- api/profile/{uri}/history — appends today's entry
- api/profile/{uri}/info — updates profile info
- api/profile/{uri}/rank — updates current rank
- api/profile/{uri}/assets — updates f... | komed3/rtb-api | scripts/update_from_forbes.py | .py | 468c490eca07298a | 7.66 | 20 |
#!/usr/bin/env python3
"""Collection of functions to build a minimal package and publish on PyPI."""
# Core Library modules
import os
import pickle
import re
import shutil
import subprocess
import sys
from importlib.resources import as_file
from pathlib import Path
from typing import Any, Union
# Third party modules
... | Stephen-RA-King/pynamer | src/pynamer/builder.py | .py | dfdae3d2deea7433 | 7.42 | 6 |
#!/usr/bin/env python3
"""Collection of package support utilities."""
# Core Library modules
import json
import os
import pickle
import re
from importlib.resources import as_file
from pathlib import Path
from typing import Any, Union
# Third party modules
import requests
from colorama import Back, Fore, Style
from pa... | Stephen-RA-King/pynamer | src/pynamer/utils.py | .py | 766ebc0f288e207d | 7.42 | 6 |
#!/usr/bin/env python3
"""Collection of functions to test availability of a package name on PyPI"""
# Core Library modules
import json
import re
import string
from datetime import datetime
from typing import Any, Union
# Third party modules
import requests
from bs4 import BeautifulSoup
from dateutil.parser import iso... | Stephen-RA-King/pynamer | src/pynamer/validators.py | .py | c72027fffc33f7b8 | 7.42 | 6 |
#!/usr/bin/env python3
"""
Tasks for maintaining the project.
Execute 'invoke --list' for guidance on using Invoke
"""
# Core Library modules
import logging.config
import shutil
import webbrowser
from pathlib import Path
# Third party modules
import yaml # type: ignore
from invoke import call, task
from jinja2 impor... | Stephen-RA-King/pynamer | tasks.py | .py | 3d339573acfcbf17 | 7.42 | 6 |
#!/usr/bin/env python3
# Core Library modules
# Third party modules
import pytest
from colorama import Back, Fore, Style
# First party modules
from pynamer import pynamer
@pytest.mark.parametrize(
"message, message_type, result",
[
("null", "null", f"{Fore.WHITE}{Style.BRIGHT}null{Style.RESET_ALL}\n... | Stephen-RA-King/pynamer | tests/test_feedback.py | .py | 849e7c593ece665d | 7.92 | 6 |
import json
import re
import sys
class ArXivURLParsingError(Exception):
"""Custom exception for arXiv URL parsing errors."""
pass
def extract_arxiv_id(url):
if url is None:
return None
# Regular expression to match arXiv IDs
pattern = r'arxiv\.org/abs/(\d+\.\d+)'
match = re.search(patt... | dmarx/stars | scripts/convert_arxiv_urls_to_ids.py | .py | ce8b960c551003b4 | 7.45 | 7 |
import os
import re
import sys
import random
import string
import logging
import argparse
import datetime
from pydoc import locate
from collections import defaultdict
def jobRandomString(num_chars=4):
global random_string
# Create a random string, if not done already
if not random_string:
random... | kocherlab/pipemake | pipemake/parser.py | .py | 670ea2e66673d8bd | 7.59 | 14 |
"""A basic first-person camera example using :mod:`pyglet.window.camera`."""
from __future__ import annotations
import weakref
import pyglet
from pyglet.math import Vec2, Vec3
from pyglet.window import key as _key
from pyglet.window.camera import FPSCamera
class FPSCameraControls:
"""First-person controls fro... | sombra-studio/sombra-engine | sombra_engine/fpscamera.py | .py | fbef67dd5d96a999 | 7.42 | 6 |
import os
from pyglet.math import Vec2, Vec3
from sombra_engine.models.obj.mtl_loader import MTLLoader
from sombra_engine.primitives import Material, Triangle, Vertex
class OBJParser:
"""
Class for parsing an OBJ file and storing the data in dictionaries.
This class implements the parse method that rea... | sombra-studio/sombra-engine | sombra_engine/models/obj/obj_parser.py | .py | 6b71e24363e517a2 | 7.42 | 6 |
from importlib.resources import files
import pyglet
from pyglet.enums import GeometryMode
from pyglet.graphics import Batch, Group, Shader, ShaderProgram
from pyglet.math import Vec4
from sombra_engine.graphics import WireframeGroup
from sombra_engine.models import Mesh
class Wireframe:
def __init__(
se... | sombra-studio/sombra-engine | sombra_engine/models/wireframe.py | .py | b2e0d25b1280e8b3 | 7.42 | 6 |
from sombra_engine.constants.actions import CameraActions as actions
from sombra_engine.scene.cameras import Camera
class Control:
"""
The control for a camera handles input conveniently
"""
def handle_action(self, target: Camera, action: actions):
pass
class FPSControl(Control):
def han... | sombra-studio/sombra-engine | sombra_engine/scene/cameras/controllers.py | .py | fc0208a94421def3 | 7.42 | 6 |
import plotly.express as px
from pandas import DataFrame
from plotly.graph_objs._figure import Figure
class Badge:
def __init__(self, df: DataFrame) -> None:
"""badge class for creating plotly badge-sized charts
Args:
df (DataFrame): a vector-like data
"""
self.df = d... | lnxpy/pypi-chart-badge | chart/__init__.py | .py | 5228b3e9452f6060 | 7.52 | 10 |
import requests
from pandas import DataFrame
from pyaction.workflow import annotations
class PyPI:
def __init__(self, package_name: str) -> None:
"""pypi interface
Args:
package_name (str): package name
"""
self.package_name = package_name
def get_rates(self, lim... | lnxpy/pypi-chart-badge | pypi/__init__.py | .py | 6050ab659e8a3a24 | 7.52 | 10 |
"""Shared helpers for alliance health endpoints."""
from alliance.helpers.access import (
can_view_health,
ceo_corp_ids,
is_alliance_executor,
officer_corp_ids,
viewer_home_corp_id,
)
from alliance.helpers.health import latest_snapshot
from alliance.endpoints.health.schemas import ViewerContext
fro... | minmatarfleet/minmatar.org | backend/alliance/endpoints/health/helpers.py | .py | 685c2f379f5f081e | 7.56 | 12 |
"""Who can view alliance health and change community status."""
from django.contrib.auth.models import User
from eveonline.helpers.characters import user_primary_character
from eveonline.models import EveCorporation
from groups.helpers import PEOPLE_TEAM, user_in_group_named
from groups.helpers.feature_access import ... | minmatarfleet/minmatar.org | backend/alliance/helpers/access.py | .py | 3ba61eaa7744d3f7 | 7.56 | 12 |
# Licensed under the MIT License
# https://github.com/craigahobbs/ollama-chat/blob/main/LICENSE
"""
ollama-chat command-line script main module
"""
import argparse
import json
import os
import sys
import threading
import webbrowser
from schema_markdown import encode_query_string
import urllib3
import waitress
from ... | craigahobbs/ollama-chat | src/ollama_chat/main.py | .py | edfcb38fe987a922 | 7.42 | 6 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
import socket
import logging
from threading import Event
from typing import Optional
import win32serviceutil
import win32service
import servicemanager
import sys
import os
import argparse
import shlex
import win32con
import win32api
import pytest
fr... | OpenJobDescription/openjd-sessions-for-python | scripts/windows_service_test.py | .py | 3059ca8751f9d9ff | 8.04 | 11 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""This module contains code for interacting with Linux capabilities. The module uses the ctypes
module from the Python standard library to wrap the libcap library.
See https://man7.org/linux/man-pages/man7/capabilities.7.html for details on this Li... | OpenJobDescription/openjd-sessions-for-python | src/openjd/sessions/_linux/_capabilities.py | .py | eebd7a3f9e031cdf | 7.54 | 11 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
import glob
import os
import sys
import time
from subprocess import Popen, DEVNULL, PIPE, STDOUT, run
from typing import Optional
from .._logging import LoggerAdapter, LogContent, LogExtraInfo
from .._os_checker import is_posix, is_linux
from .._sys... | OpenJobDescription/openjd-sessions-for-python | src/openjd/sessions/_linux/_sudo.py | .py | 3bf7fc899df6528e | 7.54 | 11 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
import re
from dataclasses import dataclass, fields
from enum import Enum
from os import name as os_name
from pathlib import PurePath, PurePosixPath, PureWindowsPath
from string import ascii_lowercase, ascii_uppercase
from typing import Optional, Uni... | OpenJobDescription/openjd-sessions-for-python | src/openjd/sessions/_path_mapping.py | .py | 7f8091a6ece4ff4d | 7.54 | 11 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from datetime import timedelta
from ._logging import LoggerAdapter
from pathlib import Path
from typing import Callable, Optional
from openjd.model import SymbolTable
from openjd.model.v2023_09 import EnvironmentScript as EnvironmentScript_2023_09
f... | OpenJobDescription/openjd-sessions-for-python | src/openjd/sessions/_runner_env_script.py | .py | 4f388bda01ac8308 | 7.54 | 11 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from datetime import timedelta
from ._logging import LoggerAdapter
from pathlib import Path
from typing import Callable, Optional
from openjd.model import SymbolTable
from openjd.model.v2023_09 import StepScript as StepScript_2023_09
from ._embedded... | OpenJobDescription/openjd-sessions-for-python | src/openjd/sessions/_runner_step_script.py | .py | a24c0dcb9907b0f3 | 7.54 | 11 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
import os
import sys
from functools import lru_cache
from typing import Optional
from abc import ABC, abstractmethod
from ctypes.wintypes import HANDLE
from ._os_checker import is_posix, is_windows
if is_posix():
import grp
import pwd
if i... | OpenJobDescription/openjd-sessions-for-python | src/openjd/sessions/_session_user.py | .py | 64605ea6557931a9 | 7.54 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.