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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3
"""
Generate MANIFEST.yaml with per-file metadata:
- path, category, rows, unique_rows, sha256
- source: unknown (placeholder), date_collected: yyyy-mm-dd (today)
"""
import datetime
import hashlib
import os
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
def sha256_te... | manoelrichard29/SecLists-2025-advanced | tools/manifest_yaml.py | .py | 0d1b1b1e6e9bbea1 | 7.5 | 9 |
#!/usr/bin/env python3
"""
Normalize all lists to UTF-8 LF, strip BOM/CR, trim whitespace, remove duplicates.
Writes changes in place and prints a manifest summary.
"""
import hashlib
import os
import sys
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
def read_binary(path):
with open(path, ... | manoelrichard29/SecLists-2025-advanced | tools/normalize.py | .py | 45025ae1de755d0d | 7.5 | 9 |
#!/usr/bin/env python3
"""
Validate lists for formatting rules: UTF-8, LF newlines, no carriage returns,
no trailing spaces, no tabs, reasonable line length, and uniqueness.
"""
import os
import sys
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
def validate_file(path):
errors = []
with... | manoelrichard29/SecLists-2025-advanced | tools/validate.py | .py | 1873dfffd6c4d685 | 7.5 | 9 |
#!/usr/bin/env python3
"""
Railway cron job script.
Runs the OFAC pipeline, then commits and pushes any data changes to GitHub.
Required environment variables:
GITHUB_TOKEN - Personal access token with repo write access
GITHUB_REPO - Repository in "owner/repo" format (e.g. "cylon56/ofac-naughtylist")
... | cylon56/ofac-naughtylist | scripts/railway_cron.py | .py | 7d735197217f87c1 | 7.45 | 7 |
"""Map parsed addresses to chains using ticker mapping and address format inference."""
import logging
import re
from dataclasses import dataclass, field
import yaml
from src.parse import SanctionedAddress
logger = logging.getLogger(__name__)
@dataclass
class CategorizedAddress:
address: str
chain: str
... | cylon56/ofac-naughtylist | src/categorize.py | .py | 92e13a7d29208a91 | 7.45 | 7 |
"""Generate JSON output files from categorized addresses."""
import json
import logging
import os
from datetime import datetime, timezone
from src.categorize import CategorizedAddress
logger = logging.getLogger(__name__)
def _load_existing_addresses(output_dir: str) -> set[tuple[str, str]]:
"""Load existing ad... | cylon56/ofac-naughtylist | src/output.py | .py | ff3d075c93db9b5f | 7.45 | 7 |
"""Parse the SDN Advanced XML and extract all digital currency addresses."""
import logging
import re
import xml.etree.ElementTree as StdET
from dataclasses import dataclass
import defusedxml.ElementTree as ET
logger = logging.getLogger(__name__)
@dataclass
class SanctionedAddress:
address: str
ofac_ticker... | cylon56/ofac-naughtylist | src/parse.py | .py | 33938f0a4079fc58 | 7.45 | 7 |
"""Update the 'Current sanctions snapshot' section of README.md from generated data.
Kept as part of the core pipeline (rather than a deploy script) so that the
snapshot is refreshed on every ``python -m src.main`` run, regardless of which
runner (GitHub Actions, Railway cron, or a local invocation) executes it.
"""
... | cylon56/ofac-naughtylist | src/readme.py | .py | 0cc8bf516fb3227c | 7.45 | 7 |
"""Tests for src/categorize.py — address-to-chain mapping."""
import os
import pytest
from src.categorize import CategorizedAddress, categorize_addresses, load_chain_mapping
from src.parse import SanctionedAddress, parse_sdn_xml
FIXTURE_PATH = os.path.join(os.path.dirname(__file__), "fixtures", "sample_sdn_advanced... | cylon56/ofac-naughtylist | tests/test_categorize.py | .py | c3a143d26e13a58b | 7.95 | 7 |
"""Tests for src/parse.py — XML parsing and address extraction."""
import os
import pytest
from src.parse import SanctionedAddress, get_namespace, parse_sdn_xml
FIXTURE_PATH = os.path.join(os.path.dirname(__file__), "fixtures", "sample_sdn_advanced.xml")
class TestGetNamespace:
def test_extracts_namespace(sel... | cylon56/ofac-naughtylist | tests/test_parse.py | .py | b3d82c3826bdc4c8 | 7.95 | 7 |
"""Tests for src/readme.py — README snapshot section updating."""
import json
import os
import tempfile
import pytest
from src.readme import update_readme
_STALE_README = """# OFAC Naughty List
Some intro text.
## Current sanctions snapshot
> Last updated: **2020-01-01** | **2 addresses** across **1 sanctioned e... | cylon56/ofac-naughtylist | tests/test_readme.py | .py | b694983b948ddf98 | 7.95 | 7 |
"""
Standalone ASGI server example (no framework adapter needed).
Run directly:
uv run python examples/asgi_standalone.py
Or with the CLI:
pyrpc serve examples.asgi_standalone
"""
import uvicorn
from pyrpc_core import asgi_app, rpc
@rpc
def add(a: int, b: int) -> int:
"""Adds two numbers together."""
... | pyrpc/pyrpc | examples/asgi_standalone.py | .py | 06c6e90a7ec60acf | 7.57 | 13 |
"""
Python client example for pyRPC.
Requires a running pyRPC server (e.g. examples/asgi_standalone.py,
examples/fastapi-react/server/main.py, or `pyrpc serve`).
Run:
uv run python examples/basic_client.py
"""
import asyncio
from pyrpc_core import RPCClient, RPCError
def run_sync_example():
print("--- Run... | pyrpc/pyrpc | examples/basic_client.py | .py | dc609c2edf59e67f | 7.57 | 13 |
from django.http import HttpResponse
from pyrpc_core import rpc
def index(request):
"""Django index view - following official Django tutorial pattern"""
return HttpResponse("<h1>Django + pyRPC Server</h1><p>pyRPC endpoint: /rpc/</p>")
@rpc.query
async def greet(name: str = "World") -> dict:
"""Greets a ... | pyrpc/pyrpc | examples/django-nextjs/server/myproject/views.py | .py | 03b8cd515ef10199 | 7.57 | 13 |
#!/usr/bin/env python3
"""Dispatch adapter for the Claude Code CLI, plus a fake for tests.
Route N1 (spec Iteration 4) fixed the execution contract: the with-arm is
claude -p "/<skill> <prompt>" --output-format json
run with the workspace as cwd, authenticated by the developer's existing
subscription session. Th... | yongwoon/ywc-agent-toolkit | .claude/skills/ywc-toolkit-eval/scripts/claude_adapter.py | .py | fe3777a1af5ae2dc | 7.48 | 8 |
#!/usr/bin/env python3
"""v2 evaluation-fixture validator and workspace manifest normalizer.
Two contracts live here, and every later task in this batch builds on them:
* `validate_case` — the v2 case shape (spec AC3) and the closed
`expected_checks` whitelist (AC4). A fixture describes *what to assert*;
it can n... | yongwoon/ywc-agent-toolkit | .claude/skills/ywc-toolkit-eval/scripts/fixture_schema.py | .py | febb00f2e9979364 | 7.48 | 8 |
#!/usr/bin/env python3
"""Unit tests for the v2 fixture validator and the verifier registry.
Guards the two contracts every later task in this batch builds on
(000067-010): the v2 case shape (AC3), the closed `expected_checks`
whitelist (AC4), and `fixture_root` boundary sealing (AC5).
The central invariant under tes... | yongwoon/ywc-agent-toolkit | .claude/skills/ywc-toolkit-eval/scripts/test_fixture_schema.py | .py | 98f6ee06728bc17b | 7.98 | 8 |
#!/usr/bin/env python3
"""Evaluator-owned registry of runnable verifiers.
A fixture may name a verifier by id and nothing else. The argv, working
directory, timeout, environment allowlist, and expected exit code all live
here, in evaluator-owned code that a human reviews — never in fixture data.
That asymmetry is the... | yongwoon/ywc-agent-toolkit | .claude/skills/ywc-toolkit-eval/scripts/verifier_registry.py | .py | c4883722dc88647e | 7.48 | 8 |
"""Small, non-secret Codex CLI adapter contract used by the isolated runner."""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import Mapping, Protocol
import json
import os
import subprocess
@dataclass(frozen=True)
class RunnerRequest:
"""Inputs to one... | yongwoon/ywc-agent-toolkit | .codex/skills/ywc-codex-toolkit-eval/scripts/codex_adapter.py | .py | 14937bcdef1fe98d | 7.48 | 8 |
#!/usr/bin/env python3
"""Small, offline-safe primitives used by the evaluator CI workflow."""
from __future__ import annotations
import argparse
import json
import os
from pathlib import Path
from results import MAX_ARTIFACT_BYTES, ArtifactStore, redact
STATUS_EXITS = {"PASS": 0, "FAIL": 1, "ERROR": 2, "SKIPPED_UN... | yongwoon/ywc-agent-toolkit | .codex/skills/ywc-codex-toolkit-eval/scripts/workflow_contract.py | .py | 73bf3b19e4089f63 | 7.48 | 8 |
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = []
# ///
"""
Cost Tracker Hook
PostToolUse : logs each tool call to ~/.claude/cost-tracker/YYYY-MM-DD.jsonl
Stop : prints session summary to terminal (stderr)
Token counts are estimated as: characters / 4 (industry app... | yongwoon/ywc-agent-toolkit | claude-code/hooks/cost-tracker.py | .py | dca5b504a4cff8a3 | 7.48 | 8 |
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = []
# ///
"""
PermissionRequest Hook
======================
Triggered when Claude Code requests user permission for a tool call.
Behavior:
- Auto-allows read-only operations (Read, Glob, Grep, safe Bash commands)
when invoke... | yongwoon/ywc-agent-toolkit | claude-code/hooks/permission_request.py | .py | 0787f20ccff97ab4 | 7.48 | 8 |
#!/usr/bin/env python3
"""
build-pr-title.py <task-name> [--lang <lang>] [--format parts|title]
Deterministically extracts the task number and description slug from a task
directory name. Eliminates the need for the LLM to parse task-name regex rules
on every invocation — saves tokens on every PR-based task delivery.
... | yongwoon/ywc-agent-toolkit | claude-code/skills/ywc-finish-branch/scripts/build-pr-title.py | .py | c1cce359d40d2a11 | 7.48 | 8 |
#!/usr/bin/env python3
"""
extract-nitpick-comments.py
Reads one CodeRabbit review `body` string from stdin (the raw HTML/markdown
value of `.body` from `GET /pulls/{pr}/reviews/{review_id}`). Locates the
`<details><summary>Nitpick comments (N)</summary>` section and emits a JSON
array of pseudo-comment objects to std... | yongwoon/ywc-agent-toolkit | claude-code/skills/ywc-handle-pr-reviews/scripts/extract-nitpick-comments.py | .py | 980304a7facd2ae0 | 7.48 | 8 |
#!/usr/bin/env python3
"""Compact fully-completed sections of tasks/dependency-graph.md.
Heading-based, no markers required — this also retrofits files written
before this script existed. `tasks/dependency-graph.md` is split on every
top-level `## ` heading:
Task ids may carry an optional `<initials>-` prefix (`yk-00... | yongwoon/ywc-agent-toolkit | claude-code/skills/ywc-task-generator/scripts/compact-dependency-graph.py | .py | fd4b7368a49a1457 | 7.48 | 8 |
#!/usr/bin/env python3
"""
build-pr-title.py <task-name> [--lang <lang>] [--format parts|title]
Deterministically extracts the task number and description slug from a task
directory name. Eliminates the need for the LLM to parse task-name regex rules
on every invocation — saves tokens on every PR-based task delivery.
... | yongwoon/ywc-agent-toolkit | codex/skills/ywc-finish-branch/scripts/build-pr-title.py | .py | 69ee7ce2aaed4fb8 | 7.48 | 8 |
import logging
import time
from typing import Dict, Optional, Tuple
from typing_extensions import override
import websockets.sync.client
from openpi_client import base_policy as _base_policy
from openpi_client import msgpack_numpy
class WebsocketClientPolicy(_base_policy.BasePolicy):
"""Implements the Policy in... | Kushagra1A/openpi | packages/openpi-client/src/openpi_client/websocket_client_policy.py | .py | f96009f787d6ccde | 7.45 | 7 |
"""Compute normalization statistics for a config.
This script is used to compute the normalization statistics for a given config. It
will compute the mean and standard deviation of the data in the dataset and save it
to the config assets directory.
"""
import numpy as np
import tqdm
import tyro
import openpi.models.... | Kushagra1A/openpi | scripts/compute_norm_stats.py | .py | 8a64773495b714d6 | 7.45 | 7 |
import dataclasses
import enum
import logging
import socket
import tyro
from openpi.policies import policy as _policy
from openpi.policies import policy_config as _policy_config
from openpi.serving import websocket_policy_server
from openpi.training import config as _config
class EnvMode(enum.Enum):
"""Supporte... | Kushagra1A/openpi | scripts/serve_policy.py | .py | eccc0448b4873fd3 | 7.45 | 7 |
import abc
from collections.abc import Sequence
import dataclasses
import enum
import logging
import pathlib
from typing import Generic, TypeVar
import augmax
from flax import nnx
from flax import struct
from flax import traverse_util
import jax
import jax.numpy as jnp
import numpy as np
import orbax.checkpoint as ocp... | Kushagra1A/openpi | src/openpi/models/model.py | .py | 0d74bc1d8f4623ac | 7.45 | 7 |
import logging
import einops
import flax.nnx as nnx
import flax.nnx.bridge as nnx_bridge
import jax
import jax.numpy as jnp
from typing_extensions import override
from openpi.models import model as _model
from openpi.models import pi0_config
import openpi.models.gemma as _gemma
import openpi.models.siglip as _siglip
... | Kushagra1A/openpi | src/openpi/models/pi0.py | .py | 24b32d7c6ed5e409 | 7.45 | 7 |
import dataclasses
from typing import TYPE_CHECKING
import flax.nnx as nnx
import jax
import jax.numpy as jnp
from typing_extensions import override
from openpi.models import model as _model
import openpi.models.gemma as _gemma
from openpi.shared import array_typing as at
import openpi.shared.nnx_utils as nnx_utils
... | Kushagra1A/openpi | src/openpi/models/pi0_config.py | .py | e15d71586f1a561b | 7.45 | 7 |
import dataclasses
import logging
from typing import Any
import einops
import flax.nnx as nnx
import flax.nnx.bridge as nnx_bridge
import jax
import jax.numpy as jnp
from typing_extensions import override
from openpi.models import model as _model
import openpi.models.gemma_fast as _gemma
import openpi.models.siglip a... | Kushagra1A/openpi | src/openpi/models/pi0_fast.py | .py | 627332a555046f27 | 7.45 | 7 |
# Copyright 2024 Big Vision Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | Kushagra1A/openpi | src/openpi/models/siglip.py | .py | 14b4df0be280d576 | 7.45 | 7 |
#!/usr/bin/env python3
"""
Telegram Bot for Binance Trading Bot Account Overview - Hourly Reports
"""
import os
import csv
import logging
import time
import requests
import pandas as pd
from datetime import datetime, timedelta
from typing import Dict, List
import pytz
from binance.um_futures import UMFutures
import do... | marahman30104/binance-scalping | telegram_bot.py | .py | e2b15a2d3f1f6e5b | 7.54 | 11 |
#!/usr/bin/env python3
"""
Validate the generated hooks.json file
"""
import json
import sys
from pathlib import Path
def validate_hooks_file(file_path):
"""Validate hooks.json file"""
print(f"🔍 Validating file: {file_path}")
print("-" * 50)
# Check if file exists
if not file_path.exists():... | astrodragonv/claudecode-rule2hook | validate-hooks.py | .py | 51ac77c0fac0bbc1 | 7.65 | 19 |
import os
import sys
import json
import requests
from datetime import datetime, timedelta
import subprocess
from tqdm import tqdm
def get_daily_papers(query_date):
"""获取指定日期的论文数据"""
# 构建API URL
url = f"https://hf-mirror.com/api/daily_papers?date={query_date}"
print(f"请求API: {url}")
... | kaymungai/AI-Research-Radar | batch_paper_download.py | .py | 4a10d70e01a844b2 | 7.42 | 6 |
import os
import sys
import json
import logging
from typing import List
from zhipuai import ZhipuAI
from tqdm import tqdm
# ========== 日志配置 ==========
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s [%(levelname)s] %(message)s',
handlers=[logging.StreamHandler(sys.stdout)]
)
logg... | kaymungai/AI-Research-Radar | classify_and_generate_md.py | .py | 6862bc53bc6c7dc6 | 7.42 | 6 |
import os
import sys
import json
import logging
from typing import List
from volcenginesdkarkruntime import Ark # 替换zhipuai为Ark
from tqdm import tqdm
# ========== 日志配置 ==========
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s [%(levelname)s] %(message)s',
handlers=[logging.Stream... | kaymungai/AI-Research-Radar | classify_and_generate_mdDouBao.py | .py | a3478da900ebb124 | 7.42 | 6 |
import os
import sys
import json
import logging
from typing import List, Dict, Any
# =====================
# 日志配置
# =====================
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s [%(levelname)s] %(message)s',
handlers=[logging.StreamHandler(sys.stdout)]
)
logger = logging.... | kaymungai/AI-Research-Radar | split_hf_glms_json_to_md.py | .py | 1de4f07095c2e756 | 7.42 | 6 |
"""
Example: Advanced stability analysis with AnnData integration
This example demonstrates how to use the enhanced perturbation stability
methods (whitened and k-NN) with AnnData objects in a scanpy-compatible workflow.
"""
import numpy as np
# Try to import required packages
try:
from anndata import AnnData
... | prashantcraju/shesha | examples/anndata_advanced_stability.py | .py | 1e45e855cd0dbe33 | 7.42 | 6 |
"""
Example: Comparing Stability vs. Similarity
This example demonstrates the key distinction from the paper:
Stability and similarity are UNCORRELATED (ρ ≈ 0.01).
A model can have:
- High similarity (aligns well with reference)
- Low stability (brittle internal geometry)
This is the "geometric tax" identified in th... | prashantcraju/shesha | examples/similarity_comparison.py | .py | e95060cd466aebd8 | 7.42 | 6 |
# %% [markdown]
# # Shesha Tutorial
#
# This tutorial demonstrates how to use SHESHA (Self-consistency metrics for representational stability analysis) to measure geometric stability of high-dimensional representations.
#
# **What you'll learn:**
# 1. Basic usage of unsupervised variants (feature_split, sample_split,... | prashantcraju/shesha | examples/tutorial.py | .py | 1e80cd2bf3600845 | 7.42 | 6 |
"""
Internal utilities for bootstrap confidence intervals.
"""
import numpy as np
from typing import Optional, Union, Callable
def bootstrap_ci(
func: Callable,
n_bootstrap_ci: int,
ci: float,
bootstrap_seed: Optional[int],
*args,
**kwargs,
) -> dict:
"""
Compute bootstrap confidence ... | prashantcraju/shesha | shesha/_utils.py | .py | 5d0aa1d0aaa87830 | 7.42 | 6 |
"""
Test shesha.bio on CRISPR perturbation data.
Uses pertpy's Norman et al 2019 dataset (CRISPRa screen).
Install dependencies: pip install pertpy scanpy
Expected behavior:
- Strong perturbations should have higher stability (cells respond consistently)
- Weak/noisy perturbations should have lower stability
"""
imp... | prashantcraju/shesha | tests/test_crispr.py | .py | f75716e7636e600f | 7.92 | 6 |
"""
Tests for newly added features from paper code.
"""
import numpy as np
import pytest
import shesha
try:
from sklearn.neighbors import NearestNeighbors # noqa: F401
SKLEARN_AVAILABLE = True
except ImportError:
SKLEARN_AVAILABLE = False
def test_class_separation_ratio():
"""Test class separation ... | prashantcraju/shesha | tests/test_new_features.py | .py | 1e186d9fba335425 | 7.92 | 6 |
#!/usr/bin/env python3
"""pxx PreToolUse HITL gate hook — pause a gated tool call, route an approval
request out (n8n -> Slack/ntfy), block on the human's decision, FAIL CLOSED.
pxx calls this with {"tool","args"} on stdin; exit 0 = allow, non-zero = deny.
Configure it from a TRUSTED source (user config / env, never r... | cdnwetzel/pxx | docs/examples/hitl/hitl_gate.py | .py | 213015d62c8c3a57 | 7.64 | 18 |
#!/usr/bin/env python3
"""HITL decision listener — the endpoint an ntfy action / Slack button / n8n
decision node calls when the human taps Approve or Abort.
Fail-closed hardening (matches the pxx roadmap HITL item):
- HMAC over the DECISION, not the nonce alone: sig = HMAC(secret, f"{req}:{decision}").
An `approve`... | cdnwetzel/pxx | docs/examples/hitl/hitl_listener.py | .py | d2a7d1efdd9c3b17 | 7.64 | 18 |
"""Artifact store — full logs on disk, a bounded + secret-scrubbed summary to the model.
Test/terminal output can run to megabytes and can contain credentials. The model never sees
the full log: it gets a bounded, secret-scrubbed **summary** plus a **reference ID** it can
INSPECT. The full artifact stays host-side on ... | cdnwetzel/pxx | prototypes/context_paging/artifacts.py | .py | 72d701ca8ec590d4 | 7.64 | 18 |
"""Capsule builder — a fresh, hard-capped context assembled per action (no transcript replay).
Each action gets a capsule built from scratch:
fixed agent kernel + task contract (from the ledger) + the EXACT target source verbatim
+ a compact diagnostic (last failure summary + artifact ref) + this phase's tool... | cdnwetzel/pxx | prototypes/context_paging/capsule.py | .py | 524af94d84168c69 | 7.64 | 18 |
"""Model clients — the ONE seam that separates the deterministic mechanism from the live run.
The runtime asks a model for exactly one typed action given a capsule prompt. A
:class:`ScriptedModel` makes the negative-control suite hermetic (no network); the
:class:`OpenAICompatibleModel` drives a real 4B/8K local model... | cdnwetzel/pxx | prototypes/context_paging/model.py | .py | 9fa37532a98c43c4 | 7.64 | 18 |
"""Source pages — the single hashing authority.
A page's ``sha-256`` is over the **raw file bytes** (no normalization, no newline munging),
addressed by the **canonicalized, symlink-resolved** path. The SAME rule is used everywhere it
matters — the patcher's ``expected_sha`` check, the reindex after a write, and the r... | cdnwetzel/pxx | prototypes/context_paging/pages.py | .py | 9057a00641febb63 | 7.64 | 18 |
"""PASS receipt — the recorded evidence that the mechanism ran (and can fail).
Mirrors the schema in ``docs/context-paging-prototype.md``: per-capsule token accounting, the
action trace, the four negative-control flags, the host verification verdict, and the terminal
code. Written to disk so a run leaves proof, not a ... | cdnwetzel/pxx | prototypes/context_paging/receipt.py | .py | 96736b4ab1858088 | 7.64 | 18 |
#!/usr/bin/env python3
"""Earn the live 8 GB Neo receipt: drive a REAL 4B/8K local model through the paging runtime.
The deterministic mechanism proof lives in ``tests/test_context_paging.py`` (no hardware). This
script is the LIVE arm: it builds a tiny scratch repo with a real failing test, points the
runtime at a lo... | cdnwetzel/pxx | prototypes/context_paging/run_neo.py | .py | 14a31cdcca6c6158 | 7.64 | 18 |
"""Phase 14.5: deterministic human audit sampling.
Flags runs and promotions for human review at the roadmap's policy rates —
100% of promotions and high-risk actions, ~20% of ordinary runs. Selection
is a pure hash of the run id (no RNG): the same run id always yields the
same decision, so the flagged set is reproduc... | cdnwetzel/pxx | pxx/audit_sampling.py | .py | 47d55be372fbf142 | 7.64 | 18 |
"""Backend protocol — pxx owns the runtime; backends are pluggable executors.
A backend receives a task and a :class:`SessionContext` (which carries the
gates: scope, hooks, budgets, event bus, tools, memory) and drives one run.
Every model/tool event must be emitted on the bus; tool execution must go
through ``ctx.to... | cdnwetzel/pxx | pxx/backends/base.py | .py | b9417f007ed04481 | 7.64 | 18 |
"""Phase 14: the action broker — the single authorization authority.
Every tool call flows through :class:`ActionBroker.authorize` (wired at the
``ToolRegistry.call`` choke point — one enforcement authority, no parallel
path; the F2/F5 lesson). The broker normalizes a proposed call into a typed
:class:`ToolAction`, ch... | cdnwetzel/pxx | pxx/broker.py | .py | d2a49dbedc0f9988 | 7.64 | 18 |
"""Reviewer calibration suite (Phase 14).
Runs a reviewer (the ``pxx.review.Reviewer`` protocol) against a fixed corpus
of TOML cases under ``evals/calibration/`` and scores it on:
- ``recall`` — fraction of expected-flag cases the reviewer actually flagged
(known critical defects must be caught);
- ``fp_rate`` — f... | cdnwetzel/pxx | pxx/calibration.py | .py | 93aadb7080628ab5 | 7.64 | 18 |
"""Phase 14: the ambiguity / clarification gate.
Deterministic ``ready_to_act`` check run BEFORE the first backend round: a
task that is empty, references a file that does not exist, or implies tests
without a configured test command stops with a question instead of burning
an autonomous run on a guess. Fail-safe by c... | cdnwetzel/pxx | pxx/clarify.py | .py | d3fc0c5714befa0f | 7.64 | 18 |
"""Phase 12.4: pluggable cost accounting.
A :class:`CostLedger` records per-leg usage (tokens, seconds, model) and
returns a :class:`LegCost` whose ``usd`` is ``None`` whenever a dollar value
cannot be grounded in the versioned price table. **Never fabricate dollar
values**: unknown models, unknown providers, and loca... | cdnwetzel/pxx | pxx/cost.py | .py | 28a5cf86c610d2c2 | 7.64 | 18 |
"""Health checks: ``pxx doctor``.
Reports on the Python runtime, loaded config files, directory writability,
endpoint reachability + tool-calling capability, and optional binaries. Hard
checks (python, config, directories) failing make the CLI exit non-zero; soft
checks (endpoints, tool calling, optional binaries) are... | cdnwetzel/pxx | pxx/doctor.py | .py | 862c4c546b233539 | 7.64 | 18 |
"""pxx error hierarchy.
Gates raise; telemetry suppresses. Anything that stops work derives from
``GateError`` so the session layer can map it to a ``TerminalCode``.
"""
from __future__ import annotations
class PxxError(Exception):
"""Base class for all pxx errors."""
class ConfigError(PxxError):
"""Inval... | cdnwetzel/pxx | pxx/errors.py | .py | 58ba5132381f1f7e | 7.64 | 18 |
"""Phase 13.5: scorecards, corpus fingerprints, comparison.
A :class:`Scorecard` is the frozen, deterministic record of one agent
version evaluated against one corpus. The corpus fingerprint (sha256 of the
sorted per-case content hashes) binds the scorecard to the exact cases that
produced it; :func:`compare` refuses ... | cdnwetzel/pxx | pxx/eval/report.py | .py | 7747931757bd3df9 | 7.64 | 18 |
"""Typed event stream + hash-chained audit log.
Every model/tool/gate event in a session flows through :class:`EventBus`.
The :class:`AuditLog` subscriber persists events as hash-chained JSONL —
tamper-evident, append-only, and **metadata-only**: no prompt bodies, no file
contents, no diffs, no secrets. Audit is best-... | cdnwetzel/pxx | pxx/events.py | .py | e48226ca2f6ee602 | 7.64 | 18 |
"""Sanitized environment for git subprocesses.
git exports repo-targeting and identity variables (``GIT_DIR``,
``GIT_INDEX_FILE``, ``GIT_AUTHOR_*``, …) into hooks. Any pxx invocation
that inherits them — running under a pre-commit hook, a CI step, another
tool's hook — would silently operate on the *caller's* reposito... | cdnwetzel/pxx | pxx/gitenv.py | .py | 3951c6400fdc0554 | 7.64 | 18 |
"""Goal-oriented multi-file orchestration (Phase 22).
Decomposes a high-level goal into a validated task DAG via a read-only
planner, then runs each node as a bounded :func:`pxx.loop.run_loop` with its
own scope — a fresh backend per node (fresh-context invariant). Independent
nodes with disjoint scopes run in paralle... | cdnwetzel/pxx | pxx/goal.py | .py | b8ce1c03296e3ab5 | 7.64 | 18 |
"""Public-content governance scanner (Phase 0.1).
Deterministic, offline scanning for content that must never leave the
machine: secrets (API keys, tokens, private keys), private IPv4 addresses,
absolute home paths, and denylisted internal hostnames. Used by ``pxx check``
(exit 2 on findings) and by any pre-publish/pr... | cdnwetzel/pxx | pxx/governance.py | .py | a092fc11bbb6ab45 | 7.64 | 18 |
"""Phase 16: the apply → verify envelope for content-like candidates.
Ported from the v1 live-eval envelope (with M0's F2/F3 hardening): a
candidate is applied to a repo, and the envelope PROVES it touched only its
declared target — committed AND worktree changes are read with
``--no-renames`` (a rename can't collapse... | cdnwetzel/pxx | pxx/improve/apply.py | .py | 3f836822fb45138e | 7.64 | 18 |
"""Phase 16 seam: one-command both-arms candidate evaluation.
Re-validates a persisted candidate (a hand-edited candidate.json is in the
threat model), runs the held-out corpus at baseline AND under the
candidate's overlay, and feeds both arms to the override-proof promotion
policy. Never applies anything to productio... | cdnwetzel/pxx | pxx/improve/candidate_eval.py | .py | 2f1e8eb9f97afd53 | 7.64 | 18 |
"""Phase 16: declarative improvement candidates + integrity validation.
A :class:`Candidate` is a *declarative*, JSON-persisted proposal for one
behavioral change, stored at ``.pxx/candidates/<id>/candidate.json`` and
immutable once written. Candidates never touch the trusted control plane:
any protected path (see :mo... | cdnwetzel/pxx | pxx/improve/candidates.py | .py | 1b583b552d6f260e | 7.64 | 18 |
"""Phase 19: scheduled propose-only improvement cycle + triage inbox.
``run_cycle(state_dir, mode="propose-only")`` walks COLLECT -> NORMALIZE ->
ANALYZE -> PROPOSE -> VALIDATE, persists candidates and a report, and STOPS
BEFORE PROMOTION: it never activates a channel and never writes a promotion
record. Only ``"propo... | cdnwetzel/pxx | pxx/improve/cycle.py | .py | efeea058607df065 | 7.64 | 18 |
#!/usr/bin/env python3
"""Canonical JSON + canonical hash for ticket sync (worklog spec section 10.3).
This is THE implementation of the canonical hash. The ticket-sync skill and
bin/sync_dispatch.py both call THIS function; nothing else may reimplement it.
Changing the serialization or the field set changes every ite... | SpillwaveSolutions/wiki_ticket_sdd | bin/canonical.py | .py | 2d05ccf79ff86268 | 7.52 | 10 |
#!/usr/bin/env python3
"""
changelog.py -- draft the unreleased CHANGELOG section from git history.
Item #136: the release skill requires a hand-written `## X.Y.Z — unreleased`
section before a release can be cut, but nothing enforced writing it as
features landed. v0.13.0's section had to be reconstructed from `git l... | SpillwaveSolutions/wiki_ticket_sdd | bin/changelog.py | .py | fc427bba6c9ae002 | 7.52 | 10 |
#!/usr/bin/env python3
"""
fold.py -- derive work item state from the append-only event log.
Reference implementation of WORKLOG-SPEC section 6.
State is a fold over events. Nothing here writes. The log is the truth; this
file is the only thing allowed to decide what it means.
Read section 6 before changing anything... | SpillwaveSolutions/wiki_ticket_sdd | bin/fold.py | .py | 8096b7a1dcdd2728 | 7.52 | 10 |
#!/usr/bin/env python3
"""
item_fields.py -- the configurable optional-field model. Item #108.
The item model had a fixed shape. A lightweight team carried fields it never
filled in; a heavyweight one had nowhere to put risk, owner, or acceptance
criteria without inventing conventions in the body text. The ask was one... | SpillwaveSolutions/wiki_ticket_sdd | bin/item_fields.py | .py | be7796bd8958595a | 7.52 | 10 |
#!/usr/bin/env python3
"""provenance.py -- backfill `merged_in` onto documents once they land.
A document is stamped with `git_hash` when it is written: the commit its
claims were read against. It cannot know the merge that will bring it to the
default branch, because that merge does not exist yet. This module fills t... | SpillwaveSolutions/wiki_ticket_sdd | bin/provenance.py | .py | 3fd95f2e0b4a6590 | 7.52 | 10 |
#!/usr/bin/env python3
"""
render_roadmap.py -- generate the roadmap from the log. WORKLOG-SPEC 13.1.
Pure function of the log: fold in, markdown out, byte-deterministic. The
pre-commit hook regenerates and diffs, so `generated-at` is derived from the
newest event's ULID timestamp -- wall clock here would fail every c... | SpillwaveSolutions/wiki_ticket_sdd | bin/render_roadmap.py | .py | c9b89d6d73bfb2d3 | 7.52 | 10 |
#!/usr/bin/env python3
"""
ulid.py -- ULID generation, including the deterministic form used for ingested
remote changes.
WORKLOG-SPEC sections 5.2 and 10.2.
A ULID is 128 bits: 48 bits of millisecond timestamp + 80 bits of entropy,
Crockford base32 encoded to 26 characters. Lexicographic sort == time sort,
which is ... | SpillwaveSolutions/wiki_ticket_sdd | bin/ulid.py | .py | 343410199710b586 | 7.52 | 10 |
#!/usr/bin/env python3
"""
wiki_flavor.py -- the renderer's one platform seam. Item #271.
The renderer never read the wiki system from config: page naming and every
cross-page link were written for Gollum, the GitHub wiki engine. Roughly forty
wikilink sites and five naming helpers assumed its conventions, so porting ... | SpillwaveSolutions/wiki_ticket_sdd | bin/wiki_flavor.py | .py | f7e148ce1b591201 | 7.52 | 10 |
#!/usr/bin/env python3
"""Bug #142: a commit-only code entry ({'commit': sha}, written by
`worklog link-pr --commit` with no --pr) created no lands-in edge in
build_graph(), so trace-check --strict kept reporting "no PR/commit link"
even after linking a real commit."""
import os
import sys
import unittest
from unittest... | SpillwaveSolutions/wiki_ticket_sdd | tests/test_bug_142.py | .py | cad4fd38f76d2b5d | 8.02 | 10 |
#!/usr/bin/env python3
"""Tests for bug #253: priority/level/kind are single-valued, so a push must
REPLACE the label group, not append to it. Reuses the `gh` stub sandbox from
test_github_adapter.py -- see that file for how calls are recorded and
replayed.
Real-world case: issue #243 in this repo was bumped P3 -> P1 ... | SpillwaveSolutions/wiki_ticket_sdd | tests/test_bug_253.py | .py | 4a5688c9cd116b0a | 8.02 | 10 |
#!/usr/bin/env python3
"""Bug #361: bot pushes to main skip CI.
GitHub does not trigger `on: push` workflows for commits made with the
default GITHUB_TOKEN. The compact job pushes that way, so worklog-invariants
never ran on those commits. Compact already self-checks before it pushes
(0.24.3). The remaining gap is mai... | SpillwaveSolutions/wiki_ticket_sdd | tests/test_bug_361.py | .py | 42d65bd921a1715e | 8.02 | 10 |
#!/usr/bin/env python3
"""Bug #381: generated files conflict on every concurrent branch.
`.work/todo.jsonl` union-merges. docs/roadmap.md does not, and pre-commit
requires every branch to carry a fresh render, so two branches that each
add a work item always conflict on a file nobody edited by hand.
Fix: `merge=ours`... | SpillwaveSolutions/wiki_ticket_sdd | tests/test_bug_381.py | .py | af92424846171d6f | 8.02 | 10 |
#!/usr/bin/env python3
"""
QRadar dagitim paketi ureticisi.
CMT (Content Management Tool) export zip'ini dogrulayip dagitim paketine
cevirir: icine README + LICENSE eklenmis bir release zip'i.
python apps/qradar/build.py --input sgb-usecases-export.zip --version 1.0.0
Cikti: apps/qradar/dist/sgb-qradar-content-<... | bilsectr/sgb-api-bridge | apps/qradar/build.py | .py | c0c713d7db030459 | 7.5 | 9 |
#!/usr/bin/env python3
"""
QRadar rule worksheet ureticisi.
docs/usecases/UC-*.md dosyalarindan her UC'nin QRadar bolumunu cekip
tier sirasina gore tek bir calisma dokumani (rule-sheet.md) uretir.
Lab'da kural girisi yapan kisi 24 dosya arasinda gezinmek yerine bu
sheet'i bastan sona takip eder; her kuralin onunde che... | bilsectr/sgb-api-bridge | apps/qradar/make_rule_sheet.py | .py | 03d253cdec18e548 | 7.5 | 9 |
#!/usr/bin/env python3
"""sgb_taxii modular input'unu canli TAXII servisine karsi calistirir.
Splunk'in run-time'da stdin'e verdigi <input> XML'ini simule eder,
event stream'ini parse edip ozetler. Kucuk koleksiyon (sgb-mining) ile
hizli kosar; ikinci kosumda checkpoint'in calistigini da dogrular.
"""
import io
import... | bilsectr/sgb-api-bridge | apps/splunk/smoke_test_input.py | .py | d51621177f0a2e33 | 8 | 9 |
#!/usr/bin/env python3
"""Hizli yerel dogrulama: XML parse, scheme, annotation JSON, conf yapisi.
AppInspect'in tam kapsamini ikame etmez (o CI'da kosar); paketlemeden once
bariz hatalari yakalar.
"""
import contextlib
import configparser
import glob
import io
import json
import os
import re
import sys
import xml.etre... | bilsectr/sgb-api-bridge | apps/splunk/validate.py | .py | 45fe1933b203b28c | 7.5 | 9 |
"""
SGB indicator + catalog veritabani katmani (SQLite).
Tek dosya: state/sgb.db. Idempotent upsert; full sync sonrasi reconcile ile
silinen kayitlar removed_at_utc damgalanir. Mevcut docs/*-list.txt akisini
bozmaz - paralel yazim icin tasarlandi.
Schema notu: API'deki 'desc' alani internal olarak 'category' kolonund... | bilsectr/sgb-api-bridge | scripts/sgb_db.py | .py | 70328b49ed487f48 | 7.5 | 9 |
"""Command-line interface for PDF renamer."""
import sys
import traceback
from pathlib import Path
import click
from .lookup import lookup_paper_metadata
from .metadata import (
extract_text_from_first_page,
extract_xmp_metadata,
parse_title_and_authors_from_text,
)
from .renamer import generate_zotero_s... | osteele/rename-academic-pdf | src/pdf_renamer/__main__.py | .py | c4f532c04d04a490 | 7.42 | 6 |
"""Extract metadata from PDF files."""
import re
from pathlib import Path
import pymupdf # type: ignore[import-untyped]
from pypdf import PdfReader
from pypdf.errors import PdfReadError
def parse_author_name(author_str: str, multiple_authors: bool = False) -> str:
"""Parse author name and return last name, wit... | osteele/rename-academic-pdf | src/pdf_renamer/metadata.py | .py | c567524de5b7e7f5 | 7.42 | 6 |
"""Core renaming logic."""
import re
from pathlib import Path
def sanitize_filename(filename: str) -> str:
"""Sanitize a filename by removing/replacing invalid characters."""
# Remove or replace invalid filename characters
filename = re.sub(r'[<>:"/\\|?*]', "", filename)
# Replace multiple spaces wit... | osteele/rename-academic-pdf | src/pdf_renamer/renamer.py | .py | e0e218f173455ce8 | 7.42 | 6 |
"""Tests for file selection logic."""
from pathlib import Path
from pdf_renamer.__main__ import collect_files_to_process
class TestCollectFilesToProcess:
"""Test the file collection logic."""
def test_direct_pdf_file_included(self, tmp_path: Path) -> None:
"""Test that directly specified PDF files ... | osteele/rename-academic-pdf | tests/test_file_selection.py | .py | 0bacb6aa20b5ff42 | 7.92 | 6 |
"""Integration tests with synthetic PDFs."""
from pathlib import Path
from pypdf import PdfWriter
def create_pdf_with_metadata(
path: Path, title: str | None = None, author: str | None = None
) -> None:
"""Create a minimal PDF with embedded XMP metadata but no text.
This simulates a scanned PDF with me... | osteele/rename-academic-pdf | tests/test_integration.py | .py | 96665e2107e83b94 | 7.92 | 6 |
"""Tests for PDF renaming logic."""
from pathlib import Path
from pdf_renamer.renamer import (
generate_zotero_style_filename,
is_generic_filename,
sanitize_filename,
should_rename_file,
)
class TestGenerateZoteroStyleFilename:
"""Test filename generation with various metadata combinations."""
... | osteele/rename-academic-pdf | tests/test_renamer.py | .py | 6ff624fa6f769675 | 7.92 | 6 |
"""ai-sdlc-harness core package.
M0 shipped schema validation for the declared data (pipeline manifest, task
FSM, surfaces, config defaults); M1+ added the owned entry points (state
transitions, commit, merge-task, publish-mirror, sync-branch, verify-red,
log-event) per docs/build-plan.md.
"""
import json as _json
imp... | MostAshraf/ai-sdlc-harness | harness/__init__.py | .py | 4f2bba29e517039b | 7.62 | 16 |
"""HMAC integrity chain for run-authority files (RC4).
`state.yaml` and the red-proof sidecars get the same defense-in-depth the TDD
path has: every write by an owned entry point is sealed (HMAC over seq +
prev-hmac + content bytes, key workspace-local); every read verifies. An
out-of-band mutation — any bypass of the... | MostAshraf/ai-sdlc-harness | harness/chain.py | .py | f88550a3edd7b261 | 7.62 | 16 |
"""Provider adapter layer (design.md piece 4).
Callers name an *operation*, never a provider: `dispatch(config, "work_item.fetch",
id=...)` routes to the configured provider's implementation and returns the
normalized contract. Each provider module exposes:
OPS: dict[operation-name, callable(config, **kwargs) -> ... | MostAshraf/ai-sdlc-harness | harness/providers/__init__.py | .py | 56252afe0b3659bb | 7.62 | 16 |
"""Shared normalization helpers (design.md piece 4): section/checklist
parsing and the AC-embedding heuristic for providers without a dedicated
acceptance-criteria field (GitHub/GitLab/local-markdown: look for an
'## Acceptance Criteria' heading, else task-list items)."""
from __future__ import annotations
import re
i... | MostAshraf/ai-sdlc-harness | harness/providers/_normalize.py | .py | 7cc12bd3d40df3c3 | 7.62 | 16 |
"""Azure DevOps work-item provider, CLI transport (`az boards`). Auth =
`az login` / `az devops login`. ADO has real work-item types and states, so
normalization is thin; org/project come from config or az defaults. The
field-mapping is shared with the MCP transport (`ado_mcp`) via `ado_common`."""
from __future__ impo... | MostAshraf/ai-sdlc-harness | harness/providers/ado_cli.py | .py | 1427db5d3068bf10 | 7.62 | 16 |
"""Git-provider axis (design.md piece 4): pr.create per forge, CLI transport.
Emulation hides inside the adapter: GitHub/GitLab link the work item via a
`Closes #N` body line; ADO passes `--work-items` (native link). `local` is
the records-only provider so the pipeline completes without a forge.
"""
from __future__ im... | MostAshraf/ai-sdlc-harness | harness/providers/git_providers.py | .py | 70acf9a09389eac8 | 7.62 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.