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 |
|---|---|---|---|---|---|---|
"""Transform run metrics API responses into export JSON format."""
from __future__ import annotations
import datetime
import math
import re
from pathlib import Path
from typing import Any, cast
from osmosis_ai.cli.errors import CLIError
from osmosis_ai.cli.paths import parse_cli_path
from osmosis_ai.platform.api.mod... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/metrics_export.py | .py | ecdc0ac46aab3a1a | 7.45 | 7 |
"""Render training metric trends as compact sparklines for rich terminals."""
from __future__ import annotations
import math
from rich.table import Table
from rich.text import Text
from osmosis_ai.platform.api.models import MetricDataPoint, MetricHistory
MIN_TREND_TERMINAL_WIDTH = 100
MIN_SPARKLINE_WIDTH = 8
SPARK... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/metrics_graph.py | .py | 107b0e7966740e42 | 7.45 | 7 |
"""Output format/context plumbing for the CLI."""
from __future__ import annotations
import sys
from collections.abc import Iterator
from contextlib import contextmanager
from contextvars import ContextVar, Token
from dataclasses import dataclass
from enum import StrEnum
from typing import TYPE_CHECKING
from osmosis... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/output/context.py | .py | 83cf308fd8e93294 | 7.45 | 7 |
"""Structured error envelope + PlatformAPIError to CLI code mapping."""
from __future__ import annotations
import sys
from typing import Any
from osmosis_ai.cli._click_compat import Context, UsageError, get_current_context
from osmosis_ai.cli.command_registry import (
COMMAND_GROUPS,
REMOVED_TOP_LEVEL_COMMAN... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/output/error.py | .py | ff5b6614cb309677 | 7.45 | 7 |
"""Public JSON serializers for CLI output."""
from __future__ import annotations
from typing import Any
from osmosis_ai.platform.api.models import (
BaseModelInfo,
BenchmarkRun,
DatasetFile,
DevRolloutServerInfo,
EnvironmentSecretInfo,
EvaluationRun,
LoraCheckpointInfo,
LoraModelInfo,... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/output/serializers.py | .py | 5574e86cdc52973e | 7.45 | 7 |
"""Shared helpers for parsing CLI path arguments."""
from __future__ import annotations
import os
from dataclasses import dataclass
from pathlib import Path
@dataclass(frozen=True)
class ParsedCliPath:
path: Path
has_trailing_separator: bool
def parse_cli_path(value: str, *, expand_user: bool = False) -> ... | Osmosis-AI/osmosis-sdk-python | osmosis_ai/cli/paths.py | .py | 4d8e750d9b349990 | 7.45 | 7 |
"""linker-robot-assets — bundled robot asset tree + composer + validators.
This package ships:
- the asset tree at ``linker_robot_assets/assets/`` (URDF / MJCF +
meshes, organised by ``components/`` and ``workstations/``);
- the composer that builds workstation URDFs from components
(``linker_robot_assets.compose... | linker-bot/linker-sim | packages/linker-robot-assets/src/linker_robot_assets/__init__.py | .py | 9a6f332c523a0385 | 7.45 | 7 |
"""Refuse minor/patch version bumps when a workstation's joint names change.
Run as ``python -m linker_robot_assets.ci.joint_rename_guard`` (typically
invoked by ``check_drift.sh`` when ``CHECK_JOINT_RENAMES=1`` is set).
For each workstation present in BOTH the current tree and the previous git
tag, compare the actua... | linker-bot/linker-sim | packages/linker-robot-assets/src/linker_robot_assets/ci/joint_rename_guard.py | .py | 7483f9aeaa66682e | 7.45 | 7 |
"""Deterministic XML serialization for composed URDF/MJCF.
Goal: `git diff` only shows meaningful changes. Re-running the composer on
unchanged inputs produces byte-identical output.
"""
from __future__ import annotations
import xml.etree.ElementTree as ET
from io import StringIO
# Consistent float formatting for x... | linker-bot/linker-sim | packages/linker-robot-assets/src/linker_robot_assets/composer/determinism.py | .py | 09a44f4d97ac7ae8 | 7.45 | 7 |
"""Hand telemetry decoder — linear-fit placeholder.
WARNING: SDK-pending. The Linker SDK has not yet defined an angle
convention; this module ships a linear interpolation from an SDK-shaped
0–100 value per channel to the URDF [lower, upper] limit of the
corresponding actuated joint. When the SDK lands an angle convent... | linker-bot/linker-sim | packages/linker-robot-assets/src/linker_robot_assets/decoders/hand.py | .py | 951449de6b84e1a1 | 7.45 | 7 |
"""Controller Protocol.
Every controller in the repo conforms to this so `BaseEnv` can drive
them uniformly. The contract is thin on purpose: a controller owns
its own gain profile (applied to the robot once on `attach`) and its
own action→effort/target transformation.
Decimation model (understood by `BaseEnv`):
... | linker-bot/linker-sim | packages/linker-sim/src/linker_sim/controllers/base.py | .py | abbf4496f9b24183 | 7.45 | 7 |
"""Joint-space position-PD controller.
Trivial controller: `apply` writes
`default_pos + scale * command` as a position target for `role`'s
actuated joints. Covers the legacy `MinimalAR5RLEnv` use case and is
the default for the hand role in the OSC stack.
"""
from __future__ import annotations
from dataclasses impo... | linker-bot/linker-sim | packages/linker-sim/src/linker_sim/controllers/joint_pd.py | .py | dc913e51c3a970a0 | 7.45 | 7 |
"""OSC (operational-space control) controller — NOT IMPLEMENTED.
TODO(linker-sim): Rewrite and test before use. The previous implementation
was never validated end-to-end and has been gutted.
"""
from __future__ import annotations
from dataclasses import dataclass
import torch
from linker_sim.backends.base import ... | linker-bot/linker-sim | packages/linker-sim/src/linker_sim/controllers/osc.py | .py | 7eac65f7978a13a4 | 7.45 | 7 |
"""Hand-encoding decoders.
Real-robot recordings often store hand commands in a sensor-native
encoding (Linker Hand uses 0–255 bytes per finger) rather than radians.
A decoder takes raw per-frame values plus the actuated-joint limits
for that hand role and returns joint-position targets in radians.
The current Linker... | linker-bot/linker-sim | packages/linker-sim/src/linker_sim/io/replay/hands.py | .py | c2456c9fbc42d1e3 | 7.45 | 7 |
"""Replay sources.
A source is a (role -> per-frame joint-target table) container plus a
sample rate. `TelemetryNpzSource` is the only concrete impl right now;
it reads a numpy `.npz` (or directory containing `telemetry.npz`) and
slices a flat (T, N_total) column block into per-role (T, n_joints)
arrays according to a... | linker-bot/linker-sim | packages/linker-sim/src/linker_sim/io/replay/sources.py | .py | 1ddafb2c038e4352 | 7.45 | 7 |
"""Episode replayer.
Reads episodes produced by `sim.io.recorder.JsonlSink` and drives a
`BaseEnv` through them in one of two modes:
- `action_replay`: feed the recorded action each step. The env's
physics + controller deterministically reproduce (up to RNG +
float noise) the original rollout. Useful for reward/t... | linker-bot/linker-sim | packages/linker-sim/src/linker_sim/io/replayer.py | .py | f0b642c5f7c2efdd | 7.45 | 7 |
"""Task Protocol.
A `Task` owns the env's obs / reward / done semantics and any
task-local reset state (target sampling, object spawning). `BaseEnv`
drives it through a narrow contract so swapping tasks (reach → pick →
place) is a config change, not a code change.
Design points:
- Tasks don't own the simulator. They... | linker-bot/linker-sim | packages/linker-sim/src/linker_sim/tasks/base.py | .py | e9bab642ccc533aa | 7.45 | 7 |
"""core/exec_truth.py — execution-price truth helpers (D-5, external review).
Two tiny, heavily-tested functions shared by the parent entry path, the popper
fire path, and the manage loop:
adopt_fill(quoted, trade, direction, pip)
The broker's orderFillTransaction price is the ONLY true entry. Returns
(... | BrockStar3540/mr-scrooge-v6 | core/exec_truth.py | .py | 1d4c88608e55f2a4 | 7.45 | 7 |
"""core/feed/structure.py — market-structure features (2026-08-06).
Three pure, deterministic feature builders, kept out of the feed so they can be
unit-tested against synthetic bars without a broker:
liquidity_sweep() — equal-high/low stop pools and the sweeps that take them
impulse_blocks() — impulse-origin ... | BrockStar3540/mr-scrooge-v6 | core/feed/structure.py | .py | 652b9c26ef38fbe0 | 7.45 | 7 |
"""core/trial_stats.py — honest statistics for the trial system (D-6).
Three corrections from the 2026-07-27 external review, shared by the governor
and the Shadowboard so promotion and display always use the SAME math:
1. OVERLAP-AWARE EFFECTIVE SAMPLE SIZE. Episodes are deduped at 30-minute
gaps but scored on 24... | BrockStar3540/mr-scrooge-v6 | core/trial_stats.py | .py | e098c82e0c8a97cf | 7.45 | 7 |
"""modules/cells/pair_module.py — PairModule (Phase C).
Holds the set of CellModules for one pair. Session gate comes from the
per-session "enabled" flag in the pair's config/cells/<PAIR>.json.
Usage (from engine):
pair_module = PairModule(pair, config_dict)
...
for cell in pair_module.active_cells(now):... | BrockStar3540/mr-scrooge-v6 | modules/cells/pair_module.py | .py | 9fec49caef16d2b5 | 7.45 | 7 |
from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass
from datetime import datetime
from typing import Optional
from ..playmaker.playmaker import TradeTicket
@dataclass
class Position:
ticket: TradeTicket
entry_price: float
entry_time: date... | BrockStar3540/mr-scrooge-v6 | modules/management/base.py | .py | 0b5cd58ed59a32e4 | 7.45 | 7 |
"""modules/management/bracket.py — fixed-bracket exit manager (FAST slice class).
Cost-aware slicer exits (2026-07-05, Brock live order):
* TP = server-side limit placed on fill (takeProfitOnFill) — cannot slip.
* SL = server-side stop placed on fill (standard V5 path).
* timeout_min: if neither side hit, flat a... | BrockStar3540/mr-scrooge-v6 | modules/management/bracket.py | .py | c37982cd236c2059 | 7.45 | 7 |
"""02_crud.py — CRUD operations with pycubrid.
Demonstrates:
- CREATE TABLE
- INSERT rows
- SELECT with filtering
- UPDATE rows
- DELETE rows
- DROP TABLE cleanup
"""
from __future__ import annotations
import pycubrid
DB_CONFIG = {
"host": "localhost",
"port": 33000,
"database": "testdb",
"user": "d... | cubrid-lab/cubrid-cookbook-python | fundamentals/crud/02_crud.py | .py | cc5d66987fe9eef9 | 7.57 | 13 |
"""03_query_timeout.py - Bound a blocked operation with a client-side read_timeout.
Demonstrates:
- Why a server-side ``lock_timeout`` system parameter is not a reliable way to
bound a client that is blocked waiting for a row lock on CUBRID 11.2
- The robust alternative: pass ``read_timeout`` to ``pycubrid.connect()... | cubrid-lab/cubrid-cookbook-python | fundamentals/error-handling/03_query_timeout.py | .py | 5a60d31d34f68b0f | 7.57 | 13 |
"""05_error_handling.py — Exception handling with pycubrid.
Demonstrates:
- PEP 249 exception hierarchy
- Catching specific database errors
- Handling connection failures
- Graceful error recovery
"""
from __future__ import annotations
import pycubrid
DB_CONFIG = {
"host": "localhost",
"port": 33000,
"d... | cubrid-lab/cubrid-cookbook-python | fundamentals/error-handling/05_error_handling.py | .py | 3f03d2c68a295b29 | 7.57 | 13 |
"""01_isolation_levels.py - CUBRID isolation levels under MVCC.
Demonstrates:
- The isolation levels CUBRID accepts in raw SQL under MVCC
- Setting a level with raw SQL via pycubrid and reading it back
- A two-connection demonstration that dirty reads do NOT occur, even at the
most permissive level, because CUBRID u... | cubrid-lab/cubrid-cookbook-python | fundamentals/isolation-levels/01_isolation_levels.py | .py | 876c3bde00f46f84 | 7.57 | 13 |
"""06_lob.py — Large Object (BLOB/CLOB) handling with pycubrid.
Demonstrates:
- Creating CLOB columns and inserting text data
- Creating BLOB columns and inserting binary data
- Reading LOB data back via the Lob handle
- Working with large text documents
"""
from __future__ import annotations
import pycubrid
from py... | cubrid-lab/cubrid-cookbook-python | fundamentals/lob-handling/06_lob.py | .py | faeaf72a64e2e33e | 7.57 | 13 |
"""01_engine.py — Engine creation and connection management.
Demonstrates:
- Creating engines with different URLs
- Connection pool settings
- Engine events
- Testing connectivity
"""
from __future__ import annotations
from sqlalchemy import create_engine, event, text
# Default connection URL — pycubrid driver (pur... | cubrid-lab/cubrid-cookbook-python | fundamentals/orm-basics/01_engine.py | .py | 857d478474ae50bd | 7.57 | 13 |
"""02_core.py — SQLAlchemy Core usage with CUBRID.
Demonstrates:
- Table definitions
- Core INSERT, SELECT, UPDATE, DELETE
- text() for raw SQL
- Joins, subqueries, and aggregation
"""
from __future__ import annotations
from sqlalchemy import (
Column,
Double,
Integer,
MetaData,
String,
Table... | cubrid-lab/cubrid-cookbook-python | fundamentals/orm-basics/02_core.py | .py | a22875e1c4fedc87 | 7.57 | 13 |
"""03_orm.py — SQLAlchemy ORM with CUBRID.
Demonstrates:
- DeclarativeBase models
- mapped_column with type annotations
- Session — add, query, update, delete
- Filtering, ordering, pagination
"""
from __future__ import annotations
from datetime import date
from sqlalchemy import String, create_engine, func, select... | cubrid-lab/cubrid-cookbook-python | fundamentals/orm-basics/03_orm.py | .py | 79d6b70254692e46 | 7.57 | 13 |
"""04_relationships.py — ORM relationships with CUBRID.
Demonstrates:
- One-to-many relationships
- Many-to-many relationships
- Eager/lazy loading
- Cascading deletes
"""
from __future__ import annotations
from sqlalchemy import Column, ForeignKey, Integer, String, Table, create_engine, select
from sqlalchemy.orm i... | cubrid-lab/cubrid-cookbook-python | fundamentals/orm-basics/04_relationships.py | .py | b33d15a6269a702c | 7.57 | 13 |
"""05_dml_extensions.py — CUBRID-specific DML extensions.
Demonstrates:
- ON DUPLICATE KEY UPDATE (upsert)
- MERGE statement
- REPLACE INTO
"""
from __future__ import annotations
from sqlalchemy import (
Column,
Integer,
MetaData,
String,
Table,
create_engine,
select,
text,
)
from sql... | cubrid-lab/cubrid-cookbook-python | fundamentals/orm-basics/05_dml_extensions.py | .py | 1ce81d78902f20da | 7.57 | 13 |
"""06_reflection.py — Schema reflection with CUBRID.
Demonstrates:
- Inspecting existing tables
- Reflecting table structure (columns, types, constraints)
- Reflecting indexes and foreign keys
- Auto-loading tables from the database
"""
from __future__ import annotations
from sqlalchemy import (
Column,
Doub... | cubrid-lab/cubrid-cookbook-python | fundamentals/orm-basics/06_reflection.py | .py | 29869d8f372e24b3 | 7.57 | 13 |
"""Clean and transform raw order rows using pandas rename, assign, and apply patterns."""
from __future__ import annotations
from sqlalchemy import create_engine, text
from sqlalchemy.exc import SQLAlchemyError
import pandas as pd
DATABASE_URL = "cubrid+pycubrid://dba@localhost:33000/testdb"
TABLE_NAME = "cookbook_r... | cubrid-lab/cubrid-cookbook-python | fundamentals/pandas/03_clean_and_transform.py | .py | 9586d131b6637aca | 7.57 | 13 |
"""03_transactions.py — Transaction management with pycubrid.
Demonstrates:
- Manual commit/rollback
- Autocommit mode
- Savepoints (SAVEPOINT, ROLLBACK TO SAVEPOINT)
- Transaction isolation
"""
from __future__ import annotations
import pycubrid
DB_CONFIG = {
"host": "localhost",
"port": 33000,
"databas... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/03_transactions.py | .py | 9619a012ab4c84c7 | 7.57 | 13 |
"""04_prepared.py — Parameterized queries and batch operations.
Demonstrates:
- Parameterized queries (qmark style: ?)
- Preventing SQL injection
- executemany for batch inserts
- Batch operations with executemany
"""
from __future__ import annotations
import time
import pycubrid
DB_CONFIG = {
"host": "localho... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/04_prepared.py | .py | f79bfc82a280db48 | 7.57 | 13 |
"""07_merge_upsert.py - Idempotent reference sync with MERGE.
Demonstrates:
- Loading a latest external snapshot into a staging table
- MERGE INTO target USING staging (upsert by business key)
- Deactivating rows missing from the latest snapshot
If MERGE syntax fails on a specific server patch level, adapt to
INSERT ... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/07_merge_upsert.py | .py | fa9f21d361809eb9 | 7.57 | 13 |
"""08_hierarchy_connect_by.py - Tree traversal with CONNECT BY.
Demonstrates:
- Modeling a simple hierarchy with parent_id
- Traversing full tree using START WITH ... CONNECT BY
- Traversing a subtree from a selected node
"""
from __future__ import annotations
# pyright: reportAttributeAccessIssue=false, reportMissi... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/08_hierarchy_connect_by.py | .py | 3f1ed14f3ca87053 | 7.57 | 13 |
"""09_serial_order_numbers.py - Business order IDs with SERIAL.
Demonstrates:
- Creating and using SERIAL for business order numbers
- Inserting order headers and line items in one transaction
- Listing generated order numbers and totals
"""
from __future__ import annotations
# pyright: reportAttributeAccessIssue=fa... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/09_serial_order_numbers.py | .py | 1e9b073e1f2fa932 | 7.57 | 13 |
"""10_collection_columns.py - Native SET/MULTISET/LIST columns.
Demonstrates:
- Creating collection-typed columns
- Inserting collection literals
- Updating collection values
- Reading collection columns back
Collection literals use CUBRID syntax: SET{...}, MULTISET{...}, LIST{...}.
"""
from __future__ import annota... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/10_collection_columns.py | .py | ba3e32eb69f32d2d | 7.57 | 13 |
"""11_bulk_etl_pipeline.py — Chunked ETL with staging table.
Demonstrates:
- Generating source rows
- Chunked staging inserts with executemany()
- Validation and rejection workflow
- Deduplication and apply to final table
- ETL summary metrics and cleanup
Adaptation note:
- To keep behavior predictable on CUBRID 11.2... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/11_bulk_etl_pipeline.py | .py | e13d17a09920efc1 | 7.57 | 13 |
"""12_pool_retry_worker.py — Minimal connection pool and retry worker.
Demonstrates:
- Lightweight connection pool with borrow/return
- Retry wrapper with exponential backoff
- Replacing failed connections
- Background-like job processing with resilient DB access
"""
from __future__ import annotations
import datetim... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/12_pool_retry_worker.py | .py | 0b59258f7b29b815 | 7.57 | 13 |
"""13_atomic_counters.py — Atomic counters for hot-path metrics.
Demonstrates:
- Counter table keyed by metric_key + day
- Atomic increment with ON DUPLICATE KEY UPDATE
- Efficient batch event recording
- Top-N rankings query
Adaptation note:
- If ON DUPLICATE KEY UPDATE fails on your server build, switch to a
SELE... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/13_atomic_counters.py | .py | 6256a41caba0e59d | 7.57 | 13 |
"""15_cursor_memory_bound.py - Bounded memory fetching with connection fetch_size.
Demonstrates:
- Setting ``fetch_size`` at connection level to cap server fetch page size
- Measuring peak client memory with ``tracemalloc`` across fetch_size values
- How fetch_size differs from cursor.arraysize (page size vs client ba... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/15_cursor_memory_bound.py | .py | 715e4c893381c198 | 7.57 | 13 |
"""17_window_functions.py - Analytic (window) functions.
Demonstrates:
- ROW_NUMBER() / RANK() / DENSE_RANK() ranking within partitions
- LAG() to compare a row with the previous row
- Running total with SUM() OVER (... ORDER BY ...)
- Deterministic tie-breakers on ROW_NUMBER/RANK; DENSE_RANK omits one on
purpose to... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/17_window_functions.py | .py | 73e6c6e1d70bb4ea | 7.57 | 13 |
"""18_recursive_cte.py - Recursive common table expressions (WITH RECURSIVE).
Demonstrates:
- A generated number series with an anchor + recursive member
- Walking a parent/child hierarchy and building a materialized path
- How WITH RECURSIVE contrasts with START WITH ... CONNECT BY (see 08)
CUBRID supports BOTH the ... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/18_recursive_cte.py | .py | 359c4c293ac0494f | 7.57 | 13 |
"""19_pagination.py - Server-side pagination idioms in CUBRID.
Demonstrates:
- Portable LIMIT ... OFFSET paging
- CUBRID-idiomatic FOR ORDERBY_NUM() BETWEEN ... AND ... paging
- Why the two return the SAME ordered page
- A note on ROWNUM (assigned BEFORE ORDER BY, so it is not a paging tool)
Rule of thumb: always ORD... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/19_pagination.py | .py | 527dcdfa04376ba0 | 7.57 | 13 |
"""20_timezone_datetime.py - Timezone-aware datetime types.
Demonstrates:
- SET TIME ZONE to pin the session zone (makes *LTZ values deterministic)
- DATETIMETZ: stores an explicit zone, read back as a tz-aware datetime
- DATETIMELTZ: stored in UTC; pycubrid materializes native reads as UTC-aware
(+00:00) datetimes.... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/20_timezone_datetime.py | .py | 4e970b2d473e4ac5 | 7.57 | 13 |
"""21_enum_type.py - The ENUM column type.
Demonstrates:
- Declaring an ENUM column with an ordered set of allowed string values
- Ordering by an ENUM sorts by DECLARATION order, not alphabetically
- Recovering the 1-based ordinal of a value with `col + 0`
- Rejecting a value outside the declared set
The declaration ... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/21_enum_type.py | .py | 1414d5757763a4fc | 7.57 | 13 |
"""22_date_formatting.py - Formatting and parsing dates with TO_CHAR / TO_DATE.
Demonstrates:
- TO_CHAR(date, fmt) to render dates and datetimes in several layouts
- TO_DATE(str, fmt) to parse strings in one layout, then re-render in another
- TO_CHAR(number, fmt) for grouped/padded numeric formatting
- How fixed-widt... | cubrid-lab/cubrid-cookbook-python | fundamentals/pycubrid/22_date_formatting.py | .py | e99ac96ef8215e6b | 7.57 | 13 |
"""hermes-livekit — LiveKit voice gateway plugin for hermes-agent.
Registers a ``livekit`` platform via the ``hermes_agent.plugins`` entry
point. No core hermes-agent edits are required — every integration touch
point uses an existing ``register_platform()`` hook.
"""
import logging
import os
from typing import Optio... | kortexa-ai/hermes-livekit | hermes_livekit/__init__.py | .py | 6dd8c7806c3b8693 | 7.48 | 8 |
"""Session-owned client function tools for the direct Realtime transport."""
from __future__ import annotations
import asyncio
import hashlib
import json
from dataclasses import dataclass
from typing import Any, Iterable
from .tool_safety import valid_tool_name
DIRECT_TOOLSET_NAME = "realtime-client-tools"
DIRECT_... | kortexa-ai/hermes-livekit | hermes_livekit/direct_tools.py | .py | 7dbd81e26c5c9c90 | 7.48 | 8 |
"""Closed protocol contract for bounded LiveKit byte-stream tool results."""
from __future__ import annotations
import base64
import json
import math
import re
from dataclasses import dataclass
from typing import Any
REFERENCE_TYPE = "livekit-byte-stream"
REFERENCE_VERSION = 1
TOPIC_PREFIX = "hermes-tool-result/"
M... | kortexa-ai/hermes-livekit | hermes_livekit/tool_result_protocol.py | .py | 79608e8a18f419d8 | 7.48 | 8 |
"""Keep ``LiveKitAdapter`` callable the way the gateway calls the base class.
Twice now an override has drifted from ``BasePlatformAdapter`` and taken out a
whole path at runtime, each time with a ``TypeError`` raised *after* real work
had already been done:
- ``play_tts()`` did not accept ``caption``, which the auto... | kortexa-ai/hermes-livekit | tests/test_adapter_contract.py | .py | a7522dbae9f0d389 | 7.98 | 8 |
#!/usr/bin/env python3
"""Compatibility entry point for the shared image-to-editable PSD runtime."""
from __future__ import annotations
import sys
from pathlib import Path
from typing import Sequence
from image2editable.cli import main as runtime_main
from image2editable.runtime import convert as runtime_convert
d... | DSY-Xueai/image2editable | image_to_psd.py | .py | ad36a9e1ca59401a | 7.54 | 11 |
"""add_code_to_tools
Revision ID: 0a1b2c3d4e5f
Revises: 9a8b7c6d5e4f
Create Date: 2026-05-13 14:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '0a1b2c3d4e5f'
down_revision: Union[str, None] = '9a8b7c6d5e4f'
... | kainotomo/ph-agent-hub | backend/src/db/migrations/versions/0a1b2c3d4e5f_add_code_to_tools.py | .py | 9c0995db2d64032b | 7.52 | 10 |
"""add_tenant_balance
Revision ID: 1a6a9deff1b2
Revises: a3b4c5d6e7f8
Create Date: 2026-05-26 17:36:42.512436
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision: str = '1a6a9deff1b2'
down_revis... | kainotomo/ph-agent-hub | backend/src/db/migrations/versions/1a6a9deff1b2_add_tenant_balance.py | .py | add27f25488cba43 | 7.52 | 10 |
"""add_message_embeddings_and_cross_session_memory_config
Revision ID: 359185b6bb95
Revises: 852db3dd6183
Create Date: 2026-05-22 07:03:02.644429
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revis... | kainotomo/ph-agent-hub | backend/src/db/migrations/versions/359185b6bb95_add_message_embeddings_and_cross_.py | .py | 7d25c7169d406317 | 7.52 | 10 |
import httpx
from pydantic import BaseModel, Field
from typing import Literal
from .modules_endpoint import get_modules
from assessment_module_manager.app import app
from assessment_module_manager.logger import logger
from assessment_module_manager.module import Module
async def is_healthy(module: Module) -> bool:
... | ls1intum/edutelligence | athena/assessment_module_manager/assessment_module_manager/endpoints/health_endpoint.py | .py | 56f048f9b75b53c9 | 7.63 | 17 |
import json
from typing import TypeVar, Generic, Optional
import httpx
from fastapi import HTTPException
from .module import Module
from .list_modules import list_modules
from athena import ExerciseType
from assessment_module_manager import env
from assessment_module_manager.logger import logger
from pydantic import ... | ls1intum/edutelligence | athena/assessment_module_manager/assessment_module_manager/module/request_to_module.py | .py | 85f433fd7f9414b6 | 7.63 | 17 |
"""
The main app instance for your module. Try not to use the FastAPI functionality of the app instance directly.
Instead, use the decorators in the `athena` package.
The only exception is the `start` method, which is used to start the module.
"""
import uvicorn
from uvicorn.config import LOGGING_CONFIG
from fastapi im... | ls1intum/edutelligence | athena/athena/athena/app.py | .py | 562eed1b4e79efab | 7.63 | 17 |
import importlib
import os
from contextlib import contextmanager
from typing import Iterator, Optional
from sqlalchemy import create_engine
from sqlalchemy.engine import Engine
from sqlalchemy.orm import Session, declarative_base, sessionmaker
from athena import env
from athena.logger import logger
Base = declarativ... | ls1intum/edutelligence | athena/athena/athena/database.py | .py | fe9c3d7ac3b6f74e | 7.63 | 17 |
"""
Provides the experiment environment for Athena so it knows which experiment is currently running.
Note: This is mainly being used in the Playground during research and development but could also be used in production.
"""
import contextvars
from typing import Optional
from fastapi import Request
from pydantic im... | ls1intum/edutelligence | athena/athena/athena/experiment.py | .py | c0f5fba3d188b857 | 7.63 | 17 |
import hashlib
import os
import shutil
import tempfile
from pathlib import Path
from typing import Optional, cast, Dict, Any, Union
from pydantic import AnyUrl
from athena import contextvars
from athena.helpers.programming.path_utils import ensure_safe_path
import httpx
from git.repo import Repo
cache_dir = Path(tem... | ls1intum/edutelligence | athena/athena/athena/helpers/programming/code_repository.py | .py | 3679ceba9aee33ed | 7.63 | 17 |
from fastapi import FastAPI, Request, Response
from starlette.middleware.base import BaseHTTPMiddleware
from typing import Callable, Awaitable
from athena.contextvars import set_repository_authorization_secret_context_var
class RepositoryAuthorizationMiddleware(BaseHTTPMiddleware):
"""
Capture the X-Reposito... | ls1intum/edutelligence | athena/athena/athena/helpers/programming/repository_authorization_middleware.py | .py | 4766fc1d23fb53ff | 7.63 | 17 |
"""
Provides request metadata handling for Athena.
You can use this module to add metadata to HTTP responses for most endpoints (decorated with @with_meta).
Example usage:
from fastapi import FastAPI
from .metadata import MetaDataMiddleware, with_meta, emit_meta
app = FastAPI()
app.add_middleware(Met... | ls1intum/edutelligence | athena/athena/athena/metadata.py | .py | 8eb65b9e91e59ed5 | 7.63 | 17 |
from typing import cast, Optional
from athena.schemas.programming_submission import ProgrammingSubmission
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship
from athena.database import Base, get_db
from .db_programming_submission import DBProgrammingSubmission
from .db_f... | ls1intum/edutelligence | athena/athena/athena/models/db_programming_feedback.py | .py | 89eb2c449f3fa9ed | 7.63 | 17 |
"""ComfyUI node for final ledger safety, readiness, and freeze.
The node preserves the writer's accepted story. It permits only bounded,
same-story cleanup of the narrow terminal safety policy; word length, visual
vocabulary, style, craft, and quality never affect publication.
"""
from __future__ import annotations
... | jbrick2070/ComfyUI-OldTimeRadio | nodes/OTR_LedgerFreezeCascade.py | .py | 93d888208e74f1fc | 7.45 | 7 |
"""Shared lifecycle helpers for the Path-B audio sidecars (chatterbox / dia).
Centralizes the things the polish roundtable flagged across both new adapters:
* :func:`read_protocol_line` -- a bounded, Windows-safe read of one protocol line
(``select`` does not work on Windows pipes, so a daemon reader thread is used... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_audio_engines/_otr_sidecar.py | .py | 2fa3d37125c46be6 | 7.45 | 7 |
"""Audio-engine adapter base + the AUDIO-batch packer (plan piece 4).
Two things live here:
* :class:`AudioEngineAdapter` -- an OPTIONAL common base for engine adapters.
The registry duck-types against the :class:`~.registry.AudioEngine` Protocol,
so an adapter does not have to inherit from this; the existing leg... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_audio_engines/base.py | .py | 263f1b4d472d3a72 | 7.45 | 7 |
"""Bark voice adapter -- self-contained per_line (clean-break 1a).
Serves both char_voice and announcer_voice (2026-08-24) -- the same v2/*
preset mechanism either way; the caller's ``role`` (threaded onto the
adapter instance by the dispatch core) only selects which curated profile
(``char_bark_v1`` / ``announcer_bar... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_audio_engines/eng_bark.py | .py | 8105e3d87f3a1c07 | 7.45 | 7 |
"""Chatterbox voice adapter -- Path B isolated subprocess worker (opt-in, MIT).
Chatterbox (Resemble AI, MIT -> commercial-clean ENGINE) pins its own torch /
numpy that would brick the Blackwell (torch 2.10 / cu130) ComfyUI venv, so --
exactly like IndexTTS2 -- it runs in its OWN isolated venv as a supervised
subproce... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_audio_engines/eng_chatterbox.py | .py | 8dd4a18bcd7fc181 | 7.45 | 7 |
"""Sonilo cloud MUSIC adapter (cloud-audio S5, 2026-07-03).
A truly-cloud music engine (theme cues) that runs on Comfy Cloud via the built
cloud backend (``invoke_partner_node``), NOT a local model. Fail-loud, no
fallback, dropdown-is-enable.
Contract parity with the local music engines (``eng_stable_audio_3`` /
``en... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_audio_engines/eng_cloud_sonilo.py | .py | a86c32f665ef62da | 7.45 | 7 |
"""Dia voice adapter -- Path B isolated subprocess worker (opt-in, Apache-2.0).
Dia (Nari Labs, ``nari-labs/Dia-1.6B-0626``) is Apache-2.0 -> a COMMERCIAL-CLEAN
engine, which (unlike the bilibili-licensed IndexTTS2 default) is safe to ship in
Jeffrey's films. It is dialogue-native and zero-shot, so it reuses the exist... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_audio_engines/eng_dia.py | .py | 4d5d8af1736fd329 | 7.45 | 7 |
"""Google Gemini TTS BYO-key adapter.
Direct Google API lane for character and announcer voice. This is not a Comfy
Cloud Partner node and it never routes through the Partner backend. The adapter
is explicit-selection-only, fail-loud, and uses the current Gemini Interactions
REST shape.
Import-time stays light: no Go... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_audio_engines/eng_google_tts.py | .py | c54eac1108372a06 | 7.45 | 7 |
"""Kokoro announcer-voice adapter -- self-contained per_line (clean-break 1b).
interface == "per_line": the announcer node calls generate_voice per announcer
line; no delegation to a batch node. The announcer voice is ONE per episode,
chosen by a per-episode seeded pick from the curated British pool.
2026-08-05: that... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_audio_engines/eng_kokoro.py | .py | e805f019d548aede | 7.45 | 7 |
"""MusicGen theme adapter -- self-contained clip engine (clean-break 1c).
interface == "clip": the theme node (OTR_StableAudioTheme) calls generate_clip
per cue; no delegation to a batch node. MusicGen inference (transformers
MusicgenForConditionalGeneration) is lazy-loaded inside load() / generate_clip so
importing t... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_audio_engines/eng_musicgen.py | .py | 3e426f0df6e2fcf3 | 7.45 | 7 |
"""Stable Audio music adapter -- opt-in, commercial-clean.
Stability Community license (commercial use under a revenue cap). Native
ComfyUI support keeps Blackwell risk low. Opt-in behind OTR_ENABLE_STABLE_AUDIO.
``interface == "clip"``: the theme node calls ``generate_clip``.
Stable Audio is natively stereo and the ... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_audio_engines/eng_stable_audio.py | .py | 42eda1b4569a1cef | 7.45 | 7 |
"""Stable Audio 3 music adapter -- ComfyUI-NATIVE (no stable_audio_tools).
Drives ComfyUI's own audio node classes (CheckpointLoaderSimple + optional
t5gemma CLIPLoader + CLIPTextEncode + ConditioningStableAudio + EmptyLatentAudio
+ KSampler + VAEDecodeAudio) so SA3 uses ComfyUI's `comfy.model_management` --
no PyPI d... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_audio_engines/eng_stable_audio_3.py | .py | 7bbc5652f4c0b33c | 7.45 | 7 |
"""S-C C1 -- per-beat ``audio_motion_profile`` EXTRACTION (analysis only).
Computes a small, deterministic, READ-ONLY feature profile from a conditioning
WAV (a per-beat slice of the FROZEN master mix, or a per-line TTS clip). There
is NO consumer yet -- C2 (per-engine consumers + HuMo phrase-chunking) is
deferred per... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_audio_motion.py | .py | 342c7ab4f7864a4a | 7.45 | 7 |
"""Shared audio helpers for the v2 audio lane.
ComfyUI AUDIO is ``{"waveform": tensor[B, C, T], "sample_rate": int}``. Never
assume ``waveform.shape[0] == 2`` -- dim 0 is batch, dim 1 is channel. Every
engine output passes through ``canonical_audio`` then ``mono_safe`` before it
reaches SceneSequencer / EpisodeAssembl... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_audio_utils.py | .py | ce5731aab444f4b8 | 7.45 | 7 |
"""Bake-off bank-variant id helper (pure, zero-dependency leaf module).
A bake-off variant bank id is a base bank id with a trailing ``_v2`` or ``_v3``
suffix (e.g. ``shakespeare_v2``, ``science_news_v3``). Variant rows mirror their
base family and reuse the base's story_rules pack and family-keyed behaviour
(style po... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_bank_variants.py | .py | 370c104633664e1e | 7.45 | 7 |
"""nodes/_otr_brief_reader.py -- central reader for the story-brief
meta delta (Sprint 8.1).
The brief producer (`_otr_story_brief.py`) emits the eight v1 meta
keys plus the five v2 additive fields onto `meta` (decision A1, flat
additive -- see `downstream_brief_consumer_followup.md`). Every
downstream consumer that w... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_brief_reader.py | .py | bb64ed0c15e1a16a | 7.45 | 7 |
"""Repair a silent cast slot BEFORE the freeze gate has to refuse it.
THE DEFECT (PBUG-20260802-02, third manifestation, shakespeare/MARIA,
2026-08-24). A composition pass can allocate dialogue for some cast members
and not others under a tight beat budget -- the writer locks a cast (e.g.
Shakespeare's per-scene ``cas... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_cast_coverage_repair.py | .py | 22a2a352a97ec495 | 7.45 | 7 |
"""nodes/_otr_cast_env.py -- frozen env-var contract for the cast name system.
All cast knobs are environment variables; there are NO new ComfyUI widgets
(per the cast-system sprint plan, "Frozen interface contracts"). Every default
reproduces the pre-fix behavior exactly, so a run that sets none of these is
byte-iden... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_cast_env.py | .py | f5c6c2b9fa75fc7b | 7.45 | 7 |
"""nodes/_otr_cast_validator.py -- cast LLM Pass-1 referee (S7).
The LLM Pass-1 call (S6) may return ONLY a name + texture per slot. This
validator rejects anything outside that contract; on ANY rejection the caller
falls back to the deterministic pool names (which are already gender-coherent
via the S2 repair) -- no ... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_cast_validator.py | .py | 85cda2a95b926dee | 7.45 | 7 |
"""nodes/_otr_castplanner.py -- immutable CastPlanner slot schema (S4).
Python owns cast STRUCTURE; the LLM only names + textures. The CastPlanner
freezes the structural decision -- char_id / gender / age_band / voice_preset /
dramatic_role -- into an immutable slot the LLM Pass-1 call (S6) writes a name
and texture a... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_castplanner.py | .py | dc8b6d6605172b6e | 7.45 | 7 |
"""Parse a play's cast list into character records, with gender.
Why this exists
---------------
Casting currently gives Shakespeare characters a gender by DICE ROLL. Measured:
`gender_of_first_name` returns "unknown" for JULIET, ROSALIND, CELIA, TITANIA,
BEATRICE and every other name in the vendored corpus -- they ar... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_character_roster.py | .py | 2b3c1780266bc099 | 7.45 | 7 |
"""Single source of truth for the v2 audio/casting NODE registrations
(plan piece 6).
The exact ComfyUI mapping key, module path, class name, display name, and
CATEGORY for every NEW node introduced by the audio + voice-casting overhaul
live here -- in ONE place -- so the node modules, the top-level package
``__init__... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_class_registry.py | .py | 42a3dc666f74c168 | 7.45 | 7 |
"""Generic accepted-artifact authorship proof for content-owned story lanes."""
from __future__ import annotations
import hashlib
import json
from collections.abc import Mapping, Sequence
from typing import Any
SCHEMA_VERSION = 1
class ContentAuthorshipError(RuntimeError):
"""The accepted artifact no longer pro... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_content_authorship.py | .py | 7fcc1d39f914beb1 | 7.45 | 7 |
"""An AUTHORIZED rewrite between the acceptance receipt and the audit.
WHY THIS EXISTS. `_otr_content_authorship` stamps a receipt proving the ledger's
canonical text is exactly what the lane ACCEPTED, and the freeze cascade later
re-validates it by hashing the live rows. That contract was written when nothing
ran in ... | jbrick2070/ComfyUI-OldTimeRadio | nodes/_otr_content_transition.py | .py | 73b13738a9742f6d | 7.45 | 7 |
import logging
from typing import Annotated, ClassVar
from django import forms
from django.utils import timezone
from dependency_injector.wiring import Provide, inject
from common.utils.request_utils import client_ip_from_request, user_agent_from_request
from legal.exceptions import NoPolicyDocumentError
from legal.... | vintasoftware/vinta-schedule-api | accounts/base_forms.py | .py | 66e76045b5b17739 | 7.45 | 7 |
from http import HTTPStatus
from django.http import JsonResponse
from allauth.core import context
from allauth.core.exceptions import ImmediateHttpResponse
from allauth.headless.internal.restkit.response import APIResponse
class AccountError(Exception):
"""Base exception for account related errors"""
pass
... | vintasoftware/vinta-schedule-api | accounts/exceptions.py | .py | 3000c876d55c8775 | 7.45 | 7 |
"""Request/response middleware for the authentication surface."""
import json
import logging
from http import HTTPStatus
from django.contrib.auth import get_user_model
from django.http import HttpRequest, HttpResponse
from accounts.post_auth_destination import inject_post_auth_destination
logger = logging.getLogge... | vintasoftware/vinta-schedule-api | accounts/middlewares.py | .py | a6a2ab97b5506971 | 7.45 | 7 |
from django.conf import settings
from django.db import models
from common.models import BaseModel
class RefreshToken(BaseModel):
"""
Model to store refresh tokens for users.
This model is used to manage refresh tokens for user sessions.
"""
user = models.ForeignKey(
settings.AUTH_USER_MO... | vintasoftware/vinta-schedule-api | accounts/models.py | .py | a198cd814f4ef10f | 7.45 | 7 |
from typing import Any
from vintasend.services.notification_service import register_context
from users.notification_contexts import user_context
@register_context("phone_verification_context")
def phone_verification_context(
user_id: str, phone_verification_code: str, phone_number: str
) -> dict[str, Any]:
... | vintasoftware/vinta-schedule-api | accounts/notification_contexts.py | .py | 479d2345e0cc7b1f | 7.45 | 7 |
"""Where a just-authenticated user should land, resolved server-side.
The destination is read exclusively from the acting organization's stored
branding (``organizations.models.resolve_branding_for_display``) -- never from a
``next``/``callback_url`` parameter, a header, or anything else the caller
controls. That is t... | vintasoftware/vinta-schedule-api | accounts/post_auth_destination.py | .py | 0da0f0922ab26935 | 7.45 | 7 |
"""``ACCOUNT_PHONE_VERIFICATION_ENABLED`` is env-driven, default off.
Unit-level: exercises the exact ``decouple.config(...)`` expression used in
``vinta_schedule_api/settings/base.py`` directly, so it fails if the cast/
default behavior ever regresses (e.g. someone swaps ``cast=bool`` for a plain
string compare). Doe... | vintasoftware/vinta-schedule-api | accounts/tests/test_account_phone_verification_env_var.py | .py | 7628f02037f00568 | 7.95 | 7 |
"""
Integration tests: Create own org on email verification (no invite).
These tests exercise the AccountAdapter.confirm_email override, which is the
imperative provisioning hook for the email/password signup path — symmetric
with the social path (SocialAccountAdapter.save_user).
Three scenarios are covered:
1. Uninv... | vintasoftware/vinta-schedule-api | accounts/tests/test_email_confirmation_provisioning.py | .py | ee4c9b46a759e703 | 7.95 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.