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
#!/usr/bin/env python3 """This entry knows where to download the ImageNet metadata (ground truth, class labels, etc) from, how to unpack it and how to interpret it. Usage examples : axs byname base_imagenet_experiment , get ground_truth_path axs byname base_imagenet_experiment , get cl...
krai/axs
core_collection/workflows_collection/image_classification/base_imagenet_experiment/code_axs.py
.py
c3d2327e81330d9a
7.42
6
#!/usr/bin/env python3 import os import numpy as np class ImagenetLoader: def __init__(self, preprocessed_imagenet_dir, input_file_list, height, width, data_layout, normalize_symmetric=None, subtract_mean_bool=None, given_channel_means=None, given_channel_stds=None): "A trivial constructor" sel...
krai/axs
core_collection/workflows_collection/image_classification/imagenet_preprocessed_loader/imagenet_loader.py
.py
9567b9479e7e1b14
7.42
6
#!/usr/bin/env python3 import os import sys import numpy as np from PIL import Image """An example Python script that is given its data, necessary Python environment and the output path by wrapping it into an Entry. Usage examples : # using all defaults triggers downloading of a 500-sample subset...
krai/axs
core_collection/workflows_collection/image_classification/pillow_process_imagenet/code_axs.py
.py
8f5b734aeb15f4da
7.42
6
#!/usr/bin/env python3 """A standalone Object Detection program based on ONNX. Usage examples : # a short accuracy run: axs byquery program_output,task=object_detection,framework=onnxrt,num_of_images=20 , mAP # a short accuracy run with RetinaNet model: ...
krai/axs
core_collection/workflows_collection/object_detection/object_detection_using_onnxrt_py/onnx_detect.py
.py
8ff31b51bc1c2f49
7.42
6
#!/usr/bin/env python3 import errno import os import sys import json import numpy as np import PIL.Image def generate_file_list(annotation_data, src_images_dir, supported_extensions, first_n=None): if annotation_data: sorted_filenames = [ ann_record['file_name'] for ann_record in annotation_data ] e...
krai/axs
core_collection/workflows_collection/object_detection/pillow_resize_for_object_detection/code_axs.py
.py
3ebe44ddf318dbde
7.42
6
#!/usr/bin/env python3 # Accessing almost any python function or method (collectively called an "action") in CK way # by feeding it parameters from a list and a dictionary-like object. # # Thanks for this SO entry for inspiration: # https://stackoverflow.com/questions/196960/can-you-list-the-keyword-argume...
krai/axs
function_access.py
.py
ba6a9084ad415ae9
7.42
6
#!/usr/bin/env python3 """ # Accessing the kernel via API (default and non-default) if condition: from kernel import MicroKernel ak = MicroKernel(name='SpecialKernel') else: from kernel import default as ak """ __version__ = '0.2.483' # TODO: update with every kernel change import logging import os ...
krai/axs
kernel.py
.py
bd446395e56b1e82
7.42
6
""" Tests for ITMClient initialization and authentication. """ import pytest import responses from unittest.mock import patch, Mock from proofpoint_itm.client import ITMClient class TestClientInitialization: """Test client initialization and configuration.""" def test_client_init_with_valid_config(self, ...
drizzo-tech/proofpoint_itm
tests/test_client_init.py
.py
ae895054ca90eadb
7.92
6
from __future__ import annotations from baywatch.bay import Bay from baywatch.config_control import ConfigUpdateForm, Configuration from baywatch.version import __version__ import rich from rich.panel import Panel from rich.align import Align from rich.console import RenderableType from rich.text import Text from ric...
hdb/baywatch
baywatch/app.py
.py
ab352a861059a8ec
7.42
6
#!/usr/bin/env python from __future__ import annotations import requests import urllib.parse from datetime import datetime import json import os from baywatch.version import __version__ CATEGORIES = os.path.join(os.path.dirname(__file__), 'data/categories.json') SHORT_CATEGORIES = os.path.join(os.path.dirname(__fil...
hdb/baywatch
baywatch/bay.py
.py
b94dc05f1221f35c
7.42
6
from __future__ import annotations from rich.align import Align from textual.app import App from textual.reactive import Reactive from textual.widgets import Footer, Static from textual.message import Message from textual_inputs import TextInput import os import json import asyncio CONFIG_PATH = os.path.join(os.p...
hdb/baywatch
baywatch/config_control.py
.py
7e53085852e9e339
7.42
6
""" Spectral quality evaluation metrics. Authors: David R. Thompson, david.r.thompson@jpl.nasa.gov """ import os import argparse import numpy as np import spectral.io.envi as envi import matplotlib.pyplot as plt import logging def find_header(inputpath:str) -> str: """Return the header associated with an image fi...
emit-sds/emit-sds-l2a
spectrum_quality.py
.py
671c296f4becc851
8.02
10
import hashlib import json import os import sys from typing import List from urllib.parse import urlparse, urlunparse def print_json(data): """Pretty print as JSON string""" print(json.dumps(data, sort_keys=True, indent=2)) def log(*msgs): """Print text chunks to stderr""" print(*msgs, file=sys.stde...
opengisch/qfieldcloud-sdk-python
qfieldcloud_sdk/utils.py
.py
6b5bbf4f95ba086d
7.6
15
""" Variants of ResidualMLPAutoencoder for TM-negative detection. All variants share the same IO contract as the baseline so they plug into _train_deep_binary in run_tm_isoform_model_comparison.py. Configurable knobs: * hidden_dim width of residual blocks * latent_dim bottleneck width (autoencoder) ...
SalomonisLab/altanalyze3
altanalyze3/components/Daedalus/models/residual_mlp_variants.py
.py
ecd58487c770fc81
7.5
9
""" baselines.py: Baseline models for Proteus benchmarking. Three baselines are implemented: 1. SequenceDeltaBaseline ESM2(alt) − ESM2(ref) → logistic regression per task. Represents the simplest "what does the sequence difference tell us?" baseline. 2. LengthRatioBaseline alt_length / ref_length → logistic...
SalomonisLab/altanalyze3
altanalyze3/components/Proteus/proteus/benchmarking/baselines.py
.py
cf19647e0aa803d1
7.5
9
""" SyntheticExonSkipDataset: Dataset for self-supervised pretraining. Loads synthetic exon-skip pairs generated by SyntheticExonSkipGenerator and their cached embeddings. """ from __future__ import annotations from pathlib import Path from typing import Any, Dict, List, Optional import numpy as np import torch fro...
SalomonisLab/altanalyze3
altanalyze3/components/Proteus/proteus/data/pretrain_dataset.py
.py
1f7f106d0eaf14fb
7.5
9
""" CrossModalFusion: Fuses RNA, protein, disorder, and structural delta representations into a unified embedding via cross-modal attention and MLP fusion. """ from __future__ import annotations import torch import torch.nn as nn from torch import Tensor class CrossModalFusion(nn.Module): """ Fuses four mod...
SalomonisLab/altanalyze3
altanalyze3/components/Proteus/proteus/delta/cross_modal.py
.py
e9e4f3895b45a346
7.5
9
""" ReferenceDelta: Asymmetric reference-conditioned delta module. This is the core novel architectural contribution of Proteus. """ from __future__ import annotations import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor class ReferenceDelta(nn.Module): """ Asymmetric...
SalomonisLab/altanalyze3
altanalyze3/components/Proteus/proteus/delta/reference_delta.py
.py
71d941f5e85272d5
7.5
9
""" DisorderEncoder: Intrinsic disorder feature extractor. Attempts to use STARLING first, falls back to metapredict. Computes a 50-dimensional feature vector summarizing per-residue disorder scores for downstream use in the Proteus delta model. """ from __future__ import annotations import warnings from pathlib imp...
SalomonisLab/altanalyze3
altanalyze3/components/Proteus/proteus/encoders/disorder.py
.py
18da94e47a65dede
7.5
9
""" ESM2ProteinEncoder: Frozen ESM2 protein language model wrapper. Encodes protein sequences into 1280-dimensional embeddings using facebook/esm2_t33_650M_UR50D. Handles absent proteins (NMD isoforms) via sentinel files and center-crop for long sequences. """ from __future__ import annotations import warnings from ...
SalomonisLab/altanalyze3
altanalyze3/components/Proteus/proteus/encoders/protein.py
.py
ef2246fa47321232
7.5
9
""" OrthrusRNAEncoder: Frozen Orthrus foundation model wrapper for RNA transcript encoding. Orthrus uses a 6-track Mamba SSM architecture trained on paired RNA transcripts. This module handles loading, encoding, caching, and graceful fallback. """ from __future__ import annotations import warnings from pathlib impor...
SalomonisLab/altanalyze3
altanalyze3/components/Proteus/proteus/encoders/rna.py
.py
3293e0ad8f231919
7.5
9
""" topology.py: Sequence-based transmembrane topology and signal peptide prediction. Uses the same Kyte-Doolittle hydropathy algorithm as Daedalus build_gencode_protein_sequence_features.py so it can be applied to novel AltAnalyze3 isoforms not present in the GENCODE FASTA. CPU-only, no external dependencies beyond ...
SalomonisLab/altanalyze3
altanalyze3/components/Proteus/proteus/encoders/topology.py
.py
77985abcd7252203
7.5
9
""" TaskHeads: Multi-task prediction heads for Proteus. Ten prediction heads operating on the fused 256-dim representation: nine binary heads and one 8-class deviation classification head. New in v1.1: - localization_preserved : subcellular localization maintained - tm_insertion_competent : novel TM isoform c...
SalomonisLab/altanalyze3
altanalyze3/components/Proteus/proteus/heads/task_heads.py
.py
b133a86a8ff271eb
7.5
9
""" ProteusModel: Reference-conditioned isoform function prediction model. The main trainable model. Uses pre-cached embeddings from frozen foundation models (Orthrus, ESM2, disorder encoders) as input. """ from __future__ import annotations from pathlib import Path from typing import Any, Dict, Optional import tor...
SalomonisLab/altanalyze3
altanalyze3/components/Proteus/proteus/model.py
.py
ddf244f4f758b127
7.5
9
from abc import ABC, abstractmethod class CustomSearchAlgorithm(ABC): """ Custom search algorithm to be implemented if injecting a custom search class in the properties file """ def __init__(self): """Initialise the custom search algorithm.""" pass @abstractmethod def search(s...
PlanetHunters/tkmatrix
tkmatrix/custom_algorithms/custom_search.py
.py
5ead1b8674e1d024
7.45
7
""" Generate sns.regplot for each metric (volume, length, max_axial_damage_ratio) manual vs SCIseg 3D lesion segmentation BEFORE (phase1) and AFTER (phase3) active learning. The script: - fetch subjects from the provided /results folders (each one for a specific seed) - keep only the unique subjects (to avoid duplic...
ivadomed/model_seg_sci
correlations_with_clinical_scores/02a_generate_regplot_manual_vs_predicted.py
.py
9c39896ed3cf310b
7.64
18
""" Combine XLSX files (one per subject) with lesion metrics generated by SCT's sct_analyze_lesion into a single CSV file for easier manipulation and visualization. Namely, the script: - reads XLSX files (located under /results) with lesion metrics computed by SCT's sct_analyze_lesion (one XLSX file per subject) ...
ivadomed/model_seg_sci
midsagittal_measures/02_combine_xlsx_files.py
.py
43161efff07fe3c7
7.64
18
""" Figure 3. Generate scatter plots and Bland-Altman plots between manual and automatic lesion metrics. The script generates a single figure with 3 scatter plots (first row) and 3 Bland-Altman plots (second row). The script: - reads CSV file with lesion metrics with _sct and _manual suffixes. - for each lesion metri...
ivadomed/model_seg_sci
midsagittal_measures/03_generate_lesion_metric_plots.py
.py
565f5e3505b179f2
7.64
18
import pandas as pd CLINICAL_SCORES_MAX = { 'uems': 50, # Maximum UEMS score 'lems': 50, # Maximum LEMS score 'ms': 100, # Maximum Total Motor Score 'pp': 112, # Maximum Pinprick Score 'lt': 112 # Maximum Light-Touch Score } METHOD_TO_TITLE = { 'GT': 'Semi-automatic (manual lesion ma...
ivadomed/model_seg_sci
midsagittal_measures/utils.py
.py
edd56f953d759f4c
7.64
18
""" This (cool) script generates a LaTeX table with the lesion-wise metrics for the SCIsegV2 paper. The input to the script is a CSV file containing the metrics across all the sites and models, which is output by the 'plot_metrics_per_site.py' script in the 'model_seg_sci/testing' directory. The table is printed to th...
ivadomed/model_seg_sci
testing/generate_table1.py
.py
78e6d883e6988b8a
8.14
18
""" This script iterates through all the predictions and keeps only the largest connected object in each lesion mask. """ import os import glob import subprocess from concurrent.futures import ThreadPoolExecutor from tqdm import tqdm # NOTE: this file has to be moved to dataset-conversion folder to make it run. the fol...
ivadomed/model_seg_sci
testing/keep_largest_object.py
.py
145852157e842e5a
8.14
18
""" This script generates bar plots for the selected metrics across all sites and models. It automatically iterates through all the available folds, plots the metrics and also saves them into a CSV file. The output CSV file is then used to generate the lesion-wise metrics table for the SCIsegV2 paper. """ import os im...
ivadomed/model_seg_sci
testing/plot_metrics_per_site.py
.py
0f0a778bf153311d
8.14
18
import os import re def fetch_filename_details(filename_path): """ Get dataset name, subject name, session number (if exists), file ID and filename from the input nnUNet-compatible filename or file path. The function works both on absolute file path as well as filename :param filename_path: input nif...
ivadomed/model_seg_sci
testing/test_utils.py
.py
8a97e9cd80c07d75
7.14
18
""" Combine XLS files (one per subject) with lesion metrics computed using SCT's sct_analyze_lesion into a single CSV file for easier manipulation and visualization. The script: - read XLS files (located under /results) with lesion metrics (computed using sct_analyze_lesion for GT or predicted using our 3D nnUNet mo...
ivadomed/model_seg_sci
tissue_bridges/02_read_xls_files.py
.py
cf311885bc12e76a
7.64
18
""" Compare tissue bridges obtained using different methods (manual, semi-automatic, automatic) The script: - computes normality test - computes Kruskal-Wallis H-test for the tissue bridges obtained using three methods: 1. manual: manually segmented intramedullary lesions and manually measured tissue bridges ...
ivadomed/model_seg_sci
tissue_bridges/03_compute_stats.py
.py
41103d5376c4c0d0
7.64
18
#!/usr/bin/env python import importlib import inspect from typing import Any __all__: list[str] = [] CORE_MODULES: list[str] = [ "gitlab_api.gitlab_input_models", "gitlab_api.gitlab_response_models", "gitlab_api.api_client", ] OPTIONAL_MODULES = { "gitlab_api.gitlab_gql": "gql", "gitlab_api.agen...
Knuckles-Team/gitlab-api
gitlab_api/__init__.py
.py
9007da7afde4610d
7.52
10
"""GitLab Authentication Module. Authentication priority: 1. **OIDC Delegation** — If ``ENABLE_DELEGATION`` is active, exchanges the IdP-issued user token for a downstream GitLab access token via RFC 8693 Token Exchange using the shared ``delegated_auth`` helper. 2. **Fixed Credentials** — Falls back to ``GITLAB...
Knuckles-Team/gitlab-api
gitlab_api/auth.py
.py
6c72053dba7078c3
7.52
10
"""Multi-tenant GitLab instance registry. The single source of truth for *which* GitLab instances exist is the agent-utilities XDG config (`~/.config/agent-utilities/config.json`, `gitlab_instances`) — the same list the KG GitLab indexer reads — so one config drives both code/metadata indexing AND every `gitlab-api` c...
Knuckles-Team/gitlab-api
gitlab_api/instances.py
.py
f3bfb0c30ee4ccf8
7.52
10
import sys import os import pytest NUMPY_AVAILABLE = False try: import numpy as np NUMPY_AVAILABLE = True except ImportError: np = None sys.path.append(os.path.join(os.path.dirname(__file__), "../src/")) from mathjson_solver import create_solver def _create_numpy_test_cases(): """Create test cas...
LongenesisLtd/mathjson-solver
tests/test_TrapezoidalIntegratel.py
.py
da32dddac5a753d4
7.07
13
import sys import os import pytest import datetime sys.path.append(os.path.join(os.path.dirname(__file__), "../src/")) from mathjson_solver import create_solver class TestDatetimeReturnTypes: """Test that datetime functions return strings by default.""" def test_today_returns_string(self): solver =...
LongenesisLtd/mathjson-solver
tests/test_datetime.py
.py
1c12613958991b21
7.07
13
import sys import os import pytest sys.path.append(os.path.join(os.path.dirname(__file__), "../src/")) from mathjson_solver import create_solver def _create_Interpolate_test_cases(): """Create test cases for Interpolate function.""" test_cases = [ # Basic linear interpolation ( {...
LongenesisLtd/mathjson-solver
tests/test_interpolate.py
.py
6acead7955abdd58
8.07
13
""" Simple test cases for Reduce functionality These tests verify that Reduce works with three variables: - accumulator: carries state between iterations - current_item: the current element from the array being reduced - index: the current position in the array (0-based) """ import sys import os import pytest sys.pa...
LongenesisLtd/mathjson-solver
tests/test_reduce_simple.py
.py
73815b1a63af9d2b
7.07
13
""" Test demonstrating state tuples with Reduce for stateful accumulation This test validates that we can use Reduce with tuple states to maintain multiple accumulator variables, which is essential for implementing the NCI discrete approximation method. """ import sys import os import pytest sys.path.append(os.path....
LongenesisLtd/mathjson-solver
tests/test_state_tuples_reduce.py
.py
476782e169cc91c5
7.07
13
#!/usr/bin/python3 # # Copyright (c) 2020 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
oVirt/python-ovirt-engine-sdk4
examples/cancel_transfer.py
.py
c9bfb3a7908611e1
7.64
18
#!/usr/bin/python3 # -*- coding: utf-8 -*- # # Copyright (c) 2021 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
oVirt/python-ovirt-engine-sdk4
examples/checkpoints.py
.py
971645ab8a10b174
7.64
18
""" pip install uvicorn[standard] pip install fastapi """ from fastapi import APIRouter from pydantic import BaseModel from wayfarer import routing, loader, io import logging from . import utils log = logging.getLogger("web") router = APIRouter() class ShortestPath(BaseModel): path: list[int | str] edits...
compassinformatics/wayfarer
demo/edges.py
.py
a80f372bdb3b6123
7.59
14
r""" A FastAPI router to handle solving upstream and downstream paths on a river network """ from fastapi import APIRouter import logging import osmnx as ox import networkx as nx from shapely.geometry import LineString, Point, Polygon from wayfarer import loader from pydantic import BaseModel from functools import lru...
compassinformatics/wayfarer
demo/isochrones.py
.py
6ed1c5f3bac347e8
7.59
14
""" pip install uvicorn[standard] pip install fastapi """ from fastapi import APIRouter from pydantic import BaseModel from wayfarer import routing, loader, io, functions, splitter from wayfarer.splitter import SPLIT_KEY_SEPARATOR import logging import json from shapely.geometry import shape from collections import d...
compassinformatics/wayfarer
demo/routes.py
.py
267563905fe81c99
7.59
14
import osmnx as ox from wayfarer import loader from osmnx import convert, projection def download_osm(): """ Download roads from OSM centered around Riga, Latvia This only needs to be run once. """ location_point = (56.94105, 24.09682) # get roads within a distance of 500m from this point ...
compassinformatics/wayfarer
docs/examples/create_network.py
.py
655add34ac4f05b6
7.59
14
r""" C:\VirtualEnvs\wayfarer\Scripts\activate pip install numpy pip install GDAL --extra-index-url https://pypi.compass.ie pip install fiona --extra-index-url https://pypi.compass.ie pip install shapely --extra-index-url https://pypi.compass.ie pip install git+https://github.com/compassinformatics/wayfarer@main C:\Vi...
compassinformatics/wayfarer
scripts/ptals.py
.py
3c2e47a230ba0fdd
7.59
14
from wayfarer import loader def simple_features(): """ Create a list of features representing a network There are 3 features in a flat line running from 0,0 to 300,0 Each feature is 100 units in length """ return [ { "properties": {"EDGE_ID": 1}, "geometry": {"t...
compassinformatics/wayfarer
tests/helper.py
.py
bdb16e135b536f12
7.09
14
""" This file contains a collection of various network forms """ from networkx import MultiDiGraph, MultiGraph from wayfarer import ( EDGE_ID_FIELD, LENGTH_FIELD, NODEID_FROM_FIELD, NODEID_TO_FIELD, loader, ) def tuples_to_net(tuples, graph_type=MultiGraph): """ Takes in a list of tuples ...
compassinformatics/wayfarer
tests/networks.py
.py
a7d58b6e083af7eb
7.09
14
""" pytest -v tests/test_functions.py """ import logging import pytest import wayfarer from wayfarer import loader, functions, Edge, WITH_DIRECTION_FIELD import networkx @pytest.mark.parametrize("use_reverse_lookup", [(True), (False)]) def test_get_edge_by_key(use_reverse_lookup): recs = [{"EDGE_ID": 1, "LEN_": ...
compassinformatics/wayfarer
tests/test_functions.py
.py
9a1f822639617fb0
7.09
14
import pytest from wayfarer import linearref from shapely.geometry import LineString, Point, MultiLineString from shapely.wkt import loads from decimal import Decimal def test_invalid_lr(): ls = LineString([(0, 0), (0, 100)]) with pytest.raises(ValueError): linearref.create_line(ls, -1, 100) def te...
compassinformatics/wayfarer
tests/test_linearref.py
.py
d9bf2191c179dd67
7.09
14
""" pytest -v tests/test_splitting.py """ import logging import pytest from wayfarer import routing, splitter, Edge, WITH_DIRECTION_FIELD from wayfarer.splitter import SPLIT_KEY_SEPARATOR from tests import networks from networkx import NetworkXNoPath, NodeNotFound def test_solve_all_simple_paths(): net = network...
compassinformatics/wayfarer
tests/test_routing.py
.py
cb7bf65253337b17
7.09
14
""" pytest -v tests/test_routing_ordered_path.py """ import logging import pytest from wayfarer import Edge, routing, loops, functions from tests import networks import wayfarer from networkx.exception import NetworkXError def test_get_path_ends(): edges = [ Edge(0, 1, key="A", attributes={"EDGE_ID": "A...
compassinformatics/wayfarer
tests/test_routing_ordered_path.py
.py
1f75c5502b8fc54c
7.09
14
""" pytest -v tests/test_splitting.py """ import logging import pytest from wayfarer import splitter, functions, loader, routing from tests.helper import simple_features from shapely import LineString @pytest.mark.parametrize("use_reverse_lookup", [(True), (False)]) def test_split_network_edge(use_reverse_lookup): ...
compassinformatics/wayfarer
tests/test_splitting.py
.py
18e838a4546a995d
7.09
14
from __future__ import annotations from typing import NamedTuple __version__ = "0.13.3" LENGTH_FIELD = "LEN_" EDGE_ID_FIELD = "EDGE_ID" OFFSET_FIELD = "OFFSET" NODEID_FROM_FIELD = "NODEID_FROM" NODEID_TO_FIELD = "NODEID_TO" WITH_DIRECTION_FIELD = "WITH_DIRECTION" GEOMETRY_FIELD = "geometry" SPLIT_POINT_ID_FIELD ...
compassinformatics/wayfarer
wayfarer/__init__.py
.py
ce61a155494f275b
7.59
14
r""" This module contains functions relating to linear referencing. Requires the Shapely module Reference links: + https://pypi.org/project/ligeos/ + https://www.gaia-gis.it/fossil/libspatialite/wiki?name=VirtualRouting + http://plugins.qgis.org/plugins/lrs/ + http://blazek.github.io/lrs/release/help.1.2.0/index.html...
compassinformatics/wayfarer
wayfarer/linearref.py
.py
ba590e7c62c0e6bf
7.59
14
from __future__ import annotations import logging import wayfarer from math import hypot from wayfarer import ( EDGE_ID_FIELD, LENGTH_FIELD, NODEID_FROM_FIELD, NODEID_TO_FIELD, GEOMETRY_FIELD, ) from wayfarer import functions import pickle from typing import Iterable from networkx import MultiGraph,...
compassinformatics/wayfarer
wayfarer/loader.py
.py
b0b3d4d59d3f94a4
7.59
14
""" Module containing functions relating to loops """ from __future__ import annotations import networkx from networkx import cycles from wayfarer import Edge, functions import logging from typing import Iterable log = logging.getLogger("wayfarer") def is_loop(net: networkx.MultiGraph | networkx.MultiDiGraph) -> b...
compassinformatics/wayfarer
wayfarer/loops.py
.py
39adfd45eae0e962
7.59
14
from __future__ import annotations import logging import itertools import networkx from wayfarer import functions, LENGTH_FIELD, Edge from networkx.algorithms import eulerian_path from networkx import NetworkXNoPath, NodeNotFound class MultipleEnds(Exception): pass log = logging.getLogger("wayfarer") def solv...
compassinformatics/wayfarer
wayfarer/routing.py
.py
0a691a0f83af1372
7.59
14
""" This module handles splitting existing edges, and creating new nodes to join the split edges """ from __future__ import annotations import logging import uuid from collections import defaultdict, OrderedDict from wayfarer import functions, linearref import networkx from wayfarer import ( LENGTH_FIELD, OFFS...
compassinformatics/wayfarer
wayfarer/splitter.py
.py
923cdbd2df99d678
7.59
14
""" A collection of functions to help validate a network """ from __future__ import annotations from collections import Counter import networkx def duplicate_keys( net: networkx.MultiGraph | networkx.MultiDiGraph, ) -> list[int | str]: """ Find any duplicate keys in the network Keys must be unique fo...
compassinformatics/wayfarer
wayfarer/validator.py
.py
82f7c3e71ee68f04
7.59
14
""" Author: Michel Peltriaux Organization: Spatial data infrastructure Rhineland-Palatinate, Germany Contact: michel.peltriaux@vermkv.rlp.de Created on: 25.08.20 """ import os import subprocess import sys from pathlib import Path from django.core.management import BaseCommand, call_command class Command(BaseCommand...
mrmap-community/mrmap
backend/MrMap/management/commands/dev_messages.py
.py
69896aeb63ee1bcc
7.54
11
""" Author: Michel Peltriaux Organization: Spatial data infrastructure Rhineland-Palatinate, Germany Contact: michel.peltriaux@vermkv.rlp.de Created on: 02.07.20 """ from django.core.management import BaseCommand from django.db import transaction from MrMap.management.commands.setup_settings import LICENCES class C...
mrmap-community/mrmap
backend/MrMap/management/commands/load_licences.py
.py
959b33ce3af65beb
7.54
11
import warnings from functools import wraps from django.conf import settings from django.db import connection from django.test.utils import CaptureQueriesContext def warn_on_queries(fn): """ Decorator to warn if the wrapped function executes any database queries. Usage: @warn_on_queries ...
mrmap-community/mrmap
backend/extras/decorators.py
.py
3448c1173a7af485
7.54
11
from django.db.models.enums import ChoicesType, IntegerChoices class SmartIntegerChoicesMeta(ChoicesType): """Erweitert Django’s IntegerChoices-Meta, um Label-Lookup zu erlauben.""" def __call__(cls, value, *args, **kwargs): # Wenn int → normales Verhalten if isinstance(value, int): ...
mrmap-community/mrmap
backend/extras/enums.py
.py
70be682ce757d3b6
7.54
11
import logging import os.path import time from typing import Type, TypeVar, Iterator, Union import pykube import pytest import yaml from deepdiff import DeepDiff from deepdiff.helper import NotPresent from pykube.objects import APIObject from pytest_helm_charts.clusters import Cluster from pytest_helm_charts.flux.helm...
giantswarm/gitops-template
tests/ats/test_flux_objects.py
.py
fcff6e1df27da82d
7.15
19
import logging from homeassistant.components.light import ( LightEntity, ColorMode, ) from datetime import timedelta from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant...
MrSleeps/Juwel-HeliaLux-Home-Assistant-Custom-Component
custom_components/juwel_helialux/light.py
.py
a7f75a7b7f05b10f
7.65
19
import logging from homeassistant.components.number import NumberEntity from homeassistant.const import UnitOfTime from homeassistant.helpers.storage import Store from homeassistant.util import slugify from .const import DOMAIN import asyncio _LOGGER = logging.getLogger(__name__) async def async_setup_entry...
MrSleeps/Juwel-HeliaLux-Home-Assistant-Custom-Component
custom_components/juwel_helialux/number.py
.py
95733da61aad6183
7.65
19
# Original pyHelialux by moretea (https://github.com/moretea/pyHelialux) # Updated to work with Home Assistant by MrSleeps (https://github.com/MrSleeps/pyHelialuxHomeAssistant) import aiohttp import asyncio import logging import re _LOGGER = logging.getLogger(__name__) # Code added by @gehrausundspiel REQ...
MrSleeps/Juwel-HeliaLux-Home-Assistant-Custom-Component
custom_components/juwel_helialux/pyhelialux/pyHelialux.py
.py
82ae7eb8859fc6b8
7.65
19
import logging from homeassistant.components.select import SelectEntity from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.entity import EntityCategory from homeassistant.util import slugify from .const import DOMAIN, CONF_TANK_NAME _LOGGER = logging.getLogger(__na...
MrSleeps/Juwel-HeliaLux-Home-Assistant-Custom-Component
custom_components/juwel_helialux/select.py
.py
e0e516ea10b5d0f1
7.65
19
import logging from homeassistant.components.sensor import ( SensorEntity, SensorStateClass, SensorEntityDescription, ) from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import Add...
MrSleeps/Juwel-HeliaLux-Home-Assistant-Custom-Component
custom_components/juwel_helialux/sensor.py
.py
50840683807aa865
7.65
19
import logging from homeassistant.components.switch import SwitchEntity from homeassistant.util import slugify from .const import DOMAIN import asyncio _LOGGER = logging.getLogger(__name__) async def async_setup_entry(hass, entry, async_add_entities): """Set up switches for Helialux via config entry.""" ...
MrSleeps/Juwel-HeliaLux-Home-Assistant-Custom-Component
custom_components/juwel_helialux/switch.py
.py
6294dc91bc4fc77c
7.65
19
# -*- coding: utf-8 -*- """Helper code for file system (directory/file) manipulation The routines in this package provides helpers for creating files from templates, for example, and creating directories and files while printing log messages. """ import datetime import difflib import os import shutil from .logging i...
bihealth/snappy-pipeline
snappy_pipeline/apps/impl/fsmanip.py
.py
74a678a2b1afa7a9
7.52
10
# -*- coding: utf-8 -*- """Utilities for processing YAML configuration""" import re from collections.abc import MutableMapping, MutableSequence from ruamel.yaml.comments import CommentedMap, CommentedSeq def remove_yaml_comment_lines(yaml_str): """ :param yaml_str: YAML configuration as string. Expected use...
bihealth/snappy-pipeline
snappy_pipeline/apps/impl/yaml_utils.py
.py
3e28c971d0c4b8ad
7.52
10
#!/usr/bin/env python """Pull biomedsheet sample sheet from SODAR API.""" import argparse import re import sys import requests #: The URL template to use. URL_TPL = "https://%(sodar_host)s/samplesheets/api/remote/get/%(project_uuid)s/%(api_key)s" #: Template for the to-be-generated file. HEADER_TPL = ( "[Metada...
bihealth/snappy-pipeline
snappy_pipeline/apps/snappy_pull_sheet.py
.py
fe1ea769c381e0bf
7.52
10
# -*- coding: utf-8 -*- """Tool for refreshing pipeline_job.sh file for a step. Global configuration will not be touched. """ import argparse import os import sys import ruamel.yaml as ruamel_yaml from .. import __version__ from .impl.fsmanip import assume_path_existing, create_directory, create_from_tpl from .impl...
bihealth/snappy-pipeline
snappy_pipeline/apps/snappy_refresh_step.py
.py
3213e9ae042d13ec
7.52
10
# -*- coding: utf-8 -*- """Tool for starting a pipeline step instance The tool will update the existing global configuration with sensible default settings for the given step. """ import argparse import io import os import sys import ruamel.yaml as ruamel_yaml from ruamel.yaml.comments import CommentedMap from .. i...
bihealth/snappy-pipeline
snappy_pipeline/apps/snappy_start_step.py
.py
8137b3db11ec957d
7.52
10
# -*- coding: utf-8 -*- """Basic utility code for snappy_pipeline""" import os import sys import warnings from collections import OrderedDict from collections.abc import MutableMapping from copy import deepcopy from typing import TYPE_CHECKING, Any, AnyStr, Dict import ruamel.yaml as ruamel_yaml from .models import ...
bihealth/snappy-pipeline
snappy_pipeline/base.py
.py
8653d1488b2150ac
7.52
10
import enum import json import re import types import typing from enum import Enum from inspect import isclass from io import StringIO from typing import Annotated import ruamel import typing_extensions from annotated_types import Predicate from pydantic import BaseModel, ConfigDict, Field from pydantic_core import Py...
bihealth/snappy-pipeline
snappy_pipeline/models/__init__.py
.py
55faee877d76abe6
7.52
10
from typing import Annotated from pydantic import ConfigDict, Field from snappy_pipeline.models import SnappyModel class TargetIntervalEntry(SnappyModel): """ The following will match both the stock IDT library kit and the ones with spike-ins seen fromr Yale genomics. The path above would be mapped...
bihealth/snappy-pipeline
snappy_pipeline/models/gcnv.py
.py
ac34b6466e32a059
7.52
10
import pydantic from pydantic import BaseModel def validate_tools(): def ensure_tools_are_configured(instance): for tool in instance.tools: if not getattr(instance, str(tool)): raise ValueError(f"Tool {tool} not configured") return instance return pydantic.model_va...
bihealth/snappy-pipeline
snappy_pipeline/models/validators.py
.py
45da7cfea841dd86
7.52
10
"""Commonly used code and types""" import re import typing from itertools import chain from snakemake.io import Wildcards from snappy_wrappers.resource_usage import ResourceUsage #: Type for a Snaekmake key/path dict. SnakemakeDict = typing.Dict[str, typing.Union[typing.List[str], str]] #: Type for a Snakemake inp...
bihealth/snappy-pipeline
snappy_pipeline/workflows/abstract/common.py
.py
d133a06adb424182
7.52
10
# -*- coding: utf-8 -*- """Generic variant annotation step The assumption is that variant annotation is similar for all kind of variants, germline or somatic. This implementation attepmts to provide annotation for a set of variants stored in vcf format, using a generic sample sheet (_i.e._ without restriction on tumo...
bihealth/snappy-pipeline
snappy_pipeline/workflows/any_variant_annotation/__init__.py
.py
0aa2baf72718265e
7.52
10
# -*- coding: utf-8 -*- """Abstract class for somatic & germline variant callers""" import os from snakemake.io import expand from biomedsheets.shortcuts import GenericSampleSheet from snappy_pipeline.utils import listify from snappy_pipeline.workflows.abstract import BaseStep from snappy_pipeline.workflows.ngs_mapp...
bihealth/snappy-pipeline
snappy_pipeline/workflows/any_variant_calling/__init__.py
.py
ffbe1ffa4062deea
7.52
10
# -*- coding: utf-8 -*- """Implementation of the gCNV COHORT mode methods - used to build models.""" from snakemake.io import expand, touch from snappy_pipeline.utils import dictify, listify from snappy_pipeline.workflows.common.gcnv.gcnv_common import GcnvCommonStepPart class AnnotateGcMixin: """Mixin providin...
bihealth/snappy-pipeline
snappy_pipeline/workflows/common/gcnv/gcnv_build_model.py
.py
b4c8e999b6b34462
7.52
10
# -*- coding: utf-8 -*- """Implementation of the gCNV common methods.""" from collections import OrderedDict from snappy_pipeline.utils import dictify from snappy_pipeline.workflows.abstract import BaseStepPart, ResourceUsage class GcnvWarning(UserWarning): """Base class for custom warning of the gCNV integrati...
bihealth/snappy-pipeline
snappy_pipeline/workflows/common/gcnv/gcnv_common.py
.py
d2dadc6759ce616b
7.52
10
from importlib.resources import files import numpy as np import pandas as pd from smart_data_hub.property2dataframe import load_rock_property def load_default_df(lithologies): """Load default rock property DataFrame for the given lithologies. Args: lithologies (list): list of lithologies. Return...
mbd-rwth/smart_data_hub
src/smart_data_hub/add_default.py
.py
e2a6389eb8a77bc6
7.54
11
import pandas as pd def string_in_strings(target, strings) -> bool: """Check if 'target' exists in 'strings'. Args: target (str): string to search for. strings (list, str, None): list or string containing multiple entries Returns: bool: True if target is found in the strings, Fal...
mbd-rwth/smart_data_hub
src/smart_data_hub/data_tagging.py
.py
d519cad639570958
7.54
11
import yaml # keep the flow sequence style when writing as a YAML sequence class List_flow_sequence(list): pass def flow_sequence_representer(dumper, data): return dumper.represent_sequence("tag:yaml.org,2002:seq", data, flow_style=True) def convert_to_flow_sequence(unit_base): """Convert unit_base to...
mbd-rwth/smart_data_hub
src/smart_data_hub/dataframe2yaml.py
.py
8bb52ed6ecb98fb2
7.54
11
import os from importlib.resources import files import gempy as gp import numpy as np import pyvista as pv from gempy_engine.core.data.stack_relation_type import StackRelationType def generate_geomodel( site_orientation_path, site_points_path, extent_geometry, refinement, resolution, structura...
mbd-rwth/smart_data_hub
src/smart_data_hub/generate_geomodel.py
.py
56172ad0e83b1796
7.54
11
import uuid from importlib.resources import files from ruamel.yaml import YAML from smart_data_hub.load_path import get_path_in_dir # Preserve quotes and save None to null in YAML yaml = YAML() yaml.preserve_quotes = True yaml.representer.add_representer( type(None), lambda dumper, _: dumper.represent_scalar("...
mbd-rwth/smart_data_hub
src/smart_data_hub/generate_id.py
.py
77268ae3bfa27f2a
7.54
11
import numpy as np import scipy.constants as sc def convert_value(type, convert_ratio, value): """Convert a value based on its type and a conversion ratio. Args: type (scalar): The type of the value. convert_ratio (float): The conversion ratio to apply. value (float, str, dict, None):...
mbd-rwth/smart_data_hub
src/smart_data_hub/hydraulic2intrinic.py
.py
91847bbae58eed19
7.54
11
import numpy as np import pandas as pd from scipy import stats from smart_data_hub.hydraulic2intrinic import hydraulic2intrinic from smart_data_hub.property2dataframe import combine_rock_site_property def value_best_mask(input_pd_df): """Filter data in the input DataFrame that contains the best estimate value. ...
mbd-rwth/smart_data_hub
src/smart_data_hub/recommended_CV.py
.py
9d75b6e4b3d04e4f
7.54
11
import os from importlib.resources import files from pathlib import Path import pytest import pyvista as pv from smart_data_hub.load_path import get_path_in_dir from smart_data_hub.merge_method import value_empty_mask from smart_data_hub.merge_method import value_invalid_mask from smart_data_hub.property2dataframe impo...
mbd-rwth/smart_data_hub
tests/test_property_data_validation.py
.py
54a8e017e05bea7c
7.04
11
# Copyright 2022-2026 Fictionlab sp. z o.o. # # 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, including without limitation the rights # to use, copy, modify, merge, publi...
LeoRover/leo_robot-ros2
leo_fw/leo_fw/board.py
.py
910554781a9fc731
7.52
10
# Copyright 2026 Fictionlab sp. z o.o. # # 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, including without limitation the rights # to use, copy, modify, merge, publish, d...
LeoRover/leo_robot-ros2
leo_fw/leo_fw/console.py
.py
d3031a841813c548
7.52
10
# Copyright 2022-2026 Fictionlab sp. z o.o. # # 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, including without limitation the rights # to use, copy, modify, merge, publi...
LeoRover/leo_robot-ros2
leo_fw/leo_fw/utils.py
.py
a1681752768f730f
7.52
10