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
"""Training a single gated model and scoring it on held-out data. The original pipeline reported feature weights with no accompanying measure of whether the model had learned anything -- a network that failed to fit still emitted a full set of importances. :func:`train_one` always returns test-set metrics alongside t...
AkandaAshraf/DeepFeatSelection
deepfeatselect/train.py
.py
6f2330bd3d003eab
7
0
"""Did the model understand the structure, or memorise the rows? Validation loss cannot tell those apart. A network that fits 4200 rows perfectly and generalises nothing, and one that never fit anything, both report a validation loss at chance -- and every scaling experiment in this project recorded only that number. ...
AkandaAshraf/DeepFeatSelection
deepfeatselect/understanding.py
.py
62d4664780a04db4
7
0
"""One table: every dataset audited so far, same statistics, same thresholds. The individual audits each answer "is this ranking identifiable", but the interesting result only appears when they are put beside each other. Ordered by how the columns came to exist rather than by subject matter, they separate cleanly, and...
AkandaAshraf/DeepFeatSelection
scripts/audit_comparison.py
.py
630d7a1a315fed41
7
0
"""Screen chamber datasets against the fitness gate, across a decimation grid. Pre-registration: paper/dataset_fitness_protocol.md and its 2026-08-23 addendum, committed before any lag_info was computed on the new data. The pass mark is unchanged and calibrated: L50 = +0.0136, the value measured on the weakest couple...
AkandaAshraf/DeepFeatSelection
scripts/chamber_screen.py
.py
174aa397dd09aec7
7
0
#!/usr/bin/env python3 """Example script for a dataset provider to submit metadata and data location records to the SOLARNET Virtual Observatory (SVO) RESTful API""" import os import sys import argparse import logging from datetime import datetime from urllib.parse import urljoin from dateutil.parser import parse, Pars...
bmampaey/SOLARNET-provider-tools
astro_su_se/submit_record.py
.py
d3539c45d3f7b492
7
0
#!/usr/bin/env python3 from unittest import TestCase, mock, main from pathlib import Path from submit_record import Record, DATE_KEYWORD class TestSubmiRecord(TestCase): '''Test the submit_record script''' def setUp(self): super().setUp() self.test_file = str(Path(__file__).parent / 'test_file.fits') def te...
bmampaey/SOLARNET-provider-tools
astro_su_se/test_submit_record.py
.py
bcb4c2d59cc265ec
7.5
0
#!/usr/bin/env python3 import argparse import json import logging import os import pickle import re import string from collections import Counter, defaultdict from datetime import datetime import astropy.io.fits import dateutil.parser # Default keywords to exclude DEFAULT_EXCLUDE_KEYWORDS = ['DATASUM', 'CHECKSUM', 'S...
bmampaey/SOLARNET-provider-tools
extra/extract_keywords_from_fits.py
.py
58c069df4de7e4c0
7
0
#!/usr/bin/env python3 import argparse import json import logging import re import pyvo class KeywordInspector: """Inspect the columns of of a TAP service table, and build the information needed for the SVO""" # Conversion from VOtable datatype to SVO keyword type # See https://www.ivoa.net/documents/VOTable/201...
bmampaey/SOLARNET-provider-tools
extra/extract_keywords_from_tap.py
.py
35b3f6467028538b
7
0
__all__ = ['DataLocation'] class DataLocation: """Base class for building data_location resource payloads. Subclasses are expected to override the getter methods of the payload fields (`file_url`, `file_size`, `file_path`, `thumbnail_url`, `offline`) for the specific data source (e.g. a remote URL, a TAP record,...
bmampaey/SOLARNET-provider-tools
provider_tools/data_locations/data_location.py
.py
3a67cbf5e38cdbd2
7
0
import os from urllib.parse import urljoin from .data_location import DataLocation __all__ = ['DataLocationFromLocalFile'] class DataLocationFromLocalFile(DataLocation): """Build a data_location payload from a local file. Attributes: BASE_FILE_PATH (str): Base path used to derive the relative file path. BASE...
bmampaey/SOLARNET-provider-tools
provider_tools/data_locations/data_location_from_local_file.py
.py
a2dfbd3789e95420
7
0
from .data_location import DataLocation __all__ = ['DataLocationFromTapRecord'] class DataLocationFromTapRecord(DataLocation): """Build a data_location payload from an EPN-TAP record.""" def __init__(self, tap_record, **kwargs): """Initialize the data location from a TAP record. Args: tap_record (Mapping)...
bmampaey/SOLARNET-provider-tools
provider_tools/data_locations/data_location_from_tap_record.py
.py
36fa77d5fa61755d
7
0
import requests from .data_location import DataLocation __all__ = ['DataLocationFromUrl'] class DataLocationFromUrl(DataLocation): """Build a data_location payload for a file hosted at a remote URL. Attributes: BASE_FILE_URL (str): Base URL to derive the relative file path. """ # The base file URL to build ...
bmampaey/SOLARNET-provider-tools
provider_tools/data_locations/data_location_from_url.py
.py
a406712b6499307c
7
0
import datetime import numbers __all__ = ['Metadata'] class Metadata: """Base class for building metadata resource payloads. Subclasses must implement [`extract_field_value`][provider_tools.metadatas.Metadata.extract_field_value] to define how a field's value is pulled from their particular source data (e.g. a T...
bmampaey/SOLARNET-provider-tools
provider_tools/metadatas/metadata.py
.py
ae5c64497098fbc1
7
0
import dateutil.parser from .metadata import Metadata __all__ = ['MetadataFromFitsHeader'] class MetadataFromFitsHeader(Metadata): """Build metadata payloads from FITS header values. Extracts field values by looking up each keyword's verbose name in the FITS header, converting the value to the type expected by ...
bmampaey/SOLARNET-provider-tools
provider_tools/metadatas/metadata_from_fits_header.py
.py
f9631c013d1f09b6
7
0
import astropy import dateutil.parser from .metadata import Metadata __all__ = ['MetadataFromTapRecord'] class MetadataFromTapRecord(Metadata): """Build metadata payloads from an EPN-TAP record. Extracts field values by looking up each keyword's verbose name in the TAP record, converting the value to the type e...
bmampaey/SOLARNET-provider-tools
provider_tools/metadatas/metadata_from_tap_record.py
.py
37f5027995dde863
7
0
import requests from ..data_locations import DataLocationFromUrl from ..metadatas import MetadataFromFitsHeader from ..utils import get_fits_header_from_url from .provider import Provider __all__ = ['ProviderFromFitsUrl'] class ProviderFromFitsUrl(Provider): """Extract the metadata and data_location resource paylo...
bmampaey/SOLARNET-provider-tools
provider_tools/providers/provider_from_fits_url.py
.py
59bb9be96579ed10
7
0
from ..data_locations import DataLocationFromLocalFile from ..metadatas import MetadataFromFitsHeader from ..utils import get_fits_header_from_local_file from .provider import Provider __all__ = ['ProviderFromLocalFitsFile'] class ProviderFromLocalFitsFile(Provider): """Extract the metadata and data_location resour...
bmampaey/SOLARNET-provider-tools
provider_tools/providers/provider_from_local_fits_file.py
.py
e564f9c8447457d7
7
0
from ..data_locations import DataLocationFromTapRecord from ..metadatas import MetadataFromTapRecord from .provider import Provider __all__ = ['ProviderFromTapRecord'] class ProviderFromTapRecord(Provider): """Extract the metadata and data_location resource payloads for TAP records. Attributes: METADATA_CLASS (...
bmampaey/SOLARNET-provider-tools
provider_tools/providers/provider_from_tap_record.py
.py
8ee690b93bff1d25
7
0
import http.client import slumber import yaml from .utils import JsonSerializer __all__ = ['RESTfulApi'] # URL of the SVO RESTful API SVO_API_URL = 'https://solarnet.oma.be/service/api/svo' class RESTfulApi(slumber.API): """RESTful API interface for the SVO. Args: username (str, optional): SVO username. Cann...
bmampaey/SOLARNET-provider-tools
provider_tools/restful_api.py
.py
5cfd10ac62aa74e7
7
0
import datetime import glob import io import logging import os import urllib.parse import zlib import astropy.io.fits import dateutil.parser import htmllistparse import pyvo import requests import simplejson import slumber __all__ = [ 'parse_date_time_string', 'iter_files', 'iter_urls', 'iter_tap_records', 'get_...
bmampaey/SOLARNET-provider-tools
provider_tools/utils.py
.py
777d5fbc38cb910b
7
0
#!/usr/bin/env python3 """Script to extract metadata from the AIA level 1.5 archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from datetime import timedelta from pathlib import Path from urllib.parse import urljoin # HACK to make sure the provider_tools package is ...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_aia_level_1_5.py
.py
c407b89646a854c5
7
0
#!/usr/bin/env python3 """Script to extract metadata from the AIA level 2 archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from datetime import timedelta from pathlib import Path # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(_...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_aia_level_2.py
.py
e11b66bc39545420
7
0
#!/usr/bin/env python3 """Script to extract metadata from the ASPIICS level 2 archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from pathlib import Path, PurePosixPath # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__).res...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_aspiics_level_2.py
.py
c8c3fde0faca25b7
7
0
#!/usr/bin/env python3 """Script to extract metadata from the ASPIICS level 2 archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from pathlib import Path, PurePosixPath # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__).res...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_aspiics_level_3.py
.py
0d5981436ec1663b
7
0
#!/usr/bin/env python3 """Script to extract metadata from the Leibniz-KIS TAP service and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from pathlib import Path # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__).resolve().parent.p...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_chrotel_level_1.py
.py
548ee5b26ba4e4e7
7
0
#!/usr/bin/env python3 """Script to extract metadata from the EIT archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from datetime import timedelta from pathlib import Path # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__)...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_eit_level_0.py
.py
088545b2b212dcc1
7
0
#!/usr/bin/env python3 """Script to extract metadata from the MEDOC TAP serviceand submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from pathlib import Path import requests # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__).resolve(...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_eit_synoptic.py
.py
07b69a35772d0b5f
7
0
#!/usr/bin/env python3 """Script to extract metadata from the EUI archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from datetime import timedelta from pathlib import Path, PurePosixPath # HACK to make sure the provider_tools package is findable sys.path.append(str...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_eui_level_1.py
.py
61854c6e050bf356
7
0
#!/usr/bin/env python3 """Script to extract metadata from the EUI archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from datetime import timedelta from pathlib import Path, PurePosixPath # HACK to make sure the provider_tools package is findable sys.path.append(str...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_eui_level_2.py
.py
5e2a2f5983c6bc15
7
0
#!/usr/bin/env python3 """Script to extract metadata from the EUVI archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from pathlib import Path # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__).resolve().parent.parent)) fro...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_euvi_level_0.py
.py
7a2aa61006e68706
7
0
#!/usr/bin/env python3 """Script to extract metadata from the MEDOC TAP serviceand submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from pathlib import Path import requests # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__).resolve(...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_gaia_dem.py
.py
25ac03fe32b46a8f
7
0
#!/usr/bin/env python3 """Script to extract metadata from the Leibniz-KIS TAP service and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from pathlib import Path # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__).resolve().parent.p...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_gris_level_1.py
.py
f2a5346accfb8f1c
7
0
#!/usr/bin/env python3 """Script to extract metadata from the AIA level 2 archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from pathlib import Path # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__).resolve().parent.paren...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_hmi_magnetogram_level_1_5.py
.py
c3ebc3953a95d352
7
0
#!/usr/bin/env python3 """Script to extract metadata from the Leibniz-KIS TAP service and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from pathlib import Path # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__).resolve().parent.p...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_lars_level_1.py
.py
537626be82c92649
7
0
#!/usr/bin/env python3 """Script to extract metadata from the LYRA archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from pathlib import Path # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__).resolve().parent.parent)) fro...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_lyra_level_2.py
.py
55ca1cf3308c1144
7
0
#!/usr/bin/env python3 """Script to extract metadata from the LYRA archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from pathlib import Path # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__).resolve().parent.parent)) fro...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_lyra_level_3.py
.py
77e04d6a6b5f695b
7
0
#!/usr/bin/env python3 """Script to extract metadata from the SPoCA Coronal Hole archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from pathlib import Path # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__).resolve().paren...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_spoca_coronal_hole.py
.py
1ef11115f7a471c5
7
0
#!/usr/bin/env python3 """Script to extract metadata from the SWAP archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from datetime import timedelta from pathlib import Path # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_swap_level_1.py
.py
22c4f6e5d54f20d3
7
0
#!/usr/bin/env python3 """Script to extract metadata from the USET archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from datetime import timedelta from pathlib import Path, PurePosixPath # HACK to make sure the provider_tools package is findable sys.path.append(st...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_uset_calciumii_k_level_1.py
.py
e0ee8da732234e53
7
0
#!/usr/bin/env python3 """Script to extract metadata from the USET archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from datetime import timedelta from pathlib import Path, PurePosixPath # HACK to make sure the provider_tools package is findable sys.path.append(st...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_uset_h_alpha_level_1.py
.py
21237b8ace1f5fb4
7
0
#!/usr/bin/env python3 """Script to extract metadata from the USET archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from datetime import timedelta from pathlib import Path, PurePosixPath # HACK to make sure the provider_tools package is findable sys.path.append(st...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_uset_white_light_level_1.py
.py
4802a3804bfc9b24
7
0
#!/usr/bin/env python3 """Script to extract metadata from the XRT online archive and submit it to the SOLARNET Virtual Observatory""" import argparse import logging import sys from pathlib import Path # HACK to make sure the provider_tools package is findable sys.path.append(str(Path(__file__).resolve().parent.parent...
bmampaey/SOLARNET-provider-tools
sidc_oma_be/submit_metadata_xrt_level_1.py
.py
82b91608f5ead127
7
0
#!/usr/bin/env python3 from tempfile import NamedTemporaryFile from unittest import TestCase, main from requests import Request from provider_tools.restful_api import ApiKeyAuth, RESTfulApi class TestRESTfulApi(TestCase): """Test the RESTfulApi class""" def setUp(self): super().setUp() self.username = 'usern...
bmampaey/SOLARNET-provider-tools
tests/test_restful_api.py
.py
e3adbf7968072e57
7.5
0
"""`create_api_reference_docs` task. Create Python API reference in the documentation. This is specifically to be used with the MkDocs and mkdocstrings framework. """ from __future__ import annotations import logging import os import re import shutil import sys from collections import defaultdict from pathlib import...
SINTEF/ci-cd
ci_cd/tasks/api_reference_docs.py
.py
52db6a38001d39c6
7.15
1
"""Relevant tools for printing to the console.""" from __future__ import annotations import platform from enum import Enum from typing import TYPE_CHECKING if TYPE_CHECKING: # pragma: no cover from typing_extensions import Self class Emoji(str, Enum): """Unicode strings for certain emojis.""" def __n...
SINTEF/ci-cd
ci_cd/utils/console_printing.py
.py
8943f3e17e444791
7.15
1
"""Generate SOFT7 entity instances based on basic information: 1. Data source (DB, File, Webpage, ...). 2. Generic data source parser. 3. Data source parser configuration. 4. SOFT7 entity (data model). Parts 2 and 3 are together considered to produce the "specific parser". Parts 1 through 3 are provided through a sin...
SINTEF/soft7
s7/factories/datasource_factory.py
.py
00d39ff1a6cc269e
7.35
4
"""Pydantic data models for the SOFT7 OTEAPI plugin.""" from __future__ import annotations from typing import Annotated, Any, Literal from oteapi.models import AttrDict from oteapi.strategies.mapping.mapping import MappingStrategyConfig from pydantic import Field, field_validator from s7.exceptions import EntityNot...
SINTEF/soft7
s7/oteapi_plugin/models.py
.py
f6eb3a1c5c192470
7.35
4
"""Strategy class for application/yaml.""" from __future__ import annotations from typing import Annotated, Literal import yaml from oteapi.datacache import DataCache from oteapi.models import ( AttrDict, DataCacheConfig, HostlessAnyUrl, ParserConfig, ResourceConfig, ) from oteapi.plugins import ...
SINTEF/soft7
s7/oteapi_plugin/yaml_parser.py
.py
d7252fc36d9bc6ad
7.35
4
"""Everything to do with the special SOFT model Data Source.""" from __future__ import annotations import logging import traceback from pathlib import Path from typing import TYPE_CHECKING, Any, Protocol, cast, runtime_checkable from pydantic import ( AnyUrl, BaseModel, ConfigDict, TypeAdapter, V...
SINTEF/soft7
s7/pydantic_models/datasource.py
.py
f642c7c20f09160c
7.35
4
"""Customized OTEAPI pydantic models.""" from __future__ import annotations from collections.abc import Hashable from oteapi.models import ( FunctionConfig, GenericConfig, MappingConfig, ParserConfig, ResourceConfig, ) from pydantic import AnyUrl from s7.pydantic_models.soft7_entity import SOFT7...
SINTEF/soft7
s7/pydantic_models/oteapi.py
.py
8478b80f7bfaa2a7
7.35
4
"""Pydantic model for the SOFT7 data source instance.""" from __future__ import annotations import logging from typing import TYPE_CHECKING, ClassVar, cast, get_args from pydantic import ( AnyUrl, BaseModel, ConfigDict, TypeAdapter, ValidationError, conlist, model_validator, ) from pydant...
SINTEF/soft7
s7/pydantic_models/soft7_instance.py
.py
6eae8a02135b28ab
7.35
4
"""Pytest fixtures for all tests.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest if TYPE_CHECKING: from pathlib import Path from typing import Any def static_folder() -> Path: """Path to the 'static' folder. This is here to support _generate_entity_test_cases...
SINTEF/soft7
tests/conftest.py
.py
e5c8695fbb0d1459
7.85
4
"""Pytest fixtures for 'factories'.""" from __future__ import annotations import pytest @pytest.fixture(scope="session", autouse=True) def _load_strategies() -> None: """Load entry points strategies.""" from oteapi.plugins import load_strategies load_strategies(test_for_uniqueness=False) @pytest.fixt...
SINTEF/soft7
tests/factories/conftest.py
.py
52494131a8801b14
7.35
4
"""Test the soft7 OTEAPI function strategy.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest if TYPE_CHECKING: from pathlib import Path from typing import Any from pydantic import AnyHttpUrl from pytest_httpx2 import HTTPXMock from s7.pydantic_models.soft7_e...
SINTEF/soft7
tests/oteapi_plugin/test_soft7_function.py
.py
b3854041574b64d0
7.85
4
"""The main `turtle-canon` module.""" from __future__ import annotations import re from pathlib import Path from tempfile import TemporaryDirectory from rdflib import Graph from rdflib.exceptions import Error as RDFlibError from rdflib.exceptions import ParserError from turtle_canon.utils import exceptions, warning...
CasperWA/turtle-canon
turtle_canon/canon.py
.py
d57922d0d6d639d0
7.39
5
"""Utility functions for `turtle-canon` CLI.""" from __future__ import annotations import sys from pathlib import Path from typing import TYPE_CHECKING if TYPE_CHECKING: # pragma: no cover from collections.abc import Sequence from typing import TextIO class Cache: """Small cache.""" def __init__(...
CasperWA/turtle-canon
turtle_canon/cli/utils.py
.py
d23330b74c38a8b7
7.39
5
"""Warnings for general usage by the Turtle Canon tool. !!! note These warnings are *not* like regular Python `Warning`s. Instead, they are `Exception`s that will be caught and treated specially by the CLI. """ from __future__ import annotations class TurtleCanonWarning(Exception): """Base Warning for ...
CasperWA/turtle-canon
turtle_canon/utils/warnings.py
.py
d462993c6bbef6e1
7.39
5
''' Created on Dec 28, 2021 @author: vladyslav_goncharuk ''' import os import io import sys import fcntl import struct import termios import glob import importlib.util def has_fileno(stream): """ Cleanly determine whether ``stream`` has a useful ``.fileno()``. .. note:: This function helps determ...
svlad-90/paf
paf/common.py
.py
c818efdf29c3896e
7.24
2
"""DLite-specific data models.""" from __future__ import annotations from typing import Annotated from oteapi.models import AttrDict from pydantic import Field, JsonValue class DLiteResult(AttrDict): """Class for returning values from DLite strategies.""" collection_id: Annotated[ str | None, Fiel...
EMMC-ASBL/oteapi-dlite
oteapi_dlite/models.py
.py
97956bc1d9914724
7.24
2
"""Generic function strategy that converts zero or more input instances to zero or more new output instances. """ from __future__ import annotations import importlib from collections.abc import Sequence from typing import Annotated import dlite from oteapi.models import AttrDict, FunctionConfig from pydantic import...
EMMC-ASBL/oteapi-dlite
oteapi_dlite/strategies/convert.py
.py
d2dd5f2e6d5c4c93
7.24
2
"""Filter that removes all but specified instances in the collection.""" from __future__ import annotations import re from typing import Annotated from dlite.utils import get_referred_instances from oteapi.models import FilterConfig from pydantic import Field from pydantic.dataclasses import dataclass from oteapi_d...
EMMC-ASBL/oteapi-dlite
oteapi_dlite/strategies/filter.py
.py
d763c0645b5f78bf
7.24
2
"""Mapping filter strategy.""" from __future__ import annotations import json from typing import TYPE_CHECKING, Annotated from oteapi.models import MappingConfig from pydantic import AnyUrl from pydantic.dataclasses import Field, dataclass from oteapi_dlite.models import DLiteConfiguration, DLiteResult from oteapi_...
EMMC-ASBL/oteapi-dlite
oteapi_dlite/strategies/mapping.py
.py
7ded578019fa877a
7.24
2
"""Generic parse strategy using DLite storage plugin.""" from __future__ import annotations from pathlib import Path from typing import Annotated, Literal import dlite from oteapi.datacache import DataCache from oteapi.models import ( AttrDict, DataCacheConfig, HostlessAnyUrl, ParserConfig, Resou...
EMMC-ASBL/oteapi-dlite
oteapi_dlite/strategies/parse.py
.py
87cb49667152793d
7.24
2
"""Strategy for parsing an Excel spreadsheet to a DLite instance.""" from __future__ import annotations import re from random import getrandbits from typing import TYPE_CHECKING, Annotated, Literal import dlite import numpy as np from dlite.datamodel import DataModel from oteapi.models import HostlessAnyUrl, ParserC...
EMMC-ASBL/oteapi-dlite
oteapi_dlite/strategies/parse_excel.py
.py
53324edadb2a827f
7.24
2
"""Strategy class for parsing an image to a DLite instance.""" from __future__ import annotations import logging from typing import Annotated, Literal import numpy as np from oteapi.datacache import DataCache from oteapi.models import ParserConfig, ResourceConfig from oteapi.plugins import create_strategy from oteap...
EMMC-ASBL/oteapi-dlite
oteapi_dlite/strategies/parse_image.py
.py
2cbdb7fa781d9fca
7.24
2
"""Filter for serialisation using DLite.""" from __future__ import annotations from collections.abc import Sequence from pathlib import Path from typing import Annotated import dlite from oteapi.models import FilterConfig from pydantic import Field from pydantic.dataclasses import dataclass from oteapi_dlite.models...
EMMC-ASBL/oteapi-dlite
oteapi_dlite/strategies/serialise.py
.py
c0cbac7ed96d8ccc
7.24
2
"""Generic strategy for adding configurations to the session.""" from __future__ import annotations from typing import Annotated from oteapi.models import AttrDict, FilterConfig from pydantic import Field, JsonValue from pydantic.dataclasses import dataclass # Must add this explicitly to make mypy happy NoneType = ...
EMMC-ASBL/oteapi-dlite
oteapi_dlite/strategies/settings.py
.py
4cb98a807dc01681
7.24
2
"""Utility functions for OTEAPI DLite plugin.""" from __future__ import annotations from numbers import Number from pathlib import Path from typing import TYPE_CHECKING import dlite from dlite.mappings import instantiate from oteapi.datacache import DataCache from oteapi_dlite.utils.exceptions import CollectionNotF...
EMMC-ASBL/oteapi-dlite
oteapi_dlite/utils/utils.py
.py
fbdd64325ca843c8
7.24
2
"""Pytest fixtures for `strategies/`.""" from __future__ import annotations from typing import TYPE_CHECKING, NamedTuple import pytest if TYPE_CHECKING: from pathlib import Path class PathsTuple(NamedTuple): """Tuple of paths.""" testdir: Path entitydir: Path inputdir: Path outputdir: Pat...
EMMC-ASBL/oteapi-dlite
tests/conftest.py
.py
5461196be9b6a181
7.74
2
"""Base API for backend client.""" from __future__ import annotations import warnings from abc import ABC, abstractmethod from typing import TYPE_CHECKING from otelib.backends.factories import strategy_factory from otelib.backends.utils import Backend, StrategyType from otelib.warnings import IgnoringConfigOptions ...
EMMC-ASBL/otelib
otelib/backends/client.py
.py
8eff4d94719fc199
7.39
5
"""Backend factory functions.""" from __future__ import annotations import importlib from typing import TYPE_CHECKING from otelib.backends.utils import Backend, StrategyType from otelib.exceptions import InvalidBackend, InvalidStrategy if TYPE_CHECKING: # pragma: no cover from otelib.backends.client import Ab...
EMMC-ASBL/otelib
otelib/backends/factories.py
.py
6b3bed12f7cd5b45
7.39
5
"""Base class for strategies in the Python backend.""" from __future__ import annotations import json import warnings from typing import TYPE_CHECKING from uuid import uuid4 from oteapi.models import AttrDict from oteapi.plugins import create_strategy from oteapi.utils.config_updater import populate_config_from_sess...
EMMC-ASBL/otelib
otelib/backends/python/base.py
.py
dfca39f544de7c36
7.39
5
"""Client for python backend.""" from __future__ import annotations from typing import TYPE_CHECKING from oteapi.plugins import load_strategies from otelib.backends.client import AbstractBaseClient from otelib.exceptions import PythonBackendException if TYPE_CHECKING: # pragma: no cover from typing import Any...
EMMC-ASBL/otelib
otelib/backends/python/client.py
.py
5424843bb587dc2d
7.39
5
"""Common strategy for Download, Parse and Resource strategies.""" from __future__ import annotations from typing import TYPE_CHECKING from oteapi.models import ResourceConfig from otelib.backends.python.base import BasePythonStrategy if TYPE_CHECKING: # pragma: no cover from oteapi.models import GenericConfi...
EMMC-ASBL/otelib
otelib/backends/python/dataresource.py
.py
e2b16ea84a5c7234
7.39
5
"""Client for services backend.""" from __future__ import annotations from typing import TYPE_CHECKING from otelib.backends.client import AbstractBaseClient if TYPE_CHECKING: # pragma: no cover from typing import Any from otelib.backends.services.base import BaseServicesStrategy class OTEServiceClient(A...
EMMC-ASBL/otelib
otelib/backends/services/client.py
.py
e3d28d60f66e1739
7.39
5
"""Utility function and classes for use in the Backends module.""" from __future__ import annotations import sys if sys.version_info >= (3, 11): from enum import StrEnum else: from enum import Enum class StrEnum(str, Enum): """Pre-3.11 style string-Enums.""" class Backend(StrEnum): """Back...
EMMC-ASBL/otelib
otelib/backends/utils.py
.py
980d44a571268a94
7.39
5
"""Pipe object for creating a pipeline.""" from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: # pragma: no cover from otelib.backends.strategies import AbstractBaseStrategy class Pipe: """Pipe object in a pipe-and-filter pattern.""" def __init__(self, strategy: Abs...
EMMC-ASBL/otelib
otelib/pipe.py
.py
0447978091a37768
7.39
5
"""Fixtures and configuration for pytest.""" from __future__ import annotations import logging import sys from typing import TYPE_CHECKING if sys.version_info >= (3, 11): from enum import StrEnum else: from enum import Enum class StrEnum(str, Enum): """Pre-3.11 style string-Enums.""" import py...
EMMC-ASBL/otelib
tests/conftest.py
.py
db428b56af8bfdeb
7.89
5
"""Tests for `otelib.strategies.abc`.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest from utils import strategy_create_kwargs if TYPE_CHECKING: from typing import Any from requests_mock import Mocker from otelib.backends.python.base import BasePythonStrategy f...
EMMC-ASBL/otelib
tests/strategies/test_abc.py
.py
67037d707379d98b
7.89
5
"""Utility functions for tests.""" from __future__ import annotations import json import sys from pathlib import Path from subprocess import run from typing import TYPE_CHECKING if sys.version_info >= (3, 11): from enum import StrEnum else: from enum import Enum class StrEnum(str, Enum): """Pre-...
EMMC-ASBL/otelib
tests/utils.py
.py
80cae1e59d290900
7.89
5
"""# VeleroBackupConfig library. This library implements the Requirer and Provider roles for the `velero_backup_config` relation interface. It is used by client charms to declare backup specifications, and by the Velero Operator charm to consume them and execute backup and restore operations. The `velero_backup_confi...
canonical/kubeflow-profiles-operator
lib/charms/velero_libs/v0/velero_backup_config.py
.py
4d948cf5685de721
7
0
# Copyright 2025 Canonical Ltd. # See LICENSE file for licensing details. """Define Interface tests fixtures.""" import pytest from interface_tester.plugin import InterfaceTester from ops.framework import Object from charm import KubeflowProfilesOperator @pytest.fixture(autouse=True) def patch_kubernetes_service_p...
canonical/kubeflow-profiles-operator
tests/interface_tests/conftest.py
.py
757548c086d4d2c2
7.5
0
# Copyright 2023 Canonical Ltd. # See LICENSE file for licensing details. """Define Unit tests fixtures.""" from unittest.mock import MagicMock import pytest from ops.testing import Harness from charm import KubeflowProfilesOperator, KubernetesServicePatch @pytest.fixture def harness(): """Initialize Harness in...
canonical/kubeflow-profiles-operator
tests/unit/conftest.py
.py
a391df5c818bc7a4
7.5
0
#!/usr/bin/env python3 """ Tasks for maintaining the project. Execute 'invoke --list' for guidance on using Invoke """ # Core Library modules import logging.config import shutil import webbrowser from pathlib import Path # Third party modules import yaml # type: ignore from invoke import task, call from jinja2 impor...
Stephen-RA-King/pynball
tasks.py
.py
72b49178b4179777
7.24
2
"""Test configuration. pynball.py is a Windows-only tool (it imports `winreg` unconditionally and exits at import time if `sys.platform != "win32"`). To unit test it on any platform, we: 1. Install lightweight stub modules for `winreg` and `magic` (python-magic, which needs the libmagic shared library) into sys.mo...
Stephen-RA-King/pynball
tests/conftest.py
.py
2cb6c55b18399107
7.74
2
# Copyright 2023 Canonical Ltd. # See LICENSE file for licensing details. """Integration tests for Jupyter controller.""" import logging from pathlib import Path import pytest import tenacity import yaml from charmed_kubeflow_chisme.testing import ( GRAFANA_AGENT_APP, assert_alert_rules, assert_logging, ...
canonical/notebook-operators
charms/jupyter-controller/tests/integration/test_charm.py
.py
9ba0382783c83d01
7.89
5
# Copyright 2025 Canonical Ltd. # See LICENSE file for licensing details. """Integration tests for Jupyter controller.""" import logging from pathlib import Path import pytest import tenacity import yaml from charmed_kubeflow_chisme.testing import ( GRAFANA_AGENT_APP, assert_alert_rules, assert_logging, ...
canonical/notebook-operators
charms/jupyter-controller/tests/integration/test_charm_ambient.py
.py
336a94c77299993b
7.89
5
# Copyright 2023 Canonical Ltd. # See LICENSE file for licensing details. """Unit tests for Jupyter controller.""" import json from unittest.mock import MagicMock, patch import pytest import yaml from ops.model import ActiveStatus, MaintenanceStatus, WaitingStatus from ops.testing import Harness from charm import J...
canonical/notebook-operators
charms/jupyter-controller/tests/unit/test_operator.py
.py
024daade7225a38f
7.89
5
#!/usr/bin/env python3 # Copyright 2023 Canonical Ltd. # See LICENSE file for licensing details. """Tools for validating configuration options.""" import dataclasses from dataclasses import field from typing import List, Union OPTIONS_LOOKUP = { "gpu-vendors": { "required_keys": ["limitsKey", "uiName"], ...
canonical/notebook-operators
charms/jupyter-ui/src/config_validators.py
.py
7ad4c1bf97150685
7.39
5
# Copyright 2023 Canonical Ltd. # See LICENSE file for licensing details. # """Integration tests for Jupyter UI Operator/Charm.""" import json import logging from pathlib import Path import aiohttp import dpath import pytest import tenacity import yaml from charmed_kubeflow_chisme.testing import ( GRAFANA_AGENT_...
canonical/notebook-operators
charms/jupyter-ui/tests/integration/test_charm.py
.py
8c43c22ca546af49
7.89
5
#!/usr/bin/env python3 # Copyright 2023 Canonical Ltd. # See LICENSE file for licensing details. """Unit tests for the configuration validators.""" from contextlib import nullcontext as does_not_raise import pytest from config_validators import ( ConfigValidationError, validate_named_options_with_default, ...
canonical/notebook-operators
charms/jupyter-ui/tests/unit/test_config_validators.py
.py
0431a64a9d5e6a76
7.89
5
# Copyright (C) 2022 - 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/hollerith
tests/test_field_writer.py
.py
0c27a89053b29d68
7.85
4
# Copyright (C) 2022 - 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/hollerith
tests/test_float_writer.py
.py
0e3ee0e195dbfcd6
7.85
4
#!/usr/bin/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 # ...
Ensembl/ensembl-genes-metadata
pipelines/assembly_metadata/bin/create_report.py
.py
f354825be0ad74f3
7.15
1
#!/usr/bin/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 # ...
Ensembl/ensembl-genes-metadata
pipelines/assembly_metadata/bin/get_tolid.py
.py
84d6c01bb3e2845c
7.15
1
#!/usr/bin/env python3 """ Example 09: DICOM Tag Printing Tool Usage Examples This example demonstrates how to use the mnts.utils.dicom_tag_printer module to print specific tag information from DICOM files. Author: MRI Normalization Tools """ import os import sys from pathlib import Path # Add mnts path sys.path.in...
alabamagan/mri_normalization_tools
examples/EG09_dicom_tag_printing.py
.py
808e7ba3cae0fbee
7.3
3
from .mnts_filters import * from typing import Any, Optional import SimpleITK as sitk __all__ = ["TypeCastNode", "DataNode"] class DataNode(MNTSFilter): r""" Presents whatever data stored in this node. This is useful for storing intermediate results, or other data that are repeatedly accessed without the ...
alabamagan/mri_normalization_tools
mnts/filters/data_node.py
.py
93eb9203544f99f5
7.3
3
import SimpleITK as sitk import numpy as np from pathlib import Path from typing import Union, Tuple, Optional from ..mnts_filters import MNTSFilter __all__ = ['RemoveShoulder'] class RemoveShoulder(MNTSFilter): r""" A geometric filter that takes a mask and calculates the slice area along a specified dimens...
alabamagan/mri_normalization_tools
mnts/filters/geom/geom_mask_crop.py
.py
2432734913f37d67
7.3
3
import SimpleITK as sitk import numpy as np import re from pathlib import Path from typing import Union, Tuple, Optional from ..mnts_filters import MNTSFilter __all__ = ['ReorientFilter'] class ReorientFilter(MNTSFilter): r""" A wrapper for sitk.DICOMOrient Attributes: target_orientation (str): ...
alabamagan/mri_normalization_tools
mnts/filters/geom/reorient_filter.py
.py
1e019b08fca65fdb
7.3
3
""" Wrap functions implemented in: jcreinhold/intensity-normalization https://github.com/jcreinhold/intensity-normalization Note that the original design was based on images of the brain, but is generally recognized to be suitable for other body regions. """ from intensity_normalization.normalize.nyul import NyulNorm...
alabamagan/mri_normalization_tools
mnts/filters/intensity/in_wrapper.py
.py
05d538213fa516a9
7.3
3