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 |
|---|---|---|---|---|---|---|
"""
logger.py - 框架统一日志模块
功能:配置按天滚动的日志文件与控制台输出
支持 Web 界面临时调整日志级别
"""
import logging
import logging.handlers
import threading
from datetime import datetime
from pathlib import Path
from core.config_loader import LOG_DIR, get_core_config, get_user_config
_logger = None
_file_handler = None
_console_handler = None
_leve... | test-qq-mail-bot/NetCore_Framework | core/logger.py | .py | 8e2231a0e29ac206 | 7 | 0 |
"""
notify.py - 通知管理模块
功能:统一管理邮件、企业微信、钉钉、飞书等通知渠道
提供统一发送 API、Go template 消息模板渲染、发送频率限制
敏感字段(密码、Webhook URL、加签密钥)加密存储
"""
import base64
import hashlib
import hmac
import smtplib
import threading
import urllib.parse
from datetime import datetime, timezone
from email.mime.text import MIMEText
import httpx
from core.audi... | test-qq-mail-bot/NetCore_Framework | core/notify.py | .py | 4aeaf968abf8056f | 7 | 0 |
"""
plugin_manager.py - 插件管理器
功能:扫描、加载、热重启插件,单插件失败不影响主框架(故障隔离)
"""
import importlib
import threading
from pathlib import Path
from typing import Dict, List
import yaml
from core.config_loader import PLUGINS_DIR, get_user_config
from core.logger import get_logger
from plugins.base_plugin import BasePlugin
logger = g... | test-qq-mail-bot/NetCore_Framework | core/plugin_manager.py | .py | 444266d1899dbea5 | 7 | 0 |
"""
security.py - 安全模块
功能:IP 黑白名单校验、登录失败策略与自动封禁
设计依据(项目书 §9.1):检查顺序 白名单 → 黑名单(404) → 正常登录。
- 白名单:受信任 IP(如管理员来源 IP),**放行且不参与失败锁定策略**,
并非「仅白名单可访问」的防火墙模式。这样既避免管理员因多次输错密码被锁,
也不会误伤其他正常用户的访问。
- 黑名单:命中且在封禁期内(含手动永久封禁)则拒绝访问(返回 404 以隐藏存在)。
- 每个条目均可携带说明(note)与有效期(expires_at),过期条目自动失效。
"""
import ipaddress
import threading
i... | test-qq-mail-bot/NetCore_Framework | core/security.py | .py | 177bb104790ca42a | 7 | 0 |
"""
session.py - 会话超时管理模块
功能:基于「空闲时长」的会话超时控制。
生命周期:
1. 登录成功后 api.auth_login 调用 create() 登记 token;
2. 之后每个受保护接口都会经过 auth.get_current_user,由它调用 touch()
判定是否超时并顺带续期(前端心跳 /api/auth/heartbeat 也走这条路径);
——注意续期主要靠 touch(),reset() 只是给 /api/system/session/reset 用的显式重置;
3. 空闲超过 user_config.yaml 的 system.auto_log... | test-qq-mail-bot/NetCore_Framework | core/session.py | .py | e07c067e371d0cf9 | 7 | 0 |
"""
core/timeutil.py - 统一时间基准工具
背景与规范
----------
框架约定:**所有落库的时间戳一律以 UTC 存储**(与 SQLite 的
``DEFAULT (datetime('now'))`` 保持一致,该函数返回的就是 UTC),
前端统一通过 ``window.NC.fmtTime()`` 按「系统设置 → 时区」换算成本地时间展示。
此前插件层大量使用 ``datetime.now``(本地时间)写库,与上述约定冲突,
导致两类可见错误:
* 任务管理「上次/下次执行」:库里存的是本地时间,前端又按 UTC 加 8 小时,
显示时间比真实执行时间**快 8 小时**;
* 网... | test-qq-mail-bot/NetCore_Framework | core/timeutil.py | .py | 62fa54b39db42a02 | 7 | 0 |
"""
base_plugin.py - 插件抽象基类
功能:定义所有插件必须实现的接口
框架通过标准接口与插件通信,插件内部错误由框架捕获
"""
from abc import ABC, abstractmethod
from typing import Dict, List, Optional
from fastapi import APIRouter
class BasePlugin(ABC):
"""插件基类,所有业务插件需继承并实现抽象方法"""
def __init__(self, name: str, config: dict = None):
self.name = nam... | test-qq-mail-bot/NetCore_Framework | plugins/base_plugin.py | .py | 042ed4299e22edf7 | 7 | 0 |
"""
plugins/wiki_docs/plugin.py - 内置文档插件
功能:将框架内置 wiki/ 文档通过 API 暴露给前端,
并在左侧菜单注册“使用文档”入口
"""
import urllib.parse
from pathlib import Path
from typing import Dict, List, Optional
from fastapi import APIRouter, Depends
from fastapi.responses import PlainTextResponse
from core.auth import get_current_user
from core.con... | test-qq-mail-bot/NetCore_Framework | plugins/wiki_docs/plugin.py | .py | 9c6c36387cb4e764 | 7 | 0 |
"""tests/unit/test_crypto.py - AES-GCM 往返 + PBKDF2 已知向量回归"""
import base64
import os
def test_aesgcm_roundtrip(isolated_env):
from core.crypto_utils import CryptoUtils
key = CryptoUtils.generate_key()
cipher = CryptoUtils.encrypt("hello-NetCore", key)
assert cipher and cipher != "hello-NetCore"
pl... | test-qq-mail-bot/NetCore_Framework | tests/unit/test_crypto.py | .py | cf81a5d7d00f4d51 | 7.5 | 0 |
"""tests/unit/test_password_reset.py - password_plain 改密链路回归(审查需求)
验证:
1. 默认生成的 user_config.yaml 不含 password_plain 行(不再无条件输出空行);
2. 用户手动添加 auth.password_plain 后,重启触发 _check_password_reset:
- password_hash 更新为新密码的 PBKDF2-SHA256 哈希;
- password_plain 从内存与文件中自动删除;
- TOTP 一并重置;
- 进程退出(SystemExit)。
"""
import py... | test-qq-mail-bot/NetCore_Framework | tests/unit/test_password_reset.py | .py | 5446335f53eb3a60 | 7.5 | 0 |
"""tests/unit/test_security.py - 安全策略回归:白名单/黑名单/失败计数原子自增"""
import os
def test_loopback_whitelist_initialized(isolated_env):
"""审查报告需求1:初始化时回环 127.0.0.1 / ::1 应自动写入白名单且永久有效。"""
import core.config_loader as cl
cl.bootstrap()
sec = cl.get_security_config()
wl = sec.get("whitelist", [])
ips = [w.... | test-qq-mail-bot/NetCore_Framework | tests/unit/test_security.py | .py | d5a9fa927be910ea | 7.5 | 0 |
"""
wiki/plugin_template/plugin.py - 空白插件模板
功能:供开发者复制使用的插件骨架,含完整中文注释
实现 BasePlugin 的四个抽象方法即可被框架加载
"""
from typing import Dict, List, Optional
from fastapi import APIRouter
from plugins.base_plugin import BasePlugin
class TemplatePlugin(BasePlugin):
"""插件模板:演示如何实现一个最小可用插件"""
def get_metadata(self) -> Dict[... | test-qq-mail-bot/NetCore_Framework | wiki/plugin_template/plugin.py | .py | 58c97d3dfe8bca0b | 7 | 0 |
"""Central config. Loads env vars once; every other file imports `settings` from here."""
import os
from dataclasses import dataclass, field
from pathlib import Path
from dotenv import load_dotenv
load_dotenv()
BASE_DIR = Path(__file__).resolve().parent
def _get_bool(key: str, default: bool) -> bool:
val = os... | veersthr/CareerCoachAgent | config.py | .py | dd542d1a1575a6e4 | 7 | 0 |
"""Local skill canonicalization — no ML deps, stdlib only.
Matches raw JD skill strings against taxonomy.py's ~60 canonical skills in two
passes:
1. Exact match (case-insensitive) against each skill's name/aliases via
taxonomy.ALIAS_TO_CANONICAL — covers the common case where the JD uses a
known alias verb... | veersthr/CareerCoachAgent | embeddings.py | .py | df8a72dfee17ccd3 | 7 | 0 |
"""LangGraph pipeline definition — wires the 5 agents into a StateGraph with
one conditional retry loop, checkpointed via SqliteSaver.
Extractor -> Role Strategist -> Scheduler -> Enabler -> Validator ->
(pass -> END) / (fail, retry_count < settings.max_retries -> Extractor)
The retry cap itself lives in agent_vali... | veersthr/CareerCoachAgent | graph.py | .py | bc9913aeba4843be | 7 | 0 |
"""Provider-agnostic LLM wrapper. Every LLM call in the pipeline goes through
call_llm_json() so swapping providers is a single env var (LLM_PROVIDER) and all
JSON-forcing/parsing/retry logic lives in exactly one place.
"""
import json
import re
from abc import ABC, abstractmethod
from typing import Optional, Type, Ty... | veersthr/CareerCoachAgent | llm_client.py | .py | a1408e4903fd04b6 | 7 | 0 |
"""JD PDF ingestion. Extracts text via PyMuPDF's text layer; any page that
yields too little text is assumed to be a scanned image and is OCR'd via
Tesseract instead. Used by api.py's POST /roadmap/pdf endpoint.
"""
from typing import Union
from config import settings
class PDFParseError(Exception):
"""Raised w... | veersthr/CareerCoachAgent | pdf_parser.py | .py | 1f11c60c4bd97dad | 7 | 0 |
"""Persistent user settings for the AI advisor, stored in ~/.fth/config.json.
Resolution order everywhere: defaults <- this file <- environment variables.
Override the file location with FTH_CONFIG (used by tests).
"""
from __future__ import annotations
import json
import os
from pathlib import Path
_FIELDS = ("key... | molotovah/Forza-Telemetry-Helper | src/fth/config.py | .py | 96dc38b677d8c520 | 7 | 0 |
"""Parser and UDP listener for the Forza Horizon 6 "Data Out" telemetry stream.
Protocol reference (official):
https://support.forza.net/hc/en-us/articles/51744149102611-Forza-Horizon-6-Data-Out-Documentation
One-way UDP traffic: a fixed 324-byte packet is sent to the configured
IP/port at the game's frame rate while... | molotovah/Forza-Telemetry-Helper | src/fth/ingest.py | .py | 12a2e2746dfe4ff5 | 7 | 0 |
"""Session recording (CSV) and feature extraction.
A "session" is any iterable of TelemetryPacket captured while driving.
Metrics follow the official field semantics: |tire_combined_slip| > 1.0
means grip loss; normalized suspension travel 0 = max stretch, 1 = max
compression; inputs are 0-255.
"""
from __future__ im... | molotovah/Forza-Telemetry-Helper | src/fth/session.py | .py | 3caae4b5623a56d6 | 7 | 0 |
#!/usr/bin/env python3
"""格式诊断模块 v2 - 修复列表项误报"""
import re
import sys
from collections import defaultdict
from docx import Document
from docx.shared import Pt
from docx.enum.text import WD_ALIGN_PARAGRAPH
# 不需要首行缩进的模式(只有主标题不需要缩进)
NO_INDENT_PATTERNS = [
r'^附件[::]', # 附件:
r'^联系人[::]', ... | KaguraNanaga/document-format-skills | scripts/analyzer.py | .py | ec5467e78c2631fc | 8 | 219 |
import os
import time
import tempfile
from pathlib import Path
def _ensure_windows():
if os.name != 'nt':
raise RuntimeError("当前系统不支持 COM 转换,请在 Windows 上运行")
def _safe_quit(app):
"""安全退出 COM 应用,兼容 Word 和 WPS"""
if app is None:
return
try:
app.Quit()
except Exception:
... | KaguraNanaga/document-format-skills | scripts/converter.py | .py | 386fca82b5501ec9 | 7 | 219 |
#!/usr/bin/env python3
"""行距统一工具 - 修复段落行距不一致"""
import sys
from docx import Document
from docx.shared import Pt
def fix_line_spacing(input_path, output_path):
"""统一段落行距"""
print(f"Reading: {input_path}")
doc = Document(input_path)
# 公文标准行距:28pt固定值(约355600 twips)
target_spacing = 355600 # 28pt i... | KaguraNanaga/document-format-skills | scripts/fix_spacing.py | .py | 39c2e414e42b18d6 | 7 | 219 |
#!/usr/bin/env python3
"""行距统一工具 - 简化版"""
import sys
from docx import Document
from docx.shared import Pt
def fix_line_spacing(input_path, output_path):
"""统一所有段落行距为28pt固定值"""
print(f"Reading: {input_path}")
doc = Document(input_path)
# 修改所有段落的行距
for i, para in enumerate(doc.paragraphs):
... | KaguraNanaga/document-format-skills | scripts/fix_spacing_simple.py | .py | 17b5935bae3b6a5e | 7 | 219 |
#!/usr/bin/env python3
"""
标点符号修复 v5
- 修复引号处理bug:使用明确的Unicode转义序列
- 正确处理省略号和句号
"""
import re
import sys
import argparse
from docx import Document
# 中文标点(使用Unicode转义确保正确)
LEFT_DOUBLE_QUOTE = '\u201c' # " 左双引号
RIGHT_DOUBLE_QUOTE = '\u201d' # " 右双引号
LEFT_SINGLE_QUOTE = '\u2018' # ' 左单引号
RIGHT_SINGLE_QUOTE = '\u2019... | KaguraNanaga/document-format-skills | scripts/punctuation.py | .py | a4731a078b6b642a | 8 | 219 |
import tempfile
from pathlib import Path
from docx import Document
from scripts.from_text import create_docx_from_markdown, detect_markdown
from scripts.punctuation import _process_spaces_text, fix_text, process_paragraph
def test_punctuation_protects_special_patterns():
text = "会议时间:上午9:30至下午14:30,请发送至 report@... | KaguraNanaga/document-format-skills | tests/test_punctuation_and_text.py | .py | c3c7484d312c886b | 7.5 | 219 |
"""帧协议与指令编解码。
帧格式:[4 字节大端无符号长度][载荷]
载荷为 JSON 字节串。
本模块提供下列能力:
- encode(commands_payload) -> 为载荷增加 4 字节大端长度前缀
- read_frame(sock) -> 从 socket 精确读取一帧(先读 4 字节长度,再读满该长度),处理短读
- decode_command(json_bytes) -> 把 JSON 字节串解析为指令 dict
"""
import json
import struct
# 长度前缀字节数
LENGTH_FIELD_SIZE = 4
def enc... | 0Sakura721/myolo-pcontrol | pc/protocol.py | .py | 86c33b64575390d7 | 7 | 0 |
"""屏幕截图推流模块。
把电脑屏幕截屏压缩成 JPEG,按帧格式发送给手机端(手机端做 YOLO 推理)。
帧格式(与 Android 端一致,服务端→客户端方向):
[4 字节大端长度][1 字节类型][载荷]
类型 0x00:载荷为 JSON 字节串(指令回执 / 状态)
类型 0x01:载荷为 JPEG 图片字节(屏幕帧)
客户端→服务端的请求仍是无类型前缀的 JSON 帧(见 protocol.encode),
本模块只负责服务端→客户端方向的「带类型字节」帧发送。
依赖 mss + Pillow;导入失败时仅给出 warning 提示,不崩溃。
"""
import io
import json
i... | 0Sakura721/myolo-pcontrol | pc/screen_stream.py | .py | fafa0fcec43865b1 | 7 | 0 |
"""电脑端主入口:多线程 TCP 服务端。
默认监听 0.0.0.0:9999(可用 --host / --port 覆盖)。
每个连接起一个线程处理,支持多客户端。
解出指令后调用 MouseController 执行;对 ping 回复 {"op":"pong"}。
记录收到/执行的日志(含指令),优雅处理 socket 关闭与异常,不掉线程。
命令行参数:
--host 监听地址(默认 0.0.0.0)
--port 监听端口(默认 9999)
--alpha EMA 平滑系数(默认 0.3)
--scale 坐标缩放倍率... | 0Sakura721/myolo-pcontrol | pc/server.py | .py | 13ddb2e77b40a335 | 7 | 0 |
"""FY27 help-text pass: dated examples in defined names and src/.
Usage: python tools/postbuild/fy27_help_text.py [workbook] [src dir]
This is the text layer of the v3.1.0 release: every worked example's start date
moves to 1 July 2026 (the start of FY27), plus the caption corrections proven in
Excel. Every swap is l... | ryanduguid/Ozzit | tools/postbuild/fy27_help_text.py | .py | e0f5a98275a83f99 | 7 | 0 |
"""GST help-text pass: legislative scope NOTES! in GSTAddλ and GSTExtractλ.
Usage: python tools/postbuild/gst_help_text.py [workbook] [src dir]
This pass starts from the committed ozzit.xlsx and src/ (the post-v3.0.0 input
recorded in ATTRIBUTION.md). It does not read the upstream workbook and does not
go through tra... | ryanduguid/Ozzit | tools/postbuild/gst_help_text.py | .py | a43ecf05bffa311c | 7 | 0 |
"""Help-link pass: repoint two WEBPAGE rows copied from a neighbouring function.
Usage: python tools/postbuild/help_links.py [workbook] [src dir]
CurrentRatioλ shipped CashRatioλ's cash-ratio article and ROIλ shipped ROEλ's
return-on-equity article. Each swap anchors on the preceding formula row of the
help so the ne... | ryanduguid/Ozzit | tools/postbuild/help_links.py | .py | 6593f337dbc731e0 | 7 | 0 |
"""Revision-history pass: remove per-function REVISIONS blocks and the creator credit.
Usage: python tools/postbuild/strip_revision_history.py [workbook] [src dir]
This pass starts from the committed ozzit.xlsx and src/ (the post-v3.0.0 input
recorded in ATTRIBUTION.md). It does not read the upstream workbook and doe... | ryanduguid/Ozzit | tools/postbuild/strip_revision_history.py | .py | f8c41a9e8ec761a4 | 7 | 0 |
"""Workbook palette pass: theme, styles, sheets and drawings to one dark system.
Usage: python tools/postbuild/workbook_palette.py [workbook]
Palette:
#5C2D91 brand purple — the one accent: titles, links, Financial tab
#04001F near-black — section headings
#2B2733 dark neutral — emphasis font
#B1AFAD warm g... | ryanduguid/Ozzit | tools/postbuild/workbook_palette.py | .py | 9856128ce999593b | 7 | 0 |
"""Strip the parts Excel adds on save and rebuild the zip deterministically.
Saving a workbook through Excel (a COM script, or a manual open and save)
adds parts that do not belong in a distributed file:
- one xl/printerSettings/printerSettingsN.bin per worksheet, pinned to the
printer installed where the save happ... | ryanduguid/Ozzit | tools/sanitise_workbook.py | .py | 34dbdcbeef7b74e5 | 7 | 0 |
"""Contract for tools/postbuild/fy27_help_text.py.
The pass rewrites dated help-text examples from the v3.0.0 state to the v3.1.0
(FY27) state, length-preserving, with asserted hit counts. On the current
workbook it must be a byte no-op; on a workbook reverted to the v3.0.0 text it
must apply each swap exactly the rec... | ryanduguid/Ozzit | tools/tests/postbuild/test_fy27_help_text.py | .py | 635d52fb7d45ffef | 7.5 | 0 |
"""Contract for tools/postbuild/workbook_palette.py.
The pass applies the house palette: explicit colour remaps in theme,
styles, sheets and drawings, plus the font-family consolidation, the help-label
greens folded to brand purple, and the mint help-block fill folded to pale
lavender. It must be a byte no-op on the c... | ryanduguid/Ozzit | tools/tests/postbuild/test_workbook_palette.py | .py | 016e9f498b78a3c0 | 7.5 | 0 |
import re
import subprocess
import unittest
import zipfile
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
SECURITY = ROOT / "SECURITY.md"
RELEASING = ROOT / "RELEASING.md"
VERIFY_WORKFLOW = ROOT / ".github" / "workflows" / "verify.yml"
DEPENDABOT = ROOT / ".github" / "dependabot.yml"
DEPENDABOT... | ryanduguid/Ozzit | tools/tests/test_repository_policy.py | .py | 13d5f4a7cb493ca9 | 7.5 | 0 |
"""Integrity checks for ozzit.xlsx.
Usage: python tools/verify_workbook.py [path/to/ozzit.xlsx]
Exits non-zero and prints every failure. Run by CI on each push.
"""
import base64
import html
import json
import re
import sys
import xml.etree.ElementTree as ET
import zipfile
# Every function name carries a λ, and a Wi... | ryanduguid/Ozzit | tools/verify_workbook.py | .py | 65f60dc86face4cc | 7 | 0 |
"""ACP auth helpers — detect and advertise Hermes authentication methods."""
from __future__ import annotations
from typing import Any, Optional
TERMINAL_SETUP_AUTH_METHOD_ID = "hermes-setup"
def detect_provider() -> Optional[str]:
"""Resolve the active Hermes runtime provider, or None if unavailable.
Tr... | NousResearch/hermes-agent | acp_adapter/auth.py | .py | fa19bb0ec30e202e | 8 | 236,738 |
"""Pre-execution ACP edit approval helpers.
This module is intentionally isolated from the generic tool registry. ACP binds
an edit approval requester in a ContextVar for the duration of one ACP agent run;
CLI, gateway, and other sessions leave it unset and therefore bypass this guard.
"""
from __future__ import ann... | NousResearch/hermes-agent | acp_adapter/edit_approval.py | .py | 589c4d8d53813724 | 8 | 236,738 |
"""CLI entry point for the hermes-agent ACP adapter.
Loads environment variables from ``~/.hermes/.env``, configures logging
to write to stderr (so stdout is reserved for ACP JSON-RPC transport),
and starts the ACP agent server.
Usage::
python -m acp_adapter.entry
# or
hermes acp
# or
hermes-acp
... | NousResearch/hermes-agent | acp_adapter/entry.py | .py | b70e7b189e36644d | 8 | 236,738 |
"""ACP permission bridging for Hermes dangerous-command approvals."""
from __future__ import annotations
import asyncio
import logging
from concurrent.futures import TimeoutError as FutureTimeout
from itertools import count
from typing import Callable
from acp.schema import (
AllowedOutcome,
PermissionOption... | NousResearch/hermes-agent | acp_adapter/permissions.py | .py | 65689660042dead9 | 8 | 236,738 |
"""Async/sync bridging helpers.
The codebase has ~30 sites that schedule a coroutine onto an event loop from a
worker thread via :func:`asyncio.run_coroutine_threadsafe`. That function can
raise :class:`RuntimeError` (e.g. the loop was closed during a shutdown race),
and when it does the coroutine object is never awa... | NousResearch/hermes-agent | agent/async_utils.py | .py | cc0a73e600cf6da7 | 8 | 236,738 |
"""Single owner for backend identity and failure-scoped skip decisions.
Every fallback / dedup / skip / quarantine decision in Hermes ultimately asks
one question: **"is this candidate the same backend as the one that failed,
along the axis that failure invalidated?"** Before this module, that
question was re-impleme... | NousResearch/hermes-agent | agent/backend_identity.py | .py | 002a555ea5c6a217 | 8 | 236,738 |
"""System-battery read-out for the CLI/TUI status bar.
Reads the host battery through ``psutil`` (already a Hermes dependency) and
exposes a compact, colour-coded label. Everything degrades to "unavailable"
when there is no battery (desktops, servers, VMs) or when the read fails, so
callers can render the result unco... | NousResearch/hermes-agent | agent/battery.py | .py | eea81b1993d9e1f8 | 8 | 236,738 |
"""Provider-agnostic billing/credit recovery links.
Maps a billing-classified failure onto a recovery link + label. *Detection*
is not done here — that is :mod:`agent.error_classifier`
(``FailoverReason.billing``), the single source of truth for "credit wall vs.
rate limit / auth / transport". The resulting :class:`Bi... | NousResearch/hermes-agent | agent/billing_links.py | .py | 3710b10b3f003ded | 8 | 236,738 |
"""Bounded reads of HTTP error response bodies.
When a provider returns a non-OK status on a *streaming* request, Hermes reads
the response body to build a useful diagnostic error. A bare ``response.read()``
on a streaming httpx response is unbounded in two dangerous ways:
1. A server can declare (or stream) an arbit... | NousResearch/hermes-agent | agent/bounded_response.py | .py | d237945a88d611a7 | 8 | 236,738 |
"""Mint a provider API key by running a command (``key_cmd``).
Static API keys are the exception at enterprise gateways: SSO/OIDC brokers,
cloud IAM, and internal auth proxies all issue SHORT-LIVED bearers instead.
A key copied into ``.env`` (``key_env``) is stale within the hour, so every
request after that 401s and ... | NousResearch/hermes-agent | agent/command_token_source.py | .py | 7db56a036fd98d4e | 8 | 236,738 |
"""Client-facing projection helpers for model-only compaction carriers."""
from __future__ import annotations
from typing import Any, Dict, Optional
from agent.context_compressor import (
ContextCompressor,
is_compaction_summary_message,
)
_COMPACTION_INTERNAL_FIELDS = (
"tool_calls",
"finish_reaso... | NousResearch/hermes-agent | agent/compaction_display.py | .py | acb1f918e5e030bd | 7 | 236,738 |
"""OpenAI-compatible shim that forwards Hermes requests to `copilot --acp`.
This adapter lets Hermes treat the GitHub Copilot ACP server as a chat-style
backend. Each request starts a short-lived ACP session, sends the formatted
conversation as a single prompt, collects text chunks, and converts the result
back into t... | NousResearch/hermes-agent | agent/copilot_acp_client.py | .py | 2717e8f5b31cda88 | 7 | 236,738 |
"""Scores one just-completed agentic subprocess run against a set of scorers —
the nondeterministic ``decision_quality`` LLM judge plus trace-only
deterministic checks (required tool calls, no tool errors, a definitive
decision keyword) — reading trace data only (no BPMN parsing, no Fluxnova REST
API calls). See EVAL-S... | dogle-scottlogic/Fluxnova-AI-workflow | eval-service-worker/src/eval_service_worker/scoring.py | .py | a5cae73bd39c7de3 | 7 | 0 |
"""BPMN external-task worker: scores a just-completed agentic subprocess run.
Subscribes to a single Camunda/Fluxnova external-task topic (default
``agent-output-eval``). On each task, reads the process instance's final
output/trace from MLflow, runs the ``decision_quality`` judge plus a set of
deterministic scorers (... | dogle-scottlogic/Fluxnova-AI-workflow | eval-service-worker/src/eval_service_worker/worker.py | .py | 30e65f81c884b0d7 | 7 | 0 |
"""Tests for ``EvalServiceConfig`` (hardcoded defaults, no config file)."""
from __future__ import annotations
from eval_service_worker.config import EvalServiceConfig
class TestEvalServiceConfig:
def test_defaults_match_documented_values(self):
config = EvalServiceConfig()
assert config.fluxno... | dogle-scottlogic/Fluxnova-AI-workflow | eval-service-worker/tests/test_config.py | .py | 8b8ce9203c059813 | 7.5 | 0 |
"""Collects newly-completed agentic subprocess runs and records them into
the persistent MLflow evaluation dataset.
This is the on-demand replacement for the old ``fluxnova_listener`` service.
Nothing here needs to run in the background or react to a live stream:
- MLflow already durably stores traces once the OTel C... | dogle-scottlogic/Fluxnova-AI-workflow | fluxnova-mlflow-dataset/src/fluxnova_mlflow_dataset/collect.py | .py | e3b850bb3daacb88 | 7 | 0 |
"""Minimal read-only Fluxnova REST API client used by the ``collect`` step.
Collection never deploys or starts processes (that's ``fluxnova_runner``'s
job) — it only needs to read back a completed instance's final variables,
which MLflow's trace store doesn't carry (only span/tool-call data does).
"""
from __future__... | dogle-scottlogic/Fluxnova-AI-workflow | fluxnova-mlflow-dataset/src/fluxnova_mlflow_dataset/fluxnova_client.py | .py | 8452f746841d1d07 | 7 | 0 |
"""Golden-scenario lookup for matching a run against its expected outcome."""
from __future__ import annotations
import json
from pathlib import Path
def load_goldens(dataset_path: Path | None) -> list[dict]:
"""Load the goldens JSON file, or return ``[]`` if none is configured."""
if not dataset_path:
... | dogle-scottlogic/Fluxnova-AI-workflow | fluxnova-mlflow-dataset/src/fluxnova_mlflow_dataset/goldens.py | .py | 41b3dbf3b1d0cd4f | 7 | 0 |
"""Builds the agent-history report from MLflow trace + BPMN + core-API sources."""
from __future__ import annotations
import json
from typing import Any, Protocol
from fluxnova_mlflow_dataset.bpmn import BpmnLookup
from fluxnova_mlflow_dataset.traces import ChatMessages, InvokeAgentMetrics, ToolCallSpan
class Vari... | dogle-scottlogic/Fluxnova-AI-workflow | fluxnova-mlflow-dataset/src/fluxnova_mlflow_dataset/report.py | .py | b33f468d5178ce84 | 7 | 0 |
"""``expected_tools`` rule parsing and evaluation.
A rule is a display tool-name plus an optional GitLab CI-style ``if``
condition string (e.g. ``'$applicantType == "EMPLOYED"'``) evaluated against
a run's input variables. Shared by anything that needs to know which tools a
given run *should* have called (dataset-reco... | dogle-scottlogic/Fluxnova-AI-workflow | fluxnova-mlflow-dataset/src/fluxnova_mlflow_dataset/tools.py | .py | 48a01ddc66791ca5 | 7 | 0 |
"""Configuration for the standalone Fluxnova automated-run service.
Deploy/deploy-and-start concerns only — no reporting or evaluation fields
(those live in the harness's ``WorkflowConfig``, read by ``mlflow-eval``).
"""
from __future__ import annotations
from dataclasses import dataclass, field
from pathlib import ... | dogle-scottlogic/Fluxnova-AI-workflow | fluxnova-runner/src/fluxnova_runner/config.py | .py | 0c32230e4265edd9 | 7 | 0 |
"""Mock external task workers driven by a workflow YAML config.
Subscribes to every topic listed under ``mock_workers`` in the config file and
immediately completes each task with the configured output variables.
Usage
-----
fluxnova-run-mock-workers config/loan-assesment.yml
"""
from __future__ import annotatio... | dogle-scottlogic/Fluxnova-AI-workflow | fluxnova-runner/src/fluxnova_runner/mock_workers.py | .py | 20379716c3f71b72 | 7 | 0 |
"""Configuration loaded from a YAML workflow config file."""
from __future__ import annotations
import json
import re
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any
import jsonschema
import yaml
_SCHEMA_PATH = Path(__file__).parent / "workflow-config.schema.json"
_SCHEMA = ... | dogle-scottlogic/Fluxnova-AI-workflow | harness/src/fluxnova/config.py | .py | 950f8ff3d984e991 | 7 | 0 |
"""Thin adapter over the shared ``fluxnova_mlflow_dataset`` package.
The actual record-shaping/read/write/collect logic lives in the standalone
``fluxnova-mlflow-dataset`` package. This module just adapts it to accept a
harness ``WorkflowConfig`` object, so the existing ``mlflow_eval.main`` call
sites don't need to ch... | dogle-scottlogic/Fluxnova-AI-workflow | harness/src/fluxnova/mlflow_dataset.py | .py | 2e4ae6a0b1edaf6e | 7 | 0 |
"""CLI to toggle MLflow *automatic* (online) evaluation judges on/off.
Automatic evaluation (``Scorer.register()`` + ``Scorer.start()``) runs
entirely inside the MLflow server itself, scoring new traces as they land —
no code needs to run continuously. This script is the "on/off switch" for
that: it registers the gate... | dogle-scottlogic/Fluxnova-AI-workflow | harness/src/mlflow_eval/judges.py | .py | b1faa93734a2dbfd | 7 | 0 |
"""Runs INSIDE Blender: blender -b -P render_frames.py -- <scene.json> <out_dir> [count]
Renders individual stills at exact positions through the shot, full size, one
file each.
Separate from the stills `build_scene.py` drops next to a take, which exist to be
tiled into a contact sheet and are a by-product of the re... | Grigoriy-V/shotops | blender/render_frames.py | .py | a4e9d5eada19e23a | 7.15 | 1 |
"""Runs INSIDE Blender: blender -b -P render_views.py -- <scene.json> <out_dir>
Renders the scene from outside the shot: top, front and three-quarter, with the
camera path drawn into the geometry.
A frame from inside the shot answers "does this look right". It cannot answer
"where is everything, and where does the c... | Grigoriy-V/shotops | blender/render_views.py | .py | 30a8ae5cfb576a1c | 7.15 | 1 |
"""Assets and instances: version the recipe, not the bake.
Eight cars built from eight primitives each landed in the scene as sixty-four
objects with the rule that made them thrown away. Every number in them was a
fraction of the car's own footprint -- a roof 0.76 as wide as the body, wheels
at 0.235 of the height -- ... | Grigoriy-V/shotops | src/ai_render/assets.py | .py | fd53d69c171aaaba | 7.15 | 1 |
"""Measure a camera move without rendering it.
The other half of the feedback loop in docs/design/feedback-loop.md. `views`
answers "where is everything" in pixels; this answers the questions pixels are
bad at -- how fast, how hard, how close -- in metres, from the same baked curve
the render uses.
It exists because ... | Grigoriy-V/shotops | src/ai_render/audit.py | .py | 671bcf0d0079f153 | 7.15 | 1 |
"""Drive headless Blender to turn a scene spec into a grey blockout video."""
from __future__ import annotations
import os
import shutil
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
BUILD_SCRIPT = ROOT / "blender" / "build_scene.py"
VIEWS_SCRIPT = ROOT / "blender" ... | Grigoriy-V/shotops | src/ai_render/blender_runner.py | .py | a75ce75c9d078eb3 | 7.15 | 1 |
"""Keyframe evaluation -- the one piece of scene semantics that is not Blender's.
Easing is baked here rather than handed to Blender f-curves, so the motion is
fully determined by the JSON and does not drift with Blender versions. That
makes it spec semantics rather than render code, which is why it lives in the
packa... | Grigoriy-V/shotops | src/ai_render/interpolate.py | .py | a11bd2c60313415f | 7.15 | 1 |
"""Tile several clips into one video, so takes can be compared moving.
The contact sheet in `compare.py` answers "is the camera where the blockout puts
it at 43%", and it answers it well: a wrong camera is obvious in one column.
It cannot answer "which of these three is cleaner". Texture, stylisation and
temporal nois... | Grigoriy-V/shotops | src/ai_render/mosaic.py | .py | ae039632a772cbfd | 7.15 | 1 |
"""Provider interface.
The video model is the fastest-moving piece of this stack, so it sits behind a
one-method interface. Swapping Seedance for Runway/Kling/Wan means adding a file
here, not touching the scene layer.
"""
from __future__ import annotations
import re
from pathlib import Path
# What the blockout ow... | Grigoriy-V/shotops | src/ai_render/providers/base.py | .py | 36d4733830a00887 | 7.15 | 1 |
"""Seedance via PiAPI (https://api.piapi.ai/api/v1/task).
This is the route that actually delivers structure control, and the reason is a
single field: `mode`. PiAPI exposes `text_to_video | first_last_frames |
omni_reference`, and only `omni_reference` attaches mixed-media references to
the generation. CometAPI's See... | Grigoriy-V/shotops | src/ai_render/providers/piapi.py | .py | 93f211b5de7c7db4 | 7.15 | 1 |
"""Output layout: one task, one directory, nothing ever overwritten.
out/nyc/seq_010/sh_0010/street_a/
20260824-153012/ <- a take: one blockout render
scene.json <- the exact spec that produced it
preview.mp4
frames/
20260824-1... | Grigoriy-V/shotops | src/ai_render/runs.py | .py | cf35289a2b51fb87 | 7.15 | 1 |
"""Load and validate a scene spec.
The scene spec is the real output of the agent: a declarative JSON document that
diffs cleanly and can be edited field by field. "Move the camera 20cm left" is a
one-line patch, not a regeneration. Everything downstream -- Blender, the video
model, any future viewer -- is a consumer ... | Grigoriy-V/shotops | src/ai_render/spec.py | .py | 8177a8c6d971a2e8 | 7.65 | 1 |
"""Turn one blockout frame into a style reference, with GPT Image 2 via CometAPI.
ByteDance's white-model workflow uses two references, not one:
保持 @视频1 中的镜头运动 ... 不变,以 @图片1 作为材质、光照、色彩和整体氛围参考
The blockout owns everything spatial. A still owns material, lighting, colour
and mood. The catch is that the still has t... | Grigoriy-V/shotops | src/ai_render/styleframe.py | .py | 334d7418d2a4c5b6 | 7.15 | 1 |
"""Publish the blockout so the video model can fetch it.
Seedance accepts reference *videos* by URL only -- base64 works for images and
audio, but not video. So the blockout has to be reachable from the internet for
the duration of one job.
Two ways to do that, and they trade off against each other.
Supabase Storage... | Grigoriy-V/shotops | src/ai_render/upload.py | .py | e9c7f51946e006b8 | 7.15 | 1 |
"""Authentication for Bilibili.
Strategy:
1. Try loading saved credential from ~/.bilibili-cli/credential.json
2. Try extracting cookies from local browsers via browser-cookie3
3. Fallback: QR code login via bilibili-api-python + terminal display
"""
from __future__ import annotations
import asyncio
import json
impo... | tiwarn01/bilibili-cli | bili_cli/auth.py | .py | eab5e26eb1796316 | 7.15 | 1 |
"""CLI entry point for bilibili-cli.
Usage:
bili login / logout / status / whoami
bili video <BV号或URL> [--subtitle] [--ai] [--comments] [--related] [--yaml|--json]
bili user <UID或用户名> bili user-videos <UID> [--max N]
bili search <关键词> [--type user|video] [--yaml|--json]
bili hot / rank / f... | tiwarn01/bilibili-cli | bili_cli/cli.py | .py | 0a8a3f30d55b49ee | 7.15 | 1 |
"""Audio extraction command — download and split video audio for ASR."""
from __future__ import annotations
import os
import re
import tempfile
import click
from .common import console, exit_error, extract_bvid_or_exit, get_credential, run_or_exit
DEFAULT_TMP_DIR = os.path.join(tempfile.gettempdir(), "bilibili-cli... | tiwarn01/bilibili-cli | bili_cli/commands/audio.py | .py | 809fae1de722eb28 | 7.15 | 1 |
"""Shared helpers for CLI command modules."""
from __future__ import annotations
import logging
import sys
import click
from .. import auth
from ..exceptions import AuthenticationError, BiliError, InvalidBvidError, NetworkError, NotFoundError, RateLimitError
# Re-export all formatting utilities from formatter.py f... | tiwarn01/bilibili-cli | bili_cli/commands/common.py | .py | a069078ab351f764 | 7.15 | 1 |
"""Shared test fixtures."""
import os
import pytest
from bilibili_api.utils.network import Credential
os.environ.setdefault("OUTPUT", "rich")
@pytest.fixture
def mock_credential():
"""A fake credential for testing."""
return Credential(sessdata="test_sessdata", bili_jct="test_bili_jct")
@pytest.fixture
d... | tiwarn01/bilibili-cli | tests/conftest.py | .py | 882a49253b390a85 | 7.65 | 1 |
from __future__ import annotations
from collections.abc import Sequence
from typing import TYPE_CHECKING, Any
from sqlalchemy import create_engine, text as sa_text
from sqlalchemy.engine import Connection, Engine
from sqlalchemy.exc import SQLAlchemyError
from .sql import split_sql
if TYPE_CHECKING:
from sqlalc... | srittau/dbupgrade | dbupgrade/db.py | .py | a34375fad47cee2e | 7.15 | 1 |
from __future__ import annotations
from copy import deepcopy
from genome import GENOME
from evaluate_dual_vocabulary_v6 import DualVocabularyV6
TRAINING = [
"CAT", "CAR", "CAN", "CARD", "CART", "DOG", "DOT", "BAT",
]
TEST = [
"CAT", "CAR", "CAN", "CARD", "CART",
"CAD", "COD", "COT", "BAD", "BAR", "BARD... | adrian-burlacu-software/Graph-Topology | research/evaluate_edge_cell_v4_reward.py | .py | a7838227c01c1dea | 7 | 0 |
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
import math
import sqlite3
RELATIONS = (
"IsA",
"CapableOf",
"HasProperty",
"UsedFor",
"HasA",
"PartOf",
"RelatedTo",
"SimilarTo",
"Antonym",
"Causes",
"AtLocation",
"MadeOf",... | adrian-burlacu-software/Graph-Topology | research/v200_graph_transformer_cognitive/long_term_memory.py | .py | a413602cadee5a5e | 7 | 0 |
from notemind.xmind.core.loader import WorkbookLoader
from notemind.xmind.core.saver import WorkbookSaver
def load(path):
""" Load XMind workbook from given path. If file no exist on given path then created new one. """
loader = WorkbookLoader(path)
return loader.get_workbook()
def save(workbook, path=N... | farfarfun/funmind | notemind/xmind/__init__.py | .py | 6a74b4ad19fbe7dc | 7 | 0 |
from xml.dom import minidom as DOM
from .. import utils
def create_document():
""":cls: ``xml.dom.Document`` object constructor
"""
return DOM.Document()
def create_element(tag_name, namespaceURI=None, prefix=None, localName=None):
""":cls: ``xml.dom.Element`` object constructor
"""
element... | farfarfun/funmind | notemind/xmind/core/__init__.py | .py | 295404e8e0a0b9eb | 7 | 0 |
#!/usr/bin/env python
# _*_ coding:utf-8 _*_
"""
xmind.core.comments implements encapsulation of the XMind comments.xml.
"""
import random
from notemind.xmind import utils
from notemind.xmind.core import Document, const, Element
class CommentsBookDocument(Document):
""" `CommentsBookDocument` as central object ... | farfarfun/funmind | notemind/xmind/core/comments.py | .py | 67a909ec40cd3504 | 7 | 0 |
from notemind.xmind.core.comments import CommentsBookDocument
from notemind.xmind.core.styles import StylesBookDocument
from . import const
from .workbook import WorkbookDocument
from .. import utils
class WorkbookLoader(object):
def __init__(self, path):
""" Load XMind workbook from given path
... | farfarfun/funmind | notemind/xmind/core/loader.py | .py | 8e067557e2718b1b | 7 | 0 |
from . import const
from .mixin import WorkbookMixinElement
class MarkerId:
def __init__(self, name):
self.name = name
def __str__(self):
return self.name
def __repr__(self):
return "<MarkerId: %s>" % self
def __eq__(self, other):
"""Override the default Equals behav... | farfarfun/funmind | notemind/xmind/core/markerref.py | .py | 6460ee7e23e87848 | 7 | 0 |
from . import const
from .mixin import TopicMixinElement
class NotesElement(TopicMixinElement):
TAG_NAME = const.TAG_NOTES
def __init__(self, node=None, ownerTopic=None):
super(NotesElement, self).__init__(node, ownerTopic)
def getContent(self, format=const.PLAIN_FORMAT_NOTE):
""" Get no... | farfarfun/funmind | notemind/xmind/core/notes.py | .py | ea10241bcc6190aa | 7 | 0 |
from notemind.xmind import utils
from . import const
from .mixin import WorkbookMixinElement
from .relationship import RelationshipElement, RelationshipsElement
from .title import TitleElement
from .topic import TopicElement
class SheetElement(WorkbookMixinElement):
TAG_NAME = const.TAG_SHEET
def __init__(s... | farfarfun/funmind | notemind/xmind/core/sheet.py | .py | 9ff314c49fabbf6f | 7 | 0 |
from notemind.xmind.core import Document, const, Element
class StylesBookDocument(Document):
""" `StylesBookDocument` as central object correspond XMind stylebook.
"""
def __init__(self, node=None, path=None):
"""Construct new `StylesBookDocument` object
:param node: pass DOM node object ... | farfarfun/funmind | notemind/xmind/core/styles.py | .py | 2ac6870ac984f137 | 7 | 0 |
from . import const
from .labels import LabelsElement, LabelElement
from .markerref import MarkerId
from .markerref import MarkerRefElement
from .markerref import MarkerRefsElement
from .mixin import WorkbookMixinElement
from .notes import NotesElement, PlainNotes
from .position import PositionElement
from .title impor... | farfarfun/funmind | notemind/xmind/core/topic.py | .py | c20ae3eea0f5bc0c | 7 | 0 |
import os
import random
import tempfile
import time
import zipfile
from functools import wraps
from hashlib import md5
from xml.dom.minidom import parse, parseString
# ********** Misc **********
temp_dir = tempfile.mkdtemp
def generate_id():
"""
Generate unique 26-digit random string
"""
# FIXME: Wh... | farfarfun/funmind | notemind/xmind/utils.py | .py | 4a5291d9f90407b8 | 7 | 0 |
#!/usr/bin/env python3
"""
Download model script for Ignis AI.
Downloads the primary language model from HuggingFace.
"""
import argparse
import logging
import os
import sys
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent.parent.parent / 'src'))
from utils.logger import get_lo... | shumskyw/Ignis | scripts/setup/01_download_model.py | .py | d316102745cc0c8f | 7 | 0 |
#!/usr/bin/env python3
"""
Convert model to GGUF format script for Ignis AI.
Converts HuggingFace models to GGUF for efficient CPU/GPU inference.
"""
import argparse
import logging
import os
import subprocess
import sys
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent.parent.par... | shumskyw/Ignis | scripts/setup/02_convert_to_gguf.py | .py | a8d441fecea73857 | 7 | 0 |
#!/usr/bin/env python3
"""
Initialize database script for Ignis AI.
Sets up ChromaDB vector database for memory storage.
"""
import argparse
import json
import os
import sys
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent.parent.parent / 'src'))
from utils.logger import get_lo... | shumskyw/Ignis | scripts/setup/03_initialize_database.py | .py | 958c6cea094ef41b | 7 | 0 |
#!/usr/bin/env python3
"""
Create configuration files script for Ignis AI.
Generates default configuration files and directories.
"""
import argparse
import json
import os
import shutil
import sys
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent.parent.parent / 'src'))
from uti... | shumskyw/Ignis | scripts/setup/04_create_configs.py | .py | 86378e4bff6a6e6a | 7 | 0 |
"""
Unified Configuration Management System for Ignis AI.
Uses Pydantic for validation and type safety.
"""
from pathlib import Path
from typing import Dict, Any, Optional, List
from pydantic import BaseModel, Field
import json
import os
from datetime import datetime
class GenerationConfig(BaseModel):
"""Configur... | shumskyw/Ignis | src/core/config.py | .py | eb04e106f5ce5f4a | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.