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
"""LISA TDI noise configuration: PSD, antenna patterns, and frame transformations. Provides :class:`LisaTdiConfiguration` with the noise power spectral density for the A/E/T TDI channels, the one-sided optical metrology and test-mass noise components, and the sky-averaged F+/F× antenna pattern functions. """ import l...
JasperSeehofer/darksiren-emri
darksiren_emri/LISA_configuration.py
.py
7727d39eb4008d2c
7.15
1
"""Parse per-event host-galaxy counts from inference log files. The ``BayesianStatistics.evaluate`` pipeline logs one line per detected EMRI event of the form:: [handler.py:399 - get_possible_hosts_from_ball_tree()] Found 58 possible hosts without BH mass and 34 possible hosts with BH mass. This module regex...
JasperSeehofer/darksiren-emri
darksiren_emri/analysis/parse_host_counts.py
.py
0047c8e6294d6edf
7.15
1
import itertools import re from collections.abc import Generator from typing import Any, override import requests from parsel.selector import Selector from rscraping.data.constants import ( CATEGORIES, CATEGORY_ABSOLUT, CATEGORY_ALL, CATEGORY_SCHOOL, CATEGORY_VETERAN, GENDER_ALL, GENDER_FE...
iagocanalejas/rscraping
rscraping/clients/traineras.py
.py
54dc14ab7963a2d4
7.15
1
import re from pyutils.shortcuts import none from pyutils.strings import ( apply_replaces, find_roman, int_to_roman, match_normalization, remove_parenthesis, remove_roman, roman_to_int, whitespaces_clean, ) from rscraping.data.checks import is_play_off from rscraping.data.normalization....
iagocanalejas/rscraping
rscraping/data/normalization/races.py
.py
66793654f8feb8ed
7.15
1
import re from datetime import datetime, time from pyutils.strings import apply_replaces def normalize_lap_time(value: str) -> time | None: """ Normalize the lap time to a standard time 1. Try to fix ':18,62' | ':45' 2. Try to fix '028:24' 3. Try to fix '00:009' 4. Try to fix '2102:48' | '25...
iagocanalejas/rscraping
rscraping/data/normalization/times.py
.py
bd3268037d96f4da
7.15
1
import re from pyutils.strings import ( match_normalization, remove_parenthesis, whitespaces_clean, ) from rscraping.data.constants import SYNONYM_BAY, SYNONYM_BEACH, SYNONYM_PORT, SYNONYMS _NORMALIZED_TOWNS = { "A POBRA DO CARAMIÑAL": [["POBRA"], ["PUEBLA"]], "RIVEIRA": [["RIVEIRA"], ["RIBEIRA"]]...
iagocanalejas/rscraping
rscraping/data/normalization/towns.py
.py
692acca5e4ad78ed
7.15
1
#!/usr/bin/env python3 import logging from datetime import datetime from pathlib import Path import gpxpy from django.contrib.gis.geos import LineString, Point from django.core.management.base import BaseCommand, CommandError from django.db import transaction from django.db.models import Q from apps.participants.mod...
iagocanalejas/regatas
apps/actions/management/commands/fixes/igpx.py
.py
7493ffac3879990b
7
0
import operator from functools import reduce from django.db.models import Q from apps.entities.models import Entity from apps.utils.choices import ENTITY_CLUB, ENTITY_TYPES from pyutils.lists import flatten from pyutils.strings import closest_result, levenshtein_distance, remove_conjunctions, remove_symbols def get...
iagocanalejas/regatas
apps/entities/services/EntityService.py
.py
b59db9d297a6a942
7
0
import argparse import dataclasses import json import os import pathlib import re import subprocess import requests from . import charm class IssueParsingError(ValueError): """Unexpected format for issue body""" def __init__(self, message: str): super().__init__(message) self.message = mess...
canonical/charmcraftcache-hub
cli/cli/add_charm_branch.py
.py
c7132722cd242166
7
0
import dataclasses import json import os import pathlib from . import charm @dataclasses.dataclass(frozen=True, kw_only=True) class _CharmRefJob(charm.CharmRef): charm_index: int job_name: str @classmethod def from_charm_ref(cls, charm_ref: charm.CharmRef, *, index: int): return cls( ...
canonical/charmcraftcache-hub
cli/cli/collect_charms.py
.py
8b0777158fcc9452
7
0
import argparse import dataclasses import enum import json import os import pathlib import charmcraftcache._platforms from . import charm, checkout class _Architecture(enum.StrEnum): X64 = "amd64" ARM64 = "arm64" S390X = "s390x" _RUNNERS = { _Architecture.X64: "ubuntu-latest", _Architecture.AR...
canonical/charmcraftcache-hub
cli/cli/collect_platforms.py
.py
cecfd0b5b8b5a406
7
0
import dataclasses import datetime import json import os import pathlib import shutil import subprocess import time import requests import requests.adapters import uritemplate import urllib3 import urllib3.util from . import charm class GitHubRateLimitRetry(urllib3.util.Retry): """Infinite retry for GitHub REST...
canonical/charmcraftcache-hub
cli/cli/release.py
.py
72942053bbc020d4
7
0
#!/usr/bin/env python3 """Shared helpers for route's hooks and scripts. Single source of truth for the three things that were previously duplicated across routing_guard.py and routing_observe.py, and diverged: role normalization — a plugin subagent's `agent_type` arrives namespaced ("route:builder", or "route...
CTJ425/Model-Routing
route/hooks/_config.py
.py
2ffe54aec585b96c
7
0
#!/usr/bin/env python3 """PreToolUse guard that makes role boundaries real instead of prompt etiquette. Four jobs, selected by tool_name. Read — polices what gets pulled into the main session's context. Replaying context dominates a routed session's spend: a large ...
CTJ425/Model-Routing
route/hooks/routing_guard.py
.py
a7798e5dba33c59b
7
0
#!/usr/bin/env python3 """Deterministic record roll tool for model-routing bookkeeping. Moves overflow or completed entries from a hot tracking file (e.g. PROGRESS.md, TASK.md) to an archive file (e.g. PROGRESS_ARCHIVE.md, TASK_ARCHIVE.md). Safety guarantees: 1. Insert-before-delete: writes to the archive first and v...
CTJ425/Model-Routing
route/scripts/roll_records.py
.py
a66662232d272f7c
7
0
"""A throwaway project on tmp_path, shaped like a repo that ran /route:init.""" import json import os import sys import pytest sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, os.path.join( os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "route", "hooks")) BASE_CONFI...
CTJ425/Model-Routing
tests/conftest.py
.py
cf476c29894f1d54
7.5
0
"""Test helpers: run the hooks as the harness runs them — a subprocess fed JSON on stdin. Calling the hook in-process would test the functions, not the contract. The contract is "exit 0, print at most one JSON object", and only a subprocess can check it. """ import json import os import subprocess import sys REPO = o...
CTJ425/Model-Routing
tests/helpers.py
.py
6cc17fbe7a4482b9
7.5
0
"""Tests for routing_doctor.py — the self-check that answers "is this plugin actually live". Run as a subprocess, like the other hook tests: the contract is the printed report and the exit code, and only a subprocess checks both. """ import json import os import subprocess import sys import pytest from conftest impo...
CTJ425/Model-Routing
tests/test_doctor.py
.py
202e5bbe87fc07c7
7.5
0
""" From https://github.com/lm-sys/FastChat/blob/main/fastchat/conversation.py """ import dataclasses from enum import IntEnum, auto from typing import Any, Dict, List class SeparatorStyle(IntEnum): """Separator styles.""" DeepSeek = auto() DeepSeekV2 = auto() PLAIN = auto() ALIGNMENT = auto() ...
KMnO4-zx/llm-model
DeepSeek-OCR/conversation.py
.py
ec7b6ce89bcda643
7.24
2
# coding=utf-8 # Copyright 2024 The Dream team, HKUNLP Group and the HuggingFace Inc. team. All rights reserved. # # 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/...
KMnO4-zx/llm-model
Dream-v0-Instruct-7B/configuration_dream.py
.py
24d038962ccf1636
7.24
2
# coding=utf-8 # Copyright 2024 The Dream team, HKUNLP Group and The HuggingFace Inc. team. All rights reserved. # # This code is based on Qwen's implementations in this library. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ma...
KMnO4-zx/llm-model
Dream-v0-Instruct-7B/tokenization_dream.py
.py
1d7f04104fa67383
7.24
2
# Copyright 2026 The Dots Studio team and the HuggingFace Inc. team. All rights reserved. # # 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 # ...
KMnO4-zx/llm-model
dots3-note-prev/image_processing_dots3_note.py
.py
bfcf372dceb86db7
7.24
2
# Copyright 2026 The Dots Studio team and the HuggingFace Inc. team. All rights reserved. # # 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 # ...
KMnO4-zx/llm-model
dots3-note-prev/processing_dots3_note.py
.py
1759c0558890859e
7.24
2
"""Provider-neutral contracts and guards for grounded explanations.""" from __future__ import annotations import hashlib import json import re from dataclasses import dataclass from typing import Protocol CLAIM_SECTIONS = ("what_changed", "why_it_matters", "uncertainties") NUMBER_LITERAL = re.compile( r"(?<![A-Z...
josephwang-ds/ai-quant-signal-platform
src/company_lens/llm/grounded.py
.py
90da17bd2a960128
7
0
"""OpenAI Responses API adapter for the provider-neutral grounded contract.""" from __future__ import annotations import json import os from copy import deepcopy from typing import Any import requests from company_lens.llm.grounded import GroundedExplanationRequest EXPLANATION_SCHEMA = { "type": "json_schema",...
josephwang-ds/ai-quant-signal-platform
src/company_lens/llm/openai_provider.py
.py
fb05319b99fc887d
7
0
"""One supported-company contract shared by every Company Lens entry point.""" from __future__ import annotations from dataclasses import dataclass from pathlib import Path import pandas as pd from company_lens.profiles import DEMO_PROFILES, display_name class UnsupportedCompanyError(ValueError): """The reque...
josephwang-ds/ai-quant-signal-platform
src/company_lens/universe.py
.py
12c957ce842085ec
7
0
"""Extension points: custom synthesis tasks, export formats, and input adapters. Registration is additive — built-ins are untouched and keep working whether or not anything is registered. A plugin is an ordinary Python module that imports this and decorates a function; point `plugins` in the config at it and the pipel...
Abdus-Sami01/PDF2QA
pdfqa/registry.py
.py
2e060d76658577aa
7
0
# Copyright (c) The btclib developers # Distributed under the MIT software license, see the accompanying # LICENSE file or https://opensource.org/license/mit for the full text. """Rewrite an sdist so that two builds of one commit are the same bytes. The backend already does that, and this runs anyway. `uv_build` writ...
btclib-org/bitcoin-core-rpc
.github/scripts/normalize_sdist.py
.py
c175d2922060fb08
7
0
# Copyright (c) The btclib developers # Distributed under the MIT software license, see the accompanying # LICENSE file or https://opensource.org/license/mit for the full text. """What the tests share: a transport that opens no socket. Not one test here reaches the network. A client a test calls passes `transport=` p...
btclib-org/bitcoin-core-rpc
tests/__init__.py
.py
7ef3583adc57fedf
7.5
0
# Copyright (c) The btclib developers # Distributed under the MIT software license, see the accompanying # LICENSE file or https://opensource.org/license/mit for the full text. """What the whole suite shares: the coverage gate a selective run drops. `coverage_fail_under` below answers section 8 of the organization st...
btclib-org/bitcoin-core-rpc
tests/conftest.py
.py
69ac20be188ddd86
7.5
0
# Copyright (c) The btclib developers # Distributed under the MIT software license, see the accompanying # LICENSE file or https://opensource.org/license/mit for the full text. """Tests for the coverage gate of conftest. `coverage_fail_under` is one a passing suite cannot exercise on its own: the run that reaches it ...
btclib-org/bitcoin-core-rpc
tests/conftest_test.py
.py
961968d6f600d1d7
7.5
0
# Copyright (c) The btclib developers # Distributed under the MIT software license, see the accompanying # LICENSE file or https://opensource.org/license/mit for the full text. """The convention-test declaration in tests/README.md is true. Section 7 of the organization standard lists the conventions a suite can turn ...
btclib-org/bitcoin-core-rpc
tests/conventions_test.py
.py
399b216a6a5fb585
7.5
0
# Copyright (c) The btclib developers # Distributed under the MIT software license, see the accompanying # LICENSE file or https://opensource.org/license/mit for the full text. """The interpreters this package claims are the ones it runs on. One fact, declared three times: `requires-python` is the floor, `Programming...
btclib-org/bitcoin-core-rpc
tests/interpreters_test.py
.py
8f8abfdd770379b3
7.5
0
# Copyright (c) The btclib developers # Distributed under the MIT software license, see the accompanying # LICENSE file or https://opensource.org/license/mit for the full text. """Tests for the sdist normalizer of `.github/scripts`. `normalize` exists for one property -- two archives whose content agrees normalize to...
btclib-org/bitcoin-core-rpc
tests/normalize_sdist_test.py
.py
89388be273aa758f
7.5
0
# Copyright (c) The btclib developers # Distributed under the MIT software license, see the accompanying # LICENSE file or https://opensource.org/license/mit for the full text. """The one property the rest of the suite cannot state: one file, no imports. Everything else here runs with the package installed, which is ...
btclib-org/bitcoin-core-rpc
tests/standalone_test.py
.py
38b1ea3c6e619403
7.5
0
"""Render captured widget snapshots in place of live widget-view outputs. Interactive widgets (ipyelk diagrams, anywidget viewers) cannot run on a static site. ``scripts/capture_widget_snapshots.py`` screenshots each rendered widget output from a real JupyterLab session into ``docs/_static/widget-snapshots/`` (commit...
sanbales/longeron
docs/_ext/widget_snapshots.py
.py
dd201be27befa342
7.15
1
"""A 'higher-fidelity' cruise-power analysis for the UAV missions demo. ``UavMissions::CruisePower`` (examples/uav_missions.sysml) declares this component through its ``@ExternalAnalysis`` annotation: the calc def's ``in`` parameters are the I/O contract, its body is the first-order model (parasite CdA + span-efficien...
sanbales/longeron
examples/uav_aero.py
.py
0933a1e12028d785
7.15
1
#!/usr/bin/env python3 """Benchmark cold vs warm model loads through the content-addressed cache. Regenerates the README's warm-load speedup claim. Each measurement runs in a fresh Python process (the dominant cold cost -- ANTLR ATN warmup -- is paid per process, which is what CLI users experience), against a private...
sanbales/longeron
scripts/bench_cache.py
.py
82a5dfb124244c06
7.15
1
#!/usr/bin/env python3 """Sweep the OMG SysML-v2-Release corpus: parse and build every ``.sysml`` file. This is the reproducible check behind the "SysML v2 corpus 309/309" badge. The corpus is not vendored; this script downloads the pinned upstream commit (the same revision ``scripts/vendor_stdlib.py`` pins the vendor...
sanbales/longeron
scripts/check_corpus.py
.py
1d4a50b9f0004c92
7.15
1
#!/usr/bin/env python3 """Regenerate the ANTLR parsers in src/longeron/_gen from grammars/*.g4. Requires Java 11+ and the ANTLR 4.13.2 tool jar. The jar is located via (in order): $ANTLR_JAR, ~/.m2/repository/org/antlr/antlr4/<ver>/, or it is downloaded from Maven Central. Java is located via $JAVA_HOME, PATH, or a ...
sanbales/longeron
scripts/generate_parsers.py
.py
e4f9013e30429976
7.15
1
#!/usr/bin/env python """Execute and/or strip the notebooks in notebooks/. Committed notebooks are output-free: running this script executes every notebook (validation) and then writes them back *stripped* of outputs, execution counts, and volatile metadata, so reruns never produce diffs. python scripts/run_noteb...
sanbales/longeron
scripts/run_notebooks.py
.py
c6710361c50d2f53
7.15
1
"""In-house t-way covering arrays: IPOG-F on the stdlib, nothing else. The generator behind :func:`longeron.analysis.verify.cover`. It builds a t-way covering array (every valid combination of values of every t factors appears in at least one row) with the IPOG family's *in-parameter-order* strategy (Lei et al., "IPO...
sanbales/longeron
src/longeron/analysis/_ipog.py
.py
d3854ee183fcd47a
7.15
1
"""Linked selection between 2D diagrams and the 3D viewer. :func:`link_selection` composes two existing public seams -- the diagrams' click-selection callback (:func:`longeron.diagrams.on_select`, whose node ids are qualified names) and the mesh viewer's highlight traitlet (:mod:`longeron.analysis.viewer3d`) -- so cli...
sanbales/longeron
src/longeron/analysis/link.py
.py
277ec6d86595d6fc
7.15
1
"""Inject a week of synthetic history so the trend charts have a week to draw. `seed_traffic.py` produces real entries, but they all land in the minute you ran it, so a seven-day window shows one bucket. This script fills the days before now with entries that no client ever sent. That is a demonstration aid, and the ...
PSCRedefine/AnalyticsDashboard
scripts/backfill_history.py
.py
32e0eb26706d070b
7
0
"""Drive real traffic through the API so the dashboard has something to show. The request log is in memory and starts empty on every restart, so a freshly started service renders the empty state — correctly, and unhelpfully. This script fixes that the honest way: by actually calling the service. Every entry the dashbo...
PSCRedefine/AnalyticsDashboard
scripts/seed_traffic.py
.py
1ed0befde978fdd7
7
0
"""Turning request records into the numbers the page draws. Specification sections 4.4 and 4.5. Both routes are thin wrappers around the two functions here, which take plain lists of dictionaries and return plain dictionaries — no HTTP, no application state — so the arithmetic can be tested directly against hand-built...
PSCRedefine/AnalyticsDashboard
src/analytics_dashboard/aggregate.py
.py
3fb31f08e15bbb00
7
0
"""The in-memory request log the dashboard reads. Specification section 4.2. Everything the Analytics page shows is derived from this buffer, which means two properties matter more than anything else about it: **It must never break a request.** The log exists to observe the service, not to be part of it. Recording is...
PSCRedefine/AnalyticsDashboard
src/analytics_dashboard/logstore.py
.py
d02c3002ee9946a8
7
0
"""The HTTP middleware that produces every number on the Analytics page. Specification section 4.2. Three properties matter: **It observes; it does not participate.** Recording happens in a ``finally`` block and the store swallows its own failures, so a broken log entry costs an observation and never a response. An o...
PSCRedefine/AnalyticsDashboard
src/analytics_dashboard/middleware.py
.py
e647c8d88c2a7141
7
0
"""Shared fixtures. Analytics tests need control over time, which real traffic does not give you: a seven-day window cannot be exercised by making requests, because every request you make lands in the same minute. So most tests build a store directly and put entries where they need them. `client` is the exception. It...
PSCRedefine/AnalyticsDashboard
tests/conftest.py
.py
6488f1f8e6a56335
7.5
0
"""FastAPI service backing the Model Info dashboard. Two routes carry the page, and they are deliberately independent (FR-01): a failure in ``/model/info`` must not stop ``/metrics/features`` from answering, and neither must take the process down. Both read state that was resolved once at start-up, so neither touches ...
PSCRedefine/ModelInfo
src/model_info/api.py
.py
ec6a5bbf30e46442
7
0
"""Reading a model and its metadata without trusting either. NFR-03 asks for something specific: a metadata file missing any field must still produce a response, and an older metadata file must not cause a 500. That turns every read into a chain rather than a lookup, and the chains are the whole content of this module...
PSCRedefine/ModelInfo
src/model_info/introspection.py
.py
66ffabbcc3dd89e1
7.5
0
"""Fit the served Pipeline and write the metadata the dashboard reads. The artefact is a single ``sklearn.pipeline.Pipeline``. That is a deployment decision before it is a modelling one, and FR-02 turns it into an observable fact: the dashboard prints ``model_type``, and anything other than ``Pipeline`` means preproce...
PSCRedefine/ModelInfo
src/model_info/train.py
.py
fa7c0cacd8fd2abe
7
0
"""Shared fixtures. The tests run against the real shipped Pipeline and the real lookup tables. The contract this repository is about — ``model_type``, the raw feature width, the ``num__``/``cat__`` names — is a property of a genuine fitted artefact, and a stubbed estimator would assert nothing about it. The degraded...
PSCRedefine/ModelInfo
tests/conftest.py
.py
677be2885b6afe71
7.5
0
"""Download the raw NHANES files used in this study from the CDC public server. NHANES data are released by the U.S. Centers for Disease Control and Prevention (CDC) National Center for Health Statistics and are fully public (no credentialing required). We use real survey data only -- no synthetic data is generated an...
balkeumlabs/FedHet
src/download_nhanes.py
.py
7ac4e884740360df
7
0
"""On-device cost measurement: wall-clock, CPU time, and real package energy. Energy is read from the Linux powercap RAPL interface (the same method as Balkeum's CEM26 study on this hardware). The package domain is exposed at ``/sys/class/powercap/intel-rapl:*/energy_uj`` (the ``intel-rapl`` driver also backs AMD Zen ...
balkeumlabs/FedHet
src/measure.py
.py
63b7a84021a93fb1
7
0
"""Lightweight logistic-regression primitives for federated training (NumPy only). A linear model is deliberate: it federates cleanly via FedAvg, trains in milliseconds on a consumer CPU, and lets us mask individual features exactly to the device a home owns -- which is the whole point of the study. No GPU, no LLM. ""...
balkeumlabs/FedHet
src/models.py
.py
7f4e5359054d18fc
7
0
"""Cost accounting: uplink bytes and the energy-source labelling.""" import measure def test_uplink_payload_is_the_published_44_bytes(): # 10 features + bias, float32 -> the "44 bytes per home per round" claim. assert measure.model_bytes(10) == 44 def test_model_bytes_scales_with_dimension(): assert mea...
balkeumlabs/FedHet
tests/test_measure.py
.py
ece73a075c7a7b82
7.5
0
"""Logistic-regression primitives, especially the per-feature gradient masking.""" import numpy as np import pytest from models import LinearModel, init_model, local_train, _sigmoid def _toy(n=40, d=4, seed=0): rng = np.random.default_rng(seed) X = rng.normal(size=(n, d)) y = (X[:, 0] + 0.5 * X[:, 1] > 0...
balkeumlabs/FedHet
tests/test_models.py
.py
45a037a92c418277
7.5
0
"""Pico REST integration.""" from __future__ import annotations from dataclasses import dataclass from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryError, ConfigEntryNo...
1waze/home-assistant-pico-rest
custom_components/pico_rest/__init__.py
.py
3fa3e8cf39c2517b
7
0
"""HTTP client for Pico REST API v1.""" from __future__ import annotations from typing import Any import async_timeout from aiohttp import ClientError, ClientSession class PicoRestError(Exception): """Base exception for Pico REST API errors.""" class PicoRestConnectionError(PicoRestError): """Raised when...
1waze/home-assistant-pico-rest
custom_components/pico_rest/api.py
.py
07da4e046370515f
7
0
"""Helpers shared by Pico REST writable entities.""" from __future__ import annotations from typing import Any from homeassistant.exceptions import HomeAssistantError from .api import PicoRestError from .coordinator import PicoRestCoordinator async def async_write_config( coordinator: PicoRestCoordinator, pat...
1waze/home-assistant-pico-rest
custom_components/pico_rest/control.py
.py
0c845f2a01ceefe7
7
0
"""Base entity for Pico REST.""" from __future__ import annotations from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import DOMAIN from .coordinator import PicoRestCoordinator class PicoRestEntity(CoordinatorEntity[PicoR...
1waze/home-assistant-pico-rest
custom_components/pico_rest/entity.py
.py
fe8cc97f9e25b79b
7
0
"""Offline pipeline: the raw interaction log to one model-ready feature table. The log is 139 MB and would be larger in production, so it is streamed in chunks and appended. Peak memory stays flat regardless of file size. """ from __future__ import annotations import argparse from pathlib import Path import pandas ...
PSCRedefine/SinglePrediction
src/single_prediction/prepare_data.py
.py
554526fc8746be33
7
0
#!/usr/bin/env python3 """Stage 1: CLIP-embed all photos. Saves embeddings + uuid_index. Robustness: - Periodic flush every 2000 images - Skip failed loads, log to embed_errors.log - Resume if partial output exists (skip already-embedded UUIDs) """ import csv import itertools import json import logging import os impor...
PixelCurator/pixelcurator
01_embed.py
.py
875fe72e8b0a6576
7
0
#!/usr/bin/env python3 """Stage 6: Retrain classifier on user corrections + regenerate contact sheets. Usage: python 06_retrain.py # retrain + regenerate HTML python 06_retrain.py --no-regen # retrain only (skip HTML regeneration) python 06_retrain.py --dry-run # show stats, write nothing Trai...
PixelCurator/pixelcurator
06_retrain.py
.py
8598ae6ff616ca6b
7
0
"""The ONE replay implementation for metadata/corrections.csv. corrections.csv is an append-only event log: one row per user decision, where the LAST row per uuid wins and an empty new_album is a tombstone (written by empty-thrash / restore / undo-to-inbox) that removes any earlier correction for that uuid. Replay ord...
PixelCurator/pixelcurator
corrections_log.py
.py
c186000f7823327f
7
0
"""Single source of truth for the CLIP model config and the embedding-space tag. Every stage that loads CLIP (01_embed, 03_classify_cluster, 06_taxonomy, 07_incremental, embed_test, tests/test_ml_smoke) imports MODEL_NAME / PRETRAINED from here, so the whole pipeline switches model config in exactly one place and can ...
PixelCurator/pixelcurator
model_tag.py
.py
a6dddbffbc006a09
7
0
"""ML pipeline smoke tests: prove the exact pinned wheels in requirements.txt (torch, torchvision, numpy, Pillow, onnxruntime, open_clip_torch, nudenet) actually work together, not just that `pip install` succeeded. These run only in .github/workflows/ml-smoke.yml, which installs the full requirements.txt. The everyda...
PixelCurator/pixelcurator
tests/test_ml_smoke.py
.py
8749d1525a51be9e
7.5
0
"""Unit tests for model_tag.py -- the embedding-space tag guard (#38). Runs in the fast lane (tests.yml): model_tag has no heavy imports, so the guard semantics are pinned on every PR, not just in the ml-smoke workflow. The end-to-end proof that 01_embed.py refuses to resume-append onto a mismatched space lives in tes...
PixelCurator/pixelcurator
tests/test_model_tag.py
.py
14e520878f32783f
7.5
0
"""Boot-path regression tests: server.py must load corrections.csv correctly at process start, before any /api/test-reset is ever called. Why this file exists: every other server test talks to the shared session-scoped server and calls /api/test-reset for isolation. test-reset used to contain its own hand-written copy...
PixelCurator/pixelcurator
tests/test_server_boot.py
.py
fe6e25445afcd1f9
7.5
0
#!/usr/bin/env python3 """List review case patches that still need materialization into shared registries.""" from __future__ import annotations import json from pathlib import Path ROOT = Path(__file__).resolve().parents[1] PATCHES = ROOT / "data" / "case-patches" INBOX = ROOT / "data" / "inbox.json" SOURCES = ROOT...
dkharlanau/signal-to-insight
scripts/pending_case_patches.py
.py
01e7fe0b9f901690
7
0
import os from dataclasses import dataclass from typing import Optional, Dict, Any from fastapi import Header, HTTPException, status from jose import jwt, JWTError from ..config import settings @dataclass class AuthenticatedUser: id: str email: Optional[str] = None name: str = "Traveler" is_anonymous: ...
DarlaRahul/AI-Travel-Copilot
backend/app/api/auth_deps.py
.py
259f2a003e295ffa
7
0
import os from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from .config import settings from .database import engine, Base from .models.entities import User, Trip, ItineraryDay, Activity, Expense, DisruptionEvent, Booking # Import API routers from .api.auth import router as auth_router f...
DarlaRahul/AI-Travel-Copilot
backend/app/main.py
.py
07f046ece1a1b8f9
7
0
#!/usr/bin/env python3 """Stop-hook: flag a chat reply that opens with a wall instead of a short lead (SPEC INV-220). The answer-first law (the personal profile's `language.answer-first`, PERMANENT) says every reply OPENS with its answer — the outcome, the decision, or the finding — in a few lines the reader may stop ...
happysasha18/live-spec
attic/answer-first-scan.py
.py
b874052f940a5d46
7.15
1
#!/usr/bin/env python3 """check-handover-provenance.py — a session handover names where it was read from (SPEC INV-302, gate ab). THE LAW it enforces, Requirement 303 (R303.10..R303.18). A session that lived the work is a poor reader of its own record: on 2026-07-28 a session wrote its handover from memory and named a...
happysasha18/live-spec
attic/check-handover-provenance.py
.py
c747dca900c584bc
7.15
1
#!/usr/bin/env python3 """check.py — grade one Director run against what a scenario expected. WHAT THIS IS FOR. Package 1 is finished when the Director's behaviour is checked by scenarios rather than by grepping its own skill file for required phrases. A phrase check passes on a skill that says the right words and doe...
happysasha18/live-spec
evals/director/check.py
.py
28330cce3582d7c8
7.15
1
#!/usr/bin/env python3 """archformat.py — the shared reader for the architecture format (PROTOTYPE, ROADMAP row 456). The sibling of `guardrails/specformat.py`: one home for reading ARCHITECTURE.md's node body, so every consumer — the traceability suite's helpers, the node-growth counter, the pin-drift check, every te...
happysasha18/live-spec
guardrails/archformat.py
.py
0d5d5f6a3187b792
7.15
1
#!/usr/bin/env python3 """case_or_space_only.py — judges whether a diff consists ENTIRELY of changes in letter case and/or whitespace: the case-or-space carve-out that lets gate a (the prover record) and gate s (the skill review) stand down without paying the full price those gates otherwise charge. The boundary is dr...
happysasha18/live-spec
guardrails/case_or_space_only.py
.py
34d44c35478102c4
7.15
1
#!/usr/bin/env python3 """check-architecture-reference.py — the generated architecture-Reference gate (SPEC INV-315, INV-269). Gate z. The architecture (a core plus any parts) and the committed index are named on the command line, the sibling shape of the matrix-reference gate (`guardrails/check-matrix-reference.py`, ...
happysasha18/live-spec
guardrails/check-architecture-reference.py
.py
356f1a86f818f257
7.15
1
#!/usr/bin/env python3 """check-board.py — the waiting list keeps what waits for his eyes, and nothing on it is ever lost (SPEC INV-206, ROADMAP 408). Chat is a display and it scrolls, so a question parked for the person and an answer he never saw both evaporate. One small file at the host root — the board, `WAITING.m...
happysasha18/live-spec
guardrails/check-board.py
.py
9261efb10f959bf2
7.15
1
#!/usr/bin/env python3 """check-config-health-perms.py — a permission rule that points at nothing is a dead rule (SPEC INV-216). The arm of config-health (gate m) that reads the settings the harness actually enforces. The worked instance, found on the owner's report (2026-07-17 ~15:29) that the harness "sometimes" ref...
happysasha18/live-spec
guardrails/check-config-health-perms.py
.py
06cc14739eff2725
7.15
1
#!/usr/bin/env python3 """check-deferral-marker.py — the mechanical net for the deferral test (SPEC INV-152). Rule 29 / INV-152 already require it: writing a needs-the-human's-word marker on a work item obliges you to NAME the human-only fact behind it — a taste, a policy, or an act irreversible outside git — and a ma...
happysasha18/live-spec
guardrails/check-deferral-marker.py
.py
f85e1f2b1f6547be
7.15
1
#!/usr/bin/env python3 """check-deposit-description.py — the agent-channel deposit-time description lint (SPEC INV-239, M-422). BLOCKING. The presence net over the named-reference pair's new reach: the agent channel. THE LAW behind it (E-35, INV-239). The named-reference pair — a stable code beside its plain one-sent...
happysasha18/live-spec
guardrails/check-deposit-description.py
.py
2c910f0f482d7a1a
7.15
1
#!/usr/bin/env python3 """check-landing-next-steps.py — the landing-refreshed-map gate (SPEC INV-242). THE LAW. A "landing" commit owes a refresh of NEXT_STEPS.md in that SAME commit, since NEXT_STEPS.md is the resume file (LIVE STATE + queue only) and a landing that does not update it leaves the next session resuming...
happysasha18/live-spec
guardrails/check-landing-next-steps.py
.py
4e467e7e7604b305
7.15
1
#!/usr/bin/env python3 """check-matrix-reference.py — the generated matrix-Reference gate (SPEC INV-273, INV-269). UNARMED until the row-477 conversion delivery converts TEST_MATRIX.md to the format-family member and splices in the generated Reference table; it arms in that same delivery (INV-272). The matrix and the ...
happysasha18/live-spec
guardrails/check-matrix-reference.py
.py
ddb17a2514760299
7.15
1
#!/usr/bin/env python3 """check-size-ratchet.py — the bytes-per-criterion ratchet gate (SPEC INV-264, INV-265). UNARMED until the spec-format conversion delivery (INV-270). The document is named on the command line; the recorded bound lives in `guardrails/spec-ratchet.json`. THE LAW (INV-264). The spec document recor...
happysasha18/live-spec
guardrails/check-size-ratchet.py
.py
9978056540d90b69
7.15
1
#!/usr/bin/env python3 """check-vocabulary.py — the closed-vocabulary gate (SPEC INV-254). UNARMED until the spec-format conversion delivery (INV-270); no default file, the document is named on the command line. THE LAW (FORMAT.md law 1, INV-254): every domain noun the document deals in holds exactly ONE glossary ent...
happysasha18/live-spec
guardrails/check-vocabulary.py
.py
3a4d2f55e43c70d0
7.15
1
#!/usr/bin/env python3 """check-weak-words.py — the weak-word gate (SPEC INV-256). UNARMED until the spec-format conversion delivery (INV-270); no default file, the document is named on the command line. THE LAW (FORMAT.md law 5, INV-256): a relational word — proportional, larger, sufficient, fast, and their kind — o...
happysasha18/live-spec
guardrails/check-weak-words.py
.py
c996441162c87bcd
7.15
1
#!/usr/bin/env python3 """cleanup_notice.py — the shared shape for "a cleanup says what it ended" (SPEC INV-204, ROADMAP 417). Every process this pack ends is reported with WHAT it was and WHY the run owned it — the PID, the process group, or the owned path that proves ownership. An ending nobody expected then becomes...
happysasha18/live-spec
guardrails/cleanup_notice.py
.py
d6ba2c3a4025641a
7.15
1
#!/usr/bin/env python3 """crosscut_counter — the boundary-health signal, mechanized (SPEC INV-128 boundary-health, INV-37 re-carve). The boundary-health law states the bar and the signal: a right node boundary keeps a typical request in one node, and repeated cross-cutting landings on the same node pair are the signal...
happysasha18/live-spec
guardrails/crosscut_counter.py
.py
c21742ca628f4b7e
7.15
1
#!/usr/bin/env python3 """nonempty_input.py — the shared shape behind "a check that looked at nothing is not a pass" (SPEC INV-218, ROADMAP 384). THE LAW behind it: a check whose INPUT SET is empty reports clean while testing nothing. A uniqueness check over zero items finds zero collisions; a "does every X satisfy Y"...
happysasha18/live-spec
guardrails/nonempty_input.py
.py
394fe5ab715772a0
7.15
1
#!/usr/bin/env python3 """reap_owned_group.py — a worker's teardown reaps its own process group (SPEC INV-230, ROADMAP 393). INV-213 landed the NOTICE: `guardrails/check-runaway-child.py` finds an owned, orphaned, burning descendant and REPORTS it, ending nothing — notice-first, so the mechanism can never become the b...
happysasha18/live-spec
guardrails/reap_owned_group.py
.py
ce042543abb16a84
7.15
1
#!/usr/bin/env python3 """route_agent_transport.py — which transport carries a message between two agents (SPEC INV-236, ROADMAP 396). INV-183's transport sentence was written on a refused premise: that git is the universal transport for all inter-agent traffic and co-location only a fast path. The owner refused it 20...
happysasha18/live-spec
guardrails/route_agent_transport.py
.py
b115f9a12aa4441d
7.15
1
#!/usr/bin/env python3 """specformat.py — the shared parser for the requirements format (SPEC INV-250..271). One home for reading the format `docs/spec-format.md` defines, so the seven format gates (check-requirement-shape, check-vocabulary, check-one-name, check-weak-words, check-no-history, check-index-generated + b...
happysasha18/live-spec
guardrails/specformat.py
.py
63b72500216e6b3a
7.65
1
#!/usr/bin/env python3 """Stop-hook: an internal code may only trail a sentence as a quiet anchor (SPEC INV-28, base rule 2). The law says every human-facing sentence stands on its own in the product's words, and internal handles — a queue row number, an INV/M/E/T code — trail in parentheses for anyone who wants to fo...
happysasha18/live-spec
hooks/code-anchor-scan.py
.py
e49ffbeda0809000
7.15
1
#!/usr/bin/env python3 """conduct-judge.py — the CONDUCT surface's judge: it reads what the seat DID (SPEC INV-241). The register judge reads what the seat SAID — the turn's outgoing text — and holds a register class a fixed word-list cannot. Its twin failure the text never shows is the seat's ACTS: whether it briefed...
happysasha18/live-spec
hooks/conduct-judge.py
.py
aaab1d2434ac1818
7.15
1
#!/usr/bin/env python3 """Stop-hook: catch the offering-hedge frame in outgoing chat (SPEC INV-238). An offering-hedge is a sentence that offers to do a thing the seat could already derive and could already reverse through git, holding the offer open for a cue — "just say the word", "let me know if you want me to" — i...
happysasha18/live-spec
hooks/hedge-scan.py
.py
3d98812cad1089c7
7.15
1
#!/usr/bin/env python3 """Stop-hook: warn a session that hoards raw file content inline without dispatching a worker (SPEC INV-246). The lean-orchestrator law asks the seat to delegate reads and drafts by default — the heavy reading lands in a worker's own context, not the orchestrator's, so the orchestrator's window ...
happysasha18/live-spec
hooks/lean-orchestrator-scan.py
.py
f7aff7103e48ee9d
7.15
1
#!/usr/bin/env python3 """register-judge.py — the CHAT surface's register judge (ROADMAP row 416, SPEC INV-203). The chat arm of the one judge (the mechanism lives in register_judge_core.py). It reads the outgoing text and hands it, with the chat law, to the cheapest tier, taking back the sentences that carry no infor...
happysasha18/live-spec
hooks/register-judge.py
.py
cdbe87a22c9ed80d
7.15
1
#!/usr/bin/env python3 """Stop-hook: catch the scissors / empty-contrast frame in outgoing chat (SPEC INV-173). Canonical pack copy, universal tier only: the English contrast-by-denial frame ("X, not Y", "X — not Y") is a pack law every host inherits. A host's own extra patterns (another language, a narrower personal ...
happysasha18/live-spec
hooks/scissors-scan.py
.py
8fde305f4b6bc21d
7.15
1