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 |
|---|---|---|---|---|---|---|
from collections.abc import Iterable, Mapping
from itertools import chain
from typing import Literal, TypeVar, cast, overload
from pydantic_core import ValidationError
from mex.common.exceptions import MergingError
from mex.common.fields import MERGEABLE_FIELDS_BY_CLASS_NAME
from mex.common.logging import logger
from... | robert-koch-institut/mex-common | mex/common/merged/main.py | .py | d3394c23059fea09 | 7.54 | 11 |
from typing import Annotated, TypeVar
from pydantic import Field
from mex.common.models.base.model import BaseModel
from mex.common.transform import camel_to_split
from mex.common.types import (
ExtractedIdentifier,
MergedIdentifier,
MergedPrimarySourceIdentifier,
)
_MergedIdentifierT = TypeVar("_MergedI... | robert-koch-institut/mex-common | mex/common/models/base/extracted_data.py | .py | 485a9c03ca6598e1 | 7.54 | 11 |
from typing import Annotated
from pydantic import BaseModel, Field
class FilterRule(BaseModel, extra="forbid"):
"""A single filter rule to apply."""
forValues: Annotated[list[str] | None, Field(title="forValues")] = None
rule: Annotated[str | None, Field(title="rule")] = None
class FilterField(BaseMod... | robert-koch-institut/mex-common | mex/common/models/base/filter.py | .py | 4fbd9b25e17f6b29 | 7.54 | 11 |
from typing import Annotated, Generic, TypeVar
from pydantic import BaseModel, Field
from mex.common.types import MergedPrimarySourceIdentifier
_ValueT = TypeVar("_ValueT")
_MappingRuleT = TypeVar("_MappingRuleT")
class MappingRule(BaseModel, Generic[_ValueT], extra="forbid"):
"""Generic mapping rule model."""... | robert-koch-institut/mex-common | mex/common/models/base/mapping.py | .py | 6c714a8729edafde | 7.54 | 11 |
import hashlib
import pickle
from collections.abc import MutableMapping
from typing import Any, Literal
from pydantic import BaseModel as PydanticBaseModel
from pydantic import ValidatorFunctionWrapHandler, model_validator
from pydantic.json_schema import DEFAULT_REF_TEMPLATE, JsonSchemaMode
from pydantic.json_schema ... | robert-koch-institut/mex-common | mex/common/models/base/model.py | .py | d55d5e697e342c70 | 7.54 | 11 |
from typing import Annotated
from pydantic import Field
from mex.common.models.base.model import BaseModel
from mex.common.types import PublishingTarget
class AdditiveRule(BaseModel, extra="forbid"):
"""Base rule to add values to merged items."""
class SubtractiveRule(BaseModel, extra="forbid"):
"""Base r... | robert-koch-institut/mex-common | mex/common/models/base/rules.py | .py | 3eeaf9e038ab85c6 | 7.54 | 11 |
from pydantic.json_schema import (
GenerateJsonSchema as PydanticJsonSchemaGenerator,
)
from pydantic.json_schema import JsonSchemaValue
class JsonSchemaGenerator(PydanticJsonSchemaGenerator):
"""Customization of the pydantic class for generating JSON schemas."""
def handle_ref_overrides(self, json_schem... | robert-koch-institut/mex-common | mex/common/models/base/schema.py | .py | 1bf02279145d946d | 7.54 | 11 |
# Auto generated from information_resource_registry.yaml by pythongen.py version: 0.0.1
# Generation date: 2026-08-24T08:00:37
# Schema: Information-Resource-Registry-Schema
#
# id: https://w3id.org/biolink/information_resource_registry.yaml
# description:
# license: https://creativecommons.org/publicdomain/zero/1.0/
... | biolink/information-resource-registry | project/information_resource_registry.py | .py | e7f55770c6322b6c | 7.42 | 6 |
# Auto generated from information_resource_registry.yaml by pythongen.py version: 0.0.1
# Generation date: 2026-08-24T08:00:40
# Schema: Information-Resource-Registry-Schema
#
# id: https://w3id.org/biolink/information_resource_registry.yaml
# description:
# license: https://creativecommons.org/publicdomain/zero/1.0/
... | biolink/information-resource-registry | src/information_resource_registry/datamodel/information_resource_registry.py | .py | 26380b7167ff8d9d | 7.42 | 6 |
import requests
import re
import json
def fetch_automat_apis():
all_apis = []
# Translator API endpoint
url = "https://smart-api.info/api/query"
params = {
"q": "Automat",
"size": 10, # 10 APIs returned per page
"from": 0 # Multiple pages of Automat APIs
}
while Tru... | biolink/information-resource-registry | src/information_resource_registry/translator_dataflow/Automat_infores.py | .py | fc61f0d759d1dfa1 | 7.42 | 6 |
import os
import time
import random
from pathlib import Path
from tqdm import tqdm
import yaml
import urllib3
from urllib3.util.ssl_ import create_urllib3_context
from urllib3.util.retry import Retry
from concurrent.futures import ThreadPoolExecutor, as_completed
# Path to the YAML file containing URLs
INFORES_YAML = ... | biolink/information-resource-registry | src/information_resource_registry/validation/check_urls.py | .py | 405103a27658046c | 7.42 | 6 |
"""Data test."""
import os
import glob
from pathlib import Path
from information_resource_registry.validation.check_urls import is_valid_url
import yaml
from linkml.generators.pythongen import PythonGenerator
ROOT = os.path.join(os.path.dirname(__file__), '..')
DATA_DIR = os.path.join(ROOT, "src", "data", "examples")
... | biolink/information-resource-registry | tests/test_data.py | .py | 1b3becfd4fc40d76 | 7.92 | 6 |
"""Public optimizer API -- a thin Python shim over the compiled `_opt` core.
Exposes opaque optimization-level sentinels and three entry points. The heavy
lifting lives in the Cython `sonolus.backend._opt` package
(marshal in -> passes (nogil) -> export back | emit).
"""
from __future__ import annotations
from datac... | qwewqa/sonolus.py | sonolus/backend/optimize/__init__.py | .py | 91082002910fa3ef | 7.5 | 9 |
"""Opt-in compile-stage timing.
Accumulates wall time for named stages of compilation, including frontend tracing,
optimizer pipeline stages, and emission. The recorded stages are intentionally
coarse and do not correspond one-to-one with individual optimizer passes.
Enabled by the `SONOLUS_OPT_PROFILE=1` environment... | qwewqa/sonolus.py | sonolus/backend/optimize/profiling.py | .py | dc22902b012f91b0 | 7.5 | 9 |
import ast
import inspect
from collections.abc import Callable
from functools import cache
from pathlib import Path
from types import CodeType, FunctionType, MethodType
class FunctionNotFoundError(ValueError):
"""No definition in the tree claims the requested line."""
@cache
def get_function(fn: Callable) -> tu... | qwewqa/sonolus.py | sonolus/backend/utils.py | .py | 4f70bc81f131c4b2 | 7.5 | 9 |
from __future__ import annotations
from abc import ABCMeta
from collections.abc import Iterable
from typing import Any, Literal, Self, TypeVar, final
from sonolus.backend.ir import IRConst, IRSet
from sonolus.backend.place import BlockPlace
from sonolus.script.array_like import ArrayLike, get_positive_index
from sono... | qwewqa/sonolus.py | sonolus/script/array.py | .py | c29090355d37c949 | 7.5 | 9 |
from __future__ import annotations
import random
from abc import abstractmethod
from collections.abc import Callable, Sequence
from typing import Any, Final
from sonolus.script.debug import assert_true
from sonolus.script.internal.context import ctx
from sonolus.script.internal.impl import validate_value
from sonolus... | qwewqa/sonolus.py | sonolus/script/array_like.py | .py | 0e4af973dca6cd6d | 7.5 | 9 |
from __future__ import annotations
from dataclasses import dataclass
from enum import IntEnum
from typing import Annotated, Any, NewType, dataclass_transform, get_origin
from sonolus.backend.mode import Mode
from sonolus.backend.ops import Op
from sonolus.script.internal.context import ctx
from sonolus.script.interna... | qwewqa/sonolus.py | sonolus/script/bucket.py | .py | dacf6ed38cc04737 | 7.5 | 9 |
from collections.abc import Callable
from contextvars import ContextVar
from typing import Any, Literal, Never, assert_never
from sonolus.backend.mode import Mode
from sonolus.backend.ops import Op
from sonolus.backend.optimize import (
FAST_PASSES,
MINIMAL_PASSES,
STANDARD_PASSES,
OptimizationLevel,
... | qwewqa/sonolus.py | sonolus/script/debug.py | .py | cb63f94966ff57d0 | 7.5 | 9 |
from __future__ import annotations
import json
import warnings
from collections.abc import Callable, Iterable
from os import PathLike
from pathlib import Path
from typing import Any, Literal
from sonolus.build.collection import Asset, load_asset
from sonolus.script.archetype import AnyArchetype, PlayArchetype, Previe... | qwewqa/sonolus.py | sonolus/script/engine.py | .py | db0dc74738c39e47 | 7.5 | 9 |
from dataclasses import dataclass
from typing import Annotated, Any, NewType, dataclass_transform, get_origin
from sonolus.backend.mode import Mode
from sonolus.backend.ops import Op
from sonolus.script.internal.context import ctx
from sonolus.script.internal.introspection import describe_value, get_field_specifiers
f... | qwewqa/sonolus.py | sonolus/script/instruction.py | .py | 63fb0a5eaa17a925 | 7.5 | 9 |
from abc import abstractmethod
class SonolusDescriptor:
"""Base class for Sonolus descriptors.
The compiler checks if a descriptor is an instance of a subclass of this class,
so it knows that it's a supported descriptor.
`__get__` must not raise `AttributeError`. It runs during compilation, so the e... | qwewqa/sonolus.py | sonolus/script/internal/descriptor.py | .py | 952b0726f57b3b27 | 7.5 | 9 |
class InternalError(RuntimeError):
"""Represents an error occurring due to a violation of an internal invariant.
This indicates there is a bug in sonolus.py, or that internal details have been used incorrectly.
"""
def __init__(self, message: str):
super().__init__(message)
class Compilation... | qwewqa/sonolus.py | sonolus/script/internal/error.py | .py | 7437e967af68161b | 7.5 | 9 |
import inspect
from abc import ABC
from collections.abc import Sequence
from typing import Annotated, get_origin
_missing = object()
def describe_value(value) -> str:
"""Return a readable description of a value for an error message, with no heap address in it."""
if get_origin(value) is Annotated:
pa... | qwewqa/sonolus.py | sonolus/script/internal/introspection.py | .py | 035a7c9a35a66e2c | 8 | 9 |
import json
from typing import List, Dict, Any
from shapely import wkt
from backend.connectors import NM_STATE_BOUNDING_POLYGON
from backend.connectors.nmose.transformer import NMOSEPODSiteTransformer
from backend.source import BaseSiteSource
def wkt_to_arcgis_json(obj):
if isinstance(obj, str):
obj = wk... | DataIntegrationGroup/DataIntegrationEngine | backend/connectors/nmose/source.py | .py | 0ff35e3672fb5a07 | 7.42 | 6 |
from datetime import datetime, timezone
from backend.transformer import SiteTransformer
def _arcgis_date_to_iso(value) -> str | None:
"""Convert an ArcGIS ``esriFieldTypeDate`` value (epoch milliseconds) to an
ISO-8601 date string ``YYYY-MM-DD``. Returns ``None`` for missing/unparseable
values so downstr... | DataIntegrationGroup/DataIntegrationEngine | backend/connectors/nmose/transformer.py | .py | 522d3b85610c3fba | 7.42 | 6 |
import http.client
import logging
import time
import urllib.parse
import xml.etree.ElementTree as ET
from datetime import datetime as dt
from enum import StrEnum
from http.client import RemoteDisconnected
from . import CATEGORIES
from .models import Author, Paper, PaperMeta
log = logging.getLogger("voy.arxiv")
__rep... | floringogianu/voy | voy/arxiv.py | .py | 361d831a0042580f | 7.45 | 7 |
import re
from typing import Dict, Match, Pattern
"""
Copyright 2017 Cornell University
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the right... | floringogianu/voy | voy/lib/tex2utf.py | .py | dcfe4a9d53194af4 | 7.45 | 7 |
import random
import sys
import threading
import time
class Task:
"""Represents a single progress bar or spinner."""
def __init__(self, prefix: str, total: int | None = None):
self.prefix = prefix
self.total = total # None denotes a spinner
self.current = 0
self.done = False
... | floringogianu/voy | voy/progress_bar.py | .py | 8b43d5ed00955b1e | 7.45 | 7 |
import datetime as dtm
import json
import logging
from abc import ABC, abstractmethod
from collections import defaultdict
from collections.abc import Sequence
from dataclasses import asdict
from datetime import datetime as dt
from . import CATEGORIES
from . import query as Q
from .arxiv import ArXivClient, SortCriteri... | floringogianu/voy | voy/repo.py | .py | 1fa78c2ade39cad9 | 7.45 | 7 |
import datetime as dtm
import logging
import time
from datetime import datetime as dt
import jsonlines as jl
from . import CATEGORIES
from . import query as Q
from . import views as V
from .models import Author, Paper, PaperMeta
from .repo import AuthorDB, PaperDB
from .storage import Storage
BATCH_SIZE = 100
log =... | floringogianu/voy | voy/seed.py | .py | 54d816b83a5f04f7 | 7.45 | 7 |
# Generated by Django 4.2.7 on 2024-06-03 12:55
from django.db import migrations, models
from capcomposer.cap.models import CapAlertPage
def add_expiry_dates(apps, schema_editor):
alerts = CapAlertPage.objects.all()
print(f"Found {len(alerts)} alerts")
for i, cap_alert_page in enumerate(alerts... | wmo-raf/cap-composer | capcomposer/src/capcomposer/cap/migrations/0017_capalertpage_expires.py | .py | 61d83c69afdbc967 | 7.6 | 15 |
# sphinx configuration
import importlib
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from navigation import build_nav_links
extensions = ["sphinx-jsonschema", "schemas", "vocabularies"]
html_theme = "alabaster"
html_theme_options = {
"extra_nav_links": build_nav_links(Path(... | robert-koch-institut/mex-model | docs/conf.py | .py | cb5c150c2268f346 | 7.48 | 8 |
"""Helper building the sidebar navigation from the documentation index.
The alabaster theme has no support for a table of contents within a single document, so
the sidebar links have to be configured manually as `extra_nav_links`. Instead of
maintaining that list by hand, this module parses the sections and directives... | robert-koch-institut/mex-model | docs/navigation.py | .py | 17c989d5ca0de7ae | 7.48 | 8 |
"""Sphinx extension rendering whole directories of json schemas.
The `jsonschema` directive renders exactly one schema file, which means every single
field and entity would have to be listed in the documentation index by hand. This module
provides a `mexschemas` directive instead, which renders all schemas of a direct... | robert-koch-institut/mex-model | docs/schemas.py | .py | b0133fd80d75a0ca | 7.48 | 8 |
"""Sphinx extension rendering the MEx vocabularies as tables.
The vocabularies are not JSON schemas but plain arrays of concepts, so they cannot be
rendered with the `jsonschema` directive that is used for entities and fields. This
module provides a `mexvocabularies` directive instead, which renders one section with
o... | robert-koch-institut/mex-model | docs/vocabularies.py | .py | 0d4a4109204fec20 | 7.48 | 8 |
import json
from collections.abc import Callable, Generator
from copy import deepcopy
from importlib.resources import files
from typing import Any
__all__ = (
"ENTITY_JSON_BY_NAME",
"EXTRACTED_MODEL_JSON_BY_NAME",
"FIELD_JSON_BY_NAME",
"I18N_PO_DATA_BY_LANGUAGE",
"MERGED_MODEL_JSON_BY_NAME",
"V... | robert-koch-institut/mex-model | mex/model/__init__.py | .py | b016e5414af012f6 | 7.48 | 8 |
from collections.abc import Iterator
from mex.model import (
EXTRACTED_MODEL_JSON_BY_NAME,
MERGED_MODEL_JSON_BY_NAME,
VOCABULARY_JSON_BY_NAME,
)
def _iter_use_schemes(node: object) -> Iterator[str]:
"""Yield all `useScheme` values found anywhere in the given json structure."""
if isinstance(node,... | robert-koch-institut/mex-model | tests/test_vocabularies.py | .py | 3112fbdd5eea4a9d | 7.98 | 8 |
"""Asynchronous Python client for NYT Games."""
from __future__ import annotations
import asyncio
from dataclasses import dataclass
from importlib import metadata
import socket
from typing import TYPE_CHECKING
from aiohttp import ClientError, ClientResponseError, ClientSession
from yarl import URL
from .exceptions ... | joostlek/python-nyt-games | src/nyt_games/nyt_games.py | .py | 151689fc647027d9 | 7.42 | 6 |
"""Asynchronous Python client for NYT Games."""
from collections.abc import AsyncGenerator, Generator
import aiohttp
from aioresponses import aioresponses
import pytest
from nyt_games.nyt_games import NYTGamesClient
from syrupy import SnapshotAssertion
from .syrupy import NYTGamesSnapshotExtension
@pytest.fixture... | joostlek/python-nyt-games | tests/conftest.py | .py | 1c9a9574c18dabaf | 7.92 | 6 |
"""Asynchronous Python client for NYTGames."""
from __future__ import annotations
from dataclasses import asdict, is_dataclass
from typing import TYPE_CHECKING, Any
from syrupy.extensions import AmberSnapshotExtension
from syrupy.extensions.amber import AmberDataSerializer
if TYPE_CHECKING:
from syrupy.types im... | joostlek/python-nyt-games | tests/syrupy.py | .py | e94f120d09551aa2 | 7.92 | 6 |
#!/usr/bin/env python
"""Conformance client for python-tuf, part of tuf-conformance"""
# Copyright 2024 tuf-conformance contributors
# SPDX-License-Identifier: MIT OR Apache-2.0
import argparse
import logging
import os
import shutil
import sys
from tuf.ngclient import Updater
def init(metadata_dir: str, trusted_ro... | theupdateframework/tuf-conformance | clients/python-tuf/python_tuf.py | .py | c6c4f76a6e97e656 | 7.5 | 9 |
import glob
import os
import subprocess
from datetime import datetime
from tempfile import TemporaryDirectory
from tuf.api.exceptions import StorageError
from tuf.api.metadata import Metadata
from tuf.api.serialization.json import JSONSerializer
from tuf_conformance._internal.metadata import MetadataTest
from tuf_con... | theupdateframework/tuf-conformance | tuf_conformance/_internal/client_runner.py | .py | 5225d6c1aacd567b | 7.5 | 9 |
import json
from typing import Any, cast
from securesystemslib.signer import Signature
from tuf.api._payload import (
_ROOT,
_SNAPSHOT,
_TARGETS,
_TIMESTAMP,
Role,
Root,
Signed,
Snapshot,
T,
Targets,
Timestamp,
)
from tuf.api.metadata import (
Key,
Metadata,
)
from t... | theupdateframework/tuf-conformance | tuf_conformance/_internal/metadata.py | .py | 1372ec7f40ba279d | 7.5 | 9 |
#!/usr/bin/env python
# Copyright 2021, New York University and the TUF contributors
# SPDX-License-Identifier: MIT OR Apache-2.0
""" "Test utility to simulate a repository
RepositorySimulator provides methods to modify repository metadata so that it's
easy to "publish" new repository versions with modified metadata... | theupdateframework/tuf-conformance | tuf_conformance/_internal/repository_simulator.py | .py | 90109da489d6d2c1 | 7.5 | 9 |
import os
from dataclasses import dataclass
from datetime import UTC, datetime
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from os import path
from urllib import parse
from tuf_conformance._internal.repository_simulator import RepositorySimulator
@dataclass
class ClientInitData:
metadata_... | theupdateframework/tuf-conformance | tuf_conformance/_internal/simulator_server.py | .py | 2504bac8c3773d25 | 7.5 | 9 |
# Copyright 2020, TUF contributors
# SPDX-License-Identifier: MIT OR Apache-2.0
"""
<Program Name>
utils.py
<Started>
August 3, 2020.
<Author>
Jussi Kukkonen
<Copyright>
See LICENSE-MIT OR LICENSE for licensing information.
<Purpose>
Provide common utilities for TUF tests
"""
import datetime
import logg... | theupdateframework/tuf-conformance | tuf_conformance/_internal/utils.py | .py | 21254e256a2edaa8 | 7.5 | 9 |
import os
from functools import cache
import pytest
from tuf_conformance._internal.client_runner import ClientRunner
from tuf_conformance._internal.simulator_server import SimulatorServer, StaticServer
def pytest_addoption(parser: pytest.Parser) -> None:
"""Add `--entrypoint` flag to CLI."""
parser.addoptio... | theupdateframework/tuf-conformance | tuf_conformance/conftest.py | .py | 0d8de8f1e968fb3a | 8 | 9 |
import json
import os
from datetime import UTC, datetime, timedelta
import pytest
from securesystemslib.formats import encode_canonical
from securesystemslib.hash import digest
from tuf.api.metadata import Key, Metadata, MetaFile, Root, Snapshot, Targets, Timestamp
from tuf_conformance._internal.client_runner import ... | theupdateframework/tuf-conformance | tuf_conformance/test_basic.py | .py | bc16545ebf3e756f | 7 | 9 |
from datetime import UTC, datetime, timedelta
from tuf.api.metadata import Root, Snapshot, Targets, Timestamp
from tuf_conformance._internal import utils
from tuf_conformance._internal.client_runner import ClientRunner
from tuf_conformance._internal.simulator_server import SimulatorServer
def test_root_expired(clie... | theupdateframework/tuf-conformance | tuf_conformance/test_expiration.py | .py | 720c96a724023278 | 7 | 9 |
import pytest
from tuf.api.metadata import Snapshot, TargetFile, Targets, Timestamp
from tuf_conformance._internal.client_runner import ClientRunner
from tuf_conformance._internal.repository_simulator import Artifact
from tuf_conformance._internal.simulator_server import SimulatorServer
def test_client_downloads_exp... | theupdateframework/tuf-conformance | tuf_conformance/test_file_download.py | .py | b8ad2c95bb21468c | 7 | 9 |
import json
import pytest
from tuf.api.metadata import Metadata, Root, Snapshot, Targets, Timestamp
from tuf_conformance._internal.client_runner import ClientRunner
from tuf_conformance._internal.simulator_server import SimulatorServer
def test_snapshot_does_not_meet_threshold(
client: ClientRunner, server: Sim... | theupdateframework/tuf-conformance | tuf_conformance/test_keys.py | .py | ae6a635994134d78 | 7 | 9 |
from urllib import parse
import pytest
from tuf.api.metadata import DelegatedRole, Snapshot, Targets, Timestamp
from tuf_conformance._internal.client_runner import ClientRunner
from tuf_conformance._internal.simulator_server import SimulatorServer
unusual_role_names = [
"?",
"#",
"/delegatedrole",
".... | theupdateframework/tuf-conformance | tuf_conformance/test_quoting_issues.py | .py | c53ca6181e0ec170 | 7 | 9 |
import pytest
from tuf.api.metadata import DelegatedRole, Root, Snapshot, Targets, Timestamp
from tuf_conformance._internal.client_runner import ClientRunner
from tuf_conformance._internal.simulator_server import SimulatorServer
def test_new_timestamp_version_rollback(
client: ClientRunner, server: SimulatorServ... | theupdateframework/tuf-conformance | tuf_conformance/test_rollback.py | .py | d5e61f1cb5fbeb2b | 7 | 9 |
import pytest
from tuf_conformance._internal.client_runner import ClientRunner
from tuf_conformance._internal.simulator_server import StaticServer
@pytest.mark.parametrize("static_repo", StaticServer.static_test_names())
def test_static_repository(
static_client: ClientRunner, static_server: StaticServer, static... | theupdateframework/tuf-conformance | tuf_conformance/test_static_repositories.py | .py | d1cdbe0a3d407ffb | 7 | 9 |
from dataclasses import astuple, dataclass, field
import pytest
from tuf.api.metadata import (
DelegatedRole,
Root,
Snapshot,
Targets,
Timestamp,
)
from tuf_conformance._internal.client_runner import ClientRunner
from tuf_conformance._internal.repository_simulator import RepositorySimulator
from t... | theupdateframework/tuf-conformance | tuf_conformance/test_updater_delegation_graphs.py | .py | ee97a95c4926e8ba | 7 | 9 |
from dataclasses import dataclass
import pytest
from tuf.api.metadata import Root, Snapshot, Targets, Timestamp
from tuf_conformance._internal.client_runner import ClientRunner
from tuf_conformance._internal.simulator_server import SimulatorServer
@dataclass
class MdVersion:
keys: list[int]
threshold: int
... | theupdateframework/tuf-conformance | tuf_conformance/test_updater_key_rotations.py | .py | be3c70245871c45d | 8 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/apps/example/src/slidetap_example/config.py | .py | e6b2b2eb83a3f10c | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/apps/example/src/slidetap_example/interfaces/image_export.py | .py | a7b88c181f4022b6 | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/apps/example/src/slidetap_example/metadata_serializer.py | .py | 6237ccfe94f121d0 | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/config.py | .py | 0a0bc0b3177f12b6 | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/database/mapper.py | .py | 31b847bf5f7ef0c4 | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/database/metadata_search_item.py | .py | ab7b56225b6946e7 | 7.5 | 9 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/database/review_issue.py | .py | cc78123b2bdaae5e | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/external_interfaces/dicom_metadata_producer.py | .py | e81dda8bfec6557d | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/external_interfaces/exceptions.py | .py | 143eab639be88f13 | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/external_interfaces/image_export.py | .py | 7294c9c183d8eaf3 | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/external_interfaces/image_import.py | .py | 1487ea8670eb88e9 | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/external_interfaces/implementations/json_file_auth.py | .py | 3f17adc1bbcfa350 | 7.5 | 9 |
# Copyright 2025 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/external_interfaces/implementations/json_mapper_injector.py | .py | a73dee750736ebf8 | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/external_interfaces/metadata_export.py | .py | a0d51de8485dbe0f | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/external_interfaces/metadata_import.py | .py | 5e321034798f6206 | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/external_interfaces/schema.py | .py | d9f0756980aaf4c9 | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/image_processor/dicom_metadata.py | .py | c9d984c688d515bc | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/image_processor/image_processing_step.py | .py | 650f931d4e0e942e | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/image_processor/image_processor.py | .py | c8517aeec68f2b06 | 7.5 | 9 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/slidetap | slidetap-app/src/slidetap/migrations/cli.py | .py | 45311861dc93e520 | 7.5 | 9 |
from __future__ import annotations
from typing import TYPE_CHECKING
import openpyxl
import pytest
from django.core.management import call_command
from django.core.serializers import serialize
from tests.models import BooleanFieldModel
if TYPE_CHECKING:
from pathlib import Path
@pytest.mark.parametrize(
"... | paduszyk/django-xlsx-serializer | tests/fields/test_boolean_fields.py | .py | 44d74ee2a401b919 | 7.09 | 14 |
from orm_loader.tables import CSVLoadableTableInterface, SerialisableTableInterface
import sqlalchemy as sa
import sqlalchemy.orm as so
class CDMTableBase(CSVLoadableTableInterface, SerialisableTableInterface):
"""
Base class for CDM tables that support CSV loading and validation.
"""
__abstract__ = ... | AustralianCancerDataNetwork/omop-alchemy | omop_alchemy/cdm/base/cdm_table_base.py | .py | 93141390c5c9533b | 7.57 | 13 |
import sqlalchemy as sa
import sqlalchemy.orm as so
class ConceptValidationMixin:
"""
Structural validation for concept-bearing columns.
A concept-bearing column is defined as:
- column name ends with '_concept_id'
- value is integer-like
Works for:
- ORM mapped tables
- mate... | AustralianCancerDataNetwork/omop-alchemy | omop_alchemy/cdm/base/concept_validation.py | .py | a6f7473c13159582 | 7.57 | 13 |
from typing import TypeVar
from .cdm_table_base import CDMTableBase
T = TypeVar("T", bound=type)
MODEL_MODULE_PREFIX = "omop_alchemy.cdm.model."
def _infer_table_category(cls: type) -> str | None:
model_module = cls.__module__
if not model_module.startswith(MODEL_MODULE_PREFIX):
return None
suffix... | AustralianCancerDataNetwork/omop-alchemy | omop_alchemy/cdm/base/decorators.py | .py | 2f845406c33593d7 | 7.57 | 13 |
from sqlalchemy import orm as so
from orm_loader.helpers import get_model_by_tablename
#from .domain_rule import DomainRule
from typing import FrozenSet
from dataclasses import dataclass
from typing import Optional
@dataclass(frozen=True)
class DomainRule:
"""
*DomainRule*
Immutable specification of ... | AustralianCancerDataNetwork/omop-alchemy | omop_alchemy/cdm/base/domain_validation.py | .py | 39756c15bab5b812 | 7.57 | 13 |
from __future__ import annotations
from hashlib import sha1
from typing import Union, Mapping, Tuple, TypedDict, Any, cast
import sqlalchemy as sa
from sqlalchemy.sql.schema import SchemaItem
from sqlalchemy.sql.elements import ColumnElement
from sqlalchemy import Column
TableArg = Union[
SchemaItem, ... | AustralianCancerDataNetwork/omop-alchemy | omop_alchemy/cdm/base/indexing.py | .py | b68dab82dccf2bc3 | 7.57 | 13 |
from __future__ import annotations
import sqlalchemy.orm as so
import sqlalchemy as sa
class ReferenceContext:
"""
`ReferenceContext`
A helper base class for defining **read-only reference relationships**.
This class is purely structural: it resolves foreign keys
into reference tables (Dom... | AustralianCancerDataNetwork/omop-alchemy | omop_alchemy/cdm/base/reference_context.py | .py | 17f978cd5f472617 | 7.57 | 13 |
from enum import StrEnum, nonmember
import sqlalchemy as sa
import sqlalchemy.orm as so
from typing import Optional
class StandardConceptFlag(StrEnum):
"""Allowed non-null values of ``concept.standard_concept`` (OMOP CDM v5.4)."""
STANDARD = "S"
CLASSIFICATION = "C"
# Keep the complete allowed-value ... | AustralianCancerDataNetwork/omop-alchemy | omop_alchemy/cdm/model/flags.py | .py | 5781eb6d902c3f09 | 7.57 | 13 |
"""Asynchronous Python client for Withings."""
from __future__ import annotations
from typing import Any, cast
from aiowithings.const import LOGGER
def to_enum[EnumT](
enum_class: type[EnumT],
value: Any,
default_value: EnumT,
) -> EnumT:
"""Convert a value to an enum and log if it doesn't exist.""... | joostlek/python-withings | src/aiowithings/util.py | .py | e96b97254f79b641 | 7.54 | 11 |
"""Asynchronous Python client for Withings."""
from __future__ import annotations
import asyncio
from dataclasses import dataclass
from importlib import metadata
from typing import TYPE_CHECKING, Any, cast
from aiohttp import ClientSession
from aiohttp.hdrs import METH_POST
from yarl import URL
from .const import (... | joostlek/python-withings | src/aiowithings/withings.py | .py | df59fae5bfc45632 | 7.54 | 11 |
"""Asynchronous Python client for Withings."""
from collections.abc import AsyncGenerator, Generator
import aiohttp
from aioresponses import aioresponses
import pytest
from aiowithings import WithingsClient
from syrupy import SnapshotAssertion
from .syrupy import WithingsSnapshotExtension
@pytest.fixture(name="sn... | joostlek/python-withings | tests/conftest.py | .py | f52b55d65cbf8b21 | 8.04 | 11 |
"""Asynchronous Python client for Withings."""
from __future__ import annotations
from dataclasses import asdict, is_dataclass
from typing import TYPE_CHECKING, Any
from syrupy.extensions import AmberSnapshotExtension
from syrupy.extensions.amber import AmberDataSerializer
if TYPE_CHECKING:
from syrupy.types im... | joostlek/python-withings | tests/syrupy.py | .py | 27654c5a9a2dff08 | 8.04 | 11 |
"""Asynchronous Python client for Withings."""
from __future__ import annotations
import json
from typing import TYPE_CHECKING, Any
from aiowithings import MeasurementGroup, SleepSummary, aggregate_measurements
from aiowithings.helpers import aggregate_sleep_summary
from . import load_fixture
if TYPE_CHECKING:
... | joostlek/python-withings | tests/test_helpers.py | .py | f838252e439745bb | 7.04 | 11 |
"""Asynchronous Python client for Withings."""
from __future__ import annotations
import json
from typing import TYPE_CHECKING, Any
import pytest
from aiowithings import MeasurementGroup
from . import load_fixture
if TYPE_CHECKING:
from syrupy import SnapshotAssertion
@pytest.mark.parametrize(
"file",
... | joostlek/python-withings | tests/test_models.py | .py | 15ba52f864f390f8 | 7.04 | 11 |
"""Asynchronous Python client for Withings."""
from aiowithings.util import get_measurement, get_measurement_from_dict
def test_measurement() -> None:
"""Test measurement."""
assert get_measurement(20, -1) == 2
def test_measurement_from_dict() -> None:
"""Test measurement."""
assert get_measurement... | joostlek/python-withings | tests/test_util.py | .py | bce726778e164702 | 7.54 | 11 |
# SPDX-FileCopyrightText: 2024 DB Systel GmbH
#
# SPDX-License-Identifier: Apache-2.0
"""Functions concerning working with ClearlyDefined."""
import contextlib
import logging
from pathlib import PurePosixPath
from urllib.parse import urljoin
from purltools import purl2clearlydefined
from requests.exceptions import J... | OpenRailAssociation/compliance-assistant | complassist/_clearlydefined.py | .py | 99838cae3a0da305 | 7.45 | 7 |
# SPDX-FileCopyrightText: 2024 DB Systel GmbH
#
# SPDX-License-Identifier: Apache-2.0
"""Wrapper for some flict operations."""
import logging
import subprocess
# We need to run flict as subprocess as usage as library is too complicated
def _run_flict(
command: str,
*arguments: str,
options: list | None ... | OpenRailAssociation/compliance-assistant | complassist/_flict.py | .py | f5e70dca7cf03c6e | 7.45 | 7 |
# SPDX-FileCopyrightText: 2024 DB Systel GmbH
#
# SPDX-License-Identifier: Apache-2.0
"""Overarching helper functions."""
from __future__ import annotations
import json
import logging
from pathlib import Path
from time import sleep
from typing import Any
import requests
def object_to_json(data: dict | list) -> st... | OpenRailAssociation/compliance-assistant | complassist/_helpers.py | .py | b90414160a504204 | 7.45 | 7 |
# SPDX-FileCopyrightText: 2024 DB Systel GmbH
#
# SPDX-License-Identifier: Apache-2.0
"""Open Source License Compliance helpers."""
import logging
from license_expression import ExpressionError, Licensing, get_spdx_licensing
from ._flict import (
flict_outbound_candidate,
flict_simplify_license,
flict_s... | OpenRailAssociation/compliance-assistant | complassist/_licensing.py | .py | 6271be7c3a822e9b | 7.45 | 7 |
# SPDX-FileCopyrightText: 2024 DB Systel GmbH
#
# SPDX-License-Identifier: Apache-2.0
"""Generate a CycloneDX SBOM and enrich its licensing data via ClearlyDefined."""
import logging
from datetime import datetime, timezone
from typing import Any
from purltools import purl2clearlydefined
from . import __version__
fr... | OpenRailAssociation/compliance-assistant | complassist/_sbom_enrich.py | .py | 865b857912f7eba4 | 7.45 | 7 |
# SPDX-FileCopyrightText: 2024 DB Systel GmbH
#
# SPDX-License-Identifier: Apache-2.0
"""Create a CycloneDX SBOM using cgxgen as Docker container."""
import logging
import re
import subprocess
import sys
from pathlib import Path
from shutil import copy2
from tempfile import NamedTemporaryFile, gettempdir
from typing ... | OpenRailAssociation/compliance-assistant | complassist/_sbom_generate.py | .py | 404e1550c9cb9ac1 | 7.45 | 7 |
# SPDX-FileCopyrightText: 2024 DB Systel GmbH
#
# SPDX-License-Identifier: Apache-2.0
"""Parse a CycloneDX SBOM and extract certain information."""
import logging
from ._flict import flict_simplify_license
from ._helpers import read_json_file
def _unify_licenses_data(licenses_data: list[dict], flict_simplify: bool... | OpenRailAssociation/compliance-assistant | complassist/_sbom_parse.py | .py | 2919c40420dd8d52 | 7.45 | 7 |
"""
These are the available settings.
All attributes prefixed ``ADMIN_HELPERS_*`` can be overridden from your Django
project's settings module by defining a setting with the same name.
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from django.conf import settings as... | browniebroke/django-admin-helpers | src/django_admin_helpers/conf.py | .py | e2e481ac207ccd43 | 7.42 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.