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
import json import logging import sys import os from concurrent.futures import ThreadPoolExecutor, as_completed from .base import SubcommandPlugin from cvs.lib.parallel_ssh_lib import Pssh class ScpPlugin(SubcommandPlugin): def get_name(self): return "scp" def get_parser(self, subparsers): p...
ROCm/cvs
cvs/cli_plugins/scp_plugin.py
.py
dd334d89b80f9bd5
7.63
17
import unittest from unittest.mock import patch import os import tempfile import argparse import io from contextlib import redirect_stdout from cvs.cli_plugins.copy_config_plugin import CopyConfigPlugin class TestCopyConfigPlugin(unittest.TestCase): @classmethod def setUpClass(cls): # Hardcode expect...
ROCm/cvs
cvs/cli_plugins/unittests/test_copy_config_plugin.py
.py
ceaae7e802855664
7.13
17
import unittest from unittest.mock import patch import os import tempfile from cvs.cli_plugins.list_plugin import ListPlugin class TestListPlugin(unittest.TestCase): """Test ListPlugin test discovery""" def test_discover_tests_core_only(self): """Test discovering tests from core cvs package only""" ...
ROCm/cvs
cvs/cli_plugins/unittests/test_list_plugin.py
.py
15fa7f4f9ff9e63c
8.13
17
import argparse import unittest from unittest.mock import MagicMock, patch import sys import os import tempfile import json # Add the parent directory to sys.path to import cli_plugins sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) from cvs.cli_plugins.run_plugin import RunPlugin, resolve_test_functio...
ROCm/cvs
cvs/cli_plugins/unittests/test_run_plugin.py
.py
9ee9d6969b0299f6
7.13
17
""" Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/conftest.py
.py
a78907c73bfb6254
8.13
17
''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/core/agent/messages.py
.py
0bb0c684167d63d6
7.63
17
''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/core/orchestrators/baremetal.py
.py
f51dc6879ec0b055
7.63
17
''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/core/orchestrators/factory.py
.py
40ac98c1ce5bfe69
7.63
17
''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/core/orchestrators/unittests/test_baremetal.py
.py
9a6fceeedf67fe41
8.13
17
''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/core/run_layout.py
.py
de14468a38ccc6d3
7.63
17
''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/core/runtimes/base.py
.py
852bf4f009189cd8
7.63
17
''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/core/runtimes/docker.py
.py
4fe1f718d9c94d50
7.63
17
''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/core/runtimes/enroot.py
.py
be2a23789c035392
7.63
17
''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/core/runtimes/factory.py
.py
010a7b13e460f7de
7.63
17
''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/core/runtimes/unittests/test_docker.py
.py
b1ebf0dec547b356
7.13
17
''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/core/scheduler.py
.py
fbaf0d419c6f81af
7.63
17
''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/core/unittests/test_run_layout.py
.py
a7137d7b743fc445
8.13
17
''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code contained here is Property...
ROCm/cvs
cvs/core/unittests/test_scheduler.py
.py
fc0b3c313a75366a
7.13
17
""" Extension configuration loader for cvs. This module provides functionality to load and parse extension configuration from extension.ini files in installed extension packages (e.g., cvs-extension). It allows extensions to override default behavior such as package name, and test discovery directories. """ import os...
ROCm/cvs
cvs/extension.py
.py
50355da610653210
7.63
17
#!/usr/bin/env python3 ''' Copyright 2025 Advanced Micro Devices, Inc. All rights reserved. This notice is intended as a precaution against inadvertent publication and does not imply publication or any waiver of confidentiality. The year included in the foregoing notice is the year of creation of the work. All code con...
ROCm/cvs
cvs/input/generate/cluster_json.py
.py
aec22cdf1ea6b867
7.63
17
import unittest from unittest.mock import MagicMock, patch import sys import os # Add the parent directory to sys.path to import generate modules sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) from cvs.input.generate.cluster_json import ClusterJsonGenerator class TestClusterJsonGenerator(unittest.Te...
ROCm/cvs
cvs/input/generate/unittests/test_cluster_json.py
.py
c18187c70b5075b2
8.13
17
"""Icon loader for toolbar PNG icons. Loads pre-rendered PNG icons at the appropriate DPI scale. Falls back gracefully to None if icons are missing (callers show text-only buttons in that case). Icons are rendered from SVGs by scripts/render_icons.py at build time. """ import logging import tkinter as tk from pathli...
yevgeniyglider/HebrewScribe
hebrewscribe/icons/__init__.py
.py
bbfea9f366168d9f
7.42
6
"""Output file writers: txt, srt, json.""" import json import os import tempfile import time from pathlib import Path from typing import List, Optional from hebrewscribe.utils import format_timestamp # A rename over a file another program is holding open is retried briefly # before the writer gives up on it; those h...
yevgeniyglider/HebrewScribe
hebrewscribe/outputs.py
.py
1170140a15265d6e
7.42
6
"""Modern flat ttk theme and color system (self-contained, no external dependency).""" import logging import sys logger = logging.getLogger("HebrewScribe") # --- Platform-adaptive font sizing --- # SF Pro (macOS) renders ~8% taller than Segoe UI (Windows) at the same pt size. _FONT_SIZE_OFFSET = -1 if sys.platform ...
yevgeniyglider/HebrewScribe
hebrewscribe/theme.py
.py
39fbb22b2b09a86b
7.42
6
"""Reusable tkinter widgets: ToolTip, TaskbarProgress.""" import logging import sys import tkinter as tk from typing import Optional from hebrewscribe.theme import Colors as C, _fs from hebrewscribe.utils import SYSTEM_FONT logger = logging.getLogger("HebrewScribe") class ToolTip: """Lightweight hover tooltip ...
yevgeniyglider/HebrewScribe
hebrewscribe/widgets.py
.py
b77dad5be820fa02
7.42
6
#!/usr/bin/env python3 """Generate the transitive-dependency licence table for THIRD-PARTY-LICENSES.md. Why this exists --------------- The hand-maintained "Additional Bundled Python Dependencies" table drifts every time a dependency gains a transitive dep. A 2026-08-15 audit found ~40 packages present in the project'...
yevgeniyglider/HebrewScribe
scripts/gen_third_party_licenses.py
.py
8f7aabdaa0bb7b20
7.42
6
"""Shared test utilities: MockApp and helpers used across test modules.""" import queue import tempfile import threading import types from pathlib import Path def symlinks_available(): """Whether this process may create symlinks. Creating one is a privileged operation on Windows unless Developer Mode is ...
yevgeniyglider/HebrewScribe
tests/helpers.py
.py
acd78ebf83a21739
7.92
6
"""Nox configuration for multi-Python testing.""" import nox PYTHON_VERSIONS = ["3.11", "3.12", "3.13", "3.14"] @nox.session(python=PYTHON_VERSIONS) def tests(session: nox.Session) -> None: """Run the test suite.""" session.install("-e", ".") session.install("pytest", "pytest-asyncio", "hypothesis") ...
craigpnnl/dnp3py
noxfile.py
.py
9031cf42251740f6
7.5
9
"""Object headers and qualifiers per IEEE 1815-2012 Clause 4.2. Object header structure: - Group (1 byte): Object group number - Variation (1 byte): Object variation number - Qualifier (1 byte): Specifies range/index format Qualifier code layout (3-bit prefix + 4-bit range specifier): - Bits 7: Reserved - Bits 6-4: P...
craigpnnl/dnp3py
src/dnp3/application/qualifiers.py
.py
2077037fe5fe30d3
7.5
9
"""CRC-16/DNP implementation per IEEE 1815-2012 Annex E. CRC parameters: - Polynomial: 0x3D65 - Init: 0x0000 - RefIn: True (reflect input bytes) - RefOut: True (reflect output) - XorOut: 0xFFFF - Check: 0x82EA (for "123456789") """ from functools import reduce def _generate_crc_table() -> tuple[int, ...]: """Ge...
craigpnnl/dnp3py
src/dnp3/core/crc.py
.py
a52d727c3ea21217
7.5
9
"""Protocol enumerations per IEEE 1815-2012.""" from enum import IntEnum # Response function codes start at this value _RESPONSE_CODE_MIN = 0x80 class FunctionCode(IntEnum): """Application layer function codes (Clause 4). Request codes: 0x00 - 0x21 Response codes: 0x81 - 0x83 """ # Confirmatio...
craigpnnl/dnp3py
src/dnp3/core/enums.py
.py
e7b67bcb5f783e3f
7.5
9
"""Quality flags and Internal Indications (IIN) per IEEE 1815-2012.""" from enum import IntEnum, IntFlag class BinaryQuality(IntFlag): """Binary point quality flags (Table 4-7). Single byte with quality indicators and state bit. """ ONLINE = 0x01 # Point is online RESTART = 0x02 # Point value...
craigpnnl/dnp3py
src/dnp3/core/flags.py
.py
932cd51d760867d1
7.5
9
"""DNP3 timestamp handling per IEEE 1815-2012. DNP3 uses 48-bit (6 byte) timestamps representing milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). """ from dataclasses import dataclass from datetime import UTC, datetime # Milliseconds per second _MS_PER_SECOND = 1000 # Size of DNP3 timestamp in bytes (48...
craigpnnl/dnp3py
src/dnp3/core/timestamp.py
.py
6631757b9bea0334
7.5
9
"""Data Link Control Byte per IEEE 1815-2012 Clause 9.2.4. Control byte bit layout: - Bit 7: DIR (direction: 1=from master, 0=from outstation) - Bit 6: PRM (primary: 1=primary message, 0=secondary message) - Bit 5: FCB (frame count bit) - Bit 4: FCV (frame count valid) - Bits 3-0: Function code """ from dataclasses i...
craigpnnl/dnp3py
src/dnp3/datalink/control.py
.py
ab5de1af932ae2d8
7.5
9
"""Data Link Frame format per IEEE 1815-2012 Clause 9. Frame structure: - Start bytes: 0x05 0x64 (2 bytes) - Length: 1 byte (user data length + 5) - Control: 1 byte - Destination: 2 bytes (little-endian) - Source: 2 bytes (little-endian) - Header CRC: 2 bytes - Data blocks: 16 bytes each with 2-byte CRC (last block ma...
craigpnnl/dnp3py
src/dnp3/datalink/frame.py
.py
f15197a88b83e16f
7.5
9
"""Stateful byte stream parser for data link frames. The parser handles: - Hunting for start bytes (0x05 0x64) - Buffering partial frames - CRC validation - Recovery from corrupted frames """ from collections.abc import Iterator from enum import Enum, auto from dnp3.core.crc import compute_crc from dnp3.datalink.fra...
craigpnnl/dnp3py
src/dnp3/datalink/parser.py
.py
88f6a6849c1bd119
7.5
9
"""Master station configuration per IEEE 1815-2012. Configuration options for DNP3 master behavior, timeouts, and polling settings. """ from dataclasses import dataclass, field # DNP3 address limits (IEEE 1815-2012) MAX_MASTER_ADDRESS = 65519 # 0xFFEF - addresses 0xFFF0-0xFFFF reserved MAX_OUTSTATION_ADDRESS = 6553...
craigpnnl/dnp3py
src/dnp3/master/config.py
.py
26c7d8d5cde707bc
7.5
9
"""Polling operations for DNP3 master. Provides classes for building and scheduling poll requests including integrity polls, class polls, and range polls. """ import time from abc import ABC, abstractmethod from dataclasses import dataclass, field from enum import Enum, auto from dnp3.application.builder import ( ...
craigpnnl/dnp3py
src/dnp3/master/polling.py
.py
e4a2ed71919281fc
7.5
9
"""Master state machine per IEEE 1815-2012. Tracks master state including sequence numbers, pending tasks, and communication state. """ import time from dataclasses import dataclass, field from enum import Enum, auto from typing import Any class MasterState(Enum): """High-level master states.""" IDLE = aut...
craigpnnl/dnp3py
src/dnp3/master/state.py
.py
02f5150001c258f0
7.5
9
"""CLI entry point: python -m dnp3.mesa""" from __future__ import annotations import argparse import asyncio from importlib.resources import as_file, files from importlib.resources.abc import Traversable from pathlib import Path from dnp3.mesa.outstation import MesaOutstation, create_mesa_outstation #: The package ...
craigpnnl/dnp3py
src/dnp3/mesa/__main__.py
.py
ae8a184f7440c051
7.5
9
"""MESA Analog Output store for DNP3 point management.""" from __future__ import annotations from dataclasses import dataclass, replace __all__ = ["AnalogOutputStore", "AnalogOutputValue"] @dataclass(frozen=True) class AnalogOutputValue: """Immutable representation of a MESA analog output point.""" index:...
craigpnnl/dnp3py
src/dnp3/mesa/ao_store.py
.py
9a7f6b05625ffc04
7.5
9
"""MESA entity model. Groups profile equipment points into logical entities (meters, DERs, inverters, batteries). Under the PICS profile format each equipment instance is an explicit struct in the ``BI``/``AO``/``AI`` sections (``BinaryInputs.equipment`` etc.), so an entity is the union of one instance's points across...
craigpnnl/dnp3py
src/dnp3/mesa/entities.py
.py
767a758d88936be4
7.5
9
"""MESA IEEE 1815.2 outstation factory and runner. Provides a factory function to create a fully wired MESA outstation from a profile JSON file, and a dataclass to hold all the components. """ from __future__ import annotations import logging from dataclasses import dataclass, field from pathlib import Path from dn...
craigpnnl/dnp3py
src/dnp3/mesa/outstation.py
.py
88071c17fed94b47
7.5
9
"""Engineering-to-transmission value scaling for the MESA PICS profile. The DNP3 wire carries the transmission integer, never the engineering float. A point's ``multiplier`` and ``offset`` are profile metadata and are never transmitted; they define the affine map between the two representations: engineering = tra...
craigpnnl/dnp3py
src/dnp3/mesa/scaling.py
.py
6ea23f1a7da90713
7.5
9
"""Base classes for DNP3 objects per IEEE 1815-2012. DNP3 objects are identified by group and variation numbers: - Group: Defines the type of data (binary input, analog output, etc.) - Variation: Defines the format/encoding of the data Object categories: - Static: Current point values (e.g., g1v1 Binary Input packed ...
craigpnnl/dnp3py
src/dnp3/objects/base.py
.py
fbe9cd5fbb25a580
7.5
9
"""Binary Output objects per IEEE 1815-2012. Group 10: Binary Output Status - Variation 1: Packed format (1 bit per point) - Variation 2: With flags (1 byte per point) Group 11: Binary Output Event - Variation 1: Without time (1 byte flags) - Variation 2: With time (7 bytes: flags + 6-byte timestamp) Group 12: Contr...
craigpnnl/dnp3py
src/dnp3/objects/binary_output.py
.py
65afd3c27d537b7d
7.5
9
import os import sys import torch from transformers import AutoModelForCausalLM, AutoTokenizer from typing import Optional, Dict, Any import logging # Add project root to path for imports project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) if project_root not in sys.path: sys.path.insert(...
Roblox/FAI-RL
core/model_utils.py
.py
a92f55234c936a66
7.54
11
""" GSM8K (Grade School Math 8K) dataset evaluation utilities. """ import re from typing import Optional, List FINAL_ANSWER_DELIMITERS = [ r"####", # Standard GSM8K delimiter r"ANSWER IS", # Variations like: The answer is 42 r"FINAL ANSWER", # Explicit final answer marker ]...
Roblox/FAI-RL
evaluations/eval_datasets/gsm8k.py
.py
e4d9c8a7a4976ae6
7.54
11
"""Contract tests for the shipped DeepSpeed configs. These lock down the two ZeRO-3 variants the ml-platform recipe builder points VLM LoRA at: * ``zero3_config.json`` — ZeRO-3 **with** CPU offload of params + optimizer state (the low-VRAM escape hatch). * ``zero3_auto_config.json`` — ZeRO-3 with **no** CPU offload...
Roblox/FAI-RL
tests/test_deepspeed_configs.py
.py
b2d68e72d002e203
8.04
11
"""Tests for ZeRO-3 partitioned-load activation in BaseTrainer. The crux of the fix is that ``from_pretrained`` must see ``is_deepspeed_zero3_enabled()`` == True so it loads the model sharded per rank instead of fully on every rank (which OOMs the host on large models). That end-to-end behavior requires a GPU + deepsp...
Roblox/FAI-RL
tests/test_deepspeed_zero3_init.py
.py
3925cbcb49d98cf4
8.04
11
import os, sys from datasets import load_dataset, concatenate_datasets from trl import SFTConfig, SFTTrainer as TRLSFTTrainer from transformers import AutoModelForCausalLM from peft import TaskType from typing import Optional project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) if project_root...
Roblox/FAI-RL
trainers/cpt_trainer.py
.py
536659eccf00ede3
7.54
11
import os, sys import torch import wandb from datasets import load_dataset, concatenate_datasets, Dataset from trl import DPOConfig, DPOTrainer as TRLDPOTrainer from transformers import AutoModelForCausalLM, AutoTokenizer from peft import TaskType from typing import Optional, List project_root = os.path.abspath(os.pat...
Roblox/FAI-RL
trainers/dpo_trainer.py
.py
ba0623901e3c827d
7.54
11
from typing import List import logging from . import reward_function def extract_answer(completion, logger=None) -> str: """Extracts the answer from XML-formatted text.""" try: # Handle case where completion is a list (e.g., list of tokens or candidates) if isinstance(completion, list): ...
Roblox/FAI-RL
trainers/rewards/accuracy_rewards.py
.py
fd46928bd00edd85
7.54
11
from typing import List import logging from . import reward_function @reward_function def structured_xml_reward_func(completions: List[str], **kwargs) -> List[float]: """Calculates reward based on XML tag counts.""" return [count_xml(c) for c in completions] def count_xml(text) -> float: """Counts XML ta...
Roblox/FAI-RL
trainers/rewards/format_rewards.py
.py
f72c8ca8b965d3ed
7.54
11
"""GSM8K dataset formatting template.""" SYSTEM_PROMPT = """ Respond in the following format: <think> ... </think> <answer> ... </answer> """ XML_COT_FORMAT = """\ <think> {thinking} </think> <answer> {answer} </answer> """ class GSM8KTemplate: """Template for formatting GSM8K math dataset examples.""" ...
Roblox/FAI-RL
trainers/templates/gsm8k_template.py
.py
404e33b6e1870a47
7.54
11
"""OpenMathInstruct dataset formatting template.""" SYSTEM_PROMPT = """ Respond in the following format: <think> ... </think> <answer> ... </answer> """ XML_COT_FORMAT = """\ <think> {thinking} </think> <answer> {answer} </answer> """ class OpenMathInstructTemplate: """Template for formatting OpenMathInstruct ...
Roblox/FAI-RL
trainers/templates/openmathinstruct_template.py
.py
034f69f3fa6a2759
7.54
11
import argparse import datetime import time import sys import os import subprocess import yaml import warnings from typing import Dict, Optional # Suppress Pydantic warnings from dependencies (TRL/transformers) warnings.filterwarnings("ignore", category=UserWarning, module="pydantic._internal._generate_schema") warnin...
Roblox/FAI-RL
trainers/train.py
.py
83fc6ce71959d287
7.54
11
"""Video-aware data collator for vision-language SFT. TRL's :class:`~trl.trainer.sft_trainer.DataCollatorForVisionLanguageModeling` only ever passes ``images=`` to the processor -- it has no notion of video. VLM processors (e.g. ``Qwen2_5_VLProcessor``, ``Gemma4Processor``) accept a ``videos=`` argument that yields ``...
Roblox/FAI-RL
trainers/vlm_collator.py
.py
245495e9216912fb
7.54
11
"""Dataset utilities for handling different dataset types and templates.""" import ast import os from typing import Any, Iterable, Optional, Sequence _LOCAL_FILE_FORMATS = { ".jsonl": "json", ".json": "json", ".csv": "csv", ".parquet": "parquet", } DEFAULT_CHOICE_LABELS = ["A", "B", "C", "D", "E", "...
Roblox/FAI-RL
utils/dataset_utils.py
.py
4112bbd1c4ac8525
7.54
11
""" Device detection utilities for cross-platform support (CUDA, MPS, CPU). This module provides utilities for detecting and managing compute devices across different platforms including: - CUDA (NVIDIA GPUs on Linux/Windows) - MPS (Apple Silicon on macOS) - CPU (fallback for all platforms) """ import importlib.util ...
Roblox/FAI-RL
utils/device_utils.py
.py
7668121d782f6ac9
7.54
11
"""Image loading utilities for multimodal (vision-language) training. The headline use case is fetching images from HTTP(S) URLs carried in a dataset column and turning them into PIL images that a VLM processor can consume. Local file paths, raw bytes, and already-decoded PIL images are also accepted so the same helpe...
Roblox/FAI-RL
utils/image_utils.py
.py
732226440187533a
7.54
11
import logging import os import sys from datetime import datetime from pathlib import Path def get_package_version() -> str: """Return the installed FAI-RL package version. Reads the version from the installed distribution metadata, which reflects the actual wheel that was installed (the real source of t...
Roblox/FAI-RL
utils/logging_utils.py
.py
64846ba1d5685306
7.54
11
"""Helpers shared by multimodal inference inputs.""" from typing import Any, Iterable import pandas as pd def _is_missing_media_source(value: Any) -> bool: """Return whether a dataset cell contains no media source.""" if value is None: return True if isinstance(value, str): return not va...
Roblox/FAI-RL
utils/media_utils.py
.py
c18ca3245eb807c6
7.54
11
""" Utility functions for handling recipe overrides from command line. """ import ast import yaml from typing import Any, Dict from utils.logging_utils import setup_logging # Module-level logger. setup_logging() attaches a RankFilter, so INFO/DEBUG # records are automatically dropped on non-rank-0 workers; WARNING+ ...
Roblox/FAI-RL
utils/recipe_overrides.py
.py
8897da5b1bf87fde
7.54
11
import os import shlex import shutil import subprocess import threading from pathlib import Path from typing import Optional from transformers import TrainerCallback, TrainerState, TrainerControl, TrainingArguments from utils.logging_utils import setup_logging # Configure the logger so messages actually appear. The ...
Roblox/FAI-RL
utils/s3_utils.py
.py
f2611d5c327a79f2
7.54
11
""" Adjacency Gate — validates that parts that should be near each other ARE. Catches scattered/misplaced components by checking that every part of type A has a part of type B within a specified distance. Usage: from cadclaw.adjacency import AdjacencyCheck, AdjacencyRule rules = [AdjacencyRule('motor', 'brack...
sunnyday-technologies/CADCLAW
cadclaw/adjacency.py
.py
004bf73c5c8829c5
7.63
17
""" BOM JSON loader + privacy-aware serializer. The BOM is the public source of truth for procurement. CADCLAW reads it but never echoes private fields (vendor pricing, internal SKUs, customer order ids) back to the user, even by accident in a finding's `evidence` block. Privacy is enforced at the **serializer**, not...
sunnyday-technologies/CADCLAW
cadclaw/bom_loader.py
.py
d5c2628f2905ae77
7.63
17
""" Claim-audit — text linter for README, docs, and BOM `notes` fields. Three rule passes: 1. Forbidden absolutes — case-insensitive substring match against a default list ("production-ready", "guaranteed", etc.). Severity: fail. 2. Numeric claims requiring evidence tags — regex; if a line matches a patt...
sunnyday-technologies/CADCLAW
cadclaw/claim_audit.py
.py
caa37c1981e51435
7.63
17
""" Findings model — the unified Severity / Finding / Report dataclasses every v0.6 gate emits. This is intentionally stdlib-only (no pydantic) so existing v0.5 callers can import `Finding` without paying for the rule-file dependency. Pydantic models in `cadclaw/rules.py` validate config; this module is what gates pro...
sunnyday-technologies/CADCLAW
cadclaw/findings.py
.py
8333478ed1bb6491
7.63
17
""" Floating-part Gate — flag parts that aren't adjacent to any structural part. v0.9 gate #3. Closes the M3-CRETE V1.0 manual fix #2 ("removed an idler + idler block floating in the center"). Inventory + interference checks both passed for the floating idler — its bbox signature was correct and it wasn't clipping any...
sunnyday-technologies/CADCLAW
cadclaw/floating.py
.py
a7b7d0390829c78b
7.63
17
"""Reusable helpers for importing authored geometry from a reference STEP. Motivating use case: when a CADQuery-driven assembly script needs a complex authored part (e.g. a gusset with a custom polygon profile and a dense bolt pattern), it is almost always better to **clone the real shape from an authoritative STEP** ...
sunnyday-technologies/CADCLAW
cadclaw/geometry_import.py
.py
b3a6e86689e95a11
7.63
17
""" Inspect — diagnostic queries against a STEP assembly. Four pure functions, each replacing a class of throwaway probe script that field users (humans + AI agents) keep rewriting: - `histogram_signatures` — bbox-signature counts. ("what's in this STEP?") - `describe_parts` — filter parts by location, signat...
sunnyday-technologies/CADCLAW
cadclaw/inspect.py
.py
8de6d2ecc3f387d6
8.13
17
""" Inventory Gate — validates part counts by bounding-box signature. Every part in a STEP assembly has a unique bbox "fingerprint" (sorted dimensions rounded to 0.1mm). This module labels parts by signature, counts them, and compares against an expected inventory. Per-region inventory (v0.6 extension): pass `regions...
sunnyday-technologies/CADCLAW
cadclaw/inventory.py
.py
c66f2a5d5c23c71b
7.63
17
""" Orientation Gate — verifies the largest bbox face of each labeled part lies in the plane its label expects. v0.9 gate #1. Closes 4 of 6 manual fixes from the M3-CRETE 2026-04-29 V1.0 session: misoriented idlers and idler-block connectors that the inventory check accepted because the bbox SIGNATURE (sorted-tuple) m...
sunnyday-technologies/CADCLAW
cadclaw/orientation.py
.py
1e699a53b188fa97
7.63
17
""" STEP-to-STEP parity check — compare two STEP files by dim-signature inventory to surface divergences between (for example) a native CAD export and a scripted regeneration of the same design. Motivating bug: hidden or suppressed parts during STEP export. Hiding a part in the native CAD assembly tree and re-exportin...
sunnyday-technologies/CADCLAW
cadclaw/parity.py
.py
f6d33d5ca866b4c4
7.63
17
""" Rule file loader — pydantic v2 models + `load_rules(path)` for cadclaw.yaml. The rule file is the single source of project-specific configuration: bbox labels, expected inventory, regions, BOM rules, claim-audit rules, publish-audit globs, and the confidence budget. Every section is optional; missing sections skip...
sunnyday-technologies/CADCLAW
cadclaw/rules.py
.py
eb8133aceb8bbdd2
7.63
17
""" Compatibility shim: `cadharness` was renamed to `cadclaw` in v0.8.0. This module exists so code written against v0.7 and earlier (`from cadharness.bom_audit import run_bom_audit`, `import cadharness`, etc.) keeps working with a one-time DeprecationWarning. New code should `import cadclaw` directly. Mechanism: eve...
sunnyday-technologies/CADCLAW
cadharness/__init__.py
.py
74b719910040fedc
7.63
17
"""Continual-learning training methods (composable with any LoRA init). Public entry points: - REGISTRY: name -> CLMethod class - build_cl_method(name, **kwargs): factory used by orchestrator/train. """ from __future__ import annotations from typing import Any, Dict, Type from .base import CLMethod from .inflora...
RamiroNB/slice
cl_lora/cl_methods/__init__.py
.py
8f4be9b44f01f026
7.54
11
"""Continual-learning method interface. A CL method composes with any LoRA initialization (vanilla, lora_ga, loram, slice). The init step writes the initial A/B; the CL method then runs four hooks during the per-stage training pipeline: cl_method.before_init(lora_model, ...) # install accumulated state pre-probe...
RamiroNB/slice
cl_lora/cl_methods/base.py
.py
a7b6f30d9ca79968
7.54
11
"""O-LoRA: orthogonality regularizer between current and previous LoRA bases. Wang et al., "Orthogonal Subspace Learning for Language Model Continual Learning" (EMNLP Findings 2023, arXiv:2310.14152). At task t, the trainable LoRA matrices A_t (one per target module) are kept orthogonal to the row-spaces spanned by a...
RamiroNB/slice
cl_lora/cl_methods/o_lora.py
.py
2e8c0fc062f31677
7.54
11
"""Tokenization and collation for causal-LM fine-tuning. Single source of truth for how a (prompt, target) pair becomes (input_ids, attention_mask, labels). Shared by the trainer, the perplexity eval, the SLICE gradient probe and the CL methods so that the loss the probe measures is exactly the loss training optimizes...
RamiroNB/slice
cl_lora/data.py
.py
6f287a45762c5da1
7.54
11
from __future__ import annotations import math from typing import Dict import torch def build_ab_from_gradient( G: torch.Tensor, r: int, weight_var: float, svd_selection: str = "lora_ga", ) -> Dict[str, torch.Tensor]: """Decompose a gradient matrix into LoRA A/B via low-rank SVD. svd_select...
RamiroNB/slice
cl_lora/slice/decompose.py
.py
827079281f212edc
7.54
11
from __future__ import annotations import logging from typing import Any, Dict, Optional, Tuple import torch from torch.utils.data import DataLoader logger = logging.getLogger("cl_lora.slice.gradients") def accumulate_gradients( model: torch.nn.Module, dataloader: DataLoader, target_params: Dict[str, t...
RamiroNB/slice
cl_lora/slice/gradients.py
.py
2e5b29ca10697a88
7.54
11
"""Advanced gradient-surgery projection methods. Implements ideas A.1 (PCGrad_c), A.2 (GradVac), A.3 (cosine threshold), A.4 (per-layer threshold), A.5 (null-space), A.6 (magnitude preserving) from ideas_for_new_methods.md. Kept on the same device as input gradients to avoid CPU offload of large tensors. Global mode:...
RamiroNB/slice
cl_lora/slice/projections.py
.py
df654ea7218ee009
7.54
11
"""The searched blob is stored lowercased. Ranking is its only reader, and lowercasing it per query meant re-lowering the entire corpus on every keystroke of a live filter: measured at over half of all ranking time. """ import os import tempfile import unittest from load_agsearch import load_agsearch def _message_...
devcodes9/agsearch
tests/test_index_case.py
.py
e84bc674c71ac73e
7.95
7
"""Cold-build progress line. Several seconds of silence on first run reads as "hung". The line that fixes that has to be careful about where it writes: warm runs must stay silent, and anything piped (`agsearch -n "q" | ...`, the fzf preview subprocess) must not receive escape codes. """ import io import unittest fro...
devcodes9/agsearch
tests/test_index_progress.py
.py
b34d90e40c909149
7.95
7
"""Prefix matching exists to undo stemming, so it should only apply where stemming happened. Applying it everywhere means `pr` matches `print`, `previously`, `prisma`, which is most of a transcript. The word you typed unchanged is the word you meant. """ import unittest from load_agsearch import load_agsearch clas...
devcodes9/agsearch
tests/test_match_precision.py
.py
2430ce47ea60c7ae
7.95
7
"""Packaging metadata must not drift from the CLI. PyPI uploads are irreversible — a file published under the wrong version can be yanked but never replaced — so the cheapest place to catch a mismatch is here, on every PR. """ import pathlib import re import unittest from load_agsearch import load_agsearch ROOT = p...
devcodes9/agsearch
tests/test_packaging.py
.py
431f6b2b83d2fdec
7.95
7
import re import unittest from load_agsearch import load_agsearch ANSI = re.compile(r"\033\[[0-9;]*m") def strip(s): return ANSI.sub("", s) def row(role, text, seq, date="2026-08-19T00:00:00", title=""): # TSV columns: 0 sid 1 cwd 2 branch 3 date 4 role 5 seq 6 title 7 text return ["sid", "/repo", "ma...
devcodes9/agsearch
tests/test_preview_render.py
.py
9824b2acc23e3a85
7.95
7
"""The transcript reader: read a session without resuming it. The point of ctrl-o is to answer "is this the session I meant?" without paying a CLI start, a context load, and a session you then have to leave. So the two properties that matter are that it shows the *whole* conversation (the preview card deliberately sho...
devcodes9/agsearch
tests/test_transcript.py
.py
58812a5e3bfc8c23
7.95
7
"""The version literal is the anchor every packaging channel reads. Homebrew, PyPI and the installer all need to agree on one string. These tests pin the two properties that keep them from drifting: the literal is a real release version, and it can be read out of the file by a regex without importing agsearch (which i...
devcodes9/agsearch
tests/test_version.py
.py
ae8619e5d97b1735
7.95
7
"""Short query terms must not match inside longer words. `pr` is a substring of 700 of 718 local sessions but a word in only 182, because it hides in `approach`, `improve`, `compress`. Counting those as hits collapses the term's idf and makes the coverage tiebreaker meaningless, so the term the query was actually abou...
devcodes9/agsearch
tests/test_word_boundary.py
.py
70d69b698c5e5874
7.95
7
"""Config flow for Inkbird Irrigation.""" from __future__ import annotations import logging from typing import Any import voluptuous as vol from homeassistant.config_entries import ConfigFlow from homeassistant.data_entry_flow import FlowResult from .api import InkbirdAPI from .const import ( CONF_CLOUD_API_KE...
ac-uy/ha-inkbird-irrigation
custom_components/inkbird_irrigation/config_flow.py
.py
932db013265ddf80
7.45
7
"""Transport-aware DataUpdateCoordinator for Inkbird Irrigation.""" from __future__ import annotations import asyncio import logging import time from contextlib import suppress from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers.update_coordina...
ac-uy/ha-inkbird-irrigation
custom_components/inkbird_irrigation/coordinator.py
.py
801981c1395c5199
7.45
7
"""Base entity for Inkbird Irrigation.""" from __future__ import annotations from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import DOMAIN from .coordinator import I...
ac-uy/ha-inkbird-irrigation
custom_components/inkbird_irrigation/entity.py
.py
b446d044101019ec
7.45
7
"""Number platform for Inkbird Irrigation — zone duration settings.""" from __future__ import annotations from homeassistant.components.number import NumberDeviceClass, NumberEntity, NumberMode from homeassistant.config_entries import ConfigEntry from homeassistant.const import UnitOfTime from homeassistant.core impo...
ac-uy/ha-inkbird-irrigation
custom_components/inkbird_irrigation/number.py
.py
6817ca5f2f17abfc
7.45
7
"""Connection preference selector for Inkbird Irrigation.""" from __future__ import annotations from homeassistant.components.select import SelectEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import EntityCategory from homeassistant.core import HomeAssistant from homeassistant.e...
ac-uy/ha-inkbird-irrigation
custom_components/inkbird_irrigation/select.py
.py
0f9cc781e3a73e15
7.45
7
#!/usr/bin/env python3 """Render the README capability contract from the checked-in registry. Usage: python scripts/gen_capability_docs.py python scripts/gen_capability_docs.py --check """ from __future__ import annotations import argparse import sys from pathlib import Path REPO_ROOT = Path(__file__).resol...
mattpainter701/kicad_automations
scripts/gen_capability_docs.py
.py
bbc051f3667285da
7.63
17
#!/usr/bin/env python3 """Generate docs/templates.md from the subcircuit template registry.""" from __future__ import annotations import sys from pathlib import Path # Ensure the package is importable sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "src")) from circuit_weaver.subcircuits.base import...
mattpainter701/kicad_automations
scripts/gen_template_docs.py
.py
b5f8530c96b57c69
7.63
17
"""One-shot migration (Sprint 41 Task 178): push every entry in every legacy `*_IC_DATABASE` dict in `src/circuit_weaver/subcircuits/` into the canonical `ic_data/*.json` store, tagged with the correct `topology` so each template's `merge_into_legacy_db()` merged view picks it up. Rules: - Hardcoded is the source of t...
mattpainter701/kicad_automations
scripts/migrate_hardcoded_ics_to_json.py
.py
f4fa4920e375cd7b
7.63
17