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
"""Normalize a generated sticker sheet to a real-alpha PNG.
The preferred path is native alpha from the image backend. Only a verified
uniform, high-contrast chroma-key plate is accepted as an opaque fallback.
Checkerboards, two-tone previews, scenery, and gradients fail closed so they
cannot s... | kobingogo/motion-sticker-pack | scripts/normalize_static_sheet.py | .py | 5f3692995ebfc5f6 | 7.57 | 13 |
import math
import cv2
import numpy as np
import time
class OneEuroFilter:
"""One Euro Filter implementation for real-time smoothing with low lag.
Reference: Casiez et al. 2012.
"""
def __init__(self, min_cutoff=1.0, beta=0.0, d_cutoff=1.0):
self.min_cutoff = float(min_cutoff)
self.be... | Project-Emerge/Project-Emerge-system | aruco-detector/estimator.py | .py | 45ecd666f70b6e96 | 7.5 | 9 |
import argparse
import json
import math
import cv2
import numpy as np
import paho.mqtt.client as mqtt
from estimator import ArUcoRobotPoseEstimator
def calibrate_camera():
"""
Load camera calibration data from calibration.npz file.
"""
try:
# Load calibration data
calib_data = np.load... | Project-Emerge/Project-Emerge-system | aruco-detector/main.py | .py | 3383002df7d390e9 | 7.5 | 9 |
import asyncio
from typing import Protocol
import aiodocker
from offloading_manager.type import ModuleType, Stats
import logging
from offloading_manager.settings import settings
logger = logging.getLogger("uvicorn.error")
DOCKER_NAME: dict[str, ModuleType] = {
"project-emerge-aruco-detector": ModuleType.ARUCO,
... | Project-Emerge/Project-Emerge-system | offloading-manager/src/offloading_manager/module_monitor/module_monitor.py | .py | ffe797579da41e93 | 7.5 | 9 |
import json
from offloading_manager.main import model
def _rpc_request(method: str, params: dict, id: int = 1) -> str:
return json.dumps({"jsonrpc": 2.0, "method": method, "params": params, "id": id})
def _rpc_response(result: dict, id: int = 1) -> str:
return json.dumps({"jsonrpc": 2.0, "result": result, "... | Project-Emerge/Project-Emerge-system | offloading-manager/tests/api/ws/test_robot.py | .py | 4b90a9f24b0538e2 | 8 | 9 |
"""
Pure metric functions for federated learning experiment analysis.
All functions take a list of floats and return a scalar or None.
Zero I/O, zero dependencies beyond stdlib + numpy.
"""
from collections import Counter
from typing import List, Literal, Optional, Tuple
import numpy as np
AGG_MODES = ("min", "max"... | nclabteam/FedProC | analysis/metrics.py | .py | bf8fec691117bde7 | 7.64 | 18 |
"""
Per-experiment analysis.
Reads all runs of one experiment, computes per-run aggregates,
aggregates across runs (mean±std), and saves results.csv.
Input: runs/expN/ directory
Output: runs/expN/results.csv (one row per metric, avg_min/std_min/avg_max/std_max)
"""
import argparse
import logging
import sys
from col... | nclabteam/FedProC | analysis/single.py | .py | ce074bb482a02f8a | 7.64 | 18 |
from collections import OrderedDict
from typing import Any
import torch
from .base import Attack
class BackdoorHF(Attack):
"""High-frequency backdoor: inject out-of-band noise into malicious updates.
Adds a random perturbation whose energy is concentrated outside the benign
DCT-H consensus band, mimick... | nclabteam/FedProC | attacks/BackdoorHF.py | .py | aa9d2c907798744f | 7.64 | 18 |
from collections import OrderedDict
from typing import Any
import torch
from .base import Attack
class GaussianNoise(Attack):
"""Replace malicious updates with zero-mean Gaussian noise.
Noise magnitude is proportional to the parameter's own norm so the
attack strength scales with the model. AUC=1.000 v... | nclabteam/FedProC | attacks/GaussianNoise.py | .py | 2d00a95277971d65 | 7.64 | 18 |
from collections import OrderedDict
from typing import Any
from .base import Attack
class ScaleBoost(Attack):
"""Scale malicious updates by a constant factor to survive 1/N averaging.
W_a = scale * W_honest. Small scale has no effect (1/N damping);
large scale (>=10) dominates the aggregate and causes m... | nclabteam/FedProC | attacks/ScaleBoost.py | .py | a1ef131f159593b0 | 7.64 | 18 |
from collections import OrderedDict
from typing import Any
from .base import Attack
class SignFlip(Attack):
"""Flip the sign of all regular model parameters for malicious clients.
Each malicious client sends -W instead of W. Cheap to compute;
destroys the gradient signal. AUC=1.000 vs benign (probe_diak... | nclabteam/FedProC | attacks/SignFlip.py | .py | 4218c8a5048af26f | 7.64 | 18 |
from collections import OrderedDict
from typing import Any
import torch
from .base import Attack
class StealthHF(Attack):
"""Stealth high-frequency injection: small amplitude to evade magnitude detection.
Low-amplitude HF noise designed to slip under the magnitude-score threshold
of temporal-plausibili... | nclabteam/FedProC | attacks/StealthHF.py | .py | f1d9f91b65819e34 | 7.64 | 18 |
from collections import OrderedDict
from typing import Any
class Attack:
"""Base class for FL Byzantine attacks.
Subclass and override craft() to implement an attack.
The attack operates server-side: it receives all round packages after
client training and before server aggregation, and may modify th... | nclabteam/FedProC | attacks/base.py | .py | 2ced71a26d5dbede | 7.64 | 18 |
import torch
class scaling:
"""Scale each sample feature by a Gaussian factor."""
def __init__(self, sigma: float = 0.5) -> None:
self.sigma = sigma
def __call__(self, x: torch.Tensor) -> torch.Tensor:
factor = 1.0 + self.sigma * torch.randn(
size=(x.size(0), 1, x.size(2)),
... | nclabteam/FedProC | augs/scaling.py | .py | a0a413559371898f | 7.14 | 18 |
import os
from .base import BaseDataset
class BaseStation5G(BaseDataset):
"""Two-minute traffic and radio metrics from 5G base stations."""
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.save_path = os.path.join("datasets", "BaseStation5G")
self.p... | nclabteam/FedProC | data_factory/BaseStation5G.py | .py | cb847e22df60e8c3 | 7.64 | 18 |
import os
import polars as pl
from .base import BaseDataset
class CitiesILI(BaseDataset):
"""Weekly influenza-like illness rates split by city."""
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
# Set the dataset name and path
self.save_path = os.path... | nclabteam/FedProC | data_factory/CitiesILI.py | .py | 1af03f06096be685 | 7.64 | 18 |
import datetime
import os
import polars as pl
import requests
from rich.progress import track
from .base import BaseDataset
class CryptoDataDownloadDay(BaseDataset):
"""Daily Binance spot OHLC series from CryptoDataDownload."""
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **... | nclabteam/FedProC | data_factory/CryptoDataDownload.py | .py | 9ed9de3d65e512cb | 7.64 | 18 |
import os
import pandas as pd
import polars as pl
from .base import BaseDataset
class ElectricityLoadDiagrams(BaseDataset):
"""UCI electricity load diagrams split into per-client series."""
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
# Set the paths for th... | nclabteam/FedProC | data_factory/ElectricityLoadDiagrams.py | .py | 8bfb429cf7505422 | 7.64 | 18 |
import os
from datetime import datetime, timedelta
import polars as pl
from .base import BaseDataset
class ExchangeRate(BaseDataset):
"""
Daily exchange rates for 8 foreign countries (1990-2016).
Countries: Australia, British, Canada, Switzerland, China, Japan, New Zealand, Singapore.
Data is prepr... | nclabteam/FedProC | data_factory/ExchangeRate.py | .py | 97745e0d8c391c02 | 7.64 | 18 |
import datetime
import os
import polars as pl
from .base import BaseDataset, CustomDataset
class M4Yearly(BaseDataset):
"""M4 competition, Yearly frequency: one series (row) = one federated client.
M4 series have no real timestamps, just a plain observation index, so a
synthetic calendar axis is genera... | nclabteam/FedProC | data_factory/M4.py | .py | b844f4b589f7e5f2 | 7.64 | 18 |
import os
import pandas as pd
import polars as pl
from .base import BaseDataset
class METRLA(BaseDataset):
"""Five-minute traffic-speed series from Los Angeles sensors."""
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.path_raw = os.path.join("datasets",... | nclabteam/FedProC | data_factory/METRLA.py | .py | c343091f59de69ed | 7.64 | 18 |
import os
from .base import BaseDataset
class MekongSalinity(BaseDataset):
"""Daily average salinity measurements from the Mekong region."""
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.path_raw = os.path.join("datasets", "MekongSalinity", "raw")
... | nclabteam/FedProC | data_factory/MekongSalinity.py | .py | 9d8c40e7a121f2c9 | 7.64 | 18 |
import datetime
import os
import numpy as np
import polars as pl
from .base import BaseDataset
class PeMS03(BaseDataset):
"""Five-minute PeMS03 sensor series."""
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.path_raw = os.path.join("datasets", "PeMS03",... | nclabteam/FedProC | data_factory/PeMS03.py | .py | 35f16707d20e2384 | 7.64 | 18 |
import datetime
import os
import numpy as np
import polars as pl
from .base import BaseDataset
class PeMS04(BaseDataset):
"""Five-minute, three-feature PeMS04 sensor series."""
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.path_raw = os.path.join("datas... | nclabteam/FedProC | data_factory/PeMS04.py | .py | e2afca96983ee9e9 | 7.64 | 18 |
import datetime
import os
import numpy as np
import polars as pl
from .base import BaseDataset
class PeMS07(BaseDataset):
"""Five-minute PeMS07 sensor series."""
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.path_raw = os.path.join("datasets", "PeMS07",... | nclabteam/FedProC | data_factory/PeMS07.py | .py | b1885a6b8d0aab43 | 7.64 | 18 |
import os
import pandas as pd
import polars as pl
from .base import BaseDataset
class PeMSBAY(BaseDataset):
"""Five-minute traffic-speed series from Bay Area sensors."""
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.path_raw = os.path.join("datasets", "... | nclabteam/FedProC | data_factory/PeMSBAY.py | .py | 525df7a8a81b3995 | 7.64 | 18 |
import torch
def design_fir_filter(
cutoff: float,
fs: float,
numtaps: int,
*,
device=None,
dtype: torch.dtype = torch.float32,
) -> torch.Tensor:
"""Create a low-pass FIR filter with a Hamming window.
Args:
cutoff: Cutoff frequency of the filter.
fs: Sampling frequenc... | songc0a/DeepGPR | src/DeepGPR/multiscale.py | .py | 6c76d96b92c5df5b | 7.63 | 17 |
from __future__ import annotations
import hashlib
import json
import math
import os
import platform
import subprocess
import sys
from datetime import datetime, timezone
from pathlib import Path
from typing import Any, Callable, Iterable, Sequence
import torch
C0 = 299_792_458.0
TESTS_DIR = Path(__file__).resolve().... | songc0a/DeepGPR | tests/verification_utils.py | .py | 2bfac61d4aefc6b0 | 8.13 | 17 |
import io
import os
import base64
import tempfile
from datetime import datetime, timedelta
import pandas as pd
import plotly.graph_objects as go
import plotly.subplots as sp
import pyimgur
import seaborn as sns
from dotenv import load_dotenv
from openbb import obb
from app.features.technical import add_technicals
l... | Floxym/financial-chat | financial-chat/app/features/chart.py | .py | e021bd5d5cd97eb7 | 7.5 | 9 |
import warnings
warnings.filterwarnings("ignore", category=FutureWarning)
from finvizfinance.screener.overview import Overview
# Custom universe criteria, please see FinViz for all available filters
UNIVERSE_CRITERIA = {
"Market Cap.": "+Small (over $300mln)",
"Average Volume": "Over 750K",
"Price": "Ove... | Floxym/financial-chat | financial-chat/app/features/screener.py | .py | 077cd3c29b987a0d | 7.5 | 9 |
from typing import List
from datetime import datetime, timedelta
from langchain.agents import tool
import pandas as pd
import numpy as np
from app.tools.utils import wrap_dataframe, fetch_stock_data, fetch_sp500_data
from app.tools.types import StockStatsInput
def calculate_performance(data: pd.DataFrame) -> float... | Floxym/financial-chat | financial-chat/app/tools/stock_relative_strength.py | .py | 5185b0866ef8b05f | 7.5 | 9 |
"""IMF Available Indicators."""
# pylint: disable=unused-argument
from typing import Any, Optional, Union
from openbb_core.app.model.abstract.error import OpenBBError
from openbb_core.provider.abstract.fetcher import Fetcher
from openbb_core.provider.standard_models.available_indicators import (
AvailableIndicat... | Floxym/financial-chat | financial-chat/imf/openbb_imf/models/available_indicators.py | .py | 3e4d33d67a458289 | 7.5 | 9 |
"""IMF Direction Of Trade Model."""
# pylint: disable=unused-argument
from datetime import datetime
from typing import Any, Optional, Union
from openbb_core.app.model.abstract.error import OpenBBError
from openbb_core.provider.abstract.fetcher import Fetcher
from openbb_core.provider.standard_models.direction_of_tra... | Floxym/financial-chat | financial-chat/imf/openbb_imf/models/direction_of_trade.py | .py | 2ceca87d6ca47fee | 7.5 | 9 |
"""IMF Maritime Chokepoint Info Model."""
# pylint: disable=unused-argument
from typing import Any, Literal, Optional
from openbb_core.app.model.abstract.error import OpenBBError
from openbb_core.provider.abstract.fetcher import Fetcher
from openbb_core.provider.standard_models.maritime_chokepoint_info import (
... | Floxym/financial-chat | financial-chat/imf/openbb_imf/models/maritime_chokepoint_info.py | .py | 4d98631898757715 | 7.5 | 9 |
"""Direction Of Trade Utilities."""
from openbb_core.app.model.abstract.error import OpenBBError
def load_country_map() -> dict:
"""Load IMF IRFCL country map."""
# pylint: disable=import-outside-toplevel
import json # noqa
from json.decoder import JSONDecodeError
from pathlib import Path
t... | Floxym/financial-chat | financial-chat/imf/openbb_imf/utils/dot_helpers.py | .py | 17ae6fe788cfc2aa | 7.5 | 9 |
"""IMF IRFCL Data Set Helpers."""
from typing import Optional
def load_irfcl_symbols() -> dict:
"""Load IMF IRFCL symbols."""
# pylint: disable=import-outside-toplevel
from openbb_imf.utils.constants import load_symbols
return load_symbols("IRFCL")
def load_country_map() -> dict:
"""Load IMF I... | Floxym/financial-chat | financial-chat/imf/openbb_imf/utils/irfcl_helpers.py | .py | ff9af7e20ca13616 | 7.5 | 9 |
"""IMF Fetcher Tests."""
from datetime import date
import pytest
from openbb_core.app.service.user_service import UserService
from openbb_imf.models.available_indicators import ImfAvailableIndicatorsFetcher
from openbb_imf.models.direction_of_trade import ImfDirectionOfTradeFetcher
from openbb_imf.models.economic_ind... | Floxym/financial-chat | financial-chat/imf/tests/test_imf_fetchers.py | .py | 2226905b95de7f9c | 7 | 9 |
"""Opt-in installed-SDK integration gate.
Set ``CRESTRON_CLZ_INTEGRATION_CONFIG`` to a real project configuration on a
Windows host with VS2022 and the Crestron SDK installed. The default unit test
run never requires proprietary inputs.
"""
from __future__ import annotations
import os
from pathlib import Path
import... | srichardsc/Crestron3SeriesCLZBuilder | tests/test_integration.py | .py | 3886aeeb742c27f7 | 8.13 | 17 |
"""
Backfill download_count for all repos in the database.
Paginates /releases?per_page=100 following the Link: next header so the sum
is accurate for repos with more than 100 releases. Rotates across the four
GH_TOKEN_* tokens (same ones run_fetcher.sh uses) so the backfill finishes
in ~20-30 min instead of ~2.5 hour... | kurikomi-labs/komi-store-backend-data | scripts/backfill_downloads.py | .py | bd2f76fc41e89857 | 7.59 | 14 |
"""
Write fetcher output to Postgres (github-store-backend database).
Requires: pip install psycopg2-binary
Env var: DATABASE_URL (e.g. postgresql://githubstore:pass@89.167.115.83:5432/githubstore)
Usage from fetch_all_categories.py:
from db_writer import save_to_postgres
save_to_postgres(category, platform, ... | kurikomi-labs/komi-store-backend-data | scripts/db_writer.py | .py | 8cdd3ca3c9f45c16 | 7.59 | 14 |
"""
Publish the live discovery feed to static JSON for the client's offline
waterfall.
The client falls back to raw.githubusercontent.com/OpenHub-Store/api when the
backend is unreachable. The category/topic endpoints already have cached
mirrors under cached-data/; this does the same for GET /v1/feed so a
backend-down... | kurikomi-labs/komi-store-backend-data | scripts/fetch_feed_cache.py | .py | 3c30ced6d9ef76dc | 7.59 | 14 |
"""
Sync repos from Postgres to Meilisearch.
Usage:
python3 meili_sync.py # bulk sync all repos
python3 meili_sync.py --configure # configure index settings only
Env vars:
DATABASE_URL - Postgres connection string
MEILI_URL - Meilisearch URL (default: http://localhost:7700)
ME... | kurikomi-labs/komi-store-backend-data | scripts/meili_sync.py | .py | d394b3ec17beba69 | 7.59 | 14 |
#!/usr/bin/env python3
"""
Release Date Validation Script
This script validates that the release dates in new-releases category
are accurate by checking them against GitHub's actual release data.
Usage:
python validate_releases.py [platform]
Examples:
python validate_releases.py android
python valida... | kurikomi-labs/komi-store-backend-data | scripts/validate_releases.py | .py | 272726edb10ffd0b | 7.59 | 14 |
#!/usr/bin/env python3
"""
Download-and-apply update support for Cosmos Collection.
Downloads the platform-matching release zip from GitHub, verifies it against
the release's published SHA256 checksum, extracts it to a staging
directory, then hands off to the standalone CosmosCollectionUpdater helper
(see updater/Cosm... | quake101/CosmosCollection | AppUpdater.py | .py | 0e1bf9075884a7e1 | 7.45 | 7 |
#!/usr/bin/env python3
"""
Database Manager for Cosmos Collection
Handles database connections and table initialization
"""
import sqlite3
import logging
from contextlib import contextmanager
# Set up logging
logger = logging.getLogger(__name__)
class DatabaseManager:
"""Singleton database manager for the Cosmo... | quake101/CosmosCollection | DatabaseManager.py | .py | cc77a45564186ec4 | 7.45 | 7 |
#!/usr/bin/env python3
"""
Cross-platform resource manager for Cosmos Collection
Handles resource paths for both development and PyInstaller bundled environments
"""
import os
import sys
import platform
from pathlib import Path
import logging
logger = logging.getLogger(__name__)
class ResourceManager:
"""Manage... | quake101/CosmosCollection | ResourceManager.py | .py | 48e524d599a0f332 | 7.45 | 7 |
#!/usr/bin/env python3
"""
System Tray Manager for Cosmos Collection
Provides system tray icon with mini weather forecast and quick actions
"""
import logging
import sys
from typing import List, Optional, Callable
from PySide6.QtCore import QObject, Signal, QSettings
from PySide6.QtGui import QIcon, QAction, QCursor
... | quake101/CosmosCollection | SystemTrayManager.py | .py | 9f3bd4e65d54c535 | 7.45 | 7 |
#!/usr/bin/env python3
"""
URL Opener utility for Cosmos Collection
Provides cross-platform URL opening that avoids shell-related issues on Linux
"""
import logging
import os
import shutil
import subprocess
import sys
from PySide6.QtCore import QUrl
from PySide6.QtGui import QDesktopServices
logger = logging.getLogg... | quake101/CosmosCollection | UrlOpener.py | .py | 3503509a6dcee923 | 7.45 | 7 |
"""
Window Position Manager
Manages saving and restoring window positions using QSettings
"""
from PySide6.QtCore import QSettings, QPoint
from PySide6.QtWidgets import QApplication
class WindowPositionManager:
"""Manages window position persistence using QSettings"""
@staticmethod
def get_settings():
... | quake101/CosmosCollection | WindowPositionManager.py | .py | 848bce8261ee047d | 7.45 | 7 |
#!/usr/bin/env python3
"""
Cosmos Collection standalone updater.
This runs as its own process, separate from the main application, because a
running app can't overwrite its own executable/DLL files (especially on
Windows). The main app downloads and verifies a new release, extracts it to
a staging directory, then laun... | quake101/CosmosCollection | updater/CosmosUpdater.py | .py | ad5e2176fe9b53a7 | 7.45 | 7 |
"""
Progress dialog for the standalone updater helper (see CosmosUpdater.py).
Reuses PySide6 rather than a platform-specific GUI toolkit - it's already a
hard dependency of the main app, so this doesn't add a second GUI stack to
the project, and the same dialog code works on every platform Cosmos
Collection ships for.... | quake101/CosmosCollection | updater/CosmosUpdaterWorker.py | .py | 605fdcccb64d7da1 | 7.45 | 7 |
#!/usr/bin/env python3
"""
Version management for Cosmos Collection
Handles version information from local fallback and GitHub releases
"""
import requests
import json
import logging
import subprocess
import sys
import os
from typing import Optional, Dict, Any
from datetime import datetime, timedelta
# Set up logging... | quake101/CosmosCollection | version.py | .py | b2333a170dec9bef | 7.45 | 7 |
#!/usr/bin/env python3
"""
Skill Initializer - Creates a new skill from template
Usage:
init_skill.py <skill-name> --path <path>
Examples:
init_skill.py my-new-skill --path skills/public
init_skill.py my-api-helper --path skills/private
init_skill.py custom-skill --path /custom/location
"""
import sy... | mixpanel/mixpanel-headless | .claude/skills/skill-creator/scripts/init_skill.py | .py | 8504df624c968b70 | 7.6 | 15 |
#!/usr/bin/env python3
"""
Skill Packager - Creates a distributable .skill file of a skill folder
Usage:
python utils/package_skill.py <path/to/skill-folder> [output-directory]
Example:
python utils/package_skill.py skills/public/my-skill
python utils/package_skill.py skills/public/my-skill ./dist
"""
im... | mixpanel/mixpanel-headless | .claude/skills/skill-creator/scripts/package_skill.py | .py | cdd10e31fb29387d | 7.6 | 15 |
"""Invocable-shape adapters for registry entries (design D4.2 items 5 and 9).
Some recorded contracts have no directly-registrable callable of the
right shape, so the registry targets these thin adapters instead:
- ``replay_labels.selector_label_fn`` is a FACTORY returning a closure; the
design records it as ``(att... | mixpanel/mixpanel-headless | conformance/record/adapters.py | .py | 79e6fa281e4e453a | 7.6 | 15 |
"""In-memory capture model shared by the record plugin and emitter.
The plugin (``conformance/record/plugin.py``) fills these structures during
the test run; the emitter (``conformance/record/emit.py``) classifies them
into vectors and manifest exclusion counts at session finish. Keeping the
model in its own module av... | mixpanel/mixpanel-headless | conformance/record/capture.py | .py | 92f065123a6edc6e | 7.6 | 15 |
"""Deterministic clock, UUID, and sleep control for record mode (design D1.4).
Record mode freezes the process clock at :data:`RECORD_EPOCH` via freezegun,
replaces ``uuid.uuid4`` with a counter-seeded deterministic stream (reset per
test), and patches ``time.sleep`` to a VIRTUAL sleep that advances the frozen
clock i... | mixpanel/mixpanel-headless | conformance/record/clock.py | .py | 682d5e88caab56ae | 7.6 | 15 |
"""Record-mode drift diff (design D8, normative semantics).
Compares a freshly re-extracted vector tree (the *candidate*, e.g.
``/tmp/re-extract``) against the committed corpus (the *reference*,
``conformance/vectors``) and fails on ANY asymmetry in either direction.
Scope is the EXTRACTED subset only: ``authored/**`... | mixpanel/mixpanel-headless | conformance/record/diff.py | .py | d5afadc6e23f625a | 7.6 | 15 |
"""bookmark_enums snapshot generator (design D4.2 item 10, PR-7).
Serializes every public constant of
``mixpanel_headless._internal.bookmark_enums`` that is a ``frozenset`` or
``dict`` into ``conformance/vectors/enums/bookmark_enums.json`` — frozensets
as sorted arrays, dicts key-sorted — because the TS enum tables ar... | mixpanel/mixpanel-headless | conformance/record/enums_snapshot.py | .py | b4c50651104ec9e3 | 7.6 | 15 |
"""Generate the B0-1 authored compat vectors (P3-4 packet B0-1).
Emits ``conformance/vectors/authored/compat/pythoncompat-b0.jsonl``: the
authored vector lines for the six pythonCompat completion wrappers
(``python_int``/``python_float``/``python_strip``/``sorted_strings``/
``cp_length``/``cp_slice``). Every ``expect`... | mixpanel/mixpanel-headless | conformance/record/gen_b0_vectors.py | .py | f8b2e928492ae240 | 7.6 | 15 |
"""Payload-handoff producer for the D15b referee (task PR-11).
Builds the ``{"id", "bookmark_type", "params"}`` JSONL that
``harness.py`` consumes, by RE-EXECUTING every bookmark-capability
builder vector live under the replay clock — the handoff carries genuine
Python-built payloads, never stale recordings. Each live... | mixpanel/mixpanel-headless | conformance/referee_bookmark_parser/handoff.py | .py | ff13c9ea041f66cf | 7.6 | 15 |
"""Corpus loading for the Python corpus runner (design D3/D7).
Walks ``conformance/vectors/**/*.jsonl``, skips each bundle's ``$bundle``
header line, and yields one :class:`LoadedVector` per vector line. JSONL
bundles load with one ``json.loads`` per line and no per-vector file I/O —
the design D7 collection-cost leve... | mixpanel/mixpanel-headless | conformance/runner/loading.py | .py | 05cf1313f7e618a6 | 7.6 | 15 |
"""Replay target construction for wire vectors (design D7).
Rebuilds the library object a vector's ``call.api`` prefix names —
``api_client.*`` / ``workspace.*`` / ``replays.*`` / ``oauth_flow.*`` /
``region_probe.*`` / ``pagination.*`` / ``wirestub.*`` — around a
:class:`conformance.runner.transport.VectorTransport`,... | mixpanel/mixpanel-headless | conformance/runner/targets.py | .py | 0cfdc947af751a26 | 7.6 | 15 |
"""Pytest harness parametrizing over the committed corpus (design D7).
One test per vector (id = vector id) via ``pytest_generate_tests``. Runs
under the normal repo toolchain:
```bash
uv run pytest conformance/runner -o addopts="" -q
```
The pytest-free equivalent for worktree smoke runs is
``python -m ... | mixpanel/mixpanel-headless | conformance/runner/test_corpus.py | .py | 28a8439238cd9028 | 8.1 | 15 |
"""Replay transport for wire/parse vectors (design D7 ``VectorTransport``).
Serves each recorded interaction's response (or raises its recorded
``transport_error``) while capturing every actual outgoing request for
diffing. Ordered interactions serve POSITIONALLY — interaction *i*'s
response answers request *i* regard... | mixpanel/mixpanel-headless | conformance/runner/transport.py | .py | 31035b2a8c8bd243 | 7.6 | 15 |
"""Deliberate-break smoke test for the conformance corpus (design D9).
Executes the 14-patch sabotage protocol: the fixed 13 patches from the
Phase-1 design of record (D9.1 patch table, D9.2 worktree mechanics,
D9.3 pass criterion) plus the AD-7 addendum patch S14, which flips a
newly-coded validation guard from the E... | mixpanel/mixpanel-headless | conformance/smoke/run_smoke.py | .py | 74412c76bf5fdbd1 | 7.6 | 15 |
"""Structural guards over the PR-7 authored corpus (design D13/D4.3/D3.1).
The authored bundles are hand-written data, outside the record plugin's
emit-time schema self-validation — so this suite re-applies the same
guarantees the extracted corpus gets for free: every authored vector
validates against ``conformance/sc... | mixpanel/mixpanel-headless | conformance/tests/test_authored_vectors.py | .py | 43ef9783c106a865 | 8.1 | 15 |
"""Selftest-driven tests for the D6 canonicalizer (design D6/D12, PR-4).
Iterates every case in ``conformance/schema/canonical-selftest.json`` — the
cross-language contract artifact the TS canonicalizer (TS-3) must also pass
— through :mod:`conformance.runner.canonical`, plus structural guards that
the selftest file i... | mixpanel/mixpanel-headless | conformance/tests/test_canonical_selftest.py | .py | a588da5a8d3a5537 | 8.1 | 15 |
"""Round-trip unit tests for the full ``$type`` codec table (design D4.4).
One test per codec: encode the rich value into vector JSON (must be
``json.dumps``-safe), decode it back through the D7 replay path, and assert
equality with the original. The tagged encodings themselves are asserted
for the scalar codecs (``da... | mixpanel/mixpanel-headless | conformance/tests/test_codecs_roundtrip.py | .py | cfbb4f1752c16ea6 | 8.1 | 15 |
"""Unit tests for the corpus runner (design D7, PR-6).
Covers the replay features the committed extracted corpus does not yet
exercise (they arrive with the PR-7 authored vectors): keyed
unordered-group serving, one-shot interaction consumption, extra/missing
traffic detection, ``transport_error`` re-raising with the ... | mixpanel/mixpanel-headless | conformance/tests/test_corpus_runner.py | .py | ded1496c010bb810 | 7.1 | 15 |
"""P2-1 recorder-coverage closure cases (phase2-design C10 / Discrepancy #10).
Five ``types.*`` entry points carry coded constructor/classmethod guards but
had ZERO recorded vectors in the AD-6 corpus: ``types.FunnelStep`` and
``types.RetentionEvent`` (real ``__post_init__`` guards, previously absent
from the D4 recor... | mixpanel/mixpanel-headless | conformance/tests/test_coverage_cases.py | .py | fbbb585bda8975df | 7.1 | 15 |
"""Unit tests for the differential fuzz harness (design D14, PR-10).
Covers the comparison core (match / skip / divergence over canonical
forms), the per-target Hypothesis runner including the R10.9 edge-set
attachment and repro writing, and the strategy table's structural
invariants (all seven Phase-1 priority target... | mixpanel/mixpanel-headless | conformance/tests/test_fuzz_harness.py | .py | b2bb508187023ff2 | 7.1 | 15 |
"""Protocol unit tests for oracle-py (design D14, PR-10).
Exercises the newline-delimited JSON-RPC 2.0 surface of
``conformance/oracle_py/server.py`` against the normative spec at
``conformance/schema/oracle-protocol.md``: framing (ASCII-safe single
lines), the three methods, R5.4 error-mapping (library errors are
``o... | mixpanel/mixpanel-headless | conformance/tests/test_oracle_protocol.py | .py | a367fd4e2cb01e4a | 7.1 | 15 |
class AppError(Exception):
"""所有应用异常的基类"""
pass
class BusinessError(AppError):
"""业务失败
HTTP 200 + 非零 business code
比如 库存不足 用户状态异常 参数业务校验失败
"""
def __init__(self, code: int, msg: str, data=None):
self.code = code
self.msg = msg
self.data = data
# 400
class BadRequ... | sungeer/waitress | src/core/exceptions.py | .py | 2fe2a46d1a4553a0 | 7.59 | 14 |
import json
from typing import Any
from starlette.responses import JSONResponse
from src.utils.serial import JsonExtendEncoder
class Response(JSONResponse):
def render(self, content: Any) -> bytes:
return json.dumps(
content,
cls=JsonExtendEncoder,
ensure_ascii=False... | sungeer/waitress | src/core/response.py | .py | 9e92f27a7835c1e8 | 7.59 | 14 |
"""CLI: python -m sdd_doc_lint.rehash --check <path> [<path> ...]
python -m sdd_doc_lint.rehash --compute --doc-id NN --section-id SS \
--title TITLE [--description DESC] [--length {4,8}]
Model-2 content-hash verifier + generator (PROVISIONAL-IDS-002).
``--check`` recomputes each BRD §... | vladm3105/aidoc-flow-framework | platforms/claude-code-plugin/sdd_doc_lint/rehash.py | .py | 2e55ac15b1a3b245 | 7.63 | 17 |
"""Shared @-tag trace primitives — the single source of the parsing/locating
rules used by both the backward walker (`trace_walk.py`) and the forward
coverage engine (`sdd_coverage.py` / the `sdd_doc_lint` coverage gate).
Extracted from `trace_walk.py` per CFB-PR-2 DD-1 so the two directions of the
trace graph agree b... | vladm3105/aidoc-flow-framework | platforms/claude-code-plugin/sdd_doc_lint/trace_graph.py | .py | d648e4a9ab1e0784 | 7.63 | 17 |
"""Finding-check schema enforcement for the synthesizer agent.
Per LAYER-PLAYBOOKS-001 design: every finding produced by a lens MUST cite
either a playbook checklist check (e.g. "C1") or a beyond-checklist
principle ("beyond-checklist:<tag>"). Findings without a valid citation
are discarded.
Stdlib-only; no external ... | vladm3105/aidoc-flow-framework | platforms/claude-code-plugin/tools/finding_filter.py | .py | 00a360aa19f55571 | 7.63 | 17 |
"""Layer-and-lens playbook resolver for plugin audit SKILLs.
Resolves framework/playbooks/<layer>/<lens>.md, reads the content, and
raises a documented error if the file is missing.
Stdlib-only.
"""
from __future__ import annotations
from pathlib import Path
class PlaybookMissingError(FileNotFoundError):
"""R... | vladm3105/aidoc-flow-framework | platforms/claude-code-plugin/tools/playbook_loader.py | .py | 74db181eeac49adf | 7.63 | 17 |
#!/usr/bin/env python3
"""
Apply deterministic documentation path alias replacements with a safe dry-run mode.
Generalizes path corrections across the ucx_framework, including:
- SDD artifacts (BRD, PRD, REQ, ADR, SPEC, etc.)
- Governance documentation
- AI project flow documents
Default behavior is dry-run. Use --ap... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/apply_doc_path_aliases.py | .py | 12092fb8a822e18f | 8.13 | 17 |
#!/usr/bin/env python3
"""Check for merge conflicts with open PRs."""
import argparse
import json
import os
import subprocess
import sys
def run_gh_command(args: list[str]) -> tuple[int, str]:
"""Run gh CLI command."""
env = os.environ.copy()
env["GH_HOST"] = "{GITHUB_HOST}"
try:
result = sub... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/check_conflicts.py | .py | 744d4dac0f00b269 | 8.13 | 17 |
#!/usr/bin/env python3
"""Check Cloud Run error rate."""
import argparse
import json
import subprocess
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--project", required=True)
parser.add_argument("--service", required=True)
parser.add_argument("--window", type=int, de... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/check_error_rate.py | .py | 9292499c4ebb905e | 7.13 | 17 |
#!/usr/bin/env python3
"""Check if a project phase is complete with rate limiting."""
import argparse
import json
import os
import subprocess
import sys
import time
from datetime import UTC, datetime
from pathlib import Path
class RateLimiter:
"""Simple rate limiter for API calls."""
def __init__(self, max_... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/check_phase_completion.py | .py | 3eac2d9ed0f3d74f | 8.13 | 17 |
#!/usr/bin/env python3
"""Determine if a development issue requires QA testing."""
import argparse
import json
import re
from pathlib import Path
# File patterns that don't require QA testing
NON_FUNCTIONAL_PATTERNS = [
r"\.md$", # Markdown files (docs)
r"README", # README files
r"CHANGELOG", # Changel... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/check_qa_required.py | .py | bfc719a2d8db0e36 | 8.13 | 17 |
#!/usr/bin/env python3
"""
Check Staging Readiness for Production Deployment
Evaluates staging environment readiness by checking:
- All QA tests pass
- All acceptance criteria for phase issues are met
- No open blockers
Usage:
python check_staging_ready.py --phase 1 --repo owner/repo
Environment:
GH_TOKEN: G... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/check_staging_ready.py | .py | 1a4ac3bb7c20e123 | 8.13 | 17 |
#!/usr/bin/env python3
"""Create bug issues from QA test failures."""
import argparse
import json
import os
import subprocess
import sys
from pathlib import Path
def run_gh_command(args: list[str]) -> tuple[int, str, str]:
"""Run a gh CLI command."""
env = os.environ.copy()
env["GH_HOST"] = "{GITHUB_HOST... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/create_bug_issues.py | .py | e6353bf248baffd7 | 8.13 | 17 |
#!/usr/bin/env python3
"""Create issues for test failures."""
import argparse
import os
import subprocess
import xml.etree.ElementTree as ET
from pathlib import Path
def run_gh_command(args: list[str]) -> int:
"""Run gh CLI."""
env = os.environ.copy()
env["GH_HOST"] = "{GITHUB_HOST}"
result = subproc... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/create_test_failure_issues.py | .py | 5239f27e8542f419 | 8.13 | 17 |
#!/usr/bin/env python3
"""Extract test plan from development issue acceptance criteria."""
import argparse
import re
from pathlib import Path
def extract_acceptance_criteria(issue_body: str) -> list[str]:
"""Extract acceptance criteria from issue body."""
criteria = []
# Look for acceptance criteria sec... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/extract_test_plan.py | .py | 683d1cf0741c8520 | 8.13 | 17 |
#!/usr/bin/env python3
"""
Generate Deployment Plan from Phase PRs
Collects deployment considerations from all issues in a phase,
identifies migration sequences, and generates a deployment plan.
Usage:
python generate_deployment_plan.py --phase 1 --repo owner/repo
Environment:
GH_TOKEN: GitHub token with iss... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/generate_deployment_plan.py | .py | 5b8cb83725fc52b4 | 8.13 | 17 |
#!/usr/bin/env python3
"""
Generate IPLAN from GitHub Issue
Creates an implementation plan (IPLAN) template from a GitHub issue
when the `ai:ready` label is added. Maps acceptance criteria to tasks.
Usage:
python generate_iplan_from_issue.py --issue-number 123 --repo owner/repo
Environment:
GH_TOKEN: GitHub ... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/generate_iplan_from_issue.py | .py | 91c0475fac537e08 | 8.13 | 17 |
#!/usr/bin/env python3
"""
Generate Phase Completion Summary
Creates a summary report when a phase completes, including:
- All issues closed in the phase
- Bug/rework counts
- Cycle time metrics
Usage:
python generate_phase_summary.py --phase 1 --repo owner/repo
Environment:
GH_TOKEN: GitHub token with issue... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/generate_phase_summary.py | .py | d4374538f36f2326 | 8.13 | 17 |
#!/usr/bin/env python3
"""Handle issue reopen - mark phase as needs-revalidation."""
import argparse
import json
import os
import subprocess
from pathlib import Path
def get_issue_labels(issue_number: int) -> list[str]:
"""Get labels for an issue."""
env = os.environ.copy()
env["GH_HOST"] = "{GITHUB_HOST... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/handle_issue_reopen.py | .py | eaf679b2ea8679c0 | 8.13 | 17 |
#!/usr/bin/env python3
"""Deprecated: legacy TASKS sync workflow.
This script is retained for compatibility only and is not part of the active
v3 governance workflow.
Replacement:
- Use v3 artifact generation (`sdd_create`) and issue-driven execution plans
(`IPLAN`) instead of bidirectional TASKS sync.
Removal cri... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/sync_tasks_from_issues.py | .py | 60ecde9e8493472a | 7.13 | 17 |
#!/usr/bin/env python3
"""Update phase tracking after dev or staging deployment.
This script supports two modes:
1. Dev deployment: Updates phase status with dev-specific fields
2. Staging deployment (legacy): Updates phase status for staging
Status values per phase:
- pending: Not started
- dev_deploying: Dev deploy... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/update_phase_tracking.py | .py | 56b725eaf92e903f | 7.13 | 17 |
#!/usr/bin/env python3
"""Update production tracking."""
import argparse
import json
from datetime import UTC, datetime
from pathlib import Path
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--tracking-file", required=True, type=Path)
parser.add_argument("--commit-sha", default=None... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/update_prod_tracking.py | .py | 4f128a3b9a632bc5 | 7.13 | 17 |
#!/usr/bin/env python3
"""Update staging tracking after staging deployment.
This script updates the staging section of phase-deployments.json.
Staging status values:
- pending: Waiting for all phases to complete on dev
- deploying: Staging deployment in progress
- deployed: Staging deployed, acceptance tests passed
-... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/update_staging_tracking.py | .py | 7937e271229f27e3 | 7.13 | 17 |
#!/usr/bin/env python3
"""
Validate Governance Documentation
Detects drift between governance docs and reality:
- ROADMAP phase dates vs actual issue timelines
- PROJECT_PLAN gap analysis vs open issues
- IPLAN references in issues
Usage:
python validate_governance.py --repo owner/repo
Environment:
GH_TOKEN:... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/validate_governance.py | .py | 421f9e457bc7a449 | 8.13 | 17 |
#!/usr/bin/env python3
"""
Validate Project Setup and Configuration
Validates project has required configuration:
- Required secrets exist (ANTHROPIC_API_KEY, etc.)
- Branch protection on main
- CLAUDE.md configuration is valid
Usage:
python validate_project_setup.py --repo owner/repo
Environment:
GH_TOKEN: ... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/validate_project_setup.py | .py | 0e1f4e707f31035f | 8.13 | 17 |
#!/usr/bin/env python3
"""
Verify Acceptance Criteria for Pull Requests
Extracts acceptance criteria from linked issue, verifies each criterion
against PR changes (files, tests, CI status), and generates a report.
Usage:
python verify_acceptance_criteria.py --pr-number 123 --repo owner/repo
Environment:
GH_T... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/verify_acceptance_criteria.py | .py | d91def9380c90ac0 | 8.13 | 17 |
#!/usr/bin/env python3
"""Verify prerequisites for phase deployment.
This script checks that all previous phases have been successfully deployed
to dev before allowing the current phase to deploy.
For dev deployment: Checks that previous phases are dev_deployed.
"""
import argparse
import json
import os
import sys
f... | vladm3105/aidoc-flow-framework | platforms/hermes/agent-skills/spec-driven-development/sdd-orchestrator/governance/scripts/workflows/verify_phase_prerequisites.py | .py | 6d2f48db067f85e9 | 7.13 | 17 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.