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
"""One map, run wide: the parallelism primitive the tools share (ADR-026). from .parallel import pmap results = pmap(render_one, units) # ordered, like map() Everything Luria does is embarrassingly parallel at some unit — a scheme's view, a journal's books, a file's scan, a URL's probe — and none of ...
dmarx/luria
luria/parallel.py
.py
57a48670b48b414c
7.64
18
#!/usr/bin/env python3 """What *this* project's record is made of, rendered from its own config. luria index # → <docs>/record.md, with every other view `configuration.md` is the schema: every key Luria accepts, what it defaults to, what it means. This page is the other half of the question, and t...
dmarx/luria
luria/record_doc.py
.py
920fb28bc57b97dc
7.64
18
"""What a status *means* in one scheme, declared beside the records. [ADR-003](../record/decisions.d/ADR-003.md) closed the status vocabulary to five words and put a lint behind it, on the strength of an audit finding that every surface guarded by an executable check had held and every surface governed by prose conven...
dmarx/luria
luria/statuses.py
.py
47c49d9e629d8f4f
7.64
18
"""Build a scheme directory with documents of chosen statuses. The tests that exercise retired-document reporting used to lean on whatever the corpus happened to contain, which made them silently weaker as the corpus changed — and impossible to write at all for a project (like this one) whose every decision is Active....
dmarx/luria
tests/_scheme.py
.py
04021b972bb9c296
7.14
18
"""Shared fixtures. Every test runs against *this* repo's record, because Luria's first consumer is Luria ([ADR-009](../record/decisions.d/ADR-009.md)) — a check that passes on a synthetic fixture and fails on a real corpus has told you nothing. Tests that need a controlled tree build one and repoint the config at it ...
dmarx/luria
tests/conftest.py
.py
54dcfd95e24ea714
8.14
18
"""Undecided decisions, aged ([ADR-035](../record/decisions.d/ADR-035.md)). Age is the whole point of this report, so the clock is injected: `--as-of` (and the `today` argument these tests pass) keeps it from being a test that fails on a Tuesday in November. """ import datetime as dt import sys from pathlib import Pat...
dmarx/luria
tests/test_adr_pending.py
.py
0b60bd924f28a204
8.14
18
"""The two collection shapes (ADR-028): append for narrative logs, changelog for release logs. Pure-function tests — `collect` takes text and bodies.""" from luria.collect import collect APPEND_VIEW = """# Log Old entry. <!-- luria-insert-here --> """ CHANGELOG_VIEW = """# Changelog Assembled from fragments. <!--...
dmarx/luria
tests/test_collect.py
.py
d503d05cb62afc05
8.14
18
"""Merge-allocated schemes: temporary codes, concretization, aliases (ADR-049). Every test here runs the loop an adopter runs: mint on a branch, cite while the context is loaded, concretize where merges serialize, and keep the old name resolving forever. The fixture builds a real record and drives the real commands — ...
dmarx/luria
tests/test_concretize.py
.py
2b80abef11d12642
8.14
18
"""The two merge rules, split by what a table is (ADR-047). A settings table merges per key — setting `docs` must not clear `reports`. A family table is replaced whole when declared — its entries are named by the project, and "you get the ones you wrote" is the only reading under which a family can shrink. Every case ...
dmarx/luria
tests/test_config.py
.py
99ed8660d077fd7d
8.14
18
"""Files are UTF-8 by construction; the console is the platform's. A Windows terminal at cp1252 could not encode the arrow in `luria init → path` and could not write the check mark a status report ends on, so a scaffold became a stack trace on a machine where nothing was wrong (#112). Worse, the two halves disagreed: ...
dmarx/luria
tests/test_encoding.py
.py
a37a3b9d6061e1a8
8.14
18
"""`luria init` never overwrites, and says something useful when it skips the one file an agent reads first (ADR-037).""" from pathlib import Path from luria import init def test_existing_files_are_kept_verbatim(tmp_path, capsys): (tmp_path / "CLAUDE.md").write_text("mine, hands off\n") written, skipped, kep...
dmarx/luria
tests/test_init.py
.py
c98974e2a1bf5005
8.14
18
"""Safe inline translations tool - Generates a unified diff (scripts/translation_patch.diff) with inlined TRANSLATIONS replacements - Writes a temp file scripts/temp_main_inlined.py for syntax checking and smoke-run - DOES NOT overwrite main.py """ import ast import difflib import sys from pathlib import Path ROOT = P...
woshiliyihang/prompt-copilot-cli
scripts/inline_translations_safe.py
.py
acd825c96440c2dd
7.57
13
from copilot.agent import AgentRuntime def test_filter_think_tags(tmp_path, monkeypatch): # Create a minimal AgentRuntime-like object class Dummy: def __init__(self): pass rt = AgentRuntime.__new__(AgentRuntime) # Attach the method under test rt._filter_think_tags = AgentRunti...
woshiliyihang/prompt-copilot-cli
tests/test_think_filter.py
.py
41b1cabc27c5fa0b
7.07
13
import sqlite3 import requests from bs4 import BeautifulSoup import scrapy from scrapy.crawler import CrawlerProcess # Database setup DB_PATH = "news.db" def initialize_db(): """Ensure the news table has the correct schema, including sub_category.""" conn = sqlite3.connect(DB_PATH) cursor = conn.cursor() ...
100rabhsah/ai-news-aggregator
crawler/test3.py
.py
0088dd29ec42c14f
7.95
7
import sqlite3 import requests from bs4 import BeautifulSoup import scrapy from scrapy.crawler import CrawlerProcess from duckduckgo_search import DDGS # Database setup DB_PATH = "newsagent.db" def initialize_db(): """Ensure the news table has the correct schema, including sub_category.""" conn = sqlite3.conn...
100rabhsah/ai-news-aggregator
crawler/test4.py
.py
f637a010b1891e6c
7.95
7
import subprocess import time import json import os # Set timeout (None means no timeout) SCRAPY_TIMEOUT = 120 progress_file = "progress.json" temp_news_file = "temp_news.json" news_file = "news.json" progress = {"progress": 0, "status": "idle"} def save_progress(): """Save progress to progress.json""" with ...
100rabhsah/ai-news-aggregator
scraper_runner.py
.py
23a2b20c87204552
7.45
7
# Copyright (C) 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """MkDocs hook that expands ``@import "relative/path.md"`` directives. Why this exists ---------------- Quick-start pages under ``docs/getting-started/`` reuse a set of shared snippet files (``docs/includes/quick-start/*.md``) via a file-tra...
open-edge-platform/edge-system-qualification
docs/hooks/md_import.py
.py
9bc57d9367c0409a
7.42
6
# Copyright (C) 2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Metric calculation and aggregation utilities for ChatQnA Core benchmarking. Provides functions for: - Token counting using Llama tokenizer - Percentile calculation - Throughput and latency aggregation """ import logging from typing impo...
open-edge-platform/edge-system-qualification
src/esq/suites/ai/gen/src/chatqna_core/metrics.py
.py
cd9c396c00988d66
7.42
6
# Copyright (C) 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Text Generation preparation functions for assets and environment setup.""" import logging import os from typing import Any, Dict import allure from sysagent.utils.config import ensure_dir_permissions from sysagent.utils.core import Resul...
open-edge-platform/edge-system-qualification
src/esq/suites/ai/gen/src/text_generation/preparation.py
.py
b44b202eb555dd1f
7.42
6
# Copyright (C) 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Text Generation utility functions for device management and cleanup.""" import logging from typing import Dict, Any, List from sysagent.utils.infrastructure import DockerClient logger = logging.getLogger(__name__) def cleanup_stale_con...
open-edge-platform/edge-system-qualification
src/esq/suites/ai/gen/src/text_generation/utils.py
.py
0c52e5a5e5c546a1
7.42
6
# Copyright (C) 2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ PMU-based GPU Telemetry Collector - Zero Prerequisites This module collects GPU metrics directly from Linux PMU without requiring: - intel_gpu_top binary - Debugfs access (/sys/kernel/debug) - Special kernel parameters - Privileged conta...
open-edge-platform/edge-system-qualification
src/esq/suites/ai/vision/src/containers/openvino_benchmark/pmu_gpu_collector.py
.py
59f6e9b1fad379a5
7.42
6
# Copyright (C) 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Base Video Analytics Pipeline Benchmark. This module provides the base class for video analytics benchmarks including VA multi-stage pipelines (decode/detect/track/classify). """ import configparser import logging import os import sys i...
open-edge-platform/edge-system-qualification
src/esq/suites/ai/vision/src/containers/video_analytics/base_benchmark.py
.py
87e66f8dccaba545
7.42
6
# Copyright (C) 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """DLStreamer concurrent analysis and container orchestration functions.""" import grp import json import logging import os from typing import Any, Dict, List import docker import numa from .container import run_dlstreamer_analyzer_contain...
open-edge-platform/edge-system-qualification
src/esq/suites/ai/vision/src/dlstreamer/concurrent.py
.py
71a54237e1552670
7.42
6
# Copyright (C) 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """DLStreamer container management utilities.""" import json import logging import os from sysagent.utils.infrastructure import DockerClient logger = logging.getLogger(__name__) def run_video_utils_container( docker_client: DockerCli...
open-edge-platform/edge-system-qualification
src/esq/suites/ai/vision/src/dlstreamer/container.py
.py
59c59d4471445130
7.42
6
# Copyright (C) 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """DLStreamer result processing and validation functions.""" import logging from typing import Any, Dict from sysagent.utils.core import Metrics, Result, get_metric_name_for_device logger = logging.getLogger(__name__) def process_device_...
open-edge-platform/edge-system-qualification
src/esq/suites/ai/vision/src/dlstreamer/results.py
.py
e5073a329a8b63d2
7.42
6
# Copyright (C) 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """DLStreamer utility functions for cleanup, device management, and system operations.""" import concurrent.futures import json import logging import os from typing import Any, Dict, List, Optional import docker from sysagent.utils.core imp...
open-edge-platform/edge-system-qualification
src/esq/suites/ai/vision/src/dlstreamer/utils.py
.py
72ef0ca0cc24324d
7.42
6
# -*- coding: utf-8 -*- """经济系统逻辑:金钱存储、增减、排行等(基于 XUID,精确到分)""" from typing import Any, Callable, Dict, List, Optional class Economy: """经济系统:负责 player_economy 表及金钱相关数据逻辑,不包含 UI 与通知。""" def __init__(self, database_manager, setting_manager, logger=None): self.db = database_manager self.setting_...
ARC-Minecraft/EndstoneMC-ARC-Core-Plugin
src/endstone_arc_core/Economy.py
.py
8228cb22f42e7fbb
7.48
8
# -*- coding: utf-8 -*- """生物名称翻译:当生物名称中包含 ':' 时视为 MC 未提供对应翻译,从 entity_display_name.txt 读取用户配置的显示名。""" from pathlib import Path from typing import Optional class EntityDisplayNameManager: """从 entity_display_name.txt 读取/补写生物显示名。仅对名称中含 ':' 的键进行查询。""" def __init__(self, base_path: Path, logger=None): s...
ARC-Minecraft/EndstoneMC-ARC-Core-Plugin
src/endstone_arc_core/EntityDisplayNameManager.py
.py
8a469d090e6ba3be
7.48
8
# -*- coding: utf-8 -*- """击杀生物金钱奖励:独立配置文件 kill_reward.txt,格式 类型ID=金额(如 minecraft:creeper=10)。""" import threading from pathlib import Path from typing import Dict def normalize_entity_type_id(entity_type: str) -> str: """统一为小写,便于配置键一致。""" s = str(entity_type or "").strip() if not s: return "" ...
ARC-Minecraft/EndstoneMC-ARC-Core-Plugin
src/endstone_arc_core/KillRewardConfig.py
.py
78df053639962e62
7.48
8
from pathlib import Path MAIN_PATH = 'plugins/ARCCore' class LanguageManager: language_dict = {} # Class variable shared across instances def __init__(self, default_language_code): self.language_code = default_language_code.upper() if self.language_code not in LanguageManager.language_dict: ...
ARC-Minecraft/EndstoneMC-ARC-Core-Plugin
src/endstone_arc_core/LanguageManager.py
.py
27fabec1bca6f2fd
7.48
8
from pathlib import Path from typing import Callable, Dict, List MAIN_PATH = 'plugins/ARCCore' class SettingManager: setting_dict = {} # Class variable to store all settings def __init__(self): self.setting_file_path = Path(MAIN_PATH) / "core_setting.yml" self._change_listeners: List[Callabl...
ARC-Minecraft/EndstoneMC-ARC-Core-Plugin
src/endstone_arc_core/SettingManager.py
.py
c6ea52b986455362
7.48
8
# -*- coding: utf-8 -*- """恶性错误写入 plugins/ARCCore/error_log.txt(与核心配置同目录)""" import threading import traceback from contextlib import suppress from datetime import datetime from pathlib import Path from typing import List, Optional _file_lock = threading.Lock() def append_arc_error_log( log_file_path: str, e...
ARC-Minecraft/EndstoneMC-ARC-Core-Plugin
src/endstone_arc_core/arc_error_log.py
.py
016bb93791cd6ebf
7.48
8
# -*- coding: utf-8 -*- """维度标识:统一为官方 namespaced ID(如 minecraft:overworld),支持自定义维度。""" from __future__ import annotations from typing import Any, Optional # 历史写法 → 官方规范 ID(仅用于写入时规范化与一次性库迁移) _VANILLA_CANONICAL = { "overworld": "minecraft:overworld", "minecraft:overworld": "minecraft:overworld", "Overworld"...
ARC-Minecraft/EndstoneMC-ARC-Core-Plugin
src/endstone_arc_core/dimension_utils.py
.py
a3e0bf6935bed35d
7.48
8
# -*- coding: utf-8 -*- """跨服同步配置:模式解析与分项表映射""" from typing import Dict, Iterable, List, Literal, Optional, Set, Tuple SyncConsumerMode = Literal["none", "client", "file"] # 配置键 -> 同步类别 SYNC_CATEGORY_SETTING_KEYS: Dict[str, str] = { "SYNC_CLIENT_SYNC_PLAYER": "player", "SYNC_CLIENT_SYNC_ECONOMY": "economy", ...
ARC-Minecraft/EndstoneMC-ARC-Core-Plugin
src/endstone_arc_core/sync_config.py
.py
d2a152cc64499207
7.48
8
# -*- coding: utf-8 -*- """跨服数据同步协议定义""" from enum import IntEnum from typing import Any, Dict, List, Optional class SyncMessageType(IntEnum): """同步消息类型枚举""" # 认证相关 AUTH_REQUEST = 0x01 # 客户端认证请求 AUTH_RESPONSE = 0x02 # 认证响应 # 数据操作 QUERY_REQUEST = 0x10 # 查询数据请求 QUE...
ARC-Minecraft/EndstoneMC-ARC-Core-Plugin
src/endstone_arc_core/sync_protocol.py
.py
c95df00d406f06e7
7.48
8
# -*- coding: utf-8 -*- """本地 DB 变更 → 同步中心镜像(上行)辅助逻辑。""" from __future__ import annotations import re from typing import Any, Dict, List, Optional, Sequence, Tuple # 可同步表的主键(用于写后回读整行再 upsert) SYNC_TABLE_PRIMARY_KEYS: Dict[str, Tuple[str, ...]] = { "player_basic_info": ("xuid",), "player_economy": ("xuid",), ...
ARC-Minecraft/EndstoneMC-ARC-Core-Plugin
src/endstone_arc_core/sync_write.py
.py
1b2c6e12ffe4a7a2
7.48
8
# -*- coding: utf-8 -*- """The record of what a session handed to its workers. One line per delegation in `<session>/delegations.jsonl`, written after the answer has already been shown, so the file is a history rather than a thing the answer waits on. It holds what the delegation was and what it cost, never the worker...
oteomamo/SALT
salt/agents/ledger.py
.py
deeec2d178e1583c
7.54
11
# -*- coding: utf-8 -*- """Who decides how one turn's memory is selected. Every memory switch already travels as a keyword on the call that uses it rather than being baked into the session, which is what makes a per-turn decision possible at all: something can vary a switch for one selection and leave the session it b...
oteomamo/SALT
salt/agents/policy.py
.py
f019712330f0e40f
7.54
11
# -*- coding: utf-8 -*- """What a model does with its own reasoning, measured rather than assumed. Some models let a caller ask for the working or ask for it to be left out, and they do it through the chat template rather than through sampling. Others always reason and offer no way not to. Others never reason at all. ...
oteomamo/SALT
salt/agents/thinking.py
.py
be5d517e30e01ba7
7.54
11
# -*- coding: utf-8 -*- """The record of the turns a session planned out instead of answering. One line per agent turn in `<session>/agent_trace.jsonl`, written after the reply is already on screen, so the file is a history rather than something the reply waits on. It holds what the round decided and what each piece ...
oteomamo/SALT
salt/agents/trace.py
.py
13acd28fa6bca0c1
7.54
11
# -*- coding: utf-8 -*- """Model registry for saltChat. Each registered chat model lives under ``salt/models/<alias>/``: config.json loading + generation settings for the model weights symlink to the resolved snapshot in the user's HF cache Weights are never copied: ``register_model`` downloads throu...
oteomamo/SALT
salt/chat/registry.py
.py
189c99ebfd4a0332
7.54
11
# -*- coding: utf-8 -*- """saltServe: launch a persistent vllm serve process for saltChat. Resolves a registered model and execs ``vllm serve`` so the server owns the model and its prefix cache outlives every saltChat run. The server is a foreground process in its own terminal - saltChat never manages its lifecycle, i...
oteomamo/SALT
salt/chat/serve.py
.py
2e5c5d904df196c3
7.54
11
""" Short-turn predicates: let terse user decisions ("go with option B") past the junk filter's length gates at conversation ingest. """ import re from salt.engine.sentence_filter import ( JUNK_CONTAINS, JUNK_PATTERNS, MIN_CHAR_LENGTH, MIN_WORD_COUNT, contains_url, is_aggressive_junk, ) from s...
oteomamo/SALT
salt/chat/shortturn.py
.py
5a3f9149edda71d5
7.54
11
# -*- coding: utf-8 -*- """What a refused tool call looks like on the wire. Every refusal carries a code, and every code renders as a fixed opening phrase, so a client can tell one kind of refusal from another by reading the front of the message and a person can read the whole of it. The phrases are the contract: they...
oteomamo/SALT
salt/mcp/errors.py
.py
048be08ff6ba525b
7.54
11
#!/usr/bin/env python3 """Synchronize SoRoMoX release metadata and optionally create a release tag. The script updates the tracked sources of release metadata: - ``pyproject.toml`` - ``CITATION.cff`` - ``docs/citation.md`` - ``docs/development/changelog.md`` - ``uv.lock`` Generated ``*.egg-info`` metadata is deliber...
tud-phi/soromox
bump_version.py
.py
91f358dbadb3f0ce
7.6
15
"""Batched rendering demo for tendon-actuated PCS robots. This example vmaps `robot.rollout_to` over randomly sampled, constant tendon tensions to generate multiple trajectories from the same initial condition, and visualizes them in a grid using Matplotlib, Open3D, and Viser renderers. """ import argparse from pathl...
tud-phi/soromox
examples/simulation/pcs/simulate_batched_tendon_actuated_pcs.py
.py
d5a002650139d8fb
7.6
15
#!/usr/bin/env python3 """ Changelog parser for extracting release notes from CHANGELOG.md. This script extracts the changelog content for a specific version to be used in GitHub releases. """ import argparse import re import sys from pathlib import Path def extract_version_changelog(changelog_path: Path, version: ...
tud-phi/soromox
extract_changelog.py
.py
145c4ebe827fbf03
7.6
15
""" Minimal PyElastica rod simulation (NO gymnasium, NO custom elastica_env). What it does: - Builds a straight Cosserat rod - Fixes one end (cantilever) - Adds linear damping - Optional gravity - Optional self-contact - Adds a simple "tendon-like" actuation (4 channels) that bends the rod by applying distributed to...
tud-phi/soromox
paper_results/secIVa_benchmarking_sequential_cpu/code/pyelastica/simulate_planar_pyelastica.py
.py
47959b3bf48aeade
7.6
15
""" Minimal PyElastica rod simulation (NO gymnasium, NO custom elastica_env). What it does: - Builds a straight Cosserat rod - Fixes one end (cantilever) - Adds linear damping - Optional gravity - Optional self-contact - Adds a simple "tendon-like" actuation (4 channels) that bends the rod by applying distributed to...
tud-phi/soromox
paper_results/secIVa_benchmarking_sequential_cpu/code/pyelastica/simulate_spatial_pyelastica.py
.py
55c485f464ba3cb9
7.6
15
#!/usr/bin/env python3 """Plot soft tentacle residual identification results with standard template aesthetics.""" import argparse import shutil import sys from dataclasses import dataclass from pathlib import Path import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from matpl...
tud-phi/soromox
paper_results/secVa_system_identification/code/plot_system_id_residual.py
.py
4d8c55565b21e5f9
7.6
15
"""Evaluation metrics reported for the Section V.C control experiments.""" from __future__ import annotations from collections.abc import Sequence import numpy as np from scipy.spatial.transform import Rotation STEADY_STATE_FRACTION = 0.1 REGULATION_SETPOINT_INTERVALS = ( (3.0, 6.0), (6.0, 9.0), (9.0, 1...
tud-phi/soromox
paper_results/secVc_model_based_control/code/evaluation_metrics.py
.py
d1692dc26797d7ff
7.6
15
"""Private capacity-admission seam used by the API-only facade.""" from __future__ import annotations import math from dataclasses import dataclass from enum import Enum from threading import Lock from typing import Protocol, runtime_checkable @dataclass(frozen=True) class _CapacitySnapshot: """Immutable observ...
HarvardMadSys/RouteWise
llm_routewise/_capacity_controller.py
.py
25df501913460d6d
7.45
7
"""Dependency-free online output-length estimation for the public facade.""" from __future__ import annotations import math from dataclasses import dataclass @dataclass class _MeanState: """Online arithmetic mean without retaining individual observations.""" count: int = 0 total: float = 0.0 def u...
HarvardMadSys/RouteWise
llm_routewise/_output_length.py
.py
b22725b82a134f52
7.45
7
"""Latency beliefs: rolling empirical profiles plus prior/penalty fallbacks. This unifies what used to be two implementations of "what do we think this provider's TTFT looks like right now": * simulator ``ObservedRollingLatencyProfileStrategy`` — rolling profile with an oracle fallback to the provider's true distri...
HarvardMadSys/RouteWise
llm_routewise/core/beliefs.py
.py
9a1273373d4c50cd
7.45
7
"""Shared RouteWise effective-cost primitives. This module is intentionally pure: it does not import provider, policy, simulator, or real-eval types. Harnesses extract request cost and scarcity signals from their own mutable state, then delegate the common math here. """ from __future__ import annotations import mat...
HarvardMadSys/RouteWise
llm_routewise/core/cost.py
.py
5d7275c0f3567295
7.45
7
"""Shared RouteWise hedging primitives. This module is limited to pure checkpoint/probability math and generic backup selection. Harnesses own provider inventory, capacity mutation, transport, and profile storage. """ from __future__ import annotations import math from dataclasses import dataclass, field from typing...
HarvardMadSys/RouteWise
llm_routewise/core/hedging.py
.py
a9a4f2b734a2b1c6
7.45
7
"""Shared rolling latency-profile estimator. This module is part of the environment-agnostic algorithm core: the profile consumes ``(timestamp, ttft_ms)`` samples and answers mean/CDF queries over a causal moving window. Both the simulator policies and the live real-eval harness parameterize the same estimator; only t...
HarvardMadSys/RouteWise
llm_routewise/core/latency_profile.py
.py
3262d4ad03d05fc6
7.45
7
"""Shared RouteWise budget LP solver. The RouteWise body router solves a small linear program: minimize objective · weights subject to cost · weights <= budget sum(weights) = 1 weights >= 0 With one budget inequality plus the probability-simplex constraints, an optimum is ...
HarvardMadSys/RouteWise
llm_routewise/core/lp.py
.py
841b42f499dbdbf2
7.45
7
"""Shared token-pricing arithmetic for cache-aware request costs. Both the simulator (per-token prices on ``Provider``) and the real-eval harness (per-million prices on ``ProviderSpec``) bill a request as input_price * uncached_input + cached_input_price * cached_input + output_price * output with the cached...
HarvardMadSys/RouteWise
llm_routewise/core/pricing.py
.py
e6064a0f8acbf6aa
7.45
7
"""The RouteWise routing algorithm, written once against ProviderView. This module owns the orchestration shared by RouteWise adapters, including the paper artifact's simulator and real-evaluation harness: * body selector: effective-cost map -> range budget ``B_alpha = (1 - alpha) * c_min + alpha * c_max`` -> budge...
HarvardMadSys/RouteWise
llm_routewise/core/router.py
.py
044a14ff24cf8d94
7.45
7
"""Shared RouteWise decision data contracts. These types are intentionally dependency-free and side-effect-free. They describe policy outputs, not provider state or execution lifecycle mutation. """ from __future__ import annotations from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any if ...
HarvardMadSys/RouteWise
llm_routewise/core/types.py
.py
3d35fe0ff7dfea7a
7.45
7
"""Public exception hierarchy for the RouteWise library facade.""" from __future__ import annotations class RouteWiseError(Exception): """Base class for errors raised by the public RouteWise API.""" class ValidationError(RouteWiseError, ValueError): """Raised when a caller supplies an invalid public-API ar...
HarvardMadSys/RouteWise
llm_routewise/errors.py
.py
26589d3eb5afd3bb
7.45
7
"""Tests for the rolling latency profile's error-aware extensions.""" from __future__ import annotations import pytest from llm_routewise.core.latency_profile import RollingLatencyProfile def _profile_with_samples( samples: list[tuple[float, float]], window_sec: float = 100.0, ) -> RollingLatencyProfile: ...
HarvardMadSys/RouteWise
tests/unit/core/test_latency_profile.py
.py
a9057d992bf1e1a0
7.95
7
# -*- coding: utf-8 -*- """ 领克 App 相关脚本的公共基础模块:H5 / App 原生两套阿里云 API 网关签名算法 (build_signature / build_native_signature),以及 env.json 读写辅助函数 (load_env_data / save_env_fields)。 env.json 结构(三个子对象): { "user": {"username": "", "password": "", "token": "", "refreshToken": "", "deviceId": "", "tokenExp...
shovelshit/LynkCoHelper
LynkCoHelper/lynkco_common.py
.py
2f692776cad36184
7.54
11
# -*- coding: utf-8 -*- """ 领克App 每日任务编排入口(签到 + 分享 + 积分查询 + 结果通知)。 - run_daily_tasks():编排"查积分 -> 签到 -> 分享 -> 再查积分对比",返回结构化结果字典。 - run_and_notify():加载 token -> 执行每日任务 -> 组装 Markdown -> 推送到 Bark。 签到/分享成功后 myEnergy 接口的积分有几秒异步延迟,故查询"之后积分"前会先 sleep。 用法: python3 lynkco_daily_tasks.py # 执行每日任务(签到+分享)并推送结果 """ import...
shovelshit/LynkCoHelper
LynkCoHelper/lynkco_daily_tasks.py
.py
1ebe4865018a8f42
7.54
11
# -*- coding: utf-8 -*- """ Bark 推送通知工具模块,提供两个通用能力(不含任何业务逻辑,供 lynkco_daily_tasks.py 按需调用): - build_markdown_report(result):把任务结果字典组装成 Bark Markdown 文案; - send_bark_notification(...):把一段 Markdown 文案推送到 Bark。 配置方式:环境变量 LYNKCO_BARK_KEY,或 env.json 的 notify.barkKey 字段 (Bark App「我的」页面可查看),未配置时跳过推送并打印提示,不抛异常。 """ imp...
shovelshit/LynkCoHelper
LynkCoHelper/lynkco_notify.py
.py
9d0970c6f75da61a
7.54
11
# -*- coding: utf-8 -*- """ 领克App 分享任务脚本。 分享流程横跨"原生签名"和"H5签名"两套认证体系,接口协议细节、已知限制见 docs/分享任务接口说明.md。重要提醒:接口返回 success 不代表真正加分(每日 有次数上限,重复调用不会重复加分),需自行对比 myEnergy 的 point 字段判断。 do_share() 已封装好"优先简化两步法,失败/无 content_id 时可选回退完整三步法"的 逻辑。通过 lynkco_sign.py / lynkco_daily_tasks.py 运行时会自动执行一次分享; 也可直接运行本文件单独触发一次分享。 """ import js...
shovelshit/LynkCoHelper
LynkCoHelper/lynkco_share.py
.py
c89caf23fec7cbf7
7.54
11
# -*- coding: utf-8 -*- """ 领克App 每日签到脚本。签名算法详见 lynkco_common.py / docs/AppSecret_逆向分析记录.md。 使用前提:需要有效 token,由 lynkco_login.py 的 load_token() 统一提供 (自动续期或人工获取),本脚本无需关心 token 具体来源。 2026-07 抓包更新:真正"执行签到"的接口路径已从 /up/api/v1/user/sign 变为 /up/api/v1/user/sign/upgrade,且改走原生 SDK 签名体系(build_native_signature, NATIVE_APP_KEY/SEC...
shovelshit/LynkCoHelper
LynkCoHelper/lynkco_sign.py
.py
e499d95ac46067fc
7.54
11
#!/usr/bin/env python3 """ Command line interface for Web Forager. This module provides the entry point for the `web-forager` command. """ import argparse import json import logging import sys from collections.abc import Callable from .duckduckgo_news import duckduckgo_news_search from .duckduckgo_search import duckd...
CyranoB/web-forager
src/web_forager/cli.py
.py
16090de2b0675820
7.52
10
#!/usr/bin/env python3 """ DuckDuckGo News Search MCP Tool This tool allows searching for recent news using DuckDuckGo through the MCP framework. It integrates with the ddgs library's news() method to provide time-sorted news results. """ import logging from typing import Any from ddgs import DDGS from ddgs.exceptio...
CyranoB/web-forager
src/web_forager/duckduckgo_news.py
.py
510d246a142ee020
7.52
10
#!/usr/bin/env python3 """ Web Fetch — URL content retrieval with automatic fallback. Tries a direct HTTP fetch with trafilatura for content extraction first. Falls back to the Jina Reader API when direct fetch fails or returns insufficient content (e.g., JavaScript-rendered pages, bot-blocked sites). """ import json...
CyranoB/web-forager
src/web_forager/web_fetch.py
.py
3d84717ccc962576
7.52
10
from __future__ import annotations import asyncio import json import os import shutil from abc import ABC, abstractmethod from datetime import datetime from pathlib import Path from codejoust.core import AgentRun, AgentSpec class AgentNotAvailable(RuntimeError): pass class AgentAdapter(ABC): """Base class...
he-yufeng/CodeJoust
src/codejoust/adapters.py
.py
d80e3f1995a05aa5
7.48
8
from __future__ import annotations from datetime import datetime from pathlib import Path from pydantic import BaseModel, Field class AgentSpec(BaseModel): """An agent that can be asked to solve a task.""" name: str cli: str model: str | None = None extra_args: list[str] = Field(default_factory...
he-yufeng/CodeJoust
src/codejoust/core.py
.py
4fbe0e7bb54fbe73
7.48
8
from __future__ import annotations import contextlib import shutil import subprocess from pathlib import Path class GitError(RuntimeError): pass def _git(args: list[str], cwd: Path) -> str: res = subprocess.run( ["git", *args], cwd=str(cwd), check=False, capture_output=True,...
he-yufeng/CodeJoust
src/codejoust/worktree.py
.py
5e276e55e7adf681
7.48
8
#!/usr/bin/env python3 """Static check: every call to _get_friday_system_prompt() must decide provider/vault_control explicitly. Catches a missing-gate bug BEFORE the rare code path that would have exercised it ever runs. Why this exists ---------------- 2026-08-25: 22 call sites across the codebase built Friday's sys...
FutureSpeakAI/Agent-Friday
scripts/check_gated_prompt_callers.py
.py
02ef4d7fb906136f
7.59
14
#!/usr/bin/env python3 """Import smoke test - catches module-level breakage before it costs an outage. Why this exists --------------- On 2026-08-19 a registration block in services/agent.py was moved ABOVE the dict it mutates, creating a module-level use-before-definition. The server could not import. It died ...
FutureSpeakAI/Agent-Friday
scripts/check_imports.py
.py
6e7365be998cdedc
7.59
14
#!/usr/bin/env python3 """One-shot Google (Gmail + Calendar) connector for Friday. Friday's server can read Gmail and Calendar read-only, but only after a Google OAuth token exists at ``~/.friday/google_token.json``. The OAuth consent step fundamentally requires *you* to approve access in a browser signed into your Go...
FutureSpeakAI/Agent-Friday
scripts/friday_google_connect.py
.py
202a4ddee0fdb5e6
7.59
14
#!/usr/bin/env python """Run the test suite so that a failure is impossible to miss. Why this exists (2026-08-19): sessions verify their work with pytest tests/ -q | tail -5 A shell pipeline exits with the status of its LAST command, so `tail`'s 0 replaces pytest's 1 and a suite with failures in it reports succe...
FutureSpeakAI/Agent-Friday
scripts/run_tests.py
.py
61035a4f8863f7f0
7.09
14
# Block ROS 2 launch_testing plugins that try to load at import-time # and fail because pyyaml isn't available in this venv. # # The plugins are registered via setuptools entry-points installed # system-wide by the ROS 2 Humble packages. We must prevent the # import from even being attempted by monkeypatching importlib...
guilyx/flybots
conftest.py
.py
05185ab6d784f0ca
8.02
10
# Erwin Lejeune - 2026-02-18 """Discovery of the runnable simulations. Simulations live at ``flybots/simulations/<category>/<name>/run.py``. Rather than maintaining a hand-written registry that drifts out of date, this module walks the package and reads each simulation's metadata from its own docstring and README. """...
guilyx/flybots
src/flybots/cli/catalogue.py
.py
5898b537ae8f26de
7.52
10
# Erwin Lejeune - 2026-02-18 """Terminal styling helpers. Deliberately tiny and dependency-free. Colour is disabled automatically when the output is not a TTY, when ``NO_COLOR`` is set (see https://no-color.org), or when ``TERM=dumb`` — so piping ``flybots list`` into a file gives clean text. """ from __future__ impo...
guilyx/flybots
src/flybots/cli/console.py
.py
1b76f19b0c3531f2
7.52
10
# Erwin Lejeune - 2026-08-27 """Controllers that treat the radio network as part of the plant. Two problems that look similar and are not: * **Connectivity maintenance** -- the fleet has a task, and the network must survive it. Connectivity is a *constraint*. * **Relay coverage** -- the fleet's task *is* the networ...
guilyx/flybots
src/flybots/comms/controllers.py
.py
b8d3f6c0c3a2d938
7.52
10
# Erwin Lejeune - 2026-08-27 """Graph metrics for a flying network, and their gradients. The quantity that matters is the **algebraic connectivity** λ₂: the second smallest eigenvalue of the weighted graph Laplacian. It is strictly positive exactly while the network is connected, and it degrades smoothly as links stre...
guilyx/flybots
src/flybots/comms/graph.py
.py
b5ceddab5768b2c2
7.52
10
# Erwin Lejeune - 2026-08-27 """Link models: how good is the radio between two aircraft. Most swarm papers use a *disk* model -- connected inside a radius, not outside -- which is convenient and produces a discontinuous graph. Every connectivity controller worth having differentiates the graph, so a hard disk gives a ...
guilyx/flybots
src/flybots/comms/radio.py
.py
86eefadddc34a49d
7.52
10
# Erwin Lejeune - 2026-02-15 """Attitude P controller. Maps desired Euler angles ``[phi_des, theta_des, psi_des]`` and a thrust scalar to desired body rates via proportional gain, then feeds into the :class:`RateController` to produce torques. The D-term is intentionally omitted: the RateController already provides a...
guilyx/flybots
src/flybots/control/attitude_controller.py
.py
dba4ee95b2e55dd6
7.52
10
# Erwin Lejeune - 2026-02-15 """Composite flight controller that stacks the four control layers. Supports multiple :class:`ControlMode` values so callers can inject commands at any abstraction level (rates, attitude, velocity, or position). """ from __future__ import annotations from enum import Enum, auto import n...
guilyx/flybots
src/flybots/control/flight_controller.py
.py
6d8a8b79ecc7f505
7.52
10
# Erwin Lejeune - 2026-02-15 """Position controller — maps desired position to desired velocity. Uses measured velocity as the derivative term instead of finite-differencing position error, which avoids 1/dt noise amplification and setpoint kick. Output: ``desired_velocity`` (world frame) for the :class:`VelocityCont...
guilyx/flybots
src/flybots/control/position_controller.py
.py
2b57a99c0952236f
7.52
10
# Erwin Lejeune - 2026-02-15 """Body-rate P controller (innermost loop). Maps desired body rates ``[p_des, q_des, r_des]`` to torques ``[tau_x, tau_y, tau_z]`` using proportional gain scaled to the vehicle inertia. Gains are kept intentionally conservative to avoid the aggressive angular accelerations that cause osci...
guilyx/flybots
src/flybots/control/rate_controller.py
.py
699ecf9f20fd940f
7.52
10
# Erwin Lejeune - 2026-02-15 """Velocity controller — maps desired velocity to attitude + thrust. This is where the conversion from "twist commands" to desired roll/pitch/yaw and collective thrust happens, mirroring the velocity-control loop in PX4. Output: ``(desired_euler, thrust)`` ready for the :class:`AttitudeCo...
guilyx/flybots
src/flybots/control/velocity_controller.py
.py
818486f77c5428a0
7.52
10
# Erwin Lejeune - 2026-02-18 """Footprint-aware inflation layer for costmaps. Uses the vehicle :class:`BaseFootprint` bounding radius to determine the inflation distance, producing a safety margin that exactly matches the robot's physical extent. This is particularly useful for swarm envelopes where a convex hull foo...
guilyx/flybots
src/flybots/costmap/footprint_layer.py
.py
281aead5e197203b
7.52
10
# Erwin Lejeune - 2026-02-21 """Obstacle inflation layer for safe-distance costmaps. Applies a distance-based cost decay around each occupied cell, ensuring the planner keeps a minimum clearance from obstacles. Supports two decay modes: - ``"exponential"``: ``cost = exp(-scaling * d)`` (default, original) - ``"line...
guilyx/flybots
src/flybots/costmap/inflation_layer.py
.py
4706895c13f8088a
7.52
10
# Erwin Lejeune - 2026-02-17 """Dynamic social costmap layer based on agent velocity. Increases cost in front of moving dynamic agents proportional to their speed, modelling the social discomfort / collision risk of passing close to a fast-moving entity. Reference: P. Trautman, A. Krause, "Unfreezing the Robot: Navig...
guilyx/flybots
src/flybots/costmap/social_layer.py
.py
b8bb963756f6ecd7
7.52
10
"""Speed-aware additive layer for 2D costmaps.""" from __future__ import annotations import numpy as np from numpy.typing import NDArray class VelocityCostLayer: """Increase local cost proportionally to ego speed. The layer is blended with an existing costmap by adding a bounded penalty. This keeps occ...
guilyx/flybots
src/flybots/costmap/velocity_layer.py
.py
cffac8dfede752e6
7.52
10
# Erwin Lejeune - 2026-02-17 """Procedural building generators for urban environments.""" from __future__ import annotations import numpy as np from flybots.environment.obstacles import BoxObstacle from flybots.environment.world import World def add_city_grid( world: World, n_blocks: tuple[int, int] = (3, ...
guilyx/flybots
src/flybots/environment/buildings.py
.py
296ac26b453baa9d
7.52
10
# Erwin Lejeune - 2026-02-15 """Environment factories and presets. Provides ready-made environments (city, indoor, open field) with matched drone scale suggestions. Every simulation should use one of these factories to ensure consistent, comparable GIFs. Usage:: world, buildings = default_world() world, buil...
guilyx/flybots
src/flybots/environment/default_world.py
.py
4399e872ba61f2cc
7.52
10
# Erwin Lejeune - 2026-02-16 """Complementary filter for attitude estimation from gyro + accelerometer. Reference: R. Mahony, T. Hamel, J.-M. Pflimlin, "Nonlinear Complementary Filters on the Special Orthogonal Group," IEEE TAC, 2008. DOI: 10.1109/TAC.2008.923738 """ from __future__ import annotations import numpy a...
guilyx/flybots
src/flybots/estimation/complementary_filter.py
.py
f16f43801d8c5a62
7.52
10
# Erwin Lejeune - 2026-02-16 """Extended Kalman Filter for nonlinear state estimation. Reference: S. Thrun, W. Burgard, D. Fox, "Probabilistic Robotics," MIT Press, 2005, Chapter 3.3. """ from __future__ import annotations from collections.abc import Callable import numpy as np from numpy.typing import NDArray cl...
guilyx/flybots
src/flybots/estimation/ekf.py
.py
a704325735c5bb18
7.52
10
# Erwin Lejeune - 2026-02-16 """Particle filter (sequential importance resampling) for state estimation. Reference: M. S. Arulampalam et al., "A Tutorial on Particle Filters for Online Nonlinear/Non-Gaussian Bayesian Tracking," IEEE TSP, 2002. DOI: 10.1109/78.978374 """ from __future__ import annotations from collec...
guilyx/flybots
src/flybots/estimation/particle_filter.py
.py
7fd22404670e97ae
7.52
10
# Erwin Lejeune - 2026-02-22 """Discrete-time process-noise covariances for constant-velocity models. A Kalman filter's ``Q`` is the covariance accumulated over **one step**, so it has to scale with ``dt``. Writing ``Q = diag([...])`` with fixed numbers is the single most common way to detune a filter: at 200 Hz...
guilyx/flybots
src/flybots/estimation/process_noise.py
.py
7bd22007bf46e5a8
7.52
10
# Erwin Lejeune - 2026-02-16 """Unscented Kalman Filter using Van der Merwe scaled sigma points. Reference: E. A. Wan, R. Van Der Merwe, "The Unscented Kalman Filter for Nonlinear Estimation," AS-SPCC, 2000. DOI: 10.1109/ASSPCC.2000.882463 """ from __future__ import annotations from collections.abc import Callable ...
guilyx/flybots
src/flybots/estimation/ukf.py
.py
44cff7aafe2b7418
7.52
10