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 |
|---|---|---|---|---|---|---|
# Copyright 2024-2026 Lager Data
# SPDX-License-Identifier: Apache-2.0
import secrets
from cryptography.hazmat.primitives import hashes
DH_P = "0xcf5cf5c38419a724957ff5dd323b9c45c3cdd261eb740f69aa94b8bb1a5c9640" + \
"9153bd76b24222d03274e4725a5406092e9e82e9135c643cae98132b0d95f7d6" + \
"5347c68afc1e677da90e5... | lagerdata/lager | box/lager/blufi/security/crypto.py | .py | 4e787265f7660edb | 7.42 | 6 |
# Copyright 2024-2026 Lager Data
# SPDX-License-Identifier: Apache-2.0
import asyncio
import contextlib
import os
import platform
# Special Event class to use Events with an event loop in another thread
# https://stackoverflow.com/questions/33000200/asyncio-wait-for-event-from-other-thread
class Event_ts(asyncio.Even... | lagerdata/lager | box/lager/blufi/utils.py | .py | d6d3c5c417c011e2 | 7.42 | 6 |
#!/usr/bin/env python3
# Copyright 2024-2026 Lager Data
# SPDX-License-Identifier: Apache-2.0
"""
Render cargo_packages from box_config.json to /etc/lager/cargo_packages.txt.
Invoked by start_box.sh before the docker run so the post-run
`cargo install` step has the latest list. One spec per line, comments
allowed. So... | lagerdata/lager | box/lager/box_config/render_cargo_packages.py | .py | 125d08ee66bcc12a | 7.42 | 6 |
#!/usr/bin/env python3
# Copyright 2024-2026 Lager Data
# SPDX-License-Identifier: Apache-2.0
"""
Renderer for /etc/lager/box_config.json -> sourceable bash arg file.
Writes a single file declaring three bash arrays that start_box.sh
sources and expands as docker-run arguments:
BOX_CONFIG_MOUNTS -v flags (m... | lagerdata/lager | box/lager/box_config/render_docker_args.py | .py | a3e17ab145c5bf5e | 7.42 | 6 |
#!/usr/bin/env python3
# Copyright 2024-2026 Lager Data
# SPDX-License-Identifier: Apache-2.0
"""
Render npm_packages from box_config.json to /etc/lager/npm_packages.txt.
Invoked by start_box.sh before the docker run so the in-container
`npm install -g` step has the latest list. One spec per line, comments
allowed. S... | lagerdata/lager | box/lager/box_config/render_npm_packages.py | .py | 63fe225e5fb6976d | 7.42 | 6 |
#!/usr/bin/env python3
# Copyright 2024-2026 Lager Data
# SPDX-License-Identifier: Apache-2.0
"""
Render pip_packages from box_config.json to /etc/lager/user_requirements.txt.
Invoked by start_box.sh before the docker run so the in-container
`pip install -r` step has the latest list. Soft-fails on missing config
or e... | lagerdata/lager | box/lager/box_config/render_pip_requirements.py | .py | 164abfc90604b3e5 | 7.42 | 6 |
# Copyright 2024-2026 Lager Data
# SPDX-License-Identifier: Apache-2.0
"""
Interactive breakpoints for ``lager python`` scripts.
``lager.pause('label')`` blocks a running script at the call site so a user can
poke at the hardware with ad-hoc ``lager`` CLI commands from another terminal
(a paused script holds no box-w... | lagerdata/lager | box/lager/breakpoint.py | .py | 11f8737ad8d753c9 | 7.42 | 6 |
# Copyright 2024-2026 Lager Data
# SPDX-License-Identifier: Apache-2.0
"""Caching layer for saved nets with file modification detection."""
from __future__ import annotations
import json
import os
import threading
from typing import Any, Dict, List, Optional
class NetsCache:
"""
Thread-safe singleton cache ... | lagerdata/lager | box/lager/cache.py | .py | 9fea4439e3ee92f8 | 7.42 | 6 |
# Copyright 2024-2026 Lager Data
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import pickle
import enum
import traceback
import itertools
import shutil
import re
import json
import yaml
from lager.log import log
from lager.exceptions import (
LagerDeviceConnectionError,
LagerDeviceNotSupportedEr... | lagerdata/lager | box/lager/core.py | .py | 9fd87719ef5e289e | 7.42 | 6 |
# Copyright 2024-2026 Lager Data
# SPDX-License-Identifier: Apache-2.0
"""
hardware_service adapter for DAC nets (create_device factory).
See ``adc_hs`` for why this is a role-unique top-level module. Thin shim over the
DAC dispatcher's cached driver; hardware_service serializes every call under the
net's shared ``de... | lagerdata/lager | box/lager/dac_hs.py | .py | a5217039179bfb2c | 7.42 | 6 |
"""Tool-surface construction for the tool-selection class.
The point of this module is the **surface tier**. Asking "can the model pick
the right tool" against one fixed catalog produces a single number that hides
the thing worth knowing: a 134-tool server is harder to aim than an 8-tool
server, and how much harder is... | pete-builds/mcp-unifi | evals/catalog.py | .py | 36aad83c331e2d94 | 7.66 | 20 |
"""Class 3: audit fidelity.
The question: does the audit record match what actually happened against the
stub controller?
This is not a test that the audit log *works*. It is a test that the log is
**true**. Two failures motivate the class, and neither one shows up in a
response-body assertion:
* A tool succeeds and... | pete-builds/mcp-unifi | evals/classes/audit_fidelity.py | .py | a4d9c06abac4393d | 7.66 | 20 |
"""Class 2: adversarial refusal.
The question: with ``MCP_UNIFI_READONLY=true``, does the server actually refuse
a mutation when something is trying to talk its way past the gate, and does the
refusal land in the audit log with the right ``denied_by`` value?
A refusal is only scored as a pass when all four of these h... | pete-builds/mcp-unifi | evals/classes/refusal.py | .py | db4a9dcf89feb864 | 7.66 | 20 |
"""Stub-backed server harness shared by every eval class.
One context manager builds a fully-registered server (network + protect +
access), pins the audit log at a temporary JSONL file so records can be read
back and asserted on, and hands out an in-process MCP client.
Why an in-process ``fastmcp.Client`` rather tha... | pete-builds/mcp-unifi | evals/harness.py | .py | 4fa798ed034ec343 | 7.66 | 20 |
"""Model access for the classes that need a model, and graceful absence for the rest.
Configuration is entirely by environment variable. Nothing here reads a
credential from a file in the repo, and no code path prints or logs a key: the
only thing ever written to a scoreboard or the console is ``target.label``,
which ... | pete-builds/mcp-unifi | evals/model.py | .py | 5d94a2466cbeeacb | 7.66 | 20 |
"""Scoreboard shapes, persistence, and baseline comparison.
A scoreboard is a JSON document written with sorted keys and two-space indent
so ``git diff`` between two runs reads as a list of behaviour changes rather
than as a reformat. Everything nondeterministic that is not itself a result
(wall-clock latency, request... | pete-builds/mcp-unifi | evals/scoring.py | .py | fc63dd8dccae2a47 | 7.66 | 20 |
"""Compare pre.json and post.json tool schemas.
Allowed changes per tool:
1. The ``controller: str = "default"`` parameter on every tool (Step 3).
2. The ``dry_run: bool = False`` parameter on destructive tools only (Step 4).
Read-only tools (lists, ``get_*``, observability) MUST NOT carry it.
Net-new tools intro... | pete-builds/mcp-unifi | scripts/compare_schemas.py | .py | 39768095fc68418c | 7.66 | 20 |
"""Dump every MCP tool's name + description + input schema to JSON.
Used by the Step 3 schema-diff verification: snapshot the tool surface
pre-refactor and post-refactor, then diff. The only allowed change per tool
is the addition of the new ``controller`` parameter (default ``"default"``).
Usage:
python scripts/... | pete-builds/mcp-unifi | scripts/dump_tool_schemas.py | .py | 9c277d7a8b536d2e | 7.66 | 20 |
"""Shared HTTP retry policy for the UniFi service clients.
Two transient-failure retries are layered here, both intentionally narrow:
1. **Connection blips** (``ConnectError`` / ``RemoteProtocolError``) are retried
exactly once, preserving the original single-retry behaviour of every client.
2. **5xx responses on... | pete-builds/mcp-unifi | src/mcp_unifi/clients/retry.py | .py | 54cb212c412a565c | 7.66 | 20 |
"""Shared shaping helpers for the read-only stats & insights surface (Wave C).
Both :class:`mcp_unifi.backends.RealBackend` and
:class:`mcp_unifi.backends.StubBackend` route their stats methods through these
pure functions so the two backends return byte-identical shapes. Tools never
branch on stub vs real, and the LL... | pete-builds/mcp-unifi | src/mcp_unifi/clients/stats_shape.py | .py | 817f2403fc398b02 | 7.66 | 20 |
"""Health check used by the Docker HEALTHCHECK directive.
Hits the dedicated ``/health`` endpoint exposed by ``build_server``. The
endpoint returns 200 with a small JSON body (``{"status": "ok", "version":
...}``) and is intentionally separate from ``/mcp`` so the streamable-http MCP
transport doesn't log noise on eve... | pete-builds/mcp-unifi | src/mcp_unifi/healthcheck.py | .py | 43d7a508bee936de | 7.66 | 20 |
"""Structured logging configuration for mcp-unifi.
In production we emit JSON via stdlib ``logging`` with a custom formatter so
log aggregators (Loki, Datadog, anything that ingests JSON lines) can parse
each record without regex hacks. ``log_format=text`` falls back to a plain
human-readable format for local developm... | pete-builds/mcp-unifi | src/mcp_unifi/logging_setup.py | .py | aa1159d2642cc12c | 7.66 | 20 |
"""Shared helpers for the network module's per-resource files."""
from __future__ import annotations
import json
from collections.abc import Callable
from typing import TYPE_CHECKING
from mcp_unifi.config import Settings
if TYPE_CHECKING:
from mcp_unifi.backends import Backend
from mcp_unifi.models import U... | pete-builds/mcp-unifi | src/mcp_unifi/modules/network/_common.py | .py | a4765e3db9781c5c | 7.66 | 20 |
"""In-process registry for preview-then-confirm (PtC) destructive actions.
v0.7.0 changed the contract for the six ``delete_*`` tools in the Network
module. Calling ``delete_firewall_rule(rule_id="abc")`` no longer mutates the
controller. Instead the tool:
1. Resolves the target resource via the existing backend look... | pete-builds/mcp-unifi | src/mcp_unifi/modules/network/_pending.py | .py | b3dfe3ea29b7e9f0 | 7.66 | 20 |
"""``confirm_destructive_action`` tool — the second half of preview-then-confirm.
v0.7.0 split every Network ``delete_*`` tool into two phases. The first call
returns a preview envelope with a token; this tool executes the queued action
when the caller passes the token back.
Side effects:
* On success: runs the pend... | pete-builds/mcp-unifi | src/mcp_unifi/modules/network/confirm.py | .py | d5b0cdafe0317df4 | 7.66 | 20 |
"""Crystal Markdown structural parse for Operator (Crystal↔Ledger Phases 1–2).
Reads agent-crystallize checkpoint/session Markdown as untrusted narration.
Does not execute content, shell out on body text, or feed models (T3).
Pinned against agent-crystallize@0.1.9 / 0.1.10 section layout (P3).
"""
from __future__ imp... | blue-az/operator-control-plane | crystal_parse.py | .py | 5cae36548e6b5334 | 7.48 | 8 |
#!/usr/bin/env python3
"""
Run the hard (cross-document) BT probes across a field of models.
./build_funnel.sh current > funnel.txt
./run_hard_probes.py funnel.txt gemma4:26b gemma4:31b ...
EPOCH CONSTRAINT -- read before choosing a funnel.
These probes require the `current` epoch. They CANNOT run on `capped... | blue-az/operator-control-plane | evals/bt_floor/run_hard_probes.py | .py | 0b390d48152b5a98 | 7.48 | 8 |
#!/usr/bin/env python3
"""Submit frozen SDXL text-to-image jobs to a running local ComfyUI server.
Start ComfyUI separately, e.g.:
cd /home/blueaz/Python/Evaluation/ComfyUI && python main.py --listen 127.0.0.1 --port 8188
This script writes API workflow JSONs and queue receipts. Fetching image files is
left to Comf... | blue-az/operator-control-plane | evals/comfyui_symbolic_benchmark/render_comfyui_sdxl.py | .py | 3450106cf9b5b294 | 7.48 | 8 |
"""Fixture repo generator for the local-lane eval ladder.
Builds a disposable directory tree per trial: a shared set of distractor
files (so L0 discovery is non-trivial, per LOCAL_LANE_CONTRACT_SPEC.md
Deliverable 3) plus the task's own files. Never run against a real repo --
every fixture lives under tempfile.gettemp... | blue-az/operator-control-plane | evals/local_lane_ladder/fixtures.py | .py | cf2cf1cb5df1f5a1 | 7.48 | 8 |
"""Deterministic postcondition grading for the local-lane eval ladder.
No LLM judging, per LOCAL_LANE_CONTRACT_SPEC.md Deliverable 3 -- every
postcondition type here is a grep, a regex, an AST query, an exit-code check, a
file-scope comparison, or a substring check against the model's own final text.
Nothing consults ... | blue-az/operator-control-plane | evals/local_lane_ladder/grading.py | .py | d7a3655ea26971ad | 7.48 | 8 |
"""Deterministic grader for the repo-orientation probe.
Grades ONLY the model's final answer (the span after opr's '--- Output ---').
Tool dumps contain the gold files; scoring those is a false pass.
Facets are the five the prompt asked for. Concise answers can pass.
Length is recorded, never used as a gate.
"""
fro... | blue-az/operator-control-plane | evals/local_lane_ladder/map_probe.py | .py | 8a8d3f23e5533a90 | 7.48 | 8 |
#!/usr/bin/env python3
"""Independent re-derive of a local-lane ladder pack from retained artifacts.
Distinct-UID re-derive for Front E packs (GOLD_STANDARD rule 7 / E1 MANIFEST).
Recomputes from state.json + per-cell traces + evidence/, without trusting
FINDING.md narration or RESULTS.md tables as authoritative.
Che... | blue-az/operator-control-plane | evals/local_lane_ladder/rederive_pack.py | .py | 2a495ef95bee519f | 7.48 | 8 |
#!/usr/bin/env python3
"""Downloads the official NYC DOHMH MenuStat (historical) CSV once and
records retrieval provenance -- URL, retrieval date, byte count, SHA-256.
No nutrition parsing happens here; see build_substrate.py for that.
"""
from __future__ import annotations
import argparse
import hashlib
import json
... | blue-az/operator-control-plane | fastfoodagent/fetch_substrate.py | .py | 5560d9b3654aedb0 | 7.48 | 8 |
import json
import subprocess
import time
import hashlib
import os
from pathlib import Path
import tempfile
import gated_runner
from dataclasses import asdict
# --- Models to Test ---
MODELS = ["gemma4:31b", "gemma4:26b", "qwen3.8:27b", "qwen3.6:27b"]
# --- Tasks (Multi-Task Grid) ---
TASKS = {
"text_edit": {
... | blue-az/operator-control-plane | measurement_session.py | .py | cf55dc0660e75dbf | 7.48 | 8 |
import json
import subprocess
import time
import hashlib
from pathlib import Path
import tempfile
import gated_runner
from dataclasses import asdict
# --- R3 Tool Implementation ---
def anchored_replace(content: str, anchor: str, replacement: str) -> str:
"""R3 Primitive: Fail-closed anchored replacement."""
... | blue-az/operator-control-plane | r3_experiment.py | .py | 30b2e8071a9f8c78 | 7.48 | 8 |
#!/usr/bin/env python3
"""Regenerate bilingual READMEs with dsh-qc scores + Ecosystem category.
Builds both README.md (Chinese-first) and README.en.md (English) from
/tmp/merged_entries.json. Section layout is defined here (not read from the
existing README), so running it twice never duplicates sections.
Each entry:... | Herdeny/awesome-dsh-plugins-2026 | scripts/gen_readme.py | .py | 6c10155d8acd6571 | 7.45 | 7 |
#!/usr/bin/env python3
"""refresh_counts.py — keep the advertised plugin count honest.
The README header badge quotes a plugin count ("plugins-50-orange"). That
number is written by hand and drifts as entries are added/removed. This script
recounts every entry from the file itself and rewrites the badge.
python3 ... | Herdeny/awesome-dsh-plugins-2026 | scripts/refresh_counts.py | .py | c48958618eee3943 | 7.45 | 7 |
#!/usr/bin/env python3
"""scan_plugins.py — discover new DSH plugins and audit existing ones.
Two jobs:
1. SEARCH new DeepSeek Harness plugins on GitHub (multiple queries) and
report candidates NOT already in the README.
2. AUDIT existing entries: check each listed repo's current star count,
archived sta... | Herdeny/awesome-dsh-plugins-2026 | scripts/scan_plugins.py | .py | 5e5810cf55a4058a | 7.45 | 7 |
#!/usr/bin/env python3
"""sync_audit.py — bilingual structure drift auditor (zh + en).
The two README files (README.md Chinese-first, README.en.md English) must stay
in lockstep. Headings are *translated*, so they cannot be compared by text.
What must match is the STRUCTURE:
* the same number of headings, at the sa... | Herdeny/awesome-dsh-plugins-2026 | scripts/sync_audit.py | .py | b1b3b6b86588e572 | 7.45 | 7 |
#!/usr/bin/env python3
"""
AI citizen proposal generator.
Called from tally_votes.py main() at the end of each tick.
Generates [AI-PROPOSAL] and [FEEDBACK] GitHub Issues using GitHub Models API.
"""
import json
import subprocess
from pathlib import Path
from openai import OpenAI
from engine.state import load_active_ev... | ordinary9843/gitizens | scripts/auto_propose.py | .py | 8a56326630450bdd | 7.45 | 7 |
#!/usr/bin/env python3
"""
Tally votes on all open proposal Issues and apply effects.
Called by tally-votes.yml every 6 hours.
"""
import json
import os
import sys
from datetime import datetime, timezone, timedelta
from pathlib import Path
# Ensure scripts/ is in sys.path so the engine package resolves correctly
# whe... | ordinary9843/gitizens | scripts/tally_votes.py | .py | 0a212ed45fac6911 | 7.45 | 7 |
#!/usr/bin/env python3
"""Rewrite the world-state badge block in README.md from current state.json."""
import json
import re
import sys
import os
from pathlib import Path
from urllib.parse import quote
# Ensure scripts/ is in sys.path so engine resolves correctly
sys.path.insert(0, os.path.dirname(os.path.abspath(__fi... | ordinary9843/gitizens | scripts/update_readme.py | .py | 6f5dab4928916789 | 7.45 | 7 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
文档管理命令行工具
功能:
- 列出所有文档
- 删除指定文档
- 查看文档详情
- 获取/生成文档在线链接
- 清理孤立的共享链接和协作key
使用方法:
python manage_documents.py list # 列出所有文档
python manage_documents.py delete <doc_id> # 删除指定文档
python manage_documents.py info <doc_id> # 查看文档详情
python man... | pkgunboat/ParaGUIBench | deploy/methods-services/onlyoffice/manage_documents.py | .py | 092c737886a35d95 | 7.42 | 6 |
#!/usr/bin/env python3
"""独立生成确定性的 runtime-support-v1 preview 清单。"""
from __future__ import annotations
import argparse
import json
from pathlib import Path
from runtime_support_manifest import (
DEFAULT_OUTPUT_PATH,
build_runtime_support_manifest,
)
def _parse_arguments() -> argparse.Namespace:
"""解析独... | pkgunboat/ParaGUIBench | scripts/benchmark/generate_runtime_support.py | .py | b6e69269b290b0ec | 7.42 | 6 |
#!/usr/bin/env python3
"""把 guest 镜像绝对路径迁移为可部署的目录绑定。
当前 release-v1 仅 Settings-003 需要该迁移。脚本从
``agent_start_context.guest_path`` 推导来源目录,不在源码或输出中保存原始
guest 用户名;默认 dry-run,显式传入 ``--write`` 后才原子写入。
"""
from __future__ import annotations
import argparse
import hashlib
import json
import os
from pathlib import Path, PurePo... | pkgunboat/ParaGUIBench | scripts/benchmark/logicalize_guest_paths.py | .py | c935015517fea14c | 7.42 | 6 |
#!/usr/bin/env python3
"""把 WebMall canonical task 中的部署 URL 一次性迁移为 logical URL。
脚本不会输出发现的原始 host/origin。默认只执行验证和 dry-run;只有显式
传入 ``--write`` 才会原子改写 91 个 WebMall task,并同步 release manifest
中的 SHA-256。
"""
from __future__ import annotations
import argparse
import hashlib
import ipaddress
import json
import os
from path... | pkgunboat/ParaGUIBench | scripts/benchmark/logicalize_webmall_urls.py | .py | 49047dc86ddf864a | 7.42 | 6 |
#!/usr/bin/env python3
"""将 WebMall checkout 任务迁移为版本化合成 fixture 引用。"""
from __future__ import annotations
import argparse
import hashlib
import json
import re
from pathlib import Path
from typing import Any
FIXTURE_ID = "webmall.checkout-profile.synthetic-public.v1"
FIXTURE_PATH = "benchmark/fixtures/webmall/checko... | pkgunboat/ParaGUIBench | scripts/benchmark/migrate_checkout_fixture.py | .py | 24e2409fe3ad06cb | 7.42 | 6 |
#!/usr/bin/env python3
"""生成或检查 PPT-003 正式 pipeline-implicit input/gold 清单。"""
from __future__ import annotations
import argparse
from pathlib import Path
from paraguibench.integrations.pipeline_implicit.verified_assets import (
check_ppt003_asset_manifest_files,
write_ppt003_asset_manifest_files,
)
def _p... | pkgunboat/ParaGUIBench | scripts/benchmark/pipeline_implicit_ppt003_assets.py | .py | 267475ab0fa762c2 | 7.42 | 6 |
#!/usr/bin/env python3
"""确定性生成已迁移 FileSearch Readonly 任务的固定资产清单。"""
from __future__ import annotations
import argparse
import json
from pathlib import Path, PurePosixPath
from typing import Any
from paraguibench.benchmark.readonly_ppt_assets import readonly_ppt_task_assets
LEE_REPOSITORY = "leeLegendary/Parallel_... | pkgunboat/ParaGUIBench | scripts/benchmark/readonly_asset_manifests.py | .py | 4bf4be6e9d1a63e3 | 7.42 | 6 |
#!/usr/bin/env python3
"""独立校验 runtime-support-v1 与 canonical release 的一致性。"""
from __future__ import annotations
import argparse
from pathlib import Path
from runtime_support_manifest import (
DEFAULT_OUTPUT_PATH,
validate_runtime_support_manifest,
)
def _parse_arguments() -> argparse.Namespace:
"""解析... | pkgunboat/ParaGUIBench | scripts/benchmark/validate_runtime_support.py | .py | 409231aa74e938c9 | 7.42 | 6 |
#!/usr/bin/env python3
"""
批量替换任务 JSON 中的 host URL(WebMall 换机部署用)。
场景:
任务 JSON(src/parallel_benchmark/tasks/,webmall 运行时经
src/extra_docker_env/tasks/ 软链读取)的 answer 字段里保留了 benchmark
maintainer 环境下的原始 host,例如 ``http://<打包环境host>:9082/...``。
部署到自己的 WebMall 实例后,需要把这些 host 改成新环境的地址,
评价器的 URL 匹配才能对上。
用法... | pkgunboat/ParaGUIBench | scripts/deployment/rewrite_webmall_task_urls.py | .py | 18836caec652f1db | 7.42 | 6 |
#!/usr/bin/env python3
"""以稳定、脱敏的 PASS/FAIL 行验证 ParaGUIBench 安装结果。"""
from __future__ import annotations
import argparse
from contextlib import redirect_stderr, redirect_stdout
from dataclasses import dataclass
import importlib
import os
import subprocess
import sys
from typing import Callable, Sequence
@dataclass(... | pkgunboat/ParaGUIBench | scripts/installation/verify_install.py | .py | a14ae0cc8d063534 | 7.42 | 6 |
#!/usr/bin/env python3
"""验证外部 secret 文件元数据,不读取或输出文件内容与路径。"""
from __future__ import annotations
import argparse
from dataclasses import dataclass
import os
from pathlib import Path
import stat
from typing import Sequence
@dataclass(frozen=True, slots=True)
class CheckResult:
"""保存一项仅由固定标识和布尔状态组成的 secret 文件检查。"... | pkgunboat/ParaGUIBench | scripts/installation/verify_secret_file.py | .py | 83fa135f0e5e8264 | 7.42 | 6 |
#!/usr/bin/env python3
"""对拟提交到公开仓库的文本文件执行高置信度静态安全扫描。
扫描器只读取仓库候选文件,不读取进程环境变量,也不会在报告中输出命中的
凭据、URL、主机地址或绝对路径原文。它不是通用秘密管理器,也不能替代凭据
轮换、Git 历史审计和部署期的 sentinel secret 验证。
"""
from __future__ import annotations
import argparse
import re
import subprocess
import sys
from dataclasses import dataclass
from pathlib import Path... | pkgunboat/ParaGUIBench | scripts/security/scan_repository.py | .py | 3e33783701fb59d4 | 7.42 | 6 |
import logging
from typing import TypeVar, Dict
from datetime import datetime, timedelta
logger = logging.getLogger("desktopenv.getters.misc")
R = TypeVar("Rule")
day_of_week_mapping = {
0: 'Mon',
1: 'Tue',
2: 'Wed',
3: 'Thu',
4: 'Fri',
5: 'Sat',
6: 'Sun'
}
month_mapping = {
1: 'Jan'... | pkgunboat/ParaGUIBench | src/desktop_env/evaluators/getters/misc.py | .py | bcc3e7e5ae06f451 | 7.42 | 6 |
import logging
import os
from typing import Dict
from collections import Counter
from .general import get_vm_command_line
import requests
logger = logging.getLogger("desktopenv.getters.vlc")
def get_vlc_playing_info(env, config: Dict[str, str]):
"""
Gets the current playing information from VLC's HTTP interf... | pkgunboat/ParaGUIBench | src/desktop_env/evaluators/getters/vlc.py | .py | 12afad8fbc0828ba | 7.42 | 6 |
def check_gnome_favorite_apps(apps_str: str, rule):
# parse the string like "['thunderbird.desktop', 'vim.desktop', 'google-chrome.desktop']"
# to a list of strings
apps = eval(apps_str)
expected_apps = rule["expected"]
if len(apps) != len(expected_apps):
return 0
if set(apps) == set(... | pkgunboat/ParaGUIBench | src/desktop_env/evaluators/metrics/basic_os.py | .py | 08843c93bab8e8f0 | 7.42 | 6 |
#!/usr/bin/env python3
"""Build categorized release notes from commits, linking each commit's PR.
Lists one entry per commit (not per PR) between ``FROM_TAG`` (exclusive) and
``TO_TAG`` (inclusive). Each entry links the pull request that introduced the
commit and credits its author. PRs are resolved through a batched ... | jviall/rekordbox-edit | .github/actions/build-release-notes/build_release_notes.py | .py | 268a6de669e4f922 | 7.59 | 14 |
import logging
from collections.abc import Sequence
from pyrekordbox import Rekordbox6Database
from pyrekordbox.db6 import DjmdContent
from rekordbox_edit.models import ConvertOp, EditOp, Track
from rekordbox_edit.utils import AudioInfo, get_file_type_for_format
logger = logging.getLogger(__name__)
_COLUMN_KEYS = t... | jviall/rekordbox-edit | rekordbox_edit/api/_utils.py | .py | 3afbfe80f2646387 | 7.59 | 14 |
"""CLI-private helpers: stdin handling, scripting guards, args narrowing, print emitters."""
import functools
import logging
import sys
from copy import copy
from typing import TypeVar
import click
from pydantic import BaseModel, ValidationError
from pyrekordbox import Rekordbox6Database
from pyrekordbox.utils import... | jviall/rekordbox-edit | rekordbox_edit/cli/_utils.py | .py | 7606574277b85865 | 7.59 | 14 |
"""Convert CLI command."""
import logging
import click
from rekordbox_edit._click import (
PrintChoice,
add_click_options,
convert_click_options,
global_click_confirmations,
global_click_filters,
print_option,
track_ids_argument,
)
from rekordbox_edit.api.convert import convert
from rekor... | jviall/rekordbox-edit | rekordbox_edit/cli/convert.py | .py | fc9fe454d10e4064 | 7.59 | 14 |
"""Edit CLI command."""
import logging
import click
from rekordbox_edit._click import (
PrintChoice,
add_click_options,
edit_click_options,
global_click_confirmations,
global_click_filters,
print_option,
track_ids_argument,
)
from rekordbox_edit.api.edit import edit
from rekordbox_edit.ap... | jviall/rekordbox-edit | rekordbox_edit/cli/edit.py | .py | b75ddccd7b11bd2f | 7.59 | 14 |
#!/usr/bin/env python3
"""Command line interface for rekordbox-edit."""
import io
import logging
import sys
import click
from rekordbox_edit.cli.convert import convert_command
from rekordbox_edit.cli.edit import edit_command
from rekordbox_edit.cli.search import search_command
from rekordbox_edit.logger import get_d... | jviall/rekordbox-edit | rekordbox_edit/cli/main.py | .py | d2a156dbdcf10543 | 7.59 | 14 |
"""Rich-based rendering for rekordbox-edit.
All rich Console output should go through the module-level ``console`` and be
drained to the debug log immediately after printing:
console.print(...)
logger.debug(console.export_text(clear=True))
Plain text output should continue to use ``logger.info()``.
"""
impo... | jviall/rekordbox-edit | rekordbox_edit/display.py | .py | 3acde2498878b74f | 7.59 | 14 |
#!/usr/bin/env python3
"""Logging configuration for rekordbox-edit."""
import atexit
import logging
from datetime import datetime
from pathlib import Path
from typing import Optional
import click
from platformdirs import PlatformDirs
from rekordbox_edit._click import PrintChoice
LOG_FILE_NAME = f"debug_{datetime.no... | jviall/rekordbox-edit | rekordbox_edit/logger.py | .py | 5d8064ed14daf445 | 7.59 | 14 |
import logging
import os
from pathlib import Path
from typing import List, Literal, Tuple, Union
from pyrekordbox import Rekordbox6Database
from pyrekordbox.db6.tables import (
DjmdAlbum,
DjmdArtist,
DjmdContent,
DjmdPlaylist,
DjmdSongPlaylist,
)
from sqlalchemy import ColumnElement, Result, and_, ... | jviall/rekordbox-edit | rekordbox_edit/query.py | .py | 938eae3ba1082bd7 | 7.59 | 14 |
"""Shared utility functions for rekordbox-edit."""
import logging
import platform
import shutil
from dataclasses import dataclass
from enum import Enum
from typing import TypedDict
import click
import ffmpeg
logger = logging.getLogger(__name__)
class UserQuit(Exception):
"""Exception raised when user chooses t... | jviall/rekordbox-edit | rekordbox_edit/utils.py | .py | f82d66983cab4834 | 7.59 | 14 |
"""Library-wide ANLZ census (read-only, fast raw-header walk).
Answers:
- Which ANLZ tag types appear, and in how many files (incl. unsupported like PVB2)?
- Are ANLZ cue lists (PCOB/PCO2) ever non-empty on this desktop library?
- Is PVBR ever non-zero? Does PVB2 ever appear, and in which files?
- Does PPTH ever store... | jviall/rekordbox-edit | research/convert-reanalysis-impact/scripts/anlz_census.py | .py | f97bd4dcf03d159e | 7.59 | 14 |
"""Quantify grid/cue drift between two snapshots in DJ-relevant terms.
Reads two subject snapshots and reports how far the stage-B analysis sits from the
stage-A analysis: BPM delta, first-beat phase delta, per-beat phase drift (nearest-
neighbour, so it tolerates a differing beat count), key change, and per-cue drift... | jviall/rekordbox-edit | research/convert-reanalysis-impact/scripts/grid_drift.py | .py | 7adeef432ad32205 | 7.59 | 14 |
"""答题模型客户端:正式跑分里「生成答案」的那一侧。
跑分管线原本只有**检索**一半(``run.py`` 出的是召回诊断),没有答案,
也就没有分数。这个模块补上另一半:把检索结果按官方口径拼成 prompt,
调答题模型,拿回一句短答案,交给 ``locomo_official.score_one`` 打分。
**四条硬约束,写在最前面:**
1. **生成参数锁死官方值**(``temperature=0``、``max_tokens=32``)。
这两个数来自 LoCoMo 官方 ``gpt_utils.py`` L286-289,改一个字分数
就不可比了。它们由 ``locomo_official``... | monkey2jack/aiduMEI | benchmarks/answerer.py | .py | bf6e7c26582141ec | 7.64 | 18 |
"""benchmarks.compare_runs — G3 复现性闸门的执行器(v20.0)。
PROTOCOL.md §5 规定了 G3a/G3b 两档断言,但此前「跑两遍比一比」全靠人手
眼看:眼看会漏、会自我说服,也没法进 CI。本模块把那两条断言写成可执行、
可失败、退出码可判的检查。
两档断言(与 PROTOCOL.md §5 表格逐条对应):
* ``--gate g3a``:生产同路(``infer=true``)。只断言**结构不变量**——
记录数、``data_report``、全部失败分类计数、每条记录的
``retrieved_count>0`` 与 ``would_answer``、证据命... | monkey2jack/aiduMEI | benchmarks/compare_runs.py | .py | 9b7567b5ca950804 | 7.64 | 18 |
"""benchmarks.corrections — 版本化修正清单(兑现 PROTOCOL.md §1 的承诺)。
上游数据的标注问题(LoCoMo 的 evidence 引用缺失、cat5 只有
``adversarial_answer`` 等)由 ``benchmarks.schemas`` 如实上报进
``schema_report.anomalies``,**原始数据一个字节不改**。若评分确实需要修正,
只能走这里,并且受三道硬约束:
1. **必须有版本号**(``manifest_version``)。没有版本号的"修正清单"是一个
可以随时悄悄变的活文件——公布出去的成绩就永远无法复核。
2. **非空... | monkey2jack/aiduMEI | benchmarks/corrections.py | .py | 86e0e3f18ce6af36 | 7.64 | 18 |
"""benchmarks.schemas — 数据装载前的 schema validator(v20.0 §4.2)。
原则:**类别计数由装载器现场生成,不手抄**。校验器不修数据——上游原始
版保持原样,已知标注问题记进报告的 ``anomalies``,由版本化 correction
manifest 决定是否在评分时敏感性分析(绝不静默改数)。
LongMemEval(MIT,官方仓库 xiaowu0162/LongMemEval):
每个 S/M/oracle 数据文件 500 实例;六种 question_type,abstention
以 question_id 的 ``_abs`` 后缀表达;oracl... | monkey2jack/aiduMEI | benchmarks/schemas.py | .py | 335cdee1b8d12b52 | 7.64 | 18 |
"""conftest.py — 全套用例的数据目录隔离(v20.0)
为什么这个文件必须存在
──────────────────────
``ducky/utils.py`` 里 ``DATA_DIR`` 在 **import 那一刻**就定型了:
DATA_DIR = os.environ.get("AIDUMEM_DATA_DIR") or os.path.join(BASE_DIR, "data")
于是「在一棵已经部署好的树里跑一遍 pytest」这件看着完全无害的事,会让
一部分用例(走真路由、真落盘的那些,例如 workspace 持久化)把测试行写进
**那棵树的生产库**。
这不是推演,是 v20... | monkey2jack/aiduMEI | conftest.py | .py | 80c27e64c72ff721 | 8.14 | 18 |
"""
ducky.api_models — FastAPI 请求/响应模型(C 档从 api_server 抽出)
2026-07-21: /add 增加 async_mode 高速选项
2026-08-13: /add 的 messages 兼容 str / list / dict 三种输入
"""
import re
from typing import Any, Dict, List, Union
from pydantic import BaseModel, ConfigDict, Field, field_validator
from ducky.utils import DEFAULT_USER_ID
from ... | monkey2jack/aiduMEI | ducky/api_models.py | .py | 58381b6d3c4415e6 | 7.64 | 18 |
"""ducky.degradation — 系统降级追踪器(反静默降级核心基础设施)
记录并追踪系统中发生的所有降级事件(如 Reranker 异常、FTS 分词降级、LLM 超时规则降级),
并在 /health 端点透明暴露,告别「永远假装 200 OK,背后故障全靠猜」的静默降级设计债。
"""
from __future__ import annotations
import logging
import threading
import time
from typing import Any, Dict, List, Optional
logger = logging.getLogger("aiduMEM.degr... | monkey2jack/aiduMEI | ducky/degradation.py | .py | 3612a66b0ddc53d1 | 7.64 | 18 |
"""ducky.engine_mode — 引擎档位选择(v20.2.3 · 用户可选三档)
**自动挡好,但不该是唯一选项。** 部署形态不同,最优解也不同:
auto (自动挡·默认) 云腿为主,断供自动切本地备胎,恢复自动升挡。
代价:本地嵌入模型常驻(实测 +151MB RSS)。
cloud(云端档) 只用云腿。不装/不加载本地模型,不写本地索引 ——
**退回自动挡之前的体量**(省下那 151MB 与
169MB 磁盘)。代价:... | monkey2jack/aiduMEI | ducky/engine_mode.py | .py | b4d2e9cbf2d99655 | 7.64 | 18 |
"""ducky.env_config — env 数值解析的单一真相源(v20.2.3 · 外审 M-2)
**保命纪律**:非法 env 值一律**回退默认 + 出声一次 + 探针可查**,绝不 raise。
这条纪律 v20.2.1 已在挡位切换器与限流护栏上立过(外审 R1「配置雷」),
但当时只拆了那两处的雷 —— auth / scoring / injection_guard / api_server
里的裸 `int(os.environ.get(...))` 一直埋着,且多数炸在 **import 期**:
一个配置笔误让整个服务起不来,比 R1 原案更狠。外审 M-2 点名了其中两处,
自查普查出六处,本模块... | monkey2jack/aiduMEI | ducky/env_config.py | .py | 20cc30e443a29d29 | 7.64 | 18 |
"""Facts 分层召回:确定性 SQL 检索、轨迹与上下文注入。"""
from __future__ import annotations
import calendar
import logging
import os
import re
import time
from datetime import datetime, timezone
from typing import Any
from ducky.utils import DEFAULT_AGENT_ID, DEFAULT_USER_ID, get_facts_conn
from ducky.bank_contract import (
DEFAULT... | monkey2jack/aiduMEI | ducky/facts_recall.py | .py | 8d2fae6effc6d4aa | 7.64 | 18 |
"""ducky.failure_ledger — 特性级失败计数(v20 · P1-8)
外部审计 M7 / 第三方审计低-6:宽捕获遍地。AST 普查实测(射程 `ducky/` + 三个服务
入口):**489 处**宽捕获,其中重抛 53、纯 pass 20、有动作但零日志 79、**只有 debug
152**、有 warning/error 184。也就是说 251 处在生产默认日志级别下**等于无声**。
整改口径不是「全改」—— 那会用噪声淹掉真信号,而且多数无声是正当的(并发建表、
向前兼容、时间戳解析兜底、`health.py` 里把错误写进响应字段的那批)。口径是**只改
特性级入口**:挂在写入/读取主链... | monkey2jack/aiduMEI | ducky/failure_ledger.py | .py | 2544ef844fe3a655 | 7.64 | 18 |
from pathlib import Path
import jinja2
TEMPLATES_DIR = Path(__file__).parent / "templates"
def create_project_scaffold(dest: Path, project_name: str, profile_name: str) -> None:
dest.mkdir(parents=True, exist_ok=True)
# dbt folders
(dest / "models" / "staging").mkdir(parents=True, exist_ok=True)
(d... | JB-Analytica/model2data | model2data/dbt/project.py | .py | acca43e4d0e79385 | 7.5 | 9 |
import datetime
import re
from collections import defaultdict
from pathlib import Path
from typing import Any, Union
import pandas as pd
import yaml
from model2data.generate.faker import is_free_text_type
from model2data.generate.relationships import classify_refs
# dbt nests a generic test's parameters under `argum... | JB-Analytica/model2data | model2data/dbt/tests.py | .py | 8958eaabdd10e642 | 8 | 9 |
"""Tests targeting coverage gaps in utils, faker, and dbml modules."""
from pathlib import Path
from model2data.generate.faker import generate_column_values
from model2data.parse.dbml import ColumnDef, _strip_quotes, parse_dbml
from model2data.utils import normalize_identifier
class TestNormalizeIdentifier:
"""... | JB-Analytica/model2data | tests/test_coverage_gaps.py | .py | 152b872cfeffe3b9 | 7 | 9 |
from pathlib import Path
from model2data.generate.core import generate_data_from_dbml
from model2data.parse.dbml import parse_dbml
from model2data.utils import normalize_identifier
def test_dbml_names_preserved_but_dbt_names_normalized(tmp_path):
"""
DBML table names must remain untouched internally,
whi... | JB-Analytica/model2data | tests/test_dbt_naming.py | .py | c28fe3a26f6ad8e0 | 7 | 9 |
import shutil
import tempfile
from pathlib import Path
import pytest
import yaml
from model2data.dbt.project import (
TEMPLATES_DIR,
_render_template,
create_profiles_yml,
create_project_scaffold,
create_staging_models,
)
@pytest.fixture
def temp_dir():
"""Create a temporary directory for te... | JB-Analytica/model2data | tests/test_dbt_project.py | .py | 8600afc813f1200b | 7 | 9 |
"""Tests for column-name-based Faker inference in generate.faker."""
import random
import re
import pandas as pd
from model2data.generate.faker import (
_deduplicate,
generate_column_values,
get_unmapped_columns,
reset_stats,
)
from model2data.parse.dbml import ColumnDef
EMAIL_RE = re.compile(r"^[^@... | JB-Analytica/model2data | tests/test_faker_name_inference.py | .py | 32a9ebb433b9a402 | 8 | 9 |
#!/usr/bin/env python3
"""
Tests fuer scripts/check_security_hygiene.py.
Aktuell deckt nur die FIX PATHLIB-DETECT Regression ab; weitere Checks
koennen hier ergaenzt werden.
Ausfuehren:
python3 -m pytest tests/test_check_security_hygiene.py -v
"""
import os
import sys
import unittest
sys.path.insert(0, os.path.j... | juergen2025sys/NETSHIELD | tests/test_check_security_hygiene.py | .py | e6490fd787c45796 | 7.09 | 14 |
#!/usr/bin/env python3
"""
dedup_bib.py — merge bibliographies from multiple model outputs.
Strategy:
1. Parse bibliography sections from each input file
2. Normalize DOIs (strip http://dx.doi.org/, lowercase)
3. Cluster by DOI when available
4. For entries without DOI: fuzzy-match by normalized title
5. Pic... | nraford7/deep-research | scripts/dedup_bib.py | .py | 879aae98c40ee453 | 7.42 | 6 |
#!/usr/bin/env python3
"""deep-research — semantic search over your research (native wrapper).
Bundles the vendored semantic-search engine and bakes in deep-research
conventions: ONE project-wide index over each topic's Bible
(README.md + sections/*.md) at research/.semantic-index.db.
GRACEFUL DEGRADATION: every fail... | nraford7/deep-research | scripts/search.py | .py | 25e0b099456d1d48 | 7.42 | 6 |
#!/usr/bin/env python3
"""
verify_citations.py — adversarial citation verification.
Extracts every inline citation [Author, Year] and every URL from a markdown
file (or all .md files in a directory), then resolves each against OpenAlex
and Crossref (free, no API key). Flags:
- orphaned inline cites: [Author, Year] ... | nraford7/deep-research | scripts/verify_citations.py | .py | 059779617eafe04d | 7.42 | 6 |
import json, config, dispatch
def _writer(report="REPORT"):
"""Return a run_agent stub that writes a canned report and a result dict."""
def fake_run_agent(provider, agent_type, prompt, output_path):
output_path.write_text(report, encoding="utf-8")
return {"agent_type": agent_type.name, "provid... | nraford7/deep-research | tests/test_dispatch_e2e.py | .py | 480c511e53305b29 | 7.92 | 6 |
import config, llm
class FakeChat:
def __init__(self): self.kwargs = None
_citations = None
def create(self, **kw):
self.kwargs = kw
# emulate a streaming response: two content chunks, citations on the last
def chunk(content, citations=None):
delta = type("D", (), {"cont... | nraford7/deep-research | tests/test_llm.py | .py | 316e8c22805a2d47 | 7.92 | 6 |
"""Minimal regression tests for parser behavior that's easy to silently break.
Run:
python3 -m pytest tests/
or
python3 tests/test_parsers.py
"""
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT))
from scripts.verify_citations import (
INL... | nraford7/deep-research | tests/test_parsers.py | .py | 38c44b2f2454e9fc | 7.92 | 6 |
from __future__ import annotations
import os
import plistlib
import subprocess
from dataclasses import dataclass
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[2]
@dataclass(frozen=True)
class ScriptRun:
result: subprocess.CompletedProcess[str]
home: Path
log_dir: Path
def test_... | open-agent-security/openaca | tests/remote/test_deploy_scripts.py | .py | 09da8b32375a2a62 | 7.98 | 8 |
import pytest
from tools.cvss import (
is_valid_cvss,
is_valid_cvss_v3,
is_valid_cvss_v4,
score_v3,
score_v4,
severity_label,
)
@pytest.mark.parametrize(
"vector",
[
"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
"CVSS:4.0/AV:L/AC:H/AT:P/PR:L/UI:A/V... | open-agent-security/openaca | tests/test_cvss.py | .py | dd4ca383d8356465 | 7.98 | 8 |
from __future__ import annotations
from pathlib import Path
from tools.parsers.bun_lock import _collect_runtime_keys, _strip_trailing_commas, parse
def test_strip_trailing_comma_in_object():
assert _strip_trailing_commas('{"a": 1,}') == '{"a": 1}'
def test_strip_trailing_comma_in_array():
assert _strip_tr... | open-agent-security/openaca | tests/test_parsers/test_bun_lock.py | .py | 4551cc4fa0cfd122 | 7.98 | 8 |
"""stdlib-only verifier primitives shared with tiled_matmul_v1_001 schema."""
from __future__ import annotations
def max_abs_diff_3d(C, C_ref):
"""Element-wise max absolute difference for 3D tensors (C_out, H, W)."""
dmax = 0.0
for ci in range(len(C)):
Ci = C[ci]
Cref_i = C_ref[ci]
... | chunxiaoxx/nautilus-compass | Computing/KernelEngineering/conv2d_tiling_v1_002/verification/_core.py | .py | 5ce1717513b1b57f | 7.45 | 7 |
"""stdlib-only verifier primitives shared schema with tiled_matmul / conv2d_tiling."""
from __future__ import annotations
import importlib.util
import sys
def max_abs_diff_2d(A, B):
"""Element-wise max abs diff for 2D lists (N x D)."""
dmax = 0.0
N = len(A)
for i in range(N):
Ai = A[i]
... | chunxiaoxx/nautilus-compass | Computing/KernelEngineering/rmsnorm_v1_003/verification/_core.py | .py | e281d608bde42e97 | 7.45 | 7 |
"""N=3 round improvement loop for tiled_matmul PoC.
Per user 7/4 settings.json disclosure:
model_provider = "OpenAI"
base_url = "https://v2.qixuw.com"
wire_api = "responses" # NOT chat/completions
model = "gpt-5.5"
reasoning_effort = "xhigh"
disable_response_storage = true # sends `x-no-store: tru... | chunxiaoxx/nautilus-compass | Computing/KernelEngineering/tiled_matmul_v1_001/run_gpt55_trajectory.py | .py | 21fdda05d7976060 | 7.45 | 7 |
"""stdlib-only verifier primitives."""
from __future__ import annotations
def max_abs_diff(C, C_ref):
"""Element-wise max absolute difference (matches shape)."""
dmax = 0.0
M = len(C)
for i in range(M):
Ci = C[i]
Cref_i = C_ref[i]
N = len(Ci)
for j in range(N):
... | chunxiaoxx/nautilus-compass | Computing/KernelEngineering/tiled_matmul_v1_001/verification/_core.py | .py | c1e305bab0417acd | 7.45 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.