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
"""make user_skills.last_assessed_at timezone-aware Revision ID: 0006 Revises: 0005 Create Date: 2026-07-27 ``user_skills`` came from 0003, before the codebase settled on ``timestamptz`` for every timestamp it writes from Python — v2 declares ``DateTime(timezone=True)`` on all 28 of its datetime columns. The column w...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0006_user_skills_last_assessed_tz.py
.py
255c4cfb1549c278
7.45
7
"""documents.origin — tell an uploaded source apart from one the model wrote Revision ID: 0007 Revises: 0006 Create Date: 2026-07-27 Creating a course "desde cero" synthesises its source document instead of asking for an upload. Everything downstream — the v1 generation pipeline, the v2 schema graph, the node runtime...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0007_document_origin.py
.py
4b2d154b150e11b8
7.45
7
"""document_chunks.embedding at a pinned dimension, and an HNSW index Revision ID: 0008 Revises: 0007 Create Date: 2026-08-04 Two changes in the same migration because both force the index to be rebuilt, and splitting them would cost two rebuilds of the same index on the same table. ## The dimension, and why it is p...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0008_embedding_dim_and_hnsw.py
.py
fa22ac4f4f7f2934
7.45
7
"""media_artifacts: the shared spine for NotebookLM-style rich media Revision ID: 0009 Revises: 0008 Create Date: 2026-08-10 One table plus two enum types. Every rich artifact (podcast, slide deck, infographic, narrated-slides video, mind map, report, cover image) is a row here, generated asynchronously and served th...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0009_media_artifacts.py
.py
c5b6ee95aedb289b
7.45
7
"""Add server-owned declarative activity definitions. Revision ID: 0014 Revises: 0013 """ from collections.abc import Sequence import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql revision: str = "0014" down_revision: str | None = "0013" branch_labels: str | Sequence[str] | None =...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0014_activity_definitions.py
.py
ce91b1242d583f1c
7.45
7
"""Learner learning-note: a per-learner free-text "how I like to learn" field. A small, nullable free-text note on the learner profile where a person says HOW they like lessons explained (metaphors, first principles, examples, tone). It steers only the FORM of an explanation, never the facts, and partitions the render...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0018_learner_learning_note.py
.py
acc4e569f781b027
7.45
7
"""Add ``courses.is_demo``: a pre-baked onboarding demo course flag. Additive and defaulted, so every existing course reads as ``false`` and the v1/v2 delivery decision is untouched. See ``src/services/org_demo_seed.py``. Revision ID: 0019 Revises: 0018 """ from collections.abc import Sequence import sqlalchemy as s...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0019_course_is_demo.py
.py
4ac42ca911bac99f
7.45
7
"""Allow ``chat_sessions.agent_type = 'admin_agent'``: the tool-calling admin agent. Additive: widens the existing check constraint, does not touch any row. The new agent type is a separate thread from ``'admin'`` (the read-only org assistant) — see ``src/services/admin_agent_service.py``. Revision ID: 0020 Revises: ...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0020_admin_agent_chat.py
.py
4ec62a2fff2615d1
7.45
7
"""Add ``api_keys.expires_at``: optional expiry for external API keys. The data model documented in ``docs/design/mcp-external-api.md`` (8.1.1) always included ``expires_at``, but the column never made it into migration 0003. Nullable and additive: existing keys read as "never expires" (``null``), matching the documen...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0020_api_key_expires_at.py
.py
f8581e76f05b8041
7.45
7
"""Add ``users.google_sub``: the external identity behind "Sign in with Google". Additive and nullable, so every existing password-only account is untouched and reads as "no Google identity linked". The column stores Google's OIDC ``sub`` claim and not the email address: ``sub`` is stable and never reused, whereas an ...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0022_user_google_identity.py
.py
cc785663fcd36289
7.45
7
"""Add ``media_artifacts.error_code``: a stable code beside the failure message. Until now a failed generation stored ``f"{type(exc).__name__}: {exc}"`` in ``error`` and showed it to whoever asked — a provider's raw exception text, unreadable to a learner and capable of carrying an endpoint, a model name or an account...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0023_media_artifact_error_code.py
.py
f85bb95bc61c7e6f
7.45
7
"""Let a draft course be deleted: ``SET NULL`` on the two FKs that only reference it. ``DELETE /courses/{id}`` has existed since 0001 and could not be used: three foreign keys point at ``courses.id`` with no ``ondelete``, so Postgres raised ``ForeignKeyViolation`` and the route answered 500 instead of deleting. Two of...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0024_course_delete_fks.py
.py
8fabeb03ef1676b4
7.45
7
"""Add ``courses.generation_state``: whether the course finished being created. A v2 course is only servable once ``POST /schema/validate`` has run, and until this revision the wizard ran that step from the browser tab. A tab that was closed, reloaded or killed between "create the course" and "validate the schema" lef...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0025_course_generation_state.py
.py
0704343ecdfe3ef2
7.45
7
"""source_images: keep the pictures that were already inside the uploaded document Revision ID: 0026 Revises: 0025 Create Date: 2026-08-27 Ingestion has decoded the images embedded in an uploaded PDF since Phase 5 and thrown every one of them away: the decoder handed the bytes to a vision model, the description went ...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0026_source_images.py
.py
7225e1f6fd3b618b
7.45
7
"""source_images.kind: what the picture IS, because the rendering decision is made from it Revision ID: 0027 Revises: 0026 Create Date: 2026-08-27 ``0026`` gave an image a ``description`` and nothing else, and the vision prompt behind it asked for "2-3 sentences describing what it shows". That is a caption: enough to...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0027_source_image_kind.py
.py
337025440150f52e
7.45
7
"""learner_node_states.completed_at: the learner finished the node, which is not mastery Revision ID: 0029 Revises: 0028 Create Date: 2026-08-27 The reported symptom was "a finished course shows 0% and never turns green", and the cause is that the table had no column for the thing the learner actually did. Progress ...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0029_learner_node_state_completed_at.py
.py
2513407566b31884
7.45
7
"""Named groups of people, their membership, and enrollment provenance. Revision ID: 0030 Revises: 0029 Create Date: 2026-08-27 """ from collections.abc import Sequence import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql revision: str = "0030" down_revision: str | None = "0029"...
ANFAIA/SkillNet
apps/skillnet-api/alembic/versions/0030_user_groups.py
.py
54d2afced77ae80b
7.45
7
#!/usr/bin/env python3 """Create a dynamic course end to end in ONE command. Wraps :func:`src.services.course_orchestration.create_course_end_to_end` so an operator or a subagent can build a fully-validated course with a single call, instead of the seven-step API dance. Run it inside the API container (it needs the a...
ANFAIA/SkillNet
apps/skillnet-api/scripts/create_course.py
.py
b94c5cb6bdb23eba
7.45
7
"""防刷屏检测模块。 按 (群号, 用户ID) 追踪消息时间戳,超限自动禁言 + 可选撤回。 """ import re import time from collections import deque from typing import Dict, List, Optional, Tuple _REPEAT_IGNORED_PLACEHOLDERS_RE = re.compile( r"^(?:\[(?:图片|语音|视频|表情|商城表情|文件|合并转发消息|空消息)\]\s*)+$" ) _ANTI_FLOOD_EVENT_DEDUP_TTL_SECONDS = 2 * 3600 _ANTI_FLOOD_EVE...
zcj-ui/astrbot_plugin_group_guardian
anti_flood.py
.py
01c2194196c39c35
7.65
19
# -*- coding: utf-8 -*- """Aho-Corasick 自动机封装。支持纯文本 AC 匹配 + 正则不可拆解部分的回退。""" import re from typing import List, Optional, Tuple try: from astrbot.api import logger except Exception: # 脱离 AstrBot 运行时(如单测)的兜底 logger import logging logger = logging.getLogger("group_guardian.automaton") try: import ahoco...
zcj-ui/astrbot_plugin_group_guardian
automaton.py
.py
8e4c6308a0e538fa
7.65
19
# -*- coding: utf-8 -*- """可追溯的辱骂词库扩展迁移。 这个模块只负责生成和写入 ``moderation_rules`` 中的 ``swear`` 规则, 不参与消息解析。规则被设计为字面量(或明确的正则)以便兼容 ``HybridMatcher``。生成器只保留明确的核心短语,并在字符间隙组合安全 分隔符;不会自动替换同音字,也不会把任意单字加入词库。 ``ensure_swear_expansion`` 可在插件启动时调用,使用 ``meta`` 中的版本 键保证已有运行库只迁移一次;脚本入口则用于更新发布包中的 seed ``lexicon.db``,支持 ``--dry-run`` 和完整性校...
zcj-ui/astrbot_plugin_group_guardian
lexicon_migration.py
.py
c950491ab547214b
7.65
19
# -*- coding: utf-8 -*- """后台调度模块(v2.4.0)。 负责多类周期性任务: 1. F3 定时自动解禁:扫描 scheduled_unbans 表,成功后删除,失败则退避重试。 2. F2 申诉超时:把过期仍 waiting 的申诉标记 expired(维持原处罚)。 3. 审核误判复盘:把人工确认的误判样本交给 LLM,生成待审批修正规则。 设计要点: - 单个 asyncio 后台 loop,按 auto_unban_scan_interval 秒轮询; - 后台任务无 event,OneBot client 通过 _get_client(None) 的 platform_manager 回退获...
zcj-ui/astrbot_plugin_group_guardian
scheduler.py
.py
a91599e59c6f10ba
7.65
19
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Support assistant handler for OMN-1201 Demo. - Input/output schemas (SupportRequest, SupportResponse) - LLM client protocol (ProtocolLLMClient) - Main handler (SupportAssistantHandler) - Provider implementations (OpenAI, Anthropic, Loca...
OmniNode-ai/omnibase_core
examples/demo/handlers/support_assistant/__init__.py
.py
666401562cadde26
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Anthropic LLM client implementation using httpx. # ai-slop-ok: pre-existing boilerplate, suppressed per OMN-4405 This module provides a ProtocolLLMClient implementation for Anthropic's API. Uses httpx for consistency with other provide...
OmniNode-ai/omnibase_core
examples/demo/handlers/support_assistant/handler_anthropic.py
.py
ce1cf0b768417a98
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT # onex-allow-file-internal-ip OMN-13480 reason="this is a demo LocalLLMClient whose entire subject IS a local/self-hosted LLM endpoint; the docstring example and DEFAULT_ENDPOINT constant intentionally show a localhost vLLM URL as illustrati...
OmniNode-ai/omnibase_core
examples/demo/handlers/support_assistant/handler_local.py
.py
ea8deeefbd5cb9ef
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Mock LLM client for unit testing. # ai-slop-ok: pre-existing boilerplate, suppressed per OMN-4405 This module provides a configurable mock LLM client that implements ProtocolLLMClient for use in unit tests. It allows testing different ...
OmniNode-ai/omnibase_core
examples/demo/handlers/support_assistant/handler_mock.py
.py
97afb8dae57182b6
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """OpenAI LLM client implementation using httpx. # ai-slop-ok: pre-existing boilerplate, suppressed per OMN-4405 This module provides a ProtocolLLMClient implementation for OpenAI's API. Uses httpx for consistency with other providers. E...
OmniNode-ai/omnibase_core
examples/demo/handlers/support_assistant/handler_openai.py
.py
e0b9c5eceaf2d0df
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """ModelConfig for LLM provider configuration. (OpenAI, Anthropic, Local) in the OMN-1201 demo support assistant handler. Example: Using a pre-defined configuration:: from examples.demo.handlers.support_assistant import OPENA...
OmniNode-ai/omnibase_core
examples/demo/handlers/support_assistant/model_config.py
.py
ce45cebbeb75528b
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Protocol definition for LLM client implementations. This module defines the ProtocolLLMClient interface that all LLM client implementations must follow. This enables protocol-based dependency injection in the SupportAssistantHandler. E...
OmniNode-ai/omnibase_core
examples/demo/handlers/support_assistant/protocol_llm_client.py
.py
fa30af0146b008fa
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Examples showing how to migrate from dict-like interfaces to ModelFieldAccessor pattern. This demonstrates the replacement of custom field access methods across CLI, Config, and Data domains with the unified ModelFieldAccessor pattern. ...
OmniNode-ai/omnibase_core
examples/field_accessor_migration.py
.py
052bb368fab38bd2
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Example: Using omnibase_core validation tools in other repositories This example demonstrates how other repositories can integrate and use the validation tools provided by omnibase_core for ONEX compliance. """ import sys from pathlib ...
OmniNode-ai/omnibase_core
examples/validation_usage_example.py
.py
bc2deb279688c1ef
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """CLI: co-change dark matter analysis. Usage: python scripts/analysis/co_change_dark_matter.py # human-readable top 20 python scripts/analysis/co_change_dark_matter.py --json # JSON to stdout python scripts/analysis...
OmniNode-ai/omnibase_core
scripts/analysis/co_change_dark_matter.py
.py
76c18a7cb2327a4c
7.48
8
#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """CLI: compute AST-level semantic diff between two git refs (OMN-10375). Usage: python scripts/analysis/semantic_diff.py --base origin/main --head HEAD --json Exits 0 on completed analysis; argparse usage errors...
OmniNode-ai/omnibase_core
scripts/analysis/semantic_diff.py
.py
84bf7781863d770f
7.48
8
#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Pre-commit hook: fail if metadata fields use dict[str, Any] without ONEX_EXCLUDE. Usage: python scripts/check_no_untyped_metadata.py [files...] Exit code 0 = clean. Exit code 1 = violations found. """ import re i...
OmniNode-ai/omnibase_core
scripts/check_no_untyped_metadata.py
.py
f963e87bcb88ebf4
7.48
8
#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Release-identity gate: no importable-surface change merges onto a published version without a bump (OMN-13411). omnibase_core is a published PyPI package that downstream repos (omnibase_infra, omnimarket, ...) pin...
OmniNode-ai/omnibase_core
scripts/check_release_identity.py
.py
37785012f56314bf
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Coverage-guided compute-golden adequacy receipt (OMN-14353 f/u, Task #41). Turns the proven ``compute_golden`` primitive into the load-bearing feature: a recorder whose golden set is chosen to MEASURE UP TO its promise. The canary showed...
OmniNode-ai/omnibase_core
scripts/ci/adequacy_receipt.py
.py
189d88fb389a02b4
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Import-layering GROWTH RATCHET for omnibase_core (OMN-14340, epic OMN-3210). The intra-core import-linter oracle (`.importlinter`) freezes known back-edges as wildcard `ignore_imports` lines. A wildcard ignore is permissive: it silently...
OmniNode-ai/omnibase_core
scripts/ci/check_import_ratchet.py
.py
980a03d31c4a122e
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Compute-behavior golden recorder + equivalence comparator (OMN-14353 canary). A minimal, general recorder for a PURE COMPUTE node: it serializes a node's ``input -> output`` as a golden and replays it, comparing the fresh output to the r...
OmniNode-ai/omnibase_core
scripts/ci/compute_golden.py
.py
9129725c0531f7a4
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Effect-golden readback oracle for EFFECT nodes (OMN-14358). The EFFECT analog of ``compute_golden``. An EFFECT node's "output" is not a return value — it is the SIDE EFFECT (a published event, a written file). This harness proves the DEC...
OmniNode-ai/omnibase_core
scripts/ci/effect_golden.py
.py
5a990f96e99e95a3
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Deterministic producer + byte-compare comparator for equivalence artifacts (OMN-14905). ``canonical_handler_shape.verify_equivalence_replay`` TRUSTS ``status == "pass"`` and never re-runs the replay it gates (blind spot E1). The first a...
OmniNode-ai/omnibase_core
scripts/ci/equivalence_producer.py
.py
08d11c249acc0656
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Append harvested shadow records to the ci-shadow-metrics NDJSON (OMN-14342). Stage 2 of the durable store: dedup-append the per-run ``shadow_record.json`` artifacts into the append-only ``shadow_metrics.ndjson`` on the ``ci-shadow-metric...
OmniNode-ai/omnibase_core
scripts/ci/shadow_metrics_append.py
.py
ce0aba167aa6b2fa
7.48
8
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc. # SPDX-License-Identifier: MIT """Reproduce the OMN-14342 premise-check number from merged dev-PR history. Replays the LIVE change-aware selector (``compute_selection``, forced ``feature_flag_enabled=True``) over a set of merged dev PRs and reports what fraction would es...
OmniNode-ai/omnibase_core
scripts/ci/shadow_premise_replay.py
.py
1e7550a1fdac38a1
7.48
8
import io import os import sys import json import base64 import requests import torch import numpy as np from PIL import Image from io import BytesIO from typing_extensions import override from comfy_api.latest import ComfyExtension, io from ..utils.image_utils import tensor_to_base64_string from ..utils.config_utils i...
ycyy/ComfyUI-YCYY-API
gemini/gemini_image_node.py
.py
64c8b547550fc8bf
7.52
10
import io import os import json import base64 import requests import torch import numpy as np from PIL import Image from io import BytesIO from typing_extensions import override from comfy_api.latest import ComfyExtension, io from ..utils.image_utils import tensor_to_base64_string # 公共函数,用于处理预设数据(带 mtime 缓存,文件变更自动重载) ...
ycyy/ComfyUI-YCYY-API
gemini/gemini_image_preset_node.py
.py
ba00c6f56511d24b
7.52
10
import os import json import time import requests import torch import numpy as np from PIL import Image from io import BytesIO from typing import Optional, Dict, List, Tuple from comfy_api.latest import ComfyExtension, io from ..utils.config_utils import get_config_section from ..utils.image_utils import pil_to_tensor ...
ycyy/ComfyUI-YCYY-API
modelscope/modelscope_image_node.py
.py
b9c69fc755e28414
7.52
10
import json import requests from typing_extensions import override from comfy_api.latest import ComfyExtension, io from ..utils.config_utils import get_config_section, get_models_list def _load_config_credentials(config_options=None): """ 从config.json中加载并验证API凭据,如果提供了config_options则优先使用 返回 (base_url, api_k...
ycyy/ComfyUI-YCYY-API
ollama/ollama_llm_node.py
.py
449124e81adcbcc9
7.52
10
import requests from typing_extensions import override from comfy_api.latest import ComfyExtension, io from ..utils.image_utils import tensor_to_base64_string from ..utils.config_utils import get_config_section,get_models_list def _load_config_credentials(config_options=None): """ 从config.json中加载并验证API凭据,如果提供...
ycyy/ComfyUI-YCYY-API
ollama/ollama_vlm_node.py
.py
d3991759dcad05af
7.52
10
import io import os import sys import json import base64 import requests import torch import numpy as np from PIL import Image from io import BytesIO from typing_extensions import override from comfy_api.latest import ComfyExtension, io from ..utils.image_utils import tensor_to_base64_string from ..utils.config_utils i...
ycyy/ComfyUI-YCYY-API
options/ollama_llm_advanced_options_node.py
.py
a2b10cc29c8fcea7
7.52
10
from comfy_api.latest import ComfyExtension, io class ProxyOptions(io.ComfyNode): """ 这个节点用于覆盖代理配置参数(enable、http、https) """ @classmethod def define_schema(cls) -> io.Schema: return io.Schema( node_id="YCYY_API_Proxy_Options", display_name="API Proxy Options", ...
ycyy/ComfyUI-YCYY-API
options/proxy_options_node.py
.py
d0126e43afb09a08
7.52
10
import av import torch def load_audio(filepath: str) -> tuple[torch.Tensor, int]: """ 从本地路径加载音频文件 Args: filepath: 音频文件路径 Returns: wav: 音频张量 sr: 采样率 """ with av.open(filepath) as af: if not af.streams.audio: raise ValueError("No audio stream found i...
ycyy/ComfyUI-YCYY-API
utils/audio_utils.py
.py
9010bb08aad58cd2
7.52
10
import json import os # 加载配置文件 def load_config(): """加载完整的config.json配置文件""" config_path = os.path.join(os.path.dirname(__file__), '..', "config.json") # 检查配置文件是否存在 if not os.path.exists(config_path): raise FileNotFoundError(f"Config file not found: {config_path}") try: with open(c...
ycyy/ComfyUI-YCYY-API
utils/config_utils.py
.py
b4c95cabe335aef7
7.52
10
import base64 import io import math import torch import numpy as np from PIL import Image def tensor_to_base64_string( image_tensor: torch.Tensor, total_pixels: int = 2048 * 2048, mime_type: str = "image/png", ) -> str: """Convert [B, H, W, C] or [H, W, C] tensor to a base64 string. Args: ...
ycyy/ComfyUI-YCYY-API
utils/image_utils.py
.py
7e58b3b20cec94cd
7.52
10
"""Shared request and media helpers for OpenAI-compatible nodes.""" import base64 import json from io import BytesIO from urllib.parse import urlsplit, urlunsplit import requests from .config_utils import get_config_section class ToolChoiceRejected(RuntimeError): """The provider explicitly rejected the request...
ycyy/ComfyUI-YCYY-API
utils/request_utils.py
.py
d0e6a706cd569ac6
7.52
10
"""The Navimow (Private) integration. Unofficial, community interoperability integration for Segway Navimow robot mowers, talking to the private mobile-app cloud (p:101). See README. """ from __future__ import annotations import logging import os import shutil from homeassistant.config_entries import ConfigEntry fro...
ilguala/navimow_pro
custom_components/navimow_pro/__init__.py
.py
611ae4f6107c733d
7.57
13
"""p:101 envelope crypto for the Segway Navimow private cloud. This is a FAITHFUL port of the proven working reference implementation (scratchpad/p101_client.py). The constants below are app-wide values shared by every user of the official app -- they are NOT user secrets. Do not "improve" the crypto: it matches the s...
ilguala/navimow_pro
custom_components/navimow_pro/api/crypto.py
.py
324b2975e5d7a5f5
7.57
13
"""Segway/Ninebot passport authentication (standalone, no phone/hooks). Faithful port of the proven reference (scratchpad/LOGIN_BIND_TEST.py and navimow_auth/scripts/passport_auth.py). sign = SHA256_hex_lower( sorted "k=v&..." join ) over the map {app_version, clientKey, os, os_language, os_version, ti...
ilguala/navimow_pro
custom_components/navimow_pro/api/passport.py
.py
63c40c70a84952d2
7.57
13
"""Calendar platform for Navimow (Private). Exposes the mower's weekly mowing schedule as a native HA calendar: each scheduled period becomes a (recurring-weekly) event with the target zone in the summary. The entity state is the NEXT upcoming mow, so you get "next cut + zone" for free, plus automations on calendar ev...
ilguala/navimow_pro
custom_components/navimow_pro/calendar.py
.py
73688a0df31748ce
7.57
13
"""Diagnostics for Navimow (Private). Adds the "Download diagnostics" button to the integration page. The point is to answer "why is X empty on my model?" without asking a non-technical owner to dig through logs: the dump carries what their mower actually reports, so an unfamiliar model can be supported from a single ...
ilguala/navimow_pro
custom_components/navimow_pro/diagnostics.py
.py
f12aaea5adf858ad
7.57
13
"""Shared base entity for Navimow (Private). Ties every entity to the single mower device (keyed by vehicle_sn) and to the coordinator's parsed snapshot. """ from __future__ import annotations from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.update_coordinator import Coordinator...
ilguala/navimow_pro
custom_components/navimow_pro/entity.py
.py
39c5c858083ad872
7.57
13
"""Lawn mower platform for Navimow (Private).""" from __future__ import annotations import logging from homeassistant.components.lawn_mower import ( LawnMowerActivity, LawnMowerEntity, LawnMowerEntityFeature, ) from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssista...
ilguala/navimow_pro
custom_components/navimow_pro/lawn_mower.py
.py
b5abdf8ef2203887
7.57
13
"""Number platform for Navimow (Private): percentage settings. Two MowerSettingBean percentages -- the return-to-dock battery threshold and the charge ceiling. Asymmetric encoding (captured live): * READ: the set-list reports them as a DECIMAL percentage (10 / 100). * WRITE: like every setting, sent on BOTH channels...
ilguala/navimow_pro
custom_components/navimow_pro/number.py
.py
773c0081e3f31cce
7.57
13
"""Select platform for Navimow (Private): choose which zone the mow button uses. Selecting an option only STORES the choice (on the coordinator); it does NOT start mowing. Pressing the lawn_mower "mow" button then mows the stored zone (or all zones). This is the classic select-then-mow flow. The available zone list i...
ilguala/navimow_pro
custom_components/navimow_pro/select.py
.py
335dfce3c1be6de8
7.57
13
"""Services for Navimow (Private). - ``navimow_pro.set_schedule`` writes one weekday's plan (enabled + one or more time periods, each optionally restricted to zones) via the proven save-set-data format. - ``navimow_pro.mow`` starts mowing now: chosen zones and a ``reset`` flag (True = riparti da zero / clear pro...
ilguala/navimow_pro
custom_components/navimow_pro/services.py
.py
5530838c9533f860
7.57
13
"""Portable request-authoring rules for MoonMind execution API clients. This module intentionally uses only the Python standard library. It is copied into resolved skill snapshots and must remain importable outside MoonMind. """ from __future__ import annotations import hashlib import json import re from typing imp...
MoonLadderStudios/MoonMind
.agents/skills/_shared/workflow_execution_client.py
.py
41e32466cdd7cc13
7.56
12
#!/usr/bin/env python3 """Shared contracts and retry policy helpers for pr-resolver scripts.""" from __future__ import annotations import os from datetime import UTC, datetime from typing import Any RESULT_SCHEMA_VERSION = 2 FULL_REMEDIATION_REASONS = { "actionable_comments", "ci_failures", "merge_confl...
MoonLadderStudios/MoonMind
.agents/skills/pr-resolver/bin/pr_resolve_contract.py
.py
e87e249b5efb8791
7.56
12
"""Resolve ``ExecutionPrincipal`` for ``POST /api/executions`` callers. Task-spawning callers identify themselves with trusted transport headers (``X-MoonMind-Task-Workflow-Id`` / ``X-MoonMind-Agent-Run-Id`` / ``X-MoonMind-Agent-Run-Identifier``). We refuse to honour those headers unless the executions service can co...
MoonLadderStudios/MoonMind
api_service/api/execution_principal.py
.py
853649fb705fb0ed
7.56
12
"""One-action OpenCode bootstrap API.""" from __future__ import annotations from typing import Any from fastapi import APIRouter, Depends, HTTPException from pydantic import BaseModel, Field from sqlalchemy.ext.asyncio import AsyncSession from api_service.auth_providers import get_current_user from api_service.db.b...
MoonLadderStudios/MoonMind
api_service/api/routers/omnigent_bootstrap.py
.py
e128bf77de9b3b34
7.56
12
"""Authorized operator session-timeline diagnostic API. Source: MoonLadderStudios/MoonMind#3708 ([Omnigent control plane 7/11]). Exposes one authorized, machine-readable diagnostic projection for a single canonical Omnigent session, derived entirely from durable control-plane records (canonical session, turn attempts...
MoonLadderStudios/MoonMind
api_service/api/routers/omnigent_session_timeline.py
.py
8d2db2d518d2f0bb
7.56
12
"""Binary sensor class for Heidelberg Energy Control.""" from __future__ import annotations from homeassistant.components.binary_sensor import BinarySensorEntity from ..classes.heidelberg_entity_base import HeidelbergEntityBase class HeidelbergBinarySensor(HeidelbergEntityBase, BinarySensorEntity): """Represen...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/classes/heidelberg_binary_sensor.py
.py
e64112e61208fedb
7.56
12
"""Heidelberg Entity Base class.""" from __future__ import annotations from typing import Any from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity from .. import HeidelbergEnergyControlConfigEntry from ..const import DATA_HW_VERSION, DAT...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/classes/heidelberg_entity_base.py
.py
26f4fe9078bb187d
7.56
12
"""HeidelbergNumber class for Heidelberg Energy Control.""" from __future__ import annotations from homeassistant.components.number import NumberEntity from ..classes.heidelberg_entity_base import HeidelbergEntityBase class HeidelbergNumber(HeidelbergEntityBase, NumberEntity): """Base class for Heidelberg hard...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/classes/heidelberg_number.py
.py
96baa6c37c2bbe09
7.56
12
"""Virtual number entity for Heidelberg Energy Control.""" from __future__ import annotations from homeassistant.components.number import NumberEntity from homeassistant.helpers.restore_state import RestoreEntity from ..classes.heidelberg_entity_base import HeidelbergEntityBase class HeidelbergNumberVirtual(Heidel...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/classes/heidelberg_number_virtual.py
.py
d4935273c001e445
7.56
12
"""Heidelberg Sensor class.""" from typing import Any from homeassistant.components.sensor import SensorEntity from .heidelberg_entity_base import HeidelbergEntityBase class HeidelbergSensor(HeidelbergEntityBase, SensorEntity): """Base class for standard Heidelberg sensors. Coordinator data holds raw wire ...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/classes/heidelberg_sensor.py
.py
c9c0e504e369b695
7.56
12
"""Heidelberg Sensor Active Phases class.""" from typing import Any from homeassistant.components.sensor import SensorEntity from .heidelberg_sensor import HeidelbergSensor class HeidelbergSensorActivePhases(HeidelbergSensor, SensorEntity): """Class for the active phases sensor with dynamic icon.""" @prop...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/classes/heidelberg_sensor_active_phases.py
.py
640c638c9e9f72c4
7.06
12
"""Heidelberg Sensor class.""" from typing import Any from homeassistant.components.sensor import SensorEntity from .heidelberg_entity_base import HeidelbergEntityBase class HeidelbergSensorCoordinator(HeidelbergEntityBase, SensorEntity): """Base class for coordinator data Heidelberg sensors.""" @property ...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/classes/heidelberg_sensor_coordinator.py
.py
3f1319de626309e9
7.56
12
"""Heidelberg Sensor Energy Base class.""" import logging from typing import Any from homeassistant.components.sensor import SensorEntity from homeassistant.helpers.restore_state import RestoreEntity from .heidelberg_entity_base import HeidelbergEntityBase _LOGGER = logging.getLogger(__name__) class HeidelbergSen...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/classes/heidelberg_sensor_energy_base.py
.py
c9656792e192d358
7.56
12
"""Hardware-backed session energy sensor (v2.0.0+).""" import logging from homeassistant.components.sensor import SensorEntity from homeassistant.helpers.restore_state import RestoreEntity from .heidelberg_entity_base import HeidelbergEntityBase _LOGGER = logging.getLogger(__name__) class HeidelbergSensorEnergyHw...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/classes/heidelberg_sensor_energy_hw_session.py
.py
5e6cd85a970ea7ca
7.56
12
"""Heidelberg Sensor Energy Session class.""" import logging from typing import Any from ..const import DATA_IS_PLUGGED, DATA_TOTAL_ENERGY from .heidelberg_sensor_energy_base import HeidelbergSensorEnergyBase _LOGGER = logging.getLogger(__name__) class HeidelbergSensorEnergySession(HeidelbergSensorEnergyBase): ...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/classes/heidelberg_sensor_energy_session.py
.py
60709599730e94fd
7.56
12
"""Heidelberg Sensor Energy Total class.""" import logging from .heidelberg_sensor_energy_base import HeidelbergSensorEnergyBase _LOGGER = logging.getLogger(__name__) class HeidelbergSensorEnergyTotal(HeidelbergSensorEnergyBase): """Total energy sensor that corrects hardware counter resets.""" @property ...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/classes/heidelberg_sensor_energy_total.py
.py
01f536db16760b08
7.56
12
"""Switch entity for Heidelberg Energy Control.""" from __future__ import annotations from typing import Any from homeassistant.components.switch import SwitchEntity from ..classes.heidelberg_entity_base import HeidelbergEntityBase class HeidelbergSwitch(HeidelbergEntityBase, SwitchEntity): """Generic represe...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/classes/heidelberg_switch.py
.py
d680e41068175edc
7.56
12
"""Virtual switch entity for Heidelberg Energy Control.""" from __future__ import annotations from typing import Any from homeassistant.components.switch import SwitchEntity from homeassistant.helpers.restore_state import RestoreEntity from ..classes.heidelberg_entity_base import HeidelbergEntityBase class Heidel...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/classes/heidelberg_switch_virtual.py
.py
cfa63217d33927a2
7.56
12
"""Coordinator for Heidelberg Energy Control integration.""" from __future__ import annotations from datetime import timedelta import logging from typing import Any from packaging import version from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_SCAN_INTERVAL from homeassistan...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/coordinator.py
.py
f019460ca47bba15
7.56
12
"""API for Heidelberg Energy Control wallbox via Modbus. Owns the Modbus client and connection lifecycle, then delegates all register access to a set of `Capability` modules. Each capability contributes static and polled data and declares the writes it owns; the API aggregates their results into the flat dicts the coo...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/core/api.py
.py
962e7a36f5744914
7.56
12
"""Capability base class. A capability owns a group of related Modbus registers (e.g. v1.0.x core data, MID power meter, phase switch). Each capability declares its register needs as immutable tuples of `RegisterDefinition`; the API collects definitions from every loaded capability and coalesces consecutive same-type ...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/core/capabilities/base.py
.py
029d1a34e65161c3
7.56
12
"""Hardware session-energy capability (v2.0.0+). The v1.0.x integration derived session energy from `DATA_TOTAL_ENERGY` deltas around the plug-in edge — it worked but reset detection lived on the HA side, so any restart or edge miss lost the session. Layout version 2.0.0 adds registers 19-20: a 32-bit "energy during ...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/core/capabilities/session_energy.py
.py
4b817caa52c7a315
7.56
12
"""Standby-mode capability (v1.0.8+). Owns holding register 258 (standby function control): value 0 enables the wallbox's built-in standby (default), value 4 disables it so the device stays awake and remains reachable over Modbus indefinitely. Landed with layout version 1.0.8, so the whole Amperfied connect-series li...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/core/capabilities/standby.py
.py
e7965b06ec75fb83
7.56
12
"""Watchdog + FailSafe capability (v1.0.8+). The wallbox measures time since the last successful Modbus transaction. If that exceeds the WatchDog Timeout (register 257, ms; 0 disables the watchdog, default 15000), the wallbox assumes Home Assistant is gone and overrides the target current (register 261) with the FailS...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/core/capabilities/watchdog.py
.py
d1aaf3f8ebcda43e
7.56
12
"""Register-block metadata used by capabilities to declare their reads. Capabilities describe the registers they need via `RegisterDefinition` tuples rather than issuing Modbus reads themselves. The API collects definitions from every loaded capability and coalesces consecutive same-type reads into single block transa...
Schrolli91/heidelberg_energy_control
custom_components/heidelberg_energy_control/core/registers.py
.py
03c5bda729d5e5b5
7.56
12
"""Shared fixtures for the Heidelberg Energy Control test suite.""" from __future__ import annotations import json from pathlib import Path from unittest.mock import AsyncMock, MagicMock import pytest FIXTURES_DIR = Path(__file__).parent / "fixtures" pytest_plugins = ["pytest_homeassistant_custom_component"] @...
Schrolli91/heidelberg_energy_control
tests/conftest.py
.py
58abff48ee8cdc7a
8.06
12
"""Characterization tests for the Modbus decoding layer. These tests pin today's wire-format contract: given a known set of raw register values, async_get_data() and async_get_static_data() must return exactly the dicts they return today. Any future refactor (capability modules, per-feature splits, etc.) must keep the...
Schrolli91/heidelberg_energy_control
tests/test_api_decoding.py
.py
c929701a4b2db9dc
8.06
12
"""Tests for the block-merging read path in HeidelbergEnergyControlAPI. Pins: - consecutive same-type register definitions merge into a single Modbus read - non-consecutive addresses become separate reads - different register types (input vs holding) never merge - duplicate definitions are deduplicated, not re...
Schrolli91/heidelberg_energy_control
tests/test_block_merging.py
.py
ba8d3a0249dd6062
7.06
12
"""Demonstrative tests for the dict-based capability decode contract. Under the definition-based Capability shape (added in this PR), a capability declares which registers it needs via class-level tuples of `RegisterDefinition`, and its `decode_polled` / `decode_static` methods are synchronous functions of a `{address...
Schrolli91/heidelberg_energy_control
tests/test_capability_decode.py
.py
3aeea8d3bb3a4484
8.06
12
"""Tests for symbolic command-write dispatch on the API. Under the capability contract, callers name commands by symbolic key (e.g. `COMMAND_TARGET_CURRENT`) rather than raw Modbus addresses. The API dispatches the write to whichever loaded capability claims the key; that capability translates the key to its owning re...
Schrolli91/heidelberg_energy_control
tests/test_command_write_dispatch.py
.py
12a6de8c920a4e68
8.06
12
"""Tests for the virtual enable / target current state machine. The coordinator runs bidirectional sync between two virtual entities (VIRTUAL_ENABLE switch + VIRTUAL_TARGET_CURRENT number) and hardware register 261. This logic is firmware-1.0.7-gated; on older firmware the coordinator returns raw API data unchanged an...
Schrolli91/heidelberg_energy_control
tests/test_coordinator_virtual.py
.py
f90a127f2a99ef8e
7.06
12
"""Tests for the virtual-enable gate on the coordinator. `is_supported()` is gone (replaced by capability-based gating on entity descriptions). The one version check that stayed on the coordinator is `supports_virtual_logic` — the virtual enable/target- current UI depends on register 261 semantics that landed in firmw...
Schrolli91/heidelberg_energy_control
tests/test_coordinator_virtual_gate.py
.py
5a1da5355490a430
8.06
12
"""Tests for MidMeterCapability (registers 3000..3012, v2.0.0+, hardware-optional). Three things to pin: 1. Version gate at 2.0.0. 2. Polled block declares 3001..3012 in one read (3000 is probe-only). 3. decode_polled maps every field to the right DATA_* key with the right unit conversion (deci-amps → A, wi...
Schrolli91/heidelberg_energy_control
tests/test_mid_meter_capability.py
.py
4a61665b0f38e078
8.06
12
"""Round-trip tests for read/write symmetry on number entities. Under the multiplier-symmetry contract: - capability decode returns raw wire values (deci-amps, ms) - number entity divides by multiplier on `native_value` (read) - number entity multiplies by multiplier on `async_set_native_value` (write) - senso...
Schrolli91/heidelberg_energy_control
tests/test_number_multiplier_symmetry.py
.py
7b26e777ee30ffd4
8.06
12
"""Regression tests for probing optional holding registers at setup. Issue #16 (upstream): the Amperfied connect-series reports layout version >= 1.0.8 but does not expose holding registers 257 (watchdog timeout) or 258 (standby control). Previously both capabilities loaded on any 1.0.8+ device, and the API's block-re...
Schrolli91/heidelberg_energy_control
tests/test_optional_capability_probe.py
.py
9a87b257d11fd922
8.06
12
"""Tests for StandbyCapability (register 258, v1.0.8+). Standby control lives on holding register 258: - value 0 = standby function ENABLED (device sleeps after 10 min idle) - value 4 = standby function DISABLED (device always awake) The switch entity is "on" when standby is enabled, matching the literal regist...
Schrolli91/heidelberg_energy_control
tests/test_standby_capability.py
.py
27514f6f82a6bacb
7.06
12
"""Repo-root pytest guard: one test root per session. This repository has several test roots, and each one needs the top-level names ``scripts`` / ``lib`` / ``tools`` to mean a DIFFERENT directory: * ``shared/tests`` -- pytest's prepend import mode puts ``<repo>/shared`` on ``sys.path`` (because ``shared/tests/__in...
svenroth-ai/shipwright
conftest.py
.py
945a44b5f422aa2c
8.06
12