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
""" This module file holds merely one function that is being utilized in some of the integration tests that are run against the XmlValidator library. """ import csv import os def _matches_expected_value(actual_value, expected_value) -> bool: """ Checks whether an actual value satisfies an expected test va...
MichaelHallik/robotframework-xmlvalidator
test/integration/validation_keywords.py
.py
ac592bb1947cebc9
7.92
6
#!/usr/bin/env python3 """Compare torchfits public exports to docs/api.md quick-path mentions.""" from __future__ import annotations import re import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[4] def load_all_from_init() -> set[str]: init = ROOT / "src" / "torchfits" / "__init__.py" ...
astroai/torchfits
.cursor/skills/release-api-freeze-review/scripts/inventory_public_api.py
.py
afc96816737a49ea
7.42
6
""" Cache performance benchmarks for torchfits. This module provides focused benchmarks for cache system performance, including environment detection, configuration optimization, and cache operations. """ # Add benchmarks and src to path for imports import sys import time from pathlib import Path from typing import A...
astroai/torchfits
benchmarks/bench_cache.py
.py
47378aa7fa4fefc8
7.42
6
"""Shared fixture discovery for the CFHT MegaCam benchmark suites.""" from __future__ import annotations import re from pathlib import Path CADC_CFHT_DIRECT_BASE = "https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/data/pub/CFHT" _FITS_RE = re.compile(r"\.fits(\.fz|\.gz)?$", re.I) def discover_fits_names(data_dir: Pat...
astroai/torchfits
benchmarks/bench_fixtures.py
.py
344c44f7014ad644
7.42
6
""" GPU Memory Usage Validation Benchmark Tests GPU memory efficiency and validates direct GPU loading capabilities. """ import gc import os import sys import tempfile from pathlib import Path import numpy as np import torch # Add src to path sys.path.insert(0, str(Path(__file__).parent.parent / "src")) try: i...
astroai/torchfits
benchmarks/bench_gpu_memory.py
.py
fa994f449b1f8a72
7.42
6
"""Shared wall-clock timers with optional peak RSS / CUDA alloc samples.""" from __future__ import annotations import gc import threading import time from typing import Any, Callable import numpy as np try: import psutil _PROC = psutil.Process() except Exception: # pragma: no cover - optional in minimal e...
astroai/torchfits
benchmarks/bench_timing.py
.py
bfefac2afefd1a8e
7.42
6
"""Download and cache public FITS samples for gallery examples.""" from __future__ import annotations import os import urllib.error import urllib.request from pathlib import Path from urllib.parse import urlsplit def _default_sample_cache() -> Path: override = os.environ.get("TORCHFITS_SAMPLE_CACHE", "").strip(...
astroai/torchfits
examples/_sample_data.py
.py
f45b5f8f21bb5501
7.42
6
"""Example: torchfits.data table and cutout datasets.""" from __future__ import annotations import os import tempfile import numpy as np from astropy.io import fits from astropy.table import Table from torchfits.data import ( FitsCutoutDataset, FitsTableDataset, FitsTableIterableDataset, make_loader...
astroai/torchfits
examples/example_data_catalogs.py
.py
a3946d3e61e2a568
7.42
6
""" Example: read and write FITS images with torchfits. """ import os import sys import tempfile from pathlib import Path import numpy as np import torch from astropy.io import fits ROOT = Path(__file__).resolve().parents[1] if str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT)) from examples._sample_data ...
astroai/torchfits
examples/example_image.py
.py
4404a91f21f7ee26
7.42
6
""" Example: extract image cutouts with read_subset, CFITSIO strings, and open_subset_reader for repeated reads. """ import os import tempfile import numpy as np import torch from astropy.io import fits import torchfits def _create_test_file(path: str) -> None: data = np.arange(1024, dtype=np.float32).reshape(...
astroai/torchfits
examples/example_image_cutouts.py
.py
87ccd3e41ae264e0
7.42
6
"""Example: FitsImageDataset + make_loader. Prefer ``read_tensor`` for a single file. Use a Dataset when you need many files as a PyTorch Dataset (shuffle, workers, epochs). ``make_loader`` is DataLoader with torchfits cache warm-up defaults — not a separate API. """ from __future__ import annotations import os impo...
astroai/torchfits
examples/example_image_dataset.py
.py
70815d58425dcafa
7.42
6
""" Example: multi-extension FITS (MEF) files with torchfits.open and read_hdus. """ import os import tempfile import numpy as np from astropy.io import fits from astropy.table import Table import torchfits def _create_test_file(path: str) -> None: primary = fits.PrimaryHDU() sci = fits.ImageHDU(np.arange(...
astroai/torchfits
examples/example_image_mef.py
.py
4843700befd19136
7.42
6
"""Example: Lupton+ (2004) asinh RGB from reprojected SDSS g/r/i cutouts. The function signature is ``lupton_rgb(r, g, b)``. Astropy convention maps the reddest band (i) to the R channel, so we pass ``r=i, g=r, b=g``. The sample images ship ``.fits.bz2``; CFITSIO doesn't decompress bzip2, so this example inflates them...
astroai/torchfits
examples/example_lupton_rgb_sdss.py
.py
5c2763c461000aff
7.42
6
""" Example: Polars integration via torchfits.table.to_polars, read_polars, and scan_polars. """ import os import tempfile import time import numpy as np from astropy.table import Table import torchfits def _create_catalog(path: str, n_rows: int = 50_000) -> None: table = Table( { "id": np....
astroai/torchfits
examples/example_polars.py
.py
2247d545eb19d406
7.42
6
# Note: initially copied from https://github.com/florimondmanca/httpx-sse/blob/master/src/httpx_sse/_decoders.py from __future__ import annotations import json import inspect from types import TracebackType from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, Optional, AsyncIterator, cast from typing_ext...
kernel/kernel-python-sdk
src/kernel/_streaming.py
.py
c238aa0b62316630
7.45
7
from __future__ import annotations from os import PathLike from typing import ( IO, TYPE_CHECKING, Any, Dict, List, Type, Tuple, Union, Mapping, TypeVar, Callable, Iterable, Iterator, Optional, Sequence, AsyncIterable, ) from typing_extensions import ( ...
kernel/kernel-python-sdk
src/kernel/_types.py
.py
51093cce88c2b516
7.45
7
from __future__ import annotations from typing import Any from typing_extensions import override from ._proxy import LazyProxy class ResourcesProxy(LazyProxy[Any]): """A proxy for the `kernel.resources` module. This is used so that we can lazily import `kernel.resources` only when needed *and* so that ...
kernel/kernel-python-sdk
src/kernel/_utils/_resources_proxy.py
.py
63df158b53ec27dd
7.45
7
import json import inspect import functools from typing import Any, Dict, List, TypeVar, Callable, Optional from dataclasses import dataclass T = TypeVar("T") # Context definition @dataclass class KernelContext: """Context object passed to action handlers""" invocation_id: str # Action definition @dataclass ...
kernel/kernel-python-sdk
src/kernel/app_framework.py
.py
4734d44cc294407b
7.45
7
"""ARC-AGI tasks, served from device memory. The prepared dataset is a three-level hierarchy, which is what makes ARC different from a flat dataset:: group -- one ARC task (a rule) puzzle -- one held-out input for that task example -- one augmented view of that puzzle On disk:: all__inputs.np...
rekursiv-ai/priml
priml/baselines/arcagi1/data.py
.py
55252bad77a6d5a4
7.45
7
"""Tests for ARC data loading.""" from __future__ import annotations from pathlib import Path import json from torch import Tensor import numpy as np import pytest import torch from priml.baselines.arcagi1.data import ArcData TASKS = 4 PUZZLES_PER_TASK = 2 VIEWS_PER_PUZZLE = 3 GRID = 12 @pytest.fixture def da...
rekursiv-ai/priml
priml/baselines/arcagi1/data_test.py
.py
9c47acff69e9a537
7.95
7
"""The ARC-AGI experiment ladder. Each ARC task shows a few input/output grid pairs demonstrating a rule, then asks for the rule applied to a held-out input. Nothing about the rule is labelled, so the model must infer it from the examples -- which is why this is a reasoning benchmark rather than a perception one. The...
rekursiv-ai/priml
priml/baselines/arcagi1/experiments.py
.py
df40bc593bbd1b42
7.45
7
"""Tests for the ARC-AGI experiment ladder. Each test asserts the DELTA a fork applies, which is what enforces one change per experiment: a fork that quietly moved a second knob fails here rather than producing a result nobody can attribute. Every test builds configs only -- no data, no device, no training -- so the ...
rekursiv-ai/priml
priml/baselines/arcagi1/experiments_test.py
.py
d32941d9788daefb
7.95
7
"""pass@K voting over a puzzle's augmented views. Each ARC puzzle is evaluated many times -- once per augmented view -- and the model may answer differently on each. The score is the consensus: group every prediction for one puzzle, rank the distinct answers, and count the puzzle solved if the true grid is among the t...
rekursiv-ai/priml
priml/baselines/arcagi1/metric.py
.py
e88d386c4bba7435
7.45
7
"""CIFAR-10 loading, served entirely from device memory. The whole dataset is 50000 32x32 RGB images -- about 180 MB in float32 -- so it fits in the memory of any device that can train on it. Holding it resident and slicing batches with an index permutation removes the host-to-device copy and the worker processes a ge...
rekursiv-ai/priml
priml/baselines/cifar10/data.py
.py
d9dd47413890b39e
7.45
7
"""Tests for CIFAR-10 loading and preparation.""" from __future__ import annotations from pathlib import Path import numpy as np import pytest import torch import torchvision.datasets from priml.baselines.cifar10.data import Cifar10Data, prepare def tiny_dataset(directory: Path, *, count: int = 8) -> Cifar10Data....
rekursiv-ai/priml
priml/baselines/cifar10/data_test.py
.py
433a46a60933a364
7.95
7
r"""CIFAR-10 experiments. ``exp000`` is the baseline: the strongest recipe that uses nothing exotic -- a residual network, AdamW, cosine decay, random crops and flips. Every later experiment forks a named parent and applies ONE change, stating its hypothesis and source, so the chain reads as an argument rather than a ...
rekursiv-ai/priml
priml/baselines/cifar10/experiments.py
.py
807dc7a93f8c6d87
7.45
7
"""Tests for the CIFAR-10 experiment configs. Two kinds of assertion, and the distinction matters: * The fields ``exp000`` pins are checked by value. It is the control every fork is measured against, so a change to it invalidates published results; the test exists to make that change deliberate rather than incide...
rekursiv-ai/priml
priml/baselines/cifar10/experiments_test.py
.py
c6c4ee7c7fac7326
7.95
7
#!/bin/sh # ruff: noqa: EXE003, D300 -- Polyglot shell/Python script. # fmt: off '''' 2>/dev/null # exec uv --quiet --project "$(dirname "$0")" run --frozen --no-sync python3 "$0" "$@" Download CIFAR-10 and cache it as normalized tensors. Run once before the first experiment. Idempotent: a split already present is lef...
rekursiv-ai/priml
priml/baselines/cifar10/scripts/prepare_data.py
.py
8b0adee27eff7ef4
7.45
7
"""Tests for the CIFAR-10 preparation CLI.""" from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING from priml.baselines.cifar10.scripts import prepare_data if TYPE_CHECKING: import pytest def test_default_directory_matches_the_loop_resolution() -> None: """The prep...
rekursiv-ai/priml
priml/baselines/cifar10/scripts/prepare_data_test.py
.py
1284ec8b3faa7737
7.95
7
"""Training step for the CIFAR-10 baseline. Owns the model, its optimizers, the learning-rate schedule, and the augmentation policy. Augmentation lives here rather than in the input pipeline because it is an experimental variable: an experiment changes crop padding or enables cutout by setting a field, without a secon...
rekursiv-ai/priml
priml/baselines/cifar10/train_step.py
.py
a55e6a406b5b9c7a
7.45
7
"""Tests for the CIFAR-10 training step.""" from __future__ import annotations from collections.abc import Callable from pathlib import Path from types import SimpleNamespace from typing import Any, Literal, cast, override import math from configgle import Makeable, PartialConfig from torch import Tensor, nn impor...
rekursiv-ai/priml
priml/baselines/cifar10/train_step_test.py
.py
f79f021a3fe086cf
7.95
7
"""Shared access to the reference implementation for parity tests. The tests in this directory check the port against the JAX package it was ported from. That package is an optional dependency, so the marker here lets each parity test skip cleanly when it is absent. The reference is only ever read, and only by tests....
rekursiv-ai/priml
priml/baselines/craftax/conftest.py
.py
9a693a109b69dbb1
7.95
7
"""The parity-skip guard must track what the parity tests actually import. ``HAS_CRAFTAX`` decides whether every parity test in this directory runs or skips. Probing the top-level ``craftax`` package answers a weaker question than the tests ask: a half-removed install leaves the package directory in place while its su...
rekursiv-ai/priml
priml/baselines/craftax/conftest_test.py
.py
0df83bedf4a1c8cc
7.95
7
"""The dataset seam for an environment that generates its own data. On-policy learning has no corpus: the next batch is whatever the current policy does next, so there is nothing to load and nothing to shuffle. What the training loop needs from a dataset is a cadence -- something to iterate that says "take another ste...
rekursiv-ai/priml
priml/baselines/craftax/data.py
.py
5552cf7335bf917f
7.45
7
"""Tests for the rollout cadence.""" from __future__ import annotations from typing import cast import pytest import torch from priml.baselines.craftax.data import CraftaxRollouts from priml.data.custom_types import DatasetProtocol from priml.train.custom_types import TrainStepProtocol def _rollouts(**overrides: ...
rekursiv-ai/priml
priml/baselines/craftax/data_test.py
.py
9381fafc6be9c3a9
7.95
7
"""The environment as a learner sees it: reset, step, and auto-restart. Episodes end at different times across the batch, so a worker whose episode just ended is returned to a fresh world on the same step that reports it. The observation handed back alongside a set ``done`` flag is therefore the RESET observation, whi...
rekursiv-ai/priml
priml/baselines/craftax/env.py
.py
eb880a358a29b9a9
7.45
7
"""Transactional evaluation helpers shared by Craftax trainers.""" from __future__ import annotations from collections.abc import Callable, Generator from contextlib import contextmanager from typing import TYPE_CHECKING import copy if TYPE_CHECKING: from torch import nn @contextmanager def evaluation_mode(m...
rekursiv-ai/priml
priml/baselines/craftax/evaluation.py
.py
a80ed257596cfa34
7.45
7
"""Tests for the Craftax experiment configs. Two kinds of assertion, and the distinction matters: * The fields ``exp000`` pins are checked by value. It is the control every fork is measured against, so a change to it invalidates published results; the test exists to make that change deliberate rather than inciden...
rekursiv-ai/priml
priml/baselines/craftax/experiments_test.py
.py
2353c8ee316519dc
7.95
7
"""The late-game actions: potions, spells, enchanting, and levelling up. These are what the deeper floors are for. Potions are the game's hidden variable -- which colour heals and which poisons is shuffled each episode, so the only way to learn the mapping is to drink one and find out. Enchanting spends gems and mana ...
rekursiv-ai/priml
priml/baselines/craftax/game/abilities.py
.py
d1231b15814426cb
7.45
7
"""Fixed properties of the Craftax world. Everything here is a fact about the game rather than a tunable: the block and item vocabularies, which blocks stop movement, how much damage each mob deals on each floor, and what each achievement is worth. They are ``Final`` for that reason -- an experiment that wants differe...
rekursiv-ai/priml
priml/baselines/craftax/game/constants.py
.py
ef5ab6217d107907
7.45
7
"""Tests that the ported constants match the reference tables exactly. The tables are the game's rules. A transcription slip in one of them changes what the environment IS, and would show up only as a slightly wrong score much later, so each is compared elementwise against the reference package. """ from __future__ i...
rekursiv-ai/priml
priml/baselines/craftax/game/constants_test.py
.py
100aa2fb8aaf0256
7.95
7
"""Crafting and block placement. Every recipe is the same shape -- spend some materials, gain a tool or a stock, subject to standing near the right station -- so they are written as a table of :class:`Recipe` rather than as one branch each. That makes the progression legible in one screen: what each tier costs, and wh...
rekursiv-ai/priml
priml/baselines/craftax/game/crafting.py
.py
e5e883e78420e074
7.45
7
"""Batched grid reads and writes with out-of-bounds semantics made explicit. The reference implementation is written in JAX, whose indexing quietly absorbs out-of-range coordinates. PyTorch instead raises, or -- worse -- returns a smaller tensor. The game relies on the quiet behaviour: a creature stepping off the edge...
rekursiv-ai/priml
priml/baselines/craftax/game/indexing.py
.py
da5879bfb6df4ddf
7.45
7
"""Tests for batched grid indexing with explicit out-of-bounds behavior. The reference implementation gets its out-of-bounds behavior from JAX for free; here it is written out, so these tests are what hold the two implementations to the same rule. """ from __future__ import annotations from torch import Tensor impo...
rekursiv-ai/priml
priml/baselines/craftax/game/indexing_test.py
.py
c6635187d23856a4
7.95
7
"""The single interact action: mine, gather, drink, eat, open, or strike. One action covers everything the player can do to the tile they face, and what happens is decided by what is there. Attacking takes precedence: if a creature occupies the tile, the blow lands on it and the block is left alone. Mining is gated o...
rekursiv-ai/priml
priml/baselines/craftax/game/interact.py
.py
88add5b9da2326e3
7.45
7
"""Shared rules the game's actions are built from. These are the pieces used in more than one place: how much a hit lands for, what the player's meters cap at, whether a tile can be stood on, and how a creature is struck. Keeping them here means an action module states what it does rather than restating arithmetic, an...
rekursiv-ai/priml
priml/baselines/craftax/game/mechanics.py
.py
7bca1bd8238d6ee3
7.45
7
"""Creature behaviour: hunting, fleeing, shooting, and spawning. Each creature class acts once per step, one slot at a time, because a slot's decision depends on where the earlier ones just moved -- two creatures must not step onto the same tile. The slot loop is therefore sequential, but every environment inside it i...
rekursiv-ai/priml
priml/baselines/craftax/game/mobs.py
.py
8507d3de57cbb69d
7.45
7
"""Batched Perlin noise, the source of the world's terrain. Terrain is not drawn from independent per-tile randomness -- that would give static, not landscape. Perlin noise assigns a random gradient to each point of a coarse lattice and interpolates between them, so nearby tiles are correlated and the result has conti...
rekursiv-ai/priml
priml/baselines/craftax/game/noise.py
.py
6dba7f17a1a50aba
7.45
7
"""Tests for the batched Perlin terrain noise.""" from __future__ import annotations from torch import Tensor import pytest import torch from priml.baselines.craftax.game.noise import ( _smoothstep, fractal_noise, perlin_noise, ) _DEVICE = torch.device("cpu") def test_fractal_noise_spans_the_unit_in...
rekursiv-ai/priml
priml/baselines/craftax/game/noise_test.py
.py
34546c7917f3e929
7.95
7
#!/usr/bin/env python3 """ Update BPM and KEY metadata for existing MP3 files """ import sys from pathlib import Path import subprocess class MetadataUpdater: def __init__(self): self.camelot_map = { # Major keys (B suffix) 'C major': '8B', 'G major': '9B', 'D major': '10B', 'A ma...
vanguarddesign/rekordbox-spotify-downloader
update_metadata.py
.py
91cf254e42958765
7.56
12
#!/usr/bin/env python3 """ Purpose: Advanced usage example demonstrating direct linter imports and custom workflows Scope: Advanced linting patterns for power users Overview: Demonstrates advanced usage patterns including direct linter imports, custom configuration objects, orchestrator usage, and custom violatio...
be-wise-be-kind/thai-lint
examples/advanced_usage.py
.py
2b537bc3629d2f90
7.62
16
#!/usr/bin/env python3 """ Purpose: CI/CD integration example demonstrating automated linting in pipelines Scope: Continuous integration and automated quality checks Overview: Demonstrates integration of thailint into CI/CD pipelines with proper exit codes, violation reporting, and error handling. Shows how to us...
be-wise-be-kind/thai-lint
examples/ci_integration.py
.py
8477a50ef7e4bd62
7.62
16
#!/usr/bin/env python3 """ Purpose: File header linter usage examples Scope: Demonstrates CLI and library usage for file header validation Overview: Shows multiple ways to use the file header linter including high-level Linter API, direct file_header lint convenience function, and custom configuration. Helps user...
be-wise-be-kind/thai-lint
examples/file_header_usage.py
.py
e9449e6e28690ae2
7.62
16
#!/usr/bin/env python3 """ Purpose: Magic numbers linter usage examples Scope: Demonstrates CLI and library usage for magic numbers detection Overview: Shows multiple ways to use the magic numbers linter including high-level Linter API, direct magic_numbers_lint convenience function, and custom configuration. Hel...
be-wise-be-kind/thai-lint
examples/magic_numbers_usage.py
.py
3fbc651918dd7a7e
7.62
16
#!/usr/bin/env python3 """ Purpose: Nesting depth linter usage examples Scope: Demonstrates CLI and library usage for nesting depth analysis Overview: Shows multiple ways to use the nesting depth linter including high-level Linter API, direct nesting_lint convenience function, and custom depth configuration. Help...
be-wise-be-kind/thai-lint
examples/nesting_usage.py
.py
f568a548d9718750
7.62
16
#!/usr/bin/env python3 """ Purpose: Demonstrates SRP linter usage patterns and integration approaches Scope: Library API examples, configuration options, and CI/CD integration patterns Overview: Working examples showing how to use the SRP linter programmatically through multiple usage patterns. Covers basic usage...
be-wise-be-kind/thai-lint
examples/srp_usage.py
.py
15684bf4b80dd0f3
7.62
16
#!/usr/bin/env python3 """ Purpose: Analyze test coverage overlap to identify duplicate and redundant tests Scope: Queries coverage.py SQLite database to find tests covering identical code Overview: This script analyzes the .coverage database generated by pytest-cov with dynamic context tracking to identify duplica...
be-wise-be-kind/thai-lint
scripts/analyze_test_coverage.py
.py
088d21baa0732936
8.12
16
#!/usr/bin/env python3 """ Purpose: Fast batch removal of redundant tests with periodic validation Scope: Removes tests in batches to minimize coverage validation overhead Overview: This script removes multiple tests at once and validates coverage periodically rather than after each individual test. This is much fa...
be-wise-be-kind/thai-lint
scripts/batch_remove_tests.py
.py
7f034a4e933b3c8f
8.12
16
#!/usr/bin/env python3 """ Purpose: Analyze pip-audit output and block on critical vulnerabilities Scope: Security gate for CI/CD pipelines to prevent vulnerable releases Overview: Parses pip-audit JSON output to identify vulnerabilities in dependencies. Supports configurable ignore patterns for known acceptable vu...
be-wise-be-kind/thai-lint
scripts/check_critical_cves.py
.py
e1359c8a9d095841
7.62
16
#!/usr/bin/env python3 """ Purpose: Remove redundant tests while maintaining coverage within acceptable limits Scope: Automates safe removal of duplicate tests identified by coverage analysis Overview: This script takes a list of redundant tests identified by the coverage analyzer and systematically removes them on...
be-wise-be-kind/thai-lint
scripts/remove_redundant_tests.py
.py
5da4cc52ae5c72f6
8.12
16
""" Purpose: Common Python AST utilities for linter analyzers Scope: Shared AST traversal utilities for Python code analysis Overview: Provides common AST utility functions used across multiple Python linters. Centralizes shared patterns like parent map building to eliminate code duplication. The build_parent...
be-wise-be-kind/thai-lint
src/analyzers/ast_utils.py
.py
896091ce54f0d901
7.62
16
""" Purpose: Base class for Rust AST analysis with tree-sitter parsing Scope: Common tree-sitter initialization, parsing, and traversal utilities for Rust Overview: Provides shared infrastructure for Rust code analysis using tree-sitter parser. Implements common tree-sitter initialization with language setup and ...
be-wise-be-kind/thai-lint
src/analyzers/rust_base.py
.py
fecaa65e11f8bf29
7.62
16
""" Purpose: Base class for TypeScript AST analysis with tree-sitter parsing Scope: Common tree-sitter initialization, parsing, and traversal utilities for TypeScript Overview: Provides shared infrastructure for TypeScript code analysis using tree-sitter parser. Implements common tree-sitter initialization with l...
be-wise-be-kind/thai-lint
src/analyzers/typescript_base.py
.py
0ed73fda32d23686
7.62
16
""" Purpose: High-level Library API providing clean programmatic interface for thailint Scope: Public API for library usage without CLI, supporting configuration and linting operations Overview: Provides high-level Linter class that serves as the primary entry point for using thailint as a library in other Python...
be-wise-be-kind/thai-lint
src/api.py
.py
a49e65deac5c70a0
7.62
16
""" Purpose: Shared utilities for linter CLI commands Scope: Common helper functions and patterns used across all linter command modules Overview: Provides reusable utilities for linter CLI commands including config section management, config value setting with logging, rule ID filtering, CLI context extraction, ...
be-wise-be-kind/thai-lint
src/cli/linters/shared.py
.py
16c9f9d8a370b403
7.62
16
""" Purpose: Main CLI group definition and core setup for thai-lint command-line interface Scope: Core Click group configuration, version handling, global options, and context setup Overview: Defines the root CLI command group using Click framework with version option and global options (verbose, config, project-...
be-wise-be-kind/thai-lint
src/cli/main.py
.py
554b5eb15a4b5de4
7.62
16
""" Purpose: Configuration management for CLI application with YAML/JSON support Scope: Load, validate, save, and merge configuration from multiple sources Overview: Provides comprehensive configuration management including loading from YAML and JSON files, searching multiple default locations, merging configurat...
be-wise-be-kind/thai-lint
src/config.py
.py
a7b1d8f25dd28252
7.62
16
""" Purpose: Shared CLI utilities for common Click command patterns across all linters Scope: CLI command decorators, config loading, and violation output formatting Overview: Provides reusable utilities for CLI commands to eliminate duplication across linter commands (dry, srp, nesting, file-placement). Includes...
be-wise-be-kind/thai-lint
src/core/cli_utils.py
.py
a3b9563d296273de
7.62
16
""" Purpose: Shared YAML/JSON/TOML configuration file parsing utilities Scope: Common parsing logic for configuration files across the project Overview: Provides reusable utilities for parsing YAML, JSON, and TOML configuration files with consistent error handling and format detection. Eliminates duplication betw...
be-wise-be-kind/thai-lint
src/core/config_parser.py
.py
b1a34030f2deec93
7.62
16
""" Purpose: Core constants and enums used across the thai-lint codebase Scope: Centralized definitions for language names, storage modes, config extensions Overview: Provides type-safe enums and constants for consistent stringly-typed patterns across the codebase. Includes Language enum for programming language ...
be-wise-be-kind/thai-lint
src/core/constants.py
.py
ac8f11fa0cf673f7
7.62
16
""" Purpose: Base class for Python-only linters with common boilerplate Scope: Shared infrastructure for Python-only lint rules Overview: Provides PythonOnlyLintRule abstract base class that handles common boilerplate for Python-only linters. Subclasses implement the abstract properties and analysis method wh...
be-wise-be-kind/thai-lint
src/core/python_lint_rule.py
.py
2f2da4a2547bef2a
7.62
16
""" Purpose: Rule registry with automatic plugin discovery and registration Scope: Dynamic rule management and discovery across all linter plugin packages Overview: Implements rule registry that maintains a collection of registered linting rules indexed by rule_id. Provides methods to register individual rules, r...
be-wise-be-kind/thai-lint
src/core/registry.py
.py
c9103c9902e26708
7.62
16
#!/usr/bin/env python3 """Advisory bench-baseline comparison for the CI ``bench`` job (T18). Inputs (CWD-relative, produced by the workflow): - bench-current.json this run's ``cairn bench --save`` payload - bench-baseline.json the ROLLING CI baseline (restored from the actions/cache ent...
tanlnm512/cairn
.github/scripts/bench_compare.py
.py
441d6ed78d95f725
7.48
8
#!/usr/bin/env python3 """Recompute the DS-v2 power-analysis record from its own committed inputs. Reads benchmarks/datasource/ds2/power-analysis.json (schema cairn-ds2-power-analysis/1), re-derives every recorded figure from the committed DS-v1 CI rows using stdlib arithmetic only (Sakai-style topic-set-size design, ...
tanlnm512/cairn
benchmarks/datasource/ds2/recompute_power.py
.py
6bdca3f68a561b7e
7.48
8
# SPDX-License-Identifier: MIT import inspect import platform import sys import threading from collections.abc import Mapping, Sequence # noqa: F401 from typing import _GenericAlias PYPY = platform.python_implementation() == "PyPy" PY_3_10_PLUS = sys.version_info[:2] >= (3, 10) PY_3_11_PLUS = sys.version_info[:2] ...
tanlnm512/cairn
benchmarks/datasource/ds2/second-corpus/attrs-26.1.0/src/attr/_compat.py
.py
c7483b88450e9c15
7.48
8
# SPDX-License-Identifier: MIT __all__ = ["get_run_validators", "set_run_validators"] _run_validators = True def set_run_validators(run): """ Set whether or not validators are run. By default, they are run. .. deprecated:: 21.3.0 It will not be removed, but it also will not be moved to new ``a...
tanlnm512/cairn
benchmarks/datasource/ds2/second-corpus/attrs-26.1.0/src/attr/_config.py
.py
746ab7c51e9f8191
7.48
8
# SPDX-License-Identifier: MIT """ Commonly useful converters. """ import typing from ._compat import _AnnotationExtractor from ._make import NOTHING, Converter, Factory, pipe __all__ = [ "default_if_none", "optional", "pipe", "to_bool", ] def optional(converter): """ A converter that all...
tanlnm512/cairn
benchmarks/datasource/ds2/second-corpus/attrs-26.1.0/src/attr/converters.py
.py
1a50de3b33de4c58
7.48
8
# SPDX-License-Identifier: MIT """ Testing strategies for Hypothesis-based tests. """ import functools import keyword import string from collections import OrderedDict from hypothesis import strategies as st import attr from .utils import make_class optional_bool = st.one_of(st.none(), st.booleans()) def gen_...
tanlnm512/cairn
benchmarks/datasource/ds2/second-corpus/attrs-26.1.0/tests/strategies.py
.py
48738566bdeb3546
7.98
8
# SPDX-License-Identifier: MIT import abc import inspect import pytest import attrs from attr._compat import PY_3_10_PLUS, PY_3_12_PLUS @pytest.mark.skipif( not PY_3_10_PLUS, reason="abc.update_abstractmethods is 3.10+" ) class TestUpdateAbstractMethods: def test_abc_implementation(self, slots): "...
tanlnm512/cairn
benchmarks/datasource/ds2/second-corpus/attrs-26.1.0/tests/test_abc.py
.py
55dc6f530c9d3fce
7.98
8
# SPDX-License-Identifier: MIT import types from typing import Protocol import pytest import attr @pytest.fixture(name="mp") def _mp(): return types.MappingProxyType({"x": 42, "y": "foo"}) class TestMetadataProxy: """ Ensure properties of metadata proxy independently of hypothesis strategies. ""...
tanlnm512/cairn
benchmarks/datasource/ds2/second-corpus/attrs-26.1.0/tests/test_compat.py
.py
1c2e6740a0618b84
7.98
8
""" Admin interface for API models (tenant-specific) These admin interfaces will only show data for the current tenant """ from django.contrib import admin from .models import Item @admin.register(Item) class ItemAdmin(admin.ModelAdmin): """ Admin interface for Items Automatically filtered by tenant schem...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/api/admin.py
.py
d5bcecc2ac0239d8
7.42
6
""" Example API models (tenant-specific) """ from django.db import models from django.contrib.auth import get_user_model User = get_user_model() class Item(models.Model): """ Example model - each tenant has their own isolated items Demonstrates tenant isolation at the database level """ name = mo...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/api/models.py
.py
3e4c328065ef05c5
7.42
6
""" API serializers """ from rest_framework import serializers from django.contrib.auth import get_user_model from .models import Item User = get_user_model() class ItemSerializer(serializers.ModelSerializer): """ Serializer for Item model """ created_by_username = serializers.CharField(source='creat...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/api/serializers.py
.py
f66d84a878a281da
7.42
6
""" Pytest fixtures for tenant-aware API testing """ import pytest from django.contrib.auth import get_user_model from django_tenants.test.cases import TenantTestCase from django_tenants.test.client import TenantClient from rest_framework.test import APIClient from apps.tenants.models import Client, Domain User = get_...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/api/tests/conftest.py
.py
3c6017c04bb7d149
7.92
6
""" Tests for Item API endpoints """ import pytest from django.contrib.auth import get_user_model from rest_framework import status from apps.core.tests import TenantAPITestCase from apps.api.models import Item User = get_user_model() @pytest.mark.django_db class TestItemAPI(TenantAPITestCase): """ Test Item...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/api/tests/test_items.py
.py
33639c6bb6ae9ae2
7.92
6
""" Tests for User Profile API endpoint """ import pytest from django.contrib.auth import get_user_model from rest_framework import status from apps.core.tests import TenantAPITestCase User = get_user_model() @pytest.mark.django_db class TestUserProfileAPI(TenantAPITestCase): """ Test user profile endpoint w...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/api/tests/test_profile.py
.py
4eede1840f659f93
7.92
6
""" Example API endpoints """ from rest_framework import generics, permissions, status from rest_framework.views import APIView from rest_framework.response import Response from django.db import connection from .models import Item from .serializers import ItemSerializer, UserProfileSerializer class ItemListCreateView...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/api/views.py
.py
f77da56ef8ba459f
7.42
6
""" Tenant JWT validation middleware Ensures tokens can't be used across different tenants """ from django.utils.deprecation import MiddlewareMixin from rest_framework_simplejwt.tokens import AccessToken from rest_framework_simplejwt.exceptions import TokenError from django.http import JsonResponse from django.db impor...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/authentication/middleware.py
.py
75d390ba7572558a
7.42
6
""" Tenant-aware JWT serializers """ from rest_framework_simplejwt.serializers import TokenObtainPairSerializer class TenantTokenObtainPairSerializer(TokenObtainPairSerializer): """ Custom JWT serializer that embeds tenant information in the token This ensures tokens are tenant-specific and can't be used ...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/authentication/serializers.py
.py
a22b4cc603f2f9a2
7.42
6
""" Base test classes for multi-tenant API testing This module provides base test classes that combine django-tenants with Django REST Framework for clean, scalable API testing. """ from django_tenants.test.cases import TenantTestCase from rest_framework.test import APIClient class TenantAPITestCase(TenantTestCase):...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/core/tests/__init__.py
.py
7771a8cda8883668
7.92
6
""" Admin interface for tenant management """ from django.contrib import admin from django_tenants.admin import TenantAdminMixin from .models import Client, Domain @admin.register(Client) class ClientAdmin(TenantAdminMixin, admin.ModelAdmin): """ Admin interface for managing tenants """ list_display =...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/tenants/admin.py
.py
e6b826c875ad3994
7.42
6
""" Management command to create a new tenant Usage: python manage.py create_tenant --schema=school1 --name="School 1" --domain=school1.localhost --admin-username=admin --admin-email=admin@school1.com """ from django.core.management.base import BaseCommand, CommandError from django.contrib.auth import get_user_model fr...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/tenants/management/commands/create_tenant.py
.py
b7040a797e6f31d1
7.42
6
""" Management command to create demo tenants for testing Usage: python manage.py setup_demo """ from django.core.management.base import BaseCommand from django.contrib.auth import get_user_model from apps.tenants.models import Client, Domain from django.db import connection User = get_user_model() class Command(Bas...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/tenants/management/commands/setup_demo.py
.py
7dd86a4b14a0b7a9
7.42
6
""" Tenant models for multi-tenancy support """ from django.db import models from django_tenants.models import TenantMixin, DomainMixin class Client(TenantMixin): """ Tenant model - represents a single tenant/customer Each tenant gets their own PostgreSQL schema """ name = models.CharField(max_len...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
apps/tenants/models.py
.py
d1298720652db484
7.42
6
""" Public schema URL configuration These URLs are accessible on the main domain (not tenant subdomains) """ from django.contrib import admin from django.urls import path from django.http import JsonResponse def health_check(request): """Simple health check endpoint for Docker/monitoring""" return JsonRespons...
bvuz/Django-Multi-Tenant-SaaS-Starter-Template
config/urls_public.py
.py
28d81298d98eb91d
7.42
6
#!/usr/bin/env python3 """ Run simple benchmarks against the sandbox/vulnapi for redir and xss endpoints. Outputs bench_results.json with minimal stats. """ import json import time import urllib.parse import urllib.request def try_url(url): try: with urllib.request.urlopen(url, timeout=5) as resp: ...
manoelrichard29/SecLists-2025-advanced
tools/bench_runner.py
.py
381023ecd35c168f
7.5
9
#!/usr/bin/env python3 """ Build compact/balanced/full packs for common tools from curated lists. Outputs packs/ with categorized wordlists. """ import os import shutil ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) OUT = os.path.join(ROOT, 'packs') def ensure_dir(p): os.makedirs(p, exist_o...
manoelrichard29/SecLists-2025-advanced
tools/build_packs.py
.py
ff08a342935477a8
7.5
9
#!/usr/bin/env python3 """ Generate counts.csv with file, total lines, unique non-empty lines, and sha256. Also write side-by-side unique files as <name>.unique.txt in-place. """ import hashlib import os ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) def sha256_text(text: str) -> str: retur...
manoelrichard29/SecLists-2025-advanced
tools/counts.py
.py
7f203cd18ce22d61
7.5
9
#!/usr/bin/env python3 """ Create a mirrored unique/ tree with de-duplicated, comment-stripped entries. Preserves relative paths; skips binary files. """ import os ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) OUT = os.path.join(ROOT, 'unique') def ensure_dir(p): os.makedirs(p, exist_ok=Tr...
manoelrichard29/SecLists-2025-advanced
tools/dedupe.py
.py
8095116cd5e0fc90
7.5
9
#!/usr/bin/env python3 """ Stub generator for frequency metadata. Produces metadata.csv with columns: path,entry,seen_count,rank,source Current implementation assigns seen_count=1, rank=NA, source=unknown. Replace with real corpus aggregation when sources are available. """ import csv import os ROOT = os.path.abspath...
manoelrichard29/SecLists-2025-advanced
tools/frequency_stub.py
.py
4aaed41dd6d558dd
7.5
9