text
stringlengths
185
73.3k
repo
stringlengths
7
100
path
stringlengths
4
146
language
stringclasses
7 values
hash
stringlengths
16
16
score
float64
7
8.5
stars
int64
0
237k
import time import typing as ty from pathlib import Path from threading import RLock import fileformats.core from .fs_mount_identifier import FsMountIdentifier PropReturn = ty.TypeVar("PropReturn") __all__ = ["mtime_cached_property", "classproperty"] class mtime_cached_property: """A property that is cached ...
python-fileformats/fileformats
fileformats/core/decorators.py
.py
564f485648a7e0c7
7.52
10
import functools import inspect import operator import re import typing as ty from pathlib import Path import fileformats.core from fileformats.core.exceptions import FormatDefinitionError, FormatRecognitionError from .utils import ( add_exc_note, fspaths_converter, get_optional_type, is_optional, ...
python-fileformats/fileformats
fileformats/core/identification.py
.py
3eb3c304593f8b9c
7.52
10
import datetime import itertools import json import re from argparse import Namespace from dataclasses import dataclass from typing import Optional, Dict, List, TypeVar, Callable, Tuple, Iterable import pytz import requests from dateutil import parser from bs4 import BeautifulSoup from telegram_animals.data.datastore...
Deer-Spangle/telegram-animals
telegram_animals/search_handles.py
.py
450a761f2f1214d6
7.45
7
import logging from abc import ABC, abstractmethod from typing import List import cv2 import numpy as np import torch import lmi_utils.gadget_utils.pipeline_utils as pipeline_utils from lmi_utils.image_utils.types import ImageBatch, ImageLike, normalize_image_batch, to_3channel class ADBase(ABC): logger = loggi...
lmitechnologies/LMI_AI_Solutions
anomaly_detectors/ad_core/ad_base.py
.py
fcd6ccc4c2f94d5c
7.56
12
import json import logging import os import shutil from typing import Any, Iterable, List import numpy as np import torch from torchvision.transforms import v2 from anomaly_detectors.ad_core.ad_base import ADBase from lmi_common.onnx_engine import ONNXEngine from lmi_common.trt_convert import onnx_to_trt from lmi_com...
lmitechnologies/LMI_AI_Solutions
anomaly_detectors/anomalib_lmi/base.py
.py
bed51b93704babaf
7.56
12
import argparse import logging import torch import torch.nn as nn from torchvision.transforms import v2 from anomaly_detectors.anomalib_lmi.base import to_list logger = logging.getLogger() class SafeNormalize(nn.Module): """ A Normalize layer that stores mean/std as buffers. This ensures they are saved...
lmitechnologies/LMI_AI_Solutions
anomaly_detectors/anomalib_lmi/convert_to_torchscript.py
.py
bc0444d034a8f4f6
7.56
12
import logging import os from collections import OrderedDict, namedtuple import albumentations as A import numpy as np import torch import lmi_utils.gadget_utils.pipeline_utils as pipeline_utils from ..base import Anomalib_Base Binding = namedtuple("Binding", ("name", "dtype", "shape", "data", "ptr")) class Anoma...
lmitechnologies/LMI_AI_Solutions
anomaly_detectors/anomalib_lmi/v0/model.py
.py
6fa617d60c271c48
7.56
12
import logging from collections.abc import Sequence from typing import Any, Iterable import torch from lmi_common.model_factory import ModelFactory from ..base import Anomalib_Base, AnomalibPT, register_backends class AnomalibPTv1(AnomalibPT): """PT/TorchScript backend with Anomalib v1-specific transform and o...
lmitechnologies/LMI_AI_Solutions
anomaly_detectors/anomalib_lmi/v1/model.py
.py
62d0f4f5d98fe9e6
7.56
12
import logging from typing import Any, Iterable import torch from lmi_common.model_factory import ModelFactory from ..base import Anomalib_Base, AnomalibPT, register_backends class AnomalibPTv2(AnomalibPT): """PT/TorchScript backend with Anomalib v2-specific transform and output extraction.""" logger = lo...
lmitechnologies/LMI_AI_Solutions
anomaly_detectors/anomalib_lmi/v2/model.py
.py
9e9fd86f3468858f
7.56
12
import argparse import logging from pathlib import Path from typing import Any, Dict, List, Optional import anomalib.models as ad_models import yaml from anomalib.data import Folder from anomalib.deploy import ExportType from anomalib.engine import Engine from torchvision.transforms import v2 logger = logging.getLogg...
lmitechnologies/LMI_AI_Solutions
anomaly_detectors/anomalib_lmi/v2/train.py
.py
6d76edef6cb4637d
7.56
12
""" MODULE: data_loader.py USAGE: load data from directory and subdirectories """ # 1. Built-in modules import glob import os # 2. Third-party modules import tensorflow as tf class DataLoader(object): """ DESCRIPTION: loads images from directory and subdirectories into tf.data.Dataset iterable...
lmitechnologies/LMI_AI_Solutions
anomaly_detectors/legacy/padim/data_loader.py
.py
8647c35391caa95d
7.56
12
import abc import time from typing import List import numpy as np import torch from lmi_utils.image_utils.types import ImageBatch, normalize_image_batch, to_3channel class ClassifierBase(abc.ABC): # Set to a positive integer in subclasses that use a fixed-batch-size model. fixed_batch_size: int = None ...
lmitechnologies/LMI_AI_Solutions
classifiers/cls_core/cls_base.py
.py
cc472abfc7f57387
7.56
12
import logging import time from collections import defaultdict import cv2 import numpy as np import torch from PIL import Image from ultralytics.data.augment import classify_transforms from ultralytics.utils.torch_utils import smart_inference_mode from classifiers.cls_core.classifier_registry import ClassifierRegistr...
lmitechnologies/LMI_AI_Solutions
classifiers/deprecated/yolov8_cls/model.py
.py
118fbb92b1769d1f
7.56
12
import logging from collections import defaultdict from typing import List import cv2 import torch from PIL import Image from ultralytics.data.augment import classify_transforms from ultralytics.utils.torch_utils import smart_inference_mode from classifiers.cls_core.cls_base import ClassifierBase from lmi_common.yolo...
lmitechnologies/LMI_AI_Solutions
classifiers/ultralytics_lmi/yolo/model.py
.py
b89187eaeb96abbd
7.56
12
from typing import Any, Dict, List, Protocol, Tuple, runtime_checkable import torch @runtime_checkable class InferenceEngine(Protocol): """Common contract for runtime inference backends (TensorRT, ONNX Runtime, ...). Implementations accept torch tensors as inputs and return torch tensors as outputs, so ...
lmitechnologies/LMI_AI_Solutions
lmi_common/inference_engine.py
.py
85cf13683a475a6f
7.56
12
class ModelFactory: """Mixin that provides extension-based dispatch to registered backend classes. Subclasses must define ``_registry = {}`` as a class attribute so each factory maintains its own independent mapping of file extensions to backend classes. Usage:: class MyModel(ModelFactory, So...
lmitechnologies/LMI_AI_Solutions
lmi_common/model_factory.py
.py
82063c056b228640
7.56
12
"""Embed and read model metadata (class names, ...) so a deployed model is a single file. An ONNX file carries the payload in its ``metadata_props``. A serialized TensorRT plan has no metadata slot, so the engine file is prefixed with a length-tagged JSON header holding that same props map — the layout ultralytics use...
lmitechnologies/LMI_AI_Solutions
lmi_common/model_metadata.py
.py
f038fb00da48f4c3
7.56
12
# coding=utf-8 import requests import time,datetime import os import re def query_stargazers_name(user, repo, token): query_star = """ query {{ repository(owner:"{0}", name:"{1}") {{ stargazers(first:100 {2}) {{ pageInfo {{ endCursor hasNextPage ...
ButterAndButterfly/GithubTools
core/github.py
.py
c71e263179d4b68b
7.54
11
import sys from core.github import * from core import github_star_history import json, os from functools import wraps from jinja2 import FileSystemLoader,Environment ''' 注解,用于优雅地扩展任务类型 ''' taskSolver = {} def task(type: str, description = "暂无描述"): assert task != None def decoratedFunc(func): @wraps(fun...
ButterAndButterfly/GithubTools
main.py
.py
650228848beda8c1
7.54
11
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2021 Mobvoi Inc. All Rights Reserved. # Author: di.wu@mobvoi.com (DI WU) """ConvolutionModule definition.""" from typing import Tuple import torch from torch import nn try: from typeguard import check_argument_types except ImportError: def check_argumen...
fclearner/Personal-vad-2.0
model/convolution.py
.py
1eb76ae85608ded7
7.63
17
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Positionwise feed forward layer definition.""" import torch class PositionwiseFeedForward(torch.nn.Module): """Positionwise feed forward layer. FeedForward are appied on...
fclearner/Personal-vad-2.0
model/position_wise_feed_forward.py
.py
8860c8d26f76d0e9
7.63
17
"""Subsampling layer definition.""" from typing import Tuple import torch class BaseSubsampling(torch.nn.Module): def __init__(self): super().__init__() self.right_context = 0 self.subsampling_rate = 1 def position_encoding(self, offset: int, size: int): return self.pos_enc.position_encoding(of...
fclearner/Personal-vad-2.0
model/subsampling.py
.py
f5917f28529aafce
7.63
17
import torch class Swish(torch.nn.Module): """Construct an Swish object.""" def forward(self, x: torch.Tensor): """Return Swish activation function.""" return x * torch.sigmoid(x) def get_activation(act): """Return activation function.""" # Lazy load to avoid unused import activation_funcs = { ...
fclearner/Personal-vad-2.0
model/utils.py
.py
bf6e57b76c602ac3
7.63
17
# -*- coding: utf-8 -*- import github import json import logging import os import re import requests import sys import youtube_req """File Information @file_name: main.py @author: Dylan "dyl-m" Monfret Main process. """ "ENVIRONMENT" try: github_repo = os.environ['GITHUB_REPOSITORY'] PAT = os.environ['PAT'...
Dyl-M/auto_youtube_playlist
src/main.py
.py
89bcf4d2149bc980
7.45
7
import json from weakref import ref from pkg_resources import parse_version DEFAULT_NAMESPACE = "default" def merge_dict(src, dest): for k, v in src.items(): if isinstance(dest.get(k), dict) and isinstance(v, dict): merge_dict(v, dest[k]) else: dest[k] = v return dest...
harvester/tests
apiclient/harvester_api/managers/base.py
.py
acfa13c18d0440ec
7.56
12
#!/usr/bin/env python # See the NOTICE file distributed with this work for additional information # regarding copyright ownership. # # 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...
Ensembl/ensembl-genomio
cicd/scripts/check_flatfile.py
.py
4fac52ad503f61e7
7.52
10
#!env python3 # See the NOTICE file distributed with this work for additional information # regarding copyright ownership. # # 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....
Ensembl/ensembl-genomio
scripts/stable_id_alloc/osid_add_organisms.py
.py
868a5bae57b778dc
7.52
10
#!env python3 # See the NOTICE file distributed with this work for additional information # regarding copyright ownership. # # 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....
Ensembl/ensembl-genomio
scripts/stable_id_alloc/osid_check_organisms.py
.py
58f8f9ce900ae5cc
7.52
10
#!env python3 # See the NOTICE file distributed with this work for additional information # regarding copyright ownership. # # 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....
Ensembl/ensembl-genomio
src/python/ensembl/brc4/runnable/seqregion_parser.py
.py
24550fc924e9801e
7.52
10
# See the NOTICE file distributed with this work for additional information # regarding copyright ownership. # # 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/lic...
Ensembl/ensembl-genomio
src/python/ensembl/io/genomio/annotation/update_description.py
.py
67c910789e6f5e29
7.52
10
# See the NOTICE file distributed with this work for additional information # regarding copyright ownership. # # 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/lic...
Ensembl/ensembl-genomio
src/python/ensembl/io/genomio/assembly/download.py
.py
be154ef61eedd05e
7.52
10
# See the NOTICE file distributed with this work for additional information # regarding copyright ownership. # # 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/lic...
Ensembl/ensembl-genomio
src/python/ensembl/io/genomio/assembly/status.py
.py
86604745c8af19bc
7.52
10
"""Runtime-only micro-shim of py2many.result (see the package docstring). Provides the ``Result[T, E]`` (Ok/Error) types used by ``raft/live.py`` for fallible operations instead of exceptions. """ from dataclasses import dataclass from enum import IntEnum from typing import Generic, TypeVar, Union T = TypeVar("T") E...
adsharma/raft
py2many/result.py
.py
af0173a0561d2ab6
7.62
16
"""Runtime-only micro-shim of py2many.spec (see the package docstring). Pure Python mirror of the markers used by raft/core.py. Kept in sync with py2many.spec: the sentinel attributes are always False, so the ``if CHECKER.*:`` blocks are dead at runtime. """ class _Checker: pre = False post = False inva...
adsharma/raft
py2many/spec.py
.py
371a1341bb94f99c
8.12
16
import redis # type: ignore from .board import Board class RedisBoard(Board): """This will create a message board that is backed by Redis.""" def __init__(self, *args, **kwargs): """Creates the Redis connection.""" self.redis = redis.Redis(*args, **kwargs) def set_owner(self, owner): ...
adsharma/raft
raft/boards/redis_board.py
.py
62d3465fdec8b129
7.62
16
"""Runtime face of the verified core: ``Result[T, E]`` instead of exceptions. The pure decision predicates live in ``raft/core.py`` (transpiled to Lean and verified). This module wraps the *fallible* operations -- most notably out-of-bounds log access, which the live code otherwise indexes directly and would raise ``...
adsharma/raft
raft/live.py
.py
16712b2b38b09afc
7.62
16
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). You may // not use this file except in compliance with the License. A copy of the // License is located at // // http://aws.amazon.com/apache2.0/ // // or in the "license" file ...
aws-controllers-k8s/lambda-controller
pkg/resource/function/hooks_test.go
.go
bd34513f6a52917a
7.14
18
from __future__ import annotations from pygismeteo_base import models, responses, types from pygismeteo_base.endpoints.current import CurrentBase from aiopygismeteo._http import AiohttpClient class Current(CurrentBase[AiohttpClient]): """Текущая погода.""" __slots__ = () async def by_coordinates( ...
monosans/aiopygismeteo
src/aiopygismeteo/_endpoints/current.py
.py
99e8524c66a6729b
7.52
10
from __future__ import annotations from ipaddress import IPv4Address from pygismeteo_base import models, responses, types from pygismeteo_base.endpoints.search import SearchBase from aiopygismeteo._http import AiohttpClient class Search(SearchBase[AiohttpClient]): """Поиск.""" __slots__ = () async de...
monosans/aiopygismeteo
src/aiopygismeteo/_endpoints/search.py
.py
057604ca6f3b15f8
7.52
10
from __future__ import annotations from pygismeteo_base import models, responses, types from pygismeteo_base.endpoints.step24 import Step24Base from aiopygismeteo._http import AiohttpClient class Step24(Step24Base[AiohttpClient]): """Погода с шагом 24 часа.""" __slots__ = () async def by_coordinates( ...
monosans/aiopygismeteo
src/aiopygismeteo/_endpoints/step24.py
.py
ea1283eb849f2b93
7.52
10
from __future__ import annotations from pygismeteo_base import models, responses, types from pygismeteo_base.endpoints.step3 import Step3Base from aiopygismeteo._http import AiohttpClient class Step3(Step3Base[AiohttpClient]): """Погода с шагом 3 часа.""" __slots__ = () async def by_coordinates( ...
monosans/aiopygismeteo
src/aiopygismeteo/_endpoints/step3.py
.py
7d288ef8d11b2647
7.52
10
from __future__ import annotations from pygismeteo_base import models, responses, types from pygismeteo_base.endpoints.step6 import Step6Base from aiopygismeteo._http import AiohttpClient class Step6(Step6Base[AiohttpClient]): """Погода с шагом 6 часов.""" __slots__ = () async def by_coordinates( ...
monosans/aiopygismeteo
src/aiopygismeteo/_endpoints/step6.py
.py
cb4e2185f02e1f22
7.52
10
from __future__ import annotations from typing import Final from aiohttp import ClientSession from pydantic import AnyHttpUrl, validate_call from pygismeteo_base.types import Lang from typing_extensions import Self, final from aiopygismeteo._endpoints.current import Current from aiopygismeteo._endpoints.search impor...
monosans/aiopygismeteo
src/aiopygismeteo/_gismeteo.py
.py
b39fceaf52a62790
7.52
10
import json from os import environ from time import sleep from typing import TYPE_CHECKING, Any, NamedTuple from urllib.parse import urlparse from boto3 import Session from botocore.credentials import AssumeRoleCredentialFetcher, DeferredRefreshableCredentials, ReadOnlyCredentials from botocore.session import Session ...
linz/topo-imagery
packages/topo-imagery-common/src/topo_imagery_common/aws/aws_helper.py
.py
5169971681806bf6
7.62
16
import argparse import json from datetime import datetime from decimal import Decimal from typing import Any, NamedTuple import shapely.geometry from linz_logger import get_log from topo_imagery_common.datetimes import parse_rfc_3339_date from topo_imagery_common.files.fs import read class InputParameterError(Except...
linz/topo-imagery
packages/topo-imagery-common/src/topo_imagery_common/cli/cli_helper.py
.py
3894ced33df6760f
7.62
16
import os from concurrent.futures import Future, ThreadPoolExecutor from boto3 import client from linz_logger import get_log from topo_imagery_common.aws.aws_helper import is_s3 from topo_imagery_common.files import fs_local, fs_s3 from topo_imagery_common.files.checksum import multihash_as_hex def write(destination...
linz/topo-imagery
packages/topo-imagery-common/src/topo_imagery_common/files/fs.py
.py
d369cfab37b2f463
7.62
16
import os def write(destination: str, source: bytes) -> None: """Write the source to the local destination file. Args: destination: The local path to the file to write. source: The source file in bytes. """ os.makedirs(os.path.dirname(destination), mode=0o777, exist_ok=True) with ...
linz/topo-imagery
packages/topo-imagery-common/src/topo_imagery_common/files/fs_local.py
.py
b3d4fbaf427fe01e
7.62
16
from collections.abc import Generator from concurrent import futures from concurrent.futures import ThreadPoolExecutor from typing import TYPE_CHECKING, Any from boto3 import client from linz_logger import get_log from topo_imagery_common.aws.aws_helper import get_session, parse_path from topo_imagery_common.files imp...
linz/topo-imagery
packages/topo-imagery-common/src/topo_imagery_common/files/fs_s3.py
.py
889739ca4e53a96d
7.62
16
import os from pathlib import Path from shutil import rmtree from tempfile import mkdtemp from boto3 import client from moto import mock_aws from moto.s3.responses import DEFAULT_REGION_NAME from mypy_boto3_s3 import S3Client from pytest import CaptureFixture, raises from pytest_subtests import SubTests from topo_imag...
linz/topo-imagery
packages/topo-imagery-common/test/files/fs_test.py
.py
f7eea425bb75d771
7.12
16
from linz_logger import get_log from topo_imagery_gdal.gdal.gdal_helper import gdal_info from topo_imagery_gdal.gdal.gdal_presets import CompressionPreset from topo_imagery_gdal.gdal.gdalinfo import GdalInfo, GdalInfoBand # Unsupported RGBNIR band types(eg. Int16, Int32) are rejected by check_band_type_is_supported()....
linz/topo-imagery
packages/topo-imagery-gdal/src/topo_imagery_gdal/gdal/gdal_bands.py
.py
ef5c4b69f65de2da
7.62
16
from __future__ import annotations from decimal import Decimal from linz_logger import get_log from topo_imagery_common.epsg import EpsgNumber from topo_imagery_gdal.gdal.gdal_bands import get_gdal_band_offset, is_high_bit_depth_band_type from topo_imagery_gdal.gdal.gdal_presets import ( BASE_COG, COMPRESS_LZ...
linz/topo-imagery
packages/topo-imagery-gdal/src/topo_imagery_gdal/gdal/gdal_commands.py
.py
12db201d6fd6cfb4
7.62
16
import json import os import subprocess from shutil import rmtree from tempfile import mkdtemp from typing import cast from linz_logger import get_log from topo_imagery_common.aws.aws_helper import is_s3 from topo_imagery_common.epsg import EpsgNumber from topo_imagery_common.files.files_helper import get_file_name_fr...
linz/topo-imagery
packages/topo-imagery-gdal/src/topo_imagery_gdal/gdal/gdal_helper.py
.py
683e94c1a287e72f
7.62
16
from decimal import Decimal from enum import Enum from typing import Annotated DEFAULT_NO_DATA_VALUE: Annotated[Decimal, "From the New Zealand National Aerial LiDAR Base Specification"] = Decimal(-9999) SCALE_254_ADD_NO_DATA = ["-scale", "0", "255", "0", "254", "-a_nodata", "255"] """ Scale imagery from 0-255 to 0-25...
linz/topo-imagery
packages/topo-imagery-gdal/src/topo_imagery_gdal/gdal/gdal_presets.py
.py
4cfb7cea074fed14
7.62
16
from typing import Any, TypedDict from topo_imagery_gdal.tile.tile_index import Point class GdalInfoBandColorTable(TypedDict): palette: str """Colour palette type Example: "RGB" """ count: int """Count of entries in the colour palette Example: 256""" entries: list[list[int]] """List o...
linz/topo-imagery
packages/topo-imagery-gdal/src/topo_imagery_gdal/gdal/gdalinfo.py
.py
8bb23b6959138f65
7.62
16
from __future__ import annotations import os import tempfile from dataclasses import dataclass from decimal import Decimal from functools import partial from multiprocessing import Pool from linz_logger import get_log from tifffile import TiffFile from topo_imagery_common.aws.aws_helper import is_s3 from topo_imagery...
linz/topo-imagery
packages/topo-imagery-gdal/src/topo_imagery_gdal/standardising.py
.py
4ebc4d1b09da69ce
7.62
16
import json import os from decimal import Decimal from enum import Enum from typing import Any from urllib.parse import unquote from topo_imagery_gdal.gdal.gdal_helper import GDALExecutionException, gdal_info, run_gdal from topo_imagery_gdal.gdal.gdal_presets import DEFAULT_NO_DATA_VALUE, CompressionPreset from topo_i...
linz/topo-imagery
packages/topo-imagery-gdal/src/topo_imagery_gdal/tiff/file_tiff.py
.py
cb160af3a857ba0f
7.62
16
import re from typing import NamedTuple from topo_imagery_common.epsg import EpsgNumber from topo_imagery_gdal.tile.util import charcodeat SHEET_WIDTH = 24_000 """ Width of Topo 1:50k mapsheets (meters) """ SHEET_HEIGHT = 36_000 """ Height of Topo 1:50k mapsheets (meters) """ SHEET_ORIGIN_LEFT = 988_000 """ The NZTM ...
linz/topo-imagery
packages/topo-imagery-gdal/src/topo_imagery_gdal/tile/tile_index.py
.py
50f506b4d82d583c
7.62
16
import pytest from pytest_subtests import SubTests from tile_index_data import CHATHAM_SHEET_DATA, MAP_SHEET_DATA from topo_imagery_common.epsg import EpsgNumber from topo_imagery_gdal.tile.tile_index import ( Bounds, Point, Size, get_bounds_from_name, get_chatham_mapsheet_offset, get_mapsheet_o...
linz/topo-imagery
packages/topo-imagery-gdal/test/tile/tile_index_test.py
.py
64524cb0fde00e91
7.12
16
from topo_imagery_pdal.pdal_commands import get_pdal_command def test_check_pdal_command() -> None: """ tests that the pdal command is built correctly """ pdal_command = get_pdal_command("info", ["--option1", "value1", "--option2", "value2"]) assert pdal_command == ["info", "--option1", "value1", ...
linz/topo-imagery
packages/topo-imagery-pdal/test/pdal_commands_test.py
.py
ed71495c8b18a668
8.12
16
from __future__ import annotations from pygismeteo_base import models, responses, types from pygismeteo_base.endpoints.current import CurrentBase from pygismeteo._http import HttpxClient class Current(CurrentBase[HttpxClient]): """Текущая погода.""" __slots__ = () def by_coordinates( self, lat...
monosans/pygismeteo
src/pygismeteo/_endpoints/current.py
.py
8943a080e1a4769b
7.52
10
from __future__ import annotations from ipaddress import IPv4Address from pygismeteo_base import models, responses, types from pygismeteo_base.endpoints.search import SearchBase from pygismeteo._http import HttpxClient class Search(SearchBase[HttpxClient]): """Поиск.""" __slots__ = () def by_coordina...
monosans/pygismeteo
src/pygismeteo/_endpoints/search.py
.py
6ab0ace4e33c53b8
7.52
10
from __future__ import annotations from pygismeteo_base import models, responses, types from pygismeteo_base.endpoints.step24 import Step24Base from pygismeteo._http import HttpxClient class Step24(Step24Base[HttpxClient]): """Погода с шагом 24 часа.""" __slots__ = () def by_coordinates( self,...
monosans/pygismeteo
src/pygismeteo/_endpoints/step24.py
.py
aa6a82afe2e6fc95
7.52
10
from __future__ import annotations from pygismeteo_base import models, responses, types from pygismeteo_base.endpoints.step3 import Step3Base from pygismeteo._http import HttpxClient class Step3(Step3Base[HttpxClient]): """Погода с шагом 3 часа.""" __slots__ = () def by_coordinates( self, ...
monosans/pygismeteo
src/pygismeteo/_endpoints/step3.py
.py
9d4c3001940a8fcf
7.52
10
from __future__ import annotations from pygismeteo_base import models, responses, types from pygismeteo_base.endpoints.step6 import Step6Base from pygismeteo._http import HttpxClient class Step6(Step6Base[HttpxClient]): """Погода с шагом 6 часов.""" __slots__ = () def by_coordinates( self, ...
monosans/pygismeteo
src/pygismeteo/_endpoints/step6.py
.py
81f40f27e2e64068
7.52
10
from __future__ import annotations from typing import Final from httpx2 import Client from pydantic import AnyHttpUrl, validate_call from pygismeteo_base.types import Lang from typing_extensions import Self, final from pygismeteo._endpoints.current import Current from pygismeteo._endpoints.search import Search from ...
monosans/pygismeteo
src/pygismeteo/_gismeteo.py
.py
5245410b753137a3
7.52
10
#!/usr/bin/env python """ Produce a phase-resolved dynamic spectrum plot for a given folding period. Reads folding parameters from a YAML config file, loads the target filterbank, folds each spectral channel time series using the riptide FFA library, and saves a grayscale phase-resolved spectrum plot. Example Usage -...
UCBerkeleySETI/blipss
blipss/cli/compute_phase_resolved_ds.py
.py
f5d2ed512d78822e
7.62
16
#!/usr/bin/env python """ Inject a periodic signal of known properties into a real-world filterbank data file. Reads injection parameters from a YAML config file, loads the target filterbank, injects one or more channel-wide boxcar pulse trains calibrated to the local bandpass statistics, and writes the result as a .f...
UCBerkeleySETI/blipss
blipss/cli/inject_signal.py
.py
45fd7a8dfa2c2dff
7.62
16
#!/usr/bin/env python """ Generate a synthetic filterbank file containing periodic signals on a Gaussian white noise background. Reads simulation parameters from a YAML config file, injects one or more channel-wide boxcar pulse trains at specified periods and duty cycles, and writes the result as a 32-bit sigproc filt...
UCBerkeleySETI/blipss
blipss/cli/simulate_data.py
.py
3395c1fcc6aa1794
7.62
16
""" Atomic data-manipulation routines for the phase-resolved dynamic spectrum pipeline. These functions implement the internal ``(n_channels, n_samples)`` array representation: 1. ``extract_waterfall_metadata``: Pull start MJD, tsamp, and frequency axis from a Waterfall header. 2. ``align_band_orientation``: Flip dat...
UCBerkeleySETI/blipss
blipss/core/compute_phase_resolved_ds.py
.py
bf7a96f14cbf9f10
7.62
16
""" Utilities for identifying and labeling harmonic and sub-harmonic relationships among a set of candidate periods. Terminology ----------- Given a fundamental period p0: - The (N-1)th **harmonic** of p0 is a period P such that ``P ≈ p0 / N`` (N >= 2). - The (N-1)th **sub-harmonic** of p0 is a period P such that ``...
UCBerkeleySETI/blipss
blipss/core/harmonic_detection.py
.py
dc95a65950144e74
7.62
16
""" Atomic data-manipulation routines for the real-data signal-injection pipeline. These functions operate on the internal ``(n_channels, n_samples)`` array representation used throughout the inject_signal pipeline: 1. ``extract_data_array`: Load a ``Waterfall`` object into the internal layout. 2. ``compute_median_ba...
UCBerkeleySETI/blipss
blipss/core/inject_signal.py
.py
6ae206b5f0c8c137
7.62
16
"""Core logic for selecting and folding periodicity candidates for verification plots.""" from collections.abc import Sequence import numpy as np import numpy.typing as npt from riptide import Periodogram, TimeSeries, ffa_search def select_candidates_by_code( cand_channels: npt.NDArray[np.intp], cand_period...
UCBerkeleySETI/blipss
blipss/core/plot_cands.py
.py
5468ba08f76f5fee
7.62
16
"""Atomic data-generation and signal-injection routines for synthetic filterbank simulation""" import numpy as np import numpy.typing as npt def generate_white_noise_background( n_channels: int, n_samples: int, rng: np.random.Generator | None = None, ) -> npt.NDArray[np.float64]: """ Generate a 2...
UCBerkeleySETI/blipss
blipss/core/simulate_data.py
.py
dd89ac3586ac0239
7.62
16
""" Filterbank write utilities for both synthetic and real-data pipelines. Two write paths are provided: - ``write_filterbank``: writes a raw numpy array produced by the *simulate_data* pipeline directly to a ``.fil`` file by serialising a sigproc header followed by the raw float32 samples. - ``write_waterfall``...
UCBerkeleySETI/blipss
blipss/io/write_filterbank.py
.py
d1b94c5693ac215b
7.62
16
"""Shared base class for blipss config models.""" from typing import Any from pydantic import BaseModel, model_validator class BlipssConfigModel(BaseModel): """Base for config models where a blank/null YAML field is treated as absent, falling back to the field's declared default.""" @model_validator(mode="...
UCBerkeleySETI/blipss
blipss/models/base.py
.py
dd1bf80bb20d6815
7.62
16
"""Pydantic models for validating input configs read from config/inject_signal.yaml""" from pathlib import Path from pydantic import Field, field_validator, model_validator from blipss.constants import FILTERBANK_EXTENSIONS from blipss.models.base import BlipssConfigModel from blipss.models.simulate_data import Peri...
UCBerkeleySETI/blipss
blipss/models/inject_signal.py
.py
69098e0d09a02406
7.62
16
"""Pydantic models for validating input configs read from config/plot_cands.yaml""" from pathlib import Path from pydantic import Field, model_validator from blipss.models.base import BlipssConfigModel from blipss.models.run_ffa_search import FfaSearchConfig, ResourceConfig class InputDataConfig(BlipssConfigModel)...
UCBerkeleySETI/blipss
blipss/models/plot_cands.py
.py
eef36f896c7d8549
7.62
16
"""General filesystem utility functions""" from pathlib import Path def ensure_path_exists(path: Path) -> None: """ Create a directory at the given path, handling file and missing-parent cases. If the path already exists as a directory, returns immediately. If the path points to an existing file, cr...
UCBerkeleySETI/blipss
blipss/utils/general_utils.py
.py
31f9a92f1b4fbe15
7.62
16
"""aha custom component.""" from dataclasses import dataclass import homeassistant.helpers.config_validation as cv from homeassistant import core from homeassistant.config_entries import ConfigEntry from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.aiohttp_client import async_get_cli...
flabbamann/aha_region
custom_components/aha_region/__init__.py
.py
8bdad8577a77f6ee
7.66
20
"""update coordinator for aha custom component.""" import asyncio import re from datetime import date, datetime, timedelta from aiohttp import ClientSession, ClientTimeout from bs4 import BeautifulSoup from homeassistant.core import HomeAssistant from homeassistant.helpers.update_coordinator import DataUpdateCoordina...
flabbamann/aha_region
custom_components/aha_region/coordinator.py
.py
4f58a43d7fd85904
7.66
20
"""aha sensor platform.""" from collections.abc import Callable, Mapping import homeassistant.helpers.config_validation as cv import voluptuous as vol from homeassistant.components.sensor import ( PLATFORM_SCHEMA, SensorDeviceClass, SensorEntity, ) from homeassistant.config_entries import ConfigEntry from...
flabbamann/aha_region
custom_components/aha_region/sensor.py
.py
d9082e636b63d218
7.66
20
"""Tests for coordinator.""" from pathlib import Path from unittest.mock import AsyncMock import pytest from custom_components.aha_region.coordinator import AhaApi STREET_OPTION_VALUE = "00152@Am Küchengarten / Linden-Mitte@Linden-Mitte" STREET_OPTION_LABEL = "Am Küchengarten / Linden-Mitte" FORM_HTML = f""" <html...
flabbamann/aha_region
tests/test_coordinator.py
.py
3c83c9b3d2e6e4fe
7.16
20
"""Test sensor.""" from unittest.mock import AsyncMock, MagicMock, patch import pytest from custom_components.aha_region import sensor @pytest.mark.asyncio async def test_async_setup_platform_success(): """Test async_setup_platform adds entities when coordinator returns data.""" hass = MagicMock() asyn...
flabbamann/aha_region
tests/test_sensor.py
.py
3761a42b4ce6ae5d
8.16
20
"""Dummy tripper backend for testing loading a custom backend.""" # pylint: disable=unused-argument class DummyStrategy: """Dummy strategy.""" def __init__(self, base_iri=None, **kwargs): """Initialise triplestore.""" def triples(self, triple): """Returns a generator over matching tripl...
EMMC-ASBL/tripper
tests/backends/dummy.py
.py
0e0a0f3bc998f3f8
8.09
14
""" A general test for all backends supporting SPARQL. Note that this test expects that that you have a Fuseki and a graphDB instance running. See https://emmc-asbl.github.io/tripper/latest/developers/ """ from pathlib import Path import pytest from tripper import Session pytest.importorskip("pyld") thisdir = Pa...
EMMC-ASBL/tripper
tests/backends/test_backends_sparql.py
.py
cf0a6ec420a3e5be
8.09
14
"""Test collection.""" def test_collection(): """Test if we can use a DLite collection as backend.""" import pytest dlite = pytest.importorskip("dlite") # pylint: disable=unused-variable from tripper import DM, EMMO, MAP, XSD, Literal, Triplestore from tripper.utils import en ts = Triplesto...
EMMC-ASBL/tripper
tests/backends/test_collection.py
.py
453f74bd95a23c42
7.09
14
"""Test rdflib backend. Most of the rdflib backend is already tested in tests/test_triplestore.py. """ # pylint: disable=invalid-name def test_rdflib_backend(): """Test rdflib backend.""" import pytest pytest.importorskip("rdflib") from tripper import RDFS, Literal, Triplestore ts = Triplesto...
EMMC-ASBL/tripper
tests/backends/test_rdflib.py
.py
15783c5833f8593d
7.09
14
"""Test SPARQLwrapper backend.""" # pylint: disable=invalid-name def test_sparqlwrapper_backend(): """Test SPARQLwrapper backend.""" import urllib import pytest pytest.importorskip("SPARQLWrapper") requests = pytest.importorskip("requests") from tripper import Triplestore # Requires i...
EMMC-ASBL/tripper
tests/backends/test_sparqlwrapper.py
.py
e25a1f5890d1d1d1
7.09
14
"""Pytest configuration and fixtures.""" from typing import TYPE_CHECKING import pytest if TYPE_CHECKING: from pathlib import Path from typing import Any, Callable @pytest.fixture(scope="session") def get_ontology_path() -> "Callable[[str], Path]": """Return a function to retrieve a Path object to a Tu...
EMMC-ASBL/tripper
tests/conftest.py
.py
d3e7dd6abc11059f
8.09
14
"""Test context module.""" import pytest pytest.importorskip("pyld") # pylint: disable=wrong-import-position from tripper.datadoc.context import Context, get_context # A fixture used by all the tests ctx = Context() def test_copy(): """Test copy() method.""" copy = ctx.copy() assert id(copy) != id(ctx...
EMMC-ASBL/tripper
tests/datadoc/test_context.py
.py
c769993f4eaee49c
8.09
14
"""Test the dataaccess module.""" # pylint: disable=invalid-name,too-many-locals,duplicate-code import pytest pytest.importorskip("yaml") pytest.importorskip("requests") pytest.importorskip("pyld") def test_save_and_load(): """Test save() and load().""" # pylint: disable=too-many-statements from datas...
EMMC-ASBL/tripper
tests/datadoc/test_dataaccess.py
.py
a2640f43b4d76bf5
7.09
14
"""Test the datadoc clitool.""" import pytest pytest.importorskip("yaml") pytest.importorskip("rdflib") pytest.importorskip("SPARQLWrapper") pytest.importorskip("pyld") from tripper.datadoc.clitool import ( # pylint: disable=wrong-import-position maincommand, ) from tripper.utils import ( # pylint: disable=wro...
EMMC-ASBL/tripper
tests/datadoc/test_datadoc_cli.py
.py
19585c5b49372dfd
7.09
14
"""Test the tripper.datadoc.utils module.""" import pytest # This annoying dependency is injected by pytest. # We can only get rid of it by moving the tripper.datadoc.utils out of the # datadoc folder. pytest.importorskip("pyld") def test_merge(): """Test help-function merge().""" from tripper.datadoc.utils...
EMMC-ASBL/tripper
tests/datadoc/test_datadoc_utils.py
.py
1aad89575831cbd4
8.09
14
"""Test the TableDoc class.""" import pytest pytest.importorskip("pyld") def test_asdicts(): """Test the asdicts() method.""" pytest.importorskip("rdflib") from tripper import IANA, Triplestore from tripper.datadoc import TableDoc td = TableDoc( headers=[ "@id", ...
EMMC-ASBL/tripper
tests/datadoc/test_tabledoc.py
.py
f324927fb14c637c
7.09
14
"""Test cost.""" def test_cost(): """Test cost""" # pylint: disable=invalid-name import pytest pytest.importorskip("rdflib") # pylint: disable=wrong-import-position from tripper import Triplestore ts = Triplestore(backend="rdflib") # Define some prefixed namespaces CHEM = ts.b...
EMMC-ASBL/tripper
tests/mappings/test_cost.py
.py
41b6acc0ed8dbdac
8.09
14
"""Test mapping function.""" def test_mapping(): """Test mapping function. We have two data sources: - literal number 3.2 mapped to ex:A - vector mapped to ex:B We also have two mapping functions; first() and sum() - first(): ex:B[0] -> ex:C - sum(): ex:A + ex:C -> ex:D The ...
EMMC-ASBL/tripper
tests/mappings/test_function.py
.py
058dbebbcb7803e3
8.09
14
#!/usr/bin/env python """Test mappings.""" # pylint: disable=invalid-name import pytest def test_mappings(): """Test mappings. Uses rdflib as backend """ pytest.importorskip("rdflib") from tripper import Triplestore from tripper.mappings import mapping_routes ts = Triplestore(backend=...
EMMC-ASBL/tripper
tests/mappings/test_mappings.py
.py
18342d5cd5d08d6a
7.09
14
"""Test Triplestore.add_function()""" # pylint: disable=invalid-name,import-outside-toplevel def test_add_function(): """Test add_function()""" import pytest pytest.importorskip("rdflib") from tripper import Triplestore from tripper.utils import function_id def func(a, b): """Return...
EMMC-ASBL/tripper
tests/test_add_function.py
.py
2bba9ad48763bb32
7.09
14
"""Test Triplestore.eval_function()""" # pylint: disable=import-outside-toplevel import pytest def eval_function(): """Test Triplestore.eval_function()""" from tripper import Triplestore pytest.importorskip("rdflib") def func(a, b): """Returns the sum of `a` and `b`.""" # pylint: ...
EMMC-ASBL/tripper
tests/test_eval_function.py
.py
f48fbaa77916ec3e
8.09
14
"""Test Triplestore.get_data() and related methods.""" # pylint: disable=unused-argument,invalid-name,import-outside-toplevel def test_get_data(): """Test get_data()""" import pytest np = pytest.importorskip("numpy") from tripper import Literal, Tripper from tripper.mappings import Value d...
EMMC-ASBL/tripper
tests/test_get_data.py
.py
6b3197da35dc8cce
8.09
14