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
''' The range of Pingdom probes from various locations. The documentation can be found here: https://documentation.solarwinds.com/en/success_center/pingdom/content/topics/pingdom-probe-servers-ip-addresses.htm?cshid=pd-rd_203682601-pingdom-probe-servers-ip-addresses This is a parser for the set of IPs / IP ranges in C...
fartbagxp/aas-cidr-ranges
src/dl/download_pingdom.py
.py
ea88ca4b7cc1744a
7.3
3
""" Module for converting GenBank files to GTF format. Usage: python gb2gtf.py sequence.gb > sequence.gtf """ # download GenBank file from NCBI and then # Usage:python gb2gtf.py sequence.gb > sequence.gtf import sys import Bio from Bio import SeqIO def main(): """Run the CLI.""" if check_args(sys.arg...
CCBR/Tools
src/ccbr_tools/gb2gtf.py
.py
8a9017e598b54a02
7.15
1
""" GitHub helper functions Contributor related functions: - [](`~ccbr_tools.github.print_contributor_images`) - Print contributor profile images for HTML web pages - [](`~ccbr_tools.github.get_repo_contributors`) - Get a list of contributors to a GitHub repository - [](`~ccbr_tools.github.get_user_info`) - Get profi...
CCBR/Tools
src/ccbr_tools/github.py
.py
e115ca494ed5d322
7.15
1
#!/usr/bin/env python3 """ Finds homologs in human and mouse. About: hf or HomologFinder finds homologs in human and mouse. if the input gene or genelist is human, then it returns mouse homolog(s) and vice versa Usage: $ hf -h Examples: $ hf -g ZNF365 $ hf -l Wdr53,Zfp365 $ hf -f genelist....
CCBR/Tools
src/ccbr_tools/homologfinder/hf.py
.py
8ae9e4222265f58b
7.15
1
""" CLI for pre-commit hooks """ import click from ..pkg_util import ( CustomClickGroup, get_version, ) from .detect_absolute_paths import detect_absolute_paths from .sync_nextflow_version import sync_nextflow_version @click.group( cls=CustomClickGroup, context_settings={"help_option_names": ["-h", ...
CCBR/Tools
src/ccbr_tools/hooks/__main__.py
.py
110f737eee67162c
7.15
1
""" Detect absolute file paths Any instances of absolute paths (i.e. paths starting with "/") in the given files will be detected and printed to the console (unless "abs-path:ignore" is included). An error will be raised at the end if any are found. ## Usage with pre-commit Add this to your `.pre-commit-config.yaml`...
CCBR/Tools
src/ccbr_tools/hooks/detect_absolute_paths.py
.py
1c8ed21cbff95f32
7.15
1
""" Synchronize `manifest.version` in `nextflow.config` with the repo `VERSION` file. Whenever the `VERSION` file is updated, the `manifest.version` entry in `nextflow.config` will be updated to match it. ## Usage with pre-commit Add this to your `.pre-commit-config.yaml` file: ```yaml - repo: https://github.com/CC...
CCBR/Tools
src/ccbr_tools/hooks/sync_nextflow_version.py
.py
20a6737e4eaa46b6
7.15
1
""" Find the intersect of two files, returns the inner join Original author: Skyler Kuhn (@skchronicles) Usage: intersect file1 file2 """ import sys def indexFile(filename, joinindex, header): """Index a tab-delimited file by the join column.""" filedict = {} with open(filename, "r") as fh: ...
CCBR/Tools
src/ccbr_tools/intersect.py
.py
9670ae51c5f2c048
7.15
1
""" Get HPC usage metadata for a list of slurm jobids on biowulf About: This wrapper script works only on BIOWULF! This script usage the "dashboard_cli" utility on biowulf to get HPC usage metadata for a list of slurm jobids. These slurm jobids can be either provided at command line or extracted from a...
CCBR/Tools
src/ccbr_tools/jobinfo.py
.py
c708aeab537e7cb5
7.15
1
#!/usr/bin/env python3 """ module_list A command-line utility to display information about currently loaded environment modules. This script interacts with the system's module management system (e.g., Lmod or Environment Modules) to retrieve and display information about loaded modules. It supports two primary modes ...
CCBR/Tools
src/ccbr_tools/module_list.py
.py
7e2fac71b6612afe
7.15
1
import ast import glob import json import math import pathlib import tarfile import warnings from .shell import shell_run def get_tree(pipeline_outdir, args="-aJ --du"): """ Generate a directory tree structure using the `tree` command-line utility Note: when using -J with --du, the output is not valid J...
CCBR/Tools
src/ccbr_tools/paths.py
.py
af7d6518c53500fc
7.15
1
""" Take a peek at tab-delimited files Usage: peek <file.tsv> [buffer] """ import sys from pathlib import Path def usage(): """Print usage information and exit program""" bin_stem = Path(sys.argv[0]).stem print(f"USAGE: {bin_stem} <file.tsv> [buffer]\n") print("Assumptions:\n\tInput file is tab ...
CCBR/Tools
src/ccbr_tools/peek.py
.py
ffbdf789bc989da1
7.15
1
""" Helpers for bioinformatics pipelines Submodules: - [](`~ccbr_tools.pipeline.cache`) - [](`~ccbr_tools.pipeline.hpc`) - [](`~ccbr_tools.pipeline.nextflow`) - [](`~ccbr_tools.pipeline.util`) Main classes & functions - [](`~ccbr_tools.pipeline.count_pipeline_samples`): Count the number of samples in a pipeline run...
CCBR/Tools
src/ccbr_tools/pipeline/__init__.py
.py
fdbfdaacd4b42592
7.15
1
""" Functions for singularity cache management """ import json import os import sys def get_singularity_cachedir(output_dir=None, cache_dir=None): """ Returns the singularity cache directory. If no user-provided cache directory is provided, the default singularity cache is in the output directory. ...
CCBR/Tools
src/ccbr_tools/pipeline/cache.py
.py
45d5a50737c71607
7.15
1
""" Classes for working with different HPC clusters. Use [](`~ccbr_tools.pipeline.hpc.get_hpc`) to retrieve an HPC Cluster instance, which contains default attributes for supported clusters. """ import pathlib import re import shutil from ..shell import shell_run from .cache import get_sif_cache_dir, get_singularity...
CCBR/Tools
src/ccbr_tools/pipeline/hpc.py
.py
3d625809911623c3
7.15
1
""" Run Nextflow workflows in local and HPC environments. Functions: - init(output, pipeline_name='pipeline', **kwargs) Initialize the launch directory by copying the system default config files. - run(nextfile_path=None, nextflow_args=None, mode="local", pipeline_name=None, debug=False, hpc_options={}) Run a ...
CCBR/Tools
src/ccbr_tools/pipeline/nextflow.py
.py
68579a67accd6840
7.15
1
""" Utility functions for shell command execution. """ import contextlib import io import subprocess def shell_run( command_str, capture_output=True, check=True, shell=True, text=True, concat_output=True, ): """ Run a shell command and return stdout/stderr Args: command_s...
CCBR/Tools
src/ccbr_tools/shell.py
.py
e7759e5c36ae426d
7.15
1
from .pipeline.hpc import Cluster from .shell import shell_run from .versions import get_major_minor_version, match_semver class Software: @staticmethod def create_software(tool_name, version, software_type=None): """Create a software object for the requested tool.""" tool_lower = tool_name.lo...
CCBR/Tools
src/ccbr_tools/software.py
.py
cdce19422066b989
7.15
1
""" SPOOKER 👻 This command is designed to be used as part of the OnComplete/OnSuccess/OnError handlers as part of Snakemake and Nextflow pipelines. It collects metadata about the pipeline run, bundles it into a tarball, and saves it to a common location for later retrieval. Run `spooker --help` for more information....
CCBR/Tools
src/ccbr_tools/spooker.py
.py
4d2e59c298a8e421
7.15
1
""" Template files for CCBR Tools. ### Templates - `submit_slurm.sh` -- slurm submission script template - `mkdocs-fnl` - theme for websites built with mkdocs material. - `pkgdown-fnl` - theme for R package websites built with pkgdown. ### Quarto extensions #### fnl Quarto HTML format with FNL branding guidelines ...
CCBR/Tools
src/ccbr_tools/templates/__init__.py
.py
69a1802750aa9136
7.15
1
""" Get information from git tags, commit hashes, and GitHub releases. """ import json import re import warnings from .pkg_util import get_url_json from .shell import shell_run def get_current_hash(): """ Get the current commit hash. Uses git rev-parse HEAD to get the current commit hash. Returns:...
CCBR/Tools
src/ccbr_tools/versions.py
.py
4246d9a68087a01d
7.15
1
import pathlib import pytest @pytest.fixture def data_dir(): """Return the absolute path to the test data directory.""" return pathlib.Path(__file__).resolve().parent / "data" @pytest.fixture def data_dir_rel(): """Return the relative path to the test data directory.""" return pathlib.Path("tests")...
CCBR/Tools
tests/conftest.py
.py
684f281135d4fd3e
7.15
1
import os import pathlib import pytest from ccbr_tools.shell import shell_run is_ci = ( os.environ.get("CI", "false") == "true" ) # Set CI to false if not in a CI environment def test_version_flag(): """Test version flag.""" version = shell_run("ccbr_tools --version") assert version.startswith("cc...
CCBR/Tools
tests/test_cli.py
.py
96927389f729da9d
7.65
1
import pytest from ccbr_tools import gb2gtf from ccbr_tools.shell import exec_in_context def test_check_args(): """Test check args.""" test_cases = [ (["", "test"], True), (["test"], False), (["test", "-h"], False), (["test", "--help"], False), ] assert [gb2gtf.check_a...
CCBR/Tools
tests/test_gb2gtf.py
.py
2585d2133c7d70af
7.65
1
import pytest from ccbr_tools.github import get_user_info, print_contributor_images def test_print_contributor_images(): """Test print contributor images.""" assert not print_contributor_images(repo="actions", org="CCBR") def test_print_contributor_images_skips_apps(mocker): """Test that print_contribu...
CCBR/Tools
tests/test_github.py
.py
d647d4b2c5b7e493
7.65
1
import sys import pytest from ccbr_tools.GSEA import ncbr_huse from ccbr_tools.shell import shell_run def test_help_deg(): """Test help deg.""" assert shell_run(f"{sys.executable} -m ccbr_tools.GSEA.deg2gs -h").startswith( "usage: deg2gs.py" ) def test_help_mt2excel(): """Test help mt2exce...
CCBR/Tools
tests/test_gsea.py
.py
dd4df80c42fe569b
7.65
1
import argparse from ccbr_tools.homologfinder import hf from ccbr_tools.shell import shell_run def test_hf_gene(): """Test hf gene.""" assert hf.hf(argparse.Namespace(gene="ZNF365", genelist="", genelistfile="")) == [ "Zfp365" ] def test_hf_list(): """Test hf list.""" assert hf.hf( ...
CCBR/Tools
tests/test_homologfinder.py
.py
698b6aa038ab2a8f
7.65
1
import pytest import ccbr_tools.intersect from ccbr_tools.shell import exec_in_context def test_intersect(data_dir_rel): """Test intersect.""" out = exec_in_context( ccbr_tools.intersect.run_intersect, [ "intersect", str(data_dir_rel / "file.txt"), str(data...
CCBR/Tools
tests/test_intersect.py
.py
68a7e4a4e239c630
7.65
1
"""Cross-job build deduplication for concurrent image sourcing.""" from __future__ import annotations import threading class BuildCoordinator: """Tracks in-flight image builds so concurrent jobs don't duplicate work. Usage:: event = coordinator.try_acquire(tag) if event is not None: ...
perftool-incubator/rickshaw
source-images-service/source_images_service/core/build_coordinator.py
.py
de5774afba52d62a
7.24
2
"""Custom exception hierarchy for source-images-service.""" from __future__ import annotations class SourceImagesError(Exception): """Base exception for all source-images-service errors.""" class SubprocessError(SourceImagesError): """A subprocess exited with a non-zero return code or timed out.""" de...
perftool-incubator/rickshaw
source-images-service/source_images_service/core/exceptions.py
.py
1f5e0272be5df034
7.24
2
"""Filesystem utilities — port of Perl find_files() (L61-94).""" from __future__ import annotations import os # Directory / file names to skip during recursive walk _SKIP_NAMES: set[str] = {".", "..", ".git", "docs", ".github", "__pycache__"} # File extensions to skip _SKIP_EXTENSIONS: set[str] = {".md"} def find...
perftool-incubator/rickshaw
source-images-service/source_images_service/core/file_utils.py
.py
9abcd26ab5ce32ee
7.24
2
"""Job lifecycle management with in-memory store and thread pool executor.""" from __future__ import annotations import logging import threading import time import uuid from concurrent.futures import ThreadPoolExecutor from dataclasses import dataclass, field from typing import Any from source_images_service.config ...
perftool-incubator/rickshaw
source-images-service/source_images_service/core/job_manager.py
.py
3b8e25982fe2f641
7.24
2
"""Container registry operations via skopeo/buildah — port of Perl L264-503.""" from __future__ import annotations import logging import os import time from typing import TYPE_CHECKING from source_images_service.core.exceptions import RegistryError from source_images_service.core.subprocess_runner import run_cmd if...
perftool-incubator/rickshaw
source-images-service/source_images_service/core/registry_ops.py
.py
9de5fa1b60486614
7.24
2
"""Ordered requirement list builder — port of Perl build_reqs() (L505-583).""" from __future__ import annotations import json import logging import re from dataclasses import dataclass, field from pathlib import Path from typing import TYPE_CHECKING if TYPE_CHECKING: from source_images_service.core.workspace imp...
perftool-incubator/rickshaw
source-images-service/source_images_service/core/requirements_builder.py
.py
e1b509b1f3cc7bd7
7.24
2
"""Thin wrapper around subprocess.run — port of Perl toolbox::run::run_cmd().""" from __future__ import annotations import logging import subprocess from dataclasses import dataclass from typing import TYPE_CHECKING from source_images_service.core.exceptions import SubprocessError if TYPE_CHECKING: from source_...
perftool-incubator/rickshaw
source-images-service/source_images_service/core/subprocess_runner.py
.py
b2610431e76e8dbf
7.24
2
"""Image building via workshop script — port of Perl workshop_build_image() (L323-378).""" from __future__ import annotations import json import logging from typing import TYPE_CHECKING from source_images_service.core.exceptions import SubprocessError, WorkshopBuildError from source_images_service.core.subprocess_ru...
perftool-incubator/rickshaw
source-images-service/source_images_service/core/workshop_runner.py
.py
06f14c6a15d21e12
7.24
2
"""Workspace materialization — decode base64 request content to temp directories.""" from __future__ import annotations import base64 import logging import os import shutil import tempfile from dataclasses import dataclass, field from pathlib import Path from source_images_service.models.requests import ( Base64...
perftool-incubator/rickshaw
source-images-service/source_images_service/core/workspace.py
.py
02d54dabc9869b77
7.24
2
#!/usr/bin/env python3 # -*- mode: python; indent-tabs-mode: nil; python-indent-level: 4 -*- # vim: autoindent tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=python """Unit tests for rickshaw-run.py's RunState.apply_tool_multiplex() -- the bridge that lets a tool's flat tool-params.json params get validated/ ...
perftool-incubator/rickshaw
tests/test_apply_tool_multiplex.py
.py
161b94b64daa85aa
7.74
2
#!/usr/bin/env python3 # -*- mode: python; indent-tabs-mode: nil; python-indent-level: 4 -*- # vim: autoindent tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=python """Unit tests for rickshaw-run.py's dropped-follower tracking: RunState.remove_followers()/remove_dropped_followers()/remove_engine_followers() a...
perftool-incubator/rickshaw
tests/test_dropped_followers.py
.py
b4c5161425b4f9d0
7.74
2
#!/usr/bin/env python3 # -*- mode: python; indent-tabs-mode: nil; python-indent-level: 4 -*- # vim: autoindent tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=python """Unit tests for rickshaw-run.py's dump_params()/render_param(). Covers rickshaw#867: a param value containing a space must be rendered with en...
perftool-incubator/rickshaw
tests/test_dump_params.py
.py
0f90b32345e2e109
7.74
2
#!/usr/bin/env python3 # -*- mode: python; indent-tabs-mode: nil; python-indent-level: 4 -*- # vim: autoindent tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=python """Unit tests for endpoints.py's do_roadblock() thin wrapper around toolbox.roadblock.do_roadblock() (PERFNFV-462). toolbox, roadblock, and the ...
perftool-incubator/rickshaw
tests/test_endpoints_do_roadblock.py
.py
201729ea0f405457
7.74
2
#!/usr/bin/env python3 # -*- mode: python; indent-tabs-mode: nil; python-indent-level: 4 -*- # vim: autoindent tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=python """Unit tests for endpoints.py's process_bench_roadblocks() data-structure initialization (rickshaw#867's third consumer). This is a separate, e...
perftool-incubator/rickshaw
tests/test_endpoints_process_bench_roadblocks.py
.py
c72e8b6fe7c78370
7.74
2
#!/usr/bin/env python3 # -*- mode: python; indent-tabs-mode: nil; python-indent-level: 4 -*- # vim: autoindent tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=python """Unit tests for rickshaw-run.py's expand_id_ranges() and RunState.load_bench_params()'s automatic per-instance param id-scoping. Fixes a bug w...
perftool-incubator/rickshaw
tests/test_load_bench_params_duplicate_names.py
.py
a9a1c728be0735bf
7.74
2
#!/usr/bin/env python3 # -*- mode: python; indent-tabs-mode: nil; python-indent-level: 4 -*- # vim: autoindent tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=python """Unit tests for rickshaw-post-process-bench.py's dump_params(). This is a second, independently-maintained "port of the Perl dump_params() fun...
perftool-incubator/rickshaw
tests/test_post_process_bench_dump_params.py
.py
11a7472ad65da2f6
7.74
2
#!/usr/bin/env python3 """Summarize Claude Code OTLP telemetry captured during a GitHub Actions run. Reads the newline-delimited OTLP JSON written by the collector's file exporter and emits a markdown report of token usage per model, plus Claude Code's own list-price USD estimate. When the workflow supplies the diff ...
Lattice-Data/lattice-tools
.github/scripts/summarize_claude_usage.py
.py
35da6fa8cefdb8a0
7.35
4
""" Validate and repair CAS Registry Numbers before spending a request on them. Shared by `chebi_lookup` and `structure_check`. It lives at the `bcp/` top level rather than inside either package so neither has to import the other for a check that belongs to both. Without it, `chebi_lookup.cas_to_cid()` and `structure_...
Lattice-Data/lattice-tools
bcp/cas_registry.py
.py
6ea8a149e9120c70
7.35
4
"""PubChem PUG REST client: CAS Registry Number → CID → properties + ChEBI xref.""" from __future__ import annotations import logging import time import urllib.parse from typing import Any import requests from cas_registry import CAS_INVALID_FORMAT, CAS_MISSING, classify_cas # PubChem rate limits: 5 req/s, 400 req...
Lattice-Data/lattice-tools
bcp/chebi_lookup/client.py
.py
0c098bf4c035849d
7.35
4
"""CSV batch I/O and single-CAS output for CAS → ChEBI mapping.""" from __future__ import annotations import csv import json import logging import sys from pathlib import Path from typing import Any, Literal from .client import OUTPUT_FIELDS_APPENDED, lookup_cas log = logging.getLogger(__name__) class CasMappingE...
Lattice-Data/lattice-tools
bcp/chebi_lookup/io.py
.py
bb0efbec58276bb3
7.35
4
"""Record live PubChem JSON responses as committed test fixtures.""" from __future__ import annotations import argparse import json import logging import sys import time import urllib.parse from pathlib import Path import requests from cas_registry import CAS_INVALID_FORMAT, CAS_MISSING, classify_cas from .client ...
Lattice-Data/lattice-tools
bcp/chebi_lookup/record_fixtures.py
.py
06d1f896b99d738d
7.35
4
"""ChEBI REST client: ChEBI ID → authoritative name, synonyms, and validation verdicts.""" from __future__ import annotations import html import logging import re import time from typing import Any, Iterator import requests # The ChEBI backend publishes no documented rate limit. Mirror the polite # spacing chebi_lo...
Lattice-Data/lattice-tools
bcp/chebi_terms/client.py
.py
574d55d2fb48f76c
7.35
4
"""Record live ChEBI JSON responses as committed test fixtures.""" from __future__ import annotations import argparse import json import logging import sys from pathlib import Path from .client import ChebiUnavailableError, fetch_compound, normalize_chebi_id log = logging.getLogger(__name__) # bcp/tests/fixtures/c...
Lattice-Data/lattice-tools
bcp/chebi_terms/record_fixtures.py
.py
bea3f4abadb225ca
7.35
4
from __future__ import annotations from dataclasses import dataclass, field from typing import Any from .constants import CRAM_COLUMNS, SHEET_HELPER_COLUMNS from .enrich import fetch_results from .models import ListedObject, RunSummary from .s3_utils import s3_uri_for from .sheets import ( SequenceFileRecord, ...
Lattice-Data/lattice-tools
bcp/file_extract/cram.py
.py
0367bef1d5cfb117
7.35
4
"""Shared per-file enrichment for deliverables under an S3 order prefix. FASTQ and CRAM deliverables are enriched identically: fetch the object's CRC64NVME, then read ``read_count`` from the companion ``<key>-metadata.json`` the CRO writes beside it. Both retry transient S3 errors the same way and both fan the work ou...
Lattice-Data/lattice-tools
bcp/file_extract/enrich.py
.py
af4d7fe2484ec268
7.35
4
from __future__ import annotations from dataclasses import dataclass, field @dataclass(frozen=True) class S3Location: """Parsed S3 URI.""" bucket: str prefix: str @dataclass(frozen=True) class ListedObject: """S3 object from a listing.""" key: str size_bytes: int @dataclass class RunSum...
Lattice-Data/lattice-tools
bcp/file_extract/models.py
.py
2fb56ffda3e13050
7.35
4
from __future__ import annotations import random import time from typing import Callable, TypeVar from botocore.exceptions import ( ClientError, ConnectTimeoutError, ConnectionClosedError, EndpointConnectionError, ReadTimeoutError, ) from .constants import TRANSIENT_ERROR_CODES, TRANSIENT_HTTP_ST...
Lattice-Data/lattice-tools
bcp/file_extract/retry.py
.py
abef4c7d3237b8d9
7.35
4
from __future__ import annotations from typing import Any, Callable from urllib.parse import urlparse from .models import ListedObject, S3Location from .retry import retry_with_backoff def parse_s3_uri(uri: str) -> S3Location: """Parse s3://bucket/prefix into bucket and normalized prefix (trailing /).""" pa...
Lattice-Data/lattice-tools
bcp/file_extract/s3_utils.py
.py
428cb83f9a1357f7
7.35
4
"""Lattice submission-sheet shaping for extracted file metadata. Turns enriched S3 records into two TSVs whose columns mirror the Lattice ``SequenceFile`` and ``SequenceFileSet`` tabs, so a run's output pastes into the submission workbook at A2 without reordering. Alias derivation lives here too, since the sheets refe...
Lattice-Data/lattice-tools
bcp/file_extract/sheets.py
.py
45c707c5ee2d019f
7.35
4
#!/usr/bin/env python3 """ Annotate CRISPR guides with gene identifiers from GTF file based on coordinate overlap. Hybrid implementation: one row per overlap, includes gene names, handles edge cases. """ import csv import argparse from collections import defaultdict def parse_gtf(gtf_file): """ Parse GTF fil...
Lattice-Data/lattice-tools
bcp/guide_to_gene.py
.py
e16b8185f353fb5c
7.35
4
#!/usr/bin/env python3 """ Annotate CRISPR guides with gene identifiers from GTF file using bioframe for overlap detection. Bioframe implementation: one row per overlap, includes gene names, handles edge cases. """ import csv import argparse import pandas as pd import bioframe as bf def csv_to_bed_dataframe(csv_file...
Lattice-Data/lattice-tools
bcp/guide_to_gene_bioframe.py
.py
b6763266d828e2bf
7.35
4
"""Core library for protospacer set signatures.""" from __future__ import annotations import csv from hashlib import sha256 from pathlib import Path _ACGT = frozenset("ACGT") DEFAULT_COLUMN = "guide_protospacer" # Single source of truth for the accepted input formats: the parser reads the # delimiter from here and ...
Lattice-Data/lattice-tools
bcp/guidesig/core.py
.py
2560578fc2d7a644
7.35
4
from __future__ import annotations from dataclasses import dataclass from pathlib import Path from typing import List, Tuple @dataclass(frozen=True) class MappingRow: """Single row from a mapping file.""" s3_path: str local_path: str line_num: int def _looks_like_s3(s: str) -> bool: return s.s...
Lattice-Data/lattice-tools
bcp/mapping_validation/parsing.py
.py
2bb8ed0bdb4f62da
7.35
4
"""Build step: loads Chart.yaml into context.""" import argparse import logging import os from typing import Set import yaml from step_exec_lib.errors import ValidationError from step_exec_lib.steps import BuildStep from step_exec_lib.types import Context, StepType from app_build_suite.build_steps.helm_consts import...
giantswarm/app-build-suite
app_build_suite/build_steps/chart_yaml_loader.py
.py
9598f049bd25f6d3
7.39
5
"""Build step: writes the in-context Chart.yaml dict to disk.""" import argparse import logging import os import shutil from typing import Set import yaml from step_exec_lib.steps import BuildStep from step_exec_lib.types import Context, StepType from app_build_suite.build_steps.helm_consts import ( CHART_YAML, ...
giantswarm/app-build-suite
app_build_suite/build_steps/chart_yaml_writer.py
.py
0ac115a0b9e9c573
7.39
5
"""Build steps implementing helm3 based builds.""" from step_exec_lib.steps import BuildStepsFilteringPipeline from app_build_suite.build_steps.chart_yaml_loader import ChartYamlLoader from app_build_suite.build_steps.chart_yaml_writer import ChartYamlWriter from app_build_suite.build_steps.giantswarm_helm_validator ...
giantswarm/app-build-suite
app_build_suite/build_steps/helm.py
.py
873056ba2385f692
7.39
5
"""Build step: injects missing Artifact Hub metadata into Chart.yaml at package time.""" import argparse import logging import os import shutil from typing import Dict, List, Optional, Set import configargparse import yaml from step_exec_lib.steps import BuildStep from step_exec_lib.types import Context, StepType fr...
giantswarm/app-build-suite
app_build_suite/build_steps/helm_artifacthub_metadata_setter.py
.py
c161f5e58e9a4120
7.39
5
"""Build step: validates the chart directory contains a valid Helm chart.""" import argparse import logging import os from typing import Set import configargparse import yaml from step_exec_lib.errors import ValidationError from step_exec_lib.steps import BuildStep from step_exec_lib.types import Context, StepType f...
giantswarm/app-build-suite
app_build_suite/build_steps/helm_builder_validator.py
.py
45085bad0587bcf3
7.39
5
"""Build step: builds a helm chart using helm package.""" import argparse import logging import os from typing import Set import configargparse from step_exec_lib.errors import ValidationError from step_exec_lib.steps import BuildStep from step_exec_lib.types import Context, StepType from step_exec_lib.utils.processe...
giantswarm/app-build-suite
app_build_suite/build_steps/helm_chart_builder.py
.py
c36fb0225e4098e8
7.39
5
"""Build step: finalizes metadata generation after chart build.""" import argparse import copy import logging import os import pathlib import shutil from datetime import datetime, timezone from typing import Any, Set import yaml from step_exec_lib.steps import BuildStep from step_exec_lib.types import Context, StepTy...
giantswarm/app-build-suite
app_build_suite/build_steps/helm_chart_metadata_finalizer.py
.py
17ddc605bf46488b
7.39
5
"""Build step: runs helm ct linter against the chart.""" import argparse import logging import os from typing import Set import configargparse from step_exec_lib.errors import ValidationError from step_exec_lib.steps import BuildStep from step_exec_lib.types import Context, StepType from step_exec_lib.utils.processes...
giantswarm/app-build-suite
app_build_suite/build_steps/helm_chart_tool_linter.py
.py
cbe1e8d2278f8e21
7.39
5
"""Build step: sets the 'home' field in Chart.yaml from git remote URL.""" import argparse import logging from typing import Optional, Set import configargparse from step_exec_lib.steps import BuildStep from step_exec_lib.types import Context, StepType from app_build_suite.build_steps.helm_consts import ( CHART_...
giantswarm/app-build-suite
app_build_suite/build_steps/helm_home_url_setter.py
.py
67002f057def75b5
7.39
5
"""Build step: runs helm dependency update.""" import argparse import logging import os import shutil from typing import List, Set from step_exec_lib.errors import ValidationError from step_exec_lib.steps import BuildStep from step_exec_lib.types import Context, StepType from step_exec_lib.utils.processes import run_...
giantswarm/app-build-suite
app_build_suite/build_steps/helm_requirements_updater.py
.py
ce5a7a939ed92e5b
7.39
5
"""Build step: renders the chart with 'helm template' and validates the output YAML.""" import argparse import logging import os import re from typing import Set import configargparse import yaml from step_exec_lib.errors import ValidationError from step_exec_lib.steps import BuildStep from step_exec_lib.types import...
giantswarm/app-build-suite
app_build_suite/build_steps/helm_template_validator.py
.py
bf63ff1c1dc84a24
7.39
5
"""Build step: sets chart version/appVersion from command line arguments.""" import argparse import logging from typing import Set import configargparse from step_exec_lib.steps import BuildStep from step_exec_lib.types import Context, StepType from app_build_suite.build_steps.helm_consts import ( CHART_YAML, ...
giantswarm/app-build-suite
app_build_suite/build_steps/helm_version_setter.py
.py
242a8a0fdbb4bee2
7.39
5
"""Build step: runs kube-linter against the chart.""" import argparse import logging import os from typing import Set import configargparse from step_exec_lib.errors import ValidationError from step_exec_lib.steps import BuildStep from step_exec_lib.types import Context, StepType from step_exec_lib.utils.processes im...
giantswarm/app-build-suite
app_build_suite/build_steps/kube_linter.py
.py
4fc4c117b02fd08a
7.39
5
"""Module with git related utilities.""" from typing import Optional import git class GitRepoVersionInfo: """ Provides application versions information based on the tags and commits in the repo """ def __init__(self, path: str): """ Create an instance of GitRepoVersionInfo :...
giantswarm/app-build-suite
app_build_suite/utils/git.py
.py
7f5b34f14a4ec42a
7.39
5
"""Git URL utilities for remote URL manipulation.""" import re from typing import Optional class GitUrlConverter: """Handles conversion between git URL formats for GitHub repositories.""" # SSH format: git@github.com:org/repo.git or git@github.com:org/repo _SSH_PATTERN = re.compile(r"^git@github\.com:([...
giantswarm/app-build-suite
app_build_suite/utils/git_url.py
.py
8a9abfd91fdd31ff
7.39
5
"""Strict YAML loading helpers that fail on duplicate mapping keys. PyYAML's SafeLoader silently keeps the last value when a mapping key is duplicated, which for rendered Helm manifests means silently dropped configuration. """ from typing import Any, Dict, Optional import yaml class DuplicateKeyError(yaml.YAMLErr...
giantswarm/app-build-suite
app_build_suite/utils/yaml_strict.py
.py
a1b03aaf8c827a45
7.39
5
import pytest from app_build_suite.utils.git_url import GitUrlConverter class TestGitUrlConverter: """Tests for GitUrlConverter utility class.""" @pytest.mark.parametrize( "url,expected", [ # SSH format URLs ("git@github.com:org/repo.git", True), ("git@git...
giantswarm/app-build-suite
tests/utils/test_git_url.py
.py
fa1ffa646abb7d2f
7.89
5
from typing import List, Optional import pytest import yaml from app_build_suite.utils.yaml_strict import DuplicateKeyError, UniqueKeyLoader, find_nearest_source VALID_MULTI_DOC = """--- # Source: my-app/templates/deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: my-app --- # Source: my-app/temp...
giantswarm/app-build-suite
tests/utils/test_yaml_strict.py
.py
e813e09c0d206eb9
7.89
5
"""Provide CLI helpers.""" import asyncio from collections.abc import Awaitable, Callable import logging from aiomysensors.exceptions import ( AIOMySensorsError, InvalidMessageError, MissingChildError, MissingNodeError, ) from aiomysensors.gateway import Gateway LOGGER = logging.getLogger("aiomysenso...
MartinHjelmare/aiomysensors
src/aiomysensors/cli/helper.py
.py
4e8d7e272426f123
7.24
2
"""Provide a gateway.""" from __future__ import annotations from collections.abc import AsyncGenerator from dataclasses import dataclass, field import logging from types import TracebackType from typing import Self from .model.message import Message, MessageSchema from .model.node import Node from .model.protocol im...
MartinHjelmare/aiomysensors
src/aiomysensors/gateway.py
.py
49ce0b3792e00146
7.24
2
"""Provide a MySensors message abstraction. Validation should be done on a protocol level, i.e. not with gateway state. """ from __future__ import annotations from dataclasses import dataclass from typing import TYPE_CHECKING, Literal, Self from mashumaro import DataClassDictMixin from aiomysensors.exceptions impo...
MartinHjelmare/aiomysensors
src/aiomysensors/model/message.py
.py
f1bb9da4dd6a78c9
7.24
2
"""Provide a MySensors node and child abstraction.""" from __future__ import annotations from dataclasses import dataclass, field from mashumaro import DataClassDictMixin, field_options from mashumaro.config import BaseConfig from aiomysensors.exceptions import MissingChildError @dataclass(kw_only=True) class Nod...
MartinHjelmare/aiomysensors
src/aiomysensors/model/node.py
.py
335652e9898b2c32
7.24
2
"""Provide MySensors protocols.""" from __future__ import annotations from enum import IntEnum from functools import cache from typing import ( Protocol, cast, ) from awesomeversion import AwesomeVersion from aiomysensors.model.const import DEFAULT_PROTOCOL_VERSION from . import protocol_14, protocol_15, p...
MartinHjelmare/aiomysensors
src/aiomysensors/model/protocol/__init__.py
.py
ad300d598a7cef14
7.24
2
"""Provide the protocol for MySensors version 1.4.""" from __future__ import annotations import calendar from collections.abc import Awaitable, Callable, Coroutine from enum import IntEnum import time from typing import Any from aiomysensors.exceptions import ( InvalidMessageError, MissingChildError, Mis...
MartinHjelmare/aiomysensors
src/aiomysensors/model/protocol/protocol_14.py
.py
2c1a707224df72a1
7.24
2
"""Provide the protocol for MySensors version 1.5.""" from enum import IntEnum from .protocol_14 import ( # noqa: F401 INTERNAL_COMMAND_TYPE, STRICT_SYSTEM_COMMAND_TYPES, VALID_SYSTEM_COMMAND_TYPES, Command, Stream, ) from .protocol_14 import ( IncomingMessageHandler as IncomingMessageHandler...
MartinHjelmare/aiomysensors
src/aiomysensors/model/protocol/protocol_15.py
.py
c236f8962c3a57a2
7.24
2
"""Provide the protocol for MySensors version 2.0.""" from __future__ import annotations from collections.abc import Awaitable, Callable, Coroutine from enum import IntEnum from functools import wraps from typing import Any from aiomysensors.exceptions import MissingChildError, MissingNodeError from aiomysensors.mod...
MartinHjelmare/aiomysensors
src/aiomysensors/model/protocol/protocol_20.py
.py
b7f6acdd5b7e18c0
7.24
2
"""Provide the protocol for MySensors version 2.1.""" from enum import IntEnum from .protocol_20 import ( # noqa: F401 INTERNAL_COMMAND_TYPE, STRICT_SYSTEM_COMMAND_TYPES, VALID_MESSAGE_TYPES, VALID_SYSTEM_COMMAND_TYPES, Command, Presentation, SetReq, Stream, ) from .protocol_20 import...
MartinHjelmare/aiomysensors
src/aiomysensors/model/protocol/protocol_21.py
.py
ccf296c2de1049d2
7.24
2
"""Provide the protocol for MySensors version 2.2.""" from __future__ import annotations from enum import IntEnum from aiomysensors.exceptions import MissingNodeError from aiomysensors.model.message import Message from .protocol_20 import handle_missing_node_child from .protocol_21 import ( # noqa: F401 INTERN...
MartinHjelmare/aiomysensors
src/aiomysensors/model/protocol/protocol_22.py
.py
5daee74241df0b22
7.24
2
"""Provide persistence.""" import asyncio from collections.abc import Callable, Coroutine from dataclasses import dataclass, field import json import logging from pathlib import Path from typing import Any from .exceptions import PersistenceReadError, PersistenceWriteError from .model.node import Node LOGGER = loggi...
MartinHjelmare/aiomysensors
src/aiomysensors/persistence.py
.py
b658a65ee6a9b52a
7.24
2
"""Provide an MQTT transport.""" from abc import abstractmethod import asyncio import contextlib from dataclasses import dataclass from enum import Enum import logging import uuid from aiomqtt import Client as AsyncioClient from aiomqtt import MqttError from aiomysensors.exceptions import TransportError, TransportFa...
MartinHjelmare/aiomysensors
src/aiomysensors/transport/mqtt.py
.py
fc6fbb5e842c2bf2
7.24
2
"""Provide a serial transport.""" import asyncio from serialx import open_serial_connection from . import StreamTransport class SerialTransport(StreamTransport): """Represent a serial transport.""" def __init__(self, port: str, baud: int = 115200) -> None: """Set up serial transport.""" su...
MartinHjelmare/aiomysensors
src/aiomysensors/transport/serial.py
.py
067cc435d7eab526
7.24
2
"""Provide a TCP transport.""" import asyncio from . import StreamTransport class TCPTransport(StreamTransport): """Represent a TCP transport.""" def __init__(self, host: str, port: int = 5003) -> None: """Set up TCP transport.""" super().__init__() self.host = host self.por...
MartinHjelmare/aiomysensors
src/aiomysensors/transport/tcp.py
.py
7a512bdeed41885f
7.24
2
"""Provide common fixtures for the CLI.""" from collections.abc import Generator from unittest.mock import AsyncMock, patch import pytest from aiomysensors.gateway import Gateway @pytest.fixture(name="gateway_cli", autouse=True) def gateway_cli_fixture() -> Generator[Gateway]: """Mock the CLI gateway handler."...
MartinHjelmare/aiomysensors
tests/cli/conftest.py
.py
9a08c98bcb42d568
7.74
2
"""Provide test tools.""" from copy import deepcopy from typing import Any from aiomysensors.transport import Transport NODE_SERIALIZED = { "children": {}, "protocol_version": "2.0", "sketch_version": "", "node_type": 17, "sketch_name": "", "node_id": 0, "battery_level": None, "sleepi...
MartinHjelmare/aiomysensors
tests/common.py
.py
5fa8b6a1134e33dc
7.74
2
"""Provide common fixtures.""" from collections.abc import Generator from pathlib import Path from unittest.mock import MagicMock, patch import pytest from aiomysensors.gateway import Gateway from aiomysensors.model.const import DEFAULT_PROTOCOL_VERSION from aiomysensors.model.message import Message, MessageSchema f...
MartinHjelmare/aiomysensors
tests/conftest.py
.py
68eff70fc8d2b6db
7.74
2
"""Provide common protocol fixtures.""" import pytest from aiomysensors.gateway import Gateway from aiomysensors.model.message import Message, MessageSchema from aiomysensors.model.node import Node from tests.common import MockTransport @pytest.fixture(name="command") def command_fixture( message_schema: Messag...
MartinHjelmare/aiomysensors
tests/model/protocol/conftest.py
.py
a47f55ae5883bb95
7.74
2
"""Test the node and child model.""" from mashumaro.exceptions import MissingField import pytest from aiomysensors.exceptions import MissingChildError from aiomysensors.model.node import Child, Node from tests.common import NODE_CHILD_SERIALIZED, NODE_SERIALIZED def test_dump(child: Child) -> None: """Test dump...
MartinHjelmare/aiomysensors
tests/model/test_node.py
.py
1f37a43d4ff82931
7.74
2
"""Compatibility shim for implementation-specific ``greenlet._greenlet`` APIs. Most functions in this module exist to satisfy greenlet compatibility tests and downstream callers that probe internal greenlet APIs. They do not implement core tealet switching semantics. In upstream greenlet, the optional-cleanup APIs (a...
kristjanvalur/pytealet
packages/tealet-greenlet/src/tealet_greenlet/_greenlet.py
.py
6b981c91737f2ce5
7
0
# -*- coding: utf-8 -*- """ If we have a run callable passed to the constructor or set as an attribute, but we don't actually use that (because ``__getattribute__`` or the like interferes), then when we clear callable before beginning to run, there's an opportunity for Python code to run. """ import greenlet g = None...
kristjanvalur/pytealet
packages/tealet-greenlet/tests/compat_greenlet/fail_clearing_run_switches.py
.py
a38df7a00fe7502b
7.5
0