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
"""Classes for internal use by `adapta.logs` module. Should not be imported outside this module""" # Copyright (c) 2023-2026. ECCO Data & AI and other project contributors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ma...
SneaksAndData/adapta
adapta/logs/_internal.py
.py
7c4280fcff70b69d
7.54
11
""" Logging handler for DataDog. """ # Copyright (c) 2023-2026. ECCO Data & AI and other project contributors. # # 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....
SneaksAndData/adapta
adapta/logs/handlers/datadog_api_handler.py
.py
5e78039015455967
7.54
11
""" Logging handler for Stdout that does not create duplicates if stdout redirection is used """ # Copyright (c) 2023-2026. ECCO Data & AI and other project contributors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may ...
SneaksAndData/adapta
adapta/logs/handlers/safe_stream_handler.py
.py
37c75bdde658ce69
7.54
11
""" Implementation of a metrics provider for Datadog. """ # Copyright (c) 2023-2026. ECCO Data & AI and other project contributors. # # 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 # # ...
SneaksAndData/adapta
adapta/metrics/providers/datadog_provider.py
.py
df0141b08bcb3427
7.54
11
""" Thin wrapper for Mlflow operations. """ # Copyright (c) 2023-2026. ECCO Data & AI and other project contributors. # # 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....
SneaksAndData/adapta
adapta/ml/mlflow/_client.py
.py
adcd8ed38328bcaf
7.54
11
"""Mlflow python model module""" # Copyright (c) 2023-2026. ECCO Data & AI and other project contributors. # # 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/li...
SneaksAndData/adapta
adapta/ml/mlflow/_functions.py
.py
affb4d241c641b36
7.54
11
""" Models used for inter-process communication in data processing applications. """ # Copyright (c) 2023-2026. ECCO Data & AI and other project contributors. # # 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 c...
SneaksAndData/adapta
adapta/process_communication/_models.py
.py
db93f7d034ae4550
7.54
11
""" Azure Cloud implementation of AuthenticationClient. """ # Copyright (c) 2023-2026. ECCO Data & AI and other project contributors. # # 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 # # ...
SneaksAndData/adapta
adapta/security/clients/_azure_client.py
.py
a284ccf46a9983e9
7.54
11
""" Amazon Web Services implementation of AuthenticationClient. """ # Copyright (c) 2023-2026. ECCO Data & AI and other project contributors. # # 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...
SneaksAndData/adapta
adapta/security/clients/aws/_aws_client.py
.py
53251f5406df4525
7.54
11
import logging from .types import SoundContent, SimpleSoundContent from .util import ( convert_to_percentage, safely_get_json_value, convert_from_percentage, convert_from_hex, convert_to_hex, ) from .const import ( RIOT_FLAGS_CLOCK_ON, RIOT_FLAGS_CLOCK_24_HOUR, NO_SOUND_ID, NO_COLOR...
dahlb/hatch_rest_api
src/hatch_rest_api/restore_v5.py
.py
dae79924141091e2
7.59
14
from typing import TypedDict, Any class SimpleSoundContent(TypedDict): """ This is a partial type of only the fields used internally """ id: int title: str wavUrl: str class SoundContent(TypedDict): """ No guarantees here, some display fields may be nullable. These types were inf...
dahlb/hatch_rest_api
src/hatch_rest_api/types.py
.py
6c0e85e8cd2db448
7.59
14
import unittest from concurrent.futures import Future from unittest.mock import MagicMock from hatch_rest_api.shadow_client_subscriber import ShadowClientSubscriberMixin class RecordingShadowClient: """IotShadowClient stub that records subscribe/unsubscribe traffic. Subscribing hands back the (future, topic...
dahlb/hatch_rest_api
tests/test_shadow_client_subscriber.py
.py
b9ab6f06d94d03fc
8.09
14
import asyncio import unittest from unittest.mock import MagicMock, patch from hatch_rest_api import util_bootstrap class FakeHatch: """Stands in for the Hatch REST client, returning canned payloads.""" def __init__(self, *args, **kwargs): self.api_session = MagicMock() async def login(self, **...
dahlb/hatch_rest_api
tests/test_util_bootstrap.py
.py
8577598e018b4100
8.09
14
from dataclasses import dataclass from enum import Enum from typing import List, Optional @dataclass class App: app_id: int name: str payment_processing_bot_username: str class Asset(Enum): BTC = "BTC" TON = "TON" ETH = "ETH" LTC = "LTC" USDT = "USDT" USDC = "USDC" BNB = "BNB...
ragnarok22/cryptobot_python
cryptobot/models/__init__.py
.py
3fd81fedc0c048b4
7.42
6
#!/usr/bin/env python """Tests for error handling in `cryptobot` package.""" import pytest from cryptobot.errors import CryptoBotError class TestCryptoBotError: """Tests for CryptoBotError exception handling.""" def test_cryptobot_error_creation(self): """Test creating CryptoBotError with basic pa...
ragnarok22/cryptobot_python
tests/test_errors.py
.py
00c236b2133abbcc
7.92
6
#!/usr/bin/env python """Tests for data models in `cryptobot` package.""" import pytest from cryptobot.models import ( App, AppStats, Asset, Balance, ButtonName, Check, CheckStatus, Currency, ExchangeRate, Invoice, Status, Transfer, TransferStatus, ) class TestEn...
ragnarok22/cryptobot_python
tests/test_models.py
.py
7f3cb3d60642ca35
7.92
6
#!/usr/bin/env python """Tests for `cryptobot` package.""" import os import socket import unittest import pytest from dotenv import load_dotenv from cryptobot import CryptoBotClient from cryptobot.errors import CryptoBotError from cryptobot.models import Asset, ButtonName, CheckStatus, Status, TransferStatus load_...
ragnarok22/cryptobot_python
tests/test_sync_client.py
.py
f99688da979da188
7.92
6
#!/usr/bin/env python """Tests for utility functions in `cryptobot` package.""" from dataclasses import dataclass from enum import Enum from typing import Optional import pytest from cryptobot._utils import parse_json @dataclass class SampleClass: """Sample dataclass for parse_json testing.""" required_f...
ragnarok22/cryptobot_python
tests/test_utils.py
.py
8e7f1f1e839fbfdb
7.92
6
import os from requests.models import to_key_val_list APPLICATION_JSON = "application/json" CONTENT_TYPE = "content-type" def get_real_file_path( path="http.tx", current_file=__file__, ): if os.path.exists(current_file): tx_model_path = os.path.normpath( os.path.join( ...
cedric05/dothttp
dothttp/utils/common.py
.py
9b5b85c71b9666da
7.62
16
import json import re from json.encoder import _make_iterencode from typing import Any, Iterator try: from _json import make_encoder as c_make_encoder except ImportError: c_make_encoder = None INFINITY = float("inf") ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\r\t]') ESCAPE_DCT = { "\\": "\\\\", "\n": "\...
cedric05/dothttp
dothttp/utils/json_utils.py
.py
5680fc4053b8f43a
7.62
16
import json import logging import os import re import string import subprocess import uuid from dataclasses import dataclass, field from datetime import datetime from functools import lru_cache from json import JSONDecodeError from random import Random from types import FunctionType from typing import Dict, List, Union...
cedric05/dothttp
dothttp/utils/property_util.py
.py
de119a1e66b35217
7.62
16
# # SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD # # SPDX-License-Identifier: Apache-2.0 # import os import sys import rich_click as click from esp_pylib.cli_types import AnyIntType, BaudRateType, SerialPortType from esp_pylib.constants import ESP_ROM_BAUD from esp_coredump import CoreDump, ...
espressif/esp-coredump
esp_coredump/cli_ext.py
.py
5086011139694f5b
7.65
19
# # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD # # SPDX-License-Identifier: Apache-2.0 # from abc import ABC, abstractmethod from importlib import import_module from typing import Optional, Tuple # noqa: F401 from esp_pylib.errors import FatalError from .elf import ElfFile __all__ = ['E...
espressif/esp-coredump
esp_coredump/corefile/__init__.py
.py
8b48697f7d86f528
7.65
19
# # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD # # SPDX-License-Identifier: Apache-2.0 # import hashlib import os from typing import Optional # noqa: F401 from construct import ( AlignedStruct, Bytes, Const, Container, # noqa: F401 GreedyRange, Int16ul, Int32ul...
espressif/esp-coredump
esp_coredump/corefile/elf.py
.py
1d4d75aabfb7efed
7.65
19
# # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD # # SPDX-License-Identifier: Apache-2.0 # import os import re import time from subprocess import TimeoutExpired from pygdbmi.gdbcontroller import GdbController from esp_coredump.log import log from . import ESPCoreDumpError DEFAULT_GDB_TIMEO...
espressif/esp-coredump
esp_coredump/corefile/gdb.py
.py
bd878972c3066dc1
7.65
19
# # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD # # SPDX-License-Identifier: Apache-2.0 # from __future__ import annotations from typing import Any, Optional, Tuple # noqa: F401 from construct import Int16ul, Int32ul, Int64ul, Struct from . import BaseArchMethodsMixin, BaseTargetMethods, ...
espressif/esp-coredump
esp_coredump/corefile/xtensa.py
.py
ceda58fa55528c5e
7.65
19
# # SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD # # SPDX-License-Identifier: Apache-2.0 # """esp-coredump logger extending esp-pylib with legacy ``--debug`` info level.""" from __future__ import annotations from typing import Any from esp_pylib.logger import EspLog, Verbosity # ``--debug`` flag...
espressif/esp-coredump
esp_coredump/log.py
.py
4689f60e406b0a57
7.65
19
""" fmsg DNS Resolver Module This module provides functionality to resolve fmsg host IP addresses for a given domain name, as specified in the domain resolution section of the fmsg specification. According to the spec, the fmsg host domain is ``fmsg.<domain>``. For example, for the address `@B@example.edu`, the fmsg ...
markmnl/fmsg
fmsg_dns_resolver.py
.py
5589df4c9d4932c8
7.45
7
class LoginError(Exception): """Generic error to distinguish login failures""" class AuthenticationError(Exception): """Generic error to distinguish an authentication error""" class DAFNIError(Exception): """An error returned by one of the DAFNI API's""" class EndpointNotFoundError(Exception): """...
dafnifacility/cli
dafni_cli/api/exceptions.py
.py
e333a1c2efe59380
7.45
7
from pathlib import Path from typing import Dict, List, Optional, Union import requests from tqdm.utils import CallbackIOWrapper from dafni_cli.api.session import DAFNISession from dafni_cli.consts import ( DSS_API_URL, MINIO_UPLOAD_CT, NID_API_URL, ) from dafni_cli.utils import create_file_progress_bar ...
dafnifacility/cli
dafni_cli/api/minio_api.py
.py
9f80c055a51ef27d
7.45
7
import click from dafni_cli.api.session import DAFNISession @click.command(help="Login to DAFNI") def login(): """ Log into the DAFNI CLI if needed after requesting the user's username and password. If there is already a cached session this will instead output the current logged in username and user_...
dafnifacility/cli
dafni_cli/commands/login.py
.py
5cb230d0a1ef13fb
7.45
7
from dataclasses import dataclass, field from datetime import datetime from typing import ClassVar, List, Optional import click from dafni_cli.api.parser import ParserBaseObject, ParserParam, parse_datetime from dafni_cli.consts import CONSOLE_WIDTH, TAB_SPACE from dafni_cli.utils import format_data_format, format_da...
dafnifacility/cli
dafni_cli/datasets/dataset.py
.py
9fe877452419d1a8
7.45
7
from dataclasses import dataclass, field from typing import Any, ClassVar, List, Optional from dafni_cli.api.parser import ParserBaseObject, ParserParam from dafni_cli.consts import ( TABLE_DEFAULT_DATASETS_HEADER, TABLE_DEFAULT_HEADER, TABLE_DESCRIPTION_HEADER, TABLE_DESCRIPTION_MAX_COLUMN_WIDTH, ...
dafnifacility/cli
dafni_cli/models/inputs.py
.py
f5bd4a6615ebe346
7.45
7
from dataclasses import dataclass from typing import ClassVar, List, Optional from dafni_cli.api.parser import ParserBaseObject, ParserParam from dafni_cli.consts import ( TABLE_FORMAT_HEADER, TABLE_NAME_HEADER, TABLE_SUMMARY_HEADER, TABLE_SUMMARY_MAX_COLUMN_WIDTH, ) from dafni_cli.utils import format_...
dafnifacility/cli
dafni_cli/models/outputs.py
.py
10e4258a7b21249a
7.45
7
from unittest import TestCase from dafni_cli.api.auth import Auth from dafni_cli.api.parser import ParserBaseObject from dafni_cli.tests.fixtures.auth import TEST_AUTH_DATA_OBJECT, TEST_AUTH_DATA_OBJECTS class TestAuth(TestCase): """Tests the Auth dataclass parsing""" def test_data_object_parse(self): ...
dafnifacility/cli
dafni_cli/tests/api/test_auth.py
.py
2fdc2935c0fab063
7.95
7
from unittest import TestCase from unittest.mock import ANY, MagicMock, mock_open, patch from dafni_cli.api import minio_api from dafni_cli.consts import ( DSS_API_URL, MINIO_UPLOAD_CT, NID_API_URL, ) class TestMinioAPI(TestCase): """Test class to test the functions in minio_api.py""" @patch("bu...
dafnifacility/cli
dafni_cli/tests/api/test_minio_api.py
.py
f165ce77732aa69d
7.95
7
"""Secrets related helper classes/functions.""" # Copyright 2023 Canonical Ltd. # See LICENSE file for licensing details. from typing import Dict, Literal, Optional from ops import Secret, SecretInfo from ops.charm import CharmBase from ops.model import SecretNotFoundError # The unique Charmhub library identifier, ...
canonical/data-platform-libs
lib/charms/data_platform_libs/v0/data_secrets.py
.py
4c52010e1821d3aa
7.56
12
# Copyright 2023 Canonical Ltd. # # 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 or agreed to in writing, s...
canonical/data-platform-libs
lib/charms/data_platform_libs/v0/database_provides.py
.py
cd441b9b5d0710c4
7.56
12
# Copyright 2023 Canonical Ltd. # # 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 or agreed to in writing, s...
canonical/data-platform-libs
lib/charms/data_platform_libs/v0/database_requires.py
.py
1ba950b481dbff94
7.56
12
# Copyright 2024 Canonical Ltd. # # 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 or agreed to in writing, s...
canonical/data-platform-libs
lib/charms/data_platform_libs/v1/data_models.py
.py
409a554cbd80fa45
7.56
12
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. import json import logging from platform import machine import jubilant import pytest from jubilant import Juju logger = logging.getLogger(__name__) LXD_CONTROLLER = "lxd-controller" @pytest.fixture(scope="package") d...
canonical/data-platform-libs
tests/conftest.py
.py
8ec2065a791de17a
8.06
12
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. import base64 import json import logging import subprocess from datetime import datetime, timedelta from enum import StrEnum from typing import Any, Dict import jubilant from dateutil.parser import parse from jubilant impo...
canonical/data-platform-libs
tests/jubilant_helpers.py
.py
d7012d61a08cb6ea
8.06
12
# Copyright 2023 Canonical Ltd. # See LICENSE file for licensing details. import argparse import os from importlib.metadata import version from unittest.mock import PropertyMock import pytest from ops import JujuVersion from pytest_mock import MockerFixture def pytest_addoption(parser): parser.addoption( ...
canonical/data-platform-libs
tests/v0/conftest.py
.py
63cf028bda552330
8.06
12
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Application charm that connects to etcd charm using data interfaces v0. This charm is meant to be used only for testing of the libraries in this repository. """ import logging import socket import subprocess from path...
canonical/data-platform-libs
tests/v0/integration/application-charm-etcd-client/src/charm.py
.py
391bb475a560dfab
8.06
12
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Etcd requires interface implementation using data interfaces v0.""" import logging from pathlib import Path from typing import TYPE_CHECKING import ops from charmlibs.interfaces.tls_certificates import Certificate fro...
canonical/data-platform-libs
tests/v0/integration/application-charm-etcd-client/src/etcd_requires.py
.py
e0f702e1cc352553
8.06
12
#!/usr/bin/env python3 # Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. """Application charm that connects to S3 provider charms. This charm is meant to be used only for testing of the libraries in this repository. """ import logging from ops.charm import CharmBase, RelationJoinedEvent from...
canonical/data-platform-libs
tests/v0/integration/application-s3-charm/src/charm.py
.py
eb73827596bb4b2c
8.06
12
#!/usr/bin/env python3 # Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. import logging import os import shutil from datetime import datetime from pathlib import Path from subprocess import check_call, check_output import pytest from pytest_operator.plugin import OpsTest logger = logging.getL...
canonical/data-platform-libs
tests/v0/integration/conftest.py
.py
94609b157c78fa8f
8.06
12
#!/usr/bin/env python3 # Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. """Database charm that accepts connections from application charms. This charm is meant to be used only for testing of the libraries in this repository. """ import logging import secrets import string from random import ...
canonical/data-platform-libs
tests/v0/integration/database-charm/src/charm.py
.py
9a6a8bd686ac1485
7.06
12
#!/usr/bin/env python3 # Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. """Database charm that accepts connections from application charms. This charm is meant to be used only for testing of the libraries in this repository. """ import logging import secrets import string from typing import ...
canonical/data-platform-libs
tests/v0/integration/dummy-database-charm/src/charm.py
.py
6cfc2f7f0134f14d
7.06
12
#!/usr/bin/env python3 # Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. """Kafka provider charm that accepts connections from application charms. This charm is meant to be used only for testing of the libraries in this repository. """ import logging import os from typing import Dict, Optiona...
canonical/data-platform-libs
tests/v0/integration/kafka-charm/src/charm.py
.py
a7817cd4d41789ed
8.06
12
#!/usr/bin/env python3 # Copyright 2025 Canonical Ltd. # See LICENSE file for licensing details. """Kafka Connect provider charm that accepts connections from application charms. This charm is meant to be used only for testing of the libraries in this repository. """ import logging from typing import Dict, Optional ...
canonical/data-platform-libs
tests/v0/integration/kafka-connect-charm/src/charm.py
.py
895b6d2bdf4ecb30
8.06
12
#!/usr/bin/env python3 # Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. """OpenSearch provider charm that accepts connections from application charms. This charm is meant to be used only for testing the libraries in this repository. """ import logging import secrets import string from typing...
canonical/data-platform-libs
tests/v0/integration/opensearch-charm/src/charm.py
.py
cd55585f1164dbc2
8.06
12
#!/usr/bin/env python3 # Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. """S3 provider charm that accepts connections from application charms. This charm is meant to be used only for testing of the libraries in this repository. """ import logging from ops.charm import CharmBase from ops.mai...
canonical/data-platform-libs
tests/v0/integration/s3-charm/src/charm.py
.py
265e7e95c611d3f8
8.06
12
"""Secrets related helper classes/functions.""" # Copyright 2023 Canonical Ltd. # See LICENSE file for licensing details. from typing import Dict, Literal, Optional from ops import Secret, SecretInfo from ops.charm import CharmBase from ops.model import SecretNotFoundError # The unique Charmhub library identifier, ...
canonical/data-platform-libs
tests/v0/integration/secrets-charm/lib/charms/data_platform_libs/v0/data_secrets.py
.py
57691152a1735233
8.06
12
#!/usr/bin/env python3 # Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. """Application charm that connects to database charms. This charm is meant to be used only for testing of the libraries in this repository. """ import logging from ops.charm import ActionEvent, CharmBase from ops.main i...
canonical/data-platform-libs
tests/v0/integration/secrets-charm/src/charm.py
.py
0b99daa68c5d2c73
8.06
12
#!/usr/bin/env python3 # Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. import logging from datetime import timedelta from pathlib import Path import pytest from charmlibs.interfaces.tls_certificates import ( Certificate, CertificateRequestAttributes, PrivateKey, generate_csr, ...
canonical/data-platform-libs
tests/v0/integration/test_etcd_charm.py
.py
afe7cd59f8d30a02
8.06
12
"""Component level tests.""" from unittest.mock import Mock import pytest from ops.charm import CharmBase from ops.testing import Harness from charms.data_platform_libs.v0.data_interfaces import CachedSecret class EmptyCharm(CharmBase): """Mock database charm to use in units tests.""" def __init__(self, *...
canonical/data-platform-libs
tests/v0/unit/test_cached_secrets.py
.py
b6768d905a56f9d3
8.06
12
"""Data cache based on DiskCache. See [Python-DiskCache](https://github.com/grantjenks/python-diskcache). Features: - Persistent cache between sessions. - Default keys are hashes of the stored data. - Automatic expiration of cached data. - Sessions can selectively be cleaned up via tags. - Store small values in SQLit...
EMMC-ASBL/oteapi-core
oteapi/datacache/datacache.py
.py
d2dbf623f3db1b0e
7.5
9
"""Generic data model for configuration attributes.""" from __future__ import annotations from collections.abc import Iterable, Mapping, MutableMapping from typing import TYPE_CHECKING from pydantic import BaseModel, ConfigDict, Field from pydantic.fields import PydanticUndefined if TYPE_CHECKING: # pragma: no cov...
EMMC-ASBL/oteapi-core
oteapi/models/genericconfig.py
.py
8d94d11c7a251806
7.5
9
"""Pydantic Resource Configuration Data Model.""" from __future__ import annotations from typing import Annotated from pydantic import Field, model_validator from pydantic.networks import AnyUrl, UrlConstraints from oteapi.models.genericconfig import GenericConfig from oteapi.models.secretconfig import SecretConfig...
EMMC-ASBL/oteapi-core
oteapi/models/resourceconfig.py
.py
2eae69fabc19727c
7.5
9
"""Pydantic Transformation Configuration Data Model. A transformation status data model is provided as well. This data model represents what should be returned from the strategy's `status()` method. """ from __future__ import annotations from datetime import datetime from enum import Enum from pydantic import BaseM...
EMMC-ASBL/oteapi-core
oteapi/models/transformationconfig.py
.py
7d911adc40ddb082
7.5
9
"""Load plugins through entry points. This module deals with handling all plugged in strategies through the entry points API and importlib metadata API. Special functionality is put in place to handle the OTEAPI-specific entry points. Since the entry points are information complete in and of themselves, there is no ...
EMMC-ASBL/oteapi-core
oteapi/plugins/entry_points.py
.py
b441f65f31ceea05
7.5
9
"""Factory class for registering and creating strategy instances. Factory wrapper methods for creating the individual strategies. """ from __future__ import annotations from typing import TYPE_CHECKING, get_args from oteapi.models import StrategyConfig from oteapi.plugins.entry_points import StrategyType, get_strat...
EMMC-ASBL/oteapi-core
oteapi/plugins/factories.py
.py
1e5ce0d1b11d62d3
7.5
9
"""Download strategy class for the `file` scheme.""" from __future__ import annotations from pydantic import Field, FileUrl, field_validator from pydantic.dataclasses import dataclass from oteapi.datacache import DataCache from oteapi.models import AttrDict, DataCacheConfig, ResourceConfig from oteapi.utils.paths im...
EMMC-ASBL/oteapi-core
oteapi/strategies/download/file.py
.py
ce694ab5d45f1314
7.5
9
"""Download strategy class for http/https""" from __future__ import annotations import warnings from typing import Any, Literal import requests from pydantic import AnyHttpUrl, Field, field_validator, model_validator from pydantic.dataclasses import dataclass from oteapi.datacache import DataCache from oteapi.model...
EMMC-ASBL/oteapi-core
oteapi/strategies/download/https.py
.py
4f73058971f984aa
7.5
9
"""Strategy class for sftp/ftp""" from __future__ import annotations from pathlib import Path from tempfile import NamedTemporaryFile from typing import Annotated import paramiko from pydantic import Field from pydantic.dataclasses import dataclass from pydantic.networks import AnyUrl, UrlConstraints from oteapi.da...
EMMC-ASBL/oteapi-core
oteapi/strategies/download/sftp.py
.py
6ff53cb8d725c7b0
7.5
9
"""Demo-filter strategy""" from __future__ import annotations from typing import Literal from pydantic import Field from pydantic.dataclasses import dataclass from oteapi.models import AttrDict, FilterConfig class CropImageConfig(AttrDict): """Configuration model for crop data.""" crop: tuple[int, int, i...
EMMC-ASBL/oteapi-core
oteapi/strategies/filter/crop_filter.py
.py
97f7240837e14ca2
7.5
9
"""SQL query filter strategy.""" from __future__ import annotations from typing import Literal from pydantic import Field from pydantic.dataclasses import dataclass from oteapi.models import AttrDict, FilterConfig class SqlQueryFilterConfig(FilterConfig): """SQL query filter strategy filter config.""" fi...
EMMC-ASBL/oteapi-core
oteapi/strategies/filter/sql_query_filter.py
.py
fb6c314bc44bb2cd
7.5
9
"""Mapping filter strategy.""" from __future__ import annotations from pydantic.dataclasses import Field, dataclass from oteapi.models import AttrDict, MappingConfig, RDFTriple class MappingStrategyConfig(AttrDict): """AttrDict model for mappings.""" prefixes: dict[str, str] = Field( ..., ...
EMMC-ASBL/oteapi-core
oteapi/strategies/mapping/mapping.py
.py
5be58977acae4131
7.5
9
"""Strategy class for application/json.""" from __future__ import annotations import json from typing import Literal from pydantic import Field from pydantic.dataclasses import dataclass from oteapi.datacache import DataCache from oteapi.models import AttrDict, DataCacheConfig, HostlessAnyUrl, ParserConfig from ote...
EMMC-ASBL/oteapi-core
oteapi/strategies/parse/application_json.py
.py
0dec6e783533ca67
7.5
9
"""Strategy class for application/vnd.sqlite3.""" from __future__ import annotations import sqlite3 from pathlib import Path from typing import Literal from pydantic import Field from pydantic.dataclasses import dataclass from oteapi.datacache import DataCache from oteapi.models import ( AttrDict, DataCache...
EMMC-ASBL/oteapi-core
oteapi/strategies/parse/application_vnd_sqlite.py
.py
61a880334ca9d538
7.5
9
"""Strategy class for workbook/xlsx.""" from __future__ import annotations from typing import TYPE_CHECKING, Literal from openpyxl import load_workbook from openpyxl.utils import column_index_from_string, get_column_letter from pydantic import Field from pydantic.dataclasses import dataclass from oteapi.datacache i...
EMMC-ASBL/oteapi-core
oteapi/strategies/parse/excel_xlsx.py
.py
307757e630bacfff
7.5
9
"""Strategy class for image/jpg.""" from __future__ import annotations from enum import Enum from typing import Literal from PIL import Image from pydantic import AliasChoices, Field from pydantic.dataclasses import dataclass from oteapi.datacache import DataCache from oteapi.models import ( AttrDict, DataC...
EMMC-ASBL/oteapi-core
oteapi/strategies/parse/image.py
.py
12da3be59b5ec9a0
7.5
9
"""Strategy class for application/vnd.postgresql""" from __future__ import annotations from typing import Any, Literal import psycopg from pydantic import AnyUrl, BaseModel, Field, model_validator from pydantic.dataclasses import dataclass from oteapi.models import ( AttrDict, DataCacheConfig, HostlessA...
EMMC-ASBL/oteapi-core
oteapi/strategies/parse/postgres.py
.py
605f8d2a51c22955
7.5
9
"""Strategy class for parser/csv.""" from __future__ import annotations import csv from collections import defaultdict from collections.abc import Hashable from enum import Enum from typing import Any, Literal from pydantic import BaseModel, Field, field_validator from pydantic.dataclasses import dataclass from ote...
EMMC-ASBL/oteapi-core
oteapi/strategies/parse/text_csv.py
.py
866c8bcb9bfcd427
7.5
9
"""Strategy class for resource/url.""" from __future__ import annotations from typing import Literal from pydantic import Field from pydantic.dataclasses import dataclass from oteapi.models import AttrDict, HostlessAnyUrl, ResourceConfig class ResourceURLConfig(ResourceConfig): """Resource URL strategy config...
EMMC-ASBL/oteapi-core
oteapi/strategies/resource/resource_url.py
.py
e419adaae56291e1
7.5
9
"""Transformation Plugin that uses the Celery framework to call remote workers.""" from __future__ import annotations import os from typing import TYPE_CHECKING, Literal from celery import Celery from celery.result import AsyncResult from pydantic import ConfigDict, Field from pydantic.dataclasses import dataclass ...
EMMC-ASBL/oteapi-core
oteapi/strategies/transformation/celery_remote.py
.py
72318f24c8c2ee47
7.5
9
"""Fixtures and configuration for pytest framework.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest if TYPE_CHECKING: from collections.abc import Callable, Iterable from importlib.metadata import EntryPoint from pathlib import Path from typing import Any Moc...
EMMC-ASBL/oteapi-core
tests/conftest.py
.py
aca6f587d6847be0
8
9
from application.core.utils import NoneToEmptyStringEncoder from jinja2 import pass_eval_context from markdown import markdown from markupsafe import Markup import json import jsonpickle from bs4 import BeautifulSoup from slugify import slugify from uritemplate import URITemplate import urllib.parse as urlparse from ur...
digital-land/digital-land.info
application/core/filters.py
.py
b0b2aac8b6b10d8f
7.59
14
import logging from sqlalchemy.orm import Session from application.db.models import LookupOrm, EntityOrm logger = logging.getLogger(__name__) def get_lookup_by_curie(session: Session, prefix: str, reference: str): """ This function queries the database for lookup records matching the given prefix and r...
digital-land/digital-land.info
application/data_access/curie_queries.py
.py
ee1d3b299887a081
7.59
14
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker, Session from typing import Iterator, Optional import logging import json from application.settings import get_settings, Settings from contextlib import contextmanager from functools import wraps, lru_cache from datetime import datetime from d...
digital-land/digital-land.info
application/db/session.py
.py
130e3f8845596c6e
7.59
14
from typing import Any from pydantic import GetCoreSchemaHandler from pydantic.json_schema import GetJsonSchemaHandler, JsonSchemaValue from pydantic_core import core_schema class FormInt(int): """ Custom integer type that accepts empty strings by treating them as None. Used for optional integer form fie...
digital-land/digital-land.info
application/search/custom_data_types.py
.py
8427bced8678845f
7.59
14
from enum import Enum class SuffixLinkableFiles(str, Enum): csv = "csv" class SuffixEntity(str, Enum): """Must be one of: json or geojson""" json = "json" html = "html" geojson = "geojson" class SuffixDataset(str, Enum): """Must be json""" json = "json" html = "html" class Suff...
digital-land/digital-land.info
application/search/enum.py
.py
c0b146e98d8df71a
7.59
14
# See the NOTICE file distributed with this work for additional information #pylint: disable=missing-module-docstring # 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 Lic...
Ensembl/ensembl-anno
simple_feature_utils.py
.py
1821cc2e53dd3031
7.54
11
import argparse import json import os import re from abc import ABC, abstractmethod from collections.abc import Generator from contextlib import contextmanager from dataclasses import dataclass from enum import Enum, auto from pathlib import Path from typing import Any import kconfiglib from spl_core.co...
avengineers/spl-core
src/spl_core/kconfig/kconfig.py
.py
f455492d6b533e51
7.42
6
"""Centralized Sphinx configuration for SPL projects.""" import datetime import json import os import re from typing import Any, ClassVar from sphinx.application import Sphinx from sphinx_needs.data import NeedsMutable, NeedsView from sphinx_needs.need_item import NeedItem, NeedPartItem def sple_tr_lin...
avengineers/spl-core
src/spl_core/report_generation/spl_sphinx.py
.py
506b6cb868136d0e
7.42
6
"""Sphinx extension that injects the SPL platform layout CSS. Add ``"spl_core.report_generation.spl_theme_extension"`` to your Sphinx ``extensions`` list. The extension automatically registers the static directory and CSS file so that downstream projects don't need to manage paths themselves. It also bridges sphinx-...
avengineers/spl-core
src/spl_core/report_generation/spl_theme_extension.py
.py
799c51af1a0ab967
7.42
6
import json from dataclasses import dataclass from pathlib import Path from mashumaro.mixins.json import DataClassJSONMixin from py_app_dev.core.logging import logger from py_app_dev.core.subprocess import SubprocessExecutor from pypeline.domain.pipeline import PipelineStep from pypeline_semantic_release.check...
avengineers/spl-core
src/spl_core/steps/collect_pr_changes.py
.py
5478231204c7ccb5
7.42
6
import json import zipfile from dataclasses import dataclass from pathlib import Path class ArchiveArtifactsCollection: """ Collection of artifacts to be archived. This class collects artifacts from a list of paths, handling both individual files and directories. It supports absolute paths and ensures...
avengineers/spl-core
src/spl_core/test_utils/archive_artifacts_collection.py
.py
c0d4c9d5886a9e56
7.92
6
import json import sys import time import zipfile from collections.abc import Callable from dataclasses import dataclass from pathlib import Path from typing import ClassVar from py_app_dev.core.logging import time_it from py_app_dev.core.subprocess import SubprocessExecutor @dataclass class ArchiveArtifact: """...
avengineers/spl-core
src/spl_core/test_utils/spl_build.py
.py
d007948d569a680d
7.92
6
from pathlib import Path import pytest from bs4 import BeautifulSoup from tests.utils import SplKickstartProjectIntegrationTestBase @pytest.mark.integration class TestDocumentation(SplKickstartProjectIntegrationTestBase): def test_build_reports(self) -> None: variant = "EnglishVariant" result = ...
avengineers/spl-core
tests/integration/test_documentation.py
.py
17732a632dc5acd2
7.92
6
"""Unit tests for kickstart project template conf.py consistency.""" import ast import re from pathlib import Path import pytest from spl_core.report_generation.spl_sphinx import SplSphinx TEMPLATE_CONF_PY = Path("src/spl_core/kickstart/templates/project/conf.py") TEMPLATE_SPHINX_DOC = Path("src/spl_core...
avengineers/spl-core
tests/unit/test_kickstart_template.py
.py
4f5581021dcdc112
7.92
6
import json import os import zipfile from pathlib import Path from unittest.mock import MagicMock, patch import pytest from spl_core.test_utils.spl_build import SplBuild @pytest.fixture def spl_build(tmp_path_factory): os.chdir(tmp_path_factory.mktemp("spl_build")) return SplBuild(variant="my_var", build_ki...
avengineers/spl-core
tests/unit/test_spl_build.py
.py
00933dbd90a8d808
7.92
6
"""Unit tests for spl_html_settings module.""" import pytest from spl_core.report_generation import spl_html_settings @pytest.mark.unit class TestSplHtmlSettings: def test_html_theme_is_pydata(self): assert spl_html_settings.html_theme == "pydata_sphinx_theme" def test_html_show_sourcel...
avengineers/spl-core
tests/unit/test_spl_html_settings.py
.py
fe7aa2080d8e91f6
7.92
6
"""Unit tests for the SPL theme Sphinx extension CSS helpers.""" import pytest from spl_core.report_generation.spl_theme_extension import ( _generate_needs_dark_css, rescope_root_block, ) @pytest.mark.unit class TestRescopeRootBlock: def test_rescopes_root_to_dark_selector(self): out = rescope_r...
avengineers/spl-core
tests/unit/test_spl_theme_extension.py
.py
bf2d3324a16c7517
7.92
6
import os from celery import Celery os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production") from django.conf import settings # noqa app = Celery("envergo") app.config_from_object("django.conf:settings", namespace="CELERY") class BaseTaskWithRetry(app.Task): """Default base task: always ...
MTES-MCT/envergo
config/celery_app.py
.py
02977a0fc4bee9ef
7.45
7
from django.conf import settings from django.contrib.admin.forms import AdminAuthenticationForm from django_otp.admin import OTPAdminAuthenticationForm, OTPAdminSite # Exclude those models from the main list, but don't disable the admin module entirely EXCLUDED_MODELS = ("MoulinetteTemplate",) def get_login_form(): ...
MTES-MCT/envergo
envergo/admin/site.py
.py
9ed488f7c74c780a
7.45
7
from urllib.parse import urlparse from uuid import uuid4 from django.conf import settings from django.http.response import HttpResponseRedirect from envergo.analytics.utils import set_visitor_id_cookie class SetVisitorIdCookie: """Make sure a unique visitor id cookie is always sent. By default, django does...
MTES-MCT/envergo
envergo/analytics/middleware.py
.py
884397fe1e4ddbe7
7.45
7
from django.contrib.sites.models import Site from django.db import models from django.utils import timezone from django.utils.translation import gettext_lazy as _ class Event(models.Model): """Stores an event in db for analytics purpose.""" # Category and event describe an event we want to track # e.g "s...
MTES-MCT/envergo
envergo/analytics/models.py
.py
47358cadf9c72beb
7.45
7
import argparse import asyncio import collections.abc import contextlib import functools import inspect import logging import pathlib import sys import tempfile import textwrap import typing as ty from ek_scraper import __version__ from ek_scraper.config import Config, NotificationsConfig, SearchConfig from ek_scraper...
jonasehrlich/ek-scraper
ek_scraper/cli.py
.py
a8afb40aacac0599
7.66
20