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
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Helpers for app-level integration metrics assertions.""" import json import time from pathlib import Path from typing import Any from github.Repository import Repository from github_runner_manager.manager.vm_manager import PostJobStatus fr...
canonical/github-runner-operator
github-runner-manager/tests/integration/metrics_helpers.py
.py
b22ae7531642f115
8.15
19
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """OpenStack helper functions shared by integration tests.""" import logging import socket import time from pathlib import Path import openstack from github.Repository import Repository from openstack.compute.v2.server import Server as Opensta...
canonical/github-runner-operator
github-runner-manager/tests/integration/openstack_helpers.py
.py
5a15c994fada14d7
8.15
19
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Delete leftover OpenStack resources from github-runner-manager integration tests. This module is used by the suite under ``github-runner-manager/tests/integration/``. That suite runs the github-runner-manager application against a real OpenS...
canonical/github-runner-operator
github-runner-manager/tests/integration/orphan_cleanup.py
.py
1a5f99c3cabb07ad
8.15
19
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Lightweight planner stub for integration tests. Provides flavor info and pressure endpoints expected by PlannerClient: - GET /api/v1/flavors/<name>/pressure - GET /api/v1/flavors/<name>/pressure?stream=true (NDJSON) - POST /control/pressure ...
canonical/github-runner-operator
github-runner-manager/tests/integration/planner_stub.py
.py
45068d32fc579287
8.15
19
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Integration tests for tmate ssh connection.""" import logging import subprocess from dataclasses import dataclass from datetime import datetime, timezone from pathlib import Path from time import sleep from typing import Generator, Iterator ...
canonical/github-runner-operator
github-runner-manager/tests/integration/test_debug_ssh.py
.py
677565c2cbc4d7fc
8.15
19
""" Provides a container for an analyzed document, i.e., parsed document and found errors. """ from __future__ import annotations import typing from typing import Any from checkmytex.finding.problem import Problem from checkmytex.latex_document import LatexDocument class AnalyzedDocument: """ An analyzed d...
d-krupke/CheckMyTex
checkmytex/analyzed_document.py
.py
fe5a1ef4482cedd7
7.62
16
""" Parsing the arguments from CLI. """ from __future__ import annotations import argparse import sys from pathlib import Path def create_default_argument_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser( description="CheckMyTex: A simple tool for checking your LaTeX." ) pa...
d-krupke/CheckMyTex
checkmytex/cli/arguments.py
.py
9e9929c707271a9c
7.62
16
""" Module for checking a latex document by applying a set of checker and filter. """ import logging import traceback import typing from .analyzed_document import AnalyzedDocument from .filtering.filter import Filter from .finding import ( Checker, CheckSpell, ChkTex, Cleveref, Languagetool, P...
d-krupke/CheckMyTex
checkmytex/document_analyzer.py
.py
eaf70dd78ba9e5e3
7.62
16
"""Filter to ignore errors within code listing environments.""" import re import typing from checkmytex.finding import Problem from checkmytex.latex_document import LatexDocument from .filter import Filter class IgnoreCodeListings(Filter): """ Ignores errors within code listing environments. Code snip...
d-krupke/CheckMyTex
checkmytex/filtering/code_listings.py
.py
6164e1eeaed316a1
7.62
16
""" The math mode creates text, but it does often not proper english, leading to many false positives. This module filters out specific problems in math mode. """ import re import typing from checkmytex.finding import Problem from checkmytex.latex_document import LatexDocument from .filter import Filter class Math...
d-krupke/CheckMyTex
checkmytex/filtering/math_mode.py
.py
62b9174d4cf2c31e
7.62
16
import re import typing from pathlib import Path from ..finding.problem import Problem from ..latex_document import LatexDocument from .filter import Filter class Whitelist(Filter): """ Managing the whitelist, skipped problems, and ignored rules. """ def __init__( self, path: str | N...
d-krupke/CheckMyTex
checkmytex/filtering/whitelist.py
.py
4a5f070395fced18
7.62
16
""" Wrapping chktex (LaTeX linter, part of LaTeX distribution). https://www.nongnu.org/chktex/ """ import re import shutil import typing from checkmytex.latex_document import LatexDocument from .abstract_checker import Checker from .problem import Problem def _extract_problem(match: re.Match, document: LatexDocume...
d-krupke/CheckMyTex
checkmytex/finding/chktex.py
.py
19ce4134dcf5804a
7.62
16
""" Finding usages of raw \\ref """ import re import typing from checkmytex.latex_document import LatexDocument from .abstract_checker import Checker from .problem import Problem class Cleveref(Checker): """ A checker module for finding raw \\ref. Better use \\cref. """ def check(self, document: L...
d-krupke/CheckMyTex
checkmytex/finding/cleveref.py
.py
1cd4ede4ad6702f8
7.62
16
import json import shutil import typing from checkmytex.latex_document import LatexDocument, Origin from .abstract_checker import Checker from .problem import Problem class Languagetool(Checker): def __init__( self, lang: str = "en-US", max_characters: int | None = None, timeout_...
d-krupke/CheckMyTex
checkmytex/finding/languagetool.py
.py
47e7fc75a2a5d444
7.62
16
""" Simple module for finding inconsisting writing style of NP-hard/complete. Common problem with documents in theoretical computer science. """ import re import typing from checkmytex.latex_document import LatexDocument from .abstract_checker import Checker from .problem import Problem class UniformNpHard(Checker...
d-krupke/CheckMyTex
checkmytex/finding/nphard.py
.py
004b92698e252da8
7.62
16
""" Module for finding raw numbers and units in the LaTeX-document. SIUnitX is much better in formatting them. """ import re import typing from checkmytex.latex_document import LatexDocument from .abstract_checker import Checker from .problem import Problem def _looks_like_year(num: str): if re.fullmatch("[21]...
d-krupke/CheckMyTex
checkmytex/finding/siunitx.py
.py
53bfb35147f71eef
7.62
16
from yalafi.tex2txt import Options, tex2txt from checkmytex.latex_document.indexed_string import IndexedText class DetexedText(IndexedText): """ Container for the detexed text. It just wraps yalafi. """ def __init__(self, source: str, yalafi_opts: Options | None = None): yalafi_opts = yalafi...
d-krupke/CheckMyTex
checkmytex/latex_document/detex.py
.py
67c92ce003f83b9f
7.62
16
import typing from bisect import bisect from flachtex import TraceableString from flachtex.utils import compute_row_index class TextPosition: """ Position in a multi-line text. """ def __init__(self, index: int, line: int, line_offset: int): self.index = index self.line = line ...
d-krupke/CheckMyTex
checkmytex/latex_document/indexed_string.py
.py
196bc74e0dc9426c
7.62
16
""" The LatexDocument provides easy access to the latex document to be fed to a checker and to trace the checker's report back to the original document. """ import logging import re import typing from flachtex import TraceableString from .detex import DetexedText from .indexed_string import TextPosition from .origin...
d-krupke/CheckMyTex
checkmytex/latex_document/latex_document.py
.py
bcf1a026b6748361
7.62
16
from __future__ import annotations import re from pathlib import Path import flachtex from flachtex.command_substitution import NewCommandSubstitution, find_new_commands from flachtex.rules import ChangesRule, TodonotesRule from flachtex.rules.skip_rules import RegexSkipRule from flachtex.utils import Range from .la...
d-krupke/CheckMyTex
checkmytex/latex_document/parser.py
.py
cc25fde35f543eff
7.62
16
""" Container for the LaTeX-sources. """ from __future__ import annotations import typing from flachtex import TraceableString from checkmytex.latex_document.indexed_string import ( IndexedText, TextPosition, simplify_text_range, ) class FilePosition: def __init__(self, file: str, pos: TextPositio...
d-krupke/CheckMyTex
checkmytex/latex_document/source.py
.py
49bd56dff82c82af
7.62
16
""" Base classes for problem display extensions. Extensions add functionality to problem displays in HTML reports. Each extension can render a line of HTML for a problem, or skip by returning None. """ from __future__ import annotations import abc from dataclasses import dataclass from typing import TYPE_CHECKING, A...
d-krupke/CheckMyTex
checkmytex/reporting/extension_base.py
.py
00eb702345dcaff9
7.62
16
"""Basic message extension that displays the standard problem message.""" from __future__ import annotations import html from ..extension_base import ExtensionContext, ProblemExtension class BasicMessageExtension(ProblemExtension): """ The standard problem message extension. Renders: >>> [tool] messag...
d-krupke/CheckMyTex
checkmytex/reporting/extensions/basic_message.py
.py
23aae81f8dea2229
7.62
16
"""Lookup URL extension for problems.""" from __future__ import annotations import html from ..extension_base import ExtensionContext, ProblemExtension class LookupUrlExtension(ProblemExtension): """ Show helpful link if problem has a look_up_url. Checkers may provide various types of URLs: - Rule...
d-krupke/CheckMyTex
checkmytex/reporting/extensions/lookup_url.py
.py
0097e8090408bc04
7.62
16
"""HTML report generator for CheckMyTex analysis results.""" from __future__ import annotations import html import os.path import re from collections import defaultdict from pathlib import Path from checkmytex import AnalyzedDocument from checkmytex.finding import Problem from checkmytex.reporting.extension_base imp...
d-krupke/CheckMyTex
checkmytex/reporting/html_report.py
.py
ed223620ea0eb1f5
7.62
16
""" Provides a simple class for CLI option prompt. """ import typing class OptionPrompt: """ A simple helper for getting an input from multiple options. """ def __init__(self, read=input, write=print, front="", end=""): self._options = {} self._read = read self._write = write...
d-krupke/CheckMyTex
checkmytex/utils/choice.py
.py
017c782a896a07d6
7.62
16
""" Provides a class to open editors at specific lines and try to guess the line number after (sequential) changes in the file. """ import logging import os import shlex import subprocess import typing from pathlib import Path def _number_of_lines(file_path: str) -> int: with Path(file_path).open() as file: ...
d-krupke/CheckMyTex
checkmytex/utils/editor.py
.py
52bc0f0b5882987b
7.62
16
import re import typing from checkmytex import DocumentAnalyzer, LatexDocument from checkmytex.finding import Checker, Problem from checkmytex.latex_document.parser import LatexParser from flachtex import FileFinder class AbcChecker(Checker): def __init__(self, check_ranges): super().__init__() s...
d-krupke/CheckMyTex
tests/test_abc.py
.py
2b8ffe711c1f5ead
7.12
16
#!/usr/bin/env python # encoding: utf-8 # Copyright 2009 Baptiste Lepilleur and The JsonCpp Authors # Distributed under MIT license, or public domain if desired and # recognized in your jurisdiction. # See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE from __future__ import print_function f...
ansys/api-eigen-example
external/jsoncpp-v1.9.5/devtools/antglob.py
.py
28c64608546d58f3
7.48
8
# Copyright 2010 Baptiste Lepilleur and The JsonCpp Authors # Distributed under MIT license, or public domain if desired and # recognized in your jurisdiction. # See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE from contextlib import closing import os import tarfile TARGZ_DEFAULT_COMPRESS...
ansys/api-eigen-example
external/jsoncpp-v1.9.5/devtools/tarball.py
.py
d393421db48cd317
7.48
8
"""Script to generate doxygen documentation. """ from __future__ import print_function from __future__ import unicode_literals from devtools import tarball from contextlib import contextmanager import subprocess import traceback import re import os import sys import shutil @contextmanager def cd(newdir): """ h...
ansys/api-eigen-example
external/jsoncpp-v1.9.5/doxybuild.py
.py
15618dabe099d751
7.48
8
# Copyright 2007 Baptiste Lepilleur and The JsonCpp Authors # Distributed under MIT license, or public domain if desired and # recognized in your jurisdiction. # See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE """Simple implementation of a json test runner to run the test against json-py....
ansys/api-eigen-example
external/jsoncpp-v1.9.5/test/pyjsontestrunner.py
.py
76f2665704d19d5a
7.98
8
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/ansys-tools-repo-sync
src/ansys/tools/repo_sync/repo_sync.py
.py
7de8ceaad3356e81
7.48
8
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includi...
ansys/ansys-tools-repo-sync
tests/conftest.py
.py
e6b1343c525cba86
7.98
8
""" Utilities for HPVsim Quarto docs (version file, quartodoc, notebook cleanup). """ import os import sys import importlib import subprocess import sciris as sc import hpvsim as hpv default_folders = ['tutorials'] # Folders with notebooks temp_patterns = ['**/my-*.*', '**/example*.*'] # Temporary files to be removed...
starsimhub/hpvsim
docs/quarto_utils.py
.py
70120ffd8bcb9140
7.63
17
"""M07 demo: vaccination-coverage sweep with multi-seed UQ. Runs a 4 × 20 (coverage × seed) routine-vx sweep on the M05 Nigeria 4-genotype anchor, reduces each coverage scenario to median + 10/90 quantiles, and plots aggregate cancer trajectories by coverage. Exercises every M07 verification target: - sc.paralleliz...
starsimhub/hpvsim
examples/m07_uq_sweep.py
.py
9abc57bd0f3c361c
7.63
17
"""HPVsim calibration — ss.Calibration subclass with a weighted-gof eval. Provides: - hpv.Calibration: ss.Calibration subclass that takes a ``data`` dict of observed-target DataFrames and computes a single weighted mismatch using ``compute_gof`` (normalized absolute error by default). - compute_gof...
starsimhub/hpvsim
hpvsim/calibration.py
.py
e4c73854738c07a6
7.63
17
"""Country-data adapter: load location data into Starsim-shaped DataFrames. Used by ``hpvsim.Sim`` to build People (age pyramid), Births (CBR), Deaths (age- and sex-specific mortality), and SexualNetwork (debut, partners, mixing, layer probs, durations, acts). Underlying data lives in ``hpvsim/data/files/`` and is loa...
starsimhub/hpvsim
hpvsim/data/country.py
.py
d5675afc7ed07d88
7.63
17
''' Download data needed for HPVsim. Typically, this is done automatically: on load, HPVsim checks if the data are already downloaded, and if not, downloads them using the quick_download() function. The "slow download" functions supply the files that are usually zipped and stored in a separate repository, hpvsim_data....
starsimhub/hpvsim
hpvsim/data/downloaders.py
.py
ee086e13f2e4e5b8
7.63
17
"""HIV-data adapter: load per-location HIV/ART inputs for the co-infection sim. Mirrors ``hpvsim.data.country.load_country`` in style. Returns the HIV inputs used to build a co-infection sim: - ``art_coverage``: tidy long DataFrame ``[age, sex, year, coverage]`` parsed from the by-age ART coverage CSVs (females + m...
starsimhub/hpvsim
hpvsim/data/hiv.py
.py
e6cf1fc5d1287209
7.63
17
''' Load data ''' #%% Housekeeping import numpy as np import pandas as pd import sciris as sc import unicodedata import re __all__ = ['get_country_aliases', 'map_entries', 'get_age_distribution', 'get_age_distribution_over_time', 'get_total_pop', 'get_death_rates', 'get_birth_rates'] thisdir = sc.thispa...
starsimhub/hpvsim
hpvsim/data/loaders.py
.py
08d6ffa84b205cf7
7.63
17
''' Set the defaults across each of the different files. ''' import numpy as np import sciris as sc import pylab as pl from .settings import options as hpo # To set options # Specify all externally visible functions this file defines -- other things are available as e.g. hpv.defaults.default_int __all__ = ['datadir',...
starsimhub/hpvsim
hpvsim/defaults.py
.py
c7304563914808a3
7.63
17
"""Translation helpers for legacy distribution-dict inputs. Country-data adapters provide distribution parameters as ``{'dist': name, 'par1': p1, 'par2': p2}`` dicts; this module converts them into Starsim Dist instances. Retired once the country-data layer is rewritten to emit Starsim Dist instances directly. """ im...
starsimhub/hpvsim
hpvsim/migration_utils.py
.py
2d5f52bb70327582
7.63
17
"""HPV simulation parameters. ``SimPars`` subclasses ``ss.SimPars`` with HPV-specific defaults. ``GenotypePars`` holds per-genotype natural-history defaults (durations, severity functions, immunity, age risk) consumed by ``HPV(ss.Infection)``; ``get_genotype_pars(genotype)`` is the factory multi-genotype consumers use...
starsimhub/hpvsim
hpvsim/parameters.py
.py
bc0edf45edd1ea44
7.63
17
"""Initial HPV-prevalence curves and multi-genotype seeding Connector. The age-banded init_prev curves and ``_make_init_prev_fn`` sampler are used by both per-genotype ``HPV`` modules (for ``init_seeding='independent'``) and by ``_ExclusiveSeeder`` (for ``init_seeding='exclusive'``, which uses the 'total' curve as the...
starsimhub/hpvsim
hpvsim/seeding.py
.py
c9a67df700dfbe90
7.63
17
"""Sub-annual accumulation gate for AgeResults.cancer_incidence. Needs ms_agent_ratio=50 over 5000 agents and 35 years to resolve enough cancers per single tick for the 4x ratio to be distinguishable from noise, so it lives here rather than in tests/test_age_results.py. """ import numpy as np import pytest import scir...
starsimhub/hpvsim
tests/devtests/test_age_results_subannual.py
.py
72361d15e9a87625
7.13
17
"""Seed-averaged multiscale-equivalence gates for the analyzers. Both quantities below are means over rare events (age at cancer, DALYs from young-onset cancer), so a single seed is far too noisy to assert on — they need 4-6 seeds per ratio, i.e. ~20 full sims. The cheap per-run invariants those analyzers must satisfy...
starsimhub/hpvsim
tests/devtests/test_analyzers_multiscale_gates.py
.py
958833928185c23c
8.13
17
"""HIV-HPV coinfection direction gate. Runs the full Rwanda HIV+HPV anchor sim, which is far too expensive for the unit suite. The connector's own arithmetic (CD4 stratification, rel_sus / rel_sev multipliers) is unit-tested in ``tests/test_hiv_connector.py``; this asserts the emergent population-level direction. """ ...
starsimhub/hpvsim
tests/devtests/test_hiv_coinfection_gate.py
.py
1ff5a9deda7d8286
7.13
17
"""Incidence-driven HIV importer tests. The ``hpv.hiv_incidence_import`` intervention drives STIsim's HIV by imposing the Rwanda HIV incidence curve: each step it selects HIV-negative susceptibles per the (year, sex, age) incidence rate and calls ``hiv.set_prognoses`` on them (which flips them to infected AND wires th...
starsimhub/hpvsim
tests/devtests/test_hiv_incidence_import.py
.py
d3fa112fc4a3753e
8.13
17
"""Statistical acceptance gates for the multiscale grow engine. These three gates run ~72 full sims (many seeds x ratios) and take ~14 min. The mechanism-level checks — that fine agents are spawned, excluded from the network, subject to emigration, and reached by interventions — live in ``tests/test_multiscale_grow_un...
starsimhub/hpvsim
tests/devtests/test_multiscale_grow_gates.py
.py
6d192f5b009313b7
8.13
17
"""Rendering gates for hpv.plot_calibration. Both need a real ``Calibration.calibrate()`` run to produce something to plot, which is why they live here rather than in ``tests/test_plotting.py``. """ import matplotlib matplotlib.use('Agg') # headless, before pyplot import import matplotlib.pyplot as plt import numpy a...
starsimhub/hpvsim
tests/devtests/test_plot_calibration.py
.py
0adc97662c5da8be
8.13
17
"""Co-infection anchor: 4-genotype HPV + transmission HIV + ART on Nigeria. Phase-1 anchor uses a hand-tuned HIV beta to produce a non-trivial HIV+ subpopulation; it is NOT calibrated to a country (that is Phase 2 / Rwanda). API notes (STIsim 1.5.0): - ``sti.HIV.init_prev_data`` accepts a scalar float (parsed by ...
starsimhub/hpvsim
tests/regression/anchor_hiv_hpv.py
.py
2facc9610f39929d
7.13
17
"""Confirm the dur_cin long tail drives old-age (55+) cancer in HIV- women. (1) Percentiles of the calibrated dur_cin lognormal (mean=5x1.043, std=20x1.043 for hpv16) -- a very long right tail would push some cancers to old ages. (2) Actual age-at-cancer distribution from the calibrated sim (HIV- females), poo...
starsimhub/hpvsim
tests/regression/diag_dur_cin_tail.py
.py
ef9a1e6b6b69ccd3
8.13
17
"""Verify the v3 ported Rwanda network reproduces the DHS/v2 partnership pattern, and connect it to old-age HPV acquisition (the HIV- 55+ cancer driver). For each 5-yr female age band over 2010-2019 it reports: - realized marital / casual participation (fraction of alive women in a partnership) vs the INPUT annu...
starsimhub/hpvsim
tests/regression/diag_network_oldage.py
.py
2d81e6f7eddd29c9
8.13
17
"""Verify the ported Rwanda calibration reproduces v2 HPV + cancer levels. Runs the calibrated incidence-driven Rwanda sim for a few seeds and reports: - adult-female (15-49) any-genotype HPV prevalence by year - HIV-stratified cervical-cancer incidence per 100k women, pooled across seeds over a measurement wi...
starsimhub/hpvsim
tests/regression/diag_rwanda_calib_check.py
.py
7a9dfcb29866f659
8.13
17
"""Reproduction of methods-paper Fig 1 (natural history), all four genotypes. Port of ``plot_nh_simple`` from https://github.com/hpvsim/hpvsim_methods_manuscript/blob/main/plot_fig1.py. Loops over (hpv16, hpv18, hi5, ohr) — added in M03 once the per-genotype ``GenotypePars`` defaults landed. The M02 single-genotype v...
starsimhub/hpvsim
tests/regression/methods_fig1.py
.py
dc609b19c3b80d3b
8.13
17
import textwrap from pathlib import Path import click from loguru import logger @click.group() def commands(**_): """tools related to bootstrapping (new cluster, new repository, etc)""" pass @commands.command() def kubernetes(**_): """bootstrap kubernetes to pull from your cluster repository""" ret...
ocf/transpire
transpire/internal/cli/bootstrap.py
.py
a81d8e1ea6d6dae9
7.45
7
import os from datetime import datetime, timezone import click from transpire.internal.cli.utils import AliasedGroup from transpire.internal.config import ClusterConfig, GitModuleConfig from transpire.types import Image, Module from transpire.utils import get_image_tag def image_metadata(config: GitModuleConfig, mo...
ocf/transpire
transpire/internal/cli/image.py
.py
3f570f7b20bc070a
7.45
7
import subprocess import sys from pathlib import Path from shutil import rmtree from typing import Optional import click import yaml from loguru import logger from transpire.internal import render from transpire.internal.cli.utils import AliasedGroup from transpire.internal.config import ClusterConfig, get_config @...
ocf/transpire
transpire/internal/cli/obj.py
.py
1b7a6eecdc3a3846
7.45
7
import click from kubernetes import client, config from transpire.internal.cli.utils import AliasedGroup from transpire.internal.config import get_config, provider_from_context @click.command(cls=AliasedGroup) def commands(**_): """secret management commands""" pass @commands.command() @click.argument("app...
ocf/transpire
transpire/internal/cli/secrets.py
.py
fcd3eda10422b139
7.45
7
import shutil import tempfile from subprocess import PIPE, run from typing import Any import yaml from transpire.internal.config import CLIConfig from transpire.internal.context import get_app_context __all__ = ["build_chart_from_versions", "build_chart"] def assert_helm() -> None: """ensure helm binary is ava...
ocf/transpire
transpire/internal/helm.py
.py
9846c2b86a9bb26d
7.45
7
import shutil import urllib.parse from subprocess import PIPE, run from typing import Any import yaml __all__ = ["build_kustomization_from_versions", "build_kustomization"] def assert_kubectl() -> None: """ensure kubectl binary is available""" if shutil.which("kubectl") is None: raise RuntimeError(...
ocf/transpire
transpire/internal/kustomize.py
.py
bfa3cef246985c92
7.45
7
from transpire.internal.config import ClusterConfig, provider_from_context from transpire.manifestlike import ManifestLike class ManifestError(Exception): def __init__(self, message: str, *, suggestion: ManifestLike | None) -> None: self.message = message self.suggestion = suggestion def postpro...
ocf/transpire
transpire/internal/postprocessor.py
.py
cb6d8eb02c9aaacd
7.45
7
import base64 import os import hvac # type: ignore import hvac.exceptions # type: ignore from pydantic import BaseModel from transpire.internal.secrets import SecretsProvider from transpire.manifestlike import ManifestLike, manifest_to_dict class HashicorpVaultConfig(BaseModel): kvstore: str def fix_base64(...
ocf/transpire
transpire/internal/secrets/vault.py
.py
a8ce3e4704bcefa5
7.45
7
from typing import Iterable, Protocol from kubernetes import client class OpenAPIObject(Protocol): """An object that can be converted to a dictionary. Useful for objects from github.com/kubernetes-client/python.""" openapi_types: dict attribute_map: dict # Something that is possibly a Kubernetes manif...
ocf/transpire
transpire/manifestlike.py
.py
feb2c7ded7246406
7.45
7
import pathlib import tomllib from typing import Dict, cast from transpire.internal.context import get_app_context from transpire.types import ContainerRegistry, Image, Module def get_revision() -> str | None: """Retrieves the current Transpire module's revision.""" return get_app_context().revision def ge...
ocf/transpire
transpire/utils.py
.py
e66f3bdd411142de
7.45
7
"""CLI entrypoint for rewrite deployments from paired YAML specifications.""" from __future__ import annotations import argparse from pathlib import Path from prefect import deploy from echodataflow.deployment.deployment_engine import ( build_deploy_specs, configure_concurrency_groups, create_deployment...
echostack-org/echodataflow
src/echodataflow/deployment/deploy_cli.py
.py
3dd1a9ac8a0ce044
7.45
7
from pathlib import Path import datetime from prefect import flow, get_client, runtime, task from prefect.client.schemas.filters import FlowRunFilter @flow(timeout_seconds=600, log_prints=True) def flow_file_upload( src_dir: str, dest_dir: str, exclude_subdirs: list[str], max_age: int = -1, ): ""...
echostack-org/echodataflow
src/echodataflow/flows/flows_helper.py
.py
de2c35007f9715d0
7.45
7
from __future__ import annotations import configparser from pathlib import Path import echopype as ep import geopandas as gpd import pandas as pd import s3fs from prefect import flow, get_run_logger from prefect.futures import as_completed from echodataflow.operations.operations_integration import ( ReadNASCSett...
echostack-org/echodataflow
src/echodataflow/flows/flows_integration.py
.py
9e415763de5db592
7.45
7
"""Flows for hake prediction and downstream NASC processing.""" from __future__ import annotations import datetime from pathlib import Path import echopype as ep import pandas as pd from prefect import flow, get_client, get_run_logger, runtime from prefect.states import Failed from echodataflow.utils.manifests impo...
echostack-org/echodataflow
src/echodataflow/flows/flows_predict_hake.py
.py
d8af9913c98420b5
7.45
7
from pathlib import Path import pandas as pd from prefect import flow from echodataflow.utils.processing_ledger import ( get_completed_sv_files, resolve_database, ) TRANSECT_COLUMNS = [ "transectPart", "transectNumber", "transectStart", "transectEnd", ] def get_changed_transects( curre...
echostack-org/echodataflow
src/echodataflow/flows/flows_transect.py
.py
cbd206ef5c5b1ad0
7.45
7
"""Acoustic data-processing operations and their data contracts.""" from __future__ import annotations from dataclasses import dataclass from pathlib import Path import echopype as ep from echopype.qc import coerce_increasing_time, exist_reversed_time import numpy as np import pandas as pd import xarray as xr @dat...
echostack-org/echodataflow
src/echodataflow/operations/operations_acoustics.py
.py
60e84ab0a74d396d
7.45
7
"""Biological data ingestion, transformations, and estimates for trawl hauls.""" from __future__ import annotations import os from collections.abc import Iterable, Mapping from dataclasses import dataclass, fields from pathlib import Path from typing import Any from uuid import uuid4 import numpy as np import pandas...
echostack-org/echodataflow
src/echodataflow/operations/operations_biology.py
.py
f6455e0f32e51977
7.45
7
"""Operations for integrating acoustic and biological survey products.""" from __future__ import annotations import os from dataclasses import dataclass from pathlib import Path from uuid import uuid4 import echopype as ep import geopandas as gpd import numpy as np import pandas as pd import s3fs import xarray as xr...
echostack-org/echodataflow
src/echodataflow/operations/operations_integration.py
.py
14814c3e091d6dec
7.45
7
"""Pure planning helpers for batch acoustic post-processing.""" from __future__ import annotations import hashlib import json from dataclasses import dataclass from pathlib import Path from typing import Callable import pandas as pd from echodataflow.utils.manifests import ( MVBS_COLUMNS_POSTPROCESSING, PRE...
echostack-org/echodataflow
src/echodataflow/operations/operations_postprocessing.py
.py
92d37a6f9a401b6c
7.45
7
"""Hake-prediction and downstream NASC operations.""" from __future__ import annotations from dataclasses import dataclass from pathlib import Path import echopype as ep import echoregions as er import numpy as np import pandas as pd import torch import xarray as xr from segmentation_inference.model import binary_ha...
echostack-org/echodataflow
src/echodataflow/operations/operations_predict_hake.py
.py
0dd4c2fe74403482
7.45
7
"""Reusable operations for moving data between storage systems.""" from __future__ import annotations from dataclasses import dataclass from pathlib import Path from typing import Any import boto3 from botocore import UNSIGNED from botocore.config import Config @dataclass(frozen=True) class S3CopyWorkItem: """...
echostack-org/echodataflow
src/echodataflow/operations/operations_storage.py
.py
abc5b7b2df2a1154
7.45
7
from pathlib import Path from prefect.events import emit_event from prefect.events.worker import EventsWorker from watchdog.observers import Observer from echodataflow.utils.file_watcher import watch_directory, watch_file from echodataflow.utils.processing_ledger import ( initialize_ledger, register_raw_file,...
echostack-org/echodataflow
src/echodataflow/operations/operations_watchdog.py
.py
1aa69c739bd9693d
7.45
7
from pathlib import Path import panel as pn import xarray as xr from holoviews import opts import echoshader # Configure Panel to prevent automatic refreshes pn.config.autoreload = False path_MVBS = Path("/media/volume/shimada_202506_volume/viz_data_cache") def update_cache_multi_freq(): """ Load latest MVB...
echostack-org/echodataflow
src/echodataflow/services/viz_echogram_track.py
.py
f99859916c300b51
7.45
7
from pathlib import Path import panel as pn import xarray as xr from holoviews import opts import echoshader # Configure Panel to prevent automatic refreshes pn.config.autoreload = False path_MVBS = Path("/media/volume/shimada_202506_volume/viz_data_cache_2026/dyson_2026") def update_cache_multi_freq(): """ ...
echostack-org/echodataflow
src/echodataflow/services/viz_echogram_track_dyson.py
.py
34f7e3a16a9f2429
7.45
7
from pathlib import Path import panel as pn import xarray as xr from holoviews import opts import echoshader # Configure Panel to prevent automatic refreshes pn.config.autoreload = False path_MVBS = Path("/media/volume/shimada_202506_volume/viz_data_cache_2026/iwcsp_2026") def update_cache_multi_freq(): """ ...
echostack-org/echodataflow
src/echodataflow/services/viz_echogram_track_lasker.py
.py
dca62bb9de939c0d
7.45
7
"""Reusable Prefect tasks for acoustic data processing.""" import xarray as xr from prefect import get_run_logger, task from echodataflow.operations.operations_acoustics import ( CreateMVBSResult, CreateMVBSSettings, CreateMVBSWorkItem, RawToSvResult, RawToSvSettings, RawToSvWorkItem, comp...
echostack-org/echodataflow
src/echodataflow/tasks/tasks_acoustics.py
.py
b66c13e6af1b32e9
7.45
7
"""Reusable Prefect tasks for hake prediction and NASC processing.""" from prefect import get_run_logger, task from echodataflow.operations.operations_predict_hake import ( ComputeNASCResult, ComputeNASCSettings, ComputeNASCWorkItem, PredictHakeResult, PredictHakeSettings, PredictHakeWorkItem,...
echostack-org/echodataflow
src/echodataflow/tasks/tasks_predict_hake.py
.py
7148d51b7241e65c
7.45
7
import cartopy.feature as cfeature from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter from geopy.distance import distance import pandas as pd import numpy as np import geopandas as gpd import shapely.geometry as sg import matplotlib.pyplot as plt from shapely import wkt def utm_string_generator(long...
echostack-org/echodataflow
src/echodataflow/utils/grid.py
.py
932b9d1260dae92b
7.45
7
"""Utilities for reading, writing, and filtering processing manifests.""" from __future__ import annotations from pathlib import Path import pandas as pd SV_COLUMNS_REALTIME = [ "raw_filename", "Sv_filename", "first_ping_time", "last_ping_time", ] MVBS_COLUMNS_REALTIME = ["MVBS_filename", "first_ping...
echostack-org/echodataflow
src/echodataflow/utils/manifests.py
.py
2ef404e2d0507a5d
7.45
7
"""Utilities for matching cloud trawl files to complete hauls.""" from __future__ import annotations import re from collections.abc import Iterable, Mapping from pathlib import Path HAUL_NUMBER_PATTERN = re.compile(r"(?P<haul_num>\d{3})_[^_]+\.xlsx$", re.IGNORECASE) REQUIRED_TRAWL_FILE_TYPES = ("length", "specimen",...
echostack-org/echodataflow
src/echodataflow/utils/trawl_files.py
.py
77b0964b39a5addb
7.45
7
import re from pathlib import Path import datetime import numpy as np import pandas as pd def round_up_mins(dt: datetime.datetime, slice_mins: int) -> datetime.datetime: """Round down datetime to nearest interval minutes. Parameters ---------- dt : datetime.datetime Datetime to round ...
echostack-org/echodataflow
src/echodataflow/utils/utils.py
.py
ebb54fa1fe56d10f
7.45
7
from yuptoo.modifiers.add_host_facts import AddHostFacts from datetime import datetime, timedelta from yuptoo.lib.config import SATELLITE_HOST_TTL import uuid def test_add_host_facts(): uuid1 = str(uuid.uuid4()) b64_identity = ('eyJpZGVudGl0eSI6IHsiYWNjb3VudF9udW1iZXIiOiAic3lzYWNjb3VudCIsICJ0eXBlIjogIlN5c3R' ...
RedHatInsights/yuptoo
tests/modifiers/test_add_host_facts.py
.py
14e5d7098e43f336
7.95
7
from unittest.mock import patch from yuptoo.modifiers.transform_installed_packages import TransfromInstalledPackages def test_remove_installed_packages(): """Test remove installed_packages when message size exceeds.""" host = { 'system_profile': { 'installed_packages': [ ...
RedHatInsights/yuptoo
tests/modifiers/test_transform_installed_packages.py
.py
b8a7f76654524b8b
7.95
7
from yuptoo.modifiers.transform_mac_addresses import TransformMacAddresses def test_transform_mac_addresses(): """Test transform mac_addresses.""" host = {'mac_addresses': []} transformed_obj = {'removed': []} TransformMacAddresses().run(host, transformed_obj) assert host == {} assert 'empty m...
RedHatInsights/yuptoo
tests/modifiers/test_transform_mac_addresses.py
.py
297b69ab22836e87
7.95
7
from yuptoo.modifiers.transform_os_kernel_version import TransformOsKernalVersion def test_transform_os_kernel_field(): """Test transform os fields.""" host = {'system_profile': { 'os_release': '7', 'os_kernel_version': '3.10.0-1127.el7.x86_64' }} transformed_obj = {'modified': []} Transfo...
RedHatInsights/yuptoo
tests/modifiers/test_transform_os_kernel_version.py
.py
6e230f259ff70927
7.95
7
from uuid import UUID from yuptoo.processor.utils import Modifier class RemoveInvalidBiosUUID(Modifier): def run(self, host: dict, transformed_obj: dict, **kwargs): """Remove invalid bios UUID.""" uuid = host.get('bios_uuid') if (uuid and not self.is_valid_uuid(uuid)) or uuid == '': ...
RedHatInsights/yuptoo
yuptoo/modifiers/remove_invalid_bios_uuid.py
.py
88442554ed524fe5
7.45
7
from yuptoo.processor.utils import Modifier import logging LOG = logging.getLogger(__name__) GOOGLE_PROVIDER_NAME = 'gcp' class TransformCloudProvider(Modifier): def run(self, host: dict, transformed_obj: dict, **kwargs): """Transform 'system_profile.cloud_provider. When system_profile.cloud_prov...
RedHatInsights/yuptoo
yuptoo/modifiers/transform_cloud_provider.py
.py
f7cb40e235681f97
7.45
7
import json import logging from insights.parsers.installed_rpms import InstalledRpm from yuptoo.lib.config import KAFKA_PRODUCER_OVERRIDE_MAX_REQUEST_SIZE from yuptoo.processor.utils import Modifier LOG = logging.getLogger(__name__) class TransfromInstalledPackages(Modifier): def run(self, host: dict, transform...
RedHatInsights/yuptoo
yuptoo/modifiers/transform_installed_packages.py
.py
1001d42e8c9236ba
7.45
7
from yuptoo.processor.utils import Modifier import logging LOG = logging.getLogger(__name__) class TransformIPAddress(Modifier): def run(self, host: dict, transformed_obj: dict, **kwargs): """Remove empty & make 'ip_addresses' unique. Drop blank items.""" ip_addresses = host.get('ip_addresses') ...
RedHatInsights/yuptoo
yuptoo/modifiers/transform_ip_addresses.py
.py
152a562e2f0b936c
7.45
7
import logging from yuptoo.processor.utils import Modifier LOG = logging.getLogger(__name__) class TransformMacAddresses(Modifier): def run(self, host: dict, transformed_obj: dict, **kwargs): """Make values unique and remove empty 'mac_addresses' field.""" mac_addresses = host.get('mac_addresses'...
RedHatInsights/yuptoo
yuptoo/modifiers/transform_mac_addresses.py
.py
93b9c812b8ceb489
7.45
7
import re from yuptoo.processor.utils import Modifier # Follow the system_profile schema defination of the "os_kernel_version" field KERNEL_VERSION_PATTERN = re.compile(r'^(\d+\.\d+\.\d+)(\.\d+)?') class TransformOsKernalVersion(Modifier): def run(self, host: dict, transformed_obj: dict, **kwargs): """Tr...
RedHatInsights/yuptoo
yuptoo/modifiers/transform_os_kernel_version.py
.py
46cbb5acad5240f5
7.45
7
#!/usr/bin/env python3 """ HACK SLOW - Envia um comando por vez com delays longos. Cada comando eh curto e simples pra sobreviver ao ruido do IPC. """ import serial import time import sys PORT = '/dev/ttyUSB0' BAUD = 115200 SD = '/mnt/disc1' def send_slow(ser, cmd, wait=2.0): """Envia comando caract...
wangcai0124/camera-hack
scripts/hack_slow.py
.py
fa5e46bb3abda86e
7.56
12
#!/usr/bin/env python3 """ HACK V3 - Baseado na engenharia reversa do firmware Yoosee/Anyka Descobertas: - inittab: ttySAK0 respawn getty → login prompt reaparece após logout - setup.sh: 'q' + Enter nos primeiro 1s para o IPC - rc.local: SD so processa com RESET pressionado - /rom = jffs2 RW = persistencia - /e...
wangcai0124/camera-hack
scripts/hack_v3.py
.py
8b3d7a02025fb599
7.56
12
#!/usr/bin/env python3 """ Teste de RX e TX separados para comunicação serial com a câmera. Fase 1: RX puro (só escuta por 15s) Fase 2: TX+RX (envia dados e verifica eco/resposta) """ import serial import time import sys PORT = '/dev/ttyUSB0' BAUD = 115200 TIMEOUT = 0.5 def test_rx(duration=15): ""...
wangcai0124/camera-hack
scripts/test_rxtx.py
.py
d8bbacd60ac3c51f
8.06
12