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 |
|---|---|---|---|---|---|---|
"""Define artifact declarations, identities, pointers, and resolved values."""
from __future__ import annotations
from typing import Annotated, Literal
from pydantic import Field, model_validator
from ._schema import (
SHA256,
ArtifactName,
DataRole,
ProtocolModel,
PythonRepoRelPath,
PythonS... | pvd232/viper | src/viper/artifacts.py | .py | 4c2857b634d224d7 | 7 | 0 |
"""Define benchmark specifications, criteria, comparisons, and results."""
from __future__ import annotations
from typing import Literal
from pydantic import AwareDatetime, Field, model_validator
from ._schema import SHA256, BenchmarkId, EvaluationId, ProtocolModel
from .artifacts import StageArtifactRef
from .ids ... | pvd232/viper | src/viper/benchmark.py | .py | 5869bdb5a8a35417 | 7 | 0 |
"""Execute project commands through the VIPER worker interface."""
from __future__ import annotations
import os
import subprocess
from datetime import UTC, datetime
from pathlib import Path
from typing import Literal
from pydantic import BaseModel, ConfigDict, Field, model_validator
class WorkerError(RuntimeError)... | pvd232/viper | src/viper/execution/_process.py | .py | 91463c23b20e2e21 | 7 | 0 |
"""Retrieve exact source and immutable output bytes for run execution."""
from __future__ import annotations
import hashlib
import subprocess
from pathlib import Path
from .._schema import RepoRelPath
from ..references import (
GitFileRef,
HuggingFaceFileRef,
LocalStageResultSnapshotRef,
ResolvedGitF... | pvd232/viper | src/viper/execution/_source.py | .py | f1c505d78f421da6 | 7 | 0 |
"""Define experiments, variants, factors, and replicate selections."""
from __future__ import annotations
from typing import Annotated, Literal
from pydantic import Field, model_validator
from . import parameters
from ._schema import ProtocolModel, RNGSeed
from .ids import ExperimentId, FactorId, LevelId, Replicate... | pvd232/viper | src/viper/experiments.py | .py | 425438c53024d489 | 7 | 0 |
"""Persist ordered run-attempt transitions in an append-only journal."""
from __future__ import annotations
import os
from datetime import datetime
from pathlib import Path
from typing import Any, Literal
from pydantic import BaseModel, ConfigDict, Field
AttemptState = Literal[
"allocated",
"preflighting",
... | pvd232/viper | src/viper/journal.py | .py | 7d6948fe9e737ce2 | 7 | 0 |
"""Resolve verified same-run artifacts into stage input paths."""
from __future__ import annotations
from collections.abc import Mapping
from pathlib import Path
from .ids import InputName, StageId
from .stages import (
BaseSpec,
FutureInputRef,
InternalSpec,
)
class MaterializationError(RuntimeError):... | pvd232/viper | src/viper/materialization.py | .py | 555089a62cd44e6d | 7 | 0 |
"""Define project metric authoring, invocation, comparison, and measurement."""
from __future__ import annotations
import hashlib
import importlib.util
import inspect
import math
import os
from abc import ABC, abstractmethod
from collections.abc import Callable, Mapping
from dataclasses import dataclass
from datetime... | pvd232/viper | src/viper/metrics.py | .py | e359636d570fb386 | 7 | 0 |
"""Define the public parameter categories that projects may specialize."""
from typing import Literal, Self
from pydantic import BaseModel, ConfigDict, Field, JsonValue, model_validator
from ._schema import SHA256, ProtocolModel, PythonRepoRelPath, PythonSymbol
class ParameterSet(BaseModel):
"""A versioned JSO... | pvd232/viper | src/viper/parameters.py | .py | a98c0c893f4fb77c | 7 | 0 |
"""Generate a small project that demonstrates every VIPER stage kind."""
from __future__ import annotations
import re
import shutil
import tempfile
from pathlib import Path
PACKAGE_PATTERN = re.compile(r"[a-z][a-z0-9_]*\Z")
class ProjectInitializationError(RuntimeError):
"""Report an invalid target or a failed... | pvd232/viper | src/viper/project_init.py | .py | 7fedcaa710c9982a | 7 | 0 |
"""Capture and restore the state required to resume training exactly."""
from __future__ import annotations
import random
from collections.abc import Mapping
from pathlib import Path
from typing import Annotated, Any, Literal, cast
import numpy as np
import torch
from pydantic import Field, model_validator
from torc... | pvd232/viper | src/viper/resume.py | .py | fb512cda8eca3d34 | 7 | 0 |
from __future__ import annotations
import json
import os
import tempfile
PROFILE_PATH = os.path.join(os.path.expanduser("~"), ".config", "theme-engine", "starship.json")
# Nerd Font glyphs above U+FFFF need a surrogate pair once encoded to UTF-16.
# Something in the editing pipeline this file has passed through mang... | grapes7000/themes | bin/theme_starship.py | .py | d633ab0f57de8954 | 7 | 0 |
import logging
import time
from abc import ABC, abstractmethod
from typing import Any
import litellm
from backend.core.config import get_settings
from backend.core.metrics import agent_calls_total, llm_cost_total, llm_tokens_total
from backend.graph.state import AgentCallMetadata, ResearchState
from backend.schemas.a... | siddharthgaur1/deepresearch | backend/agents/base.py | .py | daf74968c9d810f9 | 7 | 0 |
from backend.agents.base import BaseAgent
from backend.graph.state import Claim, ResearchState
FACT_CHECK_PROMPT = """Claim: "{claim}"
Sources:
{sources}
Does the evidence across these sources support the claim? Reply with exactly \
one word: SUPPORTED, PARTIAL, or CONTRADICTED.
"""
class FactCheckerAgent(BaseAgen... | siddharthgaur1/deepresearch | backend/agents/fact_checker.py | .py | 80d5a737803b4ad1 | 7 | 0 |
from backend.agents.base import BaseAgent
from backend.core.redis import dedup_key, get_redis
from backend.graph.state import ResearchState
from backend.tools.search import search
class ResearcherAgent(BaseAgent):
"""Runs once per sub-question branch (fanned out via LangGraph Send()).
Expects state to carry a... | siddharthgaur1/deepresearch | backend/agents/researcher.py | .py | e7b4e192165ce780 | 7 | 0 |
"""Core LangGraph state schema shared by every agent node."""
import operator
from enum import StrEnum
from typing import Annotated, NotRequired, TypedDict
class ResearchStatus(StrEnum):
QUEUED = "queued"
PLANNING = "planning"
RESEARCHING = "researching"
VERIFYING = "verifying"
WRITING = "writing... | siddharthgaur1/deepresearch | backend/graph/state.py | .py | f0a7186b1741f3b9 | 7 | 0 |
"""Conditional-edge routing logic. Kept separate from graph.py so the
retry/re-research decision (the one bit of real branching logic in this
graph) is unit-testable without spinning up a full StateGraph."""
from langgraph.graph import END
from langgraph.types import Send
from backend.core.config import get_settings
... | siddharthgaur1/deepresearch | backend/graph/supervisor.py | .py | d8a761564d566715 | 7 | 0 |
import uuid
from datetime import datetime
from sqlalchemy import DateTime, ForeignKey, Text, func
from sqlalchemy.dialects.postgresql import JSONB, UUID
from sqlalchemy.orm import Mapped, mapped_column, relationship
from backend.core.database import Base
class Report(Base):
__tablename__ = "reports"
id: Ma... | siddharthgaur1/deepresearch | backend/models/report.py | .py | c4b5013d869956f9 | 7 | 0 |
import uuid
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from backend.models.report import Report
async def get_report_by_job(db: AsyncSession, job_id: uuid.UUID) -> Report | None:
result = await db.execute(select(Report).where(Report.job_id == job_id))
return result.scalar_... | siddharthgaur1/deepresearch | backend/services/report_service.py | .py | 36bc0056247cb2af | 7 | 0 |
import asyncio
import logging, datetime,json,time
from signaldeck_sdk import Processor
from pathlib import Path
from pymodbus.client import AsyncModbusTcpClient
from pymodbus.exceptions import ConnectionException
from pymodbus.constants import Endian
from signaldeck_sdk import PersistData
from .modbus_pool import Modb... | signaldeck/signaldeck-plugin-main | signaldeck_plugin_main/processors/modbus/modbus.py | .py | 42d6577d6623719a | 7 | 0 |
# 2から1579までの素数を使った2次元配列(横3159・縦249行)を作成し、
# 複数行を同時にランダムシフトし、「全行が0になる列」の数が増えれば採用、
# 増えなければ元に戻す、という山登り法を1万回繰り返す。
#
# 改善版:
# ・複数行同時変更: 1回の試行で1〜MULTI_ROW_MAX行をまとめてシフトし、
# グループ全体でゼロ列数の増減を評価する(1行ずつでは見つからない
# 組み合わせ改善を拾えるようにする)。
# ・未試行シフト優先: 各行ごとに未試行のシフト量をシャッフルして保持し、
# そこから優先的に選ぶことで、同じ値の再試行によるムダを減らす。
import os
from... | Hajime-Ooshiro/PyHLSearch_HillClimb | HLSearch_HillClimb.py | .py | bb375b284eaa017c | 7 | 0 |
#!/usr/bin/env python3
"""
sweep_probe.py
==============
Measure technocore.chat's server-side single-line sweep from the outside.
How it works
------------
When a signature fails to verify, the server returns 403 along with the exact
string the signature should have covered. That string is the text AFTER the
sweep ha... | N5342689605/technocore-signing | sweep_probe.py | .py | 9326c5ab51037951 | 7 | 0 |
# -*- coding: utf-8 -*-
"""파일럿 정답(gold) 초안과 사람이 확정할 검토 시트를 만든다.
`docs/spec/prereg-02-pilot.md` §4의 정답 규칙을 구현한다.
조건없음 층 → 기본금리
닫힘 층 → 기본금리 + 충족된 우대금리 합 (상한 적용)
안닫힘 층 → "알 수 없다" (하한 = 기본 + 충족 우대)
**출력은 초안이다.** 사전등록 §4는 정답을 "사람이 원문을 보고 확정한 조건표"에서
계산하도록 정했고, §2는 층 판정도 사람이 확인하도록 정했다. 이 스크립트는 그 확인을
받을 시트를 만드는 데... | hyos0415/fineprint | src/analysis/build_gold.py | .py | 4bfd3fbfb1ce9e95 | 7 | 0 |
# -*- coding: utf-8 -*-
"""사람이 직접 읽어야 하는 표본을 뽑아 검토용 문서로 만든다.
이 파일이 채우는 자리
추출 결과 1,051개 중 **사람 눈이 필요한 두 덩어리**가 있다
(`../../docs/spec/prereg-06-matching-and-judgment.md` §1.1·§1.4).
부정 조건 6건 금융위 소비자 경보가 지목한 유형인데 데이터에는 0.6%뿐이고
전부 같은 문구다. **AI 가 "없어야 한다"를 "해야 한다"로 잘못
... | hyos0415/fineprint | src/analysis/review_sample.py | .py | 2ac3f954203362cf | 7 | 0 |
# -*- coding: utf-8 -*-
"""유형 배정 재추출을 사전등록 기준으로 채점한다 — `../../docs/spec/prereg-07-type-assignment.md`.
**기준은 이 파일이 아니라 `prereg-07` 이 정한다.** 여기는 그걸 계산할 뿐이다.
주 지표 은행권 A군 11건이 사람이 읽은 유형과 일치하는가 임계 >= 9/11
부 지표 저축은행 A군 9건 (홀드아웃) 임계 >= 3/9
회귀 가드 커버리지 게이트 · 닫힘률 -2%p · `기타` 비율 · 항목 0개 비율
**... | hyos0415/fineprint | src/analysis/score_type_assignment.py | .py | 84a3f46f69522829 | 7 | 0 |
from vibeshield.models.finding import Finding, SeverityLevel
from vibeshield.triage.models import TriageResult
SEVERITY_RANK = {
SeverityLevel.CRITICAL: 5,
SeverityLevel.HIGH: 4,
SeverityLevel.MEDIUM: 3,
SeverityLevel.LOW: 2,
SeverityLevel.INFO: 1,
}
def baseline_triage(finding: Finding) -> Triag... | Kiamapatrick/Vibechek | src/vibeshield/triage/baseline.py | .py | 534130198b85910e | 7 | 0 |
from pathlib import Path
DEFAULT_KB_DIR = Path(__file__).parent / "knowledge_base"
def load_kb(kb_dir: Path | None = None) -> dict[str, str]:
"""Load all markdown files from the knowledge base directory.
Returns a mapping of topic_name (filename without .md) -> content.
"""
target_dir = kb_dir o... | Kiamapatrick/Vibechek | src/vibeshield/triage/context/loader.py | .py | 87c2210e62a7c9f4 | 7 | 0 |
from dataclasses import dataclass
from pathlib import Path
from rank_bm25 import BM25Okapi
from vibeshield.models.finding import Finding
from vibeshield.triage.context.loader import load_kb
from vibeshield.triage.models import ContextSnippet
@dataclass
class _IndexedDoc:
topic: str
content: str
tokens: ... | Kiamapatrick/Vibechek | src/vibeshield/triage/context/retriever.py | .py | 386e0c9fbbdefb5c | 7 | 0 |
import json
from pathlib import Path
from typing import Any
from scipy.stats import spearmanr
from vibeshield.models.finding import Finding
from vibeshield.triage.models import TriageResult
def load_golden(golden_path: Path) -> list[dict[str, Any]]:
with golden_path.open("r", encoding="utf-8") as f:
ret... | Kiamapatrick/Vibechek | src/vibeshield/triage/eval/harness.py | .py | 27660ee7fd5e8d48 | 7 | 0 |
import json
from typing import Any
from groq import APIConnectionError, APITimeoutError, Groq, RateLimitError
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_exponential
from vibeshield.models.finding import Finding
from vibeshield.triage.config import get_settings
from vibeshield.triage... | Kiamapatrick/Vibechek | src/vibeshield/triage/llm/client.py | .py | 0efa6403a0099419 | 7 | 0 |
from dataclasses import dataclass
from vibeshield.models.finding import Finding
from vibeshield.triage.models import ContextSnippet
@dataclass(frozen=True)
class PromptTemplate:
"""Typed prompt template for LLM triage."""
version: str
system: str
user_template: str
def build(self, finding: F... | Kiamapatrick/Vibechek | src/vibeshield/triage/llm/prompts/prompt_v1.py | .py | f41700dc8c8314c3 | 7 | 0 |
from vibeshield.models.finding import SeverityLevel
from vibeshield.triage.models import TriageResult
SEVERITY_ORDER = [
SeverityLevel.CRITICAL,
SeverityLevel.HIGH,
SeverityLevel.MEDIUM,
SeverityLevel.LOW,
SeverityLevel.INFO,
]
SEVERITY_LABEL = {
SeverityLevel.CRITICAL: "CRITICAL",
Severit... | Kiamapatrick/Vibechek | src/vibeshield/triage/report.py | .py | a5ad1b2193f6c5ef | 7 | 0 |
"""
Common code used in multiple modules.
"""
class weekday(object):
__slots__ = ["weekday", "n"]
def __init__(self, weekday, n=None):
self.weekday = weekday
self.n = n
def __call__(self, n):
if n == self.n:
return self
else:
return self.__class__(... | Papawadee-Mohdee/Gasstation_KRK | .venv/lib/python3.12/site-packages/dateutil/_common.py | .py | efbc34cb2b64af19 | 7 | 0 |
# -*- coding: utf-8 -*-
"""
This module offers general convenience and utility functions for dealing with
datetimes.
.. versionadded:: 2.7.0
"""
from __future__ import unicode_literals
from datetime import datetime, time
def today(tzinfo=None):
"""
Returns a :py:class:`datetime` representing the current day... | Papawadee-Mohdee/Gasstation_KRK | .venv/lib/python3.12/site-packages/dateutil/utils.py | .py | 74a09c844c3c78e6 | 7 | 0 |
# -*- coding: utf-8 -*-
import warnings
import json
from tarfile import TarFile
from pkgutil import get_data
from io import BytesIO
from dateutil.tz import tzfile as _tzfile
__all__ = ["get_zonefile_instance", "gettz", "gettz_db_metadata"]
ZONEFILENAME = "dateutil-zoneinfo.tar.gz"
METADATA_FN = 'METADATA'
class t... | Papawadee-Mohdee/Gasstation_KRK | .venv/lib/python3.12/site-packages/dateutil/zoneinfo/__init__.py | .py | 298834a6d8423237 | 7 | 0 |
import logging
import os
import tempfile
import shutil
import json
from subprocess import check_call, check_output
from tarfile import TarFile
from dateutil.zoneinfo import METADATA_FN, ZONEFILENAME
def rebuild(filename, tag=None, format="gz", zonegroups=[], metadata=None):
"""Rebuild the internal timezone info ... | Papawadee-Mohdee/Gasstation_KRK | .venv/lib/python3.12/site-packages/dateutil/zoneinfo/rebuild.py | .py | 322a98cc2207bcd6 | 7 | 0 |
"""
Contains the core of NumPy: ndarray, ufuncs, dtypes, etc.
Please note that this module is private. All functions and objects
are available in the main ``numpy`` namespace - use that instead.
"""
import os
from numpy.version import version as __version__
# disables OpenBLAS affinity setting of the main thread ... | Papawadee-Mohdee/Gasstation_KRK | .venv/lib/python3.12/site-packages/numpy/_core/__init__.py | .py | 837ce8aec8693095 | 7 | 0 |
"""
A place for code to be called from the implementation of np.dtype
String handling is much easier to do correctly in python.
"""
import numpy as np
_kind_to_stem = {
'u': 'uint',
'i': 'int',
'c': 'complex',
'f': 'float',
'b': 'bool',
'V': 'void',
'O': 'object',
'M': 'datetime',
... | Papawadee-Mohdee/Gasstation_KRK | .venv/lib/python3.12/site-packages/numpy/_core/_dtype.py | .py | 59a285cabfcef070 | 7 | 0 |
"""
Conversion from ctypes to dtype.
In an ideal world, we could achieve this through the PEP3118 buffer protocol,
something like::
def dtype_from_ctypes_type(t):
# needed to ensure that the shape of `t` is within memoryview.format
class DummyStruct(ctypes.Structure):
_fields_ = [('a',... | Papawadee-Mohdee/Gasstation_KRK | .venv/lib/python3.12/site-packages/numpy/_core/_dtype_ctypes.py | .py | 28f3e56a40ec3e4b | 7 | 0 |
"""
Various richly-typed exceptions, that also help us deal with string formatting
in python where it's easier.
By putting the formatting in `__str__`, we also avoid paying the cost for
users who silence the exceptions.
"""
def _unpack_tuple(tup):
if len(tup) == 1:
return tup[0]
else:
return t... | Papawadee-Mohdee/Gasstation_KRK | .venv/lib/python3.12/site-packages/numpy/_core/_exceptions.py | .py | 5fc120d61ab5b94f | 7 | 0 |
import functools
import inspect
import operator
import types
import warnings
import numpy as np
from numpy._core import overrides
from numpy._core._multiarray_umath import _array_converter
from numpy._core.multiarray import add_docstring
from . import numeric as _nx
from .numeric import asanyarray, nan, ndim, result_... | Papawadee-Mohdee/Gasstation_KRK | .venv/lib/python3.12/site-packages/numpy/_core/function_base.py | .py | 97925f5f2a271088 | 7 | 0 |
"""Time-Space A* algorithm for multi-robot path planning with dynamic obstacle avoidance."""
from __future__ import annotations
import heapq
from typing import TypeAlias
Coord: TypeAlias = tuple[int, int]
State: TypeAlias = tuple[int, int, int]
def time_space_astar(
start: Coord,
goal: Coord,
grid_widt... | SoulViper07/sih-amr-fleet | backend/algorithms/time_space_astar.py | .py | fad2a453fcc3c741 | 7 | 0 |
"""FastAPI server with WebSocket and MQTT bridge for real-time AMR fleet monitoring."""
import asyncio
import json
import logging
import random
import uuid
from typing import Any
import paho.mqtt.client as mqtt
import requests
from fastapi import FastAPI, WebSocket, WebSocketDisconnect, HTTPException
from fastapi.mid... | SoulViper07/sih-amr-fleet | backend/api.py | .py | 97691485bd996b6b | 7 | 0 |
"""Warehouse grid environment for multi-robot simulation."""
from typing import Dict, List, Tuple
class WarehouseGrid:
"""2D grid environment representing a warehouse with obstacles and agents."""
def __init__(
self,
width: int,
height: int,
obstacles: List[Tuple[int, int]] |... | SoulViper07/sih-amr-fleet | backend/world/grid.py | .py | 1692ac6ae936672d | 7 | 0 |
import sys
from pathlib import Path
# Add project root directory to sys.path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
#!/usr/bin/env python3
"""Simulation runner for multi-robot warehouse simulation demo."""
import time
import json
import logging
import threading
import random
import uuid
from ... | SoulViper07/sih-amr-fleet | scripts/sim_runner.py | .py | ad4f70e863591e9c | 7 | 0 |
"""Shared admission and rate controls for every application network path."""
from __future__ import annotations
import contextlib
import random
import re
import threading
import time
from collections.abc import Iterator
_RATE = re.compile(r"^(?P<value>\d+(?:\.\d+)?)(?P<unit>[BKMGTP]?)$", re.IGNORECASE)
_SCALES = {"B... | tpluharik/Tuxindrive | src/tuxindrive/bandwidth.py | .py | bac2e679689322fb | 7.35 | 4 |
from __future__ import annotations
import json
import os
import shutil
import time
from dataclasses import dataclass
from pathlib import Path
from .config import cache_root
from .models import SyncJob
@dataclass(frozen=True, slots=True)
class CacheCleanupResult:
job_id: str
examined_bytes: int = 0
relea... | tpluharik/Tuxindrive | src/tuxindrive/cache_manager.py | .py | bd144cd90e63ebe4 | 7.35 | 4 |
from __future__ import annotations
import json
import os
import platform
import tempfile
from pathlib import Path
from .models import AppConfig
from .file_permissions import private_descriptor
def config_home() -> Path:
system = platform.system()
if system == "Windows":
return Path(os.environ.get("A... | tpluharik/Tuxindrive | src/tuxindrive/config.py | .py | ada3726bed420fcc | 7.35 | 4 |
from __future__ import annotations
from collections.abc import Iterable, Sequence
from .models import FolderGroup, SyncJob
JOB_DRAG_PREFIX = "tuxindrive-job:"
MAX_JOB_DRAG_ID_LENGTH = 256
def cloud_selection_paths(selected: Iterable[str] | None = None) -> set[str]:
"""Keep cloud choices independently of the a... | tpluharik/Tuxindrive | src/tuxindrive/folder_layout.py | .py | 35ade1f891cc1759 | 7.35 | 4 |
"""Desktop-independent helpers for Nautilus availability actions."""
from __future__ import annotations
import os
from pathlib import Path
def command_line_path(arguments: list[str], name: str) -> str:
"""Read both ``--name PATH`` and ``--name=PATH`` fallback forms."""
option_name = f"--{name}"
for inde... | tpluharik/Tuxindrive | src/tuxindrive/nautilus_support.py | .py | cfd65016676b94a1 | 7.35 | 4 |
"""
benchmark.py — measure DINOv3 embedding latency on THIS machine, and
suggest a `--frame-skip` value for live.py accordingly. Phase 3's fourth
and final enrichment idea from the brief: "a short benchmark script...
so I know what frame rate to expect."
Deliberately separate from backbone.py: loading the model is one... | Zahin2470/ProtoVision | protovision/benchmark.py | .py | 7dd08b8b95bbc4fd | 7.24 | 2 |
"""
enroll.py — camera app: capture N example images of one object, embed each
with the frozen DINOv3 backbone, and add them to the class's prototype.
Testing approach
-----------------
`EnrollApp.__init__` opens a real camera (`Camera()`), which doesn't exist in
this sandbox. Every other method is pure state-machine ... | Zahin2470/ProtoVision | protovision/enroll.py | .py | 162e4c0dd4702aa9 | 7.24 | 2 |
"""
live.py — camera app: live recognition against stored prototypes.
Testing approach: same as enroll.py — `__init__` opens a real camera and is
not testable here; `process_frame()` (the actual decision logic, including
the frame-skip strategy) is pure and is fully unit tested by constructing
the instance via `LiveAp... | Zahin2470/ProtoVision | protovision/live.py | .py | 9886a98a96fd93d0 | 7.24 | 2 |
"""
Shared fixtures for tests that need "a backbone" but shouldn't need real
DINOv3 weights — same mock-model approach as test_backbone.py, reused here
so enroll/live tests aren't coupled to real hardware/weights either.
"""
import os
import sys
from pathlib import Path
# Must be set before pygame's mixer is ever ini... | Zahin2470/ProtoVision | tests/conftest.py | .py | 1ce799db61fa9978 | 7.74 | 2 |
"""Reference-material handling: inject text documents into a prompt and encode
images for multimodal models.
Two mechanisms, two different things measured:
* Text/document references are read and stitched into the prompt as context.
This inflates the *prompt* token count, so the harness's prefill metrics
(`prompt... | ishpatel/llm-bench-lab | llmbench/attachments.py | .py | 8cbe54a7256b884b | 7 | 0 |
"""Loading and validation of benchmark configs and prompt sets."""
from __future__ import annotations
import json
import os
from typing import Any, Dict, List, Optional
DEFAULTS: Dict[str, Any] = {
"name": "benchmark",
"system_label": None, # None => auto-detect
# 127.0.0.1 rather than "localhost... | ishpatel/llm-bench-lab | llmbench/config.py | .py | 110f869a16794b16 | 7 | 0 |
"""Discovery of local inference engines.
Ollama is one way to run models locally, not the only one. LM Studio,
llama.cpp's llama-server, vLLM, Jan and GPT4All all expose the same
OpenAI-compatible /v1 API on well-known ports, so the bench can find whatever
the user already runs instead of insisting on Ollama.
Discove... | ishpatel/llm-bench-lab | llmbench/engines.py | .py | b1fd82a12488d0e7 | 7 | 0 |
"""Running the remediation commands that the readiness checks suggest.
The web UI can offer a "Run" button next to a failing check. That means a page
in a browser can cause a command to execute on this machine, so the rules are
deliberately narrow:
1. The browser sends a check *key*, never a command string. The comma... | ishpatel/llm-bench-lab | llmbench/fixes.py | .py | 32dea5528a752a7d | 7 | 0 |
"""A tiny single-worker job queue.
Benchmark runs must not overlap (two generations sharing the GPU would ruin
each other's timings), so every submitted run is processed FIFO by one worker
thread. Each job carries a live log buffer that the web UI polls for progress.
"""
from __future__ import annotations
import queu... | ishpatel/llm-bench-lab | llmbench/jobs.py | .py | fc4f0cb2844bf0d8 | 7 | 0 |
"""Can this machine actually run a benchmark, and what is missing if not.
`describe_system_deep` answers "what hardware is this". That is a different
question from "is the bench ready to run", which is about the runtime around
the hardware: an interpreter new enough, a reachable engine, models pulled, a
place to write... | ishpatel/llm-bench-lab | llmbench/readiness.py | .py | c053ac8f17b4db03 | 7 | 0 |
"""Config loading and prompt resolution.
Config resolution decides what actually gets measured, so a silent mistake here
does not crash; it produces a benchmark of something other than what was asked
for. These tests pin the merge rules and the failure messages.
"""
import json
import os
import tempfile
import unittes... | ishpatel/llm-bench-lab | tests/test_config.py | .py | ff77f2ed0e378f2e | 7.5 | 0 |
"""The CLI summary, the surface most users read the numbers from.
Two classes of thing are pinned here. First, units: every metric column carries
its unit in the header, because a bare "88.5" is not a measurement. Second, the
notes, which are the honest-reporting machinery: on-battery, thermal pressure,
throttling, pa... | ishpatel/llm-bench-lab | tests/test_console.py | .py | 33cf1279660e758c | 7.5 | 0 |
"""Telemetry parsers, against captured command output.
Everything here parses a string that a system tool printed. That makes these the
only tests in the suite that can cover the AMD, Intel and Windows code paths at
all: this project has never run on that hardware, so a fixture of real output is
the closest thing to e... | ishpatel/llm-bench-lab | tests/test_telemetry.py | .py | 2c1dd2fbae530b6a | 7.5 | 0 |
#!/usr/bin/env python3
"""Build the live 840313 website profile from one passing protected-main canary."""
from __future__ import annotations
import argparse
import json
from pathlib import Path
from typing import Any, Sequence
from blueprint_pipeline.adp009d_840313_runtime_bundle import (
verify_materialized_ru... | ognjhunt/BlueprintCapturePipeline | scripts/build_adp009d_840313_live_profile.py | .py | a4a2e3097bccafee | 7 | 0 |
#!/usr/bin/env python3
"""Build a live launch profile for the Arena native-control probe.
The allocator has dispatched `adp-isaac-lab-arena-native-control` throughout,
the transport is written and tested, and the bundle got a command line of its
own so it could be rebuilt after a deploy moved the control plane's commi... | ognjhunt/BlueprintCapturePipeline | scripts/build_arena_native_control_live_profile.py | .py | 07e27f6bcdc5de42 | 7 | 0 |
from __future__ import annotations
import logging, os
from flask import Flask
from typing import Optional
from jinja2 import ChoiceLoader, FileSystemLoader
from signaldeck_ui.blueprint import bp as ui_bp
from .models.manager import Manager
from signaldeck_core.logging_setup import setup_logging
from signaldeck_cor... | signaldeck/signaldeck-core | signaldeck_core/app_factory.py | .py | 60443267a3964e07 | 7 | 0 |
import logging.config
import json
import numpy as np
import pandas as pd
import glob
import os
from .models.manager import manager
config_path = "config/haus.json"
def config():
with open("logging_config_i.json", 'r') as logging_configuration_file:
config_dict = json.load(logging_configuration_file)
... | signaldeck/signaldeck-core | signaldeck_core/app_i.py | .py | ad5a294d86cabe09 | 7 | 0 |
from __future__ import annotations
import argparse, os
import importlib
import json
from pathlib import Path
from typing import Any
from signaldeck_core.app_factory import create_app
from signaldeck_core.services import server_runner
from .render_config import render_processor_config
def _load_raw_config(path: str)... | signaldeck/signaldeck-core | signaldeck_core/cli.py | .py | e794e28ce63325ee | 7 | 0 |
import json
from typing import Any, Protocol
from importlib import resources
from signaldeck_sdk.context import Translator
class TranslatorImpl(Translator):
"""
A translator implementation.
"""
def __init__(self, lang: str, fallback_lang: str):
self.language = lang
self.fallback_langu... | signaldeck/signaldeck-core | signaldeck_core/models/translator.py | .py | 176bfbd4a8c042c1 | 7 | 0 |
from __future__ import annotations
import importlib
import json
import re
from dataclasses import dataclass
from getpass import getpass
from typing import Any
from signaldeck_sdk import Placeholder
# ---------- Placeholder handling ----------
_PLACEHOLDER_FULL_RE = re.compile(r"^\$([a-zA-Z0-9_]+)\$$")
def _find... | signaldeck/signaldeck-core | signaldeck_core/render_config.py | .py | bcebeb992d4a1115 | 7 | 0 |
# signaldeck_core/services/action_dispatcher.py
from __future__ import annotations
import threading
import logging
class ActionDispatcher:
def __init__(self, *, logger: logging.Logger) -> None:
self.logger = logger
self.pending: list[threading.Thread] = []
self.is_processing: bool = False
... | signaldeck/signaldeck-core | signaldeck_core/services/action_dispatcher.py | .py | 00e1e35a8f092882 | 7 | 0 |
from __future__ import annotations
from dataclasses import dataclass
from typing import List
from ..models.group import Group # adjust import if needed
@dataclass(frozen=True)
class UiAssets:
js: list[str]
css: list[str]
class UiAssetService:
"""
Aggregates JS/CSS assets needed for a given set of gro... | signaldeck/signaldeck-core | signaldeck_core/services/ui_asset_service.py | .py | 2b23fe41cbb55a8f | 7 | 0 |
# SPDX-License-Identifier: MIT
"""fituna.bench
===============
Runs ``llama-bench`` for a single (quant, ngl, ctx) candidate and parses its
JSON output into a :class:`~fituna.config.BenchResult`. Generation
throughput (``gen_tok_per_sec``) is the primary metric the search algorithm
in :mod:`fituna.search` optimizes ag... | leeyunseokarchive/fituna | fituna/bench.py | .py | 7c9839eaec1899bb | 7 | 0 |
# SPDX-License-Identifier: MIT
"""fituna.binaries
==================
Locates required llama.cpp executables (on PATH or under a user-supplied
``--llama-bin-dir``), and introspects them (``--help``/``--version``) so
FiTuna never hardcodes a quant-type list that may drift from the user's
llama.cpp build.
"""
from __fut... | leeyunseokarchive/fituna | fituna/binaries.py | .py | f25309090525787d | 7 | 0 |
# SPDX-License-Identifier: MIT
"""fituna.cache
================
sqlite3-backed cache for bench/quality results, keyed by
(model_fingerprint, hardware_fingerprint, candidate) so re-running the same
search (``--resume``) skips subprocess calls that already have an answer.
Schema::
bench_cache(model_fp, hw_fp, quan... | leeyunseokarchive/fituna | fituna/cache.py | .py | 73ad2f6761665ef5 | 7 | 0 |
# SPDX-License-Identifier: MIT
"""fituna.config
================
Shared types for every FiTuna module: :class:`Enum`/``frozen`` ``dataclass``
value objects and the :class:`FiTunaError` exception hierarchy.
This module is the interface contract. No module outside ``config.py``
defines its own cross-module type -- ever... | leeyunseokarchive/fituna | fituna/config.py | .py | c64e21285ab2781e | 7 | 0 |
# SPDX-License-Identifier: MIT
"""fituna.quality
=================
Runs ``llama-perplexity`` against a wikitext corpus to measure quality loss
of a quantized GGUF relative to the unquantized baseline.
"""
from __future__ import annotations
import re
import subprocess
from pathlib import Path
from typing import Optio... | leeyunseokarchive/fituna | fituna/quality.py | .py | 1302e8f3a266e201 | 7 | 0 |
# SPDX-License-Identifier: MIT
"""fituna.report
================
Turns a :class:`~fituna.config.SearchResult` into ready-to-run ``llama-cli``
/ ``llama-server`` commands, an Ollama ``Modelfile``, and a JSON /
human-readable report.
Almost everything here is a pure function of already-computed dataclasses
(see fituna/... | leeyunseokarchive/fituna | fituna/report.py | .py | ad9a0df25707f929 | 7 | 0 |
"""Transactional local event ledger; VALR remains account-state authority."""
from __future__ import annotations
import json
import sqlite3
from datetime import datetime, timedelta, timezone
from decimal import Decimal
from pathlib import Path
from breakwater.decimal_utils import D
class Ledger:
def __init__(s... | 6ixtyn9-sudo/Breakwater | src/breakwater/ledger.py | .py | 681e086f56911239 | 7 | 0 |
"""VALR-native catalog, time and candle completeness checks.
Patch: enable paging in fetch_recent_candles() so research can request >300 SPOT
candles (VALR per-request limit remains 300; we page backwards).
Env:
- BREAKWATER_CANDLE_PAGE_SLEEP_SECONDS (default 0.05): politeness delay between pages
"""
from __future__... | 6ixtyn9-sudo/Breakwater | src/breakwater/market.py | .py | d7a0262ff744168e | 7 | 0 |
"""Monitored-slice scanning over the live universe.
Regime gating (evidence-aware):
- Strict mode blocks longs in bear and shorts in bull.
- Evidence-aware mode blocks only when the slice is hostile-unproven
(`hostile_unproven=True`).
Environment:
- BREAKWATER_REGIME_GATE_STRICT=1 forces strict gating.
Optional boo... | 6ixtyn9-sudo/Breakwater | src/breakwater/monitor.py | .py | 07352687920635f0 | 7 | 0 |
"""Hyperliquid public market data for VALR Perps pairs.
VALR Perps executes on Hyperliquid. Market data such as candles is served
by Hyperliquid's public info API and needs no VALR credentials, which the
VALR web application itself relies on.
HIP-3 builder venues (VALR symbols like ``xyz:NVDAUSDC``) *do* have a
Hyper... | 6ixtyn9-sudo/Breakwater | src/breakwater/perpdata.py | .py | a474905cd921f82b | 7 | 0 |
from __future__ import annotations
from typing import Any
import pandas as pd
from src.battle_contract import (
SourceProvenance,
canonicalize_battles,
canonicalize_outcome,
parse_conversation,
)
def safe_parse_conversation(value: Any) -> list:
parsed = parse_conversation(value)
return [{"r... | l73989712-a11y/LLM-Arena-Preference-Analysis | src/preprocess.py | .py | ee3bbf1cbbfed965 | 7.15 | 1 |
"""Creates the three role groups referenced by apps.accounts.roles
(section 63) so they can be assigned to users from the Django admin."""
from django.contrib.auth.models import Group
from django.core.management.base import BaseCommand
from apps.accounts.roles import ALL_ROLES
class Command(BaseCommand):
help = ... | yusufaliaskin/ZKSessions | apps/accounts/management/commands/setup_roles.py | .py | c3363f0071f2442a | 7 | 0 |
from django.conf import settings
from django.shortcuts import redirect
from django.urls import reverse
class LoginRequiredMiddleware:
"""The dashboard must never be publicly accessible (section 62)."""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request)... | yusufaliaskin/ZKSessions | apps/accounts/middleware.py | .py | 431c471cecf6e294 | 7 | 0 |
import logging
from django.contrib.auth.models import Group, User
from django.db.models import Q
from django.utils import timezone
from .models import AccountAuditLog, UserProfile
from .roles import (
ADMINISTRATOR,
ALL_PERMISSION_KEYS,
ALL_ROLES,
REPORT_OPERATOR,
ROLE_PERMISSIONS_PRESETS,
SECUR... | yusufaliaskin/ZKSessions | apps/accounts/services.py | .py | 3219a9c9052fab4c | 7 | 0 |
"""Pardus and Enterprise Client Environment & Device Identity Utilities.
Extracts real client OS identity (e.g. YA550047) and real hardware/device name (e.g. ZK34990NX0814)
from corporate proxy headers, reverse DNS, socket hostnames, or computer inventory.
"""
import socket
from django.http import HttpRequest
def ge... | yusufaliaskin/ZKSessions | apps/accounts/utils.py | .py | 9465323165573705 | 7 | 0 |
"""
Asset Inventory Models — ComputerAsset & UserAsset.
These models provide dedicated, queryable inventory tables for:
- /assets/computers/ → ComputerAsset (terminals, servers, DCs)
- /assets/users/ → UserAsset (human users, service accounts, machine accounts)
They are populated from normalized audit events (A... | yusufaliaskin/ZKSessions | apps/assets/models.py | .py | 2b70ea1c71f9a91f | 7 | 0 |
"""
Audit adapter abstraction.
🔴 RULE 1 / RULE 2 — The audit system is a READ-ONLY source of truth.
No adapter implementation is allowed to INSERT, UPDATE, DELETE, terminate
sessions, or modify audit data in any way. Adapters only ever *fetch*.
This module defines the contract for production audit readers (WazuhAudi... | yusufaliaskin/ZKSessions | apps/audit/adapters/base.py | .py | 543d4b8fdc0235c1 | 7 | 0 |
"""
Database audit reader for real-world SQL audit sources (MSSQL, PostgreSQL, MySQL, SQLite, Oracle).
🔴 RULE 1 / RULE 2 — READ-ONLY SOURCE OF TRUTH.
This adapter only executes SELECT queries and connectivity checks. It never alters
or mutates the external audit database.
"""
from __future__ import annotations
impor... | yusufaliaskin/ZKSessions | apps/audit/adapters/db_reader.py | .py | c0667e35c911d12a | 7 | 0 |
"""Resolves the configured AuditReader implementation from settings."""
from django.conf import settings
from django.utils.module_loading import import_string
from .base import AuditReader
_instance: AuditReader | None = None
def get_audit_reader() -> AuditReader:
"""Return a (cached) instance of the configured... | yusufaliaskin/ZKSessions | apps/audit/adapters/factory.py | .py | 07dd38ea28d21254 | 7 | 0 |
"""Central AuditSourceManager.
Unified production service for managing active data sources (CSVAdapter vs WazuhAdapter),
validating live connectivity before migrations, safe CSV data purging, and deterministic ingestion.
"""
from __future__ import annotations
import logging
from datetime import datetime
from django.c... | yusufaliaskin/ZKSessions | apps/audit/adapters/source_manager.py | .py | 4096d1778fef87f7 | 7 | 0 |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024-2026 Paul Fremantle
"""The single-face bevel read and the convex-corner probe, shared by three recognisers.
`recognise_chamfers`, `recognise_angled_steps` and `recognise_fillets` all begin by asking the
same two questions of a face: **is this an oblique planar bev... | pzfreo/b123d-recognisers | src/b123d_recognisers/_bevel.py | .py | a5d107c39ba4fcbd | 7.24 | 2 |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024-2026 Paul Fremantle
"""Which faces established which candidate: run-local and append-only during discovery.
Two recognisers can describe the same physical region, and until now the package could only ask
*where* their records were, not *what they were built from*.... | pzfreo/b123d-recognisers | src/b123d_recognisers/_claims.py | .py | 01af3c748bddb77b | 7.24 | 2 |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024-2026 Paul Fremantle
"""Internal shared axis and length conventions used by recognition records and patterns.
Two things live here because every recogniser needs them and none owns them: the stable
dominant-axis convention, and the length-tolerance form of ADR 0008... | pzfreo/b123d-recognisers | src/b123d_recognisers/_geometry.py | .py | cec65fc49a61d0fb | 7.24 | 2 |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024-2026 Paul Fremantle
"""Internal bridge from facade faces to one aggregate evidence authority."""
from __future__ import annotations
from collections.abc import Iterable
from b123d_recognisers._candidates import FamilyId
from b123d_recognisers._claims import Evid... | pzfreo/b123d-recognisers | src/b123d_recognisers/_geometry_evidence.py | .py | 5da8adee1abca04a | 7.24 | 2 |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024-2026 Paul Fremantle
"""Hole-pattern records and derived recognition."""
import math
from collections.abc import Sequence
from dataclasses import dataclass
from b123d_recognisers._hole_features import CounterBore, HoleRecord
from b123d_recognisers._pattern_geometr... | pzfreo/b123d-recognisers | src/b123d_recognisers/_hole_patterns.py | .py | 5e64d1f05f4404e5 | 7.24 | 2 |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024-2026 Paul Fremantle
"""Record-agnostic deterministic 2-D pattern geometry."""
import math
from collections.abc import Callable, Sequence
from typing import TypeVar
from b123d_recognisers._geometry import _unit, length_tol, plane_axes
#: The record type a caller'... | pzfreo/b123d-recognisers | src/b123d_recognisers/_pattern_geometry.py | .py | 9288f02b1f1412bd | 7.24 | 2 |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024-2026 Paul Fremantle
"""What a solid's faces say about recesses, before any family has an opinion.
The bottom of the recess stack. `_planar_faces` reduces a solid to the axis-aligned planar
faces the three recess families work from -- ADR 0009's worked example, and... | pzfreo/b123d-recognisers | src/b123d_recognisers/_recess_faces.py | .py | 79747d5f49256517 | 7.24 | 2 |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024-2026 Paul Fremantle
"""Public slot, pocket, and channel recognisers over one shared recess core."""
from __future__ import annotations
from functools import partial
from b123d_recognisers._adjacency import FaceEdges, FaceGraph, FaceNode, SolidRef
from b123d_reco... | pzfreo/b123d-recognisers | src/b123d_recognisers/_recess_features.py | .py | d231b9ed63477273 | 7.24 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.