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
"""图片 OCR 脱敏单元测试(v0.4,可选特性)。 核心逻辑(mask_blocks / render_text / redact_image)是纯函数,不依赖 pytesseract / Pillow 即可测试;真机 tesseract 相关测试按可用性跳过。 """ import os import subprocess import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from llm_sanitizer import ocr # noqa: E40...
JunyuZhan/llm-sanitizer
tests/test_ocr.py
.py
f3a3626aa4635af7
7.5
0
#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2026 mokume-metal # SPDX-License-Identifier: MIT """版を決め、リリースノートを組む。 リリースは**リポジトリのファイルを 1 つも変えない**。まとめた変更履歴を main へ 入れるには PR が要り、Actions の既定のトークンで作った PR は他のワークフローを 起こさないので必須チェックが走らない — その迂回はリリースのたびに壊れる場所を 増やす。置き場は GitHub の Releases で足り、ファイルに写すと二重管理になる (ADR-0001 原則 9)。 ...
mokume-metal/mokume
scripts/release.py
.py
ced7aa0c777df643
7
0
#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2026 mokume-metal # SPDX-License-Identifier: MIT """ルールセット定義ファイルの検査と、実設定との照合 (#98)。 正本はリポジトリの `.github/rulesets/*.json` で、GitHub 側の状態はその写しに すぎない (ADR-0006)。ここは二つの問いだけに答える: shape <定義ディレクトリ> 定義が API に投げられる形か (token 不要) diff <定義ディレクトリ> <実設定ディレクトリ>...
mokume-metal/mokume
scripts/rulesets_lib.py
.py
cb5f146e36e2dd5a
7
0
#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2026 mokume-metal # SPDX-License-Identifier: MIT """scripts/release.py の検査。 守りたいのは 3 つ: 1. 版の上げ幅が履歴どおりに決まる (1.0 未満では破壊的変更も minor) 2. 中身の無い版を出さない (断片が 1 つも増えていなければ中断) 3. 書いた断片がノートから黙って消えない (知らない分類も落とさない) git は一時リポジトリを本物で回す — 「前回のタグ以降に追加されたか」は履歴の話で、 そこを模造すると検査が確かめた...
mokume-metal/mokume
scripts/tests/release_test.py
.py
72d616fa3cd70063
7.5
0
#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2026 mokume-metal # SPDX-License-Identifier: MIT """ルールセットのドリフト起票の検査 (#99)。 固定したいのは六つ: 1. ドリフトを検出したら Issue が立ち、本文に差分そのものが載る (run のログを開かないと何がずれたか分からない起票は、無いのとあまり変わらない) 2. 同じ Issue が open なら二重に立てない — 日次で回る検査なので、放置された ドリフトが毎日 1 本ずつ Issue を産まない 3. 重複判定はタイトル...
mokume-metal/mokume
scripts/tests/ruleset_drift_test.py
.py
675e3334d01b2714
7.5
0
#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2026 mokume-metal # SPDX-License-Identifier: MIT """ルールセットの定義ファイルと照合・適用の検査 (#98)。 固定したいのは三つ: 1. 定義ファイルの形の検査が、GET の応答をそのまま置いた事故 (id 等の混入) と bypass_actors の欠落を落とす — ADR-0003 決定 1 は書かれていて初めて検査できる 2. 実設定に bypass_actors が無い (= その認証では読めない) とき、黙って一致と 言わない — 既定は赤...
mokume-metal/mokume
scripts/tests/rulesets_test.py
.py
acf738ab8642e0f5
7.5
0
#!/usr/bin/env python3 """Strict conformance adapter for OSIRIS v3 spiral compute. The frozen parent OSIRIS v2/S𓂸ḥ/2 technical_forward keeps the full verified SAT assignment inside its engine but intentionally exports only assignment_sha256 in the public projection. The spiral contract requires a reusable SAT witness...
Hawkar-usls/Janus-Cosmos
workspace/osiris_spiral_runtime_strict.py
.py
f989df1681b8c0e7
7
0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Start the loopback-only ViralX Connector and open the hosted pairing page.""" from __future__ import annotations import argparse import json import socket import threading import time import webbrowser from urllib.error import URLError from urllib.parse import parse_q...
chongchonghaoman/ViralX
connector.py
.py
529bc2b4d160f97b
7.39
5
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """将分析结果导出为 Markdown 到 Obsidian""" import sys sys.stdout.reconfigure(encoding='utf-8') import json from pathlib import Path from datetime import datetime def generate_markdown(analysis_file: Path, keyword: str) -> str: """生成详细的 Markdown 报告""" with open(analysis_fi...
chongchonghaoman/ViralX
export_to_obsidian.py
.py
bbc0b36e202d9917
7.39
5
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """完整分析流程 + 导出到 Obsidian""" import sys sys.stdout.reconfigure(encoding='utf-8') import json from pathlib import Path from datetime import datetime from tiktok_viral_analyzer import TikTokViralAnalyzer from ai_analyzer import AIAnalyzer from report_generator import generate...
chongchonghaoman/ViralX
full_analysis.py
.py
1efd6276e27dc23a
7.39
5
#!/usr/bin/env python3 """ Ask-the-user bridge — the Discord surface for a multiple-choice question. Why this exists at all ---------------------- Claude Code's built-in `AskUserQuestion` tool does not exist over this transport. The agents here are spawned as `claude -p --input-format stream-json`, and in that mode th...
mcarmody/karakos-package
bin/ask_handler.py
.py
d1f80b573f7bea69
7
0
#!/usr/bin/env python3 """ Message Capture — Persist Discord messages to daily JSONL logs. Reads from the agent server's message queue and writes structured JSONL entries to data/messages/messages-YYYY-MM-DD.jsonl. Called by the relay after processing each message batch. Usage: capture.py --message '{"channel":"g...
mcarmody/karakos-package
bin/capture.py
.py
d4b72d70aad5200a
7
0
#!/usr/bin/env python3 """ Health Monitor — Checks component health and alerts on staleness """ import json import logging import os import subprocess import sys import time from pathlib import Path from datetime import datetime, timedelta, timezone from logging.handlers import RotatingFileHandler WORKSPACE_ROOT = Pa...
mcarmody/karakos-package
bin/health-monitor.py
.py
2b1f6abe8c54e712
7
0
#!/usr/bin/env python3 """ Memory Maintenance — Episodic consolidation and embedding generation. Processes recent messages from JSONL files: 1. Reads previous day's messages from JSONL 2. Scores importance (using Claude Haiku for cheap importance scoring) 3. Creates episodes in SQLite episodes table 4. Decays existing...
mcarmody/karakos-package
bin/memory-maintenance.py
.py
6c1e2c40cd11cd98
7
0
#!/usr/bin/env python3 """ Data Purging — Clean up old logs and messages. Purges: 1. Message JSONL files older than MESSAGE_RETENTION_DAYS (default 90) 2. Tool audit records older than TOOL_AUDIT_RETENTION_DAYS (default 30) 3. Session summary archives (keeps last 30 per agent) 4. Agent stream logs older than STREAM_LO...
mcarmody/karakos-package
bin/purge-data.py
.py
61733edf74b1763f
7
0
#!/usr/bin/env python3 """Register Karakos's Discord application ("slash") commands. Guild-scoped registration (not global): guild commands appear immediately, global ones take up to an hour to propagate. Run automatically by `bin/entrypoint.sh` on every container start, so a fresh install has working `/` commands wi...
mcarmody/karakos-package
bin/register-discord-commands.py
.py
423ae53da0e4d90e
7
0
#!/usr/bin/env python3 """ Python-based Scheduler — Replaces cron inside Docker Runs scheduled tasks with full environment variable access. Health heartbeat confirms liveness. """ import schedule import subprocess import sys import os import json import time import logging from pathlib import Path from datetime impor...
mcarmody/karakos-package
bin/scheduler.py
.py
48f30b084be9020d
7
0
#!/usr/bin/env python3 """ Session Summarizer — Generates session summaries for agent context preservation Reads recent agent stream logs, calls Claude to generate a summary, validates required headers, and outputs to checkpoint file for next session re-injection. """ import argparse import json import os import sys ...
mcarmody/karakos-package
bin/summarize-session.py
.py
c0a9fab4847d056c
7
0
#!/usr/bin/env python3 """ wedge-check.py — catch an agent that is alive and stuck. health-monitor.py checks whether components are *running*. This checks whether a running agent is *moving*, which is a different failure and the one that actually strands a user: the claude subprocess is up, the agent server's event lo...
mcarmody/karakos-package
bin/wedge-check.py
.py
2c2e9a217d7c9676
7
0
#!/usr/bin/env python3 """ Protected Paths Checker — Verifies staged git files against protection rules. Called by pre-commit hook. Prints blocked paths and exits non-zero if any Tier 1 protected files are staged for commit. Usage: check-protected-paths.py --staged """ import json import os import subprocess imp...
mcarmody/karakos-package
system/check-protected-paths.py
.py
fbc8675a8772621d
7
0
#!/usr/bin/env python3 """ stop-deferred-work.py — Stop hook: catch a promised-but-never-done turn. An agent can end its turn with "I'll check that shortly" or "On it." and nothing re-invokes it — no background self, no next beat. The user is left holding a commitment with nothing behind it. This hook runs a regex cat...
mcarmody/karakos-package
system/hooks/stop-deferred-work.py
.py
4e24e959877ccb0e
7
0
""" Shared pytest fixtures for Karakos test suite. """ import importlib.util import json import os import sqlite3 import sys import tempfile from pathlib import Path import pytest PACKAGE_ROOT = Path(__file__).parent.parent def import_script(name: str, file_path: Path = None): """Import a Python script by name...
mcarmody/karakos-package
tests/conftest.py
.py
05bb987d42ad3933
7.5
0
# A simple torch style logger # (C) Wei YANG 2017 from __future__ import absolute_import import matplotlib.pyplot as plt import os import sys import numpy as np __all__ = ['Logger', 'LoggerMonitor', 'savefig'] def savefig(fname, dpi=None): dpi = 150 if dpi == None else dpi plt.savefig(fname, dpi=dpi) def...
yoonsangPark0422/Semi-supervised-learning
baseline compare/ABC-main/ABCcode0920/utils/logger.py
.py
55b5e593428afa6d
7
0
'''Some helper functions for PyTorch, including: - get_mean_and_std: calculate the mean and std value of dataset. - msr_init: net parameter initialization. - progress_bar: progress bar mimic xlua.progress. ''' import errno import os import sys import time import math import torch.nn as nn import torch.nn.i...
yoonsangPark0422/Semi-supervised-learning
baseline compare/ABC-main/ABCcode0920/utils/misc.py
.py
014c138f0ea7c49d
7
0
# Copyright 2019 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
yoonsangPark0422/Semi-supervised-learning
baseline compare/crest-master/third_party/augment_ops.py
.py
d38cd3442f152a6d
7
0
# Copyright 2019 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
yoonsangPark0422/Semi-supervised-learning
baseline compare/crest-master/third_party/rand_augment.py
.py
6ab1d5737ab07ed9
7
0
# Copyright 2021 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
yoonsangPark0422/Semi-supervised-learning
baseline compare/crest-master/train_and_eval_loop.py
.py
b3932a66f3e18456
7
0
import json import os import torch import torch.nn.functional as F from yacs.config import CfgNode from lib.dataset.utils import get_class_counts from lib.engine import BaseTrainer from lib.models.losses import Accuracy from lib.utils import Meters, get_last_n_median from lib.utils.dist_logger import DistributionLogg...
yoonsangPark0422/Semi-supervised-learning
baseline compare/daso-main/lib/algorithm/base_algorithm.py
.py
27883d15b9b99002
7
0
import math import os import numpy as np import torch from scipy import optimize from lib.dataset.utils import get_data_config, get_imb_num def get_target_dist(cfg, to_prob=False, device=None): data_cfg = get_data_config(cfg) num_l_head = data_cfg.NUM_LABELED_HEAD num_ul_head = data_cfg.NUM_UNLABELED_H...
yoonsangPark0422/Semi-supervised-learning
baseline compare/daso-main/lib/algorithm/darp_reproduce.py
.py
bbe1a03f62e84273
7
0
"""Process-wide registry of the running :class:`AgentRuntime`. z4j has two independent install paths that can fire in the same Python process when a Django app uses Celery: 1. ``z4j_django.apps.Z4JDjangoConfig.ready()`` - runs when Django loads ``INSTALLED_APPS`` (which happens for *both* the web process and th...
z4jdev/z4j-bare
src/z4j_bare/_process_singleton.py
.py
8e8c66b44ca2bd7e
7
0
"""Out-of-band agent control: pidfile + SIGHUP-driven reconnect. The agent normally lives inside another host process (Django, Flask, FastAPI, a Celery worker, a bare Python script). When an operator wants to force the agent to drop its current connection and reconnect immediately - skipping the supervisor's exponenti...
z4jdev/z4j-bare
src/z4j_bare/control.py
.py
6c1cdf22abfc6db4
7
0
"""Framework-agnostic declarative scheduler reconciler (1.2.2+). Shared by every framework adapter (z4j-django, z4j-flask, z4j-fastapi). Each adapter's own ``declarative.py`` is a thin shim that: 1. Reads ``Z4J_SCHEDULES`` (and optional ``CELERY_BEAT_SCHEDULE``) from the framework's config surface (Django settings...
z4jdev/z4j-bare
src/z4j_bare/declarative.py
.py
13da1c56b6337f0f
7
0
"""Reusable agent diagnostics for ``z4j-doctor`` style commands. Each framework adapter (z4j-django, z4j-flask, z4j-fastapi) ships a ``z4j-doctor`` entry point that wraps the same probes here. Probes return structured :class:`ProbeResult` records, never raise: a doctor command's job is to *report* a failure, not bubbl...
z4jdev/z4j-bare
src/z4j_bare/diagnostics.py
.py
d7ab36c31fe35032
7
0
"""Public ``install_agent()`` entry point for bare Python projects. This is the function bare-Python projects call from their startup module (e.g. a Celery app's ``celery.py``, an RQ worker bootstrap, a Dramatiq broker init module, or any other engine entry point) to wire up z4j. Framework adapters (Django, Flask, Fas...
z4jdev/z4j-bare
src/z4j_bare/install.py
.py
08247598e607f60a
7
0
"""Best-effort detection of "am I running under a process supervisor?" Used by the ``restart_worker`` self-exit path to refuse a restart when no supervisor can be detected - otherwise the agent would silently kill the worker process with nothing to respawn it. Detection signals (any one → orchestrated): - ``Z4J_ORCH...
z4jdev/z4j-bare
src/z4j_bare/orchestrator_detect.py
.py
5465d7632eaf59ac
7
0
"""Exception-safety wrappers. These helpers isolate z4j failures at synchronous host-call boundaries that opt into them. Some engine and framework integrations implement an equivalent local boundary instead, so this module is not a universal wrapper around every public entry point. ``KeyboardInterrupt`` and ``SystemEx...
z4jdev/z4j-bare
src/z4j_bare/safety.py
.py
127e378eb73edcf8
7
0
"""Resolve writable directories for the agent's on-disk buffer. Service deployments often run the agent process under a low-privilege user (``www-data``, ``nobody``, systemd ``DynamicUser=yes``) whose ``$HOME`` resolves to a directory the process cannot write to - ``/var/www``, ``/nonexistent``, or a transient ``/run/...
z4jdev/z4j-bare
src/z4j_bare/storage.py
.py
8b52746a4eb87c54
7
0
"""Transport layer - how the agent talks to the brain. Two implementations, selected by configuration: - :class:`z4j_bare.transport.websocket.WebSocketTransport` - the primary transport. A long-lived bi-directional WebSocket to the brain at ``/ws/agent``. Preferred in production. - :class:`z4j_bare.transport.long...
z4jdev/z4j-bare
src/z4j_bare/transport/__init__.py
.py
5820359c1683fe30
7
0
"""Exactly one place in z4j may swallow a ``BaseException``. ``safe_boundary`` is the firewall between z4j and the host application: a bug in our signal handler or middleware must not crash the user's worker. That is worth having, and it is worth having exactly once. Every other handler has to re-raise or forward, bec...
z4jdev/z4j-bare
tests/unit/test_base_exception_firewall.py
.py
71cd7afe59861c5d
7.5
0
"""Tests for the process-wide ``AgentRuntime`` singleton. The singleton prevents duplicate WebSocket sessions when two independent install paths fire in the same Python process - the concrete case being a Django+Celery worker where both ``Z4JDjangoConfig.ready()`` and ``celery.signals.worker_init`` try to install an a...
z4jdev/z4j-bare
tests/unit/test_process_singleton.py
.py
b2cf348e3aa5b5a8
7.5
0
"""Unit tests for ``z4j_bare.safety``. The safety wrappers are the single most important firewall between z4j code and the host application. Every test here must pass 100% of the time. """ from __future__ import annotations import logging import pytest from z4j_bare.safety import safe_boundary, safe_call class Te...
z4jdev/z4j-bare
tests/unit/test_safety.py
.py
868f6334f7ad8ce6
7.5
0
"""``except*`` runs every matching arm, so arm order cannot decide the class. The supervisor picked a failure class by assigning inside each ``except*`` arm, with a comment explaining that the AgentIncompatibleError arm came first deliberately. That reasoning holds for ``except`` and not for ``except*``: PEP 654 runs ...
z4jdev/z4j-bare
tests/unit/test_supervisor_classifies_by_rank.py
.py
6e2076dbeb0df15d
7.5
0
"""The supervisor must count a failure under the class that classified it. A disconnect is logged in tiers: the first failure of a streak is loud and carries the remedy, later ones drop to DEBUG, and every tenth re-surfaces as an "still trying" INFO. The tier is chosen from the failure's position in its streak, so the...
z4jdev/z4j-bare
tests/unit/test_supervisor_failure_streaks.py
.py
698f85c1e8a1bc42
7.5
0
"""Deterministic repro: silent event_batch loss across a WS reconnect. Safety property under test (the delivery contract from runtime.py's own comments): an ``event_batch`` buffer entry may only be deleted after ITS frame id was acked by the brain in the CURRENT session, or after the entry was re-sent and acked later....
z4jdev/z4j-bare
tests/unit/test_ws_ack_loss_repro.py
.py
7f93aac1e111ade1
7.5
0
"""Shared backend contracts (design doc 17.1). These are the data shapes that cross the MemoryBackend seam. ``ExecutionRecord`` is the canonical one defined in ``tehm/canonical/capture.py`` (single source of truth); the rest are backend-neutral. Provenance rule for every candidate/proposal: ``source`` is always one o...
Zhang-D-Y/Typed-Executable-Hardware-Memory
memory/contracts.py
.py
b2d13e3cf8e4d15b
7
0
"""Resolve the canonical TEHM freeze without host-specific paths.""" from __future__ import annotations import json import os from pathlib import Path POINTER_PATH = Path(__file__).resolve().parent / "canonical_freeze_pointer_v1.json" def load_pointer(path: Path | None = None) -> dict: path = Path(path or POIN...
Zhang-D-Y/Typed-Executable-Hardware-Memory
memory/evaluation/freeze_pointer.py
.py
ff0fafa4ed9f6b1c
7
0
"""MemoryBackend factory (design doc 17.2-17.4). Backend selection is locked at process start via ``R2G_MEMORY_BACKEND`` (``none`` | ``legacy`` | ``tehm``, default ``legacy``). Switching mid-run is forbidden; an invalid name is a hard error, never a silent fallback (H12). """ from __future__ import annotations import...
Zhang-D-Y/Typed-Executable-Hardware-Memory
memory/factory.py
.py
4a911cdd4a774405
7
0
"""MemoryBackend interface (design doc 17.1). The single seam every runtime memory touchpoint goes through. The three implementations (none / legacy / tehm) are mutually isolated: TEHM never reads legacy authority and legacy never reads ``tehm.sqlite`` (H5/H8). """ from __future__ import annotations from typing impor...
Zhang-D-Y/Typed-Executable-Hardware-Memory
memory/interface.py
.py
686afb568e3d94ac
7
0
"""``none`` backend: no-memory baseline (design doc 17.2). Records execution evidence (as a receipt) but never retrieves historical experience. Used as the M0 / no-memory experimental arm. """ from __future__ import annotations from contracts import ( ActivationProposal, ActivationResult, BuildReport, ...
Zhang-D-Y/Typed-Executable-Hardware-Memory
memory/none_backend.py
.py
dde98280deb7ea4d
7
0
#!/usr/bin/env python3 """Build the second held-out evaluation snapshot after the training expansion. The physical training database is the post-WP2 ``memory/tehm.sqlite``. The RTL training evidence is copied from the first freeze because the current working database is physical-only; only RTL rows/rules are imported...
Zhang-D-Y/Typed-Executable-Hardware-Memory
memory/scripts/build_second_heldout_freeze.py
.py
5d7b41cf028546bd
7
0
#!/usr/bin/env python3 """E2E tests for CLI flags using kimi model.""" from __future__ import annotations import json import os import subprocess import sys from pathlib import Path # Colors for output GREEN = "\033[92m" RED = "\033[91m" RESET = "\033[0m" BOLD = "\033[1m" def _env() -> dict[str, str]: """Retur...
AkshatTilak/codeless
scripts/test_cli_flags.py
.py
3e95f52f7e17bcca
7.74
2
#!/usr/bin/env python3 """E2E tests for Harness features: retry, skills, parallel tools, path permissions. Uses kimi model for real API calls. """ from __future__ import annotations import asyncio import os import subprocess import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents...
AkshatTilak/codeless
scripts/test_harness_features.py
.py
372f47348eddd4de
7.74
2
"""Git Checkpoints and Rollback Engine for Codeless & ABB workspaces.""" from __future__ import annotations import datetime import json import shutil import subprocess import uuid from dataclasses import asdict, dataclass from pathlib import Path from codeless.abb.shadow import get_project_storage_dir, resolve_abb_w...
AkshatTilak/codeless
src/codeless/abb/checkpoints.py
.py
dd68e1ec3aee75e9
7.24
2
"""ABB Lifecycle Hook Bridge for intercepting tool execution.""" from __future__ import annotations from pathlib import Path from typing import Any from codeless.abb.hooks.dag_guard import check_dag_dependencies from codeless.abb.hooks.frontmatter import parse_frontmatter, validate_task_frontmatter from codeless.abb...
AkshatTilak/codeless
src/codeless/abb/hooks/bridge.py
.py
4a79c93e6c92d660
7.24
2
"""DAG Dependency Gating hook for ABB task transitions.""" from __future__ import annotations from pathlib import Path from typing import Any from codeless.abb.hooks.frontmatter import parse_frontmatter def index_tasks(tasks_dir: Path) -> dict[str, tuple[Path, dict[str, Any]]]: """ Index all task markdown ...
AkshatTilak/codeless
src/codeless/abb/hooks/dag_guard.py
.py
9fc45caab55c1232
7.24
2
"""YAML frontmatter parser and strict schema validator for ABB task files.""" from __future__ import annotations import re from pathlib import Path from typing import Any import yaml SEMVER_REGEX = re.compile(r"^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?$") VALID_STATUSES = frozenset( { "not_started", "pend...
AkshatTilak/codeless
src/codeless/abb/hooks/frontmatter.py
.py
e28e790916e71867
7.24
2
"""4-Mode Permission Controller and Persona Composition Engine for Codeless.""" from __future__ import annotations from enum import Enum from pathlib import Path from codeless.abb.shadow import resolve_abb_workspace from codeless.abb.virtualization import find_project_root, is_abb_path from codeless.permissions.mode...
AkshatTilak/codeless
src/codeless/abb/permissions.py
.py
69f6fe31bcadde70
7.24
2
"""Shadow workspace bootstrapper, location manager, and path resolver for Codeless.""" from __future__ import annotations import datetime import hashlib import json import os import shutil from pathlib import Path from typing import Any, Literal AbbLocation = Literal["shadow", "local"] def get_project_hash(project...
AkshatTilak/codeless
src/codeless/abb/shadow.py
.py
64038b307b712b85
7.24
2
"""Two-Track Verification Runner and Manifest Engine for Codeless.""" from __future__ import annotations import asyncio import datetime import subprocess import time from dataclasses import dataclass, field from pathlib import Path from typing import Any from codeless.abb.hooks.frontmatter import parse_frontmatter f...
AkshatTilak/codeless
src/codeless/abb/verification.py
.py
ae0b06355673ee3d
7.24
2
"""Shadow path virtualization engine for Codeless. Transparently maps Agent Buildable Base (ABB) domains (tasks, references, workflows, design, features, skills, etc.) to the project's active shadow or local workspace while mapping codebase source and tests to the repo root. """ from __future__ import annotations fr...
AkshatTilak/codeless
src/codeless/abb/virtualization.py
.py
94a38b72ca99e187
7.24
2
"""Anthropic API client wrapper with retry logic.""" from __future__ import annotations import asyncio import json import logging import uuid from dataclasses import dataclass, field from typing import Any, AsyncIterator, Callable, Protocol from anthropic import APIError, APIStatusError, AsyncAnthropic from codeles...
AkshatTilak/codeless
src/codeless/api/client.py
.py
bba6cf80444682d6
7.24
2
# Copyright 2026 Alibaba Cloud (Qwen3-ASR) # # 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 t...
Karin-java/qwen3-aligner-refactor
qwen3_aligner/srt_utils.py
.py
62928ac8c6a234ec
7
0
# Copyright 2026 Alibaba Cloud (Qwen3-ASR) # # 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 t...
Karin-java/qwen3-aligner-refactor
qwen3_aligner/text_utils.py
.py
bf797f17747e336e
7
0
"""Semantic actions and the action engine. An *action* is a named unit of work against a device (inventory, run a set of commands / on-demand commands, collect, ...), implemented as a class and registered in ``ActionRegistry``. ``run_action`` resolves a vendor's command catalog and executes the action, saving outputs ...
liliangnike/fncollect
src/fncollect/actions.py
.py
07df1f305922c09b
7
0
"""ONT cutthrough. An ONT's management plane is not directly reachable: it is reached *through* the OLT. Before any ONT session can open, the OLT side must be provisioned (prepare a debug/vlan path, push the workstation client IP, register the ONT serial, etc.) and often restored afterwards. This module models that a...
liliangnike/fncollect
src/fncollect/cutthrough.py
.py
95682915294b5810
7
0
"""Per-device single-task lock (cross-platform). For a Fixed Network device, only one log-collect task may run at a time. Each fncollect process is separate, so we use an advisory OS file lock keyed by the device identifier (e.g. its IP). Another process targeting the same device fails fast with ``DeviceLockedError``....
liliangnike/fncollect
src/fncollect/device_lock.py
.py
fada41defc040007
7
0
"""Hardware-type auto-discovery. Mirrors the ngalexx approach of dispatching to a concrete hardware class by import path, so that adding a new hardware board is a single-file change with no core edits. Given a vendor package import path and a hardware type string, this resolves and imports the matching class. Convent...
liliangnike/fncollect
src/fncollect/discovery.py
.py
229483b2c90e5227
7
0
"""Real interactive SSH session. Nokia ISAM-style devices do not accept a plain ``exec`` request: they need an interactive PTY shell, prompt detection, paging (``--more--``) handling and support for the context-based CLI navigation. This module provides a session that meets those needs. It also works around the SSH `...
liliangnike/fncollect
src/fncollect/net.py
.py
84be8e100efe811c
7
0
"""ONT devices, specialised by management SoC/chipset. An ONT's management plane runs on vendor-specific silicon (MediaTek, Broadcom, Realtek, ...). Different chipsets speak different CLI dialects, so each is a distinct device class. ``ont_device_for`` dispatches an ONT to the class for its chipset (falling back to a ...
liliangnike/fncollect
src/fncollect/ont.py
.py
c9827e92897be96b
7
0
"""Reusable value processors. Turns raw device output into exact values. Each processor is a *named* transform referenced from YAML (``extract`` / ``probe.mappings``), so "get value" steps stay declarative while the parsing logic lives once in code. Supported processors: * ``regex`` -- capture one/many groups via a...
liliangnike/fncollect
src/fncollect/processors.py
.py
6fffc3ad1503390d
7
0
"""Progress bars for stages/steps/procedures/command executions. Built on ``tqdm`` and styled to look like a Linux package-installation progress bar: a fixed square-bracket bar with a percentage and a description of the current unit (stage -> procedure -> step -> command). Nested levels are rendered as stacked tqdm b...
liliangnike/fncollect
src/fncollect/progress.py
.py
2eeb8c9591771d5a
7
0
"""Abstract contracts for fncollect. A *vendor* is a collection of device types that share a command dialect, login behaviour and transport options. A *device* is a concrete box the tool collects from, composed of a *session* (how to talk) and a *role* / hardware type (what it is, e.g. OLT/NT/LT/ONT). An *action* is o...
liliangnike/fncollect
src/fncollect/vendor.py
.py
6aeef0a1647220bd
7
0
"""Nokia ISAM (7360/7362) vendor pack. Uses the real interactive SSH session with context-based CLI navigation. Bare-bones but functional; extend the command catalog in ``config/vendors/isam/vendor.yml`` and add hardware models under ``vendors/isam/hardware/``. """ from __future__ import annotations from fncollect.n...
liliangnike/fncollect
src/fncollect/vendors/isam/__init__.py
.py
cbcc2e655ebfc256
7
0
"""Tests for the DCP-driven ONT cutthrough provider.""" import pytest from fncollect.config import LoggingConfig, RunConfig from fncollect.cutthrough import DcpCutthroughProvider, OntTarget from fncollect.dcp import DcpDefinition, DcpStep, parse_dcp from fncollect.logging_setup import build_logger from fncollect.ses...
liliangnike/fncollect
tests/test_dcp_cutthrough.py
.py
556997fab7471491
7.5
0
"""Tests for the per-device single-task lock.""" import pytest from fncollect.device_lock import DeviceLock, DeviceLockedError def test_lock_prevents_concurrent(tmp_path): a = DeviceLock(tmp_path, "10.10.10.10") b = DeviceLock(tmp_path, "10.10.10.10") with a, pytest.raises(DeviceLockedError): b....
liliangnike/fncollect
tests/test_device_lock.py
.py
7d2b3d15081d20ac
7.5
0
"""Tests for the non-programmer UX: auto-regex + procedure catalog.""" from fncollect.processors import auto_regex, extract_values from fncollect.vendors.isam import IsamVendor def test_auto_regex_extracts_version(): line = " isam-feature-group : R6.6.02g" pattern = auto_regex(line, "6.6.02") assert p...
liliangnike/fncollect
tests/test_procedures.py
.py
0e50735ea15fd79c
7.5
0
"""Self-contained HTML5 player for the fill-front frame sequence. ``export_frames`` already writes one PNG per frame, so the scrubber costs no extra rendering: the PNGs are inlined as data URIs and driven by a small vanilla-JS player. Everything (play/pause, seek, speed) happens in the browser, so dragging the scrubbe...
shostako/mold-flow-fangate
build/lib/core/fill_player.py
.py
e3b3dc6efa939651
7
0
"""Cavity geometry definition. The simulation domain is a 2D structured grid where each cell is either inside the cavity (mask=True) or outside (mask=False). Each in-cavity cell carries a thickness h [mm] (gap between mold halves). Gates are point-like Dirichlet boundaries at tau=0. This module provides: - Geometry: ...
shostako/mold-flow-fangate
build/lib/core/geometry.py
.py
4055eb99495268fa
7
0
"""Material database and Cross-WLF viscosity model.""" from __future__ import annotations import json from collections.abc import Iterable from dataclasses import dataclass from pathlib import Path import numpy as np @dataclass(frozen=True) class Material: key: str name: str n: float tau_star: floa...
shostako/mold-flow-fangate
build/lib/core/materials.py
.py
21c6ab7d3cbef7f7
7
0
"""Record of the inputs that produced a run, for the results ZIP. ``metadata.json`` holds what the solver *computed* (volumes, tau, iteration counts). It never held what the user *entered*, so a downloaded ZIP could not be traced back to the settings that made it -- the geometry had to be reverse-engineered from the i...
shostako/mold-flow-fangate
build/lib/core/settings_record.py
.py
37b97c6af806319e
7
0
"""Single source of truth for the application version. ``__version__`` is the release version (kept in sync with ``pyproject.toml`` and ``CHANGELOG.md``). ``build_label()`` additionally reports the git commit the running code came from, which is what tells you whether a deployed instance is actually up to date. To cu...
shostako/mold-flow-fangate
build/lib/core/version.py
.py
78aa1fc8eb704eaa
7
0
"""Cavity geometry definition. The simulation domain is a 2D structured grid where each cell is either inside the cavity (mask=True) or outside (mask=False). Each in-cavity cell carries a thickness h [mm] (gap between mold halves). Gates are point-like Dirichlet boundaries at tau=0. This module provides: - Geometry: ...
shostako/mold-flow-fangate
core/geometry.py
.py
4338f785e62ae4d1
7
0
"""Single source of truth for the application version. ``__version__`` is the release version (kept in sync with ``pyproject.toml`` and ``CHANGELOG.md``). ``build_label()`` additionally reports the git commit the running code came from, which is what tells you whether a deployed instance is actually up to date. To cu...
shostako/mold-flow-fangate
core/version.py
.py
09fab4305ea2d52c
7
0
"""Color helpers shared by the thickness-colormap tests. These live in one place on purpose. The luminance formula was originally written out by hand in two test files, and *both copies were wrong the same way* — reason enough to stop having two copies. See :func:`relative_luminance`. """ from __future__ import annot...
shostako/mold-flow-fangate
tests/colorimetry.py
.py
c4b28ca9bee5f251
7.5
0
"""AppTest wiring for the fan-gate geometry sidebar in ``app.py``.""" from __future__ import annotations import dataclasses from core import FanGatePlateConfig from tests.ui_helpers import app as _app from tests.ui_helpers import texts as _texts def test_the_defaults_are_the_spec_mold_and_are_recorded_in_full(): ...
shostako/mold-flow-fangate
tests/test_fan_gate_ui.py
.py
b4d3ecd73ed35663
7.5
0
"""Tests for the run-settings record bundled with the results ZIP. The point of this record is that a downloaded ZIP can be reproduced. Before it existed, ``metadata.json`` held only what the solver computed, so the geometry had to be recovered by measuring the rendered images and searching for a config whose volume a...
shostako/mold-flow-fangate
tests/test_settings_record.py
.py
c8b569ca308d3f33
7.5
0
"""Smoke tests: import-level sanity checks for the core package. These tests do not solve the Hele-Shaw system; they only verify that the package imports cleanly and the bundled material data is loadable. """ from __future__ import annotations def test_core_imports() -> None: from core import ( # noqa: F401 ...
shostako/mold-flow-fangate
tests/test_smoke.py
.py
9ba5455b021ec8b3
7.5
0
"""Analytical-solution verification: 1D strip, full-edge gate. Setup ----- Uniform strip with width Ny cells, length Nx cells, uniform thickness h, uniform effective viscosity. Dirichlet τ=0 imposed on the entire left edge (x=0), no-flux on the other three edges. Reduces to a strict 1D problem in x. The discrete oper...
shostako/mold-flow-fangate
tests/test_solver_1d.py
.py
4d08ef9ee5d94f86
7.5
0
"""AppTest wiring checks for the two-phase short-shot UI in ``app.py``.""" from __future__ import annotations import io import zipfile from pathlib import Path from streamlit.testing.v1 import AppTest from tests.ui_helpers import app as _app from tests.ui_helpers import texts as _texts def test_the_defaults_are_t...
shostako/mold-flow-fangate
tests/test_two_phase_ui.py
.py
9957329624984ed8
7.5
0
"""Smoke tests for the Plotly-based 3D visualizer. These tests do not validate visual output (Plotly figure JSON is verbose and brittle). They confirm: - the 3D renderers run end-to-end on a small Hele-Shaw result, - they return :class:`plotly.graph_objects.Figure` instances, - the figure has the expected three-...
shostako/mold-flow-fangate
tests/test_visualizer_3d.py
.py
2ebe415951bd6615
7.5
0
"""Smoke tests for the multilayer 2D renderers (PR-D).""" from __future__ import annotations import matplotlib.colors as mcolors import matplotlib.pyplot as plt import pytest from core import ( MaterialDB, MultilayerHeleShawSolver, build_demo_geometry, ) from core.visualizer import ( THICKNESS_CMAP, ...
shostako/mold-flow-fangate
tests/test_visualizer_layer.py
.py
c4ae2cf7cd9b185a
7.5
0
"""Weld-line detector: confluence of flow directions, not a local maximum. The old heuristic ("6 of 8 neighbours have a smaller tau") was a near-peak test. A weld that keeps flowing -- the line behind a hole -- always has a later downstream row, so at most 5 neighbours qualified and nothing was drawn. The detector now...
shostako/mold-flow-fangate
tests/test_weld_detection.py
.py
0348edb5ba8a443e
7.5
0
"""Shared AppTest helpers for the ``app.py`` wiring tests.""" from __future__ import annotations from pathlib import Path from streamlit.testing.v1 import AppTest APP = Path(__file__).resolve().parent.parent / "app.py" def app(timeout: float = 240.0, *, fast: bool = True) -> AppTest: """Load the app; ``fast``...
shostako/mold-flow-fangate
tests/ui_helpers.py
.py
6c64a4c216b17d37
7.5
0
"""Language packs: per-language data + hooks, registered centrally. Every language's vocabulary lives in one pack — units, months, symbol words, number-speaker hooks. Adding a language means adding one pack here and one normalizer module; the pipeline reads packs through ``get_pack`` and never branches on language cod...
Revolab-Sdn-Bhd/revo-norm
revo_norm/langpack.py
.py
43d7b81f9967d726
7
0
import re from revo_norm.currency_utils import CURRENCY_K_SUFFIX_PATTERN, expand_currency_k_suffix from revo_norm.num2word_ms import to_cardinal as num2word numbers_mapping_malay = { "0": "kosong", "1": "satu", "2": "dua", "3": "tiga", "4": "empat", "5": "lima", "6": "enam", "7": "tuju...
Revolab-Sdn-Bhd/revo-norm
revo_norm/normalizer_ms.py
.py
873ef516822ef072
7
0
""" Chinese number-to-words conversion for TTS. Supports cardinal numbers from 0 to 10^16 (兆). Handles special Chinese number conventions: - 十 (10) standalone, 一十 (10 embedded in compound) - 一百零一 (101) - 一万零一 (10001) — 零 between groups with skipped digits """ _DIGITS = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九...
Revolab-Sdn-Bhd/revo-norm
revo_norm/num2word_zh.py
.py
96432f27cc8d696a
7
0
""" TTS-specific utility functions for the ChatterBox backend. This module contains features specific to TTS processing that should NOT be in the general text normalization library (revo-norm). Features: - Sentence splitting and chunking for TTS - Random comma insertion for pauses - Sound word removal (laughter, appl...
Revolab-Sdn-Bhd/revo-norm
revo_norm/tts_utils.py
.py
e89e2f32f471bcc3
7
0
""" Scrapes a headline from The Daily Pennsylvanian website and saves it to a JSON file that tracks headlines over time. """ import os import sys import daily_event_monitor import bs4 import requests import loguru def scrape_data_point(): """ Scrapes the top article headline from The Daily Pennsylvanian O...
ang-won/daily-pennsylvanian-basic-scraper
script.py
.py
de021cfd9c0fa358
7
0
"""현행 법령 부칙에서 적용례·경과조치 문장만 고른다.""" from __future__ import annotations import re from utils.parsing import json_list, json_text _TRANSITION_RE = re.compile( r"적용례|경과조치|종전의\s*규정|시행\s*전에?|시행\s*당시|" r"행위에\s*대하여|예에\s*따른다|불구하고.{0,20}적용" ) def _flatten_addendum(value: object) -> list[str]: if value is None: ...
hgkang17/law_info_search
llm/addendum.py
.py
abd1f5cbafb45d76
7
0
"""AI CLI 설치 여부 확인과 npm 전역 설치. 화면에서는 이 함수를 작업 스레드에서 부른다. npm 설치는 네트워크와 디스크를 쓰는 느린 작업이므로 GUI 스레드에서 직접 실행하면 안 된다. """ from __future__ import annotations import json import shutil import subprocess from collections.abc import Callable from dataclasses import dataclass from .desktop_mcp import clean_child_environment, ...
hgkang17/law_info_search
llm/ai_cli_setup.py
.py
0b6d3cc12884c9a4
7
0