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
# SPDX-FileCopyrightText: Copyright (C) 2025-2026, Jean-Christophe Malapert and Antoine Basset # SPDX-PackageSourceInfo: https://github.com/kabasset/azulero # SPDX-License-Identifier: Apache-2.0 from typing import Sequence from astropy.coordinates import Angle, SkyCoord import numpy as np class ConvexSphericalPolyg...
kabasset/azulero
src/azulero/providers/polygon.py
.py
dabd05c723acf2ec
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 argparse from astropy import units from astropy.coordinates import Angle import numpy as np from pathlib import Path import cv2 from azulero impo...
kabasset/azulero
src/azulero/roam.py
.py
6f58350910dc2c6a
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 functools import lru_cache import logging import os import shlex import sys def parse_envargs(command=None, prefix=os.environ.get("AZULERO_PREFIX"...
kabasset/azulero
src/azulero/tools/messaging.py
.py
bdb6f7558f9b3b3e
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 Angle import numpy as np from pathlib import Path import re class ParseError(Exception): def __init__(self, name: ...
kabasset/azulero
src/azulero/tools/parsing.py
.py
6dea323ff6eb8f68
7.48
8
# SPDX-FileCopyrightText: Copyright (C) 2025-2026, Antoine Basset # SPDX-PackageSourceInfo: https://github.com/kabasset/azulero # SPDX-License-Identifier: Apache-2.0 def retry(retries=2, exceptions=Exception, default=None, logger=None): """ Decorator to retry a callable. """ def decorate(func): ...
kabasset/azulero
src/azulero/tools/retry.py
.py
2c071d204f5ccb87
7.48
8
from dataclasses import dataclass import getpass import netrc @dataclass class Secret: """ A foolproof secret (e.g. password) wrapper, string representation of which returns an obfuscated text. This class does not bring any kind of security. It only ensures that printing or logging the secret will ob...
kabasset/azulero
src/azulero/tools/secret.py
.py
10b4c9244211d382
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 typing import Sequence from dataclasses import dataclass import numpy as np @dataclass class KeysValues: """ Ordered, possibly-float inde...
kabasset/azulero
src/azulero/tools/stats.py
.py
6a09488d680508c9
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 dataclasses import dataclass from pathlib import Path @dataclass class Workspace: workspace: Path = Path(".") input_pattern: str = "*[-_]...
kabasset/azulero
src/azulero/tools/workspace.py
.py
3d5046a08b12682e
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 dataclasses import dataclass import numpy as np import scipy.interpolate as interp from azulero.video import sequence def sin_sequence(key_frames...
kabasset/azulero
src/azulero/video/interp.py
.py
01a3faced8c109c7
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 typing import Any from astropy import units as u from astropy.coordinates import SkyCoord, Angle from astropy.wcs import WCS from dataclasses import...
kabasset/azulero
src/azulero/video/sequence.py
.py
7d147ab467dfa799
7.48
8
/** * CSV/JSONL export guards — B4 from the 2026-07-24 release-readiness review. * * The CSV path carries attacker-influenced text (agent tool commands) straight * into Excel or Sheets. An unescaped leading `=` there is a working formula * injection in the very tool meant to audit one, so these are the assertions ...
blitzcrieg1/agentmetry
apps/dashboard/tests/audit-export.test.ts
.ts
da25c733eaf54723
7.06
12
/** * Source-app normalization — B4 from the 2026-07-24 release-readiness review. * * Every source label, badge, dot and chart colour resolves through * `normalizeSourceApp`. When that logic lived in three components they drifted, * and a legacy codename leaked into the analytics charts. This pins the * consolida...
blitzcrieg1/agentmetry
apps/dashboard/tests/audit-source.test.ts
.ts
94f8544c318e7ba8
7.06
12
/** * Beta gate panel logic. * * The one behaviour worth pinning is restraint. A panel that shouts on day one, * when nothing is wrong and four weeks simply have not elapsed, gets ignored by * day three. `needsAttention` is what separates "not finished yet" from * "something needs you". */ import { describe, exp...
blitzcrieg1/agentmetry
apps/dashboard/tests/dogfood.test.ts
.ts
064cf6d9e72ebaf1
7.06
12
"""Agentmetry API — JSONL tail + external Tier B ingest.""" from __future__ import annotations from datetime import datetime, timedelta, timezone from pathlib import Path from typing import Any, Literal from fastapi import APIRouter, Depends, HTTPException, Query from fastapi.responses import FileResponse from pydan...
blitzcrieg1/agentmetry
apps/orchestrator/agentmetry/api/routes/audit.py
.py
0e070cda3f815142
7.56
12
"""WebSocket connection manager for real-time telemetry streaming.""" from __future__ import annotations import json from typing import Any from fastapi import WebSocket # Session id that mirrors every event; the dashboard subscribes to it to # observe autonomous runs that happen in other sessions. GLOBAL_SESSION ...
blitzcrieg1/agentmetry
apps/orchestrator/agentmetry/api/websocket.py
.py
cd4c1bbcbda1505b
7.56
12
"""Read Microsoft Agent Governance Toolkit audit files into the canonical trail. AGT governs agents you *build* -- Semantic Kernel, AutoGen, LangGraph, CrewAI -- and its `FileAuditSink` writes hash-chained, HMAC-signed JSONL. Agentmetry hooks agents you *use*. Reading their file closes the gap between the two without ...
blitzcrieg1/agentmetry
apps/orchestrator/agentmetry/core/audit/adapters/agt.py
.py
4cd33243d13912d0
7.56
12
"""Google SecOps (Chronicle) UDM envelope for Agentmetry canonical events. Chronicle normalises everything it stores into the Unified Data Model, and there are two ways to get there. You can post raw JSON to `unstructuredlogentries` and have a Config Based Normalization parser turn it into UDM, or you can post UDM dir...
blitzcrieg1/agentmetry
apps/orchestrator/agentmetry/core/audit/adapters/chronicle.py
.py
836f83b5857d8dd0
7.56
12
"""Map Agentmetry canonical events to CloudEvents v1.0 JSON envelopes. CloudEvents is a CNCF spec for describing an event's *envelope* -- who emitted it, what kind it is, when -- while leaving the payload alone. That is a good fit here: the canonical event is already the thing worth keeping, and this adds a routing he...
blitzcrieg1/agentmetry
apps/orchestrator/agentmetry/core/audit/adapters/cloudevents.py
.py
b0f22da7a5bd9453
7.56
12
"""Map Agentmetry canonical events to Elastic Common Schema (ECS) documents.""" from __future__ import annotations from datetime import datetime, timezone from typing import Any def _parse_timestamp(ts: str) -> str: if not ts: return datetime.now(timezone.utc).isoformat().replace("+00:00", "Z") retu...
blitzcrieg1/agentmetry
apps/orchestrator/agentmetry/core/audit/adapters/ecs.py
.py
66be2609cd6ba7b0
7.56
12
"""Splunk HEC envelope for Agentmetry canonical events.""" from __future__ import annotations from datetime import datetime, timezone from typing import Any def _epoch_seconds(ts: str) -> float: if not ts: return datetime.now(timezone.utc).timestamp() normalized = ts.replace("Z", "+00:00") try: ...
blitzcrieg1/agentmetry
apps/orchestrator/agentmetry/core/audit/adapters/splunk.py
.py
0b5e3d544e3e386a
7.56
12
"""Alerting engine for high-severity audit events.""" from __future__ import annotations import logging from typing import Any import httpx logger = logging.getLogger(__name__) class AlertWebhookSink: """Fires webhooks (Slack/Discord) for high-severity events.""" def __init__(self, url: str, *, timeout_s...
blitzcrieg1/agentmetry
apps/orchestrator/agentmetry/core/audit/alerts.py
.py
3058bc81e298f5aa
7.56
12
"""Map durable outbox rows to Agentmetry canonical events (schema v1.1.0).""" from __future__ import annotations import uuid from typing import Any from agentmetry.core.audit.atlas import attach_atlas from agentmetry.core.audit.hashing import arguments_sha256 from agentmetry.core.audit.identity import identity_field...
blitzcrieg1/agentmetry
apps/orchestrator/agentmetry/core/audit/canonical.py
.py
23f5a4b29307c520
7.56
12
"""Replay a corpus of recorded sessions and score the detection rules. Two things this exists for. **Catching the bugs unit tests cannot.** On 2026-07-25 two real defects shipped past 546 passing tests: sequence ordering was decided by a random UUID on a timestamp tie, and off-hours detection silently used UTC on Win...
blitzcrieg1/agentmetry
apps/orchestrator/agentmetry/core/audit/detection/benchmark.py
.py
0af6772abc9f0ee5
7.56
12
"""Detection engine — orders a session's events and runs the rule registry.""" from __future__ import annotations from datetime import datetime, timezone from typing import Any from .models import SEVERITY_RANK, Detection from .rules import HOST_REGISTRY, REGISTRY from .yaml_rules import build_yaml_rules _EPOCH = d...
blitzcrieg1/agentmetry
apps/orchestrator/agentmetry/core/audit/detection/engine.py
.py
1d2ccfa0f6676fa8
7.56
12
"""Live detection — correlate as events arrive, not only when someone asks. The rule engine is a pure function over a session's events. That is fine for a forensic query, but a detection nobody sees is not a control: until this module existed, a `credential-exfil` finding only appeared if an operator happened to open ...
blitzcrieg1/agentmetry
apps/orchestrator/agentmetry/core/audit/detection/live.py
.py
c43ef2cb3905c789
7.56
12
"""SQLite checkpoint for live detection — survives orchestrator restarts. Persists per-session event windows (bounded) and emitted rule IDs so a restart does not re-fire detections or lose correlation context for active sessions. """ from __future__ import annotations import json import logging import sqlite3 import...
blitzcrieg1/agentmetry
apps/orchestrator/agentmetry/core/audit/detection/live_store.py
.py
0a3dcdb90c5c9b4b
7.56
12
"""Core model benchmarks: forward pass, forward+backward, attention, MLP.""" from __future__ import annotations import torch from benchmarks.micro.runner import BenchmarkResult, print_results, run_benchmark from kempnerforge.config.model import ModelConfig from kempnerforge.model.transformer import Transformer # 12...
KempnerInstitute/KempnerForge
benchmarks/micro/bench_forward.py
.py
c4d16faf5585a637
7.65
19
"""Benchmark runner for KempnerForge. Provides timing utilities and a CLI to run all benchmarks and produce a results table. Uses CUDA events for accurate GPU timing. Usage: # Run all benchmarks uv run python benchmarks/micro/runner.py # Run a specific benchmark file uv run python benchmarks/micro/be...
KempnerInstitute/KempnerForge
benchmarks/micro/runner.py
.py
d2ebea3935be6fd5
7.65
19
"""Parse the H200 MFU sweep logs into a results table + scaling efficiency + pulse. Reads <results_dir>/*.log (one per benchmark config), extracts steady-state tok/s / MFU / mem / step_time (median over the BACK HALF of each run -- discards compile + thermal warmup), aggregates `_rN` repeats into mean +/- std, compute...
KempnerInstitute/KempnerForge
benchmarks/weak_scaling_160gpu/parse_results.py
.py
38a6139af17904d6
7.65
19
#!/usr/bin/env python3 """Prepare a COCO-captions dataset for VLM training, eval, or smoke testing. Reads the Karpathy-split COCO caption JSON(s) and writes an HF ``Dataset`` (single split) or ``DatasetDict`` (``--all-splits``) via ``save_to_disk``. The output directory is consumed by ``HuggingFaceVLMDataset`` through...
KempnerInstitute/KempnerForge
examples/vlm/data/prep_vlm_coco.py
.py
706c4a0ece45f8bd
7.65
19
# pyright: reportMissingImports=false # ^ lmms-eval is an optional, undeclared dependency; see adapter.py's directive. """Contract tests pinning the real ``lmms_eval`` API to what this example assumes. The VLM-eval unit tests run against an in-repo fake ``lmms_eval`` (``../unit/_fake_lmms_eval.py``) so they execute wi...
KempnerInstitute/KempnerForge
examples/vlm/eval/tests/integration/test_lmms_eval_contract.py
.py
d5ca28291697adc2
8.15
19
"""Integration tests for the KempnerForge VLM lmms-eval adapter. Three tests, all skipped when lmms-eval is absent (optional, undeclared dep): 1. ``test_dcp_roundtrip_generate_until`` — self-contained and CPU-only: builds a tiny VLM, saves it via DCP, then loads it back through ``KempnerForgeVLM`` and runs ``ge...
KempnerInstitute/KempnerForge
examples/vlm/eval/tests/integration/test_vlm_eval.py
.py
54ca30016261b06d
8.15
19
"""Hermetic fake ``lmms_eval`` for the VLM-eval unit tests. ``lmms-eval`` is an optional, undeclared dependency, so ``adapter.py`` cannot be imported without it and these tests would otherwise skip wherever it is absent. This conftest installs a faithful in-repo fake (``_fake_lmms_eval``) into ``sys.modules`` at impor...
KempnerInstitute/KempnerForge
examples/vlm/eval/tests/unit/conftest.py
.py
452dd8fd8b9969d0
7.15
19
"""Import isolation: ``import kempnerforge`` must not require lmms-eval. This example's adapter depends on the optional, undeclared ``lmms-eval`` package. Keeping the adapter here — outside ``kempnerforge/`` — is what keeps that dependency off the core package's import path; this test pins it. It runs in a fresh subpr...
KempnerInstitute/KempnerForge
examples/vlm/eval/tests/unit/test_import_isolation.py
.py
4f394cce5f738c97
7.15
19
#!/usr/bin/env python3 # pyright: reportMissingImports=false # ^ lmms-eval is an optional, undeclared dependency; see adapter.py's directive. """Run lmms-eval benchmarks on a KempnerForge VLM checkpoint. Evaluates a VLM checkpoint via the ``KempnerForgeVLM`` lmms-eval chat-model adapter (the sibling ``adapter.py``), o...
KempnerInstitute/KempnerForge
examples/vlm/eval/vlm_eval_harness.py
.py
262568e361c87e03
7.65
19
"""Tests for what this example ships: its configs and its entry point.""" from __future__ import annotations import importlib.util import sys import tomllib from collections.abc import Iterator from pathlib import Path from typing import Any import pytest from kempnerforge.config.loader import load_config EXAMPLE_...
KempnerInstitute/KempnerForge
examples/vlm/tests/test_configs.py
.py
1c5b127aa1d8f12b
8.15
19
"""Async checkpointing for non-blocking saves. Uses ``dcp.async_save()`` to snapshot state to CPU and write to disk in the background, returning control to the training loop immediately. Modes: - disabled: Synchronous save (simple, for debugging). - async: Standard async via dcp.async_save(). - async_with_pinne...
KempnerInstitute/KempnerForge
kempnerforge/checkpoint/async_save.py
.py
05ac237d7b31e4e8
7.65
19
"""Training state assembly for checkpointing. Collects the full training state — model, optimizer, scheduler, dataloader, training metadata, and RNG states — into a single dict for DCP save/load. RNG state capture ensures exact reproducibility on resume. """ from __future__ import annotations import logging import ...
KempnerInstitute/KempnerForge
kempnerforge/checkpoint/state.py
.py
c86db3744a4ab1ca
7.65
19
"""Adapter (connector) configuration. ``AdapterConfig`` selects which adapter the VLM wrapper instantiates and parameterizes the chosen adapter. Dispatched via the ``adapter`` registry at build time (see ``kempnerforge/model/adapter.py``). In TOML, ``[adapter]`` is a top-level section parallel to ``[model]``, ``[visi...
KempnerInstitute/KempnerForge
kempnerforge/config/adapter.py
.py
19eabda04f123211
7.65
19
"""Checkpoint configuration.""" from __future__ import annotations from dataclasses import dataclass, field from enum import StrEnum from typing import Literal from kempnerforge.config.registry import registry class AsyncCheckpointMode(StrEnum): disabled = "disabled" async_ = "async" async_pinned = "as...
KempnerInstitute/KempnerForge
kempnerforge/config/checkpoint.py
.py
5e9f1436259a45c3
7.65
19
"""Data pipeline configuration.""" from __future__ import annotations from dataclasses import dataclass, field @dataclass class DatasetSource: """A single data source in a multi-dataset mixture. Either ``path`` (pre-tokenized) or ``hf_name`` (HuggingFace) must be set. ``weight`` controls the relative s...
KempnerInstitute/KempnerForge
kempnerforge/config/data.py
.py
ecbe9190dd308a78
7.65
19
"""Distributed parallelism configuration.""" from __future__ import annotations from dataclasses import dataclass from enum import StrEnum class PipelineSchedule(StrEnum): schedule_1f1b = "1f1b" gpipe = "gpipe" interleaved_1f1b = "interleaved_1f1b" @dataclass class DistributedConfig: """Parallelis...
KempnerInstitute/KempnerForge
kempnerforge/config/distributed.py
.py
3151bad1d5fef005
7.65
19
"""Evaluation configuration.""" from __future__ import annotations from dataclasses import dataclass @dataclass class EvalConfig: """Evaluation pipeline settings (disabled by default).""" enabled: bool = False interval: int = 1000 # Eval every N training steps steps: int = 50 # Number of eval bat...
KempnerInstitute/KempnerForge
kempnerforge/config/eval.py
.py
0601d083406ec4fc
7.65
19
"""Top-level job configuration aggregating all sub-configs.""" from __future__ import annotations from dataclasses import dataclass, field from kempnerforge.config.adapter import AdapterConfig from kempnerforge.config.checkpoint import CheckpointConfig from kempnerforge.config.data import DataConfig from kempnerforg...
KempnerInstitute/KempnerForge
kempnerforge/config/job.py
.py
c1975b35babc2254
7.65
19
"""Config loading: TOML files → dataclass configs with CLI overrides. Loading pipeline: 1. Start with default JobConfig 2. Import the modules listed in the `plugins` key (registry side effects) 3. Load TOML file (if provided) and overlay 4. Apply CLI overrides (--model.dim=512 style) 5. Return JobConfig inst...
KempnerInstitute/KempnerForge
kempnerforge/config/loader.py
.py
b388c22ddfb8f916
7.65
19
"""Model architecture configuration.""" from __future__ import annotations import math from dataclasses import dataclass from enum import StrEnum class NormType(StrEnum): rmsnorm = "rmsnorm" layernorm = "layernorm" class Activation(StrEnum): silu = "silu" gelu = "gelu" relu = "relu" @datacla...
KempnerInstitute/KempnerForge
kempnerforge/config/model.py
.py
052050d1a61c17ac
7.65
19
"""Optimizer configuration.""" from __future__ import annotations from dataclasses import dataclass @dataclass class OptimizerConfig: """Optimizer settings.""" name: str = "adamw" lr: float = 3e-4 weight_decay: float = 0.1 betas: tuple[float, float] = (0.9, 0.95) eps: float = 1e-8 fused...
KempnerInstitute/KempnerForge
kempnerforge/config/optimizer.py
.py
17840aa78310d65c
7.65
19
"""Profiling configuration.""" from __future__ import annotations from dataclasses import dataclass @dataclass class ProfilingConfig: """Performance profiling settings.""" enable: bool = False start_step: int = 5 end_step: int = 8 trace_dir: str = "profiler_traces" def __post_init__(self) ...
KempnerInstitute/KempnerForge
kempnerforge/config/profiling.py
.py
498ef1757953b326
7.15
19
"""LR scheduler configuration.""" from __future__ import annotations from dataclasses import dataclass from enum import StrEnum class SchedulerType(StrEnum): cosine = "cosine" linear = "linear" wsd = "wsd" # warmup-stable-decay constant = "constant" # warmup then flat LR rex = "rex" # polynom...
KempnerInstitute/KempnerForge
kempnerforge/config/scheduler.py
.py
061245ce6952d281
7.65
19
"""Training configuration.""" from __future__ import annotations from dataclasses import dataclass from enum import StrEnum from typing import TYPE_CHECKING, Literal if TYPE_CHECKING: import torch class ActivationCheckpointing(StrEnum): none = "none" full = "full" selective = "selective" @datacla...
KempnerInstitute/KempnerForge
kempnerforge/config/training.py
.py
2d5e3a41facbca37
7.65
19
"""Video input configuration. ``VideoConfig`` is the ``[video]`` top-level section. When present, the job trains on a video dataset through the VLM wrapper: a clip is decoded into an ordered set of frames, each preprocessed like an image and fed to the vision encoder. The section is a sibling of ``[vision_encoder]`` /...
KempnerInstitute/KempnerForge
kempnerforge/config/video.py
.py
7064439268f4a310
7.65
19
"""Vision-encoder configuration. ``VisionEncoderConfig`` selects and parameterizes the vision encoder that the ``VLMWrapper`` composes alongside the text backbone and adapter. It is a top-level section in TOML (``[vision_encoder]``), sibling to ``[model]``, ``[adapter]``, and ``[vlm]``. Field summary: - ``type`` sel...
KempnerInstitute/KempnerForge
kempnerforge/config/vision.py
.py
26820b693fba9a65
7.65
19
#!/usr/bin/env python3 """Publish reviewed vendor icons for casks without an extractable app bundle.""" from __future__ import annotations import argparse import json import sys import tempfile from pathlib import Path from extract_icons import ( DEFAULT_UA, ICON_SIZE, REPO_ROOT, load_report, publ...
alielsokary/CaskFlow
scripts/curate_icons.py
.py
13bfbad02cd6974c
7.5
9
"""Shared shell/git helpers and icon-report state on the icons branch.""" # Leaf module: extract_icons.py and curate_icons.py build on these; this file # imports nothing back from them. from __future__ import annotations import json import subprocess from datetime import date from pathlib import Path REPO_ROOT = Path...
alielsokary/CaskFlow
scripts/icons_state.py
.py
3f9c5945c4ba2b4f
7.5
9
"""Provider-agnostic LLM clients with validated classification output.""" from __future__ import annotations import json import os import random import time from abc import ABC, abstractmethod from dataclasses import dataclass from prompts import ( CategoryCatalog, TRAIT_CATEGORIES, build_system_prompt, ...
alielsokary/CaskFlow
scripts/llm_client.py
.py
176e2c325e2767c8
7.5
9
#!/usr/bin/env python3 """Mine each cask's earliest addition timestamp (UTC) from Homebrew's git history.""" from __future__ import annotations import argparse import json import os import re import subprocess import sys import tempfile from datetime import datetime, timezone from pathlib import Path REPO_ROOT = Path...
alielsokary/CaskFlow
scripts/mine_added_dates.py
.py
89b43c41e856ef9f
7.5
9
"""Build classification prompts from the live catalog and boundary rules.""" from __future__ import annotations import json from dataclasses import dataclass from pathlib import Path TRAIT_CATEGORIES: frozenset[str] = frozenset({"ai"}) SCOPE_RULES: dict[str, str] = { "developerTools": ( "IDEs, code edi...
alielsokary/CaskFlow
scripts/prompts.py
.py
be69f886208c0a92
7.5
9
#!/usr/bin/env python3 """Normalize typographic slop out of authored prose and generated data.""" # Only slop is listed. Real content (CJK, emoji, accented Latin) and meaningful # notation (copyright, section, >=, arrows) are deliberately absent so they # survive untouched. Characters are built with chr() so this file ...
alielsokary/CaskFlow
scripts/style_standards.py
.py
13553a81a4416a5e
7.5
9
"""Tests for old_tokens rename migration in classify_new_casks.""" from __future__ import annotations from classify_new_casks import migrate_renames def _existing(*tokens: str) -> dict: return {"tokenToCategory": {t: {"primary": "utilities", "secondary": []} for t in tokens}} def test_rename_migrates_classific...
alielsokary/CaskFlow
tests/test_renames.py
.py
d944d00e4a244872
8
9
"""Repository-wide text style standard checks.""" # Slop characters are built with chr() on purpose: literal ones would make this # file fail its own guard. from __future__ import annotations import json import subprocess import unicodedata from pathlib import Path import style_standards REPO_ROOT = Path(__file__)....
alielsokary/CaskFlow
tests/test_style_standards.py
.py
53dea6c203ba4e2f
8
9
#!/usr/bin/env python3 """Tests for the pure helpers in bin/omarchy-jellyfin. The CLI has no .py extension (it is meant to be run, not imported), so it is loaded by path here. """ import contextlib import importlib.util import io import json import os import socket import stat import tempfile import threading import ...
andreas-bylund/omarchy-jellyfin-music-plugin
tests/test_jellyfin.py
.py
fe4d49e5d82305f5
7.02
10
// Personal-account dedupe must survive a service worker restart. // // The dedupe state was a module-level Map. Chrome stops an MV3 worker after // roughly thirty seconds idle and content.js checks every five minutes, so the // advertised six-hour window was in practice one flag per check. This test // evaluates backg...
AmanSK5/shadow-ai-guard
extension/tests/test_account_dedupe.js
.js
471dd7cb97912b38
7.07
13
// Payment card detector: real card formats only, not any run of digits. // // The detector fired on SVG path and polygon data. The old pattern allowed a // separator after every single digit, so `points="12 2 15 8 22 9 17 14"` was a // candidate, and Luhn passes 10% of arbitrary digit runs so it filtered almost // not...
AmanSK5/shadow-ai-guard
extension/tests/test_payment_card.js
.js
e1ff5a0dc5606923
7.07
13
// A paste-guard finding must survive the receiver being down. // // The guard warns or blocks locally whether or not anything is recorded, so a // failed POST costs no protection. It costs the audit trail, and that is the // half someone asks about weeks later: "did we stop a card number going into // ChatGPT, and whe...
AmanSK5/shadow-ai-guard
extension/tests/test_pending_queue.js
.js
d90080fc4dd823b4
7.07
13
"""Governance decisions: what an organisation decided about a tool. Separate from the registry on purpose. The registry answers "what is this tool and how do I detect it", and it ships with the project. Governance answers "what did this organisation decide about it", and it cannot ship with anything: an upstream proje...
AmanSK5/shadow-ai-guard
portal/app/governance.py
.py
785f2394cf0ac28c
7.57
13
"""The identity map as portal-managed state. It was the last piece of configuration that still needed kubectl: the portal generated the proposal and could not accept the corrected version back, so the loop ended at a ConfigMap. Same harness shape as the other managed-mode suites. """ import json import os os.environ...
AmanSK5/shadow-ai-guard
receiver/tests/test_identity_map.py
.py
463193a945845f8a
8.07
13
# Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 """Conformance scenario: a qwen-agent agent run that calls a tool. The tool actually runs, which is the point: an agent framework executes the call itself rather than handing it back, so the tool execution is a span of its own and not just a ...
open-telemetry/semantic-conventions-conformance
scenarios/gen-ai/python/qwen-agent/scenarios/automatic_tool_calling.py
.py
a9d3608f6dd4b092
7.45
7
#!/usr/bin/env python3 """One-shot migration: restructure docs to YADE-native 11-category tree. Moves every class JSON from the current 5-top-level layout (engines/bodies/materials/shapes/interactions/...) to a YADE-native 11-top-level layout rooted in YADE's class hierarchy: engine/ functor/ material/ shap...
yusong652/yade-mcp
scripts/restructure_docs.py
.py
c23c394ac71887e6
7.57
13
"""Runtime context collection from the bridge and injection into tool responses.""" import functools import logging from collections.abc import Awaitable, Callable from typing import Any from yade_mcp.bridge.client import get_bridge_client from yade_mcp.settings import is_debug_mode logger = logging.getLogger("yade-...
yusong652/yade-mcp
src/yade_mcp/bridge/context.py
.py
df2fd70e4c3875ac
7.57
13
"""Runtime configuration for YADE MCP server.""" import os from dataclasses import dataclass def _env_float(name: str, default: float) -> float: value = os.getenv(name) if value is None: return default try: return float(value) except ValueError: return default @dataclass(fro...
yusong652/yade-mcp
src/yade_mcp/config.py
.py
e2aaaa7aaa020735
7.57
13
"""Unified tool response envelope contracts with response size enforcement.""" from __future__ import annotations import json from typing import Any, Literal from pydantic import BaseModel, Field, model_validator # Serialized response cap: 2^17 chars ≈ 32k English tokens, a tokenizer-free # proxy sized so the large...
yusong652/yade-mcp
src/yade_mcp/contracts.py
.py
a3a5ac643bfc24d3
7.57
13
"""Unified document model for YADE search system.""" from dataclasses import dataclass, field from typing import Any @dataclass class SearchDocument: """A searchable document with multi-field content.""" name: str description: str keywords: list[str] category: str | None = None metadata: dic...
yusong652/yade-mcp
src/yade_mcp/knowledge/search/document.py
.py
445b7b825682c6d4
7.57
13
"""High-level YADE API search interface using BM25.""" import json from pathlib import Path from typing import Any from yade_mcp.knowledge.loader import APILoader from yade_mcp.knowledge.search.document import SearchDocument from yade_mcp.knowledge.search.indexing.bm25_indexer import BM25Indexer from yade_mcp.knowled...
yusong652/yade-mcp
src/yade_mcp/knowledge/search/engine.py
.py
aea97f1eedf32fab
7.57
13
"""Text tokenization for YADE search system. Handles CamelCase, underscores, dots, and YADE-specific naming conventions like Ig2_Sphere_Sphere_ScGeom, Law2_ScGeom_FrictPhys_CundallStrack. """ import re from yade_mcp.knowledge.search.preprocessing.stopwords import is_stopword class TextTokenizer: """Tokenizer f...
yusong652/yade-mcp
src/yade_mcp/knowledge/search/preprocessing/tokenizer.py
.py
2513d465e408b155
7.57
13
"""Task status query tool backed by yade-mcp-bridge.""" from typing import Any from fastmcp import FastMCP from yade_mcp.bridge import get_bridge_client from yade_mcp.bridge.context import with_context from yade_mcp.contracts import build_ok from yade_mcp.formatting import ( build_bridge_error, build_operati...
yusong652/yade-mcp
src/yade_mcp/tools/check_task_status.py
.py
5887c190d6e1d366
7.57
13
"""YADE execute_code tool — synchronous code execution in YADE process.""" from typing import Any from fastmcp import FastMCP from yade_mcp.bridge import get_bridge_client from yade_mcp.bridge.context import with_context from yade_mcp.contracts import build_ok from yade_mcp.formatting import build_bridge_error, buil...
yusong652/yade-mcp
src/yade_mcp/tools/execute_code.py
.py
9706a398a3bbd971
7.57
13
"""YADE task execution tool backed by yade-mcp-bridge.""" from typing import Any from fastmcp import FastMCP from yade_mcp.bridge import get_bridge_client from yade_mcp.bridge.context import with_context from yade_mcp.contracts import build_ok from yade_mcp.formatting import build_bridge_error, build_operation_error...
yusong652/yade-mcp
src/yade_mcp/tools/execute_task.py
.py
28b70010b62ad26b
7.57
13
"""Task interruption tool backed by yade-mcp-bridge.""" from typing import Any from fastmcp import FastMCP from yade_mcp.bridge import get_bridge_client from yade_mcp.bridge.context import with_context from yade_mcp.contracts import build_ok from yade_mcp.formatting import build_bridge_error, build_operation_error f...
yusong652/yade-mcp
src/yade_mcp/tools/interrupt_task.py
.py
8097af508c8f4b34
7.57
13
"""Task listing tool backed by yade-mcp-bridge.""" from typing import Any from fastmcp import FastMCP from yade_mcp.bridge import get_bridge_client from yade_mcp.bridge.context import with_context from yade_mcp.contracts import build_ok from yade_mcp.formatting import ( build_bridge_error, build_operation_er...
yusong652/yade-mcp
src/yade_mcp/tools/list_tasks.py
.py
97cfc1bb7e478327
7.57
13
"""YADE Python API Query Tool - Keyword search for API documentation.""" from typing import Any from fastmcp import FastMCP from yade_mcp.contracts import build_docs_data, build_ok from yade_mcp.knowledge.search import APISearch from yade_mcp.utils import PythonAPISearchQuery, SearchLimit def register(mcp: FastMCP...
yusong652/yade-mcp
src/yade_mcp/tools/query_api.py
.py
0d053ad72976d032
7.57
13
"""Validation models and utilities for YADE MCP tools.""" from pathlib import PurePosixPath, PureWindowsPath from typing import Annotated from pydantic import Field from pydantic.functional_validators import AfterValidator # Search limits DEFAULT_SEARCH_LIMIT = 10 MAX_SEARCH_LIMIT = 20 # Task/output pagination DEFA...
yusong652/yade-mcp
src/yade_mcp/utils.py
.py
2a11559ea8ea39d1
7.57
13
"""Tests for waitForBackgroundRun — the post-exec O.wait() that aligns task lifetime with cycling lifetime (fixes wait=False orphan cycling + silent-success bugs).""" import sys import types from unittest.mock import MagicMock import pytest from yade_mcp_bridge.execution.taskRunner import TaskRunner from yade_mcp_bri...
yusong652/yade-mcp
tests/bridge/test_background_run.py
.py
ad513efc4c15d87e
8.07
13
"""Tests for the shared execution error formatter. `formatExecutionError` is the one-and-only truth about how user-code exceptions get packaged for the LLM — filtering out YADE/bridge frames, capping the inline traceback, and handing off to an overflow log when the excerpt is truncated. Both execute_code and execute_t...
yusong652/yade-mcp
tests/bridge/test_error_helper.py
.py
681efe195819cdd0
8.07
13
"""Tests for TaskRunner's AsyncAbort path — the async-exc escape hatch that handles pure-Python deadloops that the flag/PyRunner path cannot reach.""" import sys import types from unittest.mock import MagicMock import pytest from yade_mcp_bridge.execution.taskRunner import TaskRunner from yade_mcp_bridge.runtime.sign...
yusong652/yade-mcp
tests/bridge/test_script_interrupt.py
.py
9e94c7fdb02a661a
8.07
13
"""Tests for bridge interrupt signal mechanism.""" import threading import time import pytest from yade_mcp_bridge.runtime.signals import ( clearCurrentTask, clearInterrupt, getCurrentTask, getExecThread, isTaskInterruptRequested, registerExecThread, requestInterrupt, setCurrentTask, ...
yusong652/yade-mcp
tests/bridge/test_signals.py
.py
fb569dffab43e5bf
8.07
13
"""Tests for the async-exception termination helpers.""" import threading import time import pytest from yade_mcp_bridge.execution.termination import AsyncAbort, injectAsyncException class TestInjectAsyncException: def test_terminates_tight_python_loop(self): """A pure Python loop hits a bytecode edge e...
yusong652/yade-mcp
tests/bridge/test_termination.py
.py
7f67375c90dc676a
8.07
13
"""Shared test fixtures. Provides an in-process bridge server fixture so the MCP client can be tested without a YADE runtime or the ``yade_mcp_bridge`` package. It speaks the same JSON-over-HTTP protocol as the real bridge (``POST /<command>`` for request/response plus a ``GET /events`` SSE stream); the response shape...
yusong652/yade-mcp
tests/conftest.py
.py
cea2797dca42f5a3
8.07
13
"""应用配置,从环境变量中加载。""" import os from dotenv import load_dotenv load_dotenv() def ensure_valid_api_key(api_key: str | None = None) -> str: """校验 API Key,拒绝空值或 .env.example 中的示例占位 Key。""" key = (api_key or settings.LLM_API_KEY or "").strip() lowered = key.lower() if not key or "your-api-key" in lowered...
ACDD49967/TRPG-AI-DM
backend/config.py
.py
aa133b519bc2ebfd
7.42
6
"""异步 SQLAlchemy 数据库引擎与会话工厂。""" from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine from sqlalchemy.orm import DeclarativeBase from backend.config import settings engine = create_async_engine(settings.DATABASE_URL, echo=False) async_session = async_sessionmaker(engine, class_=Asy...
ACDD49967/TRPG-AI-DM
backend/database.py
.py
d241cc2bd7d8da2a
7.42
6
"""DM 工具箱——固定程序工具,减少 LLM 自由发挥与 token 消耗。 包含: - 掷骰解析 - NPC 名字生成 - NPC 怪癖生成 - 遭遇难度参考 - 财宝掉落参考 - 知识库检索 """ from __future__ import annotations import random from typing import Any from backend.knowledge_base import get_knowledge_base def roll_dice(spec: str) -> int: """解析 '2d6+3' 并返回结果。""" import re m = r...
ACDD49967/TRPG-AI-DM
backend/dm_toolbox.py
.py
aba773978fcf874c
7.42
6
"""低成本后台剧情推进器。 目标: - 世界在玩家视线之外继续推进:暗线、重要人物、大事件的后续影响。 - 不占用玩家回合的叙事,不额外生成大段文本。 - 通过“低频触发 + 小 max_tokens + 精简 JSON”控制 token 消耗。 """ from __future__ import annotations import asyncio import json import re from typing import Any from openai import AsyncOpenAI from backend.config import ensure_valid_api_key, settings fr...
ACDD49967/TRPG-AI-DM
backend/engine/background_events.py
.py
b31932c06117f1a1
7.42
6
"""分层记忆系统——维持叙事一致性的核心组件。 三层记忆架构: 第1层 — 活跃上下文:最近N轮完整对话记录 第2层 — 摘要缓冲区:由旧轮次压缩而成的叙事摘要 第3层 — 向量长期记忆:关键事实(Phase 3 实现) 记忆系统将三层信息拼接为一个上下文块,注入每次 LLM 调用的 System Prompt。 """ from dataclasses import dataclass, field @dataclass class DialogueTurn: """一轮完整的玩家-DM交互记录。""" player_input: str # 玩家输入的行动 dm_re...
ACDD49967/TRPG-AI-DM
backend/engine/memory.py
.py
6483c354c482c006
7.42
6
"""DM 根据剧本大纲、角色背景与财宝规则生成起始金币。""" from __future__ import annotations import asyncio import json import re from openai import AsyncOpenAI from backend.config import ensure_valid_api_key, settings from backend.engine.game_systems import get_starting_gold STARTING_GOLD_PROMPT = """你是TRPG主持人。请严格阅读以下D&D 5e起始财富规则,然后根据剧本大纲...
ACDD49967/TRPG-AI-DM
backend/engine/starting_gold.py
.py
7657a5a409060eb8
7.42
6
"""SQLite 长期记忆存储——按 username 租户隔离,用于跨存档复用世界事实。""" from __future__ import annotations import sqlite3 from pathlib import Path DB_PATH = Path("data") / "long_term_memory.db" def _conn() -> sqlite3.Connection: DB_PATH.parent.mkdir(parents=True, exist_ok=True) conn = sqlite3.connect(str(DB_PATH)) conn.exec...
ACDD49967/TRPG-AI-DM
backend/long_term_memory.py
.py
ee6a95feed7e4a81
7.42
6
"""TRPG AI 跑团主持的 SQLAlchemy ORM 数据模型。""" import uuid from datetime import datetime from typing import Any from sqlalchemy import DateTime, Float, ForeignKey, Integer, String, Text from sqlalchemy.dialects.sqlite import JSON from sqlalchemy.orm import Mapped, mapped_column, relationship from backend.database import B...
ACDD49967/TRPG-AI-DM
backend/models.py
.py
a86135d200939779
7.42
6
"""An append-only, bounded local activity log — what actually happened, for the Activity page and for deciding which desktop notifications to fire. Structural/metadata only, the same boundary as everywhere else here: an event's `text` is a locally generated description (e.g. "Rotated Work Max → Personal Max"), never r...
DevDock-AI/claude-unlimited
claude_unlimited/activity.py
.py
cb5d9fdc7349b42a
7.45
7
from __future__ import annotations import json import os import threading from dataclasses import asdict, dataclass, field, replace from pathlib import Path from typing import List, Optional APP_DIR = Path.home() / ".claude-unlimited" CONFIG_FILE = APP_DIR / "config.json" # The isolated per-account login directories...
DevDock-AI/claude-unlimited
claude_unlimited/config.py
.py
d25019690275d843
7.45
7
"""Sends one minimal live request through a specific Profile's stored credential to confirm that account can serve traffic right now. Deliberately bypasses the Router: it tests the one Profile the caller asked about, not whichever Profile is currently eligible. Costs at most a handful of tokens (max_tokens=1, a one-wo...
DevDock-AI/claude-unlimited
claude_unlimited/connection_test.py
.py
814f5ed243554519
7.95
7
"""The one place a Profile "kind"'s identity is declared. See docs/ARCHITECTURE.md for the wider connector design. Without this registry, a kind's name lives in `_VALID_KINDS` / `_VALID_AUTH_MODES` in profiles.py plus a scattering of `if p.kind == "..."` branches, and adding one means grepping for every existing kind ...
DevDock-AI/claude-unlimited
claude_unlimited/connectors.py
.py
432fd71ed02ed5b0
7.45
7
"""Daemon install/auto-start interface: install/uninstall/is_installed/status/ start/stop. The single point that knows which OS backend to use — every other module imports THIS package, never a specific backend module. See docs/adr/0002-pluggable-secret-store-and-daemon-installer.md. Supporting a new OS means adding a ...
DevDock-AI/claude-unlimited
claude_unlimited/daemon_installer/__init__.py
.py
ebe16ede4ed87c51
7.45
7