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
"""cross_code_topology_diagnosis.py —— 跨码族 A0/A1 拓扑诊断基准(10.55 延伸)
验证 diagnose_circuit 的电路无关性扩展到非格点码族,并标定拓扑诊断的
适用边界:
[一] surface code (L=4):2D 格点 → A0/A1 强分离(10.54 已知,cross_lift>1.5)
[二] [[15,7,3]] Hamming CSS:1D 坐标 → A0/A1 分离消失(cross_lift≈1.0)
核心结论:A0/A1 拓扑分离依赖 ≥2D 格点探测器坐标——这是诊断的适用范围
边界(非缺... | sdoygb/qec-geometry | scripts/cross_code_topology_diagnosis.py | .py | ee194a3b3a8595b5 | 7.15 | 1 |
#!/usr/bin/env python3
"""end_to_end_demo.py —— 一台 Mac 执行纠错:完整端到端演示(10.83,v4)
v4 改进:支持更大码(CSS(RM(1,m)) 家族 [[16,6,4]] / [[32,20,4]] / [[64,50,4]]),
恢复编码拆分为 rec_x / rec_z 两个 uint64 数组(2n 位不再溢出 int64)。
v3 改进(保留):
- 向量化解码循环(100k shots 60 ms,~60×)
v2 改进(保留):
[A] 真正应用恢复操作并重算逻辑值——从"检测"升级为"纠错"验证
[B] d=4 码——权重 2 错误混合型全... | sdoygb/qec-geometry | scripts/end_to_end_demo.py | .py | 59b9a164d3b710bc | 7.15 | 1 |
#!/usr/bin/env python3
"""ldpc_degeneracy.py —— 标准 LDPC 码(hypergraph product)简并结构分析
把几何论的简并类方法(10.30 定理 10.30.2.05 / 10.83)应用到主流 LDPC 族:
- hypergraph product 构造(HGP(H1,H2))
- 权重 1/2 层 syndrome 唯一率 + 类大小分布 + fail(2)
- 与 AG 完备码对照(r≥2 零简并 fail=0;r=1 部分简并)
用途:量化主流码的简并结构,判断解码恢复质量——
权重1唯一率 100% = 无歧义;权重2简并 = 恢复选错风险... | sdoygb/qec-geometry | scripts/ldpc_degeneracy.py | .py | 540df8b93f413b18 | 7.15 | 1 |
#!/usr/bin/env python3
"""mutation_test.py —— 变异测试(手动注入 bug,验证测试抓错能力)
不依赖 mutmut(其依赖 libcst 在此环境构建失败)。原理相同:
对源码注入已知变异(bug),跑测试套件,统计"测试能否抓住"。
存活变异 = 测试盲区(需要补测试)。
变异清单(每类注入 decoder.py 的一个真实 bug 模式):
M1 syndrome==0 误判(decode_error 旧 bug)——应被抓
M2 in_group 相位比较(旧 bug)——应被抓
M3 fail_rate 的 v 少算(类大小-1)——应被抓
M4 bu... | sdoygb/qec-geometry | scripts/mutation_test.py | .py | 7a19e8978fd948d6 | 7.65 | 1 |
#!/usr/bin/env python3
"""rm_fast_decoder.py —— Reed-Muller 快速解码器(矩恢复,非查表)
量子 CSS(RM(r,m)) 的 X 错误解码 ≡ 经典码 RM(m-r-1,m) 的 syndrome 解码:
- syndrome = 错误支撑 A(|A| ≤ 2^r)与次数 ≤ r 单项式的点积("矩")
- 解码目标:从矩恢复最小权重错误 A(= syndrome 类的最小权重代表)
解码策略(按 r 分层,O(n·poly),非查表):
r=1(错误 ≤ 2):矩直接读出
- m_∅=1 → A={a},a = 线性矩向量
- m_∅=0 ... | sdoygb/qec-geometry | scripts/rm_fast_decoder.py | .py | cbb85904845826e0 | 7.15 | 1 |
#!/usr/bin/env python3
"""rm_general_decoder.py —— 通用 Reed-Muller 矩解码器(r≥1,非查表)
理论(经典 Reed 多数逻辑,本实现为其矩域版本):
量子 CSS(RM(r,m)) X 错误 A(|A| ≤ 2^r)的 syndrome = 次数 ≤ r 矩 m_I。
矩唯一决定 A(已验证:m=8, r=4 无碰撞)。恢复策略:
对 r=1(|A|≤2):O(n) 矩读出(差分向量枚举)
对 r=2(|A|≤4):矩方程 + 平行四边形优先
对 r≥3(|A|≤8/16/…):Reed 递推多数逻辑——
利用"错误定位多项式":定义 ... | sdoygb/qec-geometry | scripts/rm_general_decoder.py | .py | 9e389886d2bf7fed | 7.15 | 1 |
#!/usr/bin/env python3
"""sinter_collect_demo.py —— sinter.collect:自定义解码器 vs pymatching 对照
可复现对照实验(sinter 标准流程):
- 码 1:CSS(RM(1,4)) [[16,6,4]](26 qubit 电路,rounds=2 差分,数据 depolarize + 测量翻转)
- 解码器 A:本库查表解码器(LookupSinterDecoder,sinter.Decoder 接口)
- 解码器 B:pymatching (MWPM)
- 解码器 A:本库查表解码器(LookupSinterDecoder,sinter.De... | sdoygb/qec-geometry | scripts/sinter_collect_demo.py | .py | 7a116a5f3a43fa72 | 7.15 | 1 |
#!/usr/bin/env python3
"""sinter_lookup_decoder.py —— LookupDecoder 的 sinter.Decoder 适配
把几何论自研查表解码器(10.30/10.83)接入 sinter/stim 生态:
- 实现 sinter.Decoder.decode_via_files(文件式 b8 解码)
- dets(bit-packed)→ 我们的 LookupDecoder 查表恢复 → 预测 observable flips
- 可用于 sinter collect(大规模采样 + 自定义解码器统计 p_L),
以及任何调用 sinter.Decoder 的生态(含 t... | sdoygb/qec-geometry | scripts/sinter_lookup_decoder.py | .py | 3d73e798f984c536 | 7.15 | 1 |
#!/usr/bin/env python3
"""
verify_closed_form_sim.py —— 闭式预测 vs 独立验证([[16,6,4]] AG 完备码)
闭环:几何论闭式 loss(θ) = c_d·θ^d 的三个成分,各自独立验证:
1. fail(w0) 闭式 vs 精确枚举(权重 w0 错误的最小权重解码失败率)
2. 零损失边界 vs 精确枚举(注入 ≤⌊(d-1)/2⌋ 比特 → 零损失)
3. θ⁴ 斜率 vs Qiskit 态矢量模拟(小码 [[7,1,3]],16 qubit 态矢量不可行)
运行: python3 verify_clos... | sdoygb/qec-geometry | scripts/verify_closedform.py | .py | f69d4279961ee1a2 | 7.15 | 1 |
#!/usr/bin/env python3
"""verify_degeneracy_classes.py —— RM(r,m) 权重 2^r 层简并类结构闭式验证
对照 rm_degeneracy_classes(10.30 开放问题 1 的 r≥1 通用化):
- 精确枚举(小参数):类数、类大小分布逐项对比
- 守恒律:闭式成员总数 = 10.33 简并比例分子
- r=1 退化:精确回到 rm1_w2_degeneracy
- 均匀性:r=1(全均匀)与 r=2(混合)边界行为
用法: python3 scripts/verify_degeneracy_classes.py
"""
import sys... | sdoygb/qec-geometry | scripts/verify_degeneracy_classes.py | .py | b6a7a3215de653ad | 7.15 | 1 |
#!/usr/bin/env python3
"""verify_lookup_decoder.py —— 自研查表解码器 + 几何论恢复表验证
把 10.30/10.35 简并类理论落地为可执行解码器,并做三重验证:
[一] 解码正确性:全部枚举错误恢复后残留 ∈ 稳定子群(成功)或逻辑(失败)
[二] fail(2) 谱系 vs 闭式(10.35 定理 10.35.1.02):
- AG r≥2 零简并 → fail(2) = 0(权重 2 唯一率 = 1.0)
- AG r=1 → fail(2) = 1 − 2^{1−m}
[三] 类结构 vs rm_degeneracy_cl... | sdoygb/qec-geometry | scripts/verify_lookup_decoder.py | .py | 690bfde1ed0605e0 | 7.15 | 1 |
#!/usr/bin/env python3
"""verify_theta4_suppression.py —— 10.30 开放问题 3:零简并是否压低 θ⁴ 系数?
理论(10.35 定理 10.35.1.02 + 推论 10.35.1.03):
主阶系数 c_d = C(n,w0)·P(w0)·fail(w0)·2^{-2w0}·κ_r(m)
"压低"机制逐层检验:
(A) 权重 2 层(θ⁴ 源层)的 fail(2):
- PG d=3: 跨层简并, fail(2) = 4/9(|0_L⟩ 编码,10.29)
- AG r=1: 同层全简并, fail(2) = 1 - 2^{1... | sdoygb/qec-geometry | scripts/verify_theta4_suppression.py | .py | 63f8f089548d1da8 | 7.15 | 1 |
import os
import sys
from logging.config import fileConfig
from pathlib import Path
from alembic import context
from sqlalchemy import engine_from_config, pool
# Ensure project root is in sys.path
PROJECT_ROOT = Path(__file__).resolve().parents[2]
if str(PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(PROJE... | WaifuPuller/CourseTide | backend/alembic/env.py | .py | 636e70a606af527e | 7 | 0 |
"""initial_coursetide_schema
Revision ID: 31500d98ece1
Revises:
Create Date: 2026-08-26 15:23:43.228710
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
try:
from pgvector.sqlalchemy import Vector
VECTOR_TYPE = Vector(384)
exce... | WaifuPuller/CourseTide | backend/alembic/versions/31500d98ece1_initial_coursetide_schema.py | .py | f82f0956c3176486 | 7 | 0 |
"""Semantic Course Recommender for CourseTide.
Embeds learner gap skills using sentence-transformers/all-MiniLM-L6-v2 and ranks
candidate courses via the approved hybrid gap-recall scoring formula:
Score(C) = 0.50 * S_sim + 0.35 * S_gap + 0.15 * S_pri
"""
import json
from pathlib import Path
from typing import Any, D... | WaifuPuller/CourseTide | backend/app/recommender/embeddings.py | .py | 6af6e9df4d6a14f0 | 7 | 0 |
"""Deterministic Skill-Gap Engine for CourseTide.
Compares a learner's normalized known skills against target role requirements in
data/target_roles.json. Purely deterministic (zero LLM calls).
"""
import json
from pathlib import Path
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field... | WaifuPuller/CourseTide | backend/app/recommender/skill_gap.py | .py | b807bc6519d5470e | 7 | 0 |
"""Integration tests for CourseTide API endpoints using isolated in-memory SQLite database."""
import asyncio
import unittest.mock
import uuid
import pytest
import httpx
from sqlalchemy.pool import StaticPool
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
from backend.app.mai... | WaifuPuller/CourseTide | backend/tests/test_api.py | .py | ea5adae6d7fa3500 | 7.5 | 0 |
"""Unit tests for CourseTide Semantic Course Recommendation & Scoring."""
import pytest
import numpy as np
from unittest.mock import MagicMock
from backend.app.recommender.embeddings import (
build_gap_query_text,
compute_composite_score,
RecommendedCourse,
)
def test_build_gap_query_text():
"""Veri... | WaifuPuller/CourseTide | backend/tests/test_embeddings.py | .py | ba119060d484feec | 7.5 | 0 |
"""Unit tests for CourseTide Goal Parser & Skill Normalization."""
import pytest
from unittest.mock import patch, MagicMock
from backend.app.recommender.goal_parser import (
GoalParsingError,
LLMConfigurationError,
ParsedGoal,
normalize_role,
normalize_skill,
parse_goal,
SKILL_ALIASES,
... | WaifuPuller/CourseTide | backend/tests/test_goal_parser.py | .py | 71cf941e89631cfe | 7.5 | 0 |
"""Unit tests for CourseTide Deterministic Skill-Gap Engine."""
import pytest
from backend.app.recommender.skill_gap import SkillGapError, SkillGapResult, detect_skill_gaps
def test_skill_gap_ml_engineer_novice():
"""Verify gap detection for complete beginner aiming for ML Engineer."""
res = detect_skill_gap... | WaifuPuller/CourseTide | backend/tests/test_skill_gap.py | .py | ab35bc459e97009f | 7.5 | 0 |
#!/usr/bin/env python3
"""Build the newest prior tagged release in an isolated exported tree."""
from __future__ import annotations
import argparse
import io
from pathlib import Path
import shutil
import subprocess
import sys
import tarfile
import tempfile
def version_key(tag: str) -> tuple[int, ...]:
return tu... | zhiyuzhang001-a11y/codebase-atlas | scripts/build_previous_wheel.py | .py | 828c68778e6600ee | 7 | 0 |
"""Load benchmark records without leaking hidden fields into agent prompts."""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any, Iterator
def read_jsonl(path: str | Path) -> Iterator[dict[str, Any]]:
with Path(path).open("r", encoding="utf-8") as handle:
for... | Fasuiker/ParamCAD-AgentBench | src/paramcad_agentbench/dataset.py | .py | 2523f7aac4c92363 | 7 | 0 |
# Made with ❤️ by [Vibey](https://adammatthewsteinberger.github.io/vibey/), Developed by [Adam Matthew Steinberger](https://hire.adam.matthewsteinberger.com/) ([@adammatthewsteinberger](https://github.com/adammatthewsteinberger/)).
"""Comprehensive documentation configuration and deterministic contracts."""
import jso... | adammatthewsteinberger/vibey-gh | test/test_documentation.py | .py | 68721f24bd5163f3 | 7.65 | 1 |
# Made with ❤️ by [Vibey](https://adammatthewsteinberger.github.io/vibey/), Developed by [Adam Matthew Steinberger](https://hire.adam.matthewsteinberger.com/) ([@adammatthewsteinberger](https://github.com/adammatthewsteinberger/)).
"""The local review fallback.
The behaviour worth pinning is not "it calls a model" but... | adammatthewsteinberger/vibey-gh | test/test_local_review.py | .py | 0dccab8f041711ba | 7.65 | 1 |
# Made with ❤️ by [Vibey](https://adammatthewsteinberger.github.io/vibey/), Developed by [Adam Matthew Steinberger](https://hire.adam.matthewsteinberger.com/) ([@adammatthewsteinberger](https://github.com/adammatthewsteinberger/)).
"""Talking to the automation in the place the work already happens: a comment.
Everythi... | adammatthewsteinberger/vibey-gh | vibey_gh/conversation.py | .py | 2f3b311b433c2624 | 7.15 | 1 |
# Made with ❤️ by [Vibey](https://adammatthewsteinberger.github.io/vibey/), Developed by [Adam Matthew Steinberger](https://hire.adam.matthewsteinberger.com/) ([@adammatthewsteinberger](https://github.com/adammatthewsteinberger/)).
"""Opt-in, tamper-evident branch tracing without exposing application data.
The tracer ... | adammatthewsteinberger/vibey-gh | vibey_gh/debugging.py | .py | db7dd84d03354516 | 7.15 | 1 |
# Made with ❤️ by [Vibey](https://adammatthewsteinberger.github.io/vibey/), Developed by [Adam Matthew Steinberger](https://hire.adam.matthewsteinberger.com/) ([@adammatthewsteinberger](https://github.com/adammatthewsteinberger/)).
"""Durable automation state carried in exactly one GitHub comment.
Both pull-request an... | adammatthewsteinberger/vibey-gh | vibey_gh/github_state.py | .py | e02e0867c3bf85f6 | 7.15 | 1 |
# Made with ❤️ by [Vibey](https://adammatthewsteinberger.github.io/vibey/), Developed by [Adam Matthew Steinberger](https://hire.adam.matthewsteinberger.com/) ([@adammatthewsteinberger](https://github.com/adammatthewsteinberger/)).
"""Policy and durable state for autonomously proposing a solution to a published issue.
... | adammatthewsteinberger/vibey-gh | vibey_gh/issue_automation.py | .py | c9cd47ce1920e650 | 7.15 | 1 |
# Made with ❤️ by [Vibey](https://adammatthewsteinberger.github.io/vibey/), Developed by [Adam Matthew Steinberger](https://hire.adam.matthewsteinberger.com/) ([@adammatthewsteinberger](https://github.com/adammatthewsteinberger/)).
"""Local-model fallback for vibey-gh's exact-head review.
Runs when the paid review pat... | adammatthewsteinberger/vibey-gh | vibey_gh/local_review.py | .py | f63ca1cf1d7348dd | 7.15 | 1 |
# Made with ❤️ by [Vibey](https://adammatthewsteinberger.github.io/vibey/), Developed by [Adam Matthew Steinberger](https://hire.adam.matthewsteinberger.com/) ([@adammatthewsteinberger](https://github.com/adammatthewsteinberger/)).
"""The merge train: review every open pull request into the integration branch and merge... | adammatthewsteinberger/vibey-gh | vibey_gh/merge_train.py | .py | c642319000b072d6 | 7.15 | 1 |
# Made with ❤️ by [Vibey](https://adammatthewsteinberger.github.io/vibey/), Developed by [Adam Matthew Steinberger](https://hire.adam.matthewsteinberger.com/) ([@adammatthewsteinberger](https://github.com/adammatthewsteinberger/)).
"""Promote the integration branch to the release branch.
This is the half of the flow t... | adammatthewsteinberger/vibey-gh | vibey_gh/promote.py | .py | 4f8bfd87b71a11ea | 7.15 | 1 |
# Made with ❤️ by [Vibey](https://adammatthewsteinberger.github.io/vibey/), Developed by [Adam Matthew Steinberger](https://hire.adam.matthewsteinberger.com/) ([@adammatthewsteinberger](https://github.com/adammatthewsteinberger/)).
"""Realign the integration branch with the release branch after a release.
When the rel... | adammatthewsteinberger/vibey-gh | vibey_gh/realign.py | .py | fb5b343f22d6fe49 | 7.15 | 1 |
# Made with ❤️ by [Vibey](https://adammatthewsteinberger.github.io/vibey/), Developed by [Adam Matthew Steinberger](https://hire.adam.matthewsteinberger.com/) ([@adammatthewsteinberger](https://github.com/adammatthewsteinberger/)).
"""Reconcile open topic branches after the integration branch is rewritten.
Realign con... | adammatthewsteinberger/vibey-gh | vibey_gh/reconcile.py | .py | 7efae49067ac8b28 | 7.15 | 1 |
# Made with ❤️ by [Vibey](https://adammatthewsteinberger.github.io/vibey/), Developed by [Adam Matthew Steinberger](https://hire.adam.matthewsteinberger.com/) ([@adammatthewsteinberger](https://github.com/adammatthewsteinberger/)).
"""Derive the release version from what actually changed.
This has to be automatic, not... | adammatthewsteinberger/vibey-gh | vibey_gh/versioning.py | .py | e17fd0838fd0f60b | 7.15 | 1 |
# Made with ❤️ by [Vibey](https://adammatthewsteinberger.github.io/vibey/), Developed by [Adam Matthew Steinberger](https://hire.adam.matthewsteinberger.com/) ([@adammatthewsteinberger](https://github.com/adammatthewsteinberger/)).
"""Report which releases on an index have been superseded by the one just published.
**... | adammatthewsteinberger/vibey-gh | vibey_gh/yank.py | .py | 5ea4fcaf4094e98c | 7.15 | 1 |
"""Shared HTTP/auth helpers for the confluence skill.
Targets Confluence Server / Data Center: the /rest/api/content endpoints, storage
format XHTML, and a personal access token sent as a Bearer credential. Confluence
Cloud lives under /wiki with different auth, and will not work here.
Reads CONFLUENCE_URL and CONFLU... | JanKolenko-git/JanKolenko-Skills | skills/integrations/atlassian/confluence/_client.py | .py | f8a8ae25e6edbdb3 | 7 | 0 |
#!/usr/bin/env python3
"""List a Confluence page's attachments with their download URLs.
Usage:
list_attachments.py <page-url-or-id>
Prints one attachment per line: <filename> <media-type> <size> <download-url>
Env: CONFLUENCE_URL, CONFLUENCE_PERSONAL_TOKEN (both required)
"""
import argparse
from _client imp... | JanKolenko-git/JanKolenko-Skills | skills/integrations/atlassian/confluence/list_attachments.py | .py | 0a48aa5d946a1204 | 7 | 0 |
#!/usr/bin/env python3
"""Add or update a delimited section on a Confluence page, leaving the rest alone.
Usage:
update_page.py <page-url-or-id> --marker ticket-report:PROJ-4821 \
--heading "Verification — PROJ-4821" --body-file report.xhtml
update_page.py <page-url-or-id> --marker ... --heading ... --stdin ... | JanKolenko-git/JanKolenko-Skills | skills/integrations/atlassian/confluence/update_page.py | .py | b06f87efcaaf0700 | 7 | 0 |
"""Shared HTTP/auth helpers for the jira skill.
Targets Jira Server / Data Center: REST v2, wiki markup, and a personal access
token sent as a Bearer credential. Jira Cloud is a different API (v3, ADF) with
different auth, and will not work here.
Reads JIRA_URL and JIRA_PERSONAL_TOKEN from the environment.
Never hard... | JanKolenko-git/JanKolenko-Skills | skills/integrations/atlassian/jira/_client.py | .py | 4dd742a2904e94f8 | 7 | 0 |
"""Convert Jira wiki markup (what Jira Data Center stores in text fields) to Markdown.
Descriptions and comments come back from `/rest/api/2` as wiki markup, not HTML and
not ADF. Rendering it makes tables, code blocks and lists readable instead of noise.
Pure stdlib on purpose — the skill must work with no pip insta... | JanKolenko-git/JanKolenko-Skills | skills/integrations/atlassian/jira/_markup.py | .py | 0d215554c8639359 | 7 | 0 |
"""Away / holiday mode with deadline-driven recovery.
A week away is the single largest saving a heating system can offer: a deep
setback plus hot water suppressed entirely, except for a legionella cycle timed
to complete before return.
What makes this more than an ``input_number`` is the **return time**. Knowing
whe... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/away.py | .py | 1ee6375b93aadaba | 7 | 0 |
"""The house, published as a virtual battery.
The building fabric plus the buffer and DHW tanks together form real energy
storage. The integration modelled it internally and never exposed it, so from
the outside a heat pump looks like an opaque load rather than the flexible
asset it is.
Two payoffs from publishing th... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/battery.py | .py | 450c3395f78cdf0b | 7 | 0 |
"""Binary sensors for Heat Pump Cost Optimizer.
Three states are worth surfacing as their own entities rather than as
attributes buried on another sensor, because each one is something a user may
reasonably want to automate on or be alerted about:
* whether any input the optimizer depends on has gone stale,
* whether... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/binary_sensor.py | .py | 11e933c1e374c42b | 7 | 0 |
"""Button entities for Heat Pump Cost Optimizer.
Forcing an optimization run and starting a system-identification experiment are
both momentary actions with no lasting state, which is exactly what a
``ButtonEntity`` is for. A switch would have to bounce itself back off, and
until it did, the UI would imply a state tha... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/button.py | .py | 6c66d198ae953f7c | 7 | 0 |
"""Climate entity for Heat Pump Cost Optimizer.
Provides a virtual climate entity that represents the optimizer's control
over the heat pump. Users can use this to:
- Set target temperature
- Switch between optimization modes (auto, comfort, economy, off, boost)
- View current state and optimizer recommendations
- See... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/climate.py | .py | 7ab6417278733a25 | 7 | 0 |
"""Learned heat-curve bias for the ECL110 displace (item 2, v4.0.0 T4b).
Most ECL110 installs run a heat curve set once, conservatively, by an
installer who was never coming back: a curve hot enough for the coldest
day the house will ever see, every day. The optimizer already commands a
displace on top of that curve, ... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/curve_learning.py | .py | 2ce4c9cb1c0eea7f | 7 | 0 |
"""Parsing and evaluation helpers for user-configured DHW demand windows.
A DHW demand window describes a time frame during which domestic hot water must
be available. Outside of the configured windows there is no availability
requirement, which lets the optimizer let the tank coast and re-heat only when
electricity ... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/dhw_schedule.py | .py | 331d7823a200d225 | 7 | 0 |
"""Why did the room end up where it did? (T6 #52)
The accuracy tracker says HOW WRONG the last interval's prediction was; this
module says WHY. It re-runs the interval through the same thermal model the
plan used, swapping one realised input at a time into the forecast set —
realised outdoor for forecast outdoor, meas... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/diagnosis.py | .py | 26047b4dd99496d2 | 7 | 0 |
"""One CUSUM primitive for every drift detector in the program (v4.0.0 T4).
Three places need "this signal has been consistently off for a while":
the open-window detector (#26, °C residuals over minutes-to-hours), the
compressor-health watch (#12, relative COP shortfall over weeks) and the
snapshot insurance's bias t... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/drift.py | .py | e3e1f79cecb04680 | 7 | 0 |
"""Frontend registration for the Heat Pump Optimizer Lovelace card.
This module serves the custom card's JavaScript from a static path and, when
Lovelace is running in storage mode, registers the resource automatically so
users do not have to add it by hand.
Both steps are defensive: the static-path helper prefers th... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/frontend.py | .py | 17a58109b9fab58e | 7 | 0 |
"""Time-of-use grid transfer fees, layered onto the spot price (item #1).
Swedish DSOs increasingly price the grid by time, not only by peak kW:
höglast energy fees (roughly +25 öre/kWh weekday 06–22, November–March at
several DSOs), and per-hour dynamic fees are on the way. The spot price the
integration plans agains... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/grid_fee.py | .py | d36b57ff9213e778 | 7 | 0 |
"""Guarded reads of Home Assistant states, with a staleness watchdog.
Every sensor the optimizer depends on is read through :class:`InputReader`
rather than directly from ``hass.states``. Two things are enforced here that a
bare read cannot express:
**Freshness.** ``unavailable`` and ``unknown`` are the easy failures... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/inputs.py | .py | a2f1dab4363214b9 | 7 | 0 |
"""Manual plan override: pinning *when* the heat pump actually runs.
The optimizer decides both *whether* to run each channel and *how hard*. The
apply_schedule service only ever changed the comfort/demand envelope and let
the optimizer keep re-deciding inside it, which is the opposite of what a user
who has hand-arra... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/manual_plan.py | .py | cc387bebda3204b3 | 7 | 0 |
"""The plan, told in sentences (T6 #29).
The reason codes (item 16) made each slot explicable one tooltip at a time;
this module tells the whole day at once: group the plan's steps by reason,
total each group's energy and money, and render one line per reason —
"6.2 kWh in the cheapest hours for 8.40 kr", "holding the... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/narrative.py | .py | a610a1aa78f4a200 | 7 | 0 |
"""The live peak guard: act inside the metering window the plan never saw (#7).
Planning avoids forecast peaks, but an unforecast coincidence — oven, sauna,
surprise EV plug-in — can set a new monthly peak in one hour. The DSO's meter
averages over a window, so at any instant mid-window the damage is not yet
done: wha... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/power_guard.py | .py | bf35b712367c7162 | 7 | 0 |
"""Circulation pump scheduling (item 6): stop pumping heat nobody asked for.
Two pumps, two very different risk profiles:
* **The VVC pump** (hot-water circulation loop) exists so the tap runs hot
immediately. Outside the demand windows nobody is at the tap, and the
loop is a radiator fed straight from the tank —... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/pump_schedule.py | .py | a17fbf11077521b2 | 7 | 0 |
"""PV self-consumption: pricing each step at the marginal cost of consuming.
For a house with solar, heating hot water or the buffer from surplus production
beats exporting it at spot-minus-fees. The v2.7.0 Open-Meteo work already
supplies the irradiance forecast and aligns it to the optimizer's step grid;
what was mi... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/pv.py | .py | 704c30ccc3b53ea8 | 7 | 0 |
"""Switch entity for Heat Pump Cost Optimizer.
Provides an on/off switch to enable/disable the optimizer.
When off, the heat pump is left in its default state.
When on, the optimizer actively controls the heat pump.
"""
from __future__ import annotations
import logging
from typing import Any
from homeassistant.compo... | tvofi/heatpump_optimizer | custom_components/heatpump_optimizer/switch.py | .py | 891c819ba87263ee | 7 | 0 |
"""Checks for Lovelace resource registration.
Getting the card onto the page is as much a part of it working as the card's
own code. These paths had no coverage, and a bug in them is unusually hard to
diagnose from the outside: the files on disk are correct, the integration logs
nothing unusual, and the browser simply... | tvofi/heatpump_optimizer | tests/frontend.py | .py | 7203182c7f48cae6 | 7.5 | 0 |
"""
Data API for Vision-Language Models
Load datasets from JSON files
"""
from datasets import Dataset
import os
import json
import logging
from multiprocessing import Pool, cpu_count
from .prompts import vl_cot_prompt
def process_single_item(item, index):
"""
Process a single item from JSON data.
Ar... | quhongyu/latentE | DMLR-main/DMLR/data.py | .py | d9241e41a72bfa4d | 7.15 | 1 |
"""
Custom logger module with colored debug output
"""
import logging
import sys
import os
# Try to import colorama for cross-platform color support
try:
from colorama import Fore, Style, init
init(autoreset=True)
USE_COLORAMA = True
except ImportError:
# Fallback to ANSI codes if colorama is not avail... | quhongyu/latentE | DMLR-main/DMLR/logger.py | .py | ee113c4f798f49df | 7.15 | 1 |
from dataclasses import dataclass
from typing import List
from datasets import Dataset
from lmms_eval.api.instance import Instance
class Filter:
"""
Filter classes operate on a per-task level.
They take all model outputs (`instance.resps` for all `task.instances`)
across all instances of a task, and... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/api/filter.py | .py | 221905dd75d14b03 | 7.15 | 1 |
import abc
from dataclasses import asdict, dataclass
from inspect import getsource
from typing import Any, Callable, List, Optional, Union
@dataclass
class AggMetricConfig(dict):
metric: Optional[str] = None
aggregation: Optional[str] = "mean"
weight_by_size: Optional[str] = False
# list of filter nam... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/api/group.py | .py | 29a767c5ddfbcf89 | 7.15 | 1 |
from dataclasses import dataclass, field
from typing import Literal, Tuple
@dataclass
class Instance:
request_type: Literal["loglikelihood", "generate_until", "generate_until_multi_round"]
arguments: tuple
idx: int
metadata: Tuple[str, int, int] = field(default_factory=lambda: (None, None, None)) # T... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/api/instance.py | .py | b082825d1c703391 | 7.15 | 1 |
import abc
import hashlib
import json
import os
from typing import List, Optional, Tuple, Type, TypeVar, Union
from loguru import logger as eval_logger
from sqlitedict import SqliteDict
from tqdm import tqdm
from lmms_eval import utils
from lmms_eval.api.instance import Instance
T = TypeVar("T", bound="lmms")
clas... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/api/model.py | .py | cbcc8577ee38030c | 7.15 | 1 |
class ContextSampler:
def __init__(self, docs, task, fewshot_indices=None, rnd=None) -> None:
self.rnd = rnd
assert self.rnd, "must pass rnd to FewShotSampler!"
self.task = task
self.config = task._config
self.target_delimiter = self.config.target_delimiter
self.few... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/api/samplers.py | .py | 1d790b96226da5c3 | 7.15 | 1 |
from lmms_eval.api.filter import Filter, FilterEnsemble
from . import extraction, selection, transformation
FILTER_REGISTRY = {
"take_first": selection.TakeFirstFilter,
"regex": extraction.RegexFilter,
"majority_vote": selection.MajorityVoteFilter,
"take_first_k": selection.TakeKFilter,
"remove_wh... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/filters/__init__.py | .py | 582f14f0271465f8 | 7.15 | 1 |
from lmms_eval.api.filter import Filter
class DecontaminationFilter(Filter):
"""
A filter which evaluates
"""
name = "track_decontamination"
def __init__(self, path) -> None:
"""
TODO: make sure only ever run one time on the train set (should this be cached as a class var? keyed... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/filters/decontamination.py | .py | 96293cccad035c8d | 7.15 | 1 |
import os
import pickle
import re
import subprocess
from pathlib import Path
from typing import Any, Dict, Optional, Tuple, Union
import numpy as np
from loguru import logger
from torch.utils.collect_env import get_pretty_env_info
from transformers import __version__ as trans_version
def remove_none_pattern(input_st... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/loggers/utils.py | .py | 45b3b506376201d2 | 7.15 | 1 |
import copy
import json
import logging
from typing import Any, Dict, List, Literal, Tuple
import numpy as np
import pandas as pd
from loguru import logger
from packaging.version import Version
from lmms_eval.loggers.utils import _handle_non_serializable, remove_none_pattern
def get_wandb_printer() -> Literal["Print... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/loggers/wandb_logger.py | .py | 04a2d8649a9888b3 | 7.15 | 1 |
# Code mostly from: https://github.com/EleutherAI/lm-evaluation-harness/pull/1339, credit to: https://github.com/ayulockin
import copy
import glob
import json
import os
import re
from datetime import datetime
from typing import Any, Dict, List, Literal, Tuple, Union
import numpy as np
import pandas as pd
import tenaci... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/logging_utils.py | .py | 8539569af67fbea7 | 7.15 | 1 |
import os
import warnings
from typing import List, Optional, Tuple, Union
import librosa
import numpy as np
import PIL
import torch
from accelerate import Accelerator, DistributedType
from accelerate.state import AcceleratorState
from tqdm import tqdm
from transformers import AutoModelForCausalLM, AutoProcessor
from ... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/models/aero.py | .py | db37fd7150284bcf | 7.15 | 1 |
import warnings
from typing import List, Optional, Tuple, Union
import numpy as np
import PIL
import requests
import torch
from accelerate import Accelerator, DistributedType
from accelerate.state import AcceleratorState
from decord import VideoReader, cpu
from PIL import Image
from tqdm import tqdm
from transformers ... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/models/aria.py | .py | daa90dd65215a5b4 | 7.15 | 1 |
import warnings
from typing import List, Optional, Tuple, Union
import torch
from accelerate import Accelerator, DistributedType
from accelerate.state import AcceleratorState
from tqdm import tqdm
from transformers import AutoModelForCausalLM, AutoTokenizer
from lmms_eval import utils
from lmms_eval.api.instance impo... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/models/cogvlm2.py | .py | 04923ec2ae5f2bac | 7.15 | 1 |
import warnings
warnings.simplefilter("ignore", category=DeprecationWarning)
warnings.filterwarnings("ignore")
from typing import List, Optional, Tuple, Union
import torch
from accelerate import Accelerator, DistributedType
from accelerate.state import AcceleratorState
from loguru import logger as eval_logger
from P... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/models/fuyu.py | .py | 23feab3d8969dd10 | 7.15 | 1 |
import warnings
from typing import List, Optional, Tuple, Union
import torch
from accelerate import Accelerator, DistributedType
from accelerate.state import AcceleratorState
from torchvision.transforms.functional import to_pil_image
from tqdm import tqdm
from transformers import AutoProcessor, Idefics2ForConditionalG... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/models/idefics2.py | .py | ec8222f92dce6bb0 | 7.15 | 1 |
import copy
import warnings
from typing import List, Optional, Tuple, Union
import torch
import transformers
from accelerate import Accelerator, DistributedType
from accelerate.state import AcceleratorState
from tqdm import tqdm
from transformers import InstructBlipForConditionalGeneration, InstructBlipProcessor
from... | quhongyu/latentE | evaluation/lmms-eval/lmms_eval/models/instructblip.py | .py | 41f2ccea949131ef | 7.15 | 1 |
#!/usr/bin/env python3
"""Guard: a public repo's commit history should not narrate its private origin.
When a public repo is extracted and generalized from private work, the code and
docs usually get reviewed for leaks. The commit messages and PR bodies usually
do not, and they are just as public and far more revealin... | The-825/breadcrumbs | ci-kit/guards/guard_no_provenance_leak.py | .py | 78dc5c93234a9412 | 7.3 | 3 |
"""Guard self-tests: every guard bites a bad fixture.
For each of the six CI lint guards, run it (as a subprocess, the same way CI
does) against a deliberately-bad fixture and assert a non-zero exit, then
against a clean fixture and assert exit 0. This is the proof the guards
actually block. A guard that never fails i... | The-825/breadcrumbs | ci-kit/guards/tests/test_guards.py | .py | b87b88c2ddcc6fbe | 7.8 | 3 |
#!/usr/bin/env python3
"""Staleness auditor for a conclusions ledger (a CONCLUSIONS.jsonl file).
Reads a jsonl ledger (base line format: templates/CONCLUSIONS_TEMPLATE.md;
provenance fields: PROVENANCE.md next to this script) and classifies every
entry:
STALE the entry's `path` no longer exists in the repo (the ... | The-825/breadcrumbs | templates/ledger-tools/conclusions_audit.py | .py | 03fd958a8d57604a | 7.3 | 3 |
#!/usr/bin/env python3
"""Self-tests for the memory desk's mem CLI.
Run from anywhere: python3 templates/memory-desk/tests/test_mem.py
Subprocess-driven end to end: each test runs the real executable against a
throwaway desk in a temp directory, so the contract under test (exit codes
included) is the one a session act... | The-825/breadcrumbs | templates/memory-desk/tests/test_mem.py | .py | 3ccf1c746114fe8e | 7.8 | 3 |
"""A tiny synthetic inventory service, written so the harness seams show.
This is scaffolding, not a framework. Routes live in a plain callable table
so the tests run on stdlib alone; swap in your real app factory and the
harness pattern stays identical. All data here is invented workshop
inventory; none of it is real... | The-825/breadcrumbs | templates/test-harness/app_example.py | .py | 69fcd108ba200142 | 7.8 | 3 |
# butterflyetl.py (Modified for Neon PostgreSQL)
import os
from flask import Flask, request, jsonify
import pandas as pd
import logging
# For PostgreSQL connection
from sqlalchemy import create_engine
import psycopg2 # Imported by create_engine
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(as... | conrad1451/animaltrackingetls | butterflyetl.py | .py | 1b375c291efd434f | 7.15 | 1 |
# etl_past_day_script.py
import monarch_butterfly_module
from datetime import date, datetime, timedelta
# CHQ: Gemini AI generated function
def get_first_sunday_of_year(input_date: date) -> date:
"""
For a given date, this function returns the date of the first Sunday
of the year in which the input date... | conrad1451/animaltrackingetls | etl_past_day_script.py | .py | c93b1d19a9b4e628 | 7.15 | 1 |
import os
from flask import Flask, Response, request, send_file
# import requests
from PIL import Image, ImageDraw, ImageFont
from io import BytesIO
# Libraries needed (pandas is not standard and must be installed in Python)
import requests
import pandas as pd
# Initialize Flask app
app = Flask(__name__)
FROST_API_C... | conrad1451/animaltrackingetls | frostapi.py | .py | 8b4c1fbaaba0f18a | 7.15 | 1 |
# CHQ: Claude AI generated file
"""
table_naming.py
---------------
Pure utility: derives the PostgreSQL table name for a given date.
Keeping this logic isolated means any future naming-convention change
is a one-line edit in one place.
Examples
--------
>>> table_name_for_day(2025, 6, 1)
'june012025'
>>> table_name... | conrad1451/animaltrackingetls | monarch_etl/table_naming.py | .py | 260663d8b7414c59 | 7.15 | 1 |
# CHQ: Gemini AI generated the following file
import os
from flask import Flask, Response, request, send_file
import requests
from PIL import Image, ImageDraw, ImageFont
from io import BytesIO
# Initialize Flask app
app = Flask(__name__)
# --- Configuration ---
# Get OpenWeatherMap API key from environment variable
... | conrad1451/animaltrackingetls | openweatherbasicmap.py | .py | 58034c9384dc40c7 | 7.15 | 1 |
# Sources:
# [1]: https://stackoverflow.com/questions/10727366/jsonify-is-not-defined-internal-server-error
import os
from flask import Flask, Response, request, send_file, jsonify
from PIL import Image, ImageDraw, ImageFont
from io import BytesIO
# Libraries needed (pandas is not standard and must be installed in P... | conrad1451/animaltrackingetls | usamonarchbutterflies.py | .py | bc4f9cc7e74d22cc | 7.15 | 1 |
"""
Base Analyzer - Abstract base class for all analyzers.
⚠️ IMPORTANT — INTERNAL CONSENT-GATED ENTRYPOINT
The ``authors`` constructor argument is **not** a public author filter for
library consumers. It is an internal channel that the CLI orchestrator
(``src.main``) populates **only after** it has:
1. confirmed... | ProjectZeroDays/FreeAI_AI-Inference-Workstation | .agents/skills/code-analysis/src/analyzers/base_analyzer.py | .py | 7c30fe7e3c422bc7 | 7.24 | 2 |
"""
Cadence Signal Analyzer — *self-reflection only*.
This module extracts low-level, descriptive cadence component values from a
Git repository (cadence sparsity, inter-commit gap size, trivial-change
ratio, lines-per-active-day, non-code-only commit ratio). It is
structurally constrained so the output cannot be misu... | ProjectZeroDays/FreeAI_AI-Inference-Workstation | .agents/skills/code-analysis/src/analyzers/cadence_signal_analyzer.py | .py | c89e952e22478476 | 7.24 | 2 |
"""
Code Quality Analyzer - Analyzes code quality signals from Git history.
Metrics include:
- Bug fix commit ratio
- Hotfix/revert frequency
- Large commit ratio (potential code smell)
- Test file modification ratio
- Code complexity trend (via radon for Python files)
- Documentation update ratio
"""
imp... | ProjectZeroDays/FreeAI_AI-Inference-Workstation | .agents/skills/code-analysis/src/analyzers/code_quality_analyzer.py | .py | e7d2adb32fcc276f | 7.24 | 2 |
"""
Code Style Analyzer - Analyzes code style consistency and patterns.
Metrics include:
- File type distribution (languages used)
- Naming convention adherence (snake_case, camelCase, etc.)
- Average file size of modified files
- Commit message convention analysis (conventional commits, etc.)
- Common file ... | ProjectZeroDays/FreeAI_AI-Inference-Workstation | .agents/skills/code-analysis/src/analyzers/code_style_analyzer.py | .py | e8066fb2c2c71c8d | 7.24 | 2 |
"""
Commit Analyzer - Analyzes commit patterns and behaviors.
Metrics include:
- Total commits for the consented identity
- Commit frequency (daily/weekly/monthly)
- Average commits per day
- Commit message length & quality
- Commit size distribution (lines added/deleted)
- Merge vs non-merge commit ratio
... | ProjectZeroDays/FreeAI_AI-Inference-Workstation | .agents/skills/code-analysis/src/analyzers/commit_analyzer.py | .py | df6be02a3b5a44bb | 7.24 | 2 |
"""
Efficiency Analyzer - Aggregates Git diff statistics into descriptive
code-change metrics.
⚠️ IMPORTANT — INTENDED USE & LIMITATIONS
The metrics produced here (churn rate, rework ratio, lines per commit,
file ownership, bus factor) are derived purely from Git diffs and authorship
records. They DO NOT measure sof... | ProjectZeroDays/FreeAI_AI-Inference-Workstation | .agents/skills/code-analysis/src/analyzers/efficiency_analyzer.py | .py | 276976a0f453d26b | 7.24 | 2 |
"""
Work Habit Analyzer - Aggregates Git commit timestamps into descriptive
work-time pattern statistics.
⚠️ IMPORTANT — INTENDED USE & LIMITATIONS
The metrics produced here (peak hour, weekend ratio, late-night ratio,
streaks, average gap between commits) are extracted from Git timestamps,
which only reflect *when ... | ProjectZeroDays/FreeAI_AI-Inference-Workstation | .agents/skills/code-analysis/src/analyzers/work_habit_analyzer.py | .py | f5a4818c97d6c798 | 7.24 | 2 |
"""
Reflection Narrator.
⚠️ IMPORTANT — INTENDED USE & STRUCTURAL SAFEGUARDS
This module produces *self-reflection narrative text* from Git history
component values. The output:
- Is a NARROW, BIASED proxy. Git history misses code review, design,
mentoring, on-call, ops, security work, pair programming, refac... | ProjectZeroDays/FreeAI_AI-Inference-Workstation | .agents/skills/code-analysis/src/narrator/reflection_narrator.py | .py | 0b829757ef9c92e6 | 7.24 | 2 |
"""
Base Reporter - Abstract base class for report generators.
"""
from abc import ABC, abstractmethod
from typing import Dict
class BaseReporter(ABC):
"""Abstract base class for report generators."""
@abstractmethod
def generate(self, metrics: Dict) -> str:
"""
Generate a formatted repo... | ProjectZeroDays/FreeAI_AI-Inference-Workstation | .agents/skills/code-analysis/src/reporters/base_reporter.py | .py | e0cc9421eab8735f | 7.24 | 2 |
"""
JSON Reporter - Generates analysis reports in JSON format.
"""
import json
from typing import Dict
from src.reporters.base_reporter import BaseReporter
class JsonReporter(BaseReporter):
"""Generates structured JSON reports from analysis metrics."""
def generate(self, metrics: Dict) -> str:
"""G... | ProjectZeroDays/FreeAI_AI-Inference-Workstation | .agents/skills/code-analysis/src/reporters/json_reporter.py | .py | f97e59d1f472a054 | 7.24 | 2 |
"""
Repository Scanner - Discovers Git repositories on the local filesystem.
⚠️ IMPORTANT — SCOPE & CONSENT MODEL
This module only enumerates ``.git`` directories under a path the operator
has explicitly passed via ``-r/--repo``. It does NOT itself perform any
Git-history analysis. Whatever repositories it discovers... | ProjectZeroDays/FreeAI_AI-Inference-Workstation | .agents/skills/code-analysis/src/scanner.py | .py | 38b705b65834d0c3 | 7.24 | 2 |
"""
Utility functions for the code analysis skills.
"""
import os
from datetime import datetime
from typing import Optional
def parse_date(date_str: Optional[str]) -> Optional[datetime]:
"""
Parse a date string in ISO format.
Args:
date_str: Date string like '2024-01-01' or '2024-01-01T10:00:00'... | ProjectZeroDays/FreeAI_AI-Inference-Workstation | .agents/skills/code-analysis/src/utils/helpers.py | .py | f405727d82af3b04 | 7.24 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.