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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3
"""receipt_coverage_spot_audit.py — ddm_sd1 leg 4.
QUESTION. Memos in `.omx/research` cite SSD paths as evidence. Two things can go wrong and both
are silent: the path no longer RESOLVES (the artifact was moved, pruned, or never written), or it
resolves but is not COVERED by any retention manife... | adpena/comma-lab | .omx/research/ddm_sd1_ssd_signal_debt_drain_20260820/receipt_coverage_spot_audit.py | .py | e487b5c124903306 | 7 | 0 |
"""ddm_sg3 granularity ladder: MEASURED real-coder ADDRESS cost per granularity.
LOGIC NOTE (bz1 mirage law): every number here is DESCRIPTION-ONLY -- the bytes to
DESCRIBE a GT-derived set at a given granularity. It is a LOWER BOUND on any counted-GT
artifact at that granularity, because a realizer can only ADD bytes... | adpena/comma-lab | .omx/research/ddm_sg3_scripts/ladder.py | .py | 75daef3b4a8f6132 | 7 | 0 |
"""Ordinary and fractional Epps build-up kernels.
The ordinary kernel implements Eq. (A.15)/(B.20) of the frozen target paper.
The fractional kernel implements Eq. (A.19)/(C.16) on the non-negative real
axis. For 0 < alpha < 1 it uses the Pollard real-axis representation of the
Mittag-Leffler survival function, integ... | timgebbie/correlation-emergence-reproducibility | functions/correlation_build_up.py | .py | f86d1eed16781130 | 7 | 0 |
"""Reaction-boundary first moments and finite-grid representation checks."""
from __future__ import annotations
from math import pi, sqrt
import numpy as np
def _positive_finite(value: float, name: str) -> float:
value = float(value)
if not np.isfinite(value) or value <= 0.0:
raise ValueError(f"{na... | timgebbie/correlation-emergence-reproducibility | functions/coupling_moment.py | .py | 593870ddef2a4bbe | 7 | 0 |
"""Atomic figure publication outside the user-facing figure directory."""
from __future__ import annotations
import os
import uuid
from pathlib import Path
from typing import Any
PROJECT_ROOT = Path(__file__).resolve().parents[1]
STAGING_DIRECTORY = PROJECT_ROOT / ".render-staging"
def _flush_windows_file_descrip... | timgebbie/correlation-emergence-reproducibility | functions/figure_io.py | .py | fe57af6f7f8613f9 | 7 | 0 |
"""Outer-grid policy and reaction-boundary extraction in operational time."""
from __future__ import annotations
from dataclasses import dataclass
import math
import numpy as np
class ReactionBoundaryError(RuntimeError):
"""Raised when no unambiguous admissible reaction boundary is available."""
def _finite(... | timgebbie/correlation-emergence-reproducibility | functions/operational/boundary.py | .py | ef47afae60854c94 | 7 | 0 |
"""Regularised thick-boundary coupling for the operational-time model."""
from __future__ import annotations
from dataclasses import dataclass
import math
import numpy as np
from functions.operational.source import OperationalSource, operational_source_density
def _finite(name: str, value: float) -> float:
re... | timgebbie/correlation-emergence-reproducibility | functions/operational/coupling.py | .py | 3684634666a9049c | 7 | 0 |
"""Explicit two-book innovations for the uniform operational-time model."""
from __future__ import annotations
from dataclasses import dataclass
import math
from typing import Sequence
import numpy as np
def _finite(name: str, value: float) -> float:
result = float(value)
if not math.isfinite(result):
... | timgebbie/correlation-emergence-reproducibility | functions/operational/innovations.py | .py | 9155aac07e9e28e6 | 7 | 0 |
"""Target one-book source on the fixed operational-time price grid."""
from __future__ import annotations
from dataclasses import dataclass
import math
import numpy as np
def _finite(name: str, value: float) -> float:
result = float(value)
if not math.isfinite(result):
raise ValueError(f"{name} mus... | timgebbie/correlation-emergence-reproducibility | functions/operational/source.py | .py | 4e7779552065ec73 | 7 | 0 |
"""Projection-consistent coupling of current reaction-front translation modes."""
from __future__ import annotations
from dataclasses import dataclass
import math
import numpy as np
def _finite(name: str, value: float) -> float:
result = float(value)
if not math.isfinite(result):
raise ValueError(f... | timgebbie/correlation-emergence-reproducibility | functions/operational/translation_coupling.py | .py | 555f36f1bb49d1c5 | 7 | 0 |
import os
import re
import sys
import shutil
import subprocess
import winreg
from pathlib import Path
# Supported Games config
GAMES = {
"ETS2": {
"process": "eurotruck2.exe",
"folder": "Euro Truck Simulator 2",
"steam_id": "227300"
},
"ATS": {
"process": "amtrucks.exe",
... | playhaux/ETS2ATS-Neon-Paint-Job | app_logic.py | .py | 2cf2495196f5f2f9 | 7 | 0 |
"""Shared host-integration helpers for prompt retrieval."""
from __future__ import annotations
from collections.abc import Callable
from typing import Any
from .context_store import context_key
from .memory_client import materialize_for_prompt
from .storage import record_skill_usage, save_project_memory_materializat... | rxa3c/chat2skill | scripts/chat2skill/integration.py | .py | 36bfd6002bffa89a | 7.3 | 3 |
"""Shared similarity primitives and merge thresholds.
Single source of truth for the tokenizer, lexical (Jaccard) and vector
(cosine) similarity used by the proposer, storage merge, replay sampling,
retrieval, and maintenance. The two thresholds are on different scales by
design: cosine compares dense embeddings, Jacc... | rxa3c/chat2skill | scripts/chat2skill/similarity.py | .py | 2dd4a2b315a2f282 | 7.3 | 3 |
"""Windows firewall rule management via HNetCfg.FwPolicy2 COM.
No `netsh.exe`. Reads/ensures the OpenSSH-Port-22-Inbound rule and any custom
WRE-managed rule.
"""
from __future__ import annotations
from typing import Any
def _fw_policy(): # type: ignore[no-untyped-def]
import comtypes # type: ignore
impo... | A2Sumie/windows-remote-executor | v4/native/win32/firewall.py | .py | 8d60563cdb675e43 | 7 | 0 |
"""Scheduled task management via TaskScheduler COM — `win32com.client.Dispatch`.
No `schtasks.exe`, no PowerShell. Pure IDispatch through pywin32 (already
shipped in the embeddable Python, see make_bootstrap_package.py).
"""
from __future__ import annotations
import os
from typing import Any
# Task Scheduler magic... | A2Sumie/windows-remote-executor | v4/native/win32/scheduled_tasks.py | .py | f6fa5944e858e556 | 7 | 0 |
"""Windows service control via pywin32 — no `sc.exe`, no `schtasks.exe`.
Hard dependency on pywin32 on the Windows host. Wrapped so that probe paths
that only read state do not crash if the import is unavailable.
"""
from __future__ import annotations
import time
from typing import Any
def _import_win32serviceutil... | A2Sumie/windows-remote-executor | v4/native/win32/service.py | .py | 9afbcf94f75b395a | 7 | 0 |
"""Build the WRE v4 Windows bootstrap package on the controller (macOS/Linux).
Output: `v4/release/wre-v<version>-windows-x64.zip` containing:
python/ <- standalone Windows python (embeddable + wheels preinstalled)
python.exe
pythonw.exe
python312._pth
Lib/site-package... | A2Sumie/windows-remote-executor | v4/scripts/make_bootstrap_package.py | .py | b5fdd8bdeca33b28 | 7 | 0 |
"""WRE v5 controller shell — single entrypoint.
Usage:
python3 -m v5.controller.shell <target> <action> [payload-json]
python3 -m v5.controller.shell <target> --probe [...]
python3 -m v5.controller.shell <target> --repl
"""
from __future__ import annotations
import argparse
import json
import sys
from ty... | A2Sumie/windows-remote-executor | v5/controller/shell.py | .py | 20d00c69cca35d42 | 7 | 0 |
"""Host actions: probe, guard, repair, policy, tasks.*.
Pure Python: stdlib + pywin32 (for service config / sshd restart) + comtypes
(for TaskScheduler COM). No PowerShell, no argv to schtasks.exe / netsh.exe /
sc.exe. Firewall rules are read via HNetCfg.FwPolicy2 COM.
v5: host.repair restarts sshd only when the conf... | A2Sumie/windows-remote-executor | v5/native/actions/host.py | .py | 29ba33b1278dbf99 | 7 | 0 |
"""Windows firewall rule management via HNetCfg.FwPolicy2 COM.
No `netsh.exe`. Reads/ensures the OpenSSH-Port-22-Inbound rule and any custom
WRE-managed rule.
"""
from __future__ import annotations
from typing import Any
# Tailscale CGNAT range: the WRE-managed inbound rule only accepts traffic
# from the tailnet. ... | A2Sumie/windows-remote-executor | v5/native/win32/firewall.py | .py | 49916c2e6da5612c | 7 | 0 |
"""Read and rewrite Windows OpenSSH `sshd_config` without shell tools.
Layout on a default OpenSSH-on-Windows install:
config: C:/ProgramData/ssh/sshd_config
admin keys: C:/ProgramData/ssh/administrators_authorized_keys
user keys: <user>/.ssh/authorized_keys
Service name: sshd (managed by service.py)... | A2Sumie/windows-remote-executor | v5/native/win32/sshd.py | .py | e56d81bd885aa05d | 7 | 0 |
"""带工具的 Agent Loop(流式):调 LLM -> 若要工具则执行 -> 结果回灌 -> 再调,循环到纯文本回复或上限。"""
import http.client
import json
from concurrent.futures import ThreadPoolExecutor
from urllib.parse import urlparse
from mini_agent.tools import registry, executor
from mini_agent.config import BASE_URL, API_KEY, MODEL, MAX_ITERATIONS
def call_llm... | liiiiiiiiil/agent-from-scratch | src/mini_agent/agent.py | .py | c551ef26715afdca | 7 | 0 |
"""Smoke test for mini_agent v0.01.
验证 import 链路和函数签名,不实际调用 LLM(避免依赖网络)。
可独立运行:python tests/test_loop.py
(零第三方依赖,仅标准库)
"""
import os
import sys
# 让 tests/ 目录下也能 import 到 src 布局的包
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
from mini_agent.agent import call_llm, agent_loop
from mini_agen... | liiiiiiiiil/agent-from-scratch | tests/test_loop.py | .py | 3812ccea330bb954 | 7.5 | 0 |
"""Smoke test for mini_agent v0.07 system prompt.
验证 prompt.py 的分层组装:header / core_rules / environment。
可独立运行:python tests/test_prompt.py
(零第三方依赖,仅标准库)
"""
import os
import sys
# 让 tests/ 目录下也能 import 到 src 布局的包
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
from mini_agent.prompt import b... | liiiiiiiiil/agent-from-scratch | tests/test_prompt.py | .py | 0ab263cedd718950 | 7.5 | 0 |
"""Smoke test for mini_agent v0.08 tools.
验证 Tool/ToolRegistry/ToolExecutor + calculate/read_file/write_file/edit_file/list_dir/grep + 权限闸门。
可独立运行:python tests/test_tools.py
"""
import os
import sys
import tempfile
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
from mini_agent.tools import... | liiiiiiiiil/agent-from-scratch | tests/test_tools.py | .py | 15f2109f55a2f6e6 | 7.5 | 0 |
"""
DECISIVE Phase B test: is the committed two-timescale mixture globally fitted?
Method: calibrate an independent implementation until it reproduces the COMMITTED
held-out scores (which proves it computes the same quantity), then evaluate the
committed parameters and the independently-optimal parameters under that S... | TMDLRG/uni-flagellum-motor-stack | audits/phase-b/b2-decisive-oracle.py | .py | 408bf4ec6cbd0315 | 7 | 0 |
"""Build the D5-safe successor archive and round-trip verify it (D12 step 4).
Pipeline (per the M25 authorization):
1. build from a named anchor commit (default HEAD)
2. stage a CURATED allowlist (leak-bearing files are excluded, not included-then-hoped-clean)
3. scan the staged tree with d5_distribution_guard ... | TMDLRG/uni-flagellum-motor-stack | hierarchical-aif/scripts/build_d5_safe_successor_archive.py | .py | d33c77e6f07184be | 7 | 0 |
"""Claim guard — mechanical clamp on forbidden claim language.
Scans hierarchical-aif documents for claims the current evidence does not license. A phrase is a
VIOLATION unless it appears in a NEGATED or QUOTED-AS-FORBIDDEN context (these documents must be
able to say "we do NOT claim biological parity" and to list fo... | TMDLRG/uni-flagellum-motor-stack | hierarchical-aif/src/motor_stack_aif/claim_guard.py | .py | e137f3910639b32d | 7 | 0 |
"""Lmotor-0 observed blanket — typed event records.
Three modes enforce the D5/D6 quarantines at the type level rather than by convention:
duration_only : dwell + state + censor. The ONLY mode permitted to touch holdout.
mark_retrospective : adds nextStateN/direction/jump. TRAIN-safe; on holdout it is
... | TMDLRG/uni-flagellum-motor-stack | hierarchical-aif/src/motor_stack_aif/events.py | .py | 7c44fcd0af7ac77b | 7 | 0 |
"""Fit the constrained F-side motor-stack model.
Two free parameters only: (mu, tau) of the population prior over log-shape. Per-motor latents are
integrated by Gauss-Hermite quadrature, never estimated freely, so the parameter count does not
grow with motor count.
Deterministic: Nelder-Mead from a fixed simplex, no ... | TMDLRG/uni-flagellum-motor-stack | hierarchical-aif/src/motor_stack_aif/fit.py | .py | ae7f30d96faeb433 | 7 | 0 |
"""F_motor — the observational variational free energy.
F_motor = E_q[ ln q(Theta, eta, z) - ln p(o, z, eta, Theta) ]
= KL[ q || prior ] - E_q[ ln p(o | latents) ]
= complexity - accuracy
WHAT THIS IS: the ANALYST's objective for fitting a hierarchical model to recorded dwell times.
WHAT T... | TMDLRG/uni-flagellum-motor-stack | hierarchical-aif/src/motor_stack_aif/free_energy.py | .py | d650eef79c901a3b | 7 | 0 |
"""Lmotor-5..Lmotor-1, with Lmotor-2 NOT instantiated — the constrained hierarchy actually built.
DELIBERATELY MINIMAL. The identifiability analysis says the full stack (population prior +
per-motor latents + per-event hidden kinetic state + policies) is not identifiable at 793 training
events / 80 training motors / 1... | TMDLRG/uni-flagellum-motor-stack | hierarchical-aif/src/motor_stack_aif/hierarchy.py | .py | 500a3cd5bd4c215a | 7 | 0 |
"""Mark-field validation and preparation (D6).
The mark channel is {nextStateN, direction, jump}. Two constraints make naive use unsafe:
D6_INGEST_NEXTSTATE_NOT_RANGE_CHECKED
2 events record nextStateN = -1 (physically impossible). The ingest range-checks the dwell's
own state but writes next_state through un... | TMDLRG/uni-flagellum-motor-stack | hierarchical-aif/src/motor_stack_aif/marks.py | .py | 3459e641438d4cd5 | 7 | 0 |
"""Measured-runtime resource estimation.
D2_RESOURCE_BOUND_OVERESTIMATE: a RESOURCE_BOUND status is only honest if the resource claim is
true. The committed B4 reasons cited 250-400 h (C01) and 150-250 h (C02) against measured
projections of ~14.5 h and ~8.7 h — overstated by 17-29x — and justified the cost by a model... | TMDLRG/uni-flagellum-motor-stack | hierarchical-aif/src/motor_stack_aif/resource.py | .py | 6e2fa1a222f1432c | 7 | 0 |
"""Held-out scoring — motor-equal, on the frozen split.
Rules enforced here:
- the experimental unit is the MOTOR; motor-equal aggregation weights each motor equally
- the frozen sha256_mod5(motorId) split is reused, never recomputed differently
- bootstrap resamples MOTORS, never events (pseudoreplication guard... | TMDLRG/uni-flagellum-motor-stack | hierarchical-aif/src/motor_stack_aif/score.py | .py | 873332e9ed15f1cb | 7 | 0 |
"""Deterministic seed derivation.
D3_HASH_SEED_NONDETERMINISM
---------------------------
The committed B4 runner seeds C01/C02 with `seed_base + sim + hash(gen) % 100000`, where `gen`
is a generator-name STRING. CPython randomizes `str` hashing per process unless PYTHONHASHSEED
is pinned, so the same command produces... | TMDLRG/uni-flagellum-motor-stack | hierarchical-aif/src/motor_stack_aif/seeding.py | .py | 8cd0c4cb2d511e1b | 7 | 0 |
"""Execute exactly this copy of pip, within a different environment.
This file is named as it is, to ensure that this module can't be imported via
an import statement.
"""
# /!\ This version compatibility check section must be Python 2 compatible. /!\
import sys
# Copied from pyproject.toml
PYTHON_REQUIRES = (3, 8)... | codengers/mydborm | .venv/Lib/site-packages/pip/__pip-runner__.py | .py | 70f3d6b89e8d2bf9 | 7 | 0 |
"""Build Environment used for isolation during sdist building
"""
import logging
import os
import pathlib
import site
import sys
import textwrap
from collections import OrderedDict
from types import TracebackType
from typing import TYPE_CHECKING, Iterable, List, Optional, Set, Tuple, Type, Union
from pip._vendor.pack... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/build_env.py | .py | 0efe14082952838b | 7 | 0 |
"""Cache Management
"""
import hashlib
import json
import logging
import os
from pathlib import Path
from typing import Any, Dict, List, Optional
from pip._vendor.packaging.tags import Tag, interpreter_name, interpreter_version
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.exceptions i... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/cache.py | .py | 25bebdf29e4f3628 | 7 | 0 |
"""Logic that powers autocompletion installed by ``pip completion``.
"""
import optparse
import os
import sys
from itertools import chain
from typing import Any, Iterable, List, Optional
from pip._internal.cli.main_parser import create_main_parser
from pip._internal.commands import commands_dict, create_command
from ... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/cli/autocompletion.py | .py | 2e58b732be9a0cdb | 7 | 0 |
"""Base Command class, and related routines"""
import logging
import logging.config
import optparse
import os
import sys
import traceback
from optparse import Values
from typing import List, Optional, Tuple
from pip._vendor.rich import reconfigure
from pip._vendor.rich import traceback as rich_traceback
from pip._in... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/cli/base_command.py | .py | 3598a7e8a3335bd3 | 7 | 0 |
"""
Contains command classes which may interact with an index / the network.
Unlike its sister module, req_command, this module still uses lazy imports
so commands which don't always hit the network (e.g. list w/o --outdated or
--uptodate) don't need waste time importing PipSession and friends.
"""
import logging
imp... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/cli/index_command.py | .py | 8bfb203653e65c2e | 7 | 0 |
"""Base option parser setup"""
import logging
import optparse
import shutil
import sys
import textwrap
from contextlib import suppress
from typing import Any, Dict, Generator, List, NoReturn, Optional, Tuple
from pip._internal.cli.status_codes import UNKNOWN_ERROR
from pip._internal.configuration import Configuration... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/cli/parser.py | .py | 54232d76ecc40945 | 7 | 0 |
import functools
import sys
from typing import Callable, Generator, Iterable, Iterator, Optional, Tuple
from pip._vendor.rich.progress import (
BarColumn,
DownloadColumn,
FileSizeColumn,
Progress,
ProgressColumn,
SpinnerColumn,
TextColumn,
TimeElapsedColumn,
TimeRemainingColumn,
... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/cli/progress_bars.py | .py | f46720bac5adc1fa | 7 | 0 |
"""Contains the RequirementCommand base class.
This class is in a separate module so the commands that do not always
need PackageFinder capability don't unnecessarily import the
PackageFinder machinery and all its vendored dependencies, etc.
"""
import logging
from functools import partial
from optparse import Values... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/cli/req_command.py | .py | 0ea78586650cb3aa | 7 | 0 |
import os
import textwrap
from optparse import Values
from typing import Any, List
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.exceptions import CommandError, PipError
from pip._internal.utils import filesystem
from pip._internal.utils... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/commands/cache.py | .py | 20e7b34e27078c61 | 7 | 0 |
import sys
import textwrap
from optparse import Values
from typing import List
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import SUCCESS
from pip._internal.utils.misc import get_prog
BASE_COMPLETION = """
# pip {shell} completion start{script}# pip {shell} completion end
""... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/commands/completion.py | .py | 1d3e250f46e0b1f9 | 7 | 0 |
import logging
import os
import subprocess
from optparse import Values
from typing import Any, List, Optional
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.configuration import (
Configuration,
Kind,
get_configuration_files,
... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/commands/configuration.py | .py | 9fdf1e9f0a7acb46 | 7 | 0 |
import locale
import logging
import os
import sys
from optparse import Values
from types import ModuleType
from typing import Any, Dict, List, Optional
import pip._vendor
from pip._vendor.certifi import where
from pip._vendor.packaging.version import parse as parse_version
from pip._internal.cli import cmdoptions
fro... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/commands/debug.py | .py | 0cd0d1804f58b0aa | 7 | 0 |
import logging
from optparse import Values
from typing import Any, Iterable, List, Optional
from pip._vendor.packaging.version import Version
from pip._internal.cli import cmdoptions
from pip._internal.cli.req_command import IndexGroupCommand
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._interna... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/commands/index.py | .py | 4405f1989c058556 | 7 | 0 |
import logging
from optparse import Values
from typing import Any, Dict, List
from pip._vendor.packaging.markers import default_environment
from pip._vendor.rich import print_json
from pip import __version__
from pip._internal.cli import cmdoptions
from pip._internal.cli.base_command import Command
from pip._internal... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/commands/inspect.py | .py | 3c6ad8f534534423 | 7.5 | 0 |
import json
import logging
from optparse import Values
from typing import TYPE_CHECKING, Generator, List, Optional, Sequence, Tuple, cast
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.packaging.version import Version
from pip._internal.cli import cmdoptions
from pip._internal.cli.index_co... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/commands/list.py | .py | a222334a32cfebff | 7 | 0 |
"""Configuration management setup
Some terminology:
- name
As written in config files.
- value
Value associated with a name
- key
Name combined with it's section (section.name)
- variant
A single word describing where the configuration key-value pair came from
"""
import configparser
import locale
import os
i... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/configuration.py | .py | f8a3a893a8e1de11 | 7 | 0 |
import abc
from typing import TYPE_CHECKING, Optional
from pip._internal.metadata.base import BaseDistribution
from pip._internal.req import InstallRequirement
if TYPE_CHECKING:
from pip._internal.index.package_finder import PackageFinder
class AbstractDistribution(metaclass=abc.ABCMeta):
"""A base class fo... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/distributions/base.py | .py | 41e07daaf2970c88 | 7 | 0 |
from typing import Optional
from pip._internal.distributions.base import AbstractDistribution
from pip._internal.index.package_finder import PackageFinder
from pip._internal.metadata import BaseDistribution
class InstalledDistribution(AbstractDistribution):
"""Represents an installed package.
This does not ... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/distributions/installed.py | .py | 4229c715b58043ca | 7 | 0 |
import logging
from typing import TYPE_CHECKING, Iterable, Optional, Set, Tuple
from pip._internal.build_env import BuildEnvironment
from pip._internal.distributions.base import AbstractDistribution
from pip._internal.exceptions import InstallationError
from pip._internal.metadata import BaseDistribution
from pip._int... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/distributions/sdist.py | .py | 3e570fe1aebe47a7 | 7 | 0 |
from typing import TYPE_CHECKING, Optional
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.distributions.base import AbstractDistribution
from pip._internal.metadata import (
BaseDistribution,
FilesystemWheel,
get_wheel_distribution,
)
if TYPE_CHECKING:
from pip._internal... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/distributions/wheel.py | .py | 4c70587e7bfb555b | 7 | 0 |
import functools
import logging
import os
import pathlib
import sys
import sysconfig
from typing import Any, Dict, Generator, Optional, Tuple
from pip._internal.models.scheme import SCHEME_KEYS, Scheme
from pip._internal.utils.compat import WINDOWS
from pip._internal.utils.deprecation import deprecated
from pip._inter... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/locations/__init__.py | .py | 51a031799fdff771 | 7 | 0 |
"""Locations where we look for configs, install stuff, etc"""
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
# If pip's going to use distutils, it should not be using the copy that setuptools
# might have injected into the environment. This is done by removing the... | codengers/mydborm | .venv/Lib/site-packages/pip/_internal/locations/_distutils.py | .py | c7a9f254b8fb5f5d | 7 | 0 |
#!/usr/bin/env python3
"""Assemble step-vs-success curves for all 2026-08-16/17 B200 runs plus the
collaborators' frozen A100-machine curves, write a merged CSV, and plot.
Series identity = method (fixed hue); run/seed = linestyle within the hue.
Palette validated (dataviz six checks): blue #2a78d6 adaptive, orange #e... | Sisyphe-lee/opd-baseline-repro | analysis/multiseed_curves_20260817/build_curves.py | .py | 7c0bc62962acdf9f | 7.15 | 1 |
# Copyright 2026 OPD ALFWorld contributors
#
# 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 t... | Sisyphe-lee/opd-baseline-repro | scripts/prepare_tcod_official_alfworld_data.py | .py | 2a4352ced0ac5de6 | 7.15 | 1 |
# backend/agents/base_agent.py
from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional
from backend.agents.tools.base_tool import BaseTool
from backend.models.schemas import AgentTask, AgentResult
from backend.core.logger import get_logger
class BaseAgent(ABC):
"""
Every agent extends... | harishd-dev/lyra-popup | backend/agents/base_agent.py | .py | cb9e9294adc7b90e | 7 | 0 |
# backend/agents/execution_engine.py
from __future__ import annotations
import os
import re
import subprocess
import asyncio
import uuid
from typing import NamedTuple, Optional
from pathlib import Path
from backend.core.logger import get_logger
from backend.core.config import settings
logger = get_logger(__name__)
... | harishd-dev/lyra-popup | backend/agents/execution_engine.py | .py | 6c7817c3b09116ae | 7 | 0 |
# backend/agents/sandbox.py
from __future__ import annotations
import os
import shlex
import subprocess
from pathlib import Path
from typing import NamedTuple
from backend.core.logger import get_logger
logger = get_logger(__name__)
# Dynamic sandbox workspace relative to repository root
SANDBOX_ROOT = (Path(__file_... | harishd-dev/lyra-popup | backend/agents/sandbox.py | .py | c8d07026c7359a6c | 7 | 0 |
# backend/agents/tools/base_tool.py
from abc import ABC, abstractmethod
from typing import Any
class BaseTool(ABC):
name: str = ""
description: str = ""
requires_confirmation: bool = False # If True, must ask user before run
@abstractmethod
async def run(self, **kwargs) -> Any:
"""Ex... | harishd-dev/lyra-popup | backend/agents/tools/base_tool.py | .py | 573b05d453ceff5e | 7 | 0 |
# backend/automation/accessibility.py
#
# Wraps the uiautomation library for structured element access.
# uiautomation exposes the Windows UI Automation API (UIA) — the same
# one used by screen readers. Every accessible Win32/WPF/UWP element
# appears in this tree.
from __future__ import annotations
from typing impor... | harishd-dev/lyra-popup | backend/automation/accessibility.py | .py | 34fadca1e14470a3 | 7 | 0 |
# backend/automation/ocr.py
from __future__ import annotations
import io
import os
from typing import List, Dict
from backend.core.logger import get_logger
logger = get_logger(__name__)
class OCRLayer:
def __init__(self):
import pytesseract
# On Windows: set Tesseract path if it exists at defau... | harishd-dev/lyra-popup | backend/automation/ocr.py | .py | 3ae9e3bebc7a52b8 | 7 | 0 |
"""Client identity helpers shared by config-flow orchestration."""
from __future__ import annotations
from typing import Any
from .const import (
CLIENT_TYPE_ESP32,
CLIENT_TYPE_IOS,
CLIENT_TYPE_MACOS,
CLIENT_TYPE_RASPBERRY_PI,
CLIENT_TYPE_WATCHOS,
CLIENT_TYPE_WINDOWS,
CLIENT_TYPES,
SET... | pcvantol/djconnect | custom_components/djconnect/client_identity.py | .py | 3e8a3c235e254fd8 | 7.15 | 1 |
"""Discovery selection helpers for DJConnect config flow."""
from __future__ import annotations
from typing import Any
from .const import (
CONF_CLIENT_TYPE,
CONF_DEVICE_ID,
CONF_DEVICE_NAME,
CONF_LOCAL_URL,
CONF_PAIR_CODE,
DEFAULT_CLIENT_TYPE,
DEFAULT_DEVICE_NAME,
CLIENT_TYPES,
)
from... | pcvantol/djconnect | custom_components/djconnect/discovery_selection.py | .py | 3b584f4330054572 | 7.15 | 1 |
"""Trusted built-in DJ Brain capability metadata and policy resolution.
The registry is deliberately metadata-only. It neither loads third-party code
nor owns planning, knowledge, moment realization, session flow or broadcast.
"""
from __future__ import annotations
from dataclasses import dataclass
from enum import... | pcvantol/djconnect | custom_components/djconnect/dj_brain_capabilities.py | .py | c0f1e79f64c1d5d4 | 7.15 | 1 |
"""Music Backend registrations and capabilities."""
from __future__ import annotations
from dataclasses import dataclass, field
from enum import StrEnum
from typing import Any
from ..models import clean_identifier
class BackendProvider(StrEnum):
"""Known and future DJConnect music backend providers."""
SP... | pcvantol/djconnect | custom_components/djconnect/domain/backend/models.py | .py | a521deaff497130f | 7.15 | 1 |
"""Device-owned DJConnect runtime state."""
from __future__ import annotations
from dataclasses import dataclass, field
from enum import StrEnum
from typing import Any
from ..models import clean_identifier
class DevicePairingState(StrEnum):
"""Device pairing lifecycle."""
UNPAIRED = "unpaired"
PENDING... | pcvantol/djconnect | custom_components/djconnect/domain/device/models.py | .py | dda709454cde61e4 | 7.15 | 1 |
"""Canonical DJConnect domain errors."""
from __future__ import annotations
class DJConnectDomainError(Exception):
"""Base class for core DJConnect domain errors."""
class ResolverError(DJConnectDomainError):
"""Base class for profile resolver failures."""
class ProfileNotFound(ResolverError):
"""Rai... | pcvantol/djconnect | custom_components/djconnect/domain/errors.py | .py | d9766fd1d4e50dda | 7.15 | 1 |
"""Household-owned DJConnect platform configuration."""
from __future__ import annotations
from dataclasses import dataclass, field
from ..backend import MusicBackendRegistration
from ..device import Device
from ..models import clean_identifier
from ..music_account import MusicAccount
from ..playback_zone import Pla... | pcvantol/djconnect | custom_components/djconnect/domain/household/models.py | .py | 582f1fa7cb9ae69b | 7.15 | 1 |
"""Provider account bindings for DJConnect Profiles and Households."""
from __future__ import annotations
from dataclasses import dataclass, field
from enum import StrEnum
from ..models import clean_identifier
class MusicAccountKind(StrEnum):
"""Music Account ownership shape."""
PERSONAL = "personal"
... | pcvantol/djconnect | custom_components/djconnect/domain/music_account/models.py | .py | eefc64ac272cd7cb | 7.15 | 1 |
"""Playback targets for DJConnect music backends."""
from __future__ import annotations
from dataclasses import dataclass, field
from enum import StrEnum
from ..models import clean_identifier
class PlaybackZoneKind(StrEnum):
"""Known playback target categories."""
ROOM = "room"
SPOTIFY_DEVICE = "spoti... | pcvantol/djconnect | custom_components/djconnect/domain/playback_zone/models.py | .py | 05738f7064e3dbcd | 7.15 | 1 |
"""Profile-owned DJConnect state."""
from __future__ import annotations
from dataclasses import dataclass, field
from enum import StrEnum
from typing import Any
from ...dj_brain_capabilities import CapabilityPolicy
from ..models import clean_identifier
class ProfileType(StrEnum):
"""Canonical DJConnect Profil... | pcvantol/djconnect | custom_components/djconnect/domain/profile/models.py | .py | 370ba158934e93e7 | 7.15 | 1 |
"""Canonical Profile resolution for DJConnect.
Resolution order is defined by the Platform Foundation and must remain singular:
1. explicit profile_id
2. device_id mapping
3. voice endpoint mapping
4. Home Assistant user hint
5. area mapping
6. player mapping
7. fallback profile
8. ProfileRequired
"""
from __future_... | pcvantol/djconnect | custom_components/djconnect/domain/resolver/profile_resolver.py | .py | a13f58d7d965157a | 7.15 | 1 |
from __future__ import annotations
import re
import pandas as pd
def clean_text(value: object, limit: int = 0, fallback: str = "") -> str:
"""Normalize whitespace, strip NaN. Truncate if limit > 0."""
if value is None or (isinstance(value, float) and pd.isna(value)):
return fallback
cleaned = " ... | Flat0312/Zuolian-Data-Visualization | app/frontend/utils.py | .py | 3d67f76c22bdd12e | 7 | 0 |
"""
鲁迅节点数据清洗与聚合
- 保留强关联记录
- 按月聚合弱关联-通信记录
- 剔除无关记录
"""
import re
import shutil
from datetime import datetime
import pandas as pd
EXCEL_PATH = r'd:\1大创\大创数据收集1.xlsx'
BACKUP_PATH = r'd:\1大创\大创数据收集1_备份_{}.xlsx'.format(datetime.now().strftime('%Y%m%d_%H%M%S'))
# ID到姓名映射
ID_TO_NAME = {
"ZLH-001": "鲁迅", "ZLH-002": "茅盾... | Flat0312/Zuolian-Data-Visualization | research/analysis/aggregate_luxun_data.py | .py | aab683efc55ab75d | 7 | 0 |
"""
OCR识别《左联史》PDF并将《左联词典》和《左联史》转换为TXT文件
需要安装: pip install pytesseract pdf2image pillow
"""
import json
import os
import pytesseract
from pdf2image import convert_from_path
# 配置路径
PDF_ZUOLIAN_CIDIAN = r'd:\1大创\左联词典 (姚辛) (z-library.sk, 1lib.sk, z-lib.sk).pdf'
PDF_ZUOLIAN_SHI = r'd:\1大创\左联史 (姚辛著, Yao, Xin. etc.) (z-lib... | Flat0312/Zuolian-Data-Visualization | research/analysis/convert_to_txt.py | .py | 2bdb028ae52a6d18 | 7 | 0 |
"""
从鲁迅日记中提取人际关系数据并写入Excel
更新版 - 修正日期格式和关系类型分类
"""
import re
import openpyxl
# 人物对照表 - 包含所有别名映射
PERSON_MAP = {
# ZLH-002 茅盾
"茅盾": "ZLH-002", "沈雁冰": "ZLH-002", "玄珠": "ZLH-002", "方璧": "ZLH-002", "微明": "ZLH-002",
# ZLH-003 瞿秋白
"瞿秋白": "ZLH-003", "维它": "ZLH-003", "史铁儿": "ZLH-003", "宋阳": "ZLH-003", "何凝": "... | Flat0312/Zuolian-Data-Visualization | research/analysis/extract_relationships.py | .py | e71dd2eeea3c4253 | 7 | 0 |
"""
孤岛成员识别与词典检索
"""
from collections import defaultdict
import pandas as pd
import pdfplumber
EXCEL_PATH = r'd:\1大创\大创数据收集1.xlsx'
PDF_PATH = r'd:\1大创\左联词典 (姚辛) (z-library.sk, 1lib.sk, z-lib.sk).pdf'
def identify_isolated_members():
"""识别孤岛成员"""
sheet1 = pd.read_excel(EXCEL_PATH, sheet_name='Sheet1')
she... | Flat0312/Zuolian-Data-Visualization | research/analysis/find_isolated_members.py | .py | 752b5d46fd1697f9 | 7 | 0 |
"""把 phase2 第二批补证(龙华二十四烈士名录)合并进生产数据。
幂等保证:
- 以 fact_evidences.origin_evidence_id 识别已转正证据;全部已转正时早退不写盘;
- 已转正证据携带的正式 source_id 会复用给同批剩余证据,来源注册前先按 URL 查重;
- 事件注记与 source_ids 追加均带去重检查,重复执行不产生重复文本或新 ID。
前置条件:两个来源已完成网页核验,项目负责人确认"23姓名+1佚名"展示口径。
"""
from __future__ import annotations
import csv
import hashlib
from pathlib ... | Flat0312/Zuolian-Data-Visualization | research/analysis/merge_longhua_roster.py | .py | 753b8d8ba1f2b3ce | 7 | 0 |
"""
使用OCR识别《左联词典》PDF并检索孤岛成员
需要安装: pip install pytesseract pdf2image pillow
需要安装Tesseract-OCR: https://github.com/tesseract-ocr/tesseract
"""
import json
import os
from collections import defaultdict
import pandas as pd
import pytesseract
from pdf2image import convert_from_path
# 配置路径
EXCEL_PATH = r'd:\1大创\大创数据收集1.xl... | Flat0312/Zuolian-Data-Visualization | research/analysis/ocr_search.py | .py | cfffeacf73401b0d | 7 | 0 |
"""JSON API over the task core, and the built page that drives it.
Every route is a plain `def` that touches progress.json inside a `state.writing()` or
`state.reading()` block: an `async def` blocking on that lock would freeze the whole
server, while FastAPI runs sync handlers in a threadpool."""
import logging
from... | vazome/drillion | src/drillion/api.py | .py | 5d71a9418cb7fbe2 | 7 | 0 |
"""The attempt: one timer per task, from the first open until the pass.
Time is *active* seconds: every touch adds the gap since the last one, capped at two
minutes, and grades, hints and the solution gate all price themselves in that currency."""
import random
from datetime import datetime
from .region import cut, ... | vazome/drillion | src/drillion/attempts.py | .py | 9fe1bca9624426eb | 7 | 0 |
"""The catalogue: one folder per task, read from disk and never executed.
`<NNN>_<name>/README.md` is the guidance and `<NNN>_<name>/task.py` is the code."""
import ast
import re
import yaml
from .region import Invalid, _solve, bounds, cut
from .settings import settings
REQUIRED = ("title", "difficulty", "tier", "... | vazome/drillion | src/drillion/catalogue.py | .py | 1a15d2893387a14f | 7 | 0 |
"""The ways in: serve the tasks in a browser, or check the whole set still works."""
import argparse
import logging
import shutil
import subprocess
import threading
import webbrowser
from pathlib import Path
from . import __version__
from .settings import TASKS_TEMPLATE, settings
log = logging.getLogger(__name__)
... | vazome/drillion | src/drillion/cli.py | .py | e5f2c786d52620d4 | 7 | 0 |
"""The language server behind the editor: one basedpyright per open editor, framed both ways.
The page only ever holds the learner's region, so the region is the whole document the
server is given — a task's machinery never reaches the browser through here. Every region
is self-contained, so nothing is lost by withhol... | vazome/drillion | src/drillion/lsp.py | .py | 080ea337a7d10b59 | 7 | 0 |
"""The learner's region: cut a task file in two, splice it back, guard the write.
A task file starts with the learner's code and ends with the grader's, separated by
one marker line."""
import ast
import hashlib
import os
from typing import NamedTuple
MARKER = "# ══ machinery — everything below is the grader's, not ... | vazome/drillion | src/drillion/region.py | .py | 08590e57e99eba31 | 7 | 0 |
"""Running the tests: task code only ever executes in a pytest subprocess."""
import ast
import os
import re
import subprocess
import sys
import tempfile
from pathlib import Path
from .catalogue import tasks
from .region import _solve, cut, splice, stub
from .settings import settings
_TASK_LINE = re.compile(r"[\w./\... | vazome/drillion | src/drillion/runner.py | .py | 54eb4d4c0658fb65 | 7 | 0 |
"""The Leitner ladder: what comes back today, what is new, and what a pass is worth."""
from collections import Counter
from datetime import date, timedelta
from .state import card, today
# days until the next sighting, per box
LADDER = [2, 4, 8, 16, 28, 60, 120]
NEW_PER_DAY = 2
REVIEWS_PER_DAY = 12
# struggles on o... | vazome/drillion | src/drillion/scheduler.py | .py | 53d973148d111c2b | 7 | 0 |
"""Where the tasks live and where the server listens — read from the environment.
Every module asks `settings` for a path at call time rather than freezing one at import."""
import os
import sys
from dataclasses import dataclass, field
from pathlib import Path
PKG = Path(__file__).resolve().parent
REPO = PKG.parent.... | vazome/drillion | src/drillion/settings.py | .py | c305bb334ca5580c | 7 | 0 |
"""progress.json: every card, every open attempt, every pass you have ever made.
One file under `settings.root`, read and written whole."""
import json
import os
import threading
from contextlib import contextmanager
from datetime import date
from .settings import settings
def load():
path = settings.state_pat... | vazome/drillion | src/drillion/state.py | .py | 25e9871b2f43f809 | 7 | 0 |
from collections.abc import Iterator
def solve(lines: Iterator[str]):
raise NotImplementedError
# ══ machinery — everything below is the grader's, not yours ══
from _lib import rng
def _gen(r):
"""A short log with at least one ERROR line, somewhere unpredictable."""
services = ["api", "auth", "billin... | vazome/drillion | tasks/010_generators/task.py | .py | d2fe66141e81779a | 7 | 0 |
from collections.abc import Callable
def solve(fn: Callable[[int], int]):
raise NotImplementedError
# ══ machinery — everything below is the grader's, not yours ══
from _lib import rng
def _gen(r):
"""Parameters for one pure function, plus the call sequence to replay."""
k, b = r.randint(2, 9), r.ran... | vazome/drillion | tasks/016_functools/task.py | .py | 22c31fb04614d050 | 7 | 0 |
"""Client-side policy-bundle signing for ``artzain policy`` (FR-6, WS3).
Private keys are generated and used **here**, on your machine — only the public
key is ever sent to the server (``artzain policy register-key``). The
canonicalisation and key-id rules match the server (``services/policy_bundles.py``)
so a bundle... | CogNEXUSlabs/cognexus-tools | python/src/artzain/policy_sign.py | .py | ea01fb3d88587c92 | 7.15 | 1 |
"""Tool-call contract inspection (security-sentinel scope; open-items todo #1).
Structured validation of ``payload_kind="tool_call"`` payloads at the decision
boundary — the schema-level complement to the regex screens in
``prompt_injection`` / ``destructive_action_guard``. A tool call must be a
well-formed JSON objec... | CogNEXUSlabs/cognexus-tools | python/src/artzain/tool_call_contract.py | .py | 995d25c9d2c426de | 7.15 | 1 |
"""Pytest fixtures shared by the artzain test suite.
Cloud ingest is exercised via :func:`artzain.cloud.post_sdk_event`; integration tests
patch ``urllib.request.urlopen`` to capture payloads without opening sockets.
Run integration tests::
cd pypi-package
export PYTHONPATH=src
export COGNEXUS_API_KEY="y... | CogNEXUSlabs/cognexus-tools | python/tests/conftest.py | .py | 40f07a1c97e7712f | 7.65 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.