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 __future__ import annotations import asyncio from collections.abc import Callable, Iterator, Mapping from contextlib import contextmanager import inspect import logging from typing import Any from ._metadata import ( KNOWLEDGE_METADATA_VERSION, KnowledgeMetadata, set_knowledge_metadata, ) from ._meta...
yeongseon/azure-functions-knowledge-python
src/azure_functions_knowledge/decorator.py
.py
0053d86700f7bd29
7.42
6
from __future__ import annotations from collections.abc import Mapping from typing import Any, Protocol, runtime_checkable from ..errors import ConfigurationError from ..types import Document _PROVIDER_REGISTRY: dict[str, type[KnowledgeProvider]] = {} @runtime_checkable class KnowledgeProvider(Protocol): """Pr...
yeongseon/azure-functions-knowledge-python
src/azure_functions_knowledge/providers/base.py
.py
155c43267fce12cf
7.42
6
"""Real-Azure end-to-end tests for azure-functions-knowledge. These drive the HTTP routes of ``examples/e2e_app`` on a live Azure Functions host that was deployed from the release commit's own source (see the e2e-azure workflow). They are the runtime-behavior proof behind the release gate's Azure certification. Usage...
yeongseon/azure-functions-knowledge-python
tests/e2e/test_knowledge_e2e.py
.py
b1c2efd780c28273
7.92
6
"""Regression guard for the release-gate drift-lint. Exercises tools/lint_release_workflows.py against this repo (must be clean) and against synthetic drift (must be caught). Keeps the vendored lint honest. Family-agnostic: the runtime-tier assertions are derived from the lint's own ``REQUIRED_RUNTIME_TIERS`` config,...
yeongseon/azure-functions-knowledge-python
tests/test_release_workflow_pins.py
.py
604cab6acceaad48
7.92
6
"""Worker-indexing compatibility regression tests. The Azure Functions Python library resolves the "user function" for a registered handler by recursively following ``__wrapped__`` (``function_app._get_user_function``). If a decorator wrapper exposes ``__wrapped__`` (as ``functools.wraps`` sets it), the library binds ...
yeongseon/azure-functions-knowledge-python
tests/test_worker_compat.py
.py
0fee4ae0b9572443
7.92
6
#!/usr/bin/env python3 """Fleet-wide pin-hygiene lint for GitHub Actions workflows. Part of the DX Toolkit CI hardening work (follow-up to yeongseon/azure-functions-validation-python#319, umbrella #308). Unlike ``tools/lint_release_workflows.py`` -- which enforces a single *canonical* SHA per action for the two relea...
yeongseon/azure-functions-knowledge-python
tools/lint_workflow_pins.py
.py
4c788d7193ffbb46
7.42
6
"""Notion-backed knowledge retrieval with ``azure-functions-knowledge``. The ``KnowledgeBindings`` decorator API gives two Azure Functions-native ways to reach a knowledge provider (here, Notion): * ``@kb.input(...)`` -- inject ranked search results into a handler param. * ``@kb.inject_client`` -- inject a live pr...
yeongseon/azure-functions-cookbook-python
examples/ai-and-agents/knowledge_notion_search/function_app.py
.py
67079b01007816c0
7.42
6
from __future__ import annotations import base64 import json from collections.abc import Callable from functools import wraps from typing import TypeAlias, TypedDict, TypeVar, cast import azure.functions as func class Claim(TypedDict): typ: str val: str class Principal(TypedDict): """Azure App Service...
yeongseon/azure-functions-cookbook-python
examples/apis-and-ingress/auth_easyauth/app/services/auth_service.py
.py
fd6114beea11c1e9
7.42
6
from __future__ import annotations import json import logging from collections.abc import Callable from typing import Any import azure.functions as func import jwt from jwt import PyJWKClient ClaimsResponse = tuple[dict[str, Any], int] ClaimsHandler = Callable[[dict[str, Any]], ClaimsResponse] def _json_response(b...
yeongseon/azure-functions-cookbook-python
examples/apis-and-ingress/auth_jwt_validation/app/services/jwt_service.py
.py
89d28d1e6429e685
7.42
6
from __future__ import annotations import base64 import json from typing import Any import azure.functions as func def _json_response(body: object, status_code: int = 200) -> func.HttpResponse: return func.HttpResponse( body=json.dumps(body), status_code=status_code, mimetype="applicatio...
yeongseon/azure-functions-cookbook-python
examples/apis-and-ingress/auth_multitenant/app/services/tenant_service.py
.py
194807126e6e727e
7.42
6
"""Two-node greeting graph used by the real-Azure e2e certification. Purpose-built for `tests/e2e` — kept separate from the user-facing `examples/simple_agent` so docs can evolve without breaking the release gate. The graph performs NO LLM call: ``greet`` -> ``farewell``. """ from __future__ import annotations from ...
yeongseon/azure-functions-langgraph-python
examples/e2e_app/graph.py
.py
139c709b8f080d5d
7.56
12
"""Timer Trigger that resets stale run locks on AzureTableThreadStore. Threads stuck in ``busy`` status (e.g. due to host crashes during graph execution) are reclaimed so new runs can proceed. """ from __future__ import annotations import logging import os from typing import Literal import azure.functions as func ...
yeongseon/azure-functions-langgraph-python
examples/maintenance_timer/function_app.py
.py
cfaac2455e736b94
7.56
12
"""Builder for the cross-package ``endpoint`` metadata namespace. Toolkit convention (shared across the Azure Functions Python DX Toolkit): handlers carry an ``_azure_functions_metadata`` dict keyed by a package-owned *namespace* string, so sibling packages (e.g. ``azure-functions-openapi``) can discover metadata **wi...
yeongseon/azure-functions-langgraph-python
src/azure_functions_langgraph/_endpoint.py
.py
9382e89772650aa0
7.56
12
"""Typed cross-package metadata contract for the ``langgraph`` namespace. Toolkit convention (shared across the Azure Functions Python DX Toolkit): handlers carry an ``_azure_functions_metadata`` dict keyed by a package-owned *namespace* string, so sibling packages can discover metadata **without importing this packag...
yeongseon/azure-functions-langgraph-python
src/azure_functions_langgraph/_metadata.py
.py
311ae7c2d26d8fb8
7.56
12
"""Cosmos DB checkpointer DX helper. .. versionadded:: 0.7.0 Thin wrapper around the upstream :pypi:`langgraph-checkpoint-cosmosdb` package that resolves credentials and builds a :class:`CosmosDBSaver` suitable for Azure Functions cold-start (module-level instantiation). The helper uses **key-based authentication**....
yeongseon/azure-functions-langgraph-python
src/azure_functions_langgraph/checkpointers/cosmos.py
.py
29f1b3b84d8409b7
7.56
12
"""Azure Blob lease-backed distributed ThreadLock. Uses the Azure Blob Storage lease API to coordinate a per-thread lock across multiple Azure Functions instances. Each ``(graph_name, thread_id)`` maps to a marker blob; acquiring the lock means holding an exclusive lease on that blob. Releasing the lock releases the l...
yeongseon/azure-functions-langgraph-python
src/azure_functions_langgraph/locks/azure_blob.py
.py
b0e76c85ce564906
7.56
12
"""ThreadLock protocol — pluggable per-thread lock backend contract.""" from __future__ import annotations from typing import Protocol, runtime_checkable @runtime_checkable class ThreadLock(Protocol): """Contract for pluggable per-thread lock backends. Implementations coordinate concurrent access to a nati...
yeongseon/azure-functions-langgraph-python
src/azure_functions_langgraph/locks/base.py
.py
c1ec37e88ee1f3a4
7.56
12
"""In-process ThreadLock backend using :class:`threading.Lock`.""" from __future__ import annotations import logging import threading logger = logging.getLogger(__name__) class InProcessThreadLock: """:class:`threading.Lock`-based per-thread lock scoped to a single worker. This is the default backend when...
yeongseon/azure-functions-langgraph-python
src/azure_functions_langgraph/locks/inprocess.py
.py
e277158a1fd9a654
7.56
12
"""Bridge between azure-functions-langgraph and azure-functions-openapi-python. This module forwards route metadata from :class:`LangGraphApp` to the ``azure-functions-openapi-python`` package for OpenAPI spec generation. Usage:: from azure_functions_langgraph import LangGraphApp from azure_functions_langgra...
yeongseon/azure-functions-langgraph-python
src/azure_functions_langgraph/openapi.py
.py
e70f865800c0b23b
7.56
12
"""Internal SSE event formatting for Platform API compatibility. Produces Server-Sent Events in the wire format expected by ``langgraph_sdk``'s ``SSEDecoder``. The native streaming format (``_handlers.py``) is **not** affected by this module. Wire-format contract (each frame terminated by ``\\n\\n``): * ``event: me...
yeongseon/azure-functions-langgraph-python
src/azure_functions_langgraph/platform/_sse.py
.py
6d0230ab11434f60
7.56
12
""" Base channel interface. All output channels (LoR, toast, Telegram, etc.) implement this interface. This makes it easy to add new channels without touching the engine. """ from abc import ABC, abstractmethod class Channel(ABC): """Abstract base for output channels.""" @abstractmethod async def send(...
elliejayliquid/pulse
channels/base.py
.py
3b7881a88835ad1f
7.52
10
""" LoR channel - posts to the Local Reddit for AIs forum. Writes directly to LoR's data files (posts.json, authors.json) so the companion can participate in the forum without needing MCP. """ import json import hashlib import logging import os import time from datetime import datetime, timezone from pathlib import P...
elliejayliquid/pulse
channels/lor.py
.py
eca3fc7ac44fb5c8
7.52
10
""" Toast channel - Windows desktop notifications. Uses win11toast for modern Windows 10/11 notifications. Falls back to plyer if win11toast isn't available. """ import logging from channels.base import Channel logger = logging.getLogger(__name__) class ToastChannel(Channel): """Sends Windows desktop toast no...
elliejayliquid/pulse
channels/toast.py
.py
c66ef4440e305e50
7.52
10
""" Document inbox helpers — shared by the Telegram channel and the documents skill. Incoming files are saved to the persona's inbox (personas/<p>/data/inbox/), and text is extracted for the model: small documents are injected inline into the conversation, larger ones are read on demand via the documents skill. """ f...
elliejayliquid/pulse
core/documents.py
.py
5c1a2c109e12aed3
7.52
10
import numpy as np import re def blob_to_vec(blob) -> np.ndarray | None: """Convert an embedding blob (bytes/list/ndarray) to a numpy array.""" if blob is None: return None if isinstance(blob, (bytes, bytearray)): if not blob: return None try: return np.fromb...
elliejayliquid/pulse
core/embeddings.py
.py
43ba52951d5c2fc5
7.52
10
"""Shared builders for journal memory mirrors. Journal entries are stored as full reflections, but their memory mirrors need two different text forms: - embedded text: compact semantic content for vector search - display text: labelled recall text returned by memory search """ def search_summary_is_thin(summary: str...
elliejayliquid/pulse
core/journal_mirror.py
.py
aeec233f8b4e9caa
7.52
10
"""Runtime status and shutdown-sentinel helpers for Pulse. The GUI polls status.json while Pulse is running. Writes must be atomic because the GUI may read while Pulse is updating the file. """ from __future__ import annotations import json import os from datetime import datetime, timezone from pathlib import Path f...
elliejayliquid/pulse
core/runtime_status.py
.py
6009074e8a8171ef
7.52
10
""" llama.cpp server manager — starts and stops llama-server as a subprocess. Pulse owns the server process: starts it on boot, monitors health, and shuts it down gracefully (waiting for in-flight inference to finish). """ import asyncio import logging import subprocess import threading import time from collections i...
elliejayliquid/pulse
core/server.py
.py
554fc43db86e7455
7.52
10
""" Voice transcription via whisper.cpp — auto-downloads binary, model, and ffmpeg. Usage: transcriber = Transcriber(config) await transcriber.ensure_ready() text = await transcriber.transcribe("voice.ogg") All downloads are lazy — nothing is fetched until the first voice message. """ import asyncio impo...
elliejayliquid/pulse
core/transcriber.py
.py
034f2e5cced92cfa
7.52
10
""" Token usage tracker — logs API token consumption per day. Keeps a simple JSON log (data/usage.json) with one entry per day. Used when provider != "local" to help track costs. Local inference is free, so usage is only logged for API calls. """ import json import logging from datetime import datetime from pathlib i...
elliejayliquid/pulse
core/usage.py
.py
560111a7c4cb173c
7.52
10
"""YAML loading that rejects duplicate mapping keys. PyYAML's SafeLoader silently lets the last duplicate key win, so a second `context:` section in config.yaml can shadow the first with no warning. This loader raises a YAMLError naming the key and both line numbers. """ import yaml class UniqueKeyLoader(yaml.SafeL...
elliejayliquid/pulse
core/yaml_loader.py
.py
bb0b7b320c08cce5
7.52
10
""" Manual memory seeder for Pulse companions. Pre-load your companion's memory with facts about you, your relationship, shared history, or anything you want them to know from day one. Memories are saved to the companion's SQLite database with embeddings for semantic search — your companion recalls them naturally dur...
elliejayliquid/pulse
scripts/add_memory.py
.py
5f6896686257ce54
7.52
10
""" Backfill embeddings for journal entries and memories that have empty embeddings. Run: python scripts/backfill_embeddings.py """ import json import sys from pathlib import Path # Add project root to path sys.path.insert(0, str(Path(__file__).parent.parent)) from core.context import load_embedding_model, _get_emb...
elliejayliquid/pulse
scripts/backfill_embeddings.py
.py
380c959b09687442
7.52
10
""" Stage 1: ChatGPT conversation export Parses users's conversations.json export into per-conversation .md files for user to review before Stage 2 import into legacy.db. Usage: python export_chatgpt.py [--count N] [--start N] [--force] [--list] python export_chatgpt.py # exports all 385 ...
elliejayliquid/pulse
scripts/export_chatgpt.py
.py
cb4123759f1c6bf1
7.52
10
""" Stage 1: Claude conversation export Parses Claude's conversations.json export into per-conversation .md files for user to review before Stage 2 import into legacy.db. Usage: python scripts/export_claude.py [--count N] [--start N] [--force] [--list] python scripts/export_claude.py # expor...
elliejayliquid/pulse
scripts/export_claude.py
.py
9bca65cea6b9183d
7.52
10
""" Stage 2: Import exported ChatGPT conversations into legacy.db. Designed for streaming — processes files one at a time without loading all conversations into memory. N.B.: you must edit USER and ASSISTANT variables. This now works for both ChatGPT and Claude exports. Usage: python import_chatgpt.py [--db PATH]...
elliejayliquid/pulse
scripts/import_chatgpt.py
.py
0f94032f081ff028
7.52
10
"""Tiny stdio MCP server used by scripts/test_mcp_bridge.py. Run standalone: python scripts/mcp_test_server.py (speaks MCP over stdio). """ from mcp.server.fastmcp import FastMCP mcp = FastMCP("pulse-test") @mcp.tool() def echo(text: str) -> str: """Echo the given text back, prefixed so the round-trip is verif...
elliejayliquid/pulse
scripts/mcp_test_server.py
.py
7dd20fa3155d8849
7.52
10
#!/usr/bin/env python3 """ Migrate journal from Phase 1 (JSON) to Phase 2 (markdown + companion memories). What this does: 1. Moves pinned identity files (_self.json, _user.json, _relationship.json) from journal_dir/ to journal_dir/identity/ 2. Converts entry_NNN.json files to entries/NNN.md (markdown + YAML frontm...
elliejayliquid/pulse
scripts/migrate_journal_phase2.py
.py
6aff487e2a8e879c
7.52
10
""" Migration helper — set up a persona directory from existing Pulse data. Usage: python scripts/migrate_persona.py nova This will: 1. Create personas/<name>/ with config.yaml and persona.json 2. COPY (not move) data files into personas/<name>/data/ 3. Print instructions for updating the base config Safe to run...
elliejayliquid/pulse
scripts/migrate_persona.py
.py
41c859aace91c6a4
7.52
10
"""Tests for the document inbox: core/documents.py + skills/documents.py. .venv/Scripts/python.exe scripts/test_documents.py """ import sys import tempfile from pathlib import Path ROOT = Path(__file__).resolve().parent.parent sys.path.insert(0, str(ROOT)) from core.documents import extract_text, save_to_inbox ...
elliejayliquid/pulse
scripts/test_documents.py
.py
2beac69d6d6ada46
8.02
10
#!/usr/bin/env python3 """ PNG to WebP Batch Converter 自动批量转换PNG图片为WebP格式的Python脚本 功能特性: - 递归遍历指定目录下的所有PNG文件 - 支持自定义WebP质量设置 - 保持原文件结构 - 可选择是否删除原PNG文件 - 显示转换进度和统计信息 - 错误处理和日志记录 使用方法: python convert_png_to_webp.py [目录路径] [选项] 示例: python convert_png_to_webp.py ./docs --quality 85 --delete-original """ import os impor...
TechCat-Team/ChmlFrp-Docs
tools/convert_png_to_webp.py
.py
ba71f5c38ed310a8
7.45
7
import argparse import xml.etree.ElementTree as ET def modify_xml(file_path, label, field, value): """ Modify the specified field of an XML element with the given label. """ try: # Parse the XML file tree = ET.parse(file_path) root = tree.getroot() # Find the program el...
particle-iot/tachyon-composer
xml_tools.py
.py
3d4349c8a6d04f20
7.5
9
#!/usr/bin/env python3 """ Extracts the release notes for a specific version from a CHANGELOG.md file following the Keep a Changelog format (https://keepachangelog.com). Usage: python3 .github/scripts/extract-changelog.py <version> [changelog-path] Arguments: version The version to extract (e.g. "1.2....
divisionseven/pkg-defender
.github/scripts/extract-changelog.py
.py
79d5b016b00ef9c3
7.52
10
#!/usr/bin/env python3 """ Smart-merge two Homebrew formula files, protecting url/sha256 in the target. Reads a SOURCE formula (from the main repo's homebrew-tap/) and a TARGET formula (from the subsidiary tap repo checkout), then writes a merged version to the target path. Protected fields (url, sha256) are kept from...
divisionseven/pkg-defender
.github/scripts/sync-brew-formula.py
.py
8665449dcc6f1d43
7.52
10
# Copyright (c) 2026 DIVISION 7 | MI-7 (@divisionseven) # SPDX-License-Identifier: Apache-2.0 """Fuzz targets for pkg-defender lock file parsers. This file is detected by Scorecard's Fuzzing check because it imports atheris. Any Python file with ``import atheris`` in the repository triggers Scorecard to give 10/10 on...
divisionseven/pkg-defender
fuzz/parse_lockfiles_fuzz.py
.py
4dbad13f175301fb
7.52
10
#!/usr/bin/env python3 """Add SPDX-License-Identifier and copyright headers to all Python source files. Scans every ``.py`` file under ``src/pkg_defender/`` and inserts:: # Copyright (c) 2026 DIVISION 7 | MI-7 (@divisionseven) # SPDX-License-Identifier: Apache-2.0 Insertion rules (by file type): - **Empty f...
divisionseven/pkg-defender
scripts/add_spdx_headers.py
.py
0f7970dc86eedd56
7.52
10
#!/usr/bin/env python3 """Build the threat intelligence snapshot database. This script is the canonical implementation used by the CI workflow. It fetches threat data from Tier 1 sources (OSV, GHSA, ossf_malicious) and produces the compressed snapshot database for distribution. """ from __future__ import annotations ...
divisionseven/pkg-defender
scripts/build_snapshot.py
.py
ade5c56f5dbabd3d
7.52
10
#!/usr/bin/env python3 """Post-release smoke test: verify pkgd blocks a known malicious package. Called from the release pipeline's smoke-test job (release.yml) after publishing to PyPI. Uses only stdlib + the installed pkg_defender package — no pytest or test dependencies. Seeds a temp SQLite database with a blockin...
divisionseven/pkg-defender
scripts/smoke_test_release.py
.py
a2f746f4276bf05d
8.02
10
# Copyright (c) 2026 DIVISION 7 | MI-7 (@divisionseven) # SPDX-License-Identifier: Apache-2.0 """Shared HTTP fetch utility with retry, backoff with jitter, and configurable error handling.""" from __future__ import annotations import logging import random from asyncio import sleep as _asyncio_sleep from dataclasses ...
divisionseven/pkg-defender
src/pkg_defender/_http.py
.py
2775cd714ca075da
7.52
10
# Copyright (c) 2026 DIVISION 7 | MI-7 (@divisionseven) # SPDX-License-Identifier: Apache-2.0 """Service for querying active bypass entries. Provides a single, centralized implementation for querying active bypasses, eliminating the duplicated bypass queries that previously existed in both the threat check and cooldo...
divisionseven/pkg-defender
src/pkg_defender/audit/bypass_service.py
.py
97e6845136bd57de
7.52
10
# Copyright (c) 2026 DIVISION 7 | MI-7 (@divisionseven) # SPDX-License-Identifier: Apache-2.0 """Cooldown checking — enforces minimum age before installing new packages. Per spec Section 6 (Step 6) and Section 9.2: Checks the release date against the user's configured cooldown window to reduce exposure to supply-chai...
divisionseven/pkg-defender
src/pkg_defender/audit/cooldown.py
.py
9e78abcd8f2a9b5a
7.52
10
# Copyright (c) 2026 DIVISION 7 | MI-7 (@divisionseven) # SPDX-License-Identifier: Apache-2.0 """Shared audit types extracted from pipeline for cross-module use.""" from __future__ import annotations from dataclasses import dataclass, field from datetime import datetime from enum import StrEnum class Verdict(StrEn...
divisionseven/pkg-defender
src/pkg_defender/audit/types.py
.py
016962e16e845aef
7.52
10
# Copyright (c) 2026 DIVISION 7 | MI-7 (@divisionseven) # SPDX-License-Identifier: Apache-2.0 """CI environment detection utilities.""" from __future__ import annotations import os CI_ENV_VARS = ( "CI", "GITHUB_ACTIONS", "TF_BUILD", "GITLAB_CI", "CIRCLECI", "JENKINS_URL", "TRAVIS", "...
divisionseven/pkg-defender
src/pkg_defender/cli/_ci_detect.py
.py
3cfdb8cfaa5f3bd3
7.52
10
# Copyright (c) 2026 DIVISION 7 | MI-7 (@divisionseven) # SPDX-License-Identifier: Apache-2.0 """Dependency version checking utilities.""" from __future__ import annotations import re import shutil import subprocess import sys # Minimum versions for key tools MIN_VERSIONS: dict[str, str] = { "pip": "21.0", ...
divisionseven/pkg-defender
src/pkg_defender/cli/_dependency_check.py
.py
5de4830cbc0c9299
7.52
10
# Copyright (c) 2026 DIVISION 7 | MI-7 (@divisionseven) # SPDX-License-Identifier: Apache-2.0 """Custom Click ParameterTypes for pkg-defender CLI.""" from __future__ import annotations import re from typing import Any import click class PackageSpecifier(click.ParamType[str]): """Click parameter type for packa...
divisionseven/pkg-defender
src/pkg_defender/cli/_param_types.py
.py
2eaf7a304eb2f628
7.52
10
# Copyright (c) 2026 DIVISION 7 | MI-7 (@divisionseven) # SPDX-License-Identifier: Apache-2.0 """Progress indicator utilities for CLI commands. Supports NO_COLOR environment variable (checked at module init). """ from __future__ import annotations import os import signal import sys from collections.abc import Calla...
divisionseven/pkg-defender
src/pkg_defender/cli/_progress.py
.py
ba71ae2d6ff419b3
7.52
10
# Copyright (c) 2026 DIVISION 7 | MI-7 (@divisionseven) # SPDX-License-Identifier: Apache-2.0 """ASCII banner loading for CLI help output.""" import os import shutil import signal import sys from pathlib import Path from typing import Any, Final __all__ = ["Path", "get_banner", "get_terminal_width", "should_use_colo...
divisionseven/pkg-defender
src/pkg_defender/cli/banners.py
.py
b110dcabf5759e72
7.52
10
# Copyright (c) 2026 DIVISION 7 | MI-7 (@divisionseven) # SPDX-License-Identifier: Apache-2.0 """pkgd completion group and subcommands.""" from __future__ import annotations import os import click from pkg_defender.cli.group import ManagerGroup from pkg_defender.cli.main import cli @cli.group(cls=ManagerGroup, n...
divisionseven/pkg-defender
src/pkg_defender/cli/commands/completion.py
.py
c26030bbacdabc2f
7.52
10
""" Pydantic models for GitHub repository sync configuration. Defines the schema for sync-config.yaml files used by .github/sync_to_repos.py. """ from pydantic import BaseModel from pydantic import ConfigDict from pydantic import Field from pydantic import field_validator from pydantic import model_validator class ...
alex-feel/claude-code-toolbox
.github/sync_config.py
.py
c692d002d2b3bc94
7.62
16
#!/usr/bin/env python3 """ Sync files and directories to target GitHub repositories. Reads configuration from a YAML file and syncs specified files and directories to one or more target repositories. Supports dry-run mode for testing. Requires Python 3.12+ """ import argparse import fnmatch import logging import os ...
alex-feel/claude-code-toolbox
.github/sync_to_repos.py
.py
5271637388304439
7.62
16
"""Pytest configuration and shared fixtures for all tests.""" import json import shutil import sys import tempfile from collections.abc import Generator from pathlib import Path from typing import Any import pytest import yaml # Known test artifact names used by the post-test leak detector. # Maintain this set when ...
alex-feel/claude-code-toolbox
tests/conftest.py
.py
e86fa8046335a6ae
7.12
16
"""E2E test fixtures providing filesystem isolation and configuration loading. This module provides comprehensive fixtures for E2E testing of setup_environment.py. All fixtures use function scope for complete test isolation. """ import sys from collections.abc import Generator from pathlib import Path from typing imp...
alex-feel/claude-code-toolbox
tests/e2e/conftest.py
.py
00c3cadea703bb3d
8.12
16
#!/usr/bin/env python3 """E2E test status line script. Generates status line content for Claude Code's status bar. Receives config file path as first argument. """ import json import sys from pathlib import Path def main() -> int: """Generate status line content.""" config_path = Path(sys.argv[1]) if len(sy...
alex-feel/claude-code-toolbox
tests/e2e/fixtures/mock_repo/hooks/e2e_statusline.py
.py
70887a6bc74191c1
7.12
16
#!/usr/bin/env node /** * E2E test JavaScript hook script for validation. * * This hook is triggered by PostToolUse events for Read operations. * Validates that JavaScript hooks receive proper node prefix. */ 'use strict'; function main() { // Read stdin (Claude Code passes event data via stdin) let inpu...
alex-feel/claude-code-toolbox
tests/e2e/fixtures/mock_repo/hooks/e2e_test_hook.js
.js
12483b8de904d928
7.12
16
#!/usr/bin/env python3 """E2E test hook script for validation. This hook is triggered by PostToolUse events for Edit/MultiEdit/Write operations. It receives a config file path as the first argument. """ import json import sys from pathlib import Path def main() -> int: """Process hook invocation and validate in...
alex-feel/claude-code-toolbox
tests/e2e/fixtures/mock_repo/hooks/e2e_test_hook.py
.py
923ba53d2b0aabfd
7.12
16
"""E2E tests for CLAUDE_CONFIG_DIR-based artifact isolation. Verifies that when command-names is set, environment artifacts (agents, skills, rules, commands, hooks, prompts) are placed in an isolated directory under ~/.claude/{primary_command_name}/, while infrastructure files (settings, MCP config, launcher scripts) ...
alex-feel/claude-code-toolbox
tests/e2e/test_artifact_isolation.py
.py
2015a35276e60a5a
7.12
16
"""E2E tests verifying specific bug fixes in the artifact isolation reorganization. Bug 1: Prompt paths in launchers reference isolated directory. Bug 4+5: CLAUDE_CONFIG_DIR removed from config.json, added to launcher export. Bug 4+5 (user-explicit): User-specified CLAUDE_CONFIG_DIR popped from env. Update marker: Use...
alex-feel/claude-code-toolbox
tests/e2e/test_bug_fixes.py
.py
7683b478196fb684
8.12
16
"""E2E tests for cleanup verification. These tests verify that no E2E test artifacts leak outside the isolated test environment to the real user home directory. They validate that the e2e_isolated_home fixture provides proper isolation. """ from __future__ import annotations from pathlib import Path class TestClea...
alex-feel/claude-code-toolbox
tests/e2e/test_cleanup.py
.py
b9cdad84683bbfdf
8.12
16
"""E2E tests for the installation confirmation mechanism. Tests verify that the confirmation gate properly blocks, allows, and reports installation based on CLI flags and environment variables. Uses isolated home directories and golden config for comprehensive validation. """ from __future__ import annotations impor...
alex-feel/claude-code-toolbox
tests/e2e/test_confirmation.py
.py
a33ba596123ddf9a
7.12
16
"""E2E tests for the real /dev/tty confirmation path under a pty. The confirmation regression that motivated these tests was invisible to mocked tests: every existing confirmation test patched _get_user_confirmation to return a clean string, while the real read path returned the terminal's queued cursor-position repor...
alex-feel/claude-code-toolbox
tests/e2e/test_confirmation_tty.py
.py
e4dc2a804cc5ffe2
8.12
16
"""E2E tests for env loader file generation and launcher env sourcing. These tests validate that generate_env_loader_files() creates correct shell-specific loader files and that create_launcher_script() injects guarded source lines for loading OS-level environment variables. """ from __future__ import annotations im...
alex-feel/claude-code-toolbox
tests/e2e/test_env_loader_files.py
.py
135f4991700fc7e6
7.12
16
"""E2E tests for OS environment variable handling. These tests verify that: 1. set_os_env_variable() updates both persistent storage AND os.environ 2. set_all_os_env_variables() processes mixed SET/DELETE operations correctly 3. Deletion of variables properly removes them from os.environ 4. Unix systems get explicit u...
alex-feel/claude-code-toolbox
tests/e2e/test_env_variable_handling.py
.py
35b87daadb477905
7.12
16
"""E2E tests for file reorganization into isolated subdirectories. Verifies that when command-names is set, all infrastructure files (config.json, manifest.json, mcp.json, launch.sh, start.ps1, start.cmd) are created inside ~/.claude/{cmd}/ with generic names (no command-name prefix). Covers: Scenarios 9-13. """ imp...
alex-feel/claude-code-toolbox
tests/e2e/test_file_reorganization.py
.py
fe5a05d84a7c0bc0
7.12
16
"""E2E tests for the complete setup_environment workflow. These tests verify that the setup process creates all expected directories and files using the golden configuration. """ from __future__ import annotations from pathlib import Path from typing import Any from scripts.setup_environment import create_launcher_...
alex-feel/claude-code-toolbox
tests/e2e/test_full_setup.py
.py
cd72caaad0160a21
8.12
16
"""E2E tests for setup-time hooks-files consistency validation. The runtime twin validate_hooks_files_consistency() runs at the main() choke point on the RESOLVED configuration, closing the model's inherit blind spot: a composition whose hook events or status-line reference a missing hook file fails at setup time inst...
alex-feel/claude-code-toolbox
tests/e2e/test_hooks_consistency.py
.py
175ac27b334f5792
8.12
16
"""E2E tests for IDE extension version pinning management. Validates that version pinning correctly injects IDE extension auto-install disable controls, and that latest/absent versions do not inject controls. """ from __future__ import annotations import json from pathlib import Path from typing import Any import y...
alex-feel/claude-code-toolbox
tests/e2e/test_ide_extension.py
.py
3c4b64530f70649e
8.12
16
"""E2E tests for platform-specific launcher script verification. These tests verify that the launcher scripts created for each platform have correct content, format, and are properly configured. """ from __future__ import annotations import sys from pathlib import Path from typing import Any import pytest from scr...
alex-feel/claude-code-toolbox
tests/e2e/test_launcher_scripts.py
.py
8d877a59bd256877
7.12
16
"""E2E tests for manifest creation and update marker lifecycle. Tests verify: - Manifest is created during setup - Stale update marker is cleaned during re-installation - Marker file absence does not cause issues """ from __future__ import annotations import json from pathlib import Path from typing import Any cla...
alex-feel/claude-code-toolbox
tests/e2e/test_manifest_lifecycle.py
.py
f26f3f0bf0ae5d51
7.12
16
"""E2E tests for the merge-keys selective merge feature. Tests verify that configuration inheritance with merge-keys correctly merges specified keys using type-aware strategies while replacing non-listed keys. """ import os from pathlib import Path from typing import Any import pytest import yaml from scripts impor...
alex-feel/claude-code-toolbox
tests/e2e/test_merge_keys.py
.py
184781b6cdb8552b
8.12
16
"""E2E tests for the optional link-projects-dir feature. Verifies link_projects_directory() correctly links an isolated profile's projects/ directory to the base ~/.claude/projects/: - Unix: a symlink (target_is_directory) resolving to the base. - Windows: a directory junction (reparse point) -- detected via the rep...
alex-feel/claude-code-toolbox
tests/e2e/test_projects_link.py
.py
58423b5f23713bf3
7.12
16
"""E2E regression guard: public GitHub skill URLs must not trigger an auth prompt. Replays the user's exact failing scenario from the original bug report -- a mini Playwright CLI skills configuration consumed via setup_environment.validate_all_config_files. Mocks HTTP responses so the test is deterministic and network...
alex-feel/claude-code-toolbox
tests/e2e/test_public_skills_no_prompt.py
.py
ddd31dba8ca33b32
8.12
16
"""E2E tests exercising the real Claude CLI for MCP configuration. These tests run `claude mcp` config commands (which require no authentication) against a fully isolated CLAUDE_CONFIG_DIR, verifying the contracts the idempotent MCP configuration depends on: - serialization parity: _build_expected_mcp_entry() predict...
alex-feel/claude-code-toolbox
tests/e2e/test_real_claude_binary.py
.py
9695aac67c01690e
8.12
16
"""E2E tests for root detection guard behavior. Tests verify that: - Root detection guard prevents execution as root/sudo - CLAUDE_CODE_TOOLBOX_ALLOW_ROOT=1 override works correctly - Root guard only activates on Unix platforms (Linux/macOS) - Root guard produces correct error messages with actionable guidance - Root ...
alex-feel/claude-code-toolbox
tests/e2e/test_root_guard.py
.py
86d7fb47c0374d28
7.12
16
"""E2E tests for scope-based routing of settings and config files. Verifies that the presence or absence of command-names in the resolved configuration determines where the user-settings content is written. - Isolated mode (command-names present): the user-settings section is built into the isolated profile's confi...
alex-feel/claude-code-toolbox
tests/e2e/test_scope_routing.py
.py
0bcb6b6d3d41e2a5
7.12
16
"""Record real YouTube payloads into tests/fixtures/ (network required). Usage: uv run python scripts/record_fixtures.py Tests never touch the network; they run against the JSON files this script records. Re-run it only to refresh fixtures, then review the diff. """ import json import subprocess import sys from path...
mudassar531/hearsay
scripts/record_fixtures.py
.py
538b5436bb19cfeb
7.64
18
"""Batch ingestion: episode/entry selection and a failure-tolerant run loop. Shared by podcast feeds and YouTube playlists. The pieces here are pure or injectable so batch behaviour (selection, continue-past-failure) is tested offline without touching the network. """ import re from collections.abc import Callable fr...
mudassar531/hearsay
src/hearsay/batch.py
.py
90f77757b67cbe26
7.64
18
"""Caption fetching and selection via youtube-transcript-api.""" import html import re from typing import Any, NamedTuple import requests from youtube_transcript_api import ( CouldNotRetrieveTranscript, NoTranscriptFound, RequestBlocked, TranscriptsDisabled, VideoUnavailable, YouTubeTranscript...
mudassar531/hearsay
src/hearsay/captions.py
.py
28e5cf2d9da1a096
7.64
18
"""Optional speaker diarization for single-voice TTS datasets (the ``[diarize]`` extra). Whisper/Parakeet produce one unlabeled transcript, so concatenating multi-speaker audio splices every voice into one "speaker" — fatal for single-voice TTS. This module adds an *optional* speaker timeline and assigns each clip a s...
mudassar531/hearsay
src/hearsay/dataset/diarize.py
.py
b7ca3ac07c19f2b0
7.64
18
"""Quality filters that drop junk clips, each logged with a reason. Tier-1 (default on, no new dependency, engine-agnostic) runs on data hearsay already has — clip duration, word timings, and the transcript — so it needs no audio decode: * **duration** — drop clips shorter than ``min_duration_s`` or longer than ``m...
mudassar531/hearsay
src/hearsay/dataset/filters.py
.py
270f2d6c5b03f5d2
7.64
18
"""Write dataset index files and the dataset card (pure file writers). Three index formats over one shared ``wavs/`` tree (see docs/dataset-mode-design.md section 1): * **LJSpeech** ``metadata.csv`` — pipe-delimited, no header, ``id|text|text`` (the verbatim transcript is duplicated into the transcription and norma...
mudassar531/hearsay
src/hearsay/dataset/formats.py
.py
3de6098f1f5483d6
7.64
18
"""Pydantic models for the dataset-export mode.""" from __future__ import annotations from pathlib import Path from pydantic import BaseModel, Field, field_validator, model_validator from hearsay.models import Word # The dataset index formats hearsay can export. DATASET_FORMATS = ("ljspeech", "jsonl", "hf") DEFAUL...
mudassar531/hearsay
src/hearsay/dataset/models.py
.py
9a9554f027b87941
7.64
18
"""Engine-agnostic word adapters: ASR output -> normalized ``Word`` objects. faster-whisper and Parakeet expose word/token timings under different shapes and field names. These pure, duck-typed adapters normalize both into hearsay's :class:`~hearsay.models.Word` so the segmenter (and the rest of dataset mode) works id...
mudassar531/hearsay
src/hearsay/dataset/words.py
.py
910deb7894975716
7.64
18
"""Podcast RSS feed parsing (feedparser) and episode audio download (urllib).""" import shutil import urllib.error import urllib.request from pathlib import Path from typing import NamedTuple import feedparser from hearsay.errors import AudioDownloadError, FeedError _USER_AGENT = "hearsay/0.1 (+https://github.com/m...
mudassar531/hearsay
src/hearsay/feeds.py
.py
d86db56c90e63b32
7.64
18
"""MCP stdio server: give an AI agent ears. Exposes two tools — ``ingest_url`` and ``ingest_file`` — that return clean, timestamped markdown. The ``mcp`` SDK is an optional extra, so it is imported lazily inside ``run_server``; ``hearsay mcp`` prints an install hint if missing. Configuration via environment (MCP tool...
mudassar531/hearsay
src/hearsay/mcp_server.py
.py
61d93272b1a01a5c
7.64
18
"""Pydantic data models shared across the ingestion pipeline.""" from __future__ import annotations import json from pydantic import BaseModel, ConfigDict, Field from hearsay.timefmt import format_timestamp class Chapter(BaseModel): """A chapter marker from the source video.""" title: str start_s: fl...
mudassar531/hearsay
src/hearsay/models.py
.py
d9cbb042559f1285
7.64
18
"""Orchestrate ingestion: YouTube captions, YouTube transcription, local files. Ties together metadata, captions or whisper transcription, paragraph grouping, sectioning, and document assembly. Network/transcription steps are injected as callables so the assembly logic can be tested offline against fixtures. """ impo...
mudassar531/hearsay
src/hearsay/pipeline.py
.py
ad46acabd90f962f
7.64
18
"""Render a Document to the hearsay markdown format (the product).""" import re import textwrap from hearsay.models import Document from hearsay.timefmt import format_timestamp _WRAP_WIDTH = 80 # Any run of whitespace (including newlines) collapses to a single space. _WHITESPACE = re.compile(r"\s+") # C0/C1 control ...
mudassar531/hearsay
src/hearsay/render.py
.py
6e4bb6b526e5a688
7.64
18
"""Group paragraphs into document sections. Chapters from the source become `##` headings; without chapters, paragraphs fall into time-based sections of roughly five minutes, titled with their actual time span (we never invent topic titles — that would be summarization). """ from hearsay.models import Chapter, Paragr...
mudassar531/hearsay
src/hearsay/sectioning.py
.py
6cf5d222a0e2173a
7.64
18
"""YouTube URL parsing and metadata fetching via yt-dlp (no media download).""" import json import re import subprocess import sys from pathlib import Path from typing import NamedTuple from urllib.parse import ParseResult, parse_qs, urlparse from hearsay.errors import ( AudioDownloadError, HearsayError, ...
mudassar531/hearsay
src/hearsay/youtube.py
.py
f6322320b8d1d036
7.64
18
"""Tests for the ffmpeg audio layer: loudness normalization, probes, filter check.""" import subprocess import wave from pathlib import Path import numpy as np import pytest from hearsay.dataset.audio import ensure_filter, probe_duration, probe_sample_rate, slice_clip from hearsay.dataset.build import build_dataset ...
mudassar531/hearsay
tests/test_dataset_audio.py
.py
a4fb8ccf996c76b2
8.14
18