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 2010-present MongoDB, Inc.
#
# 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 applicable law or agreed to in wri... | Judiciousmurich/full-stack-data-connector-platform | backend/.venv/lib/python3.9/site-packages/bson/min_key.py | .py | e501ed228c2078ee | 7 | 0 |
# Copyright 2009-2015 MongoDB, Inc.
#
# 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 applicable law or agreed to in writin... | Judiciousmurich/full-stack-data-connector-platform | backend/.venv/lib/python3.9/site-packages/bson/objectid.py | .py | f6391bb582a823aa | 7 | 0 |
# Copyright 2013-present MongoDB, Inc.
#
# 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 applicable law or agreed to in wri... | Judiciousmurich/full-stack-data-connector-platform | backend/.venv/lib/python3.9/site-packages/bson/regex.py | .py | c1e3cbffa13e87d6 | 7 | 0 |
# Copyright 2009-present MongoDB, Inc.
#
# 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 applicable law or agreed to in wri... | Judiciousmurich/full-stack-data-connector-platform | backend/.venv/lib/python3.9/site-packages/bson/son.py | .py | ce624ad208756c06 | 7 | 0 |
# Copyright 2010-2015 MongoDB, Inc.
#
# 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 applicable law or agreed to in writin... | Judiciousmurich/full-stack-data-connector-platform | backend/.venv/lib/python3.9/site-packages/bson/timestamp.py | .py | a51a629a2e079605 | 7 | 0 |
# Copyright 2010-2015 MongoDB, Inc.
#
# 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 applicable law or agreed to in writin... | Judiciousmurich/full-stack-data-connector-platform | backend/.venv/lib/python3.9/site-packages/bson/tz_util.py | .py | 2ffab461bd721408 | 7 | 0 |
import logging
from typing import Dict, Type, Optional
from sqlalchemy.exc import CompileError
from clickhouse_connect.datatypes.base import ClickHouseType, TypeDef, EMPTY_TYPE_DEF
from clickhouse_connect.datatypes.registry import parse_name, type_map
from clickhouse_connect.driver.binding import str_query_value
log... | Judiciousmurich/full-stack-data-connector-platform | backend/.venv/lib/python3.9/site-packages/clickhouse_connect/cc_sqlalchemy/datatypes/base.py | .py | 6aaaa285cc9802ec | 7 | 0 |
from sqlalchemy.sql.ddl import DDL
from sqlalchemy.exc import ArgumentError
from clickhouse_connect.driver.binding import quote_identifier
# pylint: disable=too-many-ancestors,abstract-method
class CreateDatabase(DDL):
"""
SqlAlchemy DDL statement that is essentially an alternative to the built in CreateSch... | Judiciousmurich/full-stack-data-connector-platform | backend/.venv/lib/python3.9/site-packages/clickhouse_connect/cc_sqlalchemy/ddl/custom.py | .py | fe108b836b4ae9de | 7 | 0 |
from typing import Optional, Union
from sqlalchemy import Table
from sqlalchemy.sql.selectable import FromClause, Select
from clickhouse_connect.driver.binding import quote_identifier
# Dialect name used for non-rendering statement hints that only serve to
# differentiate cache keys when FINAL/SAMPLE modifiers are a... | Judiciousmurich/full-stack-data-connector-platform | backend/.venv/lib/python3.9/site-packages/clickhouse_connect/cc_sqlalchemy/sql/__init__.py | .py | 39ffddffb1d564e5 | 7 | 0 |
from typing import Optional
from sqlalchemy import and_, true
from sqlalchemy.sql.base import Immutable
from sqlalchemy.sql.selectable import FromClause, Join
from sqlalchemy.sql.visitors import InternalTraversal
def _normalize_array_columns(array_column, alias):
"""Normalize single/multi column input into a lis... | Judiciousmurich/full-stack-data-connector-platform | backend/.venv/lib/python3.9/site-packages/clickhouse_connect/cc_sqlalchemy/sql/clauses.py | .py | 91aded04b079ee18 | 7 | 0 |
from sqlalchemy.exc import CompileError
from sqlalchemy.sql import elements, sqltypes
from sqlalchemy.sql.compiler import SQLCompiler
from clickhouse_connect.cc_sqlalchemy import ArrayJoin
from clickhouse_connect.cc_sqlalchemy.datatypes.base import ChSqlaType
from clickhouse_connect.cc_sqlalchemy.sql import format_tab... | Judiciousmurich/full-stack-data-connector-platform | backend/.venv/lib/python3.9/site-packages/clickhouse_connect/cc_sqlalchemy/sql/compiler.py | .py | e23c35c1b35d0f00 | 7 | 0 |
#!/usr/bin/env python3
"""Small, copyable checks for work-normalized and rank-three tensor metrics."""
from __future__ import annotations
import argparse
from dataclasses import dataclass
from typing import Iterable
import torch
@dataclass(frozen=True)
class WorkWindow:
"""Totals observed over one already-time... | future3317/scientific-performance-engineering | assets/materials_gnn_checks.py | .py | aa37294d31e4374e | 7 | 0 |
"""Executable-workload boundary calibration, separate from synthetic CEGIS."""
from __future__ import annotations
from dataclasses import dataclass
import random
from statistics import mean
from typing import Any, Callable, Mapping, Sequence
@dataclass(frozen=True)
class EmpiricalBoundaryCase:
context_id: str
... | future3317/scientific-performance-engineering | benchmark/boundary/empirical.py | .py | e1cc69dcb38896f8 | 7 | 0 |
"""Deterministic BoundaryBench views over the canonical family catalog."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from core.acre.cegis import BoundaryObservation, StatisticalCEGIS
from core.acre.predicates import PredicateGrammar
from benchmark.families import fam... | future3317/scientific-performance-engineering | benchmark/boundary/families.py | .py | b409fe3578408b80 | 7 | 0 |
"""Shared subprocess boundary for calibration and formal cell execution."""
from __future__ import annotations
from pathlib import Path
from typing import Any
from benchmark.harness import runner
from benchmark.provenance import digest_mapping, file_digest
def executor_digest(repo_root: str | Path) -> str:
"""... | future3317/scientific-performance-engineering | benchmark/calibration/execution.py | .py | c6f6c73143c1334a | 7 | 0 |
"""Calibration identity and JSON digest primitives."""
from __future__ import annotations
import hashlib
from pathlib import Path
from typing import Any
from benchmark.provenance import json_digest
PACKAGE_DIRS = ("workspace", "public_tests", "hidden_verifier", "oracle")
PACKAGE_FILES = ("task.yaml", "metadata.json"... | future3317/scientific-performance-engineering | benchmark/calibration/identity.py | .py | d68d0147875f3773 | 7 | 0 |
"""Canonical derived state for one calibration cell."""
from __future__ import annotations
from typing import Any
def derive_cell_state(result: dict[str, Any]) -> str:
"""Derive one state from the persisted execution facts.
The legacy JSON fields remain as reporting fields, but callers should use
this ... | future3317/scientific-performance-engineering | benchmark/calibration/state.py | .py | b606923d5ec166a3 | 7 | 0 |
"""Cross-view checks for the canonical Family workload source."""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any
from benchmark.harness import miniyaml
from .catalog import FAMILY_SPECS, family_instances, family_views, resolve_family_id, transformation, poisoning_tran... | future3317/scientific-performance-engineering | benchmark/families/consistency.py | .py | d3940861d1daccfc | 7 | 0 |
"""Family-owned environment semantics shared by evolution conditions."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Mapping, Sequence
import math
@dataclass(frozen=True)
class EpisodeEnvironmentState:
"""Persistent regime state for one sequential evolution episo... | future3317/scientific-performance-engineering | benchmark/families/environment.py | .py | 91e82e728b8f9340 | 7 | 0 |
#!/usr/bin/env python3
"""Named workspace API contracts (BENCHMARK_DESIGN.md sections 4 and 11).
A task pins the agent-visible entrypoint contract via ``task.yaml: workspace.api``.
This module is the registry of those contracts. Each spec describes the callables
the workspace entrypoint module must expose; the harness... | future3317/scientific-performance-engineering | benchmark/harness/api.py | .py | e88d53cf78c1b092 | 7 | 0 |
#!/usr/bin/env python3
"""Experimental conditions A-D materialization (BENCHMARK_DESIGN.md section 9).
Each condition builds an isolated skill copy from a pinned, rendered skill-view
bundle with the
appropriate read-only/writable bits and an injection policy, then hash-attests
the result so a run can prove which skill... | future3317/scientific-performance-engineering | benchmark/harness/conditions.py | .py | c8377e4767ae84e3 | 7 | 0 |
"""PostgreSQL connection pool + migration runner."""
from contextlib import contextmanager
import logging
import os
import psycopg2
import psycopg2.pool
import psycopg2.extras
from . import config
_pool: psycopg2.pool.ThreadedConnectionPool | None = None
logger = logging.getLogger(__name__)
MIGRATIONS_DIR = os.path.j... | GwoFinTech/kazusa-home-portal | app/db.py | .py | eab7e3e8a4f71a51 | 7.15 | 1 |
"""
ml_engine/integration.py
Connects the ML predictor to T_BOT's existing async market loop.
Drop-in usage inside T_BOT
--------------------------
from ml_engine.integration import ml_signal, format_telegram_alert
pred = await ml_signal("XAUUSD", m15_bars, h1_bars, h4_bars)
if pred is None:
retur... | Divyanshu-007v/ml-market-trend-predictor | ml_engine/integration.py | .py | 74a49a58011191a4 | 7 | 0 |
"""
ml_engine/labeler.py
Creates Up / Down / Flat labels from forward returns.
UP (+1) : future_return > threshold
FLAT ( 0) : |future_return| <= threshold
DOWN (-1) : future_return < -threshold
Lookahead of 10 M15 bars = 2h 30m forward view.
"""
from __future__ import annotations
import logging
import nump... | Divyanshu-007v/ml-market-trend-predictor | ml_engine/labeler.py | .py | 9d49b20fd97910bf | 7 | 0 |
"""
ml_engine/predictor.py
Real-time direction prediction from live M15/H1/H4 bars.
Flow
----
1. Pass latest N bars (≥ 60 recommended for indicator warm-up)
2. build_features() computes the feature row for the last bar
3. XGBoost returns P(Down), P(Flat), P(Up)
4. If winning class prob ≥ CONFIDENCE_THRESHOLD → actiona... | Divyanshu-007v/ml-market-trend-predictor | ml_engine/predictor.py | .py | f0d095932954a892 | 7 | 0 |
#!/usr/bin/env python3
"""
Benchmark layout algorithms using generated test graphs.
Usage:
uv run python scripts/benchmark_layouts.py [--graphs PATTERN] [--algorithms ALGO,...]
Examples:
uv run python scripts/benchmark_layouts.py
uv run python scripts/benchmark_layouts.py --graphs "medium_*"
uv run py... | shakfu/graph-layout | scripts/benchmark_layouts.py | .py | 542d9378594a0d61 | 7.15 | 1 |
"""
MkDocs hooks for graph-layout.
Renders ```graph-layout fenced blocks in the documentation into inline SVG by
executing the block against the installed library, so every figure in the docs
is produced by the code shown next to it and cannot drift from the API.
Wire it up in mkdocs.yml:
hooks:
- scripts/... | shakfu/graph-layout | scripts/mkdocs_hooks.py | .py | 14c9464615fd1978 | 7.15 | 1 |
#!/usr/bin/env python3
"""
Profile Kandinsky orthogonal layout to identify optimization hotspots.
"""
import cProfile
import json
import pstats
import time
from io import StringIO
from pathlib import Path
from graph_layout import KandinskyLayout
def load_graph(filepath: Path) -> tuple[list[dict], list[dict]]:
"... | shakfu/graph-layout | scripts/profile_kandinsky.py | .py | 07171f8dd9c46ea0 | 7.15 | 1 |
#!/usr/bin/env python3
"""
Visualization script for graph layout algorithms.
Generates images for all layout algorithms into ./build/
Usage:
uv run python scripts/visualize.py
"""
from pathlib import Path
import matplotlib.pyplot as plt
from graph_layout.circular import CircularLayout, ShellLayout
from graph_l... | shakfu/graph-layout | scripts/visualize.py | .py | 38f651b72d68eec3 | 7.15 | 1 |
"""
Shortest paths calculation using Dijkstra's algorithm.
This module provides efficient all-pairs shortest path calculation
using Dijkstra's algorithm with a pairing heap priority queue.
"""
from __future__ import annotations
from typing import Callable, Generic, Optional, TypeVar, cast
from .pqueue import Pairin... | shakfu/graph-layout | src/graph_layout/cola/_shortestpaths_py.py | .py | f159702b747ac8d6 | 7.65 | 1 |
"""
Batch layout operations.
This module provides utility functions for grid-based layouts and
power graph layouts with edge routing.
"""
from __future__ import annotations
from typing import Any
from .geom import Point
from .gridrouter import GridRouter
from .layout import Layout, Node
def gridify(
pg_layout... | shakfu/graph-layout | src/graph_layout/cola/batch.py | .py | d4b59bca3e21fc88 | 7.15 | 1 |
"""
Gradient descent for graph layout stress minimization.
This module implements gradient descent with Runge-Kutta integration
to minimize stress in graph layouts with ideal edge lengths.
"""
from __future__ import annotations
import math
from typing import Callable, Optional
import numpy as np
class Locks:
... | shakfu/graph-layout | src/graph_layout/cola/descent.py | .py | b8f27eae3db91388 | 7.15 | 1 |
"""
Handle disconnected graph components.
This module provides utilities for separating disconnected components
and packing them efficiently in the layout space.
"""
from __future__ import annotations
import math
from typing import Any
# Packing configuration
PADDING = 10
GOLDEN_SECTION = (1 + math.sqrt(5)) / 2
FLO... | shakfu/graph-layout | src/graph_layout/cola/handledisconnected.py | .py | 703367633e594422 | 7.15 | 1 |
"""
3D graph layout using force-directed placement.
This module extends the force-directed layout to 3D space.
"""
from __future__ import annotations
import math
import random
from typing import Optional
import numpy as np
from .descent import Descent
from .linklengths import LinkLengthAccessor, jaccard_link_lengt... | shakfu/graph-layout | src/graph_layout/cola/layout3d.py | .py | 77420301c784e087 | 7.15 | 1 |
"""
Link length utilities and constraint generation.
This module provides utilities for computing link lengths based on graph
structure and generating constraints for directed graphs.
"""
from __future__ import annotations
import math
from typing import Callable, Generic, Literal, Optional, TypeVar
T = TypeVar("T")... | shakfu/graph-layout | src/graph_layout/cola/linklengths.py | .py | f6dac5ee80e88e27 | 7.15 | 1 |
"""
Power graph clustering algorithm.
This module implements hierarchical graph clustering using greedy merging
based on edge intersection patterns.
"""
from __future__ import annotations
from typing import Any, Callable, Generic, Optional, TypeVar
from .linklengths import LinkAccessor
T = TypeVar("T")
class Lin... | shakfu/graph-layout | src/graph_layout/cola/powergraph.py | .py | 65848e0d018bbe59 | 7.15 | 1 |
"""
Minimal Red-Black Tree adapter using sortedcontainers.SortedList.
This provides just the interface needed by rectangle.py without implementing
a full Red-Black Tree from scratch.
"""
from __future__ import annotations
from typing import Callable, Generic, Optional, TypeVar, cast
from sortedcontainers import Sor... | shakfu/graph-layout | src/graph_layout/cola/rbtree.py | .py | 485c0eb825fa5810 | 7.15 | 1 |
"""
Shortest paths calculation with optimized implementations.
This module provides shortest path calculations with automatic implementation selection:
1. Cython-compiled Dijkstra (fastest, pre-built in PyPI wheels)
2. Pure Python Dijkstra (fallback, always available)
The implementation is selected automatically at i... | shakfu/graph-layout | src/graph_layout/cola/shortestpaths.py | .py | 82bac19c89f02bd2 | 7.65 | 1 |
"""
VPSC (Variable Placement with Separation Constraints) solver.
This module implements a constraint solver for maintaining separation constraints
between variables while minimizing a quadratic cost function.
"""
from __future__ import annotations
from typing import Any, Callable, Optional
class PositionStats:
... | shakfu/graph-layout | src/graph_layout/cola/vpsc.py | .py | 9ae29bc341ce4d77 | 7.15 | 1 |
"""
DOT (Graphviz) export for graph layouts.
Generates DOT format representations that can be used with Graphviz
tools (dot, neato, fdp, etc.) or imported into other graph tools.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Sequence
if TYPE_CHECKING:
from ..base import... | shakfu/graph-layout | src/graph_layout/export/dot.py | .py | 61c195be3fc1a671 | 7.15 | 1 |
"""
GraphML export for graph layouts.
Generates GraphML format representations, an XML-based format for
graph data interchange.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Sequence
from xml.sax.saxutils import escape
if TYPE_CHECKING:
from ..base import BaseLayout
... | shakfu/graph-layout | src/graph_layout/export/graphml.py | .py | f3ea2e8d56a3e4a4 | 7.15 | 1 |
"""
SVG export for graph layouts.
Generates SVG representations of graph layouts, supporting both simple
node-edge graphs and orthogonal layouts with bends.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Sequence
from xml.sax.saxutils import escape
if TYPE_CHECKING:
from... | shakfu/graph-layout | src/graph_layout/export/svg.py | .py | 3e12ad886e825530 | 7.15 | 1 |
"""Brandes-Köpf horizontal coordinate assignment for layered (Sugiyama) graphs.
Implements "Fast and Simple Horizontal Coordinate Assignment"
(Brandes & Köpf, 2002). Given a *proper* layered graph -- every edge connects
adjacent layers, long edges already split by dummy nodes -- with a fixed vertex
ordering per layer,... | shakfu/graph-layout | src/graph_layout/hierarchical/_brandes_koepf.py | .py | a2eed34961a7ea26 | 7.15 | 1 |
"""
Sentinel ML inference layer — ZERO-SHOT approach.
Why zero-shot instead of fine-tuning our own checkpoint:
Our own labelled dataset (data/ml/raw/) currently has ~36 examples.
That is nowhere near enough to honestly claim "we trained a multilingual
model" — a judge asking "how much data?" deserves a real answ... | priyankakeshava/sentinel-sihSPIDEYGEEKS-dark-pattern-auditor | sentinel-merged/ml/classifier.py | .py | 4a3c4c26eadf7c67 | 7 | 0 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["fonttools", "brotli"]
# ///
"""
Organize font files into subdirectories by font family name.
Reads each font file's internal name table to determine its family,
then moves it into ./fonts/<family>/.
Usage:
uv run organize_fonts.py... | trtmn/agent-plugins | plugins/font-extractor/skills/font-extractor/scripts/organize_fonts.py | .py | 8d30f47a1afd0f9f | 7.24 | 2 |
#!/usr/bin/env python3
"""Extract Recipe JSON-LD from an HTML file or URL.
Usage:
extract_jsonld.py <path_or_url>
Reads HTML from a local file path or fetches from a URL.
Finds <script type="application/ld+json"> blocks containing @type: Recipe.
Handles both top-level Recipe objects and @graph arrays.
Outputs a ... | trtmn/agent-plugins | plugins/recipe-fetch/skills/recipe-fetch/scripts/extract_jsonld.py | .py | 79d879db840e6d7e | 7.24 | 2 |
#!/usr/bin/env python3
"""Analyze blind A/B human-evaluation responses for singability.
Reads per-rater CSVs from data/human_eval/responses/*.csv plus the answer key
(human_eval_key.csv), decodes the A/B labels back to conditions (vanilla vs
blt), and reports:
- preference rate for BLT over all rater x case judgment... | guan404ming/blt-skills | scripts/analyze_human_eval.py | .py | b191f1277418cce7 | 7 | 0 |
#!/usr/bin/env python3
"""Gold references and translation loaders shared by build_comet_payload.py."""
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
BENCH = ROOT / "data" / "bench"
SONGS = json.load(open(next(BENCH.glob("agent_haiku/*_agent/test_songs.json"))))
def gold_lines()... | guan404ming/blt-skills | scripts/score_semantics.py | .py | 9992c5695103f2d4 | 7 | 0 |
#!/usr/bin/env python3
"""Intrinsic check of the syllable counter against CMUdict (English) and pyphen (Spanish).
Usage:
uv run --with cmudict scripts/validate_counter.py --songs <run>/test_songs.json --spanish <es_run>/partial
"""
import argparse
import glob
import json
import re
import cmudict
import pyphen
f... | guan404ming/blt-skills | scripts/validate_counter.py | .py | b1c0e6c6881f388c | 7 | 0 |
"""IPA conversion and phonetic similarity."""
from __future__ import annotations
import logging
import os
import re
import threading
from pathlib import Path
import panphon.distance
from pypinyin import lazy_pinyin
_ft = panphon.distance.Distance()
def _ensure_espeak_library() -> None:
"""Locate libespeak-ng ... | guan404ming/blt-skills | src/blt_skills/phonetics.py | .py | 2e007dcd81aa936e | 7 | 0 |
"""Rhyme analysis: ending extraction, rhyme checking, scheme detection."""
from __future__ import annotations
import re
from .phonetics import IPA_DIPHTHONG_PATTERN, normalize_language_code, phonemize_text
def extract_rhyme_ending(text: str, language: str) -> str:
"""Extract the rhyme ending from text.
Fo... | guan404ming/blt-skills | src/blt_skills/rhyme.py | .py | 99331bce906be510 | 7 | 0 |
"""Syllable counting using IPA-based analysis."""
from __future__ import annotations
import re
from .phonetics import IPA_DIPHTHONG_PATTERN, normalize_language_code, phonemize_text
# Small kana that combine with the preceding kana and do not add a mora.
_JA_SMALL_KANA = set("ゃゅょぁぃぅぇぉャュョァィゥェォ")
_PUNCT = r"[,;.!?,。;!... | guan404ming/blt-skills | src/blt_skills/syllables.py | .py | 51515ef9beffd969 | 7 | 0 |
"""GUI entry point: a pywebview window bridging to the CLI internals.
The frontend (gui/ at the repo root, Vite + TypeScript) is built into
ai_config/gui_assets/ and loaded as a local file. Frontend calls arrive
through pywebview's js_api bridge as methods on GuiApi.
"""
import contextlib
import io
import re
import s... | CSL426/ai-config | ai_config/gui.py | .py | 883e130b1d071103 | 7 | 0 |
"""Package a shared skill as a ZIP for manual upload to Claude Desktop.
Claude Desktop has no writable local skills directory; custom skills are
uploaded as a ZIP through Settings > Customize > Skills. This module finds a
skill under claude/shared/{both,agy,codex} and zips it in that format (the
skill directory itself... | CSL426/ai-config | ai_config/package.py | .py | 4c6e9a889edf272c | 7 | 0 |
import os
import sys
from pathlib import Path
from .config import ConfigError, configured_data_repo, default_data_repo
HOME = Path(os.environ.get("HOME", str(Path.home())))
CONFIG_ERROR = None
try:
configured_repo = configured_data_repo()
except ConfigError as exc:
configured_repo = None
CONFIG_ERROR = s... | CSL426/ai-config | ai_config/paths.py | .py | b286d87cbd18c668 | 7 | 0 |
"""Claude Code: staging projection, init, apply.
Claude is the source of truth — init syncs everything, including deletions."""
import shutil
from pathlib import Path
from ..console import log_error, log_header, log_info, log_success
from ..fsops import copy_file_to_stage, mirror_dir, overlay_dir_to_stage, safe_cp
fr... | CSL426/ai-config | ai_config/tools/claude.py | .py | a4aa63cf822c0d98 | 7 | 0 |
"""AntigravityCliBackend — AgentBackend wrapping `agy --print` final output."""
import asyncio
import contextlib
import json
from collections.abc import AsyncIterator
from pathlib import Path
import aiofiles
from src.agents.backends.base import (
AgentBackend,
make_error_event,
make_result_event,
make_text_e... | chnlich/charlie-bot | src/agents/backends/antigravity_cli.py | .py | 688b59c596aebb6e | 7.35 | 4 |
"""ClaudeCodeBackend — concrete AgentBackend wrapping the Claude Code CLI."""
import asyncio
import os
import signal
from pathlib import Path
import structlog
from src.agents.backends.base import AgentBackend
from src.core.process import kill_process_group
log = structlog.get_logger()
BASE_COMMAND: list[str] = [
... | chnlich/charlie-bot | src/agents/backends/claude_code.py | .py | e641432854fb759a | 7.35 | 4 |
"""CodexBackend — AgentBackend wrapping the `codex exec --json` CLI."""
import asyncio
import contextlib
import json
import os
import signal
from pathlib import Path
import structlog
from src.agents.backends.base import (
AgentBackend,
make_error_event,
make_result_event,
make_text_event,
make_tool_result_... | chnlich/charlie-bot | src/agents/backends/codex.py | .py | 6385818dade07409 | 7.35 | 4 |
"""GeminiCliBackend — AgentBackend wrapping the `gemini` CLI in stream-json mode."""
from pathlib import Path
import structlog
from src.agents.backends.base import (
AgentBackend,
make_error_event,
make_result_event,
make_text_event,
make_tool_result_event,
make_tool_use_event,
resolve_binary,
)
log =... | chnlich/charlie-bot | src/agents/backends/gemini_cli.py | .py | e3a1ba0f1eecfd5f | 7.35 | 4 |
"""KimiBackend — ClaudeCodeBackend configured to use Kimi's Anthropic-compatible endpoint."""
from src.agents.backends.claude_code import ClaudeCodeBackend, claude_model_env
_MOONSHOT_BASE_URL = "https://api.moonshot.cn/anthropic"
class KimiBackend(ClaudeCodeBackend):
"""Runs Claude Code CLI against Kimi's Anthro... | chnlich/charlie-bot | src/agents/backends/kimi.py | .py | f4f2ab29b8bacbf0 | 7.35 | 4 |
"""OpenAICompatibleClaudeBackend — Claude Code via CharlieBot's Anthropic proxy."""
from src.agents.backends.claude_code import ClaudeCodeBackend, claude_model_env
class OpenAICompatibleClaudeBackend(ClaudeCodeBackend):
"""Runs Claude Code against CharlieBot's Anthropic-to-OpenAI-compatible proxy.
The upstream ... | chnlich/charlie-bot | src/agents/backends/openai_compatible_claude.py | .py | 8304ce8b49388145 | 7.35 | 4 |
"""Shared tmux/PTY helpers for browser-backed interactive terminals."""
from __future__ import annotations
import asyncio
import base64
import fcntl
import json
import os
import pty
import shutil
import signal
import struct
import tempfile
import termios
import structlog
from fastapi import WebSocket, WebSocketDisco... | chnlich/charlie-bot | src/agents/backends/pty_common.py | .py | 304d8b05eaafa45e | 7.35 | 4 |
"""Backend registry — constructs the correct AgentBackend from a BackendOption."""
from typing import Any
from src.agents.backends.antigravity_cli import AntigravityCliBackend
from src.agents.backends.base import AgentBackend
from src.agents.backends.charlie_code import CharlieCodeBackend
from src.agents.backends.cla... | chnlich/charlie-bot | src/agents/backends/registry.py | .py | fb41a315e15b47d3 | 7.35 | 4 |
"""Per-profile web terminal backed by one tmux session."""
from __future__ import annotations
import asyncio
import hashlib
import os
from pathlib import Path
import structlog
from fastapi import WebSocket
from src.agents.backends.pty_common import (
PTY_EXIT,
PtyAttachment,
_run_pty_relay,
_run_tmux,
_st... | chnlich/charlie-bot | src/agents/backends/terminal.py | .py | 8c81ae1d8e8bf3f2 | 7.35 | 4 |
"""TUI backend — runs the `claude` CLI inside an isolated tmux session.
Each CharlieBot session_id maps to one tmux session named ``charliebot-{id}``
under the ``charliebot`` tmux socket so it never collides with the user's
normal tmux sessions. Per WebSocket connection, a ``tmux attach`` PTY is
spawned and bytes are ... | chnlich/charlie-bot | src/agents/backends/tui.py | .py | 635da5075d983a20 | 7.35 | 4 |
"""Worker Agent — spawns and monitors Claude Code CLI subprocesses."""
import asyncio
import json
import os
from collections.abc import Awaitable, Callable
from datetime import UTC, datetime
from pathlib import Path
import aiofiles
import structlog
from aiofiles.threadpool.text import AsyncTextIOWrapper
from src.age... | chnlich/charlie-bot | src/agents/worker.py | .py | c3bd1c3c2949d2b1 | 7.35 | 4 |
"""Bearer-token authentication middleware for CharlieBot."""
import hmac
import json
from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint
from starlette.requests import Request
from starlette.responses import HTMLResponse, Response
from src.core.config import get_config
def request_has... | chnlich/charlie-bot | src/api/auth.py | .py | 30201897297766d1 | 7.35 | 4 |
"""Chat API routes — triggers master CC process, returns 202 Accepted."""
import asyncio
from pathlib import Path
import aiofiles
import structlog
from fastapi import APIRouter, Depends, File, HTTPException, UploadFile
from fastapi.responses import JSONResponse
from src.agents.master_cc import cancel_master, run_mes... | chnlich/charlie-bot | src/api/chat.py | .py | 6d92a61698201d6e | 7.35 | 4 |
"""CRUD API for scheduled cron task configs (config.d/cron.d/<name>.yaml)."""
import asyncio
import copy
import re
from typing import Literal
import structlog
from fastapi import APIRouter, Depends, HTTPException
from pydantic import BaseModel
from src.api.deps import get_session_manager
from src.core.config import ... | chnlich/charlie-bot | src/api/cron.py | .py | fa86108120a5a34f | 7.35 | 4 |
"""FastAPI dependency injection helpers."""
from fastapi import Depends, HTTPException
from src.core.config import get_config
from src.core.models import SessionMetadata
from src.core.plans import PlanRegistryManager
from src.core.sessions import SessionManager
from src.core.threads import ThreadManager
from src.core... | chnlich/charlie-bot | src/api/deps.py | .py | bad5baee837480e8 | 7.35 | 4 |
"""File server router — serves files and directory listings from the filesystem."""
import asyncio
import html
import json
import mimetypes
from datetime import UTC, datetime
from pathlib import Path
from urllib.parse import quote
import structlog
from fastapi import APIRouter, HTTPException, Request
from fastapi.res... | chnlich/charlie-bot | src/api/files.py | .py | fc0b54a7cb15f7d3 | 7.35 | 4 |
"""LaTeX API routes — compile, serve PDF, read/write .tex source."""
import asyncio
import structlog
from fastapi import APIRouter
from fastapi.responses import FileResponse, JSONResponse, PlainTextResponse
from pydantic import BaseModel
from src.core.latex import (
accept_proposal,
compile_latex,
get_gi... | chnlich/charlie-bot | src/api/latex.py | .py | 67e5629d6e77717b | 7.35 | 4 |
"""Shared helpers for chat message persistence and rendering."""
import asyncio
from dataclasses import dataclass
from datetime import UTC, datetime
from typing import TYPE_CHECKING
import structlog
from src.core import event_types as ET
from src.core.message_aggregator import (
MessageAggregator,
extract_text_f... | chnlich/charlie-bot | src/api/message_utils.py | .py | 7b2e9b352d6beaac | 7.35 | 4 |
"""Shared helpers for CharlieBot CLI scripts.
Provides a single place for the POST-to-internal-API pattern used by every CLI
entry point, including consistent error-detail extraction on 4xx/5xx responses
and the restart-crossing call contract: a call whose connection never got
established is retried with bounded expon... | chnlich/charlie-bot | src/cli/common.py | .py | f2c584b91fff33e6 | 7.35 | 4 |
"""
Centralized configuration for the 2D biped simulation.
All physics parameters, dimensions, and simulation settings in one place.
"""
from dataclasses import dataclass
from typing import Tuple
@dataclass
class PhysicsConfig:
"""Physics engine configuration."""
gravity: Tuple[float, float] = (0.0, -9.81) ... | AgastyaValisetty/ECE-AGENT-WORKSHOP | biped_sim/config/robot_config.py | .py | f4254d70fa848831 | 7 | 0 |
"""
Physics constants and helper functions.
"""
import pymunk
import math
from config.robot_config import config
# Collision categories
CAT_GROUND = config.collision.CAT_GROUND
CAT_ROBOT = config.collision.CAT_ROBOT
def create_body_mass_properties(mass: float, width: float, height: float) -> tuple:
"""
Cal... | AgastyaValisetty/ECE-AGENT-WORKSHOP | biped_sim/physics/constants.py | .py | 362cb43bd821debe | 7 | 0 |
"""
Physics world wrapper for Pymunk.
Handles world creation, stepping, and ground body.
"""
import pymunk
from config.robot_config import config
class PhysicsWorld:
"""Wrapper around pymunk.Space for the simulation."""
def __init__(self):
self.space = pymunk.Space()
self.space.gravity =... | AgastyaValisetty/ECE-AGENT-WORKSHOP | biped_sim/physics/world.py | .py | 752afcdff5485d38 | 7 | 0 |
"""
Camera for world-to-screen coordinate conversion.
Simulation coordinates (meters) are converted to screen coordinates (pixels).
"""
from config.robot_config import config
class Camera:
"""Simple fixed camera for world-to-screen transform."""
def __init__(self, width: int = None, height: int = None,
... | AgastyaValisetty/ECE-AGENT-WORKSHOP | biped_sim/rendering/camera.py | .py | 4ff791b2006ef185 | 7 | 0 |
"""
Tests for the biped robot construction.
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import unittest
import pymunk
from physics.world import PhysicsWorld
from robot.biped import Biped
from config.robot_config import config
class TestRobot(unittest.Tes... | AgastyaValisetty/ECE-AGENT-WORKSHOP | biped_sim/tests/test_robot.py | .py | d82361614d41c058 | 7.5 | 0 |
"""
Tests for the physics world.
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import unittest
import pymunk
from physics.world import PhysicsWorld
from config.robot_config import config
class TestWorld(unittest.TestCase):
def test_world_creation(... | AgastyaValisetty/ECE-AGENT-WORKSHOP | biped_sim/tests/test_world.py | .py | b2228de7c2fc93ec | 7.5 | 0 |
r"""
微信图片 .dat 文件解密模块
支持两种加密格式:
- 旧格式: 单字节 XOR 加密,key 通过对比文件头与已知图片 magic bytes 自动检测
- V2 格式 (2025-08+): AES-128-ECB + XOR 混合加密,需要从微信进程内存提取 AES key
V2 文件结构:
[6B signature: 07 08 V2 08 07] [4B aes_size LE] [4B xor_size LE] [1B padding]
[aligned_aes_size bytes AES-ECB] [raw_data] [xor_size bytes XOR]
文件路径格式:
... | 2933684073/wechat-decrypt-contributors | decode_image.py | .py | bb7b0ae7cd428dba | 7.3 | 3 |
"""
WeChat 4.0 数据库解密器
使用从进程内存提取的per-DB enc_key解密SQLCipher 4加密的数据库
参数: SQLCipher 4, AES-256-CBC, HMAC-SHA512, reserve=80, page_size=4096
密钥来源: all_keys.json (由find_all_keys.py从内存提取)
"""
import hashlib, struct, os, sys, json
import hmac as hmac_mod
from Crypto.Cipher import AES
import functools
print = functools.partia... | 2933684073/wechat-decrypt-contributors | decrypt_db.py | .py | 8d3b810311b6c6b0 | 7.3 | 3 |
"""从微信进程内存中提取图片 AES 密钥 (V2 .dat 格式)
V2 .dat 文件结构:
[6B signature: 07 08 V2 08 07] [4B aes_size LE] [4B xor_size LE] [1B padding]
[aes_size bytes AES-ECB encrypted] [raw_data unencrypted] [xor_size bytes XOR encrypted]
AES key: 16-byte ASCII string found in Weixin.exe process memory
XOR key: single byte, same as ol... | 2933684073/wechat-decrypt-contributors | find_image_key.py | .py | c1211d4fbd461cdc | 7.3 | 3 |
"""测量消息延迟 - 用mtime检测WAL变化(WAL文件是预分配固定大小的)"""
import time, os, sys, io, hashlib, struct, sqlite3, json
from datetime import datetime
from Crypto.Cipher import AES
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
PAGE_SZ = 4096; KEY_SZ = 32; SALT_SZ = 16; RESERVE_SZ = 80
SQLITE_HDR =... | 2933684073/wechat-decrypt-contributors | latency_test.py | .py | 554d87fef2dac33e | 7.8 | 3 |
"""
微信实时消息监听器
原理: 定期解密 session.db (2MB, <1秒), 检测新消息
session.db 包含每个聊天的最新消息摘要、发送者、时间戳
"""
import hashlib, struct, os, sys, json, time, sqlite3, io
import hmac as hmac_mod
from datetime import datetime
from Crypto.Cipher import AES
import zstandard as zstd
_zstd_dctx = zstd.ZstdDecompressor()
sys.stdout = io.TextIOWra... | 2933684073/wechat-decrypt-contributors | monitor.py | .py | 5cb87edb18aaa5d7 | 7.3 | 3 |
#!/usr/bin/env python3
"""Check what the simulator publishes against the catalogs it vendored.
Companion to check-spec-provenance.py, and the two compose:
check-spec-provenance.py specification bytes -> our vendored catalogs
check-conformance.py vendored catalogs -> what we actually publish
Prove... | SpanPanel/panelbench | scripts/check-conformance.py | .py | 99d72619ef2d28cd | 7 | 0 |
#!/usr/bin/env python3
"""Verify this repository's eBus specification provenance.
Two checks with deliberately different severities:
1. **Byte-identity at ``synced_commit`` — hard failure.** Every vendored capability
catalog must be byte-identical to the specification's ``capabilities/`` at the
commit ``.ebus-s... | SpanPanel/panelbench | scripts/check-spec-provenance.py | .py | 1734013d81e91b62 | 7.5 | 0 |
"""Entry point for the SPAN panel eBus simulator."""
from __future__ import annotations
import argparse
import asyncio
import logging
import os
import signal
import sys
from pathlib import Path
from typing import Protocol
from panelbench.app import SimulatorApp
from panelbench.const import (
DASHBOARD_PORT,
... | SpanPanel/panelbench | src/panelbench/__main__.py | .py | 04d046e7450289ca | 7 | 0 |
"""What a circuit template means when it does not say.
``ENTITY_TYPE_DEFAULTS`` are the per-device-type energy profiles the simulator
falls back to. They live here rather than under ``dashboard/`` because they are a
domain fact -- what a circuit, a PV inverter or an EVSE typically draws -- not a
presentation one: conf... | SpanPanel/panelbench | src/panelbench/config_defaults.py | .py | fd4c707653ac4096 | 7 | 0 |
"""Configuration TypedDicts for the simulation engine.
These types define the shape of YAML configuration files used to configure
simulated panels: circuit templates, energy profiles, battery behavior,
tab synchronization, and global simulation parameters.
"""
from __future__ import annotations
from typing import An... | SpanPanel/panelbench | src/panelbench/config_types.py | .py | 28864916f8921536 | 7 | 0 |
"""Vendored eBus capability catalogs, loaded as data.
Reads the catalog JSON the emitter ships, without importing anything
from the emitter: the checker must be able to validate a tree it did not build.
"""
from __future__ import annotations
import json
from dataclasses import dataclass
from pathlib import Path
# U... | SpanPanel/panelbench | src/panelbench/conformance/catalogs.py | .py | 3acaee653be6d8d7 | 7 | 0 |
"""Vendored eBus device profiles: which capabilities a device type composes.
Distinct from the *conformance report* this package produces. A device profile is
upstream's data; the report is our output.
"""
from __future__ import annotations
import json
from dataclasses import dataclass
from pathlib import Path
cla... | SpanPanel/panelbench | src/panelbench/conformance/device_profiles.py | .py | 33358c877164b83b | 7 | 0 |
"""Where the catalogs and profiles the producer actually published from live.
Conformance asks whether what this simulator publishes is legal. Answering that
against a *copy* of the rules answers a subtly different question — whether it
would have been legal under rules it did not use. So these resolve to the data
ins... | SpanPanel/panelbench | src/panelbench/conformance/emitter_data.py | .py | 3cdefa7081331e2c | 7 | 0 |
"""Ways of obtaining $description documents.
Both feeds return the same shape - device id to raw description document - so the rules
run unchanged over an in-process tree or a capture off a live broker. That is the point:
the in-process feed catches defects at authoring time, the capture feed proves the wire
matches w... | SpanPanel/panelbench | src/panelbench/conformance/feeds.py | .py | 9d570c92a039541c | 7 | 0 |
"""Homie 5 $description documents parsed into a typed tree.
Knows the Homie document shape and nothing else: no eBus vocabulary, no catalogs,
no transport. Everything downstream reads this model rather than raw JSON.
"""
from __future__ import annotations
from dataclasses import dataclass
class DescriptionError(Va... | SpanPanel/panelbench | src/panelbench/conformance/model.py | .py | c59e8709b8945a15 | 7 | 0 |
"""The conformance report: what this publisher emits, relative to the specification.
The report is the deliverable. Violations fail a build, but the classification -
match, divergence, extension, omission - is what a consumer author actually needs,
because it states the contract this producer offers and is derived fro... | SpanPanel/panelbench | src/panelbench/conformance/report.py | .py | 9c58f9f7621b901e | 7 | 0 |
"""Constants for the standalone eBus simulator."""
from __future__ import annotations
# Default ports — offset from standard ports to avoid collisions with
# Home Assistant (8123), the Mosquitto add-on (1883/8883), and other
# common services when running on the same host.
MQTTS_PORT = 18883
WS_PORT = 19001
WSS_PORT ... | SpanPanel/panelbench | src/panelbench/const.py | .py | e39fb37c71c99f05 | 7 | 0 |
"""Default entity values by type.
When a user adds a new entity via the dashboard, these defaults
populate the template and circuit definition.
"""
from __future__ import annotations
import re
from typing import Any
# Moved to core: config loading needs these too, and the engine importing them
# from the dashboard ... | SpanPanel/panelbench | src/panelbench/dashboard/defaults.py | .py | 16cb466f68c6837a | 7 | 0 |
"""Device-ID derivation for emitter manifest entries — the only place it happens.
Circuit UUIDs were lifted from publisher.py so the simulator's derivation matches
what the legacy publisher produced: UUID v5 with a fixed namespace, so the same
circuit_id always yields the same UUID across restarts.
The rest of the de... | SpanPanel/panelbench | src/panelbench/emitter_adapter/instance_ids.py | .py | 6a9f374b40ec2db8 | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.