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
import hashlib from typing import Any from urllib.parse import urlparse from collections.abc import Sequence from langchain_core.messages import BaseMessage, SystemMessage CACHE_CONTROL = {"type": "ephemeral"} def is_openrouter_base_url(base_url: str) -> bool: """Return whether the configured chat endpoint is O...
yaowan233/nonebot-plugin-ai-groupmate
src/nonebot_plugin_ai_groupmate/agent/prompt_cache.py
.py
eec806027891d1e3
7.48
8
from typing import Any from langchain_core.tools import BaseTool, tool from langchain_core.messages import HumanMessage def _response_text(response: Any) -> str: content = getattr(response, "content", "") if isinstance(content, str): return content.strip() if not isinstance(content, list): ...
yaowan233/nonebot-plugin-ai-groupmate
src/nonebot_plugin_ai_groupmate/agent/qwen_responses_tools.py
.py
8296e7934834dcc1
7.48
8
import json from typing import Any, Literal from urllib.parse import urlparse from pydantic import Field, BaseModel, SecretStr, field_validator from langchain_openai import ChatOpenAI class ScopedConfig(BaseModel): bot_name: str = "bot" reply_probability: float = 0.01 global_model_daily_group_limit_enabl...
yaowan233/nonebot-plugin-ai-groupmate
src/nonebot_plugin_ai_groupmate/config.py
.py
bfad7cb4fb739fe3
7.48
8
"""first revision 迁移 ID: 6a6a44d58ced 父迁移: 创建时间: 2025-11-27 20:39:11.240822 """ from __future__ import annotations from collections.abc import Sequence import sqlalchemy as sa from alembic import op revision: str = "6a6a44d58ced" down_revision: str | Sequence[str] | None = None branch_labels: str | Sequence[str] ...
yaowan233/nonebot-plugin-ai-groupmate
src/nonebot_plugin_ai_groupmate/migrations/6a6a44d58ced_first_revision.py
.py
6c55907b01de257b
7.48
8
"""add group memory 迁移 ID: 811f4ae4bcd1 父迁移: 6a6a44d58ced 创建时间: 2026-03-31 16:08:32.834210 """ from __future__ import annotations from collections.abc import Sequence import sqlalchemy as sa from alembic import op revision: str = "811f4ae4bcd1" down_revision: str | Sequence[str] | None = "6a6a44d58ced" branch_labe...
yaowan233/nonebot-plugin-ai-groupmate
src/nonebot_plugin_ai_groupmate/migrations/811f4ae4bcd1_add_group_memory.py
.py
fba757bb66bd4073
7.48
8
"""add chathistory composite index 迁移 ID: a1b2c3d4e5f6 父迁移: 811f4ae4bcd1 创建时间: 2026-04-02 """ from __future__ import annotations from collections.abc import Sequence from alembic import op revision: str = "a1b2c3d4e5f6" down_revision: str | Sequence[str] | None = "811f4ae4bcd1" branch_labels: str | Sequence[str] |...
yaowan233/nonebot-plugin-ai-groupmate
src/nonebot_plugin_ai_groupmate/migrations/a1b2c3d4e5f6_add_chathistory_composite_index.py
.py
0214ab0d93d0bfce
7.48
8
"""add group media usage index 迁移 ID: d4e6f8a1b2c3 父迁移: c7f1a2d9e4b6 创建时间: 2026-08-06 """ from __future__ import annotations from collections.abc import Sequence from alembic import op revision: str = "d4e6f8a1b2c3" down_revision: str | Sequence[str] | None = "c7f1a2d9e4b6" branch_labels: str | Sequence[str] | Non...
yaowan233/nonebot-plugin-ai-groupmate
src/nonebot_plugin_ai_groupmate/migrations/d4e6f8a1b2c3_add_group_media_usage_index.py
.py
6f444750fe24c708
7.48
8
"""Command-line interface for SciEqLint.""" from __future__ import annotations import os import sys from pathlib import Path from typing import Protocol, TextIO import click from scieqlint import __version__ from scieqlint.api import ( _run_check_paths, # pyright: ignore[reportPrivateUsage] _run_graph_path...
1sgtpepper/scieqlint
src/scieqlint/cli.py
.py
e684a3da34ff4d66
7.48
8
"""Preset config resource loading.""" from __future__ import annotations from importlib import resources PRESET_PACKAGE = "scieqlint.presets" def list_presets() -> tuple[str, ...]: """Return available packaged preset names in stable order.""" return tuple( sorted( resource.name.removesu...
1sgtpepper/scieqlint
src/scieqlint/config/presets.py
.py
8302d0889b992500
7.48
8
"""Immutable fact snapshot and typed fact buckets.""" from __future__ import annotations from dataclasses import dataclass, field from scieqlint.facts.base import FactBase from scieqlint.facts.generated import GeneratedProvenanceFact from scieqlint.facts.math import DisplayMathFact, InlineMathFact, UnknownMathFact f...
1sgtpepper/scieqlint
src/scieqlint/facts/snapshot.py
.py
ccb48b47582f280d
7.48
8
"""Zoo Model Context Protocol (MCP) Server. A lightweight service that enables AI assistants to execute Zoo commands through the Model Context Protocol (MCP). """ import logging import ssl import sys from importlib.metadata import PackageNotFoundError, version import truststore FORMAT = "%(asctime)s | %(levelname)-...
KittyCAD/mcp
src/zoo_mcp/__init__.py
.py
44d033df3061db32
7.5
9
"""KCL Documentation fetching and search. This module fetches KCL documentation from zoo.dev and provides search functionality for LLMs. The index is loaded lazily — server.py kicks off the fetch in the background when the MCP server's lifespan starts, and tools ``await KCLDocs.initialize()`` before serving so the fir...
KittyCAD/mcp
src/zoo_mcp/kcl_docs.py
.py
4be3c59ba7699243
7.5
9
"""KCL Samples fetching and search. This module fetches the KCL samples index from zoo.dev and provides search functionality for LLMs. The index is loaded lazily — server.py kicks off the fetch in the background when the MCP server's lifespan starts, and tools ``await KCLSamples.initialize()`` before serving so the fi...
KittyCAD/mcp
src/zoo_mcp/kcl_samples.py
.py
1621e50b03d4329a
7.5
9
"""Shared utilities for fetching KCL docs and samples from zoo.dev. Provides path validation, URL fetching, and text extraction helpers used by both kcl_docs and kcl_samples modules. """ import posixpath import re from urllib.parse import unquote import httpx from zoo_mcp import logger ZOO_BASE_URL = "https://zoo....
KittyCAD/mcp
src/zoo_mcp/utils/data_retrieval_utils.py
.py
7ad5cb3168aece10
7.5
9
import base64 import io import tempfile from pathlib import Path from typing import Literal from mcp.server.fastmcp.utilities.types import Image from mcp.types import ImageContent from PIL import Image as PILImage MAX_COLLAGE_IMAGES = 4 ImageFormat = Literal["jpeg", "png"] _IMAGE_SUFFIXES: dict[ImageFormat, str] = {...
KittyCAD/mcp
src/zoo_mcp/utils/image_utils.py
.py
2a457aacd964be39
7.5
9
import shutil from pathlib import Path import pytest from zoo_mcp import zoo_tools # Modules whose tests open engine websockets. Concurrent engine connections make # the engine drop sockets (surfacing as "received 1005"), so they all share one # xdist group and run on a single worker. _ENGINE_TEST_MODULES = frozense...
KittyCAD/mcp
tests/conftest.py
.py
a091d0932c6a7154
7
9
import pytest from zoo_mcp import ZooMCPException from zoo_mcp.zoo_tools import _check_kcl_code_or_path def test_check_kcl_code_or_path_with_code_only(): """Test that providing only kcl_code works without error.""" _check_kcl_code_or_path(kcl_code="some kcl code", kcl_path=None) def test_check_kcl_code_or_...
KittyCAD/mcp
tests/test_code_paths.py
.py
792acd096c07526e
8
9
from zoo_mcp import kcl_docs from zoo_mcp.utils.data_retrieval_utils import extract_excerpt def test_extract_title(): """Test title extraction from Markdown content.""" content = "# My Title\n\nSome content here." assert kcl_docs._extract_title(content) == "My Title" # Test with no title content_...
KittyCAD/mcp
tests/test_docs.py
.py
41fef72bc16ea2cd
8
9
from zoo_mcp import kcl_samples from zoo_mcp.utils.data_retrieval_utils import extract_excerpt def test_parse_index_markdown_basic(): """Index lines are split into name/title/description, dropping categories.""" markdown = ( "# CAD Samples Gallery\n" "\n" "## Samples\n" "\n" ...
KittyCAD/mcp
tests/test_samples.py
.py
2aa274f1c65ba16c
8
9
"""Shutdown handling for open modeling sessions. A leaked session pins an engine instance until the backend reaps it, so the server has to close them on the way out no matter how it is stopped. """ import signal import subprocess import sys import textwrap import pytest from zoo_mcp import server # Registers a ses...
KittyCAD/mcp
tests/test_shutdown.py
.py
01007c2b2ac9e907
8
9
"""Cold-start dependency bootstrap for fusion-skills entry-point scripts. The skill's Python scripts depend on `crowdstrike-falconpy` (and `pyyaml`). Those live in a managed virtualenv at ``~/.cache/claude-code-fusion/venv``, created by the plugin's SessionStart hook and used by ``scripts/python.sh``. But a script may...
CrowdStrike/fusion-skills
common/scripts/_bootstrap.py
.py
80b893f7c22f8473
7.48
8
#!/usr/bin/env python3 """ Delete CrowdStrike Falcon Fusion workflows via the Workflows delete API. Fusion DOES expose a workflow-delete API: FalconPy ``delete_definitions`` (endpoint ``WorkflowDefinitionsDelete``, DELETE /workflows/entities/definitions/v1). This script uses it to remove test/duplicate workflows by na...
CrowdStrike/fusion-skills
scripts/cleanup_workflows.py
.py
6e41f094d4b9c846
7.48
8
""" Delete a CrowdStrike Fusion workflow definition. Removes a workflow definition from the CID via the Workflows delete endpoint (FalconPy ``delete_definitions`` / ``WorkflowDefinitionsDelete``). Use this to clean up test, duplicate, or throwaway workflows. Deletion is permanent. This is the supported removal path —...
CrowdStrike/fusion-skills
skills/deployment/scripts/delete_workflow.py
.py
470cebc8971595b2
7.48
8
""" Export a CrowdStrike Fusion workflow definition to YAML. Fetches a deployed workflow definition by ID and writes its console import/export YAML — the same format the Falcon console produces via Workflows > (workflow) > Export. Use this to capture a live workflow as a reproducible artifact, verify what a deployed d...
CrowdStrike/fusion-skills
skills/deployment/scripts/export_workflow.py
.py
4619d67fce5a5b9a
7.48
8
""" Query existing CrowdStrike Fusion workflow definitions. Search by name, check for duplicates before importing, or list all workflows with optional filtering. This script should be run BEFORE importing to avoid creating duplicate workflow definitions. Usage: python query_workflows.py --list ...
CrowdStrike/fusion-skills
skills/deployment/scripts/query_workflows.py
.py
dbe5f5bf5c86936d
7.48
8
""" Release (enable) a CrowdStrike Fusion workflow definition. In Falcon Fusion, "releasing" a workflow means enabling its definition so the Fusion engine runs it against new trigger events. A freshly imported definition is disabled until it is enabled here. This script enables a definition by ID using the Workflows d...
CrowdStrike/fusion-skills
skills/deployment/scripts/release_workflow.py
.py
bffbb1b857e734ba
7.48
8
""" Fetch results for a CrowdStrike Fusion workflow execution. Given an execution ID (returned by trigger_workflow.py), retrieve the current status and output of that execution. This performs a single fetch — use monitor_execution.py to poll until the execution reaches a terminal state. Usage: python get_executio...
CrowdStrike/fusion-skills
skills/execution/scripts/get_execution_results.py
.py
174ffd9c943b2c93
7.48
8
""" Monitor a CrowdStrike Fusion workflow execution until it completes. Polls the execution-results API at a fixed interval until the execution reaches a terminal state (succeeded, failed, canceled, nonrecoverable, actionrequired) or the timeout elapses. Status updates are printed to stderr so the final result on stdo...
CrowdStrike/fusion-skills
skills/execution/scripts/monitor_execution.py
.py
2bb135289bb3968f
7.48
8
""" Trigger a CrowdStrike Fusion workflow and optionally wait for results. Executes an on-demand workflow by definition ID, passing parameters either as a JSON string (--params) or via interactive prompts derived from the workflow's parameter schema. With --wait, polls until the execution reaches a terminal state. Us...
CrowdStrike/fusion-skills
skills/execution/scripts/trigger_workflow.py
.py
7325019566624c43
7.48
8
""" Upload a new CrowdStrike Falcon Next-Gen SIEM lookup file. Usage: python create_lookup.py --file data.csv # Upload (filename from path) python create_lookup.py --file data.csv --name "blocklist.csv" # Custom remote name python create_lookup.py --file data.csv --json ...
CrowdStrike/fusion-skills
skills/lookup-files/scripts/create_lookup.py
.py
95c76bf1963f60ae
7.48
8
""" Delete a CrowdStrike Falcon Next-Gen SIEM lookup file. Usage: python delete_lookup.py --name "blocklist.csv" # Interactive confirmation python delete_lookup.py --name "blocklist.csv" --confirm # Skip confirmation python delete_lookup.py --name "blocklist.csv" --confirm --json # ...
CrowdStrike/fusion-skills
skills/lookup-files/scripts/delete_lookup.py
.py
6f9c4f0e32cc35b4
7.48
8
""" Download or display a CrowdStrike Falcon Next-Gen SIEM lookup file. Usage: python get_lookup.py --name "blocklist.csv" # Print to stdout python get_lookup.py --name "blocklist.csv" --output file.csv # Save to file python get_lookup.py --name "blocklist.csv" --domain falcon # S...
CrowdStrike/fusion-skills
skills/lookup-files/scripts/get_lookup.py
.py
e9a23931884557a5
7.48
8
""" List and search CrowdStrike Falcon Next-Gen SIEM lookup files. Usage: python list_lookups.py --list # List all python list_lookups.py --list --domain falcon # Filter by domain python list_lookups.py --search "blocklist" # Search by name pytho...
CrowdStrike/fusion-skills
skills/lookup-files/scripts/list_lookups.py
.py
754eb3c2fe010eb3
7.48
8
""" Replace the content of an existing CrowdStrike Falcon Next-Gen SIEM lookup file. Usage: python update_lookup.py --name "blocklist.csv" --file updated-data.csv python update_lookup.py --name "blocklist.csv" --file updated-data.csv --json The file is updated in the global namespace so CQL match() can resolv...
CrowdStrike/fusion-skills
skills/lookup-files/scripts/update_lookup.py
.py
5def3c273a383229
7.48
8
""" Verify a CrowdStrike Falcon Next-Gen SIEM lookup file works end to end. Uploads a CSV lookup, then runs a CQL query that synthesizes an event carrying a known value from the file's first data row and joins it back with match(). If the row comes back, the file is real, correctly formatted, and resolvable by match()...
CrowdStrike/fusion-skills
skills/lookup-files/scripts/verify_lookup.py
.py
c78ff2ef6dd828d9
7.48
8
""" Shared test fixtures and helpers for fusion-skills tests. All tests mock HTTP responses — no CrowdStrike API credentials are needed. """ import os import sys import pytest # Add every scripts directory to sys.path so tests can import the modules # by name (matching how the scripts import each other at runtime)....
CrowdStrike/fusion-skills
tests/conftest.py
.py
2dac6a380c5beb38
7.98
8
"""Tests for the cold-start dependency bootstrap (`_bootstrap.ensure_deps`). The shim re-execs a script through the managed venv wrapper when the marker dependency (falconpy) is missing, so a bare `python script.py` in a dependency-free interpreter still runs. These tests exercise the decision logic without actually r...
CrowdStrike/fusion-skills
tests/test_bootstrap.py
.py
2bcececb2f9e0bb2
7.98
8
""" Tests for scripts/convert_catalog_to_yaml.py. The converter turns a Content Library catalog record (a BPMN-style `model` graph) into the flat import YAML the Falcon console consumes. These tests exercise the graph-flattening logic directly on small in-memory models — no credentials or network. The trigger `event` ...
CrowdStrike/fusion-skills
tests/test_convert_catalog_to_yaml.py
.py
867f8ee6e530e346
7.98
8
"""Advanced FastAPI app — user management with Body and multiple methods.""" import json from typing import Optional from fastapi import Body, FastAPI app = FastAPI() @app.post("/users") def create_user( username: str = Body(..., description="Unique username"), email: str = Body(..., description="Email add...
tugrulguner/intpot
examples/advanced_api.py
.py
b4e2b2a007baaa4f
7.56
12
"""Advanced Typer CLI — task manager with multiple commands and types.""" import json import typer app = typer.Typer() @app.command() def create( title: str = typer.Argument(..., help="Task title"), priority: int = typer.Option(3, help="Priority level 1-5"), tags: str = typer.Option("", help="Comma-sep...
tugrulguner/intpot
examples/advanced_cli.py
.py
09968ce00984bd01
7.56
12
"""Advanced FastMCP server — note-taking tools with various param types.""" import hashlib import json from datetime import datetime from fastmcp import FastMCP mcp = FastMCP("notes-server") @mcp.tool() def create_note(title: str, body: str, tags: str = "") -> str: """Create a new note with a generated ID.""" ...
tugrulguner/intpot
examples/advanced_mcp.py
.py
e5d57a7ba743526b
7.56
12
"""Example FastAPI app for testing conversions.""" from fastapi import FastAPI app = FastAPI() @app.post("/add") def add(a: int, b: int) -> dict: """Add two numbers together.""" return {"result": a + b} @app.post("/greet") def greet(name: str, greeting: str = "Hello") -> dict: """Greet someone by name...
tugrulguner/intpot
examples/api_app.py
.py
300b218ca20508b6
7.06
12
"""Example Typer CLI app for testing conversions.""" import typer app = typer.Typer() @app.command() def add( a: int = typer.Argument(..., help="First number"), b: int = typer.Argument(..., help="Second number"), ) -> None: """Add two numbers together.""" typer.echo(a + b) @app.command() def greet...
tugrulguner/intpot
examples/cli_app.py
.py
c80ca3073b360927
7.56
12
"""FastAPI app generated by intpot.""" from fastapi import FastAPI, Body import json app = FastAPI() @app.post("/create") def create( title: str = Body(..., description="Task title"), priority: int = Body(default=3, description="Priority level 1-5"), tags: str = Body(default='', description="Comma-sepa...
tugrulguner/intpot
examples/conversions/advanced_cli_to_api.py
.py
7de3273e86dc76a4
7.56
12
"""MCP server generated by intpot.""" from fastmcp import FastMCP import json mcp = FastMCP("generated-server") @mcp.tool() def create( title: str, priority: int = 3, tags: str = '', ) -> str: """Create a new task with optional priority and tags.""" tag_list = [t.strip() for t in tags.split(',...
tugrulguner/intpot
examples/conversions/advanced_cli_to_mcp.py
.py
15c81aa374c29b93
7.56
12
"""FastAPI app generated by intpot.""" from fastapi import FastAPI, Body from datetime import datetime import hashlib import json app = FastAPI() @app.post("/create_note") def create_note( title: str = Body(...), body: str = Body(...), tags: str = Body(default=''), ) -> dict: """Create a new note w...
tugrulguner/intpot
examples/conversions/advanced_mcp_to_api.py
.py
c417261e5465fcc8
7.56
12
"""FastAPI app generated by intpot.""" from fastapi import FastAPI, Body app = FastAPI() @app.post("/add") def add( a: int = Body(..., description="First number"), b: int = Body(..., description="Second number"), ) -> dict: """Add two numbers together.""" return {'result': a + b} @app.post("/gree...
tugrulguner/intpot
examples/conversions/cli_to_api.py
.py
28f882a3f68cbf5e
7.56
12
"""FastAPI app generated by intpot.""" from fastapi import FastAPI, Body app = FastAPI() @app.post("/add") def add( a: int = Body(...), b: int = Body(...), ) -> dict: """Add two numbers together.""" return {'result': a + b} @app.post("/greet") def greet( name: str = Body(...), greeting: s...
tugrulguner/intpot
examples/conversions/mcp_to_api.py
.py
a16817578fc8f211
7.56
12
"""FastAPI app whose dependency injection is intentionally not convertible.""" from fastapi import Depends, FastAPI app = FastAPI() def get_current_user() -> dict: """Return the authenticated user for this example.""" return {"username": "example", "role": "member"} @app.get("/profile") def read_profile(u...
tugrulguner/intpot
examples/dependency_api.py
.py
af329ba106832874
7.06
12
"""Example FastMCP server for testing conversions.""" from fastmcp import FastMCP mcp = FastMCP("example-server") @mcp.tool() def add(a: int, b: int) -> int: """Add two numbers together.""" return a + b @mcp.tool() def greet(name: str, greeting: str = "Hello") -> str: """Greet someone by name.""" ...
tugrulguner/intpot
examples/mcp_server.py
.py
7c77bb544794bde2
7.06
12
"""Example: write once, serve as CLI, API, or MCP. Usage: intpot serve examples/universal_app.py --cli intpot serve examples/universal_app.py --api intpot serve examples/universal_app.py --mcp intpot eject examples/universal_app.py --to api """ from intpot import App app = App("example") @app.tool(...
tugrulguner/intpot
examples/universal_app.py
.py
9e4a1ff742b38582
7.56
12
"""Shared conversion logic for CLI commands.""" from __future__ import annotations import sys from pathlib import Path import typer from intpot.converter import ( UnsupportedFastAPIDependencyError, tools_for_target, ) from intpot.core.inspectors.base import InspectionError from intpot.core.models import Sou...
tugrulguner/intpot
src/intpot/commands/_convert.py
.py
875091be67d35d5a
7.56
12
"""Scaffold a new intpot project.""" from __future__ import annotations from enum import Enum from pathlib import Path import typer _SCAFFOLD_DIR = Path(__file__).resolve().parent.parent / "templates" / "scaffold" class ProjectType(str, Enum): mcp = "mcp" cli = "cli" api = "api" def init_command( ...
tugrulguner/intpot
src/intpot/commands/init.py
.py
16916d533dbd560c
7.56
12
"""Serve an intpot App as CLI, API, or MCP.""" from __future__ import annotations import sys from pathlib import Path import typer from intpot.core.detector import DetectionError, _import_module_from_path def _find_intpot_app(source_path: Path) -> object: """Import a module and find the intpot App instance.""...
tugrulguner/intpot
src/intpot/commands/serve.py
.py
dd21234993f3f240
7.56
12
"""Python API for intpot: load sources and convert programmatically.""" from __future__ import annotations import functools from pathlib import Path from typing import Any from intpot.core.detector import SourceImportError, detect_instance, detect_source from intpot.core.models import SourceType, ToolInfo class Un...
tugrulguner/intpot
src/intpot/converter.py
.py
38bc0ee85aeb0486
7.56
12
"""Auto-detect source type by importing a module and finding the app instance.""" from __future__ import annotations import ast import importlib.util import sys from pathlib import Path from typing import Any from intpot.core.models import SourceType _FRAMEWORK_CONSTRUCTORS = {"FastMCP", "Typer", "FastAPI"} class...
tugrulguner/intpot
src/intpot/core/detector.py
.py
80f527730d9ed88d
7.56
12
"""Shared Jinja2 rendering logic for generators.""" from __future__ import annotations import re from pathlib import Path from jinja2 import Environment, FileSystemLoader from intpot.core.models import ToolInfo _TEMPLATES_DIR = Path(__file__).resolve().parent.parent.parent / "templates" _TYPING_NAMES = { "Any...
tugrulguner/intpot
src/intpot/core/generators/_render.py
.py
f3c11e2777cb99c0
7.56
12
"""Generate a FastAPI app from ToolInfo.""" from __future__ import annotations from intpot.core.generators._render import render_template from intpot.core.generators.base import BaseGenerator from intpot.core.models import ToolInfo class APIGenerator(BaseGenerator): def generate(self, tools: list[ToolInfo]) -> ...
tugrulguner/intpot
src/intpot/core/generators/api.py
.py
59cb25ac2c4dbb8b
7.06
12
"""Abstract base generator.""" from __future__ import annotations from abc import ABC, abstractmethod from intpot.core.models import ToolInfo class BaseGenerator(ABC): @abstractmethod def generate(self, tools: list[ToolInfo]) -> str: """Generate source code from a list of ToolInfo.""" ...
tugrulguner/intpot
src/intpot/core/generators/base.py
.py
c7864fe35d5217e4
7.06
12
"""Generate a Typer CLI app from ToolInfo.""" from __future__ import annotations from intpot.core.generators._render import render_template from intpot.core.generators.base import BaseGenerator from intpot.core.models import ToolInfo class CLIGenerator(BaseGenerator): def generate(self, tools: list[ToolInfo]) -...
tugrulguner/intpot
src/intpot/core/generators/cli.py
.py
a8eb4cc26427dcc0
7.06
12
"""Generate a FastMCP server from ToolInfo.""" from __future__ import annotations from intpot.core.generators._render import render_template from intpot.core.generators.base import BaseGenerator from intpot.core.models import ToolInfo class MCPGenerator(BaseGenerator): def generate(self, tools: list[ToolInfo]) ...
tugrulguner/intpot
src/intpot/core/generators/mcp.py
.py
4605be31de52d2f8
7.06
12
"""Shared utilities for inspectors.""" from __future__ import annotations import ast import inspect import textwrap from typing import Any def python_type_name(annotation: Any) -> str: """Convert a type annotation to a string representation.""" if annotation is inspect.Parameter.empty or annotation is None:...
tugrulguner/intpot
src/intpot/core/inspectors/_utils.py
.py
904215749893a120
8.06
12
"""Extract endpoints from a FastAPI app instance.""" from __future__ import annotations import asyncio import inspect import re from collections.abc import Iterable, Iterator from typing import Any, cast from intpot.core.inspectors._utils import ( extract_function_body, extract_source_imports, python_ret...
tugrulguner/intpot
src/intpot/core/inspectors/api.py
.py
2992cb41d3dc1aaf
8.06
12
"""Abstract base inspector.""" from __future__ import annotations from abc import ABC, abstractmethod from typing import Any from intpot.core.models import ToolInfo class InspectionError(RuntimeError): """A framework app was detected but could not be inspected safely.""" class BaseInspector(ABC): @abstra...
tugrulguner/intpot
src/intpot/core/inspectors/base.py
.py
5c40ba009bde3ac6
7.56
12
"""Extract commands from a Typer app instance.""" from __future__ import annotations import asyncio import inspect from typing import Annotated, Any, get_args, get_origin from intpot.core.inspectors._utils import ( extract_function_body, extract_source_imports, python_type_name, ) from intpot.core.inspec...
tugrulguner/intpot
src/intpot/core/inspectors/cli.py
.py
b4d8e9cdf7a03460
8.06
12
"""Extract tools from a FastMCP server instance.""" from __future__ import annotations import asyncio import concurrent.futures import inspect from collections.abc import Callable, Coroutine, Mapping from typing import Annotated, Any, cast, get_args, get_origin from intpot.core.inspectors._utils import ( extract...
tugrulguner/intpot
src/intpot/core/inspectors/mcp.py
.py
1d587d233019f509
8.06
12
"""Shared data models for the inspect -> normalize -> generate pipeline.""" from __future__ import annotations import keyword import re from dataclasses import dataclass, field from enum import Enum from typing import Any class SourceType(Enum): MCP = "mcp" CLI = "cli" API = "api" class Agent(str, Enu...
tugrulguner/intpot
src/intpot/core/models.py
.py
e59b80b317818c8f
7.56
12
import os import requests import json import sys import time import hashlib def load_env(): """本地调试:从 .env 文件加载环境变量""" env_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), '.env') if os.path.exists(env_path): with open(env_path, 'r') as f: for line in f: l...
Hana19951208/BlogImagesBox
scripts/sync_to_wechat.py
.py
763d7b73b7a791be
7.42
6
"""Fetch reaction counts from GitHub issue comments and produce likes.json + comment_map.json. Scans all "Cat Gallery - YYYY-MM" issues, reads comments, parses cat numbers, and sums positive reactions (👍 ❤️ 😄 🎉 🚀 👀). Run by GitHub Actions hourly or manually. """ import json import re import subprocess import sy...
yazelin/catime
scripts/fetch_likes.py
.py
625a5e18687bca01
7.5
9
#!/usr/bin/env python3 """Generate an Atom feed (docs/feed.xml) from catlist.json.""" import json import os from datetime import datetime, timezone from xml.etree.ElementTree import Element, SubElement, ElementTree FEED_TITLE = "Catime - AI Cat Gallery" FEED_LINK = "https://yazelin.github.io/catime/" GALLERY_BASE = "...
yazelin/catime
scripts/generate_rss.py
.py
9a692c869d23c484
7.5
9
"""Post the latest cat image to a Telegram channel. Run after generate_cat.py.""" import json import os import subprocess import sys import urllib.error import urllib.request from pathlib import Path STATE_FILE = Path(".telegram_last_posted.json") def get_latest_cat() -> dict | None: """Get the latest successfu...
yazelin/catime
scripts/post_telegram.py
.py
283be05b915aa82a
7.5
9
"""CLI entry point for catime - view AI-generated hourly cats.""" import argparse import json import re import sys from datetime import datetime, timezone, timedelta from pathlib import Path from catime.utils.http import safe_get_json # Data files are served by GitHub Pages (no anonymous rate limit); # raw.githubuse...
yazelin/catime
src/catime/cli.py
.py
1355e678ac7fbc9d
7.5
9
"""Mock helpers for tests.""" class MockOpenAI: """Mock OpenAI client for testing.""" def __init__(self): self.calls = [] class MockGemini: """Mock Gemini client for testing.""" def __init__(self): self.images = [] def generate_image(self, prompt: str) -> dict: self.im...
yazelin/catime
tests/mock_helpers.py
.py
6e5435ee7df1fe1e
7.5
9
"""Pure v4.4.1 Admin Agent quorum and Leader fencing contracts. The database service is responsible for transactions and persistence. This module contains only deterministic decisions so every database adapter and test suite uses the same safety rules. """ from __future__ import annotations from dataclasses import ...
Haiwen-Yin/AI-Agent-Infra-with-PG-Community-Edition
scripts/lib/admin_ha.py
.py
658b589c50cfdf37
7.56
12
"""Database-backed opaque cursor contract for v4.4.1 inventories. Cursor records bind the authenticated principal, resource, canonical filters, sort order and page size. They are intentionally short-lived and do not contain a SQL fragment or an authorization decision supplied by the client. """ from __future__ impor...
Haiwen-Yin/AI-Agent-Infra-with-PG-Community-Edition
scripts/lib/cursor_pagination.py
.py
f8417623ec65f84e
7.56
12
"""PostgreSQL 18 Apache AGE projection adapter. Only this adapter contains AGE/Cypher syntax. The shared Graph service stays portable and can later be paired with a PostgreSQL 19 native adapter. """ from typing import Any, Dict, List, Optional, Tuple try: from .graph_predicate import compile_safe_predicate, sta...
Haiwen-Yin/AI-Agent-Infra-with-PG-Community-Edition
scripts/lib/graph_adapter.py
.py
2c61e28371ca4ce3
7.56
12
"""Test-gated reliability controls and evidence for the Graph Runtime. The database remains the authority for Graph state. This module deliberately does not offer HTTP, Skill, MCP, or Agent entry points: failpoints are only available to an in-process test which explicitly enables them. Recovery evidence is durable w...
Haiwen-Yin/AI-Agent-Infra-with-PG-Community-Edition
scripts/lib/graph_assurance.py
.py
87450d22fbfac983
7.56
12
"""Database-independent contracts shared by Graph services and tests.""" from __future__ import annotations import hashlib import json from typing import Any, Dict, Iterable, Optional GRAPH_STATUSES = frozenset({"DRAFT", "VALIDATED", "PUBLISHED", "DEPRECATED", "ARCHIVED"}) class CompletionContractError(ValueError...
Haiwen-Yin/AI-Agent-Infra-with-PG-Community-Edition
scripts/lib/graph_contracts.py
.py
89c0971382a59cc6
7.56
12
"""Graph-specific authorization, budgets, evaluation, and interventions.""" from __future__ import annotations import json import hashlib import uuid from datetime import datetime, timezone from typing import Any, Dict, Optional from . import connection def _id(prefix: str) -> str: return f"{prefix}_{uuid.uuid...
Haiwen-Yin/AI-Agent-Infra-with-PG-Community-Edition
scripts/lib/graph_governance.py
.py
8429e9adb70cbeb4
7.56
12
import datetime from pathlib import Path from cliany_site.config import get_config def _log_file() -> Path: return get_config().activity_log_path def write_log( action: str, domain: str = "", command: str = "", status: str = "", details: str = "", ) -> None: """Append one log line: {tim...
pearjelly/cliany.site
src/cliany_site/activity_log.py
.py
2f136e9a58ca1fda
7.52
10
from __future__ import annotations import logging import shutil import subprocess import sys import tarfile import zipfile from pathlib import Path from cliany_site.binary.releases import ArtifactSpec from cliany_site.envelope import ErrorCode from cliany_site.errors import ClanySiteError logger = logging.getLogger(...
pearjelly/cliany.site
src/cliany_site/binary/cache.py
.py
d5f9aba938b8fbcc
7.52
10
# src/cliany_site/binary/platforms.py from dataclasses import dataclass @dataclass(frozen=True) class PlatformTarget: os: str # 'darwin' | 'linux' | 'windows' arch: str # 'x86_64' | 'arm64' | 'amd64' target_key: str # 如 'darwin-arm64', 'linux-x86_64', 'windows-x86_64' exe_suffix: s...
pearjelly/cliany.site
src/cliany_site/binary/platforms.py
.py
07d2abb88fcb49e4
7.52
10
# src/cliany_site/binary/releases.py from __future__ import annotations from dataclasses import dataclass from pathlib import Path from cliany_site.binary.platforms import PlatformTarget, get_artifact_filename from cliany_site.envelope import ErrorCode from cliany_site.errors import ClanySiteError @dataclass(frozen...
pearjelly/cliany.site
src/cliany_site/binary/releases.py
.py
0fd0eb402b3a7371
7.52
10
# src/cliany_site/browser/launcher.py import json import os import shutil import subprocess import time import urllib.error import urllib.request from pathlib import Path from cliany_site.config import get_config class ChromeNotFoundError(Exception): """Chrome 二进制文件未找到""" pass def find_chrome_binary() -> ...
pearjelly/cliany.site
src/cliany_site/browser/launcher.py
.py
2285172f63b4bcd9
7.52
10
"""CapabilityRouter — API endpoint sniffing and action routing. 零外部依赖:仅使用 Python stdlib。 """ from __future__ import annotations from dataclasses import dataclass @dataclass class ApiEndpoint: url: str method: str status: int sample_response_keys: list[str] content_type: str @dataclass class R...
pearjelly/cliany.site
src/cliany_site/capability.py
.py
715eede23b22f042
7.52
10
"""命名转换和文本清洗工具函数。 提供 Click 命令名、Python 函数名、参数名的规范化转换, 以及行内文本 / docstring 文本的安全清洗。 """ from __future__ import annotations import re def to_command_name(name: str, index: int) -> str: """将原始名称转换为 Click 命令名(小写、连字符分隔)。""" normalized = re.sub(r"[^a-zA-Z0-9_-]+", "-", (name or "").strip().lower()) normalized ...
pearjelly/cliany.site
src/cliany_site/codegen/naming.py
.py
4bfd8f2491d73c19
7.52
10
#!/usr/bin/env python3 """Add @pytest.mark.fast markers to unit test files that lack them. This script: 1. Finds all test files in tests/unit/ without @pytest.mark.fast 2. Adds pytestmark = pytest.mark.fast at the module level 3. Handles files that already have pytestmark (extends the list) 4. Skips files marked as sl...
BenchBox-dev/BenchBox
_project/scripts/add_fast_markers.py
.py
9d03c8e9f14f4b0a
7.54
11
#!/usr/bin/env python3 """Backfill `develop_sha` frontmatter into historical audit Markdown files.""" from __future__ import annotations import argparse import subprocess import sys from dataclasses import dataclass from pathlib import Path from audit_sha_check import AuditShaError, parse_frontmatter, run_git @dat...
BenchBox-dev/BenchBox
_project/scripts/audit_sha_backfill.py
.py
073d1e4f0e8c6330
7.54
11
#!/usr/bin/env python3 """Validate tree and measurement SHA provenance on audit Markdown files.""" from __future__ import annotations import argparse import re import subprocess import sys from dataclasses import dataclass from pathlib import Path SHA_RE = re.compile(r"^[0-9a-fA-F]{40}$") NUMERIC_EVIDENCE_RE = re.co...
BenchBox-dev/BenchBox
_project/scripts/audit_sha_check.py
.py
5c363ce7c97dd368
7.54
11
#!/usr/bin/env python3 """Decide whether a `make ci-lint` guard is meaningful on a CI runner. `ci-lint` (Makefile) exists to mirror the `pr.yml` `code-lint` job locally (docs/operations/ci-local-parity.md), but `develop-post-merge.yml` also runs `make ci-lint` directly on a real, ephemeral GitHub-hosted runner -- not ...
BenchBox-dev/BenchBox
_project/scripts/ci_lint_environment_gate.py
.py
aa3b7e0ed8574230
7.54
11
#!/usr/bin/env python3 """Cross-surface applicability sweep (benchmark-cross-surface-equivalence-gate w2). The oracle coverage map flags a benchmark as a cross-surface candidate when it is dual-surface (ships SQL queries AND has ``supports_dataframe=True``) and currently unguarded. But ``supports_dataframe`` is a *loa...
BenchBox-dev/BenchBox
_project/scripts/cross_surface_applicability_sweep.py
.py
f850963ad8a8442d
7.54
11
#!/usr/bin/env python3 """Detect + prune RESOLVED cross-surface known-divergence baseline entries. Supporting glue for the scheduled workflow ``.github/workflows/cross-surface-baseline-autodetect.yml``. #903 made every enforced cross-surface gate (``benchbox/core/equivalence/cross_surface.py`` ``GATES``) FAIL a normal...
BenchBox-dev/BenchBox
_project/scripts/cross_surface_baseline_autodetect.py
.py
7f985e9b262f1a92
7.54
11
"""Scan source for `import X` / `from X` for every declared dep. w2 of the dependency audit. Emits a JSON map { package -> [file:line] } so later steps can classify each dep as KEEP / FLAG-UNUSED / etc. Walks benchbox/, scripts/, tests/, docs/ and parses Python files via the `ast` module. ast is robust against multi-...
BenchBox-dev/BenchBox
_project/scripts/dependency_audit/scan_imports.py
.py
4f43a549a7473a56
7.54
11
"""Static detector for correlated-subquery self-binding in benchmark SQL. PR #756 fixed three TPC-Havoc SQL variants where a correlated subquery's UNQUALIFIED correlation column silently bound to the INNER relation instead of the intended outer table, degenerating a per-row correlation into an uncorrelated scan (wrong...
BenchBox-dev/BenchBox
_project/scripts/detect_self_binding.py
.py
46aaf6790c92a9f4
7.54
11
"""Canonical cohort-comparison arithmetic for the results explorer. These are the reference formulas that both the DuckDB pipeline populate step and any runtime SQL window-function computation must agree with. Kept here (under ``_project/scripts/explorer_pipeline/``) so the registry in ``_project/planning/visible_metr...
BenchBox-dev/BenchBox
_project/scripts/explorer_pipeline/compare_math.py
.py
4940e5f5a82d9f2a
7.54
11
"""Maintainer entry point for publishing the Results Explorer read model.""" from __future__ import annotations import json import sys from pathlib import Path import click # `_project/` is a PEP 420 implicit namespace package (no `__init__.py`) and is # excluded from the wheel build (see `tool.setuptools.packages....
BenchBox-dev/BenchBox
_project/scripts/explorer_publish.py
.py
593c96a70fe62131
7.54
11
#!/usr/bin/env python3 """Regenerate the bounded correctness-gate TPC-H value-digest reference. This WRITES ``benchbox/core/expected_results/reference_digests/tpch_value_digests_sf1.json`` from a live gate run, replacing the historical hand-copy (the old provenance note asked a human to run the gate and paste the stre...
BenchBox-dev/BenchBox
_project/scripts/regenerate_correctness_gate_digests.py
.py
8449d21a2877db1b
7.54
11
#!/usr/bin/env python3 """Shared required-lane classifier for develop PR observers. Both ``green_unmerged_sweep.py`` and ``soundness_drain_report.py`` classify the same lane — every required status context in the ``develop-squash-only`` ruleset (``docs/operations/repo-admin-settings.md``, live id ``15611785``). This m...
BenchBox-dev/BenchBox
_project/scripts/required_lane.py
.py
d5b8b2e29a6906f9
7.54
11
#!/usr/bin/env python3 """Deterministically migrate curated Explorer bundles to the public path contract. The default mode is a dry run. ``--write`` atomically rewrites primary bundles, JSON companions, and their manifests with the same public anonymizer used by the Explorer publication boundary. A migration manifes...
BenchBox-dev/BenchBox
_project/scripts/results_explorer_corpus_migrate.py
.py
056343e6bfeaa021
7.54
11
#!/usr/bin/env python3 """Fail when active source revives the retired mixed-theme Results Explorer contract. The current product contract is the shared BenchBox `system` / `light` / `dark` theme. Earlier planning evidence described a retired "dark BenchBox shell + light analytical data panels" contract; if those phras...
BenchBox-dev/BenchBox
_project/scripts/scan_explorer_stale_theme.py
.py
43bcc80c4cc2c8cf
7.54
11