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 |
|---|---|---|---|---|---|---|
from .mossformer2 import MossFormer_MaskNet
import torch.nn as nn
class MossFormer2_SE_48K(nn.Module):
"""
The MossFormer2_SE_48K model for speech enhancement.
This class encapsulates the functionality of the MossFormer MaskNet
within a higher-level model. It processes input audio data to produce
... | FelysNeko/qwen3-tts-post-training | workers/preprocess/src/preprocess/clearvoice/mossformer2_se/mossformer2_se_wrapper.py | .py | 85e71167a9025a13 | 7 | 0 |
"""First-load weight fetch — delegates cache/download-location management to
the upstream tools (HF / ModelScope), no manual paths here.
Sources:
- SV ckpts (ModelScope — canonical 3D-Speaker host, NOT on HF):
iic/speech_eres2netv2w24s4ep4_sv_zh-cn_16k-common
iic/speech_campplus_sv_zh-cn_16k-common
- UTMOSv2 f... | FelysNeko/qwen3-tts-post-training | workers/scorer/src/scorer/fetch.py | .py | 0e98ae5039bb282f | 7 | 0 |
"""MOS scoring: vendored UTMOSv2 fusion_stage3 fold0, deterministic mode.
Randomness trap (MD §4 bake-off): the dataset does random 1.4s crops ×2 +
same-file mixup per prediction — single calls drift up to Δ0.65 MOS.
Fix (validated, this repo): np.random.seed(fixed) once before the repetition
loop + num_repetitions=8 ... | FelysNeko/qwen3-tts-post-training | workers/scorer/src/scorer/mos.py | .py | 1fa0d311cd6b4fb6 | 7 | 0 |
# Copyright 3D-Speaker (https://github.com/alibaba-damo-academy/3D-Speaker). All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""This implementation is adapted from https://github.com/wenet-e2e/wespeaker."""
import torch
import torch.nn as nn
class T... | FelysNeko/qwen3-tts-post-training | workers/scorer/src/scorer/speakerlab/models/eres2net/pooling_layers.py | .py | 7849e066330eb09b | 7 | 0 |
"""Dataset side of UTMOSv2 inference — verbatim numeric/RNG paths from
UTMOSv2/utmosv2/dataset/{_utils,multi_spec,ssl,ssl_multispec,_base}.py @ cc2700db.
RNG call order is the determinism anchor (np.random.seed(42) + num_workers=0):
per item per repetition — 1 ssl crop, then per spec frame: 1 crop, then per
spec confi... | FelysNeko/qwen3-tts-post-training | workers/scorer/src/scorer/utmos/dataset.py | .py | 51959eca2abc845e | 7 | 0 |
"""UTMOSv2 inference glue — replaces upstream create_model + UTMOSv2Model.predict.
Determinism contract (validated): np.random.seed(fixed) before each
repetition loop + sequential in-order item processing (no fork workers).
Weights are fetched (once, via HF cache) from the official
sarulab-speech/UTMOSv2 repo by score... | FelysNeko/qwen3-tts-post-training | workers/scorer/src/scorer/utmos/utmos.py | .py | d8f9b843b897e9ab | 7 | 0 |
"""Teacher-forcing log-prob extraction over ALL 16 codebooks (MD §7 缺口 #4).
The talker's generation does not expose per-step logits, so we rebuild the
exact sampling-time input from the prompt text + sampled code groups through
the SHARED teacher-forcing kernel `ModelWrapper.teacher_forcing` (via
`collate`, one talker... | FelysNeko/qwen3-tts-post-training | workers/trainer/src/trainer/grpo/logprob.py | .py | 5c79a2bf17713b4f | 7 | 0 |
"""Asset-universe helpers shared by trading, risk, and UI surfaces."""
from __future__ import annotations
import re
from dataclasses import dataclass
from typing import Iterable
DEFAULT_QUOTE_ASSET = "USDC"
DEFAULT_SYMBOL = "BTCUSDC"
SUPPORTED_MAJOR_BASE_ASSETS = ("BTC", "ETH", "SOL")
SUPPORTED_MAJOR_QUOTE_ASSETS = ... | strmt7/simple_ai_trading | src/simple_ai_trading/assets.py | .py | a2532c31f4667905 | 7.15 | 1 |
"""Independent backtesting panel — interval + time-window validation, no forced training.
This module is the operator surface for ad-hoc backtests. It does **not**
train a model; callers pass a model path (or ``None`` for a zero-weight
baseline walk) and the panel loads it, applies it to the selected candles,
and wri... | strmt7/simple_ai_trading | src/simple_ai_trading/backtest_panel.py | .py | 7c2778dd6aa16160 | 7.65 | 1 |
"""ASCII chart and sparkline helpers for the operator shell and TUI.
Everything is stdlib-only — no numpy, no pandas — and deterministic for a
given input so tests can pin exact output.
"""
from __future__ import annotations
import math
from dataclasses import dataclass
from typing import Iterable, Sequence
_SPARK_... | strmt7/simple_ai_trading | src/simple_ai_trading/chart.py | .py | f2db5550a0b47f8b | 7.15 | 1 |
#!/usr/bin/env python3
"""Release consistency — catch a version that was documented but never actually shipped.
Releases are cut by pushing a `vX.Y.Z` tag, which is the only thing that triggers the PyPI publish
workflow. Bumping `__version__` and writing the CHANGELOG entry are the steps a human does by hand;
pushing ... | hamilton-sky/codeintel | scripts/check_release_consistency.py | .py | 68f2f52691ff0100 | 7 | 0 |
"""`codeintel prompt` — generate a paste-to-your-agent setup prompt, tailored to this machine.
`setup` DOES the bring-up and `install` REGISTERS the MCP server; this hands the same job to your
coding agent instead. It runs a doctor probe, sees which engines are actually missing and whether
this agent is already regist... | hamilton-sky/codeintel | src/codeintel/agent_prompt.py | .py | 88e938094459ddc3 | 7 | 0 |
from __future__ import annotations
import hashlib
import os
import threading
from collections import OrderedDict
from codeintel.provider import Result
def _compute_hash(target: str, project_root: str) -> str:
"""The cache key's content component: a file target hashes its BYTES, so an edit invalidates.
A re... | hamilton-sky/codeintel | src/codeintel/cache.py | .py | d2abfd6919f5d70d | 7 | 0 |
"""Shared plumbing for the CLI command handlers.
Every command is `run(args) -> int` — it *returns* its exit code rather than calling `sys.exit`,
so a test can call it directly and assert on the code instead of driving argv and catching
SystemExit. `__main__` is the only place that turns the code into an exit.
"""
im... | hamilton-sky/codeintel | src/codeintel/commands/_common.py | .py | 2f7d00985bc6d65e | 7 | 0 |
"""`codeintel index` — build the semantic index, then best-effort refresh the graph and the map."""
import logging
import os
from typing import Any
from codeintel.commands._common import resolve_root
class _ProgressLogBridge(logging.Handler):
"""Routes WARNING+ log records from the indexer to a live progress co... | hamilton-sky/codeintel | src/codeintel/commands/index.py | .py | e6d3f451f8fa3f77 | 7 | 0 |
"""`codeintel install` — register codeintel with the AI agents installed on this machine."""
from typing import Any
from codeintel.commands._common import never_raise
def _register(installer: Any, agent: str, *, verify: bool, absolute: bool) -> tuple[list, list]:
"""(results, skipped) for the requested agent se... | hamilton-sky/codeintel | src/codeintel/commands/install.py | .py | 15b555966b1cb190 | 7 | 0 |
"""The single definition of "this file is safely inside the indexed root".
Containment used to live entirely inside ``Indexer._walk_files`` — that is, it was a property of
the indexing *walk* rather than of the data path. Everything that read indexed content afterwards
re-derived the path itself and opened it directly... | hamilton-sky/codeintel | src/codeintel/containment.py | .py | e666ac4628fc03e4 | 7 | 0 |
"""Backend transport for the graph provider.
The second slice extracted from `GraphProvider` under docs/refactor-graph-provider.md: everything
that speaks the codebase-memory-mcp wire protocol and never raises — running a call, falling back
between the two subprocess forms the backend supports, naming WHY a call faile... | hamilton-sky/codeintel | src/codeintel/graph_backend.py | .py | dde0a314db69f37a | 7 | 0 |
"""Pure path/label classification for the graph provider.
The first slice extracted from `GraphProvider` under docs/refactor-graph-provider.md: language-family
and non-code detection, and the module-scope container test. All provider-independent — no subprocess,
no state, no `self` — which is exactly why it can leave ... | hamilton-sky/codeintel | src/codeintel/graph_render.py | .py | 56b7eac0b7e0aad8 | 7 | 0 |
"""Project resolution for the graph provider.
The third slice extracted from `GraphProvider` under docs/refactor-graph-provider.md: turning a
`project_root` (a filesystem path) into the backend project that answers for it, distinguishing
"not indexed" from "could not ask" from "indexed under a containing project", and... | hamilton-sky/codeintel | src/codeintel/graph_resolution.py | .py | 273275a202e279bb | 7 | 0 |
"""Build an interactive view of a project's call graph from the graph engine.
Headless-first, in board-differ's data→renderer spirit: `build_graph_payload` returns a plain
``{project, nodes, edges}`` dict (the machine-readable `--format json` shape); `render_html` wraps
that payload in the self-contained interactive v... | hamilton-sky/codeintel | src/codeintel/grapher.py | .py | 4db25eaf199c3f7e | 7 | 0 |
from __future__ import annotations
import hmac
import json
import logging
import os
import signal
import sys
import threading
import time
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from urllib.parse import parse_qs, urlparse
from codeintel import __version__
from codeintel.auth import TokenAu... | hamilton-sky/codeintel | src/codeintel/http_server.py | .py | 42f08b9ade6f8413 | 7 | 0 |
from __future__ import annotations
import logging
import os
_START_MARKER = "<!-- codeintel-map-start -->"
_END_MARKER = "<!-- codeintel-map-end -->"
_CONTEXT_FILES = ["CLAUDE.md", "AGENTS.md"]
_BLOCK_CONTENT = (
"\n## codeintel orientation map\n\n"
"See [CODE_INTEL.md](CODE_INTEL.md) for a ranked overview o... | hamilton-sky/codeintel | src/codeintel/injector.py | .py | 658b996c2394a42d | 7 | 0 |
"""Line-number conversion for the backends whose numbering differs from ours.
**This module does not apply to every backend, and the line base is data, not a rule.** An earlier
version of this docstring asserted "the only place in codeintel permitted to format a path:line" and
"every backend we speak to counts lines f... | hamilton-sky/codeintel | src/codeintel/loc.py | .py | 04239307e2ec1773 | 7 | 0 |
from __future__ import annotations
import json
import logging
import os
import sys
class _JsonFormatter(logging.Formatter):
"""Minimal structured formatter for log aggregators (ELK / Splunk / Datadog). One JSON object
per line; no external dependency."""
def format(self, record: logging.LogRecord) -> st... | hamilton-sky/codeintel | src/codeintel/logconfig.py | .py | 8b5e6d554807bd71 | 7 | 0 |
"""A typed result for internal seams, so a failure stays a failure all the way up.
Every provider-internal helper used to return ``X | None``, and ``None`` there meant five
different things: never asked · timed out · the backend errored · the payload did not parse ·
genuinely empty. Callers could not tell them apart, ... | hamilton-sky/codeintel | src/codeintel/outcome.py | .py | a2a585e01f780ee8 | 7 | 0 |
from __future__ import annotations
import os
_ALL = "*"
def _normalize_root(path: str) -> str:
"""An absolute, symlink-resolved root for containment comparison. Resolving BOTH sides is what
makes `..` traversal and symlink escapes ineffective: `/srv/a/../../etc` normalizes to `/etc`
and simply fails the... | hamilton-sky/codeintel | src/codeintel/policy.py | .py | dd0559cdc4a34642 | 7 | 0 |
"""The progress-reporting seam for indexing.
This is a deliberately tiny, dependency-free contract that lets the indexer say *how far it is*
without knowing anything about terminals, TTYs, or ANSI. The renderer that turns these calls into
a live line (``term.LiveCounter``) lives on the far side of this line: it never ... | hamilton-sky/codeintel | src/codeintel/progress.py | .py | b548bc1a0f0ce65a | 7 | 0 |
from __future__ import annotations
import logging
import os
import traceback
from typing import Any, NotRequired, Protocol, runtime_checkable
from typing_extensions import TypedDict
_logger = logging.getLogger("codeintel")
_DEBUG = os.environ.get("CODEINTEL_DEBUG", "").strip().lower() in ("1", "true", "on", "yes")
... | hamilton-sky/codeintel | src/codeintel/provider.py | .py | a2b10ff3ffaa380e | 7 | 0 |
"""Internal customer-obsession operating layer for Fabrient.
This turns customer-first principles into measurable product behavior rather than
exposing a competitive-strategy UI to customers.
"""
from __future__ import annotations
from typing import Any
from fastapi import APIRouter
router = APIRouter(prefix="/inter... | omerschsaban-hub/Barber- | engineering/app/customer_obsession.py | .py | 186a9acd819735cf | 7 | 0 |
from __future__ import annotations
import math
from dataclasses import dataclass
from statistics import mean
@dataclass(frozen=True)
class ValidationResult:
n:int
mae:float
rmse:float
sigma:float
calibrated:bool
model_version:str
def fit_residual_linear(x:list[list[float]], y:list[float]):
... | omerschsaban-hub/Barber- | engineering/app/ml.py | .py | ecc5d1b40a792b05 | 7 | 0 |
#!/usr/bin/env python3
"""atoms-freshness.py — advisory staleness check for the atoms fast-fact layer (memory-sweep T3d).
The atoms layer (memory/atoms.jsonl) is injected into EVERY session on EVERY machine. If a source
memory/<src>.md gains facts but its atoms aren't refreshed, canon injects stale claims fleet-wide
a... | Urinophoria/claude-memory-kit | setup/atoms-freshness.py | .py | b0275291bfda247a | 7 | 0 |
#!/usr/bin/env python3
"""atoms-lint.py -- integrity guard for the atoms fast-fact layer (memory/atoms.jsonl).
Built 2026-08-26 to make the atom system bulletproof before it graduates from PILOT. The frantic
early work left 4 duplicate ids + a dangling cross-reference (canon referenced wr-27 with no atom);
nothing cau... | Urinophoria/claude-memory-kit | setup/atoms-lint.py | .py | a197b18ce8d36a9b | 7 | 0 |
"""recall.py - search the CONVERSATION tier of canon: transcripts/rendered/.
THE PROBLEM THIS SOLVES (Paul, 2026-08-02):
"The transcripts and losing their nuance/feel to compression is hard for me, so
anything that might blunt that, or even negate it entirely, is a welcome change."
transcripts/INDEX.md already... | Urinophoria/claude-memory-kit | setup/recall.py | .py | c093a569cd95f0ac | 7 | 0 |
#!/usr/bin/env python3
"""Schreibt echte Messwerte fuer den Erklaerfilm.
Der Film zeigt in der Szene „Pruefen" Zeilen aus dem Messbericht. Sie werden
nicht abgetippt, sondern hier aus einem wirklichen Lauf gezogen: rendern,
`verify --json` lesen, die gezeigten Pruefungen herausschreiben.
python3 scripts/bericht.p... | blitzsicht/falzmarke | scripts/bericht.py | .py | 0f4606e26d596a02 | 7 | 0 |
#!/usr/bin/env python3
"""Traegt die juengsten Aenderungen in die README ein — aus CHANGELOG.md.
Anlass: Viele Projekte fuehren ihren Verlauf in der README, damit man ihn sieht,
ohne eine zweite Datei zu oeffnen. Das ist ein echter Gewinn — aber eine zweite
Fassung derselben Sache driftet auseinander. Dieses Repositor... | blitzsicht/falzmarke | scripts/changelog.py | .py | 366f99124f7c22fb | 7 | 0 |
#!/usr/bin/env python3
"""Erneuert die Golden-Dateien der Mail-Beispiele.
Ein Golden ist die Byte-für-Byte festgehaltene Ausgabe. Es faellt auf, wenn
sich an der `.eml` etwas aendert, das niemand angesagt hat — eine
Kopfzeilenreihenfolge, eine Kodierung, ein Trennstring. Damit das ueberhaupt
moeglich ist, muss die Aus... | blitzsicht/falzmarke | scripts/golden_email.py | .py | 4e601ecc2b4c5b17 | 7 | 0 |
#!/usr/bin/env python3
"""Prüft die öffentlichen Issues auf interne Angaben — nach ADR 0031.
Ein Issue hier beschreibt das Werkzeug, nicht unsere Arbeitsweise. Der Unterschied
ist leicht zu übersehen, weil ein Auftrag beim Übersetzen in ein Issue seinen
Kontext mitbringt. Dieses Skript zählt nach.
python3 scripts... | blitzsicht/falzmarke | scripts/oeffentlichkeit.py | .py | f5a8f9cdf56fad29 | 7 | 0 |
#!/usr/bin/env python3
"""Prüft PDF-Konformität mit veraPDF — einem fremden Werkzeug (Issue #34).
WARUM ES DIESES SKRIPT GIBT
falzmarke schreibt PDF/A und misst das Ergebnis anschließend selbst nach. Das
belegt, dass das Werkzeug einhält, was es sich vornimmt — nicht, dass das
Ergebnis der Norm entspricht. Beides wir... | blitzsicht/falzmarke | scripts/pdf_konformitaet.py | .py | 0b70f340f9991080 | 7 | 0 |
#!/usr/bin/env python3
"""falzmarke-Markdown: eine Teilmenge von CommonMark, geprüft statt geraten.
Bis v0.1.2 war das hier ein Regex-Konverter. Regexe können Markdown nicht
zerlegen — sie sehen `**` und `*`, aber keine Struktur, und was sie nicht
kennen, reichen sie durch. Ein `//` im Fließtext löschte so den Rest de... | blitzsicht/falzmarke | skill/falzmarke/markdown.py | .py | 465b71ae27e2533a | 7 | 0 |
#!/usr/bin/env python3
"""Die Quellenlage je Regel, gelesen aus `din5008.yaml`.
Warum das eine eigene Ebene ist: Alle Maße und Schreibregeln stammen aus
Sekundärquellen; der Abgleich mit dem Originaltext der DIN 5008:2020-03 steht
aus. Solange das so ist, darf das Werkzeug nur als **Fehler** melden, was
mehrfach beleg... | blitzsicht/falzmarke | skill/falzmarke/regeln/__init__.py | .py | 5b1a21b3eade455e | 7 | 0 |
"""Beschriftung je Sprache — deutsche Geometrie, fremde Wörter.
Für Briefe an Empfänger, die kein Deutsch lesen. Die Geometrie bleibt dabei
unverändert: Anschriftfeld, Informationsblock, Falzmarken und das 12-pt-Raster
sind Maße der DIN 5008 und hängen nicht an der Sprache. Es ändern sich die
Zeichenketten, die Monats... | blitzsicht/falzmarke | skill/falzmarke/sprachen.py | .py | 9ba43f468a031d88 | 7 | 0 |
#!/usr/bin/env python3
"""Der Typografie-Pass nach DIN 5008.
Läuft ausschließlich auf Textknoten, nie auf Adressen, URLs oder E-Mails — dort
würde ein geschütztes Leerzeichen den Wert unbrauchbar machen.
Die Ersetzungen passieren hier in Python und nicht über Typsts eingebaute
Kurzschreibweisen. Beides führt zum selb... | blitzsicht/falzmarke | skill/falzmarke/typografie.py | .py | f2c3ac4eaac7afd2 | 7 | 0 |
#!/usr/bin/env python3
"""Prüft die Laufzeitabhängigkeiten von falzmarke und installiert sie bei Bedarf.
Exit 0: alles vorhanden (oder erfolgreich installiert)
Exit 1: Installation nicht möglich — die Meldung nennt den Grund
"""
from __future__ import annotations
import importlib.util
import subprocess
import sys
fr... | blitzsicht/falzmarke | skill/scripts/bootstrap.py | .py | 4e1659af4bf3294c | 7 | 0 |
"""Gemeinsame Fixtures. Die Beispiele werden einmal je Testlauf gerendert.
Wo Tests die CLI über `subprocess` aufrufen, steht dort `encoding="utf-8"`.
Ohne das liest Python die Ausgabe unter Windows in cp1252, und jeder Vergleich
mit einem Text, der `—` oder `ß` enthält, scheitert an Mojibake statt an der
Sache. Das P... | blitzsicht/falzmarke | tests/conftest.py | .py | 15348384e802b910 | 7.5 | 0 |
"""Die Aktion für fremde Repositories (action.yml).
Was hier geprüft wird, ist die Beschreibung — Eingaben, Ausgaben, gepinnte
Fremd-Actions, Erwähnung in der README. Ob sie *läuft*, kann kein lokaler Test
sagen: Dafür braucht es einen Runner, und dafür gibt es
`.github/workflows/aktion.yml`, der sie auf den eigenen B... | blitzsicht/falzmarke | tests/test_aktion.py | .py | 740b5714faf1f4a5 | 7.5 | 0 |
"""Die Maße aus DIN 5008:2020, gemessen am fertigen PDF.
Diese Datei ist die Abnahme. Sie prüft nicht, ob der Code etwas tut, sondern
ob das ausgelieferte PDF die Norm einhält.
"""
from __future__ import annotations
import pytest
from falzmarke import geometrie
from conftest import BEISPIELE
@pytest.mark.parametr... | blitzsicht/falzmarke | tests/test_geometry.py | .py | 0d6300516b347dc2 | 7.5 | 0 |
"""Die README darf keinen Installationsbefehl nennen, den es nicht gibt.
Anlass, gemessen am 25.08.2026: README und CHANGELOG versprachen
`uvx normbrief` und `pipx install normbrief`. Beides schlug fehl — das Paket
lag nie auf PyPI. Aufgefallen ist es niemandem, weil der Frischklon-Job der CI
ein lokal gebautes Wheel ... | blitzsicht/falzmarke | tests/test_installationswege.py | .py | 34ff3cad2e6e908a | 7.5 | 0 |
#!/usr/bin/env python3
"""Run the debate engine on stored single-pass reviews.
Takes paired reviews from 03_combine_results.py and runs them through
the M5 DebateController → M6 EvidenceTracker → M7 SynthesisReport pipeline.
During debate rounds, calls the LLM API live via OpenRouter using the same
model that did the... | deghosal-2026/adversarial-debate | scripts/04_run_debate.py | .py | 8f61c00ac75cd238 | 7 | 0 |
#!/usr/bin/env python3
"""Compare model outputs and produce the FIELD_TEST_REPORT.md.
Analyzes:
1. Distinct issues per model (what did each model find that others missed?)
2. Cross-model overlap (Venn: issues found by A only, B only, both, neither)
3. Baseline comparison (does the debate pair find more than sing... | deghosal-2026/adversarial-debate | scripts/05_analyze.py | .py | 8e775b9d96d231df | 7 | 0 |
#!/usr/bin/env python3
"""Ground-truth verification: side-by-side of known revert reasons vs debate claims.
Produces a CSV for manual judgment: did any debate pair surface the actual
cause of the revert/advisory?
Usage:
python3 06_ground_truth.py --corpus results/field-test/v0.1.0/corpus0.csv
Output:
results... | deghosal-2026/adversarial-debate | scripts/06_ground_truth.py | .py | fb0ff39fbd441e49 | 7 | 0 |
#!/usr/bin/env python3
"""LLM-as-judge: fill human_judgment column in ground-truth-comparison.csv.
Uses an LLM to classify each debate claim against the known revert/advisory
reason: MATCH / PARTIAL / NO_MATCH. Spot-check results before trusting.
Usage:
python3 07_llm_judge.py --model openai/gpt-4o-mini
pytho... | deghosal-2026/adversarial-debate | scripts/07_llm_judge.py | .py | 7cb587f7f4b66923 | 7 | 0 |
"""Normalizer framework: protocol, registry, shared errors (WBS T4.1).
Plugin contract per PRD [05-features §5.3](docs/design/prd/05-features.md):
each domain ships a ``Normalizer`` under ``adapters/<domain>/`` and registers
itself on import; the engine stays domain-agnostic. Registry errors are
user-facing and action... | deghosal-2026/adversarial-debate | src/adversarial_debate/adapters/base.py | .py | 65748270e6831da3 | 7 | 0 |
"""File-extension → language heuristics for PR artifacts (WBS T4.3).
Feeds ``DetectedLanguage``/``classification_tag`` on the artifact. These are
deliberately shallow filename heuristics — never claims about content semantics
([13-failure-modes FM-10](docs/design/prd/13-failure-modes.md): no invented
metadata).
"""
f... | deghosal-2026/adversarial-debate | src/adversarial_debate/adapters/pr_review/language.py | .py | 0b9514e75dfbf97c | 7 | 0 |
"""PR metadata extraction: local diff paths or GitHub PR URLs via ``gh`` (WBS T4.3).
``gh`` runs behind an injected [GhRunner][...] so tests stay hermetic
(tests/conftest.py blocks all sockets); when the CLI is missing, callers get a
clear degrade-to-local-path message. FM-10 discipline
([13-failure-modes](docs/design... | deghosal-2026/adversarial-debate | src/adversarial_debate/adapters/pr_review/metadata.py | .py | 7eac0324e525610b | 7 | 0 |
"""Config model + TOML loader (WBS T1.6, F8 BYOM registry, PRD §6.4 reproducibility).
Design decisions honored here: DD-01 (rounds default 2), DD-03/§6.4 (seed for
reproducible runs). Secrets are referenced by environment-variable name
(``key_env``) and never stored in config files — raw keys are rejected.
Validation ... | deghosal-2026/adversarial-debate | src/adversarial_debate/config.py | .py | 8f65330403c42dff | 7 | 0 |
"""ID/hash utilities (WBS T1.7): SHA-256 content hashes, monotonic sequences, IDs.
Deterministic IDs keep transcripts reproducible across runs on the same input
(PRD §6.4): the same payload always yields the same id, so audit logs can be
cross-checked without persisting a mapping.
"""
import hashlib
import threading
... | deghosal-2026/adversarial-debate | src/adversarial_debate/ids.py | .py | 010142d180c4f6ea | 7 | 0 |
"""Shared provider contract: ReviewRequest / ReviewResult (WBS T2.1 #8, PRD §6.4).
Every transport, adapter, and scripted reviewer honors this contract so the
engine (M5) is provider-agnostic. ``ReviewResult.metadata`` carries the seed
and prompt_version for transcript reproducibility (PRD §6.4).
"""
from pydantic im... | deghosal-2026/adversarial-debate | src/adversarial_debate/providers/contract.py | .py | 812f053a2cab9dec | 7 | 0 |
"""LangGraph adapter: wraps a LangGraph chat model node as a reviewer backend (WBS T2.4 #11).
Honours the same ReviewRequest / ReviewResult contract as OpenAITransport.
LangGraph is an optional dependency — install with ``uv add adversarial-debate[langgraph]``.
"""
from __future__ import annotations
import json
from... | deghosal-2026/adversarial-debate | src/adversarial_debate/providers/langgraph_adapter.py | .py | 7d220317b2df18fc | 7 | 0 |
"""PydanticAI adapter: wraps a PydanticAI model as a reviewer backend (WBS T2.3 #10).
Honours the same ReviewRequest / ReviewResult contract as OpenAITransport.
PydanticAI is an optional dependency — install with ``uv add adversarial-debate[pydanticai]``.
"""
from __future__ import annotations
import json
from typin... | deghosal-2026/adversarial-debate | src/adversarial_debate/providers/pydanticai_adapter.py | .py | 443f6d1f805677c9 | 7 | 0 |
"""ProviderRegistry: config slots A/B → provider instances (WBS T2.1 #8, PRD §2.5).
Validates heterogeneous vs same-family pairs (DD-04), exposes ``pair_mode``,
and produces actionable errors for missing API-key environment variables.
"""
import os
from collections.abc import Callable
from typing import Literal
from... | deghosal-2026/adversarial-debate | src/adversarial_debate/providers/registry.py | .py | ef16219ae4ead9c9 | 7 | 0 |
"""ScriptedReviewer: deterministic test double from canned YAML scenarios (WBS T2.6 #13, PRD §2.5).
Zero paid LLM calls in CI — this is the only reviewer used during automated tests.
Supports malformed-output scenarios to exercise fail-closed paths in M5.
"""
import os
from pathlib import Path
from typing import Any
... | deghosal-2026/adversarial-debate | src/adversarial_debate/providers/scripted_reviewer.py | .py | 651dda8c1c1a3020 | 7 | 0 |
"""Artifact schemas: the normalized thing under review (PRD §2.2 component 1, §2.4).
Naming source of truth: [11-glossary](docs/design/prd/11-glossary.md) ("Artifact").
``detected_language`` per [i18n §22.2](docs/design/prd/22-internationalization.md)
— auto-detected, overridable, never a translation trigger.
"""
fro... | deghosal-2026/adversarial-debate | src/adversarial_debate/schemas/artifact.py | .py | a73aed8d6e2f2bc7 | 7 | 0 |
"""Debate schemas: first-class evidence objects (PRD §2.4 rows 4-9, §2.7, F3).
Lifecycle semantics per [11-glossary](docs/design/prd/11-glossary.md): a concession
is a new event, never an edit; convergence is claim-state-based (DD-08), and
``would_resolve_if`` is mandatory on every unresolved point (DD-06).
"""
from ... | deghosal-2026/adversarial-debate | src/adversarial_debate/schemas/debate.py | .py | a68f7b1a53f09ccc | 7 | 0 |
"""Review schemas: isolated reviewer sessions and their committed reviews (PRD §2.3, §2.4).
Session status enum per WBS T1.4: ``isolated|revealed|debating|done|error`` — the
revelation gate transition ``isolated → revealed`` (§2.3) is mechanically enforced
by the engine in M3; this schema carries the state.
"""
from ... | deghosal-2026/adversarial-debate | src/adversarial_debate/schemas/review.py | .py | 4c0144cd71bc03ae | 7 | 0 |
"""Hermetic-only test guard (WBS T1.2).
Global exit gate: zero paid-LLM calls and zero network access in CI (PRD §2.5).
Every test runs with outbound sockets disabled; a test that needs the network is
a bug, not a configuration problem. Set ``ADVDEB_ALLOW_NETWORK=1`` only when
debugging locally — never in CI.
"""
imp... | deghosal-2026/adversarial-debate | tests/conftest.py | .py | 84dc690c0159201e | 7.5 | 0 |
from __future__ import annotations
import json
from pathlib import Path
from typing import Any
from .adaptive_learning import LearningAwareAITeam, classify_domain
from .team import OrchestrationPlan
DOMAIN_REQUIRED_ROLES: dict[str, tuple[str, ...]] = {
"communication": ("planner",),
"engineering": ("planner... | Maxhm007/Genesis-AI-Network | genesis/adaptive_team.py | .py | c6d75621de435370 | 7 | 0 |
from __future__ import annotations
import hashlib
import json
import re
from pathlib import Path
from .coding import CodingModule
class DeterministicLearnedCapabilityProvider:
"""Build a small evidence-backed learned capability without an LLM.
This provider is intentionally narrow. It only activates for gr... | Maxhm007/Genesis-AI-Network | genesis/deterministic_capability_builder.py | .py | 98e7114a83562344 | 7 | 0 |
from __future__ import annotations
import shutil
import subprocess
import tempfile
from pathlib import Path, PurePosixPath
from genesis.coding import CodingModule
from genesis.providers import IntelligenceProvider, ProviderRegistry
from .module import DevLabAttempt, GenesisDevLab, TargetGroundedProvider, ValidationF... | Maxhm007/Genesis-AI-Network | genesis/devlab/iterative.py | .py | 7b6557d2fe3aa9fd | 7 | 0 |
from __future__ import annotations
from dataclasses import dataclass, asdict
@dataclass(frozen=True)
class EvaluationResult:
name: str
score: float
max_score: float
evidence_count: int
@property
def normalized(self) -> float:
return 0.0 if self.max_score <= 0 else max(0.0, min(1.0, s... | Maxhm007/Genesis-AI-Network | genesis/evaluation.py | .py | 07fcd0284db1faf3 | 7 | 0 |
"""v0.11: S3-compatible REST API endpoints (/s3/{bucket}/{key:path}).
Supports:
- PUT /s3/{bucket}/{key} (PutObject)
- GET /s3/{bucket}/{key} (GetObject with Range & ETag)
- HEAD /s3/{bucket}/{key} (HeadObject)
- DELETE /s3/{bucket}/{key} (DeleteObject)
- GET /s3/{bucket} (ListObjectsV2)
"""
from __future__ import ann... | HA-ir/Anbar | src/anbar/api/s3.py | .py | 00c8c19891a82d37 | 7 | 0 |
"""Web UI (F7): a minimal password-gated page for list / upload / download.
Login accepts the **admin** key, then sets a signed, short-lived session
cookie (see webauth). After that the browser never sends the raw key again:
all same-origin requests carry the cookie, and ``whoami`` (in auth.py)
resolves the role from ... | HA-ir/Anbar | src/anbar/api/web.py | .py | 9660344f8fd4f225 | 7 | 0 |
"""Configuration: env-driven, validated, immutable."""
from __future__ import annotations
from enum import StrEnum
from functools import lru_cache
from pathlib import Path
from pydantic import Field, SecretStr, field_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
class Backend(StrEnum):
... | HA-ir/Anbar | src/anbar/config.py | .py | 40bad5ed0fc3357e | 7 | 0 |
"""Share-link registry (v0.10).
Links were previously write-only: mint a signed URL and hope you still have
the message it lives in. This module makes links first-class:
- every mint registers `link:<obj_id>:<exp>` → meta JSON in kv;
- ``list_links`` walks those entries (newest first);
- ``revoke`` deletes the signat... | HA-ir/Anbar | src/anbar/links.py | .py | 8318b752540f08f2 | 7 | 0 |
"""anbar: Telegram-backed object storage (zero local file retention)."""
from __future__ import annotations
import asyncio
import sys
from contextlib import asynccontextmanager
from fastapi import FastAPI
from . import __version__
from .config import get_settings
from .db import Database
from .storage import Storag... | HA-ir/Anbar | src/anbar/main.py | .py | bc165a98196d94ae | 7 | 0 |
"""Object layer: chunking, manifests, object ids.
The chunker is backend-agnostic: it yields fixed-size chunks from an async
byte stream while maintaining an incremental SHA-256 over the joined bytes.
Small files produce a single-element manifest — one code path for all sizes.
"""
from __future__ import annotations
... | HA-ir/Anbar | src/anbar/objects.py | .py | bee94649808be9a9 | 7 | 0 |
"""Fixed-window rate limits backed by SQLite (F6). No Redis required."""
from __future__ import annotations
import hashlib
from fastapi import HTTPException, Request
from .db import Database
_WINDOW_S = 60
def _client_ip(request: Request) -> str:
fwd = request.headers.get("x-forwarded-for", "")
if fwd:
... | HA-ir/Anbar | src/anbar/ratelimit.py | .py | 88383b8d8c6f9584 | 7 | 0 |
"""Runtime-tunable settings (F8).
Operator-adjustable values, persisted in the ``kv`` table so they survive
restarts but never touch the git-controlled ``.env``. A setting present in
kv overrides the env default; deleting the kv row restores the env value.
Every value is validated against a fixed spec (type + inclusi... | HA-ir/Anbar | src/anbar/runtime.py | .py | e51309ee2018d4a1 | 7 | 0 |
"""Storage backend abstraction.
Backends store files in Telegram and expose an opaque `file_id`.
The object layer (F2/F3) sits above this and uses chunking transparently.
"""
from __future__ import annotations
import abc
from dataclasses import dataclass
@dataclass(frozen=True)
class ObjectRef:
"""Handle to st... | HA-ir/Anbar | src/anbar/storage/base.py | .py | 5242bcdfda590343 | 7 | 0 |
"""Bot harvester: capture document file_id for messages posted to the channel.
In hybrid mode, files are uploaded via MTProto (fast, multi-part, no floodwait),
and the Bot in the channel reads the channel_post updates to capture the Bot API
`file_id` for each chunk. The file_id is stored in the object chunk manifest,
... | HA-ir/Anbar | src/anbar/storage/bot_harvester.py | .py | d6518be2b6a4af59 | 7 | 0 |
"""Multi-Bot Token Pool for distributed Bot CDN downloads.
When multiple bot tokens are configured, BotPool round-robins CDN download
requests across different bot tokens to distribute Telegram's per-bot rate
limits and eliminate CDN queuing stalls on massive multi-gigabyte transfers.
"""
from __future__ import annot... | HA-ir/Anbar | src/anbar/storage/bot_pool.py | .py | a52f6e7b9d0c5e5c | 7 | 0 |
"""Web UI sessions (F7): short-lived, stateless, HMAC-signed cookies.
The raw key never appears in the cookie. The value is ``{exp}:{tag}:{sig}``:
sig = HMAC-SHA256(secret, f"anbar-ui:{role}:{exp}:{tag}")
The signing secret is a dedicated value stored in the kv table (created on
first login), so rotating the dow... | HA-ir/Anbar | src/anbar/webauth.py | .py | d634cd4c5921c9b5 | 7 | 0 |
"""Streaming ZIP (v0.10): correct offsets via byte-counting bridge.
zipfile computes central-directory offsets from ``fileobj.tell()``. Our
bridge counts forwarded bytes so offsets are exact; the worker thread hands
chunks to an asyncio queue that the consumer streams out.
"""
from __future__ import annotations
impo... | HA-ir/Anbar | src/anbar/zipper.py | .py | 41426306a12fd2ef | 7 | 0 |
"""Shared test fixtures: app wired with FakeBackend, isolated env + temp DB."""
from __future__ import annotations
import pytest
from fastapi.testclient import TestClient
from anbar.main import create_app
from anbar.storage import FakeBackend
@pytest.fixture(autouse=True)
def _isolate_env(monkeypatch, tmp_path):
... | HA-ir/Anbar | tests/conftest.py | .py | bf77e51a41ac1acb | 7.5 | 0 |
"""Dynamic API keys: create → use → list (masked) → revoke."""
from __future__ import annotations
ADMIN = {"Authorization": "Bearer test-admin-key"}
def _post(client, path, body=None):
return client.post(path, json=body or {}, headers=ADMIN)
def test_api_key_lifecycle(client):
# empty at start
r = cli... | HA-ir/Anbar | tests/test_api_keys.py | .py | e214575f352c315c | 7.5 | 0 |
"""
Comprehensive end-to-end integration and edge-case test suite for Anbar 0.12.0.
Covers:
1. Multi-type preview & streaming (Video, Image, Audio, PDF, Text/Code/JSON).
2. Range-requests & Partial Content (206) vs Full (200) vs 304 ETag.
3. S3 PutObject, GetObject with Range, HeadObject, DeleteObject, ListObjectsV2.
4... | HA-ir/Anbar | tests/test_audit_comprehensive_e2e.py | .py | c008704749113aed | 7.5 | 0 |
"""Body-stall guard: client declares more Content-Length than it sends.
Regression test for the 500 MB bench bug — the bench wrote only 7×64 MiB
(448 MiB) but declared 500 MiB, so the server waited forever on body bytes
that never came. v0.8.4 aborts such uploads with 408 + rollback.
"""
from __future__ import annota... | HA-ir/Anbar | tests/test_body_stall.py | .py | 43511bccad9db3a9 | 7.5 | 0 |
"""F4: anbarctl end-to-end against a live server (threaded uvicorn)."""
from __future__ import annotations
import socket
import subprocess
import sys
import threading
import time
import uvicorn
from anbar.main import create_app
def _free_port() -> int:
s = socket.socket()
s.bind(("127.0.0.1", 0))
port... | HA-ir/Anbar | tests/test_cli.py | .py | 7f0f20e527be60aa | 7.5 | 0 |
"""v0.11: conditional requests (ETag / If-None-Match -> 304) and smart media disposition."""
from __future__ import annotations
import io
ADMIN = {"Authorization": "Bearer test-admin-key"}
def _upload(
client,
filename="photo.png",
data=b"\x89PNG\r\n\x1a\nfakeimage",
content_type="image/png",
):
... | HA-ir/Anbar | tests/test_conditional.py | .py | eb78eb7ab9d3e8f3 | 7.5 | 0 |
"""v0.11: AES-256-GCM chunk encryption tests."""
from __future__ import annotations
from anbar.crypto import decrypt_gcm, derive_key_256, encrypt_gcm
ADMIN = {"Authorization": "Bearer test-admin-key"}
def test_crypto_aes_gcm_direct():
key = derive_key_256("my-secret-password-123")
original = b"Super confid... | HA-ir/Anbar | tests/test_crypto.py | .py | 6a458a6f1f6e8fa6 | 7.5 | 0 |
"""v0.11: Comprehensive End-to-End (E2E) integration tests for the 6 new capabilities.
Simulates real full client workflows without mocks:
1. S3 Lifecycle (PutObject -> Head -> Get Range -> ETag 304 -> List -> Delete)
2. ETag & Smart Content-Disposition in direct /f/ download routes
3. Telegram Mini App initData Auth -... | HA-ir/Anbar | tests/test_e2e_new_features.py | .py | fc4a390fc58c69ce | 7.5 | 0 |
"""Local evidence and audit record primitives."""
from __future__ import annotations
from datetime import datetime, timezone
import hashlib
import json
from pathlib import Path
import sys
from typing import Any
try:
from .common import *
except ImportError: # direct execution: python3 registry/aine_registry.py
... | williamlabdev/aine-registry | registry/evidence.py | .py | b5f78d428e5cf5b9 | 7.24 | 2 |
"""JSON-line audit trail for the exposed listener.
One line per authenticated request that mutated state. Bodies are not
logged — the prompt of an agent_spawn or the contents of a message stay out
of the access log to avoid leaking sensitive data on disk.
"""
from __future__ import annotations
import json
import thr... | phy0x1a79ed/agentic-workspace | awm/gateway/awm/gateway/access_log.py | .py | 73b2f2f754f1d7c0 | 7 | 0 |
"""Core lifecycle operations (restart, etc.)."""
from __future__ import annotations
import subprocess
import time
import httpx
from awm.config import BASE_URL
from awm.gateway._process_utils import sweep_orphan_awm_serves
def restart_core() -> dict[str, str]:
"""Restart the AWM core systemd unit (``awm.servic... | phy0x1a79ed/agentic-workspace | awm/gateway/awm/gateway/core.py | .py | b87d843b1bc06fac | 7 | 0 |
"""opencode MCP-config exporter.
Translates Claude Code's ``.mcp.json`` shape into opencode's config shape and
writes it to ``<workspace>/.awm/mcp-opencode.json``. The consumer side wires
opencode to that file by setting ``OPENCODE_CONFIG`` (merges with user config).
"""
from __future__ import annotations
import jso... | phy0x1a79ed/agentic-workspace | awm/gateway/awm/gateway/exports/backends/opencode.py | .py | befde9df6a9ca9b7 | 7 | 0 |
"""MCP-config export framework.
Reads the canonical workspace ``.mcp.json`` (Claude Code's MCP registry) and
fans it out to backend-specific config files for other CLI agents that don't
read ``.mcp.json`` natively (opencode, codex, …).
The framework is intentionally protocol-agnostic: each exporter is a plain
module ... | phy0x1a79ed/agentic-workspace | awm/gateway/awm/gateway/exports/mcp.py | .py | cbcf43a9ee365f2e | 7 | 0 |
"""WS-lease liveness for hub-registered services.
A service registers (HTTP POST), then opens ``WS /hub/lease/{service_id}``
and holds it for its lifetime. The WS handler calls ``hold`` for the
duration of the connection; on disconnect the registry entry is evicted.
"""
from __future__ import annotations
import asyn... | phy0x1a79ed/agentic-workspace | awm/gateway/awm/gateway/hub/lease.py | .py | f7f2f64d11a7631b | 7 | 0 |
"""Static-directory serving for ``kind="static"`` registrations.
Mirrors ``proxy.py`` in role: where ``proxy_http`` forwards a request to a
registered URL, ``serve_static`` answers it from a registered directory.
The hub uses ``starlette.responses.FileResponse`` for the actual byte
shipping — we don't mount a ``Stati... | phy0x1a79ed/agentic-workspace | awm/gateway/awm/gateway/hub/static.py | .py | e65eff4fc947eeeb | 7 | 0 |
"""Which session is calling this proxy — the identity reflection acts on.
Shared by both stdio proxies (:mod:`awm.gateway.mcp_stdio` and
:mod:`awm.gateway.mcp_server_sdk`), which stamp the result as the
``X-Awm-Session-Pid`` header. It lives apart from either so the two cannot drift:
a session that reflects on itself ... | phy0x1a79ed/agentic-workspace | awm/gateway/awm/gateway/mcp_caller.py | .py | 2029b19c29f75fa8 | 7 | 0 |
"""Turn a peer's file references into local files, for the MCP proxies.
A verb that produces a file (``social download_attachments``, ``social
bucket_get``) writes the bytes to a temp dir **on the node that ran it** and
returns that absolute path. Run locally that is exactly right. Run on a peer it
is a path to nothin... | phy0x1a79ed/agentic-workspace | awm/gateway/awm/gateway/peer_files.py | .py | b52e11dd2ce64f87 | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.