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 |
|---|---|---|---|---|---|---|
"""What counts as a comparable listing — one home, two consumers (#386).
`_value_score` and the AI prompt both answer "what do the neighbours ask per
m²", and until this module they each built their own peer set. #378 measured
why that matters and #383 fixed the scorer's half; the prompt's half went on
averaging price... | sergi039/idealista-tracker-ai | services/property_comparables.py | .py | 8baead5ffdd3f918 | 7.42 | 6 |
"""Breakage Radar for Home Assistant.
Tells you which of your installed custom integrations use Home Assistant APIs
that are already scheduled for removal, and in which release they go away.
"""
from __future__ import annotations
import logging
from homeassistant.config_entries import ConfigEntry
from homeassistant... | Booyaka101/hass-breakage-radar | custom_components/breakage_radar/__init__.py | .py | d202efe733eaba49 | 7.63 | 17 |
"""Config flow: one confirmation step, plus options for the alert window."""
from __future__ import annotations
from typing import Any
import voluptuous as vol
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.core import callback
... | Booyaka101/hass-breakage-radar | custom_components/breakage_radar/config_flow.py | .py | 44812af5fcbc936d | 7.63 | 17 |
"""Fetches the published breakage index and matches it against this system."""
from __future__ import annotations
import asyncio
import json
import logging
from collections.abc import Iterable
from datetime import UTC, datetime
from typing import Any
import aiohttp
from homeassistant import const as ha_const
from ho... | Booyaka101/hass-breakage-radar | custom_components/breakage_radar/coordinator.py | .py | 079df2540a6974e1 | 7.63 | 17 |
"""Finds the custom integrations installed on this system.
Blocking I/O, so call from an executor. The domain a component declares in its
manifest is the key the scan, the index lookup and the report all join on; a
fork can have a directory name that differs from it, so it is resolved here
and nowhere else.
"""
from ... | Booyaka101/hass-breakage-radar | custom_components/breakage_radar/discovery.py | .py | 812d5e8dd6fadefb | 7.63 | 17 |
"""Repairs issues for integrations that are going to break.
None of these are fixable in place, because the code lives in someone else's
repository. What the user can do is real though: update the integration, raise
it upstream, or replace it before the deadline.
"""
from __future__ import annotations
from urllib.pa... | Booyaka101/hass-breakage-radar | custom_components/breakage_radar/repairs.py | .py | df038dc97268d65a | 7.63 | 17 |
"""Turns the index and the local scan into the sensor's state.
Free of any ``homeassistant`` import and of I/O, so the code that runs on a
real system can be tested without one. Discovery lives in :mod:`.discovery`,
scanning in :mod:`.scanner`.
"""
from __future__ import annotations
from collections.abc import Itera... | Booyaka101/hass-breakage-radar | custom_components/breakage_radar/report.py | .py | de7a6ed06861ad58 | 7.63 | 17 |
"""Runs the rule matchers over installed integrations' own source.
Blocking I/O, so call from an executor. This is what gives forked, renamed and
non-HACS integrations a real verdict instead of "not in the index".
Problems are counted, never raised. A domain whose files cannot be parsed comes
back ``unknown`` with a ... | Booyaka101/hass-breakage-radar | custom_components/breakage_radar/scanner.py | .py | ec247807e3a70161 | 7.63 | 17 |
"""Release-label date arithmetic, shared by the crawler and the integration.
This file exists twice, byte for byte: ``tools/schedule.py`` and
``custom_components/breakage_radar/schedule.py``, the same arrangement as
``rules_engine.py`` and guarded by the same kind of test. The integration has
to ship self-contained (`... | Booyaka101/hass-breakage-radar | custom_components/breakage_radar/schedule.py | .py | 87980b4a90bb56fd | 7.63 | 17 |
"""Fixture: code that *looks* legacy but is not.
Everything here must produce ZERO findings:
* ``setup_scanner`` defined inside a class body is a method, not the module-level
platform entry point Home Assistant looks for.
* ``DeviceScanner`` used as a plain class *name* (not a base class) is somebody
else's helpe... | Booyaka101/hass-breakage-radar | tests/fixtures/false_positive/custom_components/lookalike_tracker/device_tracker.py | .py | cd2188aad8eb0bfa | 8.13 | 17 |
"""Fixture: a module-level ``setup_scanner`` in a file that is NOT device_tracker.py.
The legacy device tracker platform API is only the platform API when it lives in
``device_tracker.py``. Here it is just a function with an unlucky name, so this
file must produce ZERO findings.
"""
DOMAIN = "lookalike_tracker"
def... | Booyaka101/hass-breakage-radar | tests/fixtures/false_positive/custom_components/lookalike_tracker/sensor.py | .py | b96a6d4ee1532a92 | 8.13 | 17 |
"""Fixture: a custom integration still on the legacy device tracker platform API.
A module-level ``setup_scanner`` in a file named ``device_tracker.py`` is the
legacy platform entry point Home Assistant removes in the 2027.5 release.
"""
from homeassistant.const import CONF_HOST
DOMAIN = "fixture_tracker"
def setu... | Booyaka101/hass-breakage-radar | tests/fixtures/true_positive/custom_components/fixture_tracker/device_tracker.py | .py | 112b6f5ef147a873 | 7.13 | 17 |
"""Fixture: every ``config_entries`` read that must NOT be a finding.
The whole point of the typed matcher is that ``config_entries`` is also the
ubiquitous ``hass.config_entries``. Everything here must scan clean under the
full shipped rule set, not just this rule.
"""
from .my_registry import async_get
class Devi... | Booyaka101/hass-breakage-radar | tests/fixtures/typed_receiver/false_positive/custom_components/typed_lookalike/__init__.py | .py | c36c38dd5cd25034 | 8.13 | 17 |
"""Fixture: every way a DeviceEntry receiver can be proved.
Each ``.config_entries`` read below sits on a receiver the binder can prove, so
each one is a finding. Line numbers are pinned in ``test_typed_receiver.py``.
"""
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.device_regist... | Booyaka101/hass-breakage-radar | tests/fixtures/typed_receiver/true_positive/custom_components/typed_entry/__init__.py | .py | e73b2823f5fd532b | 8.13 | 17 |
"""The config flow and the options flow.
Nothing imported config_flow.py before, so a broken import there would only
have shown up when a user tried to add the integration. That is how issue #1
reached someone's system, so these tests exist mostly to make sure the module
loads and both flows actually run.
"""
from __... | Booyaka101/hass-breakage-radar | tests/test_config_flow.py | .py | 9353a7d568340464 | 8.13 | 17 |
"""The coordinator's update flow, issue #1 in particular.
Setup waits on the first update, so the first update must never wait on the
local scan. These drive the real BreakageRadarCoordinator with a fake hass
that records what was scheduled where.
"""
from __future__ import annotations
import asyncio
import json
imp... | Booyaka101/hass-breakage-radar | tests/test_coordinator.py | .py | d036a53da07d129f | 8.13 | 17 |
"""Resolving the latest released core version, and the RC-window boundary.
Core's dev branch runs two releases ahead of stable while a release is in RC,
so pending-ness is measured against the newest release PyPI has seen, with the
last known release and then dev minus one behind it (#46).
"""
from __future__ import ... | Booyaka101/hass-breakage-radar | tests/test_release.py | .py | 3eab3dff9b015cd4 | 8.13 | 17 |
"""A daily provenance-only rewrite must not land as a commit.
Committing it conflicts with every open pull request that touches the file,
and a conflicted pull request gets no `pull_request` workflow run at all.
"""
from __future__ import annotations
import json
from tools.rules_changed import main, rules_changed
... | Booyaka101/hass-breakage-radar | tests/test_rules_changed.py | .py | 83bc03121f4b60f3 | 8.13 | 17 |
"""Choosing which existing issue, if any, is worth linking someone to.
Searching a deprecated symbol also matches tracebacks pasted into unrelated
bug reports. Measured on real repositories: "Bug: Everything is unavailable"
came back for a symbol search purely because the traceback contained it, so a
raw search hit is... | Booyaka101/hass-breakage-radar | tests/test_upstream.py | .py | 392df4352aad59ba | 8.13 | 17 |
"""Bounded rendering of raw store file reads.
Pure, total helpers behind :mod:`nauro_core.renderers`: given a file's content
and its canonical store-relative path, produce the bounded form the rendered
agent channel emits. The CLI's default json output stays uncapped.
Content at or under its budget passes through byt... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/bounded_read.py | .py | b2d97d4704de205b | 7.5 | 9 |
"""Context assembly: build_l0, build_l1, build_l2 from pre-loaded data.
Accepts pre-loaded file contents (``dict[str, str]``) and parsed decision
lists (``list[Decision]``) via function injection. Callers control which
files to include, allowing surface-specific customization (e.g., only L2
loads state_history.md) wit... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/context.py | .py | 47577a4fcdffba3d | 7.5 | 9 |
"""Pydantic Decision model plus the canonical YAML-frontmatter round-trip:
``parse_decision`` reads a markdown file with frontmatter into a validated
``Decision``, ``format_decision`` writes it back.
Tolerant reader, known-key writer. Malformed YAML, missing required fields,
non-ISO dates, unknown enum values, reasonl... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/decision_model.py | .py | 13279e3998457eba | 7.5 | 9 |
"""Deterministic store-integrity diagnosis for ``nauro doctor``.
``diagnose_store`` reads a store through the :class:`Store` protocol and reports
four blocking defects: unparseable decision files, dangling supersession refs,
supersession cycles over both ref directions, and status contradictions.
Alongside those it r... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/doctor.py | .py | a9d5d25e81c21725 | 7.5 | 9 |
"""Optional embedding augmenter for retrieval.
Isolated from ``search.py`` so the BM25 path carries no embedding imports.
The dependency is an optional extra (``nauro-core[embeddings]``); when it is
absent the augmenter returns nothing and callers fall back to BM25-only.
Model: ``potion-retrieval-32M`` (Model2Vec sta... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/embeddings.py | .py | 7dcc160f3268d3d0 | 7.5 | 9 |
"""Pure builder for the decision-graph payload.
``build_graph_payload`` takes parsed ``Decision`` objects and an optional parsed
``OpenQuestionsFile`` and returns one versioned JSON-shaped dict: nodes,
supersession edges, citation edges, connected components with branch points,
filtered open questions, and summary sta... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/graph.py | .py | c31f1a11a766867a | 7.5 | 9 |
"""Shape validators for identifiers that cross the local/hosted seam.
One definition per shape, so journal targets, receipts, projection rows, and
audit records cannot drift and every encoded identifier has a bounded size. The
alphabet-only local project-ID check is deliberately not reused here. Matching
is always who... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/identifiers.py | .py | 01181b2cd7593963 | 7.5 | 9 |
"""Per-user composition of MCP server instructions.
The static instructional block (MCP_INSTRUCTIONS_STATIC) is project-agnostic.
Remote callers prepend a per-user section that depends on how many projects
the caller has access to:
- 0 projects: WELCOME_NO_PROJECT onboarding copy.
- 1 project: a single orientation li... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/instructions.py | .py | 40e4a387531cd78b | 7.5 | 9 |
"""Pure decision and question transitions shared by local and hosted planning."""
from __future__ import annotations
from collections.abc import Mapping, Sequence
from dataclasses import dataclass
from datetime import date
from nauro_core.decision_model import (
Decision,
DecisionConfidence,
DecisionSour... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/_decision_transitions.py | .py | fd8bc5226605d21d | 7.5 | 9 |
"""Dict-backed ``Store`` implementation for kernel tests.
Keeps the test surface free of filesystem I/O. Decision file stems live in
their own dict so :meth:`list_decisions` can return a sorted view without
introspecting the broader file table.
"""
from __future__ import annotations
from nauro_core.parsing import _s... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/_in_memory_store.py | .py | 9277f155b3a1ea65 | 7.5 | 9 |
"""Pure proposal validation and similarity evaluation over parsed inputs."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Literal
from nauro_core.constants import MIN_RATIONALE_LENGTH
from nauro_core.decision_model import Decision, DecisionStatus
from nauro_core.operations.... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/_proposal_evaluation.py | .py | 5abdcf22c43799e6 | 7.5 | 9 |
"""``check_decision`` retrieves related decisions for assessment.
Cross-transport implementation: CLI, local stdio MCP, and remote HTTP MCP
all call this function with the same arguments and receive the same
:class:`CheckDecisionResult`. Each transport's adapter wraps the call to
add transport-specific framing (``stor... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/check_decision.py | .py | 26e69f6ee250de21 | 7.5 | 9 |
"""Decision-stem lookup helpers shared across the operations kernel.
Resolving a decision identifier (any of the shapes
:func:`~nauro_core.parsing.extract_decision_number` accepts) to its
on-disk file stem only needs the :class:`~nauro_core.operations.store.Store`
protocol. Both ``propose_decision`` (supersede target ... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/decision_lookup.py | .py | 4be6800a7f54a0ba | 7.5 | 9 |
"""``diff_since_last_session`` — semantic diff between two snapshot dicts.
Cross-transport implementation: CLI, local stdio MCP, and remote HTTP MCP
all call this function with the same arguments and receive the same
:class:`DiffSinceLastSessionResult`. Snapshot discovery (``list_snapshots``,
``load_snapshot``, ``reso... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/diff_since_last_session.py | .py | cc53c85afc09dd53 | 7.5 | 9 |
"""``flag_question`` — append an open question, or resolve existing ones.
CLI, local stdio MCP, and remote HTTP MCP all call this function and receive
the same :class:`FlagQuestionResult`. The kernel owns parse, scan, mint and
insert through the :class:`Store` protocol; length validation, envelope-token
rejection, sim... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/flag_question.py | .py | bb603d67bb6e31f4 | 7.5 | 9 |
"""``get_context`` — assemble project context at L0/L1/L2 detail levels.
Cross-transport implementation: CLI, local stdio MCP, and remote HTTP MCP
all call this function with the same arguments and receive the same
:class:`GetContextResult`. Each transport's adapter wraps the call to add
transport-specific framing (``... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/get_context.py | .py | 7ca7422e99366085 | 7.5 | 9 |
"""Shared plumbing for plan-returning kernel operations.
Two operation conventions live in this package. Store-writing operations
execute their own reads and writes through the ``Store`` protocol.
Plan-returning operations (``update_stack``, ``share_context``,
``submit_report``, and the hosted plan path of ``update_st... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/planning.py | .py | d7d978279ab5179a | 7.5 | 9 |
"""Shared triage projection for retrieval hits and decision headers.
``check_decision`` and ``propose_decision`` both lift raw BM25 hit dicts
into the canonical :class:`RelatedDecision` shape, and ``get_decision``'s
header mode projects the same triage fields for a single decision. This
module owns the shared primitiv... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/related_hits.py | .py | 2faa97b021ece9e1 | 7.5 | 9 |
"""Plan the one supersession repair a machine may make on a human's word.
A supersede backref orphan is a half-written supersession: the newer decision
records ``supersedes=<old>`` but the old one was never flipped, so it still reads
active with no ``superseded_by``. ``nauro doctor`` names the shape; this module
decid... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/repair.py | .py | d0002761cf96e843 | 7.5 | 9 |
"""``search_decisions`` — BM25-rank decisions by query relevance.
All transports call this with the same arguments; each one wraps the
call to add transport-specific framing such as the ``store`` field. The
listing, BM25 ranking, and projection live here.
Status filtering happens here: by default only active decision... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/search_decisions.py | .py | d20a58bebd126d5b | 7.5 | 9 |
"""``share_context`` — plan one immutable brief and its discovery pointer.
A plan-returning kernel operation (see :mod:`nauro_core.operations.planning`
for the convention): unlike the Store-writing operations in this package it
performs no I/O. The kernel validates the brief payload, derives the brief
path, content di... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/share_context.py | .py | e11b469037ee8199 | 7.5 | 9 |
"""Storage adapter protocol for the operations kernel.
Operations call into a ``Store`` to read and write the project store; each
transport supplies a concrete implementation (filesystem for local, S3 +
DynamoDB for cloud). The Protocol stays minimal: the six primitives locked
by the operations-kernel restructure and ... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/store.py | .py | 9053fece32f9da63 | 7.5 | 9 |
"""``update_stack`` — plan the full replacement of ``stack.md``.
A plan-returning kernel operation (see :mod:`nauro_core.operations.planning`
for the convention): unlike the Store-writing operations in this package it
performs no I/O. The kernel validates the complete replacement document,
computes the deterministic c... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/operations/update_stack.py | .py | 7d2e3c7ebb8b9252 | 7.5 | 9 |
"""Stateless markdown → structured data parsers for non-decision files.
Decision parsing lives in ``nauro_core.decision_model.parse_decision``.
This module covers the smaller helpers — filename number extraction,
state/stack/questions parsing, and snippet extraction.
"""
from __future__ import annotations
import re
... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/parsing.py | .py | edf94cfa5095e8d5 | 7.5 | 9 |
"""Closed membership rules for protected generations and hosted snapshots."""
from __future__ import annotations
from nauro_core.identifiers import IdentifierKind, is_identifier
_TOP_LEVEL_GENERATION_MEMBERS = frozenset(
{
"project.md",
"state.md",
"state_current.md",
"state_histo... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/protected_generation_membership.py | .py | 9699ecc805ec5f32 | 7.5 | 9 |
"""Canonical wording for Nauro protocol claims used across instruction surfaces.
Six claims about Nauro's MCP tools recur in ``MCP_INSTRUCTIONS_STATIC``
(delivered via the MCP ``initialize.instructions`` field) and the
``/nauro-adopt`` skill body. This module owns the wording so the surfaces
cannot drift into paraphra... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/protocol.py | .py | d38c69ffda316594 | 7.5 | 9 |
"""Validation for provenance values shared across local and hosted writers."""
from __future__ import annotations
from datetime import datetime
class InvalidCommitSha(ValueError):
"""A repository commit is not a canonical full SHA-1 or SHA-256 value."""
class InvalidUtcTimestamp(ValueError):
"""A timestam... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/provenance.py | .py | d43c622541816a11 | 7.5 | 9 |
"""Shared allocation, composition, and insertion for open-questions entries.
The single source for how a new ``- [Q###]`` entry enters
``open-questions.md``: ``flag_question`` appends through these helpers, and
the hosted shared-context workflow composes its discovery-pointer entry with
the same functions, so the allo... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/question_append.py | .py | 5dc085389616d874 | 7.5 | 9 |
"""Human-readable renderers for MCP read-tool responses.
Each renderer is a pure function: it takes the result dict the ``tools_read``
adapter produced and returns a formatted text block for chat-UI consumption,
which the dispatcher emits as the sole ``content[0]`` block of the
``tools/call`` response. Renderers do no... | Nauro-AI/nauro | packages/nauro-core/src/nauro_core/renderers.py | .py | c8e9afd6d17bf81b | 7.5 | 9 |
from typing import Any, Optional
from abc import ABC, abstractmethod
from context import ExtractionContext
from rom_database import RomDatabase
from segment import (
segment_from_addr,
offset_from_segment_addr,
where_is_segment_loaded,
get_segment,
)
from byteio import CustomBytesIO
from utils import de... | Isaac0-dev/rom-decomp-64 | base_processor.py | .py | efbadedb12a8b907 | 7.56 | 12 |
import sys
import os
# Check if we are running in a browser environment (Pyodide)
try:
import pyodide # noqa: F401
IS_BROWSER = True
except ImportError:
IS_BROWSER = False
def get_io_root():
"""Return the root directory for IO operations."""
if IS_BROWSER:
return "/"
return os.getcw... | Isaac0-dev/rom-decomp-64 | browser_bridge.py | .py | 6972214e371f517b | 7.56 | 12 |
import functools
from dataclasses import dataclass, field
from typing import Any, Callable, Dict, List, Set, Optional, TypeVar
from tweaks import LevelValues, BehaviorValues
from argparse import Namespace
@dataclass
class LevelAreaContext:
curr_level: int = -1
curr_area: int = -1
@dataclass
class ParseFrame... | Isaac0-dev/rom-decomp-64 | context.py | .py | 98fcf3e30b6f5c1b | 7.56 | 12 |
"""
Deferred output system for level script parsing.
Instead of immediately serializing each command to a string, command handlers
can register structured records into a DeferredScriptOutput. After all commands
in a script are parsed, a post-processing pass runs that can refine the
interpretation of data using cross-r... | Isaac0-dev/rom-decomp-64 | deferred_output.py | .py | 2bcae3665dbade3c | 7.56 | 12 |
import struct
class MipsInstruction:
def __init__(self, raw_int):
self.raw = raw_int
self.opcode = (raw_int >> 26) & 0x3F
self.rs = (raw_int >> 21) & 0x1F
self.rt = (raw_int >> 16) & 0x1F
self.rd = (raw_int >> 11) & 0x1F
self.shamt = (raw_int >> 6) & 0x1F
se... | Isaac0-dev/rom-decomp-64 | function_matching/mips_utils.py | .py | 1e026f407d52de86 | 7.56 | 12 |
#!/usr/bin/env python3
"""
Generate anonymous behavior hashes from a vanilla ROM and append them
to behavior_hashes.py.
Usage:
python3 gen_anon_hashes.py baserom.us.z64
This runs the behavior parser against the vanilla ROM's behavior segment
and computes the anonymous hash (CALL_NATIVE = always UNKNOWN) for every... | Isaac0-dev/rom-decomp-64 | gen_anon_hashes.py | .py | 867f845b570076ca | 7.56 | 12 |
#!/usr/bin/env python3
import os
import sys
import threading
import subprocess
import queue
import traceback
import urllib.parse
import tkinter as tk
from tkinter import filedialog, ttk
from typing import Any, cast
try:
import sv_ttk
except ImportError:
sv_ttk = cast(Any, None)
try:
from tkinterdnd2 impo... | Isaac0-dev/rom-decomp-64 | gui_extract.py | .py | 867eb46627a28db2 | 7.56 | 12 |
"""Shared API key resolution for cc-memory."""
import json
import os
import time
from pathlib import Path
def _wire_for(key: str) -> str:
"""Which Anthropic auth wire format a credential needs.
``sk-ant-oat…`` = Claude subscription OAuth access token → must be sent
as ``Authorization: Bearer`` + ``anthro... | skymanbp/cc-memory | cc_memory/core/auth.py | .py | 3cf732b73072f958 | 7.42 | 6 |
"""
Idle reorg — lightweight, no-LLM consolidation called from Stop hook.
Runs every N turns (default 5) to prevent drift between full consolidations.
Operations are O(N memories) and never call LLM, so they're safe to run in
the Stop hook's tight budget (≤2 seconds added).
What runs:
1. cleanup_garbage — d... | skymanbp/cc-memory | cc_memory/core/idle.py | .py | 13c959c925b16de2 | 7.42 | 6 |
"""
Structured file logger.
Hooks must NOT write to stderr (Claude Code shows stderr as error UI).
All diagnostic output goes to ~/.claude/hooks/cc-memory/logs/cc-memory-YYYY-MM-DD.log.
Suppression policy: every except-pass below is intentional because logger
failures must never propagate — a broken logger that crash... | skymanbp/cc-memory | cc_memory/core/logger.py | .py | b5395b298ccca68f | 7.42 | 6 |
"""
Per-session temp markers — ONE directory, owner-only, symlink-proof.
Every hook keeps a little cross-process state that must NOT live under the
project's `memory/`: the turn counter, the last user prompt, the last
observation-eval timestamp, the idle-reorg stamp, the plan-refine nudge. Anything
written under `memo... | skymanbp/cc-memory | cc_memory/core/markers.py | .py | 2770a35710c0292d | 7.42 | 6 |
"""One similarity substrate — shingle sets, word sets, Jaccard. CJK-aware.
WHY THIS MODULE EXISTS. Three modules carried byte-identical private copies of
`_trigram_set` / `_jaccard` (llm/memory_writer.py, core/consolidate.py,
core/plan.py) and a fourth primitive (`_word_set`) lived beside one of them.
All four tokeniz... | skymanbp/cc-memory | cc_memory/core/textsim.py | .py | ccb047e72d596f1f | 7.42 | 6 |
#!/usr/bin/env python3
"""Shared hook entry: stdin payload parsing + the opt-out→anchor gate.
Every hook process starts the same way: read stdin to EOF, parse JSON,
require an object, consult config.json's `excluded_projects` on the RAW
cwd, and only then anchor that cwd to the project root. Through v2.9.0
each of the... | skymanbp/cc-memory | cc_memory/hooks/_entry.py | .py | bf09ad843b449348 | 7.42 | 6 |
#!/usr/bin/env python3
"""
PostToolUse hook — fires after every tool call.
Two jobs:
1. LIVE PLAN (v2.2) — capture ExitPlanMode output, sync TodoWrite snapshots
into the active plan's step statuses, and accrue the guardian drift
counters. MODE-INDEPENDENT (see the comment in main()).
2. OBSERVATION ROW —... | skymanbp/cc-memory | cc_memory/hooks/post_tool_use.py | .py | 7509455a6eac454c | 7.42 | 6 |
"""
Unified LLM call helper.
Strategy (v2.3.4): Anthropic candidates in order, local Ollama OPT-IN only.
- Iterate ``core.auth.get_api_candidates()`` — typically the ANTHROPIC_API_KEY
env var first, then the Claude Code subscription OAuth token. Each candidate
is sent with its correct wire format (platform key → `... | skymanbp/cc-memory | cc_memory/llm/ccl_backend.py | .py | 169d9b92141fb7c3 | 7.42 | 6 |
"""JSON-backed storage for tally entries.
Known bug (deliberate, for the demo): `add()` accepts a negative amount
without complaint, so `total()` can silently go down.
"""
from __future__ import annotations
import json
from pathlib import Path
from typing import Dict, List
class Store:
def __init__(self, path: ... | skymanbp/cc-memory | demo/tally/tally/store.py | .py | 65c9e983490b6f87 | 7.42 | 6 |
#!/usr/bin/env python3
"""
Build standalone exe files for cc-memory plugin.
Produces:
dist/cc-memory-installer.exe (one-click install on any machine, CONSOLE app)
dist/cc-memory-dashboard.exe (visual memory management, windowed)
Requirements: pip install pyinstaller
Packaging: bundles three payloads.
cc_me... | skymanbp/cc-memory | scripts/build_exe.py | .py | 7ba2506c78ab4a78 | 7.42 | 6 |
#!/usr/bin/env python3
"""Bounded subprocess execution for read-only TartCI observations."""
from __future__ import annotations
import dataclasses
import os
import signal
import subprocess
import tempfile
import time
from collections.abc import Sequence
TIMEOUT_EXIT_CODE = 124
DESCENDANT_LEAK_EXIT_CODE = 125
TERMIN... | danielraffel/tartci | scripts/bounded_subprocess.py | .py | fb7f020f2bcb9299 | 7.42 | 6 |
#!/usr/bin/env python3
"""Fleet drift guard — catch the silent config rot that kills event delivery.
Every check here exists because it FAILED SILENTLY in production on
2026-07-28, and none of the existing surfaces reported it. `tartci doctor`
checks host prereqs, `tartci pool status` lists agents, and `shipyard runne... | danielraffel/tartci | scripts/fleet_preflight.py | .py | 61d45f7eb9629428 | 7.42 | 6 |
#!/usr/bin/env python3
"""Derive a conservative host resource profile for tartci."""
from __future__ import annotations
import argparse
import json
import os
import platform
import shutil
import subprocess
from dataclasses import dataclass
from pathlib import Path
from typing import Any
VALID_ROLES = ("dedicated-bu... | danielraffel/tartci | scripts/host_profile.py | .py | c0759699379aff10 | 7.42 | 6 |
#!/usr/bin/env python3
"""Render plist string placeholders without shell or XML escaping hazards."""
from __future__ import annotations
import argparse
import plistlib
import re
import sys
from pathlib import Path
from typing import Any
def replace_strings(value: Any, replacements: dict[str, str]) -> Any:
if is... | danielraffel/tartci | scripts/render_launchd_template.py | .py | f14f95246528293f | 7.42 | 6 |
#!/usr/bin/env python3
"""Behavioral tests for the TARTCI_GH_CLI knob in the runner providers.
The providers poll GitHub every VM_POLL seconds on every host; on a shared
personal PAT that polling is the dominant secondary-rate-limit source. The knob
lets a host route all provider API traffic through a GitHub-App CLI w... | danielraffel/tartci | scripts/test_gh_cli_knob.py | .py | f44dd3f59b435ffb | 7.92 | 6 |
#!/usr/bin/env python3
"""Hermetic tests for the GitHub-hosted queue-saturation detector.
Exercises the pure decision core (`classify_saturation`) and the clock helper
(`_iso_age_secs`) with synthetic inputs — no network, no `gh`, no real clock —
so the triad contract is what we lock down. Runs on any platform in CI.
... | danielraffel/tartci | scripts/test_gh_queue_saturation.py | .py | 54f73e2363fb7de3 | 7.92 | 6 |
#!/usr/bin/env python3
"""Tests for tartci host resource profile derivation."""
from __future__ import annotations
import contextlib
import json
import os
import subprocess
import sys
import tempfile
import unittest
from pathlib import Path
import host_profile
class HostProfileRoleTests(unittest.TestCase):
def... | danielraffel/tartci | scripts/test_host_profile.py | .py | 26c8956b70f39132 | 7.92 | 6 |
#!/usr/bin/env python3
"""Hermetic install and rollback tests for the stewardship scheduler."""
from __future__ import annotations
import json
import os
from pathlib import Path
import subprocess
import tempfile
import unittest
INSTALLER = Path(__file__).with_name("install_shipyard_steward_scheduler.sh")
class St... | danielraffel/tartci | scripts/test_install_shipyard_steward_scheduler.py | .py | dbaa0eb94d62965c | 7.92 | 6 |
#!/usr/bin/env python3
"""Guard: every launchd plist template's PATH includes the system bin dirs.
A launchd agent gets only the PATH its plist declares. `sysctl` lives in
/usr/sbin, so a template that omits it hands every child process a PATH where
system binaries are unreachable — which is how the Linux and Windows ... | danielraffel/tartci | scripts/test_launchd_plist_path.py | .py | ab5c5328d81629b1 | 7.92 | 6 |
#!/usr/bin/env python3
"""Regression coverage for the Linux Actions runner's inherited file mode.
The GitHub Actions runner must start under the canonical ``0022`` umask. A
group-writable ambient umask changes archive fixtures and install receipts,
which makes clean Linux validation depend on how the golden launched t... | danielraffel/tartci | scripts/test_linux_runner_umask.py | .py | 9572742ef9517fe8 | 7.92 | 6 |
#!/usr/bin/env python3
"""Static safety checks for the M1-only scoped JIT GitHub wrapper."""
from pathlib import Path
import unittest
ROOT = Path(__file__).resolve().parents[1]
WRAPPER = ROOT / "scripts" / "tartci-m1-stackbench-jit-gh"
class M1StackbenchJitWrapperTests(unittest.TestCase):
def test_wrapper_keeps... | danielraffel/tartci | scripts/test_m1_stackbench_jit_wrapper.py | .py | f63ff69de4f66180 | 7.92 | 6 |
#!/usr/bin/env python3
"""Behavioral test for the macOS runner's EPHEMERAL per-boot registration name.
A fixed STATIC name (the bare $RUNNER_NAME, e.g. `pulp-vm-01`) reused across boots
lets a SIGKILL'd VM orphan a GitHub runner registration that lingers "offline but
running a job". The next boot then collides on that... | danielraffel/tartci | scripts/test_macos_ephemeral_name.py | .py | dcc0881b069b7ad4 | 7.92 | 6 |
"""Turn ``results/raw.csv`` into the two tables the docs page reads.
::
python -m benchmarks.aggregate
Writes ``summary.csv`` (levels, for the table) and ``paired.csv`` (differences
against the baseline, for the claim).
Why paired differences
----------------------
Seed variance dwarfs the effect being measured... | finite-sample/calibre | benchmarks/aggregate.py | .py | 98c99eeffca0a670 | 7.45 | 7 |
"""Draw the benchmark's figures, through ``calibre.plots``.
::
python -m benchmarks.figures
Every figure goes through the package's own plotting API rather than raw
matplotlib. That is deliberate: the benchmark dogfoods ``calibre.plots``, so a
regression in the plotting layer breaks the benchmark build instead o... | finite-sample/calibre | benchmarks/figures.py | .py | d0beac82fd72b81d | 7.45 | 7 |
"""What gets recorded for one calibrated test set.
Deliberately several numbers rather than one. A composite score is where a thumb
goes on the scale, so score and resolution stay on separate axes and the reader
does the trading off.
"""
from __future__ import annotations
import numpy as np
__all__ = ["COLUMNS", "e... | finite-sample/calibre | benchmarks/measures.py | .py | a4c9553f50a58dfe | 7.45 | 7 |
"""Base classifiers whose probabilities the calibrators are asked to fix.
Three, chosen because they fail in different ways and one of them barely fails at
all. Hyperparameters are fixed and unexplained by design: tuning the base model
would change what the calibrator is being asked to correct, and the benchmark is
ab... | finite-sample/calibre | benchmarks/models.py | .py | 2c38c9fa063ff761 | 7.45 | 7 |
"""One benchmark cell: a dataset, a model, and a seed.
This module holds the fairness controls, so they are in one place and visible in
one diff:
1. **The test split is touched exactly once**, at the end, to score. Nothing is
selected, tuned or inspected on it.
2. **Calibrators fit on out-of-fold model scores.** A... | finite-sample/calibre | benchmarks/protocol.py | .py | 3c1a577f7d010363 | 7.45 | 7 |
"""Run the benchmark grid and write ``results/raw.csv``.
::
python -m benchmarks.run --quick # offline and fast; what CI runs
python -m benchmarks.run # the committed grid
python -m benchmarks.run --include-remote --include-large
Rows are independent and individually seeded, so the ... | finite-sample/calibre | benchmarks/run.py | .py | a25497a66410378f | 7.45 | 7 |
"""Calibre: Model Probability Calibration Library.
This library provides various methods for calibrating probability predictions
from machine learning models to improve their reliability.
"""
from __future__ import annotations
# Get version from pyproject.toml - single source of truth
import importlib
import importl... | finite-sample/calibre | calibre/__init__.py | .py | 738e7b2530cd0849 | 7.45 | 7 |
"""Base classes and interfaces for calibration.
This module provides the foundational classes that all calibrators inherit from,
as well as optional mixins for additional functionality like diagnostics.
Supports a modular architecture with concrete implementations in the
calibrators package.
"""
from __future__ impor... | finite-sample/calibre | calibre/base.py | .py | 41435714b498225e | 7.45 | 7 |
"""Centered isotonic regression (CIR).
Isotonic regression's fitted curve is piecewise constant, so a flat block spreads
one pooled rate across a whole interval of scores. Every score inside the block
is mapped to the same probability, which discards the ranking information the
base model provided there.
CIR keeps th... | finite-sample/calibre | calibre/calibrators/centered_isotonic.py | .py | 41cdfe2aa34fb701 | 7.45 | 7 |
"""Isotonic regression calibrator with optional plateau diagnostics.
This module provides isotonic regression calibration, which is a non-parametric
method that fits a monotonically increasing function to data. It can optionally
perform sophisticated plateau analysis to distinguish between genuine flat
regions and art... | finite-sample/calibre | calibre/calibrators/isotonic.py | .py | 269d9d969da050ec | 7.45 | 7 |
"""Nearly-isotonic regression for flexible monotonic calibration.
This module provides nearly-isotonic regression, which relaxes the strict
monotonicity constraint by penalizing rather than prohibiting violations.
"""
from __future__ import annotations
import numpy as np
from .._core import (
PiecewiseLinear,
... | finite-sample/calibre | calibre/calibrators/nearly_isotonic.py | .py | c2142615f4298ff1 | 7.45 | 7 |
"""Monotone spline calibration.
A smooth, strictly monotone calibration map is the shape post-hoc calibration
benchmarks consistently favor: it corrects miscalibration without collapsing the
base model's score ordering into a staircase the way isotonic regression does.
Monotonicity here is structural rather than enfo... | finite-sample/calibre | calibre/calibrators/spline.py | .py | 9de26ca44f6d492d | 7.45 | 7 |
"""Diagnostic analysis tools for calibration.
This module provides diagnostic analysis to help understand calibration behavior,
particularly detecting plateaus (flat regions) and identifying potential data
quality issues.
"""
from __future__ import annotations
import numpy as np
# Plateau widths, in number of tied ... | finite-sample/calibre | calibre/diagnostics.py | .py | 74d97ddadce66a28 | 7.45 | 7 |
"""Shared styling for calibre's plots.
Colors are fixed here rather than left to matplotlib's cycle so that a given
quantity keeps the same color across every figure in the documentation: ``MCB``
is the same red whether it appears in a decomposition panel, a benchmark scatter
or a notebook.
Nothing in this module mut... | finite-sample/calibre | calibre/plots/_style.py | .py | a4be3fcc7a1d08d1 | 7.45 | 7 |
"""Plots of what calibration cost you in resolution.
Isotonic regression is a step function, so it maps many distinct scores onto one
value. The usual reliability diagram cannot show this -- a step function and a
strictly increasing curve can sit on top of each other and score identically --
which is why the loss goes... | finite-sample/calibre | calibre/plots/resolution.py | .py | de33bcf7087b82e0 | 7.45 | 7 |
"""Cross-validation shared by every calibrator.
Until 0.8.0 the only cross-validation in the package lived inside
``SplineCalibrator`` as a private method, and every other calibrator shipped a
fixed default for parameters that have no principled fixed value. ``lam=1.0`` and
``alpha=0.1`` are not neutral: they are bias... | finite-sample/calibre | calibre/selection.py | .py | 8c1f3bb9cdb2d3ab | 7.45 | 7 |
"""Array operation utilities.
This module provides functions for common array operations used in calibration,
such as sorting, transforming, and manipulating arrays.
"""
from __future__ import annotations
import numpy as np
def sort_by_x(
X: np.ndarray, y: np.ndarray
) -> tuple[np.ndarray, np.ndarray, np.ndarr... | finite-sample/calibre | calibre/utils/array_ops.py | .py | ebcd8474739e2615 | 7.45 | 7 |
"""Input validation utilities.
This module provides functions for validating and checking input arrays
to ensure they meet the requirements for calibration.
"""
from __future__ import annotations
import numpy as np
from sklearn.utils import check_array
def _validate_probability_vector(y_pred: np.ndarray) -> np.nda... | finite-sample/calibre | calibre/utils/validation.py | .py | 0e24e82937c276bc | 7.45 | 7 |
"""Generate smECE reference values from Apple's ``relplot``.
calibre reimplements the smooth calibration error of Blasiok & Nakkiran (ICLR
2024) rather than depending on ``relplot``, which pulls in seaborn and matplotlib.
The reimplementation is pinned against the reference here, in the same way the
isotonic machinery... | finite-sample/calibre | experiments/relplot_reference/gen_fixtures.py | .py | be7df3c232c71309 | 7.45 | 7 |
"""Tests for the benchmark harness.
Cheap enough for CI: one small cell, plus the guards that keep the harness
honest. The full grid is run by hand and its results are committed.
The guards matter more than the happy path. A benchmark that silently drops a
failing configuration, or that lets calibre's isotonic wrappe... | finite-sample/calibre | tests/test_benchmarks.py | .py | dc51e390632caba0 | 7.95 | 7 |
"""Reference and contract tests for ``bootstrap_ci``."""
from __future__ import annotations
import inspect
import numpy as np
import pytest
from scipy.stats import bootstrap as scipy_bootstrap
from calibre import bootstrap_ci, calibration_report
from calibre.metrics import brier_score
@pytest.fixture
def evaluati... | finite-sample/calibre | tests/test_bootstrap_ci.py | .py | 61e5b1344d916755 | 7.95 | 7 |
"""Reference and scenario tests for the binary Brier score."""
from __future__ import annotations
import numpy as np
import pytest
from calibre import IsotonicCalibrator, brier_score
def _exact_grouped_sample() -> tuple[np.ndarray, np.ndarray]:
"""Return observations with exact rates at five forecast values.""... | finite-sample/calibre | tests/test_brier_score.py | .py | 49f70d715beeeba0 | 7.95 | 7 |
"""Reference and scenario tests for calibration_curve."""
from __future__ import annotations
import inspect
import numpy as np
import pytest
from sklearn.calibration import calibration_curve as sklearn_calibration_curve
from calibre import calibration_curve
def _exact_grouped_sample() -> tuple[np.ndarray, np.ndar... | finite-sample/calibre | tests/test_calibration_curve.py | .py | 5061f8874ad555c4 | 7.95 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.