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 logging import queue import time import re import atexit from logging.handlers import QueueHandler, RotatingFileHandler from rich.logging import RichHandler from pydantic import BaseModel from typing import Optional, Tuple from pathlib import Path class LoggingConfig(BaseModel): log_level: str = "INFO" ...
mozarkai/optics-framework
optics_framework/common/logging_config.py
.py
375a6c45a470cffd
7.52
10
from uuid import uuid4 from enum import Enum from typing import Optional, Dict, List, Callable, Any from pydantic import BaseModel, Field from optics_framework.common.logging_config import internal_logger from optics_framework.common.error import OpticsError, Code # State Enum class State(str, Enum): NOT_RUN = "NO...
mozarkai/optics-framework
optics_framework/common/models.py
.py
9d3797ef232d047c
7.52
10
from typing import Union, List, Dict, Optional, Type, TypeVar, Any from pydantic import BaseModel from optics_framework.common.base_factory import InstanceFallback from optics_framework.common.driver_interface import DriverInterface from optics_framework.common.elementsource_interface import ElementSourceInterface from...
mozarkai/optics-framework
optics_framework/common/optics_builder.py
.py
087ed11f1cc72ac0
7.52
10
import csv import yaml import re import inspect from abc import ABC, abstractmethod from typing import Callable, Optional, Dict, Union, List, Tuple, cast from optics_framework.common.logging_config import internal_logger from optics_framework.common.models import ( ApiData, ApiDefinition, ExpectedResultDefi...
mozarkai/optics-framework
optics_framework/common/runner/data_reader.py
.py
cafa76575a2adddd
7.52
10
from typing import Callable, Dict, Optional from optics_framework.common.logging_config import internal_logger class KeywordRegistry: """ Manages a mapping of keyword function names to their methods. This class maintains a registry of callable methods extracted from given instances. It maps public me...
mozarkai/optics-framework
optics_framework/common/runner/keyword_register.py
.py
d57d82709c83c82e
7.52
10
import abc from typing import Dict, List, Optional import shutil import json from pydantic import BaseModel, Field from rich.live import Live from rich.tree import Tree from rich.text import Text from rich.panel import Panel from rich.progress import Progress, TaskID from rich.console import Group from rich import get_...
mozarkai/optics-framework
optics_framework/common/runner/printers.py
.py
7591c31b8dec1063
7.52
10
import cv2 import time import threading import queue from skimage.metrics import structural_similarity as ssim from optics_framework.common import utils from optics_framework.common.logging_config import internal_logger class ScreenshotStream: def __init__(self, capture_screenshot_callable, max_queue_size=100, deb...
mozarkai/optics-framework
optics_framework/common/screenshot_stream.py
.py
83e62529589bd01a
7.52
10
import shutil import tempfile import uuid import asyncio from abc import ABC, abstractmethod from typing import Dict, Optional from pathlib import Path from optics_framework.common.Junit_eventhandler import setup_junit, cleanup_junit from optics_framework.common.config_handler import Config, ConfigHandler from optics_f...
mozarkai/optics-framework
optics_framework/common/session_manager.py
.py
508a6ae62c7ba241
7.52
10
"""Shared LLM-driven step curation for the NL agent and AI self-heal. Both :class:`~optics_framework.common.nl_agent.NaturalLanguageAgent` and :class:`~optics_framework.common.ai_self_heal.AISelfHealHandler` drive the UI one keyword at a time and finish with an ordered list of *successful* steps that may still contain...
mozarkai/optics-framework
optics_framework/common/step_curation.py
.py
2fb365a224ddf7d4
7.52
10
from abc import ABC, abstractmethod from typing import Optional, Tuple, Any, List class TextInterface(ABC): """ Abstract base class for text processing engines. This interface defines methods for detecting and locating text (e.g., via OCR) within input data, such as images or video frames, implementi...
mozarkai/optics-framework
optics_framework/common/text_interface.py
.py
1dc3bfa13d988ee3
7.52
10
from typing import TYPE_CHECKING, Optional, Tuple, Any from fuzzywuzzy import fuzz from bs4 import BeautifulSoup from lxml import html from selenium.webdriver.common.by import By from selenium.common.exceptions import NoSuchElementException from optics_framework.common.logging_config import internal_logger from optics_...
mozarkai/optics-framework
optics_framework/engines/drivers/selenium_UI_helper.py
.py
9db1600e3a8e05a9
7.52
10
# pyright: standard """Address — typed heap/region address.""" from __future__ import annotations from dataclasses import dataclass @dataclass(frozen=True) class Address: """A heap object or region address (e.g., 'obj_0', 'arr_3', 'mem_0').""" value: str def __post_init__(self) -> None: if not...
avishek-sen-gupta/red-dragon
interpreter/address.py
.py
f02342b1c67fa5e3
7.56
12
# pyright: standard """Pure functions to extract ErrorSpan regions from a tree-sitter AST.""" from __future__ import annotations import logging from functools import reduce from typing import Any from interpreter.ast_repair.error_span import ErrorSpan logger = logging.getLogger(__name__) def extract(root_node: An...
avishek-sen-gupta/red-dragon
interpreter/ast_repair/error_span_extractor.py
.py
4657cf95fa45fe27
7.56
12
# pyright: standard """Builds LLM prompts for syntax repair and parses responses.""" from __future__ import annotations import logging from dataclasses import dataclass from interpreter.ast_repair.error_span import ErrorSpan logger = logging.getLogger(__name__) FRAGMENT_DELIMITER = "===FRAGMENT===" @dataclass(fr...
avishek-sen-gupta/red-dragon
interpreter/ast_repair/repair_prompter.py
.py
4539ac51b3ffead9
7.56
12
# pyright: standard """Decorator that wraps any Frontend, repairing tree-sitter parse errors via LLM.""" from __future__ import annotations import logging from interpreter.ast_repair.error_span_extractor import extract from interpreter.ast_repair.repair_config import RepairConfig from interpreter.ast_repair.repair_p...
avishek-sen-gupta/red-dragon
interpreter/ast_repair/repairing_frontend_decorator.py
.py
2cc223e6ca739b56
7.56
12
"""CFG Builder.""" from __future__ import annotations from interpreter import constants from interpreter.cfg_types import ( CFG, BasicBlock, ) # noqa: F401 — re-exported for backwards compatibility from interpreter.instructions import ( Branch, BranchIf, CallCtorFunction, CallFunction, Ha...
avishek-sen-gupta/red-dragon
interpreter/cfg.py
.py
7ae627bc1e73eb17
7.56
12
# pyright: standard """ClassName — typed class/type name.""" from __future__ import annotations from dataclasses import dataclass @dataclass(frozen=True) class ClassName: """A class or type name.""" value: str def __post_init__(self) -> None: if not isinstance(self.value, str): rai...
avishek-sen-gupta/red-dragon
interpreter/class_name.py
.py
d439a1c9298dec1f
7.56
12
# pyright: standard """ClosureId — typed closure environment identifier.""" from __future__ import annotations from dataclasses import dataclass @dataclass(frozen=True) class ClosureId: """A closure environment identifier (e.g., 'closure_42').""" value: str def __post_init__(self) -> None: if ...
avishek-sen-gupta/red-dragon
interpreter/closure_id.py
.py
2231c80faf577fd5
7.56
12
"""Neutral access-method outcome — the engine's shared, consumer-agnostic result. Carries the underlying access-method *condition*, NOT any consumer's status vocabulary (no COBOL FILE STATUS, no CICS EIBRESP). Each consumer adapter maps AccessCondition to its own vocabulary. """ from __future__ import annotations fr...
avishek-sen-gupta/red-dragon
interpreter/cobol/access_result.py
.py
d26c1516a7be4398
7.56
12
# pyright: standard """Alphanumeric encoding/decoding — reference implementation. Ported from smojol's AlphanumericDataTypeSpec.java. Uses EBCDIC encoding, right-pads with EBCDIC spaces (0x40), truncates from the right if over-length. This is a reference implementation for testing — NOT a VM builtin. """ from __futu...
avishek-sen-gupta/red-dragon
interpreter/cobol/alphanumeric.py
.py
f3278316f7ba0c54
7.56
12
# pyright: standard """COBOL ASG types — frozen dataclasses defining the JSON contract. These dataclasses represent the Abstract Semantic Graph produced by the ProLeap bridge (Java/ANTLR4). The bridge parses COBOL source and emits JSON to stdout; these types consume that JSON via from_dict(). """ from __future__ impo...
avishek-sen-gupta/red-dragon
interpreter/cobol/asg_types.py
.py
0e74ee7ff6310598
7.56
12
# pyright: standard """AstStore — a per-run, parallel, strategy-backed cache of parsed COBOL ASGs. The knowledge-graph and multi-file-compile paths parse many programs; holding every CobolASG in RAM does not scale. AstStore parses in parallel (thread pool over the JVM bridge) and, under the DISK strategy, keeps only r...
avishek-sen-gupta/red-dragon
interpreter/cobol/ast_store.py
.py
ee2f616e36536e1d
7.56
12
# pyright: standard """COMP/BINARY big-endian two's complement encoding/decoding — reference implementation. COMP (also COMP-4, BINARY) stores numeric values as big-endian two's complement integers. The PIC clause determines the digit count, which determines byte size: - 1-4 digits -> 2 bytes (halfword) - 5-9 dig...
avishek-sen-gupta/red-dragon
interpreter/cobol/binary.py
.py
cd4a8c8fb68128fe
7.56
12
# pyright: standard """Named constants for COBOL encoding/decoding — eliminates magic hex values and strings.""" from __future__ import annotations from enum import StrEnum class NibblePosition(StrEnum): """Position of a nibble within a byte.""" HIGH = "high" LOW = "low" class CobolEncoding(StrEnum):...
avishek-sen-gupta/red-dragon
interpreter/cobol/cobol_constants.py
.py
78dd015171746e4f
7.56
12
# pyright: standard """COBOL arithmetic expression tree. Expression trees are emitted in structured JSON by the ProLeap bridge (``serializeArithmeticExpr``) and consumed via :func:`expr_from_dict`. This module defines the :data:`ExprNode` dataclass hierarchy plus the :func:`expr_from_dict` / :func:`expr_to_dict` (de)s...
avishek-sen-gupta/red-dragon
interpreter/cobol/cobol_expression.py
.py
b49a13e785a43236
7.56
12
# pyright: standard """COBOL parser — subprocess bridge to ProLeap. The ProLeap bridge is a separate Java repo that parses COBOL source using ANTLR4 and emits JSON ASG to stdout. This module wraps the subprocess call and deserializes the JSON into CobolASG. """ from __future__ import annotations import json import l...
avishek-sen-gupta/red-dragon
interpreter/cobol/cobol_parser.py
.py
797b58e85c230434
7.56
12
# pyright: standard """COBOL type descriptors — pure dataclasses for type metadata.""" from __future__ import annotations from dataclasses import dataclass from enum import Enum class CobolDataCategory(str, Enum): """COBOL data type categories supported by the type system. These are STORAGE categories, coa...
avishek-sen-gupta/red-dragon
interpreter/cobol/cobol_types.py
.py
5841f50beb245c60
7.56
12
# pyright: standard """COMP-3 (packed BCD) encoding/decoding — reference implementation. Ported from smojol's Comp3DataTypeSpec.java. Two digits per byte, sign in the low nibble of the last byte. Size = (total_digits // 2) + 1. Sign nibble: 0xC = positive, 0xD = negative, 0xF = unsigned. This is a reference implement...
avishek-sen-gupta/red-dragon
interpreter/cobol/comp3.py
.py
2a0e3f7ddcb7c0f1
7.56
12
# pyright: standard """Condition name types for COBOL level-88 condition names. A level-88 entry defines named conditions on a parent field. Each condition has one or more values (discrete or THRU ranges) that the parent field can match. For example: 05 WS-STATUS PIC X(1). 88 STATUS-ACTIVE VALUE 'A'. ...
avishek-sen-gupta/red-dragon
interpreter/cobol/condition_name.py
.py
6087dc625310315b
7.56
12
# pyright: standard """Condition name index — maps level-88 condition names to parent fields. Builds a lookup from condition names to their parent field name and associated values, enabling condition_lowering to expand bare condition name references (e.g. IF STATUS-ACTIVE) into parent field comparisons. """ from __fu...
avishek-sen-gupta/red-dragon
interpreter/cobol/condition_name_index.py
.py
f32fcbb6fd380d42
7.56
12
# pyright: standard """Data alignment filters for COBOL numeric formatting. Ported from smojol's RightAdjuster, LeftAdjuster, DecimalPointAligner. Pure functions — zero dependencies. """ from __future__ import annotations def right_adjust(value: str, length: int) -> str: """Right-pad with spaces, truncate from ...
avishek-sen-gupta/red-dragon
interpreter/cobol/data_filters.py
.py
8638ab187e6c7cd7
7.56
12
# pyright: standard """EBCDIC ↔ ASCII bidirectional lookup tables. Ported from smojol's ByteConverter.java — 256-entry mapping between EBCDIC (Code Page 037 / CP500 common subset) and ASCII. """ from __future__ import annotations # fmt: off # EBCDIC-to-ASCII lookup: index = EBCDIC byte, value = ASCII byte. _EBCDIC_T...
avishek-sen-gupta/red-dragon
interpreter/cobol/ebcdic_table.py
.py
401d19df28b953f5
7.56
12
"""COBOL edit-picture formatting. Applies COBOL editing rules when a value is MOVEd into an edited receiving item. Two categories are edited: numeric-edited (e.g. ``PIC +99999999.99``, ``+ZZZ,ZZZ,ZZZ.99``, ``Z(9).99-``), handled by :func:`format_edited`, and alphanumeric-edited (e.g. ``PIC XXBXXBXX``, ``XX/XX/XXXX``),...
avishek-sen-gupta/red-dragon
interpreter/cobol/edit_picture.py
.py
e3b01e757ba133e6
7.56
12
"""Auto-discovered skill evals from sibling test_cases.yaml files. The eval framework discovers skills by scanning subdirectories of evals/skills/. Each skill directory must contain: - system_prompt.md — the system prompt sent to the agent - test_cases.yaml — one or more test cases (query, schema, expected) Op...
openshift/agentic-skills
evals/skills/test_eval.py
.py
3fb889a78ee5cc1c
7.98
8
"""Stdio framing codec (Content-Length / JSONL).""" from __future__ import annotations import json from typing import Any class AcpCodec: """Header & line framing codec for JSON-RPC 2.0 stdio.""" @staticmethod def read_message(stream: Any, max_bytes: int = 10 * 1024 * 1024) -> tuple[dict[str, Any] | No...
pvnc228/local-coding-agent
local_coding_agent/acp_server/_codec.py
.py
5dfeb5064468126b
7.5
9
"""VRAM-based worker-pool calibration for one Ollama model runtime. The worker pool cannot promise physical parallelism that a single machine does not have. This module answers one question: given a model and a VRAM budget, how many concurrent worker slots can we run without over-subscribing memory? """ from __future...
pvnc228/local-coding-agent
local_coding_agent/calibration.py
.py
2c200148a5e027e8
7.5
9
"""Harness State Machine and Context Manager (R14). Provides deterministic state tracking and stateless context assembly for local models. """ from __future__ import annotations import json from dataclasses import dataclass, field from typing import Any from .task import TaskEnvelope @dataclass class HarnessState...
pvnc228/local-coding-agent
local_coding_agent/context_manager.py
.py
3853fecaa191f2cf
7.5
9
"""Harness-agnostic delegating agent: decompose, delegate, decompose further. The delegating agent owns the outer "expensive agent" loop: it breaks a wide task into bounded children using decomposition templates, delegates each child through the transport-neutral ``delegate`` seam, and on a decomposable failure re-spl...
pvnc228/local-coding-agent
local_coding_agent/delegator.py
.py
2acec90b5ffc08ed
7.5
9
"""Desktop Harness embedded HTTP server with persistent storage and process orchestration.""" from __future__ import annotations import json import os import subprocess import threading import time from http.server import ThreadingHTTPServer from pathlib import Path from typing import Any from ...stats import Delega...
pvnc228/local-coding-agent
local_coding_agent/desktop/server/_server.py
.py
60a7c0c8e46c28dc
7.5
9
"""Lifecycle hook bridge: registry and dispatcher (R30).""" from __future__ import annotations import re import threading import uuid from dataclasses import asdict, dataclass from typing import Any, Callable from ._decision import HookDecision @dataclass class _HookRegistration: hook_id: str point: str ...
pvnc228/local-coding-agent
local_coding_agent/hooks/_bridge.py
.py
4c97e8fc0f034787
7.5
9
# wrap a recurrent policy so its carried state - the memory - threads through # a rollout, reset to `init_memory` on each episode start from __future__ import annotations import torch from torch import atleast_1d, cat, nn from populora._utils import cast_tensor, default, exists # helpers def init_memory_tensor(ini...
lucidrains/populora
populora/memory.py
.py
7b0d4c8e448aabd6
7.64
18
"""Build the legal-Estonian collocation / frequency index that powers the `common_legal_usage` tool — the "what's the canonical legal phrasing" engine. DATA, THE SMART WAY: we never store the corpus, only the statistics distilled from it. The source is streamed sentence-by-sentence; each is lemmatised with Vabamorf (t...
silly-geese/estonian-mcp
scripts/build_legal_collocations.py
.py
f0ab1480e8cb1a38
7.63
17
"""Tests for per-IP rate-limit bucketing (public mode). The bug these pin down: `_client_ip` returned `scope["client"][0]`, which uvicorn had rewritten from the LEFTMOST `X-Forwarded-For` entry. A proxy APPENDS to whatever the caller sent, so the leftmost entry is entirely caller-controlled — meaning any caller could ...
silly-geese/estonian-mcp
tests/test_client_ip.py
.py
6912f83fbe8fe028
8.13
17
"""Unit tests for the compound-familiarity verdict. `_familiarity_verdict` is the pure decision behind check_compound_familiarity. Splitting it out means the coinage heuristic can be tested WITHOUT loading the 33 MB fastText model — we feed it real nearest-neighbour data captured from the production model and assert t...
silly-geese/estonian-mcp
tests/test_familiarity.py
.py
50570a10a6abdb09
8.13
17
"""Tests for attributive indeclinability (issue #42). `_is_indeclinable_attr` decides whether an attribute stays in base form under adjective-noun agreement. Two defects are pinned here. 1. The reported one: the `-mata` form was omitted. EKI is explicit that it is the tud-participle's negative counterpart and "jää...
silly-geese/estonian-mcp
tests/test_indeclinable.py
.py
a2b54cbc0cfb1454
8.13
17
"""Tests for the legal-Estonian tools (check_legalese, check_defined_terms). Both are pure (Vabamorf morphology + regex, no fastText/WordNet), so they run locally without the model artifacts. The check_compound_familiarity legal de-noise assertion lives in test_smoke.py (it needs the fastText model, which only CI has)...
silly-geese/estonian-mcp
tests/test_legal.py
.py
4062cda2a08a02d9
8.13
17
"""PRIVACY.md says the running server makes no outbound HTTP calls. This test enforces it instead of trusting it. Every tool is invoked with `socket.socket.connect` and `socket.create_connection` replaced by a raiser, so any attempt to open an outbound connection fails loudly and names the tool that tried. Why this e...
silly-geese/estonian-mcp
tests/test_no_network.py
.py
48adb4c6496c974a
8.13
17
"""Tests for the editorial tools: impersonal-voice counting, check_officialese, and check_term_consistency. These pin the behaviour against a real Estonian R&D report paragraph and the plain-language rewrite a native speaker produced from it — the bureaucratic original must flag and the human rewrite must come back cl...
silly-geese/estonian-mcp
tests/test_officialese.py
.py
2ddf697104f5d99b
8.13
17
"""Tests for resource-availability handling (issues #37 and #38). The defect these pin down: `check_term_consistency` returned "Ebajärjekindlat terminikasutust ei tuvastatud" — a confident negative — while one of its two rules was switched off because Estonian WordNet was missing. The only signal was a `rules_run` fla...
silly-geese/estonian-mcp
tests/test_resources.py
.py
989c03a9addbd060
8.13
17
#!/usr/bin/env python """Score a topica model's topics against a reference's, after topic alignment. Topic models from different implementations cannot be compared element-wise: the topic order is arbitrary and the RNG differs. This aligns the two topic-word matrices by Hungarian assignment (maximizing cosine) and rep...
nealcaren/topica
.claude/skills/add-topic-model/scripts/compare_to_reference.py
.py
4849dc60c5446654
7.42
6
"""Topic-count (K) scaling benchmark for the logistic-normal variational fit. Shows where topica 0.17.0's memory and speed options matter: the per-document variational covariance is O(N*K^2), so it dominates at large K. This sweeps K at a fixed corpus and measures, for each variant, the fit time and peak RSS: * lap...
nealcaren/topica
benchmarks/bench_scaling.py
.py
eca46b49599ccc38
7.42
6
"""Benchmark topica's STM per-iteration fit cost against R ``stm``. This is the *mechanism* benchmark: it isolates per-iteration engine efficiency by running both engines a fixed number of EM iterations from a common Spectral init (R with ``max.em.its=iters, emtol=0`` so it does not stop early; topica with ``convergen...
nealcaren/topica
benchmarks/bench_stm.py
.py
616d29bfec1c118e
7.42
6
"""Hierarchical recovery: fit HLDA on the dedicated domain-structured corpus and check it recovers the planted 2-level tree (domains at internal nodes, topics at leaves; docs routed by domain).""" import json, glob, re, sys import numpy as np import topica topica.enable_experimental() try: from sklearn.metrics impo...
nealcaren/topica
benchmarks/synthetic/score_hierarchical.py
.py
fbdaf3379786de3e
7.42
6
"""Doc-topic (theta) mixture recovery: the metric that separates admixture models (LDA/STM) from mixture models (GSDMM). Both are fit on the SAME full documents; we align topics to truth, then compare each model's recovered doc_topic to the planted theta_d -- overall and binned by document mixedness (effective #topics)...
nealcaren/topica
benchmarks/synthetic/score_theta.py
.py
c9a6adc16ac1f4be
7.42
6
"""Party and time in congressional press releases — a Structural Topic Model tour. U.S. House members put out a steady stream of press releases, and what they choose to talk about is shaped by two things this tutorial makes explicit: *who* is speaking (party) and *when* (year). That is exactly the setting the Structur...
nealcaren/topica
examples/congress_tutorial.py
.py
6a4da6f4d5f1915f
7.42
6
"""Reproduce the STM (Structural Topic Model) R-package vignette with topica. Works through the same analysis as Roberts, Stewart & Tingley's `stm` vignette, on the same data (`gadarian`: 341 open-ended survey responses about immigration, with an experimental `treatment` and party-id `pid_rep`), using topica instead o...
nealcaren/topica
examples/stm_vignette.py
.py
cb96f2149d229d12
7.42
6
"""One-command reproduction of every number in the topica paper. Runs the three empirical parts of the paper end to end and writes a single consolidated report that maps each paper claim to its freshly computed value: - Section 5 Validation against reference implementations (parity/*) - Section 6 Performance be...
nealcaren/topica
paper/reproduce.py
.py
af3312722d6a134b
7.42
6
"""Push notifications via ntfy (https://ntfy.sh) — same pattern as Invoke-RestMethod -Uri https://ntfy.sh/$Topic.""" from __future__ import annotations import json from typing import Any from urllib.parse import quote import requests from app.config import settings def send_ntfy( message: str, *, title...
bbartling/py-bacnet-stacks-playground
vibe_code_apps_10/diy-bas/app/ntfy_out.py
.py
70ab46250c0ed5cb
7.63
17
"""Helpers for diy-bacnet schedule read + pushing occupancy to linked BACnet binary points.""" from __future__ import annotations from typing import Any from app import rpc_client, trend_store def extract_schedule_present_value(payload: dict[str, Any]) -> Any | None: """Best-effort present / effective value fro...
bbartling/py-bacnet-stacks-playground
vibe_code_apps_10/diy-bas/app/schedule_bacnet.py
.py
bdcbb4306a6444b0
7.63
17
"""Map diy-bas schedule JSON ↔ diy-bacnet ``server_update_schedule`` weekly format. diy-bacnet expects ``weekly_schedule`` as **7 lists** in **Monday → Sunday** order (see server-rpc.md). The vanilla UI uses Sunday → Saturday — we convert here. """ from __future__ import annotations from typing import Any # BACnet ...
bbartling/py-bacnet-stacks-playground
vibe_code_apps_10/diy-bas/app/schedules_bridge.py
.py
c8b204e8a0b6549a
7.63
17
"""Async Alembic environment.""" from __future__ import annotations import asyncio import logging from logging.config import fileConfig from alembic import context from sqlalchemy import pool from sqlalchemy.engine import Connection from sqlalchemy.ext.asyncio import async_engine_from_config from qq_ai_bot.config i...
YuanYeYouTao/Yuki-QQbot
migrations/env.py
.py
db0d07dd083b7181
7.54
11
"""Record durable causality for proactive plugin replies. Revision ID: 0050 Revises: 0049 Create Date: 2026-08-28 """ from __future__ import annotations from collections.abc import Sequence from alembic import op revision: str = "0050" down_revision: str | None = "0049" branch_labels: str | Sequence[str] | None = ...
YuanYeYouTao/Yuki-QQbot
migrations/versions/0050_plugin_reply_causality.py
.py
4b19b2275ede95e6
7.54
11
"""Typed GitHub Monitor failures.""" from __future__ import annotations from datetime import datetime class GitHubMonitorError(RuntimeError): pass class GitHubAPIError(GitHubMonitorError): def __init__( self, category: str, status_code: int = 0, *, remaining: int | ...
YuanYeYouTao/Yuki-QQbot
plugins/github-monitor/github_monitor/errors.py
.py
8ba01d4d159943a8
7.54
11
"""Provider-neutral contracts for deterministic speech-only text transforms.""" from __future__ import annotations from dataclasses import dataclass from typing import Protocol class SpeechTextFrontendUnavailable(RuntimeError): """A configured local frontend cannot safely process its language.""" @dataclass(f...
YuanYeYouTao/Yuki-QQbot
services/genie_tts_worker/src/genie_tts_worker/text_frontends/base.py
.py
7a353e78db4c8530
7.54
11
#!/usr/bin/env python3 """Verify that release artifacts came from the exact tagged SDK commit.""" from __future__ import annotations import argparse import hashlib import json import re import subprocess import sys import tarfile import zipfile from email.message import Message from email.parser import Parser from pa...
gleanwork/glean-indexing-sdk
scripts/check_publish_provenance.py
.py
03f213a311bb97ca
7.5
9
#!/usr/bin/env python3 """Verify that Ruff discovers and enforces the repository policy used by CI.""" from __future__ import annotations import subprocess import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[1] CONFIG = ROOT / "pyproject.toml" CONTROL_FILENAME = ROOT / "_ruff_policy_control.p...
gleanwork/glean-indexing-sdk
scripts/check_ruff_config.py
.py
a096d265bc628fd8
7.5
9
#!/usr/bin/env python3 """Find the nearest reachable prior tag matching the publish version grammar.""" from __future__ import annotations import argparse import subprocess import sys from typing import NoReturn from check_publish_provenance import TAG_PATTERN class PreviousTagError(Exception): """The previous...
gleanwork/glean-indexing-sdk
scripts/find_previous_release_tag.py
.py
5f648ddc48ad4d47
7.5
9
from collections.abc import Generator from typing import Any from glean.indexing.recipes.pull import BasePullHttpStreamingDataClient from .article_data import ArticleData class LargeKnowledgeBaseClient(BasePullHttpStreamingDataClient[ArticleData]): """Streams every article from an offset-paginated source API.""...
gleanwork/glean-indexing-sdk
snippets/streaming/article_data_client.py
.py
94f820d39b3c05b6
7.5
9
"""`glean-idx completion` — shell completion for interactive use. Click can complete commands and options, but only once the shell has been told how. The documented way is an incantation involving an internal environment variable; printing the script from a real subcommand is something a person can discover from `--he...
gleanwork/glean-indexing-sdk
src/glean/indexing/cli/commands/completion.py
.py
8f4d8bc2a13741e7
7.5
9
"""`glean-idx doctor` — check that the environment is ready before anything else. A bad or missing token otherwise surfaces part-way through a crawl, as a `MissingEnvironmentVariableError` from whichever call happened to run first. This turns that into one deliberate, early check with an actionable result. """ from _...
gleanwork/glean-indexing-sdk
src/glean/indexing/cli/commands/doctor.py
.py
fcb40ae7c984e8f8
7.5
9
"""`glean-idx document` — inspect and remove individual indexed documents. The commands here answer the question that follows every crawl: did *this* document land, and can the right people see it. Each needs only credentials, so they run anywhere — including `uvx`, before you have a project. """ from __future__ impo...
gleanwork/glean-indexing-sdk
src/glean/indexing/cli/commands/document.py
.py
3584f1b6a7d7f7d9
7.5
9
"""`glean-idx run` — execute a connector against Glean. The command the whole CLI exists to support. Everything else either prepares for this or inspects what it produced. Deliberately matched to how the deployed connector runs: the generated Kubernetes entrypoint imports the target named in the project file, constru...
gleanwork/glean-indexing-sdk
src/glean/indexing/cli/commands/run.py
.py
077d2ddacfab1f2c
7.5
9
"""`glean-idx schema` — the shape of what a connector has to produce. `transform()` returns API models, and getting a field name or nesting wrong is the most common way for a connector to upload something Glean rejects. Printing the schema means neither a person nor an agent has to read the SDK's source to find out wh...
gleanwork/glean-indexing-sdk
src/glean/indexing/cli/commands/schema.py
.py
f003d27bb539fd36
7.5
9
"""`glean-idx test` — run a connector at one of three fidelities. The SDK's `TestHarness` already defines the progression: mock Glean, then the real source against a mocked Glean, then both real. This exposes it so that checking a connector does not require writing a test file first, which is what made the middle phas...
gleanwork/glean-indexing-sdk
src/glean/indexing/cli/commands/test.py
.py
b02acf8f68cc1fd8
8
9
"""`glean-idx validate` — the gate between planning a connector and building one. The artifacts under a connector's `.glean/` directory are what an agent and a person agreed the connector would do. This checks they are complete, filled in, and confirmed before any implementation code gets written. Shipped as part of ...
gleanwork/glean-indexing-sdk
src/glean/indexing/cli/commands/validate.py
.py
b9e265edf7f8d796
7.5
9
"""Error types for the `glean-idx` CLI. Every failure the CLI raises deliberately carries three things: a stable machine-readable ``code`` that agents can branch on, a human-readable message, and — where one exists — a concrete ``hint`` naming the command that fixes it. Exit codes are stable and documented so callers ...
gleanwork/glean-indexing-sdk
src/glean/indexing/cli/errors.py
.py
c1dab28b0d6a2134
7.5
9
"""Root group for `glean-idx`. Commands are loaded lazily. `glean-idx document status` should not pay to import Jinja2 and the cloud SDKs that `deploy` needs, and a CLI invoked repeatedly by an agent notices the difference. """ from __future__ import annotations import importlib from pathlib import Path from typing ...
gleanwork/glean-indexing-sdk
src/glean/indexing/cli/main.py
.py
9b788608e16f9963
7.5
9
"""Output rendering for the `glean-idx` CLI. Two modes, one envelope. Text is for people; JSON is for agents and pipelines. The default is chosen by whether stdout is a terminal, so a skill that pipes output gets JSON without having to pass a flag, and a person at a prompt gets readable text without having to know one...
gleanwork/glean-indexing-sdk
src/glean/indexing/cli/output.py
.py
b86107078ceab2dd
7.5
9
"""Declarative preconditions for `glean-idx` commands. A command states what it needs; the check runs before any work, so a missing token or a wrong working directory fails in milliseconds with one consistent, actionable message rather than part-way through a crawl. """ from __future__ import annotations import func...
gleanwork/glean-indexing-sdk
src/glean/indexing/cli/preconditions.py
.py
989f374a2e777069
7.5
9
"""Connector-project discovery and connector loading. Some commands need only credentials and run anywhere. Others have to load *your* connector class, which means running inside your project with the SDK installed alongside your code. Getting that wrong is the most likely way to be confused by this CLI, so the failur...
gleanwork/glean-indexing-sdk
src/glean/indexing/cli/project.py
.py
18ae87035def6052
7.5
9
"""Batch processing utility for efficient data handling.""" import json import logging from typing import Generic, Iterator, Optional, Sequence, TypeVar from glean.api_client.models import DocumentDefinition logger = logging.getLogger(__name__) T = TypeVar("T") DEFAULT_DOCUMENT_BATCH_SIZE_BYTES = 5 * 1024 * 1024 ...
gleanwork/glean-indexing-sdk
src/glean/indexing/common/batch_processor.py
.py
6d445096f8652c97
7.5
9
"""Content formatting utility using Jinja2.""" import logging from typing import Any, Dict from jinja2 import Environment logger = logging.getLogger(__name__) class ContentFormatter: """A utility for formatting content using Jinja2 templates.""" def __init__(self, template_str: str): """Initialize...
gleanwork/glean-indexing-sdk
src/glean/indexing/common/content_formatter.py
.py
3e4214651a11b5a3
7.5
9
"""Performance metrics tracking utility for connectors.""" import logging import time from typing import Any, Dict, Optional logger = logging.getLogger(__name__) class ConnectorMetrics: """A context manager for tracking connector metrics.""" def __init__(self, name: str, logger: Optional[logging.Logger] = ...
gleanwork/glean-indexing-sdk
src/glean/indexing/common/metrics.py
.py
4960960989cd3a43
7.5
9
from typing import List, Optional from glean.api_client.models.propertydefinition import ( PropertyDefinition, UIOptions, ) from glean.api_client.models.propertydefinition import ( PropertyDefinitionPropertyType as PropertyType, ) from glean.indexing.exceptions import InvalidPropertyError class PropertyD...
gleanwork/glean-indexing-sdk
src/glean/indexing/common/property_definition_builder.py
.py
1dfb267e0d9a6879
7.5
9
"""Base async streaming data client for fetching data in chunks.""" from abc import ABC, abstractmethod from typing import Any, AsyncGenerator, Generic from glean.indexing.models import TSourceData class BaseAsyncStreamingDataClient(ABC, Generic[TSourceData]): """ Base class for async streaming data clients...
gleanwork/glean-indexing-sdk
src/glean/indexing/connectors/base_async_streaming_data_client.py
.py
25a29ad647cad51d
7.5
9
"""Base connector class for the Glean Connector SDK.""" import logging from abc import ABC, abstractmethod from typing import Any, Generic, Literal, Optional, Sequence from glean.indexing.common.batch_processor import DEFAULT_DOCUMENT_BATCH_SIZE_BYTES from glean.indexing.models import ( DEFAULT_UPLOAD_MAX_WORKERS...
gleanwork/glean-indexing-sdk
src/glean/indexing/connectors/base_connector.py
.py
2d12d080d5ddfa86
7.5
9
"""Base data client interface for standard Glean connectors.""" from abc import ABC, abstractmethod from typing import Any, Generic, Sequence from glean.indexing.models import TSourceData class BaseDataClient(ABC, Generic[TSourceData]): """ Base class for all connector data clients. This interface defi...
gleanwork/glean-indexing-sdk
src/glean/indexing/connectors/base_data_client.py
.py
d3f41275c8ebd552
7.5
9
"""Base datasource connector for the Glean Connector SDK.""" import logging from abc import ABC from typing import Optional, Sequence from glean.api_client.models import DocumentDefinition from glean.indexing.common.batch_processor import DEFAULT_DOCUMENT_BATCH_SIZE_BYTES from glean.indexing.connectors.base_connector...
gleanwork/glean-indexing-sdk
src/glean/indexing/connectors/base_datasource_connector.py
.py
5644c2e4e5744efd
7.5
9
"""Base people connector for the Glean Connector SDK.""" import logging from abc import ABC from typing import Optional, Sequence from glean.api_client.models import EmployeeInfoDefinition from glean.indexing.connectors.base_connector import BaseConnector from glean.indexing.connectors.base_data_client import BaseDat...
gleanwork/glean-indexing-sdk
src/glean/indexing/connectors/base_people_connector.py
.py
f2fcda507ffef11a
7.5
9
"""Base streaming data client interface for Glean connectors.""" from abc import ABC, abstractmethod from typing import Any, Generator, Generic from glean.indexing.models import TSourceData class BaseStreamingDataClient(ABC, Generic[TSourceData]): """ Base class for streaming data clients that fetch data in...
gleanwork/glean-indexing-sdk
src/glean/indexing/connectors/base_streaming_data_client.py
.py
d29fce3cbbfb78a2
7.5
9
"""Base streaming datasource connector for memory-efficient processing of large datasets.""" import logging import time import uuid from abc import ABC from typing import Generator, Optional, Sequence from glean.api_client.models import DocumentDefinition from glean.indexing.common import DocumentBatchProcessor from ...
gleanwork/glean-indexing-sdk
src/glean/indexing/connectors/base_streaming_datasource_connector.py
.py
21f50a7350da025a
7.5
9
import pytest from unittest.mock import patch, MagicMock, mock_open from velez.file_ops import FileOperations from velez.velez import Velez @pytest.fixture def file_ops(): velez = Velez() return FileOperations(velez) @patch('velez.file_ops.run_command') def test_format_hcl_files_tf(mock_run_command, file_ops)...
devops-infra/velez
tests/test_file_ops.py
.py
570458908d1423a4
7.92
6
import json import os import shutil import sys import hcl2 from pick import pick from velez.utils import STR_BACK, STR_EXIT, run_command STR_FORMAT_FILES = "⎆ Format HCL files" STR_CLEAN_FILES = "⌧ Clean temporary files" class FileOperations: """ Class for file operations. """ def __init__(self, ve...
devops-infra/velez
velez/file_ops.py
.py
502650ef71e2ac83
7.42
6
import shutil from datetime import datetime import subprocess STR_BACK = "⏮️ BACK" STR_EXIT = "📛 EXIT" def run_command(command: list[str], quiet: bool = False) -> tuple: """ Run a command. :param command: command to run :param quiet: if True, suppress output and errors :return: tuple with stdou...
devops-infra/velez
velez/utils.py
.py
de65d6a1e10ea2a1
7.42
6
import argparse import os import shutil import sys from pick import pick from importlib.metadata import version from velez.file_ops import FileOperations from velez.github_ops import GitHubOperations from velez.terragrunt_ops import TerragruntOperations from velez.docker_ops import DockerOperations from velez.utils im...
devops-infra/velez
velez/velez.py
.py
180250ed90e83f22
7.42
6
#!/usr/bin/env python3 import json import sys from pypdf import PdfReader, PdfWriter from pypdf.annotations import FreeText # Fills a PDF by adding text annotations defined in `fields.json`. See forms.md. def transform_coordinates(bbox, image_width, image_height, pdf_width, pdf_height): """Transform bounding b...
organvm-iv-taxis/a-i--skills
distributions/claude/skills-document/pdf/scripts/fill_pdf_form_with_annotations.py
.py
8956df56a2f47a8d
7.63
17
"""CI/CD models for OpenAgent Eval.""" from __future__ import annotations from enum import StrEnum from typing import Any from pydantic import BaseModel, Field class ThresholdOperator(StrEnum): """Comparison operators for threshold evaluation.""" GT = "gt" # Greater than GTE = "gte" # Greater than o...
OpenAgentHQ/openagent-eval
openagent_eval/cicd/models.py
.py
6c6a6a9fc633b758
7.62
16
"""Threshold evaluation for CI/CD gating.""" from __future__ import annotations from dataclasses import dataclass, field from typing import Any from openagent_eval.cicd.models import ( CICDConfig, EvaluationGate, GateBehavior, TestResult, TestStatus, ThresholdConfig, ThresholdOperator, ) ...
OpenAgentHQ/openagent-eval
openagent_eval/cicd/thresholds.py
.py
1e276c9a48acc03e
7.62
16
"""ASCII art banner for OpenAgent Eval CLI.""" from __future__ import annotations from rich.align import Align from rich.console import Console from rich.panel import Panel from rich.table import Table from rich.text import Text def _generate_ascii_art(text: str = "oaeval") -> str: """Generate ASCII art for OAE...
OpenAgentHQ/openagent-eval
openagent_eval/cli/banner.py
.py
7fe61c674a2cacd2
7.62
16
"""Audit command for corpus health checking.""" from __future__ import annotations import asyncio import time from pathlib import Path from typing import TYPE_CHECKING import typer from rich.console import Console from rich.panel import Panel from rich.progress import ( BarColumn, Progress, SpinnerColumn...
OpenAgentHQ/openagent-eval
openagent_eval/cli/commands/audit.py
.py
bf8ecbc9f3c1d839
7.62
16