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 |
|---|---|---|---|---|---|---|
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf005.py | .py | f00948936c637b4c | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf009.py | .py | 4fc5457e5cb6a6ab | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf011.py | .py | ea983cbd497881e9 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf015.py | .py | dc489bdf1be4c227 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf016.py | .py | 993b05a7575c1ab1 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf017.py | .py | 9fc5e403a34e0d87 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf018.py | .py | 5b9d7a414c68f52b | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf019.py | .py | 6814cb054a0f0952 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf020.py | .py | ff6622b5dc35cdbe | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf021.py | .py | 7179a8c2fe9e2af7 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf022.py | .py | 5f17ef86aabddec3 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf023.py | .py | 34c9045161ad4dd6 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf024.py | .py | 8356cdb5134331d9 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf025.py | .py | ef6512b98684eb85 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf026.py | .py | e01b0a8e1a40581e | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf028.py | .py | 78be84d982d82d69 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf029.py | .py | 770bc2223eb95e74 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf030.py | .py | 3b0fba53365a74a5 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf031.py | .py | 6a6c3471be7fa234 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf032.py | .py | e25918a543378100 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf034.py | .py | 7363dc31abb74ca6 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf038.py | .py | f33e9e2543e9b5c7 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf039.py | .py | 260ae5186fffd33a | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf040.py | .py | 375687cf59439ecb | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf041.py | .py | 488b40d83c469c72 | 7.42 | 6 |
# Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | huggingface/transformers-mlinter | mlinter/trf042.py | .py | 57167a6381a443a1 | 7.42 | 6 |
#!/usr/bin/env python3
"""Estimate camera-to-world from a captured tabletop AprilTag sequence."""
from __future__ import annotations
import argparse
import json
from pathlib import Path
from typing import Any
import numpy as np
DEFAULT_WORLD_T_TAG = np.asarray(
[
[0.0, -1.0, 0.0, 0.0],
[-1.0, 0... | Jianshu-Hu/real-exp | calibration/calibrate_camera_to_world.py | .py | 02c7c8beec58eca9 | 7.45 | 7 |
"""Pose calibration primitives for the future Quest teleoperation mapper."""
from __future__ import annotations
import math
from dataclasses import dataclass
from typing import Sequence
Vector3 = tuple[float, float, float]
Quaternion = tuple[float, float, float, float]
def _vector3(values: Sequence[float]) -> Vec... | Jianshu-Hu/real-exp | data_collection/meta_quest/calibration.py | .py | cbfc4a63cf2cbee9 | 7.45 | 7 |
"""Scoped Quest power-state control for an active pose stream."""
from __future__ import annotations
import subprocess
_PROX_CLOSE_ACTION = "com.oculus.vrpowermanager.prox_close"
_AUTOMATION_DISABLE_ACTION = "com.oculus.vrpowermanager.automation_disable"
class QuestKeepAwake:
"""Keep Quest awake only while fr... | Jianshu-Hu/real-exp | data_collection/meta_quest/power.py | .py | c62601254e6199c1 | 7.45 | 7 |
"""Temporal aggregation for overlapping absolute-timestep action chunks."""
from __future__ import annotations
from dataclasses import dataclass, field
import numpy as np
@dataclass
class TemporalProposalAggregator:
"""Keep raw proposals and recompute normalized generation-age weighting.
``decay`` is the ... | Jianshu-Hu/real-exp | deploy/action_aggregation.py | .py | 2287519e254b48c6 | 7.45 | 7 |
#!/usr/bin/env python3
"""Receive one-shot Wuji grasp targets and invoke the existing FR3 controller."""
from __future__ import annotations
import argparse
import collections
import subprocess
from pathlib import Path
from typing import Any
from grasp.common import validate_command
REPOSITORY_ROOT = Path(__file__)... | Jianshu-Hu/real-exp | grasp/control_server.py | .py | e0690da834e71dda | 7.45 | 7 |
# actions/batch_swipe.py
import json
import time
import os
from maa.custom_action import CustomAction
from maa.context import Context
class BatchSwipe(CustomAction):
"""
批量执行滑动/点击/等待操作,零识别开销。
坐标使用键名引用,需提前通过 load_coords() 加载坐标映射表。
参数格式(JSON 数组):
[
{"type": "swipe", "from": "种植物_初始化_第二个槽位", ... | Maa-Assistant-PVZ-The-best/MAAPVZ | agent/actions/batch_swipe.py | .py | 1feb422abec3ec78 | 7.63 | 17 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
下载Python依赖的脚本
"""
import sys
import subprocess
import argparse
from pathlib import Path
sys.stdout.reconfigure(encoding="utf-8") # type: ignore
def get_platform_tag(os, arch):
target = (os, arch)
match target:
case ("win", "x86_64"):
pl... | Maa-Assistant-PVZ-The-best/MAAPVZ | tools/ci/download_deps.py | .py | 7fdf8b5425e3bc88 | 7.63 | 17 |
import os
import sys
import shutil
import subprocess
from urllib.error import HTTPError, URLError
import urllib.request
import zipfile
import tarfile
import stat # 用于在 macOS/Linux 上设置文件权限
sys.stdout.reconfigure(encoding="utf-8") # type: ignore
print(os.getcwd())
# --- 配置 ---
# 可以根据需要修改这些值
PYTHON_VERSION_TARGET = "3.... | Maa-Assistant-PVZ-The-best/MAAPVZ | tools/ci/setup_embed_python.py | .py | 7b5930f3ca567d72 | 7.63 | 17 |
import sys
import io
# 修复 Windows 控制台编码
if sys.platform == "win32":
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
from pathlib import Path
import shutil
import sys
try:
import jsonc
except ModuleNotFoundError as e:
... | Maa-Assistant-PVZ-The-best/MAAPVZ | tools/install.py | .py | 645c1e6a640fd2ba | 7.63 | 17 |
"""
手势分类器
输入 21 个手部关键点,输出手势类型 + 置信度。
分为两类:
- 静态手势:OK、THUMBS_UP(单帧几何判断)
- 动态手势:WAVE(多帧轨迹分析)
"""
import math
import time
from collections import deque
from typing import Optional
from .config import (
OK_DISTANCE_RATIO,
OK_FINGER_EXTEND_RATIO,
THUMBS_UP_RATIO,
THUMBS_FINGER_CURL_RATIO,
WAVE_WINDOW_... | yuxinbeiyi/Lianxin-AI | VisionLab/app/features/gesture/gesture_classifier.py | .py | ee979655474d158a | 7.6 | 15 |
"""
手势事件数据类
独立于视觉检测和 UI,作为各模块之间的通信协议。
"""
from dataclasses import dataclass
from datetime import datetime
from typing import Optional
# 手势类型常量
GESTURE_NONE = "NONE"
GESTURE_OK = "OK"
GESTURE_THUMBS_UP = "THUMBS_UP"
GESTURE_WAVE = "WAVE"
# 所有已知手势
ALL_GESTURES = (GESTURE_NONE, GESTURE_OK, GESTURE_THUMBS_UP, GESTURE_W... | yuxinbeiyi/Lianxin-AI | VisionLab/app/features/gesture/gesture_event.py | .py | 211085e813ac376e | 7.6 | 15 |
"""
手势状态机
负责连续帧确认、去抖、冷却判断。
状态流转:
NO_GESTURE → CANDIDATE → CONFIRMED → TRIGGERED → COOLDOWN → READY → NO_GESTURE
注意:GestureState 只负责"确认手势"和"判断能否触发事件",
不负责分发事件(EventManager 负责)。
"""
import time
from dataclasses import dataclass
from typing import Optional
from .config import GESTURE_CONFIRM_FRAMES, GESTURE_COOLDOWN... | yuxinbeiyi/Lianxin-AI | VisionLab/app/features/gesture/gesture_state.py | .py | 5e652d9f95bcc6c4 | 7.6 | 15 |
"""
手部关键点检测器
封装 MediaPipe Hand Landmarker,输入图像输出 21 个关键点及左右手信息。
"""
import time
from pathlib import Path
from typing import Optional
import cv2
import mediapipe as mp
import numpy as np
from .config import (
MODEL_PATH,
MAX_NUM_HANDS,
MIN_HAND_DETECTION_CONFIDENCE,
MIN_HAND_PRESENCE_CONFIDENCE,
M... | yuxinbeiyi/Lianxin-AI | VisionLab/app/features/gesture/hand_detector.py | .py | ed01b3cc7a213988 | 7.6 | 15 |
# -*- coding: utf-8 -*-
"""
阿里云实时语音识别 - 官方 SDK 版(线程安全版本,使用 threading.Event)
"""
import time
import threading
import json
import sounddevice as sd
import numpy as np
import nls
from nls.token import getToken
from config import get_aliyun_stt_config
from utils.settings import get_settings
# ========== 录音参数 ==========
... | yuxinbeiyi/Lianxin-AI | aliyun_stt.py | .py | 75221d93aef5cc1e | 7.6 | 15 |
# -*- coding: utf-8 -*-
"""
AutoTaskManager — 自动化任务核心管理器
负责 CRUD、SQLite 持久化、调度计算、执行日志。
"""
import logging
from datetime import datetime
from typing import Optional, Callable
from utils.auto_task_data import AutoTask, ActionStep
from brain.task_store import TaskStore, get_task_store
logger = logging.getLogger("AutoTa... | yuxinbeiyi/Lianxin-AI | brain/auto_task_manager.py | .py | 90a8a1daaae93d12 | 7.6 | 15 |
# -*- coding: utf-8 -*-
"""
auto_task_parser.py — 自然语言 → 自动化任务解析器
使用 LLM 将用户的自然语言指令解析为 AutoTask 结构。
"""
import json
import re
import logging
import requests
from datetime import datetime, timedelta
from config import get_api_config
from utils.auto_task_data import AutoTask
logger = logging.getLogger("AutoTaskParser"... | yuxinbeiyi/Lianxin-AI | brain/auto_task_parser.py | .py | 5c9907352aef8e67 | 7.6 | 15 |
# -*- coding: utf-8 -*-
"""
AutoTaskScheduler — 自动化任务调度线程
以 QThread 方式运行,每 30 秒检查一次到期任务,通过信号通知主线程。
"""
import logging
from PyQt5.QtCore import QThread, pyqtSignal
from brain.auto_task_manager import get_auto_task_manager
from utils.auto_task_data import AutoTask
logger = logging.getLogger("AutoTaskScheduler")
clas... | yuxinbeiyi/Lianxin-AI | brain/auto_task_scheduler.py | .py | 5cb0ae32e6e8b227 | 7.6 | 15 |
"""
checklist_extractor.py — 对话结束后 LLM 自动提取待办事项
借鉴 NagaAgent DogTag: 回顾对话→提取[ADD_ITEM]/[DONE_ITEM]→集成到TodoManager
"""
import re
import logging
import threading
from typing import Optional
logger = logging.getLogger("ChecklistExtractor")
_EXTRACT_SYSTEM = """你是莲心AI的对话回顾助手。一段对话刚刚结束,请回顾内容,提取用户提到的事项。
你的任务:
1. 识别用户提到要做、... | yuxinbeiyi/Lianxin-AI | brain/checklist_extractor.py | .py | 2243ce1f561d4eb3 | 7.6 | 15 |
"""对话上下文窗口与工具输出压缩的纯函数基础设施。
本模块不调用模型、不读写数据库,也不持有全局会话状态。AgentCore 负责
生成摘要,HistoryManager 负责持久化快照;这里仅负责安全边界、降级摘要
和工具结果压缩,确保所有调用端使用同一套规则。
"""
from __future__ import annotations
from copy import deepcopy
from dataclasses import dataclass
from typing import Any
import re
DEFAULT_TOKEN_THRESHOLD = 80_000
DEFAULT_TOOL_RES... | yuxinbeiyi/Lianxin-AI | brain/context_compressor.py | .py | ca1eaa774817dd4d | 7.6 | 15 |
"""
Decision Layer:莲心AI 的三层架构决策引擎
判断用户消息走"纯聊天"还是"全 Agent(带工具)"路由。
路由模式:
- chat_only: 所有消息走纯聊天,禁用工具
- force_agent: 所有消息走全 Agent,强制工具
- auto (默认): 规则匹配判断意图
"""
import re
from typing import Literal
RouteMode = Literal["auto", "chat_only", "force_agent"]
# ── 命中这些模式的消息走 Agent(需要调用工具) ──────────────
_AGENT_PATTERNS =... | yuxinbeiyi/Lianxin-AI | brain/decision.py | .py | 0993aa35e8f1ad2a | 7.6 | 15 |
"""
事件检测模块 v2.0:分析用户交互态度,生成情感事件。
核心改变(v2.0):
- 只看态度,不看工具调用次数。工具调用是莲心的本职工作,不惩罚
- 冷命令检测:连续 3 条 < 8 字且无礼貌用语才触发(旧:任何工具调用都触发)
- 命令连击检测:连续 5 次以上才触发(旧:3 次)
- 新增:协作完成、被记得、用户情绪感知
- 删除了 light_command、boundary_tool_only、repetitive_task
- 所有 delta 值下调,增加情绪分量效应
"""
import re
import time
from .state import Event
# ── 事件类型定义(v2.0... | yuxinbeiyi/Lianxin-AI | brain/emotional/events.py | .py | 0eb3ebeb70dddf4b | 7.6 | 15 |
"""The reference server's canvas store — one durable folder per thread.
A thread's canvas lives at ``./canvas-data/<thread_id>/`` (head files +
described commit history). Both the agent tools and the human-save endpoint
write through this single store, which is what makes a hand edit visible to
the agent's next ``read... | braincrew-lab/langchain-canvas | apps/server/app/agent/store.py | .py | 645fb4530ae9b020 | 7.42 | 6 |
"""Example canvas-emitting tools.
These show the two core patterns:
* ``write_report`` streams a markdown document token-by-token into the canvas
(the ``open_document(...).append(...)`` fast-path).
* ``build_chart`` opens a chart and fills its rows in one shot (the ``patch``
path — the same call could be made rep... | braincrew-lab/langchain-canvas | apps/server/app/agent/tools.py | .py | 64a59dd3264310a9 | 7.42 | 6 |
"""Slide verification tools — mechanical layout check and visual screenshot.
Both render the saved head file in headless Chromium at the slide's fixed
1280x720 viewport. ``check_slide_layout`` reports mechanical problems
(overflow, clipped elements, broken images, large empty areas) as
ERROR/WARNING lines the agent ca... | braincrew-lab/langchain-canvas | apps/server/app/agent/verify.py | .py | 38431c261f7098d7 | 7.42 | 6 |
"""Canvas persistence endpoints — hydrate on load, save human edits, uploads.
- ``GET /api/canvas/{thread_id}``: replay the stored history as wire events so
a reloading client rebuilds the canvas (artifacts, snapshots, described
versions) exactly as it was.
- ``POST /api/canvas/{thread_id}/save``: persist a hand e... | braincrew-lab/langchain-canvas | apps/server/app/routes/canvas.py | .py | bfdc19c59e09f100 | 7.42 | 6 |
"""The chat endpoint — streams the Canvas Wire Protocol over SSE."""
from __future__ import annotations
from fastapi import APIRouter
from fastapi.responses import StreamingResponse
from pydantic import BaseModel, ConfigDict
from pydantic.alias_generators import to_camel
from langchain_canvas import sse_from_agent
... | braincrew-lab/langchain-canvas | apps/server/app/routes/chat.py | .py | 07cee025d55589c4 | 7.42 | 6 |
"""Document verification tool — mechanical checks for canvas report files.
``check_document`` renders a saved ``report/`` file in headless Chromium at
the document column width and reports problems as ERROR/WARNING lines the
agent can fix: horizontal overflow, external resources (documents must be
self-contained), mis... | braincrew-lab/langchain-canvas | examples/deepagents-canvas/doc_check.py | .py | 170f70dfcd1d5faf | 7.42 | 6 |
"""Store sidecar — the small server a direct LangGraph setup still needs.
Chat goes browser → LangGraph directly (the web app uses
``langgraphTransport``), so there is no translation middleman here. What
cannot move into the browser is access to the canvas store on disk:
- ``GET /api/canvas/{thread_id}`` — re... | braincrew-lab/langchain-canvas | examples/deepagents-canvas/store_server.py | .py | dd75f9c492ddb5d7 | 7.42 | 6 |
"""Canvas asset references — relative paths that point at files on the canvas.
The reference contract: inside canvas content, a relative path starting with
``assets/`` (files the agent brought in through ``write_canvas_asset``) or
``sources/`` (the user's uploads — read-only, so referencing beats copying)
points at a ... | braincrew-lab/langchain-canvas | packages/canvas-py/src/langchain_canvas/assets.py | .py | d92b594316eab6f4 | 7.42 | 6 |
"""Save-time checks for documents and pages (``.md`` / ``.txt`` / ``.html``).
One check, and it is the one that keeps costing users a visible defect: an
image reference pointing at a file the canvas does not have. The reader sees
a broken image where a photo should be, and nothing said so at save time —
the deck path ... | braincrew-lab/langchain-canvas | packages/canvas-py/src/langchain_canvas/document_lint.py | .py | 22d55d6a3c89ecfc | 7.42 | 6 |
"""Bridge a LangChain agent run to a Canvas Wire Protocol SSE stream.
The agent exposes two streams we care about, and we interleave them onto one
wire in arrival order:
* ``stream_mode="messages"`` -> assistant token chunks -> ``message.delta`` events.
* ``stream_mode="custom"`` -> whatever tools wrote via ``runti... | braincrew-lab/langchain-canvas | packages/canvas-py/src/langchain_canvas/streaming/sse.py | .py | 1939802294a40c79 | 7.42 | 6 |
"""Converging a table's two representations: ``rows`` and ``sheet``.
A table artifact carries the same data twice once a person has edited it:
the structured ``columns``/``rows`` (what agents read and write) and the
grid editor state ``data["sheet"]`` (what the person sees — values plus
formatting, merges and typed fo... | braincrew-lab/langchain-canvas | packages/canvas-py/src/langchain_canvas/table_merge.py | .py | 7739fa1ab2a62b8d | 7.42 | 6 |
"""Reading a table artifact as a map instead of a wall of JSON.
A ``.table.json`` file carries the table twice: ``columns``/``rows``, which
is what agents read and write, and ``data["sheet"]``, the grid editor state
a person sees — values plus formatting, merges and typed formulas. The
second one is enormous. A real f... | braincrew-lab/langchain-canvas | packages/canvas-py/src/langchain_canvas/table_outline.py | .py | 3cef31b4722f7c1b | 7.42 | 6 |
#!/usr/bin/env python3
"""build_bundle — regenerate dist/zero-slop-single-file.md from the sources.
ChatGPT Projects, Custom GPT Knowledge and Codex all want one pasteable file
rather than a repository, so the skill and its reference documents are
concatenated into a single artifact. Maintaining that by hand does not ... | manavmishra/ZeroSlop | scripts/build_bundle.py | .py | 0043fc921d6c2231 | 7.52 | 10 |
#!/usr/bin/env python3
"""check_svg — catch overflow in a hand-authored SVG before it ships.
A diagram is code, and it fails the same way code does: text wider than the box
that holds it, a connector routed through a shape it is not touching, a label
past the canvas edge. None of that is visible in the source, so meas... | manavmishra/ZeroSlop | scripts/check_svg.py | .py | d6910a12fb3b6bb0 | 7.52 | 10 |
#!/usr/bin/env python3
"""predictability — see how easily the AI assistant can guess the original wording.
The strongest signal that a machine wrote something is that a machine finds it
predictable: the words sit where a language model would have put them. Detectors
measure this with token log-probabilities, but Zero ... | manavmishra/ZeroSlop | scripts/predictability.py | .py | b011f21ba6bfddb4 | 7.52 | 10 |
#!/usr/bin/env python3
"""Small, stdlib-only primitives for durable and concurrency-safe state updates.
Zero Slop's scorer is read-only, but the learning and calibration tools perform
read-modify-write updates. Atomic replacement prevents torn JSON; lock directories
prevent two processes from silently overwriting each... | manavmishra/ZeroSlop | scripts/safeio.py | .py | 1cbc95a6a26ed1c2 | 7.52 | 10 |
#!/usr/bin/env python3
"""
Skill Initializer - Creates a new skill from template
Usage:
init_skill.py <skill-name> --path <path>
Examples:
init_skill.py my-new-skill --path skills/public
init_skill.py my-api-helper --path skills/private
init_skill.py custom-skill --path /custom/location
"""
import sy... | azents/azents | .claude/skills/skill-creator/scripts/init_skill.py | .py | d1f485011eb930df | 7.45 | 7 |
#!/usr/bin/env python3
"""
Skill Packager - Creates a distributable .skill file of a skill folder
Usage:
python utils/package_skill.py <path/to/skill-folder> [output-directory]
Example:
python utils/package_skill.py skills/public/my-skill
python utils/package_skill.py skills/public/my-skill ./dist
"""
im... | azents/azents | .claude/skills/skill-creator/scripts/package_skill.py | .py | bcf8ed652000a676 | 7.45 | 7 |
"""Admin surface Helm render contract tests."""
import shutil
import subprocess
from pathlib import Path
import pytest
CHART_DIR = Path(__file__).resolve().parents[1]
def _helm_template(*values: str) -> str:
"""Run helm template or skip when helm is unavailable."""
helm = shutil.which("helm")
if helm i... | azents/azents | infra/charts/azents/tests/admin_surface_render_test.py | .py | 3ecc2518409320dc | 7.95 | 7 |
"""External Channel Gateway Helm render contract tests."""
from scheduler_render_test import _helm_template
def test_external_channel_gateway_renders_by_default() -> None:
"""Every server deployment includes the persistent provider ingress role."""
rendered = _helm_template()
assert "name: external-chan... | azents/azents | infra/charts/azents/tests/external_channel_gateway_render_test.py | .py | 56f0a4a8503174ac | 7.95 | 7 |
"""Scheduler Helm render contract tests."""
import shutil
import subprocess
from pathlib import Path
import pytest
CHART_DIR = Path(__file__).resolve().parents[1]
def _helm_template(*values: str) -> str:
"""Run helm template or skip when helm is unavailable."""
helm = shutil.which("helm")
if helm is No... | azents/azents | infra/charts/azents/tests/scheduler_render_test.py | .py | 1deeba3fcea86f8a | 7.95 | 7 |
"""Docker API boundary for the Docker Provider."""
import dataclasses
from collections.abc import Mapping, Sequence
from typing import Protocol
@dataclasses.dataclass(frozen=True)
class DockerBindMount:
"""Host directory bind mounted into a Runtime container."""
host_path: str
container_path: str
re... | azents/azents | python/apps/azents-runtime-provider-docker/src/azents_runtime_provider_docker/docker_api.py | .py | c0d2c75bb24b8078 | 7.45 | 7 |
"""Deterministic Kubernetes ownership metadata and safe comparison views."""
import dataclasses
import enum
import hashlib
import re
from collections.abc import Mapping
from azents_runtime_provider_kubernetes.kubernetes_api import (
ConfigMapResource,
ObjectMeta,
SecretResource,
ServiceResource,
)
LA... | azents/azents | python/apps/azents-runtime-provider-kubernetes/src/azents_runtime_provider_kubernetes/owned_resources.py | .py | 16d0b8b7771bc09b | 7.45 | 7 |
"""Asset Manager — Versioned storage and retrieval for generated assets.
Manages generated images and videos with metadata indexing,
versioning, expiration cleanup, and division-scoped queries.
"""
from __future__ import annotations
import json
import logging
import time
import uuid
from dataclasses import... | Mubder/kazma | examples/almuhalab_custom_skills/asset_generation/asset_manager.py | .py | a91e87a7ea492ef7 | 7.42 | 6 |
"""Image Generation Pipeline — Division-branded image creation.
Generates logos, marketing materials, and inspection visuals
that strictly adhere to ALMuhalab division branding guidelines.
Supports multiple backends (local diffusion, API-based).
"""
from __future__ import annotations
import hashlib
import lo... | Mubder/kazma | examples/almuhalab_custom_skills/asset_generation/image_generator.py | .py | 709c729d3b53f929 | 7.42 | 6 |
"""Video Summary Generator — Branded video generation from drone footage and reports.
Generates inspection summary videos and market update videos with
division branding, detection overlays, GPS maps, and optional
Kuwaiti Arabic narration.
"""
from __future__ import annotations
import logging
import time
im... | Mubder/kazma | examples/almuhalab_custom_skills/asset_generation/video_generator.py | .py | d86899aa75a58fbb | 7.42 | 6 |
"""Brand Guidelines Engine — ALMuhalab division branding definitions.
Defines color palettes, typography, logo elements, imagery styles,
and taglines for Gas & Oil Trading, Tourism, and General Trading divisions.
Provides prompt prefix generation for diffusion-based image generation.
"""
from __future__ import a... | Mubder/kazma | examples/almuhalab_custom_skills/branding/almuhalab_guidelines.py | .py | 5763b84a9333f14b | 7.42 | 6 |
"""Drone Fleet Manager for FPV inspection operations.
Manages multiple FPV drones, their telemetry streams,
inspection missions, and emergency landing protocols.
"""
from __future__ import annotations
import logging
import uuid
from collections.abc import Callable
from dataclasses import dataclass, field
... | Mubder/kazma | examples/almuhalab_custom_skills/drone_inspection/fleet_manager.py | .py | fe74c0b5547de1a1 | 7.92 | 6 |
"""Inspection Report Generator for Gas & Oil drone inspections.
Generates visual inspection reports from YOLO detection results
with annotated images, GPS coordinates, and Kuwaiti Arabic recommendations.
"""
from __future__ import annotations
import logging
from dataclasses import dataclass
from datetime i... | Mubder/kazma | examples/almuhalab_custom_skills/drone_inspection/inspection_report.py | .py | c0a5b6e99f806534 | 7.92 | 6 |
"""Drone Telemetry Ingestion Engine for FPV drone data streams.
Streams and parses FPV drone telemetry data from MQTT or other sources.
Feeds the Gas & Oil Trading division's asset inspection workflows.
"""
from __future__ import annotations
import asyncio
import json
import logging
from collections impor... | Mubder/kazma | examples/almuhalab_custom_skills/drone_inspection/telemetry.py | .py | 3b082d8a20ea8ad3 | 7.92 | 6 |
"""YOLOv11 Detection Pipeline for Gas & Oil inspection targets.
Provides real-time object detection on FPV drone video frames
using YOLOv11 with domain-specific inspection targets.
"""
from __future__ import annotations
import asyncio
import logging
import os
import time
from collections.abc import Async... | Mubder/kazma | examples/almuhalab_custom_skills/drone_inspection/yolo_detector.py | .py | cb8d74604f1c3561 | 7.92 | 6 |
"""Tests for MarketDataIngestor."""
from __future__ import annotations
import time
import pytest
from almuhalab_custom_skills.trading_intel.market_data import (
GoldPrice,
MarketDataIngestor,
MarketIndex,
MarketIndices,
MarketSource,
OilPrice,
)
class TestMarketIndexModel... | Mubder/kazma | examples/almuhalab_custom_skills/tests/test_market_data.py | .py | 94a074c9e3308ac6 | 7.92 | 6 |
"""Autonomous Intelligence Loop — Continuously generates trading intel.
Runs as an async background loop with configurable interval. Integrates
market data ingestion, trade correlation, and report generation with
cost breaker circuit protection.
"""
from __future__ import annotations
import asyncio
import lo... | Mubder/kazma | examples/almuhalab_custom_skills/trading_intel/intelligence_loop.py | .py | 6e6d210bf9c94281 | 7.42 | 6 |
from pathlib import Path
import click
def _load_dotenv():
import os
# Check cwd first (pip-installed users), then package root (dev installs)
candidates = [
Path.cwd() / ".env",
Path(__file__).resolve().parent.parent / ".env",
]
env_path = next((p for p in candidates if p.exists(... | mnvsk97/voice-audition | cli/main.py | .py | a4d8e9f6ea1fb033 | 7.45 | 7 |
from __future__ import annotations
import os
import re
from pathlib import Path
import yaml
CONFIG_FILENAME = "enrichment.yaml"
_ENV_VAR_RE = re.compile(r"\$\{([^}]+)\}")
def _resolve_env(value):
"""Recursively resolve ${ENV_VAR} references in config values."""
if isinstance(value, str):
def replac... | mnvsk97/voice-audition | enrichment/config.py | .py | 1229037c58d18249 | 7.45 | 7 |
"""Mappers for converting Music Assistant objects to MSX models."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Any
from urllib.parse import quote
from music_assistant_models.errors import MusicAssistantError
from .models import MsxContent, MsxItem, MsxTemplate
if TYPE_CHECK... | trudenboy/ma-provider-msx-bridge | provider/mappers.py | .py | 79ebb01d5b5aec4e | 7.45 | 7 |
"""Pydantic models for MSX JSON API."""
from __future__ import annotations
from enum import StrEnum
from pydantic import BaseModel, Field
class MsxTemplateType(StrEnum):
"""MSX Template types."""
SEPARATE = "separate"
LIST = "list"
class MsxTemplate(BaseModel):
"""MSX Template model."""
typ... | trudenboy/ma-provider-msx-bridge | provider/models.py | .py | 9d0d460e1eecb04f | 7.45 | 7 |
"""Party plugin adapter: QR, cover stamp, SSRF allowlist."""
from __future__ import annotations
import asyncio
import functools
import hashlib
import io
import logging
import time
from typing import TYPE_CHECKING, Any, NamedTuple, cast
from urllib.parse import quote, urlsplit
import aiohttp
from aiohttp import web
f... | trudenboy/ma-provider-msx-bridge | provider/party.py | .py | 74523e2a0f43f64c | 7.45 | 7 |
"""Queue ↔ MSX native playlist handshake."""
from __future__ import annotations
import asyncio
import logging
from dataclasses import dataclass
from types import SimpleNamespace
from typing import TYPE_CHECKING, Any
from music_assistant_models.errors import InvalidProviderURI
from music_assistant.helpers.uri import... | trudenboy/ma-provider-msx-bridge | provider/queue_handshake.py | .py | 0308368058513cf0 | 7.45 | 7 |
"""Fixtures for testing the MSX Bridge Provider."""
from __future__ import annotations
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
from typing import Any
from unittest.mock import AsyncMock, Mock
import pytest
from aiohttp.test_utils import TestClient, TestServer
from music_... | trudenboy/ma-provider-msx-bridge | tests/conftest.py | .py | 0e71f3a9a6fd9b3c | 7.95 | 7 |
"""Tests for the MSX Bridge Provider entry point."""
from __future__ import annotations
from typing import Any
from unittest.mock import Mock
from music_assistant_models.enums import ConfigEntryType, PlayerFeature, ProviderFeature
from music_assistant.providers.msx_bridge import setup
from music_assistant.providers... | trudenboy/ma-provider-msx-bridge | tests/test_init.py | .py | 01151412f13c86bb | 7.95 | 7 |
"""Tests for MSX mappers."""
from __future__ import annotations
from unittest.mock import AsyncMock, MagicMock
import pytest
from music_assistant_models.errors import MediaNotFoundError
from music_assistant_models.media_items import Album, Track
from music_assistant.providers.msx_bridge.mappers import (
get_alb... | trudenboy/ma-provider-msx-bridge | tests/test_mappers.py | .py | 0b88c2ae1e53c302 | 7.95 | 7 |
"""Tests for MSX Pydantic models."""
from music_assistant.providers.msx_bridge.models import MsxContent, MsxItem, MsxTemplate
def test_msx_template_serialization() -> None:
"""Test MsxTemplate serialization with aliases."""
template = MsxTemplate(type="separate", layout="0,0,2,4", image_filler="default")
... | trudenboy/ma-provider-msx-bridge | tests/test_models.py | .py | 1b07182e6be66e3d | 7.95 | 7 |
"""API client for HYMER Connect."""
from __future__ import annotations
import logging
from typing import Any
from urllib.parse import quote
import aiohttp
from .const import (
API_BASE_URL,
API_BASE_URL_APPCOMM,
API_BASE_URL_SCC,
APP_VERSION,
AUTH_GRANT_TYPE_PASSWORD,
AUTH_GRANT_TYPE_REFRESH... | BetaHydri/hymer-connect-ha-ble | custom_components/hymer_connect/api.py | .py | 7680eda82397ec13 | 7.48 | 8 |
"""Cover platform for HYMER Connect — moving components (e.g. the power awning).
Cover definitions live entirely in the brand overlay JSON under the top-level
``"covers"`` section, so adding a new moving component is a JSON-only change.
Each entry maps the open/close/stop/position write slots and the readback
sensors ... | BetaHydri/hymer-connect-ha-ble | custom_components/hymer_connect/cover.py | .py | 8007a517513e6581 | 7.48 | 8 |
"""Device tracker platform for HYMER Connect."""
from __future__ import annotations
import logging
from homeassistant.components.device_tracker import SourceType, TrackerEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform... | BetaHydri/hymer-connect-ha-ble | custom_components/hymer_connect/device_tracker.py | .py | 4205b6252a09a90a | 7.48 | 8 |
"""Light platform for HYMER Connect — controllable interior lights.
Light definitions are loaded from JSON ``"lights"`` sections in
``sensor_maps/base.json`` + ``{brand}.json``. Each entry is keyed by
bus_id and declares capabilities (brightness, color_temp). The SCU
convention is: sid 1 = on/off (bool), sid 2 = bri... | BetaHydri/hymer-connect-ha-ble | custom_components/hymer_connect/light.py | .py | 48c3b63e5d4723ef | 7.48 | 8 |
"""Number platform for HYMER Connect — writable float slots (e.g. Alde setpoint).
Bus/slot IDs and ranges are loaded from the JSON ``"climate"."numbers"``
subsection in the brand overlay file. Each entry drives one writable numeric
slot; the value is written to the SCU as a 32-bit float via the multi-sensor
command p... | BetaHydri/hymer-connect-ha-ble | custom_components/hymer_connect/number.py | .py | b1abea1b8539b982 | 7.48 | 8 |
"""Golden-vector regression test for the getPairedMobileDevices decoder.
The fixture is a real ``getPairedMobileDevices`` reply from a 7-entry pairing
table on a HYMER B-ML I 780 (SCU ASW 1.49.7), contributed by @stbcgn in
issue #26 as a follow-up to #25. The seven MACs and the two account UUIDs were
redacted with **s... | BetaHydri/hymer-connect-ha-ble | tests/test_decode_mobile_devices.py | .py | 575a99c886061669 | 7.98 | 8 |
"""Offline smoke-test for auto-slot {n} template expansion.
Loads the real hymer.json overlay (which uses the "{n}" template form) and
verifies:
1. Buses 70/71/73/74 are registered as auto-slot groups.
2. No ENTITY_DEFS key contains a literal "{n}" placeholder (no ghosts).
3. A synthetic bus-70 PIA frame carryin... | BetaHydri/hymer-connect-ha-ble | tools/_test_auto_slot_n.py | .py | d52a304fe9a653fe | 7.98 | 8 |
"""Offline byte-level test for the opt-in BLE write path (field-1 rewrap).
Mirrors dan-simms1/hymer-connect-ha ``tests/test_token_tool_ble_writes.py``
(CloudEncodingAgreementTests). It proves the exact fix for the v2.62.24
"BLE writes silently dropped" bug:
* ``build_light_command`` (the proven cloud encoder) wraps... | BetaHydri/hymer-connect-ha-ble | tools/_test_ble_write_frame.py | .py | 124335e5a7776112 | 7.98 | 8 |
"""Collision lint: canonicity guardrail for the brandless base.json goal.
Two invariants that must hold before components can be merged into the
universal ``base.json`` (the no-brand-picker end-state):
A. Cross-file key consistency - the same ``bus,slot`` must never be defined
with a DIFFERENT ``name`` in two ... | BetaHydri/hymer-connect-ha-ble | tools/_test_collision_lint.py | .py | 9eef83f52ea6d97b | 7.98 | 8 |
"""Completeness lint: every mapped *optional appliance* entity must be gated.
Rationale (see docs/ehg-app-metadata.md): the EHG SCU exposes each appliance as
a fixed component bound to a fixed bus. Almost every appliance category has
several mutually-exclusive hardware variants (9 fridges, ~8 heaters, ~8 ACs,
3 BMS, 4... | BetaHydri/hymer-connect-ha-ble | tools/_test_gating_completeness.py | .py | acf9e0550a8a65bf | 7.98 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.