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
"""Tests for Prometheus metrics collectors.""" import pytest from app.prometheus_metrics import ( active_exports, avg_strictdoc_export_time_seconds, increment_export_failure, increment_export_success, observe_export_duration, observe_request_body_size, observe_response_body_size, stric...
SchweizerischeBundesbahnen/strictdoc-service
tests/test_prometheus_metrics.py
.py
081198962645968e
7.98
8
"""Tests for the sanitization module.""" import pytest from pathvalidate import sanitize_filename from app.sanitization import ( normalize_line_endings, sanitize_for_logging, ) class TestSanitizeForLogging: """Test cases for sanitize_for_logging function.""" def test_normal_text(self) -> None: ...
SchweizerischeBundesbahnen/strictdoc-service
tests/test_sanitization.py
.py
0b09361b71ba731e
7.98
8
"""Tests for uvloop compatibility. uvloop is required for optimal async performance with uvicorn. These tests verify uvloop is properly installed and functional. """ import sys import pytest def test_uvloop_must_be_available() -> None: """Test that uvloop is available and can be imported. uvloop is a hard...
SchweizerischeBundesbahnen/strictdoc-service
tests/test_uvloop_compatibility.py
.py
d0640c4dcee040d0
7.98
8
"""Agent configuration utilities. Utilities for agent overlay merging and validation. Agents are loaded via bundles (amplifier-foundation). """ import copy import logging from typing import Any from .lib.merge_utils import merge_agent_dicts logger = logging.getLogger(__name__) def apply_spawn_tool_policy(parent: ...
microsoft/amplifier-app-cli
amplifier_app_cli/agent_config.py
.py
e62c00c32149531e
7.64
18
"""CLI approval provider for interactive user approval.""" from __future__ import annotations import asyncio import logging from amplifier_core import ApprovalRequest from amplifier_core import ApprovalResponse from rich.console import Console from rich.panel import Panel from rich.prompt import Confirm from .stdin...
microsoft/amplifier-app-cli
amplifier_app_cli/approval_provider.py
.py
51805320c131c4c4
7.64
18
"""BBS-style ANSI art banners for interactive sessions. Uses the ansiterm library for authentic 90s-style ANSI art rendering. Philosophy alignment: - Ruthless simplicity: Just render .ANS files, no complex generation - Mechanism, not policy: ansiterm handles rendering, we handle file selection - Modular design: Separ...
microsoft/amplifier-app-cli
amplifier_app_cli/banners/__init__.py
.py
a48bd0a177c317bf
7.64
18
"""Interactive terminal UI components for reset command. Provides a checklist interface for user selection using raw terminal codes. Zero external dependencies beyond stdlib - keeps the reset command self-contained even during self-uninstall scenarios. Example: >>> from .reset_interactive import run_checklist, Ch...
microsoft/amplifier-app-cli
amplifier_app_cli/commands/reset_interactive.py
.py
b54e748ba8f0742c
7.64
18
"""Shared Rich console instance for CLI output.""" from rich.console import Console from rich.console import ConsoleOptions from rich.console import RenderResult from rich.errors import MarkupError from rich.markdown import CodeBlock as RichCodeBlock from rich.markdown import Heading as RichHeading from rich.markdown ...
microsoft/amplifier-app-cli
amplifier_app_cli/console.py
.py
0bd3fab463fc6aec
7.64
18
"""Restore cumulative session cost on resume (issue #284). Session LLM cost is accumulated **in-memory** in each provider module's ``mount()`` closure (a ``_totals`` dict) and contributed to the kernel's ``session.cost`` channel. When a session is resumed the provider re-mounts with that accumulator back at zero, so t...
microsoft/amplifier-app-cli
amplifier_app_cli/cost_history.py
.py
e05f5c7080d255e0
7.64
18
"""Effective configuration summary utilities. Extracts display-friendly information from resolved configuration. """ from __future__ import annotations import logging from dataclasses import dataclass from typing import Any logger = logging.getLogger(__name__) @dataclass class EffectiveConfigSummary: """Summa...
microsoft/amplifier-app-cli
amplifier_app_cli/effective_config.py
.py
04fdbb00785a0ed4
7.64
18
"""Console rendering for the /goal auto-continue loop's progress events. The auto-continue loop itself lives in the orchestrator (loop-streaming's StreamingOrchestrator.execute()) rather than the app layer -- see docs/GOAL_COMMAND.md. The orchestrator emits an ``orchestrator:goal_progress`` event instead of writing to...
microsoft/amplifier-app-cli
amplifier_app_cli/goal_progress_hook.py
.py
7d9e2642b7d4ebb4
7.64
18
"""Incremental session save hook for transcript persistence. Saves transcript.jsonl after each tool completion (tool:post event), providing crash recovery between tool calls rather than just between turns. This is a non-blocking hook that uses the existing SessionStore for atomic writes. """ from __future__ import a...
microsoft/amplifier-app-cli
amplifier_app_cli/incremental_save.py
.py
446c22fed24b2dcc
7.64
18
"""API key management for Amplifier.""" import os import platform import tempfile from pathlib import Path from filelock import FileLock class KeyManager: """Manage API keys in ~/.amplifier/keys.env file.""" def __init__(self): self.keys_file = Path.home() / ".amplifier" / "keys.env" # Advi...
microsoft/amplifier-app-cli
amplifier_app_cli/key_manager.py
.py
a382ad595eb76e25
7.64
18
"""Bundle preparation utilities for CLI app layer. Bridges CLI discovery (search paths, packaged bundles) with foundation's prepare workflow (load → compose → prepare → create_session). This module enables the critical missing step: downloading and installing modules from git sources before session creation. """ fro...
microsoft/amplifier-app-cli
amplifier_app_cli/lib/bundle_loader/prepare.py
.py
ca034d831bb46fb3
7.64
18
"""User bundle registry - DEPRECATED. This module is deprecated. User-added bundles are now stored in ~/.amplifier/settings.yaml under bundle.added, consolidating all user configuration in one place. Migration happens automatically when get_added_bundles() is called. Use AppSettings instead: from amplifier_app_c...
microsoft/amplifier-app-cli
amplifier_app_cli/lib/bundle_loader/user_registry.py
.py
a20a74f9c4c09e51
7.64
18
"""App-layer mention resolver that extends foundation's BaseMentionResolver. This module demonstrates the proper pattern for extending foundation mechanisms: - Foundation provides the mechanism (bundle namespace resolution) - App provides policy (shortcuts, resolution order) Per KERNEL_PHILOSOPHY: Foundation provides...
microsoft/amplifier-app-cli
amplifier_app_cli/lib/mention_loading/app_resolver.py
.py
3fcaf26daa62f8ce
7.64
18
"""Merge utilities for configurations. This module provides app-level policy for how configs should be merged: - Tool configs: permission fields are UNIONED rather than replaced - Profile/agent configs: module lists merged by module ID - General: deep merge with overlay winning """ from typing import Any # ===== Mo...
microsoft/amplifier-app-cli
amplifier_app_cli/lib/merge_utils.py
.py
f2c1f90c95f8a0f5
7.64
18
"""Module source utilities. This module provides FileSource and GitSource classes for module resolution. These are used by module management commands and update utilities. """ from __future__ import annotations import hashlib import json import logging import os import re import subprocess import urllib.error import...
microsoft/amplifier-app-cli
amplifier_app_cli/lib/sources_compat.py
.py
08107f0a5dd664ae
7.64
18
"""Shared, live-instance provider diagnostics primitives. These are the reusable mechanics behind "does this provider answer" and "what models does it offer" -- the SAME questions ``amplifier provider test``/``amplifier provider models`` answer for disk-config providers (via ``provider_loader.get_provider_models``, wh...
microsoft/amplifier-app-cli
amplifier_app_cli/provider_diagnostics.py
.py
95ad15315361f57c
7.64
18
"""Provider detection from environment variables.""" import os from importlib.metadata import entry_points from .provider_sources import is_provider_module_installed # Known credential env vars for each provider # Module name -> list of env vars that indicate the provider is configured PROVIDER_CREDENTIAL_VARS: dict...
microsoft/amplifier-app-cli
amplifier_app_cli/provider_env_detect.py
.py
54cd79925a6b8168
7.64
18
"""Provider loading utilities for configuration. Provides lightweight provider loading for configuration commands without requiring a full session/coordinator setup. """ import asyncio import importlib import importlib.metadata import logging import os from typing import TYPE_CHECKING from typing import Any from .pr...
microsoft/amplifier-app-cli
amplifier_app_cli/provider_loader.py
.py
a457530a4176248a
7.64
18
"""Distribution metadata checks.""" import re import unittest from pathlib import Path class TestPackageMetadata(unittest.TestCase): def test_distribution_version_matches_import_version(self): import omnimedai text = Path("pyproject.toml").read_text(encoding="utf-8") match = re.search(r'...
OminiMedAI/OmniMedAI
omnimedai/test_metadata.py
.py
d9078d4b06df1746
7.92
6
"""Configuration settings for model evaluation.""" from dataclasses import dataclass from typing import Dict @dataclass class EvaluationConfig: """Configuration for evaluation metrics.""" task: str = "classification" average: str = "weighted" positive_label: int = 1 include_confusion_matrix: boo...
OminiMedAI/OmniMedAI
onem_eval/config/settings.py
.py
6a10b91700af154d
7.42
6
"""Multimodal feature alignment and fusion helpers.""" from typing import Dict, Iterable, Optional from .config.settings import FusionConfig def _require_pandas(): try: import pandas as pd except ImportError as exc: raise ImportError("pandas is required for feature fusion. Install with: pip ...
OminiMedAI/OmniMedAI
onem_fusion/fusion.py
.py
087037b756b6a5f5
7.42
6
""" 生态分析配置管理模块 """ import json from pathlib import Path from typing import Dict, Any, Optional, Union, List, Tuple from dataclasses import dataclass, asdict @dataclass class HabitatConfig: """生态分析配置""" # 特征提取配置 kernel_size: Tuple[int, int, int] = (5, 5, 5) feature_types: List[str] = None bin...
OminiMedAI/OmniMedAI
onem_habitat/config/settings.py
.py
a4109897d3bf763b
7.42
6
""" onem_habitat 使用示例 """ import os import numpy as np from pathlib import Path # 导入主要模块 from onem_habitat.radiomics import LocalRadiomicsExtractor from onem_habitat.clustering import FeatureClustering from onem_habitat.segmentation import MaskRefiner from onem_habitat.config import HabitatConfig, HabitatConfigManage...
OminiMedAI/OmniMedAI
onem_habitat/example_usage.py
.py
1713804a551bc6a8
7.42
6
""" onem_habitat 基础测试 """ import unittest import tempfile import shutil import numpy as np from pathlib import Path # 尝试导入,处理依赖缺失情况 try: from onem_habitat.radiomics import LocalRadiomicsExtractor from onem_habitat.clustering import FeatureClustering from onem_habitat.segmentation import MaskRefiner fr...
OminiMedAI/OmniMedAI
onem_habitat/test_basic.py
.py
f02ba1c08dbf2326
7.92
6
""" Example usage of onem_path module This script demonstrates how to use onem_path module for pathology image feature extraction using CellProfiler and TITAN deep transfer learning. """ import os import sys import logging from pathlib import Path # Add parent directory to path for imports sys.path.insert(0, str(Pat...
OminiMedAI/OmniMedAI
onem_path/example_usage.py
.py
ab189211e2009579
7.42
6
"""Alembic migration environment. Supports two database backends: - PostgreSQL (pg8000): Default for cloud deployments - SQLite: For local/self-hosted deployments PostgreSQL mode: - Uses GCP Cloud SQL connector for production - Uses pg8000 driver (sync) for Alembic migrations - Uses advisory locks for safe concurrent...
OpenHands/automation
migrations/env.py
.py
0aa1e043c782ffce
7.62
16
"""Initial schema: automations and automation_runs tables. All timestamp columns use TIMESTAMP WITH TIME ZONE (timestamptz) to enforce UTC at the database level. PostgreSQL normalizes all values to UTC on write. Cross-database compatible: works with both PostgreSQL and SQLite. Revision ID: 001 Revises: None Create D...
OpenHands/automation
migrations/versions/001_initial_schema.py
.py
9db1a5427eb667d5
7.62
16
"""Add tarball_uploads table for storing upload metadata. Cross-database compatible: works with both PostgreSQL and SQLite. Revision ID: 002 Revises: 001 Create Date: 2026-03-20 """ from collections.abc import Sequence from alembic import op from sqlalchemy import BigInteger, Column, DateTime, String, Text, Uuid, t...
OpenHands/automation
migrations/versions/002_tarball_uploads.py
.py
b8c1e2a7c85c3aef
7.62
16
"""Add event-based trigger support. This migration adds: 1. custom_webhooks table for storing custom webhook integrations (Note: Built-in integrations like github/gitlab don't use this table) 2. event_payload column to automation_runs for storing trigger payloads 3. signature_header column to custom_webhooks for co...
OpenHands/automation
migrations/versions/003_event_triggers.py
.py
a86c5cd243ef6d22
7.62
16
"""Add prompt column to automations table. This migration adds a nullable prompt column to the automations table so the prompt text is stored directly on the record and returned via API, rather than only being embedded in the tarball. Revision ID: 004 Revises: 003 Create Date: 2026-04-16 """ from collections.abc imp...
OpenHands/automation
migrations/versions/004_add_prompt_column.py
.py
a4d8b76669739f91
7.62
16
"""Add bash_command_id column to automation_runs table. Records the agent-server BashCommand id assigned when an automation's bash chain is dispatched. The verifier (watchdog) uses it to filter BashOutput events by ``command_id__eq=<hex>`` so it picks up *this run's* output rather than whatever BashOutput happened to ...
OpenHands/automation
migrations/versions/005_add_bash_command_id.py
.py
622e08c8bc4becd2
7.62
16
"""Add model column to automations table. Revision ID: 006 Revises: 005 Create Date: 2026-05-16 """ from collections.abc import Sequence import sqlalchemy as sa from alembic import op revision: str = "006" down_revision: str = "005" branch_labels: str | Sequence[str] | None = None depends_on: str | Sequence[str] |...
OpenHands/automation
migrations/versions/006_add_model.py
.py
6c646f1d9b228f18
7.62
16
"""Move sandbox cleanup configuration to automations. Revision ID: 009 Revises: 008 Create Date: 2026-06-24 """ from collections.abc import Sequence import sqlalchemy as sa from alembic import op revision: str = "009" down_revision: str = "008" branch_labels: str | Sequence[str] | None = None depends_on: str | Seq...
OpenHands/automation
migrations/versions/009_add_sandbox_cleanup_policy.py
.py
d2fdaabe088b82c8
7.62
16
"""Add index on automation_runs.automation_id. Revision ID: 010 Revises: 009 Create Date: 2026-07-21 """ from collections.abc import Sequence from alembic import op revision: str = "010" down_revision: str = "009" branch_labels: str | Sequence[str] | None = None depends_on: str | Sequence[str] | None = None def ...
OpenHands/automation
migrations/versions/010_add_automation_id_index.py
.py
15922f8b615b0348
7.62
16
"""Add telemetry attribution to automations and runs. Revision ID: 012 Revises: 011 Create Date: 2026-07-26 """ from collections.abc import Sequence import sqlalchemy as sa from alembic import op revision: str = "012" down_revision: str = "011" branch_labels: str | Sequence[str] | None = None depends_on: str | Seq...
OpenHands/automation
migrations/versions/012_add_telemetry_attribution.py
.py
20238c7442d95d3c
7.62
16
"""Add cost column to automation_runs table. Revision ID: 013 Revises: 012 Create Date: 2026-07-26 """ from collections.abc import Sequence import sqlalchemy as sa from alembic import op revision: str = "013" down_revision: str = "012" branch_labels: str | Sequence[str] | None = None depends_on: str | Sequence[str...
OpenHands/automation
migrations/versions/013_add_run_cost.py
.py
d639403010064910
7.62
16
"""Add preset_metadata column to automations table. This migration adds a nullable preset_metadata JSON column to the automations table so preset endpoints can record the configuration used to build the automation (preset type, prompt, plugins, repos) for the UI to consume. Custom SDK automations leave it NULL. Revis...
OpenHands/automation
migrations/versions/014_add_preset_metadata.py
.py
69c48510ebb2f672
7.62
16
"""Add run_metadata column to automation_runs. Stores additional execution metadata captured after a run completes, such as structured semantic task outcomes parsed from preset conversation finish actions. Revision ID: 017 Revises: 016 Create Date: 2026-08-12 """ from collections.abc import Sequence import sqlalche...
OpenHands/automation
migrations/versions/017_add_run_metadata.py
.py
c06fb429446767c6
7.62
16
"""Authentication for the automations service API. Supports three authentication methods (checked in order): 1. API key via Authorization: Bearer header 2. API key via X-Session-API-Key header (matches agent-server convention, useful behind reverse proxies that overwrite the Authorization header) 3. Cookie: keycloa...
OpenHands/automation
openhands/automation/auth.py
.py
c929da945e8d6d78
7.62
16
"""Cloud sandbox execution backend. Creates a fresh Cloud sandbox for each automation run. """ from __future__ import annotations import asyncio import logging from collections.abc import Awaitable, Callable from typing import TYPE_CHECKING, Any, TypeVar import httpx from tenacity import ( before_sleep_log, ...
OpenHands/automation
openhands/automation/backends/cloud.py
.py
a45a00e41ae2b64a
7.62
16
"""Local agent-server execution backend. Uses a pre-configured local agent server instead of creating Cloud sandboxes. """ from __future__ import annotations import logging import os from typing import TYPE_CHECKING import httpx from openhands.automation.backends.base import ExecutionBackend, ExecutionContext from...
OpenHands/automation
openhands/automation/backends/local.py
.py
0c495c96c9efdfb2
7.62
16
"""Capability discovery and preflight validation for automation setup UIs. A setup UI needs two answers before it creates anything: what this deployment supports, so it never offers an option that cannot work, and whether a draft is acceptable, so a bad configuration is caught before an automation exists. Neither endp...
OpenHands/automation
openhands/automation/capabilities_router.py
.py
37e10369bdfb8117
7.62
16
"""Database engine and session management. Supports two database backends: - PostgreSQL (asyncpg): Default for cloud deployments - SQLite (aiosqlite): For local/self-hosted deployments The backend is selected based on the AUTOMATION_DB_URL setting: - If db_url starts with "sqlite": Use SQLite - Otherwise: Use Postgre...
OpenHands/automation
openhands/automation/db.py
.py
992144dfda7d5bbf
7.62
16
""" Event router for receiving webhook events and triggering automations. Endpoint: POST /v1/events/{org_id}/{source} Built-in sources (github) verify signatures using the shared secret from the OpenHands server. Custom sources verify using per-org webhook secrets. Security Notes: - Rate limiting should be appli...
OpenHands/automation
openhands/automation/event_router.py
.py
296b3b684449219a
7.62
16
""" Event schema module for webhook event processing. This module provides: 1. `WebhookEvent` base class for typed event payloads 2. `parse_event()` function to parse payloads from any source Each source (GitHub, Linear, etc.) has its own WebhookEvent subclass. Unknown sources automatically get `CustomWebhookEvent`. ...
OpenHands/automation
openhands/automation/event_schemas/__init__.py
.py
9b1e949fd64faf59
7.62
16
"""Bitbucket Data Center webhook event parsing.""" from typing import Any, ClassVar from pydantic import Field, computed_field from openhands.automation.event_schemas import WebhookEvent class BitbucketDataCenterEvent(WebhookEvent): """Bitbucket Data Center webhook event. Bitbucket Data Center exposes the...
OpenHands/automation
openhands/automation/event_schemas/bitbucket_data_center.py
.py
f9518fe7926aa677
7.62
16
""" Custom webhook event for user-defined webhook integrations. Custom webhooks have minimal structure requirements - the payload is stored as-is and users define how to extract the event_key using JMESPath. Example event_key_expr values: - "type" # Simple field access - "event.type" ...
OpenHands/automation
openhands/automation/event_schemas/custom.py
.py
d513f650fe62c967
7.62
16
""" Event type detection using JMESPath expressions. This module provides declarative, data-driven event type detection. Detection rules are defined as (event_type, jmespath_expr) tuples, evaluated in order. The first matching rule determines the event type. Example: >>> from openhands.automation.event_schemas.de...
OpenHands/automation
openhands/automation/event_schemas/detection.py
.py
85b05e3863eb761b
7.62
16
"""Jira Data Center webhook event parsing.""" from typing import Any, ClassVar from pydantic import Field, computed_field from openhands.automation.event_schemas import WebhookEvent class JiraDcEvent(WebhookEvent): """Jira Data Center webhook event. Jira DC exposes the event identity in the top-level ``we...
OpenHands/automation
openhands/automation/event_schemas/jira_dc.py
.py
6f7afd1ed539d652
7.62
16
"""Async wrapper around the `git` CLI. Commands run via `create_subprocess_exec` with an argument list, never a shell string. The auth token goes per-invocation through `-c http.extraHeader`, so it reaches neither the checkout nor a log line; credentials an operator embeds in the repo URL are ordinary arguments, so `r...
OpenHands/automation
openhands/automation/git_sync/client.py
.py
d79e2b0864eaee28
7.62
16
"""FastAPI router for the git sync status/config/trigger API.""" import asyncio import logging from datetime import datetime from typing import Final from fastapi import APIRouter, Depends, HTTPException, Request, status from sqlalchemy import func, select from sqlalchemy.ext.asyncio import AsyncSession, async_sessio...
OpenHands/automation
openhands/automation/git_sync/router.py
.py
3265ba9157c2138e
7.62
16
"""Pydantic schemas for the git sync status API.""" from pydantic import BaseModel, Field, field_validator from openhands.automation.config import normalize_git_sync_path from openhands.automation.utils.time import UtcDatetime class GitSyncStatusResponse(BaseModel): enabled: bool repo_url: str branch: s...
OpenHands/automation
openhands/automation/git_sync/schemas.py
.py
8300816fe66e4dde
7.62
16
"""Regenerate the app icon (pinball_decryptor/icon.png + icon.ico). The artwork (rounded tile, metallic pinball, red flippers, dark gradient) is kept as-is from the existing icon.png; only the top wordmark is redrawn. Run after changing WORDMARK below: python installer/make_icon.py Needs Pillow. The macOS/Linux bu...
davidvanderburgh/pinball-asset-decryptor
installer/make_icon.py
.py
c303c11ad05fa43a
7.56
12
"""Administrator-privilege detection. Direct-SSD mode needs Administrator privileges on Windows because both ``Set-Disk -IsOffline`` and ``wsl --mount <physical drive>`` fail with elevation errors otherwise. The GUI uses :func:`is_admin` to gate the Direct-SSD UI (warning banner + disabled Extract / Apply Modificatio...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/admin.py
.py
ae5ddad65526ca6a
7.56
12
"""Best-effort audio-slot categories for the Replace Audio "Type" filter. Four buckets cover what the naming pipelines can tell apart (a tester's "working on callouts, hide everything else"): * ``music`` — jukebox/bank tracks: ``music_cat``-stem decodes, files the transcriber isolation-tagged " - ...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/audio_categories.py
.py
6f9c046844ef447c
7.56
12
"""Per-sound diff between two extract folders — the audio half of the Compare report. WHY THIS EXISTS. The Compare tab reads the two CARDS, and a card's packed audio is one opaque blob (``image.bin``) whose per-sound layout only exists once the booted firmware has handed it out — i.e. after an Extract. So the report...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/audio_compare.py
.py
5af32af7fd8e71a0
7.56
12
"""Baseline checksum generation and reading — shared across plugins. Each plugin's Extract pipeline calls :func:`generate_checksums` to write ``.checksums.md5`` next to the extracted files. Write pipelines and mod-pack export use :func:`read_checksums` to diff against the baseline. """ import hashlib import os impor...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/checksums.py
.py
bdde092ea07dd0fd
7.56
12
"""Handing URLs and files off to the desktop (browser, file manager). Why this exists instead of a bare ``webbrowser.open``: inside a frozen build the environment we hand a child process is *our* environment, and both PyInstaller and the AppImage runtime rewrite it to point inside the bundle — ``LD_LIBRARY_PATH`` at o...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/desktop.py
.py
7ec58e2fcd752055
7.56
12
"""Records which source image an extract came from, so the GUI can warn when the underlying image is swapped/reverted *after* assets were extracted. The "Original Track / Image / Text" names the Replace tabs show come from the files in the extract *output* folder, not from the source ``.raw``/``.img``. If a user rever...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/extract_source.py
.py
8c5ac57c8d45b074
7.56
12
"""Size+mtime-keyed MD5 cache for change scans. The Write tab's change scan and the mod-pack export both MD5 every baseline file to find the changed ones — minutes of re-hashing on big or networked folders even when almost nothing changed since the last walk (a tester batch 14). This sidecar remembers each file's ``(...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/hashcache.py
.py
5ae9e952828ef6ce
7.56
12
"""Append-only, human-readable history of what the user changed in an assets folder — every replacement pick/re-pick/clear (with the old and new source file), staged default-settings edits, builds and reverts, each stamped with date and time. The session log already says these things, but it is a rolling record of one...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/history_log.py
.py
107ec7cd114020bf
7.56
12
"""Windows temp-dir cleanup for the host-side staging the app leaves behind. Several code paths stage on the Windows drive via ``tempfile.gettempdir()`` (normally ``%TEMP%`` = ``C:\\Users\\<you>\\AppData\\Local\\Temp``), independently of WSL. Most use context managers and auto-delete, but bare ``mkdtemp()`` dirs can ...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/host_temp.py
.py
119e194765acf105
7.56
12
"""Thread-safe message types passed from pipelines to the Tk main loop.""" class LogMsg: def __init__(self, text, level="info"): self.text = text self.level = level class LinkMsg: def __init__(self, text, url): self.text = text self.url = url class PhaseMsg: def __init_...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/messages.py
.py
206d99eeee79d297
7.56
12
"""The known-projects registry — what the Project menu's Recent list and the Projects… manager window show. Pure functions over the app's settings dict (the App owns persistence — every mutator here rides on the caller's ``_save_settings()``). The list is only ever fed by folders the app has actually anchored or open...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/project_registry.py
.py
c281973ea4e28736
7.56
12
"""Persists the user's pending (un-written) Replace-Audio/Video/Image assignments into the assets folder, so they survive quitting and re-opening the app. The Replace tabs hold each assignment in memory only — ``rel_path -> replacement source file`` — and apply them at Write time; there is no manual "stage" step. Wit...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/staged_changes.py
.py
b681eec94c37b70c
7.56
12
"""Pristine-original snapshot cache, so a staged edit can be reverted without re-extracting the whole card. The Replace tabs apply edits by writing the converted replacement *over* the extracted file in the assets folder (see ``core.audio_slots.stage_replacements`` and its video/image twins) — the Write pipeline then ...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/staged_originals.py
.py
b79e6e8776902401
7.56
12
"""A cross-extract library of the user's renamed image-group tags. Image-group tags (the "Rename group…" names in Replace Images) are stored per extract folder in that folder's ``.staged_changes.json`` sidecar, keyed by the group's container identity (``rad::`` / ``scn::`` / ``dir::``). A brand-new extract folder has...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/tag_library.py
.py
4575293c6b209b30
7.56
12
"""Tar-related helpers used by .upd-style pipelines.""" import os def safe_member(member, dest_dir): """Return *member* if it's safe to extract; None otherwise. Rejects absolute paths, drive letters, and ``..`` traversal. """ name = member.name if not name: return None if name.starts...
davidvanderburgh/pinball-asset-decryptor
pinball_decryptor/core/tar_utils.py
.py
d81b362596ec2d15
7.56
12
""" Seed a local NetBox instance with the lab's 26 devices. Run AFTER `docker compose -f docker-compose.netbox.yml up -d` and after NetBox has finished its initial migration (~60s on first boot): python3 network-lab/seed_netbox.py Reads inventory.json, creates sites + device-roles + manufacturers + device-types ...
gesh75/multivendor-ai-network-lab
network-lab/seed_netbox.py
.py
a1dc18359f350959
7.54
11
"""Vendor command tables + alias map for the driver layer. Migrated verbatim from ``src/health.py`` COMMAND_MAP so the drivers package is self-contained (no import of the 25K-line health/app surface). Order matters within a section: the first command that returns useful output wins, so JSON variants come before text f...
gesh75/multivendor-ai-network-lab
src/drivers/commands.py
.py
697fde7fa1489f71
7.54
11
"""Driver factory — resolve a vendor (any alias) to a wired-up driver. ``get_driver`` picks the concrete driver class for a vendor and auto-selects a transport: * ``transport=`` given → use it as-is. * ``container=`` given → DockerExecTransport. * ``runner=`` given → SSHRunnerTransport (...
gesh75/multivendor-ai-network-lab
src/drivers/factory.py
.py
4a85c144a4ca3d71
7.54
11
"""Cisco IOS-XR driver. IOS-XR JSON (`| json`) support is version-dependent (7.x+) and often partial, so the command table leads with JSON then falls back to text — and the parsers lean on the standard Cisco-style text tables (which `parse_bgp`/`parse_ospf` already handle via their text fallback). Interfaces use an XR...
gesh75/multivendor-ai-network-lab
src/drivers/iosxr.py
.py
682e0e10923504e9
7.54
11
"""Juniper Junos (cli / display json) driver. Junos ``| display json`` emits a deeply-nested ``[{"data": value}]`` schema; the parsers in :mod:`drivers.parsers` unwrap it via ``_jv``. Junos devices are typically reached over SSH (Scrapli/NETCONF) rather than docker-exec — use ``get_driver("junos", runner=...)`` or a S...
gesh75/multivendor-ai-network-lab
src/drivers/junos.py
.py
d92e223736441ad4
7.54
11
"""DriverResult — the single immutable return shape for every driver command. Every concrete driver method (get_bgp_summary, run_command, …) returns one of these. It pairs the *raw* device output with a vendor-neutral *normalized* dict so callers can choose either fidelity level without re-running the command. """ fro...
gesh75/multivendor-ai-network-lab
src/drivers/result.py
.py
bb97f82f2cd8471f
7.54
11
""" gait_audit.py — GAIT (Git AI Trail) immutable audit log. Inspired by NetClaw. Every AI-driven action appends a JSONL record so we can later answer "what did the agent do, when, why, and what was the outcome". Records are append-only; rotation by date. """ from __future__ import annotations import json import os ...
gesh75/multivendor-ai-network-lab
src/gait_audit.py
.py
7307911625013775
7.54
11
""" Device configuration validation and connection parameter utilities """ import logging from typing import Dict, Any log = logging.getLogger('jmcp-server.config') def validate_device_config(device_name: str, device_config: Dict[str, Any]) -> None: """Validate device configuration has all required fields ...
gesh75/multivendor-ai-network-lab
src/jmcp/utils/config.py
.py
6099fd33a707b6dd
7.54
11
import { describe, expect, it, afterEach, beforeEach } from "bun:test"; import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs"; import os from "node:os"; import path from "node:path"; import { buildHookEnv, candidateScriptDirs, resolveScriptDir, SCRIPT_REQUIRED_FILES, } from "./scriptRunner"; cons...
paulrobello/parsidion
extensions/pi/parsidion/lib/scriptRunner.test.ts
.ts
7bb1bde1aaa9efe6
7.02
10
"""ANSI colour helpers for the Parsidion installer. Disabled automatically when stdout is not a TTY or NO_COLOR is set. Stdlib-only — no third-party dependencies. """ from __future__ import annotations import os import sys _USE_COLOUR = sys.stdout.isatty() and "NO_COLOR" not in os.environ def _colorize(code: str,...
paulrobello/parsidion
installer/colors.py
.py
6dcc9c82fbe8f622
7.52
10
"""Install plan construction for the Parsidion installer (ARC-008). Holds the resolved install matrix (:class:`InstallPlan`), the interactive option prompts, the ``Installation Plan`` printer, and the ordered :class:`installer.steps.StepList` builder previously inlined in the 1,342-line ``install.py`` entrypoint. The...
paulrobello/parsidion
installer/plan.py
.py
1d1dfd8ee5281bf5
7.52
10
"""Nightly summarizer scheduler for the Parsidion installer. Handles macOS launchd plist installation and Linux/other cron job management. Stdlib-only — no third-party dependencies. """ from __future__ import annotations import shlex import subprocess import sys from pathlib import Path from installer.paths import ...
paulrobello/parsidion
installer/schedule.py
.py
2a140f2c6faae277
7.52
10
"""Transaction step-list primitives shared by ``install()`` and ``uninstall()``. ARC-017 / QA-002: ``install.py:install()`` was a CC-67 monolith of ~12 bare sequential ``_run_step`` calls with no rollback, and ``installer/uninstall.py :uninstall()`` was its equally-complex inverse maintained as a separate function — s...
paulrobello/parsidion
installer/steps.py
.py
dd4e8b07bf501b49
7.52
10
"""vault_read and vault_write MCP tools.""" from __future__ import annotations import os from pathlib import Path import vault_common class VaultToolError(Exception): """Raised when a vault MCP tool encounters an error.""" def _resolve_vault_path(path: str, vault: str | None = None) -> Path: """Resolve *...
paulrobello/parsidion
parsidion-mcp/src/parsidion_mcp/tools/notes.py
.py
8e4d3727adcbb632
7.52
10
"""rebuild_index and vault_doctor MCP tools.""" from __future__ import annotations import subprocess from pathlib import Path import vault_common import vault_path # ARC-021: resolve SCRIPTS_DIR from the imported package's __file__ rather # than the hardwired ``~/.claude/skills/parsidion/scripts`` constant in # vau...
paulrobello/parsidion
parsidion-mcp/src/parsidion_mcp/tools/ops.py
.py
281453a336c4e6b1
7.52
10
"""Integration smoke test — skipped when vault is absent.""" import pytest import vault_common VAULT_PRESENT = vault_common.VAULT_ROOT.exists() @pytest.mark.skipif(not VAULT_PRESENT, reason="vault not present") def test_vault_read_real_note() -> None: """Read the first available vault note without errors.""" ...
paulrobello/parsidion
parsidion-mcp/tests/test_integration.py
.py
acfe93d058db0d52
8.02
10
"""Smoke tests for server.py wiring.""" from parsidion_mcp.server import mcp def test_mcp_instance_exists() -> None: assert mcp is not None assert mcp.name == "parsidion-mcp" def test_all_tool_modules_importable() -> None: """Verify all tool functions are importable and callable. Avoids FastMCP pr...
paulrobello/parsidion
parsidion-mcp/tests/test_server.py
.py
176eb1c804542b2f
8.02
10
#!/usr/bin/env python3 """Canonicalize generated docs/api artifacts that are byte-unstable across platforms. The DOC-003 drift gate (make docs-api-check) regenerates docs/api and diffs against the committed snapshot, so every emitted byte must be identical on every machine. Three generators produce content-identical b...
paulrobello/parsidion
scripts/normalize_docs_api.py
.py
5fabaed2b4aa3822
7.52
10
#!/usr/bin/env python3 """Audit vault tag coverage against Obsidian graph.json color groups. Reports: - Vault tags NOT covered by any color group (sorted by frequency) - Graph group tags NOT found in the vault (stale entries) Usage: python check_graph_coverage.py python check_graph_coverage.py --json ...
paulrobello/parsidion
skills/parsidion/scripts/check_graph_coverage.py
.py
a6b4415fb329efd0
7.52
10
""" hermes-relay plugin — registers android_* + desktop_* tools and the `hermes pair` + `hermes relay` CLI sub-commands into hermes-agent via the v0.3.0+ plugin system. Drop this folder into ~/.hermes/plugins/hermes-relay and add `hermes-relay` to `plugins.enabled` in ~/.hermes/config.yaml, then restart hermes. Run `h...
pmontgo33/nix-config
hosts/nxc/hermes/plugins/hermes-relay/__init__.py
.py
3289f97cb86bed21
7.52
10
"""Plugin-level configuration helpers. These helpers cover feature flags that are shared by the gateway plugin and the standalone relay process. Values come from the Hermes ``.env`` file when present, matching the dashboard's ``/api/env`` writer, with process environment variables as a fallback. """ from __future__ i...
pmontgo33/nix-config
hosts/nxc/hermes/plugins/hermes-relay/config.py
.py
b4cd596c9b835586
7.52
10
"""Enhancement registry for relay-owned host patches.""" from __future__ import annotations import logging from dataclasses import dataclass from typing import Callable, Literal logger = logging.getLogger(__name__) EnhancementPhase = Literal["startup", "plugin_load"] @dataclass(frozen=True) class Enhancement: ...
pmontgo33/nix-config
hosts/nxc/hermes/plugins/hermes-relay/enhancements/registry.py
.py
6abc2e0aef6e8620
7.52
10
"""Read-only, sanitized diagnostics for the upstream gateway heartbeat.""" from __future__ import annotations import json import os import time from datetime import datetime from pathlib import Path from typing import Any, Callable DEFAULT_STALE_AFTER_S = 90.0 def hermes_home() -> Path: configured = os.environ...
pmontgo33/nix-config
hosts/nxc/hermes/plugins/hermes-relay/gateway_diagnostics.py
.py
75a06eb80ed3ef5a
7.52
10
"""Per-profile plugin-enablement helpers. Hermes installs a plugin's *code* once — a single global symlink at ``~/.hermes/plugins/<name>`` — but *enables* it **per profile**: the root ``~/.hermes/config.yaml`` and every ``~/.hermes/profiles/<name>/config.yaml`` carry their own ``plugins.enabled`` / ``plugins.disabled`...
pmontgo33/nix-config
hosts/nxc/hermes/plugins/hermes-relay/profiles.py
.py
2e209cc0ebc780c8
7.52
10
"""Thin sync client helpers for in-process callers (tools, pair.py, etc). Everything here talks to the local relay over the loopback interface using ``urllib.request`` (stdlib only — no httpx / requests dependency) to match ``plugin/pair.py``'s existing ``register_relay_code`` helper. The public surface today is :fun...
pmontgo33/nix-config
hosts/nxc/hermes/plugins/hermes-relay/relay/client.py
.py
16d53f22dc012c13
7.52
10
"""Read-only image-generation activity derived from Hermes session history. This is an optional Relay compatibility surface for clients connected to an upstream Gateway that does not emit tool lifecycle events when tool progress is disabled. Hermes' session database remains the source of truth; Relay never creates or ...
pmontgo33/nix-config
hosts/nxc/hermes/plugins/hermes-relay/relay/image_activity.py
.py
7fd1720481064859
7.52
10
"""HMAC-SHA256 signing for QR pairing payloads. The operator runs ``hermes-pair`` (or the ``/hermes-relay-pair`` skill) on the host. It generates a QR payload containing the API endpoint + the relay URL + a pre-registered pairing code. A malicious LAN peer who captures or forges a QR with a different host/code could t...
pmontgo33/nix-config
hosts/nxc/hermes/plugins/hermes-relay/relay/qr_sign.py
.py
67b4c3981bcb763e
7.52
10
"""Relay-side audio floor owner for realtime-agent sessions (ADR 33). Up to three sources can produce ``voice.output_audio.delta`` on Android's single ``AudioTrack``: 1. the realtime provider (xAI / OpenAI), 2. the relay TTS fallback render (``_render_provider_audio``), and 3. Android local filler, driven by the ``sh...
pmontgo33/nix-config
hosts/nxc/hermes/plugins/hermes-relay/relay/realtime_agent/floor.py
.py
482c3ea8e50f5f5f
7.52
10
"""Provider adapter contract for relay realtime-agent sessions.""" from __future__ import annotations import asyncio from collections.abc import AsyncIterator, Callable from dataclasses import dataclass, field from pathlib import Path from typing import Any, Protocol from ....voice_lab.expressions import VoiceExpres...
pmontgo33/nix-config
hosts/nxc/hermes/plugins/hermes-relay/relay/realtime_agent/providers/base.py
.py
e38522fcf5d9a16a
7.52
10