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
"""Add end_position column to books table. Revision ID: 043 Revises: 042 """ from collections.abc import Sequence import sqlalchemy as sa from alembic import op revision: str = "043" down_revision: str | Sequence[str] | None = "042" branch_labels: str | Sequence[str] | None = None depends_on: str | Sequence[str] |...
Crossbill-App/crossbill-web
backend/alembic/versions/043_add_end_position_to_books.py
.py
144eb86b41b740cd
7.57
13
"""Drop cover column from books table. The cover URL was deterministic (/api/v1/books/{id}/cover) and derived from the book ID at runtime. It is no longer stored in the database. Revision ID: 046 Revises: 045 """ from collections.abc import Sequence import sqlalchemy as sa from alembic import op revision: str = "...
Crossbill-App/crossbill-web
backend/alembic/versions/046_drop_cover_column_from_books.py
.py
dc606dee0e5e306c
7.57
13
"""add questions to chapter prereading contents Revision ID: 039 Revises: 038 Create Date: 2026-03-16 """ from collections.abc import Sequence import sqlalchemy as sa from sqlalchemy.dialects import postgresql from alembic import op # revision identifiers, used by Alembic. revision: str = "047" down_revision: str...
Crossbill-App/crossbill-web
backend/alembic/versions/047_add_questions_to_chapter_prereading_contents.py
.py
5957cac4f9912ef0
7.57
13
# /// script # requires-python = ">=3.12" # /// """Validate every committed example catalog with rashid, upstream sources included. examples/catalog/ holds the canonical examples of a conformant Portolan catalog, committed in full, Parquet and COG included. This runs rashid over each of them. The data pass is left on...
portolan-sdi/portolan-spec
examples/tools/check_catalogs.py
.py
e025b83ad1bc1799
7.42
6
"""Small shared helpers, subprocess runner, checksums, and value formatting.""" from __future__ import annotations import hashlib import subprocess from pathlib import Path from typing import Any def run(cmd: list[str], **kw: Any) -> subprocess.CompletedProcess: kw.setdefault("check", True) kw.setdefault("te...
portolan-sdi/portolan-spec
examples/tools/common.py
.py
89ae70ae79e9aa94
7.42
6
"""Coordinate reference system detection and resolution. Detects the true source CRS of each geospatial source and resolves the output CRS, which preserves the source by default and is overridable per manifest or per collection. Nothing about the CRS is hardcoded in the rest of the generator. """ from __future__ impor...
portolan-sdi/portolan-spec
examples/tools/crs.py
.py
80edc1d79d0d5946
7.42
6
# /// script # requires-python = ">=3.12" # dependencies = ["pyyaml>=6.0.3"] # /// """Publish a built example catalog to the Portolan repository on Source Cooperative. examples/manifests/*.yaml each describe one whole catalog, and build.py turns a manifest into a complete catalog tree under examples/catalog/<stem>/. T...
portolan-sdi/portolan-spec
examples/tools/publish_catalogs.py
.py
249532adeb8105f3
7.42
6
# /// script # requires-python = ">=3.12" # dependencies = [ # "duckdb>=1.5.5", # "rasterio>=1.5", # "rio-cogeo>=5.3", # "numpy", # ] # /// """Standalone check for convert.to_cog on rio-cogeo. Covers the two rules formats.md raises to MUSTs on top of a valid COG, per OGC 21-026's Optimized GeoTIFF requirements...
portolan-sdi/portolan-spec
examples/tools/tests/check_cog.py
.py
22479a08e86c150d
7.92
6
# /// script # requires-python = ">=3.12" # dependencies = [ # "pyyaml>=6.0.3", # "duckdb>=1.5.5", # "jsonschema>=4.26.0", # "pyarrow>=25", # "geoparquet-io @ git+https://github.com/yharby/geoparquet-io.git@f27e53108910f19bd74a9ff4be5c7d97b104753c", # "rasterio>=1.5", # "numpy", # "Pillow>=11", # "rio...
portolan-sdi/portolan-spec
examples/tools/tests/check_compliance.py
.py
072d49c7fcf65a40
7.92
6
# /// script # requires-python = ">=3.12" # dependencies = [ # "duckdb>=1.5.5", # "pandas>=2.2", # "pyarrow>=25", # "geopandas>=1.1", # "rioxarray>=0.17", # "rasterio>=1.5", # ] # /// """Run every fenced code block in the committed catalog docs. The documentation best-practices page asks that every example...
portolan-sdi/portolan-spec
examples/tools/tests/check_docs.py
.py
999942d6d3c0142b
7.92
6
# /// script # requires-python = ">=3.12" # dependencies = [] # /// """Standalone check for fetch.fetch's caching rule. core.md requires an asset's file:size and file:checksum to be regenerated at publish time so they match the bytes actually published. A source the manifest marks `stable: false` is a live endpoint wh...
portolan-sdi/portolan-spec
examples/tools/tests/check_fetch.py
.py
914ec64af2d2376c
7.92
6
# /// script # requires-python = ">=3.12" # dependencies = [ # "duckdb>=1.5.5", # ] # /// """Standalone check for the MapLibre styles author_styles writes. formats.md requires a PMTiles style to be "a complete, self-contained JSON loadable directly by MapLibre GL JS", and states the convention that `sources.data.url...
portolan-sdi/portolan-spec
examples/tools/tests/check_styles.py
.py
6a398eb22dd65918
7.92
6
# /// script # requires-python = ">=3.12" # dependencies = [ # "duckdb>=1.5.5", # "rasterio>=1.5", # "numpy", # "Pillow>=11", # ] # /// """Standalone check for the pure-Python vector and raster thumbnail path. Seeds the tile cache so no network is hit, builds tiny sources, and asserts each thumbnail PNG exists...
portolan-sdi/portolan-spec
examples/tools/tests/check_thumbnails.py
.py
315fe07e72c5f692
7.92
6
# /// script # requires-python = ">=3.12" # dependencies = [ # "numpy", # "Pillow>=11", # ] # /// """Standalone check for tiles.fetch_basemap. Exercises the pure zoom/tile math and mosaics a pre-seeded tile cache with no network, so the test needs neither GDAL nor internet. Run: uv run examples/tools/tests/check_t...
portolan-sdi/portolan-spec
examples/tools/tests/check_tiles.py
.py
be35fee190ee4e19
7.92
6
# /// script # requires-python = ">=3.12" # dependencies = [ # "jsonschema>=4.26.0", # "rashid[data]>=0.1.8,<0.2.0", # ] # /// """Standalone checks for the rashid validation adapter. Run: uv run examples/tools/tests/check_validate.py """ import json import sys from pathlib import Path sys.path.insert(0, str(P...
portolan-sdi/portolan-spec
examples/tools/tests/check_validate.py
.py
666dc6ff7e11a410
7.92
6
# /// script # requires-python = ">=3.12" # /// """Run every generator check in this directory and report them together. Each check_*.py is its own uv entrypoint with its own PEP 723 dependencies, so each runs in its own resolved environment. This runner shells out to `uv run` per script rather than importing them, wh...
portolan-sdi/portolan-spec
examples/tools/tests/run_all.py
.py
aaf13b494263c8a4
7.92
6
"""Thumbnail rendering. Renders previews in Web Mercator at the data's true aspect ratio over a CARTO light XYZ tile basemap, painting features from the collection style block so the preview mirrors the map. """ from __future__ import annotations import json import math from pathlib import Path import duckdb import ...
portolan-sdi/portolan-spec
examples/tools/thumbnails.py
.py
c1b7803caafafd61
7.42
6
"""XYZ basemap tiles for thumbnails. Fetches Web Mercator XYZ raster tiles over HTTP, caches them under `.cache/tiles`, and mosaics the covering tiles into a numpy RGB array cropped and resampled to a framed Mercator extent. Replaces the GDAL WMS descriptor the thumbnail path used to hand gdalwarp. """ from __future__...
portolan-sdi/portolan-spec
examples/tools/tiles.py
.py
f933e7f184d06db9
7.42
6
"""Validate a built Portolan catalog with rashid, the canonical validator. rashid defines Portolan conformance. This module is a thin adapter. It runs rashid's metadata, structural, schema, and data passes over a built catalog, feeds the schema pass the repo's working-copy schema under stac/, restricts the data pass t...
portolan-sdi/portolan-spec
examples/tools/validate.py
.py
4102cf31985f4398
7.42
6
# /// script # requires-python = ">=3.12" # dependencies = ["pyyaml>=6"] # /// """Verify requirements.yaml and the spec prose agree, both directions. The manifest (specs/portolan/requirements.yaml) assigns a stable ID to every normative statement in the spec. Each entry anchors its ID to the exact sentence it governs,...
portolan-sdi/portolan-spec
specs/tools/check_requirements.py
.py
7c29251ec83c642c
7.92
6
#!/usr/bin/env python3 """ Validate a skill or subagent before you open a PR. Mirrors the repo CI lint (.github/workflows/team-context-lint.yml) AND the Agent Skills framework frontmatter rules, so failures show up here instead of on the PR. stdlib only, no dependencies. Usage: python3 validate_skill.py <path> ...
Hamosian/marketing-brain-starter
.claude/skills/agent-builder/scripts/validate_skill.py
.py
08bac99a0c92b1fd
7.45
7
#!/usr/bin/env python3 """Deterministic tier of the skill-routing eval suite. The repo already lints *structure* (the Team Context Lint workflow) and audits *staleness* (`/health-check`). Neither one tests *behaviour*: with skills routed purely on their frontmatter `description`, the failure that actually bites is a n...
Hamosian/marketing-brain-starter
scripts/eval_routing.py
.py
7fd7f1baaedcee78
7.45
7
"""Provider-failure alerting. An upstream failure — our Deepgram key revoked, a vendor account out of credits, a provider outage — must reach a human, not just the logs. When Sentry is configured, every provider failure becomes an issue fingerprinted per (provider, code): one broken key groups into ONE alert that emai...
speech-router/speechrouter
gateway/speechrouter_gateway/alerting.py
.py
95d2e4512fe594fd
7.52
10
"""Deepgram-compatible wire mode. Point an unmodified official Deepgram SDK at this gateway and it works — against ANY provider, with mid-stream failover. The dialect is selected by the auth scheme Deepgram SDKs use (`Authorization: Token <key>` header, or the browser `['token', <key>]` WebSocket subprotocol); native ...
speech-router/speechrouter
gateway/speechrouter_gateway/api/dg_compat.py
.py
6a46cebfc81340f9
7.52
10
"""Session audio ring buffer. Single source of audio truth for a streaming session: the client reader appends, the provider feeder iterates by index. Failover replays by starting a new iteration at the oldest retained chunk — the buffer keeps the last `max_seconds` of audio, so a mid-stream provider switch can re-tran...
speech-router/speechrouter
gateway/speechrouter_gateway/audio/ring.py
.py
1ab3d9f7485a1ed7
7.52
10
"""Optional audio-persistence hook. Off by default everywhere, including the hosted api.speechrouter.ai — the gateway's core promise is that audio passes straight through to the provider and nothing else ever sees it. A sink is how a self-hoster who genuinely needs a copy (compliance, QA review, dispute resolution) op...
speech-router/speechrouter
gateway/speechrouter_gateway/audio/sink.py
.py
6c4f06e7e0eb3e25
7.52
10
"""API-key verification. The hot path calls lookup() once per connection.""" import hashlib from abc import ABC, abstractmethod from dataclasses import dataclass, field from ..config import KeyStoreKind, Settings from ..logging import logger @dataclass(frozen=True) class KeyRecord: key_id: str # stable identif...
speech-router/speechrouter
gateway/speechrouter_gateway/auth/keystore.py
.py
7308836ac2f5b775
7.52
10
"""Short-lived tokens for client-side use. API keys must never ship to a browser or mobile app. Instead, the customer's backend calls POST /v1/tokens with its real key and hands the resulting `st_...` token to the client. The token authenticates exactly like a key (same query param / header), inherits the parent key's...
speech-router/speechrouter
gateway/speechrouter_gateway/auth/tokens.py
.py
6fb6a7a453a36d85
7.52
10
"""Gateway settings. Every self-host/cloud difference is an env var read here.""" from enum import StrEnum from functools import lru_cache from pydantic_settings import BaseSettings, SettingsConfigDict class KeyStoreKind(StrEnum): none = "none" # dev only: auth disabled, logs a loud warning local = "local"...
speech-router/speechrouter
gateway/speechrouter_gateway/config.py
.py
a128ed00dd61bdd7
7.52
10
"""Usage events. Fire-and-forget from the hot path; must never add stream latency.""" import time from abc import ABC, abstractmethod from dataclasses import asdict, dataclass, field from ..config import Settings, UsageEmitterKind from ..logging import logger @dataclass(frozen=True) class UsageEvent: session_id...
speech-router/speechrouter
gateway/speechrouter_gateway/metering/emitter.py
.py
42458da89150bfdf
7.52
10
"""Cloud usage emitter: fire-and-forget XADD onto the usage stream. The cloud app's Solid Queue consumer reads this stream with a consumer group (at-least-once) and lands idempotent usage_events + ledger rows. A metering outage must never touch a live stream, so every failure is swallowed into a log line. """ import ...
speech-router/speechrouter
gateway/speechrouter_gateway/metering/redis_emitter.py
.py
cec3cf836eb59a26
7.52
10
# Derived from Amazon sample code. Copyright Amazon.com, Inc. or affiliates. # SPDX-License-Identifier: MIT-0 """AWS event-stream binary framing (prelude + headers + payload + CRC32s). Wire layout: 4B BE total length | 4B BE headers length | 4B prelude CRC32 | headers | payload | 4B message CRC32. Header: 1B name-len,...
speech-router/speechrouter
gateway/speechrouter_gateway/providers/aws/eventstream.py
.py
6c1edbeabc9a5ed5
7.52
10
# Derived from Amazon sample code. Copyright Amazon.com, Inc. or affiliates. # SPDX-License-Identifier: MIT-0 """SigV4 presigned URL for the Transcribe streaming WebSocket. Canonical querystring params MUST be alphabetically ordered — arbitrary passthrough params would break the signature, which is why the adapter doe...
speech-router/speechrouter
gateway/speechrouter_gateway/providers/aws/signer.py
.py
ac928bb32c4481cc
7.52
10
"""Provider plugin contract. Everything outside providers/ knows only these classes. Every provider quirk — Deepgram's speech_final vs is_final, Soniox's token algebra, AssemblyAI's turn supersession, Speechmatics' ack-based backpressure — is absorbed inside an adapter and comes out as normalized protocol events. Int...
speech-router/speechrouter
gateway/speechrouter_gateway/providers/base.py
.py
e039be58985d64e1
7.52
10
"""Deepgram streaming STT adapter (raw WebSocket, /v1/listen). Protocol facts (docs/providers/deepgram.md, verified 2026-07-27): - Auth header scheme is `Token`, not Bearer. - Control JSON must go as TEXT frames; binary JSON is treated as audio. - KeepAlive every 3-5s of send-silence or the server closes 1011/NET-0001...
speech-router/speechrouter
gateway/speechrouter_gateway/providers/deepgram/adapter.py
.py
bad5d9f4c546d868
7.52
10
from __future__ import annotations import logging import sys def get_log_level_func(value_to_log: int): def func(self, message: str, *args, **kws) -> None: if self.isEnabledFor(value_to_log): self._log(value_to_log, message, args, **kws) return func # Additional levels inspired by verb...
ionworks/ionworksdata
ionworksdata/logger.py
.py
ec77b48565e73ba7
7.54
11
"""Utility functions for reading cycler data files.""" from __future__ import annotations from contextlib import contextmanager from pathlib import Path import sys import polars as pl class _FilterStderr: """Filter stderr to suppress pandas dtype warnings while allowing other output.""" def __init__(self)...
ionworks/ionworksdata
ionworksdata/read/_utils.py
.py
696182fc7aebef43
7.54
11
"""Reader for BaSyTec battery cycler CSV exports. BaSyTec cyclers (CTS, X50) are commonly used in European academic battery labs. The CSV format has no preamble — column names on the first line, data rows below. File format ----------- Columns: ``run_time`` (HH:MM:SS.sss, hours may exceed 24), ``c_vol`` (V), ``c_cur`...
ionworks/ionworksdata
ionworksdata/read/basytec.py
.py
9f5f297376098c4e
7.54
11
"""BDF (Battery Data Format) reader. Reads files conforming to the Battery Data Alliance BDF spec (https://battery-data-alliance.github.io/battery-data-format/) and returns them in the standard ionworksdata time-series format. """ from __future__ import annotations from pathlib import Path from typing import Any, Li...
ionworks/ionworksdata
ionworksdata/read/bdf.py
.py
63b66c644c300eaa
7.54
11
from __future__ import annotations from datetime import datetime from pathlib import Path import re from typing import Any import iwutil import polars as pl import pytz import ionworksdata as iwdata from .read import BaseReader class Biologic(BaseReader): """ Reader for Biologic files (.mpt and .txt forma...
ionworks/ionworksdata
ionworksdata/read/biologic.py
.py
102b8dd89a78bbbe
7.54
11
"""Automatic reader detection based on file content.""" from __future__ import annotations import gzip from pathlib import Path import fastexcel import polars as pl from ._utils import ( is_maccor_text_extension, read_excel_and_get_column_names, suppress_excel_dtype_warnings, ) # Maccor signature colum...
ionworks/ionworksdata
ionworksdata/read/detect.py
.py
ccf9806081ae798c
7.54
11
"""Reader for Gamry EIS data files (.dta and .csv with ZCURVE tables).""" from __future__ import annotations from datetime import datetime from pathlib import Path from typing import Any, cast import iwutil # type: ignore[reportMissingTypeStubs] import polars as pl import pytz # type: ignore[reportMissingTypeStubs...
ionworks/ionworksdata
ionworksdata/read/gamry.py
.py
3eac1e41f6daf33c
7.54
11
from __future__ import annotations from datetime import datetime from io import BytesIO, StringIO from pathlib import Path import re from typing import Any import fastexcel import iwutil import polars as pl import ionworksdata as iwdata from .read import BaseReader class Neware(BaseReader): name: str = "Newar...
ionworks/ionworksdata
ionworksdata/read/neware.py
.py
f1a70510291eac8d
7.54
11
# pyright: reportMissingTypeStubs=false from datetime import datetime from pathlib import Path from typing import Any, cast import iwutil # type: ignore[reportMissingTypeStubs] import polars as pl import pytz # type: ignore[reportMissingTypeStubs] import ionworksdata as iwdata from .read import BaseReader class ...
ionworks/ionworksdata
ionworksdata/read/novonix.py
.py
681bbd0e93fef2ed
7.54
11
from __future__ import annotations from pathlib import Path from typing import Any import warnings import iwutil import polars as pl from .csv import ( build_columns_keep, detect_canonical, synthesize_current_a_from_ma, ) from .read import BaseReader class Parquet(BaseReader): name: str = "parquet"...
ionworks/ionworksdata
ionworksdata/read/parquet.py
.py
d76689c380ac5382
7.54
11
from __future__ import annotations import csv as csv_py from datetime import datetime from pathlib import Path from typing import Any import iwutil import polars as pl import pytz import ionworksdata as iwdata from .read import BaseReader def _try_int_or_nan(x: str) -> int | None: try: return int(x) ...
ionworks/ionworksdata
ionworksdata/read/repower.py
.py
60fc2f98cd5a1e1f
7.54
11
""" Settings module for ionworksdata. This module provides configurable settings for various tolerance parameters used throughout the ionworksdata package. Users can modify these settings to adjust the behavior of algorithms and analysis functions. """ from __future__ import annotations from typing import Any clas...
ionworks/ionworksdata
ionworksdata/settings.py
.py
e08ba3e4a62f21e8
7.54
11
from __future__ import annotations from datetime import UTC, datetime, timedelta import warnings import numpy as np import polars as pl def get_current_and_capacity_units(options: dict | None) -> tuple[str, str]: options = options or {} current_format = options.get("current units", "total") if current_f...
ionworks/ionworksdata
ionworksdata/util.py
.py
b909656eab5eca16
7.54
11
#!/usr/bin/env python """ Test script to demonstrate and verify the conversion from old to new format. Creates sample data in old format, converts it, and verifies the results. """ from pathlib import Path import sys import polars as pl # Add parent to path to import conversion script sys.path.insert(0, str(Path(__...
ionworks/ionworksdata
scripts/test_conversion.py
.py
9f82ca8e93076653
8.04
11
import json import os import time import threading from datetime import datetime, timezone from config import Config MODELS_CONFIG = [] models_env = Config.GEMINI_MODELS # Support multiline format with newlines or single-line with commas raw_lines = models_env.replace(',', '\n').split('\n') for line in raw_lines: ...
faithsaly5-stack/GhostGram
api_tracker.py
.py
1fb0cf2ccd26ac77
7.57
13
import os import json import asyncio import random from config import Config class AssistantManager: def __init__(self, state_file=Config.ASSISTANT_STATE_FILE): self.state_file = state_file self.dm_enabled = False # By default, Assistant mode is OFF self.active_chats = set() # Speci...
faithsaly5-stack/GhostGram
assistant_manager.py
.py
a15f3e44ff714990
7.57
13
import os import re import html import time import asyncio import threading from google import genai from google.genai import types from config import Config from text import Text from api_tracker import api_tracker from text_processing import clean_outbound_text class GeminiEngine: def __init__(self): sel...
faithsaly5-stack/GhostGram
gemini_engine.py
.py
8b521e144221ba70
7.57
13
import os import json import asyncio from datetime import datetime, timezone from config import Config from text import Text class MemoryManager: def __init__(self, state_file=Config.MEMORY_STATE_FILE): self.state_file = state_file self.reset_cutoffs = {} # chat_id -> timestamp (float) ...
faithsaly5-stack/GhostGram
memory_manager.py
.py
bb3b783c12b9802f
7.57
13
import os import json import asyncio import random from config import Config class PalManager: def __init__(self, state_file=Config.PAL_STATE_FILE): self.state_file = state_file self.active_chats = {} # dict: chat_id -> mode ("normal" or "lust") self.auto_engage_chats = {} # dict: chat_id -...
faithsaly5-stack/GhostGram
pal_manager.py
.py
15c6f48a410fcc59
7.57
13
import os import glob from config import Config class PersonaManager: def __init__(self, dir_path="personas"): self.dir_path = dir_path self.personas = {} self.load_personas() def load_personas(self): """Loads personas from the .txt files in the personas directory.""" i...
faithsaly5-stack/GhostGram
persona_manager.py
.py
509f01cac9f18c59
7.57
13
import asyncio import random from config import Config def calculate_human_typing_delay(text: str) -> float: """ Calculates a human-like, proportional typing duration based on message length, punctuation pauses, and natural variance. """ if not text: return 1.2 text = text.strip() ...
faithsaly5-stack/GhostGram
typing_helper.py
.py
3e8a7a91f67d6ad5
7.57
13
#!/usr/bin/env python3 """Fail if the shared ruff/pyright config has drifted between this repo's Python projects. The engine at the root and the validator beside it carry the same lint and type-check block, copied verbatim, because neither ruff's nor pyright's pyproject config can be inherited from a file outside the ...
decoderesearch/interp-engine
.github/scripts/check_lint_config_parity.py
.py
30e84aa1be83fdb8
7.54
11
"""What a directory of JSON cells says, shared by everything that renders them. ``report_bench`` renders these into ``results-latest.md``; ``publish`` renders the same readings into the root README's throughput tables and the visualizer's card. The three views must agree about which cell is which, about row order, and...
decoderesearch/interp-engine
benchmarks/cells.py
.py
0ef340bcc4c39394
7.54
11
"""The environment stamp and the timing primitives. Split out from the workloads because both need care that is unrelated to what is being timed. """ from __future__ import annotations import os import platform import subprocess import time from dataclasses import dataclass, field import torch GIB = float(1 << 30)...
decoderesearch/interp-engine
benchmarks/probe.py
.py
3c7a1fa0d54f11e0
7.54
11
"""Drive the async model surface from synchronous code. :class:`LoopRunner` owns one event loop on one daemon thread and submits coroutines to it, which is what lets the sync free functions (``run_with_cache``, ``steer``, ``generate_stream``) serve a backend whose only surface is ``async``. A long-lived loop rather t...
decoderesearch/interp-engine
interp_engine/_loop.py
.py
b35dcd8e4f6c8c04
7.54
11
"""The canonical capture address, and the one string form it round-trips through. An address says *which tensor*, in enough coordinates to name it unambiguously. It replaces ``Point = tuple[str, int]``, which conflated the tensor with the invocation and could not be extended without every consumer silently truncating ...
decoderesearch/interp-engine
interp_engine/address.py
.py
9328e3bde87136af
7.54
11
"""Which config fields the off-kernel attention recompute honors -- and a tripwire for the rest. Everywhere the engine calls a real module, architecture quirks are free: ``transformers`` applies them inside ``forward()`` and we never have to know they exist. The exception is the vLLM backend's attention path, where th...
decoderesearch/interp-engine
interp_engine/attn_config.py
.py
50e21a1614b8229b
7.54
11
"""Pre-softmax attention scores (TransformerLens' ``blocks.N.attn.hook_attn_scores``). The scores are the one attention quantity with no module boundary anywhere: ``transformers`` forms them inside a plain function, softmaxes them, and returns only the probabilities. HF's own ``output_attentions`` is a forward hook on...
decoderesearch/interp-engine
interp_engine/attn_scores.py
.py
17bb2a9136607404
7.54
11
"""Whether gradients are available, per backend and (on vLLM) per layer. Two rules this module exists to enforce. **Gradient support never gates loading.** Someone moving off vLLM loads successfully on any kernel, any quantization scheme, any cudagraph mode, and finds out about gradients only if they ask for them. So...
decoderesearch/interp-engine
interp_engine/autograd_support.py
.py
65e935cded1c544b
7.54
11
"""Turn a generated completion back into chat messages, without re-parsing the prompt. A chat response is ``prompt messages + what the model just generated``. The prompt half never needs parsing: whoever rendered the prompt still holds the structured messages it came from. Only the generation has to be recovered, and ...
decoderesearch/interp-engine
interp_engine/chat_compose.py
.py
40a0de03af49650f
7.54
11
"""Startup check for the CUDA driver / PyTorch build pair. A driver older than the CUDA version torch was built against fails inside ``torch.cuda._lazy_init``, ten frames below anything in this repo, on whichever call happens to touch the GPU first. The message it prints ("found version 12080") names neither the torch...
decoderesearch/interp-engine
interp_engine/cuda_preflight.py
.py
56c90c7831a2d8eb
7.54
11
"""Logit + Jacobian-lens read-out by calling the model's real final norm + lm_head. Guiding rule: **call the real HF module** (``final_norm``, ``lm_head``) rather than reconstruct the math, so RMSNorm offset / weight tying / dtype are all handled for free. Only the Gemma-style final-logit softcap is applied explicitly...
decoderesearch/interp-engine
interp_engine/lens.py
.py
e05ec3d0f26db1e2
7.54
11
"""``load_model``: the single documented entry point for getting a model. Picks a backend, constructs it, and hands back something you can capture from, steer, and generate with. Callers who want a specific backend can still construct ``EagerModel`` or ``VLLMModel`` directly -- this only removes the need to *decide*. ...
decoderesearch/interp-engine
interp_engine/load.py
.py
62508fea3f800388
7.54
11
"""Rebuilding the routing decision where no module boundary carries it. The MoE routing points are read off the router module wherever one runs, and that is still the rule -- see :mod:`interp_engine.points`. This module is the exception it makes room for: transformers' MXFP4 path for gpt-oss replaces the sparse block'...
decoderesearch/interp-engine
interp_engine/moe_routing.py
.py
72e7fa074800edbf
7.54
11
"""Give a notebook kernel's stdout the file descriptor vLLM's engine start needs. vLLM silences C-level output around ``torch.distributed.new_group`` by dup'ing over a descriptor (``suppress_stdout`` in ``vllm/utils/system_utils.py``), and its EngineCore child is forked, so the child inherits whichever ``sys.stdout`` ...
decoderesearch/interp-engine
interp_engine/notebook_stdout.py
.py
7cb0d1fdbd5f302c
7.54
11
"""Backend-agnostic steering specs (replaces chatspace/steerllm's core.specs). Mirrors the small spec surface the inference endpoints build (AddSpec / ProjectionCapSpec / LayerSteeringSpec / SteeringSpec) so they can import from the engine instead of the vendored steerllm, and provides a converter to the flat worker-s...
decoderesearch/interp-engine
interp_engine/steer_specs.py
.py
8368ac9da43abc5c
8.04
11
"""Building the PyTorch forward hooks that write into a capture store. The plain, request-agnostic factories, shared by the single-request path in :mod:`~interp_engine.vllm_capture.capture` and the attention capture in :mod:`~interp_engine.vllm_capture.attn`. The per-request demux builds its own combined hooks (steeri...
decoderesearch/interp-engine
interp_engine/vllm_capture/_hooks.py
.py
81660f6f332909ca
7.54
11
"""Single-request capture: global hooks, one forward at a time. The simple path, and the shape the tier-1 ``worker_extension_cls`` plugin exposes to users driving their own ``vllm.LLM``; nothing inside the engine drives it. :class:`VLLMModel` uses the per-request demux in :mod:`~interp_engine.vllm_capture.requests` in...
decoderesearch/interp-engine
interp_engine/vllm_capture/capture.py
.py
b3c7d099bfa4cf86
7.54
11
"""Which CUDA-graph path vLLM chose, for the two decisions that depend on the answer. The rest of this package assumes ``enforce_eager=True``, because a replayed CUDA graph does not re-execute the Python ``forward`` a ``register_forward_hook`` lives on. vLLM 0.26 complicates that assumption without lifting it, in a wa...
decoderesearch/interp-engine
interp_engine/vllm_capture/graphs.py
.py
5e21920e399520b4
7.54
11
""" Sandbox Manager for Hosted Agent Infrastructure. Use when: building background coding agents that need sandboxed execution environments with pre-built images, warm pools, and session snapshots. This module provides composable building blocks for sandbox lifecycle management. Each class handles one concern (image ...
docxology/template
.agents/skills/hosted-agents/scripts/sandbox_manager.py
.py
843b07af22f7ce53
7.65
19
"""Load persisted harness run state from a workspace directory.""" from __future__ import annotations import json from pathlib import Path def load_benchmark(workspace: Path) -> dict: """Read benchmark.json from a harness workspace.""" benchmark_path = workspace / "benchmark.json" if not benchmark_path....
docxology/template
docs/prompts/_skill-eval/scripts/skill_eval/workspace.py
.py
504dc47b921b96ea
7.65
19
"""Infrastructure layer - Modular build, validation, and development tools. This package contains reusable infrastructure modules for building, validating, and managing research projects. Organized by functionality into submodules. Modules: autoresearch: Deterministic research planning/readiness controls; see aut...
docxology/template
infrastructure/__init__.py
.py
dae93f8b71bebe46
7.65
19
"""Metric-unit inference and grading helpers for autoresearch benchmarks.""" from __future__ import annotations import math import re from collections.abc import Sequence from statistics import median _METRIC_LINE_RE = re.compile( r"^METRIC\s+(?P<name>[A-Za-z_][A-Za-z0-9_.:-]*)=(?P<value>[+-]?(?:\d+(?:\.\d*)?|\....
docxology/template
infrastructure/autoresearch/metrics.py
.py
4326517f3547a863
7.65
19
"""Public dataclasses for deterministic AutoResearch readiness checks.""" from __future__ import annotations from dataclasses import asdict, dataclass from pathlib import Path from typing import Any DEFAULT_QUALITY_CHECKS = ( "domain_profile", "experiment_plan", "pipeline_contracts", "evidence_regis...
docxology/template
infrastructure/autoresearch/models.py
.py
478fa28da94b9998
7.65
19
"""Deterministic AutoResearch multi-phase orchestration engine. Provides structured execution across AutoResearch phases: 1. Intrinsic phase validation (domain, plan, pipeline, scripts) 2. Candidate budget evaluation (readiness-only; no candidate execution) 3. Extrinsic readiness verification (evidence, manifests, rev...
docxology/template
infrastructure/autoresearch/orchestrator.py
.py
a800b0dad4d5e632
7.65
19
"""Reusable rubric scoring for template benchmark checks.""" from __future__ import annotations import math from dataclasses import dataclass, field from typing import Any, Mapping @dataclass(frozen=True) class RubricDimension: """One weighted benchmark dimension.""" name: str weight: float = 1.0 @da...
docxology/template
infrastructure/benchmark/rubrics.py
.py
11ac781f8caa6ba9
7.65
19
"""Lightweight compatibility exports for core infrastructure utilities. New code should import leaf modules directly. Package-level conveniences are resolved lazily so importing an unrelated leaf such as ``pipeline.types`` does not initialize performance or scientific dependencies. """ from __future__ import annotat...
docxology/template
infrastructure/core/__init__.py
.py
507a031677d13019
7.65
19
"""Independent POSIX guardian for token-bound subprocess cleanup. The bounded executor normally waits for a direct child and then removes any detached descendants that inherited the run token. A heavily loaded caller can be descheduled after the direct child exits, however, which leaves a detached writer time to act ...
docxology/template
infrastructure/core/_bounded_run_guardian.py
.py
3d71ef56f4966cec
7.65
19
from deskit.base.base import BaseRouter from deskit.base.predictbase import PredictBase import numpy as np class KNNBase(PredictBase, BaseRouter): """ Base for KNN-based DES algorithms. Inheriting PredictBase gives every subclass the public predict() and predict_weights() API automatically. Subcl...
TikaaVo/deskit
src/deskit/base/knnbase.py
.py
047f922fa088c1ab
7.48
8
""" DEWS-I: K-Nearest Neighbors with Distance-Weighted Softmax — Inverse-weighted. """ from deskit.base.knnbase import KNNBase from deskit._config import make_finder, resolve_metric, resolve_norm, prep_fit_inputs import numpy as np class DEWSI(KNNBase): """ DEWS-I: K-Nearest Neighbors with Distance-Weighted S...
TikaaVo/deskit
src/deskit/des/dewsi.py
.py
690d286068041dc4
7.48
8
""" DEWS-IV: Distance-weighted Ensemble with Softmax — Inverse-distance + Variance-penalised. """ from deskit.base.knnbase import KNNBase from deskit._config import make_finder, resolve_metric, resolve_norm, prep_fit_inputs import numpy as np _SIGNED_METRICS = {'mae', 'mse'} def _signed_residual(y_true, y_pred): ...
TikaaVo/deskit
src/deskit/des/dewsiv.py
.py
92aac462e214afef
7.48
8
""" DEWS-U: K-Nearest Neighbors with Distance-Weighted Softmax. """ from deskit.base.knnbase import KNNBase from deskit._config import make_finder, resolve_metric, resolve_norm, prep_fit_inputs import numpy as np class DEWSU(KNNBase): """ DEWS-U: K-Nearest Neighbors with Distance-Weighted Softmax. Parame...
TikaaVo/deskit
src/deskit/des/dewsu.py
.py
cf047a709818f8ac
7.48
8
""" DEWS-V: Distance-weighted Ensemble with Softmax — Variance-penalised. """ from deskit.base.knnbase import KNNBase from deskit._config import make_finder, resolve_metric, resolve_norm, prep_fit_inputs import numpy as np _SIGNED_METRICS = {'mae', 'mse'} def _signed_residual(y_true, y_pred): return float(y_tru...
TikaaVo/deskit
src/deskit/des/dewsv.py
.py
09d4a91114551106
7.48
8
""" KNORA-U: K-Nearest Oracles — Union. """ from deskit.base.knnbase import KNNBase from deskit._config import make_finder, resolve_metric, resolve_norm, prep_fit_inputs import numpy as np class KNORAU(KNNBase): """ KNORA-U: K-Nearest Oracles — Union. Parameters ---------- task : str 'cla...
TikaaVo/deskit
src/deskit/des/knorau.py
.py
6a0465a8756c8404
7.48
8
""" OLA: Overall Local Accuracy. """ from deskit.base.knnbase import KNNBase from deskit._config import make_finder, resolve_metric, prep_fit_inputs import numpy as np class OLA(KNNBase): """ OLA: Overall Local Accuracy. Parameters ---------- task : str 'classification' or 'regression'. ...
TikaaVo/deskit
src/deskit/des/ola.py
.py
0de759163c92cf2f
7.48
8
""" Normalization functions for Dynamic Ensemble Selection. All functions operate row-wise: each row corresponds to a query instance, and columns are the base models. They return a matrix of the same shape, with values in a suitable range (usually [0,1]) and "higher = better". Built‑in options: 'minmax' : class...
TikaaVo/deskit
src/deskit/norms.py
.py
fef1749bbbf1ad97
7.48
8
""" DynamicRouter — string-based factory for programmatic algorithm selection. Use DynamicRouter when you need to choose an algorithm via a string at runtime. """ from deskit.des.dewsu import DEWSU from deskit.des.ola import OLA from deskit.des.knorau import KNORAU from deskit.des.knorae import KNORAE from ...
TikaaVo/deskit
src/deskit/router.py
.py
d50b48d02c115991
7.48
8
# SPDX-FileCopyrightText: Copyright (C) 2025-2026, Antoine Basset # SPDX-PackageSourceInfo: https://github.com/kabasset/azulero # SPDX-License-Identifier: Apache-2.0 from astropy.wcs import WCS from astropy.coordinates import Angle, SkyCoord import numpy as np from pathlib import Path from azulero import retrieve, pr...
kabasset/azulero
src/azulero/api.py
.py
2d2dae9bfdc64012
7.48
8
# SPDX-FileCopyrightText: Copyright (C) 2025-2026, Antoine Basset # SPDX-PackageSourceInfo: https://github.com/kabasset/azulero # SPDX-License-Identifier: Apache-2.0 from astropy.io import fits from astropy.wcs import WCS import cv2 import json import numpy as np from pathlib import Path import tifffile import yaml f...
kabasset/azulero
src/azulero/image/io.py
.py
7a687450caa831df
7.48
8
# SPDX-FileCopyrightText: Copyright (C) 2025-2026, Antoine Basset # SPDX-PackageSourceInfo: https://github.com/kabasset/azulero # SPDX-License-Identifier: Apache-2.0 import enum import numpy as np from skimage.restoration import inpaint as skinpaint from skimage.segmentation import clear_border as skclear_border from ...
kabasset/azulero
src/azulero/image/mask.py
.py
5919ae8f87dc154a
7.48
8
# SPDX-FileCopyrightText: Copyright (C) 2025-2026, Antoine Basset # SPDX-PackageSourceInfo: https://github.com/kabasset/azulero # SPDX-License-Identifier: Apache-2.0 import numpy as np import cv2 from scipy.spatial.transform import Rotation class Projection: """ Equirectangular to planar projection, adapted ...
kabasset/azulero
src/azulero/projections/equirectangular.py
.py
ab3f1c14e935aa2c
7.48
8
# SPDX-FileCopyrightText: Copyright (C) 2025-2026, Antoine Basset # SPDX-PackageSourceInfo: https://github.com/kabasset/azulero # SPDX-License-Identifier: Apache-2.0 import numpy as np import cv2 from scipy.spatial.transform import Rotation from astropy.coordinates import SkyCoord, Angle from astropy.wcs import WCS f...
kabasset/azulero
src/azulero/projections/wcs.py
.py
083e5eca99511960
7.48
8
# SPDX-FileCopyrightText: Copyright (C) 2025-2026, Antoine Basset # SPDX-PackageSourceInfo: https://github.com/kabasset/azulero # SPDX-License-Identifier: Apache-2.0 from pathlib import Path from astropy.coordinates import Angle, SkyCoord from astropy.io import fits from astropy.nddata import Cutout2D from astropy.wcs...
kabasset/azulero
src/azulero/providers/cutout.py
.py
876caad9de32a280
7.48
8
# SPDX-FileCopyrightText: Copyright (C) 2025-2026, Antoine Basset # SPDX-PackageSourceInfo: https://github.com/kabasset/azulero # SPDX-License-Identifier: Apache-2.0 from astropy.coordinates import SkyCoord import csv import gzip from io import BytesIO, StringIO from pathlib import Path import requests from azulero.p...
kabasset/azulero
src/azulero/providers/dss.py
.py
5c3915333ad24f70
7.48
8
# SPDX-FileCopyrightText: Copyright (C) 2025-2026, Antoine Basset # SPDX-PackageSourceInfo: https://github.com/kabasset/azulero # SPDX-License-Identifier: Apache-2.0 from astropy.io import fits from astropy.coordinates import Angle, SkyCoord from pathlib import Path from typing import Callable, Iterable from azulero...
kabasset/azulero
src/azulero/providers/factory.py
.py
6f440c2cdcb34e74
7.48
8