From e28357ae624e4ecdb27a2b24e8f436842afee265 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Wed, 9 Oct 2024 00:59:11 -0700 Subject: [PATCH 01/17] python 3.13 update --- .github/workflows/main.yaml | 8 +- .github/workflows/pypi-publish.yaml | 2 +- .github/workflows/test-upstream.yaml | 6 +- linkml_runtime/__init__.py | 4 + .../dumpers/delimited_file_dumper.py | 1 - linkml_runtime/dumpers/json_dumper.py | 4 +- linkml_runtime/dumpers/rdflib_dumper.py | 9 +- linkml_runtime/index/object_index.py | 11 +- linkml_runtime/linkml_model/__init__.py | 46 + linkml_runtime/linkml_model/annotations.py | 28 +- linkml_runtime/linkml_model/datasets.py | 42 +- linkml_runtime/linkml_model/extensions.py | 27 +- linkml_runtime/linkml_model/linkml_files.py | 4 +- linkml_runtime/linkml_model/mappings.py | 23 +- linkml_runtime/linkml_model/meta.py | 1122 ++++++++--------- linkml_runtime/linkml_model/types.py | 12 +- linkml_runtime/linkml_model/units.py | 19 +- linkml_runtime/linkml_model/validation.py | 25 +- linkml_runtime/loaders/context_flattener.py | 8 +- .../loaders/delimited_file_loader.py | 14 +- linkml_runtime/loaders/json_loader.py | 8 +- linkml_runtime/loaders/loader_root.py | 22 +- linkml_runtime/loaders/rdf_loader.py | 6 +- linkml_runtime/loaders/rdflib_loader.py | 34 +- linkml_runtime/loaders/yaml_loader.py | 10 +- .../processing/referencevalidator.py | 23 +- .../processing/validation_datamodel.py | 78 +- linkml_runtime/utils/context_utils.py | 10 +- linkml_runtime/utils/csvutils.py | 5 +- linkml_runtime/utils/dictutils.py | 3 +- linkml_runtime/utils/distroutils.py | 5 +- linkml_runtime/utils/enumerations.py | 4 +- linkml_runtime/utils/eval_utils.py | 4 +- linkml_runtime/utils/formatutils.py | 7 +- linkml_runtime/utils/inference_utils.py | 4 +- linkml_runtime/utils/introspection.py | 5 +- linkml_runtime/utils/metamodelcore.py | 4 +- linkml_runtime/utils/namespaces.py | 6 +- linkml_runtime/utils/pattern.py | 7 +- linkml_runtime/utils/permissiblevalueimpl.py | 18 +- linkml_runtime/utils/ruleutils.py | 14 +- linkml_runtime/utils/schema_as_dict.py | 4 +- linkml_runtime/utils/schema_builder.py | 20 +- linkml_runtime/utils/schemaops.py | 7 +- linkml_runtime/utils/schemaview.py | 9 +- linkml_runtime/utils/schemaview_cli.py | 7 +- linkml_runtime/utils/slot.py | 9 +- linkml_runtime/utils/walker_utils.py | 4 +- linkml_runtime/utils/yamlutils.py | 31 +- notebooks/SchemaView_BioLink.ipynb | 86 +- notebooks/SchemaView_Monarch.ipynb | 53 +- poetry.lock | 934 +++++++------- pyproject.toml | 10 +- tests/support/clicktestcase.py | 4 +- tests/support/dirutils.py | 2 +- tests/support/mismatchlog.py | 5 +- tests/support/test_environment.py | 10 +- tests/test_index/model/container_test.py | 109 +- tests/test_index/test_object_index.py | 2 +- tests/test_issues/input/issue_355.py | 25 +- tests/test_issues/input/issue_368.py | 14 +- tests/test_issues/input/issue_368_imports.py | 18 +- tests/test_issues/models/linkml_issue_576.py | 52 +- tests/test_issues/models/model_817.py | 40 +- tests/test_issues/test_issue_1040.py | 1 - tests/test_issues/test_issue_355.py | 24 +- tests/test_issues/test_issue_718a.py | 1 - tests/test_issues/test_issue_8.py | 3 +- tests/test_issues/test_linkml_issue_1126.py | 1 - tests/test_issues/test_linkml_issue_1143.py | 16 +- tests/test_issues/test_linkml_issue_478.py | 1 - tests/test_issues/test_linkml_issue_576.py | 3 +- tests/test_issues/test_linkml_issue_817.py | 1 - tests/test_linkml_model/test_linkml_files.py | 7 +- .../loaderdumpertestcase.py | 6 +- .../models/books_normalized.py | 66 +- .../models/books_normalized_pydantic.py | 64 +- .../test_loaders_dumpers/models/enum_model.py | 17 +- .../models/kitchen_sink_pydantic.py | 196 ++- .../models/node_object.py | 32 +- .../test_loaders_dumpers/models/personinfo.py | 142 +-- .../models/personinfo_test_issue_429.py | 27 +- .../models/phenopackets.py | 454 ++++--- .../models/termci_schema.py | 37 +- .../test_csv_tsv_loader_dumper.py | 6 +- .../test_dumpers_pydantic.py | 6 +- tests/test_loaders_dumpers/test_enum.py | 3 +- tests/test_loaders_dumpers/test_loaders.py | 6 +- .../test_loaders_dumpers.py | 5 +- .../test_loaders_pydantic.py | 2 +- .../test_rdflib_dumper.py | 1 - .../test_referencevalidator.py | 8 +- tests/test_utils/input/inlined_as_dict.py | 23 +- tests/test_utils/input/inlined_as_list.py | 23 +- tests/test_utils/model/inference_example.py | 49 +- tests/test_utils/test_dict_utils.py | 1 - tests/test_utils/test_distroutils.py | 3 - tests/test_utils/test_eval_utils.py | 7 +- tests/test_utils/test_formatutils.py | 4 +- tests/test_utils/test_introspection.py | 2 - tests/test_utils/test_ruleutils.py | 2 - tests/test_utils/test_schema_as_dict.py | 3 +- tests/test_utils/test_schemaview.py | 4 +- 103 files changed, 2138 insertions(+), 2266 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 973acf9c..74c86602 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -12,10 +12,12 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - python-version: ["3.8", "3.9", "3.10", "3.12"] + python-version: ["3.9", "3.10", "3.12", "3.13"] exclude: - os: windows-latest - python-version: "3.8" + python-version: "3.10" + - os: windows-latest + python-version: "3.12" runs-on: ${{ matrix.os }} @@ -34,7 +36,7 @@ jobs: uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: 'poetry' diff --git a/.github/workflows/pypi-publish.yaml b/.github/workflows/pypi-publish.yaml index a47376cb..03c00bf2 100644 --- a/.github/workflows/pypi-publish.yaml +++ b/.github/workflows/pypi-publish.yaml @@ -15,7 +15,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2.2.2 with: - python-version: 3.8 + python-version: 3.12 - name: Install Poetry run: pipx install poetry diff --git a/.github/workflows/test-upstream.yaml b/.github/workflows/test-upstream.yaml index eb07758c..dff2097c 100644 --- a/.github/workflows/test-upstream.yaml +++ b/.github/workflows/test-upstream.yaml @@ -10,14 +10,14 @@ jobs: strategy: matrix: os: [ ubuntu-latest, windows-latest ] - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] exclude: - - os: windows-latest - python-version: "3.9" - os: windows-latest python-version: "3.10" - os: windows-latest python-version: "3.11" + - os: windows-latest + python-version: "3.12" runs-on: ${{ matrix.os }} env: POETRY_VIRTUALENVS_IN_PROJECT: true diff --git a/linkml_runtime/__init__.py b/linkml_runtime/__init__.py index 6cc39aa1..3062326e 100644 --- a/linkml_runtime/__init__.py +++ b/linkml_runtime/__init__.py @@ -3,6 +3,10 @@ from linkml_runtime.utils.schemaview import SchemaView from rdflib import RDF, RDFS, SKOS, XSD, OWL +__all__ = [ + "SchemaView", +] + # use importlib.metadata to read the version provided # by the package during installation. Do not hardcode # the version in the code diff --git a/linkml_runtime/dumpers/delimited_file_dumper.py b/linkml_runtime/dumpers/delimited_file_dumper.py index b144eaa8..d9e53574 100644 --- a/linkml_runtime/dumpers/delimited_file_dumper.py +++ b/linkml_runtime/dumpers/delimited_file_dumper.py @@ -1,5 +1,4 @@ import io -import yaml import json from abc import ABC, abstractmethod from typing import Union diff --git a/linkml_runtime/dumpers/json_dumper.py b/linkml_runtime/dumpers/json_dumper.py index 45837f05..6b34305f 100644 --- a/linkml_runtime/dumpers/json_dumper.py +++ b/linkml_runtime/dumpers/json_dumper.py @@ -1,6 +1,6 @@ import json from decimal import Decimal -from typing import Dict, Union +from typing import Union from pydantic import BaseModel from deprecated.classic import deprecated @@ -67,7 +67,7 @@ def default(o): @staticmethod @deprecated("Use `utils/formatutils/remove_empty_items` instead") - def remove_empty_items(obj: Dict) -> Dict: + def remove_empty_items(obj: dict) -> dict: """ Remove empty items from obj :param obj: diff --git a/linkml_runtime/dumpers/rdflib_dumper.py b/linkml_runtime/dumpers/rdflib_dumper.py index 4a3d1864..9d61c282 100644 --- a/linkml_runtime/dumpers/rdflib_dumper.py +++ b/linkml_runtime/dumpers/rdflib_dumper.py @@ -1,7 +1,6 @@ import logging import urllib -from abc import abstractmethod -from typing import Optional, Any, Dict, Union +from typing import Optional, Any, Union from pydantic import BaseModel from curies import Converter @@ -31,7 +30,7 @@ def as_rdf_graph( self, element: Union[BaseModel, YAMLRoot], schemaview: SchemaView, - prefix_map: Union[Dict[str, str], Converter, None] = None, + prefix_map: Union[dict[str, str], Converter, None] = None, ) -> Graph: """ Dumps from element to an rdflib Graph, @@ -154,7 +153,7 @@ def dump( to_file: str, schemaview: SchemaView = None, fmt: str = 'turtle', - prefix_map: Union[Dict[str, str], Converter, None] = None, + prefix_map: Union[dict[str, str], Converter, None] = None, **args, ) -> None: """ @@ -174,7 +173,7 @@ def dumps( element: Union[BaseModel, YAMLRoot], schemaview: SchemaView = None, fmt: Optional[str] = 'turtle', - prefix_map: Union[Dict[str, str], Converter, None] = None, + prefix_map: Union[dict[str, str], Converter, None] = None, ) -> str: """ Convert element into an RDF graph guided by the schema diff --git a/linkml_runtime/index/object_index.py b/linkml_runtime/index/object_index.py index 56c7cbe3..a473a1c2 100644 --- a/linkml_runtime/index/object_index.py +++ b/linkml_runtime/index/object_index.py @@ -10,7 +10,8 @@ """ import logging import inspect -from typing import Mapping, Any, Optional, Tuple, List, Iterator, Union +from typing import Any, Union +from collections.abc import Mapping, Iterator from linkml_runtime import SchemaView from linkml_runtime.utils import eval_utils @@ -54,8 +55,8 @@ def __init__(self, obj: YAMLRoot, schemaview: SchemaView): self._schemaview = schemaview self._class_map = schemaview.class_name_mappings() self._source_object_cache: Mapping[str, Any] = {} - self._proxy_object_cache: Mapping[str, "ProxyObject"] = {} - self._child_to_parent: Mapping[str, List[Tuple[str, str]]] = {} + self._proxy_object_cache: Mapping[str, ProxyObject] = {} + self._child_to_parent: Mapping[str, list[tuple[str, str]]] = {} self._index(obj) def _index(self, obj: Any, parent_key=None, parent=None): @@ -112,7 +113,7 @@ def bless(self, obj: Any) -> "ProxyObject": else: return ProxyObject(obj, _db=self) - def _key(self, obj: Any) -> Tuple[Union[str, YAMLRoot], str]: + def _key(self, obj: Any) -> tuple[Union[str, YAMLRoot], str]: """ Returns primary key value for this object. @@ -265,6 +266,6 @@ def _map(self, obj: Any, in_range: str) -> Any: return cls(obj) return obj - def _attributes(self) -> List[str]: + def _attributes(self) -> list[str]: return list(vars(self._shadowed).keys()) diff --git a/linkml_runtime/linkml_model/__init__.py b/linkml_runtime/linkml_model/__init__.py index 3c86968a..587788d0 100644 --- a/linkml_runtime/linkml_model/__init__.py +++ b/linkml_runtime/linkml_model/__init__.py @@ -8,3 +8,49 @@ Definition, EnumDefinition, SlotDefinition, ClassDefinition, Prefix, LocalName, Example, AltDescription, \ PermissibleValue, PvFormulaOptions +__all__ = [ + "String", + "Integer", + "Boolean", + "Float", + "Double", + "Decimal", + "Time", + "Date", + "Datetime", + "Uriorcurie", + "Uri", + "Ncname", + "Objectidentifier", + "Nodeidentifier", + "Extension", + "Extensible", + "Annotation", + "Annotatable", + "ElementName", + "SchemaDefinitionName", + "TypeDefinitionName", + "SubsetDefinitionName", + "DefinitionName", + "EnumDefinitionName", + "SlotDefinitionName", + "ClassDefinitionName", + "PrefixPrefixPrefix", + "LocalNameLocalNameSource", + "AltDescriptionSource", + "PermissibleValueText", + "Element", + "SchemaDefinition", + "TypeDefinition", + "SubsetDefinition", + "Definition", + "EnumDefinition", + "SlotDefinition", + "ClassDefinition", + "Prefix", + "LocalName", + "Example", + "AltDescription", + "PermissibleValue", + "PvFormulaOptions", +] diff --git a/linkml_runtime/linkml_model/annotations.py b/linkml_runtime/linkml_model/annotations.py index 9b229b22..3055634e 100644 --- a/linkml_runtime/linkml_model/annotations.py +++ b/linkml_runtime/linkml_model/annotations.py @@ -7,22 +7,16 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from .extensions import AnyValue, Extension, ExtensionTag -from .types import Uriorcurie -from linkml_runtime.utils.metamodelcore import URIorCURIE metamodel_version = "1.7.0" version = "2.0.0" @@ -47,16 +41,16 @@ class Annotatable(YAMLRoot): """ mixin for classes that support annotations """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Annotatable"] class_class_curie: ClassVar[str] = "linkml:Annotatable" class_name: ClassVar[str] = "annotatable" class_model_uri: ClassVar[URIRef] = LINKML.Annotatable - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, "Annotation"]], List[Union[dict, "Annotation"]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, "Annotation"]], list[Union[dict, "Annotation"]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_dict(slot_name="annotations", slot_type=Annotation, key_name="tag", keyed=True) super().__post_init__(**kwargs) @@ -67,7 +61,7 @@ class Annotation(Extension): """ a tag/value pair with the semantics of OWL Annotation """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Annotation"] class_class_curie: ClassVar[str] = "linkml:Annotation" @@ -76,9 +70,9 @@ class Annotation(Extension): tag: Union[str, AnnotationTag] = None value: Union[dict, AnyValue] = None - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, "Annotation"]], List[Union[dict, "Annotation"]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, "Annotation"]], list[Union[dict, "Annotation"]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.tag): self.MissingRequiredField("tag") if not isinstance(self.tag, AnnotationTag): @@ -97,4 +91,4 @@ class slots: pass slots.annotations = Slot(uri=LINKML.annotations, name="annotations", curie=LINKML.curie('annotations'), - model_uri=LINKML.annotations, domain=None, range=Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, "Annotation"]], List[Union[dict, "Annotation"]]]]) + model_uri=LINKML.annotations, domain=None, range=Optional[Union[dict[Union[str, AnnotationTag], Union[dict, "Annotation"]], list[Union[dict, "Annotation"]]]]) diff --git a/linkml_runtime/linkml_model/datasets.py b/linkml_runtime/linkml_model/datasets.py index e8bb1521..02c7f3cc 100644 --- a/linkml_runtime/linkml_model/datasets.py +++ b/linkml_runtime/linkml_model/datasets.py @@ -7,20 +7,16 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_list +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from .types import Datetime, Integer, String, Uri, Uriorcurie from linkml_runtime.utils.metamodelcore import URI, URIorCURIE, XSDDateTime metamodel_version = "1.7.0" @@ -73,7 +69,7 @@ class Information(YAMLRoot): """ Grouping for datasets and data files """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = DATASETS["Information"] class_class_curie: ClassVar[str] = "datasets:Information" @@ -91,16 +87,16 @@ class Information(YAMLRoot): version: Optional[str] = None language: Optional[str] = None publisher: Optional[Union[str, URIorCURIE]] = None - keywords: Optional[Union[str, List[str]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() issued: Optional[Union[str, XSDDateTime]] = None created_by: Optional[Union[str, URIorCURIE]] = None created_on: Optional[Union[str, XSDDateTime]] = None compression: Optional[str] = None was_derived_from: Optional[str] = None page: Optional[str] = None - test_roles: Optional[Union[Union[str, "TestRole"], List[Union[str, "TestRole"]]]] = empty_list() + test_roles: Optional[Union[Union[str, "TestRole"], list[Union[str, "TestRole"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, InformationId): @@ -170,7 +166,7 @@ class DataPackage(Information): """ A collection of data resources """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VOID["Dataset"] class_class_curie: ClassVar[str] = "void:Dataset" @@ -178,9 +174,9 @@ class DataPackage(Information): class_model_uri: ClassVar[URIRef] = DATASETS.DataPackage id: Union[str, DataPackageId] = None - resources: Optional[Union[Union[str, DataResourceId], List[Union[str, DataResourceId]]]] = empty_list() + resources: Optional[Union[Union[str, DataResourceId], list[Union[str, DataResourceId]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, DataPackageId): @@ -198,7 +194,7 @@ class DataResource(Information): """ An individual file or table """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = DCAT["Distribution"] class_class_curie: ClassVar[str] = "dcat:Distribution" @@ -218,7 +214,7 @@ class DataResource(Information): sha256: Optional[str] = None dialect: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, DataResourceId): @@ -265,7 +261,7 @@ class FormatDialect(YAMLRoot): """ Additional format information for a file """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = DATASETS["FormatDialect"] class_class_curie: ClassVar[str] = "datasets:FormatDialect" @@ -278,7 +274,7 @@ class FormatDialect(YAMLRoot): header: Optional[str] = None quote_char: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.comment_prefix is not None and not isinstance(self.comment_prefix, str): self.comment_prefix = str(self.comment_prefix) @@ -493,16 +489,16 @@ class slots: model_uri=DATASETS.profile, domain=None, range=Optional[Union[str, URIorCURIE]]) slots.keywords = Slot(uri=DCAT.keyword, name="keywords", curie=DCAT.curie('keyword'), - model_uri=DATASETS.keywords, domain=None, range=Optional[Union[str, List[str]]]) + model_uri=DATASETS.keywords, domain=None, range=Optional[Union[str, list[str]]]) slots.themes = Slot(uri=DCAT.theme, name="themes", curie=DCAT.curie('theme'), - model_uri=DATASETS.themes, domain=None, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=DATASETS.themes, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.resources = Slot(uri=DCAT.distribution, name="resources", curie=DCAT.curie('distribution'), - model_uri=DATASETS.resources, domain=None, range=Optional[Union[Union[str, DataResourceId], List[Union[str, DataResourceId]]]]) + model_uri=DATASETS.resources, domain=None, range=Optional[Union[Union[str, DataResourceId], list[Union[str, DataResourceId]]]]) slots.test_roles = Slot(uri=DATASETS.test_roles, name="test_roles", curie=DATASETS.curie('test_roles'), - model_uri=DATASETS.test_roles, domain=None, range=Optional[Union[Union[str, "TestRole"], List[Union[str, "TestRole"]]]]) + model_uri=DATASETS.test_roles, domain=None, range=Optional[Union[Union[str, "TestRole"], list[Union[str, "TestRole"]]]]) slots.created_by = Slot(uri=PAV.createdBy, name="created_by", curie=PAV.curie('createdBy'), model_uri=DATASETS.created_by, domain=None, range=Optional[Union[str, URIorCURIE]]) diff --git a/linkml_runtime/linkml_model/extensions.py b/linkml_runtime/linkml_model/extensions.py index 3fe8b661..05e1fbc5 100644 --- a/linkml_runtime/linkml_model/extensions.py +++ b/linkml_runtime/linkml_model/extensions.py @@ -7,20 +7,15 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from .types import Uriorcurie from linkml_runtime.utils.metamodelcore import URIorCURIE metamodel_version = "1.7.0" @@ -48,7 +43,7 @@ class Extension(YAMLRoot): """ a tag/value pair used to add non-model information to an entry """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Extension"] class_class_curie: ClassVar[str] = "linkml:Extension" @@ -57,9 +52,9 @@ class Extension(YAMLRoot): tag: Union[str, ExtensionTag] = None value: Union[dict, AnyValue] = None - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, "Extension"]], List[Union[dict, "Extension"]]]] = empty_dict() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, "Extension"]], list[Union[dict, "Extension"]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.tag): self.MissingRequiredField("tag") if not isinstance(self.tag, ExtensionTag): @@ -75,16 +70,16 @@ class Extensible(YAMLRoot): """ mixin for classes that support extension """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Extensible"] class_class_curie: ClassVar[str] = "linkml:Extensible" class_name: ClassVar[str] = "extensible" class_model_uri: ClassVar[URIRef] = LINKML.Extensible - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_dict(slot_name="extensions", slot_type=Extension, key_name="tag", keyed=True) super().__post_init__(**kwargs) @@ -98,7 +93,7 @@ class slots: pass slots.extensions = Slot(uri=LINKML.extensions, name="extensions", curie=LINKML.curie('extensions'), - model_uri=LINKML.extensions, domain=None, range=Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]]) + model_uri=LINKML.extensions, domain=None, range=Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]]) slots.extension_tag = Slot(uri=LINKML.tag, name="extension_tag", curie=LINKML.curie('tag'), model_uri=LINKML.extension_tag, domain=Extension, range=Union[str, ExtensionTag]) diff --git a/linkml_runtime/linkml_model/linkml_files.py b/linkml_runtime/linkml_model/linkml_files.py index bce1ca5b..a2a58c08 100644 --- a/linkml_runtime/linkml_model/linkml_files.py +++ b/linkml_runtime/linkml_model/linkml_files.py @@ -1,6 +1,6 @@ from pathlib import Path from enum import Enum, auto -from typing import Dict, Optional, Union, Tuple, NamedTuple +from typing import Optional, Union, NamedTuple from urllib.parse import urljoin from dataclasses import dataclass @@ -87,7 +87,7 @@ class _Path: YAML = FormatPath(str(Path("model") / "schema"),"yaml" ) @classmethod - def items(cls) -> Dict[str, FormatPath]: + def items(cls) -> dict[str, FormatPath]: return {k:v for k,v in cls.__dict__.items() if not k.startswith('_')} @classmethod diff --git a/linkml_runtime/linkml_model/mappings.py b/linkml_runtime/linkml_model/mappings.py index d6135152..e2232494 100644 --- a/linkml_runtime/linkml_model/mappings.py +++ b/linkml_runtime/linkml_model/mappings.py @@ -7,20 +7,11 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any -from dataclasses import dataclass +from typing import Optional, Union from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from .types import Uriorcurie from linkml_runtime.utils.metamodelcore import URIorCURIE metamodel_version = "1.7.0" @@ -55,22 +46,22 @@ class slots: pass slots.mappings = Slot(uri=SKOS.mappingRelation, name="mappings", curie=SKOS.curie('mappingRelation'), - model_uri=LINKML.mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.exact_mappings = Slot(uri=SKOS.exactMatch, name="exact mappings", curie=SKOS.curie('exactMatch'), - model_uri=LINKML.exact_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.exact_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.close_mappings = Slot(uri=SKOS.closeMatch, name="close mappings", curie=SKOS.curie('closeMatch'), - model_uri=LINKML.close_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.close_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.related_mappings = Slot(uri=SKOS.relatedMatch, name="related mappings", curie=SKOS.curie('relatedMatch'), - model_uri=LINKML.related_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.related_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.narrow_mappings = Slot(uri=SKOS.narrowMatch, name="narrow mappings", curie=SKOS.curie('narrowMatch'), - model_uri=LINKML.narrow_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.narrow_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.broad_mappings = Slot(uri=SKOS.broadMatch, name="broad mappings", curie=SKOS.curie('broadMatch'), - model_uri=LINKML.broad_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.broad_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.deprecated_element_has_exact_replacement = Slot(uri=LINKML.deprecated_element_has_exact_replacement, name="deprecated element has exact replacement", curie=LINKML.curie('deprecated_element_has_exact_replacement'), model_uri=LINKML.deprecated_element_has_exact_replacement, domain=None, range=Optional[Union[str, URIorCURIE]], mappings = [IAO["0100001"]]) diff --git a/linkml_runtime/linkml_model/meta.py b/linkml_runtime/linkml_model/meta.py index fee7f676..4bbfa3dd 100644 --- a/linkml_runtime/linkml_model/meta.py +++ b/linkml_runtime/linkml_model/meta.py @@ -31,22 +31,20 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from jsonasobj2 import as_dict +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_list, empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx +from linkml_runtime.utils.formatutils import sfx from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from .annotations import Annotation, AnnotationTag from .extensions import Extension, ExtensionTag -from .types import Boolean, Datetime, Integer, Ncname, String, Uri, Uriorcurie from .units import UnitOfMeasure from linkml_runtime.utils.metamodelcore import Bool, NCName, URI, URIorCURIE, XSDDateTime @@ -153,7 +151,7 @@ class CommonMetadata(YAMLRoot): """ Generic metadata shared across definitions """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["CommonMetadata"] class_class_curie: ClassVar[str] = "linkml:CommonMetadata" @@ -161,40 +159,40 @@ class CommonMetadata(YAMLRoot): class_model_uri: ClassVar[URIRef] = LINKML.CommonMetadata description: Optional[str] = None - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], List[Union[dict, "StructuredAlias"]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], list[Union[dict, "StructuredAlias"]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None rank: Optional[int] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - keywords: Optional[Union[str, List[str]]] = empty_list() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) @@ -316,7 +314,7 @@ class Element(YAMLRoot): """ A named element in the model """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Element"] class_class_curie: ClassVar[str] = "linkml:Element" @@ -324,50 +322,50 @@ class Element(YAMLRoot): class_model_uri: ClassVar[URIRef] = LINKML.Element name: Union[str, ElementName] = None - id_prefixes: Optional[Union[Union[str, NCName], List[Union[str, NCName]]]] = empty_list() + id_prefixes: Optional[Union[Union[str, NCName], list[Union[str, NCName]]]] = empty_list() id_prefixes_are_closed: Optional[Union[bool, Bool]] = None definition_uri: Optional[Union[str, URIorCURIE]] = None - local_names: Optional[Union[Dict[Union[str, LocalNameLocalNameSource], Union[dict, "LocalName"]], List[Union[dict, "LocalName"]]]] = empty_dict() + local_names: Optional[Union[dict[Union[str, LocalNameLocalNameSource], Union[dict, "LocalName"]], list[Union[dict, "LocalName"]]]] = empty_dict() conforms_to: Optional[str] = None - implements: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - instantiates: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict() + implements: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + instantiates: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], List[Union[dict, "StructuredAlias"]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], list[Union[dict, "StructuredAlias"]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None rank: Optional[int] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - keywords: Optional[Union[str, List[str]]] = empty_list() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.name): self.MissingRequiredField("name") if not isinstance(self.name, ElementName): @@ -521,7 +519,7 @@ class SchemaDefinition(Element): """ A collection of definitions that make up a schema or a data model. """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["SchemaDefinition"] class_class_curie: ClassVar[str] = "linkml:SchemaDefinition" @@ -531,28 +529,28 @@ class SchemaDefinition(Element): name: Union[str, SchemaDefinitionName] = None id: Union[str, URI] = None version: Optional[str] = None - imports: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + imports: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() license: Optional[str] = None - prefixes: Optional[Union[Dict[Union[str, PrefixPrefixPrefix], Union[dict, "Prefix"]], List[Union[dict, "Prefix"]]]] = empty_dict() - emit_prefixes: Optional[Union[Union[str, NCName], List[Union[str, NCName]]]] = empty_list() - default_curi_maps: Optional[Union[str, List[str]]] = empty_list() + prefixes: Optional[Union[dict[Union[str, PrefixPrefixPrefix], Union[dict, "Prefix"]], list[Union[dict, "Prefix"]]]] = empty_dict() + emit_prefixes: Optional[Union[Union[str, NCName], list[Union[str, NCName]]]] = empty_list() + default_curi_maps: Optional[Union[str, list[str]]] = empty_list() default_prefix: Optional[str] = None default_range: Optional[Union[str, TypeDefinitionName]] = None - subsets: Optional[Union[Dict[Union[str, SubsetDefinitionName], Union[dict, "SubsetDefinition"]], List[Union[dict, "SubsetDefinition"]]]] = empty_dict() - types: Optional[Union[Dict[Union[str, TypeDefinitionName], Union[dict, "TypeDefinition"]], List[Union[dict, "TypeDefinition"]]]] = empty_dict() - enums: Optional[Union[Dict[Union[str, EnumDefinitionName], Union[dict, "EnumDefinition"]], List[Union[dict, "EnumDefinition"]]]] = empty_dict() - slots: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, "SlotDefinition"]], List[Union[dict, "SlotDefinition"]]]] = empty_dict() - classes: Optional[Union[Dict[Union[str, ClassDefinitionName], Union[dict, "ClassDefinition"]], List[Union[dict, "ClassDefinition"]]]] = empty_dict() + subsets: Optional[Union[dict[Union[str, SubsetDefinitionName], Union[dict, "SubsetDefinition"]], list[Union[dict, "SubsetDefinition"]]]] = empty_dict() + types: Optional[Union[dict[Union[str, TypeDefinitionName], Union[dict, "TypeDefinition"]], list[Union[dict, "TypeDefinition"]]]] = empty_dict() + enums: Optional[Union[dict[Union[str, EnumDefinitionName], Union[dict, "EnumDefinition"]], list[Union[dict, "EnumDefinition"]]]] = empty_dict() + slots: Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, "SlotDefinition"]], list[Union[dict, "SlotDefinition"]]]] = empty_dict() + classes: Optional[Union[dict[Union[str, ClassDefinitionName], Union[dict, "ClassDefinition"]], list[Union[dict, "ClassDefinition"]]]] = empty_dict() metamodel_version: Optional[str] = None source_file: Optional[str] = None source_file_date: Optional[Union[str, XSDDateTime]] = None source_file_size: Optional[int] = None generation_date: Optional[Union[str, XSDDateTime]] = None slot_names_unique: Optional[Union[bool, Bool]] = None - settings: Optional[Union[Dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], List[Union[dict, "Setting"]]]] = empty_dict() - bindings: Optional[Union[Union[dict, "EnumBinding"], List[Union[dict, "EnumBinding"]]]] = empty_list() + settings: Optional[Union[dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], list[Union[dict, "Setting"]]]] = empty_dict() + bindings: Optional[Union[Union[dict, "EnumBinding"], list[Union[dict, "EnumBinding"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.default_prefix is None: self.default_prefix = sfx(str(self.id)) if self._is_empty(self.name): @@ -633,7 +631,7 @@ class AnonymousTypeExpression(YAMLRoot): """ A type expression that is not a top-level named type definition. Used for nesting. """ - _inherited_slots: ClassVar[List[str]] = ["pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "minimum_value", "maximum_value"] + _inherited_slots: ClassVar[list[str]] = ["pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "minimum_value", "maximum_value"] class_class_uri: ClassVar[URIRef] = LINKML["AnonymousTypeExpression"] class_class_curie: ClassVar[str] = "linkml:AnonymousTypeExpression" @@ -645,16 +643,16 @@ class AnonymousTypeExpression(YAMLRoot): unit: Optional[Union[dict, UnitOfMeasure]] = None implicit_prefix: Optional[str] = None equals_string: Optional[str] = None - equals_string_in: Optional[Union[str, List[str]]] = empty_list() + equals_string_in: Optional[Union[str, list[str]]] = empty_list() equals_number: Optional[int] = None minimum_value: Optional[Union[dict, Anything]] = None maximum_value: Optional[Union[dict, Anything]] = None - none_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - any_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - all_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() + none_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() + exactly_one_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() + any_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() + all_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.pattern is not None and not isinstance(self.pattern, str): self.pattern = str(self.pattern) @@ -701,7 +699,7 @@ class TypeDefinition(Element): """ an element that whose instances are atomic scalar values that can be mapped to primitive types """ - _inherited_slots: ClassVar[List[str]] = ["base", "uri", "repr", "pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "minimum_value", "maximum_value"] + _inherited_slots: ClassVar[list[str]] = ["base", "uri", "repr", "pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "minimum_value", "maximum_value"] class_class_uri: ClassVar[URIRef] = LINKML["TypeDefinition"] class_class_curie: ClassVar[str] = "linkml:TypeDefinition" @@ -713,22 +711,22 @@ class TypeDefinition(Element): base: Optional[str] = None uri: Optional[Union[str, URIorCURIE]] = None repr: Optional[str] = None - union_of: Optional[Union[Union[str, TypeDefinitionName], List[Union[str, TypeDefinitionName]]]] = empty_list() + union_of: Optional[Union[Union[str, TypeDefinitionName], list[Union[str, TypeDefinitionName]]]] = empty_list() pattern: Optional[str] = None structured_pattern: Optional[Union[dict, "PatternExpression"]] = None unit: Optional[Union[dict, UnitOfMeasure]] = None implicit_prefix: Optional[str] = None equals_string: Optional[str] = None - equals_string_in: Optional[Union[str, List[str]]] = empty_list() + equals_string_in: Optional[Union[str, list[str]]] = empty_list() equals_number: Optional[int] = None minimum_value: Optional[Union[dict, Anything]] = None maximum_value: Optional[Union[dict, Anything]] = None - none_of: Optional[Union[Union[dict, AnonymousTypeExpression], List[Union[dict, AnonymousTypeExpression]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, AnonymousTypeExpression], List[Union[dict, AnonymousTypeExpression]]]] = empty_list() - any_of: Optional[Union[Union[dict, AnonymousTypeExpression], List[Union[dict, AnonymousTypeExpression]]]] = empty_list() - all_of: Optional[Union[Union[dict, AnonymousTypeExpression], List[Union[dict, AnonymousTypeExpression]]]] = empty_list() + none_of: Optional[Union[Union[dict, AnonymousTypeExpression], list[Union[dict, AnonymousTypeExpression]]]] = empty_list() + exactly_one_of: Optional[Union[Union[dict, AnonymousTypeExpression], list[Union[dict, AnonymousTypeExpression]]]] = empty_list() + any_of: Optional[Union[Union[dict, AnonymousTypeExpression], list[Union[dict, AnonymousTypeExpression]]]] = empty_list() + all_of: Optional[Union[Union[dict, AnonymousTypeExpression], list[Union[dict, AnonymousTypeExpression]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.name): self.MissingRequiredField("name") if not isinstance(self.name, TypeDefinitionName): @@ -796,7 +794,7 @@ class SubsetDefinition(Element): """ an element that can be used to group other metamodel elements """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["SubsetDefinition"] class_class_curie: ClassVar[str] = "linkml:SubsetDefinition" @@ -805,7 +803,7 @@ class SubsetDefinition(Element): name: Union[str, SubsetDefinitionName] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.name): self.MissingRequiredField("name") if not isinstance(self.name, SubsetDefinitionName): @@ -819,7 +817,7 @@ class Definition(Element): """ abstract base class for core metaclasses """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Definition"] class_class_curie: ClassVar[str] = "linkml:Definition" @@ -830,12 +828,12 @@ class Definition(Element): is_a: Optional[Union[str, DefinitionName]] = None abstract: Optional[Union[bool, Bool]] = None mixin: Optional[Union[bool, Bool]] = None - mixins: Optional[Union[Union[str, DefinitionName], List[Union[str, DefinitionName]]]] = empty_list() - apply_to: Optional[Union[Union[str, DefinitionName], List[Union[str, DefinitionName]]]] = empty_list() - values_from: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + mixins: Optional[Union[Union[str, DefinitionName], list[Union[str, DefinitionName]]]] = empty_list() + apply_to: Optional[Union[Union[str, DefinitionName], list[Union[str, DefinitionName]]]] = empty_list() + values_from: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() string_serialization: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.is_a is not None and not isinstance(self.is_a, DefinitionName): self.is_a = DefinitionName(self.is_a) @@ -868,7 +866,7 @@ class AnonymousEnumExpression(YAMLRoot): """ An enum_expression that is not named """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["AnonymousEnumExpression"] class_class_curie: ClassVar[str] = "linkml:AnonymousEnumExpression" @@ -879,15 +877,15 @@ class AnonymousEnumExpression(YAMLRoot): code_set_tag: Optional[str] = None code_set_version: Optional[str] = None pv_formula: Optional[Union[str, "PvFormulaOptions"]] = None - permissible_values: Optional[Union[Dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], List[Union[dict, "PermissibleValue"]]]] = empty_dict() - include: Optional[Union[Union[dict, "AnonymousEnumExpression"], List[Union[dict, "AnonymousEnumExpression"]]]] = empty_list() - minus: Optional[Union[Union[dict, "AnonymousEnumExpression"], List[Union[dict, "AnonymousEnumExpression"]]]] = empty_list() - inherits: Optional[Union[Union[str, EnumDefinitionName], List[Union[str, EnumDefinitionName]]]] = empty_list() + permissible_values: Optional[Union[dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], list[Union[dict, "PermissibleValue"]]]] = empty_dict() + include: Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]] = empty_list() + minus: Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]] = empty_list() + inherits: Optional[Union[Union[str, EnumDefinitionName], list[Union[str, EnumDefinitionName]]]] = empty_list() reachable_from: Optional[Union[dict, "ReachabilityQuery"]] = None matches: Optional[Union[dict, "MatchQuery"]] = None - concepts: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + concepts: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.code_set is not None and not isinstance(self.code_set, URIorCURIE): self.code_set = URIorCURIE(self.code_set) @@ -932,7 +930,7 @@ class EnumDefinition(Definition): """ an element whose instances must be drawn from a specified set of permissible values """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["EnumDefinition"] class_class_curie: ClassVar[str] = "linkml:EnumDefinition" @@ -945,15 +943,15 @@ class EnumDefinition(Definition): code_set_tag: Optional[str] = None code_set_version: Optional[str] = None pv_formula: Optional[Union[str, "PvFormulaOptions"]] = None - permissible_values: Optional[Union[Dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], List[Union[dict, "PermissibleValue"]]]] = empty_dict() - include: Optional[Union[Union[dict, AnonymousEnumExpression], List[Union[dict, AnonymousEnumExpression]]]] = empty_list() - minus: Optional[Union[Union[dict, AnonymousEnumExpression], List[Union[dict, AnonymousEnumExpression]]]] = empty_list() - inherits: Optional[Union[Union[str, EnumDefinitionName], List[Union[str, EnumDefinitionName]]]] = empty_list() + permissible_values: Optional[Union[dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], list[Union[dict, "PermissibleValue"]]]] = empty_dict() + include: Optional[Union[Union[dict, AnonymousEnumExpression], list[Union[dict, AnonymousEnumExpression]]]] = empty_list() + minus: Optional[Union[Union[dict, AnonymousEnumExpression], list[Union[dict, AnonymousEnumExpression]]]] = empty_list() + inherits: Optional[Union[Union[str, EnumDefinitionName], list[Union[str, EnumDefinitionName]]]] = empty_list() reachable_from: Optional[Union[dict, "ReachabilityQuery"]] = None matches: Optional[Union[dict, "MatchQuery"]] = None - concepts: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + concepts: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.name): self.MissingRequiredField("name") if not isinstance(self.name, EnumDefinitionName): @@ -1006,7 +1004,7 @@ class EnumBinding(YAMLRoot): """ A binding of a slot or a class to a permissible value from an enumeration. """ - _inherited_slots: ClassVar[List[str]] = ["range"] + _inherited_slots: ClassVar[list[str]] = ["range"] class_class_uri: ClassVar[URIRef] = LINKML["EnumBinding"] class_class_curie: ClassVar[str] = "linkml:EnumBinding" @@ -1017,43 +1015,43 @@ class EnumBinding(YAMLRoot): obligation_level: Optional[Union[str, "ObligationLevelEnum"]] = None binds_value_of: Optional[str] = None pv_formula: Optional[Union[str, "PvFormulaOptions"]] = None - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], List[Union[dict, "StructuredAlias"]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], list[Union[dict, "StructuredAlias"]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None rank: Optional[int] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - keywords: Optional[Union[str, List[str]]] = empty_list() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.range is not None and not isinstance(self.range, EnumDefinitionName): self.range = EnumDefinitionName(self.range) @@ -1192,7 +1190,7 @@ class MatchQuery(YAMLRoot): A query that is used on an enum expression to dynamically obtain a set of permissivle values via a query that matches on properties of the external concepts. """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["MatchQuery"] class_class_curie: ClassVar[str] = "linkml:MatchQuery" @@ -1202,7 +1200,7 @@ class MatchQuery(YAMLRoot): identifier_pattern: Optional[str] = None source_ontology: Optional[Union[str, URIorCURIE]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.identifier_pattern is not None and not isinstance(self.identifier_pattern, str): self.identifier_pattern = str(self.identifier_pattern) @@ -1218,7 +1216,7 @@ class ReachabilityQuery(YAMLRoot): A query that is used on an enum expression to dynamically obtain a set of permissible values via walking from a set of source nodes to a set of descendants or ancestors over a set of relationship types. """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["ReachabilityQuery"] class_class_curie: ClassVar[str] = "linkml:ReachabilityQuery" @@ -1226,13 +1224,13 @@ class ReachabilityQuery(YAMLRoot): class_model_uri: ClassVar[URIRef] = LINKML.ReachabilityQuery source_ontology: Optional[Union[str, URIorCURIE]] = None - source_nodes: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - relationship_types: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + source_nodes: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + relationship_types: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() is_direct: Optional[Union[bool, Bool]] = None include_self: Optional[Union[bool, Bool]] = None traverse_up: Optional[Union[bool, Bool]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.source_ontology is not None and not isinstance(self.source_ontology, URIorCURIE): self.source_ontology = URIorCURIE(self.source_ontology) @@ -1262,7 +1260,7 @@ class StructuredAlias(YAMLRoot): object that contains meta data about a synonym or alias including where it came from (source) and its scope (narrow, broad, etc.) """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SKOSXL["Label"] class_class_curie: ClassVar[str] = "skosxl:Label" @@ -1271,44 +1269,44 @@ class StructuredAlias(YAMLRoot): literal_form: str = None predicate: Optional[Union[str, "AliasPredicateEnum"]] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - contexts: Optional[Union[Union[str, URI], List[Union[str, URI]]]] = empty_list() - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + contexts: Optional[Union[Union[str, URI], list[Union[str, URI]]]] = empty_list() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], List[Union[dict, "StructuredAlias"]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], list[Union[dict, "StructuredAlias"]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None rank: Optional[int] = None - keywords: Optional[Union[str, List[str]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.literal_form): self.MissingRequiredField("literal_form") if not isinstance(self.literal_form, str): @@ -1445,7 +1443,7 @@ class Expression(YAMLRoot): """ general mixin for any class that can represent some form of expression """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Expression"] class_class_curie: ClassVar[str] = "linkml:Expression" @@ -1458,7 +1456,7 @@ class TypeExpression(Expression): """ An abstract class grouping named types and anonymous type expressions """ - _inherited_slots: ClassVar[List[str]] = ["pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "minimum_value", "maximum_value"] + _inherited_slots: ClassVar[list[str]] = ["pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "minimum_value", "maximum_value"] class_class_uri: ClassVar[URIRef] = LINKML["TypeExpression"] class_class_curie: ClassVar[str] = "linkml:TypeExpression" @@ -1470,16 +1468,16 @@ class TypeExpression(Expression): unit: Optional[Union[dict, UnitOfMeasure]] = None implicit_prefix: Optional[str] = None equals_string: Optional[str] = None - equals_string_in: Optional[Union[str, List[str]]] = empty_list() + equals_string_in: Optional[Union[str, list[str]]] = empty_list() equals_number: Optional[int] = None minimum_value: Optional[Union[dict, Anything]] = None maximum_value: Optional[Union[dict, Anything]] = None - none_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - any_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - all_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() + none_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() + exactly_one_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() + any_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() + all_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.pattern is not None and not isinstance(self.pattern, str): self.pattern = str(self.pattern) @@ -1526,7 +1524,7 @@ class EnumExpression(Expression): """ An expression that constrains the range of a slot """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["EnumExpression"] class_class_curie: ClassVar[str] = "linkml:EnumExpression" @@ -1537,15 +1535,15 @@ class EnumExpression(Expression): code_set_tag: Optional[str] = None code_set_version: Optional[str] = None pv_formula: Optional[Union[str, "PvFormulaOptions"]] = None - permissible_values: Optional[Union[Dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], List[Union[dict, "PermissibleValue"]]]] = empty_dict() - include: Optional[Union[Union[dict, "AnonymousEnumExpression"], List[Union[dict, "AnonymousEnumExpression"]]]] = empty_list() - minus: Optional[Union[Union[dict, "AnonymousEnumExpression"], List[Union[dict, "AnonymousEnumExpression"]]]] = empty_list() - inherits: Optional[Union[Union[str, EnumDefinitionName], List[Union[str, EnumDefinitionName]]]] = empty_list() + permissible_values: Optional[Union[dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], list[Union[dict, "PermissibleValue"]]]] = empty_dict() + include: Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]] = empty_list() + minus: Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]] = empty_list() + inherits: Optional[Union[Union[str, EnumDefinitionName], list[Union[str, EnumDefinitionName]]]] = empty_list() reachable_from: Optional[Union[dict, "ReachabilityQuery"]] = None matches: Optional[Union[dict, "MatchQuery"]] = None - concepts: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + concepts: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.code_set is not None and not isinstance(self.code_set, URIorCURIE): self.code_set = URIorCURIE(self.code_set) @@ -1590,50 +1588,50 @@ class AnonymousExpression(YAMLRoot): """ An abstract parent class for any nested expression """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["AnonymousExpression"] class_class_curie: ClassVar[str] = "linkml:AnonymousExpression" class_name: ClassVar[str] = "anonymous_expression" class_model_uri: ClassVar[URIRef] = LINKML.AnonymousExpression - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, StructuredAlias], list[Union[dict, StructuredAlias]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None rank: Optional[int] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - keywords: Optional[Union[str, List[str]]] = empty_list() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_dict(slot_name="extensions", slot_type=Extension, key_name="tag", keyed=True) self._normalize_inlined_as_dict(slot_name="annotations", slot_type=Annotation, key_name="tag", keyed=True) @@ -1759,7 +1757,7 @@ class PathExpression(YAMLRoot): """ An expression that describes an abstract path from an object to another through a sequence of slot lookups """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["PathExpression"] class_class_curie: ClassVar[str] = "linkml:PathExpression" @@ -1767,50 +1765,50 @@ class PathExpression(YAMLRoot): class_model_uri: ClassVar[URIRef] = LINKML.PathExpression followed_by: Optional[Union[dict, "PathExpression"]] = None - none_of: Optional[Union[Union[dict, "PathExpression"], List[Union[dict, "PathExpression"]]]] = empty_list() - any_of: Optional[Union[Union[dict, "PathExpression"], List[Union[dict, "PathExpression"]]]] = empty_list() - all_of: Optional[Union[Union[dict, "PathExpression"], List[Union[dict, "PathExpression"]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, "PathExpression"], List[Union[dict, "PathExpression"]]]] = empty_list() + none_of: Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]] = empty_list() + any_of: Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]] = empty_list() + all_of: Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]] = empty_list() + exactly_one_of: Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]] = empty_list() reversed: Optional[Union[bool, Bool]] = None traverse: Optional[Union[str, SlotDefinitionName]] = None range_expression: Optional[Union[dict, "AnonymousClassExpression"]] = None - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, StructuredAlias], list[Union[dict, StructuredAlias]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None rank: Optional[int] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - keywords: Optional[Union[str, List[str]]] = empty_list() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.followed_by is not None and not isinstance(self.followed_by, PathExpression): self.followed_by = PathExpression(**as_dict(self.followed_by)) @@ -1964,7 +1962,7 @@ class SlotExpression(Expression): """ an expression that constrains the range of values a slot can take """ - _inherited_slots: ClassVar[List[str]] = ["range", "required", "recommended", "multivalued", "inlined", "inlined_as_list", "minimum_value", "maximum_value", "pattern", "structured_pattern", "value_presence", "equals_string", "equals_string_in", "equals_number", "equals_expression", "exact_cardinality", "minimum_cardinality", "maximum_cardinality"] + _inherited_slots: ClassVar[list[str]] = ["range", "required", "recommended", "multivalued", "inlined", "inlined_as_list", "minimum_value", "maximum_value", "pattern", "structured_pattern", "value_presence", "equals_string", "equals_string_in", "equals_number", "equals_expression", "exact_cardinality", "minimum_cardinality", "maximum_cardinality"] class_class_uri: ClassVar[URIRef] = LINKML["SlotExpression"] class_class_curie: ClassVar[str] = "linkml:SlotExpression" @@ -1974,7 +1972,7 @@ class SlotExpression(Expression): range: Optional[Union[str, ElementName]] = None range_expression: Optional[Union[dict, "AnonymousClassExpression"]] = None enum_range: Optional[Union[dict, EnumExpression]] = None - bindings: Optional[Union[Union[dict, EnumBinding], List[Union[dict, EnumBinding]]]] = empty_list() + bindings: Optional[Union[Union[dict, EnumBinding], list[Union[dict, EnumBinding]]]] = empty_list() required: Optional[Union[bool, Bool]] = None recommended: Optional[Union[bool, Bool]] = None multivalued: Optional[Union[bool, Bool]] = None @@ -1988,7 +1986,7 @@ class SlotExpression(Expression): implicit_prefix: Optional[str] = None value_presence: Optional[Union[str, "PresenceEnum"]] = None equals_string: Optional[str] = None - equals_string_in: Optional[Union[str, List[str]]] = empty_list() + equals_string_in: Optional[Union[str, list[str]]] = empty_list() equals_number: Optional[int] = None equals_expression: Optional[str] = None exact_cardinality: Optional[int] = None @@ -1996,12 +1994,12 @@ class SlotExpression(Expression): maximum_cardinality: Optional[int] = None has_member: Optional[Union[dict, "AnonymousSlotExpression"]] = None all_members: Optional[Union[dict, "AnonymousSlotExpression"]] = None - none_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - any_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - all_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() + none_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() + exactly_one_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() + any_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() + all_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.range is not None and not isinstance(self.range, ElementName): self.range = ElementName(self.range) @@ -2094,7 +2092,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass(repr=False) class AnonymousSlotExpression(AnonymousExpression): - _inherited_slots: ClassVar[List[str]] = ["range", "required", "recommended", "multivalued", "inlined", "inlined_as_list", "minimum_value", "maximum_value", "pattern", "structured_pattern", "value_presence", "equals_string", "equals_string_in", "equals_number", "equals_expression", "exact_cardinality", "minimum_cardinality", "maximum_cardinality"] + _inherited_slots: ClassVar[list[str]] = ["range", "required", "recommended", "multivalued", "inlined", "inlined_as_list", "minimum_value", "maximum_value", "pattern", "structured_pattern", "value_presence", "equals_string", "equals_string_in", "equals_number", "equals_expression", "exact_cardinality", "minimum_cardinality", "maximum_cardinality"] class_class_uri: ClassVar[URIRef] = LINKML["AnonymousSlotExpression"] class_class_curie: ClassVar[str] = "linkml:AnonymousSlotExpression" @@ -2104,7 +2102,7 @@ class AnonymousSlotExpression(AnonymousExpression): range: Optional[Union[str, ElementName]] = None range_expression: Optional[Union[dict, "AnonymousClassExpression"]] = None enum_range: Optional[Union[dict, EnumExpression]] = None - bindings: Optional[Union[Union[dict, EnumBinding], List[Union[dict, EnumBinding]]]] = empty_list() + bindings: Optional[Union[Union[dict, EnumBinding], list[Union[dict, EnumBinding]]]] = empty_list() required: Optional[Union[bool, Bool]] = None recommended: Optional[Union[bool, Bool]] = None multivalued: Optional[Union[bool, Bool]] = None @@ -2118,7 +2116,7 @@ class AnonymousSlotExpression(AnonymousExpression): implicit_prefix: Optional[str] = None value_presence: Optional[Union[str, "PresenceEnum"]] = None equals_string: Optional[str] = None - equals_string_in: Optional[Union[str, List[str]]] = empty_list() + equals_string_in: Optional[Union[str, list[str]]] = empty_list() equals_number: Optional[int] = None equals_expression: Optional[str] = None exact_cardinality: Optional[int] = None @@ -2126,12 +2124,12 @@ class AnonymousSlotExpression(AnonymousExpression): maximum_cardinality: Optional[int] = None has_member: Optional[Union[dict, "AnonymousSlotExpression"]] = None all_members: Optional[Union[dict, "AnonymousSlotExpression"]] = None - none_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - any_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - all_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() + none_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() + exactly_one_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() + any_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() + all_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.range is not None and not isinstance(self.range, ElementName): self.range = ElementName(self.range) @@ -2227,7 +2225,7 @@ class SlotDefinition(Definition): """ an element that describes how instances are related to other instances """ - _inherited_slots: ClassVar[List[str]] = ["domain", "array", "inherited", "readonly", "ifabsent", "list_elements_unique", "list_elements_ordered", "shared", "key", "identifier", "designates_type", "role", "relational_role", "range", "required", "recommended", "multivalued", "inlined", "inlined_as_list", "minimum_value", "maximum_value", "pattern", "structured_pattern", "value_presence", "equals_string", "equals_string_in", "equals_number", "equals_expression", "exact_cardinality", "minimum_cardinality", "maximum_cardinality"] + _inherited_slots: ClassVar[list[str]] = ["domain", "array", "inherited", "readonly", "ifabsent", "list_elements_unique", "list_elements_ordered", "shared", "key", "identifier", "designates_type", "role", "relational_role", "range", "required", "recommended", "multivalued", "inlined", "inlined_as_list", "minimum_value", "maximum_value", "pattern", "structured_pattern", "value_presence", "equals_string", "equals_string_in", "equals_number", "equals_expression", "exact_cardinality", "minimum_cardinality", "maximum_cardinality"] class_class_uri: ClassVar[URIRef] = LINKML["SlotDefinition"] class_class_curie: ClassVar[str] = "linkml:SlotDefinition" @@ -2250,7 +2248,7 @@ class SlotDefinition(Definition): designates_type: Optional[Union[bool, Bool]] = None alias: Optional[str] = None owner: Optional[Union[str, DefinitionName]] = None - domain_of: Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]] = empty_list() + domain_of: Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]] = empty_list() subproperty_of: Optional[Union[str, SlotDefinitionName]] = None symmetric: Optional[Union[bool, Bool]] = None reflexive: Optional[Union[bool, Bool]] = None @@ -2269,17 +2267,17 @@ class SlotDefinition(Definition): slot_group: Optional[Union[str, SlotDefinitionName]] = None is_grouping_slot: Optional[Union[bool, Bool]] = None path_rule: Optional[Union[dict, PathExpression]] = None - disjoint_with: Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]] = empty_list() + disjoint_with: Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]] = empty_list() children_are_mutually_disjoint: Optional[Union[bool, Bool]] = None - union_of: Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]] = empty_list() - type_mappings: Optional[Union[Union[str, TypeMappingFramework], List[Union[str, TypeMappingFramework]]]] = empty_list() + union_of: Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]] = empty_list() + type_mappings: Optional[Union[Union[str, TypeMappingFramework], list[Union[str, TypeMappingFramework]]]] = empty_list() is_a: Optional[Union[str, SlotDefinitionName]] = None - mixins: Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]] = empty_list() - apply_to: Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]] = empty_list() + mixins: Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]] = empty_list() + apply_to: Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]] = empty_list() range: Optional[Union[str, ElementName]] = None range_expression: Optional[Union[dict, "AnonymousClassExpression"]] = None enum_range: Optional[Union[dict, EnumExpression]] = None - bindings: Optional[Union[Union[dict, EnumBinding], List[Union[dict, EnumBinding]]]] = empty_list() + bindings: Optional[Union[Union[dict, EnumBinding], list[Union[dict, EnumBinding]]]] = empty_list() required: Optional[Union[bool, Bool]] = None recommended: Optional[Union[bool, Bool]] = None multivalued: Optional[Union[bool, Bool]] = None @@ -2293,7 +2291,7 @@ class SlotDefinition(Definition): implicit_prefix: Optional[str] = None value_presence: Optional[Union[str, "PresenceEnum"]] = None equals_string: Optional[str] = None - equals_string_in: Optional[Union[str, List[str]]] = empty_list() + equals_string_in: Optional[Union[str, list[str]]] = empty_list() equals_number: Optional[int] = None equals_expression: Optional[str] = None exact_cardinality: Optional[int] = None @@ -2301,12 +2299,12 @@ class SlotDefinition(Definition): maximum_cardinality: Optional[int] = None has_member: Optional[Union[dict, AnonymousSlotExpression]] = None all_members: Optional[Union[dict, AnonymousSlotExpression]] = None - none_of: Optional[Union[Union[dict, AnonymousSlotExpression], List[Union[dict, AnonymousSlotExpression]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, AnonymousSlotExpression], List[Union[dict, AnonymousSlotExpression]]]] = empty_list() - any_of: Optional[Union[Union[dict, AnonymousSlotExpression], List[Union[dict, AnonymousSlotExpression]]]] = empty_list() - all_of: Optional[Union[Union[dict, AnonymousSlotExpression], List[Union[dict, AnonymousSlotExpression]]]] = empty_list() + none_of: Optional[Union[Union[dict, AnonymousSlotExpression], list[Union[dict, AnonymousSlotExpression]]]] = empty_list() + exactly_one_of: Optional[Union[Union[dict, AnonymousSlotExpression], list[Union[dict, AnonymousSlotExpression]]]] = empty_list() + any_of: Optional[Union[Union[dict, AnonymousSlotExpression], list[Union[dict, AnonymousSlotExpression]]]] = empty_list() + all_of: Optional[Union[Union[dict, AnonymousSlotExpression], list[Union[dict, AnonymousSlotExpression]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.name): self.MissingRequiredField("name") if not isinstance(self.name, SlotDefinitionName): @@ -2536,20 +2534,20 @@ class ClassExpression(YAMLRoot): """ A boolean expression that can be used to dynamically determine membership of a class """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["ClassExpression"] class_class_curie: ClassVar[str] = "linkml:ClassExpression" class_name: ClassVar[str] = "class_expression" class_model_uri: ClassVar[URIRef] = LINKML.ClassExpression - any_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - none_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - all_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - slot_conditions: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], List[Union[dict, SlotDefinition]]]] = empty_dict() + any_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() + exactly_one_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() + none_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() + all_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() + slot_conditions: Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.any_of, list): self.any_of = [self.any_of] if self.any_of is not None else [] self.any_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.any_of] @@ -2573,7 +2571,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass(repr=False) class AnonymousClassExpression(AnonymousExpression): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["AnonymousClassExpression"] class_class_curie: ClassVar[str] = "linkml:AnonymousClassExpression" @@ -2581,13 +2579,13 @@ class AnonymousClassExpression(AnonymousExpression): class_model_uri: ClassVar[URIRef] = LINKML.AnonymousClassExpression is_a: Optional[Union[str, DefinitionName]] = None - any_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - none_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - all_of: Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - slot_conditions: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], List[Union[dict, SlotDefinition]]]] = empty_dict() + any_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() + exactly_one_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() + none_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() + all_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() + slot_conditions: Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.is_a is not None and not isinstance(self.is_a, DefinitionName): self.is_a = DefinitionName(self.is_a) @@ -2617,7 +2615,7 @@ class ClassDefinition(Definition): """ an element whose instances are complex objects that may have slot-value assignments """ - _inherited_slots: ClassVar[List[str]] = ["defining_slots", "represents_relationship"] + _inherited_slots: ClassVar[list[str]] = ["defining_slots", "represents_relationship"] class_class_uri: ClassVar[URIRef] = LINKML["ClassDefinition"] class_class_curie: ClassVar[str] = "linkml:ClassDefinition" @@ -2625,31 +2623,31 @@ class ClassDefinition(Definition): class_model_uri: ClassVar[URIRef] = LINKML.ClassDefinition name: Union[str, ClassDefinitionName] = None - slots: Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]] = empty_list() - slot_usage: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], List[Union[dict, SlotDefinition]]]] = empty_dict() - attributes: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], List[Union[dict, SlotDefinition]]]] = empty_dict() + slots: Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]] = empty_list() + slot_usage: Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]] = empty_dict() + attributes: Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]] = empty_dict() class_uri: Optional[Union[str, URIorCURIE]] = None subclass_of: Optional[Union[str, URIorCURIE]] = None - union_of: Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]] = empty_list() - defining_slots: Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]] = empty_list() + union_of: Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]] = empty_list() + defining_slots: Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]] = empty_list() tree_root: Optional[Union[bool, Bool]] = None - unique_keys: Optional[Union[Dict[Union[str, UniqueKeyUniqueKeyName], Union[dict, "UniqueKey"]], List[Union[dict, "UniqueKey"]]]] = empty_dict() - rules: Optional[Union[Union[dict, "ClassRule"], List[Union[dict, "ClassRule"]]]] = empty_list() - classification_rules: Optional[Union[Union[dict, AnonymousClassExpression], List[Union[dict, AnonymousClassExpression]]]] = empty_list() + unique_keys: Optional[Union[dict[Union[str, UniqueKeyUniqueKeyName], Union[dict, "UniqueKey"]], list[Union[dict, "UniqueKey"]]]] = empty_dict() + rules: Optional[Union[Union[dict, "ClassRule"], list[Union[dict, "ClassRule"]]]] = empty_list() + classification_rules: Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]] = empty_list() slot_names_unique: Optional[Union[bool, Bool]] = None represents_relationship: Optional[Union[bool, Bool]] = None - disjoint_with: Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]] = empty_list() + disjoint_with: Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]] = empty_list() children_are_mutually_disjoint: Optional[Union[bool, Bool]] = None is_a: Optional[Union[str, ClassDefinitionName]] = None - mixins: Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]] = empty_list() - apply_to: Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]] = empty_list() - any_of: Optional[Union[Union[dict, AnonymousClassExpression], List[Union[dict, AnonymousClassExpression]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, AnonymousClassExpression], List[Union[dict, AnonymousClassExpression]]]] = empty_list() - none_of: Optional[Union[Union[dict, AnonymousClassExpression], List[Union[dict, AnonymousClassExpression]]]] = empty_list() - all_of: Optional[Union[Union[dict, AnonymousClassExpression], List[Union[dict, AnonymousClassExpression]]]] = empty_list() - slot_conditions: Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], List[Union[dict, SlotDefinition]]]] = empty_dict() - - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + mixins: Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]] = empty_list() + apply_to: Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]] = empty_list() + any_of: Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]] = empty_list() + exactly_one_of: Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]] = empty_list() + none_of: Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]] = empty_list() + all_of: Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]] = empty_list() + slot_conditions: Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]] = empty_dict() + + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.name): self.MissingRequiredField("name") if not isinstance(self.name, ClassDefinitionName): @@ -2739,7 +2737,7 @@ class ClassLevelRule(YAMLRoot): """ A rule that is applied to classes """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["ClassLevelRule"] class_class_curie: ClassVar[str] = "linkml:ClassLevelRule" @@ -2752,7 +2750,7 @@ class ClassRule(ClassLevelRule): """ A rule that applies to instances of a class """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["ClassRule"] class_class_curie: ClassVar[str] = "linkml:ClassRule" @@ -2766,42 +2764,42 @@ class ClassRule(ClassLevelRule): open_world: Optional[Union[bool, Bool]] = None rank: Optional[int] = None deactivated: Optional[Union[bool, Bool]] = None - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, StructuredAlias], list[Union[dict, StructuredAlias]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - keywords: Optional[Union[str, List[str]]] = empty_list() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.preconditions is not None and not isinstance(self.preconditions, AnonymousClassExpression): self.preconditions = AnonymousClassExpression(**as_dict(self.preconditions)) @@ -2945,7 +2943,7 @@ class ArrayExpression(YAMLRoot): """ defines the dimensions of an array """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["ArrayExpression"] class_class_curie: ClassVar[str] = "linkml:ArrayExpression" @@ -2955,44 +2953,44 @@ class ArrayExpression(YAMLRoot): exact_number_dimensions: Optional[int] = None minimum_number_dimensions: Optional[int] = None maximum_number_dimensions: Optional[Union[dict, Anything]] = None - dimensions: Optional[Union[Union[dict, "DimensionExpression"], List[Union[dict, "DimensionExpression"]]]] = empty_list() - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict() + dimensions: Optional[Union[Union[dict, "DimensionExpression"], list[Union[dict, "DimensionExpression"]]]] = empty_list() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, StructuredAlias], list[Union[dict, StructuredAlias]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None rank: Optional[int] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - keywords: Optional[Union[str, List[str]]] = empty_list() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.exact_number_dimensions is not None and not isinstance(self.exact_number_dimensions, int): self.exact_number_dimensions = int(self.exact_number_dimensions) @@ -3128,7 +3126,7 @@ class DimensionExpression(YAMLRoot): """ defines one of the dimensions of an array """ - _inherited_slots: ClassVar[List[str]] = ["maximum_cardinality", "minimum_cardinality", "exact_cardinality"] + _inherited_slots: ClassVar[list[str]] = ["maximum_cardinality", "minimum_cardinality", "exact_cardinality"] class_class_uri: ClassVar[URIRef] = LINKML["DimensionExpression"] class_class_curie: ClassVar[str] = "linkml:DimensionExpression" @@ -3139,43 +3137,43 @@ class DimensionExpression(YAMLRoot): maximum_cardinality: Optional[int] = None minimum_cardinality: Optional[int] = None exact_cardinality: Optional[int] = None - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, StructuredAlias], list[Union[dict, StructuredAlias]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None rank: Optional[int] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - keywords: Optional[Union[str, List[str]]] = empty_list() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.alias is not None and not isinstance(self.alias, str): self.alias = str(self.alias) @@ -3313,7 +3311,7 @@ class PatternExpression(YAMLRoot): """ a regular expression pattern used to evaluate conformance of a string """ - _inherited_slots: ClassVar[List[str]] = ["syntax"] + _inherited_slots: ClassVar[list[str]] = ["syntax"] class_class_uri: ClassVar[URIRef] = LINKML["PatternExpression"] class_class_curie: ClassVar[str] = "linkml:PatternExpression" @@ -3323,43 +3321,43 @@ class PatternExpression(YAMLRoot): syntax: Optional[str] = None interpolated: Optional[Union[bool, Bool]] = None partial_match: Optional[Union[bool, Bool]] = None - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, StructuredAlias], list[Union[dict, StructuredAlias]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None rank: Optional[int] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - keywords: Optional[Union[str, List[str]]] = empty_list() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.syntax is not None and not isinstance(self.syntax, str): self.syntax = str(self.syntax) @@ -3494,7 +3492,7 @@ class ImportExpression(YAMLRoot): """ an expression describing an import """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["ImportExpression"] class_class_curie: ClassVar[str] = "linkml:ImportExpression" @@ -3503,44 +3501,44 @@ class ImportExpression(YAMLRoot): import_from: Union[str, URIorCURIE] = None import_as: Optional[Union[str, NCName]] = None - import_map: Optional[Union[Dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], List[Union[dict, "Setting"]]]] = empty_dict() - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict() + import_map: Optional[Union[dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], list[Union[dict, "Setting"]]]] = empty_dict() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, StructuredAlias], list[Union[dict, StructuredAlias]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None rank: Optional[int] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - keywords: Optional[Union[str, List[str]]] = empty_list() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.import_from): self.MissingRequiredField("import_from") if not isinstance(self.import_from, URIorCURIE): @@ -3676,7 +3674,7 @@ class Setting(YAMLRoot): """ assignment of a key to a value """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Setting"] class_class_curie: ClassVar[str] = "linkml:Setting" @@ -3686,7 +3684,7 @@ class Setting(YAMLRoot): setting_key: Union[str, SettingSettingKey] = None setting_value: str = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.setting_key): self.MissingRequiredField("setting_key") if not isinstance(self.setting_key, SettingSettingKey): @@ -3705,7 +3703,7 @@ class Prefix(YAMLRoot): """ prefix URI tuple """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Prefix"] class_class_curie: ClassVar[str] = "linkml:Prefix" @@ -3715,7 +3713,7 @@ class Prefix(YAMLRoot): prefix_prefix: Union[str, PrefixPrefixPrefix] = None prefix_reference: Union[str, URI] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.prefix_prefix): self.MissingRequiredField("prefix_prefix") if not isinstance(self.prefix_prefix, PrefixPrefixPrefix): @@ -3734,7 +3732,7 @@ class LocalName(YAMLRoot): """ an attributed label """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["LocalName"] class_class_curie: ClassVar[str] = "linkml:LocalName" @@ -3744,7 +3742,7 @@ class LocalName(YAMLRoot): local_name_source: Union[str, LocalNameLocalNameSource] = None local_name_value: str = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.local_name_source): self.MissingRequiredField("local_name_source") if not isinstance(self.local_name_source, LocalNameLocalNameSource): @@ -3763,7 +3761,7 @@ class Example(YAMLRoot): """ usage example and description """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Example"] class_class_curie: ClassVar[str] = "linkml:Example" @@ -3774,7 +3772,7 @@ class Example(YAMLRoot): description: Optional[str] = None object: Optional[Union[dict, Anything]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.value is not None and not isinstance(self.value, str): self.value = str(self.value) @@ -3789,7 +3787,7 @@ class AltDescription(YAMLRoot): """ an attributed description """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["AltDescription"] class_class_curie: ClassVar[str] = "linkml:AltDescription" @@ -3799,7 +3797,7 @@ class AltDescription(YAMLRoot): source: Union[str, AltDescriptionSource] = None description: str = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.source): self.MissingRequiredField("source") if not isinstance(self.source, AltDescriptionSource): @@ -3818,7 +3816,7 @@ class PermissibleValue(YAMLRoot): """ a permissible value, accompanied by intended text and an optional mapping to a concept URI """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["PermissibleValue"] class_class_curie: ClassVar[str] = "linkml:PermissibleValue" @@ -3829,46 +3827,46 @@ class PermissibleValue(YAMLRoot): description: Optional[str] = None meaning: Optional[Union[str, URIorCURIE]] = None unit: Optional[Union[dict, UnitOfMeasure]] = None - instantiates: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - implements: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + instantiates: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + implements: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() is_a: Optional[Union[str, PermissibleValueText]] = None - mixins: Optional[Union[Union[str, PermissibleValueText], List[Union[str, PermissibleValueText]]]] = empty_list() - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict() - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], List[Union[dict, AltDescription]]]] = empty_dict() + mixins: Optional[Union[Union[str, PermissibleValueText], list[Union[str, PermissibleValueText]]]] = empty_list() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], list[Union[dict, AltDescription]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, Example], List[Union[dict, Example]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, Example], list[Union[dict, Example]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, StructuredAlias], list[Union[dict, StructuredAlias]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None rank: Optional[int] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - keywords: Optional[Union[str, List[str]]] = empty_list() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.text): self.MissingRequiredField("text") if not isinstance(self.text, PermissibleValueText): @@ -4020,7 +4018,7 @@ class UniqueKey(YAMLRoot): """ a collection of slots whose values uniquely identify an instance of a class """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["UniqueKey"] class_class_curie: ClassVar[str] = "linkml:UniqueKey" @@ -4028,45 +4026,45 @@ class UniqueKey(YAMLRoot): class_model_uri: ClassVar[URIRef] = LINKML.UniqueKey unique_key_name: Union[str, UniqueKeyUniqueKeyName] = None - unique_key_slots: Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]] = None + unique_key_slots: Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]] = None consider_nulls_inequal: Optional[Union[bool, Bool]] = None - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], List[Union[dict, AltDescription]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], list[Union[dict, AltDescription]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, Example], List[Union[dict, Example]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, Example], list[Union[dict, Example]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, StructuredAlias], list[Union[dict, StructuredAlias]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None rank: Optional[int] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - keywords: Optional[Union[str, List[str]]] = empty_list() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.unique_key_name): self.MissingRequiredField("unique_key_name") if not isinstance(self.unique_key_name, UniqueKeyUniqueKeyName): @@ -4206,7 +4204,7 @@ class TypeMapping(YAMLRoot): """ Represents how a slot or type can be serialized to a format. """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["TypeMapping"] class_class_curie: ClassVar[str] = "linkml:TypeMapping" @@ -4216,43 +4214,43 @@ class TypeMapping(YAMLRoot): framework: Union[str, TypeMappingFramework] = None type: Optional[Union[str, TypeDefinitionName]] = None string_serialization: Optional[str] = None - extensions: Optional[Union[Dict[Union[str, ExtensionTag], Union[dict, Extension]], List[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[Dict[Union[str, AnnotationTag], Union[dict, Annotation]], List[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], List[Union[dict, AltDescription]]]] = empty_dict() + alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], list[Union[dict, AltDescription]]]] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() - examples: Optional[Union[Union[dict, Example], List[Union[dict, Example]]]] = empty_list() - in_subset: Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() + examples: Optional[Union[Union[dict, Example], list[Union[dict, Example]]]] = empty_list() + in_subset: Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None source: Optional[Union[str, URIorCURIE]] = None in_language: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]] = empty_list() - mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - close_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - related_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - narrow_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - broad_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, StructuredAlias], list[Union[dict, StructuredAlias]]]] = empty_list() + mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + related_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + narrow_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + broad_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_by: Optional[Union[str, URIorCURIE]] = None - contributors: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + contributors: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() created_on: Optional[Union[str, XSDDateTime]] = None last_updated_on: Optional[Union[str, XSDDateTime]] = None modified_by: Optional[Union[str, URIorCURIE]] = None status: Optional[Union[str, URIorCURIE]] = None rank: Optional[int] = None - categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() - keywords: Optional[Union[str, List[str]]] = empty_list() + categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() + keywords: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.framework): self.MissingRequiredField("framework") if not isinstance(self.framework, TypeMappingFramework): @@ -4512,22 +4510,22 @@ class slots: model_uri=LINKML.conforms_to, domain=Element, range=Optional[str]) slots.implements = Slot(uri=LINKML.implements, name="implements", curie=LINKML.curie('implements'), - model_uri=LINKML.implements, domain=Element, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.implements, domain=Element, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.instantiates = Slot(uri=LINKML.instantiates, name="instantiates", curie=LINKML.curie('instantiates'), - model_uri=LINKML.instantiates, domain=Element, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.instantiates, domain=Element, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.categories = Slot(uri=DCTERMS.subject, name="categories", curie=DCTERMS.curie('subject'), - model_uri=LINKML.categories, domain=None, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.categories, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.keywords = Slot(uri=SCHEMA.keywords, name="keywords", curie=SCHEMA.curie('keywords'), - model_uri=LINKML.keywords, domain=Element, range=Optional[Union[str, List[str]]]) + model_uri=LINKML.keywords, domain=Element, range=Optional[Union[str, list[str]]]) slots.definition_uri = Slot(uri=LINKML.definition_uri, name="definition_uri", curie=LINKML.curie('definition_uri'), model_uri=LINKML.definition_uri, domain=Element, range=Optional[Union[str, URIorCURIE]]) slots.id_prefixes = Slot(uri=LINKML.id_prefixes, name="id_prefixes", curie=LINKML.curie('id_prefixes'), - model_uri=LINKML.id_prefixes, domain=Element, range=Optional[Union[Union[str, NCName], List[Union[str, NCName]]]]) + model_uri=LINKML.id_prefixes, domain=Element, range=Optional[Union[Union[str, NCName], list[Union[str, NCName]]]]) slots.id_prefixes_are_closed = Slot(uri=LINKML.id_prefixes_are_closed, name="id_prefixes_are_closed", curie=LINKML.curie('id_prefixes_are_closed'), model_uri=LINKML.id_prefixes_are_closed, domain=Element, range=Optional[Union[bool, Bool]]) @@ -4536,25 +4534,25 @@ class slots: model_uri=LINKML.description, domain=Element, range=Optional[str]) slots.structured_aliases = Slot(uri=SKOSXL.altLabel, name="structured_aliases", curie=SKOSXL.curie('altLabel'), - model_uri=LINKML.structured_aliases, domain=None, range=Optional[Union[Union[dict, StructuredAlias], List[Union[dict, StructuredAlias]]]]) + model_uri=LINKML.structured_aliases, domain=None, range=Optional[Union[Union[dict, StructuredAlias], list[Union[dict, StructuredAlias]]]]) slots.aliases = Slot(uri=SKOS.altLabel, name="aliases", curie=SKOS.curie('altLabel'), - model_uri=LINKML.aliases, domain=Element, range=Optional[Union[str, List[str]]]) + model_uri=LINKML.aliases, domain=Element, range=Optional[Union[str, list[str]]]) slots.deprecated = Slot(uri=LINKML.deprecated, name="deprecated", curie=LINKML.curie('deprecated'), model_uri=LINKML.deprecated, domain=Element, range=Optional[str]) slots.todos = Slot(uri=LINKML.todos, name="todos", curie=LINKML.curie('todos'), - model_uri=LINKML.todos, domain=Element, range=Optional[Union[str, List[str]]]) + model_uri=LINKML.todos, domain=Element, range=Optional[Union[str, list[str]]]) slots.notes = Slot(uri=SKOS.editorialNote, name="notes", curie=SKOS.curie('editorialNote'), - model_uri=LINKML.notes, domain=Element, range=Optional[Union[str, List[str]]]) + model_uri=LINKML.notes, domain=Element, range=Optional[Union[str, list[str]]]) slots.comments = Slot(uri=SKOS.note, name="comments", curie=SKOS.curie('note'), - model_uri=LINKML.comments, domain=Element, range=Optional[Union[str, List[str]]]) + model_uri=LINKML.comments, domain=Element, range=Optional[Union[str, list[str]]]) slots.in_subset = Slot(uri=OIO.inSubset, name="in_subset", curie=OIO.curie('inSubset'), - model_uri=LINKML.in_subset, domain=Element, range=Optional[Union[Union[str, SubsetDefinitionName], List[Union[str, SubsetDefinitionName]]]]) + model_uri=LINKML.in_subset, domain=Element, range=Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]]) slots.from_schema = Slot(uri=SKOS.inScheme, name="from_schema", curie=SKOS.curie('inScheme'), model_uri=LINKML.from_schema, domain=Element, range=Optional[Union[str, URI]]) @@ -4563,7 +4561,7 @@ class slots: model_uri=LINKML.imported_from, domain=Element, range=Optional[str]) slots.see_also = Slot(uri=RDFS.seeAlso, name="see_also", curie=RDFS.curie('seeAlso'), - model_uri=LINKML.see_also, domain=Element, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.see_also, domain=Element, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.owned_by = Slot(uri=LINKML.owned_by, name="owned_by", curie=LINKML.curie('owned_by'), model_uri=LINKML.owned_by, domain=Element, range=Optional[Union[str, URIorCURIE]]) @@ -4572,7 +4570,7 @@ class slots: model_uri=LINKML.created_by, domain=Element, range=Optional[Union[str, URIorCURIE]]) slots.contributors = Slot(uri=DCTERMS.contributor, name="contributors", curie=DCTERMS.curie('contributor'), - model_uri=LINKML.contributors, domain=Element, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.contributors, domain=Element, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.created_on = Slot(uri=PAV.createdOn, name="created_on", curie=PAV.curie('createdOn'), model_uri=LINKML.created_on, domain=Element, range=Optional[Union[str, XSDDateTime]]) @@ -4593,7 +4591,7 @@ class slots: model_uri=LINKML.alias_predicate, domain=StructuredAlias, range=Optional[Union[str, "AliasPredicateEnum"]]) slots.alias_contexts = Slot(uri=LINKML.contexts, name="alias_contexts", curie=LINKML.curie('contexts'), - model_uri=LINKML.alias_contexts, domain=StructuredAlias, range=Optional[Union[Union[str, URI], List[Union[str, URI]]]]) + model_uri=LINKML.alias_contexts, domain=StructuredAlias, range=Optional[Union[Union[str, URI], list[Union[str, URI]]]]) slots.in_language = Slot(uri=SCHEMA.inLanguage, name="in_language", curie=SCHEMA.curie('inLanguage'), model_uri=LINKML.in_language, domain=None, range=Optional[str]) @@ -4614,13 +4612,13 @@ class slots: model_uri=LINKML.mixin, domain=Definition, range=Optional[Union[bool, Bool]]) slots.mixins = Slot(uri=LINKML.mixins, name="mixins", curie=LINKML.curie('mixins'), - model_uri=LINKML.mixins, domain=None, range=Optional[Union[Union[str, DefinitionName], List[Union[str, DefinitionName]]]]) + model_uri=LINKML.mixins, domain=None, range=Optional[Union[Union[str, DefinitionName], list[Union[str, DefinitionName]]]]) slots.apply_to = Slot(uri=LINKML.apply_to, name="apply_to", curie=LINKML.curie('apply_to'), - model_uri=LINKML.apply_to, domain=Definition, range=Optional[Union[Union[str, DefinitionName], List[Union[str, DefinitionName]]]]) + model_uri=LINKML.apply_to, domain=Definition, range=Optional[Union[Union[str, DefinitionName], list[Union[str, DefinitionName]]]]) slots.values_from = Slot(uri=LINKML.values_from, name="values_from", curie=LINKML.curie('values_from'), - model_uri=LINKML.values_from, domain=Definition, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.values_from, domain=Definition, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.code_set = Slot(uri=LINKML.code_set, name="code_set", curie=LINKML.curie('code_set'), model_uri=LINKML.code_set, domain=EnumExpression, range=Optional[Union[str, URIorCURIE]]) @@ -4635,19 +4633,19 @@ class slots: model_uri=LINKML.pv_formula, domain=None, range=Optional[Union[str, "PvFormulaOptions"]]) slots.permissible_values = Slot(uri=LINKML.permissible_values, name="permissible_values", curie=LINKML.curie('permissible_values'), - model_uri=LINKML.permissible_values, domain=EnumExpression, range=Optional[Union[Dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], List[Union[dict, "PermissibleValue"]]]]) + model_uri=LINKML.permissible_values, domain=EnumExpression, range=Optional[Union[dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], list[Union[dict, "PermissibleValue"]]]]) slots.enum_uri = Slot(uri=LINKML.enum_uri, name="enum_uri", curie=LINKML.curie('enum_uri'), model_uri=LINKML.enum_uri, domain=EnumDefinition, range=Optional[Union[str, URIorCURIE]]) slots.include = Slot(uri=LINKML.include, name="include", curie=LINKML.curie('include'), - model_uri=LINKML.include, domain=EnumExpression, range=Optional[Union[Union[dict, "AnonymousEnumExpression"], List[Union[dict, "AnonymousEnumExpression"]]]]) + model_uri=LINKML.include, domain=EnumExpression, range=Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]]) slots.minus = Slot(uri=LINKML.minus, name="minus", curie=LINKML.curie('minus'), - model_uri=LINKML.minus, domain=EnumExpression, range=Optional[Union[Union[dict, "AnonymousEnumExpression"], List[Union[dict, "AnonymousEnumExpression"]]]]) + model_uri=LINKML.minus, domain=EnumExpression, range=Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]]) slots.inherits = Slot(uri=LINKML.inherits, name="inherits", curie=LINKML.curie('inherits'), - model_uri=LINKML.inherits, domain=EnumExpression, range=Optional[Union[Union[str, EnumDefinitionName], List[Union[str, EnumDefinitionName]]]]) + model_uri=LINKML.inherits, domain=EnumExpression, range=Optional[Union[Union[str, EnumDefinitionName], list[Union[str, EnumDefinitionName]]]]) slots.matches = Slot(uri=LINKML.matches, name="matches", curie=LINKML.curie('matches'), model_uri=LINKML.matches, domain=EnumExpression, range=Optional[Union[dict, "MatchQuery"]]) @@ -4656,7 +4654,7 @@ class slots: model_uri=LINKML.identifier_pattern, domain=MatchQuery, range=Optional[str]) slots.concepts = Slot(uri=LINKML.concepts, name="concepts", curie=LINKML.curie('concepts'), - model_uri=LINKML.concepts, domain=EnumExpression, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.concepts, domain=EnumExpression, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.reachable_from = Slot(uri=LINKML.reachable_from, name="reachable_from", curie=LINKML.curie('reachable_from'), model_uri=LINKML.reachable_from, domain=EnumExpression, range=Optional[Union[dict, "ReachabilityQuery"]]) @@ -4674,10 +4672,10 @@ class slots: model_uri=LINKML.include_self, domain=ReachabilityQuery, range=Optional[Union[bool, Bool]]) slots.relationship_types = Slot(uri=LINKML.relationship_types, name="relationship_types", curie=LINKML.curie('relationship_types'), - model_uri=LINKML.relationship_types, domain=ReachabilityQuery, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.relationship_types, domain=ReachabilityQuery, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.source_nodes = Slot(uri=LINKML.source_nodes, name="source_nodes", curie=LINKML.curie('source_nodes'), - model_uri=LINKML.source_nodes, domain=ReachabilityQuery, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.source_nodes, domain=ReachabilityQuery, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.text = Slot(uri=LINKML.text, name="text", curie=LINKML.curie('text'), model_uri=LINKML.text, domain=PermissibleValue, range=Union[str, PermissibleValueText]) @@ -4689,22 +4687,22 @@ class slots: model_uri=LINKML.id, domain=SchemaDefinition, range=Union[str, URI]) slots.emit_prefixes = Slot(uri=LINKML.emit_prefixes, name="emit_prefixes", curie=LINKML.curie('emit_prefixes'), - model_uri=LINKML.emit_prefixes, domain=SchemaDefinition, range=Optional[Union[Union[str, NCName], List[Union[str, NCName]]]]) + model_uri=LINKML.emit_prefixes, domain=SchemaDefinition, range=Optional[Union[Union[str, NCName], list[Union[str, NCName]]]]) slots.version = Slot(uri=PAV.version, name="version", curie=PAV.curie('version'), model_uri=LINKML.version, domain=SchemaDefinition, range=Optional[str]) slots.imports = Slot(uri=LINKML.imports, name="imports", curie=LINKML.curie('imports'), - model_uri=LINKML.imports, domain=SchemaDefinition, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.imports, domain=SchemaDefinition, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.structured_imports = Slot(uri=LINKML.structured_imports, name="structured_imports", curie=LINKML.curie('structured_imports'), - model_uri=LINKML.structured_imports, domain=SchemaDefinition, range=Optional[Union[Union[dict, "ImportExpression"], List[Union[dict, "ImportExpression"]]]]) + model_uri=LINKML.structured_imports, domain=SchemaDefinition, range=Optional[Union[Union[dict, "ImportExpression"], list[Union[dict, "ImportExpression"]]]]) slots.license = Slot(uri=DCTERMS.license, name="license", curie=DCTERMS.curie('license'), model_uri=LINKML.license, domain=SchemaDefinition, range=Optional[str]) slots.default_curi_maps = Slot(uri=LINKML.default_curi_maps, name="default_curi_maps", curie=LINKML.curie('default_curi_maps'), - model_uri=LINKML.default_curi_maps, domain=SchemaDefinition, range=Optional[Union[str, List[str]]]) + model_uri=LINKML.default_curi_maps, domain=SchemaDefinition, range=Optional[Union[str, list[str]]]) slots.default_prefix = Slot(uri=LINKML.default_prefix, name="default_prefix", curie=LINKML.curie('default_prefix'), model_uri=LINKML.default_prefix, domain=SchemaDefinition, range=Optional[str]) @@ -4713,19 +4711,19 @@ class slots: model_uri=LINKML.default_range, domain=SchemaDefinition, range=Optional[Union[str, TypeDefinitionName]]) slots.subsets = Slot(uri=LINKML.subsets, name="subsets", curie=LINKML.curie('subsets'), - model_uri=LINKML.subsets, domain=SchemaDefinition, range=Optional[Union[Dict[Union[str, SubsetDefinitionName], Union[dict, "SubsetDefinition"]], List[Union[dict, "SubsetDefinition"]]]]) + model_uri=LINKML.subsets, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, SubsetDefinitionName], Union[dict, "SubsetDefinition"]], list[Union[dict, "SubsetDefinition"]]]]) slots.types = Slot(uri=LINKML.types, name="types", curie=LINKML.curie('types'), - model_uri=LINKML.types, domain=SchemaDefinition, range=Optional[Union[Dict[Union[str, TypeDefinitionName], Union[dict, "TypeDefinition"]], List[Union[dict, "TypeDefinition"]]]]) + model_uri=LINKML.types, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, TypeDefinitionName], Union[dict, "TypeDefinition"]], list[Union[dict, "TypeDefinition"]]]]) slots.enums = Slot(uri=LINKML.enums, name="enums", curie=LINKML.curie('enums'), - model_uri=LINKML.enums, domain=SchemaDefinition, range=Optional[Union[Dict[Union[str, EnumDefinitionName], Union[dict, "EnumDefinition"]], List[Union[dict, "EnumDefinition"]]]]) + model_uri=LINKML.enums, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, EnumDefinitionName], Union[dict, "EnumDefinition"]], list[Union[dict, "EnumDefinition"]]]]) slots.slot_definitions = Slot(uri=LINKML.slots, name="slot_definitions", curie=LINKML.curie('slots'), - model_uri=LINKML.slot_definitions, domain=SchemaDefinition, range=Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, "SlotDefinition"]], List[Union[dict, "SlotDefinition"]]]]) + model_uri=LINKML.slot_definitions, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, "SlotDefinition"]], list[Union[dict, "SlotDefinition"]]]]) slots.classes = Slot(uri=LINKML.classes, name="classes", curie=LINKML.curie('classes'), - model_uri=LINKML.classes, domain=SchemaDefinition, range=Optional[Union[Dict[Union[str, ClassDefinitionName], Union[dict, "ClassDefinition"]], List[Union[dict, "ClassDefinition"]]]]) + model_uri=LINKML.classes, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, ClassDefinitionName], Union[dict, "ClassDefinition"]], list[Union[dict, "ClassDefinition"]]]]) slots.metamodel_version = Slot(uri=LINKML.metamodel_version, name="metamodel_version", curie=LINKML.curie('metamodel_version'), model_uri=LINKML.metamodel_version, domain=SchemaDefinition, range=Optional[str]) @@ -4743,10 +4741,10 @@ class slots: model_uri=LINKML.generation_date, domain=SchemaDefinition, range=Optional[Union[str, XSDDateTime]]) slots.slots = Slot(uri=LINKML.slots, name="slots", curie=LINKML.curie('slots'), - model_uri=LINKML.slots, domain=ClassDefinition, range=Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]]) + model_uri=LINKML.slots, domain=ClassDefinition, range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]]) slots.slot_usage = Slot(uri=LINKML.slot_usage, name="slot_usage", curie=LINKML.curie('slot_usage'), - model_uri=LINKML.slot_usage, domain=ClassDefinition, range=Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], List[Union[dict, SlotDefinition]]]]) + model_uri=LINKML.slot_usage, domain=ClassDefinition, range=Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]]) slots.enum_range = Slot(uri=LINKML.enum_range, name="enum_range", curie=LINKML.curie('enum_range'), model_uri=LINKML.enum_range, domain=None, range=Optional[Union[dict, EnumExpression]]) @@ -4755,19 +4753,19 @@ class slots: model_uri=LINKML.range_expression, domain=None, range=Optional[Union[dict, "AnonymousClassExpression"]]) slots.boolean_slot = Slot(uri=LINKML.boolean_slot, name="boolean_slot", curie=LINKML.curie('boolean_slot'), - model_uri=LINKML.boolean_slot, domain=None, range=Optional[Union[Union[dict, Expression], List[Union[dict, Expression]]]]) + model_uri=LINKML.boolean_slot, domain=None, range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]]) slots.any_of = Slot(uri=LINKML.any_of, name="any_of", curie=LINKML.curie('any_of'), - model_uri=LINKML.any_of, domain=None, range=Optional[Union[Union[dict, Expression], List[Union[dict, Expression]]]]) + model_uri=LINKML.any_of, domain=None, range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]]) slots.exactly_one_of = Slot(uri=LINKML.exactly_one_of, name="exactly_one_of", curie=LINKML.curie('exactly_one_of'), - model_uri=LINKML.exactly_one_of, domain=None, range=Optional[Union[Union[dict, Expression], List[Union[dict, Expression]]]]) + model_uri=LINKML.exactly_one_of, domain=None, range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]]) slots.none_of = Slot(uri=LINKML.none_of, name="none_of", curie=LINKML.curie('none_of'), - model_uri=LINKML.none_of, domain=None, range=Optional[Union[Union[dict, Expression], List[Union[dict, Expression]]]]) + model_uri=LINKML.none_of, domain=None, range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]]) slots.all_of = Slot(uri=LINKML.all_of, name="all_of", curie=LINKML.curie('all_of'), - model_uri=LINKML.all_of, domain=None, range=Optional[Union[Union[dict, Expression], List[Union[dict, Expression]]]]) + model_uri=LINKML.all_of, domain=None, range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]]) slots.preconditions = Slot(uri=SH.condition, name="preconditions", curie=SH.curie('condition'), model_uri=LINKML.preconditions, domain=None, range=Optional[Union[dict, AnonymousClassExpression]]) @@ -4791,16 +4789,16 @@ class slots: model_uri=LINKML.deactivated, domain=None, range=Optional[Union[bool, Bool]]) slots.rules = Slot(uri=SH.rule, name="rules", curie=SH.curie('rule'), - model_uri=LINKML.rules, domain=ClassDefinition, range=Optional[Union[Union[dict, "ClassRule"], List[Union[dict, "ClassRule"]]]]) + model_uri=LINKML.rules, domain=ClassDefinition, range=Optional[Union[Union[dict, "ClassRule"], list[Union[dict, "ClassRule"]]]]) slots.classification_rules = Slot(uri=LINKML.classification_rules, name="classification_rules", curie=LINKML.curie('classification_rules'), - model_uri=LINKML.classification_rules, domain=ClassDefinition, range=Optional[Union[Union[dict, AnonymousClassExpression], List[Union[dict, AnonymousClassExpression]]]]) + model_uri=LINKML.classification_rules, domain=ClassDefinition, range=Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]]) slots.slot_conditions = Slot(uri=LINKML.slot_conditions, name="slot_conditions", curie=LINKML.curie('slot_conditions'), - model_uri=LINKML.slot_conditions, domain=None, range=Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], List[Union[dict, SlotDefinition]]]]) + model_uri=LINKML.slot_conditions, domain=None, range=Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]]) slots.attributes = Slot(uri=LINKML.attributes, name="attributes", curie=LINKML.curie('attributes'), - model_uri=LINKML.attributes, domain=ClassDefinition, range=Optional[Union[Dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], List[Union[dict, SlotDefinition]]]]) + model_uri=LINKML.attributes, domain=ClassDefinition, range=Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]]) slots.class_uri = Slot(uri=LINKML.class_uri, name="class_uri", curie=LINKML.curie('class_uri'), model_uri=LINKML.class_uri, domain=ClassDefinition, range=Optional[Union[str, URIorCURIE]]) @@ -4809,16 +4807,16 @@ class slots: model_uri=LINKML.subclass_of, domain=ClassDefinition, range=Optional[Union[str, URIorCURIE]]) slots.defining_slots = Slot(uri=LINKML.defining_slots, name="defining_slots", curie=LINKML.curie('defining_slots'), - model_uri=LINKML.defining_slots, domain=ClassDefinition, range=Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]]) + model_uri=LINKML.defining_slots, domain=ClassDefinition, range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]]) slots.union_of = Slot(uri=LINKML.union_of, name="union_of", curie=LINKML.curie('union_of'), - model_uri=LINKML.union_of, domain=Element, range=Optional[Union[Union[str, ElementName], List[Union[str, ElementName]]]]) + model_uri=LINKML.union_of, domain=Element, range=Optional[Union[Union[str, ElementName], list[Union[str, ElementName]]]]) slots.tree_root = Slot(uri=LINKML.tree_root, name="tree_root", curie=LINKML.curie('tree_root'), model_uri=LINKML.tree_root, domain=ClassDefinition, range=Optional[Union[bool, Bool]]) slots.unique_keys = Slot(uri=LINKML.unique_keys, name="unique_keys", curie=LINKML.curie('unique_keys'), - model_uri=LINKML.unique_keys, domain=ClassDefinition, range=Optional[Union[Dict[Union[str, UniqueKeyUniqueKeyName], Union[dict, "UniqueKey"]], List[Union[dict, "UniqueKey"]]]]) + model_uri=LINKML.unique_keys, domain=ClassDefinition, range=Optional[Union[dict[Union[str, UniqueKeyUniqueKeyName], Union[dict, "UniqueKey"]], list[Union[dict, "UniqueKey"]]]]) slots.unique_key_name = Slot(uri=LINKML.unique_key_name, name="unique_key_name", curie=LINKML.curie('unique_key_name'), model_uri=LINKML.unique_key_name, domain=UniqueKey, range=Union[str, UniqueKeyUniqueKeyName]) @@ -4827,7 +4825,7 @@ class slots: model_uri=LINKML.consider_nulls_inequal, domain=UniqueKey, range=Optional[Union[bool, Bool]]) slots.unique_key_slots = Slot(uri=LINKML.unique_key_slots, name="unique_key_slots", curie=LINKML.curie('unique_key_slots'), - model_uri=LINKML.unique_key_slots, domain=UniqueKey, range=Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]) + model_uri=LINKML.unique_key_slots, domain=UniqueKey, range=Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]) slots.slot_names_unique = Slot(uri=LINKML.slot_names_unique, name="slot_names_unique", curie=LINKML.curie('slot_names_unique'), model_uri=LINKML.slot_names_unique, domain=Definition, range=Optional[Union[bool, Bool]]) @@ -4848,7 +4846,7 @@ class slots: model_uri=LINKML.array, domain=SlotDefinition, range=Optional[Union[dict, "ArrayExpression"]]) slots.dimensions = Slot(uri=LINKML.dimensions, name="dimensions", curie=LINKML.curie('dimensions'), - model_uri=LINKML.dimensions, domain=ArrayExpression, range=Optional[Union[Union[dict, "DimensionExpression"], List[Union[dict, "DimensionExpression"]]]]) + model_uri=LINKML.dimensions, domain=ArrayExpression, range=Optional[Union[Union[dict, "DimensionExpression"], list[Union[dict, "DimensionExpression"]]]]) slots.minimum_number_dimensions = Slot(uri=LINKML.minimum_number_dimensions, name="minimum_number_dimensions", curie=LINKML.curie('minimum_number_dimensions'), model_uri=LINKML.minimum_number_dimensions, domain=ArrayExpression, range=Optional[int]) @@ -4899,10 +4897,10 @@ class slots: model_uri=LINKML.maximum_cardinality, domain=None, range=Optional[int]) slots.equals_string_in = Slot(uri=LINKML.equals_string_in, name="equals_string_in", curie=LINKML.curie('equals_string_in'), - model_uri=LINKML.equals_string_in, domain=None, range=Optional[Union[str, List[str]]]) + model_uri=LINKML.equals_string_in, domain=None, range=Optional[Union[str, list[str]]]) slots.equals_number_in = Slot(uri=LINKML.equals_number_in, name="equals_number_in", curie=LINKML.curie('equals_number_in'), - model_uri=LINKML.equals_number_in, domain=None, range=Optional[Union[int, List[int]]]) + model_uri=LINKML.equals_number_in, domain=None, range=Optional[Union[int, list[int]]]) slots.has_member = Slot(uri=LINKML.has_member, name="has_member", curie=LINKML.curie('has_member'), model_uri=LINKML.has_member, domain=None, range=Optional[Union[dict, AnonymousSlotExpression]]) @@ -4956,7 +4954,7 @@ class slots: model_uri=LINKML.owner, domain=SlotDefinition, range=Optional[Union[str, DefinitionName]]) slots.domain_of = Slot(uri=LINKML.domain_of, name="domain_of", curie=LINKML.curie('domain_of'), - model_uri=LINKML.domain_of, domain=SlotDefinition, range=Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]]) + model_uri=LINKML.domain_of, domain=SlotDefinition, range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]]) slots.is_usage_slot = Slot(uri=LINKML.is_usage_slot, name="is_usage_slot", curie=LINKML.curie('is_usage_slot'), model_uri=LINKML.is_usage_slot, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) @@ -4968,7 +4966,7 @@ class slots: model_uri=LINKML.subproperty_of, domain=SlotDefinition, range=Optional[Union[str, SlotDefinitionName]]) slots.disjoint_with = Slot(uri=LINKML.disjoint_with, name="disjoint_with", curie=LINKML.curie('disjoint_with'), - model_uri=LINKML.disjoint_with, domain=Definition, range=Optional[Union[Union[str, DefinitionName], List[Union[str, DefinitionName]]]]) + model_uri=LINKML.disjoint_with, domain=Definition, range=Optional[Union[Union[str, DefinitionName], list[Union[str, DefinitionName]]]]) slots.children_are_mutually_disjoint = Slot(uri=LINKML.children_are_mutually_disjoint, name="children_are_mutually_disjoint", curie=LINKML.curie('children_are_mutually_disjoint'), model_uri=LINKML.children_are_mutually_disjoint, domain=Definition, range=Optional[Union[bool, Bool]]) @@ -5034,7 +5032,7 @@ class slots: model_uri=LINKML.string_serialization, domain=Definition, range=Optional[str]) slots.bindings = Slot(uri=LINKML.bindings, name="bindings", curie=LINKML.curie('bindings'), - model_uri=LINKML.bindings, domain=Element, range=Optional[Union[Union[dict, "EnumBinding"], List[Union[dict, "EnumBinding"]]]]) + model_uri=LINKML.bindings, domain=Element, range=Optional[Union[Union[dict, "EnumBinding"], list[Union[dict, "EnumBinding"]]]]) slots.binds_value_of = Slot(uri=LINKML.binds_value_of, name="binds_value_of", curie=LINKML.curie('binds_value_of'), model_uri=LINKML.binds_value_of, domain=EnumBinding, range=Optional[str]) @@ -5043,7 +5041,7 @@ class slots: model_uri=LINKML.obligation_level, domain=None, range=Optional[Union[str, "ObligationLevelEnum"]]) slots.type_mappings = Slot(uri=LINKML.type_mappings, name="type_mappings", curie=LINKML.curie('type_mappings'), - model_uri=LINKML.type_mappings, domain=None, range=Optional[Union[Union[str, TypeMappingFramework], List[Union[str, TypeMappingFramework]]]]) + model_uri=LINKML.type_mappings, domain=None, range=Optional[Union[Union[str, TypeMappingFramework], list[Union[str, TypeMappingFramework]]]]) slots.framework_key = Slot(uri=LINKML.framework, name="framework_key", curie=LINKML.curie('framework'), model_uri=LINKML.framework_key, domain=None, range=URIRef) @@ -5070,7 +5068,7 @@ class slots: model_uri=LINKML.alt_description_source, domain=AltDescription, range=Union[str, AltDescriptionSource]) slots.alt_descriptions = Slot(uri=LINKML.alt_descriptions, name="alt_descriptions", curie=LINKML.curie('alt_descriptions'), - model_uri=LINKML.alt_descriptions, domain=Element, range=Optional[Union[Dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], List[Union[dict, "AltDescription"]]]]) + model_uri=LINKML.alt_descriptions, domain=Element, range=Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]]) slots.value = Slot(uri=SKOS.example, name="value", curie=SKOS.curie('example'), model_uri=LINKML.value, domain=Example, range=Optional[str]) @@ -5082,7 +5080,7 @@ class slots: model_uri=LINKML.value_object, domain=Example, range=Optional[Union[dict, Anything]]) slots.examples = Slot(uri=LINKML.examples, name="examples", curie=LINKML.curie('examples'), - model_uri=LINKML.examples, domain=Element, range=Optional[Union[Union[dict, "Example"], List[Union[dict, "Example"]]]]) + model_uri=LINKML.examples, domain=Element, range=Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]]) slots.prefix_prefix = Slot(uri=SH.prefix, name="prefix_prefix", curie=SH.curie('prefix'), model_uri=LINKML.prefix_prefix, domain=Prefix, range=Union[str, PrefixPrefixPrefix]) @@ -5091,7 +5089,7 @@ class slots: model_uri=LINKML.prefix_reference, domain=Prefix, range=Union[str, URI]) slots.prefixes = Slot(uri=SH.declare, name="prefixes", curie=SH.curie('declare'), - model_uri=LINKML.prefixes, domain=SchemaDefinition, range=Optional[Union[Dict[Union[str, PrefixPrefixPrefix], Union[dict, "Prefix"]], List[Union[dict, "Prefix"]]]]) + model_uri=LINKML.prefixes, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, PrefixPrefixPrefix], Union[dict, "Prefix"]], list[Union[dict, "Prefix"]]]]) slots.setting_key = Slot(uri=LINKML.setting_key, name="setting_key", curie=LINKML.curie('setting_key'), model_uri=LINKML.setting_key, domain=Setting, range=Union[str, SettingSettingKey]) @@ -5100,7 +5098,7 @@ class slots: model_uri=LINKML.setting_value, domain=Setting, range=str) slots.settings = Slot(uri=LINKML.settings, name="settings", curie=LINKML.curie('settings'), - model_uri=LINKML.settings, domain=SchemaDefinition, range=Optional[Union[Dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], List[Union[dict, "Setting"]]]]) + model_uri=LINKML.settings, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], list[Union[dict, "Setting"]]]]) slots.import_from = Slot(uri=LINKML.import_from, name="import_from", curie=LINKML.curie('import_from'), model_uri=LINKML.import_from, domain=ImportExpression, range=Union[str, URIorCURIE]) @@ -5109,7 +5107,7 @@ class slots: model_uri=LINKML.import_as, domain=ImportExpression, range=Optional[Union[str, NCName]]) slots.import_map = Slot(uri=LINKML.import_map, name="import_map", curie=LINKML.curie('import_map'), - model_uri=LINKML.import_map, domain=ImportExpression, range=Optional[Union[Dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], List[Union[dict, "Setting"]]]]) + model_uri=LINKML.import_map, domain=ImportExpression, range=Optional[Union[dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], list[Union[dict, "Setting"]]]]) slots.local_name_source = Slot(uri=LINKML.local_name_source, name="local_name_source", curie=LINKML.curie('local_name_source'), model_uri=LINKML.local_name_source, domain=LocalName, range=Union[str, LocalNameLocalNameSource]) @@ -5118,7 +5116,7 @@ class slots: model_uri=LINKML.local_name_value, domain=LocalName, range=str) slots.local_names = Slot(uri=LINKML.local_names, name="local_names", curie=LINKML.curie('local_names'), - model_uri=LINKML.local_names, domain=Element, range=Optional[Union[Dict[Union[str, LocalNameLocalNameSource], Union[dict, "LocalName"]], List[Union[dict, "LocalName"]]]]) + model_uri=LINKML.local_names, domain=Element, range=Optional[Union[dict[Union[str, LocalNameLocalNameSource], Union[dict, "LocalName"]], list[Union[dict, "LocalName"]]]]) slots.slot_group = Slot(uri=SH.group, name="slot_group", curie=SH.curie('group'), model_uri=LINKML.slot_group, domain=SlotDefinition, range=Optional[Union[str, SlotDefinitionName]]) @@ -5148,100 +5146,100 @@ class slots: model_uri=LINKML.schema_definition_name, domain=SchemaDefinition, range=Union[str, SchemaDefinitionName]) slots.type_expression_any_of = Slot(uri=LINKML.any_of, name="type_expression_any_of", curie=LINKML.curie('any_of'), - model_uri=LINKML.type_expression_any_of, domain=None, range=Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]]) + model_uri=LINKML.type_expression_any_of, domain=None, range=Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]]) slots.type_expression_all_of = Slot(uri=LINKML.all_of, name="type_expression_all_of", curie=LINKML.curie('all_of'), - model_uri=LINKML.type_expression_all_of, domain=None, range=Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]]) + model_uri=LINKML.type_expression_all_of, domain=None, range=Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]]) slots.type_expression_exactly_one_of = Slot(uri=LINKML.exactly_one_of, name="type_expression_exactly_one_of", curie=LINKML.curie('exactly_one_of'), - model_uri=LINKML.type_expression_exactly_one_of, domain=None, range=Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]]) + model_uri=LINKML.type_expression_exactly_one_of, domain=None, range=Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]]) slots.type_expression_none_of = Slot(uri=LINKML.none_of, name="type_expression_none_of", curie=LINKML.curie('none_of'), - model_uri=LINKML.type_expression_none_of, domain=None, range=Optional[Union[Union[dict, "AnonymousTypeExpression"], List[Union[dict, "AnonymousTypeExpression"]]]]) + model_uri=LINKML.type_expression_none_of, domain=None, range=Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]]) slots.type_definition_union_of = Slot(uri=LINKML.union_of, name="type_definition_union_of", curie=LINKML.curie('union_of'), - model_uri=LINKML.type_definition_union_of, domain=TypeDefinition, range=Optional[Union[Union[str, TypeDefinitionName], List[Union[str, TypeDefinitionName]]]]) + model_uri=LINKML.type_definition_union_of, domain=TypeDefinition, range=Optional[Union[Union[str, TypeDefinitionName], list[Union[str, TypeDefinitionName]]]]) slots.enum_binding_range = Slot(uri=LINKML.range, name="enum_binding_range", curie=LINKML.curie('range'), model_uri=LINKML.enum_binding_range, domain=EnumBinding, range=Optional[Union[str, EnumDefinitionName]]) slots.structured_alias_categories = Slot(uri=DCTERMS.subject, name="structured_alias_categories", curie=DCTERMS.curie('subject'), - model_uri=LINKML.structured_alias_categories, domain=StructuredAlias, range=Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]]) + model_uri=LINKML.structured_alias_categories, domain=StructuredAlias, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) slots.path_expression_followed_by = Slot(uri=LINKML.followed_by, name="path_expression_followed_by", curie=LINKML.curie('followed_by'), model_uri=LINKML.path_expression_followed_by, domain=PathExpression, range=Optional[Union[dict, "PathExpression"]]) slots.path_expression_any_of = Slot(uri=LINKML.any_of, name="path_expression_any_of", curie=LINKML.curie('any_of'), - model_uri=LINKML.path_expression_any_of, domain=PathExpression, range=Optional[Union[Union[dict, "PathExpression"], List[Union[dict, "PathExpression"]]]]) + model_uri=LINKML.path_expression_any_of, domain=PathExpression, range=Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]]) slots.path_expression_exactly_one_of = Slot(uri=LINKML.exactly_one_of, name="path_expression_exactly_one_of", curie=LINKML.curie('exactly_one_of'), - model_uri=LINKML.path_expression_exactly_one_of, domain=PathExpression, range=Optional[Union[Union[dict, "PathExpression"], List[Union[dict, "PathExpression"]]]]) + model_uri=LINKML.path_expression_exactly_one_of, domain=PathExpression, range=Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]]) slots.path_expression_none_of = Slot(uri=LINKML.none_of, name="path_expression_none_of", curie=LINKML.curie('none_of'), - model_uri=LINKML.path_expression_none_of, domain=PathExpression, range=Optional[Union[Union[dict, "PathExpression"], List[Union[dict, "PathExpression"]]]]) + model_uri=LINKML.path_expression_none_of, domain=PathExpression, range=Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]]) slots.path_expression_all_of = Slot(uri=LINKML.all_of, name="path_expression_all_of", curie=LINKML.curie('all_of'), - model_uri=LINKML.path_expression_all_of, domain=PathExpression, range=Optional[Union[Union[dict, "PathExpression"], List[Union[dict, "PathExpression"]]]]) + model_uri=LINKML.path_expression_all_of, domain=PathExpression, range=Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]]) slots.slot_expression_any_of = Slot(uri=LINKML.any_of, name="slot_expression_any_of", curie=LINKML.curie('any_of'), - model_uri=LINKML.slot_expression_any_of, domain=None, range=Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]]) + model_uri=LINKML.slot_expression_any_of, domain=None, range=Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]]) slots.slot_expression_all_of = Slot(uri=LINKML.all_of, name="slot_expression_all_of", curie=LINKML.curie('all_of'), - model_uri=LINKML.slot_expression_all_of, domain=None, range=Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]]) + model_uri=LINKML.slot_expression_all_of, domain=None, range=Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]]) slots.slot_expression_exactly_one_of = Slot(uri=LINKML.exactly_one_of, name="slot_expression_exactly_one_of", curie=LINKML.curie('exactly_one_of'), - model_uri=LINKML.slot_expression_exactly_one_of, domain=None, range=Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]]) + model_uri=LINKML.slot_expression_exactly_one_of, domain=None, range=Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]]) slots.slot_expression_none_of = Slot(uri=LINKML.none_of, name="slot_expression_none_of", curie=LINKML.curie('none_of'), - model_uri=LINKML.slot_expression_none_of, domain=None, range=Optional[Union[Union[dict, "AnonymousSlotExpression"], List[Union[dict, "AnonymousSlotExpression"]]]]) + model_uri=LINKML.slot_expression_none_of, domain=None, range=Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]]) slots.slot_definition_is_a = Slot(uri=LINKML.is_a, name="slot_definition_is_a", curie=LINKML.curie('is_a'), model_uri=LINKML.slot_definition_is_a, domain=SlotDefinition, range=Optional[Union[str, SlotDefinitionName]]) slots.slot_definition_mixins = Slot(uri=LINKML.mixins, name="slot_definition_mixins", curie=LINKML.curie('mixins'), - model_uri=LINKML.slot_definition_mixins, domain=SlotDefinition, range=Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]]) + model_uri=LINKML.slot_definition_mixins, domain=SlotDefinition, range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]]) slots.slot_definition_apply_to = Slot(uri=LINKML.apply_to, name="slot_definition_apply_to", curie=LINKML.curie('apply_to'), - model_uri=LINKML.slot_definition_apply_to, domain=SlotDefinition, range=Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]]) + model_uri=LINKML.slot_definition_apply_to, domain=SlotDefinition, range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]]) slots.slot_definition_disjoint_with = Slot(uri=LINKML.disjoint_with, name="slot_definition_disjoint_with", curie=LINKML.curie('disjoint_with'), - model_uri=LINKML.slot_definition_disjoint_with, domain=SlotDefinition, range=Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]]) + model_uri=LINKML.slot_definition_disjoint_with, domain=SlotDefinition, range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]]) slots.slot_definition_union_of = Slot(uri=LINKML.union_of, name="slot_definition_union_of", curie=LINKML.curie('union_of'), - model_uri=LINKML.slot_definition_union_of, domain=SlotDefinition, range=Optional[Union[Union[str, SlotDefinitionName], List[Union[str, SlotDefinitionName]]]]) + model_uri=LINKML.slot_definition_union_of, domain=SlotDefinition, range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]]) slots.class_expression_any_of = Slot(uri=LINKML.any_of, name="class_expression_any_of", curie=LINKML.curie('any_of'), - model_uri=LINKML.class_expression_any_of, domain=None, range=Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]]) + model_uri=LINKML.class_expression_any_of, domain=None, range=Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]]) slots.class_expression_all_of = Slot(uri=LINKML.all_of, name="class_expression_all_of", curie=LINKML.curie('all_of'), - model_uri=LINKML.class_expression_all_of, domain=None, range=Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]]) + model_uri=LINKML.class_expression_all_of, domain=None, range=Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]]) slots.class_expression_exactly_one_of = Slot(uri=LINKML.exactly_one_of, name="class_expression_exactly_one_of", curie=LINKML.curie('exactly_one_of'), - model_uri=LINKML.class_expression_exactly_one_of, domain=None, range=Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]]) + model_uri=LINKML.class_expression_exactly_one_of, domain=None, range=Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]]) slots.class_expression_none_of = Slot(uri=LINKML.none_of, name="class_expression_none_of", curie=LINKML.curie('none_of'), - model_uri=LINKML.class_expression_none_of, domain=None, range=Optional[Union[Union[dict, "AnonymousClassExpression"], List[Union[dict, "AnonymousClassExpression"]]]]) + model_uri=LINKML.class_expression_none_of, domain=None, range=Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]]) slots.class_definition_is_a = Slot(uri=LINKML.is_a, name="class_definition_is_a", curie=LINKML.curie('is_a'), model_uri=LINKML.class_definition_is_a, domain=ClassDefinition, range=Optional[Union[str, ClassDefinitionName]]) slots.class_definition_mixins = Slot(uri=LINKML.mixins, name="class_definition_mixins", curie=LINKML.curie('mixins'), - model_uri=LINKML.class_definition_mixins, domain=ClassDefinition, range=Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]]) + model_uri=LINKML.class_definition_mixins, domain=ClassDefinition, range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]]) slots.class_definition_apply_to = Slot(uri=LINKML.apply_to, name="class_definition_apply_to", curie=LINKML.curie('apply_to'), - model_uri=LINKML.class_definition_apply_to, domain=ClassDefinition, range=Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]]) + model_uri=LINKML.class_definition_apply_to, domain=ClassDefinition, range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]]) slots.class_definition_rules = Slot(uri=SH.rule, name="class_definition_rules", curie=SH.curie('rule'), - model_uri=LINKML.class_definition_rules, domain=ClassDefinition, range=Optional[Union[Union[dict, "ClassRule"], List[Union[dict, "ClassRule"]]]]) + model_uri=LINKML.class_definition_rules, domain=ClassDefinition, range=Optional[Union[Union[dict, "ClassRule"], list[Union[dict, "ClassRule"]]]]) slots.class_definition_disjoint_with = Slot(uri=LINKML.disjoint_with, name="class_definition_disjoint_with", curie=LINKML.curie('disjoint_with'), - model_uri=LINKML.class_definition_disjoint_with, domain=ClassDefinition, range=Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]]) + model_uri=LINKML.class_definition_disjoint_with, domain=ClassDefinition, range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]]) slots.class_definition_union_of = Slot(uri=LINKML.union_of, name="class_definition_union_of", curie=LINKML.curie('union_of'), - model_uri=LINKML.class_definition_union_of, domain=ClassDefinition, range=Optional[Union[Union[str, ClassDefinitionName], List[Union[str, ClassDefinitionName]]]]) + model_uri=LINKML.class_definition_union_of, domain=ClassDefinition, range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]]) slots.permissible_value_is_a = Slot(uri=LINKML.is_a, name="permissible_value_is_a", curie=LINKML.curie('is_a'), model_uri=LINKML.permissible_value_is_a, domain=PermissibleValue, range=Optional[Union[str, PermissibleValueText]]) slots.permissible_value_mixins = Slot(uri=LINKML.mixins, name="permissible_value_mixins", curie=LINKML.curie('mixins'), - model_uri=LINKML.permissible_value_mixins, domain=PermissibleValue, range=Optional[Union[Union[str, PermissibleValueText], List[Union[str, PermissibleValueText]]]]) + model_uri=LINKML.permissible_value_mixins, domain=PermissibleValue, range=Optional[Union[Union[str, PermissibleValueText], list[Union[str, PermissibleValueText]]]]) diff --git a/linkml_runtime/linkml_model/types.py b/linkml_runtime/linkml_model/types.py index b7034f6f..ba0a7bc2 100644 --- a/linkml_runtime/linkml_model/types.py +++ b/linkml_runtime/linkml_model/types.py @@ -7,18 +7,8 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any -from dataclasses import dataclass - -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int + from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.metamodelcore import Bool, Curie, Decimal, ElementIdentifier, NCName, NodeIdentifier, URI, URIorCURIE, XSDDate, XSDDateTime, XSDTime diff --git a/linkml_runtime/linkml_model/units.py b/linkml_runtime/linkml_model/units.py index 88f68a31..c31b1d95 100644 --- a/linkml_runtime/linkml_model/units.py +++ b/linkml_runtime/linkml_model/units.py @@ -7,20 +7,15 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_list +from linkml_runtime.utils.yamlutils import YAMLRoot from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from .types import String, Uriorcurie from linkml_runtime.utils.metamodelcore import URIorCURIE metamodel_version = "1.7.0" @@ -53,7 +48,7 @@ class UnitOfMeasure(YAMLRoot): A unit of measure, or unit, is a particular quantity value that has been chosen as a scale for measuring other quantities the same kind (more generally of equivalent dimension). """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = QUDT["Unit"] class_class_curie: ClassVar[str] = "qudt:Unit" @@ -63,13 +58,13 @@ class UnitOfMeasure(YAMLRoot): symbol: Optional[str] = None abbreviation: Optional[str] = None descriptive_name: Optional[str] = None - exact_mappings: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() ucum_code: Optional[str] = None derivation: Optional[str] = None has_quantity_kind: Optional[Union[str, URIorCURIE]] = None iec61360code: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.symbol is not None and not isinstance(self.symbol, str): self.symbol = str(self.symbol) diff --git a/linkml_runtime/linkml_model/validation.py b/linkml_runtime/linkml_model/validation.py index 222f1511..ee4615c1 100644 --- a/linkml_runtime/linkml_model/validation.py +++ b/linkml_runtime/linkml_model/validation.py @@ -7,20 +7,17 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from jsonasobj2 import as_dict +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_list +from linkml_runtime.utils.yamlutils import YAMLRoot from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from .types import Nodeidentifier, String from linkml_runtime.utils.metamodelcore import NodeIdentifier metamodel_version = "1.7.0" @@ -54,16 +51,16 @@ class ValidationReport(YAMLRoot): """ A report object """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SH["ValidationReport"] class_class_curie: ClassVar[str] = "sh:ValidationReport" class_name: ClassVar[str] = "ValidationReport" class_model_uri: ClassVar[URIRef] = REPORTING.ValidationReport - results: Optional[Union[Union[dict, "ValidationResult"], List[Union[dict, "ValidationResult"]]]] = empty_list() + results: Optional[Union[Union[dict, "ValidationResult"], list[Union[dict, "ValidationResult"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.results, list): self.results = [self.results] if self.results is not None else [] self.results = [v if isinstance(v, ValidationResult) else ValidationResult(**as_dict(v)) for v in self.results] @@ -76,7 +73,7 @@ class ValidationResult(YAMLRoot): """ An individual result arising from validation of a data instance using a particular rule """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SH["ValidationResult"] class_class_curie: ClassVar[str] = "sh:ValidationResult" @@ -93,7 +90,7 @@ class ValidationResult(YAMLRoot): node_source: Optional[Union[str, NodeIdentifier]] = None info: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.type is not None and not isinstance(self.type, NodeIdentifier): self.type = NodeIdentifier(self.type) @@ -199,4 +196,4 @@ class slots: model_uri=REPORTING.info, domain=None, range=Optional[str]) slots.validationReport__results = Slot(uri=REPORTING.results, name="validationReport__results", curie=REPORTING.curie('results'), - model_uri=REPORTING.validationReport__results, domain=None, range=Optional[Union[Union[dict, ValidationResult], List[Union[dict, ValidationResult]]]]) + model_uri=REPORTING.validationReport__results, domain=None, range=Optional[Union[Union[dict, ValidationResult], list[Union[dict, ValidationResult]]]]) diff --git a/linkml_runtime/loaders/context_flattener.py b/linkml_runtime/loaders/context_flattener.py index 0462a6bf..dbcc814c 100644 --- a/linkml_runtime/loaders/context_flattener.py +++ b/linkml_runtime/loaders/context_flattener.py @@ -1,11 +1,11 @@ import json import os -from typing import List, Optional, Union +from typing import Optional, Union -def flatten_dict(ctxt: str, base: str, seen: Optional[List[str]] = None) -> dict: +def flatten_dict(ctxt: str, base: str, seen: Optional[list[str]] = None) -> dict: - def map_context(ctxt_ent: Union[str, dict, list], seen: List[str]) -> Union[dict, list]: + def map_context(ctxt_ent: Union[str, dict, list], seen: list[str]) -> Union[dict, list]: if isinstance(ctxt_ent, str): ent_dict = flatten_dict(ctxt_ent, base, seen) return ent_dict['@context'] if '@context' in ent_dict else ent_dict @@ -14,7 +14,7 @@ def map_context(ctxt_ent: Union[str, dict, list], seen: List[str]) -> Union[dict else: return map_dict(ctxt_ent, seen) - def map_dict(inp: dict, seen: List[str]) -> dict: + def map_dict(inp: dict, seen: list[str]) -> dict: rval = dict() for k, v in inp.items(): if k == '@context': diff --git a/linkml_runtime/loaders/delimited_file_loader.py b/linkml_runtime/loaders/delimited_file_loader.py index d5c48110..a3d965d1 100644 --- a/linkml_runtime/loaders/delimited_file_loader.py +++ b/linkml_runtime/loaders/delimited_file_loader.py @@ -1,13 +1,13 @@ from abc import ABC, abstractmethod -from json_flattener import unflatten_from_csv, KeyConfig, GlobalConfig, Serializer +from json_flattener import unflatten_from_csv, GlobalConfig import json -from typing import Type, Union, List +from typing import Union from linkml_runtime.utils.yamlutils import YAMLRoot from pydantic import BaseModel from linkml_runtime.loaders.loader_root import Loader from linkml_runtime.loaders.json_loader import JSONLoader -from linkml_runtime.linkml_model.meta import SlotDefinitionName, SchemaDefinition, ClassDefinition +from linkml_runtime.linkml_model.meta import SlotDefinitionName, SchemaDefinition from linkml_runtime.utils.yamlutils import YAMLRoot from linkml_runtime.utils.schemaview import SchemaView from linkml_runtime.utils.csvutils import get_configmap @@ -24,15 +24,15 @@ def load_as_dict(self, index_slot: SlotDefinitionName = None, schema: SchemaDefinition = None, schemaview: SchemaView = None, - **kwargs) -> Union[dict, List[dict]]: + **kwargs) -> Union[dict, list[dict]]: json_str = self._get_json_str_to_load(source, index_slot, schema, schemaview, **kwargs) return JSONLoader().load_as_dict(json_str) - def load_any(self, *args, **kwargs) -> Union[YAMLRoot, List[YAMLRoot]]: + def load_any(self, *args, **kwargs) -> Union[YAMLRoot, list[YAMLRoot]]: return self.load(*args, **kwargs) def loads(self, input, - target_class: Type[Union[BaseModel, YAMLRoot]], + target_class: type[Union[BaseModel, YAMLRoot]], index_slot: SlotDefinitionName = None, schema: SchemaDefinition = None, schemaview: SchemaView = None, @@ -41,7 +41,7 @@ def loads(self, input, return JSONLoader().loads(json_str, target_class=target_class) def load(self, source: str, - target_class: Type[Union[BaseModel, YAMLRoot]], + target_class: type[Union[BaseModel, YAMLRoot]], index_slot: SlotDefinitionName = None, schema: SchemaDefinition = None, schemaview: SchemaView = None, diff --git a/linkml_runtime/loaders/json_loader.py b/linkml_runtime/loaders/json_loader.py index 5d4d94cf..34f89991 100644 --- a/linkml_runtime/loaders/json_loader.py +++ b/linkml_runtime/loaders/json_loader.py @@ -1,6 +1,6 @@ import json import logging -from typing import Union, TextIO, Optional, Dict, Type, List +from typing import Union, TextIO, Optional from hbreader import FileInfo @@ -17,18 +17,18 @@ def load_as_dict(self, source: Union[str, dict, TextIO], *, base_dir: Optional[str] = None, - metadata: Optional[FileInfo] = None) -> Union[dict, List[dict]]: + metadata: Optional[FileInfo] = None) -> Union[dict, list[dict]]: data = self._read_source(source, base_dir=base_dir, metadata=metadata, accept_header="application/ld+json, application/json, text/json") data_as_dict = json.loads(data) if isinstance(data, str) else data return self.json_clean(data_as_dict) def load_any(self, source: Union[str, dict, TextIO], - target_class: Type[Union[BaseModel, YAMLRoot]], + target_class: type[Union[BaseModel, YAMLRoot]], *, base_dir: Optional[str] = None, metadata: Optional[FileInfo] = None, - **_) -> Union[BaseModel, YAMLRoot, List[BaseModel], List[YAMLRoot]]: + **_) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: data_as_dict = self.load_as_dict(source, base_dir=base_dir, metadata=metadata) if isinstance(data_as_dict, dict): diff --git a/linkml_runtime/loaders/loader_root.py b/linkml_runtime/loaders/loader_root.py index e690c4b3..49e3fae2 100644 --- a/linkml_runtime/loaders/loader_root.py +++ b/linkml_runtime/loaders/loader_root.py @@ -1,5 +1,5 @@ from abc import ABC, abstractmethod -from typing import TextIO, Union, Optional, Callable, Dict, Type, Any, List +from typing import TextIO, Union, Optional, Callable, Any from logging import getLogger from pydantic import BaseModel @@ -41,10 +41,10 @@ def _is_empty(o) -> bool: def load_source(self, source: Union[str, dict, TextIO], - loader: Callable[[Union[str, Dict], FileInfo], Optional[Union[Dict, List]]], - target_class: Union[Type[YAMLRoot], Type[BaseModel]], + loader: Callable[[Union[str, dict], FileInfo], Optional[Union[dict, list]]], + target_class: Union[type[YAMLRoot], type[BaseModel]], accept_header: Optional[str] = "text/plain, application/yaml;q=0.9", - metadata: Optional[FileInfo] = None) -> Optional[Union[BaseModel, YAMLRoot, List[BaseModel], List[YAMLRoot]]]: + metadata: Optional[FileInfo] = None) -> Optional[Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]]: """ Base loader - convert a file, url, string, open file handle or dictionary into an instance of target_class @@ -79,12 +79,12 @@ def load(self, *args, **kwargs) -> Union[BaseModel, YAMLRoot]: else: raise ValueError(f'Result is not an instance of BaseModel or YAMLRoot: {type(results)}') - def load_as_dict(self, *args, **kwargs) -> Union[dict, List[dict]]: + def load_as_dict(self, *args, **kwargs) -> Union[dict, list[dict]]: raise NotImplementedError() @abstractmethod - def load_any(self, source: Union[str, dict, TextIO], target_class: Type[Union[BaseModel, YAMLRoot]], *, base_dir: Optional[str] = None, - metadata: Optional[FileInfo] = None, **_) -> Union[BaseModel, YAMLRoot, List[BaseModel], List[YAMLRoot]]: + def load_any(self, source: Union[str, dict, TextIO], target_class: type[Union[BaseModel, YAMLRoot]], *, base_dir: Optional[str] = None, + metadata: Optional[FileInfo] = None, **_) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: """ Load source as an instance of target_class, or list of instances of target_class @@ -97,7 +97,7 @@ def load_any(self, source: Union[str, dict, TextIO], target_class: Type[Union[Ba """ raise NotImplementedError() - def loads_any(self, source: str, target_class: Type[Union[BaseModel, YAMLRoot]], *, metadata: Optional[FileInfo] = None, **_) -> Union[BaseModel, YAMLRoot, List[BaseModel], List[YAMLRoot]]: + def loads_any(self, source: str, target_class: type[Union[BaseModel, YAMLRoot]], *, metadata: Optional[FileInfo] = None, **_) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: """ Load source as a string as an instance of target_class, or list of instances of target_class @param source: source @@ -108,7 +108,7 @@ def loads_any(self, source: str, target_class: Type[Union[BaseModel, YAMLRoot]], """ return self.load_any(source, target_class, metadata=metadata) - def loads(self, source: str, target_class: Type[Union[BaseModel, YAMLRoot]], *, metadata: Optional[FileInfo] = None, **_) -> Union[BaseModel, YAMLRoot]: + def loads(self, source: str, target_class: type[Union[BaseModel, YAMLRoot]], *, metadata: Optional[FileInfo] = None, **_) -> Union[BaseModel, YAMLRoot]: """ Load source as a string :param source: source @@ -120,8 +120,8 @@ def loads(self, source: str, target_class: Type[Union[BaseModel, YAMLRoot]], *, return self.load(source, target_class, metadata=metadata) def _construct_target_class(self, - data_as_dict: Union[dict, List[dict]], - target_class: Union[Type[YAMLRoot], Type[BaseModel]]) -> Optional[Union[BaseModel, YAMLRoot, List[BaseModel], List[YAMLRoot]]]: + data_as_dict: Union[dict, list[dict]], + target_class: Union[type[YAMLRoot], type[BaseModel]]) -> Optional[Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]]: if data_as_dict: if isinstance(data_as_dict, list): if issubclass(target_class, YAMLRoot): diff --git a/linkml_runtime/loaders/rdf_loader.py b/linkml_runtime/loaders/rdf_loader.py index abaa8a79..69dea78a 100644 --- a/linkml_runtime/loaders/rdf_loader.py +++ b/linkml_runtime/loaders/rdf_loader.py @@ -1,4 +1,4 @@ -from typing import Union, TextIO, Optional, Type, List +from typing import Union, TextIO, Optional from hbreader import FileInfo @@ -16,11 +16,11 @@ class RDFLoader(Loader): - def load_any(self, *args, **kwargs) -> Union[BaseModel, YAMLRoot, List[BaseModel], List[YAMLRoot]]: + def load_any(self, *args, **kwargs) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: return self.load(*args, **kwargs) - def load(self, source: Union[str, TextIO, Graph], target_class: Type[Union[BaseModel, YAMLRoot]], *, base_dir: Optional[str] = None, + def load(self, source: Union[str, TextIO, Graph], target_class: type[Union[BaseModel, YAMLRoot]], *, base_dir: Optional[str] = None, contexts: CONTEXTS_PARAM_TYPE = None, fmt: Optional[str] = 'turtle', metadata: Optional[FileInfo] = None) -> Union[BaseModel, YAMLRoot]: """ diff --git a/linkml_runtime/loaders/rdflib_loader.py b/linkml_runtime/loaders/rdflib_loader.py index 84e98d61..758d13e9 100644 --- a/linkml_runtime/loaders/rdflib_loader.py +++ b/linkml_runtime/loaders/rdflib_loader.py @@ -2,12 +2,12 @@ import urllib from copy import copy from dataclasses import dataclass -from typing import Optional, Any, Dict, Type, Union, TextIO, List, Tuple, Set +from typing import Optional, Any, Union, TextIO from curies import Converter from hbreader import FileInfo from rdflib import Graph, URIRef -from rdflib.term import Node, BNode, Literal +from rdflib.term import BNode, Literal from rdflib.namespace import RDF from linkml_runtime import MappingError, DataNotFoundError @@ -22,7 +22,7 @@ VALID_SUBJECT = Union[URIRef, BNode] -ANYDICT = Dict[str, Any] +ANYDICT = dict[str, Any] @dataclass class Pointer: @@ -37,12 +37,12 @@ class RDFLibLoader(Loader): def from_rdf_graph( self, graph: Graph, schemaview: SchemaView, - target_class: Type[Union[BaseModel, YAMLRoot]], - prefix_map: Union[Dict[str, str], Converter, None] = None, + target_class: type[Union[BaseModel, YAMLRoot]], + prefix_map: Union[dict[str, str], Converter, None] = None, cast_literals: bool = True, allow_unprocessed_triples: bool = True, ignore_unmapped_predicates: bool = False, - ) -> List[Union[BaseModel, YAMLRoot]]: + ) -> list[Union[BaseModel, YAMLRoot]]: """ Loads objects from graph into lists of the python target_class structure, recursively walking RDF graph from instances of target_class. @@ -75,20 +75,20 @@ def from_rdf_graph( graph.namespace_manager.bind(k, URIRef(v)) # Step 1: Create stub root dict-objects target_class_uriref: URIRef = target_class.class_class_uri - root_dicts: List[ANYDICT] = [] - root_subjects: List[VALID_SUBJECT] = list(graph.subjects(RDF.type, target_class_uriref)) + root_dicts: list[ANYDICT] = [] + root_subjects: list[VALID_SUBJECT] = list(graph.subjects(RDF.type, target_class_uriref)) logger.debug(f'ROOTS = {root_subjects}') # Step 2: walk RDF graph starting from root subjects, constructing dict tree - node_tuples_to_visit: List[Tuple[VALID_SUBJECT, ClassDefinitionName]] ## nodes and their type still to visit + node_tuples_to_visit: list[tuple[VALID_SUBJECT, ClassDefinitionName]] ## nodes and their type still to visit node_tuples_to_visit = [(subject, target_class.class_name) for subject in root_subjects] - uri_to_slot: Dict[str, SlotDefinition] ## lookup table for RDF predicates -> slots + uri_to_slot: dict[str, SlotDefinition] ## lookup table for RDF predicates -> slots uri_to_slot = {URIRef(schemaview.get_uri(s, expand=True)): s for s in schemaview.all_slots().values()} - processed: Set[VALID_SUBJECT] = set() ## track nodes already visited, or already scheduled + processed: set[VALID_SUBJECT] = set() ## track nodes already visited, or already scheduled for n, _ in node_tuples_to_visit: processed.add(n) - obj_map: Dict[VALID_SUBJECT, ANYDICT] = {} ## map from an RDF node to its dict representation + obj_map: dict[VALID_SUBJECT, ANYDICT] = {} ## map from an RDF node to its dict representation unmapped_predicates = set() - processed_triples: Set[Tuple] = set() + processed_triples: set[tuple] = set() while len(node_tuples_to_visit) > 0: subject, subject_class = node_tuples_to_visit.pop() processed.add(subject) @@ -195,7 +195,7 @@ def repl(v): return v2 else: return v - objs_to_visit: List[ANYDICT] = copy(root_dicts) + objs_to_visit: list[ANYDICT] = copy(root_dicts) while len(objs_to_visit) > 0: obj = objs_to_visit.pop() logger.debug(f'Replacing pointers for {obj}') @@ -238,9 +238,9 @@ def _uri_to_id(self, node: VALID_SUBJECT, id_slot: SlotDefinition, schemaview: S def load( self, source: Union[str, TextIO, Graph], - target_class: Type[Union[BaseModel, YAMLRoot]], *, + target_class: type[Union[BaseModel, YAMLRoot]], *, schemaview: SchemaView = None, - prefix_map: Union[Dict[str, str], Converter, None] = None, + prefix_map: Union[dict[str, str], Converter, None] = None, fmt: Optional[str] = 'turtle', metadata: Optional[FileInfo] = None, **kwargs, @@ -276,7 +276,7 @@ def load( def loads(self, source: str, **kwargs) -> Union[BaseModel, YAMLRoot]: return self.load(source, **kwargs) - def load_any(self, source: str, **kwargs) -> Union[BaseModel, YAMLRoot, List[BaseModel], List[YAMLRoot]]: + def load_any(self, source: str, **kwargs) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: return self.load(source, **kwargs) diff --git a/linkml_runtime/loaders/yaml_loader.py b/linkml_runtime/loaders/yaml_loader.py index eee6e973..fa33a280 100644 --- a/linkml_runtime/loaders/yaml_loader.py +++ b/linkml_runtime/loaders/yaml_loader.py @@ -1,6 +1,6 @@ import os from io import StringIO -from typing import Union, TextIO, Optional, Dict, Type, List +from typing import Union, TextIO, Optional import yaml from hbreader import FileInfo @@ -19,7 +19,7 @@ def load_as_dict(self, source: Union[str, dict, TextIO], *, base_dir: Optional[str] = None, - metadata: Optional[FileInfo] = None) -> Union[dict, List[dict]]: + metadata: Optional[FileInfo] = None) -> Union[dict, list[dict]]: if metadata is None: metadata = FileInfo() if base_dir and not metadata.base_path: @@ -35,13 +35,13 @@ def load_as_dict(self, def load_any(self, source: Union[str, dict, TextIO], - target_class: Union[Type[YAMLRoot], Type[BaseModel]], + target_class: Union[type[YAMLRoot], type[BaseModel]], *, base_dir: Optional[str] = None, - metadata: Optional[FileInfo] = None, **_) -> Union[YAMLRoot, List[YAMLRoot]]: + metadata: Optional[FileInfo] = None, **_) -> Union[YAMLRoot, list[YAMLRoot]]: data_as_dict = self.load_as_dict(source, base_dir=base_dir, metadata=metadata) return self._construct_target_class(data_as_dict, target_class) - def loads_any(self, source: str, target_class: Type[Union[BaseModel, YAMLRoot]], *, metadata: Optional[FileInfo] = None, **_) -> Union[BaseModel, YAMLRoot, List[BaseModel], List[YAMLRoot]]: + def loads_any(self, source: str, target_class: type[Union[BaseModel, YAMLRoot]], *, metadata: Optional[FileInfo] = None, **_) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: """ Load source as a string @param source: source diff --git a/linkml_runtime/processing/referencevalidator.py b/linkml_runtime/processing/referencevalidator.py index d01764ba..a167f634 100644 --- a/linkml_runtime/processing/referencevalidator.py +++ b/linkml_runtime/processing/referencevalidator.py @@ -13,7 +13,8 @@ import datetime from decimal import Decimal from enum import Enum -from typing import Any, Optional, List, Tuple, Union, Iterator, TextIO +from typing import Any, Optional, Union, TextIO +from collections.abc import Iterator import click import yaml @@ -93,7 +94,7 @@ def _is_list_of_lists(x: Any) -> bool: return x and isinstance(x, list) and isinstance(x[0], list) -def linearize_nested_lists(nested_list: List, is_row_ordered=True): +def linearize_nested_lists(nested_list: list, is_row_ordered=True): """ Returns a linear sequence of elements corresponding to a nested list array representation @@ -151,7 +152,7 @@ class CollectionForm(Enum): ListOfLists = "ListOfLists" -COLLECTION_FORM_NORMALIZATION = Tuple[CollectionForm, CollectionForm] +COLLECTION_FORM_NORMALIZATION = tuple[CollectionForm, CollectionForm] COLLECTION_FORM_ANNOTATION_KEY = "collection_form" @@ -180,10 +181,10 @@ class Report: configuration: ValidationConfiguration = None """Customization of reporting.""" - results: List[ValidationResult] = field(default_factory=lambda: []) + results: list[ValidationResult] = field(default_factory=lambda: []) """All results, including normalized""" - normalizations: List[Normalization] = field(default_factory=lambda: []) + normalizations: list[Normalization] = field(default_factory=lambda: []) """All normalizations and repairs applied""" def combine(self, other: "Report") -> "Report": @@ -250,32 +251,32 @@ def add_problem( def _is_error(self, result: ValidationResult) -> bool: return result.type != ConstraintType(ConstraintType.RecommendedConstraint) - def errors(self) -> List[ValidationResult]: + def errors(self) -> list[ValidationResult]: """ Return a list of all results that are not normalized and do not have ERROR severity """ # TODO: use severity return [r for r in self.results_excluding_normalized() if self._is_error(r)] - def warnings(self) -> List[ValidationResult]: + def warnings(self) -> list[ValidationResult]: """ Return a list of all results that are not normalized and do not have ERROR severity """ # TODO: use severity return [r for r in self.results_excluding_normalized() if not self._is_error(r)] - def results_excluding_normalized(self) -> List[ValidationResult]: + def results_excluding_normalized(self) -> list[ValidationResult]: return [r for r in self.results if not r.normalized] - def unrepaired_problem_types(self) -> List[ConstraintType]: + def unrepaired_problem_types(self) -> list[ConstraintType]: return [r.type for r in self.results_excluding_normalized()] - def normalized_results(self) -> List[ValidationResult]: + def normalized_results(self) -> list[ValidationResult]: return [r for r in self.results if r.normalized] def collection_form_normalizations( self, - ) -> Iterator[Tuple[CollectionForm, CollectionForm]]: + ) -> Iterator[tuple[CollectionForm, CollectionForm]]: for norm in self.normalizations: if isinstance(norm, CollectionFormNormalization): yield norm.input_form, norm.output_form diff --git a/linkml_runtime/processing/validation_datamodel.py b/linkml_runtime/processing/validation_datamodel.py index 035835c3..a65b7f29 100644 --- a/linkml_runtime/processing/validation_datamodel.py +++ b/linkml_runtime/processing/validation_datamodel.py @@ -7,33 +7,25 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from jsonasobj2 import as_dict +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass from linkml_runtime.linkml_model.meta import ( EnumDefinition, PermissibleValue, - PvFormulaOptions, ) from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode +from linkml_runtime.utils.metamodelcore import empty_list, empty_dict from linkml_runtime.utils.yamlutils import ( YAMLRoot, - extended_str, - extended_float, - extended_int, ) from linkml_runtime.utils.dataclass_extensions_376 import ( dataclasses_init_fn_with_kwargs, ) -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.linkml_model.types import Boolean, Integer, String, Uriorcurie from linkml_runtime.utils.metamodelcore import Bool, URIorCURIE metamodel_version = "1.7.0" @@ -73,7 +65,7 @@ class TypeSeverityKeyValueType(URIorCURIE): @dataclass class ConstraintCheck(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VM.ConstraintCheck class_class_curie: ClassVar[str] = "vm:ConstraintCheck" @@ -82,7 +74,7 @@ class ConstraintCheck(YAMLRoot): id: Union[str, ConstraintCheckId] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, ConstraintCheckId): @@ -93,7 +85,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Node(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VM.Node class_class_curie: ClassVar[str] = "vm:Node" @@ -102,7 +94,7 @@ class Node(YAMLRoot): id: Union[str, NodeId] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, NodeId): @@ -117,7 +109,7 @@ class ValidationConfiguration(YAMLRoot): Configuration parameters for execution of a validation report """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VM.ValidationConfiguration class_class_curie: ClassVar[str] = "vm:ValidationConfiguration" @@ -127,15 +119,15 @@ class ValidationConfiguration(YAMLRoot): max_number_results_per_type: Optional[int] = None type_severity_map: Optional[ Union[ - Dict[ + dict[ Union[str, TypeSeverityKeyValueType], Union[dict, "TypeSeverityKeyValue"], ], - List[Union[dict, "TypeSeverityKeyValue"]], + list[Union[dict, "TypeSeverityKeyValue"]], ] ] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.max_number_results_per_type is not None and not isinstance( self.max_number_results_per_type, int ): @@ -157,7 +149,7 @@ class RepairConfiguration(YAMLRoot): Configuration parameters for execution of validation repairs """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VM.RepairConfiguration class_class_curie: ClassVar[str] = "vm:RepairConfiguration" @@ -167,7 +159,7 @@ class RepairConfiguration(YAMLRoot): validation_configuration: Optional[Union[dict, ValidationConfiguration]] = None dry_run: Optional[Union[bool, Bool]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.validation_configuration is not None and not isinstance( self.validation_configuration, ValidationConfiguration ): @@ -187,7 +179,7 @@ class TypeSeverityKeyValue(YAMLRoot): key-value pair that maps a validation result type to a severity setting, for overriding default severity """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VM.TypeSeverityKeyValue class_class_curie: ClassVar[str] = "vm:TypeSeverityKeyValue" @@ -197,7 +189,7 @@ class TypeSeverityKeyValue(YAMLRoot): type: Union[str, TypeSeverityKeyValueType] = None severity: Optional[Union[str, "SeverityType"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.type): self.MissingRequiredField("type") if not isinstance(self.type, TypeSeverityKeyValueType): @@ -215,7 +207,7 @@ class Report(YAMLRoot): A report object that is a holder to multiple report results """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VM.Report class_class_curie: ClassVar[str] = "vm:Report" @@ -223,10 +215,10 @@ class Report(YAMLRoot): class_model_uri: ClassVar[URIRef] = VM.Report results: Optional[ - Union[Union[dict, "Result"], List[Union[dict, "Result"]]] + Union[Union[dict, "Result"], list[Union[dict, "Result"]]] ] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.results, list): self.results = [self.results] if self.results is not None else [] self.results = [ @@ -242,7 +234,7 @@ class ValidationReport(Report): A report that consists of validation results """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SH.ValidationReport class_class_curie: ClassVar[str] = "sh:ValidationReport" @@ -250,10 +242,10 @@ class ValidationReport(Report): class_model_uri: ClassVar[URIRef] = VM.ValidationReport results: Optional[ - Union[Union[dict, "ValidationResult"], List[Union[dict, "ValidationResult"]]] + Union[Union[dict, "ValidationResult"], list[Union[dict, "ValidationResult"]]] ] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.results, list): self.results = [self.results] if self.results is not None else [] self.results = [ @@ -270,7 +262,7 @@ class RepairReport(Report): A report that consists of repair operation results """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VM.RepairReport class_class_curie: ClassVar[str] = "vm:RepairReport" @@ -278,10 +270,10 @@ class RepairReport(Report): class_model_uri: ClassVar[URIRef] = VM.RepairReport results: Optional[ - Union[Union[dict, "RepairOperation"], List[Union[dict, "RepairOperation"]]] + Union[Union[dict, "RepairOperation"], list[Union[dict, "RepairOperation"]]] ] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.results, list): self.results = [self.results] if self.results is not None else [] self.results = [ @@ -297,7 +289,7 @@ class Result(YAMLRoot): Abstract base class for any individual report result """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VM.Result class_class_curie: ClassVar[str] = "vm:Result" @@ -311,7 +303,7 @@ class ValidationResult(Result): An individual result arising from validation of a data instance using a particular rule """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SH.ValidationResult class_class_curie: ClassVar[str] = "sh:ValidationResult" @@ -333,7 +325,7 @@ class ValidationResult(Result): source_column_number: Optional[int] = None source_location: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.type): self.MissingRequiredField("type") if not isinstance(self.type, ConstraintType): @@ -393,7 +385,7 @@ class RepairOperation(Result): The result of performing an individual repair """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VM.RepairOperation class_class_curie: ClassVar[str] = "vm:RepairOperation" @@ -405,7 +397,7 @@ class RepairOperation(Result): successful: Optional[Union[bool, Bool]] = None info: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.repairs is not None and not isinstance(self.repairs, ValidationResult): self.repairs = ValidationResult(**as_dict(self.repairs)) @@ -649,7 +641,7 @@ class slots: curie=SH.curie("result"), model_uri=VM.results, domain=None, - range=Optional[Union[Union[dict, Result], List[Union[dict, Result]]]], + range=Optional[Union[Union[dict, Result], list[Union[dict, Result]]]], ) slots.normalized = Slot( @@ -732,10 +724,10 @@ class slots: domain=None, range=Optional[ Union[ - Dict[ + dict[ Union[str, TypeSeverityKeyValueType], Union[dict, TypeSeverityKeyValue] ], - List[Union[dict, TypeSeverityKeyValue]], + list[Union[dict, TypeSeverityKeyValue]], ] ], ) @@ -819,7 +811,7 @@ class slots: model_uri=VM.ValidationReport_results, domain=ValidationReport, range=Optional[ - Union[Union[dict, "ValidationResult"], List[Union[dict, "ValidationResult"]]] + Union[Union[dict, "ValidationResult"], list[Union[dict, "ValidationResult"]]] ], ) @@ -830,6 +822,6 @@ class slots: model_uri=VM.RepairReport_results, domain=RepairReport, range=Optional[ - Union[Union[dict, "RepairOperation"], List[Union[dict, "RepairOperation"]]] + Union[Union[dict, "RepairOperation"], list[Union[dict, "RepairOperation"]]] ], ) diff --git a/linkml_runtime/utils/context_utils.py b/linkml_runtime/utils/context_utils.py index 1d28fe1b..922aaaf5 100644 --- a/linkml_runtime/utils/context_utils.py +++ b/linkml_runtime/utils/context_utils.py @@ -1,13 +1,13 @@ import json import os from io import TextIOWrapper -from typing import Optional, Union, List, Any, Dict, Callable +from typing import Optional, Union, Any, Callable import yaml from jsonasobj2 import JsonObj, loads CONTEXT_TYPE = Union[str, dict, JsonObj] -CONTEXTS_PARAM_TYPE = Optional[Union[CONTEXT_TYPE, List[CONTEXT_TYPE]]] +CONTEXTS_PARAM_TYPE = Optional[Union[CONTEXT_TYPE, list[CONTEXT_TYPE]]] def merge_contexts(contexts: CONTEXTS_PARAM_TYPE = None, base: Optional[Any] = None) -> JsonObj: @@ -50,7 +50,7 @@ def to_file_uri(fname: str) -> str: JsonObj(**{"@context": context_list[0] if len(context_list) == 1 else context_list}) -def map_import(importmap: Dict[str, str], namespaces: Callable[[None], "Namespaces"], imp: Any) -> str: +def map_import(importmap: dict[str, str], namespaces: Callable[[None], "Namespaces"], imp: Any) -> str: """ lookup an import in an importmap. @@ -77,8 +77,8 @@ def map_import(importmap: Dict[str, str], namespaces: Callable[[None], "Namespac return importmap.get(sname, sname) # It may also use URI or other forms -def parse_import_map(map_: Optional[Union[str, Dict[str, str], TextIOWrapper]], - base: Optional[str] = None) -> Dict[str, str]: +def parse_import_map(map_: Optional[Union[str, dict[str, str], TextIOWrapper]], + base: Optional[str] = None) -> dict[str, str]: """ Process the import map :param map_: A map location, the JSON for a map, YAML for a map or an existing dictionary diff --git a/linkml_runtime/utils/csvutils.py b/linkml_runtime/utils/csvutils.py index f233f2ae..7813f078 100644 --- a/linkml_runtime/utils/csvutils.py +++ b/linkml_runtime/utils/csvutils.py @@ -1,8 +1,7 @@ import logging -from json_flattener import KeyConfig, GlobalConfig, Serializer +from json_flattener import KeyConfig, Serializer from json_flattener.flattener import CONFIGMAP -from linkml_runtime.linkml_model.meta import SlotDefinitionName, SchemaDefinition, \ - SlotDefinition, ClassDefinition, ClassDefinitionName +from linkml_runtime.linkml_model.meta import SlotDefinitionName, ClassDefinitionName from linkml_runtime.utils.schemaview import SchemaView logger = logging.getLogger(__name__) diff --git a/linkml_runtime/utils/dictutils.py b/linkml_runtime/utils/dictutils.py index af77e4bd..06763832 100644 --- a/linkml_runtime/utils/dictutils.py +++ b/linkml_runtime/utils/dictutils.py @@ -1,10 +1,9 @@ import json -from typing import Dict from linkml_runtime.dumpers import json_dumper from linkml_runtime.utils.yamlutils import YAMLRoot -def as_simple_dict(element: YAMLRoot) -> Dict: +def as_simple_dict(element: YAMLRoot) -> dict: """ Returns the representation of element as a python dictionary diff --git a/linkml_runtime/utils/distroutils.py b/linkml_runtime/utils/distroutils.py index d7986fe4..60e7ce90 100644 --- a/linkml_runtime/utils/distroutils.py +++ b/linkml_runtime/utils/distroutils.py @@ -4,12 +4,11 @@ import logging import pkgutil from pathlib import PurePath -from typing import List, Type logger = logging.getLogger(__name__) -def get_default_paths(file_type: str) -> List[PurePath]: +def get_default_paths(file_type: str) -> list[PurePath]: """ Return candidate relative paths for a file type @@ -45,7 +44,7 @@ def get_default_paths(file_type: str) -> List[PurePath]: logger.debug(f"Paths to search: {paths}") return paths -def get_packaged_file_as_str(package: str, file_type: str, rel_paths: List[PurePath]=[], encoding="utf-8") -> str: +def get_packaged_file_as_str(package: str, file_type: str, rel_paths: list[PurePath]=[], encoding="utf-8") -> str: """ Retrieve the value of a data file distributed alongside a python package diff --git a/linkml_runtime/utils/enumerations.py b/linkml_runtime/utils/enumerations.py index 5cd06ed2..6b9cd047 100644 --- a/linkml_runtime/utils/enumerations.py +++ b/linkml_runtime/utils/enumerations.py @@ -1,5 +1,5 @@ from dataclasses import fields -from typing import Union, Optional, Type +from typing import Union, Optional from linkml_runtime.utils.metamodelcore import Curie from linkml_runtime.utils.yamlutils import YAMLRoot @@ -28,7 +28,7 @@ def __contains__(cls, item) -> bool: return item in cls.__dict__ -def isinstance_dt(cls: Type, inst: str) -> bool: +def isinstance_dt(cls: type, inst: str) -> bool: """ Duck typing isinstance to prevent recursion errors """ return inst in [c.__name__ for c in type(cls).mro()] diff --git a/linkml_runtime/utils/eval_utils.py b/linkml_runtime/utils/eval_utils.py index 962325f7..a7d28bfb 100644 --- a/linkml_runtime/utils/eval_utils.py +++ b/linkml_runtime/utils/eval_utils.py @@ -8,14 +8,14 @@ import operator as op # supported operators -from typing import Tuple, List, Any +from typing import Any operators = {ast.Add: op.add, ast.Sub: op.sub, ast.Mult: op.mul, ast.Div: op.truediv, ast.Pow: op.pow, ast.BitXor: op.xor, ast.USub: op.neg} compare_operators = {ast.Eq: op.eq, ast.Lt: op.lt, ast.LtE: op.le, ast.Gt: op.gt, ast.GtE: op.ge} -def eval_conditional(*conds: List[Tuple[bool, Any]]) -> Any: +def eval_conditional(*conds: list[tuple[bool, Any]]) -> Any: """ Evaluate a collection of expression,value tuples, returing the first value whose expression is true diff --git a/linkml_runtime/utils/formatutils.py b/linkml_runtime/utils/formatutils.py index da77ba73..37e437d2 100644 --- a/linkml_runtime/utils/formatutils.py +++ b/linkml_runtime/utils/formatutils.py @@ -1,9 +1,8 @@ import re from decimal import Decimal -from numbers import Number -from typing import List, Any, Union +from typing import Any -from jsonasobj2 import JsonObj, as_dict, is_list, is_dict, items, as_json_obj +from jsonasobj2 import JsonObj, as_dict, is_list, is_dict, items ws_pattern = re.compile(r'\s+') us_pattern = re.compile(r'_+') @@ -69,7 +68,7 @@ def uri_for(prefix: str, suffix: str) -> str: return prefix + ':' + suffix -def split_line(txt: str, split_len: int = split_col) -> List[str]: +def split_line(txt: str, split_len: int = split_col) -> list[str]: # TODO: consider replacing by textwrap.fill function, but note that its behavior is a bit different out_lines = [] words = txt.split() diff --git a/linkml_runtime/utils/inference_utils.py b/linkml_runtime/utils/inference_utils.py index ea554529..c8545d78 100644 --- a/linkml_runtime/utils/inference_utils.py +++ b/linkml_runtime/utils/inference_utils.py @@ -1,7 +1,7 @@ import logging from dataclasses import field, dataclass from enum import Enum -from typing import Union, Optional, Any, Dict, Callable +from typing import Union, Optional, Any, Callable from jsonasobj2 import JsonObj, items from linkml_runtime import SchemaView @@ -16,7 +16,7 @@ RESOLVE_FUNC = Callable[[str, Any], Any] -def obj_as_dict_nonrecursive(obj: YAMLRoot, resolve_function: RESOLVE_FUNC = None) -> Dict[str, Any]: +def obj_as_dict_nonrecursive(obj: YAMLRoot, resolve_function: RESOLVE_FUNC = None) -> dict[str, Any]: """ Translates an object into a dict, for the purposes of input into formatted strings diff --git a/linkml_runtime/utils/introspection.py b/linkml_runtime/utils/introspection.py index f52ae82e..0f50aa77 100644 --- a/linkml_runtime/utils/introspection.py +++ b/linkml_runtime/utils/introspection.py @@ -1,9 +1,8 @@ -import logging import sys from functools import lru_cache from pathlib import Path from types import ModuleType -from typing import List, Type, Union +from typing import Union from linkml_runtime.linkml_model import ClassDefinition from linkml_runtime.utils.distroutils import get_schema_string @@ -26,7 +25,7 @@ def package_schema_path(package: Union[str, ModuleType]) -> Path: return path -@lru_cache() +@lru_cache def package_schemaview(package: str, **kwargs) -> SchemaView: """ Returns the corresponding SchemaView for a package diff --git a/linkml_runtime/utils/metamodelcore.py b/linkml_runtime/utils/metamodelcore.py index f46b8d4a..26093793 100644 --- a/linkml_runtime/utils/metamodelcore.py +++ b/linkml_runtime/utils/metamodelcore.py @@ -3,7 +3,7 @@ import re from dataclasses import field from decimal import Decimal -from typing import Union, Optional, Tuple +from typing import Union, Optional from urllib.parse import urlparse from rdflib import Literal, BNode, URIRef @@ -166,7 +166,7 @@ def __init__(self, v: str) -> None: term_name = re.compile("^[A-Za-z]([A-Za-z0-9._-]|/)*$") @classmethod - def ns_ln(cls, v: str) -> Optional[Tuple[str, str]]: + def ns_ln(cls, v: str) -> Optional[tuple[str, str]]: # See if this is indeed a valid CURIE, ie, it can be split by a colon curie_split = v.split(':', 1) if len(curie_split) == 1: diff --git a/linkml_runtime/utils/namespaces.py b/linkml_runtime/utils/namespaces.py index a7232210..20d9252a 100644 --- a/linkml_runtime/utils/namespaces.py +++ b/linkml_runtime/utils/namespaces.py @@ -1,5 +1,5 @@ import logging -from typing import Any, Tuple, Optional, Union +from typing import Any, Optional, Union from prefixcommons import curie_util from rdflib import Namespace, URIRef, Graph, BNode @@ -150,7 +150,7 @@ def curie_for(self, uri: Any, default_ok: bool = True, pythonform: bool = False) if pythonform: default_ok = False - match: Tuple[str, Optional[Namespace]] = ('', None) # match string / prefix + match: tuple[str, Optional[Namespace]] = ('', None) # match string / prefix uri_string = str(uri) # Find the longest match for the URI, self.items() is a list of (prefix/namespace, uri base prefix) tuples @@ -191,7 +191,7 @@ def curie_for(self, uri: Any, default_ok: bool = True, pythonform: bool = False) def prefix_for(self, uri_or_curie: Any, case_shift: bool = True) -> Optional[str]: return self.prefix_suffix(uri_or_curie, case_shift)[0] - def prefix_suffix(self, uri_or_curie: Any, case_shift: bool = True) -> Tuple[Optional[str], Optional[str]]: + def prefix_suffix(self, uri_or_curie: Any, case_shift: bool = True) -> tuple[Optional[str], Optional[str]]: uri_or_curie = str(uri_or_curie) if '://' in uri_or_curie: uri_or_curie = self.curie_for(uri_or_curie) diff --git a/linkml_runtime/utils/pattern.py b/linkml_runtime/utils/pattern.py index 8f74a5fc..941bd54e 100644 --- a/linkml_runtime/utils/pattern.py +++ b/linkml_runtime/utils/pattern.py @@ -1,9 +1,8 @@ from functools import lru_cache import re -from typing import Dict # We might want to deprecate this method in favor of PatternResolver in the future -def generate_patterns(schema_view) -> Dict[str, str]: +def generate_patterns(schema_view) -> dict[str, str]: """Generates a dictionary of slot patterns corresponding to the structured patterns in the settings. :param schema_view: SchemaView object with LinkML YAML @@ -27,7 +26,7 @@ def generate_patterns(schema_view) -> Dict[str, str]: return generated_patterns -class PatternResolver(): +class PatternResolver: # regular expression capturing the various use cases # for the optionally dot separated, curly braces bound, pattern syntax @@ -46,7 +45,7 @@ def __init__(self, schema_view): # substrings in the structured pattern syntax self.format_spec[k] = setting.setting_value - @lru_cache() + @lru_cache def resolve(self, pattern: str) -> str: # apply the regex to the pattern and look for matches matches = self.var_name.finditer(pattern) diff --git a/linkml_runtime/utils/permissiblevalueimpl.py b/linkml_runtime/utils/permissiblevalueimpl.py index 73c5e895..c7cd3043 100644 --- a/linkml_runtime/utils/permissiblevalueimpl.py +++ b/linkml_runtime/utils/permissiblevalueimpl.py @@ -1,5 +1,5 @@ from dataclasses import dataclass -from typing import Dict, Any, Optional, ClassVar, List, Union +from typing import Any, Optional, ClassVar, Union from rdflib import URIRef @@ -20,7 +20,7 @@ class PermissibleValue(YAMLRoot): """ a permissible value, accompanied by intended text and an optional mapping to a concept URI """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML.PermissibleValue class_class_curie: ClassVar[str] = "linkml:PermissibleValue" @@ -31,18 +31,18 @@ class PermissibleValue(YAMLRoot): description: Optional[str] = None meaning: Optional[Union[str, URIorCURIE]] = None deprecated: Optional[str] = None - todos: Optional[Union[str, List[str]]] = empty_list() - notes: Optional[Union[str, List[str]]] = empty_list() - comments: Optional[Union[str, List[str]]] = empty_list() + todos: Optional[Union[str, list[str]]] = empty_list() + notes: Optional[Union[str, list[str]]] = empty_list() + comments: Optional[Union[str, list[str]]] = empty_list() from_schema: Optional[Union[str, URI]] = None imported_from: Optional[str] = None - see_also: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() + see_also: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None is_a: Optional[Union[str, PermissibleValueText]] = None - mixins: Optional[Union[Union[str, PermissibleValueText], List[Union[str, PermissibleValueText]]]] = empty_list() + mixins: Optional[Union[Union[str, PermissibleValueText], list[Union[str, PermissibleValueText]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.text is None: raise ValueError("text must be supplied") if not isinstance(self.text, PermissibleValueText): @@ -133,7 +133,7 @@ def __init__(self, *args, defn: EnumDefinitionImpl, **kwargs) -> None: super().__init__(*args, **kwargs) self._defn = defn - def __post_init__(self, **kwargs: Dict[str, Any]) -> None: + def __post_init__(self, **kwargs: dict[str, Any]) -> None: """ Make sure that we are correctly situated in the containing definition """ if self.text in self._defn: if self._defn.permissible_values[self.text] != self: diff --git a/linkml_runtime/utils/ruleutils.py b/linkml_runtime/utils/ruleutils.py index 2f1f664d..a9821e70 100644 --- a/linkml_runtime/utils/ruleutils.py +++ b/linkml_runtime/utils/ruleutils.py @@ -1,10 +1,8 @@ import logging from dataclasses import dataclass -from typing import Set, List, Union -from linkml_runtime.utils.schemaview import SchemaView, CLASS_NAME -from linkml_runtime.linkml_model.meta import SchemaDefinition, ClassDefinition, SlotDefinition, Expression, \ - ClassExpression, ClassDefinitionName, ClassRule, AnonymousClassExpression, SlotExpression, SlotDefinitionName +from linkml_runtime.utils.schemaview import SchemaView +from linkml_runtime.linkml_model.meta import ClassDefinition, SlotDefinition, ClassExpression, ClassDefinitionName, ClassRule, AnonymousClassExpression, SlotExpression, SlotDefinitionName logger = logging.getLogger(__name__) @@ -36,13 +34,13 @@ class DisjunctiveNormalFormClassExpression: """ A boolean combination of class expressions in Disjunctive Normal Form """ - operands: List[ClassExpressionConjunction] + operands: list[ClassExpressionConjunction] def __str__(self): return ' OR '.join([str(op) for op in self.operands]) -def get_range_as_disjunction(slot: SlotExpression) -> Set[ClassDefinitionName]: +def get_range_as_disjunction(slot: SlotExpression) -> set[ClassDefinitionName]: """ translate the range of a slot as defined by both range expressions and direct named class ranges to a disjunctive expression @@ -74,7 +72,7 @@ def get_range_as_disjunction(slot: SlotExpression) -> Set[ClassDefinitionName]: return conjs[0] -def get_disjunction(cx: ClassExpression) -> Set[ClassDefinitionName]: +def get_disjunction(cx: ClassExpression) -> set[ClassDefinitionName]: disj = set() if cx.is_a: disj.add(cx.is_a) @@ -85,7 +83,7 @@ def get_disjunction(cx: ClassExpression) -> Set[ClassDefinitionName]: def subclass_to_rules(view: SchemaView, child: ClassDefinitionName, parent: ClassDefinitionName, - type_designator_slot: SlotDefinitionName = None) -> List[ClassRule]: + type_designator_slot: SlotDefinitionName = None) -> list[ClassRule]: """ rolls up child class to parent class, turning class-specific slot_usages into rules :param view: diff --git a/linkml_runtime/utils/schema_as_dict.py b/linkml_runtime/utils/schema_as_dict.py index 34fe2f89..6432479b 100644 --- a/linkml_runtime/utils/schema_as_dict.py +++ b/linkml_runtime/utils/schema_as_dict.py @@ -1,4 +1,4 @@ -from typing import Dict, Any, Optional +from typing import Any, Optional import yaml @@ -49,7 +49,7 @@ def _remove_names(obj: Any, parent: Optional[str]) -> Any: return obj -def schema_as_dict(schema: SchemaDefinition) -> Dict: +def schema_as_dict(schema: SchemaDefinition) -> dict: """ Translates a SchemaDefinition object into a python dictionary, removing redundant elements diff --git a/linkml_runtime/utils/schema_builder.py b/linkml_runtime/utils/schema_builder.py index d37ec739..951a2df8 100644 --- a/linkml_runtime/utils/schema_builder.py +++ b/linkml_runtime/utils/schema_builder.py @@ -1,11 +1,11 @@ -from dataclasses import dataclass, field -from typing import Dict, List, Union, Optional +from dataclasses import dataclass +from typing import Union, Optional from linkml_runtime.linkml_model import (ClassDefinition, EnumDefinition, PermissibleValue, Prefix, SchemaDefinition, SlotDefinition, TypeDefinition) -from linkml_runtime.utils.formatutils import camelcase, underscore +from linkml_runtime.utils.formatutils import underscore from linkml_runtime.utils.schema_as_dict import schema_as_dict @@ -54,9 +54,9 @@ def __post_init__(self): def add_class( self, - cls: Union[ClassDefinition, Dict, str], - slots: List[Union[str, SlotDefinition]] = None, - slot_usage: Dict[str, SlotDefinition] = None, + cls: Union[ClassDefinition, dict, str], + slots: list[Union[str, SlotDefinition]] = None, + slot_usage: dict[str, SlotDefinition] = None, replace_if_present=False, use_attributes=False, **kwargs, @@ -103,7 +103,7 @@ def add_class( return self def add_slot( - self, slot: Union[SlotDefinition, Dict, str], class_name: str = None, replace_if_present=False, **kwargs + self, slot: Union[SlotDefinition, dict, str], class_name: str = None, replace_if_present=False, **kwargs ) -> "SchemaBuilder": """ Adds the slot to the schema. @@ -142,7 +142,7 @@ def set_slot(self, slot_name: str, **kwargs) -> "SchemaBuilder": def add_enum( self, enum_def: Union[EnumDefinition, dict, str], - permissible_values: List[Union[str, PermissibleValue]] = None, + permissible_values: list[Union[str, PermissibleValue]] = None, replace_if_present=False, **kwargs, ) -> "SchemaBuilder": @@ -217,7 +217,7 @@ def add_defaults(self) -> "SchemaBuilder": def add_type( self, - type: Union[TypeDefinition, Dict, str], + type: Union[TypeDefinition, dict, str], typeof: str = None, uri: str = None, replace_if_present=False, @@ -247,7 +247,7 @@ def add_type( setattr(type, k, v) return self - def as_dict(self) -> Dict: + def as_dict(self) -> dict: """ Returns the schema as a dictionary. diff --git a/linkml_runtime/utils/schemaops.py b/linkml_runtime/utils/schemaops.py index ce6374fc..361d83b1 100644 --- a/linkml_runtime/utils/schemaops.py +++ b/linkml_runtime/utils/schemaops.py @@ -1,9 +1,8 @@ -from typing import List, Union +from typing import Union from linkml_runtime.utils.schemaview import SchemaView, CLASS_NAME -from linkml_runtime.linkml_model.meta import SchemaDefinition, ClassDefinition -CLASS_NAME_OR_LIST = Union[CLASS_NAME, List[CLASS_NAME]] +CLASS_NAME_OR_LIST = Union[CLASS_NAME, list[CLASS_NAME]] def roll_up(sv: SchemaView, classes: CLASS_NAME_OR_LIST = None, mixins=True, is_a=True, delete=True) -> None: """ @@ -38,7 +37,7 @@ def roll_up(sv: SchemaView, classes: CLASS_NAME_OR_LIST = None, mixins=True, is_ sv.delete_class(d) sv.set_modified() -def roll_down(sv: SchemaView, classes: List[CLASS_NAME] = None, mixins=True, is_a=True, delete=True) -> None: +def roll_down(sv: SchemaView, classes: list[CLASS_NAME] = None, mixins=True, is_a=True, delete=True) -> None: """ rolls down to a set of descendant classes diff --git a/linkml_runtime/utils/schemaview.py b/linkml_runtime/utils/schemaview.py index 1bc97f1e..c3d15758 100644 --- a/linkml_runtime/utils/schemaview.py +++ b/linkml_runtime/utils/schemaview.py @@ -6,7 +6,8 @@ from copy import copy, deepcopy from collections import defaultdict, deque from pathlib import Path -from typing import Mapping, Optional, Tuple, TypeVar +from typing import Optional, TypeVar +from collections.abc import Mapping import warnings from linkml_runtime.utils.namespaces import Namespaces @@ -107,7 +108,7 @@ def is_absolute_path(path: str) -> bool: @dataclass -class SchemaUsage(): +class SchemaUsage: """ A usage of an element of a schema """ @@ -119,7 +120,7 @@ class SchemaUsage(): @dataclass -class SchemaView(object): +class SchemaView: """ A SchemaView provides a virtual schema layered on top of a schema plus its import closure @@ -1242,7 +1243,7 @@ def get_element_by_mapping(self, mapping_id: URIorCURIE) -> List[str]: model_elements.append(element.name) return model_elements - def get_mapping_index(self, imports=True, expand=False) -> Dict[URIorCURIE, List[Tuple[MAPPING_TYPE, Element]]]: + def get_mapping_index(self, imports=True, expand=False) -> Dict[URIorCURIE, List[tuple[MAPPING_TYPE, Element]]]: """ Returns an index of all elements keyed by the mapping value. The index values are tuples of mapping type and element diff --git a/linkml_runtime/utils/schemaview_cli.py b/linkml_runtime/utils/schemaview_cli.py index 7d4a862e..44256451 100644 --- a/linkml_runtime/utils/schemaview_cli.py +++ b/linkml_runtime/utils/schemaview_cli.py @@ -1,9 +1,6 @@ import io import json import logging -import re -from pathlib import Path -from typing import Dict, List, Tuple from json_flattener import flatten_to_csv @@ -11,7 +8,7 @@ from linkml_runtime.utils.schemaview import SchemaView from linkml_runtime.dumpers import json_dumper, yaml_dumper import click -import yaml +import builtins logger = logging.getLogger(__name__) @@ -138,7 +135,7 @@ def delete(schema, class_names): print(yaml_dumper.dumps(schema_view.schema)) -def _show_elements(elements: List[Element], columns=None, output = io.StringIO()) -> None: +def _show_elements(elements: builtins.list[Element], columns=None, output = io.StringIO()) -> None: elements_j = json.loads(json_dumper.dumps(elements, inject_type=False)) if columns is not None and columns != '' and columns != [] and columns != '%': if isinstance(columns, str): diff --git a/linkml_runtime/utils/slot.py b/linkml_runtime/utils/slot.py index bdc0b309..82adbf40 100644 --- a/linkml_runtime/utils/slot.py +++ b/linkml_runtime/utils/slot.py @@ -1,5 +1,6 @@ from dataclasses import dataclass -from typing import Type, List, Optional, Any, re +from typing import Optional, Any +from re import Pattern from rdflib import URIRef @@ -12,7 +13,7 @@ class Slot: curie: Optional[str] model_uri: URIRef - domain: Optional[Type] + domain: Optional[type] range: Any - mappings: Optional[List[URIRef]] = None - pattern: Optional[re] = None + mappings: Optional[list[URIRef]] = None + pattern: Optional[Pattern] = None diff --git a/linkml_runtime/utils/walker_utils.py b/linkml_runtime/utils/walker_utils.py index ba9190c7..1aa0061c 100644 --- a/linkml_runtime/utils/walker_utils.py +++ b/linkml_runtime/utils/walker_utils.py @@ -3,7 +3,7 @@ """ from copy import deepcopy -from typing import Callable, Union, List, Dict, Any +from typing import Callable, Union, Any from linkml_runtime.utils.yamlutils import YAMLRoot @@ -21,7 +21,7 @@ def traverse_object_tree(obj: YAMLRoot, func: Callable, mutate: bool = True) -> # implementation for traverse_object_tree, but also accepts lists, dicts -def _traverse_object_tree_1(obj: Union[YAMLRoot, List, Dict], func: Callable, +def _traverse_object_tree_1(obj: Union[YAMLRoot, list, dict], func: Callable, mutate: bool = True) -> Any: if isinstance(obj, list): return [_traverse_object_tree_1(x, func, mutate) for x in obj] diff --git a/linkml_runtime/utils/yamlutils.py b/linkml_runtime/utils/yamlutils.py index 219cb135..2a5b2832 100644 --- a/linkml_runtime/utils/yamlutils.py +++ b/linkml_runtime/utils/yamlutils.py @@ -1,6 +1,6 @@ from copy import copy from json import JSONDecoder -from typing import Union, Any, List, Optional, Type, Callable, Dict +from typing import Union, Any, Optional, Callable from pprint import pformat import textwrap import re @@ -8,12 +8,11 @@ import yaml from deprecated.classic import deprecated from jsonasobj2 import JsonObj, as_json, as_dict, JsonObjTypes, items -import jsonasobj2 from rdflib import Graph, URIRef from yaml.constructor import ConstructorError from linkml_runtime.utils.context_utils import CONTEXTS_PARAM_TYPE, merge_contexts -from linkml_runtime.utils.formatutils import is_empty, remove_empty_items, is_list, is_dict, items +from linkml_runtime.utils.formatutils import is_empty, items YAMLObjTypes = Union[JsonObjTypes, "YAMLRoot"] @@ -44,9 +43,9 @@ def __init__(self, *args, **kwargs): """ super().__init__(*args, **kwargs) - def __post_init__(self, *args: List[str], **kwargs): + def __post_init__(self, *args: list[str], **kwargs): if args or kwargs: - messages: List[str] = [] + messages: list[str] = [] for v in args: v = repr(v)[:40].replace('\n', '\\n') messages.append(f"Unknown positional argument: {v}") @@ -101,13 +100,13 @@ def _is_empty(v: Any) -> bool: # TODO: Deprecate this function and migrate the python generator over to the stand alone is_empty return is_empty(v) - def _normalize_inlined_as_list(self, slot_name: str, slot_type: Type, key_name: str, keyed: bool) -> None: + def _normalize_inlined_as_list(self, slot_name: str, slot_type: type, key_name: str, keyed: bool) -> None: self._normalize_inlined(slot_name, slot_type, key_name, keyed, True) - def _normalize_inlined_as_dict(self, slot_name: str, slot_type: Type, key_name: str, keyed: bool) -> None: + def _normalize_inlined_as_dict(self, slot_name: str, slot_type: type, key_name: str, keyed: bool) -> None: self._normalize_inlined(slot_name, slot_type, key_name, keyed, False) - def _normalize_inlined(self, slot_name: str, slot_type: Type, key_name: str, keyed: bool, is_list: bool) \ + def _normalize_inlined(self, slot_name: str, slot_type: type, key_name: str, keyed: bool, is_list: bool) \ -> None: """ __post_init__ function for a list of inlined keyed or identified classes. @@ -149,7 +148,7 @@ def loc(s): loc_str = '' return loc_str + str(s) - def form_1(entries: Dict[Any, Optional[Union[dict, JsonObj]]]) -> None: + def form_1(entries: dict[Any, Optional[Union[dict, JsonObj]]]) -> None: """ A dictionary of key:dict entries where key is the identifier and dict is an instance of slot_type """ for key, raw_obj in items(entries): if raw_obj is None: @@ -217,7 +216,7 @@ def form_1(entries: Dict[Any, Optional[Union[dict, JsonObj]]]) -> None: raise ValueError(f"Unrecognized entry: {loc(k)}: {str(v)}") self[slot_name] = cooked_slot - def _normalize_inlined_slot(self, slot_name: str, slot_type: Type, key_name: Optional[str], + def _normalize_inlined_slot(self, slot_name: str, slot_type: type, key_name: Optional[str], inlined_as_list: Optional[bool], keyed: bool) -> None: """ A deprecated entry point to slot normalization. Used for models generated prior to the linkml-runtime split. @@ -252,7 +251,7 @@ def _normalize_inlined_slot(self, slot_name: str, slot_type: Type, key_name: Opt self._normalize_inlined_as_dict(slot_name, slot_type, key_name, keyed) @classmethod - def _class_for(cls, attribute: str, uri_or_curie: Union[str, URIRef]) -> Optional[Type["YAMLRoot"]]: + def _class_for(cls, attribute: str, uri_or_curie: Union[str, URIRef]) -> Optional[type["YAMLRoot"]]: """ Locate self or descendant class that has attribute == uri_or_curie """ if getattr(cls, attribute, None) == uri_or_curie: return cls @@ -263,14 +262,14 @@ def _class_for(cls, attribute: str, uri_or_curie: Union[str, URIRef]) -> Optiona return None @classmethod - def _class_for_uri(cls: Type["YAMLRoot"], uri: str, use_model_uri: bool = False) -> Optional[Type["YAMLRoot"]]: + def _class_for_uri(cls: type["YAMLRoot"], uri: str, use_model_uri: bool = False) -> Optional[type["YAMLRoot"]]: """ Return the self or descendant of self having with a matching class uri """ return cls._class_for('class_model_uri' if use_model_uri else 'class_class_uri', URIRef(uri)) @classmethod - def _class_for_curie(cls: Type["YAMLRoot"], curie: str) -> Optional[Type["YAMLRoot"]]: + def _class_for_curie(cls: type["YAMLRoot"], curie: str) -> Optional[type["YAMLRoot"]]: return cls._class_for('class_class_curie', curie) # ================== @@ -341,7 +340,7 @@ def root_representer(dumper: yaml.Dumper, data: YAMLRoot): return dumper.represent_data(rval) -def from_yaml(data: str, cls: Type[YAMLRoot]) -> YAMLRoot: +def from_yaml(data: str, cls: type[YAMLRoot]) -> YAMLRoot: return cls(**yaml.load(data, DupCheckYamlLoader)) @@ -455,7 +454,7 @@ def map_constructor(loader, node, deep=False): """ if not isinstance(node, yaml.MappingNode): - raise ConstructorError(None, None, "expected a mapping node, but found %s" % node.id, node.start_mark) + raise ConstructorError(None, None, f"expected a mapping node, but found {node.id}", node.start_mark) mapping = {} for key_node, value_node in node.value: key = loader.construct_object(key_node, deep=deep) @@ -469,7 +468,7 @@ def map_constructor(loader, node, deep=False): def seq_constructor(loader, node, deep=False): if not isinstance(node, yaml.SequenceNode): raise ConstructorError(None, None, - "expected a sequence node, but found %s" % node.id, + f"expected a sequence node, but found {node.id}", node.start_mark) for child in node.value: if not child.value: diff --git a/notebooks/SchemaView_BioLink.ipynb b/notebooks/SchemaView_BioLink.ipynb index 49a4dc4a..57fa54a0 100644 --- a/notebooks/SchemaView_BioLink.ipynb +++ b/notebooks/SchemaView_BioLink.ipynb @@ -4,191 +4,191 @@ "cell_type": "code", "execution_count": 2, "metadata": {}, + "outputs": [], "source": [ "from linkml_runtime.utils.schemaview import SchemaView" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, + "outputs": [], "source": [ "view = SchemaView(\"../tests/test_utils/input/biolink-model.yaml\")" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, + "outputs": [], "source": [ "view.imports_closure()" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, + "outputs": [], "source": [ "len(view.all_classes()), len(view.all_slots()), len(view.all_subsets())" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, + "outputs": [], "source": [ "view.class_ancestors('gene')" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, + "outputs": [], "source": [ "[view.get_uri(c) for c in view.class_ancestors('gene')]" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, + "outputs": [], "source": [ "[view.get_uri(c, expand=True) for c in view.class_ancestors('gene')]" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, + "outputs": [], "source": [ "view.class_ancestors('gene', mixins=False)" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, + "outputs": [], "source": [ "view.slot_ancestors('affects')" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, + "outputs": [], "source": [ "view.slot_children('affects')" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, + "outputs": [], "source": [ "affects = view.get_slot('affects')" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, + "outputs": [], "source": [ "affects.exact_mappings" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, + "outputs": [], "source": [ "view.get_mappings(affects.name)" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, + "outputs": [], "source": [ "view.get_mappings(affects.name, expand=True)" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, + "outputs": [], "source": [ "[c for c in view.all_classes().keys() if view.is_relationship(c)][0:20]" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, + "outputs": [], "source": [ "view.annotation_dict(affects.name)" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, + "outputs": [], "source": [ "affects.annotations" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, + "outputs": [], "source": [ - "from linkml_runtime.linkml_model.annotations import Annotation, Annotatable\n", + "from linkml_runtime.linkml_model.annotations import Annotatable\n", "\n", "isinstance(affects, Annotatable)" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, + "outputs": [], "source": [ "affects" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, + "outputs": [], "source": [ "e = view.get_element('affects')\n", "e" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "source": [], - "outputs": [] + "outputs": [], + "source": [] } ], "metadata": { diff --git a/notebooks/SchemaView_Monarch.ipynb b/notebooks/SchemaView_Monarch.ipynb index 98ec7743..ef527bcf 100644 --- a/notebooks/SchemaView_Monarch.ipynb +++ b/notebooks/SchemaView_Monarch.ipynb @@ -5,31 +5,31 @@ "execution_count": 1, "id": "3e37f9e6", "metadata": {}, + "outputs": [], "source": [ "# what biolink:category does my identifier represent\n", "# how to find the predicates used for gene to disease mappings\n" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 14, "id": "169c9e40", "metadata": {}, + "outputs": [], "source": [ "from linkml_runtime.utils.schemaview import SchemaView\n", "import requests \n", - "from pprint import pprint\n", "# note you can also use a path on a local filesystem\n", "view = SchemaView(\"https://raw.githubusercontent.com/biolink/biolink-model/master/biolink-model.yaml\")" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 15, "id": "54424ac5", "metadata": {}, + "outputs": [], "source": [ "# what biolink:category does my identifier represent?\n", "# id_prefixes\n", @@ -40,50 +40,50 @@ "\n", "element = view.get_element('phenotype of')\n", "print(element.name)\n" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 16, "id": "61eeb009", "metadata": {}, + "outputs": [], "source": [ "# find inverses of a predicate\n", "print(\"inverse is: \" + view.inverse(element.name))" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 17, "id": "91212ad9", "metadata": {}, + "outputs": [], "source": [ "# id_prefixes\n", "prefixed_categories = view.get_elements_applicable_by_identifier(\"DOID:4\")\n", "print(prefixed_categories)" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 18, "id": "49d364e9", "metadata": {}, + "outputs": [], "source": [ "# mappings \n", "\n", "mapped_categories = view.get_category_by_mapping('SO:0001583')\n", "print(mapped_categories)\n" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 21, "id": "a7a0fa3f", "metadata": {}, + "outputs": [], "source": [ "# object = 'gene'\n", "# object = 'disease'\n", @@ -112,41 +112,41 @@ " else:\n", " print(exact_mapping + \": can't find any matching terms in OLS that don't return 404 errors\")\n", " " - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 10, "id": "5fbbc1c1", "metadata": {}, + "outputs": [], "source": [ "# is my element a mixin?\n", "\n", "e = view.get_element('gene or gene product')\n", "view.is_mixin(e.name)" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 22, "id": "5ab2f5c3", "metadata": {}, + "outputs": [], "source": [ "# view poly hierarchy - a gene is a chemical and biological entity\n", "\n", "ancestors = view.class_ancestors('gene')\n", "for a in ancestors:\n", " print(a)\n" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 23, "id": "2f9e0c55", "metadata": {}, + "outputs": [], "source": [ "# how to find the predicates used for gene to disease mappings\n", "# association: \n", @@ -161,14 +161,14 @@ "for a in associations:\n", " if a.startswith('gene'):\n", " print(a)\n" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 26, "id": "2779d0d9", "metadata": {}, + "outputs": [], "source": [ "for association in associations:\n", " domain_element = view.get_element(view.induced_slot('subject', association).range)\n", @@ -180,29 +180,28 @@ " if 'gene or gene product' in view.class_ancestors(domain_element.name) and 'disease' in view.class_ancestors(range_element.name):\n", " print(association)\n", " print(view.induced_slot('subject', association))\n" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": null, "id": "04093dc5", "metadata": {}, + "outputs": [], "source": [ "# find predicates for those associations\n", "# at this point, navigating the online doc might be easiest if you just want answers. \n", "# programatically, we can get the predicates that have equivalent domain and range constraints to find which \n", "# coudl be used for associations above.\n" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": null, "id": "6c8ade22", "metadata": {}, - "source": [], - "outputs": [] + "outputs": [], + "source": [] } ], "metadata": { diff --git a/poetry.lock b/poetry.lock index afd28039..be90c706 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,47 +1,44 @@ -# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "annotated-types" -version = "0.6.0" +version = "0.7.0" description = "Reusable constraint types to use with typing.Annotated" optional = false python-versions = ">=3.8" files = [ - {file = "annotated_types-0.6.0-py3-none-any.whl", hash = "sha256:0641064de18ba7a25dee8f96403ebc39113d0cb953a01429249d5c7564666a43"}, - {file = "annotated_types-0.6.0.tar.gz", hash = "sha256:563339e807e53ffd9c267e99fc6d9ea23eb8443c08f112651963e24e22f84a5d"}, + {file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"}, + {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, ] -[package.dependencies] -typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} - [[package]] name = "attrs" -version = "23.2.0" +version = "24.2.0" description = "Classes Without Boilerplate" optional = false python-versions = ">=3.7" files = [ - {file = "attrs-23.2.0-py3-none-any.whl", hash = "sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1"}, - {file = "attrs-23.2.0.tar.gz", hash = "sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30"}, + {file = "attrs-24.2.0-py3-none-any.whl", hash = "sha256:81921eb96de3191c8258c199618104dd27ac608d9366f5e35d011eae1867ede2"}, + {file = "attrs-24.2.0.tar.gz", hash = "sha256:5cfb1b9148b5b086569baec03f20d7b6bf3bcacc9a42bebf87ffaaca362f6346"}, ] [package.extras] -cov = ["attrs[tests]", "coverage[toml] (>=5.3)"] -dev = ["attrs[tests]", "pre-commit"] -docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope-interface"] -tests = ["attrs[tests-no-zope]", "zope-interface"] -tests-mypy = ["mypy (>=1.6)", "pytest-mypy-plugins"] -tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pytest (>=4.3.0)", "pytest-xdist[psutil]"] +benchmark = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-codspeed", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +cov = ["cloudpickle", "coverage[toml] (>=5.3)", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +dev = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +docs = ["cogapp", "furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier (<24.7)"] +tests = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +tests-mypy = ["mypy (>=1.11.1)", "pytest-mypy-plugins"] [[package]] name = "cattrs" -version = "23.2.3" +version = "24.1.2" description = "Composable complex class support for attrs and dataclasses." optional = false python-versions = ">=3.8" files = [ - {file = "cattrs-23.2.3-py3-none-any.whl", hash = "sha256:0341994d94971052e9ee70662542699a3162ea1e0c62f7ce1b4a57f563685108"}, - {file = "cattrs-23.2.3.tar.gz", hash = "sha256:a934090d95abaa9e911dac357e3a8699e0b4b14f8529bcc7d2b1ad9d51672b9f"}, + {file = "cattrs-24.1.2-py3-none-any.whl", hash = "sha256:67c7495b760168d931a10233f979b28dc04daf853b30752246f4f8471c6d68d0"}, + {file = "cattrs-24.1.2.tar.gz", hash = "sha256:8028cfe1ff5382df59dd36474a86e02d817b06eaf8af84555441bac915d2ef85"}, ] [package.dependencies] @@ -53,6 +50,7 @@ typing-extensions = {version = ">=4.1.0,<4.6.3 || >4.6.3", markers = "python_ver bson = ["pymongo (>=4.4.0)"] cbor2 = ["cbor2 (>=5.4.6)"] msgpack = ["msgpack (>=1.0.5)"] +msgspec = ["msgspec (>=0.18.5)"] orjson = ["orjson (>=3.9.2)"] pyyaml = ["pyyaml (>=6.0)"] tomlkit = ["tomlkit (>=0.11.8)"] @@ -60,112 +58,127 @@ ujson = ["ujson (>=5.7.0)"] [[package]] name = "certifi" -version = "2024.2.2" +version = "2024.8.30" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"}, - {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"}, + {file = "certifi-2024.8.30-py3-none-any.whl", hash = "sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8"}, + {file = "certifi-2024.8.30.tar.gz", hash = "sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9"}, ] [[package]] name = "charset-normalizer" -version = "3.3.2" +version = "3.4.0" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." optional = false python-versions = ">=3.7.0" files = [ - {file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e06ed3eb3218bc64786f7db41917d4e686cc4856944f53d5bdf83a6884432e12"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:2e81c7b9c8979ce92ed306c249d46894776a909505d8f5a4ba55b14206e3222f"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:572c3763a264ba47b3cf708a44ce965d98555f618ca42c926a9c1616d8f34269"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-win32.whl", hash = "sha256:3d47fa203a7bd9c5b6cee4736ee84ca03b8ef23193c0d1ca99b5089f72645c73"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-win_amd64.whl", hash = "sha256:10955842570876604d404661fbccbc9c7e684caf432c09c715ec38fbae45ae09"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-win32.whl", hash = "sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl", hash = "sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-win32.whl", hash = "sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl", hash = "sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:95f2a5796329323b8f0512e09dbb7a1860c46a39da62ecb2324f116fa8fdc85c"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c002b4ffc0be611f0d9da932eb0f704fe2602a9a949d1f738e4c34c75b0863d5"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a981a536974bbc7a512cf44ed14938cf01030a99e9b3a06dd59578882f06f985"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3287761bc4ee9e33561a7e058c72ac0938c4f57fe49a09eae428fd88aafe7bb6"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:42cb296636fcc8b0644486d15c12376cb9fa75443e00fb25de0b8602e64c1714"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0a55554a2fa0d408816b3b5cedf0045f4b8e1a6065aec45849de2d6f3f8e9786"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:c083af607d2515612056a31f0a8d9e0fcb5876b7bfc0abad3ecd275bc4ebc2d5"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:87d1351268731db79e0f8e745d92493ee2841c974128ef629dc518b937d9194c"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:bd8f7df7d12c2db9fab40bdd87a7c09b1530128315d047a086fa3ae3435cb3a8"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:c180f51afb394e165eafe4ac2936a14bee3eb10debc9d9e4db8958fe36afe711"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:8c622a5fe39a48f78944a87d4fb8a53ee07344641b0562c540d840748571b811"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-win32.whl", hash = "sha256:db364eca23f876da6f9e16c9da0df51aa4f104a972735574842618b8c6d999d4"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-win_amd64.whl", hash = "sha256:86216b5cee4b06df986d214f664305142d9c76df9b6512be2738aa72a2048f99"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:6463effa3186ea09411d50efc7d85360b38d5f09b870c48e4600f63af490e56a"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6c4caeef8fa63d06bd437cd4bdcf3ffefe6738fb1b25951440d80dc7df8c03ac"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:37e55c8e51c236f95b033f6fb391d7d7970ba5fe7ff453dad675e88cf303377a"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fb69256e180cb6c8a894fee62b3afebae785babc1ee98b81cdf68bbca1987f33"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ae5f4161f18c61806f411a13b0310bea87f987c7d2ecdbdaad0e94eb2e404238"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b2b0a0c0517616b6869869f8c581d4eb2dd83a4d79e0ebcb7d373ef9956aeb0a"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:45485e01ff4d3630ec0d9617310448a8702f70e9c01906b0d0118bdf9d124cf2"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eb00ed941194665c332bf8e078baf037d6c35d7c4f3102ea2d4f16ca94a26dc8"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:2127566c664442652f024c837091890cb1942c30937add288223dc895793f898"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:a50aebfa173e157099939b17f18600f72f84eed3049e743b68ad15bd69b6bf99"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:4d0d1650369165a14e14e1e47b372cfcb31d6ab44e6e33cb2d4e57265290044d"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:923c0c831b7cfcb071580d3f46c4baf50f174be571576556269530f4bbd79d04"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-win32.whl", hash = "sha256:6ef1d82a3af9d3eecdba2321dc1b3c238245d890843e040e41e470ffa64c3e25"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-win_amd64.whl", hash = "sha256:eb8821e09e916165e160797a6c17edda0679379a4be5c716c260e836e122f54b"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:c235ebd9baae02f1b77bcea61bce332cb4331dc3617d254df3323aa01ab47bd4"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5b4c145409bef602a690e7cfad0a15a55c13320ff7a3ad7ca59c13bb8ba4d45d"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:68d1f8a9e9e37c1223b656399be5d6b448dea850bed7d0f87a8311f1ff3dabb0"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22afcb9f253dac0696b5a4be4a1c0f8762f8239e21b99680099abd9b2b1b2269"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e27ad930a842b4c5eb8ac0016b0a54f5aebbe679340c26101df33424142c143c"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1f79682fbe303db92bc2b1136016a38a42e835d932bab5b3b1bfcfbf0640e519"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b261ccdec7821281dade748d088bb6e9b69e6d15b30652b74cbbac25e280b796"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:122c7fa62b130ed55f8f285bfd56d5f4b4a5b503609d181f9ad85e55c89f4185"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:d0eccceffcb53201b5bfebb52600a5fb483a20b61da9dbc885f8b103cbe7598c"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9f96df6923e21816da7e0ad3fd47dd8f94b2a5ce594e00677c0013018b813458"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:7f04c839ed0b6b98b1a7501a002144b76c18fb1c1850c8b98d458ac269e26ed2"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:34d1c8da1e78d2e001f363791c98a272bb734000fcef47a491c1e3b0505657a8"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-win32.whl", hash = "sha256:aed38f6e4fb3f5d6bf81bfa990a07806be9d83cf7bacef998ab1a9bd660a581f"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl", hash = "sha256:b01b88d45a6fcb69667cd6d2f7a9aeb4bf53760d7fc536bf679ec94fe9f3ff3d"}, - {file = "charset_normalizer-3.3.2-py3-none-any.whl", hash = "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:4f9fc98dad6c2eaa32fc3af1417d95b5e3d08aff968df0cd320066def971f9a6"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0de7b687289d3c1b3e8660d0741874abe7888100efe14bd0f9fd7141bcbda92b"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5ed2e36c3e9b4f21dd9422f6893dec0abf2cca553af509b10cd630f878d3eb99"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:40d3ff7fc90b98c637bda91c89d51264a3dcf210cade3a2c6f838c7268d7a4ca"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1110e22af8ca26b90bd6364fe4c763329b0ebf1ee213ba32b68c73de5752323d"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:86f4e8cca779080f66ff4f191a685ced73d2f72d50216f7112185dc02b90b9b7"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7f683ddc7eedd742e2889d2bfb96d69573fde1d92fcb811979cdb7165bb9c7d3"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:27623ba66c183eca01bf9ff833875b459cad267aeeb044477fedac35e19ba907"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:f606a1881d2663630ea5b8ce2efe2111740df4b687bd78b34a8131baa007f79b"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:0b309d1747110feb25d7ed6b01afdec269c647d382c857ef4663bbe6ad95a912"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:136815f06a3ae311fae551c3df1f998a1ebd01ddd424aa5603a4336997629e95"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:14215b71a762336254351b00ec720a8e85cada43b987da5a042e4ce3e82bd68e"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:79983512b108e4a164b9c8d34de3992f76d48cadc9554c9e60b43f308988aabe"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-win32.whl", hash = "sha256:c94057af19bc953643a33581844649a7fdab902624d2eb739738a30e2b3e60fc"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-win_amd64.whl", hash = "sha256:55f56e2ebd4e3bc50442fbc0888c9d8c94e4e06a933804e2af3e89e2f9c1c749"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:0d99dd8ff461990f12d6e42c7347fd9ab2532fb70e9621ba520f9e8637161d7c"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c57516e58fd17d03ebe67e181a4e4e2ccab1168f8c2976c6a334d4f819fe5944"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6dba5d19c4dfab08e58d5b36304b3f92f3bd5d42c1a3fa37b5ba5cdf6dfcbcee"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf4475b82be41b07cc5e5ff94810e6a01f276e37c2d55571e3fe175e467a1a1c"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ce031db0408e487fd2775d745ce30a7cd2923667cf3b69d48d219f1d8f5ddeb6"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8ff4e7cdfdb1ab5698e675ca622e72d58a6fa2a8aa58195de0c0061288e6e3ea"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3710a9751938947e6327ea9f3ea6332a09bf0ba0c09cae9cb1f250bd1f1549bc"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:82357d85de703176b5587dbe6ade8ff67f9f69a41c0733cf2425378b49954de5"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:47334db71978b23ebcf3c0f9f5ee98b8d65992b65c9c4f2d34c2eaf5bcaf0594"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:8ce7fd6767a1cc5a92a639b391891bf1c268b03ec7e021c7d6d902285259685c"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:f1a2f519ae173b5b6a2c9d5fa3116ce16e48b3462c8b96dfdded11055e3d6365"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:63bc5c4ae26e4bc6be6469943b8253c0fd4e4186c43ad46e713ea61a0ba49129"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:bcb4f8ea87d03bc51ad04add8ceaf9b0f085ac045ab4d74e73bbc2dc033f0236"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-win32.whl", hash = "sha256:9ae4ef0b3f6b41bad6366fb0ea4fc1d7ed051528e113a60fa2a65a9abb5b1d99"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:cee4373f4d3ad28f1ab6290684d8e2ebdb9e7a1b74fdc39e4c211995f77bec27"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:0713f3adb9d03d49d365b70b84775d0a0d18e4ab08d12bc46baa6132ba78aaf6"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:de7376c29d95d6719048c194a9cf1a1b0393fbe8488a22008610b0361d834ecf"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4a51b48f42d9358460b78725283f04bddaf44a9358197b889657deba38f329db"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b295729485b06c1a0683af02a9e42d2caa9db04a373dc38a6a58cdd1e8abddf1"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ee803480535c44e7f5ad00788526da7d85525cfefaf8acf8ab9a310000be4b03"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3d59d125ffbd6d552765510e3f31ed75ebac2c7470c7274195b9161a32350284"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8cda06946eac330cbe6598f77bb54e690b4ca93f593dee1568ad22b04f347c15"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07afec21bbbbf8a5cc3651aa96b980afe2526e7f048fdfb7f1014d84acc8b6d8"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6b40e8d38afe634559e398cc32b1472f376a4099c75fe6299ae607e404c033b2"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:b8dcd239c743aa2f9c22ce674a145e0a25cb1566c495928440a181ca1ccf6719"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:84450ba661fb96e9fd67629b93d2941c871ca86fc38d835d19d4225ff946a631"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:44aeb140295a2f0659e113b31cfe92c9061622cadbc9e2a2f7b8ef6b1e29ef4b"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1db4e7fefefd0f548d73e2e2e041f9df5c59e178b4c72fbac4cc6f535cfb1565"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-win32.whl", hash = "sha256:5726cf76c982532c1863fb64d8c6dd0e4c90b6ece9feb06c9f202417a31f7dd7"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:b197e7094f232959f8f20541ead1d9862ac5ebea1d58e9849c1bf979255dfac9"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:dd4eda173a9fcccb5f2e2bd2a9f423d180194b1bf17cf59e3269899235b2a114"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e9e3c4c9e1ed40ea53acf11e2a386383c3304212c965773704e4603d589343ed"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:92a7e36b000bf022ef3dbb9c46bfe2d52c047d5e3f3343f43204263c5addc250"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:54b6a92d009cbe2fb11054ba694bc9e284dad30a26757b1e372a1fdddaf21920"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ffd9493de4c922f2a38c2bf62b831dcec90ac673ed1ca182fe11b4d8e9f2a64"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:35c404d74c2926d0287fbd63ed5d27eb911eb9e4a3bb2c6d294f3cfd4a9e0c23"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4796efc4faf6b53a18e3d46343535caed491776a22af773f366534056c4e1fbc"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e7fdd52961feb4c96507aa649550ec2a0d527c086d284749b2f582f2d40a2e0d"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:92db3c28b5b2a273346bebb24857fda45601aef6ae1c011c0a997106581e8a88"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:ab973df98fc99ab39080bfb0eb3a925181454d7c3ac8a1e695fddfae696d9e90"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:4b67fdab07fdd3c10bb21edab3cbfe8cf5696f453afce75d815d9d7223fbe88b"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:aa41e526a5d4a9dfcfbab0716c7e8a1b215abd3f3df5a45cf18a12721d31cb5d"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ffc519621dce0c767e96b9c53f09c5d215578e10b02c285809f76509a3931482"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-win32.whl", hash = "sha256:f19c1585933c82098c2a520f8ec1227f20e339e33aca8fa6f956f6691b784e67"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:707b82d19e65c9bd28b81dde95249b07bf9f5b90ebe1ef17d9b57473f8a64b7b"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:dbe03226baf438ac4fda9e2d0715022fd579cb641c4cf639fa40d53b2fe6f3e2"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dd9a8bd8900e65504a305bf8ae6fa9fbc66de94178c420791d0293702fce2df7"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b8831399554b92b72af5932cdbbd4ddc55c55f631bb13ff8fe4e6536a06c5c51"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a14969b8691f7998e74663b77b4c36c0337cb1df552da83d5c9004a93afdb574"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dcaf7c1524c0542ee2fc82cc8ec337f7a9f7edee2532421ab200d2b920fc97cf"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:425c5f215d0eecee9a56cdb703203dda90423247421bf0d67125add85d0c4455"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:d5b054862739d276e09928de37c79ddeec42a6e1bfc55863be96a36ba22926f6"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_i686.whl", hash = "sha256:f3e73a4255342d4eb26ef6df01e3962e73aa29baa3124a8e824c5d3364a65748"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_ppc64le.whl", hash = "sha256:2f6c34da58ea9c1a9515621f4d9ac379871a8f21168ba1b5e09d74250de5ad62"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_s390x.whl", hash = "sha256:f09cb5a7bbe1ecae6e87901a2eb23e0256bb524a79ccc53eb0b7629fbe7677c4"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:0099d79bdfcf5c1f0c2c72f91516702ebf8b0b8ddd8905f97a8aecf49712c621"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-win32.whl", hash = "sha256:9c98230f5042f4945f957d006edccc2af1e03ed5e37ce7c373f00a5a4daa6149"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-win_amd64.whl", hash = "sha256:62f60aebecfc7f4b82e3f639a7d1433a20ec32824db2199a11ad4f5e146ef5ee"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:af73657b7a68211996527dbfeffbb0864e043d270580c5aef06dc4b659a4b578"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cab5d0b79d987c67f3b9e9c53f54a61360422a5a0bc075f43cab5621d530c3b6"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:9289fd5dddcf57bab41d044f1756550f9e7cf0c8e373b8cdf0ce8773dc4bd417"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6b493a043635eb376e50eedf7818f2f322eabbaa974e948bd8bdd29eb7ef2a51"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9fa2566ca27d67c86569e8c85297aaf413ffab85a8960500f12ea34ff98e4c41"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a8e538f46104c815be19c975572d74afb53f29650ea2025bbfaef359d2de2f7f"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6fd30dc99682dc2c603c2b315bded2799019cea829f8bf57dc6b61efde6611c8"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2006769bd1640bdf4d5641c69a3d63b71b81445473cac5ded39740a226fa88ab"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:dc15e99b2d8a656f8e666854404f1ba54765871104e50c8e9813af8a7db07f12"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:ab2e5bef076f5a235c3774b4f4028a680432cded7cad37bba0fd90d64b187d19"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:4ec9dd88a5b71abfc74e9df5ebe7921c35cbb3b641181a531ca65cdb5e8e4dea"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:43193c5cda5d612f247172016c4bb71251c784d7a4d9314677186a838ad34858"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:aa693779a8b50cd97570e5a0f343538a8dbd3e496fa5dcb87e29406ad0299654"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-win32.whl", hash = "sha256:7706f5850360ac01d80c89bcef1640683cc12ed87f42579dab6c5d3ed6888613"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:c3e446d253bd88f6377260d07c895816ebf33ffffd56c1c792b13bff9c3e1ade"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:980b4f289d1d90ca5efcf07958d3eb38ed9c0b7676bf2831a54d4f66f9c27dfa"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f28f891ccd15c514a0981f3b9db9aa23d62fe1a99997512b0491d2ed323d229a"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a8aacce6e2e1edcb6ac625fb0f8c3a9570ccc7bfba1f63419b3769ccf6a00ed0"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bd7af3717683bea4c87acd8c0d3d5b44d56120b26fd3f8a692bdd2d5260c620a"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5ff2ed8194587faf56555927b3aa10e6fb69d931e33953943bc4f837dfee2242"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e91f541a85298cf35433bf66f3fab2a4a2cff05c127eeca4af174f6d497f0d4b"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:309a7de0a0ff3040acaebb35ec45d18db4b28232f21998851cfa709eeff49d62"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:285e96d9d53422efc0d7a17c60e59f37fbf3dfa942073f666db4ac71e8d726d0"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:5d447056e2ca60382d460a604b6302d8db69476fd2015c81e7c35417cfabe4cd"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:20587d20f557fe189b7947d8e7ec5afa110ccf72a3128d61a2a387c3313f46be"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:130272c698667a982a5d0e626851ceff662565379baf0ff2cc58067b81d4f11d"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:ab22fbd9765e6954bc0bcff24c25ff71dcbfdb185fcdaca49e81bac68fe724d3"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:7782afc9b6b42200f7362858f9e73b1f8316afb276d316336c0ec3bd73312742"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-win32.whl", hash = "sha256:2de62e8801ddfff069cd5c504ce3bc9672b23266597d4e4f50eda28846c322f2"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-win_amd64.whl", hash = "sha256:95c3c157765b031331dd4db3c775e58deaee050a3042fcad72cbc4189d7c8dca"}, + {file = "charset_normalizer-3.4.0-py3-none-any.whl", hash = "sha256:fe9f97feb71aa9896b81973a7bbada8c49501dc73e58a10fcef6663af95e5079"}, + {file = "charset_normalizer-3.4.0.tar.gz", hash = "sha256:223217c3d4f82c3ac5e29032b3f1c2eb0fb591b72161f86d93f5719079dae93e"}, ] [[package]] @@ -257,22 +270,22 @@ toml = ["tomli"] [[package]] name = "curies" -version = "0.7.7" -description = "Idiomatic conversion between URIs and compact URIs (CURIEs)." +version = "0.8.0" +description = "Idiomatic conversion between URIs and compact URIs (CURIEs)" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "curies-0.7.7-py3-none-any.whl", hash = "sha256:609de3e8cdf39f410e8f4d9f06eb7df379465860f4fb441bf0e79672430f8e2a"}, - {file = "curies-0.7.7.tar.gz", hash = "sha256:a8d674029f906fb9c3564eafa0862ce96725932bd801fa751e076265b111cb34"}, + {file = "curies-0.8.0-py3-none-any.whl", hash = "sha256:da2f47270a778cc3ac5e573c1fcaab5c7f7ea91d9b542ada50d5fafb240997cd"}, + {file = "curies-0.8.0.tar.gz", hash = "sha256:be743facd2cc33cf3f827e318f846dcc192e7f7787a2bf215cb4c317e94ac02d"}, ] [package.dependencies] -pydantic = "*" +pydantic = ">=2.0" pytrie = "*" requests = "*" [package.extras] -docs = ["sphinx", "sphinx-automodapi", "sphinx-rtd-theme"] +docs = ["sphinx (>=8)", "sphinx-automodapi", "sphinx-rtd-theme (>=3.0)"] fastapi = ["defusedxml", "fastapi", "httpx", "python-multipart", "uvicorn"] flask = ["defusedxml", "flask"] pandas = ["pandas"] @@ -298,13 +311,13 @@ dev = ["PyTest", "PyTest-Cov", "bump2version (<1)", "sphinx (<2)", "tox"] [[package]] name = "exceptiongroup" -version = "1.2.0" +version = "1.2.2" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" files = [ - {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, - {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, + {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, + {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, ] [package.extras] @@ -323,32 +336,17 @@ files = [ [[package]] name = "idna" -version = "3.6" +version = "3.10" description = "Internationalized Domain Names in Applications (IDNA)" optional = false -python-versions = ">=3.5" -files = [ - {file = "idna-3.6-py3-none-any.whl", hash = "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"}, - {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"}, -] - -[[package]] -name = "importlib-resources" -version = "6.1.1" -description = "Read resources from Python packages" -optional = false -python-versions = ">=3.8" +python-versions = ">=3.6" files = [ - {file = "importlib_resources-6.1.1-py3-none-any.whl", hash = "sha256:e8bf90d8213b486f428c9c39714b920041cb02c184686a3dee24905aaa8105d6"}, - {file = "importlib_resources-6.1.1.tar.gz", hash = "sha256:3893a00122eafde6894c59914446a512f728a0c1a45f9bb9b63721b6bacf0b4a"}, + {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, + {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, ] -[package.dependencies] -zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""} - [package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-ruff", "zipp (>=3.17)"] +all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"] [[package]] name = "iniconfig" @@ -406,88 +404,75 @@ hbreader = "*" [[package]] name = "jsonschema" -version = "4.21.1" +version = "4.23.0" description = "An implementation of JSON Schema validation for Python" optional = false python-versions = ">=3.8" files = [ - {file = "jsonschema-4.21.1-py3-none-any.whl", hash = "sha256:7996507afae316306f9e2290407761157c6f78002dcf7419acb99822143d1c6f"}, - {file = "jsonschema-4.21.1.tar.gz", hash = "sha256:85727c00279f5fa6bedbe6238d2aa6403bedd8b4864ab11207d07df3cc1b2ee5"}, + {file = "jsonschema-4.23.0-py3-none-any.whl", hash = "sha256:fbadb6f8b144a8f8cf9f0b89ba94501d143e50411a1278633f56a7acf7fd5566"}, + {file = "jsonschema-4.23.0.tar.gz", hash = "sha256:d71497fef26351a33265337fa77ffeb82423f3ea21283cd9467bb03999266bc4"}, ] [package.dependencies] attrs = ">=22.2.0" -importlib-resources = {version = ">=1.4.0", markers = "python_version < \"3.9\""} jsonschema-specifications = ">=2023.03.6" -pkgutil-resolve-name = {version = ">=1.3.10", markers = "python_version < \"3.9\""} referencing = ">=0.28.4" rpds-py = ">=0.7.1" [package.extras] format = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3987", "uri-template", "webcolors (>=1.11)"] -format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3986-validator (>0.1.0)", "uri-template", "webcolors (>=1.11)"] +format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3986-validator (>0.1.0)", "uri-template", "webcolors (>=24.6.0)"] [[package]] name = "jsonschema-specifications" -version = "2023.12.1" +version = "2024.10.1" description = "The JSON Schema meta-schemas and vocabularies, exposed as a Registry" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "jsonschema_specifications-2023.12.1-py3-none-any.whl", hash = "sha256:87e4fdf3a94858b8a2ba2778d9ba57d8a9cafca7c7489c46ba0d30a8bc6a9c3c"}, - {file = "jsonschema_specifications-2023.12.1.tar.gz", hash = "sha256:48a76787b3e70f5ed53f1160d2b81f586e4ca6d1548c5de7085d1682674764cc"}, + {file = "jsonschema_specifications-2024.10.1-py3-none-any.whl", hash = "sha256:a09a0680616357d9a0ecf05c12ad234479f549239d0f5b55f3deea67475da9bf"}, + {file = "jsonschema_specifications-2024.10.1.tar.gz", hash = "sha256:0f38b83639958ce1152d02a7f062902c41c8fd20d558b0c34344292d417ae272"}, ] [package.dependencies] -importlib-resources = {version = ">=1.4.0", markers = "python_version < \"3.9\""} referencing = ">=0.31.0" [[package]] name = "packaging" -version = "23.2" +version = "24.1" description = "Core utilities for Python packages" optional = false -python-versions = ">=3.7" -files = [ - {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, - {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, -] - -[[package]] -name = "pkgutil-resolve-name" -version = "1.3.10" -description = "Resolve a name to an object." -optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" files = [ - {file = "pkgutil_resolve_name-1.3.10-py3-none-any.whl", hash = "sha256:ca27cc078d25c5ad71a9de0a7a330146c4e014c2462d9af19c6b828280649c5e"}, - {file = "pkgutil_resolve_name-1.3.10.tar.gz", hash = "sha256:357d6c9e6a755653cfd78893817c0853af365dd51ec97f3d358a819373bbd174"}, + {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, + {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, ] [[package]] name = "platformdirs" -version = "4.2.0" -description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +version = "4.3.6" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." optional = false python-versions = ">=3.8" files = [ - {file = "platformdirs-4.2.0-py3-none-any.whl", hash = "sha256:0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068"}, - {file = "platformdirs-4.2.0.tar.gz", hash = "sha256:ef0cc731df711022c174543cb70a9b5bd22e5a9337c8624ef2c2ceb8ddad8768"}, + {file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"}, + {file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"}, ] [package.extras] -docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] +docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"] +type = ["mypy (>=1.11.2)"] [[package]] name = "pluggy" -version = "1.4.0" +version = "1.5.0" description = "plugin and hook calling mechanisms for python" optional = false python-versions = ">=3.8" files = [ - {file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"}, - {file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"}, + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, ] [package.extras] @@ -513,13 +498,13 @@ requests = ">=2.28.1,<3.0.0" [[package]] name = "prefixmaps" -version = "0.2.2" +version = "0.2.5" description = "A python library for retrieving semantic prefix maps" optional = false -python-versions = ">=3.8,<4.0" +python-versions = "<4.0,>=3.8" files = [ - {file = "prefixmaps-0.2.2-py3-none-any.whl", hash = "sha256:4ac2bf3ddb9b27c40c978cf937e9bedb160050d24e8c679b94c9c885e1d73c72"}, - {file = "prefixmaps-0.2.2.tar.gz", hash = "sha256:a36b1554154ef465271bde82dc91cd671e2d31dc1f50c2fd08ccb0d7d5791c33"}, + {file = "prefixmaps-0.2.5-py3-none-any.whl", hash = "sha256:68caa04b3a6a8e058aa1c55affe32c62e44b564d031d63f768e267b796a1f3ee"}, + {file = "prefixmaps-0.2.5.tar.gz", hash = "sha256:aaccd2425ade2ea97a502c58be49fe8f3536e3d5e919712ae0358a39fc800799"}, ] [package.dependencies] @@ -528,109 +513,123 @@ pyyaml = ">=5.3.1" [[package]] name = "pydantic" -version = "2.6.1" +version = "2.9.2" description = "Data validation using Python type hints" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic-2.6.1-py3-none-any.whl", hash = "sha256:0b6a909df3192245cb736509a92ff69e4fef76116feffec68e93a567347bae6f"}, - {file = "pydantic-2.6.1.tar.gz", hash = "sha256:4fd5c182a2488dc63e6d32737ff19937888001e2a6d86e94b3f233104a5d1fa9"}, + {file = "pydantic-2.9.2-py3-none-any.whl", hash = "sha256:f048cec7b26778210e28a0459867920654d48e5e62db0958433636cde4254f12"}, + {file = "pydantic-2.9.2.tar.gz", hash = "sha256:d155cef71265d1e9807ed1c32b4c8deec042a44a50a4188b25ac67ecd81a9c0f"}, ] [package.dependencies] -annotated-types = ">=0.4.0" -pydantic-core = "2.16.2" -typing-extensions = ">=4.6.1" +annotated-types = ">=0.6.0" +pydantic-core = "2.23.4" +typing-extensions = [ + {version = ">=4.12.2", markers = "python_version >= \"3.13\""}, + {version = ">=4.6.1", markers = "python_version < \"3.13\""}, +] [package.extras] email = ["email-validator (>=2.0.0)"] +timezone = ["tzdata"] [[package]] name = "pydantic-core" -version = "2.16.2" -description = "" +version = "2.23.4" +description = "Core functionality for Pydantic validation and serialization" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic_core-2.16.2-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:3fab4e75b8c525a4776e7630b9ee48aea50107fea6ca9f593c98da3f4d11bf7c"}, - {file = "pydantic_core-2.16.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8bde5b48c65b8e807409e6f20baee5d2cd880e0fad00b1a811ebc43e39a00ab2"}, - {file = "pydantic_core-2.16.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2924b89b16420712e9bb8192396026a8fbd6d8726224f918353ac19c4c043d2a"}, - {file = "pydantic_core-2.16.2-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:16aa02e7a0f539098e215fc193c8926c897175d64c7926d00a36188917717a05"}, - {file = "pydantic_core-2.16.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:936a787f83db1f2115ee829dd615c4f684ee48ac4de5779ab4300994d8af325b"}, - {file = "pydantic_core-2.16.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:459d6be6134ce3b38e0ef76f8a672924460c455d45f1ad8fdade36796df1ddc8"}, - {file = "pydantic_core-2.16.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f9ee4febb249c591d07b2d4dd36ebcad0ccd128962aaa1801508320896575ef"}, - {file = "pydantic_core-2.16.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:40a0bd0bed96dae5712dab2aba7d334a6c67cbcac2ddfca7dbcc4a8176445990"}, - {file = "pydantic_core-2.16.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:870dbfa94de9b8866b37b867a2cb37a60c401d9deb4a9ea392abf11a1f98037b"}, - {file = "pydantic_core-2.16.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:308974fdf98046db28440eb3377abba274808bf66262e042c412eb2adf852731"}, - {file = "pydantic_core-2.16.2-cp310-none-win32.whl", hash = "sha256:a477932664d9611d7a0816cc3c0eb1f8856f8a42435488280dfbf4395e141485"}, - {file = "pydantic_core-2.16.2-cp310-none-win_amd64.whl", hash = "sha256:8f9142a6ed83d90c94a3efd7af8873bf7cefed2d3d44387bf848888482e2d25f"}, - {file = "pydantic_core-2.16.2-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:406fac1d09edc613020ce9cf3f2ccf1a1b2f57ab00552b4c18e3d5276c67eb11"}, - {file = "pydantic_core-2.16.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ce232a6170dd6532096cadbf6185271e4e8c70fc9217ebe105923ac105da9978"}, - {file = "pydantic_core-2.16.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a90fec23b4b05a09ad988e7a4f4e081711a90eb2a55b9c984d8b74597599180f"}, - {file = "pydantic_core-2.16.2-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8aafeedb6597a163a9c9727d8a8bd363a93277701b7bfd2749fbefee2396469e"}, - {file = "pydantic_core-2.16.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9957433c3a1b67bdd4c63717eaf174ebb749510d5ea612cd4e83f2d9142f3fc8"}, - {file = "pydantic_core-2.16.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b0d7a9165167269758145756db43a133608a531b1e5bb6a626b9ee24bc38a8f7"}, - {file = "pydantic_core-2.16.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dffaf740fe2e147fedcb6b561353a16243e654f7fe8e701b1b9db148242e1272"}, - {file = "pydantic_core-2.16.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f8ed79883b4328b7f0bd142733d99c8e6b22703e908ec63d930b06be3a0e7113"}, - {file = "pydantic_core-2.16.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:cf903310a34e14651c9de056fcc12ce090560864d5a2bb0174b971685684e1d8"}, - {file = "pydantic_core-2.16.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:46b0d5520dbcafea9a8645a8164658777686c5c524d381d983317d29687cce97"}, - {file = "pydantic_core-2.16.2-cp311-none-win32.whl", hash = "sha256:70651ff6e663428cea902dac297066d5c6e5423fda345a4ca62430575364d62b"}, - {file = "pydantic_core-2.16.2-cp311-none-win_amd64.whl", hash = "sha256:98dc6f4f2095fc7ad277782a7c2c88296badcad92316b5a6e530930b1d475ebc"}, - {file = "pydantic_core-2.16.2-cp311-none-win_arm64.whl", hash = "sha256:ef6113cd31411eaf9b39fc5a8848e71c72656fd418882488598758b2c8c6dfa0"}, - {file = "pydantic_core-2.16.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:88646cae28eb1dd5cd1e09605680c2b043b64d7481cdad7f5003ebef401a3039"}, - {file = "pydantic_core-2.16.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:7b883af50eaa6bb3299780651e5be921e88050ccf00e3e583b1e92020333304b"}, - {file = "pydantic_core-2.16.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7bf26c2e2ea59d32807081ad51968133af3025c4ba5753e6a794683d2c91bf6e"}, - {file = "pydantic_core-2.16.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:99af961d72ac731aae2a1b55ccbdae0733d816f8bfb97b41909e143de735f522"}, - {file = "pydantic_core-2.16.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:02906e7306cb8c5901a1feb61f9ab5e5c690dbbeaa04d84c1b9ae2a01ebe9379"}, - {file = "pydantic_core-2.16.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d5362d099c244a2d2f9659fb3c9db7c735f0004765bbe06b99be69fbd87c3f15"}, - {file = "pydantic_core-2.16.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ac426704840877a285d03a445e162eb258924f014e2f074e209d9b4ff7bf380"}, - {file = "pydantic_core-2.16.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b94cbda27267423411c928208e89adddf2ea5dd5f74b9528513f0358bba019cb"}, - {file = "pydantic_core-2.16.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:6db58c22ac6c81aeac33912fb1af0e930bc9774166cdd56eade913d5f2fff35e"}, - {file = "pydantic_core-2.16.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:396fdf88b1b503c9c59c84a08b6833ec0c3b5ad1a83230252a9e17b7dfb4cffc"}, - {file = "pydantic_core-2.16.2-cp312-none-win32.whl", hash = "sha256:7c31669e0c8cc68400ef0c730c3a1e11317ba76b892deeefaf52dcb41d56ed5d"}, - {file = "pydantic_core-2.16.2-cp312-none-win_amd64.whl", hash = "sha256:a3b7352b48fbc8b446b75f3069124e87f599d25afb8baa96a550256c031bb890"}, - {file = "pydantic_core-2.16.2-cp312-none-win_arm64.whl", hash = "sha256:a9e523474998fb33f7c1a4d55f5504c908d57add624599e095c20fa575b8d943"}, - {file = "pydantic_core-2.16.2-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:ae34418b6b389d601b31153b84dce480351a352e0bb763684a1b993d6be30f17"}, - {file = "pydantic_core-2.16.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:732bd062c9e5d9582a30e8751461c1917dd1ccbdd6cafb032f02c86b20d2e7ec"}, - {file = "pydantic_core-2.16.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e4b52776a2e3230f4854907a1e0946eec04d41b1fc64069ee774876bbe0eab55"}, - {file = "pydantic_core-2.16.2-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ef551c053692b1e39e3f7950ce2296536728871110e7d75c4e7753fb30ca87f4"}, - {file = "pydantic_core-2.16.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ebb892ed8599b23fa8f1799e13a12c87a97a6c9d0f497525ce9858564c4575a4"}, - {file = "pydantic_core-2.16.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aa6c8c582036275997a733427b88031a32ffa5dfc3124dc25a730658c47a572f"}, - {file = "pydantic_core-2.16.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e4ba0884a91f1aecce75202473ab138724aa4fb26d7707f2e1fa6c3e68c84fbf"}, - {file = "pydantic_core-2.16.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:7924e54f7ce5d253d6160090ddc6df25ed2feea25bfb3339b424a9dd591688bc"}, - {file = "pydantic_core-2.16.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:69a7b96b59322a81c2203be537957313b07dd333105b73db0b69212c7d867b4b"}, - {file = "pydantic_core-2.16.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:7e6231aa5bdacda78e96ad7b07d0c312f34ba35d717115f4b4bff6cb87224f0f"}, - {file = "pydantic_core-2.16.2-cp38-none-win32.whl", hash = "sha256:41dac3b9fce187a25c6253ec79a3f9e2a7e761eb08690e90415069ea4a68ff7a"}, - {file = "pydantic_core-2.16.2-cp38-none-win_amd64.whl", hash = "sha256:f685dbc1fdadb1dcd5b5e51e0a378d4685a891b2ddaf8e2bba89bd3a7144e44a"}, - {file = "pydantic_core-2.16.2-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:55749f745ebf154c0d63d46c8c58594d8894b161928aa41adbb0709c1fe78b77"}, - {file = "pydantic_core-2.16.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b30b0dd58a4509c3bd7eefddf6338565c4905406aee0c6e4a5293841411a1286"}, - {file = "pydantic_core-2.16.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:18de31781cdc7e7b28678df7c2d7882f9692ad060bc6ee3c94eb15a5d733f8f7"}, - {file = "pydantic_core-2.16.2-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5864b0242f74b9dd0b78fd39db1768bc3f00d1ffc14e596fd3e3f2ce43436a33"}, - {file = "pydantic_core-2.16.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b8f9186ca45aee030dc8234118b9c0784ad91a0bb27fc4e7d9d6608a5e3d386c"}, - {file = "pydantic_core-2.16.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cc6f6c9be0ab6da37bc77c2dda5f14b1d532d5dbef00311ee6e13357a418e646"}, - {file = "pydantic_core-2.16.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa057095f621dad24a1e906747179a69780ef45cc8f69e97463692adbcdae878"}, - {file = "pydantic_core-2.16.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6ad84731a26bcfb299f9eab56c7932d46f9cad51c52768cace09e92a19e4cf55"}, - {file = "pydantic_core-2.16.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:3b052c753c4babf2d1edc034c97851f867c87d6f3ea63a12e2700f159f5c41c3"}, - {file = "pydantic_core-2.16.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:e0f686549e32ccdb02ae6f25eee40cc33900910085de6aa3790effd391ae10c2"}, - {file = "pydantic_core-2.16.2-cp39-none-win32.whl", hash = "sha256:7afb844041e707ac9ad9acad2188a90bffce2c770e6dc2318be0c9916aef1469"}, - {file = "pydantic_core-2.16.2-cp39-none-win_amd64.whl", hash = "sha256:9da90d393a8227d717c19f5397688a38635afec89f2e2d7af0df037f3249c39a"}, - {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:5f60f920691a620b03082692c378661947d09415743e437a7478c309eb0e4f82"}, - {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:47924039e785a04d4a4fa49455e51b4eb3422d6eaacfde9fc9abf8fdef164e8a"}, - {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e6294e76b0380bb7a61eb8a39273c40b20beb35e8c87ee101062834ced19c545"}, - {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fe56851c3f1d6f5384b3051c536cc81b3a93a73faf931f404fef95217cf1e10d"}, - {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9d776d30cde7e541b8180103c3f294ef7c1862fd45d81738d156d00551005784"}, - {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:72f7919af5de5ecfaf1eba47bf9a5d8aa089a3340277276e5636d16ee97614d7"}, - {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:4bfcbde6e06c56b30668a0c872d75a7ef3025dc3c1823a13cf29a0e9b33f67e8"}, - {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:ff7c97eb7a29aba230389a2661edf2e9e06ce616c7e35aa764879b6894a44b25"}, - {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:9b5f13857da99325dcabe1cc4e9e6a3d7b2e2c726248ba5dd4be3e8e4a0b6d0e"}, - {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:a7e41e3ada4cca5f22b478c08e973c930e5e6c7ba3588fb8e35f2398cdcc1545"}, - {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:60eb8ceaa40a41540b9acae6ae7c1f0a67d233c40dc4359c256ad2ad85bdf5e5"}, - {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7beec26729d496a12fd23cf8da9944ee338c8b8a17035a560b585c36fe81af20"}, - {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:22c5f022799f3cd6741e24f0443ead92ef42be93ffda0d29b2597208c94c3753"}, - {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:eca58e319f4fd6df004762419612122b2c7e7d95ffafc37e890252f869f3fb2a"}, - {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:ed957db4c33bc99895f3a1672eca7e80e8cda8bd1e29a80536b4ec2153fa9804"}, - {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:459c0d338cc55d099798618f714b21b7ece17eb1a87879f2da20a3ff4c7628e2"}, - {file = "pydantic_core-2.16.2.tar.gz", hash = "sha256:0ba503850d8b8dcc18391f10de896ae51d37fe5fe43dbfb6a35c5c5cad271a06"}, + {file = "pydantic_core-2.23.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:b10bd51f823d891193d4717448fab065733958bdb6a6b351967bd349d48d5c9b"}, + {file = "pydantic_core-2.23.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:4fc714bdbfb534f94034efaa6eadd74e5b93c8fa6315565a222f7b6f42ca1166"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63e46b3169866bd62849936de036f901a9356e36376079b05efa83caeaa02ceb"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ed1a53de42fbe34853ba90513cea21673481cd81ed1be739f7f2efb931b24916"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cfdd16ab5e59fc31b5e906d1a3f666571abc367598e3e02c83403acabc092e07"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:255a8ef062cbf6674450e668482456abac99a5583bbafb73f9ad469540a3a232"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a7cd62e831afe623fbb7aabbb4fe583212115b3ef38a9f6b71869ba644624a2"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f09e2ff1f17c2b51f2bc76d1cc33da96298f0a036a137f5440ab3ec5360b624f"}, + {file = "pydantic_core-2.23.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e38e63e6f3d1cec5a27e0afe90a085af8b6806ee208b33030e65b6516353f1a3"}, + {file = "pydantic_core-2.23.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0dbd8dbed2085ed23b5c04afa29d8fd2771674223135dc9bc937f3c09284d071"}, + {file = "pydantic_core-2.23.4-cp310-none-win32.whl", hash = "sha256:6531b7ca5f951d663c339002e91aaebda765ec7d61b7d1e3991051906ddde119"}, + {file = "pydantic_core-2.23.4-cp310-none-win_amd64.whl", hash = "sha256:7c9129eb40958b3d4500fa2467e6a83356b3b61bfff1b414c7361d9220f9ae8f"}, + {file = "pydantic_core-2.23.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:77733e3892bb0a7fa797826361ce8a9184d25c8dffaec60b7ffe928153680ba8"}, + {file = "pydantic_core-2.23.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1b84d168f6c48fabd1f2027a3d1bdfe62f92cade1fb273a5d68e621da0e44e6d"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df49e7a0861a8c36d089c1ed57d308623d60416dab2647a4a17fe050ba85de0e"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ff02b6d461a6de369f07ec15e465a88895f3223eb75073ffea56b84d9331f607"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:996a38a83508c54c78a5f41456b0103c30508fed9abcad0a59b876d7398f25fd"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d97683ddee4723ae8c95d1eddac7c192e8c552da0c73a925a89fa8649bf13eea"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:216f9b2d7713eb98cb83c80b9c794de1f6b7e3145eef40400c62e86cee5f4e1e"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6f783e0ec4803c787bcea93e13e9932edab72068f68ecffdf86a99fd5918878b"}, + {file = "pydantic_core-2.23.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:d0776dea117cf5272382634bd2a5c1b6eb16767c223c6a5317cd3e2a757c61a0"}, + {file = "pydantic_core-2.23.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d5f7a395a8cf1621939692dba2a6b6a830efa6b3cee787d82c7de1ad2930de64"}, + {file = "pydantic_core-2.23.4-cp311-none-win32.whl", hash = "sha256:74b9127ffea03643e998e0c5ad9bd3811d3dac8c676e47db17b0ee7c3c3bf35f"}, + {file = "pydantic_core-2.23.4-cp311-none-win_amd64.whl", hash = "sha256:98d134c954828488b153d88ba1f34e14259284f256180ce659e8d83e9c05eaa3"}, + {file = "pydantic_core-2.23.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:f3e0da4ebaef65158d4dfd7d3678aad692f7666877df0002b8a522cdf088f231"}, + {file = "pydantic_core-2.23.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f69a8e0b033b747bb3e36a44e7732f0c99f7edd5cea723d45bc0d6e95377ffee"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:723314c1d51722ab28bfcd5240d858512ffd3116449c557a1336cbe3919beb87"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bb2802e667b7051a1bebbfe93684841cc9351004e2badbd6411bf357ab8d5ac8"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d18ca8148bebe1b0a382a27a8ee60350091a6ddaf475fa05ef50dc35b5df6327"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:33e3d65a85a2a4a0dc3b092b938a4062b1a05f3a9abde65ea93b233bca0e03f2"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:128585782e5bfa515c590ccee4b727fb76925dd04a98864182b22e89a4e6ed36"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:68665f4c17edcceecc112dfed5dbe6f92261fb9d6054b47d01bf6371a6196126"}, + {file = "pydantic_core-2.23.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:20152074317d9bed6b7a95ade3b7d6054845d70584216160860425f4fbd5ee9e"}, + {file = "pydantic_core-2.23.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:9261d3ce84fa1d38ed649c3638feefeae23d32ba9182963e465d58d62203bd24"}, + {file = "pydantic_core-2.23.4-cp312-none-win32.whl", hash = "sha256:4ba762ed58e8d68657fc1281e9bb72e1c3e79cc5d464be146e260c541ec12d84"}, + {file = "pydantic_core-2.23.4-cp312-none-win_amd64.whl", hash = "sha256:97df63000f4fea395b2824da80e169731088656d1818a11b95f3b173747b6cd9"}, + {file = "pydantic_core-2.23.4-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:7530e201d10d7d14abce4fb54cfe5b94a0aefc87da539d0346a484ead376c3cc"}, + {file = "pydantic_core-2.23.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:df933278128ea1cd77772673c73954e53a1c95a4fdf41eef97c2b779271bd0bd"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0cb3da3fd1b6a5d0279a01877713dbda118a2a4fc6f0d821a57da2e464793f05"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:42c6dcb030aefb668a2b7009c85b27f90e51e6a3b4d5c9bc4c57631292015b0d"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:696dd8d674d6ce621ab9d45b205df149399e4bb9aa34102c970b721554828510"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2971bb5ffe72cc0f555c13e19b23c85b654dd2a8f7ab493c262071377bfce9f6"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8394d940e5d400d04cad4f75c0598665cbb81aecefaca82ca85bd28264af7f9b"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:0dff76e0602ca7d4cdaacc1ac4c005e0ce0dcfe095d5b5259163a80d3a10d327"}, + {file = "pydantic_core-2.23.4-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:7d32706badfe136888bdea71c0def994644e09fff0bfe47441deaed8e96fdbc6"}, + {file = "pydantic_core-2.23.4-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:ed541d70698978a20eb63d8c5d72f2cc6d7079d9d90f6b50bad07826f1320f5f"}, + {file = "pydantic_core-2.23.4-cp313-none-win32.whl", hash = "sha256:3d5639516376dce1940ea36edf408c554475369f5da2abd45d44621cb616f769"}, + {file = "pydantic_core-2.23.4-cp313-none-win_amd64.whl", hash = "sha256:5a1504ad17ba4210df3a045132a7baeeba5a200e930f57512ee02909fc5c4cb5"}, + {file = "pydantic_core-2.23.4-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:d4488a93b071c04dc20f5cecc3631fc78b9789dd72483ba15d423b5b3689b555"}, + {file = "pydantic_core-2.23.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:81965a16b675b35e1d09dd14df53f190f9129c0202356ed44ab2728b1c905658"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4ffa2ebd4c8530079140dd2d7f794a9d9a73cbb8e9d59ffe24c63436efa8f271"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:61817945f2fe7d166e75fbfb28004034b48e44878177fc54d81688e7b85a3665"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:29d2c342c4bc01b88402d60189f3df065fb0dda3654744d5a165a5288a657368"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5e11661ce0fd30a6790e8bcdf263b9ec5988e95e63cf901972107efc49218b13"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d18368b137c6295db49ce7218b1a9ba15c5bc254c96d7c9f9e924a9bc7825ad"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ec4e55f79b1c4ffb2eecd8a0cfba9955a2588497d96851f4c8f99aa4a1d39b12"}, + {file = "pydantic_core-2.23.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:374a5e5049eda9e0a44c696c7ade3ff355f06b1fe0bb945ea3cac2bc336478a2"}, + {file = "pydantic_core-2.23.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5c364564d17da23db1106787675fc7af45f2f7b58b4173bfdd105564e132e6fb"}, + {file = "pydantic_core-2.23.4-cp38-none-win32.whl", hash = "sha256:d7a80d21d613eec45e3d41eb22f8f94ddc758a6c4720842dc74c0581f54993d6"}, + {file = "pydantic_core-2.23.4-cp38-none-win_amd64.whl", hash = "sha256:5f5ff8d839f4566a474a969508fe1c5e59c31c80d9e140566f9a37bba7b8d556"}, + {file = "pydantic_core-2.23.4-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:a4fa4fc04dff799089689f4fd502ce7d59de529fc2f40a2c8836886c03e0175a"}, + {file = "pydantic_core-2.23.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0a7df63886be5e270da67e0966cf4afbae86069501d35c8c1b3b6c168f42cb36"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dcedcd19a557e182628afa1d553c3895a9f825b936415d0dbd3cd0bbcfd29b4b"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f54b118ce5de9ac21c363d9b3caa6c800341e8c47a508787e5868c6b79c9323"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86d2f57d3e1379a9525c5ab067b27dbb8a0642fb5d454e17a9ac434f9ce523e3"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:de6d1d1b9e5101508cb37ab0d972357cac5235f5c6533d1071964c47139257df"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1278e0d324f6908e872730c9102b0112477a7f7cf88b308e4fc36ce1bdb6d58c"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9a6b5099eeec78827553827f4c6b8615978bb4b6a88e5d9b93eddf8bb6790f55"}, + {file = "pydantic_core-2.23.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:e55541f756f9b3ee346b840103f32779c695a19826a4c442b7954550a0972040"}, + {file = "pydantic_core-2.23.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a5c7ba8ffb6d6f8f2ab08743be203654bb1aaa8c9dcb09f82ddd34eadb695605"}, + {file = "pydantic_core-2.23.4-cp39-none-win32.whl", hash = "sha256:37b0fe330e4a58d3c58b24d91d1eb102aeec675a3db4c292ec3928ecd892a9a6"}, + {file = "pydantic_core-2.23.4-cp39-none-win_amd64.whl", hash = "sha256:1498bec4c05c9c787bde9125cfdcc63a41004ff167f495063191b863399b1a29"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:f455ee30a9d61d3e1a15abd5068827773d6e4dc513e795f380cdd59932c782d5"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1e90d2e3bd2c3863d48525d297cd143fe541be8bbf6f579504b9712cb6b643ec"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2e203fdf807ac7e12ab59ca2bfcabb38c7cf0b33c41efeb00f8e5da1d86af480"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e08277a400de01bc72436a0ccd02bdf596631411f592ad985dcee21445bd0068"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f220b0eea5965dec25480b6333c788fb72ce5f9129e8759ef876a1d805d00801"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:d06b0c8da4f16d1d1e352134427cb194a0a6e19ad5db9161bf32b2113409e728"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:ba1a0996f6c2773bd83e63f18914c1de3c9dd26d55f4ac302a7efe93fb8e7433"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:9a5bce9d23aac8f0cf0836ecfc033896aa8443b501c58d0602dbfd5bd5b37753"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:78ddaaa81421a29574a682b3179d4cf9e6d405a09b99d93ddcf7e5239c742e21"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:883a91b5dd7d26492ff2f04f40fbb652de40fcc0afe07e8129e8ae779c2110eb"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:88ad334a15b32a791ea935af224b9de1bf99bcd62fabf745d5f3442199d86d59"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:233710f069d251feb12a56da21e14cca67994eab08362207785cf8c598e74577"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:19442362866a753485ba5e4be408964644dd6a09123d9416c54cd49171f50744"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:624e278a7d29b6445e4e813af92af37820fafb6dcc55c012c834f9e26f9aaaef"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f5ef8f42bec47f21d07668a043f077d507e5bf4e668d5c6dfe6aaba89de1a5b8"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:aea443fffa9fbe3af1a9ba721a87f926fe548d32cab71d188a6ede77d0ff244e"}, + {file = "pydantic_core-2.23.4.tar.gz", hash = "sha256:2584f7cf844ac4d970fba483a717dbe10c1c1c96a969bf65d61ffe94df1b2863"}, ] [package.dependencies] @@ -638,13 +637,13 @@ typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" [[package]] name = "pyparsing" -version = "3.1.1" +version = "3.1.4" description = "pyparsing module - Classes and methods to define and execute parsing grammars" optional = false python-versions = ">=3.6.8" files = [ - {file = "pyparsing-3.1.1-py3-none-any.whl", hash = "sha256:32c7c0b711493c72ff18a981d24f28aaf9c1fb7ed5e9667c9e84e3db623bdbfb"}, - {file = "pyparsing-3.1.1.tar.gz", hash = "sha256:ede28a1a32462f5a9705e07aea48001a08f7cf81a021585011deba701581a0db"}, + {file = "pyparsing-3.1.4-py3-none-any.whl", hash = "sha256:a6a7ee4235a3f944aa1fa2249307708f893fe5717dc603503c6c7969c070fb7c"}, + {file = "pyparsing-3.1.4.tar.gz", hash = "sha256:f86ec8d1a83f11977c9a6ea7598e8c27fc5cddfa5b07ea2241edbbde1d7bc032"}, ] [package.extras] @@ -652,13 +651,13 @@ diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pytest" -version = "8.0.1" +version = "8.3.3" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-8.0.1-py3-none-any.whl", hash = "sha256:3e4f16fe1c0a9dc9d9389161c127c3edc5d810c38d6793042fb81d9f48a59fca"}, - {file = "pytest-8.0.1.tar.gz", hash = "sha256:267f6563751877d772019b13aacbe4e860d73fe8f651f28112e9ac37de7513ae"}, + {file = "pytest-8.3.3-py3-none-any.whl", hash = "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2"}, + {file = "pytest-8.3.3.tar.gz", hash = "sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181"}, ] [package.dependencies] @@ -666,11 +665,11 @@ colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = "*" -pluggy = ">=1.3.0,<2.0" -tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} +pluggy = ">=1.5,<2" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} [package.extras] -testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "pytest-logging" @@ -701,73 +700,75 @@ sortedcontainers = "*" [[package]] name = "pyyaml" -version = "6.0.1" +version = "6.0.2" description = "YAML parser and emitter for Python" optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" files = [ - {file = "PyYAML-6.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a"}, - {file = "PyYAML-6.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fd66fc5d0da6d9815ba2cebeb4205f95818ff4b79c3ebe268e75d961704af52f"}, - {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, - {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, - {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, - {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, - {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, - {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, - {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, - {file = "PyYAML-6.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f003ed9ad21d6a4713f0a9b5a7a0a79e08dd0f221aff4525a2be4c346ee60aab"}, - {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, - {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, - {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, - {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, - {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, - {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, - {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, - {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, - {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, - {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, - {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, - {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, - {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, - {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, - {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:afd7e57eddb1a54f0f1a974bc4391af8bcce0b444685d936840f125cf046d5bd"}, - {file = "PyYAML-6.0.1-cp36-cp36m-win32.whl", hash = "sha256:fca0e3a251908a499833aa292323f32437106001d436eca0e6e7833256674585"}, - {file = "PyYAML-6.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:f22ac1c3cac4dbc50079e965eba2c1058622631e526bd9afd45fedd49ba781fa"}, - {file = "PyYAML-6.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b1275ad35a5d18c62a7220633c913e1b42d44b46ee12554e5fd39c70a243d6a3"}, - {file = "PyYAML-6.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:18aeb1bf9a78867dc38b259769503436b7c72f7a1f1f4c93ff9a17de54319b27"}, - {file = "PyYAML-6.0.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:596106435fa6ad000c2991a98fa58eeb8656ef2325d7e158344fb33864ed87e3"}, - {file = "PyYAML-6.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:baa90d3f661d43131ca170712d903e6295d1f7a0f595074f151c0aed377c9b9c"}, - {file = "PyYAML-6.0.1-cp37-cp37m-win32.whl", hash = "sha256:9046c58c4395dff28dd494285c82ba00b546adfc7ef001486fbf0324bc174fba"}, - {file = "PyYAML-6.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:4fb147e7a67ef577a588a0e2c17b6db51dda102c71de36f8549b6816a96e1867"}, - {file = "PyYAML-6.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1d4c7e777c441b20e32f52bd377e0c409713e8bb1386e1099c2415f26e479595"}, - {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, - {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, - {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, - {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, - {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, - {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, - {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, - {file = "PyYAML-6.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c8098ddcc2a85b61647b2590f825f3db38891662cfc2fc776415143f599bb859"}, - {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, - {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, - {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, - {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, - {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, - {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, - {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, + {file = "PyYAML-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0a9a2848a5b7feac301353437eb7d5957887edbf81d56e903999a75a3d743086"}, + {file = "PyYAML-6.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:29717114e51c84ddfba879543fb232a6ed60086602313ca38cce623c1d62cfbf"}, + {file = "PyYAML-6.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8824b5a04a04a047e72eea5cec3bc266db09e35de6bdfe34c9436ac5ee27d237"}, + {file = "PyYAML-6.0.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7c36280e6fb8385e520936c3cb3b8042851904eba0e58d277dca80a5cfed590b"}, + {file = "PyYAML-6.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ec031d5d2feb36d1d1a24380e4db6d43695f3748343d99434e6f5f9156aaa2ed"}, + {file = "PyYAML-6.0.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:936d68689298c36b53b29f23c6dbb74de12b4ac12ca6cfe0e047bedceea56180"}, + {file = "PyYAML-6.0.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:23502f431948090f597378482b4812b0caae32c22213aecf3b55325e049a6c68"}, + {file = "PyYAML-6.0.2-cp310-cp310-win32.whl", hash = "sha256:2e99c6826ffa974fe6e27cdb5ed0021786b03fc98e5ee3c5bfe1fd5015f42b99"}, + {file = "PyYAML-6.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:a4d3091415f010369ae4ed1fc6b79def9416358877534caf6a0fdd2146c87a3e"}, + {file = "PyYAML-6.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cc1c1159b3d456576af7a3e4d1ba7e6924cb39de8f67111c735f6fc832082774"}, + {file = "PyYAML-6.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1e2120ef853f59c7419231f3bf4e7021f1b936f6ebd222406c3b60212205d2ee"}, + {file = "PyYAML-6.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5d225db5a45f21e78dd9358e58a98702a0302f2659a3c6cd320564b75b86f47c"}, + {file = "PyYAML-6.0.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5ac9328ec4831237bec75defaf839f7d4564be1e6b25ac710bd1a96321cc8317"}, + {file = "PyYAML-6.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ad2a3decf9aaba3d29c8f537ac4b243e36bef957511b4766cb0057d32b0be85"}, + {file = "PyYAML-6.0.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:ff3824dc5261f50c9b0dfb3be22b4567a6f938ccce4587b38952d85fd9e9afe4"}, + {file = "PyYAML-6.0.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:797b4f722ffa07cc8d62053e4cff1486fa6dc094105d13fea7b1de7d8bf71c9e"}, + {file = "PyYAML-6.0.2-cp311-cp311-win32.whl", hash = "sha256:11d8f3dd2b9c1207dcaf2ee0bbbfd5991f571186ec9cc78427ba5bd32afae4b5"}, + {file = "PyYAML-6.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:e10ce637b18caea04431ce14fabcf5c64a1c61ec9c56b071a4b7ca131ca52d44"}, + {file = "PyYAML-6.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:c70c95198c015b85feafc136515252a261a84561b7b1d51e3384e0655ddf25ab"}, + {file = "PyYAML-6.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ce826d6ef20b1bc864f0a68340c8b3287705cae2f8b4b1d932177dcc76721725"}, + {file = "PyYAML-6.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f71ea527786de97d1a0cc0eacd1defc0985dcf6b3f17bb77dcfc8c34bec4dc5"}, + {file = "PyYAML-6.0.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9b22676e8097e9e22e36d6b7bda33190d0d400f345f23d4065d48f4ca7ae0425"}, + {file = "PyYAML-6.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:80bab7bfc629882493af4aa31a4cfa43a4c57c83813253626916b8c7ada83476"}, + {file = "PyYAML-6.0.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:0833f8694549e586547b576dcfaba4a6b55b9e96098b36cdc7ebefe667dfed48"}, + {file = "PyYAML-6.0.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8b9c7197f7cb2738065c481a0461e50ad02f18c78cd75775628afb4d7137fb3b"}, + {file = "PyYAML-6.0.2-cp312-cp312-win32.whl", hash = "sha256:ef6107725bd54b262d6dedcc2af448a266975032bc85ef0172c5f059da6325b4"}, + {file = "PyYAML-6.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:7e7401d0de89a9a855c839bc697c079a4af81cf878373abd7dc625847d25cbd8"}, + {file = "PyYAML-6.0.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:efdca5630322a10774e8e98e1af481aad470dd62c3170801852d752aa7a783ba"}, + {file = "PyYAML-6.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:50187695423ffe49e2deacb8cd10510bc361faac997de9efef88badc3bb9e2d1"}, + {file = "PyYAML-6.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0ffe8360bab4910ef1b9e87fb812d8bc0a308b0d0eef8c8f44e0254ab3b07133"}, + {file = "PyYAML-6.0.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:17e311b6c678207928d649faa7cb0d7b4c26a0ba73d41e99c4fff6b6c3276484"}, + {file = "PyYAML-6.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70b189594dbe54f75ab3a1acec5f1e3faa7e8cf2f1e08d9b561cb41b845f69d5"}, + {file = "PyYAML-6.0.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:41e4e3953a79407c794916fa277a82531dd93aad34e29c2a514c2c0c5fe971cc"}, + {file = "PyYAML-6.0.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:68ccc6023a3400877818152ad9a1033e3db8625d899c72eacb5a668902e4d652"}, + {file = "PyYAML-6.0.2-cp313-cp313-win32.whl", hash = "sha256:bc2fa7c6b47d6bc618dd7fb02ef6fdedb1090ec036abab80d4681424b84c1183"}, + {file = "PyYAML-6.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:8388ee1976c416731879ac16da0aff3f63b286ffdd57cdeb95f3f2e085687563"}, + {file = "PyYAML-6.0.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:24471b829b3bf607e04e88d79542a9d48bb037c2267d7927a874e6c205ca7e9a"}, + {file = "PyYAML-6.0.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7fded462629cfa4b685c5416b949ebad6cec74af5e2d42905d41e257e0869f5"}, + {file = "PyYAML-6.0.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d84a1718ee396f54f3a086ea0a66d8e552b2ab2017ef8b420e92edbc841c352d"}, + {file = "PyYAML-6.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9056c1ecd25795207ad294bcf39f2db3d845767be0ea6e6a34d856f006006083"}, + {file = "PyYAML-6.0.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:82d09873e40955485746739bcb8b4586983670466c23382c19cffecbf1fd8706"}, + {file = "PyYAML-6.0.2-cp38-cp38-win32.whl", hash = "sha256:43fa96a3ca0d6b1812e01ced1044a003533c47f6ee8aca31724f78e93ccc089a"}, + {file = "PyYAML-6.0.2-cp38-cp38-win_amd64.whl", hash = "sha256:01179a4a8559ab5de078078f37e5c1a30d76bb88519906844fd7bdea1b7729ff"}, + {file = "PyYAML-6.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:688ba32a1cffef67fd2e9398a2efebaea461578b0923624778664cc1c914db5d"}, + {file = "PyYAML-6.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a8786accb172bd8afb8be14490a16625cbc387036876ab6ba70912730faf8e1f"}, + {file = "PyYAML-6.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d8e03406cac8513435335dbab54c0d385e4a49e4945d2909a581c83647ca0290"}, + {file = "PyYAML-6.0.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f753120cb8181e736c57ef7636e83f31b9c0d1722c516f7e86cf15b7aa57ff12"}, + {file = "PyYAML-6.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3b1fdb9dc17f5a7677423d508ab4f243a726dea51fa5e70992e59a7411c89d19"}, + {file = "PyYAML-6.0.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:0b69e4ce7a131fe56b7e4d770c67429700908fc0752af059838b1cfb41960e4e"}, + {file = "PyYAML-6.0.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a9f8c2e67970f13b16084e04f134610fd1d374bf477b17ec1599185cf611d725"}, + {file = "PyYAML-6.0.2-cp39-cp39-win32.whl", hash = "sha256:6395c297d42274772abc367baaa79683958044e5d3835486c16da75d2a694631"}, + {file = "PyYAML-6.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:39693e1f8320ae4f43943590b49779ffb98acb81f788220ea932a6b6c51004d8"}, + {file = "pyyaml-6.0.2.tar.gz", hash = "sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e"}, ] [[package]] name = "rdflib" -version = "6.3.2" +version = "7.0.0" description = "RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information." optional = false -python-versions = ">=3.7,<4.0" +python-versions = ">=3.8.1,<4.0.0" files = [ - {file = "rdflib-6.3.2-py3-none-any.whl", hash = "sha256:36b4e74a32aa1e4fa7b8719876fb192f19ecd45ff932ea5ebbd2e417a0247e63"}, - {file = "rdflib-6.3.2.tar.gz", hash = "sha256:72af591ff704f4caacea7ecc0c5a9056b8553e0489dd4f35a9bc52dbd41522e0"}, + {file = "rdflib-7.0.0-py3-none-any.whl", hash = "sha256:0438920912a642c866a513de6fe8a0001bd86ef975057d6962c79ce4771687cd"}, + {file = "rdflib-7.0.0.tar.gz", hash = "sha256:9995eb8569428059b8c1affd26b25eac510d64f5043d9ce8c84e0d0036e995ae"}, ] [package.dependencies] @@ -782,13 +783,13 @@ networkx = ["networkx (>=2.0.0,<3.0.0)"] [[package]] name = "referencing" -version = "0.33.0" +version = "0.35.1" description = "JSON Referencing + Python" optional = false python-versions = ">=3.8" files = [ - {file = "referencing-0.33.0-py3-none-any.whl", hash = "sha256:39240f2ecc770258f28b642dd47fd74bc8b02484de54e1882b74b35ebd779bd5"}, - {file = "referencing-0.33.0.tar.gz", hash = "sha256:c775fedf74bc0f9189c2a3be1c12fd03e8c23f4d371dce795df44e06c5b412f7"}, + {file = "referencing-0.35.1-py3-none-any.whl", hash = "sha256:eda6d3234d62814d1c64e305c1331c9a3a6132da475ab6382eaa997b21ee75de"}, + {file = "referencing-0.35.1.tar.gz", hash = "sha256:25b42124a6c8b632a425174f24087783efb348a6f1e0008e63cd4466fedf703c"}, ] [package.dependencies] @@ -797,13 +798,13 @@ rpds-py = ">=0.7.0" [[package]] name = "requests" -version = "2.31.0" +version = "2.32.3" description = "Python HTTP for Humans." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, - {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, + {file = "requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"}, + {file = "requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"}, ] [package.dependencies] @@ -818,13 +819,13 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "requests-cache" -version = "1.2.0" +version = "1.2.1" description = "A persistent cache for python requests" optional = false python-versions = ">=3.8" files = [ - {file = "requests_cache-1.2.0-py3-none-any.whl", hash = "sha256:490324301bf0cb924ff4e6324bd2613453e7e1f847353928b08adb0fdfb7f722"}, - {file = "requests_cache-1.2.0.tar.gz", hash = "sha256:db1c709ca343cc1cd5b6c8b1a5387298eceed02306a6040760db538c885e3838"}, + {file = "requests_cache-1.2.1-py3-none-any.whl", hash = "sha256:1285151cddf5331067baa82598afe2d47c7495a1334bfe7a7d329b43e9fd3603"}, + {file = "requests_cache-1.2.1.tar.gz", hash = "sha256:68abc986fdc5b8d0911318fbb5f7c80eebcd4d01bfacc6685ecf8876052511d1"}, ] [package.dependencies] @@ -848,110 +849,114 @@ yaml = ["pyyaml (>=6.0.1)"] [[package]] name = "rpds-py" -version = "0.18.0" +version = "0.20.0" description = "Python bindings to Rust's persistent data structures (rpds)" optional = false python-versions = ">=3.8" files = [ - {file = "rpds_py-0.18.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:5b4e7d8d6c9b2e8ee2d55c90b59c707ca59bc30058269b3db7b1f8df5763557e"}, - {file = "rpds_py-0.18.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c463ed05f9dfb9baebef68048aed8dcdc94411e4bf3d33a39ba97e271624f8f7"}, - {file = "rpds_py-0.18.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:01e36a39af54a30f28b73096dd39b6802eddd04c90dbe161c1b8dbe22353189f"}, - {file = "rpds_py-0.18.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d62dec4976954a23d7f91f2f4530852b0c7608116c257833922a896101336c51"}, - {file = "rpds_py-0.18.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:dd18772815d5f008fa03d2b9a681ae38d5ae9f0e599f7dda233c439fcaa00d40"}, - {file = "rpds_py-0.18.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:923d39efa3cfb7279a0327e337a7958bff00cc447fd07a25cddb0a1cc9a6d2da"}, - {file = "rpds_py-0.18.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:39514da80f971362f9267c600b6d459bfbbc549cffc2cef8e47474fddc9b45b1"}, - {file = "rpds_py-0.18.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a34d557a42aa28bd5c48a023c570219ba2593bcbbb8dc1b98d8cf5d529ab1434"}, - {file = "rpds_py-0.18.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:93df1de2f7f7239dc9cc5a4a12408ee1598725036bd2dedadc14d94525192fc3"}, - {file = "rpds_py-0.18.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:34b18ba135c687f4dac449aa5157d36e2cbb7c03cbea4ddbd88604e076aa836e"}, - {file = "rpds_py-0.18.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c0b5dcf9193625afd8ecc92312d6ed78781c46ecbf39af9ad4681fc9f464af88"}, - {file = "rpds_py-0.18.0-cp310-none-win32.whl", hash = "sha256:c4325ff0442a12113a6379af66978c3fe562f846763287ef66bdc1d57925d337"}, - {file = "rpds_py-0.18.0-cp310-none-win_amd64.whl", hash = "sha256:7223a2a5fe0d217e60a60cdae28d6949140dde9c3bcc714063c5b463065e3d66"}, - {file = "rpds_py-0.18.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:3a96e0c6a41dcdba3a0a581bbf6c44bb863f27c541547fb4b9711fd8cf0ffad4"}, - {file = "rpds_py-0.18.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:30f43887bbae0d49113cbaab729a112251a940e9b274536613097ab8b4899cf6"}, - {file = "rpds_py-0.18.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fcb25daa9219b4cf3a0ab24b0eb9a5cc8949ed4dc72acb8fa16b7e1681aa3c58"}, - {file = "rpds_py-0.18.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d68c93e381010662ab873fea609bf6c0f428b6d0bb00f2c6939782e0818d37bf"}, - {file = "rpds_py-0.18.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b34b7aa8b261c1dbf7720b5d6f01f38243e9b9daf7e6b8bc1fd4657000062f2c"}, - {file = "rpds_py-0.18.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2e6d75ab12b0bbab7215e5d40f1e5b738aa539598db27ef83b2ec46747df90e1"}, - {file = "rpds_py-0.18.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0b8612cd233543a3781bc659c731b9d607de65890085098986dfd573fc2befe5"}, - {file = "rpds_py-0.18.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:aec493917dd45e3c69d00a8874e7cbed844efd935595ef78a0f25f14312e33c6"}, - {file = "rpds_py-0.18.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:661d25cbffaf8cc42e971dd570d87cb29a665f49f4abe1f9e76be9a5182c4688"}, - {file = "rpds_py-0.18.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:1df3659d26f539ac74fb3b0c481cdf9d725386e3552c6fa2974f4d33d78e544b"}, - {file = "rpds_py-0.18.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:a1ce3ba137ed54f83e56fb983a5859a27d43a40188ba798993812fed73c70836"}, - {file = "rpds_py-0.18.0-cp311-none-win32.whl", hash = "sha256:69e64831e22a6b377772e7fb337533c365085b31619005802a79242fee620bc1"}, - {file = "rpds_py-0.18.0-cp311-none-win_amd64.whl", hash = "sha256:998e33ad22dc7ec7e030b3df701c43630b5bc0d8fbc2267653577e3fec279afa"}, - {file = "rpds_py-0.18.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:7f2facbd386dd60cbbf1a794181e6aa0bd429bd78bfdf775436020172e2a23f0"}, - {file = "rpds_py-0.18.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1d9a5be316c15ffb2b3c405c4ff14448c36b4435be062a7f578ccd8b01f0c4d8"}, - {file = "rpds_py-0.18.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cd5bf1af8efe569654bbef5a3e0a56eca45f87cfcffab31dd8dde70da5982475"}, - {file = "rpds_py-0.18.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5417558f6887e9b6b65b4527232553c139b57ec42c64570569b155262ac0754f"}, - {file = "rpds_py-0.18.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:56a737287efecafc16f6d067c2ea0117abadcd078d58721f967952db329a3e5c"}, - {file = "rpds_py-0.18.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8f03bccbd8586e9dd37219bce4d4e0d3ab492e6b3b533e973fa08a112cb2ffc9"}, - {file = "rpds_py-0.18.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4457a94da0d5c53dc4b3e4de1158bdab077db23c53232f37a3cb7afdb053a4e3"}, - {file = "rpds_py-0.18.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:0ab39c1ba9023914297dd88ec3b3b3c3f33671baeb6acf82ad7ce883f6e8e157"}, - {file = "rpds_py-0.18.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:9d54553c1136b50fd12cc17e5b11ad07374c316df307e4cfd6441bea5fb68496"}, - {file = "rpds_py-0.18.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:0af039631b6de0397ab2ba16eaf2872e9f8fca391b44d3d8cac317860a700a3f"}, - {file = "rpds_py-0.18.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:84ffab12db93b5f6bad84c712c92060a2d321b35c3c9960b43d08d0f639d60d7"}, - {file = "rpds_py-0.18.0-cp312-none-win32.whl", hash = "sha256:685537e07897f173abcf67258bee3c05c374fa6fff89d4c7e42fb391b0605e98"}, - {file = "rpds_py-0.18.0-cp312-none-win_amd64.whl", hash = "sha256:e003b002ec72c8d5a3e3da2989c7d6065b47d9eaa70cd8808b5384fbb970f4ec"}, - {file = "rpds_py-0.18.0-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:08f9ad53c3f31dfb4baa00da22f1e862900f45908383c062c27628754af2e88e"}, - {file = "rpds_py-0.18.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:c0013fe6b46aa496a6749c77e00a3eb07952832ad6166bd481c74bda0dcb6d58"}, - {file = "rpds_py-0.18.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e32a92116d4f2a80b629778280103d2a510a5b3f6314ceccd6e38006b5e92dcb"}, - {file = "rpds_py-0.18.0-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e541ec6f2ec456934fd279a3120f856cd0aedd209fc3852eca563f81738f6861"}, - {file = "rpds_py-0.18.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:bed88b9a458e354014d662d47e7a5baafd7ff81c780fd91584a10d6ec842cb73"}, - {file = "rpds_py-0.18.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2644e47de560eb7bd55c20fc59f6daa04682655c58d08185a9b95c1970fa1e07"}, - {file = "rpds_py-0.18.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8e8916ae4c720529e18afa0b879473049e95949bf97042e938530e072fde061d"}, - {file = "rpds_py-0.18.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:465a3eb5659338cf2a9243e50ad9b2296fa15061736d6e26240e713522b6235c"}, - {file = "rpds_py-0.18.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:ea7d4a99f3b38c37eac212dbd6ec42b7a5ec51e2c74b5d3223e43c811609e65f"}, - {file = "rpds_py-0.18.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:67071a6171e92b6da534b8ae326505f7c18022c6f19072a81dcf40db2638767c"}, - {file = "rpds_py-0.18.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:41ef53e7c58aa4ef281da975f62c258950f54b76ec8e45941e93a3d1d8580594"}, - {file = "rpds_py-0.18.0-cp38-none-win32.whl", hash = "sha256:fdea4952db2793c4ad0bdccd27c1d8fdd1423a92f04598bc39425bcc2b8ee46e"}, - {file = "rpds_py-0.18.0-cp38-none-win_amd64.whl", hash = "sha256:7cd863afe7336c62ec78d7d1349a2f34c007a3cc6c2369d667c65aeec412a5b1"}, - {file = "rpds_py-0.18.0-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:5307def11a35f5ae4581a0b658b0af8178c65c530e94893345bebf41cc139d33"}, - {file = "rpds_py-0.18.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:77f195baa60a54ef9d2de16fbbfd3ff8b04edc0c0140a761b56c267ac11aa467"}, - {file = "rpds_py-0.18.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:39f5441553f1c2aed4de4377178ad8ff8f9d733723d6c66d983d75341de265ab"}, - {file = "rpds_py-0.18.0-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9a00312dea9310d4cb7dbd7787e722d2e86a95c2db92fbd7d0155f97127bcb40"}, - {file = "rpds_py-0.18.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8f2fc11e8fe034ee3c34d316d0ad8808f45bc3b9ce5857ff29d513f3ff2923a1"}, - {file = "rpds_py-0.18.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:586f8204935b9ec884500498ccc91aa869fc652c40c093bd9e1471fbcc25c022"}, - {file = "rpds_py-0.18.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ddc2f4dfd396c7bfa18e6ce371cba60e4cf9d2e5cdb71376aa2da264605b60b9"}, - {file = "rpds_py-0.18.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5ddcba87675b6d509139d1b521e0c8250e967e63b5909a7e8f8944d0f90ff36f"}, - {file = "rpds_py-0.18.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:7bd339195d84439cbe5771546fe8a4e8a7a045417d8f9de9a368c434e42a721e"}, - {file = "rpds_py-0.18.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:d7c36232a90d4755b720fbd76739d8891732b18cf240a9c645d75f00639a9024"}, - {file = "rpds_py-0.18.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:6b0817e34942b2ca527b0e9298373e7cc75f429e8da2055607f4931fded23e20"}, - {file = "rpds_py-0.18.0-cp39-none-win32.whl", hash = "sha256:99f70b740dc04d09e6b2699b675874367885217a2e9f782bdf5395632ac663b7"}, - {file = "rpds_py-0.18.0-cp39-none-win_amd64.whl", hash = "sha256:6ef687afab047554a2d366e112dd187b62d261d49eb79b77e386f94644363294"}, - {file = "rpds_py-0.18.0-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:ad36cfb355e24f1bd37cac88c112cd7730873f20fb0bdaf8ba59eedf8216079f"}, - {file = "rpds_py-0.18.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:36b3ee798c58ace201289024b52788161e1ea133e4ac93fba7d49da5fec0ef9e"}, - {file = "rpds_py-0.18.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f8a2f084546cc59ea99fda8e070be2fd140c3092dc11524a71aa8f0f3d5a55ca"}, - {file = "rpds_py-0.18.0-pp310-pypy310_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e4461d0f003a0aa9be2bdd1b798a041f177189c1a0f7619fe8c95ad08d9a45d7"}, - {file = "rpds_py-0.18.0-pp310-pypy310_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8db715ebe3bb7d86d77ac1826f7d67ec11a70dbd2376b7cc214199360517b641"}, - {file = "rpds_py-0.18.0-pp310-pypy310_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:793968759cd0d96cac1e367afd70c235867831983f876a53389ad869b043c948"}, - {file = "rpds_py-0.18.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:66e6a3af5a75363d2c9a48b07cb27c4ea542938b1a2e93b15a503cdfa8490795"}, - {file = "rpds_py-0.18.0-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6ef0befbb5d79cf32d0266f5cff01545602344eda89480e1dd88aca964260b18"}, - {file = "rpds_py-0.18.0-pp310-pypy310_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:1d4acf42190d449d5e89654d5c1ed3a4f17925eec71f05e2a41414689cda02d1"}, - {file = "rpds_py-0.18.0-pp310-pypy310_pp73-musllinux_1_2_i686.whl", hash = "sha256:a5f446dd5055667aabaee78487f2b5ab72e244f9bc0b2ffebfeec79051679984"}, - {file = "rpds_py-0.18.0-pp310-pypy310_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:9dbbeb27f4e70bfd9eec1be5477517365afe05a9b2c441a0b21929ee61048124"}, - {file = "rpds_py-0.18.0-pp38-pypy38_pp73-macosx_10_12_x86_64.whl", hash = "sha256:22806714311a69fd0af9b35b7be97c18a0fc2826e6827dbb3a8c94eac6cf7eeb"}, - {file = "rpds_py-0.18.0-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:b34ae4636dfc4e76a438ab826a0d1eed2589ca7d9a1b2d5bb546978ac6485461"}, - {file = "rpds_py-0.18.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8c8370641f1a7f0e0669ddccca22f1da893cef7628396431eb445d46d893e5cd"}, - {file = "rpds_py-0.18.0-pp38-pypy38_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c8362467a0fdeccd47935f22c256bec5e6abe543bf0d66e3d3d57a8fb5731863"}, - {file = "rpds_py-0.18.0-pp38-pypy38_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:11a8c85ef4a07a7638180bf04fe189d12757c696eb41f310d2426895356dcf05"}, - {file = "rpds_py-0.18.0-pp38-pypy38_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b316144e85316da2723f9d8dc75bada12fa58489a527091fa1d5a612643d1a0e"}, - {file = "rpds_py-0.18.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cf1ea2e34868f6fbf070e1af291c8180480310173de0b0c43fc38a02929fc0e3"}, - {file = "rpds_py-0.18.0-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e546e768d08ad55b20b11dbb78a745151acbd938f8f00d0cfbabe8b0199b9880"}, - {file = "rpds_py-0.18.0-pp38-pypy38_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:4901165d170a5fde6f589acb90a6b33629ad1ec976d4529e769c6f3d885e3e80"}, - {file = "rpds_py-0.18.0-pp38-pypy38_pp73-musllinux_1_2_i686.whl", hash = "sha256:618a3d6cae6ef8ec88bb76dd80b83cfe415ad4f1d942ca2a903bf6b6ff97a2da"}, - {file = "rpds_py-0.18.0-pp38-pypy38_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:ed4eb745efbff0a8e9587d22a84be94a5eb7d2d99c02dacf7bd0911713ed14dd"}, - {file = "rpds_py-0.18.0-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:6c81e5f372cd0dc5dc4809553d34f832f60a46034a5f187756d9b90586c2c307"}, - {file = "rpds_py-0.18.0-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:43fbac5f22e25bee1d482c97474f930a353542855f05c1161fd804c9dc74a09d"}, - {file = "rpds_py-0.18.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6d7faa6f14017c0b1e69f5e2c357b998731ea75a442ab3841c0dbbbfe902d2c4"}, - {file = "rpds_py-0.18.0-pp39-pypy39_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:08231ac30a842bd04daabc4d71fddd7e6d26189406d5a69535638e4dcb88fe76"}, - {file = "rpds_py-0.18.0-pp39-pypy39_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:044a3e61a7c2dafacae99d1e722cc2d4c05280790ec5a05031b3876809d89a5c"}, - {file = "rpds_py-0.18.0-pp39-pypy39_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3f26b5bd1079acdb0c7a5645e350fe54d16b17bfc5e71f371c449383d3342e17"}, - {file = "rpds_py-0.18.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:482103aed1dfe2f3b71a58eff35ba105289b8d862551ea576bd15479aba01f66"}, - {file = "rpds_py-0.18.0-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1374f4129f9bcca53a1bba0bb86bf78325a0374577cf7e9e4cd046b1e6f20e24"}, - {file = "rpds_py-0.18.0-pp39-pypy39_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:635dc434ff724b178cb192c70016cc0ad25a275228f749ee0daf0eddbc8183b1"}, - {file = "rpds_py-0.18.0-pp39-pypy39_pp73-musllinux_1_2_i686.whl", hash = "sha256:bc362ee4e314870a70f4ae88772d72d877246537d9f8cb8f7eacf10884862432"}, - {file = "rpds_py-0.18.0-pp39-pypy39_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:4832d7d380477521a8c1644bbab6588dfedea5e30a7d967b5fb75977c45fd77f"}, - {file = "rpds_py-0.18.0.tar.gz", hash = "sha256:42821446ee7a76f5d9f71f9e33a4fb2ffd724bb3e7f93386150b61a43115788d"}, + {file = "rpds_py-0.20.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:3ad0fda1635f8439cde85c700f964b23ed5fc2d28016b32b9ee5fe30da5c84e2"}, + {file = "rpds_py-0.20.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9bb4a0d90fdb03437c109a17eade42dfbf6190408f29b2744114d11586611d6f"}, + {file = "rpds_py-0.20.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c6377e647bbfd0a0b159fe557f2c6c602c159fc752fa316572f012fc0bf67150"}, + {file = "rpds_py-0.20.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eb851b7df9dda52dc1415ebee12362047ce771fc36914586b2e9fcbd7d293b3e"}, + {file = "rpds_py-0.20.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1e0f80b739e5a8f54837be5d5c924483996b603d5502bfff79bf33da06164ee2"}, + {file = "rpds_py-0.20.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5a8c94dad2e45324fc74dce25e1645d4d14df9a4e54a30fa0ae8bad9a63928e3"}, + {file = "rpds_py-0.20.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f8e604fe73ba048c06085beaf51147eaec7df856824bfe7b98657cf436623daf"}, + {file = "rpds_py-0.20.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:df3de6b7726b52966edf29663e57306b23ef775faf0ac01a3e9f4012a24a4140"}, + {file = "rpds_py-0.20.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:cf258ede5bc22a45c8e726b29835b9303c285ab46fc7c3a4cc770736b5304c9f"}, + {file = "rpds_py-0.20.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:55fea87029cded5df854ca7e192ec7bdb7ecd1d9a3f63d5c4eb09148acf4a7ce"}, + {file = "rpds_py-0.20.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:ae94bd0b2f02c28e199e9bc51485d0c5601f58780636185660f86bf80c89af94"}, + {file = "rpds_py-0.20.0-cp310-none-win32.whl", hash = "sha256:28527c685f237c05445efec62426d285e47a58fb05ba0090a4340b73ecda6dee"}, + {file = "rpds_py-0.20.0-cp310-none-win_amd64.whl", hash = "sha256:238a2d5b1cad28cdc6ed15faf93a998336eb041c4e440dd7f902528b8891b399"}, + {file = "rpds_py-0.20.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:ac2f4f7a98934c2ed6505aead07b979e6f999389f16b714448fb39bbaa86a489"}, + {file = "rpds_py-0.20.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:220002c1b846db9afd83371d08d239fdc865e8f8c5795bbaec20916a76db3318"}, + {file = "rpds_py-0.20.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8d7919548df3f25374a1f5d01fbcd38dacab338ef5f33e044744b5c36729c8db"}, + {file = "rpds_py-0.20.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:758406267907b3781beee0f0edfe4a179fbd97c0be2e9b1154d7f0a1279cf8e5"}, + {file = "rpds_py-0.20.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3d61339e9f84a3f0767b1995adfb171a0d00a1185192718a17af6e124728e0f5"}, + {file = "rpds_py-0.20.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1259c7b3705ac0a0bd38197565a5d603218591d3f6cee6e614e380b6ba61c6f6"}, + {file = "rpds_py-0.20.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5c1dc0f53856b9cc9a0ccca0a7cc61d3d20a7088201c0937f3f4048c1718a209"}, + {file = "rpds_py-0.20.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:7e60cb630f674a31f0368ed32b2a6b4331b8350d67de53c0359992444b116dd3"}, + {file = "rpds_py-0.20.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:dbe982f38565bb50cb7fb061ebf762c2f254ca3d8c20d4006878766e84266272"}, + {file = "rpds_py-0.20.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:514b3293b64187172bc77c8fb0cdae26981618021053b30d8371c3a902d4d5ad"}, + {file = "rpds_py-0.20.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:d0a26ffe9d4dd35e4dfdd1e71f46401cff0181c75ac174711ccff0459135fa58"}, + {file = "rpds_py-0.20.0-cp311-none-win32.whl", hash = "sha256:89c19a494bf3ad08c1da49445cc5d13d8fefc265f48ee7e7556839acdacf69d0"}, + {file = "rpds_py-0.20.0-cp311-none-win_amd64.whl", hash = "sha256:c638144ce971df84650d3ed0096e2ae7af8e62ecbbb7b201c8935c370df00a2c"}, + {file = "rpds_py-0.20.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:a84ab91cbe7aab97f7446652d0ed37d35b68a465aeef8fc41932a9d7eee2c1a6"}, + {file = "rpds_py-0.20.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:56e27147a5a4c2c21633ff8475d185734c0e4befd1c989b5b95a5d0db699b21b"}, + {file = "rpds_py-0.20.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2580b0c34583b85efec8c5c5ec9edf2dfe817330cc882ee972ae650e7b5ef739"}, + {file = "rpds_py-0.20.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b80d4a7900cf6b66bb9cee5c352b2d708e29e5a37fe9bf784fa97fc11504bf6c"}, + {file = "rpds_py-0.20.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:50eccbf054e62a7b2209b28dc7a22d6254860209d6753e6b78cfaeb0075d7bee"}, + {file = "rpds_py-0.20.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:49a8063ea4296b3a7e81a5dfb8f7b2d73f0b1c20c2af401fb0cdf22e14711a96"}, + {file = "rpds_py-0.20.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ea438162a9fcbee3ecf36c23e6c68237479f89f962f82dae83dc15feeceb37e4"}, + {file = "rpds_py-0.20.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:18d7585c463087bddcfa74c2ba267339f14f2515158ac4db30b1f9cbdb62c8ef"}, + {file = "rpds_py-0.20.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:d4c7d1a051eeb39f5c9547e82ea27cbcc28338482242e3e0b7768033cb083821"}, + {file = "rpds_py-0.20.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:e4df1e3b3bec320790f699890d41c59d250f6beda159ea3c44c3f5bac1976940"}, + {file = "rpds_py-0.20.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:2cf126d33a91ee6eedc7f3197b53e87a2acdac63602c0f03a02dd69e4b138174"}, + {file = "rpds_py-0.20.0-cp312-none-win32.whl", hash = "sha256:8bc7690f7caee50b04a79bf017a8d020c1f48c2a1077ffe172abec59870f1139"}, + {file = "rpds_py-0.20.0-cp312-none-win_amd64.whl", hash = "sha256:0e13e6952ef264c40587d510ad676a988df19adea20444c2b295e536457bc585"}, + {file = "rpds_py-0.20.0-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:aa9a0521aeca7d4941499a73ad7d4f8ffa3d1affc50b9ea11d992cd7eff18a29"}, + {file = "rpds_py-0.20.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:4a1f1d51eccb7e6c32ae89243cb352389228ea62f89cd80823ea7dd1b98e0b91"}, + {file = "rpds_py-0.20.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8a86a9b96070674fc88b6f9f71a97d2c1d3e5165574615d1f9168ecba4cecb24"}, + {file = "rpds_py-0.20.0-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:6c8ef2ebf76df43f5750b46851ed1cdf8f109d7787ca40035fe19fbdc1acc5a7"}, + {file = "rpds_py-0.20.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b74b25f024b421d5859d156750ea9a65651793d51b76a2e9238c05c9d5f203a9"}, + {file = "rpds_py-0.20.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:57eb94a8c16ab08fef6404301c38318e2c5a32216bf5de453e2714c964c125c8"}, + {file = "rpds_py-0.20.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e1940dae14e715e2e02dfd5b0f64a52e8374a517a1e531ad9412319dc3ac7879"}, + {file = "rpds_py-0.20.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d20277fd62e1b992a50c43f13fbe13277a31f8c9f70d59759c88f644d66c619f"}, + {file = "rpds_py-0.20.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:06db23d43f26478303e954c34c75182356ca9aa7797d22c5345b16871ab9c45c"}, + {file = "rpds_py-0.20.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:b2a5db5397d82fa847e4c624b0c98fe59d2d9b7cf0ce6de09e4d2e80f8f5b3f2"}, + {file = "rpds_py-0.20.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5a35df9f5548fd79cb2f52d27182108c3e6641a4feb0f39067911bf2adaa3e57"}, + {file = "rpds_py-0.20.0-cp313-none-win32.whl", hash = "sha256:fd2d84f40633bc475ef2d5490b9c19543fbf18596dcb1b291e3a12ea5d722f7a"}, + {file = "rpds_py-0.20.0-cp313-none-win_amd64.whl", hash = "sha256:9bc2d153989e3216b0559251b0c260cfd168ec78b1fac33dd485750a228db5a2"}, + {file = "rpds_py-0.20.0-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:f2fbf7db2012d4876fb0d66b5b9ba6591197b0f165db8d99371d976546472a24"}, + {file = "rpds_py-0.20.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:1e5f3cd7397c8f86c8cc72d5a791071431c108edd79872cdd96e00abd8497d29"}, + {file = "rpds_py-0.20.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ce9845054c13696f7af7f2b353e6b4f676dab1b4b215d7fe5e05c6f8bb06f965"}, + {file = "rpds_py-0.20.0-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c3e130fd0ec56cb76eb49ef52faead8ff09d13f4527e9b0c400307ff72b408e1"}, + {file = "rpds_py-0.20.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4b16aa0107ecb512b568244ef461f27697164d9a68d8b35090e9b0c1c8b27752"}, + {file = "rpds_py-0.20.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aa7f429242aae2947246587d2964fad750b79e8c233a2367f71b554e9447949c"}, + {file = "rpds_py-0.20.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:af0fc424a5842a11e28956e69395fbbeab2c97c42253169d87e90aac2886d751"}, + {file = "rpds_py-0.20.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b8c00a3b1e70c1d3891f0db1b05292747f0dbcfb49c43f9244d04c70fbc40eb8"}, + {file = "rpds_py-0.20.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:40ce74fc86ee4645d0a225498d091d8bc61f39b709ebef8204cb8b5a464d3c0e"}, + {file = "rpds_py-0.20.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:4fe84294c7019456e56d93e8ababdad5a329cd25975be749c3f5f558abb48253"}, + {file = "rpds_py-0.20.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:338ca4539aad4ce70a656e5187a3a31c5204f261aef9f6ab50e50bcdffaf050a"}, + {file = "rpds_py-0.20.0-cp38-none-win32.whl", hash = "sha256:54b43a2b07db18314669092bb2de584524d1ef414588780261e31e85846c26a5"}, + {file = "rpds_py-0.20.0-cp38-none-win_amd64.whl", hash = "sha256:a1862d2d7ce1674cffa6d186d53ca95c6e17ed2b06b3f4c476173565c862d232"}, + {file = "rpds_py-0.20.0-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:3fde368e9140312b6e8b6c09fb9f8c8c2f00999d1823403ae90cc00480221b22"}, + {file = "rpds_py-0.20.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9824fb430c9cf9af743cf7aaf6707bf14323fb51ee74425c380f4c846ea70789"}, + {file = "rpds_py-0.20.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:11ef6ce74616342888b69878d45e9f779b95d4bd48b382a229fe624a409b72c5"}, + {file = "rpds_py-0.20.0-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c52d3f2f82b763a24ef52f5d24358553e8403ce05f893b5347098014f2d9eff2"}, + {file = "rpds_py-0.20.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9d35cef91e59ebbeaa45214861874bc6f19eb35de96db73e467a8358d701a96c"}, + {file = "rpds_py-0.20.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d72278a30111e5b5525c1dd96120d9e958464316f55adb030433ea905866f4de"}, + {file = "rpds_py-0.20.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b4c29cbbba378759ac5786730d1c3cb4ec6f8ababf5c42a9ce303dc4b3d08cda"}, + {file = "rpds_py-0.20.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6632f2d04f15d1bd6fe0eedd3b86d9061b836ddca4c03d5cf5c7e9e6b7c14580"}, + {file = "rpds_py-0.20.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:d0b67d87bb45ed1cd020e8fbf2307d449b68abc45402fe1a4ac9e46c3c8b192b"}, + {file = "rpds_py-0.20.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:ec31a99ca63bf3cd7f1a5ac9fe95c5e2d060d3c768a09bc1d16e235840861420"}, + {file = "rpds_py-0.20.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:22e6c9976e38f4d8c4a63bd8a8edac5307dffd3ee7e6026d97f3cc3a2dc02a0b"}, + {file = "rpds_py-0.20.0-cp39-none-win32.whl", hash = "sha256:569b3ea770c2717b730b61998b6c54996adee3cef69fc28d444f3e7920313cf7"}, + {file = "rpds_py-0.20.0-cp39-none-win_amd64.whl", hash = "sha256:e6900ecdd50ce0facf703f7a00df12374b74bbc8ad9fe0f6559947fb20f82364"}, + {file = "rpds_py-0.20.0-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:617c7357272c67696fd052811e352ac54ed1d9b49ab370261a80d3b6ce385045"}, + {file = "rpds_py-0.20.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:9426133526f69fcaba6e42146b4e12d6bc6c839b8b555097020e2b78ce908dcc"}, + {file = "rpds_py-0.20.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:deb62214c42a261cb3eb04d474f7155279c1a8a8c30ac89b7dcb1721d92c3c02"}, + {file = "rpds_py-0.20.0-pp310-pypy310_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fcaeb7b57f1a1e071ebd748984359fef83ecb026325b9d4ca847c95bc7311c92"}, + {file = "rpds_py-0.20.0-pp310-pypy310_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d454b8749b4bd70dd0a79f428731ee263fa6995f83ccb8bada706e8d1d3ff89d"}, + {file = "rpds_py-0.20.0-pp310-pypy310_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d807dc2051abe041b6649681dce568f8e10668e3c1c6543ebae58f2d7e617855"}, + {file = "rpds_py-0.20.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c3c20f0ddeb6e29126d45f89206b8291352b8c5b44384e78a6499d68b52ae511"}, + {file = "rpds_py-0.20.0-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b7f19250ceef892adf27f0399b9e5afad019288e9be756d6919cb58892129f51"}, + {file = "rpds_py-0.20.0-pp310-pypy310_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:4f1ed4749a08379555cebf4650453f14452eaa9c43d0a95c49db50c18b7da075"}, + {file = "rpds_py-0.20.0-pp310-pypy310_pp73-musllinux_1_2_i686.whl", hash = "sha256:dcedf0b42bcb4cfff4101d7771a10532415a6106062f005ab97d1d0ab5681c60"}, + {file = "rpds_py-0.20.0-pp310-pypy310_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:39ed0d010457a78f54090fafb5d108501b5aa5604cc22408fc1c0c77eac14344"}, + {file = "rpds_py-0.20.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:bb273176be34a746bdac0b0d7e4e2c467323d13640b736c4c477881a3220a989"}, + {file = "rpds_py-0.20.0-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:f918a1a130a6dfe1d7fe0f105064141342e7dd1611f2e6a21cd2f5c8cb1cfb3e"}, + {file = "rpds_py-0.20.0-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:f60012a73aa396be721558caa3a6fd49b3dd0033d1675c6d59c4502e870fcf0c"}, + {file = "rpds_py-0.20.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3d2b1ad682a3dfda2a4e8ad8572f3100f95fad98cb99faf37ff0ddfe9cbf9d03"}, + {file = "rpds_py-0.20.0-pp39-pypy39_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:614fdafe9f5f19c63ea02817fa4861c606a59a604a77c8cdef5aa01d28b97921"}, + {file = "rpds_py-0.20.0-pp39-pypy39_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fa518bcd7600c584bf42e6617ee8132869e877db2f76bcdc281ec6a4113a53ab"}, + {file = "rpds_py-0.20.0-pp39-pypy39_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f0475242f447cc6cb8a9dd486d68b2ef7fbee84427124c232bff5f63b1fe11e5"}, + {file = "rpds_py-0.20.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f90a4cd061914a60bd51c68bcb4357086991bd0bb93d8aa66a6da7701370708f"}, + {file = "rpds_py-0.20.0-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:def7400461c3a3f26e49078302e1c1b38f6752342c77e3cf72ce91ca69fb1bc1"}, + {file = "rpds_py-0.20.0-pp39-pypy39_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:65794e4048ee837494aea3c21a28ad5fc080994dfba5b036cf84de37f7ad5074"}, + {file = "rpds_py-0.20.0-pp39-pypy39_pp73-musllinux_1_2_i686.whl", hash = "sha256:faefcc78f53a88f3076b7f8be0a8f8d35133a3ecf7f3770895c25f8813460f08"}, + {file = "rpds_py-0.20.0-pp39-pypy39_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:5b4f105deeffa28bbcdff6c49b34e74903139afa690e35d2d9e3c2c2fba18cec"}, + {file = "rpds_py-0.20.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:fdfc3a892927458d98f3d55428ae46b921d1f7543b89382fdb483f5640daaec8"}, + {file = "rpds_py-0.20.0.tar.gz", hash = "sha256:d72a210824facfdaf8768cf2d7ca25a042c30320b3020de2fa04640920d4e121"}, ] [[package]] @@ -978,24 +983,24 @@ files = [ [[package]] name = "tomli" -version = "2.0.1" +version = "2.0.2" description = "A lil' TOML parser" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, - {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, + {file = "tomli-2.0.2-py3-none-any.whl", hash = "sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38"}, + {file = "tomli-2.0.2.tar.gz", hash = "sha256:d46d457a85337051c36524bc5349dd91b1877838e2979ac5ced3e710ed8a60ed"}, ] [[package]] name = "typing-extensions" -version = "4.9.0" +version = "4.12.2" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.9.0-py3-none-any.whl", hash = "sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd"}, - {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"}, + {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, + {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, ] [[package]] @@ -1014,13 +1019,13 @@ six = "*" [[package]] name = "urllib3" -version = "2.2.1" +version = "2.2.3" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.8" files = [ - {file = "urllib3-2.2.1-py3-none-any.whl", hash = "sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d"}, - {file = "urllib3-2.2.1.tar.gz", hash = "sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19"}, + {file = "urllib3-2.2.3-py3-none-any.whl", hash = "sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac"}, + {file = "urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"}, ] [package.extras] @@ -1108,22 +1113,7 @@ files = [ {file = "wrapt-1.16.0.tar.gz", hash = "sha256:5f370f952971e7d17c7d1ead40e49f32345a7f7a5373571ef44d800d06b1899d"}, ] -[[package]] -name = "zipp" -version = "3.17.0" -description = "Backport of pathlib-compatible object wrapper for zip files" -optional = false -python-versions = ">=3.8" -files = [ - {file = "zipp-3.17.0-py3-none-any.whl", hash = "sha256:0e923e726174922dce09c53c59ad483ff7bbb8e572e00c7f7c46b88556409f31"}, - {file = "zipp-3.17.0.tar.gz", hash = "sha256:84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0"}, -] - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy (>=0.9.1)", "pytest-ruff"] - [metadata] lock-version = "2.0" -python-versions = "^3.8" -content-hash = "fddd54f2e38fdce32a4236c283d5f4e141f897e6d7ed4aac4ce5dbb40c37e428" +python-versions = "^3.9" +content-hash = "1b1e8101fbf36d25f1b0e8396baae3198edeb413eed82b5dda8da492264375c5" diff --git a/pyproject.toml b/pyproject.toml index b50cba65..0bc7cbe2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ comparefiles = "linkml_runtime.utils.comparefiles:cli" linkml-normalize = "linkml_runtime.processing.referencevalidator:cli" [tool.poetry.dependencies] -python = "^3.8" +python = "^3.9" click = "*" deprecated = "*" hbreader = "*" @@ -62,6 +62,14 @@ prefixmaps = ">=0.1.4" curies = ">=0.5.4" pydantic = ">=1.10.2, <3.0.0" +[tool.ruff] +line-length = 120 +select = [ + "F401", + "UP" +] +target-version = "py39" + [tool.poetry.dev-dependencies] coverage = "^6.2" requests-cache = "^1.2.0" diff --git a/tests/support/clicktestcase.py b/tests/support/clicktestcase.py index fe14b62d..a35a35dc 100644 --- a/tests/support/clicktestcase.py +++ b/tests/support/clicktestcase.py @@ -1,7 +1,7 @@ import os import shlex import unittest -from typing import Union, List, Optional, Callable +from typing import Union, Optional, Callable from warnings import warn from tests.support.dirutils import make_and_clear_directory @@ -86,7 +86,7 @@ def closein_comparison(expected_txt: str, actual_txt: str) -> None: print(nw[offset:offset+view+view]) def do_test(self, - args: Union[str, List[str]], + args: Union[str, list[str]], testFileOrDirectory: Optional[str] = None, *, expected_error: type(Exception) = None, diff --git a/tests/support/dirutils.py b/tests/support/dirutils.py index 26865bce..7b68f256 100644 --- a/tests/support/dirutils.py +++ b/tests/support/dirutils.py @@ -14,7 +14,7 @@ def make_and_clear_directory(dirbase: str) -> None: safety_file = os.path.join(dirbase, "generated") if os.path.exists(dirbase): if not os.path.exists(safety_file): - raise FileNotFoundError("'generated' guard file not found in {}".format(safety_file)) + raise FileNotFoundError(f"'generated' guard file not found in {safety_file}") shutil.rmtree(dirbase) os.makedirs(dirbase) with open(os.path.join(dirbase, "generated"), "w") as f: diff --git a/tests/support/mismatchlog.py b/tests/support/mismatchlog.py index 0523c161..c51fb47d 100644 --- a/tests/support/mismatchlog.py +++ b/tests/support/mismatchlog.py @@ -1,7 +1,6 @@ import os import sys -from dataclasses import dataclass -from typing import Optional, List +from typing import Optional base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) @@ -44,7 +43,7 @@ def __str__(self): return '\n'.join(rval) + '\n' def __init__(self) -> None: - self.entries: List[MismatchLog.MismatchLogEntry] = list() + self.entries: list[MismatchLog.MismatchLogEntry] = list() def log(self, file_or_directory: str, message: Optional[str] = None) -> None: self.entries.append(MismatchLog.MismatchLogEntry(file_or_directory, message)) diff --git a/tests/support/test_environment.py b/tests/support/test_environment.py index e04e4eac..8bebdbac 100644 --- a/tests/support/test_environment.py +++ b/tests/support/test_environment.py @@ -9,7 +9,7 @@ from importlib import import_module from io import StringIO from pathlib import Path -from typing import Optional, Callable, Union, List +from typing import Optional, Callable, Union from tests.support.dirutils import are_dir_trees_equal from tests.support.mismatchlog import MismatchLog @@ -159,14 +159,14 @@ def make_testing_directory(directory: str, clear: bool = False) -> None: with open(safety_file, "w") as f: f.write("Generated for safety. Directory will not be cleared if this file is not present") - def generate_directory(self, dirname: Union[str, List[str]], generator: Callable[[str], None]) -> None: + def generate_directory(self, dirname: Union[str, list[str]], generator: Callable[[str], None]) -> None: """ Invoke the generator and compare the output in a temp directory to the output directory. Report the results and then update the output directory :param dirname: relative directory name (e.g. gengolr/meta) :param generator: function to create the output. First argument is the target directory """ - dirname = dirname if isinstance(dirname, List) else [dirname] + dirname = dirname if isinstance(dirname, list) else [dirname] temp_output_directory = self.make_temp_dir(*dirname) expected_output_directory = self.expected_path(*dirname) self.make_testing_directory(expected_output_directory) @@ -182,7 +182,7 @@ def generate_directory(self, dirname: Union[str, List[str]], generator: Callable else: shutil.rmtree(temp_output_directory) - def generate_single_file(self, filename: Union[str, List[str]], generator: Callable[[Optional[str]], Optional[str]], + def generate_single_file(self, filename: Union[str, list[str]], generator: Callable[[Optional[str]], Optional[str]], value_is_returned: bool = False, filtr: Callable[[str], str] = None, comparator: Callable[[str, str], str] = None, use_testing_root: bool = False) -> str: """ @@ -198,7 +198,7 @@ def generate_single_file(self, filename: Union[str, List[str]], generator: Calla # If no filter, default to identity function if not filtr: filtr = lambda s: s - filename = filename if isinstance(filename, List) else [filename] + filename = filename if isinstance(filename, list) else [filename] actual_file = self.root_temp_file_path(*filename) if use_testing_root else self.actual_path(*filename) expected_file = self.root_expected_path(*filename) if use_testing_root else self.expected_path(*filename) diff --git a/tests/test_index/model/container_test.py b/tests/test_index/model/container_test.py index 23d1f84a..1dc73f10 100644 --- a/tests/test_index/model/container_test.py +++ b/tests/test_index/model/container_test.py @@ -7,22 +7,19 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from jsonasobj2 import as_dict +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_list, empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.linkml_model.types import Boolean, Date, Float, Integer, String from linkml_runtime.utils.metamodelcore import Bool, XSDDate metamodel_version = "1.7.0" @@ -85,7 +82,7 @@ class NamedThing(YAMLRoot): """ A generic grouping for any identifiable entity """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.NamedThing class_class_curie: ClassVar[str] = "personinfo:NamedThing" @@ -97,7 +94,7 @@ class NamedThing(YAMLRoot): description: Optional[str] = None image: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, NamedThingId): @@ -120,7 +117,7 @@ class Person(NamedThing): """ A person (alive, dead, undead, or fictional). """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCHEMA.Person class_class_curie: ClassVar[str] = "schema:Person" @@ -133,12 +130,12 @@ class Person(NamedThing): age_in_years: Optional[int] = None gender: Optional[Union[str, "GenderType"]] = None current_address: Optional[Union[dict, "Address"]] = None - has_employment_history: Optional[Union[Union[dict, "EmploymentEvent"], List[Union[dict, "EmploymentEvent"]]]] = empty_list() - has_familial_relationships: Optional[Union[Union[dict, "FamilialRelationship"], List[Union[dict, "FamilialRelationship"]]]] = empty_list() - has_medical_history: Optional[Union[Union[dict, "MedicalEvent"], List[Union[dict, "MedicalEvent"]]]] = empty_list() - aliases: Optional[Union[str, List[str]]] = empty_list() + has_employment_history: Optional[Union[Union[dict, "EmploymentEvent"], list[Union[dict, "EmploymentEvent"]]]] = empty_list() + has_familial_relationships: Optional[Union[Union[dict, "FamilialRelationship"], list[Union[dict, "FamilialRelationship"]]]] = empty_list() + has_medical_history: Optional[Union[Union[dict, "MedicalEvent"], list[Union[dict, "MedicalEvent"]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, PersonId): @@ -183,16 +180,16 @@ class HasAliases(YAMLRoot): """ A mixin applied to any class that can have aliases/alternateNames """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.HasAliases class_class_curie: ClassVar[str] = "personinfo:HasAliases" class_name: ClassVar[str] = "HasAliases" class_model_uri: ClassVar[URIRef] = PERSONINFO.HasAliases - aliases: Optional[Union[str, List[str]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] @@ -205,7 +202,7 @@ class Organization(NamedThing): """ An organization such as a company or university """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCHEMA.Organization class_class_curie: ClassVar[str] = "schema:Organization" @@ -216,9 +213,9 @@ class Organization(NamedThing): mission_statement: Optional[str] = None founding_date: Optional[str] = None founding_location: Optional[Union[str, PlaceId]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, OrganizationId): @@ -242,7 +239,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Place(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Place class_class_curie: ClassVar[str] = "personinfo:Place" @@ -251,9 +248,9 @@ class Place(YAMLRoot): id: Union[str, PlaceId] = None name: Optional[str] = None - aliases: Optional[Union[str, List[str]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, PlaceId): @@ -271,7 +268,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Address(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCHEMA.PostalAddress class_class_curie: ClassVar[str] = "schema:PostalAddress" @@ -282,7 +279,7 @@ class Address(YAMLRoot): city: Optional[str] = None postal_code: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.street is not None and not isinstance(self.street, str): self.street = str(self.street) @@ -297,7 +294,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Event(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Event class_class_curie: ClassVar[str] = "personinfo:Event" @@ -309,7 +306,7 @@ class Event(YAMLRoot): duration: Optional[float] = None is_current: Optional[Union[bool, Bool]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.started_at_time is not None and not isinstance(self.started_at_time, XSDDate): self.started_at_time = XSDDate(self.started_at_time) @@ -327,7 +324,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Concept(NamedThing): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Concept class_class_curie: ClassVar[str] = "personinfo:Concept" @@ -336,7 +333,7 @@ class Concept(NamedThing): id: Union[str, ConceptId] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, ConceptId): @@ -347,7 +344,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class DiagnosisConcept(Concept): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.DiagnosisConcept class_class_curie: ClassVar[str] = "personinfo:DiagnosisConcept" @@ -356,7 +353,7 @@ class DiagnosisConcept(Concept): id: Union[str, DiagnosisConceptId] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, DiagnosisConceptId): @@ -367,7 +364,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class ProcedureConcept(Concept): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.ProcedureConcept class_class_curie: ClassVar[str] = "personinfo:ProcedureConcept" @@ -376,7 +373,7 @@ class ProcedureConcept(Concept): id: Union[str, ProcedureConceptId] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, ProcedureConceptId): @@ -387,7 +384,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Relationship(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Relationship class_class_curie: ClassVar[str] = "personinfo:Relationship" @@ -398,7 +395,7 @@ class Relationship(YAMLRoot): ended_at_time: Optional[Union[str, XSDDate]] = None related_to: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.started_at_time is not None and not isinstance(self.started_at_time, XSDDate): self.started_at_time = XSDDate(self.started_at_time) @@ -413,7 +410,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class FamilialRelationship(Relationship): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.FamilialRelationship class_class_curie: ClassVar[str] = "personinfo:FamilialRelationship" @@ -423,7 +420,7 @@ class FamilialRelationship(Relationship): type: Union[str, "FamilialRelationshipType"] = None related_to: Union[str, PersonId] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.type): self.MissingRequiredField("type") if not isinstance(self.type, FamilialRelationshipType): @@ -439,7 +436,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class EmploymentEvent(Event): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.EmploymentEvent class_class_curie: ClassVar[str] = "personinfo:EmploymentEvent" @@ -449,7 +446,7 @@ class EmploymentEvent(Event): employed_at: Optional[Union[str, OrganizationId]] = None type: Optional[Union[str, "RelationshipType"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.employed_at is not None and not isinstance(self.employed_at, OrganizationId): self.employed_at = OrganizationId(self.employed_at) @@ -461,7 +458,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class MedicalEvent(Event): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.MedicalEvent class_class_curie: ClassVar[str] = "personinfo:MedicalEvent" @@ -473,7 +470,7 @@ class MedicalEvent(Event): procedure: Optional[Union[dict, ProcedureConcept]] = None type: Optional[Union[str, "RelationshipType"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.in_location is not None and not isinstance(self.in_location, PlaceId): self.in_location = PlaceId(self.in_location) @@ -491,7 +488,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class WithLocation(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.WithLocation class_class_curie: ClassVar[str] = "personinfo:WithLocation" @@ -500,7 +497,7 @@ class WithLocation(YAMLRoot): in_location: Optional[Union[str, PlaceId]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.in_location is not None and not isinstance(self.in_location, PlaceId): self.in_location = PlaceId(self.in_location) @@ -509,17 +506,17 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Container(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Container class_class_curie: ClassVar[str] = "personinfo:Container" class_name: ClassVar[str] = "Container" class_model_uri: ClassVar[URIRef] = PERSONINFO.Container - persons: Optional[Union[Dict[Union[str, PersonId], Union[dict, Person]], List[Union[dict, Person]]]] = empty_dict() - organizations: Optional[Union[Dict[Union[str, OrganizationId], Union[dict, Organization]], List[Union[dict, Organization]]]] = empty_dict() + persons: Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]] = empty_dict() + organizations: Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_list(slot_name="persons", slot_type=Person, key_name="id", keyed=True) self._normalize_inlined_as_list(slot_name="organizations", slot_type=Organization, key_name="id", keyed=True) @@ -614,13 +611,13 @@ class slots: model_uri=PERSONINFO.is_current, domain=None, range=Optional[Union[bool, Bool]]) slots.has_employment_history = Slot(uri=PERSONINFO.has_employment_history, name="has_employment_history", curie=PERSONINFO.curie('has_employment_history'), - model_uri=PERSONINFO.has_employment_history, domain=None, range=Optional[Union[Union[dict, EmploymentEvent], List[Union[dict, EmploymentEvent]]]]) + model_uri=PERSONINFO.has_employment_history, domain=None, range=Optional[Union[Union[dict, EmploymentEvent], list[Union[dict, EmploymentEvent]]]]) slots.has_medical_history = Slot(uri=PERSONINFO.has_medical_history, name="has_medical_history", curie=PERSONINFO.curie('has_medical_history'), - model_uri=PERSONINFO.has_medical_history, domain=None, range=Optional[Union[Union[dict, MedicalEvent], List[Union[dict, MedicalEvent]]]]) + model_uri=PERSONINFO.has_medical_history, domain=None, range=Optional[Union[Union[dict, MedicalEvent], list[Union[dict, MedicalEvent]]]]) slots.has_familial_relationships = Slot(uri=PERSONINFO.has_familial_relationships, name="has_familial_relationships", curie=PERSONINFO.curie('has_familial_relationships'), - model_uri=PERSONINFO.has_familial_relationships, domain=None, range=Optional[Union[Union[dict, FamilialRelationship], List[Union[dict, FamilialRelationship]]]]) + model_uri=PERSONINFO.has_familial_relationships, domain=None, range=Optional[Union[Union[dict, FamilialRelationship], list[Union[dict, FamilialRelationship]]]]) slots.in_location = Slot(uri=PERSONINFO.in_location, name="in_location", curie=PERSONINFO.curie('in_location'), model_uri=PERSONINFO.in_location, domain=None, range=Optional[Union[str, PlaceId]]) @@ -671,13 +668,13 @@ class slots: model_uri=PERSONINFO.ended_at_time, domain=None, range=Optional[Union[str, XSDDate]]) slots.persons = Slot(uri=PERSONINFO.persons, name="persons", curie=PERSONINFO.curie('persons'), - model_uri=PERSONINFO.persons, domain=None, range=Optional[Union[Dict[Union[str, PersonId], Union[dict, Person]], List[Union[dict, Person]]]]) + model_uri=PERSONINFO.persons, domain=None, range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]]) slots.organizations = Slot(uri=PERSONINFO.organizations, name="organizations", curie=PERSONINFO.curie('organizations'), - model_uri=PERSONINFO.organizations, domain=None, range=Optional[Union[Dict[Union[str, OrganizationId], Union[dict, Organization]], List[Union[dict, Organization]]]]) + model_uri=PERSONINFO.organizations, domain=None, range=Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]]) slots.hasAliases__aliases = Slot(uri=PERSONINFO.aliases, name="hasAliases__aliases", curie=PERSONINFO.curie('aliases'), - model_uri=PERSONINFO.hasAliases__aliases, domain=None, range=Optional[Union[str, List[str]]]) + model_uri=PERSONINFO.hasAliases__aliases, domain=None, range=Optional[Union[str, list[str]]]) slots.Person_primary_email = Slot(uri=SCHEMA.email, name="Person_primary_email", curie=SCHEMA.curie('email'), model_uri=PERSONINFO.Person_primary_email, domain=Person, range=Optional[str], diff --git a/tests/test_index/test_object_index.py b/tests/test_index/test_object_index.py index 1b8c4764..ea2d5e6e 100644 --- a/tests/test_index/test_object_index.py +++ b/tests/test_index/test_object_index.py @@ -5,7 +5,7 @@ from linkml_runtime.loaders import yaml_loader import tests.test_index.model.container_test as src_dm from linkml_runtime.index.object_index import ObjectIndex, ProxyObject -from linkml_runtime.utils.inference_utils import infer_all_slot_values, infer_slot_value, Config +from linkml_runtime.utils.inference_utils import infer_slot_value, Config from tests.test_index import INPUT_DIR SCHEMA = os.path.join(INPUT_DIR, 'container_test.yaml') diff --git a/tests/test_issues/input/issue_355.py b/tests/test_issues/input/issue_355.py index b5117559..ecf17ce3 100644 --- a/tests/test_issues/input/issue_355.py +++ b/tests/test_issues/input/issue_355.py @@ -7,19 +7,14 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re -from jsonasobj2 import JsonObj -from typing import Optional, List, Union, Dict, ClassVar, Any +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.metamodelcore import URIorCURIE @@ -43,16 +38,16 @@ class ContaineeId(URIorCURIE): @dataclass class Container(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCT.Container class_class_curie: ClassVar[str] = "sct:Container" class_name: ClassVar[str] = "container" class_model_uri: ClassVar[URIRef] = SCT.Container - entry: Optional[Union[Dict[Union[str, ContaineeId], Union[dict, "Containee"]], List[Union[dict, "Containee"]]]] = empty_dict() + entry: Optional[Union[dict[Union[str, ContaineeId], Union[dict, "Containee"]], list[Union[dict, "Containee"]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_dict(slot_name="entry", slot_type=Containee, key_name="id", keyed=True) super().__post_init__(**kwargs) @@ -60,7 +55,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Containee(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCT.Containee class_class_curie: ClassVar[str] = "sct:Containee" @@ -70,7 +65,7 @@ class Containee(YAMLRoot): id: Union[str, ContaineeId] = None value: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.id is None: raise ValueError("id must be supplied") if not isinstance(self.id, ContaineeId): @@ -90,7 +85,7 @@ class slots: pass slots.container__entry = Slot(uri=SCT.entry, name="container__entry", curie=SCT.curie('entry'), - model_uri=SCT.container__entry, domain=None, range=Optional[Union[Dict[Union[str, ContaineeId], Union[dict, Containee]], List[Union[dict, Containee]]]]) + model_uri=SCT.container__entry, domain=None, range=Optional[Union[dict[Union[str, ContaineeId], Union[dict, Containee]], list[Union[dict, Containee]]]]) slots.containee__id = Slot(uri=SCT.id, name="containee__id", curie=SCT.curie('id'), model_uri=SCT.containee__id, domain=None, range=URIRef) diff --git a/tests/test_issues/input/issue_368.py b/tests/test_issues/input/issue_368.py index 3632d13b..0f02158d 100644 --- a/tests/test_issues/input/issue_368.py +++ b/tests/test_issues/input/issue_368.py @@ -7,18 +7,12 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re -from typing import Optional, List, Union, Dict, ClassVar, Any +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from .issue_368_imports import ParentClass, SampleEnum @@ -40,7 +34,7 @@ @dataclass class SampleClass(ParentClass): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = URIRef("https://microbiomedata/schema/SampleClass") class_class_curie: ClassVar[str] = None @@ -49,7 +43,7 @@ class SampleClass(ParentClass): slot_1: Optional[Union[str, "SampleEnum"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.slot_1 is not None and not isinstance(self.slot_1, SampleEnum): self.slot_1 = SampleEnum(self.slot_1) diff --git a/tests/test_issues/input/issue_368_imports.py b/tests/test_issues/input/issue_368_imports.py index 828a5ec2..e15bdb15 100644 --- a/tests/test_issues/input/issue_368_imports.py +++ b/tests/test_issues/input/issue_368_imports.py @@ -7,19 +7,13 @@ # license: import dataclasses -import sys -import re -from typing import Optional, List, Union, Dict, ClassVar, Any -from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions - -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from typing import ClassVar +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue + +from linkml_runtime.utils.yamlutils import YAMLRoot from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -39,7 +33,7 @@ class ParentClass(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = URIRef("https://microbiomedata/schema/mixs/ParentClass") class_class_curie: ClassVar[str] = None diff --git a/tests/test_issues/models/linkml_issue_576.py b/tests/test_issues/models/linkml_issue_576.py index 81fb80c7..89a1f39d 100644 --- a/tests/test_issues/models/linkml_issue_576.py +++ b/tests/test_issues/models/linkml_issue_576.py @@ -7,22 +7,16 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_list, empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.linkml_model.types import String, Uriorcurie +from linkml_runtime.linkml_model.types import String from linkml_runtime.utils.metamodelcore import URIorCURIE metamodel_version = "1.7.0" @@ -64,7 +58,7 @@ class OrganizationId(Code): @dataclass class Person(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCHEMA.Person class_class_curie: ClassVar[str] = "schema:Person" @@ -73,9 +67,9 @@ class Person(YAMLRoot): id: Union[str, PersonId] = None name: Optional[str] = None - friends: Optional[Union[Union[str, PersonId], List[Union[str, PersonId]]]] = empty_list() + friends: Optional[Union[Union[str, PersonId], list[Union[str, PersonId]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, PersonId): @@ -93,7 +87,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Pet(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Pet class_class_curie: ClassVar[str] = "personinfo:Pet" @@ -104,7 +98,7 @@ class Pet(YAMLRoot): name: Optional[str] = None owner: Optional[Union[str, PersonId]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, PetId): @@ -121,7 +115,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Organization(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCHEMA.Organization class_class_curie: ClassVar[str] = "schema:Organization" @@ -130,9 +124,9 @@ class Organization(YAMLRoot): id: Union[str, OrganizationId] = None name: Optional[str] = None - part_of: Optional[Union[Union[str, OrganizationId], List[Union[str, OrganizationId]]]] = empty_list() + part_of: Optional[Union[Union[str, OrganizationId], list[Union[str, OrganizationId]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, OrganizationId): @@ -150,7 +144,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Dataset(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Dataset class_class_curie: ClassVar[str] = "personinfo:Dataset" @@ -158,11 +152,11 @@ class Dataset(YAMLRoot): class_model_uri: ClassVar[URIRef] = PERSONINFO.Dataset source: Optional[Union[str, URIorCURIE]] = None - persons: Optional[Union[Dict[Union[str, PersonId], Union[dict, Person]], List[Union[dict, Person]]]] = empty_dict() - organizations: Optional[Union[Dict[Union[str, OrganizationId], Union[dict, Organization]], List[Union[dict, Organization]]]] = empty_dict() - pets: Optional[Union[Dict[Union[str, PetId], Union[dict, Pet]], List[Union[dict, Pet]]]] = empty_dict() + persons: Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]] = empty_dict() + organizations: Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]] = empty_dict() + pets: Optional[Union[dict[Union[str, PetId], Union[dict, Pet]], list[Union[dict, Pet]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.source is not None and not isinstance(self.source, URIorCURIE): self.source = URIorCURIE(self.source) @@ -189,7 +183,7 @@ class slots: model_uri=PERSONINFO.person__name, domain=None, range=Optional[str]) slots.person__friends = Slot(uri=PERSONINFO.friends, name="person__friends", curie=PERSONINFO.curie('friends'), - model_uri=PERSONINFO.person__friends, domain=None, range=Optional[Union[Union[str, PersonId], List[Union[str, PersonId]]]]) + model_uri=PERSONINFO.person__friends, domain=None, range=Optional[Union[Union[str, PersonId], list[Union[str, PersonId]]]]) slots.pet__id = Slot(uri=PERSONINFO.id, name="pet__id", curie=PERSONINFO.curie('id'), model_uri=PERSONINFO.pet__id, domain=None, range=URIRef) @@ -207,16 +201,16 @@ class slots: model_uri=PERSONINFO.organization__name, domain=None, range=Optional[str]) slots.organization__part_of = Slot(uri=PERSONINFO.part_of, name="organization__part_of", curie=PERSONINFO.curie('part_of'), - model_uri=PERSONINFO.organization__part_of, domain=None, range=Optional[Union[Union[str, OrganizationId], List[Union[str, OrganizationId]]]]) + model_uri=PERSONINFO.organization__part_of, domain=None, range=Optional[Union[Union[str, OrganizationId], list[Union[str, OrganizationId]]]]) slots.dataset__source = Slot(uri=PERSONINFO.source, name="dataset__source", curie=PERSONINFO.curie('source'), model_uri=PERSONINFO.dataset__source, domain=None, range=Optional[Union[str, URIorCURIE]]) slots.dataset__persons = Slot(uri=PERSONINFO.persons, name="dataset__persons", curie=PERSONINFO.curie('persons'), - model_uri=PERSONINFO.dataset__persons, domain=None, range=Optional[Union[Dict[Union[str, PersonId], Union[dict, Person]], List[Union[dict, Person]]]]) + model_uri=PERSONINFO.dataset__persons, domain=None, range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]]) slots.dataset__organizations = Slot(uri=PERSONINFO.organizations, name="dataset__organizations", curie=PERSONINFO.curie('organizations'), - model_uri=PERSONINFO.dataset__organizations, domain=None, range=Optional[Union[Dict[Union[str, OrganizationId], Union[dict, Organization]], List[Union[dict, Organization]]]]) + model_uri=PERSONINFO.dataset__organizations, domain=None, range=Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]]) slots.dataset__pets = Slot(uri=PERSONINFO.pets, name="dataset__pets", curie=PERSONINFO.curie('pets'), - model_uri=PERSONINFO.dataset__pets, domain=None, range=Optional[Union[Dict[Union[str, PetId], Union[dict, Pet]], List[Union[dict, Pet]]]]) + model_uri=PERSONINFO.dataset__pets, domain=None, range=Optional[Union[dict[Union[str, PetId], Union[dict, Pet]], list[Union[dict, Pet]]]]) diff --git a/tests/test_issues/models/model_817.py b/tests/test_issues/models/model_817.py index ce6ac68f..f9ca3298 100644 --- a/tests/test_issues/models/model_817.py +++ b/tests/test_issues/models/model_817.py @@ -7,22 +7,18 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from jsonasobj2 import as_dict +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_list, empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.linkml_model.types import String metamodel_version = "1.7.0" version = None @@ -49,7 +45,7 @@ class PersonId(extended_str): @dataclass class Person(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Person class_class_curie: ClassVar[str] = "personinfo:Person" @@ -60,7 +56,7 @@ class Person(YAMLRoot): name: Optional[str] = None vital_status: Optional[Union[str, "VitalStatusEnum"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, PersonId): @@ -77,7 +73,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class PersonNoId(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.PersonNoId class_class_curie: ClassVar[str] = "personinfo:PersonNoId" @@ -87,7 +83,7 @@ class PersonNoId(YAMLRoot): name: Optional[str] = None vital_status: Optional[Union[str, "VitalStatusEnum"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.name is not None and not isinstance(self.name, str): self.name = str(self.name) @@ -99,7 +95,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Container(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Container class_class_curie: ClassVar[str] = "personinfo:Container" @@ -107,13 +103,13 @@ class Container(YAMLRoot): class_model_uri: ClassVar[URIRef] = PERSONINFO.Container name: Optional[str] = None - persons_as_list: Optional[Union[Dict[Union[str, PersonId], Union[dict, Person]], List[Union[dict, Person]]]] = empty_dict() - persons_as_dict: Optional[Union[Dict[Union[str, PersonId], Union[dict, Person]], List[Union[dict, Person]]]] = empty_dict() + persons_as_list: Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]] = empty_dict() + persons_as_dict: Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]] = empty_dict() single_person_inlined: Optional[Union[dict, Person]] = None - noidobj_as_list: Optional[Union[Union[dict, PersonNoId], List[Union[dict, PersonNoId]]]] = empty_list() + noidobj_as_list: Optional[Union[Union[dict, PersonNoId], list[Union[dict, PersonNoId]]]] = empty_list() single_noidobj_inlined: Optional[Union[dict, PersonNoId]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.name is not None and not isinstance(self.name, str): self.name = str(self.name) @@ -155,16 +151,16 @@ class slots: model_uri=PERSONINFO.name, domain=None, range=Optional[str]) slots.persons_as_list = Slot(uri=PERSONINFO.persons_as_list, name="persons_as_list", curie=PERSONINFO.curie('persons_as_list'), - model_uri=PERSONINFO.persons_as_list, domain=None, range=Optional[Union[Dict[Union[str, PersonId], Union[dict, Person]], List[Union[dict, Person]]]]) + model_uri=PERSONINFO.persons_as_list, domain=None, range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]]) slots.persons_as_dict = Slot(uri=PERSONINFO.persons_as_dict, name="persons_as_dict", curie=PERSONINFO.curie('persons_as_dict'), - model_uri=PERSONINFO.persons_as_dict, domain=None, range=Optional[Union[Dict[Union[str, PersonId], Union[dict, Person]], List[Union[dict, Person]]]]) + model_uri=PERSONINFO.persons_as_dict, domain=None, range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]]) slots.single_person_inlined = Slot(uri=PERSONINFO.single_person_inlined, name="single_person_inlined", curie=PERSONINFO.curie('single_person_inlined'), model_uri=PERSONINFO.single_person_inlined, domain=None, range=Optional[Union[dict, Person]]) slots.noidobj_as_list = Slot(uri=PERSONINFO.noidobj_as_list, name="noidobj_as_list", curie=PERSONINFO.curie('noidobj_as_list'), - model_uri=PERSONINFO.noidobj_as_list, domain=None, range=Optional[Union[Union[dict, PersonNoId], List[Union[dict, PersonNoId]]]]) + model_uri=PERSONINFO.noidobj_as_list, domain=None, range=Optional[Union[Union[dict, PersonNoId], list[Union[dict, PersonNoId]]]]) slots.single_noidobj_inlined = Slot(uri=PERSONINFO.single_noidobj_inlined, name="single_noidobj_inlined", curie=PERSONINFO.curie('single_noidobj_inlined'), model_uri=PERSONINFO.single_noidobj_inlined, domain=None, range=Optional[Union[dict, PersonNoId]]) diff --git a/tests/test_issues/test_issue_1040.py b/tests/test_issues/test_issue_1040.py index d51d1352..a2a0d770 100644 --- a/tests/test_issues/test_issue_1040.py +++ b/tests/test_issues/test_issue_1040.py @@ -1,4 +1,3 @@ -import sys from unittest import TestCase import yaml.constructor diff --git a/tests/test_issues/test_issue_355.py b/tests/test_issues/test_issue_355.py index a1dc7872..a2032ff7 100644 --- a/tests/test_issues/test_issue_355.py +++ b/tests/test_issues/test_issue_355.py @@ -7,19 +7,15 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re from jsonasobj2 import JsonObj -from typing import Optional, List, Union, Dict, ClassVar, Any +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.metamodelcore import URIorCURIE @@ -43,16 +39,16 @@ class ContaineeId(URIorCURIE): @dataclass class Container(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCT.Container class_class_curie: ClassVar[str] = "sct:Container" class_name: ClassVar[str] = "container" class_model_uri: ClassVar[URIRef] = SCT.Container - entry: Optional[Union[Dict[Union[str, ContaineeId], Union[dict, "Containee"]], List[Union[dict, "Containee"]]]] = empty_dict() + entry: Optional[Union[dict[Union[str, ContaineeId], Union[dict, "Containee"]], list[Union[dict, "Containee"]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.entry, (list, dict, JsonObj)): self.entry = [self.entry] self._normalize_inlined_as_dict(slot_name="entry", slot_type=Containee, key_name="id", keyed=True) @@ -62,7 +58,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Containee(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCT.Containee class_class_curie: ClassVar[str] = "sct:Containee" @@ -72,7 +68,7 @@ class Containee(YAMLRoot): id: Union[str, ContaineeId] = None value: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.id is None: raise ValueError("id must be supplied") if not isinstance(self.id, ContaineeId): @@ -92,7 +88,7 @@ class slots: pass slots.container__entry = Slot(uri=SCT.entry, name="container__entry", curie=SCT.curie('entry'), - model_uri=SCT.container__entry, domain=None, range=Optional[Union[Dict[Union[str, ContaineeId], Union[dict, Containee]], List[Union[dict, Containee]]]]) + model_uri=SCT.container__entry, domain=None, range=Optional[Union[dict[Union[str, ContaineeId], Union[dict, Containee]], list[Union[dict, Containee]]]]) slots.containee__id = Slot(uri=SCT.id, name="containee__id", curie=SCT.curie('id'), model_uri=SCT.containee__id, domain=None, range=URIRef) diff --git a/tests/test_issues/test_issue_718a.py b/tests/test_issues/test_issue_718a.py index b5710e20..ad6e9dc0 100644 --- a/tests/test_issues/test_issue_718a.py +++ b/tests/test_issues/test_issue_718a.py @@ -1,4 +1,3 @@ -import dataclasses import unittest from dataclasses import dataclass from typing import Optional, ClassVar diff --git a/tests/test_issues/test_issue_8.py b/tests/test_issues/test_issue_8.py index cb8ca996..c9167743 100644 --- a/tests/test_issues/test_issue_8.py +++ b/tests/test_issues/test_issue_8.py @@ -1,5 +1,4 @@ import unittest -from typing import Type from linkml_runtime.linkml_model import SchemaDefinition, SlotDefinition, ClassDefinition from linkml_runtime.loaders import yaml_loader @@ -7,7 +6,7 @@ from tests.test_issues.environment import env -def override(cls: Type[YAMLRoot]): +def override(cls: type[YAMLRoot]): orig = cls.MissingRequiredField def mrf(self, field_name: str) -> None: if isinstance(self, SchemaDefinition) and field_name == "name" and self.id: diff --git a/tests/test_issues/test_linkml_issue_1126.py b/tests/test_issues/test_linkml_issue_1126.py index fd69c1dd..93be1f6d 100644 --- a/tests/test_issues/test_linkml_issue_1126.py +++ b/tests/test_issues/test_linkml_issue_1126.py @@ -1,4 +1,3 @@ -import logging import unittest from unittest import TestCase from linkml_runtime.utils.schemaview import SchemaView diff --git a/tests/test_issues/test_linkml_issue_1143.py b/tests/test_issues/test_linkml_issue_1143.py index e0ec799c..24e163b8 100644 --- a/tests/test_issues/test_linkml_issue_1143.py +++ b/tests/test_issues/test_linkml_issue_1143.py @@ -1,7 +1,5 @@ -import logging import unittest from copy import deepcopy -from typing import List, Tuple from unittest import TestCase from linkml_runtime.linkml_model import SchemaDefinition, ClassDefinition, SlotDefinition, EnumDefinition, TypeDefinition, Prefix, \ @@ -22,12 +20,12 @@ def make_schema(name: str, - prefixes: List[Prefix] = None, - classes: List[ClassDefinition] = None, - slots: List[SlotDefinition] = None, - enums: List[EnumDefinition] = None, - types: List[TypeDefinition] = None, - subsets: List[SubsetDefinition] = None, + prefixes: list[Prefix] = None, + classes: list[ClassDefinition] = None, + slots: list[SlotDefinition] = None, + enums: list[EnumDefinition] = None, + types: list[TypeDefinition] = None, + subsets: list[SubsetDefinition] = None, ) -> SchemaDefinition: """ Make a schema with the given elements @@ -148,7 +146,7 @@ def test_merge_schema(self): for k, vs in EXPECTED.items(): self.assertCountEqual(getattr(self.sv2.schema, k).keys(), vs, f'{k} keys not equal') - def _get_clobbered_field_val(self, element: str) -> Tuple[str, str]: + def _get_clobbered_field_val(self, element: str) -> tuple[str, str]: if element == 'prefixes': return 'prefix_reference', 'http://example.org/clobbered' else: diff --git a/tests/test_issues/test_linkml_issue_478.py b/tests/test_issues/test_linkml_issue_478.py index 67f5de75..96a3ce6c 100644 --- a/tests/test_issues/test_linkml_issue_478.py +++ b/tests/test_issues/test_linkml_issue_478.py @@ -1,4 +1,3 @@ -import logging import unittest from unittest import TestCase from linkml_runtime.utils.schemaview import SchemaView diff --git a/tests/test_issues/test_linkml_issue_576.py b/tests/test_issues/test_linkml_issue_576.py index 73b560f6..019a3038 100644 --- a/tests/test_issues/test_linkml_issue_576.py +++ b/tests/test_issues/test_linkml_issue_576.py @@ -2,9 +2,8 @@ from unittest import TestCase import rdflib -from rdflib import RDF -from linkml_runtime.dumpers import rdflib_dumper, yaml_dumper +from linkml_runtime.dumpers import rdflib_dumper from linkml_runtime.loaders import yaml_loader, rdflib_loader from linkml_runtime.utils.schemaview import SchemaView diff --git a/tests/test_issues/test_linkml_issue_817.py b/tests/test_issues/test_linkml_issue_817.py index 738b6c0e..9cf0d1e1 100644 --- a/tests/test_issues/test_linkml_issue_817.py +++ b/tests/test_issues/test_linkml_issue_817.py @@ -2,7 +2,6 @@ from linkml_runtime.dumpers import yaml_dumper from linkml_runtime.loaders import yaml_loader -from linkml_runtime.utils.schemaview import SchemaView from tests.test_issues.environment import env from tests.test_issues.models.model_817 import Container, Person, VitalStatusEnum, PersonNoId diff --git a/tests/test_linkml_model/test_linkml_files.py b/tests/test_linkml_model/test_linkml_files.py index 5899950d..854c55e4 100644 --- a/tests/test_linkml_model/test_linkml_files.py +++ b/tests/test_linkml_model/test_linkml_files.py @@ -3,12 +3,9 @@ from pathlib import Path from itertools import product from urllib.parse import urlparse +from importlib.util import find_spec -try: - import requests_cache - HAVE_REQUESTS_CACHE = True -except ImportError: - HAVE_REQUESTS_CACHE = False +HAVE_REQUESTS_CACHE = bool(find_spec("requests_cache")) from linkml_runtime.linkml_model.linkml_files import ( Source, diff --git a/tests/test_loaders_dumpers/loaderdumpertestcase.py b/tests/test_loaders_dumpers/loaderdumpertestcase.py index 192edf9a..e545a8cd 100644 --- a/tests/test_loaders_dumpers/loaderdumpertestcase.py +++ b/tests/test_loaders_dumpers/loaderdumpertestcase.py @@ -1,5 +1,5 @@ import os -from typing import Callable, Type, Optional, List, Union +from typing import Callable, Optional, Union from urllib.parse import urlparse from hbreader import FileInfo, hbread @@ -45,7 +45,7 @@ def dumps_test(self, filename: str, dumper: Callable[[], str], comparator: Calla return self.env.eval_single_file(expected_file, actual, comparator=comparator) - def loader_test(self, filename: str, model: Union[Type[YAMLRoot], Type[BaseModel]], loader: Loader) -> None: + def loader_test(self, filename: str, model: Union[type[YAMLRoot], type[BaseModel]], loader: Loader) -> None: """ Test the various permutations of the supplied loader using the input file 'filename' -- both load and loads @@ -88,7 +88,7 @@ def loader_test(self, filename: str, model: Union[Type[YAMLRoot], Type[BaseModel self.env.eval_single_file(expected_yaml, yaml_dumper.dumps(python_obj)) @staticmethod - def check_context_servers(possible_server: List[str]) -> Optional[str]: + def check_context_servers(possible_server: list[str]) -> Optional[str]: """ Work down possible servers to see whether any of them are actually available :param possible_server: Ordered list of servers to check diff --git a/tests/test_loaders_dumpers/models/books_normalized.py b/tests/test_loaders_dumpers/models/books_normalized.py index b06d6547..35edd068 100644 --- a/tests/test_loaders_dumpers/models/books_normalized.py +++ b/tests/test_loaders_dumpers/models/books_normalized.py @@ -7,22 +7,18 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from jsonasobj2 import as_dict +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_list, empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.linkml_model.types import Float, Integer, String metamodel_version = "1.7.0" @@ -56,7 +52,7 @@ class CountryName(extended_str): @dataclass class CreativeWork(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EXAMPLE.CreativeWork class_class_curie: ClassVar[str] = "example:CreativeWork" @@ -65,12 +61,12 @@ class CreativeWork(YAMLRoot): id: Union[str, CreativeWorkId] = None name: Optional[str] = None - genres: Optional[Union[Union[str, "GenreEnum"], List[Union[str, "GenreEnum"]]]] = empty_list() + genres: Optional[Union[Union[str, "GenreEnum"], list[Union[str, "GenreEnum"]]]] = empty_list() creator: Optional[Union[dict, "Author"]] = None summary: Optional[str] = None - reviews: Optional[Union[Union[dict, "Review"], List[Union[dict, "Review"]]]] = empty_list() + reviews: Optional[Union[Union[dict, "Review"], list[Union[dict, "Review"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, CreativeWorkId): @@ -102,7 +98,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Book(CreativeWork): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EXAMPLE.Book class_class_curie: ClassVar[str] = "example:Book" @@ -113,7 +109,7 @@ class Book(CreativeWork): price: Optional[float] = None inStock: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, BookId): @@ -130,7 +126,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class BookSeries(CreativeWork): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EXAMPLE.BookSeries class_class_curie: ClassVar[str] = "example:BookSeries" @@ -138,11 +134,11 @@ class BookSeries(CreativeWork): class_model_uri: ClassVar[URIRef] = EXAMPLE.BookSeries id: Union[str, BookSeriesId] = None - books: Optional[Union[Dict[Union[str, BookId], Union[dict, Book]], List[Union[dict, Book]]]] = empty_dict() - genres: Optional[Union[Union[str, "GenreEnum"], List[Union[str, "GenreEnum"]]]] = empty_list() + books: Optional[Union[dict[Union[str, BookId], Union[dict, Book]], list[Union[dict, Book]]]] = empty_dict() + genres: Optional[Union[Union[str, "GenreEnum"], list[Union[str, "GenreEnum"]]]] = empty_list() price: Optional[float] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, BookSeriesId): @@ -162,7 +158,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Author(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EXAMPLE.Author class_class_curie: ClassVar[str] = "example:Author" @@ -170,10 +166,10 @@ class Author(YAMLRoot): class_model_uri: ClassVar[URIRef] = EXAMPLE.Author name: Optional[str] = None - genres: Optional[Union[Union[str, "GenreEnum"], List[Union[str, "GenreEnum"]]]] = empty_list() + genres: Optional[Union[Union[str, "GenreEnum"], list[Union[str, "GenreEnum"]]]] = empty_list() from_country: Optional[Union[str, CountryName]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.name is not None and not isinstance(self.name, str): self.name = str(self.name) @@ -189,16 +185,16 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Shop(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EXAMPLE.Shop class_class_curie: ClassVar[str] = "example:Shop" class_name: ClassVar[str] = "shop" class_model_uri: ClassVar[URIRef] = EXAMPLE.Shop - all_book_series: Optional[Union[Dict[Union[str, BookSeriesId], Union[dict, BookSeries]], List[Union[dict, BookSeries]]]] = empty_dict() + all_book_series: Optional[Union[dict[Union[str, BookSeriesId], Union[dict, BookSeries]], list[Union[dict, BookSeries]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_list(slot_name="all_book_series", slot_type=BookSeries, key_name="id", keyed=True) super().__post_init__(**kwargs) @@ -206,7 +202,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Country(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EXAMPLE.Country class_class_curie: ClassVar[str] = "example:Country" @@ -215,7 +211,7 @@ class Country(YAMLRoot): name: Union[str, CountryName] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.name): self.MissingRequiredField("name") if not isinstance(self.name, CountryName): @@ -226,7 +222,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Review(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EXAMPLE.Review class_class_curie: ClassVar[str] = "example:Review" @@ -237,7 +233,7 @@ class Review(YAMLRoot): rating: Optional[int] = None review_text: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.creator is not None and not isinstance(self.creator, Author): self.creator = Author(**as_dict(self.creator)) @@ -271,7 +267,7 @@ class slots: model_uri=EXAMPLE.id, domain=None, range=URIRef) slots.book_category = Slot(uri=EXAMPLE.book_category, name="book_category", curie=EXAMPLE.curie('book_category'), - model_uri=EXAMPLE.book_category, domain=None, range=Optional[Union[str, List[str]]]) + model_uri=EXAMPLE.book_category, domain=None, range=Optional[Union[str, list[str]]]) slots.name = Slot(uri=EXAMPLE.name, name="name", curie=EXAMPLE.curie('name'), model_uri=EXAMPLE.name, domain=None, range=Optional[str]) @@ -286,22 +282,22 @@ class slots: model_uri=EXAMPLE.creator, domain=None, range=Optional[Union[dict, Author]]) slots.genres = Slot(uri=EXAMPLE.genres, name="genres", curie=EXAMPLE.curie('genres'), - model_uri=EXAMPLE.genres, domain=None, range=Optional[Union[Union[str, "GenreEnum"], List[Union[str, "GenreEnum"]]]]) + model_uri=EXAMPLE.genres, domain=None, range=Optional[Union[Union[str, "GenreEnum"], list[Union[str, "GenreEnum"]]]]) slots.from_country = Slot(uri=EXAMPLE.from_country, name="from_country", curie=EXAMPLE.curie('from_country'), model_uri=EXAMPLE.from_country, domain=None, range=Optional[Union[str, CountryName]]) slots.books = Slot(uri=EXAMPLE.books, name="books", curie=EXAMPLE.curie('books'), - model_uri=EXAMPLE.books, domain=None, range=Optional[Union[Dict[Union[str, BookId], Union[dict, Book]], List[Union[dict, Book]]]]) + model_uri=EXAMPLE.books, domain=None, range=Optional[Union[dict[Union[str, BookId], Union[dict, Book]], list[Union[dict, Book]]]]) slots.all_book_series = Slot(uri=EXAMPLE.all_book_series, name="all_book_series", curie=EXAMPLE.curie('all_book_series'), - model_uri=EXAMPLE.all_book_series, domain=None, range=Optional[Union[Dict[Union[str, BookSeriesId], Union[dict, BookSeries]], List[Union[dict, BookSeries]]]]) + model_uri=EXAMPLE.all_book_series, domain=None, range=Optional[Union[dict[Union[str, BookSeriesId], Union[dict, BookSeries]], list[Union[dict, BookSeries]]]]) slots.summary = Slot(uri=EXAMPLE.summary, name="summary", curie=EXAMPLE.curie('summary'), model_uri=EXAMPLE.summary, domain=None, range=Optional[str]) slots.reviews = Slot(uri=EXAMPLE.reviews, name="reviews", curie=EXAMPLE.curie('reviews'), - model_uri=EXAMPLE.reviews, domain=None, range=Optional[Union[Union[dict, Review], List[Union[dict, Review]]]]) + model_uri=EXAMPLE.reviews, domain=None, range=Optional[Union[Union[dict, Review], list[Union[dict, Review]]]]) slots.rating = Slot(uri=EXAMPLE.rating, name="rating", curie=EXAMPLE.curie('rating'), model_uri=EXAMPLE.rating, domain=None, range=Optional[int]) diff --git a/tests/test_loaders_dumpers/models/books_normalized_pydantic.py b/tests/test_loaders_dumpers/models/books_normalized_pydantic.py index d10222e6..ec421751 100644 --- a/tests/test_loaders_dumpers/models/books_normalized_pydantic.py +++ b/tests/test_loaders_dumpers/models/books_normalized_pydantic.py @@ -1,10 +1,6 @@ from __future__ import annotations -from datetime import datetime, date from enum import Enum -from typing import List, Dict, Optional, Any, Union -from typing_extensions import Literal from pydantic import BaseModel as BaseModel, Field -from linkml_runtime.linkml_model import Decimal metamodel_version = "None" version = "None" @@ -35,66 +31,66 @@ class GenreEnum(str, Enum): class CreativeWork(ConfiguredBaseModel): - id: Optional[str] = Field(None) - name: Optional[str] = Field(None) - genres: Optional[List[GenreEnum]] = Field(default_factory=list) - creator: Optional[Author] = Field(None) - summary: Optional[str] = Field(None) - reviews: Optional[List[Review]] = Field(default_factory=list) + id: str | None = Field(None) + name: str | None = Field(None) + genres: list[GenreEnum] | None = Field(default_factory=list) + creator: Author | None = Field(None) + summary: str | None = Field(None) + reviews: list[Review] | None = Field(default_factory=list) class Book(CreativeWork): - price: Optional[float] = Field(None) - inStock: Optional[str] = Field(None) - id: Optional[str] = Field(None) - name: Optional[str] = Field(None) - genres: Optional[List[GenreEnum]] = Field(default_factory=list) - creator: Optional[Author] = Field(None) - summary: Optional[str] = Field(None) - reviews: Optional[List[Review]] = Field(default_factory=list) + price: float | None = Field(None) + inStock: str | None = Field(None) + id: str | None = Field(None) + name: str | None = Field(None) + genres: list[GenreEnum] | None = Field(default_factory=list) + creator: Author | None = Field(None) + summary: str | None = Field(None) + reviews: list[Review] | None = Field(default_factory=list) class BookSeries(CreativeWork): - books: Optional[List[Book]] = Field(default_factory=list) - genres: Optional[List[GenreEnum]] = Field(default_factory=list) - price: Optional[float] = Field(None) - id: Optional[str] = Field(None) - name: Optional[str] = Field(None) - creator: Optional[Author] = Field(None) - summary: Optional[str] = Field(None) - reviews: Optional[List[Review]] = Field(default_factory=list) + books: list[Book] | None = Field(default_factory=list) + genres: list[GenreEnum] | None = Field(default_factory=list) + price: float | None = Field(None) + id: str | None = Field(None) + name: str | None = Field(None) + creator: Author | None = Field(None) + summary: str | None = Field(None) + reviews: list[Review] | None = Field(default_factory=list) class Author(ConfiguredBaseModel): - name: Optional[str] = Field(None) - genres: Optional[List[GenreEnum]] = Field(default_factory=list) - from_country: Optional[str] = Field(None) + name: str | None = Field(None) + genres: list[GenreEnum] | None = Field(default_factory=list) + from_country: str | None = Field(None) class Shop(ConfiguredBaseModel): - all_book_series: Optional[List[BookSeries]] = Field(default_factory=list) + all_book_series: list[BookSeries] | None = Field(default_factory=list) class Country(ConfiguredBaseModel): - name: Optional[str] = Field(None) + name: str | None = Field(None) class Review(ConfiguredBaseModel): - creator: Optional[Author] = Field(None) - rating: Optional[int] = Field(None) - review_text: Optional[str] = Field(None) + creator: Author | None = Field(None) + rating: int | None = Field(None) + review_text: str | None = Field(None) diff --git a/tests/test_loaders_dumpers/models/enum_model.py b/tests/test_loaders_dumpers/models/enum_model.py index 141e6874..4c64c484 100644 --- a/tests/test_loaders_dumpers/models/enum_model.py +++ b/tests/test_loaders_dumpers/models/enum_model.py @@ -7,20 +7,15 @@ # license: import dataclasses -import sys -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.yamlutils import YAMLRoot from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -41,7 +36,7 @@ @dataclass class Organism(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = URIRef("https://example.org/enum_test/Organism") class_class_curie: ClassVar[str] = None @@ -50,7 +45,7 @@ class Organism(YAMLRoot): state: Optional[Union[str, "StateEnum"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.state is not None and not isinstance(self.state, StateEnum): self.state = StateEnum(self.state) diff --git a/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py b/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py index 1a2505d2..96a6570c 100644 --- a/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py +++ b/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py @@ -1,10 +1,8 @@ from __future__ import annotations -from datetime import datetime, date +from datetime import date from enum import Enum -from typing import List, Dict, Optional, Any, Union -from typing_extensions import Literal +from typing import Any from pydantic import BaseModel as BaseModel, Field -from linkml_runtime.linkml_model import Decimal metamodel_version = "None" version = "None" @@ -62,13 +60,13 @@ class LifeStatusEnum(str, Enum): class HasAliases(ConfiguredBaseModel): - aliases: Optional[List[str]] = Field(default_factory=list) + aliases: list[str] | None = Field(default_factory=list) class Friend(ConfiguredBaseModel): - name: Optional[str] = Field(None) + name: str | None = Field(None) @@ -76,18 +74,18 @@ class Person(HasAliases): """ A person, living or dead """ - id: Optional[str] = Field(None) - name: Optional[str] = Field(None) - has_employment_history: Optional[List[EmploymentEvent]] = Field(None) - has_familial_relationships: Optional[List[FamilialRelationship]] = Field(None) - has_medical_history: Optional[List[MedicalEvent]] = Field(None) - age_in_years: Optional[int] = Field(None, description="""number of years since birth""", ge=0, le=999) - addresses: Optional[List[Address]] = Field(default_factory=list) - has_birth_event: Optional[BirthEvent] = Field(None) - species_name: Optional[str] = Field(None) - stomach_count: Optional[int] = Field(None) - is_living: Optional[LifeStatusEnum] = Field(None) - aliases: Optional[List[str]] = Field(default_factory=list) + id: str | None = Field(None) + name: str | None = Field(None) + has_employment_history: list[EmploymentEvent] | None = Field(None) + has_familial_relationships: list[FamilialRelationship] | None = Field(None) + has_medical_history: list[MedicalEvent] | None = Field(None) + age_in_years: int | None = Field(None, description="""number of years since birth""", ge=0, le=999) + addresses: list[Address] | None = Field(default_factory=list) + has_birth_event: BirthEvent | None = Field(None) + species_name: str | None = Field(None) + stomach_count: int | None = Field(None) + is_living: LifeStatusEnum | None = Field(None) + aliases: list[str] | None = Field(default_factory=list) @@ -104,73 +102,73 @@ class Organization(HasAliases): * a * list """ - id: Optional[str] = Field(None) - name: Optional[str] = Field(None) - aliases: Optional[List[str]] = Field(default_factory=list) + id: str | None = Field(None) + name: str | None = Field(None) + aliases: list[str] | None = Field(default_factory=list) class Place(HasAliases): - id: Optional[str] = Field(None) - name: Optional[str] = Field(None) - aliases: Optional[List[str]] = Field(default_factory=list) + id: str | None = Field(None) + name: str | None = Field(None) + aliases: list[str] | None = Field(default_factory=list) class Address(ConfiguredBaseModel): - street: Optional[str] = Field(None) - city: Optional[str] = Field(None) + street: str | None = Field(None) + city: str | None = Field(None) class Concept(ConfiguredBaseModel): - id: Optional[str] = Field(None) - name: Optional[str] = Field(None) - in_code_system: Optional[str] = Field(None) + id: str | None = Field(None) + name: str | None = Field(None) + in_code_system: str | None = Field(None) class DiagnosisConcept(Concept): - id: Optional[str] = Field(None) - name: Optional[str] = Field(None) - in_code_system: Optional[str] = Field(None) + id: str | None = Field(None) + name: str | None = Field(None) + in_code_system: str | None = Field(None) class ProcedureConcept(Concept): - id: Optional[str] = Field(None) - name: Optional[str] = Field(None) - in_code_system: Optional[str] = Field(None) + id: str | None = Field(None) + name: str | None = Field(None) + in_code_system: str | None = Field(None) class Event(ConfiguredBaseModel): - started_at_time: Optional[date] = Field(None) - ended_at_time: Optional[date] = Field(None) - is_current: Optional[bool] = Field(None) - metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") + started_at_time: date | None = Field(None) + ended_at_time: date | None = Field(None) + is_current: bool | None = Field(None) + metadata: Any | None = Field(None, description="""Example of a slot that has an unconstrained range""") class Relationship(ConfiguredBaseModel): - started_at_time: Optional[date] = Field(None) - ended_at_time: Optional[date] = Field(None) - related_to: Optional[str] = Field(None) - type: Optional[str] = Field(None) + started_at_time: date | None = Field(None) + ended_at_time: date | None = Field(None) + related_to: str | None = Field(None) + type: str | None = Field(None) class FamilialRelationship(Relationship): - started_at_time: Optional[date] = Field(None) - ended_at_time: Optional[date] = Field(None) + started_at_time: date | None = Field(None) + ended_at_time: date | None = Field(None) related_to: str = Field(...) type: FamilialRelationshipType = Field(...) @@ -178,103 +176,103 @@ class FamilialRelationship(Relationship): class BirthEvent(Event): - in_location: Optional[str] = Field(None) - started_at_time: Optional[date] = Field(None) - ended_at_time: Optional[date] = Field(None) - is_current: Optional[bool] = Field(None) - metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") + in_location: str | None = Field(None) + started_at_time: date | None = Field(None) + ended_at_time: date | None = Field(None) + is_current: bool | None = Field(None) + metadata: Any | None = Field(None, description="""Example of a slot that has an unconstrained range""") class EmploymentEvent(Event): - employed_at: Optional[str] = Field(None) - type: Optional[EmploymentEventType] = Field(None) - started_at_time: Optional[date] = Field(None) - ended_at_time: Optional[date] = Field(None) - is_current: Optional[bool] = Field(None) - metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") + employed_at: str | None = Field(None) + type: EmploymentEventType | None = Field(None) + started_at_time: date | None = Field(None) + ended_at_time: date | None = Field(None) + is_current: bool | None = Field(None) + metadata: Any | None = Field(None, description="""Example of a slot that has an unconstrained range""") class MedicalEvent(Event): - in_location: Optional[str] = Field(None) - diagnosis: Optional[DiagnosisConcept] = Field(None) - procedure: Optional[ProcedureConcept] = Field(None) - started_at_time: Optional[date] = Field(None) - ended_at_time: Optional[date] = Field(None) - is_current: Optional[bool] = Field(None) - metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") + in_location: str | None = Field(None) + diagnosis: DiagnosisConcept | None = Field(None) + procedure: ProcedureConcept | None = Field(None) + started_at_time: date | None = Field(None) + ended_at_time: date | None = Field(None) + is_current: bool | None = Field(None) + metadata: Any | None = Field(None, description="""Example of a slot that has an unconstrained range""") class WithLocation(ConfiguredBaseModel): - in_location: Optional[str] = Field(None) + in_location: str | None = Field(None) class MarriageEvent(WithLocation, Event): - married_to: Optional[str] = Field(None) - in_location: Optional[str] = Field(None) - started_at_time: Optional[date] = Field(None) - ended_at_time: Optional[date] = Field(None) - is_current: Optional[bool] = Field(None) - metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") + married_to: str | None = Field(None) + in_location: str | None = Field(None) + started_at_time: date | None = Field(None) + ended_at_time: date | None = Field(None) + is_current: bool | None = Field(None) + metadata: Any | None = Field(None, description="""Example of a slot that has an unconstrained range""") class Company(Organization): - ceo: Optional[str] = Field(None) - id: Optional[str] = Field(None) - name: Optional[str] = Field(None) - aliases: Optional[List[str]] = Field(default_factory=list) + ceo: str | None = Field(None) + id: str | None = Field(None) + name: str | None = Field(None) + aliases: list[str] | None = Field(default_factory=list) class CodeSystem(ConfiguredBaseModel): - id: Optional[str] = Field(None) - name: Optional[str] = Field(None) + id: str | None = Field(None) + name: str | None = Field(None) class Dataset(ConfiguredBaseModel): - metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") - persons: Optional[List[Person]] = Field(default_factory=list) - companies: Optional[List[Company]] = Field(default_factory=list) - activities: Optional[List[Activity]] = Field(default_factory=list) - code_systems: Optional[Dict[str, CodeSystem]] = Field(None) + metadata: Any | None = Field(None, description="""Example of a slot that has an unconstrained range""") + persons: list[Person] | None = Field(default_factory=list) + companies: list[Company] | None = Field(default_factory=list) + activities: list[Activity] | None = Field(default_factory=list) + code_systems: dict[str, CodeSystem] | None = Field(None) class FakeClass(ConfiguredBaseModel): - test_attribute: Optional[str] = Field(None) + test_attribute: str | None = Field(None) class ClassWithSpaces(ConfiguredBaseModel): - slot_with_space_1: Optional[str] = Field(None) + slot_with_space_1: str | None = Field(None) class SubclassTest(ClassWithSpaces): - slot_with_space_2: Optional[ClassWithSpaces] = Field(None) - slot_with_space_1: Optional[str] = Field(None) + slot_with_space_2: ClassWithSpaces | None = Field(None) + slot_with_space_1: str | None = Field(None) class SubSubClass2(SubclassTest): - slot_with_space_2: Optional[ClassWithSpaces] = Field(None) - slot_with_space_1: Optional[str] = Field(None) + slot_with_space_2: ClassWithSpaces | None = Field(None) + slot_with_space_1: str | None = Field(None) @@ -282,8 +280,8 @@ class TubSubClass1(SubclassTest): """ Same depth as Sub sub class 1 """ - slot_with_space_2: Optional[ClassWithSpaces] = Field(None) - slot_with_space_1: Optional[str] = Field(None) + slot_with_space_2: ClassWithSpaces | None = Field(None) + slot_with_space_1: str | None = Field(None) @@ -291,13 +289,13 @@ class Activity(ConfiguredBaseModel): """ a provence-generating activity """ - id: Optional[str] = Field(None) - started_at_time: Optional[date] = Field(None) - ended_at_time: Optional[date] = Field(None) - was_informed_by: Optional[str] = Field(None) - was_associated_with: Optional[str] = Field(None) - used: Optional[str] = Field(None) - description: Optional[str] = Field(None) + id: str | None = Field(None) + started_at_time: date | None = Field(None) + ended_at_time: date | None = Field(None) + was_informed_by: str | None = Field(None) + was_associated_with: str | None = Field(None) + used: str | None = Field(None) + description: str | None = Field(None) @@ -305,9 +303,9 @@ class Agent(ConfiguredBaseModel): """ a provence-generating agent """ - id: Optional[str] = Field(None) - acted_on_behalf_of: Optional[str] = Field(None) - was_informed_by: Optional[str] = Field(None) + id: str | None = Field(None) + acted_on_behalf_of: str | None = Field(None) + was_informed_by: str | None = Field(None) diff --git a/tests/test_loaders_dumpers/models/node_object.py b/tests/test_loaders_dumpers/models/node_object.py index 4ebaa2b5..4cbf888d 100644 --- a/tests/test_loaders_dumpers/models/node_object.py +++ b/tests/test_loaders_dumpers/models/node_object.py @@ -7,22 +7,16 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from jsonasobj2 import as_dict +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_list +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.linkml_model.types import String metamodel_version = "1.7.0" @@ -54,7 +48,7 @@ class Triple(YAMLRoot): """ Represents an RDF triple """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = RDF.Statement class_class_curie: ClassVar[str] = "rdf:Statement" @@ -65,7 +59,7 @@ class Triple(YAMLRoot): predicate: Optional[Union[str, NodeId]] = None object: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.subject is not None and not isinstance(self.subject, NodeId): self.subject = NodeId(self.subject) @@ -80,7 +74,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Node(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EX.Node class_class_curie: ClassVar[str] = "ex:Node" @@ -89,7 +83,7 @@ class Node(YAMLRoot): id: Union[str, NodeId] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, NodeId): @@ -100,7 +94,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class NodeObject(Node): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = RDF.Resource class_class_curie: ClassVar[str] = "rdf:Resource" @@ -108,9 +102,9 @@ class NodeObject(Node): class_model_uri: ClassVar[URIRef] = EX.NodeObject id: Union[str, NodeObjectId] = None - statements: Optional[Union[Union[dict, Triple], List[Union[dict, Triple]]]] = empty_list() + statements: Optional[Union[Union[dict, Triple], list[Union[dict, Triple]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, NodeObjectId): @@ -146,7 +140,7 @@ class slots: model_uri=EX.graph, domain=None, range=Optional[Union[str, NodeId]]) slots.statements = Slot(uri=SPARQLFUN.statements, name="statements", curie=SPARQLFUN.curie('statements'), - model_uri=EX.statements, domain=None, range=Optional[Union[Union[dict, Triple], List[Union[dict, Triple]]]]) + model_uri=EX.statements, domain=None, range=Optional[Union[Union[dict, Triple], list[Union[dict, Triple]]]]) slots.type = Slot(uri=EX.type, name="type", curie=EX.curie('type'), model_uri=EX.type, domain=None, range=Optional[Union[str, NodeId]]) diff --git a/tests/test_loaders_dumpers/models/personinfo.py b/tests/test_loaders_dumpers/models/personinfo.py index a061168e..643ccb8b 100644 --- a/tests/test_loaders_dumpers/models/personinfo.py +++ b/tests/test_loaders_dumpers/models/personinfo.py @@ -7,23 +7,21 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from jsonasobj2 import as_dict +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_list, empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.linkml_model.types import Boolean, Date, Decimal, Float, Integer, String, Uri, Uriorcurie -from linkml_runtime.utils.metamodelcore import Bool, Decimal, URI, URIorCURIE, XSDDate +from linkml_runtime.linkml_model.types import Decimal, Uri, Uriorcurie +from linkml_runtime.utils.metamodelcore import Bool, Decimal, XSDDate metamodel_version = "1.7.0" version = None @@ -116,7 +114,7 @@ class NamedThing(YAMLRoot): """ A generic grouping for any identifiable entity """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.NamedThing class_class_curie: ClassVar[str] = "personinfo:NamedThing" @@ -129,7 +127,7 @@ class NamedThing(YAMLRoot): image: Optional[str] = None depicted_by: Optional[Union[str, ImageURL]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, NamedThingId): @@ -155,7 +153,7 @@ class Person(NamedThing): """ A person (alive, dead, undead, or fictional). """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCHEMA.Person class_class_curie: ClassVar[str] = "schema:Person" @@ -168,13 +166,13 @@ class Person(NamedThing): age_in_years: Optional[int] = None gender: Optional[Union[str, "GenderType"]] = None current_address: Optional[Union[dict, "Address"]] = None - has_employment_history: Optional[Union[Union[dict, "EmploymentEvent"], List[Union[dict, "EmploymentEvent"]]]] = empty_list() - has_familial_relationships: Optional[Union[Union[dict, "FamilialRelationship"], List[Union[dict, "FamilialRelationship"]]]] = empty_list() - has_interpersonal_relationships: Optional[Union[Union[dict, "InterPersonalRelationship"], List[Union[dict, "InterPersonalRelationship"]]]] = empty_list() - has_medical_history: Optional[Union[Union[dict, "MedicalEvent"], List[Union[dict, "MedicalEvent"]]]] = empty_list() - aliases: Optional[Union[str, List[str]]] = empty_list() + has_employment_history: Optional[Union[Union[dict, "EmploymentEvent"], list[Union[dict, "EmploymentEvent"]]]] = empty_list() + has_familial_relationships: Optional[Union[Union[dict, "FamilialRelationship"], list[Union[dict, "FamilialRelationship"]]]] = empty_list() + has_interpersonal_relationships: Optional[Union[Union[dict, "InterPersonalRelationship"], list[Union[dict, "InterPersonalRelationship"]]]] = empty_list() + has_medical_history: Optional[Union[Union[dict, "MedicalEvent"], list[Union[dict, "MedicalEvent"]]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, PersonId): @@ -223,16 +221,16 @@ class HasAliases(YAMLRoot): """ A mixin applied to any class that can have aliases/alternateNames """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.HasAliases class_class_curie: ClassVar[str] = "personinfo:HasAliases" class_name: ClassVar[str] = "HasAliases" class_model_uri: ClassVar[URIRef] = PERSONINFO.HasAliases - aliases: Optional[Union[str, List[str]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] @@ -245,7 +243,7 @@ class Organization(NamedThing): """ An organization such as a company or university """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCHEMA.Organization class_class_curie: ClassVar[str] = "schema:Organization" @@ -256,12 +254,12 @@ class Organization(NamedThing): mission_statement: Optional[str] = None founding_date: Optional[str] = None founding_location: Optional[Union[str, PlaceId]] = None - categories: Optional[Union[Union[str, "OrganizationType"], List[Union[str, "OrganizationType"]]]] = empty_list() + categories: Optional[Union[Union[str, "OrganizationType"], list[Union[str, "OrganizationType"]]]] = empty_list() score: Optional[Decimal] = None min_salary: Optional[Union[Decimal, SalaryType]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, OrganizationId): @@ -295,7 +293,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Place(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Place class_class_curie: ClassVar[str] = "personinfo:Place" @@ -305,9 +303,9 @@ class Place(YAMLRoot): id: Union[str, PlaceId] = None name: Optional[str] = None depicted_by: Optional[Union[str, ImageURL]] = None - aliases: Optional[Union[str, List[str]]] = empty_list() + aliases: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, PlaceId): @@ -328,7 +326,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Address(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCHEMA.PostalAddress class_class_curie: ClassVar[str] = "schema:PostalAddress" @@ -339,7 +337,7 @@ class Address(YAMLRoot): city: Optional[str] = None postal_code: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.street is not None and not isinstance(self.street, str): self.street = str(self.street) @@ -354,7 +352,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Event(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Event class_class_curie: ClassVar[str] = "personinfo:Event" @@ -366,7 +364,7 @@ class Event(YAMLRoot): duration: Optional[float] = None is_current: Optional[Union[bool, Bool]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.started_at_time is not None and not isinstance(self.started_at_time, XSDDate): self.started_at_time = XSDDate(self.started_at_time) @@ -384,7 +382,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Concept(NamedThing): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Concept class_class_curie: ClassVar[str] = "personinfo:Concept" @@ -393,9 +391,9 @@ class Concept(NamedThing): id: Union[str, ConceptId] = None code_system: Optional[Union[str, CodeSystemId]] = None - mappings: Optional[Union[Union[str, CrossReference], List[Union[str, CrossReference]]]] = empty_list() + mappings: Optional[Union[Union[str, CrossReference], list[Union[str, CrossReference]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, ConceptId): @@ -413,7 +411,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class DiagnosisConcept(Concept): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.DiagnosisConcept class_class_curie: ClassVar[str] = "personinfo:DiagnosisConcept" @@ -422,7 +420,7 @@ class DiagnosisConcept(Concept): id: Union[str, DiagnosisConceptId] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, DiagnosisConceptId): @@ -433,7 +431,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class ProcedureConcept(Concept): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.ProcedureConcept class_class_curie: ClassVar[str] = "personinfo:ProcedureConcept" @@ -443,7 +441,7 @@ class ProcedureConcept(Concept): id: Union[str, ProcedureConceptId] = None subtype: Optional[Union[str, ConceptId]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, ProcedureConceptId): @@ -457,7 +455,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class OperationProcedureConcept(ProcedureConcept): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.OperationProcedureConcept class_class_curie: ClassVar[str] = "personinfo:OperationProcedureConcept" @@ -466,7 +464,7 @@ class OperationProcedureConcept(ProcedureConcept): id: Union[str, OperationProcedureConceptId] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, OperationProcedureConceptId): @@ -477,7 +475,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class ImagingProcedureConcept(ProcedureConcept): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.ImagingProcedureConcept class_class_curie: ClassVar[str] = "personinfo:ImagingProcedureConcept" @@ -486,7 +484,7 @@ class ImagingProcedureConcept(ProcedureConcept): id: Union[str, ImagingProcedureConceptId] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, ImagingProcedureConceptId): @@ -497,7 +495,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class CodeSystem(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.CodeSystem class_class_curie: ClassVar[str] = "personinfo:CodeSystem" @@ -507,7 +505,7 @@ class CodeSystem(YAMLRoot): id: Union[str, CodeSystemId] = None name: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, CodeSystemId): @@ -521,7 +519,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Relationship(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Relationship class_class_curie: ClassVar[str] = "personinfo:Relationship" @@ -533,7 +531,7 @@ class Relationship(YAMLRoot): related_to: Optional[Union[str, NamedThingId]] = None type: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.started_at_time is not None and not isinstance(self.started_at_time, XSDDate): self.started_at_time = XSDDate(self.started_at_time) @@ -551,7 +549,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class FamilialRelationship(Relationship): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.FamilialRelationship class_class_curie: ClassVar[str] = "personinfo:FamilialRelationship" @@ -561,7 +559,7 @@ class FamilialRelationship(Relationship): type: Union[str, "FamilialRelationshipType"] = None related_to: Union[str, PersonId] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.type): self.MissingRequiredField("type") if not isinstance(self.type, FamilialRelationshipType): @@ -577,7 +575,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class InterPersonalRelationship(Relationship): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.InterPersonalRelationship class_class_curie: ClassVar[str] = "personinfo:InterPersonalRelationship" @@ -587,7 +585,7 @@ class InterPersonalRelationship(Relationship): type: str = None related_to: Union[str, PersonId] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.type): self.MissingRequiredField("type") if not isinstance(self.type, str): @@ -603,7 +601,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class EmploymentEvent(Event): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.EmploymentEvent class_class_curie: ClassVar[str] = "personinfo:EmploymentEvent" @@ -613,7 +611,7 @@ class EmploymentEvent(Event): employed_at: Optional[Union[str, OrganizationId]] = None salary: Optional[Union[Decimal, SalaryType]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.employed_at is not None and not isinstance(self.employed_at, OrganizationId): self.employed_at = OrganizationId(self.employed_at) @@ -625,7 +623,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class MedicalEvent(Event): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.MedicalEvent class_class_curie: ClassVar[str] = "personinfo:MedicalEvent" @@ -636,7 +634,7 @@ class MedicalEvent(Event): diagnosis: Optional[Union[dict, DiagnosisConcept]] = None procedure: Optional[Union[dict, ProcedureConcept]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.in_location is not None and not isinstance(self.in_location, PlaceId): self.in_location = PlaceId(self.in_location) @@ -651,7 +649,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class WithLocation(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.WithLocation class_class_curie: ClassVar[str] = "personinfo:WithLocation" @@ -660,7 +658,7 @@ class WithLocation(YAMLRoot): in_location: Optional[Union[str, PlaceId]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.in_location is not None and not isinstance(self.in_location, PlaceId): self.in_location = PlaceId(self.in_location) @@ -669,17 +667,17 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Container(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Container class_class_curie: ClassVar[str] = "personinfo:Container" class_name: ClassVar[str] = "Container" class_model_uri: ClassVar[URIRef] = PERSONINFO.Container - persons: Optional[Union[Dict[Union[str, PersonId], Union[dict, Person]], List[Union[dict, Person]]]] = empty_dict() - organizations: Optional[Union[Dict[Union[str, OrganizationId], Union[dict, Organization]], List[Union[dict, Organization]]]] = empty_dict() + persons: Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]] = empty_dict() + organizations: Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_list(slot_name="persons", slot_type=Person, key_name="id", keyed=True) self._normalize_inlined_as_dict(slot_name="organizations", slot_type=Organization, key_name="id", keyed=True) @@ -800,16 +798,16 @@ class slots: model_uri=PERSONINFO.is_current, domain=None, range=Optional[Union[bool, Bool]]) slots.has_employment_history = Slot(uri=PERSONINFO.has_employment_history, name="has_employment_history", curie=PERSONINFO.curie('has_employment_history'), - model_uri=PERSONINFO.has_employment_history, domain=None, range=Optional[Union[Union[dict, EmploymentEvent], List[Union[dict, EmploymentEvent]]]]) + model_uri=PERSONINFO.has_employment_history, domain=None, range=Optional[Union[Union[dict, EmploymentEvent], list[Union[dict, EmploymentEvent]]]]) slots.has_medical_history = Slot(uri=PERSONINFO.has_medical_history, name="has_medical_history", curie=PERSONINFO.curie('has_medical_history'), - model_uri=PERSONINFO.has_medical_history, domain=None, range=Optional[Union[Union[dict, MedicalEvent], List[Union[dict, MedicalEvent]]]]) + model_uri=PERSONINFO.has_medical_history, domain=None, range=Optional[Union[Union[dict, MedicalEvent], list[Union[dict, MedicalEvent]]]]) slots.has_familial_relationships = Slot(uri=PERSONINFO.has_familial_relationships, name="has_familial_relationships", curie=PERSONINFO.curie('has_familial_relationships'), - model_uri=PERSONINFO.has_familial_relationships, domain=None, range=Optional[Union[Union[dict, FamilialRelationship], List[Union[dict, FamilialRelationship]]]]) + model_uri=PERSONINFO.has_familial_relationships, domain=None, range=Optional[Union[Union[dict, FamilialRelationship], list[Union[dict, FamilialRelationship]]]]) slots.has_interpersonal_relationships = Slot(uri=PERSONINFO.has_interpersonal_relationships, name="has_interpersonal_relationships", curie=PERSONINFO.curie('has_interpersonal_relationships'), - model_uri=PERSONINFO.has_interpersonal_relationships, domain=None, range=Optional[Union[Union[dict, InterPersonalRelationship], List[Union[dict, InterPersonalRelationship]]]]) + model_uri=PERSONINFO.has_interpersonal_relationships, domain=None, range=Optional[Union[Union[dict, InterPersonalRelationship], list[Union[dict, InterPersonalRelationship]]]]) slots.in_location = Slot(uri=PERSONINFO.in_location, name="in location", curie=PERSONINFO.curie('in_location'), model_uri=PERSONINFO.in_location, domain=None, range=Optional[Union[str, PlaceId]]) @@ -869,7 +867,7 @@ class slots: model_uri=PERSONINFO.ended_at_time, domain=None, range=Optional[Union[str, XSDDate]]) slots.categories = Slot(uri=PERSONINFO.categories, name="categories", curie=PERSONINFO.curie('categories'), - model_uri=PERSONINFO.categories, domain=None, range=Optional[Union[str, List[str]]]) + model_uri=PERSONINFO.categories, domain=None, range=Optional[Union[str, list[str]]]) slots.salary = Slot(uri=PERSONINFO.salary, name="salary", curie=PERSONINFO.curie('salary'), model_uri=PERSONINFO.salary, domain=None, range=Optional[Union[Decimal, SalaryType]]) @@ -878,19 +876,19 @@ class slots: model_uri=PERSONINFO.min_salary, domain=None, range=Optional[Union[Decimal, SalaryType]]) slots.hasAliases__aliases = Slot(uri=PERSONINFO.aliases, name="hasAliases__aliases", curie=PERSONINFO.curie('aliases'), - model_uri=PERSONINFO.hasAliases__aliases, domain=None, range=Optional[Union[str, List[str]]]) + model_uri=PERSONINFO.hasAliases__aliases, domain=None, range=Optional[Union[str, list[str]]]) slots.concept__code_system = Slot(uri=PERSONINFO.code_system, name="concept__code_system", curie=PERSONINFO.curie('code_system'), model_uri=PERSONINFO.concept__code_system, domain=None, range=Optional[Union[str, CodeSystemId]]) slots.concept__mappings = Slot(uri=SKOS.exactMatch, name="concept__mappings", curie=SKOS.curie('exactMatch'), - model_uri=PERSONINFO.concept__mappings, domain=None, range=Optional[Union[Union[str, CrossReference], List[Union[str, CrossReference]]]]) + model_uri=PERSONINFO.concept__mappings, domain=None, range=Optional[Union[Union[str, CrossReference], list[Union[str, CrossReference]]]]) slots.container__persons = Slot(uri=PERSONINFO.persons, name="container__persons", curie=PERSONINFO.curie('persons'), - model_uri=PERSONINFO.container__persons, domain=None, range=Optional[Union[Dict[Union[str, PersonId], Union[dict, Person]], List[Union[dict, Person]]]]) + model_uri=PERSONINFO.container__persons, domain=None, range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]]) slots.container__organizations = Slot(uri=PERSONINFO.organizations, name="container__organizations", curie=PERSONINFO.curie('organizations'), - model_uri=PERSONINFO.container__organizations, domain=None, range=Optional[Union[Dict[Union[str, OrganizationId], Union[dict, Organization]], List[Union[dict, Organization]]]]) + model_uri=PERSONINFO.container__organizations, domain=None, range=Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]]) slots.related_to = Slot(uri=PERSONINFO.related_to, name="related to", curie=PERSONINFO.curie('related_to'), model_uri=PERSONINFO.related_to, domain=None, range=Union[str, PersonId]) @@ -900,7 +898,7 @@ class slots: pattern=re.compile(r'^\S+@[\S+\.]+\S+')) slots.Organization_categories = Slot(uri=PERSONINFO.categories, name="Organization_categories", curie=PERSONINFO.curie('categories'), - model_uri=PERSONINFO.Organization_categories, domain=Organization, range=Optional[Union[Union[str, "OrganizationType"], List[Union[str, "OrganizationType"]]]]) + model_uri=PERSONINFO.Organization_categories, domain=Organization, range=Optional[Union[Union[str, "OrganizationType"], list[Union[str, "OrganizationType"]]]]) slots.FamilialRelationship_type = Slot(uri=PERSONINFO.type, name="FamilialRelationship_type", curie=PERSONINFO.curie('type'), model_uri=PERSONINFO.FamilialRelationship_type, domain=FamilialRelationship, range=Union[str, "FamilialRelationshipType"]) diff --git a/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py b/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py index fed09fa2..68aaf70c 100644 --- a/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py +++ b/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py @@ -7,22 +7,15 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.linkml_model.types import String metamodel_version = "1.7.0" version = None @@ -47,7 +40,7 @@ class PersonId(extended_str): @dataclass class Person(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SDO.Person class_class_curie: ClassVar[str] = "sdo:Person" @@ -59,7 +52,7 @@ class Person(YAMLRoot): age: Optional[str] = None phone: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, PersonId): @@ -79,16 +72,16 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Container(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.Container class_class_curie: ClassVar[str] = "personinfo:Container" class_name: ClassVar[str] = "Container" class_model_uri: ClassVar[URIRef] = PERSONINFO.Container - persons: Optional[Union[Dict[Union[str, PersonId], Union[dict, Person]], List[Union[dict, Person]]]] = empty_dict() + persons: Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_list(slot_name="persons", slot_type=Person, key_name="id", keyed=True) super().__post_init__(**kwargs) @@ -114,4 +107,4 @@ class slots: model_uri=PERSONINFO.phone, domain=None, range=Optional[str]) slots.container__persons = Slot(uri=PERSONINFO.persons, name="container__persons", curie=PERSONINFO.curie('persons'), - model_uri=PERSONINFO.container__persons, domain=None, range=Optional[Union[Dict[Union[str, PersonId], Union[dict, Person]], List[Union[dict, Person]]]]) + model_uri=PERSONINFO.container__persons, domain=None, range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]]) diff --git a/tests/test_loaders_dumpers/models/phenopackets.py b/tests/test_loaders_dumpers/models/phenopackets.py index 255a4578..0b2446ca 100644 --- a/tests/test_loaders_dumpers/models/phenopackets.py +++ b/tests/test_loaders_dumpers/models/phenopackets.py @@ -7,22 +7,18 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from jsonasobj2 import as_dict +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_list, empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.linkml_model.types import Boolean, Double, Integer, String from linkml_runtime.utils.metamodelcore import Bool metamodel_version = "1.7.0" @@ -73,7 +69,7 @@ class Cohort(YAMLRoot): """ A group of individuals related in some phenotypic or genotypic aspect. """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PHENOPACKETS.Cohort class_class_curie: ClassVar[str] = "phenopackets:Cohort" @@ -82,11 +78,11 @@ class Cohort(YAMLRoot): metaData: Union[dict, "MetaData"] = None description: Optional[str] = None - files: Optional[Union[Union[dict, "File"], List[Union[dict, "File"]]]] = empty_list() + files: Optional[Union[Union[dict, "File"], list[Union[dict, "File"]]]] = empty_list() id: Optional[str] = None - members: Optional[Union[Union[dict, "Phenopacket"], List[Union[dict, "Phenopacket"]]]] = empty_list() + members: Optional[Union[Union[dict, "Phenopacket"], list[Union[dict, "Phenopacket"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.metaData): self.MissingRequiredField("metaData") if not isinstance(self.metaData, MetaData): @@ -114,7 +110,7 @@ class Family(YAMLRoot): InterpretationRequestRD https://github.com/genomicsengland/GelReportModels/blob/master/schemas/IDLs/org.gel.models.report.avro/5.0.0/InterpretationRequestRD.avdl """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PHENOPACKETS.Family class_class_curie: ClassVar[str] = "phenopackets:Family" @@ -123,13 +119,13 @@ class Family(YAMLRoot): metaData: Union[dict, "MetaData"] = None consanguinousParents: Optional[Union[bool, Bool]] = None - files: Optional[Union[Union[dict, "File"], List[Union[dict, "File"]]]] = empty_list() + files: Optional[Union[Union[dict, "File"], list[Union[dict, "File"]]]] = empty_list() id: Optional[str] = None pedigree: Optional[Union[dict, "Pedigree"]] = None proband: Optional[Union[dict, "Phenopacket"]] = None - relatives: Optional[Union[Union[dict, "Phenopacket"], List[Union[dict, "Phenopacket"]]]] = empty_list() + relatives: Optional[Union[Union[dict, "Phenopacket"], list[Union[dict, "Phenopacket"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.metaData): self.MissingRequiredField("metaData") if not isinstance(self.metaData, MetaData): @@ -164,7 +160,7 @@ class Phenopacket(YAMLRoot): expected that the resources sharing the phenopackets will define and enforce their own semantics and level of requirements for included fields. """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PHENOPACKETS.Phenopacket class_class_curie: ClassVar[str] = "phenopackets:Phenopacket" @@ -172,17 +168,17 @@ class Phenopacket(YAMLRoot): class_model_uri: ClassVar[URIRef] = PHENOPACKETS.Phenopacket metaData: Union[dict, "MetaData"] = None - biosamples: Optional[Union[Union[dict, "Biosample"], List[Union[dict, "Biosample"]]]] = empty_list() - diseases: Optional[Union[Union[dict, "Disease"], List[Union[dict, "Disease"]]]] = empty_list() - files: Optional[Union[Union[dict, "File"], List[Union[dict, "File"]]]] = empty_list() + biosamples: Optional[Union[Union[dict, "Biosample"], list[Union[dict, "Biosample"]]]] = empty_list() + diseases: Optional[Union[Union[dict, "Disease"], list[Union[dict, "Disease"]]]] = empty_list() + files: Optional[Union[Union[dict, "File"], list[Union[dict, "File"]]]] = empty_list() id: Optional[str] = None - interpretations: Optional[Union[Union[dict, "Interpretation"], List[Union[dict, "Interpretation"]]]] = empty_list() - measurements: Optional[Union[Union[dict, "Measurement"], List[Union[dict, "Measurement"]]]] = empty_list() - medicalActions: Optional[Union[Union[dict, "MedicalAction"], List[Union[dict, "MedicalAction"]]]] = empty_list() - phenotypicFeatures: Optional[Union[Union[dict, "PhenotypicFeature"], List[Union[dict, "PhenotypicFeature"]]]] = empty_list() + interpretations: Optional[Union[Union[dict, "Interpretation"], list[Union[dict, "Interpretation"]]]] = empty_list() + measurements: Optional[Union[Union[dict, "Measurement"], list[Union[dict, "Measurement"]]]] = empty_list() + medicalActions: Optional[Union[Union[dict, "MedicalAction"], list[Union[dict, "MedicalAction"]]]] = empty_list() + phenotypicFeatures: Optional[Union[Union[dict, "PhenotypicFeature"], list[Union[dict, "PhenotypicFeature"]]]] = empty_list() subject: Optional[Union[dict, "Individual"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.metaData): self.MissingRequiredField("metaData") if not isinstance(self.metaData, MetaData): @@ -231,7 +227,7 @@ class Age(YAMLRoot): See http://build.fhir.org/datatypes and http://build.fhir.org/condition-definitions.html#Condition.onset_x_ In FHIR this is represented as a UCUM measurement - http://unitsofmeasure.org/trac/ """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.Age class_class_curie: ClassVar[str] = "base:Age" @@ -240,7 +236,7 @@ class Age(YAMLRoot): iso8601duration: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.iso8601duration is not None and not isinstance(self.iso8601duration, str): self.iso8601duration = str(self.iso8601duration) @@ -249,7 +245,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class AgeRange(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.AgeRange class_class_curie: ClassVar[str] = "base:AgeRange" @@ -259,7 +255,7 @@ class AgeRange(YAMLRoot): end: Optional[Union[dict, Age]] = None start: Optional[Union[dict, Age]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.end is not None and not isinstance(self.end, Age): self.end = Age(**as_dict(self.end)) @@ -270,7 +266,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): class Dictionary(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.Dictionary class_class_curie: ClassVar[str] = "base:Dictionary" @@ -283,7 +279,7 @@ class Evidence(YAMLRoot): """ FHIR mapping: Condition.evidence (https://www.hl7.org/fhir/condition-definitions.html#Condition.evidence) """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.Evidence class_class_curie: ClassVar[str] = "base:Evidence" @@ -293,7 +289,7 @@ class Evidence(YAMLRoot): evidenceCode: Optional[Union[dict, "OntologyClass"]] = None reference: Optional[Union[dict, "ExternalReference"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.evidenceCode is not None and not isinstance(self.evidenceCode, OntologyClass): self.evidenceCode = OntologyClass(**as_dict(self.evidenceCode)) @@ -308,7 +304,7 @@ class ExternalReference(YAMLRoot): """ FHIR mapping: Reference (https://www.hl7.org/fhir/references.html) """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.ExternalReference class_class_curie: ClassVar[str] = "base:ExternalReference" @@ -319,7 +315,7 @@ class ExternalReference(YAMLRoot): id: Optional[str] = None reference: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) @@ -334,7 +330,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class File(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.File class_class_curie: ClassVar[str] = "base:File" @@ -345,7 +341,7 @@ class File(YAMLRoot): individualToFileIdentifiers: Optional[Union[dict, Dictionary]] = None uri: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.fileAttributes is not None and not isinstance(self.fileAttributes, Dictionary): self.fileAttributes = Dictionary() @@ -360,7 +356,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class GestationalAge(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.GestationalAge class_class_curie: ClassVar[str] = "base:GestationalAge" @@ -370,7 +366,7 @@ class GestationalAge(YAMLRoot): days: Optional[int] = None weeks: Optional[int] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.days is not None and not isinstance(self.days, int): self.days = int(self.days) @@ -387,7 +383,7 @@ class OntologyClass(YAMLRoot): (http://www.hl7.org/fhir/datatypes.html#CodeableConcept) see also Coding (http://www.hl7.org/fhir/datatypes.html#Coding) """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.OntologyClass class_class_curie: ClassVar[str] = "base:OntologyClass" @@ -397,7 +393,7 @@ class OntologyClass(YAMLRoot): id: Union[str, OntologyClassId] = None label: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.id): self.MissingRequiredField("id") if not isinstance(self.id, OntologyClassId): @@ -418,7 +414,7 @@ class Procedure(YAMLRoot): "body_site":{"UBERON:0003403": "skin of forearm"}} - a punch biopsy of the skin from the forearm FHIR mapping: Procedure (https://www.hl7.org/fhir/procedure.html) """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.Procedure class_class_curie: ClassVar[str] = "base:Procedure" @@ -429,7 +425,7 @@ class Procedure(YAMLRoot): code: Optional[Union[dict, OntologyClass]] = None performed: Optional[Union[dict, "TimeElement"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.bodySite is not None and not isinstance(self.bodySite, OntologyClass): self.bodySite = OntologyClass(**as_dict(self.bodySite)) @@ -444,7 +440,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class TimeElement(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.TimeElement class_class_curie: ClassVar[str] = "base:TimeElement" @@ -458,7 +454,7 @@ class TimeElement(YAMLRoot): ontologyClass: Optional[Union[dict, OntologyClass]] = None timestamp: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.age is not None and not isinstance(self.age, Age): self.age = Age(**as_dict(self.age)) @@ -482,7 +478,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class TimeInterval(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.TimeInterval class_class_curie: ClassVar[str] = "base:TimeInterval" @@ -492,7 +488,7 @@ class TimeInterval(YAMLRoot): end: Optional[str] = None start: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.end is not None and not isinstance(self.end, str): self.end = str(self.end) @@ -512,7 +508,7 @@ class Biosample(YAMLRoot): genomic array as well as RNA-seq experiments) may refer to the same Biosample. FHIR mapping: Specimen (http://www.hl7.org/fhir/specimen.html). """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BIOSAMPLE.Biosample class_class_curie: ClassVar[str] = "biosample:Biosample" @@ -521,16 +517,16 @@ class Biosample(YAMLRoot): derivedFromId: Optional[str] = None description: Optional[str] = None - diagnosticMarkers: Optional[Union[Dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], List[Union[dict, OntologyClass]]]] = empty_dict() - files: Optional[Union[Union[dict, File], List[Union[dict, File]]]] = empty_list() + diagnosticMarkers: Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]] = empty_dict() + files: Optional[Union[Union[dict, File], list[Union[dict, File]]]] = empty_list() histologicalDiagnosis: Optional[Union[dict, OntologyClass]] = None id: Optional[str] = None individualId: Optional[str] = None materialSample: Optional[Union[dict, OntologyClass]] = None - measurements: Optional[Union[Union[dict, "Measurement"], List[Union[dict, "Measurement"]]]] = empty_list() + measurements: Optional[Union[Union[dict, "Measurement"], list[Union[dict, "Measurement"]]]] = empty_list() pathologicalStage: Optional[Union[dict, OntologyClass]] = None - pathologicalTnmFinding: Optional[Union[Dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], List[Union[dict, OntologyClass]]]] = empty_dict() - phenotypicFeatures: Optional[Union[Union[dict, "PhenotypicFeature"], List[Union[dict, "PhenotypicFeature"]]]] = empty_list() + pathologicalTnmFinding: Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]] = empty_dict() + phenotypicFeatures: Optional[Union[Union[dict, "PhenotypicFeature"], list[Union[dict, "PhenotypicFeature"]]]] = empty_list() procedure: Optional[Union[dict, Procedure]] = None sampleProcessing: Optional[Union[dict, OntologyClass]] = None sampleStorage: Optional[Union[dict, OntologyClass]] = None @@ -541,7 +537,7 @@ class Biosample(YAMLRoot): tumorGrade: Optional[Union[dict, OntologyClass]] = None tumorProgression: Optional[Union[dict, OntologyClass]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.derivedFromId is not None and not isinstance(self.derivedFromId, str): self.derivedFromId = str(self.derivedFromId) @@ -614,15 +610,15 @@ class Disease(YAMLRoot): """ Message to indicate a disease (diagnosis) and its recorded onset. """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = DISEASE.Disease class_class_curie: ClassVar[str] = "disease:Disease" class_name: ClassVar[str] = "Disease" class_model_uri: ClassVar[URIRef] = PHENOPACKETS.Disease - clinicalTnmFinding: Optional[Union[Dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], List[Union[dict, OntologyClass]]]] = empty_dict() - diseaseStage: Optional[Union[Dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], List[Union[dict, OntologyClass]]]] = empty_dict() + clinicalTnmFinding: Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]] = empty_dict() + diseaseStage: Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]] = empty_dict() excluded: Optional[Union[bool, Bool]] = None laterality: Optional[Union[dict, OntologyClass]] = None onset: Optional[Union[dict, TimeElement]] = None @@ -630,7 +626,7 @@ class Disease(YAMLRoot): resolution: Optional[Union[dict, TimeElement]] = None term: Optional[Union[dict, OntologyClass]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_dict(slot_name="clinicalTnmFinding", slot_type=OntologyClass, key_name="id", keyed=True) self._normalize_inlined_as_dict(slot_name="diseaseStage", slot_type=OntologyClass, key_name="id", keyed=True) @@ -658,7 +654,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Diagnosis(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = INTERPRETATION.Diagnosis class_class_curie: ClassVar[str] = "interpretation:Diagnosis" @@ -666,9 +662,9 @@ class Diagnosis(YAMLRoot): class_model_uri: ClassVar[URIRef] = PHENOPACKETS.Diagnosis disease: Optional[Union[dict, OntologyClass]] = None - genomicInterpretations: Optional[Union[Union[dict, "GenomicInterpretation"], List[Union[dict, "GenomicInterpretation"]]]] = empty_list() + genomicInterpretations: Optional[Union[Union[dict, "GenomicInterpretation"], list[Union[dict, "GenomicInterpretation"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.disease is not None and not isinstance(self.disease, OntologyClass): self.disease = OntologyClass(**as_dict(self.disease)) @@ -685,7 +681,7 @@ class GenomicInterpretation(YAMLRoot): A statement about the contribution of a genomic element towards the observed phenotype. Note that this does not intend to encode any knowledge or results of specific computations. """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = INTERPRETATION.GenomicInterpretation class_class_curie: ClassVar[str] = "interpretation:GenomicInterpretation" @@ -697,7 +693,7 @@ class GenomicInterpretation(YAMLRoot): subjectOrBiosampleId: Optional[str] = None variantInterpretation: Optional[Union[dict, "VariantInterpretation"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.gene is not None and not isinstance(self.gene, GeneDescriptor): self.gene = GeneDescriptor(**as_dict(self.gene)) @@ -715,7 +711,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Interpretation(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = INTERPRETATION.Interpretation class_class_curie: ClassVar[str] = "interpretation:Interpretation" @@ -727,7 +723,7 @@ class Interpretation(YAMLRoot): progressStatus: Optional[Union[str, "ProgressStatus"]] = None summary: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.diagnosis is not None and not isinstance(self.diagnosis, Diagnosis): self.diagnosis = Diagnosis(**as_dict(self.diagnosis)) @@ -745,7 +741,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class VariantInterpretation(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = INTERPRETATION.VariantInterpretation class_class_curie: ClassVar[str] = "interpretation:VariantInterpretation" @@ -756,7 +752,7 @@ class VariantInterpretation(YAMLRoot): therapeuticActionability: Optional[Union[str, "TherapeuticActionability"]] = None variationDescriptor: Optional[Union[dict, "VariationDescriptor"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.acmgPathogenicityClassification is not None and not isinstance(self.acmgPathogenicityClassification, AcmgPathogenicityClassification): self.acmgPathogenicityClassification = AcmgPathogenicityClassification(self.acmgPathogenicityClassification) @@ -775,14 +771,14 @@ class Individual(YAMLRoot): An individual (or subject) typically corresponds to an individual human or another organism. FHIR mapping: Patient (https://www.hl7.org/fhir/patient.html). """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = INDIVIDUAL.Individual class_class_curie: ClassVar[str] = "individual:Individual" class_name: ClassVar[str] = "Individual" class_model_uri: ClassVar[URIRef] = PHENOPACKETS.Individual - alternateIds: Optional[Union[str, List[str]]] = empty_list() + alternateIds: Optional[Union[str, list[str]]] = empty_list() dateOfBirth: Optional[str] = None gender: Optional[Union[dict, OntologyClass]] = None id: Optional[str] = None @@ -792,7 +788,7 @@ class Individual(YAMLRoot): timeAtLastEncounter: Optional[Union[dict, TimeElement]] = None vitalStatus: Optional[Union[dict, "VitalStatus"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.alternateIds, list): self.alternateIds = [self.alternateIds] if self.alternateIds is not None else [] self.alternateIds = [v if isinstance(v, str) else str(v) for v in self.alternateIds] @@ -826,7 +822,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class VitalStatus(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = INDIVIDUAL.VitalStatus class_class_curie: ClassVar[str] = "individual:VitalStatus" @@ -838,7 +834,7 @@ class VitalStatus(YAMLRoot): survivalTimeInDays: Optional[int] = None timeOfDeath: Optional[Union[dict, TimeElement]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.causeOfDeath is not None and not isinstance(self.causeOfDeath, OntologyClass): self.causeOfDeath = OntologyClass(**as_dict(self.causeOfDeath)) @@ -856,16 +852,16 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class ComplexValue(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEASUREMENT.ComplexValue class_class_curie: ClassVar[str] = "measurement:ComplexValue" class_name: ClassVar[str] = "ComplexValue" class_model_uri: ClassVar[URIRef] = PHENOPACKETS.ComplexValue - typedQuantities: Optional[Union[Union[dict, "TypedQuantity"], List[Union[dict, "TypedQuantity"]]]] = empty_list() + typedQuantities: Optional[Union[Union[dict, "TypedQuantity"], list[Union[dict, "TypedQuantity"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.typedQuantities, list): self.typedQuantities = [self.typedQuantities] if self.typedQuantities is not None else [] self.typedQuantities = [v if isinstance(v, TypedQuantity) else TypedQuantity(**as_dict(v)) for v in self.typedQuantities] @@ -878,7 +874,7 @@ class Measurement(YAMLRoot): """ FHIR mapping: Observation (https://www.hl7.org/fhir/observation.html) """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEASUREMENT.Measurement class_class_curie: ClassVar[str] = "measurement:Measurement" @@ -892,7 +888,7 @@ class Measurement(YAMLRoot): timeObserved: Optional[Union[dict, TimeElement]] = None value: Optional[Union[dict, "Value"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.assay is not None and not isinstance(self.assay, OntologyClass): self.assay = OntologyClass(**as_dict(self.assay)) @@ -916,7 +912,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Quantity(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEASUREMENT.Quantity class_class_curie: ClassVar[str] = "measurement:Quantity" @@ -927,7 +923,7 @@ class Quantity(YAMLRoot): unit: Optional[Union[dict, OntologyClass]] = None value: Optional[float] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.referenceRange is not None and not isinstance(self.referenceRange, ReferenceRange): self.referenceRange = ReferenceRange(**as_dict(self.referenceRange)) @@ -942,7 +938,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class ReferenceRange(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEASUREMENT.ReferenceRange class_class_curie: ClassVar[str] = "measurement:ReferenceRange" @@ -953,7 +949,7 @@ class ReferenceRange(YAMLRoot): low: Optional[float] = None unit: Optional[Union[dict, OntologyClass]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.high is not None and not isinstance(self.high, float): self.high = float(self.high) @@ -972,7 +968,7 @@ class TypedQuantity(YAMLRoot): For complex measurements, such as blood pressure where more than one component quantity is required to describe the measurement """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEASUREMENT.TypedQuantity class_class_curie: ClassVar[str] = "measurement:TypedQuantity" @@ -982,7 +978,7 @@ class TypedQuantity(YAMLRoot): quantity: Optional[Union[dict, Quantity]] = None type: Optional[Union[dict, OntologyClass]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.quantity is not None and not isinstance(self.quantity, Quantity): self.quantity = Quantity(**as_dict(self.quantity)) @@ -994,7 +990,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Value(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEASUREMENT.Value class_class_curie: ClassVar[str] = "measurement:Value" @@ -1004,7 +1000,7 @@ class Value(YAMLRoot): ontologyClass: Optional[Union[dict, OntologyClass]] = None quantity: Optional[Union[dict, Quantity]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.ontologyClass is not None and not isinstance(self.ontologyClass, OntologyClass): self.ontologyClass = OntologyClass(**as_dict(self.ontologyClass)) @@ -1019,7 +1015,7 @@ class DoseInterval(YAMLRoot): """ e.g. 50mg/ml 3 times daily for two weeks """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEDICAL_ACTION.DoseInterval class_class_curie: ClassVar[str] = "medical_action:DoseInterval" @@ -1030,7 +1026,7 @@ class DoseInterval(YAMLRoot): quantity: Optional[Union[dict, Quantity]] = None scheduleFrequency: Optional[Union[dict, OntologyClass]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.interval is not None and not isinstance(self.interval, TimeInterval): self.interval = TimeInterval(**as_dict(self.interval)) @@ -1048,14 +1044,14 @@ class MedicalAction(YAMLRoot): """ medication, procedure, other actions taken for clinical management """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEDICAL_ACTION.MedicalAction class_class_curie: ClassVar[str] = "medical_action:MedicalAction" class_name: ClassVar[str] = "MedicalAction" class_model_uri: ClassVar[URIRef] = PHENOPACKETS.MedicalAction - adverseEvents: Optional[Union[Dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], List[Union[dict, OntologyClass]]]] = empty_dict() + adverseEvents: Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]] = empty_dict() procedure: Optional[Union[dict, Procedure]] = None radiationTherapy: Optional[Union[dict, "RadiationTherapy"]] = None responseToTreatment: Optional[Union[dict, OntologyClass]] = None @@ -1065,7 +1061,7 @@ class MedicalAction(YAMLRoot): treatmentTarget: Optional[Union[dict, OntologyClass]] = None treatmentTerminationReason: Optional[Union[dict, OntologyClass]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_dict(slot_name="adverseEvents", slot_type=OntologyClass, key_name="id", keyed=True) if self.procedure is not None and not isinstance(self.procedure, Procedure): @@ -1100,7 +1096,7 @@ class RadiationTherapy(YAMLRoot): """ RadiationTherapy """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEDICAL_ACTION.RadiationTherapy class_class_curie: ClassVar[str] = "medical_action:RadiationTherapy" @@ -1112,7 +1108,7 @@ class RadiationTherapy(YAMLRoot): fractions: int = None modality: Union[dict, OntologyClass] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.bodySite): self.MissingRequiredField("bodySite") if not isinstance(self.bodySite, OntologyClass): @@ -1141,7 +1137,7 @@ class TherapeuticRegimen(YAMLRoot): """ ARGO mapping radiation::radiation_therapy_type (missing) """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEDICAL_ACTION.TherapeuticRegimen class_class_curie: ClassVar[str] = "medical_action:TherapeuticRegimen" @@ -1154,7 +1150,7 @@ class TherapeuticRegimen(YAMLRoot): regimenStatus: Optional[Union[str, "RegimenStatus"]] = None startTime: Optional[Union[dict, TimeElement]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.endTime is not None and not isinstance(self.endTime, TimeElement): self.endTime = TimeElement(**as_dict(self.endTime)) @@ -1178,7 +1174,7 @@ class Treatment(YAMLRoot): """ ARGO mapping treatment::is_primary_treatment (missing) treatment with an agent, such as a drug """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEDICAL_ACTION.Treatment class_class_curie: ClassVar[str] = "medical_action:Treatment" @@ -1187,11 +1183,11 @@ class Treatment(YAMLRoot): agent: Optional[Union[dict, OntologyClass]] = None cumulativeDose: Optional[Union[dict, Quantity]] = None - doseIntervals: Optional[Union[Union[dict, DoseInterval], List[Union[dict, DoseInterval]]]] = empty_list() + doseIntervals: Optional[Union[Union[dict, DoseInterval], list[Union[dict, DoseInterval]]]] = empty_list() drugType: Optional[Union[str, "DrugType"]] = None routeOfAdministration: Optional[Union[dict, OntologyClass]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.agent is not None and not isinstance(self.agent, OntologyClass): self.agent = OntologyClass(**as_dict(self.agent)) @@ -1213,7 +1209,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class MetaData(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = META_DATA.MetaData class_class_curie: ClassVar[str] = "meta_data:MetaData" @@ -1222,13 +1218,13 @@ class MetaData(YAMLRoot): created: Optional[str] = None createdBy: Optional[str] = None - externalReferences: Optional[Union[Union[dict, ExternalReference], List[Union[dict, ExternalReference]]]] = empty_list() + externalReferences: Optional[Union[Union[dict, ExternalReference], list[Union[dict, ExternalReference]]]] = empty_list() phenopacketSchemaVersion: Optional[str] = None - resources: Optional[Union[Union[dict, "Resource"], List[Union[dict, "Resource"]]]] = empty_list() + resources: Optional[Union[Union[dict, "Resource"], list[Union[dict, "Resource"]]]] = empty_list() submittedBy: Optional[str] = None - updates: Optional[Union[Union[dict, "Update"], List[Union[dict, "Update"]]]] = empty_list() + updates: Optional[Union[Union[dict, "Update"], list[Union[dict, "Update"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.created is not None and not isinstance(self.created, str): self.created = str(self.created) @@ -1260,7 +1256,7 @@ class Resource(YAMLRoot): Description of an external resource used for referencing an object. For example the resource may be an ontology such as the HPO or SNOMED. FHIR mapping: CodeSystem (http://www.hl7.org/fhir/codesystem.html) """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = META_DATA.Resource class_class_curie: ClassVar[str] = "meta_data:Resource" @@ -1274,7 +1270,7 @@ class Resource(YAMLRoot): url: Optional[str] = None version: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.id is not None and not isinstance(self.id, str): self.id = str(self.id) @@ -1302,7 +1298,7 @@ class Update(YAMLRoot): Information about when an update to a record occurred, who or what made the update and any pertinent information regarding the content and/or reason for the update """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = META_DATA.Update class_class_curie: ClassVar[str] = "meta_data:Update" @@ -1313,7 +1309,7 @@ class Update(YAMLRoot): comment: Optional[str] = None updatedBy: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.timestamp): self.MissingRequiredField("timestamp") if not isinstance(self.timestamp, str): @@ -1333,16 +1329,16 @@ class Pedigree(YAMLRoot): """ https://software.broadinstitute.org/gatk/documentation/article?id=11016 """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PEDIGREE.Pedigree class_class_curie: ClassVar[str] = "pedigree:Pedigree" class_name: ClassVar[str] = "Pedigree" class_model_uri: ClassVar[URIRef] = PHENOPACKETS.Pedigree - persons: Optional[Union[Union[dict, "Person"], List[Union[dict, "Person"]]]] = empty_list() + persons: Optional[Union[Union[dict, "Person"], list[Union[dict, "Person"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.persons, list): self.persons = [self.persons] if self.persons is not None else [] self.persons = [v if isinstance(v, Person) else Person(**as_dict(v)) for v in self.persons] @@ -1352,7 +1348,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Person(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PEDIGREE.Person class_class_curie: ClassVar[str] = "pedigree:Person" @@ -1366,7 +1362,7 @@ class Person(YAMLRoot): paternalId: Optional[str] = None sex: Optional[Union[str, "Sex"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.affectedStatus is not None and not isinstance(self.affectedStatus, AffectedStatus): self.affectedStatus = AffectedStatus(self.affectedStatus) @@ -1395,7 +1391,7 @@ class PhenotypicFeature(YAMLRoot): and frequency FHIR mapping: Condition (https://www.hl7.org/fhir/condition.html) or Observation (https://www.hl7.org/fhir/observation.html) """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PHENOTYPIC_FEATURE.PhenotypicFeature class_class_curie: ClassVar[str] = "phenotypic_feature:PhenotypicFeature" @@ -1403,15 +1399,15 @@ class PhenotypicFeature(YAMLRoot): class_model_uri: ClassVar[URIRef] = PHENOPACKETS.PhenotypicFeature description: Optional[str] = None - evidence: Optional[Union[Union[dict, Evidence], List[Union[dict, Evidence]]]] = empty_list() + evidence: Optional[Union[Union[dict, Evidence], list[Union[dict, Evidence]]]] = empty_list() excluded: Optional[Union[bool, Bool]] = None - modifiers: Optional[Union[Dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], List[Union[dict, OntologyClass]]]] = empty_dict() + modifiers: Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]] = empty_dict() onset: Optional[Union[dict, TimeElement]] = None resolution: Optional[Union[dict, TimeElement]] = None severity: Optional[Union[dict, OntologyClass]] = None type: Optional[Union[dict, OntologyClass]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) @@ -1477,7 +1473,7 @@ class Timestamp(YAMLRoot): http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D ) to obtain a formatter capable of generating timestamps in this format. """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = TIMESTAMP.Timestamp class_class_curie: ClassVar[str] = "timestamp:Timestamp" @@ -1487,7 +1483,7 @@ class Timestamp(YAMLRoot): nanos: Optional[int] = None seconds: Optional[int] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.nanos is not None and not isinstance(self.nanos, int): self.nanos = int(self.nanos) @@ -1502,7 +1498,7 @@ class Expression(YAMLRoot): """ https://vrsatile.readthedocs.io/en/latest/value_object_descriptor/vod_index.html#expression """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRSATILE.Expression class_class_curie: ClassVar[str] = "vrsatile:Expression" @@ -1513,7 +1509,7 @@ class Expression(YAMLRoot): value: Optional[str] = None version: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.syntax is not None and not isinstance(self.syntax, str): self.syntax = str(self.syntax) @@ -1531,7 +1527,7 @@ class Extension(YAMLRoot): """ https://vrsatile.readthedocs.io/en/latest/value_object_descriptor/vod_index.html#extension """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRSATILE.Extension class_class_curie: ClassVar[str] = "vrsatile:Extension" @@ -1539,9 +1535,9 @@ class Extension(YAMLRoot): class_model_uri: ClassVar[URIRef] = PHENOPACKETS.Extension name: Optional[str] = None - value: Optional[Union[Union[dict, "Any"], List[Union[dict, "Any"]]]] = empty_list() + value: Optional[Union[Union[dict, "Any"], list[Union[dict, "Any"]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.name is not None and not isinstance(self.name, str): self.name = str(self.name) @@ -1557,21 +1553,21 @@ class GeneDescriptor(YAMLRoot): """ https://vrsatile.readthedocs.io/en/latest/value_object_descriptor/vod_index.html#gene-descriptor """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRSATILE.GeneDescriptor class_class_curie: ClassVar[str] = "vrsatile:GeneDescriptor" class_name: ClassVar[str] = "GeneDescriptor" class_model_uri: ClassVar[URIRef] = PHENOPACKETS.GeneDescriptor - alternateIds: Optional[Union[str, List[str]]] = empty_list() - alternateSymbols: Optional[Union[str, List[str]]] = empty_list() + alternateIds: Optional[Union[str, list[str]]] = empty_list() + alternateSymbols: Optional[Union[str, list[str]]] = empty_list() description: Optional[str] = None symbol: Optional[str] = None valueId: Optional[str] = None - xrefs: Optional[Union[str, List[str]]] = empty_list() + xrefs: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.alternateIds, list): self.alternateIds = [self.alternateIds] if self.alternateIds is not None else [] self.alternateIds = [v if isinstance(v, str) else str(v) for v in self.alternateIds] @@ -1598,7 +1594,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class VariationDescriptor(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRSATILE.VariationDescriptor class_class_curie: ClassVar[str] = "vrsatile:VariationDescriptor" @@ -1606,10 +1602,10 @@ class VariationDescriptor(YAMLRoot): class_model_uri: ClassVar[URIRef] = PHENOPACKETS.VariationDescriptor allelicState: Optional[Union[dict, OntologyClass]] = None - alternateLabels: Optional[Union[str, List[str]]] = empty_list() + alternateLabels: Optional[Union[str, list[str]]] = empty_list() description: Optional[str] = None - expressions: Optional[Union[Union[dict, Expression], List[Union[dict, Expression]]]] = empty_list() - extensions: Optional[Union[Union[dict, Extension], List[Union[dict, Extension]]]] = empty_list() + expressions: Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]] = empty_list() + extensions: Optional[Union[Union[dict, Extension], list[Union[dict, Extension]]]] = empty_list() geneContext: Optional[Union[dict, GeneDescriptor]] = None id: Optional[str] = None label: Optional[str] = None @@ -1618,9 +1614,9 @@ class VariationDescriptor(YAMLRoot): variation: Optional[Union[dict, "Variation"]] = None vcfRecord: Optional[Union[dict, "VcfRecord"]] = None vrsRefAlleleSeq: Optional[str] = None - xrefs: Optional[Union[str, List[str]]] = empty_list() + xrefs: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.allelicState is not None and not isinstance(self.allelicState, OntologyClass): self.allelicState = OntologyClass(**as_dict(self.allelicState)) @@ -1672,7 +1668,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class VcfRecord(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRSATILE.VcfRecord class_class_curie: ClassVar[str] = "vrsatile:VcfRecord" @@ -1689,7 +1685,7 @@ class VcfRecord(YAMLRoot): qual: Optional[str] = None ref: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.alt is not None and not isinstance(self.alt, str): self.alt = str(self.alt) @@ -1741,7 +1737,7 @@ class Any(YAMLRoot): adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = ANY.Any class_class_curie: ClassVar[str] = "any:Any" @@ -1751,7 +1747,7 @@ class Any(YAMLRoot): typeUrl: Optional[str] = None value: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.typeUrl is not None and not isinstance(self.typeUrl, str): self.typeUrl = str(self.typeUrl) @@ -1763,7 +1759,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Abundance(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.Abundance class_class_curie: ClassVar[str] = "vrs:Abundance" @@ -1772,7 +1768,7 @@ class Abundance(YAMLRoot): copyNumber: Optional[Union[dict, "CopyNumber"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.copyNumber is not None and not isinstance(self.copyNumber, CopyNumber): self.copyNumber = CopyNumber(**as_dict(self.copyNumber)) @@ -1781,7 +1777,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Allele(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.Allele class_class_curie: ClassVar[str] = "vrs:Allele" @@ -1796,7 +1792,7 @@ class Allele(YAMLRoot): repeatedSequenceExpression: Optional[Union[dict, "RepeatedSequenceExpression"]] = None sequenceLocation: Optional[Union[dict, "SequenceLocation"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.chromosomeLocation is not None and not isinstance(self.chromosomeLocation, ChromosomeLocation): self.chromosomeLocation = ChromosomeLocation(**as_dict(self.chromosomeLocation)) @@ -1823,7 +1819,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class ChromosomeLocation(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.ChromosomeLocation class_class_curie: ClassVar[str] = "vrs:ChromosomeLocation" @@ -1835,7 +1831,7 @@ class ChromosomeLocation(YAMLRoot): interval: Optional[Union[dict, "CytobandInterval"]] = None speciesId: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.chr is not None and not isinstance(self.chr, str): self.chr = str(self.chr) @@ -1853,7 +1849,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class CopyNumber(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.CopyNumber class_class_curie: ClassVar[str] = "vrs:CopyNumber" @@ -1872,7 +1868,7 @@ class CopyNumber(YAMLRoot): number: Optional[Union[dict, "Number"]] = None repeatedSequenceExpression: Optional[Union[dict, "RepeatedSequenceExpression"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.allele is not None and not isinstance(self.allele, Allele): self.allele = Allele(**as_dict(self.allele)) @@ -1911,7 +1907,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class CytobandInterval(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.CytobandInterval class_class_curie: ClassVar[str] = "vrs:CytobandInterval" @@ -1921,7 +1917,7 @@ class CytobandInterval(YAMLRoot): end: Optional[str] = None start: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.end is not None and not isinstance(self.end, str): self.end = str(self.end) @@ -1933,7 +1929,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class DefiniteRange(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.DefiniteRange class_class_curie: ClassVar[str] = "vrs:DefiniteRange" @@ -1943,7 +1939,7 @@ class DefiniteRange(YAMLRoot): max: Optional[int] = None min: Optional[int] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.max is not None and not isinstance(self.max, int): self.max = int(self.max) @@ -1955,7 +1951,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class DerivedSequenceExpression(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.DerivedSequenceExpression class_class_curie: ClassVar[str] = "vrs:DerivedSequenceExpression" @@ -1965,7 +1961,7 @@ class DerivedSequenceExpression(YAMLRoot): location: Optional[Union[dict, "SequenceLocation"]] = None reverseComplement: Optional[Union[bool, Bool]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.location is not None and not isinstance(self.location, SequenceLocation): self.location = SequenceLocation(**as_dict(self.location)) @@ -1977,7 +1973,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Feature(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.Feature class_class_curie: ClassVar[str] = "vrs:Feature" @@ -1986,7 +1982,7 @@ class Feature(YAMLRoot): gene: Optional[Union[dict, "Gene"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.gene is not None and not isinstance(self.gene, Gene): self.gene = Gene(**as_dict(self.gene)) @@ -1995,7 +1991,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Gene(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.Gene class_class_curie: ClassVar[str] = "vrs:Gene" @@ -2004,7 +2000,7 @@ class Gene(YAMLRoot): geneId: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.geneId is not None and not isinstance(self.geneId, str): self.geneId = str(self.geneId) @@ -2012,7 +2008,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): class Haplotype(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.Haplotype class_class_curie: ClassVar[str] = "vrs:Haplotype" @@ -2022,7 +2018,7 @@ class Haplotype(YAMLRoot): @dataclass class IndefiniteRange(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.IndefiniteRange class_class_curie: ClassVar[str] = "vrs:IndefiniteRange" @@ -2032,7 +2028,7 @@ class IndefiniteRange(YAMLRoot): comparator: Optional[str] = None value: Optional[int] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.comparator is not None and not isinstance(self.comparator, str): self.comparator = str(self.comparator) @@ -2044,7 +2040,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class LiteralSequenceExpression(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.LiteralSequenceExpression class_class_curie: ClassVar[str] = "vrs:LiteralSequenceExpression" @@ -2053,7 +2049,7 @@ class LiteralSequenceExpression(YAMLRoot): sequence: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.sequence is not None and not isinstance(self.sequence, str): self.sequence = str(self.sequence) @@ -2062,7 +2058,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Location(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.Location class_class_curie: ClassVar[str] = "vrs:Location" @@ -2072,7 +2068,7 @@ class Location(YAMLRoot): chromosomeLocation: Optional[Union[dict, ChromosomeLocation]] = None sequenceLocation: Optional[Union[dict, "SequenceLocation"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.chromosomeLocation is not None and not isinstance(self.chromosomeLocation, ChromosomeLocation): self.chromosomeLocation = ChromosomeLocation(**as_dict(self.chromosomeLocation)) @@ -2084,7 +2080,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Member(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.Member class_class_curie: ClassVar[str] = "vrs:Member" @@ -2096,11 +2092,11 @@ class Member(YAMLRoot): curie: Optional[str] = None haplotype: Optional[Union[dict, Haplotype]] = None id: Optional[str] = None - members: Optional[Union[Union[dict, "Member"], List[Union[dict, "Member"]]]] = empty_list() + members: Optional[Union[Union[dict, "Member"], list[Union[dict, "Member"]]]] = empty_list() text: Optional[Union[dict, "Text"]] = None variationSet: Optional[Union[dict, "VariationSet"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.allele is not None and not isinstance(self.allele, Allele): self.allele = Allele(**as_dict(self.allele)) @@ -2131,7 +2127,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class MolecularVariation(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.MolecularVariation class_class_curie: ClassVar[str] = "vrs:MolecularVariation" @@ -2141,7 +2137,7 @@ class MolecularVariation(YAMLRoot): allele: Optional[Union[dict, Allele]] = None haplotype: Optional[Union[dict, Haplotype]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.allele is not None and not isinstance(self.allele, Allele): self.allele = Allele(**as_dict(self.allele)) @@ -2153,7 +2149,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Number(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.Number class_class_curie: ClassVar[str] = "vrs:Number" @@ -2162,7 +2158,7 @@ class Number(YAMLRoot): value: Optional[int] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.value is not None and not isinstance(self.value, int): self.value = int(self.value) @@ -2171,7 +2167,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class RepeatedSequenceExpression(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.RepeatedSequenceExpression class_class_curie: ClassVar[str] = "vrs:RepeatedSequenceExpression" @@ -2184,7 +2180,7 @@ class RepeatedSequenceExpression(YAMLRoot): literalSequenceExpression: Optional[Union[dict, LiteralSequenceExpression]] = None number: Optional[Union[dict, Number]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.definiteRange is not None and not isinstance(self.definiteRange, DefiniteRange): self.definiteRange = DefiniteRange(**as_dict(self.definiteRange)) @@ -2205,7 +2201,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class SequenceExpression(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.SequenceExpression class_class_curie: ClassVar[str] = "vrs:SequenceExpression" @@ -2216,7 +2212,7 @@ class SequenceExpression(YAMLRoot): literalSequenceExpression: Optional[Union[dict, LiteralSequenceExpression]] = None repeatedSequenceExpression: Optional[Union[dict, RepeatedSequenceExpression]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.derivedSequenceExpression is not None and not isinstance(self.derivedSequenceExpression, DerivedSequenceExpression): self.derivedSequenceExpression = DerivedSequenceExpression(**as_dict(self.derivedSequenceExpression)) @@ -2231,7 +2227,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class SequenceInterval(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.SequenceInterval class_class_curie: ClassVar[str] = "vrs:SequenceInterval" @@ -2245,7 +2241,7 @@ class SequenceInterval(YAMLRoot): startIndefiniteRange: Optional[Union[dict, IndefiniteRange]] = None startNumber: Optional[Union[dict, Number]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.endDefiniteRange is not None and not isinstance(self.endDefiniteRange, DefiniteRange): self.endDefiniteRange = DefiniteRange(**as_dict(self.endDefiniteRange)) @@ -2269,7 +2265,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class SequenceLocation(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.SequenceLocation class_class_curie: ClassVar[str] = "vrs:SequenceLocation" @@ -2280,7 +2276,7 @@ class SequenceLocation(YAMLRoot): sequenceId: Optional[str] = None sequenceInterval: Optional[Union[dict, SequenceInterval]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.id is not None and not isinstance(self.id, str): self.id = str(self.id) @@ -2295,7 +2291,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class SequenceState(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.SequenceState class_class_curie: ClassVar[str] = "vrs:SequenceState" @@ -2304,7 +2300,7 @@ class SequenceState(YAMLRoot): sequence: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.sequence is not None and not isinstance(self.sequence, str): self.sequence = str(self.sequence) @@ -2313,7 +2309,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class SimpleInterval(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.SimpleInterval class_class_curie: ClassVar[str] = "vrs:SimpleInterval" @@ -2323,7 +2319,7 @@ class SimpleInterval(YAMLRoot): end: Optional[int] = None start: Optional[int] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.end is not None and not isinstance(self.end, int): self.end = int(self.end) @@ -2335,7 +2331,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class SystemicVariation(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.SystemicVariation class_class_curie: ClassVar[str] = "vrs:SystemicVariation" @@ -2344,7 +2340,7 @@ class SystemicVariation(YAMLRoot): copyNumber: Optional[Union[dict, CopyNumber]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.copyNumber is not None and not isinstance(self.copyNumber, CopyNumber): self.copyNumber = CopyNumber(**as_dict(self.copyNumber)) @@ -2353,7 +2349,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Text(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.Text class_class_curie: ClassVar[str] = "vrs:Text" @@ -2363,7 +2359,7 @@ class Text(YAMLRoot): definition: Optional[str] = None id: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.definition is not None and not isinstance(self.definition, str): self.definition = str(self.definition) @@ -2375,7 +2371,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class UtilityVariation(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.UtilityVariation class_class_curie: ClassVar[str] = "vrs:UtilityVariation" @@ -2385,7 +2381,7 @@ class UtilityVariation(YAMLRoot): text: Optional[Union[dict, Text]] = None variationSet: Optional[Union[dict, "VariationSet"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.text is not None and not isinstance(self.text, Text): self.text = Text(**as_dict(self.text)) @@ -2397,7 +2393,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Variation(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.Variation class_class_curie: ClassVar[str] = "vrs:Variation" @@ -2410,7 +2406,7 @@ class Variation(YAMLRoot): text: Optional[Union[dict, Text]] = None variationSet: Optional[Union[dict, "VariationSet"]] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.allele is not None and not isinstance(self.allele, Allele): self.allele = Allele(**as_dict(self.allele)) @@ -2430,7 +2426,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): class VariationSet(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRS.VariationSet class_class_curie: ClassVar[str] = "vrs:VariationSet" @@ -3097,13 +3093,13 @@ class slots: model_uri=PHENOPACKETS.cohort__description, domain=None, range=Optional[str]) slots.cohort__files = Slot(uri=PHENOPACKETS.files, name="cohort__files", curie=PHENOPACKETS.curie('files'), - model_uri=PHENOPACKETS.cohort__files, domain=None, range=Optional[Union[Union[dict, File], List[Union[dict, File]]]]) + model_uri=PHENOPACKETS.cohort__files, domain=None, range=Optional[Union[Union[dict, File], list[Union[dict, File]]]]) slots.cohort__id = Slot(uri=PHENOPACKETS.id, name="cohort__id", curie=PHENOPACKETS.curie('id'), model_uri=PHENOPACKETS.cohort__id, domain=None, range=Optional[str]) slots.cohort__members = Slot(uri=PHENOPACKETS.members, name="cohort__members", curie=PHENOPACKETS.curie('members'), - model_uri=PHENOPACKETS.cohort__members, domain=None, range=Optional[Union[Union[dict, Phenopacket], List[Union[dict, Phenopacket]]]]) + model_uri=PHENOPACKETS.cohort__members, domain=None, range=Optional[Union[Union[dict, Phenopacket], list[Union[dict, Phenopacket]]]]) slots.cohort__metaData = Slot(uri=PHENOPACKETS.metaData, name="cohort__metaData", curie=PHENOPACKETS.curie('metaData'), model_uri=PHENOPACKETS.cohort__metaData, domain=None, range=Union[dict, MetaData]) @@ -3112,7 +3108,7 @@ class slots: model_uri=PHENOPACKETS.family__consanguinousParents, domain=None, range=Optional[Union[bool, Bool]]) slots.family__files = Slot(uri=PHENOPACKETS.files, name="family__files", curie=PHENOPACKETS.curie('files'), - model_uri=PHENOPACKETS.family__files, domain=None, range=Optional[Union[Union[dict, File], List[Union[dict, File]]]]) + model_uri=PHENOPACKETS.family__files, domain=None, range=Optional[Union[Union[dict, File], list[Union[dict, File]]]]) slots.family__id = Slot(uri=PHENOPACKETS.id, name="family__id", curie=PHENOPACKETS.curie('id'), model_uri=PHENOPACKETS.family__id, domain=None, range=Optional[str]) @@ -3127,34 +3123,34 @@ class slots: model_uri=PHENOPACKETS.family__proband, domain=None, range=Optional[Union[dict, Phenopacket]]) slots.family__relatives = Slot(uri=PHENOPACKETS.relatives, name="family__relatives", curie=PHENOPACKETS.curie('relatives'), - model_uri=PHENOPACKETS.family__relatives, domain=None, range=Optional[Union[Union[dict, Phenopacket], List[Union[dict, Phenopacket]]]]) + model_uri=PHENOPACKETS.family__relatives, domain=None, range=Optional[Union[Union[dict, Phenopacket], list[Union[dict, Phenopacket]]]]) slots.phenopacket__biosamples = Slot(uri=PHENOPACKETS.biosamples, name="phenopacket__biosamples", curie=PHENOPACKETS.curie('biosamples'), - model_uri=PHENOPACKETS.phenopacket__biosamples, domain=None, range=Optional[Union[Union[dict, Biosample], List[Union[dict, Biosample]]]]) + model_uri=PHENOPACKETS.phenopacket__biosamples, domain=None, range=Optional[Union[Union[dict, Biosample], list[Union[dict, Biosample]]]]) slots.phenopacket__diseases = Slot(uri=PHENOPACKETS.diseases, name="phenopacket__diseases", curie=PHENOPACKETS.curie('diseases'), - model_uri=PHENOPACKETS.phenopacket__diseases, domain=None, range=Optional[Union[Union[dict, Disease], List[Union[dict, Disease]]]]) + model_uri=PHENOPACKETS.phenopacket__diseases, domain=None, range=Optional[Union[Union[dict, Disease], list[Union[dict, Disease]]]]) slots.phenopacket__files = Slot(uri=PHENOPACKETS.files, name="phenopacket__files", curie=PHENOPACKETS.curie('files'), - model_uri=PHENOPACKETS.phenopacket__files, domain=None, range=Optional[Union[Union[dict, File], List[Union[dict, File]]]]) + model_uri=PHENOPACKETS.phenopacket__files, domain=None, range=Optional[Union[Union[dict, File], list[Union[dict, File]]]]) slots.phenopacket__id = Slot(uri=PHENOPACKETS.id, name="phenopacket__id", curie=PHENOPACKETS.curie('id'), model_uri=PHENOPACKETS.phenopacket__id, domain=None, range=Optional[str]) slots.phenopacket__interpretations = Slot(uri=PHENOPACKETS.interpretations, name="phenopacket__interpretations", curie=PHENOPACKETS.curie('interpretations'), - model_uri=PHENOPACKETS.phenopacket__interpretations, domain=None, range=Optional[Union[Union[dict, Interpretation], List[Union[dict, Interpretation]]]]) + model_uri=PHENOPACKETS.phenopacket__interpretations, domain=None, range=Optional[Union[Union[dict, Interpretation], list[Union[dict, Interpretation]]]]) slots.phenopacket__measurements = Slot(uri=PHENOPACKETS.measurements, name="phenopacket__measurements", curie=PHENOPACKETS.curie('measurements'), - model_uri=PHENOPACKETS.phenopacket__measurements, domain=None, range=Optional[Union[Union[dict, Measurement], List[Union[dict, Measurement]]]]) + model_uri=PHENOPACKETS.phenopacket__measurements, domain=None, range=Optional[Union[Union[dict, Measurement], list[Union[dict, Measurement]]]]) slots.phenopacket__medicalActions = Slot(uri=PHENOPACKETS.medicalActions, name="phenopacket__medicalActions", curie=PHENOPACKETS.curie('medicalActions'), - model_uri=PHENOPACKETS.phenopacket__medicalActions, domain=None, range=Optional[Union[Union[dict, MedicalAction], List[Union[dict, MedicalAction]]]]) + model_uri=PHENOPACKETS.phenopacket__medicalActions, domain=None, range=Optional[Union[Union[dict, MedicalAction], list[Union[dict, MedicalAction]]]]) slots.phenopacket__metaData = Slot(uri=PHENOPACKETS.metaData, name="phenopacket__metaData", curie=PHENOPACKETS.curie('metaData'), model_uri=PHENOPACKETS.phenopacket__metaData, domain=None, range=Union[dict, MetaData]) slots.phenopacket__phenotypicFeatures = Slot(uri=PHENOPACKETS.phenotypicFeatures, name="phenopacket__phenotypicFeatures", curie=PHENOPACKETS.curie('phenotypicFeatures'), - model_uri=PHENOPACKETS.phenopacket__phenotypicFeatures, domain=None, range=Optional[Union[Union[dict, PhenotypicFeature], List[Union[dict, PhenotypicFeature]]]]) + model_uri=PHENOPACKETS.phenopacket__phenotypicFeatures, domain=None, range=Optional[Union[Union[dict, PhenotypicFeature], list[Union[dict, PhenotypicFeature]]]]) slots.phenopacket__subject = Slot(uri=PHENOPACKETS.subject, name="phenopacket__subject", curie=PHENOPACKETS.curie('subject'), model_uri=PHENOPACKETS.phenopacket__subject, domain=None, range=Optional[Union[dict, Individual]]) @@ -3244,10 +3240,10 @@ class slots: model_uri=PHENOPACKETS.biosample__description, domain=None, range=Optional[str]) slots.biosample__diagnosticMarkers = Slot(uri=PHENOPACKETS.diagnosticMarkers, name="biosample__diagnosticMarkers", curie=PHENOPACKETS.curie('diagnosticMarkers'), - model_uri=PHENOPACKETS.biosample__diagnosticMarkers, domain=None, range=Optional[Union[Dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], List[Union[dict, OntologyClass]]]]) + model_uri=PHENOPACKETS.biosample__diagnosticMarkers, domain=None, range=Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]]) slots.biosample__files = Slot(uri=PHENOPACKETS.files, name="biosample__files", curie=PHENOPACKETS.curie('files'), - model_uri=PHENOPACKETS.biosample__files, domain=None, range=Optional[Union[Union[dict, File], List[Union[dict, File]]]]) + model_uri=PHENOPACKETS.biosample__files, domain=None, range=Optional[Union[Union[dict, File], list[Union[dict, File]]]]) slots.biosample__histologicalDiagnosis = Slot(uri=PHENOPACKETS.histologicalDiagnosis, name="biosample__histologicalDiagnosis", curie=PHENOPACKETS.curie('histologicalDiagnosis'), model_uri=PHENOPACKETS.biosample__histologicalDiagnosis, domain=None, range=Optional[Union[dict, OntologyClass]]) @@ -3262,16 +3258,16 @@ class slots: model_uri=PHENOPACKETS.biosample__materialSample, domain=None, range=Optional[Union[dict, OntologyClass]]) slots.biosample__measurements = Slot(uri=PHENOPACKETS.measurements, name="biosample__measurements", curie=PHENOPACKETS.curie('measurements'), - model_uri=PHENOPACKETS.biosample__measurements, domain=None, range=Optional[Union[Union[dict, Measurement], List[Union[dict, Measurement]]]]) + model_uri=PHENOPACKETS.biosample__measurements, domain=None, range=Optional[Union[Union[dict, Measurement], list[Union[dict, Measurement]]]]) slots.biosample__pathologicalStage = Slot(uri=PHENOPACKETS.pathologicalStage, name="biosample__pathologicalStage", curie=PHENOPACKETS.curie('pathologicalStage'), model_uri=PHENOPACKETS.biosample__pathologicalStage, domain=None, range=Optional[Union[dict, OntologyClass]]) slots.biosample__pathologicalTnmFinding = Slot(uri=PHENOPACKETS.pathologicalTnmFinding, name="biosample__pathologicalTnmFinding", curie=PHENOPACKETS.curie('pathologicalTnmFinding'), - model_uri=PHENOPACKETS.biosample__pathologicalTnmFinding, domain=None, range=Optional[Union[Dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], List[Union[dict, OntologyClass]]]]) + model_uri=PHENOPACKETS.biosample__pathologicalTnmFinding, domain=None, range=Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]]) slots.biosample__phenotypicFeatures = Slot(uri=PHENOPACKETS.phenotypicFeatures, name="biosample__phenotypicFeatures", curie=PHENOPACKETS.curie('phenotypicFeatures'), - model_uri=PHENOPACKETS.biosample__phenotypicFeatures, domain=None, range=Optional[Union[Union[dict, PhenotypicFeature], List[Union[dict, PhenotypicFeature]]]]) + model_uri=PHENOPACKETS.biosample__phenotypicFeatures, domain=None, range=Optional[Union[Union[dict, PhenotypicFeature], list[Union[dict, PhenotypicFeature]]]]) slots.biosample__procedure = Slot(uri=PHENOPACKETS.procedure, name="biosample__procedure", curie=PHENOPACKETS.curie('procedure'), model_uri=PHENOPACKETS.biosample__procedure, domain=None, range=Optional[Union[dict, Procedure]]) @@ -3301,10 +3297,10 @@ class slots: model_uri=PHENOPACKETS.biosample__tumorProgression, domain=None, range=Optional[Union[dict, OntologyClass]]) slots.disease__clinicalTnmFinding = Slot(uri=PHENOPACKETS.clinicalTnmFinding, name="disease__clinicalTnmFinding", curie=PHENOPACKETS.curie('clinicalTnmFinding'), - model_uri=PHENOPACKETS.disease__clinicalTnmFinding, domain=None, range=Optional[Union[Dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], List[Union[dict, OntologyClass]]]]) + model_uri=PHENOPACKETS.disease__clinicalTnmFinding, domain=None, range=Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]]) slots.disease__diseaseStage = Slot(uri=PHENOPACKETS.diseaseStage, name="disease__diseaseStage", curie=PHENOPACKETS.curie('diseaseStage'), - model_uri=PHENOPACKETS.disease__diseaseStage, domain=None, range=Optional[Union[Dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], List[Union[dict, OntologyClass]]]]) + model_uri=PHENOPACKETS.disease__diseaseStage, domain=None, range=Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]]) slots.disease__excluded = Slot(uri=PHENOPACKETS.excluded, name="disease__excluded", curie=PHENOPACKETS.curie('excluded'), model_uri=PHENOPACKETS.disease__excluded, domain=None, range=Optional[Union[bool, Bool]]) @@ -3328,7 +3324,7 @@ class slots: model_uri=PHENOPACKETS.diagnosis__disease, domain=None, range=Optional[Union[dict, OntologyClass]]) slots.diagnosis__genomicInterpretations = Slot(uri=PHENOPACKETS.genomicInterpretations, name="diagnosis__genomicInterpretations", curie=PHENOPACKETS.curie('genomicInterpretations'), - model_uri=PHENOPACKETS.diagnosis__genomicInterpretations, domain=None, range=Optional[Union[Union[dict, GenomicInterpretation], List[Union[dict, GenomicInterpretation]]]]) + model_uri=PHENOPACKETS.diagnosis__genomicInterpretations, domain=None, range=Optional[Union[Union[dict, GenomicInterpretation], list[Union[dict, GenomicInterpretation]]]]) slots.genomicInterpretation__gene = Slot(uri=PHENOPACKETS.gene, name="genomicInterpretation__gene", curie=PHENOPACKETS.curie('gene'), model_uri=PHENOPACKETS.genomicInterpretation__gene, domain=None, range=Optional[Union[dict, GeneDescriptor]]) @@ -3364,7 +3360,7 @@ class slots: model_uri=PHENOPACKETS.variantInterpretation__variationDescriptor, domain=None, range=Optional[Union[dict, VariationDescriptor]]) slots.individual__alternateIds = Slot(uri=PHENOPACKETS.alternateIds, name="individual__alternateIds", curie=PHENOPACKETS.curie('alternateIds'), - model_uri=PHENOPACKETS.individual__alternateIds, domain=None, range=Optional[Union[str, List[str]]]) + model_uri=PHENOPACKETS.individual__alternateIds, domain=None, range=Optional[Union[str, list[str]]]) slots.individual__dateOfBirth = Slot(uri=PHENOPACKETS.dateOfBirth, name="individual__dateOfBirth", curie=PHENOPACKETS.curie('dateOfBirth'), model_uri=PHENOPACKETS.individual__dateOfBirth, domain=None, range=Optional[str]) @@ -3403,7 +3399,7 @@ class slots: model_uri=PHENOPACKETS.vitalStatus__timeOfDeath, domain=None, range=Optional[Union[dict, TimeElement]]) slots.complexValue__typedQuantities = Slot(uri=PHENOPACKETS.typedQuantities, name="complexValue__typedQuantities", curie=PHENOPACKETS.curie('typedQuantities'), - model_uri=PHENOPACKETS.complexValue__typedQuantities, domain=None, range=Optional[Union[Union[dict, TypedQuantity], List[Union[dict, TypedQuantity]]]]) + model_uri=PHENOPACKETS.complexValue__typedQuantities, domain=None, range=Optional[Union[Union[dict, TypedQuantity], list[Union[dict, TypedQuantity]]]]) slots.measurement__assay = Slot(uri=PHENOPACKETS.assay, name="measurement__assay", curie=PHENOPACKETS.curie('assay'), model_uri=PHENOPACKETS.measurement__assay, domain=None, range=Optional[Union[dict, OntologyClass]]) @@ -3463,7 +3459,7 @@ class slots: model_uri=PHENOPACKETS.doseInterval__scheduleFrequency, domain=None, range=Optional[Union[dict, OntologyClass]]) slots.medicalAction__adverseEvents = Slot(uri=PHENOPACKETS.adverseEvents, name="medicalAction__adverseEvents", curie=PHENOPACKETS.curie('adverseEvents'), - model_uri=PHENOPACKETS.medicalAction__adverseEvents, domain=None, range=Optional[Union[Dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], List[Union[dict, OntologyClass]]]]) + model_uri=PHENOPACKETS.medicalAction__adverseEvents, domain=None, range=Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]]) slots.medicalAction__procedure = Slot(uri=PHENOPACKETS.procedure, name="medicalAction__procedure", curie=PHENOPACKETS.curie('procedure'), model_uri=PHENOPACKETS.medicalAction__procedure, domain=None, range=Optional[Union[dict, Procedure]]) @@ -3523,7 +3519,7 @@ class slots: model_uri=PHENOPACKETS.treatment__cumulativeDose, domain=None, range=Optional[Union[dict, Quantity]]) slots.treatment__doseIntervals = Slot(uri=PHENOPACKETS.doseIntervals, name="treatment__doseIntervals", curie=PHENOPACKETS.curie('doseIntervals'), - model_uri=PHENOPACKETS.treatment__doseIntervals, domain=None, range=Optional[Union[Union[dict, DoseInterval], List[Union[dict, DoseInterval]]]]) + model_uri=PHENOPACKETS.treatment__doseIntervals, domain=None, range=Optional[Union[Union[dict, DoseInterval], list[Union[dict, DoseInterval]]]]) slots.treatment__drugType = Slot(uri=PHENOPACKETS.drugType, name="treatment__drugType", curie=PHENOPACKETS.curie('drugType'), model_uri=PHENOPACKETS.treatment__drugType, domain=None, range=Optional[Union[str, "DrugType"]]) @@ -3538,19 +3534,19 @@ class slots: model_uri=PHENOPACKETS.metaData__createdBy, domain=None, range=Optional[str]) slots.metaData__externalReferences = Slot(uri=PHENOPACKETS.externalReferences, name="metaData__externalReferences", curie=PHENOPACKETS.curie('externalReferences'), - model_uri=PHENOPACKETS.metaData__externalReferences, domain=None, range=Optional[Union[Union[dict, ExternalReference], List[Union[dict, ExternalReference]]]]) + model_uri=PHENOPACKETS.metaData__externalReferences, domain=None, range=Optional[Union[Union[dict, ExternalReference], list[Union[dict, ExternalReference]]]]) slots.metaData__phenopacketSchemaVersion = Slot(uri=PHENOPACKETS.phenopacketSchemaVersion, name="metaData__phenopacketSchemaVersion", curie=PHENOPACKETS.curie('phenopacketSchemaVersion'), model_uri=PHENOPACKETS.metaData__phenopacketSchemaVersion, domain=None, range=Optional[str]) slots.metaData__resources = Slot(uri=PHENOPACKETS.resources, name="metaData__resources", curie=PHENOPACKETS.curie('resources'), - model_uri=PHENOPACKETS.metaData__resources, domain=None, range=Optional[Union[Union[dict, Resource], List[Union[dict, Resource]]]]) + model_uri=PHENOPACKETS.metaData__resources, domain=None, range=Optional[Union[Union[dict, Resource], list[Union[dict, Resource]]]]) slots.metaData__submittedBy = Slot(uri=PHENOPACKETS.submittedBy, name="metaData__submittedBy", curie=PHENOPACKETS.curie('submittedBy'), model_uri=PHENOPACKETS.metaData__submittedBy, domain=None, range=Optional[str]) slots.metaData__updates = Slot(uri=PHENOPACKETS.updates, name="metaData__updates", curie=PHENOPACKETS.curie('updates'), - model_uri=PHENOPACKETS.metaData__updates, domain=None, range=Optional[Union[Union[dict, Update], List[Union[dict, Update]]]]) + model_uri=PHENOPACKETS.metaData__updates, domain=None, range=Optional[Union[Union[dict, Update], list[Union[dict, Update]]]]) slots.resource__id = Slot(uri=PHENOPACKETS.id, name="resource__id", curie=PHENOPACKETS.curie('id'), model_uri=PHENOPACKETS.resource__id, domain=None, range=Optional[str]) @@ -3580,7 +3576,7 @@ class slots: model_uri=PHENOPACKETS.update__updatedBy, domain=None, range=Optional[str]) slots.pedigree__persons = Slot(uri=PHENOPACKETS.persons, name="pedigree__persons", curie=PHENOPACKETS.curie('persons'), - model_uri=PHENOPACKETS.pedigree__persons, domain=None, range=Optional[Union[Union[dict, Person], List[Union[dict, Person]]]]) + model_uri=PHENOPACKETS.pedigree__persons, domain=None, range=Optional[Union[Union[dict, Person], list[Union[dict, Person]]]]) slots.person__affectedStatus = Slot(uri=PHENOPACKETS.affectedStatus, name="person__affectedStatus", curie=PHENOPACKETS.curie('affectedStatus'), model_uri=PHENOPACKETS.person__affectedStatus, domain=None, range=Optional[Union[str, "AffectedStatus"]]) @@ -3604,13 +3600,13 @@ class slots: model_uri=PHENOPACKETS.phenotypicFeature__description, domain=None, range=Optional[str]) slots.phenotypicFeature__evidence = Slot(uri=PHENOPACKETS.evidence, name="phenotypicFeature__evidence", curie=PHENOPACKETS.curie('evidence'), - model_uri=PHENOPACKETS.phenotypicFeature__evidence, domain=None, range=Optional[Union[Union[dict, Evidence], List[Union[dict, Evidence]]]]) + model_uri=PHENOPACKETS.phenotypicFeature__evidence, domain=None, range=Optional[Union[Union[dict, Evidence], list[Union[dict, Evidence]]]]) slots.phenotypicFeature__excluded = Slot(uri=PHENOPACKETS.excluded, name="phenotypicFeature__excluded", curie=PHENOPACKETS.curie('excluded'), model_uri=PHENOPACKETS.phenotypicFeature__excluded, domain=None, range=Optional[Union[bool, Bool]]) slots.phenotypicFeature__modifiers = Slot(uri=PHENOPACKETS.modifiers, name="phenotypicFeature__modifiers", curie=PHENOPACKETS.curie('modifiers'), - model_uri=PHENOPACKETS.phenotypicFeature__modifiers, domain=None, range=Optional[Union[Dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], List[Union[dict, OntologyClass]]]]) + model_uri=PHENOPACKETS.phenotypicFeature__modifiers, domain=None, range=Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]]) slots.phenotypicFeature__onset = Slot(uri=PHENOPACKETS.onset, name="phenotypicFeature__onset", curie=PHENOPACKETS.curie('onset'), model_uri=PHENOPACKETS.phenotypicFeature__onset, domain=None, range=Optional[Union[dict, TimeElement]]) @@ -3643,13 +3639,13 @@ class slots: model_uri=PHENOPACKETS.extension__name, domain=None, range=Optional[str]) slots.extension__value = Slot(uri=PHENOPACKETS.value, name="extension__value", curie=PHENOPACKETS.curie('value'), - model_uri=PHENOPACKETS.extension__value, domain=None, range=Optional[Union[Union[dict, Any], List[Union[dict, Any]]]]) + model_uri=PHENOPACKETS.extension__value, domain=None, range=Optional[Union[Union[dict, Any], list[Union[dict, Any]]]]) slots.geneDescriptor__alternateIds = Slot(uri=PHENOPACKETS.alternateIds, name="geneDescriptor__alternateIds", curie=PHENOPACKETS.curie('alternateIds'), - model_uri=PHENOPACKETS.geneDescriptor__alternateIds, domain=None, range=Optional[Union[str, List[str]]]) + model_uri=PHENOPACKETS.geneDescriptor__alternateIds, domain=None, range=Optional[Union[str, list[str]]]) slots.geneDescriptor__alternateSymbols = Slot(uri=PHENOPACKETS.alternateSymbols, name="geneDescriptor__alternateSymbols", curie=PHENOPACKETS.curie('alternateSymbols'), - model_uri=PHENOPACKETS.geneDescriptor__alternateSymbols, domain=None, range=Optional[Union[str, List[str]]]) + model_uri=PHENOPACKETS.geneDescriptor__alternateSymbols, domain=None, range=Optional[Union[str, list[str]]]) slots.geneDescriptor__description = Slot(uri=PHENOPACKETS.description, name="geneDescriptor__description", curie=PHENOPACKETS.curie('description'), model_uri=PHENOPACKETS.geneDescriptor__description, domain=None, range=Optional[str]) @@ -3661,22 +3657,22 @@ class slots: model_uri=PHENOPACKETS.geneDescriptor__valueId, domain=None, range=Optional[str]) slots.geneDescriptor__xrefs = Slot(uri=PHENOPACKETS.xrefs, name="geneDescriptor__xrefs", curie=PHENOPACKETS.curie('xrefs'), - model_uri=PHENOPACKETS.geneDescriptor__xrefs, domain=None, range=Optional[Union[str, List[str]]]) + model_uri=PHENOPACKETS.geneDescriptor__xrefs, domain=None, range=Optional[Union[str, list[str]]]) slots.variationDescriptor__allelicState = Slot(uri=PHENOPACKETS.allelicState, name="variationDescriptor__allelicState", curie=PHENOPACKETS.curie('allelicState'), model_uri=PHENOPACKETS.variationDescriptor__allelicState, domain=None, range=Optional[Union[dict, OntologyClass]]) slots.variationDescriptor__alternateLabels = Slot(uri=PHENOPACKETS.alternateLabels, name="variationDescriptor__alternateLabels", curie=PHENOPACKETS.curie('alternateLabels'), - model_uri=PHENOPACKETS.variationDescriptor__alternateLabels, domain=None, range=Optional[Union[str, List[str]]]) + model_uri=PHENOPACKETS.variationDescriptor__alternateLabels, domain=None, range=Optional[Union[str, list[str]]]) slots.variationDescriptor__description = Slot(uri=PHENOPACKETS.description, name="variationDescriptor__description", curie=PHENOPACKETS.curie('description'), model_uri=PHENOPACKETS.variationDescriptor__description, domain=None, range=Optional[str]) slots.variationDescriptor__expressions = Slot(uri=PHENOPACKETS.expressions, name="variationDescriptor__expressions", curie=PHENOPACKETS.curie('expressions'), - model_uri=PHENOPACKETS.variationDescriptor__expressions, domain=None, range=Optional[Union[Union[dict, Expression], List[Union[dict, Expression]]]]) + model_uri=PHENOPACKETS.variationDescriptor__expressions, domain=None, range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]]) slots.variationDescriptor__extensions = Slot(uri=PHENOPACKETS.extensions, name="variationDescriptor__extensions", curie=PHENOPACKETS.curie('extensions'), - model_uri=PHENOPACKETS.variationDescriptor__extensions, domain=None, range=Optional[Union[Union[dict, Extension], List[Union[dict, Extension]]]]) + model_uri=PHENOPACKETS.variationDescriptor__extensions, domain=None, range=Optional[Union[Union[dict, Extension], list[Union[dict, Extension]]]]) slots.variationDescriptor__geneContext = Slot(uri=PHENOPACKETS.geneContext, name="variationDescriptor__geneContext", curie=PHENOPACKETS.curie('geneContext'), model_uri=PHENOPACKETS.variationDescriptor__geneContext, domain=None, range=Optional[Union[dict, GeneDescriptor]]) @@ -3703,7 +3699,7 @@ class slots: model_uri=PHENOPACKETS.variationDescriptor__vrsRefAlleleSeq, domain=None, range=Optional[str]) slots.variationDescriptor__xrefs = Slot(uri=PHENOPACKETS.xrefs, name="variationDescriptor__xrefs", curie=PHENOPACKETS.curie('xrefs'), - model_uri=PHENOPACKETS.variationDescriptor__xrefs, domain=None, range=Optional[Union[str, List[str]]]) + model_uri=PHENOPACKETS.variationDescriptor__xrefs, domain=None, range=Optional[Union[str, list[str]]]) slots.vcfRecord__alt = Slot(uri=PHENOPACKETS.alt, name="vcfRecord__alt", curie=PHENOPACKETS.curie('alt'), model_uri=PHENOPACKETS.vcfRecord__alt, domain=None, range=Optional[str]) @@ -3862,7 +3858,7 @@ class slots: model_uri=PHENOPACKETS.member__id, domain=None, range=Optional[str]) slots.member__members = Slot(uri=PHENOPACKETS.members, name="member__members", curie=PHENOPACKETS.curie('members'), - model_uri=PHENOPACKETS.member__members, domain=None, range=Optional[Union[Union[dict, Member], List[Union[dict, Member]]]]) + model_uri=PHENOPACKETS.member__members, domain=None, range=Optional[Union[Union[dict, Member], list[Union[dict, Member]]]]) slots.member__text = Slot(uri=PHENOPACKETS.text, name="member__text", curie=PHENOPACKETS.curie('text'), model_uri=PHENOPACKETS.member__text, domain=None, range=Optional[Union[dict, Text]]) diff --git a/tests/test_loaders_dumpers/models/termci_schema.py b/tests/test_loaders_dumpers/models/termci_schema.py index c80c5677..1f5a0e45 100644 --- a/tests/test_loaders_dumpers/models/termci_schema.py +++ b/tests/test_loaders_dumpers/models/termci_schema.py @@ -7,18 +7,13 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re -from typing import Optional, List, Union, Dict, ClassVar, Any +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_list, empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.metamodelcore import URI, URIorCURIE @@ -53,7 +48,7 @@ class ConceptReference(YAMLRoot): """ A minimal description of a class, individual, term or similar construct """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SKOS.Concept class_class_curie: ClassVar[str] = "skos:Concept" @@ -65,10 +60,10 @@ class ConceptReference(YAMLRoot): defined_in: Union[str, ConceptSystemNamespace] = None designation: Optional[str] = None definition: Optional[str] = None - reference: Optional[Union[Union[str, URI], List[Union[str, URI]]]] = empty_list() - narrower_than: Optional[Union[Union[str, ConceptReferenceUri], List[Union[str, ConceptReferenceUri]]]] = empty_list() + reference: Optional[Union[Union[str, URI], list[Union[str, URI]]]] = empty_list() + narrower_than: Optional[Union[Union[str, ConceptReferenceUri], list[Union[str, ConceptReferenceUri]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.uri is None: raise ValueError("uri must be supplied") if not isinstance(self.uri, ConceptReferenceUri): @@ -110,7 +105,7 @@ class ConceptSystem(YAMLRoot): """ A terminological resource (ontology, classification scheme, concept system, etc.) """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SKOS.ConceptScheme class_class_curie: ClassVar[str] = "skos:ConceptScheme" @@ -120,11 +115,11 @@ class ConceptSystem(YAMLRoot): namespace: Union[str, ConceptSystemNamespace] = None prefix: str = None description: Optional[str] = None - reference: Optional[Union[Union[str, URI], List[Union[str, URI]]]] = empty_list() - root_concept: Optional[Union[Union[str, ConceptReferenceUri], List[Union[str, ConceptReferenceUri]]]] = empty_list() - contents: Optional[Union[Dict[Union[str, ConceptReferenceUri], Union[dict, ConceptReference]], List[Union[dict, ConceptReference]]]] = empty_dict() + reference: Optional[Union[Union[str, URI], list[Union[str, URI]]]] = empty_list() + root_concept: Optional[Union[Union[str, ConceptReferenceUri], list[Union[str, ConceptReferenceUri]]]] = empty_list() + contents: Optional[Union[dict[Union[str, ConceptReferenceUri], Union[dict, ConceptReference]], list[Union[dict, ConceptReference]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.namespace is None: raise ValueError("namespace must be supplied") if not isinstance(self.namespace, ConceptSystemNamespace): @@ -164,16 +159,16 @@ class Package(YAMLRoot): """ A collection of ConceptSystems """ - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = TERMCI.Package class_class_curie: ClassVar[str] = "termci:Package" class_name: ClassVar[str] = "Package" class_model_uri: ClassVar[URIRef] = TERMCI.Package - system: Optional[Union[Dict[Union[str, ConceptSystemNamespace], Union[dict, ConceptSystem]], List[Union[dict, ConceptSystem]]]] = empty_dict() + system: Optional[Union[dict[Union[str, ConceptSystemNamespace], Union[dict, ConceptSystem]], list[Union[dict, ConceptSystem]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.system is None: self.system = [] if not isinstance(self.system, (list, dict)): diff --git a/tests/test_loaders_dumpers/test_csv_tsv_loader_dumper.py b/tests/test_loaders_dumpers/test_csv_tsv_loader_dumper.py index 80dc5a5d..9e6f3300 100644 --- a/tests/test_loaders_dumpers/test_csv_tsv_loader_dumper.py +++ b/tests/test_loaders_dumpers/test_csv_tsv_loader_dumper.py @@ -3,16 +3,16 @@ import json import logging -from jsonasobj2 import as_json_obj, JsonObj +from jsonasobj2 import as_json_obj from linkml_runtime.dumpers import json_dumper, yaml_dumper from linkml_runtime.loaders import yaml_loader -from linkml_runtime.utils.formatutils import remove_empty_items, is_empty +from linkml_runtime.utils.formatutils import remove_empty_items from linkml_runtime.utils.schemaview import SchemaView from linkml_runtime.dumpers import csv_dumper, tsv_dumper from linkml_runtime.loaders import csv_loader, tsv_loader from linkml_runtime.utils.yamlutils import as_json_object -from tests.test_loaders_dumpers.models.books_normalized import Author, Review, Shop, Book, GenreEnum, BookSeries +from tests.test_loaders_dumpers.models.books_normalized import Author, Review, Shop, Book, BookSeries logger = logging.getLogger(__name__) diff --git a/tests/test_loaders_dumpers/test_dumpers_pydantic.py b/tests/test_loaders_dumpers/test_dumpers_pydantic.py index 429c54c4..5e39da73 100644 --- a/tests/test_loaders_dumpers/test_dumpers_pydantic.py +++ b/tests/test_loaders_dumpers/test_dumpers_pydantic.py @@ -2,7 +2,7 @@ import yaml -from linkml_runtime.dumpers import yaml_dumper, json_dumper, csv_dumper +from linkml_runtime.dumpers import yaml_dumper, json_dumper from tests.test_loaders_dumpers.loaderdumpertestcase import LoaderDumperTestCase from tests.test_loaders_dumpers.models.books_normalized_pydantic import Book, BookSeries, Author from linkml_runtime.utils.formatutils import remove_empty_items @@ -27,7 +27,7 @@ def test_yaml_dumper(self): self.dumps_test('book_series_lotr.yaml', lambda: yaml_dumper.dumps(self.bookseries)) # test contents of yaml file with cleaned dict made from bookseries instance in setup - with open(self.env.input_path('book_series_lotr.yaml'), 'r') as f: + with open(self.env.input_path('book_series_lotr.yaml')) as f: data = yaml.safe_load(f) # explicitly confirm that unset fields aren't written to the file for i in range(3): @@ -43,7 +43,7 @@ def test_json_dumper(self): self.dumps_test('book_series_lotr.json', lambda: json_dumper.dumps(self.bookseries)) # test contents of json file with cleaned dict made from bookseries instance in setup - with open(self.env.input_path('book_series_lotr.json'), 'r') as f: + with open(self.env.input_path('book_series_lotr.json')) as f: data = json.load(f) # explicitly confirm that unset fields aren't written to the file for i in range(3): diff --git a/tests/test_loaders_dumpers/test_enum.py b/tests/test_loaders_dumpers/test_enum.py index 7a7964c7..ed47a9e8 100644 --- a/tests/test_loaders_dumpers/test_enum.py +++ b/tests/test_loaders_dumpers/test_enum.py @@ -1,9 +1,8 @@ -import os import unittest import json import yaml -from linkml_runtime.loaders import json_loader, yaml_loader +from linkml_runtime.loaders import json_loader from linkml_runtime.dumpers import json_dumper, yaml_dumper from tests.test_loaders_dumpers.models.enum_model import Organism, StateEnum diff --git a/tests/test_loaders_dumpers/test_loaders.py b/tests/test_loaders_dumpers/test_loaders.py index 495f6d3e..af1e57fe 100644 --- a/tests/test_loaders_dumpers/test_loaders.py +++ b/tests/test_loaders_dumpers/test_loaders.py @@ -1,6 +1,6 @@ import os import unittest -from typing import Union, TextIO, Type, Optional +from typing import Union, TextIO, Optional from hbreader import FileInfo @@ -51,12 +51,12 @@ def test_rdf_loader(self): fmt = 'turtle' class RDFLoaderWrapper(RDFLoader): - def load(self, source: Union[str, dict, TextIO], target_class: Type[YAMLRoot], *, + def load(self, source: Union[str, dict, TextIO], target_class: type[YAMLRoot], *, base_dir: Optional[str] = None, metadata: Optional[FileInfo] = None, **_) -> YAMLRoot: return rdf_loader.load(source, target_class, base_dir=LoadersUnitTest.env.indir, fmt=fmt, metadata=metadata, contexts=contexts) - def loads(self, source: str, target_class: Type[YAMLRoot], *, metadata: Optional[FileInfo] = None, **_) \ + def loads(self, source: str, target_class: type[YAMLRoot], *, metadata: Optional[FileInfo] = None, **_) \ -> YAMLRoot: return rdf_loader.loads(source, target_class, contexts=contexts, fmt=fmt, metadata=metadata) diff --git a/tests/test_loaders_dumpers/test_loaders_dumpers.py b/tests/test_loaders_dumpers/test_loaders_dumpers.py index a48eb77c..2ecde131 100644 --- a/tests/test_loaders_dumpers/test_loaders_dumpers.py +++ b/tests/test_loaders_dumpers/test_loaders_dumpers.py @@ -5,8 +5,7 @@ from decimal import Decimal import yaml -from rdflib import Graph, Literal, URIRef -from rdflib.namespace import RDF, SKOS, XSD +from rdflib import Graph from rdflib import Namespace from linkml_runtime.loaders import json_loader @@ -15,7 +14,7 @@ from linkml_runtime.loaders import rdflib_loader from linkml_runtime.utils.schemaview import SchemaView from tests.test_loaders_dumpers import INPUT_DIR, OUTPUT_DIR -from tests.test_loaders_dumpers.models.personinfo import Container, Person, Address, Organization, OrganizationType +from tests.test_loaders_dumpers.models.personinfo import Container, Person from tests.test_loaders_dumpers.models.node_object import NodeObject, Triple logger = logging.getLogger(__name__) diff --git a/tests/test_loaders_dumpers/test_loaders_pydantic.py b/tests/test_loaders_dumpers/test_loaders_pydantic.py index 02f5e8b2..0c9c1f1d 100644 --- a/tests/test_loaders_dumpers/test_loaders_pydantic.py +++ b/tests/test_loaders_dumpers/test_loaders_pydantic.py @@ -1,6 +1,6 @@ import unittest -from linkml_runtime.loaders import yaml_loader, json_loader, rdf_loader +from linkml_runtime.loaders import yaml_loader, json_loader from tests.test_loaders_dumpers.environment import env from tests.test_loaders_dumpers.loaderdumpertestcase import LoaderDumperTestCase from tests.test_loaders_dumpers.models.books_normalized_pydantic import BookSeries diff --git a/tests/test_loaders_dumpers/test_rdflib_dumper.py b/tests/test_loaders_dumpers/test_rdflib_dumper.py index b5c3a4f0..67a68f85 100644 --- a/tests/test_loaders_dumpers/test_rdflib_dumper.py +++ b/tests/test_loaders_dumpers/test_rdflib_dumper.py @@ -1,4 +1,3 @@ -import json import os import unittest import logging diff --git a/tests/test_processing/test_referencevalidator.py b/tests/test_processing/test_referencevalidator.py index 7f813799..6f40799d 100644 --- a/tests/test_processing/test_referencevalidator.py +++ b/tests/test_processing/test_referencevalidator.py @@ -7,7 +7,7 @@ from decimal import Decimal from io import StringIO from pathlib import Path -from typing import Optional, Any, List, Union +from typing import Optional, Any, Union import yaml @@ -69,12 +69,12 @@ def italics(self, text: str): def w(self, text: str): self.writer.write(text) - def th(self, cols: List[str]): + def th(self, cols: list[str]): self.w("\n") self.tr(cols) self.tr(["---" for _ in cols]) - def tr(self, cols: List[str]): + def tr(self, cols: list[str]): self.w(f"|{'|'.join([str(c) for c in cols])}|\n") def __repr__(self) -> str: @@ -99,7 +99,7 @@ def _add_core_schema_elements( METASLOTS = ["range", "multivalued", "inlined", "inlined_as_list"] -def _slot_metaslot_values(slot: SlotDefinition) -> List[Any]: +def _slot_metaslot_values(slot: SlotDefinition) -> list[Any]: return [ slot.range or "string", slot.multivalued or False, diff --git a/tests/test_utils/input/inlined_as_dict.py b/tests/test_utils/input/inlined_as_dict.py index dc4a8d61..7f43820e 100644 --- a/tests/test_utils/input/inlined_as_dict.py +++ b/tests/test_utils/input/inlined_as_dict.py @@ -7,18 +7,13 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re -from typing import Optional, List, Union, Dict, ClassVar, Any +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -57,7 +52,7 @@ class EInstS1(extended_str): @dataclass class EInst(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EX.EInst class_class_curie: ClassVar[str] = "ex:EInst" @@ -68,7 +63,7 @@ class EInst(YAMLRoot): s2: Optional[str] = None s3: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.s1 is None: raise ValueError("s1 must be supplied") if not isinstance(self.s1, EInstS1): @@ -85,16 +80,16 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class E(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EX.E class_class_curie: ClassVar[str] = "ex:E" class_name: ClassVar[str] = "E" class_model_uri: ClassVar[URIRef] = EX.E - ev: Optional[Union[Dict[Union[str, EInstS1], Union[dict, EInst]], List[Union[dict, EInst]]]] = empty_dict() + ev: Optional[Union[dict[Union[str, EInstS1], Union[dict, EInst]], list[Union[dict, EInst]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_dict(slot_name="ev", slot_type=EInst, key_name="s1", keyed=True) super().__post_init__(**kwargs) diff --git a/tests/test_utils/input/inlined_as_list.py b/tests/test_utils/input/inlined_as_list.py index bb2bcef7..1c91129b 100644 --- a/tests/test_utils/input/inlined_as_list.py +++ b/tests/test_utils/input/inlined_as_list.py @@ -7,18 +7,13 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re -from typing import Optional, List, Union, Dict, ClassVar, Any +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -57,7 +52,7 @@ class EInstS1(extended_str): @dataclass class EInst(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EX.EInst class_class_curie: ClassVar[str] = "ex:EInst" @@ -68,7 +63,7 @@ class EInst(YAMLRoot): s2: Optional[str] = None s3: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.s1 is None: raise ValueError("s1 must be supplied") if not isinstance(self.s1, EInstS1): @@ -85,16 +80,16 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class E(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EX.E class_class_curie: ClassVar[str] = "ex:E" class_name: ClassVar[str] = "E" class_model_uri: ClassVar[URIRef] = EX.E - ev: Optional[Union[Dict[Union[str, EInstS1], Union[dict, EInst]], List[Union[dict, EInst]]]] = empty_dict() + ev: Optional[Union[dict[Union[str, EInstS1], Union[dict, EInst]], list[Union[dict, EInst]]]] = empty_dict() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_list(slot_name="ev", slot_type=EInst, key_name="s1", keyed=True) super().__post_init__(**kwargs) diff --git a/tests/test_utils/model/inference_example.py b/tests/test_utils/model/inference_example.py index 3cbc5d3f..7be9c8a8 100644 --- a/tests/test_utils/model/inference_example.py +++ b/tests/test_utils/model/inference_example.py @@ -7,22 +7,19 @@ # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses -import sys -import re -from jsonasobj2 import JsonObj, as_dict -from typing import Optional, List, Union, Dict, ClassVar, Any +from jsonasobj2 import as_dict +from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int +from linkml_runtime.utils.metamodelcore import empty_list +from linkml_runtime.utils.yamlutils import YAMLRoot from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs -from linkml_runtime.utils.formatutils import camelcase, underscore, sfx from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import Namespace, URIRef +from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.linkml_model.types import Boolean, Decimal, String +from linkml_runtime.linkml_model.types import Decimal from linkml_runtime.utils.metamodelcore import Bool, Decimal metamodel_version = "1.7.0" @@ -48,7 +45,7 @@ @dataclass class Term(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EX.Term class_class_curie: ClassVar[str] = "ex:Term" @@ -57,9 +54,9 @@ class Term(YAMLRoot): id: Optional[str] = None name: Optional[str] = None - synonyms: Optional[Union[str, List[str]]] = empty_list() + synonyms: Optional[Union[str, list[str]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.id is not None and not isinstance(self.id, str): self.id = str(self.id) @@ -75,7 +72,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Person(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EX.Person class_class_curie: ClassVar[str] = "ex:Person" @@ -97,7 +94,7 @@ class Person(YAMLRoot): derived_expression_from_spaces: Optional[str] = None summary: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.id is not None and not isinstance(self.id, str): self.id = str(self.id) @@ -145,7 +142,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Evil(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EX.Evil class_class_curie: ClassVar[str] = "ex:Evil" @@ -154,7 +151,7 @@ class Evil(YAMLRoot): prohibited: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.prohibited is not None and not isinstance(self.prohibited, str): self.prohibited = str(self.prohibited) @@ -163,7 +160,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Relationship(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EX.Relationship class_class_curie: ClassVar[str] = "ex:Relationship" @@ -176,7 +173,7 @@ class Relationship(YAMLRoot): description: Optional[str] = None description2: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.person1 is not None and not isinstance(self.person1, Person): self.person1 = Person(**as_dict(self.person1)) @@ -197,7 +194,7 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Address(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EX.Address class_class_curie: ClassVar[str] = "ex:Address" @@ -207,7 +204,7 @@ class Address(YAMLRoot): street: Optional[str] = None city: Optional[str] = None - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.street is not None and not isinstance(self.street, str): self.street = str(self.street) @@ -219,16 +216,16 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @dataclass class Container(YAMLRoot): - _inherited_slots: ClassVar[List[str]] = [] + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = EX.Container class_class_curie: ClassVar[str] = "ex:Container" class_name: ClassVar[str] = "Container" class_model_uri: ClassVar[URIRef] = EX.Container - persons: Optional[Union[Union[dict, Person], List[Union[dict, Person]]]] = empty_list() + persons: Optional[Union[Union[dict, Person], list[Union[dict, Person]]]] = empty_list() - def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.persons, list): self.persons = [self.persons] if self.persons is not None else [] self.persons = [v if isinstance(v, Person) else Person(**as_dict(v)) for v in self.persons] @@ -258,7 +255,7 @@ class slots: model_uri=EX.name, domain=None, range=Optional[str]) slots.synonyms = Slot(uri=EX.synonyms, name="synonyms", curie=EX.curie('synonyms'), - model_uri=EX.synonyms, domain=None, range=Optional[Union[str, List[str]]]) + model_uri=EX.synonyms, domain=None, range=Optional[Union[str, list[str]]]) slots.full_name = Slot(uri=EX.full_name, name="full_name", curie=EX.curie('full_name'), model_uri=EX.full_name, domain=None, range=Optional[str]) @@ -327,7 +324,7 @@ class slots: model_uri=EX.relationship__description2, domain=None, range=Optional[str]) slots.container__persons = Slot(uri=EX.persons, name="container__persons", curie=EX.curie('persons'), - model_uri=EX.container__persons, domain=None, range=Optional[Union[Union[dict, Person], List[Union[dict, Person]]]]) + model_uri=EX.container__persons, domain=None, range=Optional[Union[Union[dict, Person], list[Union[dict, Person]]]]) slots.Person_description = Slot(uri=EX.description, name="Person_description", curie=EX.curie('description'), model_uri=EX.Person_description, domain=Person, range=Optional[str]) diff --git a/tests/test_utils/test_dict_utils.py b/tests/test_utils/test_dict_utils.py index 944f5f6e..e0beedce 100644 --- a/tests/test_utils/test_dict_utils.py +++ b/tests/test_utils/test_dict_utils.py @@ -1,6 +1,5 @@ import unittest -import yaml from linkml_runtime.linkml_model.meta import ClassDefinition, SlotDefinition, ElementName import linkml_runtime.utils.yamlutils as yutils diff --git a/tests/test_utils/test_distroutils.py b/tests/test_utils/test_distroutils.py index 9a2cc3a5..c7235dbb 100644 --- a/tests/test_utils/test_distroutils.py +++ b/tests/test_utils/test_distroutils.py @@ -1,8 +1,5 @@ -import os import unittest -import logging -from linkml_runtime.linkml_model import SchemaDefinition from linkml_runtime.utils.distroutils import get_jsonschema_string, get_schema_string diff --git a/tests/test_utils/test_eval_utils.py b/tests/test_utils/test_eval_utils.py index 500d79ac..83f082ab 100644 --- a/tests/test_utils/test_eval_utils.py +++ b/tests/test_utils/test_eval_utils.py @@ -1,5 +1,4 @@ from dataclasses import dataclass -from typing import List, Dict import pytest @@ -9,7 +8,7 @@ @dataclass class Person: name: str = None - aliases: List[str] = None + aliases: list[str] = None address: "Address" = None @@ -21,8 +20,8 @@ class Address: @dataclass class Container: name: str = None - persons: List[Person] = None - person_index: Dict[str, Person] = None + persons: list[Person] = None + person_index: dict[str, Person] = None def test_eval_expressions(): diff --git a/tests/test_utils/test_formatutils.py b/tests/test_utils/test_formatutils.py index 5107cd3d..46a45861 100644 --- a/tests/test_utils/test_formatutils.py +++ b/tests/test_utils/test_formatutils.py @@ -1,6 +1,6 @@ import json import unittest -from typing import List, Tuple, Any +from typing import Any from jsonasobj2 import JsonObj, as_json @@ -10,7 +10,7 @@ empty_things = [None, dict(), list(), JsonObj(), JsonObj({}), JsonObj([])] non_empty_things = [0, False, "", {'k': None}, {0:0}, [None], JsonObj(k=None), JsonObj(**{'k': None}), JsonObj([None])] -things_removed: List[Tuple[Any, Any]] = \ +things_removed: list[tuple[Any, Any]] = \ [(None, None), (dict(), {}), (list(), []), diff --git a/tests/test_utils/test_introspection.py b/tests/test_utils/test_introspection.py index ae0d6461..959d7ed2 100644 --- a/tests/test_utils/test_introspection.py +++ b/tests/test_utils/test_introspection.py @@ -1,6 +1,4 @@ -import os import unittest -import logging from linkml_runtime.linkml_model import SchemaDefinition from linkml_runtime.utils.introspection import package_schemaview, object_class_definition diff --git a/tests/test_utils/test_ruleutils.py b/tests/test_utils/test_ruleutils.py index 46157dbd..c1975985 100644 --- a/tests/test_utils/test_ruleutils.py +++ b/tests/test_utils/test_ruleutils.py @@ -1,9 +1,7 @@ import os import unittest -import logging from linkml_runtime.dumpers import yaml_dumper -from linkml_runtime.linkml_model.meta import SchemaDefinition, ClassDefinition, SlotDefinitionName from linkml_runtime.loaders.yaml_loader import YAMLLoader from linkml_runtime.utils.schemaview import SchemaView from linkml_runtime.utils.ruleutils import subclass_to_rules, get_range_as_disjunction diff --git a/tests/test_utils/test_schema_as_dict.py b/tests/test_utils/test_schema_as_dict.py index f9f2c53b..90ec7042 100644 --- a/tests/test_utils/test_schema_as_dict.py +++ b/tests/test_utils/test_schema_as_dict.py @@ -1,9 +1,8 @@ import os import unittest import logging -import yaml -from linkml_runtime.linkml_model.meta import SchemaDefinition, ClassDefinition +from linkml_runtime.linkml_model.meta import ClassDefinition from linkml_runtime.loaders.yaml_loader import YAMLLoader from linkml_runtime.utils.schema_as_dict import schema_as_yaml_dump, schema_as_dict from linkml_runtime.utils.schemaview import SchemaView diff --git a/tests/test_utils/test_schemaview.py b/tests/test_utils/test_schemaview.py index 8056ba9e..ba56087c 100644 --- a/tests/test_utils/test_schemaview.py +++ b/tests/test_utils/test_schemaview.py @@ -3,8 +3,6 @@ import logging from copy import copy from pathlib import Path -from typing import List -from unittest import TestCase from jsonasobj2 import JsonObj @@ -738,7 +736,7 @@ def test_traversal(self): view.add_class(ClassDefinition('BY', is_a='RootMixin', mixin=True)) view.add_class(ClassDefinition('CX', is_a='RootMixin', mixin=True)) - def check(ancs: List, expected: List): + def check(ancs: list, expected: list): self.assertEqual(ancs, expected) check(view.class_ancestors('C', depth_first=True), ['C', 'Cm1', 'Cm2', 'CX', 'B', 'Bm1', 'Bm2', 'BY', 'A', 'Am1', 'Am2', 'AZ', 'Root', 'RootMixin']) From de209514607f36b85b72816bf1a0ba6b0180c4d0 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Wed, 9 Oct 2024 01:09:41 -0700 Subject: [PATCH 02/17] dang i guess ruff really just failed at that check and also removed a bunch of actually used imports --- linkml_runtime/utils/csvutils.py | 2 +- linkml_runtime/utils/schemaview.py | 118 ++++++++++++++--------------- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/linkml_runtime/utils/csvutils.py b/linkml_runtime/utils/csvutils.py index 7813f078..b841d3ca 100644 --- a/linkml_runtime/utils/csvutils.py +++ b/linkml_runtime/utils/csvutils.py @@ -1,5 +1,5 @@ import logging -from json_flattener import KeyConfig, Serializer +from json_flattener import GlobalConfig, KeyConfig, Serializer from json_flattener.flattener import CONFIGMAP from linkml_runtime.linkml_model.meta import SlotDefinitionName, ClassDefinitionName from linkml_runtime.utils.schemaview import SchemaView diff --git a/linkml_runtime/utils/schemaview.py b/linkml_runtime/utils/schemaview.py index c3d15758..e353a842 100644 --- a/linkml_runtime/utils/schemaview.py +++ b/linkml_runtime/utils/schemaview.py @@ -13,7 +13,7 @@ from linkml_runtime.utils.namespaces import Namespaces from deprecated.classic import deprecated from linkml_runtime.utils.context_utils import parse_import_map, map_import -from linkml_runtime.utils.formatutils import is_empty +from linkml_runtime.utils.formatutils import is_empty, underscore, camelcase from linkml_runtime.utils.pattern import PatternResolver from linkml_runtime.linkml_model.meta import * from linkml_runtime.exceptions import OrderingError @@ -40,8 +40,8 @@ ElementNameType = TypeVar("ElementNameType", bound=Union[ElementName,str]) DefinitionType = TypeVar("DefinitionType", bound=Definition) DefinitionNameType = TypeVar("DefinitionNameType", bound=Union[DefinitionName,str]) -ElementDict = Dict[ElementNameType, ElementType] -DefDict = Dict[DefinitionNameType, DefinitionType] +ElementDict = dict[ElementNameType, ElementType] +DefDict = dict[DefinitionNameType, DefinitionType] class OrderedBy(Enum): @@ -140,7 +140,7 @@ class SchemaView: """ schema: SchemaDefinition = None - schema_map: Dict[SchemaDefinitionName, SchemaDefinition] = None + schema_map: dict[SchemaDefinitionName, SchemaDefinition] = None importmap: Optional[Mapping[str, str]] = None """Optional mapping between schema names and local paths/URLs""" modifications: int = 0 @@ -152,7 +152,7 @@ class SchemaView: def __init__(self, schema: Union[str, Path, SchemaDefinition], - importmap: Optional[Dict[str, str]] = None, merge_imports: bool = False, base_dir: str = None): + importmap: Optional[dict[str, str]] = None, merge_imports: bool = False, base_dir: str = None): if isinstance(schema, Path): schema = str(schema) if isinstance(schema, str): @@ -230,7 +230,7 @@ def load_import(self, imp: str, from_schema: SchemaDefinition = None): return schema @lru_cache(None) - def imports_closure(self, imports: bool = True, traverse: Optional[bool] = None, inject_metadata=True) -> List[SchemaDefinitionName]: + def imports_closure(self, imports: bool = True, traverse: Optional[bool] = None, inject_metadata=True) -> list[SchemaDefinitionName]: """ Return all imports @@ -327,7 +327,7 @@ def imports_closure(self, imports: bool = True, traverse: Optional[bool] = None, return closure @lru_cache(None) - def all_schema(self, imports: bool = True) -> List[SchemaDefinition]: + def all_schema(self, imports: bool = True) -> list[SchemaDefinition]: """ :param imports: include imports closure :return: all schemas @@ -337,7 +337,7 @@ def all_schema(self, imports: bool = True) -> List[SchemaDefinition]: @deprecated("Use `all_classes` instead") @lru_cache(None) - def all_class(self, imports=True) -> Dict[ClassDefinitionName, ClassDefinition]: + def all_class(self, imports=True) -> dict[ClassDefinitionName, ClassDefinition]: """ :param imports: include imports closure :return: all classes in schema view @@ -423,7 +423,7 @@ def _order_inheritance(self, elements: DefDict) -> DefDict: @lru_cache(None) - def all_classes(self, ordered_by=OrderedBy.PRESERVE, imports=True) -> Dict[ClassDefinitionName, ClassDefinition]: + def all_classes(self, ordered_by=OrderedBy.PRESERVE, imports=True) -> dict[ClassDefinitionName, ClassDefinition]: """ :param ordered_by: an enumerated parameter that returns all the classes in the order specified. :param imports: include imports closure @@ -435,7 +435,7 @@ def all_classes(self, ordered_by=OrderedBy.PRESERVE, imports=True) -> Dict[Class @deprecated("Use `all_slots` instead") @lru_cache(None) - def all_slot(self, **kwargs) -> Dict[SlotDefinitionName, SlotDefinition]: + def all_slot(self, **kwargs) -> dict[SlotDefinitionName, SlotDefinition]: """ :param imports: include imports closure :return: all slots in schema view @@ -443,7 +443,7 @@ def all_slot(self, **kwargs) -> Dict[SlotDefinitionName, SlotDefinition]: return self.all_slots(**kwargs) @lru_cache(None) - def all_slots(self, ordered_by=OrderedBy.PRESERVE, imports=True, attributes=True) -> Dict[ + def all_slots(self, ordered_by=OrderedBy.PRESERVE, imports=True, attributes=True) -> dict[ SlotDefinitionName, SlotDefinition]: """ :param ordered_by: an enumerated parameter that returns all the slots in the order specified. @@ -464,7 +464,7 @@ def all_slots(self, ordered_by=OrderedBy.PRESERVE, imports=True, attributes=True @deprecated("Use `all_enums` instead") @lru_cache(None) - def all_enum(self, imports=True) -> Dict[EnumDefinitionName, EnumDefinition]: + def all_enum(self, imports=True) -> dict[EnumDefinitionName, EnumDefinition]: """ :param imports: include imports closure :return: all enums in schema view @@ -472,7 +472,7 @@ def all_enum(self, imports=True) -> Dict[EnumDefinitionName, EnumDefinition]: return self._get_dict(ENUMS, imports) @lru_cache(None) - def all_enums(self, imports=True) -> Dict[EnumDefinitionName, EnumDefinition]: + def all_enums(self, imports=True) -> dict[EnumDefinitionName, EnumDefinition]: """ :param imports: include imports closure :return: all enums in schema view @@ -481,7 +481,7 @@ def all_enums(self, imports=True) -> Dict[EnumDefinitionName, EnumDefinition]: @deprecated("Use `all_types` instead") @lru_cache(None) - def all_type(self, imports=True) -> Dict[TypeDefinitionName, TypeDefinition]: + def all_type(self, imports=True) -> dict[TypeDefinitionName, TypeDefinition]: """ :param imports: include imports closure :return: all types in schema view @@ -489,7 +489,7 @@ def all_type(self, imports=True) -> Dict[TypeDefinitionName, TypeDefinition]: return self._get_dict(TYPES, imports) @lru_cache(None) - def all_types(self, imports=True) -> Dict[TypeDefinitionName, TypeDefinition]: + def all_types(self, imports=True) -> dict[TypeDefinitionName, TypeDefinition]: """ :param imports: include imports closure :return: all types in schema view @@ -497,7 +497,7 @@ def all_types(self, imports=True) -> Dict[TypeDefinitionName, TypeDefinition]: return self._get_dict(TYPES, imports) @deprecated("Use `all_subsets` instead") - def all_subset(self, imports=True) -> Dict[SubsetDefinitionName, SubsetDefinition]: + def all_subset(self, imports=True) -> dict[SubsetDefinitionName, SubsetDefinition]: """ :param imports: include imports closure :return: all subsets in schema view @@ -505,7 +505,7 @@ def all_subset(self, imports=True) -> Dict[SubsetDefinitionName, SubsetDefinitio return self._get_dict(SUBSETS, imports) @lru_cache(None) - def all_subsets(self, imports=True) -> Dict[SubsetDefinitionName, SubsetDefinition]: + def all_subsets(self, imports=True) -> dict[SubsetDefinitionName, SubsetDefinition]: """ :param imports: include imports closure :return: all subsets in schema view @@ -514,7 +514,7 @@ def all_subsets(self, imports=True) -> Dict[SubsetDefinitionName, SubsetDefiniti @deprecated("Use `all_elements` instead") @lru_cache(None) - def all_element(self, imports=True) -> Dict[ElementName, Element]: + def all_element(self, imports=True) -> dict[ElementName, Element]: """ :param imports: include imports closure :return: all elements in schema view @@ -528,7 +528,7 @@ def all_element(self, imports=True) -> Dict[ElementName, Element]: return {**all_classes, **all_slots, **all_enums, **all_types, **all_subsets} @lru_cache(None) - def all_elements(self, imports=True) -> Dict[ElementName, Element]: + def all_elements(self, imports=True) -> dict[ElementName, Element]: """ :param imports: include imports closure :return: all elements in schema view @@ -541,7 +541,7 @@ def all_elements(self, imports=True) -> Dict[ElementName, Element]: # {**a,**b} syntax merges dictionary a and b into a single dictionary, removing duplicates. return {**all_classes, **all_slots, **all_enums, **all_types, **all_subsets} - def _get_dict(self, slot_name: str, imports=True) -> Dict: + def _get_dict(self, slot_name: str, imports=True) -> dict: schemas = self.all_schema(imports) d = {} # pdb.set_trace() @@ -555,7 +555,7 @@ def _get_dict(self, slot_name: str, imports=True) -> Dict: return d @lru_cache(None) - def slot_name_mappings(self) -> Dict[str, SlotDefinition]: + def slot_name_mappings(self) -> dict[str, SlotDefinition]: """ Mapping between processed safe slot names (following naming conventions) and slots. @@ -569,7 +569,7 @@ def slot_name_mappings(self) -> Dict[str, SlotDefinition]: return m @lru_cache(None) - def class_name_mappings(self) -> Dict[str, ClassDefinition]: + def class_name_mappings(self) -> dict[str, ClassDefinition]: """ Mapping between processed safe class names (following naming conventions) and classes. @@ -594,7 +594,7 @@ def in_schema(self, element_name: ElementName) -> SchemaDefinitionName: return ix[element_name] @lru_cache(None) - def element_by_schema_map(self) -> Dict[ElementName, SchemaDefinitionName]: + def element_by_schema_map(self) -> dict[ElementName, SchemaDefinitionName]: ix = {} schemas = self.all_schema(True) for schema in schemas: @@ -681,7 +681,7 @@ def get_type(self, type_name: TYPE_NAME, imports=True, strict=False) -> TypeDefi else: return t - def _parents(self, e: Element, imports=True, mixins=True, is_a=True) -> List[ElementName]: + def _parents(self, e: Element, imports=True, mixins=True, is_a=True) -> list[ElementName]: if mixins: parents = copy(e.mixins) else: @@ -691,7 +691,7 @@ def _parents(self, e: Element, imports=True, mixins=True, is_a=True) -> List[Ele return parents @lru_cache(None) - def class_parents(self, class_name: CLASS_NAME, imports=True, mixins=True, is_a=True) -> List[ClassDefinitionName]: + def class_parents(self, class_name: CLASS_NAME, imports=True, mixins=True, is_a=True) -> list[ClassDefinitionName]: """ :param class_name: child class name :param imports: include import closure @@ -702,7 +702,7 @@ def class_parents(self, class_name: CLASS_NAME, imports=True, mixins=True, is_a= return self._parents(cls, imports, mixins, is_a) @lru_cache(None) - def enum_parents(self, enum_name: ENUM_NAME, imports=False, mixins=False, is_a=True) -> List[EnumDefinitionName]: + def enum_parents(self, enum_name: ENUM_NAME, imports=False, mixins=False, is_a=True) -> list[EnumDefinitionName]: """ :param enum_name: child enum name :param imports: include import closure (False) @@ -764,7 +764,7 @@ def permissible_value_children(self, permissible_value: str, enum_name: ENUM_NAM raise ValueError(f'No such enum as "{enum_name}"') @lru_cache(None) - def slot_parents(self, slot_name: SLOT_NAME, imports=True, mixins=True, is_a=True) -> List[SlotDefinitionName]: + def slot_parents(self, slot_name: SLOT_NAME, imports=True, mixins=True, is_a=True) -> list[SlotDefinitionName]: """ :param slot_name: child slot name :param imports: include import closure @@ -778,7 +778,7 @@ def slot_parents(self, slot_name: SLOT_NAME, imports=True, mixins=True, is_a=Tru return [] @lru_cache(None) - def type_parents(self, type_name: TYPE_NAME, imports=True) -> List[TypeDefinitionName]: + def type_parents(self, type_name: TYPE_NAME, imports=True) -> list[TypeDefinitionName]: """ :param type_name: child type name :param imports: include import closure @@ -791,7 +791,7 @@ def type_parents(self, type_name: TYPE_NAME, imports=True) -> List[TypeDefinitio return [] @lru_cache(None) - def get_children(self, name: str, mixin: bool = True) -> List[str]: + def get_children(self, name: str, mixin: bool = True) -> list[str]: """ get the children of an element (any class, slot, enum, type) :param name: name of the parent element @@ -808,7 +808,7 @@ def get_children(self, name: str, mixin: bool = True) -> List[str]: return children @lru_cache(None) - def class_children(self, class_name: CLASS_NAME, imports=True, mixins=True, is_a=True) -> List[ClassDefinitionName]: + def class_children(self, class_name: CLASS_NAME, imports=True, mixins=True, is_a=True) -> list[ClassDefinitionName]: """ :param class_name: parent class name :param imports: include import closure @@ -820,7 +820,7 @@ def class_children(self, class_name: CLASS_NAME, imports=True, mixins=True, is_a return [x.name for x in elts if (x.is_a == class_name and is_a) or (mixins and class_name in x.mixins)] @lru_cache(None) - def slot_children(self, slot_name: SLOT_NAME, imports=True, mixins=True, is_a=True) -> List[SlotDefinitionName]: + def slot_children(self, slot_name: SLOT_NAME, imports=True, mixins=True, is_a=True) -> list[SlotDefinitionName]: """ :param slot_name: parent slot name :param imports: include import closure @@ -833,7 +833,7 @@ def slot_children(self, slot_name: SLOT_NAME, imports=True, mixins=True, is_a=Tr @lru_cache(None) def class_ancestors(self, class_name: CLASS_NAME, imports=True, mixins=True, reflexive=True, is_a=True, - depth_first=True) -> List[ClassDefinitionName]: + depth_first=True) -> list[ClassDefinitionName]: """ Closure of class_parents method @@ -853,7 +853,7 @@ def class_ancestors(self, class_name: CLASS_NAME, imports=True, mixins=True, ref def permissible_value_ancestors(self, permissible_value_text: str, enum_name: ENUM_NAME, reflexive=True, - depth_first=True) -> List[str]: + depth_first=True) -> list[str]: """ Closure of permissible_value_parents method :enum @@ -868,7 +868,7 @@ def permissible_value_ancestors(self, permissible_value_text: str, def permissible_value_descendants(self, permissible_value_text: str, enum_name: ENUM_NAME, reflexive=True, - depth_first=True) -> List[str]: + depth_first=True) -> list[str]: """ Closure of permissible_value_children method :enum @@ -882,7 +882,7 @@ def permissible_value_descendants(self, permissible_value_text: str, @lru_cache(None) def enum_ancestors(self, enum_name: ENUM_NAME, imports=True, mixins=True, reflexive=True, is_a=True, - depth_first=True) -> List[EnumDefinitionName]: + depth_first=True) -> list[EnumDefinitionName]: """ Closure of enum_parents method @@ -899,7 +899,7 @@ def enum_ancestors(self, enum_name: ENUM_NAME, imports=True, mixins=True, reflex reflexive=reflexive, depth_first=depth_first) @lru_cache(None) - def type_ancestors(self, type_name: TYPES, imports=True, reflexive=True, depth_first=True) -> List[ + def type_ancestors(self, type_name: TYPES, imports=True, reflexive=True, depth_first=True) -> list[ TypeDefinitionName]: """ All ancestors of a type via typeof @@ -915,7 +915,7 @@ def type_ancestors(self, type_name: TYPES, imports=True, reflexive=True, depth_f reflexive=reflexive, depth_first=depth_first) @lru_cache(None) - def slot_ancestors(self, slot_name: SLOT_NAME, imports=True, mixins=True, reflexive=True, is_a=True) -> List[ + def slot_ancestors(self, slot_name: SLOT_NAME, imports=True, mixins=True, reflexive=True, is_a=True) -> list[ SlotDefinitionName]: """ Closure of slot_parents method @@ -932,7 +932,7 @@ def slot_ancestors(self, slot_name: SLOT_NAME, imports=True, mixins=True, reflex reflexive=reflexive) @lru_cache(None) - def class_descendants(self, class_name: CLASS_NAME, imports=True, mixins=True, reflexive=True, is_a=True) -> List[ + def class_descendants(self, class_name: CLASS_NAME, imports=True, mixins=True, reflexive=True, is_a=True) -> list[ ClassDefinitionName]: """ Closure of class_children method @@ -948,7 +948,7 @@ def class_descendants(self, class_name: CLASS_NAME, imports=True, mixins=True, r reflexive=reflexive) @lru_cache(None) - def slot_descendants(self, slot_name: SLOT_NAME, imports=True, mixins=True, reflexive=True, is_a=True) -> List[ + def slot_descendants(self, slot_name: SLOT_NAME, imports=True, mixins=True, reflexive=True, is_a=True) -> list[ SlotDefinitionName]: """ Closure of slot_children method @@ -964,7 +964,7 @@ def slot_descendants(self, slot_name: SLOT_NAME, imports=True, mixins=True, refl reflexive=reflexive) @lru_cache(None) - def class_roots(self, imports=True, mixins=True, is_a=True) -> List[ClassDefinitionName]: + def class_roots(self, imports=True, mixins=True, is_a=True) -> list[ClassDefinitionName]: """ All classes that have no parents :param imports: @@ -977,7 +977,7 @@ def class_roots(self, imports=True, mixins=True, is_a=True) -> List[ClassDefinit if self.class_parents(c, mixins=mixins, is_a=is_a, imports=imports) == []] @lru_cache(None) - def class_leaves(self, imports=True, mixins=True, is_a=True) -> List[ClassDefinitionName]: + def class_leaves(self, imports=True, mixins=True, is_a=True) -> list[ClassDefinitionName]: """ All classes that have no children :param imports: @@ -990,7 +990,7 @@ def class_leaves(self, imports=True, mixins=True, is_a=True) -> List[ClassDefini if self.class_children(c, mixins=mixins, is_a=is_a, imports=imports) == []] @lru_cache(None) - def slot_roots(self, imports=True, mixins=True) -> List[SlotDefinitionName]: + def slot_roots(self, imports=True, mixins=True) -> list[SlotDefinitionName]: """ All slotes that have no parents :param imports: @@ -1002,7 +1002,7 @@ def slot_roots(self, imports=True, mixins=True) -> List[SlotDefinitionName]: if self.slot_parents(c, mixins=mixins, imports=imports) == []] @lru_cache(None) - def slot_leaves(self, imports=True, mixins=True) -> List[SlotDefinitionName]: + def slot_leaves(self, imports=True, mixins=True) -> list[SlotDefinitionName]: """ All slotes that have no children :param imports: @@ -1116,7 +1116,7 @@ def expand_curie(self, uri: str) -> str: return uri @lru_cache(CACHE_SIZE) - def get_elements_applicable_by_identifier(self, identifier: str) -> List[str]: + def get_elements_applicable_by_identifier(self, identifier: str) -> list[str]: """ Get a model element by identifier. The model element corresponding to the given identifier as available via the id_prefixes mapped to that element. @@ -1132,7 +1132,7 @@ def get_elements_applicable_by_identifier(self, identifier: str) -> List[str]: return elements @lru_cache(CACHE_SIZE) - def get_elements_applicable_by_prefix(self, prefix: str) -> List[str]: + def get_elements_applicable_by_prefix(self, prefix: str) -> list[str]: """ Get a model element by prefix. The model element corresponding to the given prefix as available via the id_prefixes mapped to that element. @@ -1150,7 +1150,7 @@ def get_elements_applicable_by_prefix(self, prefix: str) -> List[str]: return applicable_elements @lru_cache(None) - def all_aliases(self) -> List[str]: + def all_aliases(self) -> list[str]: """ Get the aliases @@ -1171,8 +1171,8 @@ def all_aliases(self) -> List[str]: return element_aliases @lru_cache(None) - def get_mappings(self, element_name: ElementName = None, imports=True, expand=False) -> Dict[ - MAPPING_TYPE, List[URIorCURIE]]: + def get_mappings(self, element_name: ElementName = None, imports=True, expand=False) -> dict[ + MAPPING_TYPE, list[URIorCURIE]]: """ Get all mappings for a given element @@ -1233,7 +1233,7 @@ def inverse(self, slot_name: SlotDefinition): inverse = slot_definition.name return inverse - def get_element_by_mapping(self, mapping_id: URIorCURIE) -> List[str]: + def get_element_by_mapping(self, mapping_id: URIorCURIE) -> list[str]: model_elements = [] elements = self.all_elements() for el in elements: @@ -1243,7 +1243,7 @@ def get_element_by_mapping(self, mapping_id: URIorCURIE) -> List[str]: model_elements.append(element.name) return model_elements - def get_mapping_index(self, imports=True, expand=False) -> Dict[URIorCURIE, List[tuple[MAPPING_TYPE, Element]]]: + def get_mapping_index(self, imports=True, expand=False) -> dict[URIorCURIE, list[tuple[MAPPING_TYPE, Element]]]: """ Returns an index of all elements keyed by the mapping value. The index values are tuples of mapping type and element @@ -1279,7 +1279,7 @@ def is_relationship(self, class_name: CLASS_NAME = None, imports=True) -> bool: return False @lru_cache(None) - def annotation_dict(self, element_name: ElementName, imports=True) -> Dict[URIorCURIE, Any]: + def annotation_dict(self, element_name: ElementName, imports=True) -> dict[URIorCURIE, Any]: """ Return a dictionary where keys are annotation tags and values are annotation values for any given element. @@ -1295,7 +1295,7 @@ def annotation_dict(self, element_name: ElementName, imports=True) -> Dict[URIor return {k: v.value for k, v in e.annotations.items()} @lru_cache(None) - def class_slots(self, class_name: CLASS_NAME, imports=True, direct=False, attributes=True) -> List[ + def class_slots(self, class_name: CLASS_NAME, imports=True, direct=False, attributes=True) -> list[ SlotDefinitionName]: """ :param class_name: @@ -1431,7 +1431,7 @@ def _metaslots_for_slot(self): return vars(fake_slot).keys() @lru_cache(None) - def class_induced_slots(self, class_name: CLASS_NAME = None, imports=True) -> List[SlotDefinition]: + def class_induced_slots(self, class_name: CLASS_NAME = None, imports=True) -> list[SlotDefinition]: """ All slots that are asserted or inferred for a class, with their inferred semantics @@ -1560,7 +1560,7 @@ def is_inlined(self, slot: SlotDefinition, imports=True) -> bool: else: return False - def slot_applicable_range_elements(self, slot: SlotDefinition) -> List[ClassDefinitionName]: + def slot_applicable_range_elements(self, slot: SlotDefinition) -> list[ClassDefinitionName]: """ Returns all applicable metamodel elements for a slot range (metamodel class names returned: class_definition, enum_definition, type_definition) @@ -1589,7 +1589,7 @@ def slot_applicable_range_elements(self, slot: SlotDefinition) -> List[ClassDefi raise ValueError(f'Unrecognized range: {r}') return range_types - def slot_range_as_union(self, slot: SlotDefinition) -> List[ElementName]: + def slot_range_as_union(self, slot: SlotDefinition) -> list[ElementName]: """ Returns all applicable ranges for a slot @@ -1608,7 +1608,7 @@ def slot_range_as_union(self, slot: SlotDefinition) -> List[ElementName]: def get_classes_by_slot( self, slot: SlotDefinition, include_induced: bool = False - ) -> List[ClassDefinitionName]: + ) -> list[ClassDefinitionName]: """Get all classes that use a given slot, either as a direct or induced slot. :param slot: slot in consideration @@ -1633,7 +1633,7 @@ def get_classes_by_slot( return list(classes_set) @lru_cache(None) - def get_slots_by_enum(self, enum_name: ENUM_NAME = None) -> List[SlotDefinition]: + def get_slots_by_enum(self, enum_name: ENUM_NAME = None) -> list[SlotDefinition]: """Get all slots that use a given enum: schema defined, attribute, or slot_usage. :param enum_name: enum in consideration @@ -1650,7 +1650,7 @@ def get_slots_by_enum(self, enum_name: ENUM_NAME = None) -> List[SlotDefinition] enum_slots.append(slot_definition) return enum_slots - def get_classes_modifying_slot(self, slot: SlotDefinition) -> List[ClassDefinition]: + def get_classes_modifying_slot(self, slot: SlotDefinition) -> list[ClassDefinition]: """Get all ClassDefinitions that modify a given slot. :param slot_name: slot in consideration @@ -1684,7 +1684,7 @@ def is_slot_percent_encoded(self, slot: SlotDefinitionName) -> bool: return "percent_encoded" in anns @lru_cache(None) - def usage_index(self) -> Dict[ElementName, List[SchemaUsage]]: + def usage_index(self) -> dict[ElementName, list[SchemaUsage]]: """ Fetch an index that shows the ways in which each element is used From 0c50a863855c030c11625614b0b99b393ec4fe7a Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 14 Oct 2024 16:57:30 -0700 Subject: [PATCH 03/17] rm dataclass monkeypatch for kwargs in init --- .../utils/dataclass_extensions_376.py | 30 ------------------- linkml_runtime/utils/yamlutils.py | 8 +---- 2 files changed, 1 insertion(+), 37 deletions(-) delete mode 100644 linkml_runtime/utils/dataclass_extensions_376.py diff --git a/linkml_runtime/utils/dataclass_extensions_376.py b/linkml_runtime/utils/dataclass_extensions_376.py deleted file mode 100644 index d90b542f..00000000 --- a/linkml_runtime/utils/dataclass_extensions_376.py +++ /dev/null @@ -1,30 +0,0 @@ -import dataclasses -# -# The dataclass library builds a rigid `__init__` function that doesn't allow any unrecognized named parameters -# -# The purpose of this extension is to enhance the library to allow additional keyword arguments to passed in -# and then on to the __post_init__ function that can deal with them accordingly - -# Beware that there is no promise that signature of the create function will remain consistent -loc_fn = dataclasses._create_fn - - -def dc_create_fn(name, args, body, *_posargs, **_kwargs): - # If overriding the initializer and using a post init - if name == '__init__' and dataclasses._POST_INIT_NAME in body[-1]: - # Then insert the kwargs into the both the call and the post init - pi_parms = body[-1].rsplit(')', 1)[0] - body[-1] = pi_parms + ('' if pi_parms[-1] == '(' else ',') + ' **_kwargs)' - return loc_fn(name, list(args) + ["**_kwargs"], body, *_posargs, **_kwargs) - else: - return loc_fn(name, args, body, *_posargs, **_kwargs) - - -dataclasses._create_fn = dc_create_fn - -# The following line is here solely to be backwards compatible. -dataclasses_init_fn_with_kwargs = dataclasses._init_fn - -# The following line can be used to make certain that the import of the new create function doesn't get -# discarded as being potentially unused -DC_CREATE_FN = True diff --git a/linkml_runtime/utils/yamlutils.py b/linkml_runtime/utils/yamlutils.py index 2a5b2832..f70f9ae1 100644 --- a/linkml_runtime/utils/yamlutils.py +++ b/linkml_runtime/utils/yamlutils.py @@ -1,3 +1,4 @@ +import pdb from copy import copy from json import JSONDecoder from typing import Union, Any, Optional, Callable @@ -35,13 +36,6 @@ class YAMLRoot(JsonObj): """ The root object for all python YAML representations """ - def __init__(self, *args, **kwargs): - """ - Override dataclass initializer - @param args: - @param kwargs: - """ - super().__init__(*args, **kwargs) def __post_init__(self, *args: list[str], **kwargs): if args or kwargs: From 7ea7b73f68935af9bd61c9f89575df8086d0aedc Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 14 Oct 2024 16:59:28 -0700 Subject: [PATCH 04/17] rm from imports in test cases and modules, rm redundant 718a test, xfail 718, --- linkml_runtime/linkml_model/annotations.py | 4 -- linkml_runtime/linkml_model/datasets.py | 4 -- linkml_runtime/linkml_model/extensions.py | 4 -- linkml_runtime/linkml_model/mappings.py | 4 -- linkml_runtime/linkml_model/meta.py | 4 -- linkml_runtime/linkml_model/types.py | 4 -- linkml_runtime/linkml_model/units.py | 4 -- linkml_runtime/linkml_model/validation.py | 4 -- .../processing/validation_datamodel.py | 6 --- tests/test_index/model/container_test.py | 4 -- tests/test_issues/input/issue_355.py | 4 -- tests/test_issues/input/issue_368.py | 4 -- tests/test_issues/input/issue_368_imports.py | 4 -- tests/test_issues/models/linkml_issue_576.py | 4 -- tests/test_issues/models/model_817.py | 4 -- tests/test_issues/test_issue_355.py | 4 -- tests/test_issues/test_issue_718.py | 48 +++++++----------- tests/test_issues/test_issue_718a.py | 50 ------------------- .../models/books_normalized.py | 4 -- .../test_loaders_dumpers/models/enum_model.py | 4 -- .../models/node_object.py | 4 -- .../test_loaders_dumpers/models/personinfo.py | 4 -- .../models/personinfo_test_issue_429.py | 4 -- .../models/phenopackets.py | 4 -- .../models/termci_schema.py | 4 -- tests/test_utils/input/inlined_as_dict.py | 4 -- tests/test_utils/input/inlined_as_list.py | 4 -- tests/test_utils/model/inference_example.py | 4 -- 28 files changed, 19 insertions(+), 185 deletions(-) delete mode 100644 tests/test_issues/test_issue_718a.py diff --git a/linkml_runtime/linkml_model/annotations.py b/linkml_runtime/linkml_model/annotations.py index 3055634e..3dbd9183 100644 --- a/linkml_runtime/linkml_model/annotations.py +++ b/linkml_runtime/linkml_model/annotations.py @@ -13,7 +13,6 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from .extensions import AnyValue, Extension, ExtensionTag @@ -21,9 +20,6 @@ metamodel_version = "1.7.0" version = "2.0.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') DEFAULT_ = LINKML diff --git a/linkml_runtime/linkml_model/datasets.py b/linkml_runtime/linkml_model/datasets.py index 02c7f3cc..b637e831 100644 --- a/linkml_runtime/linkml_model/datasets.py +++ b/linkml_runtime/linkml_model/datasets.py @@ -13,7 +13,6 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_list from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -22,9 +21,6 @@ metamodel_version = "1.7.0" version = None -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces BIBO = CurieNamespace('bibo', 'http://purl.org/ontology/bibo/') CSVW = CurieNamespace('csvw', 'http://www.w3.org/ns/csvw#') diff --git a/linkml_runtime/linkml_model/extensions.py b/linkml_runtime/linkml_model/extensions.py index 05e1fbc5..9125d581 100644 --- a/linkml_runtime/linkml_model/extensions.py +++ b/linkml_runtime/linkml_model/extensions.py @@ -13,7 +13,6 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.metamodelcore import URIorCURIE @@ -21,9 +20,6 @@ metamodel_version = "1.7.0" version = "2.0.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') DEFAULT_ = LINKML diff --git a/linkml_runtime/linkml_model/mappings.py b/linkml_runtime/linkml_model/mappings.py index e2232494..57035d51 100644 --- a/linkml_runtime/linkml_model/mappings.py +++ b/linkml_runtime/linkml_model/mappings.py @@ -10,16 +10,12 @@ from typing import Optional, Union from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.metamodelcore import URIorCURIE metamodel_version = "1.7.0" version = "2.0.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces IAO = CurieNamespace('IAO', 'http://purl.obolibrary.org/obo/IAO_') OIO = CurieNamespace('OIO', 'http://www.geneontology.org/formats/oboInOwl#') diff --git a/linkml_runtime/linkml_model/meta.py b/linkml_runtime/linkml_model/meta.py index 4bbfa3dd..b99b0f7e 100644 --- a/linkml_runtime/linkml_model/meta.py +++ b/linkml_runtime/linkml_model/meta.py @@ -38,7 +38,6 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_list, empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.formatutils import sfx from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef @@ -51,9 +50,6 @@ metamodel_version = "1.7.0" version = None -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces IAO = CurieNamespace('IAO', 'http://purl.obolibrary.org/obo/IAO_') NCIT = CurieNamespace('NCIT', 'http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#') diff --git a/linkml_runtime/linkml_model/types.py b/linkml_runtime/linkml_model/types.py index ba0a7bc2..f60eac8a 100644 --- a/linkml_runtime/linkml_model/types.py +++ b/linkml_runtime/linkml_model/types.py @@ -8,16 +8,12 @@ import dataclasses -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.metamodelcore import Bool, Curie, Decimal, ElementIdentifier, NCName, NodeIdentifier, URI, URIorCURIE, XSDDate, XSDDateTime, XSDTime metamodel_version = "1.7.0" version = None -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') SCHEMA = CurieNamespace('schema', 'http://schema.org/') diff --git a/linkml_runtime/linkml_model/units.py b/linkml_runtime/linkml_model/units.py index c31b1d95..e14943aa 100644 --- a/linkml_runtime/linkml_model/units.py +++ b/linkml_runtime/linkml_model/units.py @@ -13,7 +13,6 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_list from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.metamodelcore import URIorCURIE @@ -21,9 +20,6 @@ metamodel_version = "1.7.0" version = None -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces IAO = CurieNamespace('IAO', 'http://purl.obolibrary.org/obo/IAO_') OIO = CurieNamespace('OIO', 'http://www.geneontology.org/formats/oboInOwl#') diff --git a/linkml_runtime/linkml_model/validation.py b/linkml_runtime/linkml_model/validation.py index ee4615c1..e506a401 100644 --- a/linkml_runtime/linkml_model/validation.py +++ b/linkml_runtime/linkml_model/validation.py @@ -14,7 +14,6 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_list from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -23,9 +22,6 @@ metamodel_version = "1.7.0" version = None -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') OWL = CurieNamespace('owl', 'http://www.w3.org/2002/07/owl#') diff --git a/linkml_runtime/processing/validation_datamodel.py b/linkml_runtime/processing/validation_datamodel.py index a65b7f29..b4fb76b6 100644 --- a/linkml_runtime/processing/validation_datamodel.py +++ b/linkml_runtime/processing/validation_datamodel.py @@ -20,9 +20,6 @@ from linkml_runtime.utils.yamlutils import ( YAMLRoot, ) -from linkml_runtime.utils.dataclass_extensions_376 import ( - dataclasses_init_fn_with_kwargs, -) from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -31,9 +28,6 @@ metamodel_version = "1.7.0" version = None -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") OWL = CurieNamespace("owl", "http://www.w3.org/2002/07/owl#") diff --git a/tests/test_index/model/container_test.py b/tests/test_index/model/container_test.py index 1dc73f10..84c2603c 100644 --- a/tests/test_index/model/container_test.py +++ b/tests/test_index/model/container_test.py @@ -16,7 +16,6 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_list, empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -25,9 +24,6 @@ metamodel_version = "1.7.0" version = None -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces CODE = CurieNamespace('CODE', 'http://example.org/code/') GEO = CurieNamespace('GEO', 'http://example.org/geoloc/') diff --git a/tests/test_issues/input/issue_355.py b/tests/test_issues/input/issue_355.py index ecf17ce3..991d356c 100644 --- a/tests/test_issues/input/issue_355.py +++ b/tests/test_issues/input/issue_355.py @@ -13,16 +13,12 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.metamodelcore import URIorCURIE metamodel_version = "1.7.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') SCT = CurieNamespace('sct', 'http://snomed.info/id/') diff --git a/tests/test_issues/input/issue_368.py b/tests/test_issues/input/issue_368.py index 0f02158d..39b6d31b 100644 --- a/tests/test_issues/input/issue_368.py +++ b/tests/test_issues/input/issue_368.py @@ -11,16 +11,12 @@ from dataclasses import dataclass from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from .issue_368_imports import ParentClass, SampleEnum metamodel_version = "1.7.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') DEFAULT_ = CurieNamespace('', 'https://microbiomedata/schema/') diff --git a/tests/test_issues/input/issue_368_imports.py b/tests/test_issues/input/issue_368_imports.py index e15bdb15..823524c0 100644 --- a/tests/test_issues/input/issue_368_imports.py +++ b/tests/test_issues/input/issue_368_imports.py @@ -11,7 +11,6 @@ from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -19,9 +18,6 @@ metamodel_version = "1.7.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces DEFAULT_ = CurieNamespace('', 'https://microbiomedata/schema/mixs/') diff --git a/tests/test_issues/models/linkml_issue_576.py b/tests/test_issues/models/linkml_issue_576.py index 89a1f39d..0b7bf1f9 100644 --- a/tests/test_issues/models/linkml_issue_576.py +++ b/tests/test_issues/models/linkml_issue_576.py @@ -13,7 +13,6 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_list, empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.linkml_model.types import String @@ -22,9 +21,6 @@ metamodel_version = "1.7.0" version = None -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces EX = CurieNamespace('ex', 'https://example.org/') LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') diff --git a/tests/test_issues/models/model_817.py b/tests/test_issues/models/model_817.py index f9ca3298..874a9162 100644 --- a/tests/test_issues/models/model_817.py +++ b/tests/test_issues/models/model_817.py @@ -15,7 +15,6 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_list, empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -23,9 +22,6 @@ metamodel_version = "1.7.0" version = None -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') PERSONINFO = CurieNamespace('personinfo', 'https://w3id.org/linkml/examples/personinfo/') diff --git a/tests/test_issues/test_issue_355.py b/tests/test_issues/test_issue_355.py index a2032ff7..4e44ad74 100644 --- a/tests/test_issues/test_issue_355.py +++ b/tests/test_issues/test_issue_355.py @@ -14,16 +14,12 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.metamodelcore import URIorCURIE metamodel_version = "1.7.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') SCT = CurieNamespace('sct', 'http://snomed.info/id/') diff --git a/tests/test_issues/test_issue_718.py b/tests/test_issues/test_issue_718.py index 63d0b879..5ad6e331 100644 --- a/tests/test_issues/test_issue_718.py +++ b/tests/test_issues/test_issue_718.py @@ -1,18 +1,14 @@ -import dataclasses -import unittest +import pytest from dataclasses import dataclass from typing import Optional, ClassVar import yaml -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.yamlutils import YAMLRoot, DupCheckYamlLoader -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - -class Issue83TestCase(unittest.TestCase): +@pytest.mark.xfail(reason='Reporting line numbers should happen at load time not when instantiating dataclasses') +def test_issue_38(): # The goal is to provide line numbers on error messages. We've tweaked the parser so that it returns augmented # str's and int's with the line numbers on them. The problem we are trying to address now is that the dataclass # constructor doesn't support **argv out of the box. We can certainly tweak the generator to emit the __init__ @@ -25,27 +21,21 @@ class FesterBesterTester(YAMLRoot): a: Optional[int] = 0 b: Optional[str] = None - def test_initvar(self): - with self.assertRaises(ValueError) as e: - Issue83TestCase.FesterBesterTester(a=12, b="Sell", c="buy") - self.assertEqual("Unknown argument: c = 'buy'", str(e.exception).strip()) - yaml_str = """base: + with pytest.raises(TypeError, match="unexpected keyword argument 'c'"): + FesterBesterTester(a=12, b="Sell", c="buy") + + yaml_str = """base: a: 17 b: Ice Cream - c: sell -""" - parsed_yaml = yaml.load(yaml_str, DupCheckYamlLoader) - with self.assertRaises(ValueError) as e: - Issue83TestCase.FesterBesterTester(**parsed_yaml['base']) - self.assertEqual('File "", line 4, col 9: Unknown argument: c = \'sell\'', - str(e.exception).strip()) - - parsed_yaml['base'].pop('c', None) - try: - Issue83TestCase.FesterBesterTester(**parsed_yaml['base']) - except Exception as e: - self.fail(f'Raised exception unexpectedly: {str(e.exception)}') - - -if __name__ == '__main__': - unittest.main() + c: sell""" + + parsed_yaml = yaml.load(yaml_str, DupCheckYamlLoader) + with pytest.raises(TypeError, match="File \"\", line 4, col 9"): + FesterBesterTester(**parsed_yaml['base']) + + parsed_yaml['base'].pop('c', None) + + instance = FesterBesterTester(**parsed_yaml['base']) + assert instance.a == 17 + assert instance.b == "Ice Cream" + diff --git a/tests/test_issues/test_issue_718a.py b/tests/test_issues/test_issue_718a.py deleted file mode 100644 index ad6e9dc0..00000000 --- a/tests/test_issues/test_issue_718a.py +++ /dev/null @@ -1,50 +0,0 @@ -import unittest -from dataclasses import dataclass -from typing import Optional, ClassVar - -import yaml - -import linkml_runtime.utils.dataclass_extensions_376 as dc_tweak -# This line makes certain that the import remains -DC_IN = dc_tweak.DC_CREATE_FN - -from linkml_runtime.utils.yamlutils import YAMLRoot, DupCheckYamlLoader - - -class Issue83TestCase(unittest.TestCase): - # The goal is to provide line numbers on error messages. We've tweaked the parser so that it returns augmented - # str's and int's with the line numbers on them. The problem we are trying to address now is that the dataclass - # constructor doesn't support **argv out of the box. We can certainly tweak the generator to emit the __init__ - # method to do this, but it would be really handy - - @dataclass - class FesterBesterTester(YAMLRoot): - cv: ClassVar[int] = 42 - - a: Optional[int] = 0 - b: Optional[str] = None - - def test_initvar(self): - with self.assertRaises(ValueError) as e: - Issue83TestCase.FesterBesterTester(a=12, b="Sell", c="buy") - self.assertEqual("Unknown argument: c = 'buy'", str(e.exception).strip()) - yaml_str = """base: - a: 17 - b: Ice Cream - c: sell -""" - parsed_yaml = yaml.load(yaml_str, DupCheckYamlLoader) - with self.assertRaises(ValueError) as e: - Issue83TestCase.FesterBesterTester(**parsed_yaml['base']) - self.assertEqual('File "", line 4, col 9: Unknown argument: c = \'sell\'', - str(e.exception).strip()) - - parsed_yaml['base'].pop('c', None) - try: - Issue83TestCase.FesterBesterTester(**parsed_yaml['base']) - except Exception as e: - self.fail(f'Raised exception unexpectedly: {str(e.exception)}') - - -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_loaders_dumpers/models/books_normalized.py b/tests/test_loaders_dumpers/models/books_normalized.py index 35edd068..5ef2eb8d 100644 --- a/tests/test_loaders_dumpers/models/books_normalized.py +++ b/tests/test_loaders_dumpers/models/books_normalized.py @@ -15,16 +15,12 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_list, empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace metamodel_version = "1.7.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces EXAMPLE = CurieNamespace('example', 'https://w3id.org/example') LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') diff --git a/tests/test_loaders_dumpers/models/enum_model.py b/tests/test_loaders_dumpers/models/enum_model.py index 4c64c484..29268796 100644 --- a/tests/test_loaders_dumpers/models/enum_model.py +++ b/tests/test_loaders_dumpers/models/enum_model.py @@ -13,7 +13,6 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -21,9 +20,6 @@ metamodel_version = "1.7.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces DEFAULT_ = CurieNamespace('', 'https://example.org/enum_test/') diff --git a/tests/test_loaders_dumpers/models/node_object.py b/tests/test_loaders_dumpers/models/node_object.py index 4cbf888d..8fbfe102 100644 --- a/tests/test_loaders_dumpers/models/node_object.py +++ b/tests/test_loaders_dumpers/models/node_object.py @@ -14,15 +14,11 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_list from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace metamodel_version = "1.7.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces EX = CurieNamespace('ex', 'https://w3id.org/example/') LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') diff --git a/tests/test_loaders_dumpers/models/personinfo.py b/tests/test_loaders_dumpers/models/personinfo.py index 643ccb8b..8b28bc49 100644 --- a/tests/test_loaders_dumpers/models/personinfo.py +++ b/tests/test_loaders_dumpers/models/personinfo.py @@ -16,7 +16,6 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_list, empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -26,9 +25,6 @@ metamodel_version = "1.7.0" version = None -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces GSSO = CurieNamespace('GSSO', 'http://purl.obolibrary.org/obo/GSSO_') HP = CurieNamespace('HP', 'http://purl.obolibrary.org/obo/HP_') diff --git a/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py b/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py index 68aaf70c..4ec14d1c 100644 --- a/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py +++ b/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py @@ -13,16 +13,12 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace metamodel_version = "1.7.0" version = None -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces ORCID = CurieNamespace('ORCID', 'https://orcid.org/') LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') diff --git a/tests/test_loaders_dumpers/models/phenopackets.py b/tests/test_loaders_dumpers/models/phenopackets.py index 0b2446ca..5ad33459 100644 --- a/tests/test_loaders_dumpers/models/phenopackets.py +++ b/tests/test_loaders_dumpers/models/phenopackets.py @@ -15,7 +15,6 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_list, empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -24,9 +23,6 @@ metamodel_version = "1.7.0" version = None -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces ARGO = CurieNamespace('ARGO', 'https://docs.icgc-argo.org/dictionary/') GENO = CurieNamespace('GENO', 'http://purl.obolibrary.org/obo/GENO_') diff --git a/tests/test_loaders_dumpers/models/termci_schema.py b/tests/test_loaders_dumpers/models/termci_schema.py index 1f5a0e45..ed47afd5 100644 --- a/tests/test_loaders_dumpers/models/termci_schema.py +++ b/tests/test_loaders_dumpers/models/termci_schema.py @@ -12,16 +12,12 @@ from linkml_runtime.utils.metamodelcore import empty_list, empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.metamodelcore import URI, URIorCURIE metamodel_version = "1.7.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces DC = CurieNamespace('dc', 'http://purl.org/dc/elements/1.1/') LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') diff --git a/tests/test_utils/input/inlined_as_dict.py b/tests/test_utils/input/inlined_as_dict.py index 7f43820e..e4ecabe6 100644 --- a/tests/test_utils/input/inlined_as_dict.py +++ b/tests/test_utils/input/inlined_as_dict.py @@ -12,16 +12,12 @@ from linkml_runtime.utils.metamodelcore import empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace metamodel_version = "1.7.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces EX = CurieNamespace('ex', 'https://example.org/inlined_as_dict#') XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') diff --git a/tests/test_utils/input/inlined_as_list.py b/tests/test_utils/input/inlined_as_list.py index 1c91129b..c50d2fe0 100644 --- a/tests/test_utils/input/inlined_as_list.py +++ b/tests/test_utils/input/inlined_as_list.py @@ -12,16 +12,12 @@ from linkml_runtime.utils.metamodelcore import empty_dict from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace metamodel_version = "1.7.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces EX = CurieNamespace('ex', 'https://example.org/inlined_as_dict#') XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') diff --git a/tests/test_utils/model/inference_example.py b/tests/test_utils/model/inference_example.py index 7be9c8a8..76888dd9 100644 --- a/tests/test_utils/model/inference_example.py +++ b/tests/test_utils/model/inference_example.py @@ -15,7 +15,6 @@ from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.metamodelcore import empty_list from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef from linkml_runtime.utils.curienamespace import CurieNamespace @@ -24,9 +23,6 @@ metamodel_version = "1.7.0" -# Overwrite dataclasses _init_fn to add **kwargs in __init__ -dataclasses._init_fn = dataclasses_init_fn_with_kwargs - # Namespaces EX = CurieNamespace('ex', 'https://w3id.org/linkml/examples/inference/') LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') From 81fd0cc765d4ca125a6ad61298fd3c0fe1fc0cfe Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 14 Oct 2024 16:59:52 -0700 Subject: [PATCH 05/17] rm deprecated pydantic calls for what feels like the one thousandth time --- linkml_runtime/dumpers/json_dumper.py | 6 +++--- linkml_runtime/dumpers/rdf_dumper.py | 4 ++-- linkml_runtime/loaders/loader_root.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/linkml_runtime/dumpers/json_dumper.py b/linkml_runtime/dumpers/json_dumper.py index 6b34305f..9d44c730 100644 --- a/linkml_runtime/dumpers/json_dumper.py +++ b/linkml_runtime/dumpers/json_dumper.py @@ -30,7 +30,7 @@ def dump(self, element: Union[BaseModel, YAMLRoot], to_file: str, contexts: CONT * A list containing elements of any type named above """ if isinstance(element, BaseModel): - element = element.dict() + element = element.model_dump() super().dump(element, to_file, contexts=contexts, **kwargs) def dumps(self, element: Union[BaseModel, YAMLRoot], contexts: CONTEXTS_PARAM_TYPE = None, inject_type=True) -> str: @@ -50,7 +50,7 @@ def dumps(self, element: Union[BaseModel, YAMLRoot], contexts: CONTEXTS_PARAM_TY def default(o): if isinstance(o, BaseModel): - return remove_empty_items(o.dict(), hide_protected_keys=True) + return remove_empty_items(o.model_dump(), hide_protected_keys=True) if isinstance(o, YAMLRoot): return remove_empty_items(o, hide_protected_keys=True) elif isinstance(o, Decimal): @@ -59,7 +59,7 @@ def default(o): else: return json.JSONDecoder().decode(o) if isinstance(element, BaseModel): - element = element.dict() + element = element.model_dump() return json.dumps(as_json_object(element, contexts, inject_type=inject_type), default=default, ensure_ascii=False, diff --git a/linkml_runtime/dumpers/rdf_dumper.py b/linkml_runtime/dumpers/rdf_dumper.py index 6de4251b..d49cd496 100644 --- a/linkml_runtime/dumpers/rdf_dumper.py +++ b/linkml_runtime/dumpers/rdf_dumper.py @@ -79,7 +79,7 @@ def dump(self, element: Union[BaseModel, YAMLRoot], to_file: str, contexts: CONT :param fmt: RDF format """ if isinstance(element, BaseModel): - element = element.dict() + element = element.model_dump() super().dump(element, to_file, contexts=contexts, fmt=fmt) def dumps(self, element: Union[BaseModel, YAMLRoot], contexts: CONTEXTS_PARAM_TYPE = None, fmt: Optional[str] = 'turtle') -> str: @@ -91,6 +91,6 @@ def dumps(self, element: Union[BaseModel, YAMLRoot], contexts: CONTEXTS_PARAM_TY :return: rdflib Graph containing element """ if isinstance(element, BaseModel): - element = element.dict() + element = element.model_dump() return self.as_rdf_graph(remove_empty_items(element, hide_protected_keys=True), contexts).\ serialize(format=fmt) diff --git a/linkml_runtime/loaders/loader_root.py b/linkml_runtime/loaders/loader_root.py index 49e3fae2..137d9913 100644 --- a/linkml_runtime/loaders/loader_root.py +++ b/linkml_runtime/loaders/loader_root.py @@ -127,12 +127,12 @@ def _construct_target_class(self, if issubclass(target_class, YAMLRoot): return [target_class(**as_dict(x)) for x in data_as_dict] elif issubclass(target_class, BaseModel): - return [target_class.parse_obj(as_dict(x)) for x in data_as_dict] + return [target_class.model_validate(as_dict(x)) for x in data_as_dict] else: raise ValueError(f'Cannot load list of {target_class}') elif isinstance(data_as_dict, dict): if issubclass(target_class, BaseModel): - return target_class.parse_obj(data_as_dict) + return target_class.model_validate(data_as_dict) else: return target_class(**data_as_dict) elif isinstance(data_as_dict, JsonObj): From cc8079cd3a158f2bfa607b47a86f8345b690eb62 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 14 Oct 2024 17:00:25 -0700 Subject: [PATCH 06/17] rm block marked as to be deprecated with python 3.7 but without deprecation warning we actually have no way of keeping track of that. --- linkml_runtime/utils/eval_utils.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/linkml_runtime/utils/eval_utils.py b/linkml_runtime/utils/eval_utils.py index a7d28bfb..31a7bdaf 100644 --- a/linkml_runtime/utils/eval_utils.py +++ b/linkml_runtime/utils/eval_utils.py @@ -106,9 +106,6 @@ def eval_(node, bindings={}): return node.value elif isinstance(node, ast.Constant): return node.value - elif isinstance(node, ast.NameConstant): - # can be removed when python 3.7 is no longer supported - return node.value elif isinstance(node, ast.Name): return bindings.get(node.id) elif isinstance(node, ast.Subscript): From 311ae03de27d05278ceb5152fdc654dcc2a5685e Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 14 Oct 2024 17:00:42 -0700 Subject: [PATCH 07/17] don't discover TestEnvironment as being itself a test --- tests/support/test_environment.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/support/test_environment.py b/tests/support/test_environment.py index 8bebdbac..35efa086 100644 --- a/tests/support/test_environment.py +++ b/tests/support/test_environment.py @@ -35,6 +35,8 @@ class MismatchAction(Enum): class TestEnvironment: import_map_warning_emitted: bool = False + __test__ = False + """ Testing environment """ def __init__(self, filedir: str) -> None: self.cwd = os.path.dirname(filedir) # base directory for indir, outdir and tempdir From c6c04bee2a32d7f2b7d58af28066975f37ce904e Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 14 Oct 2024 17:34:44 -0700 Subject: [PATCH 08/17] python 3.9 compat --- .../models/books_normalized_pydantic.py | 61 +++--- .../models/kitchen_sink_pydantic.py | 192 +++++++++--------- tox.ini | 11 +- 3 files changed, 132 insertions(+), 132 deletions(-) diff --git a/tests/test_loaders_dumpers/models/books_normalized_pydantic.py b/tests/test_loaders_dumpers/models/books_normalized_pydantic.py index ec421751..2200fb7a 100644 --- a/tests/test_loaders_dumpers/models/books_normalized_pydantic.py +++ b/tests/test_loaders_dumpers/models/books_normalized_pydantic.py @@ -1,5 +1,6 @@ from __future__ import annotations from enum import Enum +from typing import Optional from pydantic import BaseModel as BaseModel, Field metamodel_version = "None" @@ -31,66 +32,66 @@ class GenreEnum(str, Enum): class CreativeWork(ConfiguredBaseModel): - id: str | None = Field(None) - name: str | None = Field(None) - genres: list[GenreEnum] | None = Field(default_factory=list) - creator: Author | None = Field(None) - summary: str | None = Field(None) - reviews: list[Review] | None = Field(default_factory=list) + id: Optional[str] = Field(None) + name: Optional[str] = Field(None) + genres: Optional[list[GenreEnum]] = Field(default_factory=list) + creator: Optional[Author] = Field(None) + summary: Optional[str] = Field(None) + reviews: Optional[list[Review]] = Field(default_factory=list) class Book(CreativeWork): - price: float | None = Field(None) - inStock: str | None = Field(None) - id: str | None = Field(None) - name: str | None = Field(None) - genres: list[GenreEnum] | None = Field(default_factory=list) - creator: Author | None = Field(None) - summary: str | None = Field(None) - reviews: list[Review] | None = Field(default_factory=list) + price: Optional[float] = Field(None) + inStock: Optional[str] = Field(None) + id: Optional[str] = Field(None) + name: Optional[str] = Field(None) + genres: Optional[list[GenreEnum]] = Field(default_factory=list) + creator: Optional[Author] = Field(None) + summary: Optional[str] = Field(None) + reviews: Optional[list[Review]] = Field(default_factory=list) class BookSeries(CreativeWork): - books: list[Book] | None = Field(default_factory=list) - genres: list[GenreEnum] | None = Field(default_factory=list) - price: float | None = Field(None) - id: str | None = Field(None) - name: str | None = Field(None) - creator: Author | None = Field(None) - summary: str | None = Field(None) - reviews: list[Review] | None = Field(default_factory=list) + books: Optional[list[Book]] = Field(default_factory=list) + genres: Optional[list[GenreEnum]] = Field(default_factory=list) + price: Optional[float] = Field(None) + id: Optional[str] = Field(None) + name: Optional[str] = Field(None) + creator: Optional[Author] = Field(None) + summary: Optional[str] = Field(None) + reviews: Optional[list[Review]] = Field(default_factory=list) class Author(ConfiguredBaseModel): - name: str | None = Field(None) - genres: list[GenreEnum] | None = Field(default_factory=list) - from_country: str | None = Field(None) + name: Optional[str] = Field(None) + genres: Optional[list[GenreEnum]] = Field(default_factory=list) + from_country: Optional[str] = Field(None) class Shop(ConfiguredBaseModel): - all_book_series: list[BookSeries] | None = Field(default_factory=list) + all_book_series: Optional[list[BookSeries]] = Field(default_factory=list) class Country(ConfiguredBaseModel): - name: str | None = Field(None) + name: Optional[str] = Field(None) class Review(ConfiguredBaseModel): - creator: Author | None = Field(None) - rating: int | None = Field(None) - review_text: str | None = Field(None) + creator: Optional[Author] = Field(None) + rating: Optional[int] = Field(None) + review_text: Optional[str] = Field(None) diff --git a/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py b/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py index 96a6570c..bc99155d 100644 --- a/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py +++ b/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py @@ -1,7 +1,7 @@ from __future__ import annotations from datetime import date from enum import Enum -from typing import Any +from typing import Any, Optional from pydantic import BaseModel as BaseModel, Field metamodel_version = "None" @@ -60,13 +60,13 @@ class LifeStatusEnum(str, Enum): class HasAliases(ConfiguredBaseModel): - aliases: list[str] | None = Field(default_factory=list) + aliases: Optional[list[str]] = Field(default_factory=list) class Friend(ConfiguredBaseModel): - name: str | None = Field(None) + name: Optional[str] = Field(None) @@ -74,18 +74,18 @@ class Person(HasAliases): """ A person, living or dead """ - id: str | None = Field(None) - name: str | None = Field(None) - has_employment_history: list[EmploymentEvent] | None = Field(None) - has_familial_relationships: list[FamilialRelationship] | None = Field(None) - has_medical_history: list[MedicalEvent] | None = Field(None) - age_in_years: int | None = Field(None, description="""number of years since birth""", ge=0, le=999) - addresses: list[Address] | None = Field(default_factory=list) - has_birth_event: BirthEvent | None = Field(None) - species_name: str | None = Field(None) - stomach_count: int | None = Field(None) - is_living: LifeStatusEnum | None = Field(None) - aliases: list[str] | None = Field(default_factory=list) + id: Optional[str] = Field(None) + name: Optional[str] = Field(None) + has_employment_history: Optional[list[EmploymentEvent]] = Field(None) + has_familial_relationships: Optional[list[FamilialRelationship]] = Field(None) + has_medical_history: Optional[list[MedicalEvent]] = Field(None) + age_in_years: Optional[int] = Field(None, description="""number of years since birth""", ge=0, le=999) + addresses: Optional[list[Address]] = Field(default_factory=list) + has_birth_event: Optional[BirthEvent] = Field(None) + species_name: Optional[str] = Field(None) + stomach_count: Optional[int] = Field(None) + is_living: Optional[LifeStatusEnum] = Field(None) + aliases: Optional[list[str]] = Field(default_factory=list) @@ -102,73 +102,73 @@ class Organization(HasAliases): * a * list """ - id: str | None = Field(None) - name: str | None = Field(None) - aliases: list[str] | None = Field(default_factory=list) + id: Optional[str] = Field(None) + name: Optional[str] = Field(None) + aliases: Optional[list[str]] = Field(default_factory=list) class Place(HasAliases): - id: str | None = Field(None) - name: str | None = Field(None) - aliases: list[str] | None = Field(default_factory=list) + id: Optional[str] = Field(None) + name: Optional[str] = Field(None) + aliases: Optional[list[str]] = Field(default_factory=list) class Address(ConfiguredBaseModel): - street: str | None = Field(None) - city: str | None = Field(None) + street: Optional[str] = Field(None) + city: Optional[str] = Field(None) class Concept(ConfiguredBaseModel): - id: str | None = Field(None) - name: str | None = Field(None) - in_code_system: str | None = Field(None) + id: Optional[str] = Field(None) + name: Optional[str] = Field(None) + in_code_system: Optional[str] = Field(None) class DiagnosisConcept(Concept): - id: str | None = Field(None) - name: str | None = Field(None) - in_code_system: str | None = Field(None) + id: Optional[str] = Field(None) + name: Optional[str] = Field(None) + in_code_system: Optional[str] = Field(None) class ProcedureConcept(Concept): - id: str | None = Field(None) - name: str | None = Field(None) - in_code_system: str | None = Field(None) + id: Optional[str] = Field(None) + name: Optional[str] = Field(None) + in_code_system: Optional[str] = Field(None) class Event(ConfiguredBaseModel): - started_at_time: date | None = Field(None) - ended_at_time: date | None = Field(None) - is_current: bool | None = Field(None) - metadata: Any | None = Field(None, description="""Example of a slot that has an unconstrained range""") + started_at_time: Optional[date] = Field(None) + ended_at_time: Optional[date] = Field(None) + is_current: Optional[bool] = Field(None) + metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") class Relationship(ConfiguredBaseModel): - started_at_time: date | None = Field(None) - ended_at_time: date | None = Field(None) - related_to: str | None = Field(None) - type: str | None = Field(None) + started_at_time: Optional[date] = Field(None) + ended_at_time: Optional[date] = Field(None) + related_to: Optional[str] = Field(None) + type: Optional[str] = Field(None) class FamilialRelationship(Relationship): - started_at_time: date | None = Field(None) - ended_at_time: date | None = Field(None) + started_at_time: Optional[date] = Field(None) + ended_at_time: Optional[date] = Field(None) related_to: str = Field(...) type: FamilialRelationshipType = Field(...) @@ -176,103 +176,103 @@ class FamilialRelationship(Relationship): class BirthEvent(Event): - in_location: str | None = Field(None) - started_at_time: date | None = Field(None) - ended_at_time: date | None = Field(None) - is_current: bool | None = Field(None) - metadata: Any | None = Field(None, description="""Example of a slot that has an unconstrained range""") + in_location: Optional[str] = Field(None) + started_at_time: Optional[date] = Field(None) + ended_at_time: Optional[date] = Field(None) + is_current: Optional[bool] = Field(None) + metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") class EmploymentEvent(Event): - employed_at: str | None = Field(None) - type: EmploymentEventType | None = Field(None) - started_at_time: date | None = Field(None) - ended_at_time: date | None = Field(None) - is_current: bool | None = Field(None) - metadata: Any | None = Field(None, description="""Example of a slot that has an unconstrained range""") + employed_at: Optional[str] = Field(None) + type: Optional[EmploymentEventType] = Field(None) + started_at_time: Optional[date] = Field(None) + ended_at_time: Optional[date] = Field(None) + is_current: Optional[bool] = Field(None) + metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") class MedicalEvent(Event): - in_location: str | None = Field(None) - diagnosis: DiagnosisConcept | None = Field(None) - procedure: ProcedureConcept | None = Field(None) - started_at_time: date | None = Field(None) - ended_at_time: date | None = Field(None) - is_current: bool | None = Field(None) - metadata: Any | None = Field(None, description="""Example of a slot that has an unconstrained range""") + in_location: Optional[str] = Field(None) + diagnosis: Optional[DiagnosisConcept] = Field(None) + procedure: Optional[ProcedureConcept] = Field(None) + started_at_time: Optional[date] = Field(None) + ended_at_time: Optional[date] = Field(None) + is_current: Optional[bool] = Field(None) + metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") class WithLocation(ConfiguredBaseModel): - in_location: str | None = Field(None) + in_location: Optional[str] = Field(None) class MarriageEvent(WithLocation, Event): - married_to: str | None = Field(None) - in_location: str | None = Field(None) - started_at_time: date | None = Field(None) - ended_at_time: date | None = Field(None) - is_current: bool | None = Field(None) - metadata: Any | None = Field(None, description="""Example of a slot that has an unconstrained range""") + married_to: Optional[str] = Field(None) + in_location: Optional[str] = Field(None) + started_at_time: Optional[date] = Field(None) + ended_at_time: Optional[date] = Field(None) + is_current: Optional[bool] = Field(None) + metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") class Company(Organization): - ceo: str | None = Field(None) - id: str | None = Field(None) - name: str | None = Field(None) - aliases: list[str] | None = Field(default_factory=list) + ceo: Optional[str] = Field(None) + id: Optional[str] = Field(None) + name: Optional[str] = Field(None) + aliases: Optional[list[str]] = Field(default_factory=list) class CodeSystem(ConfiguredBaseModel): - id: str | None = Field(None) - name: str | None = Field(None) + id: Optional[str] = Field(None) + name: Optional[str] = Field(None) class Dataset(ConfiguredBaseModel): - metadata: Any | None = Field(None, description="""Example of a slot that has an unconstrained range""") - persons: list[Person] | None = Field(default_factory=list) - companies: list[Company] | None = Field(default_factory=list) - activities: list[Activity] | None = Field(default_factory=list) - code_systems: dict[str, CodeSystem] | None = Field(None) + metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") + persons: Optional[list[Person]] = Field(default_factory=list) + companies: Optional[list[Company]] = Field(default_factory=list) + activities: Optional[list[Activity]] = Field(default_factory=list) + code_systems: Optional[dict[str, CodeSystem]] = Field(None) class FakeClass(ConfiguredBaseModel): - test_attribute: str | None = Field(None) + test_attribute: Optional[str] = Field(None) class ClassWithSpaces(ConfiguredBaseModel): - slot_with_space_1: str | None = Field(None) + slot_with_space_1: Optional[str] = Field(None) class SubclassTest(ClassWithSpaces): - slot_with_space_2: ClassWithSpaces | None = Field(None) - slot_with_space_1: str | None = Field(None) + slot_with_space_2: Optional[ClassWithSpaces] = Field(None) + slot_with_space_1: Optional[str] = Field(None) class SubSubClass2(SubclassTest): - slot_with_space_2: ClassWithSpaces | None = Field(None) - slot_with_space_1: str | None = Field(None) + slot_with_space_2: Optional[ClassWithSpaces] = Field(None) + slot_with_space_1: Optional[str] = Field(None) @@ -280,8 +280,8 @@ class TubSubClass1(SubclassTest): """ Same depth as Sub sub class 1 """ - slot_with_space_2: ClassWithSpaces | None = Field(None) - slot_with_space_1: str | None = Field(None) + slot_with_space_2: Optional[ClassWithSpaces] = Field(None) + slot_with_space_1: Optional[str] = Field(None) @@ -289,13 +289,13 @@ class Activity(ConfiguredBaseModel): """ a provence-generating activity """ - id: str | None = Field(None) - started_at_time: date | None = Field(None) - ended_at_time: date | None = Field(None) - was_informed_by: str | None = Field(None) - was_associated_with: str | None = Field(None) - used: str | None = Field(None) - description: str | None = Field(None) + id: Optional[str] = Field(None) + started_at_time: Optional[date] = Field(None) + ended_at_time: Optional[date] = Field(None) + was_informed_by: Optional[str] = Field(None) + was_associated_with: Optional[str] = Field(None) + used: Optional[str] = Field(None) + description: Optional[str] = Field(None) @@ -303,9 +303,9 @@ class Agent(ConfiguredBaseModel): """ a provence-generating agent """ - id: str | None = Field(None) - acted_on_behalf_of: str | None = Field(None) - was_informed_by: str | None = Field(None) + id: Optional[str] = Field(None) + acted_on_behalf_of: Optional[str] = Field(None) + was_informed_by: Optional[str] = Field(None) diff --git a/tox.ini b/tox.ini index d33deaa0..418842ed 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,11 @@ [tox] envlist = py37, py38, py39, py310 isolated_build = true -skipsdist = true - [testenv] -whitelist_externals = poetry +deps= + pytest + requests-cache + coverage commands= - poetry install -v - poetry run python -m unittest - poetry run comparefiles --help + python -m pytest From 81d72ce75c1658620029231cf3d1378f654ca3d5 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 14 Oct 2024 18:15:51 -0700 Subject: [PATCH 09/17] add ruff, black, and codespell rules from upstreadm --- poetry.lock | 114 ++++++++++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 57 ++++++++++++++++++++++--- tox.ini | 26 ++++++++++- 3 files changed, 189 insertions(+), 8 deletions(-) diff --git a/poetry.lock b/poetry.lock index be90c706..8b316fe4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -30,6 +30,52 @@ docs = ["cogapp", "furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphi tests = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] tests-mypy = ["mypy (>=1.11.1)", "pytest-mypy-plugins"] +[[package]] +name = "black" +version = "24.10.0" +description = "The uncompromising code formatter." +optional = false +python-versions = ">=3.9" +files = [ + {file = "black-24.10.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e6668650ea4b685440857138e5fe40cde4d652633b1bdffc62933d0db4ed9812"}, + {file = "black-24.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1c536fcf674217e87b8cc3657b81809d3c085d7bf3ef262ead700da345bfa6ea"}, + {file = "black-24.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:649fff99a20bd06c6f727d2a27f401331dc0cc861fb69cde910fe95b01b5928f"}, + {file = "black-24.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:fe4d6476887de70546212c99ac9bd803d90b42fc4767f058a0baa895013fbb3e"}, + {file = "black-24.10.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5a2221696a8224e335c28816a9d331a6c2ae15a2ee34ec857dcf3e45dbfa99ad"}, + {file = "black-24.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f9da3333530dbcecc1be13e69c250ed8dfa67f43c4005fb537bb426e19200d50"}, + {file = "black-24.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4007b1393d902b48b36958a216c20c4482f601569d19ed1df294a496eb366392"}, + {file = "black-24.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:394d4ddc64782e51153eadcaaca95144ac4c35e27ef9b0a42e121ae7e57a9175"}, + {file = "black-24.10.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:b5e39e0fae001df40f95bd8cc36b9165c5e2ea88900167bddf258bacef9bbdc3"}, + {file = "black-24.10.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d37d422772111794b26757c5b55a3eade028aa3fde43121ab7b673d050949d65"}, + {file = "black-24.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:14b3502784f09ce2443830e3133dacf2c0110d45191ed470ecb04d0f5f6fcb0f"}, + {file = "black-24.10.0-cp312-cp312-win_amd64.whl", hash = "sha256:30d2c30dc5139211dda799758559d1b049f7f14c580c409d6ad925b74a4208a8"}, + {file = "black-24.10.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:1cbacacb19e922a1d75ef2b6ccaefcd6e93a2c05ede32f06a21386a04cedb981"}, + {file = "black-24.10.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:1f93102e0c5bb3907451063e08b9876dbeac810e7da5a8bfb7aeb5a9ef89066b"}, + {file = "black-24.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ddacb691cdcdf77b96f549cf9591701d8db36b2f19519373d60d31746068dbf2"}, + {file = "black-24.10.0-cp313-cp313-win_amd64.whl", hash = "sha256:680359d932801c76d2e9c9068d05c6b107f2584b2a5b88831c83962eb9984c1b"}, + {file = "black-24.10.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:17374989640fbca88b6a448129cd1745c5eb8d9547b464f281b251dd00155ccd"}, + {file = "black-24.10.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:63f626344343083322233f175aaf372d326de8436f5928c042639a4afbbf1d3f"}, + {file = "black-24.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ccfa1d0cb6200857f1923b602f978386a3a2758a65b52e0950299ea014be6800"}, + {file = "black-24.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:2cd9c95431d94adc56600710f8813ee27eea544dd118d45896bb734e9d7a0dc7"}, + {file = "black-24.10.0-py3-none-any.whl", hash = "sha256:3bb2b7a1f7b685f85b11fed1ef10f8a9148bceb49853e47a294a3dd963c1dd7d"}, + {file = "black-24.10.0.tar.gz", hash = "sha256:846ea64c97afe3bc677b761787993be4991810ecc7a4a937816dd6bddedc4875"}, +] + +[package.dependencies] +click = ">=8.0.0" +mypy-extensions = ">=0.4.3" +packaging = ">=22.0" +pathspec = ">=0.9.0" +platformdirs = ">=2" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.10)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] + [[package]] name = "cattrs" version = "24.1.2" @@ -195,6 +241,23 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "platform_system == \"Windows\""} +[[package]] +name = "codespell" +version = "2.3.0" +description = "Codespell" +optional = false +python-versions = ">=3.8" +files = [ + {file = "codespell-2.3.0-py3-none-any.whl", hash = "sha256:a9c7cef2501c9cfede2110fd6d4e5e62296920efe9abfb84648df866e47f58d1"}, + {file = "codespell-2.3.0.tar.gz", hash = "sha256:360c7d10f75e65f67bad720af7007e1060a5d395670ec11a7ed1fed9dd17471f"}, +] + +[package.extras] +dev = ["Pygments", "build", "chardet", "pre-commit", "pytest", "pytest-cov", "pytest-dependency", "ruff", "tomli", "twine"] +hard-encoding-detection = ["chardet"] +toml = ["tomli"] +types = ["chardet (>=5.1.0)", "mypy", "pytest", "pytest-cov", "pytest-dependency"] + [[package]] name = "colorama" version = "0.4.6" @@ -437,6 +500,17 @@ files = [ [package.dependencies] referencing = ">=0.31.0" +[[package]] +name = "mypy-extensions" +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." +optional = false +python-versions = ">=3.5" +files = [ + {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, + {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, +] + [[package]] name = "packaging" version = "24.1" @@ -448,6 +522,17 @@ files = [ {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, ] +[[package]] +name = "pathspec" +version = "0.12.1" +description = "Utility library for gitignore style pattern matching of file paths." +optional = false +python-versions = ">=3.8" +files = [ + {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, + {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, +] + [[package]] name = "platformdirs" version = "4.3.6" @@ -959,6 +1044,33 @@ files = [ {file = "rpds_py-0.20.0.tar.gz", hash = "sha256:d72a210824facfdaf8768cf2d7ca25a042c30320b3020de2fa04640920d4e121"}, ] +[[package]] +name = "ruff" +version = "0.6.9" +description = "An extremely fast Python linter and code formatter, written in Rust." +optional = false +python-versions = ">=3.7" +files = [ + {file = "ruff-0.6.9-py3-none-linux_armv6l.whl", hash = "sha256:064df58d84ccc0ac0fcd63bc3090b251d90e2a372558c0f057c3f75ed73e1ccd"}, + {file = "ruff-0.6.9-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:140d4b5c9f5fc7a7b074908a78ab8d384dd7f6510402267bc76c37195c02a7ec"}, + {file = "ruff-0.6.9-py3-none-macosx_11_0_arm64.whl", hash = "sha256:53fd8ca5e82bdee8da7f506d7b03a261f24cd43d090ea9db9a1dc59d9313914c"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:645d7d8761f915e48a00d4ecc3686969761df69fb561dd914a773c1a8266e14e"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eae02b700763e3847595b9d2891488989cac00214da7f845f4bcf2989007d577"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7d5ccc9e58112441de8ad4b29dcb7a86dc25c5f770e3c06a9d57e0e5eba48829"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:417b81aa1c9b60b2f8edc463c58363075412866ae4e2b9ab0f690dc1e87ac1b5"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c866b631f5fbce896a74a6e4383407ba7507b815ccc52bcedabb6810fdb3ef7"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7b118afbb3202f5911486ad52da86d1d52305b59e7ef2031cea3425142b97d6f"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a67267654edc23c97335586774790cde402fb6bbdb3c2314f1fc087dee320bfa"}, + {file = "ruff-0.6.9-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3ef0cc774b00fec123f635ce5c547dac263f6ee9fb9cc83437c5904183b55ceb"}, + {file = "ruff-0.6.9-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:12edd2af0c60fa61ff31cefb90aef4288ac4d372b4962c2864aeea3a1a2460c0"}, + {file = "ruff-0.6.9-py3-none-musllinux_1_2_i686.whl", hash = "sha256:55bb01caeaf3a60b2b2bba07308a02fca6ab56233302406ed5245180a05c5625"}, + {file = "ruff-0.6.9-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:925d26471fa24b0ce5a6cdfab1bb526fb4159952385f386bdcc643813d472039"}, + {file = "ruff-0.6.9-py3-none-win32.whl", hash = "sha256:eb61ec9bdb2506cffd492e05ac40e5bc6284873aceb605503d8494180d6fc84d"}, + {file = "ruff-0.6.9-py3-none-win_amd64.whl", hash = "sha256:785d31851c1ae91f45b3d8fe23b8ae4b5170089021fbb42402d811135f0b7117"}, + {file = "ruff-0.6.9-py3-none-win_arm64.whl", hash = "sha256:a9641e31476d601f83cd602608739a0840e348bda93fec9f1ee816f8b6798b93"}, + {file = "ruff-0.6.9.tar.gz", hash = "sha256:b076ef717a8e5bc819514ee1d602bbdca5b4420ae13a9cf61a0c0a4f53a2baa2"}, +] + [[package]] name = "six" version = "1.16.0" @@ -1116,4 +1228,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "1b1e8101fbf36d25f1b0e8396baae3198edeb413eed82b5dda8da492264375c5" +content-hash = "99a0e202118bb0113651575d6ef39ff602970e9fc3097d2166f9085d7b3e2eec" diff --git a/pyproject.toml b/pyproject.toml index 0bc7cbe2..3c0fcdfb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,17 +62,62 @@ prefixmaps = ">=0.1.4" curies = ">=0.5.4" pydantic = ">=1.10.2, <3.0.0" +[tool.poetry.group.tests.dependencies] +coverage = "^6.2" +requests-cache = "^1.2.0" + +[tool.poetry.group.lint.dependencies] +ruff = "^0.6.9" +black = "^24.10.0" +codespell = "^2.3.0" + +[tool.black] +line-length = 120 +target-version = ["py39", "py310", "py311", "py312", "py313"] +force-exclude = ''' +/( + # default exclude + \.direnv|\.eggs|\.git|\.hg|\.ipynb_checkpoints|\.mypy_cache|\.nox|\.pytest_cache|\.ruff_cache|\.tox|\.svn|\.venv|\.vscode|__pypackages__|_build|buck-out|build|dist|venv + # additional exclude + | tests.*/output + | __snapshots__ + | docs + | examples + | notebooks +)/ +''' + + [tool.ruff] line-length = 120 +target-version = "py39" + +# -- Rule selection -- select = [ - "F401", - "UP" + "E", # pycodestyle errors + "F", # Pyflakes + "I", # isort + "UP", # pyupgrade ] -target-version = "py39" +force-exclude = true +extend-ignore = ["E203"] + +# -- Exclude files -- +extend-exclude = [ + "tests/**/output", + "tests/**/input", + "tests/**/__snapshots__", + "notebooks/" +] + +[tool.codespell] +skip = '.git,*.pdf,*.svg,./tests,pyproject.toml,*.dill,poetry.lock' +# Ignore table where words could be split across rows +# Ignore shortcut specifications like [Ff]alse +ignore-regex = '(\|.*\|.*\|.*\||\[[A-Z][a-z]\][a-z][a-z])' +ignore-words-list = 'mater,connexion,infarction,thirdparty' +quiet-level = 3 -[tool.poetry.dev-dependencies] -coverage = "^6.2" -requests-cache = "^1.2.0" [build-system] requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"] diff --git a/tox.ini b/tox.ini index 418842ed..303079dc 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py37, py38, py39, py310 +envlist = py39, py310, py311, py312, py313 isolated_build = true [testenv] @@ -9,3 +9,27 @@ deps= coverage commands= python -m pytest + +[lint] +skip_install = true +deps = + ruff + black + codespell +commands = + ruff check + black --check --diff . + codespell + +[format] +skip_install = true +deps = + ruff + black + codespell +commands = + ruff check --fix + black . + codespell + + From edfc14fe0fda8c338d849295c7c950713631ebc0 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 14 Oct 2024 18:16:03 -0700 Subject: [PATCH 10/17] reformat with black --- linkml_runtime/__init__.py | 34 +- .../dumpers/delimited_file_dumper.py | 15 +- linkml_runtime/dumpers/dumper_root.py | 4 +- linkml_runtime/dumpers/json_dumper.py | 18 +- linkml_runtime/dumpers/rdf_dumper.py | 38 +- linkml_runtime/dumpers/rdflib_dumper.py | 29 +- linkml_runtime/dumpers/yaml_dumper.py | 14 +- linkml_runtime/exceptions.py | 2 +- linkml_runtime/index/object_index.py | 13 +- linkml_runtime/linkml_model/__init__.py | 51 +- linkml_runtime/linkml_model/annotations.py | 24 +- linkml_runtime/linkml_model/datasets.py | 652 ++- linkml_runtime/linkml_model/extensions.py | 47 +- linkml_runtime/linkml_model/linkml_files.py | 94 +- linkml_runtime/linkml_model/mappings.py | 111 +- linkml_runtime/linkml_model/meta.py | 4286 ++++++++++++---- linkml_runtime/linkml_model/types.py | 83 +- linkml_runtime/linkml_model/units.py | 111 +- linkml_runtime/linkml_model/validation.py | 174 +- linkml_runtime/loaders/context_flattener.py | 8 +- linkml_runtime/loaders/csv_loader.py | 3 +- .../loaders/delimited_file_loader.py | 61 +- linkml_runtime/loaders/json_loader.py | 33 +- linkml_runtime/loaders/loader_root.py | 87 +- linkml_runtime/loaders/rdf_loader.py | 28 +- linkml_runtime/loaders/rdflib_loader.py | 72 +- linkml_runtime/loaders/requests_ssl_patch.py | 4 +- linkml_runtime/loaders/tsv_loader.py | 3 +- linkml_runtime/loaders/yaml_loader.py | 30 +- .../processing/referencevalidator.py | 208 +- .../processing/validation_datamodel.py | 91 +- linkml_runtime/utils/comparefiles.py | 8 +- linkml_runtime/utils/compile_python.py | 12 +- linkml_runtime/utils/context_utils.py | 39 +- linkml_runtime/utils/csvutils.py | 13 +- linkml_runtime/utils/curienamespace.py | 6 +- linkml_runtime/utils/dictutils.py | 1 + linkml_runtime/utils/distroutils.py | 53 +- linkml_runtime/utils/enumerations.py | 20 +- linkml_runtime/utils/eval_utils.py | 56 +- linkml_runtime/utils/formatutils.py | 72 +- linkml_runtime/utils/inference_utils.py | 59 +- linkml_runtime/utils/introspection.py | 7 +- linkml_runtime/utils/metamodelcore.py | 80 +- linkml_runtime/utils/namespaces.py | 91 +- linkml_runtime/utils/pattern.py | 12 +- linkml_runtime/utils/permissiblevalueimpl.py | 41 +- linkml_runtime/utils/ruleutils.py | 51 +- linkml_runtime/utils/schema_as_dict.py | 19 +- linkml_runtime/utils/schema_builder.py | 32 +- linkml_runtime/utils/schemaops.py | 5 +- linkml_runtime/utils/schemaview.py | 283 +- linkml_runtime/utils/schemaview_cli.py | 73 +- linkml_runtime/utils/slot.py | 3 +- linkml_runtime/utils/strictness.py | 11 +- linkml_runtime/utils/uri_validator.py | 5 +- linkml_runtime/utils/walker_utils.py | 3 +- linkml_runtime/utils/yamlutils.py | 132 +- tests/__init__.py | 24 +- tests/conftest.py | 3 +- tests/support/clicktestcase.py | 83 +- tests/support/compare_rdf.py | 15 +- tests/support/dirutils.py | 23 +- tests/support/filters.py | 69 +- tests/support/mismatchlog.py | 14 +- tests/support/test_environment.py | 84 +- tests/test_enumerations/environment.py | 1 - tests/test_index/__init__.py | 4 +- tests/test_index/model/container_test.py | 513 +- tests/test_index/test_object_index.py | 10 +- tests/test_issues/input/issue_355.py | 39 +- tests/test_issues/input/issue_368.py | 16 +- tests/test_issues/input/issue_368_imports.py | 11 +- tests/test_issues/models/linkml_issue_576.py | 170 +- tests/test_issues/models/model_817.py | 114 +- tests/test_issues/test_include_schema.py | 8 +- tests/test_issues/test_issue_1040.py | 7 +- tests/test_issues/test_issue_1355.py | 17 +- tests/test_issues/test_issue_163.py | 6 +- tests/test_issues/test_issue_355.py | 37 +- tests/test_issues/test_issue_368_enums.py | 20 +- tests/test_issues/test_issue_6.py | 27 +- tests/test_issues/test_issue_626.py | 5 +- tests/test_issues/test_issue_718.py | 11 +- tests/test_issues/test_issue_8.py | 30 +- tests/test_issues/test_linkml_issue_1126.py | 4 +- tests/test_issues/test_linkml_issue_1143.py | 119 +- tests/test_issues/test_linkml_issue_478.py | 11 +- tests/test_issues/test_linkml_issue_576.py | 55 +- tests/test_issues/test_linkml_issue_590.py | 6 +- tests/test_issues/test_linkml_issue_817.py | 22 +- .../test_linkml_runtime_issue_1317.py | 14 +- .../test_linkml_runtime_issue_68.py | 24 +- tests/test_linkml_model/test_linkml_files.py | 109 +- tests/test_loaders_dumpers/__init__.py | 25 +- .../loaderdumpertestcase.py | 23 +- .../models/books_normalized.py | 175 +- .../models/books_normalized_pydantic.py | 36 +- .../test_loaders_dumpers/models/enum_model.py | 15 +- .../models/kitchen_sink_pydantic.py | 125 +- .../models/node_object.py | 76 +- .../test_loaders_dumpers/models/personinfo.py | 699 ++- .../models/personinfo_test_issue_429.py | 61 +- .../models/phenopackets.py | 4332 ++++++++++++----- .../models/termci_schema.py | 45 +- .../test_csv_tsv_loader_dumper.py | 81 +- tests/test_loaders_dumpers/test_dumpers.py | 129 +- .../test_dumpers_pydantic.py | 43 +- tests/test_loaders_dumpers/test_enum.py | 17 +- tests/test_loaders_dumpers/test_issue_429.py | 38 +- tests/test_loaders_dumpers/test_loaders.py | 56 +- .../test_loaders_dumpers.py | 187 +- .../test_loaders_pydantic.py | 15 +- .../test_rdflib_dumper.py | 327 +- tests/test_processing/__init__.py | 4 +- tests/test_processing/test_arrays.py | 2 - .../test_referencevalidator.py | 146 +- tests/test_utils/__init__.py | 4 +- tests/test_utils/input/inlined_as_dict.py | 11 +- tests/test_utils/input/inlined_as_list.py | 11 +- tests/test_utils/model/inference_example.py | 316 +- tests/test_utils/test_context_utils.py | 79 +- tests/test_utils/test_curienamespace.py | 9 +- tests/test_utils/test_dict_utils.py | 32 +- tests/test_utils/test_distroutils.py | 8 +- tests/test_utils/test_eval_utils.py | 60 +- tests/test_utils/test_formatutils.py | 134 +- tests/test_utils/test_inference_utils.py | 52 +- .../test_utils/test_inlined_as_dict_forms.py | 145 +- .../test_utils/test_inlined_as_list_forms.py | 111 +- tests/test_utils/test_introspection.py | 13 +- tests/test_utils/test_list_strings.py | 10 +- tests/test_utils/test_metamodelcore.py | 123 +- tests/test_utils/test_namespaces.py | 78 +- tests/test_utils/test_pattern.py | 1 - tests/test_utils/test_poly_dataclasses.py | 13 +- tests/test_utils/test_ruleutils.py | 26 +- tests/test_utils/test_schema_as_dict.py | 33 +- tests/test_utils/test_schemaview.py | 760 +-- tests/test_utils/test_version.py | 1 + tests/test_utils/test_walker_utils.py | 10 +- tests/test_utils/test_yaml_utils.py | 26 +- 142 files changed, 11882 insertions(+), 6181 deletions(-) diff --git a/linkml_runtime/__init__.py b/linkml_runtime/__init__.py index 3062326e..a16fa884 100644 --- a/linkml_runtime/__init__.py +++ b/linkml_runtime/__init__.py @@ -12,13 +12,13 @@ # the version in the code import importlib.metadata as importlib_metadata -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -TCCM = CurieNamespace('tccm', 'https://ontologies.r.us/tccm/') -OWL = CurieNamespace('owl', OWL) -RDF = CurieNamespace('rdf', RDF) -RDFS = CurieNamespace('rdfs', RDFS) -SKOS = CurieNamespace('skos', SKOS) -XSD = CurieNamespace('xsd', XSD) +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +TCCM = CurieNamespace("tccm", "https://ontologies.r.us/tccm/") +OWL = CurieNamespace("owl", OWL) +RDF = CurieNamespace("rdf", RDF) +RDFS = CurieNamespace("rdfs", RDFS) +SKOS = CurieNamespace("skos", SKOS) +XSD = CurieNamespace("xsd", XSD) __version__ = importlib_metadata.version(__name__) @@ -39,24 +39,28 @@ URI_TO_LOCAL = { - 'https://w3id.org/linkml/annotations.yaml': str(LINKML_ANNOTATIONS), - 'https://w3id.org/linkml/array.yaml': str(LINKML_ARRAY), - 'https://w3id.org/linkml/extensions.yaml': str(LINKML_EXTENSIONS), - 'https://w3id.org/linkml/mappings.yaml': str(LINKML_MAPPINGS), - 'https://w3id.org/linkml/meta.yaml': str(MAIN_SCHEMA_PATH), - 'https://w3id.org/linkml/types.yaml': str(LINKML_TYPES), - 'https://w3id.org/linkml/units.yaml': str(LINKML_UNITS), - 'https://w3id.org/linkml/validation.yaml': str(LINKML_VALIDATION), + "https://w3id.org/linkml/annotations.yaml": str(LINKML_ANNOTATIONS), + "https://w3id.org/linkml/array.yaml": str(LINKML_ARRAY), + "https://w3id.org/linkml/extensions.yaml": str(LINKML_EXTENSIONS), + "https://w3id.org/linkml/mappings.yaml": str(LINKML_MAPPINGS), + "https://w3id.org/linkml/meta.yaml": str(MAIN_SCHEMA_PATH), + "https://w3id.org/linkml/types.yaml": str(LINKML_TYPES), + "https://w3id.org/linkml/units.yaml": str(LINKML_UNITS), + "https://w3id.org/linkml/validation.yaml": str(LINKML_VALIDATION), } + class MappingError(ValueError): """ An error when mapping elements of a LinkML model to runtime objects """ + pass + class DataNotFoundError(ValueError): """ An error in which data cannot be found """ + pass diff --git a/linkml_runtime/dumpers/delimited_file_dumper.py b/linkml_runtime/dumpers/delimited_file_dumper.py index d9e53574..92016fb4 100644 --- a/linkml_runtime/dumpers/delimited_file_dumper.py +++ b/linkml_runtime/dumpers/delimited_file_dumper.py @@ -21,12 +21,15 @@ class DelimitedFileDumper(Dumper, ABC): def delimiter(self): pass - def dumps(self, element: Union[BaseModel, YAMLRoot], - index_slot: SlotDefinitionName = None, - schema: SchemaDefinition = None, - schemaview: SchemaView = None, - **kwargs) -> str: - """ Return element formatted as CSV lines """ + def dumps( + self, + element: Union[BaseModel, YAMLRoot], + index_slot: SlotDefinitionName = None, + schema: SchemaDefinition = None, + schemaview: SchemaView = None, + **kwargs, + ) -> str: + """Return element formatted as CSV lines""" json_dumper = JSONDumper() element_j = json.loads(json_dumper.dumps(element)) objs = element_j[index_slot] diff --git a/linkml_runtime/dumpers/dumper_root.py b/linkml_runtime/dumpers/dumper_root.py index 0b111bd1..d31225c8 100644 --- a/linkml_runtime/dumpers/dumper_root.py +++ b/linkml_runtime/dumpers/dumper_root.py @@ -6,7 +6,7 @@ class Dumper(ABC): - """ Abstract base class for all dumpers """ + """Abstract base class for all dumpers""" def dump(self, element: Union[BaseModel, YAMLRoot], to_file: str, **_) -> None: """ @@ -15,7 +15,7 @@ def dump(self, element: Union[BaseModel, YAMLRoot], to_file: str, **_) -> None: :param to_file: file to dump to :@param _: method specific arguments """ - with open(to_file, 'w', encoding='UTF-8') as output_file: + with open(to_file, "w", encoding="UTF-8") as output_file: output_file.write(self.dumps(element, **_)) @abstractmethod diff --git a/linkml_runtime/dumpers/json_dumper.py b/linkml_runtime/dumpers/json_dumper.py index 9d44c730..c7cbbd1e 100644 --- a/linkml_runtime/dumpers/json_dumper.py +++ b/linkml_runtime/dumpers/json_dumper.py @@ -15,8 +15,9 @@ class JSONDumper(Dumper): - def dump(self, element: Union[BaseModel, YAMLRoot], to_file: str, contexts: CONTEXTS_PARAM_TYPE = None, - **kwargs) -> None: + def dump( + self, element: Union[BaseModel, YAMLRoot], to_file: str, contexts: CONTEXTS_PARAM_TYPE = None, **kwargs + ) -> None: """ Write element as json to to_file :param element: LinkML object to be serialized as YAML @@ -58,12 +59,12 @@ def default(o): return str(o) else: return json.JSONDecoder().decode(o) + if isinstance(element, BaseModel): element = element.model_dump() - return json.dumps(as_json_object(element, contexts, inject_type=inject_type), - default=default, - ensure_ascii=False, - indent=' ') + return json.dumps( + as_json_object(element, contexts, inject_type=inject_type), default=default, ensure_ascii=False, indent=" " + ) @staticmethod @deprecated("Use `utils/formatutils/remove_empty_items` instead") @@ -75,8 +76,9 @@ def remove_empty_items(obj: dict) -> dict: """ return formatutils.remove_empty_items(obj, hide_protected_keys=True) - def to_json_object(self, element: Union[BaseModel, YAMLRoot], contexts: CONTEXTS_PARAM_TYPE = None, - inject_type=True) -> JsonObj: + def to_json_object( + self, element: Union[BaseModel, YAMLRoot], contexts: CONTEXTS_PARAM_TYPE = None, inject_type=True + ) -> JsonObj: """ As dumps(), except returns a JsonObj, not a string diff --git a/linkml_runtime/dumpers/rdf_dumper.py b/linkml_runtime/dumpers/rdf_dumper.py index d49cd496..7d734cb1 100644 --- a/linkml_runtime/dumpers/rdf_dumper.py +++ b/linkml_runtime/dumpers/rdf_dumper.py @@ -13,7 +13,9 @@ class RDFDumper(Dumper): - def as_rdf_graph(self, element: Union[BaseModel, YAMLRoot], contexts: CONTEXTS_PARAM_TYPE, namespaces: CONTEXT_TYPE = None) -> Graph: + def as_rdf_graph( + self, element: Union[BaseModel, YAMLRoot], contexts: CONTEXTS_PARAM_TYPE, namespaces: CONTEXT_TYPE = None + ) -> Graph: """ Convert element into an RDF graph guided by the context(s) in contexts :param element: element to represent in RDF @@ -29,17 +31,18 @@ def as_rdf_graph(self, element: Union[BaseModel, YAMLRoot], contexts: CONTEXTS_P :return: rdflib Graph containing element """ if contexts is None: - raise Exception(f'Must pass in JSON-LD context via contexts parameter') + raise Exception(f"Must pass in JSON-LD context via contexts parameter") if isinstance(contexts, list): inp_contexts = [json.loads(hbread(c)) for c in contexts] else: inp_contexts = json.loads(hbread(contexts)) from linkml_runtime.dumpers import json_dumper + jsonld_str = json_dumper.dumps(element) - g = Graph().parse(data=jsonld_str, format='json-ld') - #rdf_jsonld = expand() - #g = rdflib_graph_from_pyld_jsonld(rdf_jsonld) + g = Graph().parse(data=jsonld_str, format="json-ld") + # rdf_jsonld = expand() + # g = rdflib_graph_from_pyld_jsonld(rdf_jsonld) if namespaces is not None: ns_source = json.loads(hbread(namespaces)) @@ -47,24 +50,30 @@ def as_rdf_graph(self, element: Union[BaseModel, YAMLRoot], contexts: CONTEXTS_P ns_source = inp_contexts # TODO: make a utility out of this or add it to prefixcommons - if ns_source and '@context' in ns_source: - ns_contexts = ns_source['@context'] + if ns_source and "@context" in ns_source: + ns_contexts = ns_source["@context"] if isinstance(ns_contexts, dict): ns_contexts = [ns_contexts] for ns_context in ns_contexts: if isinstance(ns_context, dict): for pfx, ns in ns_context.items(): if isinstance(ns, dict): - if '@id' in ns and ns.get('@prefix', False): - ns = ns['@id'] + if "@id" in ns and ns.get("@prefix", False): + ns = ns["@id"] else: continue - if not pfx.startswith('@'): + if not pfx.startswith("@"): g.bind(pfx, ns) return g - def dump(self, element: Union[BaseModel, YAMLRoot], to_file: str, contexts: CONTEXTS_PARAM_TYPE = None, fmt: str = 'turtle') -> None: + def dump( + self, + element: Union[BaseModel, YAMLRoot], + to_file: str, + contexts: CONTEXTS_PARAM_TYPE = None, + fmt: str = "turtle", + ) -> None: """ Write element as rdf to to_file :param element: LinkML object to be emitted @@ -82,7 +91,9 @@ def dump(self, element: Union[BaseModel, YAMLRoot], to_file: str, contexts: CONT element = element.model_dump() super().dump(element, to_file, contexts=contexts, fmt=fmt) - def dumps(self, element: Union[BaseModel, YAMLRoot], contexts: CONTEXTS_PARAM_TYPE = None, fmt: Optional[str] = 'turtle') -> str: + def dumps( + self, element: Union[BaseModel, YAMLRoot], contexts: CONTEXTS_PARAM_TYPE = None, fmt: Optional[str] = "turtle" + ) -> str: """ Convert element into an RDF graph guided by the context(s) in contexts :param element: element to represent in RDF @@ -92,5 +103,4 @@ def dumps(self, element: Union[BaseModel, YAMLRoot], contexts: CONTEXTS_PARAM_TY """ if isinstance(element, BaseModel): element = element.model_dump() - return self.as_rdf_graph(remove_empty_items(element, hide_protected_keys=True), contexts).\ - serialize(format=fmt) + return self.as_rdf_graph(remove_empty_items(element, hide_protected_keys=True), contexts).serialize(format=fmt) diff --git a/linkml_runtime/dumpers/rdflib_dumper.py b/linkml_runtime/dumpers/rdflib_dumper.py index 9d61c282..9eafde43 100644 --- a/linkml_runtime/dumpers/rdflib_dumper.py +++ b/linkml_runtime/dumpers/rdflib_dumper.py @@ -26,6 +26,7 @@ class RDFLibDumper(Dumper): This requires a SchemaView object """ + def as_rdf_graph( self, element: Union[BaseModel, YAMLRoot], @@ -45,7 +46,7 @@ def as_rdf_graph( if isinstance(prefix_map, Converter): # TODO replace with `prefix_map = prefix_map.bimap` after making minimum requirement on python 3.8 prefix_map = {record.prefix: record.uri_prefix for record in prefix_map.records} - logger.debug(f'PREFIXMAP={prefix_map}') + logger.debug(f"PREFIXMAP={prefix_map}") if prefix_map: for k, v in prefix_map.items(): if k == "@base": @@ -69,7 +70,9 @@ def as_rdf_graph( self.inject_triples(element, schemaview, g) return g - def inject_triples(self, element: Any, schemaview: SchemaView, graph: Graph, target_type: ElementName = None) -> Node: + def inject_triples( + self, element: Any, schemaview: SchemaView, graph: Graph, target_type: ElementName = None + ) -> Node: """ Inject triples from conversion of element into a Graph @@ -81,7 +84,7 @@ def inject_triples(self, element: Any, schemaview: SchemaView, graph: Graph, tar """ namespaces = schemaview.namespaces() slot_name_map = schemaview.slot_name_mappings() - logger.debug(f'CONVERT: {element} // {type(element)} // {target_type}') + logger.debug(f"CONVERT: {element} // {type(element)} // {target_type}") if target_type in schemaview.all_enums(): if isinstance(element, PermissibleValueText): e = schemaview.get_enum(target_type) @@ -97,22 +100,22 @@ def inject_triples(self, element: Any, schemaview: SchemaView, graph: Graph, tar t = schemaview.get_type(target_type) dt_uri = t.uri if dt_uri: - if dt_uri == 'rdfs:Resource': + if dt_uri == "rdfs:Resource": return URIRef(schemaview.expand_curie(element)) - elif dt_uri == 'xsd:string': + elif dt_uri == "xsd:string": return Literal(element) else: if "xsd" not in namespaces: namespaces["xsd"] = XSD return Literal(element, datatype=namespaces.uri_for(dt_uri)) else: - logger.warning(f'No datatype specified for : {t.name}, using plain Literal') + logger.warning(f"No datatype specified for : {t.name}, using plain Literal") return Literal(element) - element_vars = {k: v for k, v in vars(element).items() if not k.startswith('_')} + element_vars = {k: v for k, v in vars(element).items() if not k.startswith("_")} if len(element_vars) == 0: id_slot = schemaview.get_identifier_slot(target_type) return self._as_uri(element, id_slot, schemaview) - #return URIRef(schemaview.expand_curie(str(element))) + # return URIRef(schemaview.expand_curie(str(element))) element_type = type(element) cn = element_type.class_name id_slot = schemaview.get_identifier_slot(cn) @@ -135,7 +138,7 @@ def inject_triples(self, element: Any, schemaview: SchemaView, graph: Graph, tar if k in slot_name_map: k = slot_name_map[k].name else: - logger.error(f'Slot {k} not in name map') + logger.error(f"Slot {k} not in name map") slot = schemaview.induced_slot(k, cn) if not slot.identifier: slot_uri = URIRef(schemaview.get_uri(slot, expand=True)) @@ -152,7 +155,7 @@ def dump( element: Union[BaseModel, YAMLRoot], to_file: str, schemaview: SchemaView = None, - fmt: str = 'turtle', + fmt: str = "turtle", prefix_map: Union[dict[str, str], Converter, None] = None, **args, ) -> None: @@ -172,7 +175,7 @@ def dumps( self, element: Union[BaseModel, YAMLRoot], schemaview: SchemaView = None, - fmt: Optional[str] = 'turtle', + fmt: Optional[str] = "turtle", prefix_map: Union[dict[str, str], Converter, None] = None, ) -> str: """ @@ -184,12 +187,10 @@ def dumps( :param prefix_map: :return: serialization of rdflib Graph containing element """ - return self.as_rdf_graph(element, schemaview, prefix_map=prefix_map).\ - serialize(format=fmt) + return self.as_rdf_graph(element, schemaview, prefix_map=prefix_map).serialize(format=fmt) def _as_uri(self, element_id: str, id_slot: Optional[SlotDefinition], schemaview: SchemaView) -> URIRef: if id_slot and schemaview.is_slot_percent_encoded(id_slot): return URIRef(urllib.parse.quote(element_id)) else: return schemaview.namespaces().uri_for(element_id) - diff --git a/linkml_runtime/dumpers/yaml_dumper.py b/linkml_runtime/dumpers/yaml_dumper.py index a6360608..4929fe5e 100644 --- a/linkml_runtime/dumpers/yaml_dumper.py +++ b/linkml_runtime/dumpers/yaml_dumper.py @@ -6,15 +6,19 @@ from linkml_runtime.utils.formatutils import remove_empty_items from linkml_runtime.utils.yamlutils import YAMLRoot + class YAMLDumper(Dumper): def dumps(self, element: Union[BaseModel, YAMLRoot], **kwargs) -> str: - """ Return element formatted as a YAML string """ + """Return element formatted as a YAML string""" # Internal note: remove_empty_items will also convert Decimals to int/float; # this is necessary until https://github.com/yaml/pyyaml/pull/372 is merged dumper_safe_element = element.model_dump() if isinstance(element, BaseModel) else element - return yaml.dump(remove_empty_items(dumper_safe_element, hide_protected_keys=True), - Dumper=yaml.SafeDumper, sort_keys=False, - allow_unicode=True, - **kwargs) + return yaml.dump( + remove_empty_items(dumper_safe_element, hide_protected_keys=True), + Dumper=yaml.SafeDumper, + sort_keys=False, + allow_unicode=True, + **kwargs, + ) diff --git a/linkml_runtime/exceptions.py b/linkml_runtime/exceptions.py index 97a7bfbb..3467ecd1 100644 --- a/linkml_runtime/exceptions.py +++ b/linkml_runtime/exceptions.py @@ -1,2 +1,2 @@ class OrderingError(RuntimeError): - """Exception raised when there is a problem with SchemaView ordering""" \ No newline at end of file + """Exception raised when there is a problem with SchemaView ordering""" diff --git a/linkml_runtime/index/object_index.py b/linkml_runtime/index/object_index.py index a473a1c2..6e9ebf89 100644 --- a/linkml_runtime/index/object_index.py +++ b/linkml_runtime/index/object_index.py @@ -8,6 +8,7 @@ :ref:`ProxyObject` a proxy for a domain object that "knows" its place in the index """ + import logging import inspect from typing import Any, Union @@ -50,6 +51,7 @@ class ObjectIndex: In the above, the same proxy object is reused for any object with an identifier. """ + def __init__(self, obj: YAMLRoot, schemaview: SchemaView): self._root_object = obj self._schemaview = schemaview @@ -74,8 +76,8 @@ def _index(self, obj: Any, parent_key=None, parent=None): if pk_val not in self._child_to_parent: self._child_to_parent[pk_val] = [] self._child_to_parent[pk_val].append((parent_key, parent)) - #id_slot = self._schemaview.get_identifier_slot(cls.name) - #if id_slot: + # id_slot = self._schemaview.get_identifier_slot(cls.name) + # if id_slot: # id_val = getattr(obj, id_slot.name) # self._source_object_cache[(cls.name, id_val)] = obj for k, v in vars(obj).items(): @@ -162,12 +164,12 @@ def source_object_cache_size(self) -> int: def clear_proxy_object_cache(self): """ Clears all items in the proxy cache. - + :return: """ self._proxy_object_cache = {} - def eval_expr(self, expr: str, obj: Any=None, **kwargs) -> Any: + def eval_expr(self, expr: str, obj: Any = None, **kwargs) -> Any: """ Evaluates an expression against the object store. @@ -212,7 +214,7 @@ def __getattr__(self, p: str) -> Any: return self._map(v, slot.range) def __getattribute__(self, attribute): - if attribute == '__dict__': + if attribute == "__dict__": return {k: getattr(self, k, None) for k in vars(self._shadowed).keys()} else: return object.__getattribute__(self, attribute) @@ -268,4 +270,3 @@ def _map(self, obj: Any, in_range: str) -> Any: def _attributes(self) -> list[str]: return list(vars(self._shadowed).keys()) - diff --git a/linkml_runtime/linkml_model/__init__.py b/linkml_runtime/linkml_model/__init__.py index 587788d0..6caf947a 100644 --- a/linkml_runtime/linkml_model/__init__.py +++ b/linkml_runtime/linkml_model/__init__.py @@ -1,12 +1,49 @@ -from .types import String, Integer, Boolean, Float, Double, Decimal, Time, Date, Datetime, Uriorcurie, Uri, \ - Ncname, Objectidentifier, Nodeidentifier +from .types import ( + String, + Integer, + Boolean, + Float, + Double, + Decimal, + Time, + Date, + Datetime, + Uriorcurie, + Uri, + Ncname, + Objectidentifier, + Nodeidentifier, +) from .extensions import Extension, Extensible from .annotations import Annotation, Annotatable -from .meta import ElementName, SchemaDefinitionName, TypeDefinitionName, SubsetDefinitionName, DefinitionName, \ - EnumDefinitionName, SlotDefinitionName, ClassDefinitionName, PrefixPrefixPrefix, LocalNameLocalNameSource, \ - AltDescriptionSource, PermissibleValueText, Element, SchemaDefinition, TypeDefinition, SubsetDefinition, \ - Definition, EnumDefinition, SlotDefinition, ClassDefinition, Prefix, LocalName, Example, AltDescription, \ - PermissibleValue, PvFormulaOptions +from .meta import ( + ElementName, + SchemaDefinitionName, + TypeDefinitionName, + SubsetDefinitionName, + DefinitionName, + EnumDefinitionName, + SlotDefinitionName, + ClassDefinitionName, + PrefixPrefixPrefix, + LocalNameLocalNameSource, + AltDescriptionSource, + PermissibleValueText, + Element, + SchemaDefinition, + TypeDefinition, + SubsetDefinition, + Definition, + EnumDefinition, + SlotDefinition, + ClassDefinition, + Prefix, + LocalName, + Example, + AltDescription, + PermissibleValue, + PvFormulaOptions, +) __all__ = [ "String", diff --git a/linkml_runtime/linkml_model/annotations.py b/linkml_runtime/linkml_model/annotations.py index 3dbd9183..35a0e14d 100644 --- a/linkml_runtime/linkml_model/annotations.py +++ b/linkml_runtime/linkml_model/annotations.py @@ -21,12 +21,13 @@ version = "2.0.0" # Namespaces -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") DEFAULT_ = LINKML # Types + # Class references class AnnotationTag(ExtensionTag): pass @@ -37,6 +38,7 @@ class Annotatable(YAMLRoot): """ mixin for classes that support annotations """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Annotatable"] @@ -44,7 +46,9 @@ class Annotatable(YAMLRoot): class_name: ClassVar[str] = "annotatable" class_model_uri: ClassVar[URIRef] = LINKML.Annotatable - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, "Annotation"]], list[Union[dict, "Annotation"]]]] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, "Annotation"]], list[Union[dict, "Annotation"]]] + ] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_dict(slot_name="annotations", slot_type=Annotation, key_name="tag", keyed=True) @@ -57,6 +61,7 @@ class Annotation(Extension): """ a tag/value pair with the semantics of OWL Annotation """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Annotation"] @@ -66,7 +71,9 @@ class Annotation(Extension): tag: Union[str, AnnotationTag] = None value: Union[dict, AnyValue] = None - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, "Annotation"]], list[Union[dict, "Annotation"]]]] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, "Annotation"]], list[Union[dict, "Annotation"]]] + ] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.tag): @@ -86,5 +93,12 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): class slots: pass -slots.annotations = Slot(uri=LINKML.annotations, name="annotations", curie=LINKML.curie('annotations'), - model_uri=LINKML.annotations, domain=None, range=Optional[Union[dict[Union[str, AnnotationTag], Union[dict, "Annotation"]], list[Union[dict, "Annotation"]]]]) + +slots.annotations = Slot( + uri=LINKML.annotations, + name="annotations", + curie=LINKML.curie("annotations"), + model_uri=LINKML.annotations, + domain=None, + range=Optional[Union[dict[Union[str, AnnotationTag], Union[dict, "Annotation"]], list[Union[dict, "Annotation"]]]], +) diff --git a/linkml_runtime/linkml_model/datasets.py b/linkml_runtime/linkml_model/datasets.py index b637e831..80897f2c 100644 --- a/linkml_runtime/linkml_model/datasets.py +++ b/linkml_runtime/linkml_model/datasets.py @@ -22,31 +22,32 @@ version = None # Namespaces -BIBO = CurieNamespace('bibo', 'http://purl.org/ontology/bibo/') -CSVW = CurieNamespace('csvw', 'http://www.w3.org/ns/csvw#') -DATASETS = CurieNamespace('datasets', 'https://w3id.org/linkml/report') -DCAT = CurieNamespace('dcat', 'http://www.w3.org/ns/dcat#') -DCTERMS = CurieNamespace('dcterms', 'http://purl.org/dc/terms/') -FORMATS = CurieNamespace('formats', 'http://www.w3.org/ns/formats/') -FRICTIONLESS = CurieNamespace('frictionless', 'https://specs.frictionlessdata.io/') -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -MEDIATYPES = CurieNamespace('mediatypes', 'https://www.iana.org/assignments/media-types/') -OSLC = CurieNamespace('oslc', 'http://open-services.net/ns/core#') -OWL = CurieNamespace('owl', 'http://www.w3.org/2002/07/owl#') -PAV = CurieNamespace('pav', 'http://purl.org/pav/') -PROV = CurieNamespace('prov', 'http://www.w3.org/ns/prov#') -RDF = CurieNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#') -RDFS = CurieNamespace('rdfs', 'http://www.w3.org/2000/01/rdf-schema#') -SCHEMA = CurieNamespace('schema', 'http://schema.org/') -SH = CurieNamespace('sh', 'https://w3id.org/shacl/') -SKOS = CurieNamespace('skos', 'http://www.w3.org/2004/02/skos/core#') -VOID = CurieNamespace('void', 'http://rdfs.org/ns/void#') -XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') +BIBO = CurieNamespace("bibo", "http://purl.org/ontology/bibo/") +CSVW = CurieNamespace("csvw", "http://www.w3.org/ns/csvw#") +DATASETS = CurieNamespace("datasets", "https://w3id.org/linkml/report") +DCAT = CurieNamespace("dcat", "http://www.w3.org/ns/dcat#") +DCTERMS = CurieNamespace("dcterms", "http://purl.org/dc/terms/") +FORMATS = CurieNamespace("formats", "http://www.w3.org/ns/formats/") +FRICTIONLESS = CurieNamespace("frictionless", "https://specs.frictionlessdata.io/") +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +MEDIATYPES = CurieNamespace("mediatypes", "https://www.iana.org/assignments/media-types/") +OSLC = CurieNamespace("oslc", "http://open-services.net/ns/core#") +OWL = CurieNamespace("owl", "http://www.w3.org/2002/07/owl#") +PAV = CurieNamespace("pav", "http://purl.org/pav/") +PROV = CurieNamespace("prov", "http://www.w3.org/ns/prov#") +RDF = CurieNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") +RDFS = CurieNamespace("rdfs", "http://www.w3.org/2000/01/rdf-schema#") +SCHEMA = CurieNamespace("schema", "http://schema.org/") +SH = CurieNamespace("sh", "https://w3id.org/shacl/") +SKOS = CurieNamespace("skos", "http://www.w3.org/2004/02/skos/core#") +VOID = CurieNamespace("void", "http://rdfs.org/ns/void#") +XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") DEFAULT_ = DATASETS # Types + # Class references class InformationId(extended_str): pass @@ -65,6 +66,7 @@ class Information(YAMLRoot): """ Grouping for datasets and data files """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = DATASETS["Information"] @@ -162,6 +164,7 @@ class DataPackage(Information): """ A collection of data resources """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VOID["Dataset"] @@ -190,6 +193,7 @@ class DataResource(Information): """ An individual file or table """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = DCAT["Distribution"] @@ -257,6 +261,7 @@ class FormatDialect(YAMLRoot): """ Additional format information for a file """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = DATASETS["FormatDialect"] @@ -299,11 +304,10 @@ class TestRole(EnumDefinitionImpl): name="TestRole", ) + class MediaTypeEnum(EnumDefinitionImpl): - csv = PermissibleValue( - text="csv", - meaning=MEDIATYPES["text/csv"]) + csv = PermissibleValue(text="csv", meaning=MEDIATYPES["text/csv"]) _defn = EnumDefinition( name="MediaTypeEnum", @@ -311,31 +315,17 @@ class MediaTypeEnum(EnumDefinitionImpl): @classmethod def _addvals(cls): - setattr(cls, "rdf-xml", - PermissibleValue( - text="rdf-xml", - meaning=MEDIATYPES["application/rdf+xml"])) + setattr(cls, "rdf-xml", PermissibleValue(text="rdf-xml", meaning=MEDIATYPES["application/rdf+xml"])) + class FormatEnum(EnumDefinitionImpl): - N3 = PermissibleValue( - text="N3", - meaning=FORMATS["N3"]) - Microdata = PermissibleValue( - text="Microdata", - meaning=FORMATS["microdata"]) - POWDER = PermissibleValue( - text="POWDER", - meaning=FORMATS["POWDER"]) - RDFa = PermissibleValue( - text="RDFa", - meaning=FORMATS["RDFa"]) - Turtle = PermissibleValue( - text="Turtle", - meaning=FORMATS["Turtle"]) - TriG = PermissibleValue( - text="TriG", - meaning=FORMATS["TriG"]) + N3 = PermissibleValue(text="N3", meaning=FORMATS["N3"]) + Microdata = PermissibleValue(text="Microdata", meaning=FORMATS["microdata"]) + POWDER = PermissibleValue(text="POWDER", meaning=FORMATS["POWDER"]) + RDFa = PermissibleValue(text="RDFa", meaning=FORMATS["RDFa"]) + Turtle = PermissibleValue(text="Turtle", meaning=FORMATS["Turtle"]) + TriG = PermissibleValue(text="TriG", meaning=FORMATS["TriG"]) YAML = PermissibleValue(text="YAML") JSON = PermissibleValue(text="JSON") @@ -345,192 +335,398 @@ class FormatEnum(EnumDefinitionImpl): @classmethod def _addvals(cls): - setattr(cls, "JSON-LD", - PermissibleValue( - text="JSON-LD", - meaning=FORMATS["JSON-LD"])) - setattr(cls, "N-Triples", - PermissibleValue( - text="N-Triples", - meaning=FORMATS["N-Triples"])) - setattr(cls, "N-Quads", - PermissibleValue( - text="N-Quads", - meaning=FORMATS["N-Quads"])) - setattr(cls, "LD Patch", - PermissibleValue( - text="LD Patch", - meaning=FORMATS["LD_Patch"])) - setattr(cls, "OWL XML Serialization", - PermissibleValue( - text="OWL XML Serialization", - meaning=FORMATS["OWL_XML"])) - setattr(cls, "OWL Functional Syntax", - PermissibleValue( - text="OWL Functional Syntax", - meaning=FORMATS["OWL_Functional"])) - setattr(cls, "OWL Manchester Syntax", - PermissibleValue( - text="OWL Manchester Syntax", - meaning=FORMATS["OWL_Manchester"])) - setattr(cls, "POWDER-S", - PermissibleValue( - text="POWDER-S", - meaning=FORMATS["POWDER-S"])) - setattr(cls, "PROV-N", - PermissibleValue( - text="PROV-N", - meaning=FORMATS["PROV-N"])) - setattr(cls, "PROV-XML", - PermissibleValue( - text="PROV-XML", - meaning=FORMATS["PROV-XML"])) - setattr(cls, "RDF/JSON", - PermissibleValue( - text="RDF/JSON", - meaning=FORMATS["RDF_JSON"])) - setattr(cls, "RDF/XML", - PermissibleValue( - text="RDF/XML", - meaning=FORMATS["RDF_XML"])) - setattr(cls, "RIF XML Syntax", - PermissibleValue( - text="RIF XML Syntax", - meaning=FORMATS["RIF_XML"])) - setattr(cls, "SPARQL Results in XML", - PermissibleValue( - text="SPARQL Results in XML", - meaning=FORMATS["SPARQL_Results_XML"])) - setattr(cls, "SPARQL Results in JSON", - PermissibleValue( - text="SPARQL Results in JSON", - meaning=FORMATS["SPARQL_Results_JSON"])) - setattr(cls, "SPARQL Results in CSV", - PermissibleValue( - text="SPARQL Results in CSV", - meaning=FORMATS["SPARQL_Results_CSV"])) - setattr(cls, "SPARQL Results in TSV", - PermissibleValue( - text="SPARQL Results in TSV", - meaning=FORMATS["SPARQL_Results_TSV"])) + setattr(cls, "JSON-LD", PermissibleValue(text="JSON-LD", meaning=FORMATS["JSON-LD"])) + setattr(cls, "N-Triples", PermissibleValue(text="N-Triples", meaning=FORMATS["N-Triples"])) + setattr(cls, "N-Quads", PermissibleValue(text="N-Quads", meaning=FORMATS["N-Quads"])) + setattr(cls, "LD Patch", PermissibleValue(text="LD Patch", meaning=FORMATS["LD_Patch"])) + setattr( + cls, "OWL XML Serialization", PermissibleValue(text="OWL XML Serialization", meaning=FORMATS["OWL_XML"]) + ) + setattr( + cls, + "OWL Functional Syntax", + PermissibleValue(text="OWL Functional Syntax", meaning=FORMATS["OWL_Functional"]), + ) + setattr( + cls, + "OWL Manchester Syntax", + PermissibleValue(text="OWL Manchester Syntax", meaning=FORMATS["OWL_Manchester"]), + ) + setattr(cls, "POWDER-S", PermissibleValue(text="POWDER-S", meaning=FORMATS["POWDER-S"])) + setattr(cls, "PROV-N", PermissibleValue(text="PROV-N", meaning=FORMATS["PROV-N"])) + setattr(cls, "PROV-XML", PermissibleValue(text="PROV-XML", meaning=FORMATS["PROV-XML"])) + setattr(cls, "RDF/JSON", PermissibleValue(text="RDF/JSON", meaning=FORMATS["RDF_JSON"])) + setattr(cls, "RDF/XML", PermissibleValue(text="RDF/XML", meaning=FORMATS["RDF_XML"])) + setattr(cls, "RIF XML Syntax", PermissibleValue(text="RIF XML Syntax", meaning=FORMATS["RIF_XML"])) + setattr( + cls, + "SPARQL Results in XML", + PermissibleValue(text="SPARQL Results in XML", meaning=FORMATS["SPARQL_Results_XML"]), + ) + setattr( + cls, + "SPARQL Results in JSON", + PermissibleValue(text="SPARQL Results in JSON", meaning=FORMATS["SPARQL_Results_JSON"]), + ) + setattr( + cls, + "SPARQL Results in CSV", + PermissibleValue(text="SPARQL Results in CSV", meaning=FORMATS["SPARQL_Results_CSV"]), + ) + setattr( + cls, + "SPARQL Results in TSV", + PermissibleValue(text="SPARQL Results in TSV", meaning=FORMATS["SPARQL_Results_TSV"]), + ) + # Slots class slots: pass -slots.id = Slot(uri=DCTERMS.identifier, name="id", curie=DCTERMS.curie('identifier'), - model_uri=DATASETS.id, domain=None, range=URIRef) - -slots.title = Slot(uri=DCTERMS.title, name="title", curie=DCTERMS.curie('title'), - model_uri=DATASETS.title, domain=None, range=Optional[str]) - -slots.description = Slot(uri=DCTERMS.description, name="description", curie=DCTERMS.curie('description'), - model_uri=DATASETS.description, domain=None, range=Optional[str]) - -slots.language = Slot(uri=DATASETS.language, name="language", curie=DATASETS.curie('language'), - model_uri=DATASETS.language, domain=None, range=Optional[str]) - -slots.publisher = Slot(uri=DCTERMS.publisher, name="publisher", curie=DCTERMS.curie('publisher'), - model_uri=DATASETS.publisher, domain=None, range=Optional[Union[str, URIorCURIE]]) - -slots.issued = Slot(uri=DCTERMS.issued, name="issued", curie=DCTERMS.curie('issued'), - model_uri=DATASETS.issued, domain=None, range=Optional[Union[str, XSDDateTime]]) - -slots.page = Slot(uri=DCAT.landingPage, name="page", curie=DCAT.curie('landingPage'), - model_uri=DATASETS.page, domain=None, range=Optional[str]) - -slots.dialect = Slot(uri=CSVW.dialect, name="dialect", curie=CSVW.curie('dialect'), - model_uri=DATASETS.dialect, domain=None, range=Optional[str]) - -slots.bytes = Slot(uri=DCAT.byteSize, name="bytes", curie=DCAT.curie('byteSize'), - model_uri=DATASETS.bytes, domain=None, range=Optional[int]) - -slots.path = Slot(uri=DATASETS.path, name="path", curie=DATASETS.curie('path'), - model_uri=DATASETS.path, domain=None, range=Optional[str]) - -slots.download_url = Slot(uri=DCAT.downloadURL, name="download_url", curie=DCAT.curie('downloadURL'), - model_uri=DATASETS.download_url, domain=None, range=Optional[Union[str, URI]]) - -slots.format = Slot(uri=DCTERMS.format, name="format", curie=DCTERMS.curie('format'), - model_uri=DATASETS.format, domain=None, range=Optional[Union[str, "FormatEnum"]]) - -slots.compression = Slot(uri=DATASETS.compression, name="compression", curie=DATASETS.curie('compression'), - model_uri=DATASETS.compression, domain=None, range=Optional[str]) - -slots.encoding = Slot(uri=DATASETS.encoding, name="encoding", curie=DATASETS.curie('encoding'), - model_uri=DATASETS.encoding, domain=None, range=Optional[str]) - -slots.hash = Slot(uri=DATASETS.hash, name="hash", curie=DATASETS.curie('hash'), - model_uri=DATASETS.hash, domain=None, range=Optional[str]) - -slots.sha256 = Slot(uri=DATASETS.sha256, name="sha256", curie=DATASETS.curie('sha256'), - model_uri=DATASETS.sha256, domain=None, range=Optional[str]) - -slots.md5 = Slot(uri=DATASETS.md5, name="md5", curie=DATASETS.curie('md5'), - model_uri=DATASETS.md5, domain=None, range=Optional[str]) - -slots.media_type = Slot(uri=DCAT.mediaType, name="media_type", curie=DCAT.curie('mediaType'), - model_uri=DATASETS.media_type, domain=None, range=Optional[str]) - -slots.conforms_to = Slot(uri=DCTERMS.conformsTo, name="conforms_to", curie=DCTERMS.curie('conformsTo'), - model_uri=DATASETS.conforms_to, domain=None, range=Optional[Union[str, URIorCURIE]]) - -slots.conforms_to_schema = Slot(uri=DATASETS.conforms_to_schema, name="conforms_to_schema", curie=DATASETS.curie('conforms_to_schema'), - model_uri=DATASETS.conforms_to_schema, domain=None, range=Optional[Union[str, URIorCURIE]]) - -slots.conforms_to_class = Slot(uri=DATASETS.conforms_to_class, name="conforms_to_class", curie=DATASETS.curie('conforms_to_class'), - model_uri=DATASETS.conforms_to_class, domain=None, range=Optional[Union[str, URIorCURIE]]) - -slots.profile = Slot(uri=DATASETS.profile, name="profile", curie=DATASETS.curie('profile'), - model_uri=DATASETS.profile, domain=None, range=Optional[Union[str, URIorCURIE]]) - -slots.keywords = Slot(uri=DCAT.keyword, name="keywords", curie=DCAT.curie('keyword'), - model_uri=DATASETS.keywords, domain=None, range=Optional[Union[str, list[str]]]) - -slots.themes = Slot(uri=DCAT.theme, name="themes", curie=DCAT.curie('theme'), - model_uri=DATASETS.themes, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.resources = Slot(uri=DCAT.distribution, name="resources", curie=DCAT.curie('distribution'), - model_uri=DATASETS.resources, domain=None, range=Optional[Union[Union[str, DataResourceId], list[Union[str, DataResourceId]]]]) - -slots.test_roles = Slot(uri=DATASETS.test_roles, name="test_roles", curie=DATASETS.curie('test_roles'), - model_uri=DATASETS.test_roles, domain=None, range=Optional[Union[Union[str, "TestRole"], list[Union[str, "TestRole"]]]]) - -slots.created_by = Slot(uri=PAV.createdBy, name="created_by", curie=PAV.curie('createdBy'), - model_uri=DATASETS.created_by, domain=None, range=Optional[Union[str, URIorCURIE]]) - -slots.created_on = Slot(uri=PAV.createdOn, name="created_on", curie=PAV.curie('createdOn'), - model_uri=DATASETS.created_on, domain=None, range=Optional[Union[str, XSDDateTime]]) - -slots.last_updated_on = Slot(uri=PAV.lastUpdatedOn, name="last_updated_on", curie=PAV.curie('lastUpdatedOn'), - model_uri=DATASETS.last_updated_on, domain=None, range=Optional[Union[str, XSDDateTime]]) - -slots.modified_by = Slot(uri=OSLC.modifiedBy, name="modified_by", curie=OSLC.curie('modifiedBy'), - model_uri=DATASETS.modified_by, domain=None, range=Optional[Union[str, URIorCURIE]]) - -slots.status = Slot(uri=BIBO.status, name="status", curie=BIBO.curie('status'), - model_uri=DATASETS.status, domain=None, range=Optional[Union[str, URIorCURIE]]) - -slots.license = Slot(uri=DCTERMS.license, name="license", curie=DCTERMS.curie('license'), - model_uri=DATASETS.license, domain=None, range=Optional[str]) - -slots.version = Slot(uri=PAV.version, name="version", curie=PAV.curie('version'), - model_uri=DATASETS.version, domain=None, range=Optional[str]) - -slots.was_derived_from = Slot(uri=PROV.wasDerivedFrom, name="was_derived_from", curie=PROV.curie('wasDerivedFrom'), - model_uri=DATASETS.was_derived_from, domain=None, range=Optional[str]) - -slots.formatDialect__comment_prefix = Slot(uri=DATASETS.comment_prefix, name="formatDialect__comment_prefix", curie=DATASETS.curie('comment_prefix'), - model_uri=DATASETS.formatDialect__comment_prefix, domain=None, range=Optional[str]) - -slots.formatDialect__delimiter = Slot(uri=DATASETS.delimiter, name="formatDialect__delimiter", curie=DATASETS.curie('delimiter'), - model_uri=DATASETS.formatDialect__delimiter, domain=None, range=Optional[str]) - -slots.formatDialect__double_quote = Slot(uri=DATASETS.double_quote, name="formatDialect__double_quote", curie=DATASETS.curie('double_quote'), - model_uri=DATASETS.formatDialect__double_quote, domain=None, range=Optional[str]) - -slots.formatDialect__header = Slot(uri=DATASETS.header, name="formatDialect__header", curie=DATASETS.curie('header'), - model_uri=DATASETS.formatDialect__header, domain=None, range=Optional[str]) -slots.formatDialect__quote_char = Slot(uri=DATASETS.quote_char, name="formatDialect__quote_char", curie=DATASETS.curie('quote_char'), - model_uri=DATASETS.formatDialect__quote_char, domain=None, range=Optional[str]) +slots.id = Slot( + uri=DCTERMS.identifier, + name="id", + curie=DCTERMS.curie("identifier"), + model_uri=DATASETS.id, + domain=None, + range=URIRef, +) + +slots.title = Slot( + uri=DCTERMS.title, + name="title", + curie=DCTERMS.curie("title"), + model_uri=DATASETS.title, + domain=None, + range=Optional[str], +) + +slots.description = Slot( + uri=DCTERMS.description, + name="description", + curie=DCTERMS.curie("description"), + model_uri=DATASETS.description, + domain=None, + range=Optional[str], +) + +slots.language = Slot( + uri=DATASETS.language, + name="language", + curie=DATASETS.curie("language"), + model_uri=DATASETS.language, + domain=None, + range=Optional[str], +) + +slots.publisher = Slot( + uri=DCTERMS.publisher, + name="publisher", + curie=DCTERMS.curie("publisher"), + model_uri=DATASETS.publisher, + domain=None, + range=Optional[Union[str, URIorCURIE]], +) + +slots.issued = Slot( + uri=DCTERMS.issued, + name="issued", + curie=DCTERMS.curie("issued"), + model_uri=DATASETS.issued, + domain=None, + range=Optional[Union[str, XSDDateTime]], +) + +slots.page = Slot( + uri=DCAT.landingPage, + name="page", + curie=DCAT.curie("landingPage"), + model_uri=DATASETS.page, + domain=None, + range=Optional[str], +) + +slots.dialect = Slot( + uri=CSVW.dialect, + name="dialect", + curie=CSVW.curie("dialect"), + model_uri=DATASETS.dialect, + domain=None, + range=Optional[str], +) + +slots.bytes = Slot( + uri=DCAT.byteSize, + name="bytes", + curie=DCAT.curie("byteSize"), + model_uri=DATASETS.bytes, + domain=None, + range=Optional[int], +) + +slots.path = Slot( + uri=DATASETS.path, + name="path", + curie=DATASETS.curie("path"), + model_uri=DATASETS.path, + domain=None, + range=Optional[str], +) + +slots.download_url = Slot( + uri=DCAT.downloadURL, + name="download_url", + curie=DCAT.curie("downloadURL"), + model_uri=DATASETS.download_url, + domain=None, + range=Optional[Union[str, URI]], +) + +slots.format = Slot( + uri=DCTERMS.format, + name="format", + curie=DCTERMS.curie("format"), + model_uri=DATASETS.format, + domain=None, + range=Optional[Union[str, "FormatEnum"]], +) + +slots.compression = Slot( + uri=DATASETS.compression, + name="compression", + curie=DATASETS.curie("compression"), + model_uri=DATASETS.compression, + domain=None, + range=Optional[str], +) + +slots.encoding = Slot( + uri=DATASETS.encoding, + name="encoding", + curie=DATASETS.curie("encoding"), + model_uri=DATASETS.encoding, + domain=None, + range=Optional[str], +) + +slots.hash = Slot( + uri=DATASETS.hash, + name="hash", + curie=DATASETS.curie("hash"), + model_uri=DATASETS.hash, + domain=None, + range=Optional[str], +) + +slots.sha256 = Slot( + uri=DATASETS.sha256, + name="sha256", + curie=DATASETS.curie("sha256"), + model_uri=DATASETS.sha256, + domain=None, + range=Optional[str], +) + +slots.md5 = Slot( + uri=DATASETS.md5, name="md5", curie=DATASETS.curie("md5"), model_uri=DATASETS.md5, domain=None, range=Optional[str] +) + +slots.media_type = Slot( + uri=DCAT.mediaType, + name="media_type", + curie=DCAT.curie("mediaType"), + model_uri=DATASETS.media_type, + domain=None, + range=Optional[str], +) + +slots.conforms_to = Slot( + uri=DCTERMS.conformsTo, + name="conforms_to", + curie=DCTERMS.curie("conformsTo"), + model_uri=DATASETS.conforms_to, + domain=None, + range=Optional[Union[str, URIorCURIE]], +) + +slots.conforms_to_schema = Slot( + uri=DATASETS.conforms_to_schema, + name="conforms_to_schema", + curie=DATASETS.curie("conforms_to_schema"), + model_uri=DATASETS.conforms_to_schema, + domain=None, + range=Optional[Union[str, URIorCURIE]], +) + +slots.conforms_to_class = Slot( + uri=DATASETS.conforms_to_class, + name="conforms_to_class", + curie=DATASETS.curie("conforms_to_class"), + model_uri=DATASETS.conforms_to_class, + domain=None, + range=Optional[Union[str, URIorCURIE]], +) + +slots.profile = Slot( + uri=DATASETS.profile, + name="profile", + curie=DATASETS.curie("profile"), + model_uri=DATASETS.profile, + domain=None, + range=Optional[Union[str, URIorCURIE]], +) + +slots.keywords = Slot( + uri=DCAT.keyword, + name="keywords", + curie=DCAT.curie("keyword"), + model_uri=DATASETS.keywords, + domain=None, + range=Optional[Union[str, list[str]]], +) + +slots.themes = Slot( + uri=DCAT.theme, + name="themes", + curie=DCAT.curie("theme"), + model_uri=DATASETS.themes, + domain=None, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.resources = Slot( + uri=DCAT.distribution, + name="resources", + curie=DCAT.curie("distribution"), + model_uri=DATASETS.resources, + domain=None, + range=Optional[Union[Union[str, DataResourceId], list[Union[str, DataResourceId]]]], +) + +slots.test_roles = Slot( + uri=DATASETS.test_roles, + name="test_roles", + curie=DATASETS.curie("test_roles"), + model_uri=DATASETS.test_roles, + domain=None, + range=Optional[Union[Union[str, "TestRole"], list[Union[str, "TestRole"]]]], +) + +slots.created_by = Slot( + uri=PAV.createdBy, + name="created_by", + curie=PAV.curie("createdBy"), + model_uri=DATASETS.created_by, + domain=None, + range=Optional[Union[str, URIorCURIE]], +) + +slots.created_on = Slot( + uri=PAV.createdOn, + name="created_on", + curie=PAV.curie("createdOn"), + model_uri=DATASETS.created_on, + domain=None, + range=Optional[Union[str, XSDDateTime]], +) + +slots.last_updated_on = Slot( + uri=PAV.lastUpdatedOn, + name="last_updated_on", + curie=PAV.curie("lastUpdatedOn"), + model_uri=DATASETS.last_updated_on, + domain=None, + range=Optional[Union[str, XSDDateTime]], +) + +slots.modified_by = Slot( + uri=OSLC.modifiedBy, + name="modified_by", + curie=OSLC.curie("modifiedBy"), + model_uri=DATASETS.modified_by, + domain=None, + range=Optional[Union[str, URIorCURIE]], +) + +slots.status = Slot( + uri=BIBO.status, + name="status", + curie=BIBO.curie("status"), + model_uri=DATASETS.status, + domain=None, + range=Optional[Union[str, URIorCURIE]], +) + +slots.license = Slot( + uri=DCTERMS.license, + name="license", + curie=DCTERMS.curie("license"), + model_uri=DATASETS.license, + domain=None, + range=Optional[str], +) + +slots.version = Slot( + uri=PAV.version, + name="version", + curie=PAV.curie("version"), + model_uri=DATASETS.version, + domain=None, + range=Optional[str], +) + +slots.was_derived_from = Slot( + uri=PROV.wasDerivedFrom, + name="was_derived_from", + curie=PROV.curie("wasDerivedFrom"), + model_uri=DATASETS.was_derived_from, + domain=None, + range=Optional[str], +) + +slots.formatDialect__comment_prefix = Slot( + uri=DATASETS.comment_prefix, + name="formatDialect__comment_prefix", + curie=DATASETS.curie("comment_prefix"), + model_uri=DATASETS.formatDialect__comment_prefix, + domain=None, + range=Optional[str], +) + +slots.formatDialect__delimiter = Slot( + uri=DATASETS.delimiter, + name="formatDialect__delimiter", + curie=DATASETS.curie("delimiter"), + model_uri=DATASETS.formatDialect__delimiter, + domain=None, + range=Optional[str], +) + +slots.formatDialect__double_quote = Slot( + uri=DATASETS.double_quote, + name="formatDialect__double_quote", + curie=DATASETS.curie("double_quote"), + model_uri=DATASETS.formatDialect__double_quote, + domain=None, + range=Optional[str], +) + +slots.formatDialect__header = Slot( + uri=DATASETS.header, + name="formatDialect__header", + curie=DATASETS.curie("header"), + model_uri=DATASETS.formatDialect__header, + domain=None, + range=Optional[str], +) + +slots.formatDialect__quote_char = Slot( + uri=DATASETS.quote_char, + name="formatDialect__quote_char", + curie=DATASETS.curie("quote_char"), + model_uri=DATASETS.formatDialect__quote_char, + domain=None, + range=Optional[str], +) diff --git a/linkml_runtime/linkml_model/extensions.py b/linkml_runtime/linkml_model/extensions.py index 9125d581..7c9c3cf7 100644 --- a/linkml_runtime/linkml_model/extensions.py +++ b/linkml_runtime/linkml_model/extensions.py @@ -21,12 +21,13 @@ version = "2.0.0" # Namespaces -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") DEFAULT_ = LINKML # Types + # Class references class ExtensionTag(URIorCURIE): pass @@ -34,11 +35,13 @@ class ExtensionTag(URIorCURIE): AnyValue = Any + @dataclass class Extension(YAMLRoot): """ a tag/value pair used to add non-model information to an entry """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Extension"] @@ -48,7 +51,9 @@ class Extension(YAMLRoot): tag: Union[str, ExtensionTag] = None value: Union[dict, AnyValue] = None - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, "Extension"]], list[Union[dict, "Extension"]]]] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, "Extension"]], list[Union[dict, "Extension"]]] + ] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.tag): @@ -66,6 +71,7 @@ class Extensible(YAMLRoot): """ mixin for classes that support extension """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Extensible"] @@ -73,7 +79,9 @@ class Extensible(YAMLRoot): class_name: ClassVar[str] = "extensible" class_model_uri: ClassVar[URIRef] = LINKML.Extensible - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_dict(slot_name="extensions", slot_type=Extension, key_name="tag", keyed=True) @@ -88,11 +96,30 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): class slots: pass -slots.extensions = Slot(uri=LINKML.extensions, name="extensions", curie=LINKML.curie('extensions'), - model_uri=LINKML.extensions, domain=None, range=Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]]) - -slots.extension_tag = Slot(uri=LINKML.tag, name="extension_tag", curie=LINKML.curie('tag'), - model_uri=LINKML.extension_tag, domain=Extension, range=Union[str, ExtensionTag]) -slots.extension_value = Slot(uri=LINKML.value, name="extension_value", curie=LINKML.curie('value'), - model_uri=LINKML.extension_value, domain=Extension, range=Union[dict, AnyValue]) +slots.extensions = Slot( + uri=LINKML.extensions, + name="extensions", + curie=LINKML.curie("extensions"), + model_uri=LINKML.extensions, + domain=None, + range=Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]], +) + +slots.extension_tag = Slot( + uri=LINKML.tag, + name="extension_tag", + curie=LINKML.curie("tag"), + model_uri=LINKML.extension_tag, + domain=Extension, + range=Union[str, ExtensionTag], +) + +slots.extension_value = Slot( + uri=LINKML.value, + name="extension_value", + curie=LINKML.curie("value"), + model_uri=LINKML.extension_value, + domain=Extension, + range=Union[dict, AnyValue], +) diff --git a/linkml_runtime/linkml_model/linkml_files.py b/linkml_runtime/linkml_model/linkml_files.py index a2a58c08..5fc76e79 100644 --- a/linkml_runtime/linkml_model/linkml_files.py +++ b/linkml_runtime/linkml_model/linkml_files.py @@ -24,7 +24,8 @@ def _generate_next_value_(name, start, count, last_values): class Source(_AutoName): - """ LinkML package source name """ + """LinkML package source name""" + META = auto() TYPES = auto() MAPPINGS = auto() @@ -33,7 +34,8 @@ class Source(_AutoName): class Format(_AutoName): - """ LinkML package formats """ + """LinkML package formats""" + EXCEL = auto() GRAPHQL = auto() JSON = auto() @@ -55,48 +57,51 @@ class Format(_AutoName): SQLSCHEMA = auto() YAML = auto() + @dataclass class FormatPath: path: str extension: str - def model_path(self, model:str) -> Path: + def model_path(self, model: str) -> Path: return (Path(self.path) / model).with_suffix(self.extension) + class _Path: - """ LinkML Relative paths""" - EXCEL = FormatPath("excel","xlsx" ) - GRAPHQL = FormatPath("graphql","graphql" ) - JSON = FormatPath("json","json" ) - JSONLD = FormatPath("jsonld","context.jsonld" ) - JSON_SCHEMA = FormatPath("jsonschema", "schema.json" ) - NATIVE_JSONLD = FormatPath("jsonld", "context.jsonld" ) - NATIVE_RDF = FormatPath("rdf","ttl" ) - NATIVE_SHEXC = FormatPath("shex","shex" ) - NATIVE_SHEXJ = FormatPath("shex","shexj" ) - OWL = FormatPath("owl","owl.ttl" ) - PREFIXMAP = FormatPath('prefixmap','yaml' ) - PROTOBUF = FormatPath("protobuf","proto" ) - PYTHON = FormatPath("","py" ) - RDF = FormatPath("rdf","ttl" ) - SHACL = FormatPath("shacl","shacl.ttl" ) - SHEXC = FormatPath("shex","shex" ) - SHEXJ = FormatPath("shex","shexj" ) - SQLDDL = FormatPath("sqlddl","sql" ) - SQLSCHEMA = FormatPath("sqlschema","sql" ) - YAML = FormatPath(str(Path("model") / "schema"),"yaml" ) + """LinkML Relative paths""" + + EXCEL = FormatPath("excel", "xlsx") + GRAPHQL = FormatPath("graphql", "graphql") + JSON = FormatPath("json", "json") + JSONLD = FormatPath("jsonld", "context.jsonld") + JSON_SCHEMA = FormatPath("jsonschema", "schema.json") + NATIVE_JSONLD = FormatPath("jsonld", "context.jsonld") + NATIVE_RDF = FormatPath("rdf", "ttl") + NATIVE_SHEXC = FormatPath("shex", "shex") + NATIVE_SHEXJ = FormatPath("shex", "shexj") + OWL = FormatPath("owl", "owl.ttl") + PREFIXMAP = FormatPath("prefixmap", "yaml") + PROTOBUF = FormatPath("protobuf", "proto") + PYTHON = FormatPath("", "py") + RDF = FormatPath("rdf", "ttl") + SHACL = FormatPath("shacl", "shacl.ttl") + SHEXC = FormatPath("shex", "shex") + SHEXJ = FormatPath("shex", "shexj") + SQLDDL = FormatPath("sqlddl", "sql") + SQLSCHEMA = FormatPath("sqlschema", "sql") + YAML = FormatPath(str(Path("model") / "schema"), "yaml") @classmethod def items(cls) -> dict[str, FormatPath]: - return {k:v for k,v in cls.__dict__.items() if not k.startswith('_')} + return {k: v for k, v in cls.__dict__.items() if not k.startswith("_")} @classmethod - def get(cls, item:Union[str,Format]) -> FormatPath: + def get(cls, item: Union[str, Format]) -> FormatPath: if isinstance(item, Format): item = item.name.upper() return getattr(cls, item) - def __class_getitem__(cls, item:str) -> FormatPath: + def __class_getitem__(cls, item: str) -> FormatPath: return getattr(cls, item) @@ -108,14 +113,15 @@ def __class_getitem__(cls, item:str) -> FormatPath: Format.PROTOBUF, Format.SHACL, Format.SQLDDL, - Format.SQLSCHEMA + Format.SQLSCHEMA, ) class ReleaseTag(_AutoName): - """ Release tags + """Release tags LATEST - the absolute latest in the supplied branch - CURRENT - the latest _released_ version in the supplied branch """ + CURRENT - the latest _released_ version in the supplied branch""" + LATEST = auto() CURRENT = auto() @@ -137,12 +143,12 @@ def _build_path(source: Source, fmt: Format) -> PathParts: def _build_loc(base: str, source: Source, fmt: Format) -> str: """A github location""" # urls are always forward slash separated, so hardcoding is appropriate here - path = '/'.join(_build_path(source, fmt)) - return urljoin(base, path).replace('blob/', '') + path = "/".join(_build_path(source, fmt)) + return urljoin(base, path).replace("blob/", "") def URL_FOR(source: Source, fmt: Format) -> str: - """ Return the URL to retrieve source in format """ + """Return the URL to retrieve source in format""" fmt_path: FormatPath = _Path.get(fmt.name) return f"{LINKML_URL_BASE}{source.value}.{fmt_path.extension}" @@ -152,14 +158,16 @@ def LOCAL_PATH_FOR(source: Source, fmt: Format) -> str: def GITHUB_IO_PATH_FOR(source: Source, fmt: Format, version="latest") -> str: - path = '/'.join([version, 'linkml_model', *_build_path(source, fmt)]) + path = "/".join([version, "linkml_model", *_build_path(source, fmt)]) return urljoin(GITHUB_IO_BASE, path) -def GITHUB_PATH_FOR(source: Source, - fmt: Format, - release: Optional[Union[ReleaseTag, str]] = ReleaseTag.CURRENT, - branch: Optional[str] = "main") -> str: +def GITHUB_PATH_FOR( + source: Source, + fmt: Format, + release: Optional[Union[ReleaseTag, str]] = ReleaseTag.CURRENT, + branch: Optional[str] = "main", +) -> str: def do_request(url) -> object: resp = requests.get(url) if resp.ok: @@ -169,7 +177,7 @@ def do_request(url) -> object: def tag_to_commit(tag: str) -> str: tags = do_request(f"{GITHUB_API_BASE}tags?per_page=100") for tagent in tags: - if tagent['name'] == tag: + if tagent["name"] == tag: return _build_loc(f"{GITHUB_BASE}blob/{tagent['commit']['sha']}/", source, fmt) raise ValueError(f"Tag: {tag} not found!") @@ -178,13 +186,13 @@ def tag_to_commit(tag: str) -> str: # Return the absolute latest entry for branch if release is ReleaseTag.LATEST or (release is ReleaseTag.CURRENT and branch != "main"): - path = '/'.join([branch, 'linkml_model', *_build_path(source, fmt)]) + path = "/".join([branch, "linkml_model", *_build_path(source, fmt)]) return urljoin(GITHUB_BASE, path) # Return the latest published version elif release is ReleaseTag.CURRENT: release = do_request(f"{GITHUB_API_BASE}releases/latest") - return tag_to_commit(release['tag_name']) + return tag_to_commit(release["tag_name"]) # Return a specific tag else: @@ -212,7 +220,9 @@ def url(self) -> str: def file(self) -> str: return LOCAL_PATH_FOR(self._model, self._format) - def github_loc(self, tag: Optional[str] = None, branch: Optional[str] = None, release: ReleaseTag = None) -> str: + def github_loc( + self, tag: Optional[str] = None, branch: Optional[str] = None, release: ReleaseTag = None + ) -> str: if not tag and not branch and not release: return GITHUB_IO_PATH_FOR(self._model, self._format) if tag: diff --git a/linkml_runtime/linkml_model/mappings.py b/linkml_runtime/linkml_model/mappings.py index 57035d51..b9059930 100644 --- a/linkml_runtime/linkml_model/mappings.py +++ b/linkml_runtime/linkml_model/mappings.py @@ -17,13 +17,13 @@ version = "2.0.0" # Namespaces -IAO = CurieNamespace('IAO', 'http://purl.obolibrary.org/obo/IAO_') -OIO = CurieNamespace('OIO', 'http://www.geneontology.org/formats/oboInOwl#') -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -RDF = CurieNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#') -RDFS = CurieNamespace('rdfs', 'http://www.w3.org/2000/01/rdf-schema#') -SKOS = CurieNamespace('skos', 'http://www.w3.org/2004/02/skos/core#') -XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') +IAO = CurieNamespace("IAO", "http://purl.obolibrary.org/obo/IAO_") +OIO = CurieNamespace("OIO", "http://www.geneontology.org/formats/oboInOwl#") +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +RDF = CurieNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") +RDFS = CurieNamespace("rdfs", "http://www.w3.org/2000/01/rdf-schema#") +SKOS = CurieNamespace("skos", "http://www.w3.org/2004/02/skos/core#") +XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") DEFAULT_ = LINKML @@ -32,8 +32,6 @@ # Class references - - # Enumerations @@ -41,26 +39,77 @@ class slots: pass -slots.mappings = Slot(uri=SKOS.mappingRelation, name="mappings", curie=SKOS.curie('mappingRelation'), - model_uri=LINKML.mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.exact_mappings = Slot(uri=SKOS.exactMatch, name="exact mappings", curie=SKOS.curie('exactMatch'), - model_uri=LINKML.exact_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.close_mappings = Slot(uri=SKOS.closeMatch, name="close mappings", curie=SKOS.curie('closeMatch'), - model_uri=LINKML.close_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.related_mappings = Slot(uri=SKOS.relatedMatch, name="related mappings", curie=SKOS.curie('relatedMatch'), - model_uri=LINKML.related_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.narrow_mappings = Slot(uri=SKOS.narrowMatch, name="narrow mappings", curie=SKOS.curie('narrowMatch'), - model_uri=LINKML.narrow_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.broad_mappings = Slot(uri=SKOS.broadMatch, name="broad mappings", curie=SKOS.curie('broadMatch'), - model_uri=LINKML.broad_mappings, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.deprecated_element_has_exact_replacement = Slot(uri=LINKML.deprecated_element_has_exact_replacement, name="deprecated element has exact replacement", curie=LINKML.curie('deprecated_element_has_exact_replacement'), - model_uri=LINKML.deprecated_element_has_exact_replacement, domain=None, range=Optional[Union[str, URIorCURIE]], mappings = [IAO["0100001"]]) -slots.deprecated_element_has_possible_replacement = Slot(uri=LINKML.deprecated_element_has_possible_replacement, name="deprecated element has possible replacement", curie=LINKML.curie('deprecated_element_has_possible_replacement'), - model_uri=LINKML.deprecated_element_has_possible_replacement, domain=None, range=Optional[Union[str, URIorCURIE]], mappings = [OIO["consider"]]) +slots.mappings = Slot( + uri=SKOS.mappingRelation, + name="mappings", + curie=SKOS.curie("mappingRelation"), + model_uri=LINKML.mappings, + domain=None, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.exact_mappings = Slot( + uri=SKOS.exactMatch, + name="exact mappings", + curie=SKOS.curie("exactMatch"), + model_uri=LINKML.exact_mappings, + domain=None, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.close_mappings = Slot( + uri=SKOS.closeMatch, + name="close mappings", + curie=SKOS.curie("closeMatch"), + model_uri=LINKML.close_mappings, + domain=None, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.related_mappings = Slot( + uri=SKOS.relatedMatch, + name="related mappings", + curie=SKOS.curie("relatedMatch"), + model_uri=LINKML.related_mappings, + domain=None, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.narrow_mappings = Slot( + uri=SKOS.narrowMatch, + name="narrow mappings", + curie=SKOS.curie("narrowMatch"), + model_uri=LINKML.narrow_mappings, + domain=None, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.broad_mappings = Slot( + uri=SKOS.broadMatch, + name="broad mappings", + curie=SKOS.curie("broadMatch"), + model_uri=LINKML.broad_mappings, + domain=None, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.deprecated_element_has_exact_replacement = Slot( + uri=LINKML.deprecated_element_has_exact_replacement, + name="deprecated element has exact replacement", + curie=LINKML.curie("deprecated_element_has_exact_replacement"), + model_uri=LINKML.deprecated_element_has_exact_replacement, + domain=None, + range=Optional[Union[str, URIorCURIE]], + mappings=[IAO["0100001"]], +) + +slots.deprecated_element_has_possible_replacement = Slot( + uri=LINKML.deprecated_element_has_possible_replacement, + name="deprecated element has possible replacement", + curie=LINKML.curie("deprecated_element_has_possible_replacement"), + model_uri=LINKML.deprecated_element_has_possible_replacement, + domain=None, + range=Optional[Union[str, URIorCURIE]], + mappings=[OIO["consider"]], +) diff --git a/linkml_runtime/linkml_model/meta.py b/linkml_runtime/linkml_model/meta.py index b99b0f7e..e7e149b3 100644 --- a/linkml_runtime/linkml_model/meta.py +++ b/linkml_runtime/linkml_model/meta.py @@ -51,34 +51,35 @@ version = None # Namespaces -IAO = CurieNamespace('IAO', 'http://purl.obolibrary.org/obo/IAO_') -NCIT = CurieNamespace('NCIT', 'http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#') -OIO = CurieNamespace('OIO', 'http://www.geneontology.org/formats/oboInOwl#') -SIO = CurieNamespace('SIO', 'http://semanticscience.org/resource/SIO_') -BIBO = CurieNamespace('bibo', 'http://purl.org/ontology/bibo/') -CDISC = CurieNamespace('cdisc', 'http://rdf.cdisc.org/mms#') -DCTERMS = CurieNamespace('dcterms', 'http://purl.org/dc/terms/') -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -OSLC = CurieNamespace('oslc', 'http://open-services.net/ns/core#') -OWL = CurieNamespace('owl', 'http://www.w3.org/2002/07/owl#') -PAV = CurieNamespace('pav', 'http://purl.org/pav/') -PROV = CurieNamespace('prov', 'http://www.w3.org/ns/prov#') -QB = CurieNamespace('qb', 'http://purl.org/linked-data/cube#') -QUDT = CurieNamespace('qudt', 'http://qudt.org/schema/qudt/') -RDF = CurieNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#') -RDFS = CurieNamespace('rdfs', 'http://www.w3.org/2000/01/rdf-schema#') -SCHEMA = CurieNamespace('schema', 'http://schema.org/') -SH = CurieNamespace('sh', 'http://www.w3.org/ns/shacl#') -SKOS = CurieNamespace('skos', 'http://www.w3.org/2004/02/skos/core#') -SKOSXL = CurieNamespace('skosxl', 'http://www.w3.org/2008/05/skos-xl#') -SWRL = CurieNamespace('swrl', 'http://www.w3.org/2003/11/swrl#') -VANN = CurieNamespace('vann', 'https://vocab.org/vann/') -XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') +IAO = CurieNamespace("IAO", "http://purl.obolibrary.org/obo/IAO_") +NCIT = CurieNamespace("NCIT", "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#") +OIO = CurieNamespace("OIO", "http://www.geneontology.org/formats/oboInOwl#") +SIO = CurieNamespace("SIO", "http://semanticscience.org/resource/SIO_") +BIBO = CurieNamespace("bibo", "http://purl.org/ontology/bibo/") +CDISC = CurieNamespace("cdisc", "http://rdf.cdisc.org/mms#") +DCTERMS = CurieNamespace("dcterms", "http://purl.org/dc/terms/") +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +OSLC = CurieNamespace("oslc", "http://open-services.net/ns/core#") +OWL = CurieNamespace("owl", "http://www.w3.org/2002/07/owl#") +PAV = CurieNamespace("pav", "http://purl.org/pav/") +PROV = CurieNamespace("prov", "http://www.w3.org/ns/prov#") +QB = CurieNamespace("qb", "http://purl.org/linked-data/cube#") +QUDT = CurieNamespace("qudt", "http://qudt.org/schema/qudt/") +RDF = CurieNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") +RDFS = CurieNamespace("rdfs", "http://www.w3.org/2000/01/rdf-schema#") +SCHEMA = CurieNamespace("schema", "http://schema.org/") +SH = CurieNamespace("sh", "http://www.w3.org/ns/shacl#") +SKOS = CurieNamespace("skos", "http://www.w3.org/2004/02/skos/core#") +SKOSXL = CurieNamespace("skosxl", "http://www.w3.org/2008/05/skos-xl#") +SWRL = CurieNamespace("swrl", "http://www.w3.org/2003/11/swrl#") +VANN = CurieNamespace("vann", "https://vocab.org/vann/") +XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") DEFAULT_ = LINKML # Types + # Class references class ElementName(extended_str): pass @@ -142,11 +143,13 @@ class TypeMappingFramework(extended_str): Anything = Any + @dataclass(repr=False) class CommonMetadata(YAMLRoot): """ Generic metadata shared across definitions """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["CommonMetadata"] @@ -155,7 +158,11 @@ class CommonMetadata(YAMLRoot): class_model_uri: ClassVar[URIRef] = LINKML.CommonMetadata description: Optional[str] = None - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[ + Union[ + dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]] + ] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -171,7 +178,9 @@ class CommonMetadata(YAMLRoot): deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None aliases: Optional[Union[str, list[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], list[Union[dict, "StructuredAlias"]]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], list[Union[dict, "StructuredAlias"]]]] = ( + empty_list() + ) mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() @@ -192,7 +201,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -236,17 +247,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -310,6 +329,7 @@ class Element(YAMLRoot): """ A named element in the model """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Element"] @@ -321,14 +341,24 @@ class Element(YAMLRoot): id_prefixes: Optional[Union[Union[str, NCName], list[Union[str, NCName]]]] = empty_list() id_prefixes_are_closed: Optional[Union[bool, Bool]] = None definition_uri: Optional[Union[str, URIorCURIE]] = None - local_names: Optional[Union[dict[Union[str, LocalNameLocalNameSource], Union[dict, "LocalName"]], list[Union[dict, "LocalName"]]]] = empty_dict() + local_names: Optional[ + Union[dict[Union[str, LocalNameLocalNameSource], Union[dict, "LocalName"]], list[Union[dict, "LocalName"]]] + ] = empty_dict() conforms_to: Optional[str] = None implements: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() instantiates: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]] + ] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[ + Union[ + dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]] + ] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -344,7 +374,9 @@ class Element(YAMLRoot): deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None aliases: Optional[Union[str, list[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], list[Union[dict, "StructuredAlias"]]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], list[Union[dict, "StructuredAlias"]]]] = ( + empty_list() + ) mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() @@ -377,7 +409,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.definition_uri is not None and not isinstance(self.definition_uri, URIorCURIE): self.definition_uri = URIorCURIE(self.definition_uri) - self._normalize_inlined_as_dict(slot_name="local_names", slot_type=LocalName, key_name="local_name_source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="local_names", slot_type=LocalName, key_name="local_name_source", keyed=True + ) if self.conforms_to is not None and not isinstance(self.conforms_to, str): self.conforms_to = str(self.conforms_to) @@ -397,7 +431,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -441,17 +477,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -515,6 +559,7 @@ class SchemaDefinition(Element): """ A collection of definitions that make up a schema or a data model. """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["SchemaDefinition"] @@ -527,23 +572,42 @@ class SchemaDefinition(Element): version: Optional[str] = None imports: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() license: Optional[str] = None - prefixes: Optional[Union[dict[Union[str, PrefixPrefixPrefix], Union[dict, "Prefix"]], list[Union[dict, "Prefix"]]]] = empty_dict() + prefixes: Optional[ + Union[dict[Union[str, PrefixPrefixPrefix], Union[dict, "Prefix"]], list[Union[dict, "Prefix"]]] + ] = empty_dict() emit_prefixes: Optional[Union[Union[str, NCName], list[Union[str, NCName]]]] = empty_list() default_curi_maps: Optional[Union[str, list[str]]] = empty_list() default_prefix: Optional[str] = None default_range: Optional[Union[str, TypeDefinitionName]] = None - subsets: Optional[Union[dict[Union[str, SubsetDefinitionName], Union[dict, "SubsetDefinition"]], list[Union[dict, "SubsetDefinition"]]]] = empty_dict() - types: Optional[Union[dict[Union[str, TypeDefinitionName], Union[dict, "TypeDefinition"]], list[Union[dict, "TypeDefinition"]]]] = empty_dict() - enums: Optional[Union[dict[Union[str, EnumDefinitionName], Union[dict, "EnumDefinition"]], list[Union[dict, "EnumDefinition"]]]] = empty_dict() - slots: Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, "SlotDefinition"]], list[Union[dict, "SlotDefinition"]]]] = empty_dict() - classes: Optional[Union[dict[Union[str, ClassDefinitionName], Union[dict, "ClassDefinition"]], list[Union[dict, "ClassDefinition"]]]] = empty_dict() + subsets: Optional[ + Union[ + dict[Union[str, SubsetDefinitionName], Union[dict, "SubsetDefinition"]], + list[Union[dict, "SubsetDefinition"]], + ] + ] = empty_dict() + types: Optional[ + Union[dict[Union[str, TypeDefinitionName], Union[dict, "TypeDefinition"]], list[Union[dict, "TypeDefinition"]]] + ] = empty_dict() + enums: Optional[ + Union[dict[Union[str, EnumDefinitionName], Union[dict, "EnumDefinition"]], list[Union[dict, "EnumDefinition"]]] + ] = empty_dict() + slots: Optional[ + Union[dict[Union[str, SlotDefinitionName], Union[dict, "SlotDefinition"]], list[Union[dict, "SlotDefinition"]]] + ] = empty_dict() + classes: Optional[ + Union[ + dict[Union[str, ClassDefinitionName], Union[dict, "ClassDefinition"]], list[Union[dict, "ClassDefinition"]] + ] + ] = empty_dict() metamodel_version: Optional[str] = None source_file: Optional[str] = None source_file_date: Optional[Union[str, XSDDateTime]] = None source_file_size: Optional[int] = None generation_date: Optional[Union[str, XSDDateTime]] = None slot_names_unique: Optional[Union[bool, Bool]] = None - settings: Optional[Union[dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], list[Union[dict, "Setting"]]]] = empty_dict() + settings: Optional[ + Union[dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], list[Union[dict, "Setting"]]] + ] = empty_dict() bindings: Optional[Union[Union[dict, "EnumBinding"], list[Union[dict, "EnumBinding"]]]] = empty_list() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): @@ -627,7 +691,16 @@ class AnonymousTypeExpression(YAMLRoot): """ A type expression that is not a top-level named type definition. Used for nesting. """ - _inherited_slots: ClassVar[list[str]] = ["pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "minimum_value", "maximum_value"] + + _inherited_slots: ClassVar[list[str]] = [ + "pattern", + "structured_pattern", + "equals_string", + "equals_string_in", + "equals_number", + "minimum_value", + "maximum_value", + ] class_class_uri: ClassVar[URIRef] = LINKML["AnonymousTypeExpression"] class_class_curie: ClassVar[str] = "linkml:AnonymousTypeExpression" @@ -643,10 +716,18 @@ class AnonymousTypeExpression(YAMLRoot): equals_number: Optional[int] = None minimum_value: Optional[Union[dict, Anything]] = None maximum_value: Optional[Union[dict, Anything]] = None - none_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - any_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - all_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() + none_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = ( + empty_list() + ) + exactly_one_of: Optional[ + Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]] + ] = empty_list() + any_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = ( + empty_list() + ) + all_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = ( + empty_list() + ) def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.pattern is not None and not isinstance(self.pattern, str): @@ -673,19 +754,28 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.none_of, list): self.none_of = [self.none_of] if self.none_of is not None else [] - self.none_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.none_of] + self.none_of = [ + v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.none_of + ] if not isinstance(self.exactly_one_of, list): self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else [] - self.exactly_one_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.exactly_one_of] + self.exactly_one_of = [ + v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) + for v in self.exactly_one_of + ] if not isinstance(self.any_of, list): self.any_of = [self.any_of] if self.any_of is not None else [] - self.any_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.any_of] + self.any_of = [ + v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.any_of + ] if not isinstance(self.all_of, list): self.all_of = [self.all_of] if self.all_of is not None else [] - self.all_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.all_of] + self.all_of = [ + v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.all_of + ] super().__post_init__(**kwargs) @@ -695,7 +785,19 @@ class TypeDefinition(Element): """ an element that whose instances are atomic scalar values that can be mapped to primitive types """ - _inherited_slots: ClassVar[list[str]] = ["base", "uri", "repr", "pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "minimum_value", "maximum_value"] + + _inherited_slots: ClassVar[list[str]] = [ + "base", + "uri", + "repr", + "pattern", + "structured_pattern", + "equals_string", + "equals_string_in", + "equals_number", + "minimum_value", + "maximum_value", + ] class_class_uri: ClassVar[URIRef] = LINKML["TypeDefinition"] class_class_curie: ClassVar[str] = "linkml:TypeDefinition" @@ -717,10 +819,18 @@ class TypeDefinition(Element): equals_number: Optional[int] = None minimum_value: Optional[Union[dict, Anything]] = None maximum_value: Optional[Union[dict, Anything]] = None - none_of: Optional[Union[Union[dict, AnonymousTypeExpression], list[Union[dict, AnonymousTypeExpression]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, AnonymousTypeExpression], list[Union[dict, AnonymousTypeExpression]]]] = empty_list() - any_of: Optional[Union[Union[dict, AnonymousTypeExpression], list[Union[dict, AnonymousTypeExpression]]]] = empty_list() - all_of: Optional[Union[Union[dict, AnonymousTypeExpression], list[Union[dict, AnonymousTypeExpression]]]] = empty_list() + none_of: Optional[Union[Union[dict, AnonymousTypeExpression], list[Union[dict, AnonymousTypeExpression]]]] = ( + empty_list() + ) + exactly_one_of: Optional[ + Union[Union[dict, AnonymousTypeExpression], list[Union[dict, AnonymousTypeExpression]]] + ] = empty_list() + any_of: Optional[Union[Union[dict, AnonymousTypeExpression], list[Union[dict, AnonymousTypeExpression]]]] = ( + empty_list() + ) + all_of: Optional[Union[Union[dict, AnonymousTypeExpression], list[Union[dict, AnonymousTypeExpression]]]] = ( + empty_list() + ) def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.name): @@ -768,19 +878,28 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.none_of, list): self.none_of = [self.none_of] if self.none_of is not None else [] - self.none_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.none_of] + self.none_of = [ + v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.none_of + ] if not isinstance(self.exactly_one_of, list): self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else [] - self.exactly_one_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.exactly_one_of] + self.exactly_one_of = [ + v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) + for v in self.exactly_one_of + ] if not isinstance(self.any_of, list): self.any_of = [self.any_of] if self.any_of is not None else [] - self.any_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.any_of] + self.any_of = [ + v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.any_of + ] if not isinstance(self.all_of, list): self.all_of = [self.all_of] if self.all_of is not None else [] - self.all_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.all_of] + self.all_of = [ + v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.all_of + ] super().__post_init__(**kwargs) @@ -790,6 +909,7 @@ class SubsetDefinition(Element): """ an element that can be used to group other metamodel elements """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["SubsetDefinition"] @@ -813,6 +933,7 @@ class Definition(Element): """ abstract base class for core metaclasses """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Definition"] @@ -862,6 +983,7 @@ class AnonymousEnumExpression(YAMLRoot): """ An enum_expression that is not named """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["AnonymousEnumExpression"] @@ -873,9 +995,18 @@ class AnonymousEnumExpression(YAMLRoot): code_set_tag: Optional[str] = None code_set_version: Optional[str] = None pv_formula: Optional[Union[str, "PvFormulaOptions"]] = None - permissible_values: Optional[Union[dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], list[Union[dict, "PermissibleValue"]]]] = empty_dict() - include: Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]] = empty_list() - minus: Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]] = empty_list() + permissible_values: Optional[ + Union[ + dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], + list[Union[dict, "PermissibleValue"]], + ] + ] = empty_dict() + include: Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]] = ( + empty_list() + ) + minus: Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]] = ( + empty_list() + ) inherits: Optional[Union[Union[str, EnumDefinitionName], list[Union[str, EnumDefinitionName]]]] = empty_list() reachable_from: Optional[Union[dict, "ReachabilityQuery"]] = None matches: Optional[Union[dict, "MatchQuery"]] = None @@ -894,15 +1025,21 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.pv_formula is not None and not isinstance(self.pv_formula, PvFormulaOptions): self.pv_formula = PvFormulaOptions(self.pv_formula) - self._normalize_inlined_as_dict(slot_name="permissible_values", slot_type=PermissibleValue, key_name="text", keyed=True) + self._normalize_inlined_as_dict( + slot_name="permissible_values", slot_type=PermissibleValue, key_name="text", keyed=True + ) if not isinstance(self.include, list): self.include = [self.include] if self.include is not None else [] - self.include = [v if isinstance(v, AnonymousEnumExpression) else AnonymousEnumExpression(**as_dict(v)) for v in self.include] + self.include = [ + v if isinstance(v, AnonymousEnumExpression) else AnonymousEnumExpression(**as_dict(v)) for v in self.include + ] if not isinstance(self.minus, list): self.minus = [self.minus] if self.minus is not None else [] - self.minus = [v if isinstance(v, AnonymousEnumExpression) else AnonymousEnumExpression(**as_dict(v)) for v in self.minus] + self.minus = [ + v if isinstance(v, AnonymousEnumExpression) else AnonymousEnumExpression(**as_dict(v)) for v in self.minus + ] if not isinstance(self.inherits, list): self.inherits = [self.inherits] if self.inherits is not None else [] @@ -926,6 +1063,7 @@ class EnumDefinition(Definition): """ an element whose instances must be drawn from a specified set of permissible values """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["EnumDefinition"] @@ -939,9 +1077,18 @@ class EnumDefinition(Definition): code_set_tag: Optional[str] = None code_set_version: Optional[str] = None pv_formula: Optional[Union[str, "PvFormulaOptions"]] = None - permissible_values: Optional[Union[dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], list[Union[dict, "PermissibleValue"]]]] = empty_dict() - include: Optional[Union[Union[dict, AnonymousEnumExpression], list[Union[dict, AnonymousEnumExpression]]]] = empty_list() - minus: Optional[Union[Union[dict, AnonymousEnumExpression], list[Union[dict, AnonymousEnumExpression]]]] = empty_list() + permissible_values: Optional[ + Union[ + dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], + list[Union[dict, "PermissibleValue"]], + ] + ] = empty_dict() + include: Optional[Union[Union[dict, AnonymousEnumExpression], list[Union[dict, AnonymousEnumExpression]]]] = ( + empty_list() + ) + minus: Optional[Union[Union[dict, AnonymousEnumExpression], list[Union[dict, AnonymousEnumExpression]]]] = ( + empty_list() + ) inherits: Optional[Union[Union[str, EnumDefinitionName], list[Union[str, EnumDefinitionName]]]] = empty_list() reachable_from: Optional[Union[dict, "ReachabilityQuery"]] = None matches: Optional[Union[dict, "MatchQuery"]] = None @@ -968,15 +1115,21 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.pv_formula is not None and not isinstance(self.pv_formula, PvFormulaOptions): self.pv_formula = PvFormulaOptions(self.pv_formula) - self._normalize_inlined_as_dict(slot_name="permissible_values", slot_type=PermissibleValue, key_name="text", keyed=True) + self._normalize_inlined_as_dict( + slot_name="permissible_values", slot_type=PermissibleValue, key_name="text", keyed=True + ) if not isinstance(self.include, list): self.include = [self.include] if self.include is not None else [] - self.include = [v if isinstance(v, AnonymousEnumExpression) else AnonymousEnumExpression(**as_dict(v)) for v in self.include] + self.include = [ + v if isinstance(v, AnonymousEnumExpression) else AnonymousEnumExpression(**as_dict(v)) for v in self.include + ] if not isinstance(self.minus, list): self.minus = [self.minus] if self.minus is not None else [] - self.minus = [v if isinstance(v, AnonymousEnumExpression) else AnonymousEnumExpression(**as_dict(v)) for v in self.minus] + self.minus = [ + v if isinstance(v, AnonymousEnumExpression) else AnonymousEnumExpression(**as_dict(v)) for v in self.minus + ] if not isinstance(self.inherits, list): self.inherits = [self.inherits] if self.inherits is not None else [] @@ -1000,6 +1153,7 @@ class EnumBinding(YAMLRoot): """ A binding of a slot or a class to a permissible value from an enumeration. """ + _inherited_slots: ClassVar[list[str]] = ["range"] class_class_uri: ClassVar[URIRef] = LINKML["EnumBinding"] @@ -1011,10 +1165,18 @@ class EnumBinding(YAMLRoot): obligation_level: Optional[Union[str, "ObligationLevelEnum"]] = None binds_value_of: Optional[str] = None pv_formula: Optional[Union[str, "PvFormulaOptions"]] = None - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]] + ] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[ + Union[ + dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]] + ] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -1030,7 +1192,9 @@ class EnumBinding(YAMLRoot): deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None aliases: Optional[Union[str, list[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], list[Union[dict, "StructuredAlias"]]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], list[Union[dict, "StructuredAlias"]]]] = ( + empty_list() + ) mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() @@ -1067,7 +1231,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -1111,17 +1277,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -1186,6 +1360,7 @@ class MatchQuery(YAMLRoot): A query that is used on an enum expression to dynamically obtain a set of permissivle values via a query that matches on properties of the external concepts. """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["MatchQuery"] @@ -1212,6 +1387,7 @@ class ReachabilityQuery(YAMLRoot): A query that is used on an enum expression to dynamically obtain a set of permissible values via walking from a set of source nodes to a set of descendants or ancestors over a set of relationship types. """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["ReachabilityQuery"] @@ -1256,6 +1432,7 @@ class StructuredAlias(YAMLRoot): object that contains meta data about a synonym or alias including where it came from (source) and its scope (narrow, broad, etc.) """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SKOSXL["Label"] @@ -1267,10 +1444,18 @@ class StructuredAlias(YAMLRoot): predicate: Optional[Union[str, "AliasPredicateEnum"]] = None categories: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() contexts: Optional[Union[Union[str, URI], list[Union[str, URI]]]] = empty_list() - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]] + ] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[ + Union[ + dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]] + ] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -1286,7 +1471,9 @@ class StructuredAlias(YAMLRoot): deprecated_element_has_exact_replacement: Optional[Union[str, URIorCURIE]] = None deprecated_element_has_possible_replacement: Optional[Union[str, URIorCURIE]] = None aliases: Optional[Union[str, list[str]]] = empty_list() - structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], list[Union[dict, "StructuredAlias"]]]] = empty_list() + structured_aliases: Optional[Union[Union[dict, "StructuredAlias"], list[Union[dict, "StructuredAlias"]]]] = ( + empty_list() + ) mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() exact_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() close_mappings: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() @@ -1326,7 +1513,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -1370,17 +1559,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -1439,6 +1636,7 @@ class Expression(YAMLRoot): """ general mixin for any class that can represent some form of expression """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Expression"] @@ -1452,7 +1650,16 @@ class TypeExpression(Expression): """ An abstract class grouping named types and anonymous type expressions """ - _inherited_slots: ClassVar[list[str]] = ["pattern", "structured_pattern", "equals_string", "equals_string_in", "equals_number", "minimum_value", "maximum_value"] + + _inherited_slots: ClassVar[list[str]] = [ + "pattern", + "structured_pattern", + "equals_string", + "equals_string_in", + "equals_number", + "minimum_value", + "maximum_value", + ] class_class_uri: ClassVar[URIRef] = LINKML["TypeExpression"] class_class_curie: ClassVar[str] = "linkml:TypeExpression" @@ -1468,10 +1675,18 @@ class TypeExpression(Expression): equals_number: Optional[int] = None minimum_value: Optional[Union[dict, Anything]] = None maximum_value: Optional[Union[dict, Anything]] = None - none_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - any_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() - all_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = empty_list() + none_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = ( + empty_list() + ) + exactly_one_of: Optional[ + Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]] + ] = empty_list() + any_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = ( + empty_list() + ) + all_of: Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]] = ( + empty_list() + ) def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.pattern is not None and not isinstance(self.pattern, str): @@ -1498,19 +1713,28 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.none_of, list): self.none_of = [self.none_of] if self.none_of is not None else [] - self.none_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.none_of] + self.none_of = [ + v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.none_of + ] if not isinstance(self.exactly_one_of, list): self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else [] - self.exactly_one_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.exactly_one_of] + self.exactly_one_of = [ + v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) + for v in self.exactly_one_of + ] if not isinstance(self.any_of, list): self.any_of = [self.any_of] if self.any_of is not None else [] - self.any_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.any_of] + self.any_of = [ + v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.any_of + ] if not isinstance(self.all_of, list): self.all_of = [self.all_of] if self.all_of is not None else [] - self.all_of = [v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.all_of] + self.all_of = [ + v if isinstance(v, AnonymousTypeExpression) else AnonymousTypeExpression(**as_dict(v)) for v in self.all_of + ] super().__post_init__(**kwargs) @@ -1520,6 +1744,7 @@ class EnumExpression(Expression): """ An expression that constrains the range of a slot """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["EnumExpression"] @@ -1531,9 +1756,18 @@ class EnumExpression(Expression): code_set_tag: Optional[str] = None code_set_version: Optional[str] = None pv_formula: Optional[Union[str, "PvFormulaOptions"]] = None - permissible_values: Optional[Union[dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], list[Union[dict, "PermissibleValue"]]]] = empty_dict() - include: Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]] = empty_list() - minus: Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]] = empty_list() + permissible_values: Optional[ + Union[ + dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], + list[Union[dict, "PermissibleValue"]], + ] + ] = empty_dict() + include: Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]] = ( + empty_list() + ) + minus: Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]] = ( + empty_list() + ) inherits: Optional[Union[Union[str, EnumDefinitionName], list[Union[str, EnumDefinitionName]]]] = empty_list() reachable_from: Optional[Union[dict, "ReachabilityQuery"]] = None matches: Optional[Union[dict, "MatchQuery"]] = None @@ -1552,15 +1786,21 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.pv_formula is not None and not isinstance(self.pv_formula, PvFormulaOptions): self.pv_formula = PvFormulaOptions(self.pv_formula) - self._normalize_inlined_as_dict(slot_name="permissible_values", slot_type=PermissibleValue, key_name="text", keyed=True) + self._normalize_inlined_as_dict( + slot_name="permissible_values", slot_type=PermissibleValue, key_name="text", keyed=True + ) if not isinstance(self.include, list): self.include = [self.include] if self.include is not None else [] - self.include = [v if isinstance(v, AnonymousEnumExpression) else AnonymousEnumExpression(**as_dict(v)) for v in self.include] + self.include = [ + v if isinstance(v, AnonymousEnumExpression) else AnonymousEnumExpression(**as_dict(v)) for v in self.include + ] if not isinstance(self.minus, list): self.minus = [self.minus] if self.minus is not None else [] - self.minus = [v if isinstance(v, AnonymousEnumExpression) else AnonymousEnumExpression(**as_dict(v)) for v in self.minus] + self.minus = [ + v if isinstance(v, AnonymousEnumExpression) else AnonymousEnumExpression(**as_dict(v)) for v in self.minus + ] if not isinstance(self.inherits, list): self.inherits = [self.inherits] if self.inherits is not None else [] @@ -1584,6 +1824,7 @@ class AnonymousExpression(YAMLRoot): """ An abstract parent class for any nested expression """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["AnonymousExpression"] @@ -1591,10 +1832,18 @@ class AnonymousExpression(YAMLRoot): class_name: ClassVar[str] = "anonymous_expression" class_model_uri: ClassVar[URIRef] = LINKML.AnonymousExpression - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]] + ] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[ + Union[ + dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]] + ] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -1635,7 +1884,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -1679,17 +1930,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -1753,6 +2012,7 @@ class PathExpression(YAMLRoot): """ An expression that describes an abstract path from an object to another through a sequence of slot lookups """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["PathExpression"] @@ -1768,10 +2028,18 @@ class PathExpression(YAMLRoot): reversed: Optional[Union[bool, Bool]] = None traverse: Optional[Union[str, SlotDefinitionName]] = None range_expression: Optional[Union[dict, "AnonymousClassExpression"]] = None - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]] + ] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[ + Union[ + dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]] + ] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -1822,7 +2090,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.exactly_one_of, list): self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else [] - self.exactly_one_of = [v if isinstance(v, PathExpression) else PathExpression(**as_dict(v)) for v in self.exactly_one_of] + self.exactly_one_of = [ + v if isinstance(v, PathExpression) else PathExpression(**as_dict(v)) for v in self.exactly_one_of + ] if self.reversed is not None and not isinstance(self.reversed, Bool): self.reversed = Bool(self.reversed) @@ -1840,7 +2110,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -1884,17 +2156,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -1958,7 +2238,27 @@ class SlotExpression(Expression): """ an expression that constrains the range of values a slot can take """ - _inherited_slots: ClassVar[list[str]] = ["range", "required", "recommended", "multivalued", "inlined", "inlined_as_list", "minimum_value", "maximum_value", "pattern", "structured_pattern", "value_presence", "equals_string", "equals_string_in", "equals_number", "equals_expression", "exact_cardinality", "minimum_cardinality", "maximum_cardinality"] + + _inherited_slots: ClassVar[list[str]] = [ + "range", + "required", + "recommended", + "multivalued", + "inlined", + "inlined_as_list", + "minimum_value", + "maximum_value", + "pattern", + "structured_pattern", + "value_presence", + "equals_string", + "equals_string_in", + "equals_number", + "equals_expression", + "exact_cardinality", + "minimum_cardinality", + "maximum_cardinality", + ] class_class_uri: ClassVar[URIRef] = LINKML["SlotExpression"] class_class_curie: ClassVar[str] = "linkml:SlotExpression" @@ -1990,10 +2290,18 @@ class SlotExpression(Expression): maximum_cardinality: Optional[int] = None has_member: Optional[Union[dict, "AnonymousSlotExpression"]] = None all_members: Optional[Union[dict, "AnonymousSlotExpression"]] = None - none_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - any_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - all_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() + none_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = ( + empty_list() + ) + exactly_one_of: Optional[ + Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]] + ] = empty_list() + any_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = ( + empty_list() + ) + all_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = ( + empty_list() + ) def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.range is not None and not isinstance(self.range, ElementName): @@ -2069,26 +2377,54 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.none_of, list): self.none_of = [self.none_of] if self.none_of is not None else [] - self.none_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.none_of] + self.none_of = [ + v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.none_of + ] if not isinstance(self.exactly_one_of, list): self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else [] - self.exactly_one_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.exactly_one_of] + self.exactly_one_of = [ + v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) + for v in self.exactly_one_of + ] if not isinstance(self.any_of, list): self.any_of = [self.any_of] if self.any_of is not None else [] - self.any_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.any_of] + self.any_of = [ + v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.any_of + ] if not isinstance(self.all_of, list): self.all_of = [self.all_of] if self.all_of is not None else [] - self.all_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.all_of] + self.all_of = [ + v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.all_of + ] super().__post_init__(**kwargs) @dataclass(repr=False) class AnonymousSlotExpression(AnonymousExpression): - _inherited_slots: ClassVar[list[str]] = ["range", "required", "recommended", "multivalued", "inlined", "inlined_as_list", "minimum_value", "maximum_value", "pattern", "structured_pattern", "value_presence", "equals_string", "equals_string_in", "equals_number", "equals_expression", "exact_cardinality", "minimum_cardinality", "maximum_cardinality"] + _inherited_slots: ClassVar[list[str]] = [ + "range", + "required", + "recommended", + "multivalued", + "inlined", + "inlined_as_list", + "minimum_value", + "maximum_value", + "pattern", + "structured_pattern", + "value_presence", + "equals_string", + "equals_string_in", + "equals_number", + "equals_expression", + "exact_cardinality", + "minimum_cardinality", + "maximum_cardinality", + ] class_class_uri: ClassVar[URIRef] = LINKML["AnonymousSlotExpression"] class_class_curie: ClassVar[str] = "linkml:AnonymousSlotExpression" @@ -2120,10 +2456,18 @@ class AnonymousSlotExpression(AnonymousExpression): maximum_cardinality: Optional[int] = None has_member: Optional[Union[dict, "AnonymousSlotExpression"]] = None all_members: Optional[Union[dict, "AnonymousSlotExpression"]] = None - none_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - any_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() - all_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = empty_list() + none_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = ( + empty_list() + ) + exactly_one_of: Optional[ + Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]] + ] = empty_list() + any_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = ( + empty_list() + ) + all_of: Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]] = ( + empty_list() + ) def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.range is not None and not isinstance(self.range, ElementName): @@ -2199,19 +2543,28 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.none_of, list): self.none_of = [self.none_of] if self.none_of is not None else [] - self.none_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.none_of] + self.none_of = [ + v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.none_of + ] if not isinstance(self.exactly_one_of, list): self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else [] - self.exactly_one_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.exactly_one_of] + self.exactly_one_of = [ + v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) + for v in self.exactly_one_of + ] if not isinstance(self.any_of, list): self.any_of = [self.any_of] if self.any_of is not None else [] - self.any_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.any_of] + self.any_of = [ + v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.any_of + ] if not isinstance(self.all_of, list): self.all_of = [self.all_of] if self.all_of is not None else [] - self.all_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.all_of] + self.all_of = [ + v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.all_of + ] super().__post_init__(**kwargs) @@ -2221,7 +2574,40 @@ class SlotDefinition(Definition): """ an element that describes how instances are related to other instances """ - _inherited_slots: ClassVar[list[str]] = ["domain", "array", "inherited", "readonly", "ifabsent", "list_elements_unique", "list_elements_ordered", "shared", "key", "identifier", "designates_type", "role", "relational_role", "range", "required", "recommended", "multivalued", "inlined", "inlined_as_list", "minimum_value", "maximum_value", "pattern", "structured_pattern", "value_presence", "equals_string", "equals_string_in", "equals_number", "equals_expression", "exact_cardinality", "minimum_cardinality", "maximum_cardinality"] + + _inherited_slots: ClassVar[list[str]] = [ + "domain", + "array", + "inherited", + "readonly", + "ifabsent", + "list_elements_unique", + "list_elements_ordered", + "shared", + "key", + "identifier", + "designates_type", + "role", + "relational_role", + "range", + "required", + "recommended", + "multivalued", + "inlined", + "inlined_as_list", + "minimum_value", + "maximum_value", + "pattern", + "structured_pattern", + "value_presence", + "equals_string", + "equals_string_in", + "equals_number", + "equals_expression", + "exact_cardinality", + "minimum_cardinality", + "maximum_cardinality", + ] class_class_uri: ClassVar[URIRef] = LINKML["SlotDefinition"] class_class_curie: ClassVar[str] = "linkml:SlotDefinition" @@ -2266,7 +2652,9 @@ class SlotDefinition(Definition): disjoint_with: Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]] = empty_list() children_are_mutually_disjoint: Optional[Union[bool, Bool]] = None union_of: Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]] = empty_list() - type_mappings: Optional[Union[Union[str, TypeMappingFramework], list[Union[str, TypeMappingFramework]]]] = empty_list() + type_mappings: Optional[Union[Union[str, TypeMappingFramework], list[Union[str, TypeMappingFramework]]]] = ( + empty_list() + ) is_a: Optional[Union[str, SlotDefinitionName]] = None mixins: Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]] = empty_list() apply_to: Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]] = empty_list() @@ -2295,10 +2683,18 @@ class SlotDefinition(Definition): maximum_cardinality: Optional[int] = None has_member: Optional[Union[dict, AnonymousSlotExpression]] = None all_members: Optional[Union[dict, AnonymousSlotExpression]] = None - none_of: Optional[Union[Union[dict, AnonymousSlotExpression], list[Union[dict, AnonymousSlotExpression]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, AnonymousSlotExpression], list[Union[dict, AnonymousSlotExpression]]]] = empty_list() - any_of: Optional[Union[Union[dict, AnonymousSlotExpression], list[Union[dict, AnonymousSlotExpression]]]] = empty_list() - all_of: Optional[Union[Union[dict, AnonymousSlotExpression], list[Union[dict, AnonymousSlotExpression]]]] = empty_list() + none_of: Optional[Union[Union[dict, AnonymousSlotExpression], list[Union[dict, AnonymousSlotExpression]]]] = ( + empty_list() + ) + exactly_one_of: Optional[ + Union[Union[dict, AnonymousSlotExpression], list[Union[dict, AnonymousSlotExpression]]] + ] = empty_list() + any_of: Optional[Union[Union[dict, AnonymousSlotExpression], list[Union[dict, AnonymousSlotExpression]]]] = ( + empty_list() + ) + all_of: Optional[Union[Union[dict, AnonymousSlotExpression], list[Union[dict, AnonymousSlotExpression]]]] = ( + empty_list() + ) def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.name): @@ -2385,7 +2781,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.transitive_form_of is not None and not isinstance(self.transitive_form_of, SlotDefinitionName): self.transitive_form_of = SlotDefinitionName(self.transitive_form_of) - if self.reflexive_transitive_form_of is not None and not isinstance(self.reflexive_transitive_form_of, SlotDefinitionName): + if self.reflexive_transitive_form_of is not None and not isinstance( + self.reflexive_transitive_form_of, SlotDefinitionName + ): self.reflexive_transitive_form_of = SlotDefinitionName(self.reflexive_transitive_form_of) if self.role is not None and not isinstance(self.role, str): @@ -2411,9 +2809,13 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.disjoint_with, list): self.disjoint_with = [self.disjoint_with] if self.disjoint_with is not None else [] - self.disjoint_with = [v if isinstance(v, SlotDefinitionName) else SlotDefinitionName(v) for v in self.disjoint_with] + self.disjoint_with = [ + v if isinstance(v, SlotDefinitionName) else SlotDefinitionName(v) for v in self.disjoint_with + ] - if self.children_are_mutually_disjoint is not None and not isinstance(self.children_are_mutually_disjoint, Bool): + if self.children_are_mutually_disjoint is not None and not isinstance( + self.children_are_mutually_disjoint, Bool + ): self.children_are_mutually_disjoint = Bool(self.children_are_mutually_disjoint) if not isinstance(self.union_of, list): @@ -2422,7 +2824,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.type_mappings, list): self.type_mappings = [self.type_mappings] if self.type_mappings is not None else [] - self.type_mappings = [v if isinstance(v, TypeMappingFramework) else TypeMappingFramework(v) for v in self.type_mappings] + self.type_mappings = [ + v if isinstance(v, TypeMappingFramework) else TypeMappingFramework(v) for v in self.type_mappings + ] if self.is_a is not None and not isinstance(self.is_a, SlotDefinitionName): self.is_a = SlotDefinitionName(self.is_a) @@ -2508,19 +2912,28 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.none_of, list): self.none_of = [self.none_of] if self.none_of is not None else [] - self.none_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.none_of] + self.none_of = [ + v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.none_of + ] if not isinstance(self.exactly_one_of, list): self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else [] - self.exactly_one_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.exactly_one_of] + self.exactly_one_of = [ + v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) + for v in self.exactly_one_of + ] if not isinstance(self.any_of, list): self.any_of = [self.any_of] if self.any_of is not None else [] - self.any_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.any_of] + self.any_of = [ + v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.any_of + ] if not isinstance(self.all_of, list): self.all_of = [self.all_of] if self.all_of is not None else [] - self.all_of = [v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.all_of] + self.all_of = [ + v if isinstance(v, AnonymousSlotExpression) else AnonymousSlotExpression(**as_dict(v)) for v in self.all_of + ] super().__post_init__(**kwargs) @@ -2530,6 +2943,7 @@ class ClassExpression(YAMLRoot): """ A boolean expression that can be used to dynamically determine membership of a class """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["ClassExpression"] @@ -2537,30 +2951,54 @@ class ClassExpression(YAMLRoot): class_name: ClassVar[str] = "class_expression" class_model_uri: ClassVar[URIRef] = LINKML.ClassExpression - any_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - none_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - all_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - slot_conditions: Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]] = empty_dict() + any_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = ( + empty_list() + ) + exactly_one_of: Optional[ + Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]] + ] = empty_list() + none_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = ( + empty_list() + ) + all_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = ( + empty_list() + ) + slot_conditions: Optional[ + Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]] + ] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.any_of, list): self.any_of = [self.any_of] if self.any_of is not None else [] - self.any_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.any_of] + self.any_of = [ + v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) + for v in self.any_of + ] if not isinstance(self.exactly_one_of, list): self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else [] - self.exactly_one_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.exactly_one_of] + self.exactly_one_of = [ + v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) + for v in self.exactly_one_of + ] if not isinstance(self.none_of, list): self.none_of = [self.none_of] if self.none_of is not None else [] - self.none_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.none_of] + self.none_of = [ + v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) + for v in self.none_of + ] if not isinstance(self.all_of, list): self.all_of = [self.all_of] if self.all_of is not None else [] - self.all_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.all_of] + self.all_of = [ + v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) + for v in self.all_of + ] - self._normalize_inlined_as_dict(slot_name="slot_conditions", slot_type=SlotDefinition, key_name="name", keyed=True) + self._normalize_inlined_as_dict( + slot_name="slot_conditions", slot_type=SlotDefinition, key_name="name", keyed=True + ) super().__post_init__(**kwargs) @@ -2575,11 +3013,21 @@ class AnonymousClassExpression(AnonymousExpression): class_model_uri: ClassVar[URIRef] = LINKML.AnonymousClassExpression is_a: Optional[Union[str, DefinitionName]] = None - any_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - none_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - all_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = empty_list() - slot_conditions: Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]] = empty_dict() + any_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = ( + empty_list() + ) + exactly_one_of: Optional[ + Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]] + ] = empty_list() + none_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = ( + empty_list() + ) + all_of: Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]] = ( + empty_list() + ) + slot_conditions: Optional[ + Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]] + ] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.is_a is not None and not isinstance(self.is_a, DefinitionName): @@ -2587,21 +3035,35 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.any_of, list): self.any_of = [self.any_of] if self.any_of is not None else [] - self.any_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.any_of] + self.any_of = [ + v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) + for v in self.any_of + ] if not isinstance(self.exactly_one_of, list): self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else [] - self.exactly_one_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.exactly_one_of] + self.exactly_one_of = [ + v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) + for v in self.exactly_one_of + ] if not isinstance(self.none_of, list): self.none_of = [self.none_of] if self.none_of is not None else [] - self.none_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.none_of] + self.none_of = [ + v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) + for v in self.none_of + ] if not isinstance(self.all_of, list): self.all_of = [self.all_of] if self.all_of is not None else [] - self.all_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.all_of] + self.all_of = [ + v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) + for v in self.all_of + ] - self._normalize_inlined_as_dict(slot_name="slot_conditions", slot_type=SlotDefinition, key_name="name", keyed=True) + self._normalize_inlined_as_dict( + slot_name="slot_conditions", slot_type=SlotDefinition, key_name="name", keyed=True + ) super().__post_init__(**kwargs) @@ -2611,6 +3073,7 @@ class ClassDefinition(Definition): """ an element whose instances are complex objects that may have slot-value assignments """ + _inherited_slots: ClassVar[list[str]] = ["defining_slots", "represents_relationship"] class_class_uri: ClassVar[URIRef] = LINKML["ClassDefinition"] @@ -2620,28 +3083,48 @@ class ClassDefinition(Definition): name: Union[str, ClassDefinitionName] = None slots: Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]] = empty_list() - slot_usage: Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]] = empty_dict() - attributes: Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]] = empty_dict() + slot_usage: Optional[ + Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]] + ] = empty_dict() + attributes: Optional[ + Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]] + ] = empty_dict() class_uri: Optional[Union[str, URIorCURIE]] = None subclass_of: Optional[Union[str, URIorCURIE]] = None union_of: Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]] = empty_list() defining_slots: Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]] = empty_list() tree_root: Optional[Union[bool, Bool]] = None - unique_keys: Optional[Union[dict[Union[str, UniqueKeyUniqueKeyName], Union[dict, "UniqueKey"]], list[Union[dict, "UniqueKey"]]]] = empty_dict() + unique_keys: Optional[ + Union[dict[Union[str, UniqueKeyUniqueKeyName], Union[dict, "UniqueKey"]], list[Union[dict, "UniqueKey"]]] + ] = empty_dict() rules: Optional[Union[Union[dict, "ClassRule"], list[Union[dict, "ClassRule"]]]] = empty_list() - classification_rules: Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]] = empty_list() + classification_rules: Optional[ + Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]] + ] = empty_list() slot_names_unique: Optional[Union[bool, Bool]] = None represents_relationship: Optional[Union[bool, Bool]] = None - disjoint_with: Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]] = empty_list() + disjoint_with: Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]] = ( + empty_list() + ) children_are_mutually_disjoint: Optional[Union[bool, Bool]] = None is_a: Optional[Union[str, ClassDefinitionName]] = None mixins: Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]] = empty_list() apply_to: Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]] = empty_list() - any_of: Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]] = empty_list() - exactly_one_of: Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]] = empty_list() - none_of: Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]] = empty_list() - all_of: Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]] = empty_list() - slot_conditions: Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]] = empty_dict() + any_of: Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]] = ( + empty_list() + ) + exactly_one_of: Optional[ + Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]] + ] = empty_list() + none_of: Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]] = ( + empty_list() + ) + all_of: Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]] = ( + empty_list() + ) + slot_conditions: Optional[ + Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]] + ] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self._is_empty(self.name): @@ -2669,12 +3152,16 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.defining_slots, list): self.defining_slots = [self.defining_slots] if self.defining_slots is not None else [] - self.defining_slots = [v if isinstance(v, SlotDefinitionName) else SlotDefinitionName(v) for v in self.defining_slots] + self.defining_slots = [ + v if isinstance(v, SlotDefinitionName) else SlotDefinitionName(v) for v in self.defining_slots + ] if self.tree_root is not None and not isinstance(self.tree_root, Bool): self.tree_root = Bool(self.tree_root) - self._normalize_inlined_as_dict(slot_name="unique_keys", slot_type=UniqueKey, key_name="unique_key_name", keyed=True) + self._normalize_inlined_as_dict( + slot_name="unique_keys", slot_type=UniqueKey, key_name="unique_key_name", keyed=True + ) if not isinstance(self.rules, list): self.rules = [self.rules] if self.rules is not None else [] @@ -2682,7 +3169,10 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.classification_rules, list): self.classification_rules = [self.classification_rules] if self.classification_rules is not None else [] - self.classification_rules = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.classification_rules] + self.classification_rules = [ + v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) + for v in self.classification_rules + ] if self.slot_names_unique is not None and not isinstance(self.slot_names_unique, Bool): self.slot_names_unique = Bool(self.slot_names_unique) @@ -2692,9 +3182,13 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.disjoint_with, list): self.disjoint_with = [self.disjoint_with] if self.disjoint_with is not None else [] - self.disjoint_with = [v if isinstance(v, ClassDefinitionName) else ClassDefinitionName(v) for v in self.disjoint_with] + self.disjoint_with = [ + v if isinstance(v, ClassDefinitionName) else ClassDefinitionName(v) for v in self.disjoint_with + ] - if self.children_are_mutually_disjoint is not None and not isinstance(self.children_are_mutually_disjoint, Bool): + if self.children_are_mutually_disjoint is not None and not isinstance( + self.children_are_mutually_disjoint, Bool + ): self.children_are_mutually_disjoint = Bool(self.children_are_mutually_disjoint) if self.is_a is not None and not isinstance(self.is_a, ClassDefinitionName): @@ -2710,21 +3204,35 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.any_of, list): self.any_of = [self.any_of] if self.any_of is not None else [] - self.any_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.any_of] + self.any_of = [ + v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) + for v in self.any_of + ] if not isinstance(self.exactly_one_of, list): self.exactly_one_of = [self.exactly_one_of] if self.exactly_one_of is not None else [] - self.exactly_one_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.exactly_one_of] + self.exactly_one_of = [ + v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) + for v in self.exactly_one_of + ] if not isinstance(self.none_of, list): self.none_of = [self.none_of] if self.none_of is not None else [] - self.none_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.none_of] + self.none_of = [ + v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) + for v in self.none_of + ] if not isinstance(self.all_of, list): self.all_of = [self.all_of] if self.all_of is not None else [] - self.all_of = [v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) for v in self.all_of] + self.all_of = [ + v if isinstance(v, AnonymousClassExpression) else AnonymousClassExpression(**as_dict(v)) + for v in self.all_of + ] - self._normalize_inlined_as_dict(slot_name="slot_conditions", slot_type=SlotDefinition, key_name="name", keyed=True) + self._normalize_inlined_as_dict( + slot_name="slot_conditions", slot_type=SlotDefinition, key_name="name", keyed=True + ) super().__post_init__(**kwargs) @@ -2733,6 +3241,7 @@ class ClassLevelRule(YAMLRoot): """ A rule that is applied to classes """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["ClassLevelRule"] @@ -2746,6 +3255,7 @@ class ClassRule(ClassLevelRule): """ A rule that applies to instances of a class """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["ClassRule"] @@ -2760,10 +3270,18 @@ class ClassRule(ClassLevelRule): open_world: Optional[Union[bool, Bool]] = None rank: Optional[int] = None deactivated: Optional[Union[bool, Bool]] = None - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]] + ] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[ + Union[ + dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]] + ] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -2824,7 +3342,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -2868,17 +3388,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -2939,6 +3467,7 @@ class ArrayExpression(YAMLRoot): """ defines the dimensions of an array """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["ArrayExpression"] @@ -2949,11 +3478,21 @@ class ArrayExpression(YAMLRoot): exact_number_dimensions: Optional[int] = None minimum_number_dimensions: Optional[int] = None maximum_number_dimensions: Optional[Union[dict, Anything]] = None - dimensions: Optional[Union[Union[dict, "DimensionExpression"], list[Union[dict, "DimensionExpression"]]]] = empty_list() - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() + dimensions: Optional[Union[Union[dict, "DimensionExpression"], list[Union[dict, "DimensionExpression"]]]] = ( + empty_list() + ) + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]] + ] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[ + Union[ + dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]] + ] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -2995,7 +3534,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.dimensions, list): self.dimensions = [self.dimensions] if self.dimensions is not None else [] - self.dimensions = [v if isinstance(v, DimensionExpression) else DimensionExpression(**as_dict(v)) for v in self.dimensions] + self.dimensions = [ + v if isinstance(v, DimensionExpression) else DimensionExpression(**as_dict(v)) for v in self.dimensions + ] self._normalize_inlined_as_dict(slot_name="extensions", slot_type=Extension, key_name="tag", keyed=True) @@ -3004,7 +3545,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -3048,17 +3591,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -3122,6 +3673,7 @@ class DimensionExpression(YAMLRoot): """ defines one of the dimensions of an array """ + _inherited_slots: ClassVar[list[str]] = ["maximum_cardinality", "minimum_cardinality", "exact_cardinality"] class_class_uri: ClassVar[URIRef] = LINKML["DimensionExpression"] @@ -3133,10 +3685,18 @@ class DimensionExpression(YAMLRoot): maximum_cardinality: Optional[int] = None minimum_cardinality: Optional[int] = None exact_cardinality: Optional[int] = None - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]] + ] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[ + Union[ + dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]] + ] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -3189,7 +3749,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -3233,17 +3795,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -3307,6 +3877,7 @@ class PatternExpression(YAMLRoot): """ a regular expression pattern used to evaluate conformance of a string """ + _inherited_slots: ClassVar[list[str]] = ["syntax"] class_class_uri: ClassVar[URIRef] = LINKML["PatternExpression"] @@ -3317,10 +3888,18 @@ class PatternExpression(YAMLRoot): syntax: Optional[str] = None interpolated: Optional[Union[bool, Bool]] = None partial_match: Optional[Union[bool, Bool]] = None - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]] + ] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[ + Union[ + dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]] + ] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -3370,7 +3949,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -3414,17 +3995,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -3488,6 +4077,7 @@ class ImportExpression(YAMLRoot): """ an expression describing an import """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["ImportExpression"] @@ -3497,11 +4087,21 @@ class ImportExpression(YAMLRoot): import_from: Union[str, URIorCURIE] = None import_as: Optional[Union[str, NCName]] = None - import_map: Optional[Union[dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], list[Union[dict, "Setting"]]]] = empty_dict() - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() + import_map: Optional[ + Union[dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], list[Union[dict, "Setting"]]] + ] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]] + ] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]] = empty_dict() + alt_descriptions: Optional[ + Union[ + dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]] + ] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -3552,7 +4152,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -3596,17 +4198,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -3670,6 +4280,7 @@ class Setting(YAMLRoot): """ assignment of a key to a value """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Setting"] @@ -3699,6 +4310,7 @@ class Prefix(YAMLRoot): """ prefix URI tuple """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Prefix"] @@ -3728,6 +4340,7 @@ class LocalName(YAMLRoot): """ an attributed label """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["LocalName"] @@ -3757,6 +4370,7 @@ class Example(YAMLRoot): """ usage example and description """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["Example"] @@ -3783,6 +4397,7 @@ class AltDescription(YAMLRoot): """ an attributed description """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["AltDescription"] @@ -3812,6 +4427,7 @@ class PermissibleValue(YAMLRoot): """ a permissible value, accompanied by intended text and an optional mapping to a concept URI """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["PermissibleValue"] @@ -3827,9 +4443,15 @@ class PermissibleValue(YAMLRoot): implements: Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]] = empty_list() is_a: Optional[Union[str, PermissibleValueText]] = None mixins: Optional[Union[Union[str, PermissibleValueText], list[Union[str, PermissibleValueText]]]] = empty_list() - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], list[Union[dict, AltDescription]]]] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]] + ] = empty_dict() + alt_descriptions: Optional[ + Union[dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], list[Union[dict, AltDescription]]] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -3896,7 +4518,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_dict(slot_name="annotations", slot_type=Annotation, key_name="tag", keyed=True) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -3940,17 +4564,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -4014,6 +4646,7 @@ class UniqueKey(YAMLRoot): """ a collection of slots whose values uniquely identify an instance of a class """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["UniqueKey"] @@ -4024,10 +4657,16 @@ class UniqueKey(YAMLRoot): unique_key_name: Union[str, UniqueKeyUniqueKeyName] = None unique_key_slots: Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]] = None consider_nulls_inequal: Optional[Union[bool, Bool]] = None - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]] + ] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], list[Union[dict, AltDescription]]]] = empty_dict() + alt_descriptions: Optional[ + Union[dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], list[Union[dict, AltDescription]]] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -4070,7 +4709,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.MissingRequiredField("unique_key_slots") if not isinstance(self.unique_key_slots, list): self.unique_key_slots = [self.unique_key_slots] if self.unique_key_slots is not None else [] - self.unique_key_slots = [v if isinstance(v, SlotDefinitionName) else SlotDefinitionName(v) for v in self.unique_key_slots] + self.unique_key_slots = [ + v if isinstance(v, SlotDefinitionName) else SlotDefinitionName(v) for v in self.unique_key_slots + ] if self.consider_nulls_inequal is not None and not isinstance(self.consider_nulls_inequal, Bool): self.consider_nulls_inequal = Bool(self.consider_nulls_inequal) @@ -4082,7 +4723,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -4126,17 +4769,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -4200,6 +4851,7 @@ class TypeMapping(YAMLRoot): """ Represents how a slot or type can be serialized to a format. """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML["TypeMapping"] @@ -4210,10 +4862,16 @@ class TypeMapping(YAMLRoot): framework: Union[str, TypeMappingFramework] = None type: Optional[Union[str, TypeDefinitionName]] = None string_serialization: Optional[str] = None - extensions: Optional[Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]]] = empty_dict() - annotations: Optional[Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]]] = empty_dict() + extensions: Optional[ + Union[dict[Union[str, ExtensionTag], Union[dict, Extension]], list[Union[dict, Extension]]] + ] = empty_dict() + annotations: Optional[ + Union[dict[Union[str, AnnotationTag], Union[dict, Annotation]], list[Union[dict, Annotation]]] + ] = empty_dict() description: Optional[str] = None - alt_descriptions: Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], list[Union[dict, AltDescription]]]] = empty_dict() + alt_descriptions: Optional[ + Union[dict[Union[str, AltDescriptionSource], Union[dict, AltDescription]], list[Union[dict, AltDescription]]] + ] = empty_dict() title: Optional[str] = None deprecated: Optional[str] = None todos: Optional[Union[str, list[str]]] = empty_list() @@ -4265,7 +4923,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True) + self._normalize_inlined_as_dict( + slot_name="alt_descriptions", slot_type=AltDescription, key_name="source", keyed=True + ) if self.title is not None and not isinstance(self.title, str): self.title = str(self.title) @@ -4309,17 +4969,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] if self.see_also is not None else [] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] self.aliases = [v if isinstance(v, str) else str(v) for v in self.aliases] - self._normalize_inlined_as_dict(slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False) + self._normalize_inlined_as_dict( + slot_name="structured_aliases", slot_type=StructuredAlias, key_name="literal_form", keyed=False + ) if not isinstance(self.mappings, list): self.mappings = [self.mappings] if self.mappings is not None else [] @@ -4383,31 +5051,31 @@ class PvFormulaOptions(EnumDefinitionImpl): """ The formula used to generate the set of permissible values from the code_set values """ + CODE = PermissibleValue( - text="CODE", - description="The permissible values are the set of possible codes in the code set") - CURIE = PermissibleValue( - text="CURIE", - description="The permissible values are the set of CURIES in the code set") - URI = PermissibleValue( - text="URI", - description="The permissible values are the set of code URIs in the code set") + text="CODE", description="The permissible values are the set of possible codes in the code set" + ) + CURIE = PermissibleValue(text="CURIE", description="The permissible values are the set of CURIES in the code set") + URI = PermissibleValue(text="URI", description="The permissible values are the set of code URIs in the code set") FHIR_CODING = PermissibleValue( text="FHIR_CODING", - description="The permissible values are the set of FHIR coding elements derived from the code set") + description="The permissible values are the set of FHIR coding elements derived from the code set", + ) LABEL = PermissibleValue( - text="LABEL", - description="The permissible values are the set of human readable labels in the code set") + text="LABEL", description="The permissible values are the set of human readable labels in the code set" + ) _defn = EnumDefinition( name="PvFormulaOptions", description="The formula used to generate the set of permissible values from the code_set values", ) + class PresenceEnum(EnumDefinitionImpl): """ enumeration of conditions by which a slot value should be set """ + UNCOMMITTED = PermissibleValue(text="UNCOMMITTED") PRESENT = PermissibleValue(text="PRESENT") ABSENT = PermissibleValue(text="ABSENT") @@ -4417,825 +5085,2345 @@ class PresenceEnum(EnumDefinitionImpl): description="enumeration of conditions by which a slot value should be set", ) + class RelationalRoleEnum(EnumDefinitionImpl): """ enumeration of roles a slot on a relationship class can play """ + SUBJECT = PermissibleValue( text="SUBJECT", description="a slot with this role connects a relationship to its subject/source node", - meaning=RDF["subject"]) + meaning=RDF["subject"], + ) OBJECT = PermissibleValue( text="OBJECT", description="a slot with this role connects a relationship to its object/target node", - meaning=RDF["object"]) + meaning=RDF["object"], + ) PREDICATE = PermissibleValue( text="PREDICATE", description="a slot with this role connects a relationship to its predicate/property", - meaning=RDF["predicate"]) + meaning=RDF["predicate"], + ) NODE = PermissibleValue( text="NODE", - description="""a slot with this role connects a symmetric relationship to a node that represents either subject or object node""") + description="""a slot with this role connects a symmetric relationship to a node that represents either subject or object node""", + ) OTHER_ROLE = PermissibleValue( text="OTHER_ROLE", - description="a slot with this role connects a relationship to a node that is not subject/object/predicate") + description="a slot with this role connects a relationship to a node that is not subject/object/predicate", + ) _defn = EnumDefinition( name="RelationalRoleEnum", description="enumeration of roles a slot on a relationship class can play", ) + class AliasPredicateEnum(EnumDefinitionImpl): """ permissible values for the relationship between an element and an alias """ - EXACT_SYNONYM = PermissibleValue( - text="EXACT_SYNONYM", - meaning=SKOS["exactMatch"]) - RELATED_SYNONYM = PermissibleValue( - text="RELATED_SYNONYM", - meaning=SKOS["relatedMatch"]) - BROAD_SYNONYM = PermissibleValue( - text="BROAD_SYNONYM", - meaning=SKOS["broaderMatch"]) - NARROW_SYNONYM = PermissibleValue( - text="NARROW_SYNONYM", - meaning=SKOS["narrowerMatch"]) + + EXACT_SYNONYM = PermissibleValue(text="EXACT_SYNONYM", meaning=SKOS["exactMatch"]) + RELATED_SYNONYM = PermissibleValue(text="RELATED_SYNONYM", meaning=SKOS["relatedMatch"]) + BROAD_SYNONYM = PermissibleValue(text="BROAD_SYNONYM", meaning=SKOS["broaderMatch"]) + NARROW_SYNONYM = PermissibleValue(text="NARROW_SYNONYM", meaning=SKOS["narrowerMatch"]) _defn = EnumDefinition( name="AliasPredicateEnum", description="permissible values for the relationship between an element and an alias", ) + class ObligationLevelEnum(EnumDefinitionImpl): """ The level of obligation or recommendation strength for a metadata element """ + REQUIRED = PermissibleValue( - text="REQUIRED", - description="The metadata element is required to be present in the model") + text="REQUIRED", description="The metadata element is required to be present in the model" + ) RECOMMENDED = PermissibleValue( - text="RECOMMENDED", - description="The metadata element is recommended to be present in the model") + text="RECOMMENDED", description="The metadata element is recommended to be present in the model" + ) OPTIONAL = PermissibleValue( - text="OPTIONAL", - description="The metadata element is optional to be present in the model") - EXAMPLE = PermissibleValue( - text="EXAMPLE", - description="The metadata element is an example of how to use the model") + text="OPTIONAL", description="The metadata element is optional to be present in the model" + ) + EXAMPLE = PermissibleValue(text="EXAMPLE", description="The metadata element is an example of how to use the model") DISCOURAGED = PermissibleValue( - text="DISCOURAGED", - description="The metadata element is allowed but discouraged to be present in the model") + text="DISCOURAGED", description="The metadata element is allowed but discouraged to be present in the model" + ) _defn = EnumDefinition( name="ObligationLevelEnum", description="The level of obligation or recommendation strength for a metadata element", ) + # Slots class slots: pass -slots.name = Slot(uri=RDFS.label, name="name", curie=RDFS.curie('label'), - model_uri=LINKML.name, domain=Element, range=Union[str, ElementName]) - -slots.title = Slot(uri=DCTERMS.title, name="title", curie=DCTERMS.curie('title'), - model_uri=LINKML.title, domain=Element, range=Optional[str]) - -slots.conforms_to = Slot(uri=DCTERMS.conformsTo, name="conforms_to", curie=DCTERMS.curie('conformsTo'), - model_uri=LINKML.conforms_to, domain=Element, range=Optional[str]) - -slots.implements = Slot(uri=LINKML.implements, name="implements", curie=LINKML.curie('implements'), - model_uri=LINKML.implements, domain=Element, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.instantiates = Slot(uri=LINKML.instantiates, name="instantiates", curie=LINKML.curie('instantiates'), - model_uri=LINKML.instantiates, domain=Element, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.categories = Slot(uri=DCTERMS.subject, name="categories", curie=DCTERMS.curie('subject'), - model_uri=LINKML.categories, domain=None, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.keywords = Slot(uri=SCHEMA.keywords, name="keywords", curie=SCHEMA.curie('keywords'), - model_uri=LINKML.keywords, domain=Element, range=Optional[Union[str, list[str]]]) - -slots.definition_uri = Slot(uri=LINKML.definition_uri, name="definition_uri", curie=LINKML.curie('definition_uri'), - model_uri=LINKML.definition_uri, domain=Element, range=Optional[Union[str, URIorCURIE]]) - -slots.id_prefixes = Slot(uri=LINKML.id_prefixes, name="id_prefixes", curie=LINKML.curie('id_prefixes'), - model_uri=LINKML.id_prefixes, domain=Element, range=Optional[Union[Union[str, NCName], list[Union[str, NCName]]]]) - -slots.id_prefixes_are_closed = Slot(uri=LINKML.id_prefixes_are_closed, name="id_prefixes_are_closed", curie=LINKML.curie('id_prefixes_are_closed'), - model_uri=LINKML.id_prefixes_are_closed, domain=Element, range=Optional[Union[bool, Bool]]) - -slots.description = Slot(uri=SKOS.definition, name="description", curie=SKOS.curie('definition'), - model_uri=LINKML.description, domain=Element, range=Optional[str]) - -slots.structured_aliases = Slot(uri=SKOSXL.altLabel, name="structured_aliases", curie=SKOSXL.curie('altLabel'), - model_uri=LINKML.structured_aliases, domain=None, range=Optional[Union[Union[dict, StructuredAlias], list[Union[dict, StructuredAlias]]]]) - -slots.aliases = Slot(uri=SKOS.altLabel, name="aliases", curie=SKOS.curie('altLabel'), - model_uri=LINKML.aliases, domain=Element, range=Optional[Union[str, list[str]]]) - -slots.deprecated = Slot(uri=LINKML.deprecated, name="deprecated", curie=LINKML.curie('deprecated'), - model_uri=LINKML.deprecated, domain=Element, range=Optional[str]) - -slots.todos = Slot(uri=LINKML.todos, name="todos", curie=LINKML.curie('todos'), - model_uri=LINKML.todos, domain=Element, range=Optional[Union[str, list[str]]]) - -slots.notes = Slot(uri=SKOS.editorialNote, name="notes", curie=SKOS.curie('editorialNote'), - model_uri=LINKML.notes, domain=Element, range=Optional[Union[str, list[str]]]) - -slots.comments = Slot(uri=SKOS.note, name="comments", curie=SKOS.curie('note'), - model_uri=LINKML.comments, domain=Element, range=Optional[Union[str, list[str]]]) - -slots.in_subset = Slot(uri=OIO.inSubset, name="in_subset", curie=OIO.curie('inSubset'), - model_uri=LINKML.in_subset, domain=Element, range=Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]]) - -slots.from_schema = Slot(uri=SKOS.inScheme, name="from_schema", curie=SKOS.curie('inScheme'), - model_uri=LINKML.from_schema, domain=Element, range=Optional[Union[str, URI]]) - -slots.imported_from = Slot(uri=LINKML.imported_from, name="imported_from", curie=LINKML.curie('imported_from'), - model_uri=LINKML.imported_from, domain=Element, range=Optional[str]) - -slots.see_also = Slot(uri=RDFS.seeAlso, name="see_also", curie=RDFS.curie('seeAlso'), - model_uri=LINKML.see_also, domain=Element, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.owned_by = Slot(uri=LINKML.owned_by, name="owned_by", curie=LINKML.curie('owned_by'), - model_uri=LINKML.owned_by, domain=Element, range=Optional[Union[str, URIorCURIE]]) - -slots.created_by = Slot(uri=PAV.createdBy, name="created_by", curie=PAV.curie('createdBy'), - model_uri=LINKML.created_by, domain=Element, range=Optional[Union[str, URIorCURIE]]) - -slots.contributors = Slot(uri=DCTERMS.contributor, name="contributors", curie=DCTERMS.curie('contributor'), - model_uri=LINKML.contributors, domain=Element, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.created_on = Slot(uri=PAV.createdOn, name="created_on", curie=PAV.curie('createdOn'), - model_uri=LINKML.created_on, domain=Element, range=Optional[Union[str, XSDDateTime]]) - -slots.last_updated_on = Slot(uri=PAV.lastUpdatedOn, name="last_updated_on", curie=PAV.curie('lastUpdatedOn'), - model_uri=LINKML.last_updated_on, domain=Element, range=Optional[Union[str, XSDDateTime]]) - -slots.modified_by = Slot(uri=OSLC.modifiedBy, name="modified_by", curie=OSLC.curie('modifiedBy'), - model_uri=LINKML.modified_by, domain=Element, range=Optional[Union[str, URIorCURIE]]) - -slots.status = Slot(uri=BIBO.status, name="status", curie=BIBO.curie('status'), - model_uri=LINKML.status, domain=Element, range=Optional[Union[str, URIorCURIE]]) - -slots.literal_form = Slot(uri=SKOSXL.literalForm, name="literal_form", curie=SKOSXL.curie('literalForm'), - model_uri=LINKML.literal_form, domain=StructuredAlias, range=str) - -slots.alias_predicate = Slot(uri=RDF.predicate, name="alias_predicate", curie=RDF.curie('predicate'), - model_uri=LINKML.alias_predicate, domain=StructuredAlias, range=Optional[Union[str, "AliasPredicateEnum"]]) - -slots.alias_contexts = Slot(uri=LINKML.contexts, name="alias_contexts", curie=LINKML.curie('contexts'), - model_uri=LINKML.alias_contexts, domain=StructuredAlias, range=Optional[Union[Union[str, URI], list[Union[str, URI]]]]) - -slots.in_language = Slot(uri=SCHEMA.inLanguage, name="in_language", curie=SCHEMA.curie('inLanguage'), - model_uri=LINKML.in_language, domain=None, range=Optional[str]) - -slots.source = Slot(uri=DCTERMS.source, name="source", curie=DCTERMS.curie('source'), - model_uri=LINKML.source, domain=Element, range=Optional[Union[str, URIorCURIE]]) - -slots.publisher = Slot(uri=DCTERMS.publisher, name="publisher", curie=DCTERMS.curie('publisher'), - model_uri=LINKML.publisher, domain=Element, range=Optional[Union[str, URIorCURIE]]) - -slots.is_a = Slot(uri=LINKML.is_a, name="is_a", curie=LINKML.curie('is_a'), - model_uri=LINKML.is_a, domain=None, range=Optional[Union[str, DefinitionName]]) - -slots.abstract = Slot(uri=LINKML.abstract, name="abstract", curie=LINKML.curie('abstract'), - model_uri=LINKML.abstract, domain=Definition, range=Optional[Union[bool, Bool]]) - -slots.mixin = Slot(uri=LINKML.mixin, name="mixin", curie=LINKML.curie('mixin'), - model_uri=LINKML.mixin, domain=Definition, range=Optional[Union[bool, Bool]]) - -slots.mixins = Slot(uri=LINKML.mixins, name="mixins", curie=LINKML.curie('mixins'), - model_uri=LINKML.mixins, domain=None, range=Optional[Union[Union[str, DefinitionName], list[Union[str, DefinitionName]]]]) - -slots.apply_to = Slot(uri=LINKML.apply_to, name="apply_to", curie=LINKML.curie('apply_to'), - model_uri=LINKML.apply_to, domain=Definition, range=Optional[Union[Union[str, DefinitionName], list[Union[str, DefinitionName]]]]) - -slots.values_from = Slot(uri=LINKML.values_from, name="values_from", curie=LINKML.curie('values_from'), - model_uri=LINKML.values_from, domain=Definition, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.code_set = Slot(uri=LINKML.code_set, name="code_set", curie=LINKML.curie('code_set'), - model_uri=LINKML.code_set, domain=EnumExpression, range=Optional[Union[str, URIorCURIE]]) - -slots.code_set_version = Slot(uri=LINKML.code_set_version, name="code_set_version", curie=LINKML.curie('code_set_version'), - model_uri=LINKML.code_set_version, domain=EnumExpression, range=Optional[str]) - -slots.code_set_tag = Slot(uri=LINKML.code_set_tag, name="code_set_tag", curie=LINKML.curie('code_set_tag'), - model_uri=LINKML.code_set_tag, domain=EnumExpression, range=Optional[str]) - -slots.pv_formula = Slot(uri=LINKML.pv_formula, name="pv_formula", curie=LINKML.curie('pv_formula'), - model_uri=LINKML.pv_formula, domain=None, range=Optional[Union[str, "PvFormulaOptions"]]) - -slots.permissible_values = Slot(uri=LINKML.permissible_values, name="permissible_values", curie=LINKML.curie('permissible_values'), - model_uri=LINKML.permissible_values, domain=EnumExpression, range=Optional[Union[dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], list[Union[dict, "PermissibleValue"]]]]) - -slots.enum_uri = Slot(uri=LINKML.enum_uri, name="enum_uri", curie=LINKML.curie('enum_uri'), - model_uri=LINKML.enum_uri, domain=EnumDefinition, range=Optional[Union[str, URIorCURIE]]) - -slots.include = Slot(uri=LINKML.include, name="include", curie=LINKML.curie('include'), - model_uri=LINKML.include, domain=EnumExpression, range=Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]]) - -slots.minus = Slot(uri=LINKML.minus, name="minus", curie=LINKML.curie('minus'), - model_uri=LINKML.minus, domain=EnumExpression, range=Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]]) - -slots.inherits = Slot(uri=LINKML.inherits, name="inherits", curie=LINKML.curie('inherits'), - model_uri=LINKML.inherits, domain=EnumExpression, range=Optional[Union[Union[str, EnumDefinitionName], list[Union[str, EnumDefinitionName]]]]) - -slots.matches = Slot(uri=LINKML.matches, name="matches", curie=LINKML.curie('matches'), - model_uri=LINKML.matches, domain=EnumExpression, range=Optional[Union[dict, "MatchQuery"]]) - -slots.identifier_pattern = Slot(uri=LINKML.identifier_pattern, name="identifier_pattern", curie=LINKML.curie('identifier_pattern'), - model_uri=LINKML.identifier_pattern, domain=MatchQuery, range=Optional[str]) - -slots.concepts = Slot(uri=LINKML.concepts, name="concepts", curie=LINKML.curie('concepts'), - model_uri=LINKML.concepts, domain=EnumExpression, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.reachable_from = Slot(uri=LINKML.reachable_from, name="reachable_from", curie=LINKML.curie('reachable_from'), - model_uri=LINKML.reachable_from, domain=EnumExpression, range=Optional[Union[dict, "ReachabilityQuery"]]) - -slots.source_ontology = Slot(uri=LINKML.source_ontology, name="source_ontology", curie=LINKML.curie('source_ontology'), - model_uri=LINKML.source_ontology, domain=None, range=Optional[Union[str, URIorCURIE]]) - -slots.is_direct = Slot(uri=LINKML.is_direct, name="is_direct", curie=LINKML.curie('is_direct'), - model_uri=LINKML.is_direct, domain=ReachabilityQuery, range=Optional[Union[bool, Bool]]) - -slots.traverse_up = Slot(uri=LINKML.traverse_up, name="traverse_up", curie=LINKML.curie('traverse_up'), - model_uri=LINKML.traverse_up, domain=ReachabilityQuery, range=Optional[Union[bool, Bool]]) - -slots.include_self = Slot(uri=LINKML.include_self, name="include_self", curie=LINKML.curie('include_self'), - model_uri=LINKML.include_self, domain=ReachabilityQuery, range=Optional[Union[bool, Bool]]) - -slots.relationship_types = Slot(uri=LINKML.relationship_types, name="relationship_types", curie=LINKML.curie('relationship_types'), - model_uri=LINKML.relationship_types, domain=ReachabilityQuery, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.source_nodes = Slot(uri=LINKML.source_nodes, name="source_nodes", curie=LINKML.curie('source_nodes'), - model_uri=LINKML.source_nodes, domain=ReachabilityQuery, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.text = Slot(uri=LINKML.text, name="text", curie=LINKML.curie('text'), - model_uri=LINKML.text, domain=PermissibleValue, range=Union[str, PermissibleValueText]) - -slots.meaning = Slot(uri=LINKML.meaning, name="meaning", curie=LINKML.curie('meaning'), - model_uri=LINKML.meaning, domain=PermissibleValue, range=Optional[Union[str, URIorCURIE]]) - -slots.id = Slot(uri=LINKML.id, name="id", curie=LINKML.curie('id'), - model_uri=LINKML.id, domain=SchemaDefinition, range=Union[str, URI]) - -slots.emit_prefixes = Slot(uri=LINKML.emit_prefixes, name="emit_prefixes", curie=LINKML.curie('emit_prefixes'), - model_uri=LINKML.emit_prefixes, domain=SchemaDefinition, range=Optional[Union[Union[str, NCName], list[Union[str, NCName]]]]) - -slots.version = Slot(uri=PAV.version, name="version", curie=PAV.curie('version'), - model_uri=LINKML.version, domain=SchemaDefinition, range=Optional[str]) - -slots.imports = Slot(uri=LINKML.imports, name="imports", curie=LINKML.curie('imports'), - model_uri=LINKML.imports, domain=SchemaDefinition, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.structured_imports = Slot(uri=LINKML.structured_imports, name="structured_imports", curie=LINKML.curie('structured_imports'), - model_uri=LINKML.structured_imports, domain=SchemaDefinition, range=Optional[Union[Union[dict, "ImportExpression"], list[Union[dict, "ImportExpression"]]]]) - -slots.license = Slot(uri=DCTERMS.license, name="license", curie=DCTERMS.curie('license'), - model_uri=LINKML.license, domain=SchemaDefinition, range=Optional[str]) - -slots.default_curi_maps = Slot(uri=LINKML.default_curi_maps, name="default_curi_maps", curie=LINKML.curie('default_curi_maps'), - model_uri=LINKML.default_curi_maps, domain=SchemaDefinition, range=Optional[Union[str, list[str]]]) - -slots.default_prefix = Slot(uri=LINKML.default_prefix, name="default_prefix", curie=LINKML.curie('default_prefix'), - model_uri=LINKML.default_prefix, domain=SchemaDefinition, range=Optional[str]) - -slots.default_range = Slot(uri=LINKML.default_range, name="default_range", curie=LINKML.curie('default_range'), - model_uri=LINKML.default_range, domain=SchemaDefinition, range=Optional[Union[str, TypeDefinitionName]]) - -slots.subsets = Slot(uri=LINKML.subsets, name="subsets", curie=LINKML.curie('subsets'), - model_uri=LINKML.subsets, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, SubsetDefinitionName], Union[dict, "SubsetDefinition"]], list[Union[dict, "SubsetDefinition"]]]]) - -slots.types = Slot(uri=LINKML.types, name="types", curie=LINKML.curie('types'), - model_uri=LINKML.types, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, TypeDefinitionName], Union[dict, "TypeDefinition"]], list[Union[dict, "TypeDefinition"]]]]) - -slots.enums = Slot(uri=LINKML.enums, name="enums", curie=LINKML.curie('enums'), - model_uri=LINKML.enums, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, EnumDefinitionName], Union[dict, "EnumDefinition"]], list[Union[dict, "EnumDefinition"]]]]) - -slots.slot_definitions = Slot(uri=LINKML.slots, name="slot_definitions", curie=LINKML.curie('slots'), - model_uri=LINKML.slot_definitions, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, "SlotDefinition"]], list[Union[dict, "SlotDefinition"]]]]) - -slots.classes = Slot(uri=LINKML.classes, name="classes", curie=LINKML.curie('classes'), - model_uri=LINKML.classes, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, ClassDefinitionName], Union[dict, "ClassDefinition"]], list[Union[dict, "ClassDefinition"]]]]) - -slots.metamodel_version = Slot(uri=LINKML.metamodel_version, name="metamodel_version", curie=LINKML.curie('metamodel_version'), - model_uri=LINKML.metamodel_version, domain=SchemaDefinition, range=Optional[str]) - -slots.source_file = Slot(uri=LINKML.source_file, name="source_file", curie=LINKML.curie('source_file'), - model_uri=LINKML.source_file, domain=SchemaDefinition, range=Optional[str]) - -slots.source_file_date = Slot(uri=LINKML.source_file_date, name="source_file_date", curie=LINKML.curie('source_file_date'), - model_uri=LINKML.source_file_date, domain=SchemaDefinition, range=Optional[Union[str, XSDDateTime]]) - -slots.source_file_size = Slot(uri=LINKML.source_file_size, name="source_file_size", curie=LINKML.curie('source_file_size'), - model_uri=LINKML.source_file_size, domain=SchemaDefinition, range=Optional[int]) - -slots.generation_date = Slot(uri=LINKML.generation_date, name="generation_date", curie=LINKML.curie('generation_date'), - model_uri=LINKML.generation_date, domain=SchemaDefinition, range=Optional[Union[str, XSDDateTime]]) - -slots.slots = Slot(uri=LINKML.slots, name="slots", curie=LINKML.curie('slots'), - model_uri=LINKML.slots, domain=ClassDefinition, range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]]) - -slots.slot_usage = Slot(uri=LINKML.slot_usage, name="slot_usage", curie=LINKML.curie('slot_usage'), - model_uri=LINKML.slot_usage, domain=ClassDefinition, range=Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]]) - -slots.enum_range = Slot(uri=LINKML.enum_range, name="enum_range", curie=LINKML.curie('enum_range'), - model_uri=LINKML.enum_range, domain=None, range=Optional[Union[dict, EnumExpression]]) - -slots.range_expression = Slot(uri=LINKML.range_expression, name="range_expression", curie=LINKML.curie('range_expression'), - model_uri=LINKML.range_expression, domain=None, range=Optional[Union[dict, "AnonymousClassExpression"]]) - -slots.boolean_slot = Slot(uri=LINKML.boolean_slot, name="boolean_slot", curie=LINKML.curie('boolean_slot'), - model_uri=LINKML.boolean_slot, domain=None, range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]]) - -slots.any_of = Slot(uri=LINKML.any_of, name="any_of", curie=LINKML.curie('any_of'), - model_uri=LINKML.any_of, domain=None, range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]]) - -slots.exactly_one_of = Slot(uri=LINKML.exactly_one_of, name="exactly_one_of", curie=LINKML.curie('exactly_one_of'), - model_uri=LINKML.exactly_one_of, domain=None, range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]]) - -slots.none_of = Slot(uri=LINKML.none_of, name="none_of", curie=LINKML.curie('none_of'), - model_uri=LINKML.none_of, domain=None, range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]]) - -slots.all_of = Slot(uri=LINKML.all_of, name="all_of", curie=LINKML.curie('all_of'), - model_uri=LINKML.all_of, domain=None, range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]]) - -slots.preconditions = Slot(uri=SH.condition, name="preconditions", curie=SH.curie('condition'), - model_uri=LINKML.preconditions, domain=None, range=Optional[Union[dict, AnonymousClassExpression]]) - -slots.postconditions = Slot(uri=LINKML.postconditions, name="postconditions", curie=LINKML.curie('postconditions'), - model_uri=LINKML.postconditions, domain=None, range=Optional[Union[dict, AnonymousClassExpression]]) - -slots.elseconditions = Slot(uri=LINKML.elseconditions, name="elseconditions", curie=LINKML.curie('elseconditions'), - model_uri=LINKML.elseconditions, domain=None, range=Optional[Union[dict, AnonymousClassExpression]]) - -slots.bidirectional = Slot(uri=LINKML.bidirectional, name="bidirectional", curie=LINKML.curie('bidirectional'), - model_uri=LINKML.bidirectional, domain=None, range=Optional[Union[bool, Bool]]) - -slots.open_world = Slot(uri=LINKML.open_world, name="open_world", curie=LINKML.curie('open_world'), - model_uri=LINKML.open_world, domain=None, range=Optional[Union[bool, Bool]]) - -slots.rank = Slot(uri=SH.order, name="rank", curie=SH.curie('order'), - model_uri=LINKML.rank, domain=None, range=Optional[int]) - -slots.deactivated = Slot(uri=SH.deactivated, name="deactivated", curie=SH.curie('deactivated'), - model_uri=LINKML.deactivated, domain=None, range=Optional[Union[bool, Bool]]) - -slots.rules = Slot(uri=SH.rule, name="rules", curie=SH.curie('rule'), - model_uri=LINKML.rules, domain=ClassDefinition, range=Optional[Union[Union[dict, "ClassRule"], list[Union[dict, "ClassRule"]]]]) - -slots.classification_rules = Slot(uri=LINKML.classification_rules, name="classification_rules", curie=LINKML.curie('classification_rules'), - model_uri=LINKML.classification_rules, domain=ClassDefinition, range=Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]]) - -slots.slot_conditions = Slot(uri=LINKML.slot_conditions, name="slot_conditions", curie=LINKML.curie('slot_conditions'), - model_uri=LINKML.slot_conditions, domain=None, range=Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]]) - -slots.attributes = Slot(uri=LINKML.attributes, name="attributes", curie=LINKML.curie('attributes'), - model_uri=LINKML.attributes, domain=ClassDefinition, range=Optional[Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]]]) - -slots.class_uri = Slot(uri=LINKML.class_uri, name="class_uri", curie=LINKML.curie('class_uri'), - model_uri=LINKML.class_uri, domain=ClassDefinition, range=Optional[Union[str, URIorCURIE]]) - -slots.subclass_of = Slot(uri=LINKML.subclass_of, name="subclass_of", curie=LINKML.curie('subclass_of'), - model_uri=LINKML.subclass_of, domain=ClassDefinition, range=Optional[Union[str, URIorCURIE]]) - -slots.defining_slots = Slot(uri=LINKML.defining_slots, name="defining_slots", curie=LINKML.curie('defining_slots'), - model_uri=LINKML.defining_slots, domain=ClassDefinition, range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]]) - -slots.union_of = Slot(uri=LINKML.union_of, name="union_of", curie=LINKML.curie('union_of'), - model_uri=LINKML.union_of, domain=Element, range=Optional[Union[Union[str, ElementName], list[Union[str, ElementName]]]]) - -slots.tree_root = Slot(uri=LINKML.tree_root, name="tree_root", curie=LINKML.curie('tree_root'), - model_uri=LINKML.tree_root, domain=ClassDefinition, range=Optional[Union[bool, Bool]]) - -slots.unique_keys = Slot(uri=LINKML.unique_keys, name="unique_keys", curie=LINKML.curie('unique_keys'), - model_uri=LINKML.unique_keys, domain=ClassDefinition, range=Optional[Union[dict[Union[str, UniqueKeyUniqueKeyName], Union[dict, "UniqueKey"]], list[Union[dict, "UniqueKey"]]]]) - -slots.unique_key_name = Slot(uri=LINKML.unique_key_name, name="unique_key_name", curie=LINKML.curie('unique_key_name'), - model_uri=LINKML.unique_key_name, domain=UniqueKey, range=Union[str, UniqueKeyUniqueKeyName]) - -slots.consider_nulls_inequal = Slot(uri=LINKML.consider_nulls_inequal, name="consider_nulls_inequal", curie=LINKML.curie('consider_nulls_inequal'), - model_uri=LINKML.consider_nulls_inequal, domain=UniqueKey, range=Optional[Union[bool, Bool]]) - -slots.unique_key_slots = Slot(uri=LINKML.unique_key_slots, name="unique_key_slots", curie=LINKML.curie('unique_key_slots'), - model_uri=LINKML.unique_key_slots, domain=UniqueKey, range=Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]) - -slots.slot_names_unique = Slot(uri=LINKML.slot_names_unique, name="slot_names_unique", curie=LINKML.curie('slot_names_unique'), - model_uri=LINKML.slot_names_unique, domain=Definition, range=Optional[Union[bool, Bool]]) - -slots.domain = Slot(uri=LINKML.domain, name="domain", curie=LINKML.curie('domain'), - model_uri=LINKML.domain, domain=SlotDefinition, range=Optional[Union[str, ClassDefinitionName]]) - -slots.range = Slot(uri=LINKML.range, name="range", curie=LINKML.curie('range'), - model_uri=LINKML.range, domain=SlotDefinition, range=Optional[Union[str, ElementName]]) - -slots.slot_uri = Slot(uri=LINKML.slot_uri, name="slot_uri", curie=LINKML.curie('slot_uri'), - model_uri=LINKML.slot_uri, domain=SlotDefinition, range=Optional[Union[str, URIorCURIE]]) - -slots.multivalued = Slot(uri=LINKML.multivalued, name="multivalued", curie=LINKML.curie('multivalued'), - model_uri=LINKML.multivalued, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.array = Slot(uri=LINKML.array, name="array", curie=LINKML.curie('array'), - model_uri=LINKML.array, domain=SlotDefinition, range=Optional[Union[dict, "ArrayExpression"]]) - -slots.dimensions = Slot(uri=LINKML.dimensions, name="dimensions", curie=LINKML.curie('dimensions'), - model_uri=LINKML.dimensions, domain=ArrayExpression, range=Optional[Union[Union[dict, "DimensionExpression"], list[Union[dict, "DimensionExpression"]]]]) - -slots.minimum_number_dimensions = Slot(uri=LINKML.minimum_number_dimensions, name="minimum_number_dimensions", curie=LINKML.curie('minimum_number_dimensions'), - model_uri=LINKML.minimum_number_dimensions, domain=ArrayExpression, range=Optional[int]) - -slots.maximum_number_dimensions = Slot(uri=LINKML.maximum_number_dimensions, name="maximum_number_dimensions", curie=LINKML.curie('maximum_number_dimensions'), - model_uri=LINKML.maximum_number_dimensions, domain=ArrayExpression, range=Optional[Union[dict, Anything]]) - -slots.exact_number_dimensions = Slot(uri=LINKML.exact_number_dimensions, name="exact_number_dimensions", curie=LINKML.curie('exact_number_dimensions'), - model_uri=LINKML.exact_number_dimensions, domain=ArrayExpression, range=Optional[int]) - -slots.inherited = Slot(uri=LINKML.inherited, name="inherited", curie=LINKML.curie('inherited'), - model_uri=LINKML.inherited, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.readonly = Slot(uri=LINKML.readonly, name="readonly", curie=LINKML.curie('readonly'), - model_uri=LINKML.readonly, domain=SlotDefinition, range=Optional[str]) - -slots.ifabsent = Slot(uri=LINKML.ifabsent, name="ifabsent", curie=LINKML.curie('ifabsent'), - model_uri=LINKML.ifabsent, domain=SlotDefinition, range=Optional[str]) - -slots.implicit_prefix = Slot(uri=LINKML.implicit_prefix, name="implicit_prefix", curie=LINKML.curie('implicit_prefix'), - model_uri=LINKML.implicit_prefix, domain=None, range=Optional[str]) - -slots.value_specification_constant = Slot(uri=LINKML.value_specification_constant, name="value_specification_constant", curie=LINKML.curie('value_specification_constant'), - model_uri=LINKML.value_specification_constant, domain=None, range=Optional[str]) - -slots.list_value_specification_constant = Slot(uri=LINKML.list_value_specification_constant, name="list_value_specification_constant", curie=LINKML.curie('list_value_specification_constant'), - model_uri=LINKML.list_value_specification_constant, domain=None, range=Optional[str]) - -slots.value_presence = Slot(uri=LINKML.value_presence, name="value_presence", curie=LINKML.curie('value_presence'), - model_uri=LINKML.value_presence, domain=SlotDefinition, range=Optional[Union[str, "PresenceEnum"]]) - -slots.equals_string = Slot(uri=LINKML.equals_string, name="equals_string", curie=LINKML.curie('equals_string'), - model_uri=LINKML.equals_string, domain=None, range=Optional[str]) - -slots.equals_number = Slot(uri=LINKML.equals_number, name="equals_number", curie=LINKML.curie('equals_number'), - model_uri=LINKML.equals_number, domain=None, range=Optional[int]) - -slots.equals_expression = Slot(uri=LINKML.equals_expression, name="equals_expression", curie=LINKML.curie('equals_expression'), - model_uri=LINKML.equals_expression, domain=None, range=Optional[str]) - -slots.exact_cardinality = Slot(uri=LINKML.exact_cardinality, name="exact_cardinality", curie=LINKML.curie('exact_cardinality'), - model_uri=LINKML.exact_cardinality, domain=None, range=Optional[int]) - -slots.minimum_cardinality = Slot(uri=LINKML.minimum_cardinality, name="minimum_cardinality", curie=LINKML.curie('minimum_cardinality'), - model_uri=LINKML.minimum_cardinality, domain=None, range=Optional[int]) - -slots.maximum_cardinality = Slot(uri=LINKML.maximum_cardinality, name="maximum_cardinality", curie=LINKML.curie('maximum_cardinality'), - model_uri=LINKML.maximum_cardinality, domain=None, range=Optional[int]) - -slots.equals_string_in = Slot(uri=LINKML.equals_string_in, name="equals_string_in", curie=LINKML.curie('equals_string_in'), - model_uri=LINKML.equals_string_in, domain=None, range=Optional[Union[str, list[str]]]) - -slots.equals_number_in = Slot(uri=LINKML.equals_number_in, name="equals_number_in", curie=LINKML.curie('equals_number_in'), - model_uri=LINKML.equals_number_in, domain=None, range=Optional[Union[int, list[int]]]) - -slots.has_member = Slot(uri=LINKML.has_member, name="has_member", curie=LINKML.curie('has_member'), - model_uri=LINKML.has_member, domain=None, range=Optional[Union[dict, AnonymousSlotExpression]]) - -slots.all_members = Slot(uri=LINKML.all_members, name="all_members", curie=LINKML.curie('all_members'), - model_uri=LINKML.all_members, domain=None, range=Optional[Union[dict, AnonymousSlotExpression]]) - -slots.singular_name = Slot(uri=LINKML.singular_name, name="singular_name", curie=LINKML.curie('singular_name'), - model_uri=LINKML.singular_name, domain=SlotDefinition, range=Optional[str]) - -slots.required = Slot(uri=LINKML.required, name="required", curie=LINKML.curie('required'), - model_uri=LINKML.required, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.recommended = Slot(uri=LINKML.recommended, name="recommended", curie=LINKML.curie('recommended'), - model_uri=LINKML.recommended, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.inapplicable = Slot(uri=LINKML.inapplicable, name="inapplicable", curie=LINKML.curie('inapplicable'), - model_uri=LINKML.inapplicable, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.inlined = Slot(uri=LINKML.inlined, name="inlined", curie=LINKML.curie('inlined'), - model_uri=LINKML.inlined, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.inlined_as_list = Slot(uri=LINKML.inlined_as_list, name="inlined_as_list", curie=LINKML.curie('inlined_as_list'), - model_uri=LINKML.inlined_as_list, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.inlined_as_simple_dict = Slot(uri=LINKML.inlined_as_simple_dict, name="inlined_as_simple_dict", curie=LINKML.curie('inlined_as_simple_dict'), - model_uri=LINKML.inlined_as_simple_dict, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.list_elements_ordered = Slot(uri=LINKML.list_elements_ordered, name="list_elements_ordered", curie=LINKML.curie('list_elements_ordered'), - model_uri=LINKML.list_elements_ordered, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.list_elements_unique = Slot(uri=LINKML.list_elements_unique, name="list_elements_unique", curie=LINKML.curie('list_elements_unique'), - model_uri=LINKML.list_elements_unique, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.shared = Slot(uri=LINKML.shared, name="shared", curie=LINKML.curie('shared'), - model_uri=LINKML.shared, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.key = Slot(uri=LINKML.key, name="key", curie=LINKML.curie('key'), - model_uri=LINKML.key, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.identifier = Slot(uri=LINKML.identifier, name="identifier", curie=LINKML.curie('identifier'), - model_uri=LINKML.identifier, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.designates_type = Slot(uri=LINKML.designates_type, name="designates_type", curie=LINKML.curie('designates_type'), - model_uri=LINKML.designates_type, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.alias = Slot(uri=SKOS.prefLabel, name="alias", curie=SKOS.curie('prefLabel'), - model_uri=LINKML.alias, domain=SlotDefinition, range=Optional[str]) - -slots.owner = Slot(uri=LINKML.owner, name="owner", curie=LINKML.curie('owner'), - model_uri=LINKML.owner, domain=SlotDefinition, range=Optional[Union[str, DefinitionName]]) - -slots.domain_of = Slot(uri=LINKML.domain_of, name="domain_of", curie=LINKML.curie('domain_of'), - model_uri=LINKML.domain_of, domain=SlotDefinition, range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]]) - -slots.is_usage_slot = Slot(uri=LINKML.is_usage_slot, name="is_usage_slot", curie=LINKML.curie('is_usage_slot'), - model_uri=LINKML.is_usage_slot, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.usage_slot_name = Slot(uri=LINKML.usage_slot_name, name="usage_slot_name", curie=LINKML.curie('usage_slot_name'), - model_uri=LINKML.usage_slot_name, domain=SlotDefinition, range=Optional[str]) - -slots.subproperty_of = Slot(uri=RDFS.subPropertyOf, name="subproperty_of", curie=RDFS.curie('subPropertyOf'), - model_uri=LINKML.subproperty_of, domain=SlotDefinition, range=Optional[Union[str, SlotDefinitionName]]) - -slots.disjoint_with = Slot(uri=LINKML.disjoint_with, name="disjoint_with", curie=LINKML.curie('disjoint_with'), - model_uri=LINKML.disjoint_with, domain=Definition, range=Optional[Union[Union[str, DefinitionName], list[Union[str, DefinitionName]]]]) - -slots.children_are_mutually_disjoint = Slot(uri=LINKML.children_are_mutually_disjoint, name="children_are_mutually_disjoint", curie=LINKML.curie('children_are_mutually_disjoint'), - model_uri=LINKML.children_are_mutually_disjoint, domain=Definition, range=Optional[Union[bool, Bool]]) - -slots.relational_logical_characteristic = Slot(uri=LINKML.relational_logical_characteristic, name="relational_logical_characteristic", curie=LINKML.curie('relational_logical_characteristic'), - model_uri=LINKML.relational_logical_characteristic, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.symmetric = Slot(uri=LINKML.symmetric, name="symmetric", curie=LINKML.curie('symmetric'), - model_uri=LINKML.symmetric, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.asymmetric = Slot(uri=LINKML.asymmetric, name="asymmetric", curie=LINKML.curie('asymmetric'), - model_uri=LINKML.asymmetric, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.reflexive = Slot(uri=LINKML.reflexive, name="reflexive", curie=LINKML.curie('reflexive'), - model_uri=LINKML.reflexive, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.irreflexive = Slot(uri=LINKML.irreflexive, name="irreflexive", curie=LINKML.curie('irreflexive'), - model_uri=LINKML.irreflexive, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.locally_reflexive = Slot(uri=LINKML.locally_reflexive, name="locally_reflexive", curie=LINKML.curie('locally_reflexive'), - model_uri=LINKML.locally_reflexive, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.transitive = Slot(uri=LINKML.transitive, name="transitive", curie=LINKML.curie('transitive'), - model_uri=LINKML.transitive, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.transitive_form_of = Slot(uri=LINKML.transitive_form_of, name="transitive_form_of", curie=LINKML.curie('transitive_form_of'), - model_uri=LINKML.transitive_form_of, domain=None, range=Optional[Union[str, SlotDefinitionName]]) - -slots.reflexive_transitive_form_of = Slot(uri=LINKML.reflexive_transitive_form_of, name="reflexive_transitive_form_of", curie=LINKML.curie('reflexive_transitive_form_of'), - model_uri=LINKML.reflexive_transitive_form_of, domain=None, range=Optional[Union[str, SlotDefinitionName]]) - -slots.inverse = Slot(uri=OWL.inverseOf, name="inverse", curie=OWL.curie('inverseOf'), - model_uri=LINKML.inverse, domain=SlotDefinition, range=Optional[Union[str, SlotDefinitionName]]) - -slots.is_class_field = Slot(uri=LINKML.is_class_field, name="is_class_field", curie=LINKML.curie('is_class_field'), - model_uri=LINKML.is_class_field, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.role = Slot(uri=LINKML.role, name="role", curie=LINKML.curie('role'), - model_uri=LINKML.role, domain=SlotDefinition, range=Optional[str]) - -slots.minimum_value = Slot(uri=LINKML.minimum_value, name="minimum_value", curie=LINKML.curie('minimum_value'), - model_uri=LINKML.minimum_value, domain=SlotDefinition, range=Optional[Union[dict, Anything]]) - -slots.maximum_value = Slot(uri=LINKML.maximum_value, name="maximum_value", curie=LINKML.curie('maximum_value'), - model_uri=LINKML.maximum_value, domain=SlotDefinition, range=Optional[Union[dict, Anything]]) - -slots.interpolated = Slot(uri=LINKML.interpolated, name="interpolated", curie=LINKML.curie('interpolated'), - model_uri=LINKML.interpolated, domain=PatternExpression, range=Optional[Union[bool, Bool]]) - -slots.partial_match = Slot(uri=LINKML.partial_match, name="partial_match", curie=LINKML.curie('partial_match'), - model_uri=LINKML.partial_match, domain=PatternExpression, range=Optional[Union[bool, Bool]]) - -slots.pattern = Slot(uri=LINKML.pattern, name="pattern", curie=LINKML.curie('pattern'), - model_uri=LINKML.pattern, domain=Definition, range=Optional[str]) - -slots.syntax = Slot(uri=LINKML.syntax, name="syntax", curie=LINKML.curie('syntax'), - model_uri=LINKML.syntax, domain=PatternExpression, range=Optional[str]) - -slots.structured_pattern = Slot(uri=LINKML.structured_pattern, name="structured_pattern", curie=LINKML.curie('structured_pattern'), - model_uri=LINKML.structured_pattern, domain=Definition, range=Optional[Union[dict, "PatternExpression"]]) - -slots.string_serialization = Slot(uri=LINKML.string_serialization, name="string_serialization", curie=LINKML.curie('string_serialization'), - model_uri=LINKML.string_serialization, domain=Definition, range=Optional[str]) - -slots.bindings = Slot(uri=LINKML.bindings, name="bindings", curie=LINKML.curie('bindings'), - model_uri=LINKML.bindings, domain=Element, range=Optional[Union[Union[dict, "EnumBinding"], list[Union[dict, "EnumBinding"]]]]) - -slots.binds_value_of = Slot(uri=LINKML.binds_value_of, name="binds_value_of", curie=LINKML.curie('binds_value_of'), - model_uri=LINKML.binds_value_of, domain=EnumBinding, range=Optional[str]) - -slots.obligation_level = Slot(uri=LINKML.obligation_level, name="obligation_level", curie=LINKML.curie('obligation_level'), - model_uri=LINKML.obligation_level, domain=None, range=Optional[Union[str, "ObligationLevelEnum"]]) - -slots.type_mappings = Slot(uri=LINKML.type_mappings, name="type_mappings", curie=LINKML.curie('type_mappings'), - model_uri=LINKML.type_mappings, domain=None, range=Optional[Union[Union[str, TypeMappingFramework], list[Union[str, TypeMappingFramework]]]]) - -slots.framework_key = Slot(uri=LINKML.framework, name="framework_key", curie=LINKML.curie('framework'), - model_uri=LINKML.framework_key, domain=None, range=URIRef) - -slots.mapped_type = Slot(uri=LINKML.type, name="mapped_type", curie=LINKML.curie('type'), - model_uri=LINKML.mapped_type, domain=None, range=Optional[Union[str, TypeDefinitionName]]) - -slots.typeof = Slot(uri=LINKML.typeof, name="typeof", curie=LINKML.curie('typeof'), - model_uri=LINKML.typeof, domain=TypeDefinition, range=Optional[Union[str, TypeDefinitionName]]) - -slots.base = Slot(uri=LINKML.base, name="base", curie=LINKML.curie('base'), - model_uri=LINKML.base, domain=TypeDefinition, range=Optional[str]) - -slots.type_uri = Slot(uri=LINKML.uri, name="type_uri", curie=LINKML.curie('uri'), - model_uri=LINKML.type_uri, domain=TypeDefinition, range=Optional[Union[str, URIorCURIE]]) - -slots.repr = Slot(uri=LINKML.repr, name="repr", curie=LINKML.curie('repr'), - model_uri=LINKML.repr, domain=TypeDefinition, range=Optional[str]) - -slots.alt_description_text = Slot(uri=LINKML.description, name="alt_description_text", curie=LINKML.curie('description'), - model_uri=LINKML.alt_description_text, domain=AltDescription, range=str) - -slots.alt_description_source = Slot(uri=LINKML.source, name="alt_description_source", curie=LINKML.curie('source'), - model_uri=LINKML.alt_description_source, domain=AltDescription, range=Union[str, AltDescriptionSource]) - -slots.alt_descriptions = Slot(uri=LINKML.alt_descriptions, name="alt_descriptions", curie=LINKML.curie('alt_descriptions'), - model_uri=LINKML.alt_descriptions, domain=Element, range=Optional[Union[dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]]]]) - -slots.value = Slot(uri=SKOS.example, name="value", curie=SKOS.curie('example'), - model_uri=LINKML.value, domain=Example, range=Optional[str]) - -slots.value_description = Slot(uri=LINKML.description, name="value_description", curie=LINKML.curie('description'), - model_uri=LINKML.value_description, domain=Example, range=Optional[str]) - -slots.value_object = Slot(uri=LINKML.object, name="value_object", curie=LINKML.curie('object'), - model_uri=LINKML.value_object, domain=Example, range=Optional[Union[dict, Anything]]) - -slots.examples = Slot(uri=LINKML.examples, name="examples", curie=LINKML.curie('examples'), - model_uri=LINKML.examples, domain=Element, range=Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]]) - -slots.prefix_prefix = Slot(uri=SH.prefix, name="prefix_prefix", curie=SH.curie('prefix'), - model_uri=LINKML.prefix_prefix, domain=Prefix, range=Union[str, PrefixPrefixPrefix]) - -slots.prefix_reference = Slot(uri=SH.namespace, name="prefix_reference", curie=SH.curie('namespace'), - model_uri=LINKML.prefix_reference, domain=Prefix, range=Union[str, URI]) - -slots.prefixes = Slot(uri=SH.declare, name="prefixes", curie=SH.curie('declare'), - model_uri=LINKML.prefixes, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, PrefixPrefixPrefix], Union[dict, "Prefix"]], list[Union[dict, "Prefix"]]]]) - -slots.setting_key = Slot(uri=LINKML.setting_key, name="setting_key", curie=LINKML.curie('setting_key'), - model_uri=LINKML.setting_key, domain=Setting, range=Union[str, SettingSettingKey]) - -slots.setting_value = Slot(uri=LINKML.setting_value, name="setting_value", curie=LINKML.curie('setting_value'), - model_uri=LINKML.setting_value, domain=Setting, range=str) - -slots.settings = Slot(uri=LINKML.settings, name="settings", curie=LINKML.curie('settings'), - model_uri=LINKML.settings, domain=SchemaDefinition, range=Optional[Union[dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], list[Union[dict, "Setting"]]]]) - -slots.import_from = Slot(uri=LINKML.import_from, name="import_from", curie=LINKML.curie('import_from'), - model_uri=LINKML.import_from, domain=ImportExpression, range=Union[str, URIorCURIE]) - -slots.import_as = Slot(uri=LINKML.import_as, name="import_as", curie=LINKML.curie('import_as'), - model_uri=LINKML.import_as, domain=ImportExpression, range=Optional[Union[str, NCName]]) - -slots.import_map = Slot(uri=LINKML.import_map, name="import_map", curie=LINKML.curie('import_map'), - model_uri=LINKML.import_map, domain=ImportExpression, range=Optional[Union[dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], list[Union[dict, "Setting"]]]]) - -slots.local_name_source = Slot(uri=LINKML.local_name_source, name="local_name_source", curie=LINKML.curie('local_name_source'), - model_uri=LINKML.local_name_source, domain=LocalName, range=Union[str, LocalNameLocalNameSource]) - -slots.local_name_value = Slot(uri=SKOS.altLabel, name="local_name_value", curie=SKOS.curie('altLabel'), - model_uri=LINKML.local_name_value, domain=LocalName, range=str) - -slots.local_names = Slot(uri=LINKML.local_names, name="local_names", curie=LINKML.curie('local_names'), - model_uri=LINKML.local_names, domain=Element, range=Optional[Union[dict[Union[str, LocalNameLocalNameSource], Union[dict, "LocalName"]], list[Union[dict, "LocalName"]]]]) - -slots.slot_group = Slot(uri=SH.group, name="slot_group", curie=SH.curie('group'), - model_uri=LINKML.slot_group, domain=SlotDefinition, range=Optional[Union[str, SlotDefinitionName]]) - -slots.is_grouping_slot = Slot(uri=LINKML.is_grouping_slot, name="is_grouping_slot", curie=LINKML.curie('is_grouping_slot'), - model_uri=LINKML.is_grouping_slot, domain=SlotDefinition, range=Optional[Union[bool, Bool]]) - -slots.followed_by = Slot(uri=LINKML.followed_by, name="followed_by", curie=LINKML.curie('followed_by'), - model_uri=LINKML.followed_by, domain=None, range=Optional[Union[dict, Expression]]) - -slots.reversed = Slot(uri=LINKML.reversed, name="reversed", curie=LINKML.curie('reversed'), - model_uri=LINKML.reversed, domain=None, range=Optional[Union[bool, Bool]]) - -slots.traverse = Slot(uri=LINKML.traverse, name="traverse", curie=LINKML.curie('traverse'), - model_uri=LINKML.traverse, domain=None, range=Optional[Union[str, SlotDefinitionName]]) - -slots.path_rule = Slot(uri=LINKML.path_rule, name="path_rule", curie=LINKML.curie('path_rule'), - model_uri=LINKML.path_rule, domain=SlotDefinition, range=Optional[Union[dict, PathExpression]]) - -slots.represents_relationship = Slot(uri=LINKML.represents_relationship, name="represents_relationship", curie=LINKML.curie('represents_relationship'), - model_uri=LINKML.represents_relationship, domain=ClassDefinition, range=Optional[Union[bool, Bool]]) - -slots.relational_role = Slot(uri=LINKML.relational_role, name="relational_role", curie=LINKML.curie('relational_role'), - model_uri=LINKML.relational_role, domain=SlotDefinition, range=Optional[Union[str, "RelationalRoleEnum"]]) - -slots.schema_definition_name = Slot(uri=RDFS.label, name="schema_definition_name", curie=RDFS.curie('label'), - model_uri=LINKML.schema_definition_name, domain=SchemaDefinition, range=Union[str, SchemaDefinitionName]) - -slots.type_expression_any_of = Slot(uri=LINKML.any_of, name="type_expression_any_of", curie=LINKML.curie('any_of'), - model_uri=LINKML.type_expression_any_of, domain=None, range=Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]]) - -slots.type_expression_all_of = Slot(uri=LINKML.all_of, name="type_expression_all_of", curie=LINKML.curie('all_of'), - model_uri=LINKML.type_expression_all_of, domain=None, range=Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]]) - -slots.type_expression_exactly_one_of = Slot(uri=LINKML.exactly_one_of, name="type_expression_exactly_one_of", curie=LINKML.curie('exactly_one_of'), - model_uri=LINKML.type_expression_exactly_one_of, domain=None, range=Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]]) - -slots.type_expression_none_of = Slot(uri=LINKML.none_of, name="type_expression_none_of", curie=LINKML.curie('none_of'), - model_uri=LINKML.type_expression_none_of, domain=None, range=Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]]) - -slots.type_definition_union_of = Slot(uri=LINKML.union_of, name="type_definition_union_of", curie=LINKML.curie('union_of'), - model_uri=LINKML.type_definition_union_of, domain=TypeDefinition, range=Optional[Union[Union[str, TypeDefinitionName], list[Union[str, TypeDefinitionName]]]]) - -slots.enum_binding_range = Slot(uri=LINKML.range, name="enum_binding_range", curie=LINKML.curie('range'), - model_uri=LINKML.enum_binding_range, domain=EnumBinding, range=Optional[Union[str, EnumDefinitionName]]) - -slots.structured_alias_categories = Slot(uri=DCTERMS.subject, name="structured_alias_categories", curie=DCTERMS.curie('subject'), - model_uri=LINKML.structured_alias_categories, domain=StructuredAlias, range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]]) - -slots.path_expression_followed_by = Slot(uri=LINKML.followed_by, name="path_expression_followed_by", curie=LINKML.curie('followed_by'), - model_uri=LINKML.path_expression_followed_by, domain=PathExpression, range=Optional[Union[dict, "PathExpression"]]) - -slots.path_expression_any_of = Slot(uri=LINKML.any_of, name="path_expression_any_of", curie=LINKML.curie('any_of'), - model_uri=LINKML.path_expression_any_of, domain=PathExpression, range=Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]]) - -slots.path_expression_exactly_one_of = Slot(uri=LINKML.exactly_one_of, name="path_expression_exactly_one_of", curie=LINKML.curie('exactly_one_of'), - model_uri=LINKML.path_expression_exactly_one_of, domain=PathExpression, range=Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]]) - -slots.path_expression_none_of = Slot(uri=LINKML.none_of, name="path_expression_none_of", curie=LINKML.curie('none_of'), - model_uri=LINKML.path_expression_none_of, domain=PathExpression, range=Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]]) - -slots.path_expression_all_of = Slot(uri=LINKML.all_of, name="path_expression_all_of", curie=LINKML.curie('all_of'), - model_uri=LINKML.path_expression_all_of, domain=PathExpression, range=Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]]) - -slots.slot_expression_any_of = Slot(uri=LINKML.any_of, name="slot_expression_any_of", curie=LINKML.curie('any_of'), - model_uri=LINKML.slot_expression_any_of, domain=None, range=Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]]) - -slots.slot_expression_all_of = Slot(uri=LINKML.all_of, name="slot_expression_all_of", curie=LINKML.curie('all_of'), - model_uri=LINKML.slot_expression_all_of, domain=None, range=Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]]) - -slots.slot_expression_exactly_one_of = Slot(uri=LINKML.exactly_one_of, name="slot_expression_exactly_one_of", curie=LINKML.curie('exactly_one_of'), - model_uri=LINKML.slot_expression_exactly_one_of, domain=None, range=Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]]) - -slots.slot_expression_none_of = Slot(uri=LINKML.none_of, name="slot_expression_none_of", curie=LINKML.curie('none_of'), - model_uri=LINKML.slot_expression_none_of, domain=None, range=Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]]) - -slots.slot_definition_is_a = Slot(uri=LINKML.is_a, name="slot_definition_is_a", curie=LINKML.curie('is_a'), - model_uri=LINKML.slot_definition_is_a, domain=SlotDefinition, range=Optional[Union[str, SlotDefinitionName]]) - -slots.slot_definition_mixins = Slot(uri=LINKML.mixins, name="slot_definition_mixins", curie=LINKML.curie('mixins'), - model_uri=LINKML.slot_definition_mixins, domain=SlotDefinition, range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]]) - -slots.slot_definition_apply_to = Slot(uri=LINKML.apply_to, name="slot_definition_apply_to", curie=LINKML.curie('apply_to'), - model_uri=LINKML.slot_definition_apply_to, domain=SlotDefinition, range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]]) - -slots.slot_definition_disjoint_with = Slot(uri=LINKML.disjoint_with, name="slot_definition_disjoint_with", curie=LINKML.curie('disjoint_with'), - model_uri=LINKML.slot_definition_disjoint_with, domain=SlotDefinition, range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]]) - -slots.slot_definition_union_of = Slot(uri=LINKML.union_of, name="slot_definition_union_of", curie=LINKML.curie('union_of'), - model_uri=LINKML.slot_definition_union_of, domain=SlotDefinition, range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]]) - -slots.class_expression_any_of = Slot(uri=LINKML.any_of, name="class_expression_any_of", curie=LINKML.curie('any_of'), - model_uri=LINKML.class_expression_any_of, domain=None, range=Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]]) - -slots.class_expression_all_of = Slot(uri=LINKML.all_of, name="class_expression_all_of", curie=LINKML.curie('all_of'), - model_uri=LINKML.class_expression_all_of, domain=None, range=Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]]) - -slots.class_expression_exactly_one_of = Slot(uri=LINKML.exactly_one_of, name="class_expression_exactly_one_of", curie=LINKML.curie('exactly_one_of'), - model_uri=LINKML.class_expression_exactly_one_of, domain=None, range=Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]]) - -slots.class_expression_none_of = Slot(uri=LINKML.none_of, name="class_expression_none_of", curie=LINKML.curie('none_of'), - model_uri=LINKML.class_expression_none_of, domain=None, range=Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]]) - -slots.class_definition_is_a = Slot(uri=LINKML.is_a, name="class_definition_is_a", curie=LINKML.curie('is_a'), - model_uri=LINKML.class_definition_is_a, domain=ClassDefinition, range=Optional[Union[str, ClassDefinitionName]]) - -slots.class_definition_mixins = Slot(uri=LINKML.mixins, name="class_definition_mixins", curie=LINKML.curie('mixins'), - model_uri=LINKML.class_definition_mixins, domain=ClassDefinition, range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]]) - -slots.class_definition_apply_to = Slot(uri=LINKML.apply_to, name="class_definition_apply_to", curie=LINKML.curie('apply_to'), - model_uri=LINKML.class_definition_apply_to, domain=ClassDefinition, range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]]) - -slots.class_definition_rules = Slot(uri=SH.rule, name="class_definition_rules", curie=SH.curie('rule'), - model_uri=LINKML.class_definition_rules, domain=ClassDefinition, range=Optional[Union[Union[dict, "ClassRule"], list[Union[dict, "ClassRule"]]]]) - -slots.class_definition_disjoint_with = Slot(uri=LINKML.disjoint_with, name="class_definition_disjoint_with", curie=LINKML.curie('disjoint_with'), - model_uri=LINKML.class_definition_disjoint_with, domain=ClassDefinition, range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]]) - -slots.class_definition_union_of = Slot(uri=LINKML.union_of, name="class_definition_union_of", curie=LINKML.curie('union_of'), - model_uri=LINKML.class_definition_union_of, domain=ClassDefinition, range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]]) - -slots.permissible_value_is_a = Slot(uri=LINKML.is_a, name="permissible_value_is_a", curie=LINKML.curie('is_a'), - model_uri=LINKML.permissible_value_is_a, domain=PermissibleValue, range=Optional[Union[str, PermissibleValueText]]) -slots.permissible_value_mixins = Slot(uri=LINKML.mixins, name="permissible_value_mixins", curie=LINKML.curie('mixins'), - model_uri=LINKML.permissible_value_mixins, domain=PermissibleValue, range=Optional[Union[Union[str, PermissibleValueText], list[Union[str, PermissibleValueText]]]]) +slots.name = Slot( + uri=RDFS.label, + name="name", + curie=RDFS.curie("label"), + model_uri=LINKML.name, + domain=Element, + range=Union[str, ElementName], +) + +slots.title = Slot( + uri=DCTERMS.title, + name="title", + curie=DCTERMS.curie("title"), + model_uri=LINKML.title, + domain=Element, + range=Optional[str], +) + +slots.conforms_to = Slot( + uri=DCTERMS.conformsTo, + name="conforms_to", + curie=DCTERMS.curie("conformsTo"), + model_uri=LINKML.conforms_to, + domain=Element, + range=Optional[str], +) + +slots.implements = Slot( + uri=LINKML.implements, + name="implements", + curie=LINKML.curie("implements"), + model_uri=LINKML.implements, + domain=Element, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.instantiates = Slot( + uri=LINKML.instantiates, + name="instantiates", + curie=LINKML.curie("instantiates"), + model_uri=LINKML.instantiates, + domain=Element, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.categories = Slot( + uri=DCTERMS.subject, + name="categories", + curie=DCTERMS.curie("subject"), + model_uri=LINKML.categories, + domain=None, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.keywords = Slot( + uri=SCHEMA.keywords, + name="keywords", + curie=SCHEMA.curie("keywords"), + model_uri=LINKML.keywords, + domain=Element, + range=Optional[Union[str, list[str]]], +) + +slots.definition_uri = Slot( + uri=LINKML.definition_uri, + name="definition_uri", + curie=LINKML.curie("definition_uri"), + model_uri=LINKML.definition_uri, + domain=Element, + range=Optional[Union[str, URIorCURIE]], +) + +slots.id_prefixes = Slot( + uri=LINKML.id_prefixes, + name="id_prefixes", + curie=LINKML.curie("id_prefixes"), + model_uri=LINKML.id_prefixes, + domain=Element, + range=Optional[Union[Union[str, NCName], list[Union[str, NCName]]]], +) + +slots.id_prefixes_are_closed = Slot( + uri=LINKML.id_prefixes_are_closed, + name="id_prefixes_are_closed", + curie=LINKML.curie("id_prefixes_are_closed"), + model_uri=LINKML.id_prefixes_are_closed, + domain=Element, + range=Optional[Union[bool, Bool]], +) + +slots.description = Slot( + uri=SKOS.definition, + name="description", + curie=SKOS.curie("definition"), + model_uri=LINKML.description, + domain=Element, + range=Optional[str], +) + +slots.structured_aliases = Slot( + uri=SKOSXL.altLabel, + name="structured_aliases", + curie=SKOSXL.curie("altLabel"), + model_uri=LINKML.structured_aliases, + domain=None, + range=Optional[Union[Union[dict, StructuredAlias], list[Union[dict, StructuredAlias]]]], +) + +slots.aliases = Slot( + uri=SKOS.altLabel, + name="aliases", + curie=SKOS.curie("altLabel"), + model_uri=LINKML.aliases, + domain=Element, + range=Optional[Union[str, list[str]]], +) + +slots.deprecated = Slot( + uri=LINKML.deprecated, + name="deprecated", + curie=LINKML.curie("deprecated"), + model_uri=LINKML.deprecated, + domain=Element, + range=Optional[str], +) + +slots.todos = Slot( + uri=LINKML.todos, + name="todos", + curie=LINKML.curie("todos"), + model_uri=LINKML.todos, + domain=Element, + range=Optional[Union[str, list[str]]], +) + +slots.notes = Slot( + uri=SKOS.editorialNote, + name="notes", + curie=SKOS.curie("editorialNote"), + model_uri=LINKML.notes, + domain=Element, + range=Optional[Union[str, list[str]]], +) + +slots.comments = Slot( + uri=SKOS.note, + name="comments", + curie=SKOS.curie("note"), + model_uri=LINKML.comments, + domain=Element, + range=Optional[Union[str, list[str]]], +) + +slots.in_subset = Slot( + uri=OIO.inSubset, + name="in_subset", + curie=OIO.curie("inSubset"), + model_uri=LINKML.in_subset, + domain=Element, + range=Optional[Union[Union[str, SubsetDefinitionName], list[Union[str, SubsetDefinitionName]]]], +) + +slots.from_schema = Slot( + uri=SKOS.inScheme, + name="from_schema", + curie=SKOS.curie("inScheme"), + model_uri=LINKML.from_schema, + domain=Element, + range=Optional[Union[str, URI]], +) + +slots.imported_from = Slot( + uri=LINKML.imported_from, + name="imported_from", + curie=LINKML.curie("imported_from"), + model_uri=LINKML.imported_from, + domain=Element, + range=Optional[str], +) + +slots.see_also = Slot( + uri=RDFS.seeAlso, + name="see_also", + curie=RDFS.curie("seeAlso"), + model_uri=LINKML.see_also, + domain=Element, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.owned_by = Slot( + uri=LINKML.owned_by, + name="owned_by", + curie=LINKML.curie("owned_by"), + model_uri=LINKML.owned_by, + domain=Element, + range=Optional[Union[str, URIorCURIE]], +) + +slots.created_by = Slot( + uri=PAV.createdBy, + name="created_by", + curie=PAV.curie("createdBy"), + model_uri=LINKML.created_by, + domain=Element, + range=Optional[Union[str, URIorCURIE]], +) + +slots.contributors = Slot( + uri=DCTERMS.contributor, + name="contributors", + curie=DCTERMS.curie("contributor"), + model_uri=LINKML.contributors, + domain=Element, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.created_on = Slot( + uri=PAV.createdOn, + name="created_on", + curie=PAV.curie("createdOn"), + model_uri=LINKML.created_on, + domain=Element, + range=Optional[Union[str, XSDDateTime]], +) + +slots.last_updated_on = Slot( + uri=PAV.lastUpdatedOn, + name="last_updated_on", + curie=PAV.curie("lastUpdatedOn"), + model_uri=LINKML.last_updated_on, + domain=Element, + range=Optional[Union[str, XSDDateTime]], +) + +slots.modified_by = Slot( + uri=OSLC.modifiedBy, + name="modified_by", + curie=OSLC.curie("modifiedBy"), + model_uri=LINKML.modified_by, + domain=Element, + range=Optional[Union[str, URIorCURIE]], +) + +slots.status = Slot( + uri=BIBO.status, + name="status", + curie=BIBO.curie("status"), + model_uri=LINKML.status, + domain=Element, + range=Optional[Union[str, URIorCURIE]], +) + +slots.literal_form = Slot( + uri=SKOSXL.literalForm, + name="literal_form", + curie=SKOSXL.curie("literalForm"), + model_uri=LINKML.literal_form, + domain=StructuredAlias, + range=str, +) + +slots.alias_predicate = Slot( + uri=RDF.predicate, + name="alias_predicate", + curie=RDF.curie("predicate"), + model_uri=LINKML.alias_predicate, + domain=StructuredAlias, + range=Optional[Union[str, "AliasPredicateEnum"]], +) + +slots.alias_contexts = Slot( + uri=LINKML.contexts, + name="alias_contexts", + curie=LINKML.curie("contexts"), + model_uri=LINKML.alias_contexts, + domain=StructuredAlias, + range=Optional[Union[Union[str, URI], list[Union[str, URI]]]], +) + +slots.in_language = Slot( + uri=SCHEMA.inLanguage, + name="in_language", + curie=SCHEMA.curie("inLanguage"), + model_uri=LINKML.in_language, + domain=None, + range=Optional[str], +) + +slots.source = Slot( + uri=DCTERMS.source, + name="source", + curie=DCTERMS.curie("source"), + model_uri=LINKML.source, + domain=Element, + range=Optional[Union[str, URIorCURIE]], +) + +slots.publisher = Slot( + uri=DCTERMS.publisher, + name="publisher", + curie=DCTERMS.curie("publisher"), + model_uri=LINKML.publisher, + domain=Element, + range=Optional[Union[str, URIorCURIE]], +) + +slots.is_a = Slot( + uri=LINKML.is_a, + name="is_a", + curie=LINKML.curie("is_a"), + model_uri=LINKML.is_a, + domain=None, + range=Optional[Union[str, DefinitionName]], +) + +slots.abstract = Slot( + uri=LINKML.abstract, + name="abstract", + curie=LINKML.curie("abstract"), + model_uri=LINKML.abstract, + domain=Definition, + range=Optional[Union[bool, Bool]], +) + +slots.mixin = Slot( + uri=LINKML.mixin, + name="mixin", + curie=LINKML.curie("mixin"), + model_uri=LINKML.mixin, + domain=Definition, + range=Optional[Union[bool, Bool]], +) + +slots.mixins = Slot( + uri=LINKML.mixins, + name="mixins", + curie=LINKML.curie("mixins"), + model_uri=LINKML.mixins, + domain=None, + range=Optional[Union[Union[str, DefinitionName], list[Union[str, DefinitionName]]]], +) + +slots.apply_to = Slot( + uri=LINKML.apply_to, + name="apply_to", + curie=LINKML.curie("apply_to"), + model_uri=LINKML.apply_to, + domain=Definition, + range=Optional[Union[Union[str, DefinitionName], list[Union[str, DefinitionName]]]], +) + +slots.values_from = Slot( + uri=LINKML.values_from, + name="values_from", + curie=LINKML.curie("values_from"), + model_uri=LINKML.values_from, + domain=Definition, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.code_set = Slot( + uri=LINKML.code_set, + name="code_set", + curie=LINKML.curie("code_set"), + model_uri=LINKML.code_set, + domain=EnumExpression, + range=Optional[Union[str, URIorCURIE]], +) + +slots.code_set_version = Slot( + uri=LINKML.code_set_version, + name="code_set_version", + curie=LINKML.curie("code_set_version"), + model_uri=LINKML.code_set_version, + domain=EnumExpression, + range=Optional[str], +) + +slots.code_set_tag = Slot( + uri=LINKML.code_set_tag, + name="code_set_tag", + curie=LINKML.curie("code_set_tag"), + model_uri=LINKML.code_set_tag, + domain=EnumExpression, + range=Optional[str], +) + +slots.pv_formula = Slot( + uri=LINKML.pv_formula, + name="pv_formula", + curie=LINKML.curie("pv_formula"), + model_uri=LINKML.pv_formula, + domain=None, + range=Optional[Union[str, "PvFormulaOptions"]], +) + +slots.permissible_values = Slot( + uri=LINKML.permissible_values, + name="permissible_values", + curie=LINKML.curie("permissible_values"), + model_uri=LINKML.permissible_values, + domain=EnumExpression, + range=Optional[ + Union[ + dict[Union[str, PermissibleValueText], Union[dict, "PermissibleValue"]], + list[Union[dict, "PermissibleValue"]], + ] + ], +) + +slots.enum_uri = Slot( + uri=LINKML.enum_uri, + name="enum_uri", + curie=LINKML.curie("enum_uri"), + model_uri=LINKML.enum_uri, + domain=EnumDefinition, + range=Optional[Union[str, URIorCURIE]], +) + +slots.include = Slot( + uri=LINKML.include, + name="include", + curie=LINKML.curie("include"), + model_uri=LINKML.include, + domain=EnumExpression, + range=Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]], +) + +slots.minus = Slot( + uri=LINKML.minus, + name="minus", + curie=LINKML.curie("minus"), + model_uri=LINKML.minus, + domain=EnumExpression, + range=Optional[Union[Union[dict, "AnonymousEnumExpression"], list[Union[dict, "AnonymousEnumExpression"]]]], +) + +slots.inherits = Slot( + uri=LINKML.inherits, + name="inherits", + curie=LINKML.curie("inherits"), + model_uri=LINKML.inherits, + domain=EnumExpression, + range=Optional[Union[Union[str, EnumDefinitionName], list[Union[str, EnumDefinitionName]]]], +) + +slots.matches = Slot( + uri=LINKML.matches, + name="matches", + curie=LINKML.curie("matches"), + model_uri=LINKML.matches, + domain=EnumExpression, + range=Optional[Union[dict, "MatchQuery"]], +) + +slots.identifier_pattern = Slot( + uri=LINKML.identifier_pattern, + name="identifier_pattern", + curie=LINKML.curie("identifier_pattern"), + model_uri=LINKML.identifier_pattern, + domain=MatchQuery, + range=Optional[str], +) + +slots.concepts = Slot( + uri=LINKML.concepts, + name="concepts", + curie=LINKML.curie("concepts"), + model_uri=LINKML.concepts, + domain=EnumExpression, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.reachable_from = Slot( + uri=LINKML.reachable_from, + name="reachable_from", + curie=LINKML.curie("reachable_from"), + model_uri=LINKML.reachable_from, + domain=EnumExpression, + range=Optional[Union[dict, "ReachabilityQuery"]], +) + +slots.source_ontology = Slot( + uri=LINKML.source_ontology, + name="source_ontology", + curie=LINKML.curie("source_ontology"), + model_uri=LINKML.source_ontology, + domain=None, + range=Optional[Union[str, URIorCURIE]], +) + +slots.is_direct = Slot( + uri=LINKML.is_direct, + name="is_direct", + curie=LINKML.curie("is_direct"), + model_uri=LINKML.is_direct, + domain=ReachabilityQuery, + range=Optional[Union[bool, Bool]], +) + +slots.traverse_up = Slot( + uri=LINKML.traverse_up, + name="traverse_up", + curie=LINKML.curie("traverse_up"), + model_uri=LINKML.traverse_up, + domain=ReachabilityQuery, + range=Optional[Union[bool, Bool]], +) + +slots.include_self = Slot( + uri=LINKML.include_self, + name="include_self", + curie=LINKML.curie("include_self"), + model_uri=LINKML.include_self, + domain=ReachabilityQuery, + range=Optional[Union[bool, Bool]], +) + +slots.relationship_types = Slot( + uri=LINKML.relationship_types, + name="relationship_types", + curie=LINKML.curie("relationship_types"), + model_uri=LINKML.relationship_types, + domain=ReachabilityQuery, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.source_nodes = Slot( + uri=LINKML.source_nodes, + name="source_nodes", + curie=LINKML.curie("source_nodes"), + model_uri=LINKML.source_nodes, + domain=ReachabilityQuery, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.text = Slot( + uri=LINKML.text, + name="text", + curie=LINKML.curie("text"), + model_uri=LINKML.text, + domain=PermissibleValue, + range=Union[str, PermissibleValueText], +) + +slots.meaning = Slot( + uri=LINKML.meaning, + name="meaning", + curie=LINKML.curie("meaning"), + model_uri=LINKML.meaning, + domain=PermissibleValue, + range=Optional[Union[str, URIorCURIE]], +) + +slots.id = Slot( + uri=LINKML.id, + name="id", + curie=LINKML.curie("id"), + model_uri=LINKML.id, + domain=SchemaDefinition, + range=Union[str, URI], +) + +slots.emit_prefixes = Slot( + uri=LINKML.emit_prefixes, + name="emit_prefixes", + curie=LINKML.curie("emit_prefixes"), + model_uri=LINKML.emit_prefixes, + domain=SchemaDefinition, + range=Optional[Union[Union[str, NCName], list[Union[str, NCName]]]], +) + +slots.version = Slot( + uri=PAV.version, + name="version", + curie=PAV.curie("version"), + model_uri=LINKML.version, + domain=SchemaDefinition, + range=Optional[str], +) + +slots.imports = Slot( + uri=LINKML.imports, + name="imports", + curie=LINKML.curie("imports"), + model_uri=LINKML.imports, + domain=SchemaDefinition, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.structured_imports = Slot( + uri=LINKML.structured_imports, + name="structured_imports", + curie=LINKML.curie("structured_imports"), + model_uri=LINKML.structured_imports, + domain=SchemaDefinition, + range=Optional[Union[Union[dict, "ImportExpression"], list[Union[dict, "ImportExpression"]]]], +) + +slots.license = Slot( + uri=DCTERMS.license, + name="license", + curie=DCTERMS.curie("license"), + model_uri=LINKML.license, + domain=SchemaDefinition, + range=Optional[str], +) + +slots.default_curi_maps = Slot( + uri=LINKML.default_curi_maps, + name="default_curi_maps", + curie=LINKML.curie("default_curi_maps"), + model_uri=LINKML.default_curi_maps, + domain=SchemaDefinition, + range=Optional[Union[str, list[str]]], +) + +slots.default_prefix = Slot( + uri=LINKML.default_prefix, + name="default_prefix", + curie=LINKML.curie("default_prefix"), + model_uri=LINKML.default_prefix, + domain=SchemaDefinition, + range=Optional[str], +) + +slots.default_range = Slot( + uri=LINKML.default_range, + name="default_range", + curie=LINKML.curie("default_range"), + model_uri=LINKML.default_range, + domain=SchemaDefinition, + range=Optional[Union[str, TypeDefinitionName]], +) + +slots.subsets = Slot( + uri=LINKML.subsets, + name="subsets", + curie=LINKML.curie("subsets"), + model_uri=LINKML.subsets, + domain=SchemaDefinition, + range=Optional[ + Union[ + dict[Union[str, SubsetDefinitionName], Union[dict, "SubsetDefinition"]], + list[Union[dict, "SubsetDefinition"]], + ] + ], +) + +slots.types = Slot( + uri=LINKML.types, + name="types", + curie=LINKML.curie("types"), + model_uri=LINKML.types, + domain=SchemaDefinition, + range=Optional[ + Union[dict[Union[str, TypeDefinitionName], Union[dict, "TypeDefinition"]], list[Union[dict, "TypeDefinition"]]] + ], +) + +slots.enums = Slot( + uri=LINKML.enums, + name="enums", + curie=LINKML.curie("enums"), + model_uri=LINKML.enums, + domain=SchemaDefinition, + range=Optional[ + Union[dict[Union[str, EnumDefinitionName], Union[dict, "EnumDefinition"]], list[Union[dict, "EnumDefinition"]]] + ], +) + +slots.slot_definitions = Slot( + uri=LINKML.slots, + name="slot_definitions", + curie=LINKML.curie("slots"), + model_uri=LINKML.slot_definitions, + domain=SchemaDefinition, + range=Optional[ + Union[dict[Union[str, SlotDefinitionName], Union[dict, "SlotDefinition"]], list[Union[dict, "SlotDefinition"]]] + ], +) + +slots.classes = Slot( + uri=LINKML.classes, + name="classes", + curie=LINKML.curie("classes"), + model_uri=LINKML.classes, + domain=SchemaDefinition, + range=Optional[ + Union[ + dict[Union[str, ClassDefinitionName], Union[dict, "ClassDefinition"]], list[Union[dict, "ClassDefinition"]] + ] + ], +) + +slots.metamodel_version = Slot( + uri=LINKML.metamodel_version, + name="metamodel_version", + curie=LINKML.curie("metamodel_version"), + model_uri=LINKML.metamodel_version, + domain=SchemaDefinition, + range=Optional[str], +) + +slots.source_file = Slot( + uri=LINKML.source_file, + name="source_file", + curie=LINKML.curie("source_file"), + model_uri=LINKML.source_file, + domain=SchemaDefinition, + range=Optional[str], +) + +slots.source_file_date = Slot( + uri=LINKML.source_file_date, + name="source_file_date", + curie=LINKML.curie("source_file_date"), + model_uri=LINKML.source_file_date, + domain=SchemaDefinition, + range=Optional[Union[str, XSDDateTime]], +) + +slots.source_file_size = Slot( + uri=LINKML.source_file_size, + name="source_file_size", + curie=LINKML.curie("source_file_size"), + model_uri=LINKML.source_file_size, + domain=SchemaDefinition, + range=Optional[int], +) + +slots.generation_date = Slot( + uri=LINKML.generation_date, + name="generation_date", + curie=LINKML.curie("generation_date"), + model_uri=LINKML.generation_date, + domain=SchemaDefinition, + range=Optional[Union[str, XSDDateTime]], +) + +slots.slots = Slot( + uri=LINKML.slots, + name="slots", + curie=LINKML.curie("slots"), + model_uri=LINKML.slots, + domain=ClassDefinition, + range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]], +) + +slots.slot_usage = Slot( + uri=LINKML.slot_usage, + name="slot_usage", + curie=LINKML.curie("slot_usage"), + model_uri=LINKML.slot_usage, + domain=ClassDefinition, + range=Optional[ + Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]] + ], +) + +slots.enum_range = Slot( + uri=LINKML.enum_range, + name="enum_range", + curie=LINKML.curie("enum_range"), + model_uri=LINKML.enum_range, + domain=None, + range=Optional[Union[dict, EnumExpression]], +) + +slots.range_expression = Slot( + uri=LINKML.range_expression, + name="range_expression", + curie=LINKML.curie("range_expression"), + model_uri=LINKML.range_expression, + domain=None, + range=Optional[Union[dict, "AnonymousClassExpression"]], +) + +slots.boolean_slot = Slot( + uri=LINKML.boolean_slot, + name="boolean_slot", + curie=LINKML.curie("boolean_slot"), + model_uri=LINKML.boolean_slot, + domain=None, + range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]], +) + +slots.any_of = Slot( + uri=LINKML.any_of, + name="any_of", + curie=LINKML.curie("any_of"), + model_uri=LINKML.any_of, + domain=None, + range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]], +) + +slots.exactly_one_of = Slot( + uri=LINKML.exactly_one_of, + name="exactly_one_of", + curie=LINKML.curie("exactly_one_of"), + model_uri=LINKML.exactly_one_of, + domain=None, + range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]], +) + +slots.none_of = Slot( + uri=LINKML.none_of, + name="none_of", + curie=LINKML.curie("none_of"), + model_uri=LINKML.none_of, + domain=None, + range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]], +) + +slots.all_of = Slot( + uri=LINKML.all_of, + name="all_of", + curie=LINKML.curie("all_of"), + model_uri=LINKML.all_of, + domain=None, + range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]], +) + +slots.preconditions = Slot( + uri=SH.condition, + name="preconditions", + curie=SH.curie("condition"), + model_uri=LINKML.preconditions, + domain=None, + range=Optional[Union[dict, AnonymousClassExpression]], +) + +slots.postconditions = Slot( + uri=LINKML.postconditions, + name="postconditions", + curie=LINKML.curie("postconditions"), + model_uri=LINKML.postconditions, + domain=None, + range=Optional[Union[dict, AnonymousClassExpression]], +) + +slots.elseconditions = Slot( + uri=LINKML.elseconditions, + name="elseconditions", + curie=LINKML.curie("elseconditions"), + model_uri=LINKML.elseconditions, + domain=None, + range=Optional[Union[dict, AnonymousClassExpression]], +) + +slots.bidirectional = Slot( + uri=LINKML.bidirectional, + name="bidirectional", + curie=LINKML.curie("bidirectional"), + model_uri=LINKML.bidirectional, + domain=None, + range=Optional[Union[bool, Bool]], +) + +slots.open_world = Slot( + uri=LINKML.open_world, + name="open_world", + curie=LINKML.curie("open_world"), + model_uri=LINKML.open_world, + domain=None, + range=Optional[Union[bool, Bool]], +) + +slots.rank = Slot( + uri=SH.order, name="rank", curie=SH.curie("order"), model_uri=LINKML.rank, domain=None, range=Optional[int] +) + +slots.deactivated = Slot( + uri=SH.deactivated, + name="deactivated", + curie=SH.curie("deactivated"), + model_uri=LINKML.deactivated, + domain=None, + range=Optional[Union[bool, Bool]], +) + +slots.rules = Slot( + uri=SH.rule, + name="rules", + curie=SH.curie("rule"), + model_uri=LINKML.rules, + domain=ClassDefinition, + range=Optional[Union[Union[dict, "ClassRule"], list[Union[dict, "ClassRule"]]]], +) + +slots.classification_rules = Slot( + uri=LINKML.classification_rules, + name="classification_rules", + curie=LINKML.curie("classification_rules"), + model_uri=LINKML.classification_rules, + domain=ClassDefinition, + range=Optional[Union[Union[dict, AnonymousClassExpression], list[Union[dict, AnonymousClassExpression]]]], +) + +slots.slot_conditions = Slot( + uri=LINKML.slot_conditions, + name="slot_conditions", + curie=LINKML.curie("slot_conditions"), + model_uri=LINKML.slot_conditions, + domain=None, + range=Optional[ + Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]] + ], +) + +slots.attributes = Slot( + uri=LINKML.attributes, + name="attributes", + curie=LINKML.curie("attributes"), + model_uri=LINKML.attributes, + domain=ClassDefinition, + range=Optional[ + Union[dict[Union[str, SlotDefinitionName], Union[dict, SlotDefinition]], list[Union[dict, SlotDefinition]]] + ], +) + +slots.class_uri = Slot( + uri=LINKML.class_uri, + name="class_uri", + curie=LINKML.curie("class_uri"), + model_uri=LINKML.class_uri, + domain=ClassDefinition, + range=Optional[Union[str, URIorCURIE]], +) + +slots.subclass_of = Slot( + uri=LINKML.subclass_of, + name="subclass_of", + curie=LINKML.curie("subclass_of"), + model_uri=LINKML.subclass_of, + domain=ClassDefinition, + range=Optional[Union[str, URIorCURIE]], +) + +slots.defining_slots = Slot( + uri=LINKML.defining_slots, + name="defining_slots", + curie=LINKML.curie("defining_slots"), + model_uri=LINKML.defining_slots, + domain=ClassDefinition, + range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]], +) + +slots.union_of = Slot( + uri=LINKML.union_of, + name="union_of", + curie=LINKML.curie("union_of"), + model_uri=LINKML.union_of, + domain=Element, + range=Optional[Union[Union[str, ElementName], list[Union[str, ElementName]]]], +) + +slots.tree_root = Slot( + uri=LINKML.tree_root, + name="tree_root", + curie=LINKML.curie("tree_root"), + model_uri=LINKML.tree_root, + domain=ClassDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.unique_keys = Slot( + uri=LINKML.unique_keys, + name="unique_keys", + curie=LINKML.curie("unique_keys"), + model_uri=LINKML.unique_keys, + domain=ClassDefinition, + range=Optional[ + Union[dict[Union[str, UniqueKeyUniqueKeyName], Union[dict, "UniqueKey"]], list[Union[dict, "UniqueKey"]]] + ], +) + +slots.unique_key_name = Slot( + uri=LINKML.unique_key_name, + name="unique_key_name", + curie=LINKML.curie("unique_key_name"), + model_uri=LINKML.unique_key_name, + domain=UniqueKey, + range=Union[str, UniqueKeyUniqueKeyName], +) + +slots.consider_nulls_inequal = Slot( + uri=LINKML.consider_nulls_inequal, + name="consider_nulls_inequal", + curie=LINKML.curie("consider_nulls_inequal"), + model_uri=LINKML.consider_nulls_inequal, + domain=UniqueKey, + range=Optional[Union[bool, Bool]], +) + +slots.unique_key_slots = Slot( + uri=LINKML.unique_key_slots, + name="unique_key_slots", + curie=LINKML.curie("unique_key_slots"), + model_uri=LINKML.unique_key_slots, + domain=UniqueKey, + range=Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]], +) + +slots.slot_names_unique = Slot( + uri=LINKML.slot_names_unique, + name="slot_names_unique", + curie=LINKML.curie("slot_names_unique"), + model_uri=LINKML.slot_names_unique, + domain=Definition, + range=Optional[Union[bool, Bool]], +) + +slots.domain = Slot( + uri=LINKML.domain, + name="domain", + curie=LINKML.curie("domain"), + model_uri=LINKML.domain, + domain=SlotDefinition, + range=Optional[Union[str, ClassDefinitionName]], +) + +slots.range = Slot( + uri=LINKML.range, + name="range", + curie=LINKML.curie("range"), + model_uri=LINKML.range, + domain=SlotDefinition, + range=Optional[Union[str, ElementName]], +) + +slots.slot_uri = Slot( + uri=LINKML.slot_uri, + name="slot_uri", + curie=LINKML.curie("slot_uri"), + model_uri=LINKML.slot_uri, + domain=SlotDefinition, + range=Optional[Union[str, URIorCURIE]], +) + +slots.multivalued = Slot( + uri=LINKML.multivalued, + name="multivalued", + curie=LINKML.curie("multivalued"), + model_uri=LINKML.multivalued, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.array = Slot( + uri=LINKML.array, + name="array", + curie=LINKML.curie("array"), + model_uri=LINKML.array, + domain=SlotDefinition, + range=Optional[Union[dict, "ArrayExpression"]], +) + +slots.dimensions = Slot( + uri=LINKML.dimensions, + name="dimensions", + curie=LINKML.curie("dimensions"), + model_uri=LINKML.dimensions, + domain=ArrayExpression, + range=Optional[Union[Union[dict, "DimensionExpression"], list[Union[dict, "DimensionExpression"]]]], +) + +slots.minimum_number_dimensions = Slot( + uri=LINKML.minimum_number_dimensions, + name="minimum_number_dimensions", + curie=LINKML.curie("minimum_number_dimensions"), + model_uri=LINKML.minimum_number_dimensions, + domain=ArrayExpression, + range=Optional[int], +) + +slots.maximum_number_dimensions = Slot( + uri=LINKML.maximum_number_dimensions, + name="maximum_number_dimensions", + curie=LINKML.curie("maximum_number_dimensions"), + model_uri=LINKML.maximum_number_dimensions, + domain=ArrayExpression, + range=Optional[Union[dict, Anything]], +) + +slots.exact_number_dimensions = Slot( + uri=LINKML.exact_number_dimensions, + name="exact_number_dimensions", + curie=LINKML.curie("exact_number_dimensions"), + model_uri=LINKML.exact_number_dimensions, + domain=ArrayExpression, + range=Optional[int], +) + +slots.inherited = Slot( + uri=LINKML.inherited, + name="inherited", + curie=LINKML.curie("inherited"), + model_uri=LINKML.inherited, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.readonly = Slot( + uri=LINKML.readonly, + name="readonly", + curie=LINKML.curie("readonly"), + model_uri=LINKML.readonly, + domain=SlotDefinition, + range=Optional[str], +) + +slots.ifabsent = Slot( + uri=LINKML.ifabsent, + name="ifabsent", + curie=LINKML.curie("ifabsent"), + model_uri=LINKML.ifabsent, + domain=SlotDefinition, + range=Optional[str], +) + +slots.implicit_prefix = Slot( + uri=LINKML.implicit_prefix, + name="implicit_prefix", + curie=LINKML.curie("implicit_prefix"), + model_uri=LINKML.implicit_prefix, + domain=None, + range=Optional[str], +) + +slots.value_specification_constant = Slot( + uri=LINKML.value_specification_constant, + name="value_specification_constant", + curie=LINKML.curie("value_specification_constant"), + model_uri=LINKML.value_specification_constant, + domain=None, + range=Optional[str], +) + +slots.list_value_specification_constant = Slot( + uri=LINKML.list_value_specification_constant, + name="list_value_specification_constant", + curie=LINKML.curie("list_value_specification_constant"), + model_uri=LINKML.list_value_specification_constant, + domain=None, + range=Optional[str], +) + +slots.value_presence = Slot( + uri=LINKML.value_presence, + name="value_presence", + curie=LINKML.curie("value_presence"), + model_uri=LINKML.value_presence, + domain=SlotDefinition, + range=Optional[Union[str, "PresenceEnum"]], +) + +slots.equals_string = Slot( + uri=LINKML.equals_string, + name="equals_string", + curie=LINKML.curie("equals_string"), + model_uri=LINKML.equals_string, + domain=None, + range=Optional[str], +) + +slots.equals_number = Slot( + uri=LINKML.equals_number, + name="equals_number", + curie=LINKML.curie("equals_number"), + model_uri=LINKML.equals_number, + domain=None, + range=Optional[int], +) + +slots.equals_expression = Slot( + uri=LINKML.equals_expression, + name="equals_expression", + curie=LINKML.curie("equals_expression"), + model_uri=LINKML.equals_expression, + domain=None, + range=Optional[str], +) + +slots.exact_cardinality = Slot( + uri=LINKML.exact_cardinality, + name="exact_cardinality", + curie=LINKML.curie("exact_cardinality"), + model_uri=LINKML.exact_cardinality, + domain=None, + range=Optional[int], +) + +slots.minimum_cardinality = Slot( + uri=LINKML.minimum_cardinality, + name="minimum_cardinality", + curie=LINKML.curie("minimum_cardinality"), + model_uri=LINKML.minimum_cardinality, + domain=None, + range=Optional[int], +) + +slots.maximum_cardinality = Slot( + uri=LINKML.maximum_cardinality, + name="maximum_cardinality", + curie=LINKML.curie("maximum_cardinality"), + model_uri=LINKML.maximum_cardinality, + domain=None, + range=Optional[int], +) + +slots.equals_string_in = Slot( + uri=LINKML.equals_string_in, + name="equals_string_in", + curie=LINKML.curie("equals_string_in"), + model_uri=LINKML.equals_string_in, + domain=None, + range=Optional[Union[str, list[str]]], +) + +slots.equals_number_in = Slot( + uri=LINKML.equals_number_in, + name="equals_number_in", + curie=LINKML.curie("equals_number_in"), + model_uri=LINKML.equals_number_in, + domain=None, + range=Optional[Union[int, list[int]]], +) + +slots.has_member = Slot( + uri=LINKML.has_member, + name="has_member", + curie=LINKML.curie("has_member"), + model_uri=LINKML.has_member, + domain=None, + range=Optional[Union[dict, AnonymousSlotExpression]], +) + +slots.all_members = Slot( + uri=LINKML.all_members, + name="all_members", + curie=LINKML.curie("all_members"), + model_uri=LINKML.all_members, + domain=None, + range=Optional[Union[dict, AnonymousSlotExpression]], +) + +slots.singular_name = Slot( + uri=LINKML.singular_name, + name="singular_name", + curie=LINKML.curie("singular_name"), + model_uri=LINKML.singular_name, + domain=SlotDefinition, + range=Optional[str], +) + +slots.required = Slot( + uri=LINKML.required, + name="required", + curie=LINKML.curie("required"), + model_uri=LINKML.required, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.recommended = Slot( + uri=LINKML.recommended, + name="recommended", + curie=LINKML.curie("recommended"), + model_uri=LINKML.recommended, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.inapplicable = Slot( + uri=LINKML.inapplicable, + name="inapplicable", + curie=LINKML.curie("inapplicable"), + model_uri=LINKML.inapplicable, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.inlined = Slot( + uri=LINKML.inlined, + name="inlined", + curie=LINKML.curie("inlined"), + model_uri=LINKML.inlined, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.inlined_as_list = Slot( + uri=LINKML.inlined_as_list, + name="inlined_as_list", + curie=LINKML.curie("inlined_as_list"), + model_uri=LINKML.inlined_as_list, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.inlined_as_simple_dict = Slot( + uri=LINKML.inlined_as_simple_dict, + name="inlined_as_simple_dict", + curie=LINKML.curie("inlined_as_simple_dict"), + model_uri=LINKML.inlined_as_simple_dict, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.list_elements_ordered = Slot( + uri=LINKML.list_elements_ordered, + name="list_elements_ordered", + curie=LINKML.curie("list_elements_ordered"), + model_uri=LINKML.list_elements_ordered, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.list_elements_unique = Slot( + uri=LINKML.list_elements_unique, + name="list_elements_unique", + curie=LINKML.curie("list_elements_unique"), + model_uri=LINKML.list_elements_unique, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.shared = Slot( + uri=LINKML.shared, + name="shared", + curie=LINKML.curie("shared"), + model_uri=LINKML.shared, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.key = Slot( + uri=LINKML.key, + name="key", + curie=LINKML.curie("key"), + model_uri=LINKML.key, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.identifier = Slot( + uri=LINKML.identifier, + name="identifier", + curie=LINKML.curie("identifier"), + model_uri=LINKML.identifier, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.designates_type = Slot( + uri=LINKML.designates_type, + name="designates_type", + curie=LINKML.curie("designates_type"), + model_uri=LINKML.designates_type, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.alias = Slot( + uri=SKOS.prefLabel, + name="alias", + curie=SKOS.curie("prefLabel"), + model_uri=LINKML.alias, + domain=SlotDefinition, + range=Optional[str], +) + +slots.owner = Slot( + uri=LINKML.owner, + name="owner", + curie=LINKML.curie("owner"), + model_uri=LINKML.owner, + domain=SlotDefinition, + range=Optional[Union[str, DefinitionName]], +) + +slots.domain_of = Slot( + uri=LINKML.domain_of, + name="domain_of", + curie=LINKML.curie("domain_of"), + model_uri=LINKML.domain_of, + domain=SlotDefinition, + range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]], +) + +slots.is_usage_slot = Slot( + uri=LINKML.is_usage_slot, + name="is_usage_slot", + curie=LINKML.curie("is_usage_slot"), + model_uri=LINKML.is_usage_slot, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.usage_slot_name = Slot( + uri=LINKML.usage_slot_name, + name="usage_slot_name", + curie=LINKML.curie("usage_slot_name"), + model_uri=LINKML.usage_slot_name, + domain=SlotDefinition, + range=Optional[str], +) + +slots.subproperty_of = Slot( + uri=RDFS.subPropertyOf, + name="subproperty_of", + curie=RDFS.curie("subPropertyOf"), + model_uri=LINKML.subproperty_of, + domain=SlotDefinition, + range=Optional[Union[str, SlotDefinitionName]], +) + +slots.disjoint_with = Slot( + uri=LINKML.disjoint_with, + name="disjoint_with", + curie=LINKML.curie("disjoint_with"), + model_uri=LINKML.disjoint_with, + domain=Definition, + range=Optional[Union[Union[str, DefinitionName], list[Union[str, DefinitionName]]]], +) + +slots.children_are_mutually_disjoint = Slot( + uri=LINKML.children_are_mutually_disjoint, + name="children_are_mutually_disjoint", + curie=LINKML.curie("children_are_mutually_disjoint"), + model_uri=LINKML.children_are_mutually_disjoint, + domain=Definition, + range=Optional[Union[bool, Bool]], +) + +slots.relational_logical_characteristic = Slot( + uri=LINKML.relational_logical_characteristic, + name="relational_logical_characteristic", + curie=LINKML.curie("relational_logical_characteristic"), + model_uri=LINKML.relational_logical_characteristic, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.symmetric = Slot( + uri=LINKML.symmetric, + name="symmetric", + curie=LINKML.curie("symmetric"), + model_uri=LINKML.symmetric, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.asymmetric = Slot( + uri=LINKML.asymmetric, + name="asymmetric", + curie=LINKML.curie("asymmetric"), + model_uri=LINKML.asymmetric, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.reflexive = Slot( + uri=LINKML.reflexive, + name="reflexive", + curie=LINKML.curie("reflexive"), + model_uri=LINKML.reflexive, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.irreflexive = Slot( + uri=LINKML.irreflexive, + name="irreflexive", + curie=LINKML.curie("irreflexive"), + model_uri=LINKML.irreflexive, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.locally_reflexive = Slot( + uri=LINKML.locally_reflexive, + name="locally_reflexive", + curie=LINKML.curie("locally_reflexive"), + model_uri=LINKML.locally_reflexive, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.transitive = Slot( + uri=LINKML.transitive, + name="transitive", + curie=LINKML.curie("transitive"), + model_uri=LINKML.transitive, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.transitive_form_of = Slot( + uri=LINKML.transitive_form_of, + name="transitive_form_of", + curie=LINKML.curie("transitive_form_of"), + model_uri=LINKML.transitive_form_of, + domain=None, + range=Optional[Union[str, SlotDefinitionName]], +) + +slots.reflexive_transitive_form_of = Slot( + uri=LINKML.reflexive_transitive_form_of, + name="reflexive_transitive_form_of", + curie=LINKML.curie("reflexive_transitive_form_of"), + model_uri=LINKML.reflexive_transitive_form_of, + domain=None, + range=Optional[Union[str, SlotDefinitionName]], +) + +slots.inverse = Slot( + uri=OWL.inverseOf, + name="inverse", + curie=OWL.curie("inverseOf"), + model_uri=LINKML.inverse, + domain=SlotDefinition, + range=Optional[Union[str, SlotDefinitionName]], +) + +slots.is_class_field = Slot( + uri=LINKML.is_class_field, + name="is_class_field", + curie=LINKML.curie("is_class_field"), + model_uri=LINKML.is_class_field, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.role = Slot( + uri=LINKML.role, + name="role", + curie=LINKML.curie("role"), + model_uri=LINKML.role, + domain=SlotDefinition, + range=Optional[str], +) + +slots.minimum_value = Slot( + uri=LINKML.minimum_value, + name="minimum_value", + curie=LINKML.curie("minimum_value"), + model_uri=LINKML.minimum_value, + domain=SlotDefinition, + range=Optional[Union[dict, Anything]], +) + +slots.maximum_value = Slot( + uri=LINKML.maximum_value, + name="maximum_value", + curie=LINKML.curie("maximum_value"), + model_uri=LINKML.maximum_value, + domain=SlotDefinition, + range=Optional[Union[dict, Anything]], +) + +slots.interpolated = Slot( + uri=LINKML.interpolated, + name="interpolated", + curie=LINKML.curie("interpolated"), + model_uri=LINKML.interpolated, + domain=PatternExpression, + range=Optional[Union[bool, Bool]], +) + +slots.partial_match = Slot( + uri=LINKML.partial_match, + name="partial_match", + curie=LINKML.curie("partial_match"), + model_uri=LINKML.partial_match, + domain=PatternExpression, + range=Optional[Union[bool, Bool]], +) + +slots.pattern = Slot( + uri=LINKML.pattern, + name="pattern", + curie=LINKML.curie("pattern"), + model_uri=LINKML.pattern, + domain=Definition, + range=Optional[str], +) + +slots.syntax = Slot( + uri=LINKML.syntax, + name="syntax", + curie=LINKML.curie("syntax"), + model_uri=LINKML.syntax, + domain=PatternExpression, + range=Optional[str], +) + +slots.structured_pattern = Slot( + uri=LINKML.structured_pattern, + name="structured_pattern", + curie=LINKML.curie("structured_pattern"), + model_uri=LINKML.structured_pattern, + domain=Definition, + range=Optional[Union[dict, "PatternExpression"]], +) + +slots.string_serialization = Slot( + uri=LINKML.string_serialization, + name="string_serialization", + curie=LINKML.curie("string_serialization"), + model_uri=LINKML.string_serialization, + domain=Definition, + range=Optional[str], +) + +slots.bindings = Slot( + uri=LINKML.bindings, + name="bindings", + curie=LINKML.curie("bindings"), + model_uri=LINKML.bindings, + domain=Element, + range=Optional[Union[Union[dict, "EnumBinding"], list[Union[dict, "EnumBinding"]]]], +) + +slots.binds_value_of = Slot( + uri=LINKML.binds_value_of, + name="binds_value_of", + curie=LINKML.curie("binds_value_of"), + model_uri=LINKML.binds_value_of, + domain=EnumBinding, + range=Optional[str], +) + +slots.obligation_level = Slot( + uri=LINKML.obligation_level, + name="obligation_level", + curie=LINKML.curie("obligation_level"), + model_uri=LINKML.obligation_level, + domain=None, + range=Optional[Union[str, "ObligationLevelEnum"]], +) + +slots.type_mappings = Slot( + uri=LINKML.type_mappings, + name="type_mappings", + curie=LINKML.curie("type_mappings"), + model_uri=LINKML.type_mappings, + domain=None, + range=Optional[Union[Union[str, TypeMappingFramework], list[Union[str, TypeMappingFramework]]]], +) + +slots.framework_key = Slot( + uri=LINKML.framework, + name="framework_key", + curie=LINKML.curie("framework"), + model_uri=LINKML.framework_key, + domain=None, + range=URIRef, +) + +slots.mapped_type = Slot( + uri=LINKML.type, + name="mapped_type", + curie=LINKML.curie("type"), + model_uri=LINKML.mapped_type, + domain=None, + range=Optional[Union[str, TypeDefinitionName]], +) + +slots.typeof = Slot( + uri=LINKML.typeof, + name="typeof", + curie=LINKML.curie("typeof"), + model_uri=LINKML.typeof, + domain=TypeDefinition, + range=Optional[Union[str, TypeDefinitionName]], +) + +slots.base = Slot( + uri=LINKML.base, + name="base", + curie=LINKML.curie("base"), + model_uri=LINKML.base, + domain=TypeDefinition, + range=Optional[str], +) + +slots.type_uri = Slot( + uri=LINKML.uri, + name="type_uri", + curie=LINKML.curie("uri"), + model_uri=LINKML.type_uri, + domain=TypeDefinition, + range=Optional[Union[str, URIorCURIE]], +) + +slots.repr = Slot( + uri=LINKML.repr, + name="repr", + curie=LINKML.curie("repr"), + model_uri=LINKML.repr, + domain=TypeDefinition, + range=Optional[str], +) + +slots.alt_description_text = Slot( + uri=LINKML.description, + name="alt_description_text", + curie=LINKML.curie("description"), + model_uri=LINKML.alt_description_text, + domain=AltDescription, + range=str, +) + +slots.alt_description_source = Slot( + uri=LINKML.source, + name="alt_description_source", + curie=LINKML.curie("source"), + model_uri=LINKML.alt_description_source, + domain=AltDescription, + range=Union[str, AltDescriptionSource], +) + +slots.alt_descriptions = Slot( + uri=LINKML.alt_descriptions, + name="alt_descriptions", + curie=LINKML.curie("alt_descriptions"), + model_uri=LINKML.alt_descriptions, + domain=Element, + range=Optional[ + Union[ + dict[Union[str, AltDescriptionSource], Union[dict, "AltDescription"]], list[Union[dict, "AltDescription"]] + ] + ], +) + +slots.value = Slot( + uri=SKOS.example, + name="value", + curie=SKOS.curie("example"), + model_uri=LINKML.value, + domain=Example, + range=Optional[str], +) + +slots.value_description = Slot( + uri=LINKML.description, + name="value_description", + curie=LINKML.curie("description"), + model_uri=LINKML.value_description, + domain=Example, + range=Optional[str], +) + +slots.value_object = Slot( + uri=LINKML.object, + name="value_object", + curie=LINKML.curie("object"), + model_uri=LINKML.value_object, + domain=Example, + range=Optional[Union[dict, Anything]], +) + +slots.examples = Slot( + uri=LINKML.examples, + name="examples", + curie=LINKML.curie("examples"), + model_uri=LINKML.examples, + domain=Element, + range=Optional[Union[Union[dict, "Example"], list[Union[dict, "Example"]]]], +) + +slots.prefix_prefix = Slot( + uri=SH.prefix, + name="prefix_prefix", + curie=SH.curie("prefix"), + model_uri=LINKML.prefix_prefix, + domain=Prefix, + range=Union[str, PrefixPrefixPrefix], +) + +slots.prefix_reference = Slot( + uri=SH.namespace, + name="prefix_reference", + curie=SH.curie("namespace"), + model_uri=LINKML.prefix_reference, + domain=Prefix, + range=Union[str, URI], +) + +slots.prefixes = Slot( + uri=SH.declare, + name="prefixes", + curie=SH.curie("declare"), + model_uri=LINKML.prefixes, + domain=SchemaDefinition, + range=Optional[Union[dict[Union[str, PrefixPrefixPrefix], Union[dict, "Prefix"]], list[Union[dict, "Prefix"]]]], +) + +slots.setting_key = Slot( + uri=LINKML.setting_key, + name="setting_key", + curie=LINKML.curie("setting_key"), + model_uri=LINKML.setting_key, + domain=Setting, + range=Union[str, SettingSettingKey], +) + +slots.setting_value = Slot( + uri=LINKML.setting_value, + name="setting_value", + curie=LINKML.curie("setting_value"), + model_uri=LINKML.setting_value, + domain=Setting, + range=str, +) + +slots.settings = Slot( + uri=LINKML.settings, + name="settings", + curie=LINKML.curie("settings"), + model_uri=LINKML.settings, + domain=SchemaDefinition, + range=Optional[Union[dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], list[Union[dict, "Setting"]]]], +) + +slots.import_from = Slot( + uri=LINKML.import_from, + name="import_from", + curie=LINKML.curie("import_from"), + model_uri=LINKML.import_from, + domain=ImportExpression, + range=Union[str, URIorCURIE], +) + +slots.import_as = Slot( + uri=LINKML.import_as, + name="import_as", + curie=LINKML.curie("import_as"), + model_uri=LINKML.import_as, + domain=ImportExpression, + range=Optional[Union[str, NCName]], +) + +slots.import_map = Slot( + uri=LINKML.import_map, + name="import_map", + curie=LINKML.curie("import_map"), + model_uri=LINKML.import_map, + domain=ImportExpression, + range=Optional[Union[dict[Union[str, SettingSettingKey], Union[dict, "Setting"]], list[Union[dict, "Setting"]]]], +) + +slots.local_name_source = Slot( + uri=LINKML.local_name_source, + name="local_name_source", + curie=LINKML.curie("local_name_source"), + model_uri=LINKML.local_name_source, + domain=LocalName, + range=Union[str, LocalNameLocalNameSource], +) + +slots.local_name_value = Slot( + uri=SKOS.altLabel, + name="local_name_value", + curie=SKOS.curie("altLabel"), + model_uri=LINKML.local_name_value, + domain=LocalName, + range=str, +) + +slots.local_names = Slot( + uri=LINKML.local_names, + name="local_names", + curie=LINKML.curie("local_names"), + model_uri=LINKML.local_names, + domain=Element, + range=Optional[ + Union[dict[Union[str, LocalNameLocalNameSource], Union[dict, "LocalName"]], list[Union[dict, "LocalName"]]] + ], +) + +slots.slot_group = Slot( + uri=SH.group, + name="slot_group", + curie=SH.curie("group"), + model_uri=LINKML.slot_group, + domain=SlotDefinition, + range=Optional[Union[str, SlotDefinitionName]], +) + +slots.is_grouping_slot = Slot( + uri=LINKML.is_grouping_slot, + name="is_grouping_slot", + curie=LINKML.curie("is_grouping_slot"), + model_uri=LINKML.is_grouping_slot, + domain=SlotDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.followed_by = Slot( + uri=LINKML.followed_by, + name="followed_by", + curie=LINKML.curie("followed_by"), + model_uri=LINKML.followed_by, + domain=None, + range=Optional[Union[dict, Expression]], +) + +slots.reversed = Slot( + uri=LINKML.reversed, + name="reversed", + curie=LINKML.curie("reversed"), + model_uri=LINKML.reversed, + domain=None, + range=Optional[Union[bool, Bool]], +) + +slots.traverse = Slot( + uri=LINKML.traverse, + name="traverse", + curie=LINKML.curie("traverse"), + model_uri=LINKML.traverse, + domain=None, + range=Optional[Union[str, SlotDefinitionName]], +) + +slots.path_rule = Slot( + uri=LINKML.path_rule, + name="path_rule", + curie=LINKML.curie("path_rule"), + model_uri=LINKML.path_rule, + domain=SlotDefinition, + range=Optional[Union[dict, PathExpression]], +) + +slots.represents_relationship = Slot( + uri=LINKML.represents_relationship, + name="represents_relationship", + curie=LINKML.curie("represents_relationship"), + model_uri=LINKML.represents_relationship, + domain=ClassDefinition, + range=Optional[Union[bool, Bool]], +) + +slots.relational_role = Slot( + uri=LINKML.relational_role, + name="relational_role", + curie=LINKML.curie("relational_role"), + model_uri=LINKML.relational_role, + domain=SlotDefinition, + range=Optional[Union[str, "RelationalRoleEnum"]], +) + +slots.schema_definition_name = Slot( + uri=RDFS.label, + name="schema_definition_name", + curie=RDFS.curie("label"), + model_uri=LINKML.schema_definition_name, + domain=SchemaDefinition, + range=Union[str, SchemaDefinitionName], +) + +slots.type_expression_any_of = Slot( + uri=LINKML.any_of, + name="type_expression_any_of", + curie=LINKML.curie("any_of"), + model_uri=LINKML.type_expression_any_of, + domain=None, + range=Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]], +) + +slots.type_expression_all_of = Slot( + uri=LINKML.all_of, + name="type_expression_all_of", + curie=LINKML.curie("all_of"), + model_uri=LINKML.type_expression_all_of, + domain=None, + range=Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]], +) + +slots.type_expression_exactly_one_of = Slot( + uri=LINKML.exactly_one_of, + name="type_expression_exactly_one_of", + curie=LINKML.curie("exactly_one_of"), + model_uri=LINKML.type_expression_exactly_one_of, + domain=None, + range=Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]], +) + +slots.type_expression_none_of = Slot( + uri=LINKML.none_of, + name="type_expression_none_of", + curie=LINKML.curie("none_of"), + model_uri=LINKML.type_expression_none_of, + domain=None, + range=Optional[Union[Union[dict, "AnonymousTypeExpression"], list[Union[dict, "AnonymousTypeExpression"]]]], +) + +slots.type_definition_union_of = Slot( + uri=LINKML.union_of, + name="type_definition_union_of", + curie=LINKML.curie("union_of"), + model_uri=LINKML.type_definition_union_of, + domain=TypeDefinition, + range=Optional[Union[Union[str, TypeDefinitionName], list[Union[str, TypeDefinitionName]]]], +) + +slots.enum_binding_range = Slot( + uri=LINKML.range, + name="enum_binding_range", + curie=LINKML.curie("range"), + model_uri=LINKML.enum_binding_range, + domain=EnumBinding, + range=Optional[Union[str, EnumDefinitionName]], +) + +slots.structured_alias_categories = Slot( + uri=DCTERMS.subject, + name="structured_alias_categories", + curie=DCTERMS.curie("subject"), + model_uri=LINKML.structured_alias_categories, + domain=StructuredAlias, + range=Optional[Union[Union[str, URIorCURIE], list[Union[str, URIorCURIE]]]], +) + +slots.path_expression_followed_by = Slot( + uri=LINKML.followed_by, + name="path_expression_followed_by", + curie=LINKML.curie("followed_by"), + model_uri=LINKML.path_expression_followed_by, + domain=PathExpression, + range=Optional[Union[dict, "PathExpression"]], +) + +slots.path_expression_any_of = Slot( + uri=LINKML.any_of, + name="path_expression_any_of", + curie=LINKML.curie("any_of"), + model_uri=LINKML.path_expression_any_of, + domain=PathExpression, + range=Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]], +) + +slots.path_expression_exactly_one_of = Slot( + uri=LINKML.exactly_one_of, + name="path_expression_exactly_one_of", + curie=LINKML.curie("exactly_one_of"), + model_uri=LINKML.path_expression_exactly_one_of, + domain=PathExpression, + range=Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]], +) + +slots.path_expression_none_of = Slot( + uri=LINKML.none_of, + name="path_expression_none_of", + curie=LINKML.curie("none_of"), + model_uri=LINKML.path_expression_none_of, + domain=PathExpression, + range=Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]], +) + +slots.path_expression_all_of = Slot( + uri=LINKML.all_of, + name="path_expression_all_of", + curie=LINKML.curie("all_of"), + model_uri=LINKML.path_expression_all_of, + domain=PathExpression, + range=Optional[Union[Union[dict, "PathExpression"], list[Union[dict, "PathExpression"]]]], +) + +slots.slot_expression_any_of = Slot( + uri=LINKML.any_of, + name="slot_expression_any_of", + curie=LINKML.curie("any_of"), + model_uri=LINKML.slot_expression_any_of, + domain=None, + range=Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]], +) + +slots.slot_expression_all_of = Slot( + uri=LINKML.all_of, + name="slot_expression_all_of", + curie=LINKML.curie("all_of"), + model_uri=LINKML.slot_expression_all_of, + domain=None, + range=Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]], +) + +slots.slot_expression_exactly_one_of = Slot( + uri=LINKML.exactly_one_of, + name="slot_expression_exactly_one_of", + curie=LINKML.curie("exactly_one_of"), + model_uri=LINKML.slot_expression_exactly_one_of, + domain=None, + range=Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]], +) + +slots.slot_expression_none_of = Slot( + uri=LINKML.none_of, + name="slot_expression_none_of", + curie=LINKML.curie("none_of"), + model_uri=LINKML.slot_expression_none_of, + domain=None, + range=Optional[Union[Union[dict, "AnonymousSlotExpression"], list[Union[dict, "AnonymousSlotExpression"]]]], +) + +slots.slot_definition_is_a = Slot( + uri=LINKML.is_a, + name="slot_definition_is_a", + curie=LINKML.curie("is_a"), + model_uri=LINKML.slot_definition_is_a, + domain=SlotDefinition, + range=Optional[Union[str, SlotDefinitionName]], +) + +slots.slot_definition_mixins = Slot( + uri=LINKML.mixins, + name="slot_definition_mixins", + curie=LINKML.curie("mixins"), + model_uri=LINKML.slot_definition_mixins, + domain=SlotDefinition, + range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]], +) + +slots.slot_definition_apply_to = Slot( + uri=LINKML.apply_to, + name="slot_definition_apply_to", + curie=LINKML.curie("apply_to"), + model_uri=LINKML.slot_definition_apply_to, + domain=SlotDefinition, + range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]], +) + +slots.slot_definition_disjoint_with = Slot( + uri=LINKML.disjoint_with, + name="slot_definition_disjoint_with", + curie=LINKML.curie("disjoint_with"), + model_uri=LINKML.slot_definition_disjoint_with, + domain=SlotDefinition, + range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]], +) + +slots.slot_definition_union_of = Slot( + uri=LINKML.union_of, + name="slot_definition_union_of", + curie=LINKML.curie("union_of"), + model_uri=LINKML.slot_definition_union_of, + domain=SlotDefinition, + range=Optional[Union[Union[str, SlotDefinitionName], list[Union[str, SlotDefinitionName]]]], +) + +slots.class_expression_any_of = Slot( + uri=LINKML.any_of, + name="class_expression_any_of", + curie=LINKML.curie("any_of"), + model_uri=LINKML.class_expression_any_of, + domain=None, + range=Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]], +) + +slots.class_expression_all_of = Slot( + uri=LINKML.all_of, + name="class_expression_all_of", + curie=LINKML.curie("all_of"), + model_uri=LINKML.class_expression_all_of, + domain=None, + range=Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]], +) + +slots.class_expression_exactly_one_of = Slot( + uri=LINKML.exactly_one_of, + name="class_expression_exactly_one_of", + curie=LINKML.curie("exactly_one_of"), + model_uri=LINKML.class_expression_exactly_one_of, + domain=None, + range=Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]], +) + +slots.class_expression_none_of = Slot( + uri=LINKML.none_of, + name="class_expression_none_of", + curie=LINKML.curie("none_of"), + model_uri=LINKML.class_expression_none_of, + domain=None, + range=Optional[Union[Union[dict, "AnonymousClassExpression"], list[Union[dict, "AnonymousClassExpression"]]]], +) + +slots.class_definition_is_a = Slot( + uri=LINKML.is_a, + name="class_definition_is_a", + curie=LINKML.curie("is_a"), + model_uri=LINKML.class_definition_is_a, + domain=ClassDefinition, + range=Optional[Union[str, ClassDefinitionName]], +) + +slots.class_definition_mixins = Slot( + uri=LINKML.mixins, + name="class_definition_mixins", + curie=LINKML.curie("mixins"), + model_uri=LINKML.class_definition_mixins, + domain=ClassDefinition, + range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]], +) + +slots.class_definition_apply_to = Slot( + uri=LINKML.apply_to, + name="class_definition_apply_to", + curie=LINKML.curie("apply_to"), + model_uri=LINKML.class_definition_apply_to, + domain=ClassDefinition, + range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]], +) + +slots.class_definition_rules = Slot( + uri=SH.rule, + name="class_definition_rules", + curie=SH.curie("rule"), + model_uri=LINKML.class_definition_rules, + domain=ClassDefinition, + range=Optional[Union[Union[dict, "ClassRule"], list[Union[dict, "ClassRule"]]]], +) + +slots.class_definition_disjoint_with = Slot( + uri=LINKML.disjoint_with, + name="class_definition_disjoint_with", + curie=LINKML.curie("disjoint_with"), + model_uri=LINKML.class_definition_disjoint_with, + domain=ClassDefinition, + range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]], +) + +slots.class_definition_union_of = Slot( + uri=LINKML.union_of, + name="class_definition_union_of", + curie=LINKML.curie("union_of"), + model_uri=LINKML.class_definition_union_of, + domain=ClassDefinition, + range=Optional[Union[Union[str, ClassDefinitionName], list[Union[str, ClassDefinitionName]]]], +) + +slots.permissible_value_is_a = Slot( + uri=LINKML.is_a, + name="permissible_value_is_a", + curie=LINKML.curie("is_a"), + model_uri=LINKML.permissible_value_is_a, + domain=PermissibleValue, + range=Optional[Union[str, PermissibleValueText]], +) + +slots.permissible_value_mixins = Slot( + uri=LINKML.mixins, + name="permissible_value_mixins", + curie=LINKML.curie("mixins"), + model_uri=LINKML.permissible_value_mixins, + domain=PermissibleValue, + range=Optional[Union[Union[str, PermissibleValueText], list[Union[str, PermissibleValueText]]]], +) diff --git a/linkml_runtime/linkml_model/types.py b/linkml_runtime/linkml_model/types.py index f60eac8a..65864fd0 100644 --- a/linkml_runtime/linkml_model/types.py +++ b/linkml_runtime/linkml_model/types.py @@ -9,22 +9,35 @@ import dataclasses from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.utils.metamodelcore import Bool, Curie, Decimal, ElementIdentifier, NCName, NodeIdentifier, URI, URIorCURIE, XSDDate, XSDDateTime, XSDTime +from linkml_runtime.utils.metamodelcore import ( + Bool, + Curie, + Decimal, + ElementIdentifier, + NCName, + NodeIdentifier, + URI, + URIorCURIE, + XSDDate, + XSDDateTime, + XSDTime, +) metamodel_version = "1.7.0" version = None # Namespaces -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -SCHEMA = CurieNamespace('schema', 'http://schema.org/') -SHEX = CurieNamespace('shex', 'http://www.w3.org/ns/shex#') -XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +SCHEMA = CurieNamespace("schema", "http://schema.org/") +SHEX = CurieNamespace("shex", "http://www.w3.org/ns/shex#") +XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") DEFAULT_ = LINKML # Types class String(str): - """ A character string """ + """A character string""" + type_class_uri = XSD["string"] type_class_curie = "xsd:string" type_name = "string" @@ -32,7 +45,8 @@ class String(str): class Integer(int): - """ An integer """ + """An integer""" + type_class_uri = XSD["integer"] type_class_curie = "xsd:integer" type_name = "integer" @@ -40,7 +54,8 @@ class Integer(int): class Boolean(Bool): - """ A binary (true or false) value """ + """A binary (true or false) value""" + type_class_uri = XSD["boolean"] type_class_curie = "xsd:boolean" type_name = "boolean" @@ -48,7 +63,8 @@ class Boolean(Bool): class Float(float): - """ A real number that conforms to the xsd:float specification """ + """A real number that conforms to the xsd:float specification""" + type_class_uri = XSD["float"] type_class_curie = "xsd:float" type_name = "float" @@ -56,7 +72,8 @@ class Float(float): class Double(float): - """ A real number that conforms to the xsd:double specification """ + """A real number that conforms to the xsd:double specification""" + type_class_uri = XSD["double"] type_class_curie = "xsd:double" type_name = "double" @@ -64,7 +81,8 @@ class Double(float): class Decimal(Decimal): - """ A real number with arbitrary precision that conforms to the xsd:decimal specification """ + """A real number with arbitrary precision that conforms to the xsd:decimal specification""" + type_class_uri = XSD["decimal"] type_class_curie = "xsd:decimal" type_name = "decimal" @@ -72,7 +90,8 @@ class Decimal(Decimal): class Time(XSDTime): - """ A time object represents a (local) time of day, independent of any particular day """ + """A time object represents a (local) time of day, independent of any particular day""" + type_class_uri = XSD["time"] type_class_curie = "xsd:time" type_name = "time" @@ -80,7 +99,8 @@ class Time(XSDTime): class Date(XSDDate): - """ a date (year, month and day) in an idealized calendar """ + """a date (year, month and day) in an idealized calendar""" + type_class_uri = XSD["date"] type_class_curie = "xsd:date" type_name = "date" @@ -88,7 +108,8 @@ class Date(XSDDate): class Datetime(XSDDateTime): - """ The combination of a date and time """ + """The combination of a date and time""" + type_class_uri = XSD["dateTime"] type_class_curie = "xsd:dateTime" type_name = "datetime" @@ -96,7 +117,8 @@ class Datetime(XSDDateTime): class DateOrDatetime(str): - """ Either a date or a datetime """ + """Either a date or a datetime""" + type_class_uri = LINKML["DateOrDatetime"] type_class_curie = "linkml:DateOrDatetime" type_name = "date_or_datetime" @@ -104,7 +126,8 @@ class DateOrDatetime(str): class Uriorcurie(URIorCURIE): - """ a URI or a CURIE """ + """a URI or a CURIE""" + type_class_uri = XSD["anyURI"] type_class_curie = "xsd:anyURI" type_name = "uriorcurie" @@ -112,7 +135,8 @@ class Uriorcurie(URIorCURIE): class Curie(Curie): - """ a compact URI """ + """a compact URI""" + type_class_uri = XSD["string"] type_class_curie = "xsd:string" type_name = "curie" @@ -120,7 +144,8 @@ class Curie(Curie): class Uri(URI): - """ a complete URI """ + """a complete URI""" + type_class_uri = XSD["anyURI"] type_class_curie = "xsd:anyURI" type_name = "uri" @@ -128,7 +153,8 @@ class Uri(URI): class Ncname(NCName): - """ Prefix part of CURIE """ + """Prefix part of CURIE""" + type_class_uri = XSD["string"] type_class_curie = "xsd:string" type_name = "ncname" @@ -136,7 +162,8 @@ class Ncname(NCName): class Objectidentifier(ElementIdentifier): - """ A URI or CURIE that represents an object in the model. """ + """A URI or CURIE that represents an object in the model.""" + type_class_uri = SHEX["iri"] type_class_curie = "shex:iri" type_name = "objectidentifier" @@ -144,7 +171,8 @@ class Objectidentifier(ElementIdentifier): class Nodeidentifier(NodeIdentifier): - """ A URI, CURIE or BNODE that represents a node in a model. """ + """A URI, CURIE or BNODE that represents a node in a model.""" + type_class_uri = SHEX["nonLiteral"] type_class_curie = "shex:nonLiteral" type_name = "nodeidentifier" @@ -152,7 +180,8 @@ class Nodeidentifier(NodeIdentifier): class Jsonpointer(str): - """ A string encoding a JSON Pointer. The value of the string MUST conform to JSON Point syntax and SHOULD dereference to a valid object within the current instance document when encoded in tree form. """ + """A string encoding a JSON Pointer. The value of the string MUST conform to JSON Point syntax and SHOULD dereference to a valid object within the current instance document when encoded in tree form.""" + type_class_uri = XSD["string"] type_class_curie = "xsd:string" type_name = "jsonpointer" @@ -160,7 +189,8 @@ class Jsonpointer(str): class Jsonpath(str): - """ A string encoding a JSON Path. The value of the string MUST conform to JSON Point syntax and SHOULD dereference to zero or more valid objects within the current instance document when encoded in tree form. """ + """A string encoding a JSON Path. The value of the string MUST conform to JSON Point syntax and SHOULD dereference to zero or more valid objects within the current instance document when encoded in tree form.""" + type_class_uri = XSD["string"] type_class_curie = "xsd:string" type_name = "jsonpath" @@ -168,7 +198,8 @@ class Jsonpath(str): class Sparqlpath(str): - """ A string encoding a SPARQL Property Path. The value of the string MUST conform to SPARQL syntax and SHOULD dereference to zero or more valid objects within the current instance document when encoded as RDF. """ + """A string encoding a SPARQL Property Path. The value of the string MUST conform to SPARQL syntax and SHOULD dereference to zero or more valid objects within the current instance document when encoded as RDF.""" + type_class_uri = XSD["string"] type_class_curie = "xsd:string" type_name = "sparqlpath" @@ -178,13 +209,9 @@ class Sparqlpath(str): # Class references - - # Enumerations # Slots class slots: pass - - diff --git a/linkml_runtime/linkml_model/units.py b/linkml_runtime/linkml_model/units.py index e14943aa..af39289a 100644 --- a/linkml_runtime/linkml_model/units.py +++ b/linkml_runtime/linkml_model/units.py @@ -21,14 +21,14 @@ version = None # Namespaces -IAO = CurieNamespace('IAO', 'http://purl.obolibrary.org/obo/IAO_') -OIO = CurieNamespace('OIO', 'http://www.geneontology.org/formats/oboInOwl#') -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -QUDT = CurieNamespace('qudt', 'http://qudt.org/schema/qudt/') -RDF = CurieNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#') -RDFS = CurieNamespace('rdfs', 'http://www.w3.org/2000/01/rdf-schema#') -SKOS = CurieNamespace('skos', 'http://www.w3.org/2004/02/skos/core#') -XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') +IAO = CurieNamespace("IAO", "http://purl.obolibrary.org/obo/IAO_") +OIO = CurieNamespace("OIO", "http://www.geneontology.org/formats/oboInOwl#") +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +QUDT = CurieNamespace("qudt", "http://qudt.org/schema/qudt/") +RDF = CurieNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") +RDFS = CurieNamespace("rdfs", "http://www.w3.org/2000/01/rdf-schema#") +SKOS = CurieNamespace("skos", "http://www.w3.org/2004/02/skos/core#") +XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") DEFAULT_ = LINKML @@ -37,13 +37,13 @@ # Class references - @dataclass class UnitOfMeasure(YAMLRoot): """ A unit of measure, or unit, is a particular quantity value that has been chosen as a scale for measuring other quantities the same kind (more generally of equivalent dimension). """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = QUDT["Unit"] @@ -96,26 +96,75 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): class slots: pass -slots.unit = Slot(uri=QUDT.unit, name="unit", curie=QUDT.curie('unit'), - model_uri=LINKML.unit, domain=None, range=Optional[Union[dict, UnitOfMeasure]]) - -slots.ucum_code = Slot(uri=QUDT.ucumCode, name="ucum_code", curie=QUDT.curie('ucumCode'), - model_uri=LINKML.ucum_code, domain=UnitOfMeasure, range=Optional[str]) - -slots.derivation = Slot(uri=LINKML.derivation, name="derivation", curie=LINKML.curie('derivation'), - model_uri=LINKML.derivation, domain=None, range=Optional[str]) - -slots.has_quantity_kind = Slot(uri=QUDT.hasQuantityKind, name="has_quantity_kind", curie=QUDT.curie('hasQuantityKind'), - model_uri=LINKML.has_quantity_kind, domain=None, range=Optional[Union[str, URIorCURIE]]) - -slots.iec61360code = Slot(uri=QUDT.iec61360Code, name="iec61360code", curie=QUDT.curie('iec61360Code'), - model_uri=LINKML.iec61360code, domain=None, range=Optional[str]) - -slots.symbol = Slot(uri=QUDT.symbol, name="symbol", curie=QUDT.curie('symbol'), - model_uri=LINKML.symbol, domain=None, range=Optional[str]) - -slots.abbreviation = Slot(uri=QUDT.abbreviation, name="abbreviation", curie=QUDT.curie('abbreviation'), - model_uri=LINKML.abbreviation, domain=None, range=Optional[str]) -slots.descriptive_name = Slot(uri=RDFS.label, name="descriptive_name", curie=RDFS.curie('label'), - model_uri=LINKML.descriptive_name, domain=None, range=Optional[str]) +slots.unit = Slot( + uri=QUDT.unit, + name="unit", + curie=QUDT.curie("unit"), + model_uri=LINKML.unit, + domain=None, + range=Optional[Union[dict, UnitOfMeasure]], +) + +slots.ucum_code = Slot( + uri=QUDT.ucumCode, + name="ucum_code", + curie=QUDT.curie("ucumCode"), + model_uri=LINKML.ucum_code, + domain=UnitOfMeasure, + range=Optional[str], +) + +slots.derivation = Slot( + uri=LINKML.derivation, + name="derivation", + curie=LINKML.curie("derivation"), + model_uri=LINKML.derivation, + domain=None, + range=Optional[str], +) + +slots.has_quantity_kind = Slot( + uri=QUDT.hasQuantityKind, + name="has_quantity_kind", + curie=QUDT.curie("hasQuantityKind"), + model_uri=LINKML.has_quantity_kind, + domain=None, + range=Optional[Union[str, URIorCURIE]], +) + +slots.iec61360code = Slot( + uri=QUDT.iec61360Code, + name="iec61360code", + curie=QUDT.curie("iec61360Code"), + model_uri=LINKML.iec61360code, + domain=None, + range=Optional[str], +) + +slots.symbol = Slot( + uri=QUDT.symbol, + name="symbol", + curie=QUDT.curie("symbol"), + model_uri=LINKML.symbol, + domain=None, + range=Optional[str], +) + +slots.abbreviation = Slot( + uri=QUDT.abbreviation, + name="abbreviation", + curie=QUDT.curie("abbreviation"), + model_uri=LINKML.abbreviation, + domain=None, + range=Optional[str], +) + +slots.descriptive_name = Slot( + uri=RDFS.label, + name="descriptive_name", + curie=RDFS.curie("label"), + model_uri=LINKML.descriptive_name, + domain=None, + range=Optional[str], +) diff --git a/linkml_runtime/linkml_model/validation.py b/linkml_runtime/linkml_model/validation.py index e506a401..423a0036 100644 --- a/linkml_runtime/linkml_model/validation.py +++ b/linkml_runtime/linkml_model/validation.py @@ -23,16 +23,16 @@ version = None # Namespaces -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -OWL = CurieNamespace('owl', 'http://www.w3.org/2002/07/owl#') -PAV = CurieNamespace('pav', 'http://purl.org/pav/') -RDF = CurieNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#') -RDFS = CurieNamespace('rdfs', 'http://www.w3.org/2000/01/rdf-schema#') -REPORTING = CurieNamespace('reporting', 'https://w3id.org/linkml/report') -SCHEMA = CurieNamespace('schema', 'http://schema.org/') -SH = CurieNamespace('sh', 'https://w3id.org/shacl/') -SKOS = CurieNamespace('skos', 'http://www.w3.org/2004/02/skos/core#') -XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +OWL = CurieNamespace("owl", "http://www.w3.org/2002/07/owl#") +PAV = CurieNamespace("pav", "http://purl.org/pav/") +RDF = CurieNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") +RDFS = CurieNamespace("rdfs", "http://www.w3.org/2000/01/rdf-schema#") +REPORTING = CurieNamespace("reporting", "https://w3id.org/linkml/report") +SCHEMA = CurieNamespace("schema", "http://schema.org/") +SH = CurieNamespace("sh", "https://w3id.org/shacl/") +SKOS = CurieNamespace("skos", "http://www.w3.org/2004/02/skos/core#") +XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") DEFAULT_ = REPORTING @@ -41,12 +41,12 @@ # Class references - @dataclass class ValidationReport(YAMLRoot): """ A report object """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SH["ValidationReport"] @@ -69,6 +69,7 @@ class ValidationResult(YAMLRoot): """ An individual result arising from validation of a data instance using a particular rule """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SH["ValidationResult"] @@ -122,74 +123,131 @@ class ProblemType(EnumDefinitionImpl): undeclared_slot = PermissibleValue( text="undeclared_slot", - description="Applies when a slot is used in data but the slot is undeclared in the datamodel") + description="Applies when a slot is used in data but the slot is undeclared in the datamodel", + ) inapplicable_slot = PermissibleValue( text="inapplicable_slot", - description="""Applies when a slot is used in an instance of a class where the slot is not applicable for that class""") + description="""Applies when a slot is used in an instance of a class where the slot is not applicable for that class""", + ) missing_slot_value = PermissibleValue( text="missing_slot_value", - description="Applies when an instance of a class has a required slot which is not filled in") + description="Applies when an instance of a class has a required slot which is not filled in", + ) slot_range_violation = PermissibleValue( text="slot_range_violation", - description="Applies when the value of a slot is inconsistent with the declared range") - max_count_violation = PermissibleValue( - text="max_count_violation", - meaning=SH["MaxCountConstraintComponent"]) - parsing_error = PermissibleValue( - text="parsing_error", - description="The data could not be parsed") + description="Applies when the value of a slot is inconsistent with the declared range", + ) + max_count_violation = PermissibleValue(text="max_count_violation", meaning=SH["MaxCountConstraintComponent"]) + parsing_error = PermissibleValue(text="parsing_error", description="The data could not be parsed") _defn = EnumDefinition( name="ProblemType", ) + class SeverityOptions(EnumDefinitionImpl): FATAL = PermissibleValue(text="FATAL") - ERROR = PermissibleValue( - text="ERROR", - meaning=SH["Violation"]) - WARNING = PermissibleValue( - text="WARNING", - meaning=SH["Warning"]) - INFO = PermissibleValue( - text="INFO", - meaning=SH["Info"]) + ERROR = PermissibleValue(text="ERROR", meaning=SH["Violation"]) + WARNING = PermissibleValue(text="WARNING", meaning=SH["Warning"]) + INFO = PermissibleValue(text="INFO", meaning=SH["Info"]) _defn = EnumDefinition( name="SeverityOptions", ) + # Slots class slots: pass -slots.type = Slot(uri=SH.sourceConstraintComponent, name="type", curie=SH.curie('sourceConstraintComponent'), - model_uri=REPORTING.type, domain=None, range=Optional[Union[str, NodeIdentifier]]) - -slots.subject = Slot(uri=SH.focusNode, name="subject", curie=SH.curie('focusNode'), - model_uri=REPORTING.subject, domain=None, range=Optional[Union[str, NodeIdentifier]]) - -slots.instantiates = Slot(uri=REPORTING.instantiates, name="instantiates", curie=REPORTING.curie('instantiates'), - model_uri=REPORTING.instantiates, domain=None, range=Optional[Union[str, NodeIdentifier]]) - -slots.predicate = Slot(uri=REPORTING.predicate, name="predicate", curie=REPORTING.curie('predicate'), - model_uri=REPORTING.predicate, domain=None, range=Optional[Union[str, NodeIdentifier]]) - -slots.object = Slot(uri=SH.value, name="object", curie=SH.curie('value'), - model_uri=REPORTING.object, domain=None, range=Optional[Union[str, NodeIdentifier]]) - -slots.object_str = Slot(uri=REPORTING.object_str, name="object_str", curie=REPORTING.curie('object_str'), - model_uri=REPORTING.object_str, domain=None, range=Optional[str]) - -slots.node_source = Slot(uri=REPORTING.node_source, name="node_source", curie=REPORTING.curie('node_source'), - model_uri=REPORTING.node_source, domain=None, range=Optional[Union[str, NodeIdentifier]]) - -slots.severity = Slot(uri=REPORTING.severity, name="severity", curie=REPORTING.curie('severity'), - model_uri=REPORTING.severity, domain=None, range=Optional[Union[str, "SeverityOptions"]]) - -slots.info = Slot(uri=REPORTING.info, name="info", curie=REPORTING.curie('info'), - model_uri=REPORTING.info, domain=None, range=Optional[str]) -slots.validationReport__results = Slot(uri=REPORTING.results, name="validationReport__results", curie=REPORTING.curie('results'), - model_uri=REPORTING.validationReport__results, domain=None, range=Optional[Union[Union[dict, ValidationResult], list[Union[dict, ValidationResult]]]]) +slots.type = Slot( + uri=SH.sourceConstraintComponent, + name="type", + curie=SH.curie("sourceConstraintComponent"), + model_uri=REPORTING.type, + domain=None, + range=Optional[Union[str, NodeIdentifier]], +) + +slots.subject = Slot( + uri=SH.focusNode, + name="subject", + curie=SH.curie("focusNode"), + model_uri=REPORTING.subject, + domain=None, + range=Optional[Union[str, NodeIdentifier]], +) + +slots.instantiates = Slot( + uri=REPORTING.instantiates, + name="instantiates", + curie=REPORTING.curie("instantiates"), + model_uri=REPORTING.instantiates, + domain=None, + range=Optional[Union[str, NodeIdentifier]], +) + +slots.predicate = Slot( + uri=REPORTING.predicate, + name="predicate", + curie=REPORTING.curie("predicate"), + model_uri=REPORTING.predicate, + domain=None, + range=Optional[Union[str, NodeIdentifier]], +) + +slots.object = Slot( + uri=SH.value, + name="object", + curie=SH.curie("value"), + model_uri=REPORTING.object, + domain=None, + range=Optional[Union[str, NodeIdentifier]], +) + +slots.object_str = Slot( + uri=REPORTING.object_str, + name="object_str", + curie=REPORTING.curie("object_str"), + model_uri=REPORTING.object_str, + domain=None, + range=Optional[str], +) + +slots.node_source = Slot( + uri=REPORTING.node_source, + name="node_source", + curie=REPORTING.curie("node_source"), + model_uri=REPORTING.node_source, + domain=None, + range=Optional[Union[str, NodeIdentifier]], +) + +slots.severity = Slot( + uri=REPORTING.severity, + name="severity", + curie=REPORTING.curie("severity"), + model_uri=REPORTING.severity, + domain=None, + range=Optional[Union[str, "SeverityOptions"]], +) + +slots.info = Slot( + uri=REPORTING.info, + name="info", + curie=REPORTING.curie("info"), + model_uri=REPORTING.info, + domain=None, + range=Optional[str], +) + +slots.validationReport__results = Slot( + uri=REPORTING.results, + name="validationReport__results", + curie=REPORTING.curie("results"), + model_uri=REPORTING.validationReport__results, + domain=None, + range=Optional[Union[Union[dict, ValidationResult], list[Union[dict, ValidationResult]]]], +) diff --git a/linkml_runtime/loaders/context_flattener.py b/linkml_runtime/loaders/context_flattener.py index dbcc814c..4bf0b686 100644 --- a/linkml_runtime/loaders/context_flattener.py +++ b/linkml_runtime/loaders/context_flattener.py @@ -8,7 +8,7 @@ def flatten_dict(ctxt: str, base: str, seen: Optional[list[str]] = None) -> dict def map_context(ctxt_ent: Union[str, dict, list], seen: list[str]) -> Union[dict, list]: if isinstance(ctxt_ent, str): ent_dict = flatten_dict(ctxt_ent, base, seen) - return ent_dict['@context'] if '@context' in ent_dict else ent_dict + return ent_dict["@context"] if "@context" in ent_dict else ent_dict elif isinstance(ctxt_ent, list): return [map_context(clent, seen) for clent in ctxt_ent] else: @@ -17,9 +17,9 @@ def map_context(ctxt_ent: Union[str, dict, list], seen: list[str]) -> Union[dict def map_dict(inp: dict, seen: list[str]) -> dict: rval = dict() for k, v in inp.items(): - if k == '@context': + if k == "@context": v = map_context(v, seen) - elif k == '@import': + elif k == "@import": v = {} elif isinstance(v, dict): v = map_dict(v, seen) @@ -39,7 +39,7 @@ def map_dict(inp: dict, seen: list[str]) -> dict: def flatten(ctxt: str, base: str) -> str: - print('_'*10 + f' Flattening {os.path.join(base, ctxt)}') + print("_" * 10 + f" Flattening {os.path.join(base, ctxt)}") return json.dumps(flatten_dict(ctxt, base), indent=2) diff --git a/linkml_runtime/loaders/csv_loader.py b/linkml_runtime/loaders/csv_loader.py index f8dc2cad..a7aef2e9 100644 --- a/linkml_runtime/loaders/csv_loader.py +++ b/linkml_runtime/loaders/csv_loader.py @@ -1,7 +1,8 @@ from linkml_runtime.loaders.delimited_file_loader import DelimitedFileLoader + class CSVLoader(DelimitedFileLoader): - + @property def delimiter(self): return "," diff --git a/linkml_runtime/loaders/delimited_file_loader.py b/linkml_runtime/loaders/delimited_file_loader.py index a3d965d1..4dccc813 100644 --- a/linkml_runtime/loaders/delimited_file_loader.py +++ b/linkml_runtime/loaders/delimited_file_loader.py @@ -12,6 +12,7 @@ from linkml_runtime.utils.schemaview import SchemaView from linkml_runtime.utils.csvutils import get_configmap + class DelimitedFileLoader(Loader, ABC): @property @@ -19,45 +20,55 @@ class DelimitedFileLoader(Loader, ABC): def delimiter(self): pass - def load_as_dict(self, - source: str, - index_slot: SlotDefinitionName = None, - schema: SchemaDefinition = None, - schemaview: SchemaView = None, - **kwargs) -> Union[dict, list[dict]]: + def load_as_dict( + self, + source: str, + index_slot: SlotDefinitionName = None, + schema: SchemaDefinition = None, + schemaview: SchemaView = None, + **kwargs, + ) -> Union[dict, list[dict]]: json_str = self._get_json_str_to_load(source, index_slot, schema, schemaview, **kwargs) return JSONLoader().load_as_dict(json_str) def load_any(self, *args, **kwargs) -> Union[YAMLRoot, list[YAMLRoot]]: return self.load(*args, **kwargs) - def loads(self, input, - target_class: type[Union[BaseModel, YAMLRoot]], - index_slot: SlotDefinitionName = None, - schema: SchemaDefinition = None, - schemaview: SchemaView = None, - **kwargs) -> str: + def loads( + self, + input, + target_class: type[Union[BaseModel, YAMLRoot]], + index_slot: SlotDefinitionName = None, + schema: SchemaDefinition = None, + schemaview: SchemaView = None, + **kwargs, + ) -> str: json_str = self._get_json_str_to_load(input, index_slot, schema, schemaview, **kwargs) return JSONLoader().loads(json_str, target_class=target_class) - def load(self, source: str, - target_class: type[Union[BaseModel, YAMLRoot]], - index_slot: SlotDefinitionName = None, - schema: SchemaDefinition = None, - schemaview: SchemaView = None, - **kwargs) -> str: + def load( + self, + source: str, + target_class: type[Union[BaseModel, YAMLRoot]], + index_slot: SlotDefinitionName = None, + schema: SchemaDefinition = None, + schemaview: SchemaView = None, + **kwargs, + ) -> str: json_str = self._get_json_str_to_load(source, index_slot, schema, schemaview, **kwargs) return JSONLoader().loads(json_str, target_class=target_class) - def _get_json_str_to_load(self, - input, - index_slot: SlotDefinitionName = None, - schema: SchemaDefinition = None, - schemaview: SchemaView = None, - **kwargs): + def _get_json_str_to_load( + self, + input, + index_slot: SlotDefinitionName = None, + schema: SchemaDefinition = None, + schemaview: SchemaView = None, + **kwargs, + ): if schemaview is None: schemaview = SchemaView(schema) configmap = get_configmap(schemaview, index_slot) config = GlobalConfig(key_configs=configmap, csv_delimiter=self.delimiter) objs = unflatten_from_csv(input, config=config, **kwargs) - return json.dumps({index_slot: objs}) \ No newline at end of file + return json.dumps({index_slot: objs}) diff --git a/linkml_runtime/loaders/json_loader.py b/linkml_runtime/loaders/json_loader.py index 34f89991..4ee1c555 100644 --- a/linkml_runtime/loaders/json_loader.py +++ b/linkml_runtime/loaders/json_loader.py @@ -13,26 +13,31 @@ class JSONLoader(Loader): - def load_as_dict(self, - source: Union[str, dict, TextIO], - *, - base_dir: Optional[str] = None, - metadata: Optional[FileInfo] = None) -> Union[dict, list[dict]]: - data = self._read_source(source, base_dir=base_dir, metadata=metadata, accept_header="application/ld+json, application/json, text/json") + def load_as_dict( + self, source: Union[str, dict, TextIO], *, base_dir: Optional[str] = None, metadata: Optional[FileInfo] = None + ) -> Union[dict, list[dict]]: + data = self._read_source( + source, + base_dir=base_dir, + metadata=metadata, + accept_header="application/ld+json, application/json, text/json", + ) data_as_dict = json.loads(data) if isinstance(data, str) else data return self.json_clean(data_as_dict) - def load_any(self, - source: Union[str, dict, TextIO], - target_class: type[Union[BaseModel, YAMLRoot]], - *, - base_dir: Optional[str] = None, - metadata: Optional[FileInfo] = None, - **_) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: + def load_any( + self, + source: Union[str, dict, TextIO], + target_class: type[Union[BaseModel, YAMLRoot]], + *, + base_dir: Optional[str] = None, + metadata: Optional[FileInfo] = None, + **_, + ) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: data_as_dict = self.load_as_dict(source, base_dir=base_dir, metadata=metadata) if isinstance(data_as_dict, dict): - typ = data_as_dict.pop('@type', None) + typ = data_as_dict.pop("@type", None) if typ and typ != target_class.__name__: logger.warning(f"Warning: input type mismatch. Expected: {target_class.__name__}, Actual: {typ}") diff --git a/linkml_runtime/loaders/loader_root.py b/linkml_runtime/loaders/loader_root.py index 137d9913..8a5c92b7 100644 --- a/linkml_runtime/loaders/loader_root.py +++ b/linkml_runtime/loaders/loader_root.py @@ -12,7 +12,6 @@ CACHE_SIZE = 1024 - class Loader(ABC): @staticmethod @@ -23,29 +22,32 @@ def json_clean(inp: Any) -> Any: :param inp: JSON-LD representation :return: JSON representation """ + def _is_empty(o) -> bool: return o is None or o == [] or o == {} if isinstance(inp, list): for e in [inp_e for inp_e in inp if _is_empty(inp_e)]: - del(inp[e]) + del inp[e] for e in inp: Loader.json_clean(e) elif isinstance(inp, dict): for k, v in list(inp.items()): - if k.startswith('@') or _is_empty(v): - del(inp[k]) + if k.startswith("@") or _is_empty(v): + del inp[k] else: Loader.json_clean(v) return inp - def load_source(self, - source: Union[str, dict, TextIO], - loader: Callable[[Union[str, dict], FileInfo], Optional[Union[dict, list]]], - target_class: Union[type[YAMLRoot], type[BaseModel]], - accept_header: Optional[str] = "text/plain, application/yaml;q=0.9", - metadata: Optional[FileInfo] = None) -> Optional[Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]]: - """ Base loader - convert a file, url, string, open file handle or dictionary into an instance + def load_source( + self, + source: Union[str, dict, TextIO], + loader: Callable[[Union[str, dict], FileInfo], Optional[Union[dict, list]]], + target_class: Union[type[YAMLRoot], type[BaseModel]], + accept_header: Optional[str] = "text/plain, application/yaml;q=0.9", + metadata: Optional[FileInfo] = None, + ) -> Optional[Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]]: + """Base loader - convert a file, url, string, open file handle or dictionary into an instance of target_class :param source: URL, file name, block of text, Existing Object or open file handle @@ -61,7 +63,6 @@ def load_source(self, data_as_dict = loader(data, metadata) return self._construct_target_class(data_as_dict, target_class=target_class) - def load(self, *args, **kwargs) -> Union[BaseModel, YAMLRoot]: """ Load source as an instance of target_class @@ -77,14 +78,21 @@ def load(self, *args, **kwargs) -> Union[BaseModel, YAMLRoot]: if isinstance(results, BaseModel) or isinstance(results, YAMLRoot): return results else: - raise ValueError(f'Result is not an instance of BaseModel or YAMLRoot: {type(results)}') - + raise ValueError(f"Result is not an instance of BaseModel or YAMLRoot: {type(results)}") + def load_as_dict(self, *args, **kwargs) -> Union[dict, list[dict]]: raise NotImplementedError() @abstractmethod - def load_any(self, source: Union[str, dict, TextIO], target_class: type[Union[BaseModel, YAMLRoot]], *, base_dir: Optional[str] = None, - metadata: Optional[FileInfo] = None, **_) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: + def load_any( + self, + source: Union[str, dict, TextIO], + target_class: type[Union[BaseModel, YAMLRoot]], + *, + base_dir: Optional[str] = None, + metadata: Optional[FileInfo] = None, + **_, + ) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: """ Load source as an instance of target_class, or list of instances of target_class @@ -97,7 +105,9 @@ def load_any(self, source: Union[str, dict, TextIO], target_class: type[Union[Ba """ raise NotImplementedError() - def loads_any(self, source: str, target_class: type[Union[BaseModel, YAMLRoot]], *, metadata: Optional[FileInfo] = None, **_) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: + def loads_any( + self, source: str, target_class: type[Union[BaseModel, YAMLRoot]], *, metadata: Optional[FileInfo] = None, **_ + ) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: """ Load source as a string as an instance of target_class, or list of instances of target_class @param source: source @@ -108,7 +118,9 @@ def loads_any(self, source: str, target_class: type[Union[BaseModel, YAMLRoot]], """ return self.load_any(source, target_class, metadata=metadata) - def loads(self, source: str, target_class: type[Union[BaseModel, YAMLRoot]], *, metadata: Optional[FileInfo] = None, **_) -> Union[BaseModel, YAMLRoot]: + def loads( + self, source: str, target_class: type[Union[BaseModel, YAMLRoot]], *, metadata: Optional[FileInfo] = None, **_ + ) -> Union[BaseModel, YAMLRoot]: """ Load source as a string :param source: source @@ -119,17 +131,17 @@ def loads(self, source: str, target_class: type[Union[BaseModel, YAMLRoot]], *, """ return self.load(source, target_class, metadata=metadata) - def _construct_target_class(self, - data_as_dict: Union[dict, list[dict]], - target_class: Union[type[YAMLRoot], type[BaseModel]]) -> Optional[Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]]: + def _construct_target_class( + self, data_as_dict: Union[dict, list[dict]], target_class: Union[type[YAMLRoot], type[BaseModel]] + ) -> Optional[Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]]: if data_as_dict: if isinstance(data_as_dict, list): - if issubclass(target_class, YAMLRoot): - return [target_class(**as_dict(x)) for x in data_as_dict] - elif issubclass(target_class, BaseModel): - return [target_class.model_validate(as_dict(x)) for x in data_as_dict] - else: - raise ValueError(f'Cannot load list of {target_class}') + if issubclass(target_class, YAMLRoot): + return [target_class(**as_dict(x)) for x in data_as_dict] + elif issubclass(target_class, BaseModel): + return [target_class.model_validate(as_dict(x)) for x in data_as_dict] + else: + raise ValueError(f"Cannot load list of {target_class}") elif isinstance(data_as_dict, dict): if issubclass(target_class, BaseModel): return target_class.model_validate(data_as_dict) @@ -138,17 +150,18 @@ def _construct_target_class(self, elif isinstance(data_as_dict, JsonObj): return [target_class(**as_dict(x)) for x in data_as_dict] else: - raise ValueError(f'Unexpected type {data_as_dict}') + raise ValueError(f"Unexpected type {data_as_dict}") else: return None - - def _read_source(self, - source: Union[str, dict, TextIO], - *, - base_dir: Optional[str] = None, - metadata: Optional[FileInfo] = None, - accept_header: Optional[str] = "text/plain, application/yaml;q=0.9") -> Union[dict, str]: + def _read_source( + self, + source: Union[str, dict, TextIO], + *, + base_dir: Optional[str] = None, + metadata: Optional[FileInfo] = None, + accept_header: Optional[str] = "text/plain, application/yaml;q=0.9", + ) -> Union[dict, str]: if metadata is None: metadata = FileInfo() if base_dir and not metadata.base_path: @@ -161,11 +174,11 @@ def _read_source(self, source = str(URI_TO_LOCAL[str(source)]) except (TypeError, KeyError) as e: # Fine, use original `source` value - logger = getLogger('linkml_runtime.loaders.Loader') + logger = getLogger("linkml_runtime.loaders.Loader") logger.debug(f"Error converting stringlike source to local linkml file: {source}, got: {e}") data = hbread(source, metadata, base_dir, accept_header) else: data = source - return data \ No newline at end of file + return data diff --git a/linkml_runtime/loaders/rdf_loader.py b/linkml_runtime/loaders/rdf_loader.py index 69dea78a..f8322e19 100644 --- a/linkml_runtime/loaders/rdf_loader.py +++ b/linkml_runtime/loaders/rdf_loader.py @@ -19,10 +19,16 @@ class RDFLoader(Loader): def load_any(self, *args, **kwargs) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: return self.load(*args, **kwargs) - - def load(self, source: Union[str, TextIO, Graph], target_class: type[Union[BaseModel, YAMLRoot]], *, base_dir: Optional[str] = None, - contexts: CONTEXTS_PARAM_TYPE = None, fmt: Optional[str] = 'turtle', - metadata: Optional[FileInfo] = None) -> Union[BaseModel, YAMLRoot]: + def load( + self, + source: Union[str, TextIO, Graph], + target_class: type[Union[BaseModel, YAMLRoot]], + *, + base_dir: Optional[str] = None, + contexts: CONTEXTS_PARAM_TYPE = None, + fmt: Optional[str] = "turtle", + metadata: Optional[FileInfo] = None, + ) -> Union[BaseModel, YAMLRoot]: """ Load the RDF in source into the python target_class structure :param source: RDF data source. Can be a URL, a file name, an RDF string, an open handle or an existing graph @@ -48,10 +54,10 @@ def loader(data: Union[str, dict], _: FileInfo) -> Optional[dict]: # on the way out # Also - if we don't pop type below, we need to act accordingly if isinstance(data, str): - if fmt != 'json-ld': + if fmt != "json-ld": g = Graph() g.parse(data=data, format=fmt) - jsonld_str = g.serialize(format='json-ld', indent=4) + jsonld_str = g.serialize(format="json-ld", indent=4) data = json.loads(jsonld_str) if not isinstance(data, dict): @@ -60,14 +66,14 @@ def loader(data: Union[str, dict], _: FileInfo) -> Optional[dict]: # TODO: determine whether jsonld.frame can handle something other than string input # TODO: see https://github.com/RDFLib/rdflib/issues/1727 # frame = {'@context': contexts, '@type': f'{target_class.__name__}'} - #data_as_dict = jsonld.frame(data, contexts) + # data_as_dict = jsonld.frame(data, contexts) data_as_dict = data else: data_as_dict = data - typ = data_as_dict.pop('@type', None) + typ = data_as_dict.pop("@type", None) # TODO: remove this when we get the Biolinkml issue fixed if not typ: - typ = data_as_dict.pop('type', None) + typ = data_as_dict.pop("type", None) if typ and typ != target_class.class_name: # TODO: connect this up with the logging facility or warning? print(f"Warning: input type mismatch. Expected: {target_class.__name__}, Actual: {typ}") @@ -81,9 +87,9 @@ def loader(data: Union[str, dict], _: FileInfo) -> Optional[dict]: # If the input is a graph, convert it to JSON-LD if isinstance(source, Graph): source = pyld_jsonld_from_rdflib_graph(source) - jsonld_str = source.serialize(format='json-ld', indent=4) + jsonld_str = source.serialize(format="json-ld", indent=4) source = json.loads(jsonld_str) - fmt = 'json-ld' + fmt = "json-ld" # While we may want to allow full SSL verification at some point, the general philosophy is that content forgery # is not going to be a serious problem. diff --git a/linkml_runtime/loaders/rdflib_loader.py b/linkml_runtime/loaders/rdflib_loader.py index 758d13e9..e0708701 100644 --- a/linkml_runtime/loaders/rdflib_loader.py +++ b/linkml_runtime/loaders/rdflib_loader.py @@ -24,18 +24,22 @@ VALID_SUBJECT = Union[URIRef, BNode] ANYDICT = dict[str, Any] + @dataclass class Pointer: obj: str + class RDFLibLoader(Loader): """ Loads objects from rdflib Graphs into the python target_class structure Note: this is a more complete replacement for rdf_loader """ + def from_rdf_graph( - self, graph: Graph, + self, + graph: Graph, schemaview: SchemaView, target_class: type[Union[BaseModel, YAMLRoot]], prefix_map: Union[dict[str, str], Converter, None] = None, @@ -63,7 +67,7 @@ def from_rdf_graph( if c2.name in schemaview.class_ancestors(cn): continue else: - logger.error(f'Inconsistent URI to class map: {uri} -> {c2.name}, {c.name}') + logger.error(f"Inconsistent URI to class map: {uri} -> {c2.name}, {c.name}") uri_to_class_map[uri] = c # data prefix map: supplements or overrides existing schema prefix map if isinstance(prefix_map, Converter): @@ -77,7 +81,7 @@ def from_rdf_graph( target_class_uriref: URIRef = target_class.class_class_uri root_dicts: list[ANYDICT] = [] root_subjects: list[VALID_SUBJECT] = list(graph.subjects(RDF.type, target_class_uriref)) - logger.debug(f'ROOTS = {root_subjects}') + logger.debug(f"ROOTS = {root_subjects}") # Step 2: walk RDF graph starting from root subjects, constructing dict tree node_tuples_to_visit: list[tuple[VALID_SUBJECT, ClassDefinitionName]] ## nodes and their type still to visit node_tuples_to_visit = [(subject, target_class.class_name) for subject in root_subjects] @@ -103,20 +107,22 @@ def from_rdf_graph( if len(type_vals) > 0: type_classes = [uri_to_class_map[str(x)] for x in type_vals] if len(type_classes) > 1: - raise ValueError(f'Ambiguous types for {subject} == {type_classes}') - logger.info(f'Replacing {subject_class} with {type_classes}') + raise ValueError(f"Ambiguous types for {subject} == {type_classes}") + logger.info(f"Replacing {subject_class} with {type_classes}") subject_class = type_classes[0].name # process all triples for this node - for (_, p, o) in graph.triples((subject, None, None)): - processed_triples.add((subject,p,o)) - logger.debug(f' Processing triple {subject} {p} {o}, subject type = {subject_class}') + for _, p, o in graph.triples((subject, None, None)): + processed_triples.add((subject, p, o)) + logger.debug(f" Processing triple {subject} {p} {o}, subject type = {subject_class}") if p == RDF.type: - logger.debug(f'Ignoring RDF.type for {subject} {o}, we automatically infer this from {subject_class}') + logger.debug( + f"Ignoring RDF.type for {subject} {o}, we automatically infer this from {subject_class}" + ) elif p not in uri_to_slot: if ignore_unmapped_predicates: unmapped_predicates.add(p) else: - raise MappingError(f'No pred for {p} {type(p)}') + raise MappingError(f"No pred for {p} {type(p)}") else: slot = schemaview.induced_slot(uri_to_slot[p].name, subject_class) range_applicable_elements = schemaview.slot_applicable_range_elements(slot) @@ -124,13 +130,15 @@ def from_rdf_graph( slot_name = underscore(slot.name) if isinstance(o, Literal): if EnumDefinition.class_name in range_applicable_elements: - logger.debug(f'Assuming no meaning assigned for value {o} for Enum {slot.range}') + logger.debug(f"Assuming no meaning assigned for value {o} for Enum {slot.range}") elif TypeDefinition.class_name not in range_applicable_elements: - raise ValueError(f'Cannot map Literal {o} to a slot {slot.name} whose range {slot.range} is not a type;') + raise ValueError( + f"Cannot map Literal {o} to a slot {slot.name} whose range {slot.range} is not a type;" + ) v = o.value elif isinstance(o, BNode): if not is_inlined: - logger.error(f'blank nodes should be inlined; {slot_name}={o} in {subject}') + logger.error(f"blank nodes should be inlined; {slot_name}={o} in {subject}") v = Pointer(o) else: if ClassDefinition.class_name in range_applicable_elements: @@ -140,7 +148,7 @@ def from_rdf_graph( else: v = namespaces.curie_for(o) if v is None: - logger.debug(f'No CURIE for {p}={o} in {subject} [{subject_class}]') + logger.debug(f"No CURIE for {p}={o} in {subject} [{subject_class}]") v = str(o) elif EnumDefinition.class_name in range_applicable_elements: range_union_elements = schemaview.slot_range_as_union(slot) @@ -159,9 +167,11 @@ def from_rdf_graph( v = namespaces.curie_for(o) if v is None: v = str(o) - logger.debug(f'Casting {o} to string') + logger.debug(f"Casting {o} to string") else: - raise ValueError(f'Expected literal value ({range_applicable_elements}) for {slot_name}={o}') + raise ValueError( + f"Expected literal value ({range_applicable_elements}) for {slot_name}={o}" + ) if is_inlined: # the object of the triple may not yet be processed; # we store a pointer to o, and then replace this later @@ -178,27 +188,29 @@ def from_rdf_graph( if slot.range in schemaview.all_classes(): node_tuples_to_visit.append((o, ClassDefinitionName(slot.range))) if unmapped_predicates: - logger.info(f'Unmapped predicated: {unmapped_predicates}') + logger.info(f"Unmapped predicated: {unmapped_predicates}") unprocessed_triples = set(graph.triples((None, None, None))) - processed_triples - logger.info(f'Triple processed = {len(processed_triples)}, unprocessed = {len(unprocessed_triples)}') + logger.info(f"Triple processed = {len(processed_triples)}, unprocessed = {len(unprocessed_triples)}") if len(unprocessed_triples) > 0: if not allow_unprocessed_triples: for t in unprocessed_triples: - logger.warning(f' Unprocessed: {t}') - raise ValueError(f'Unprocessed triples: {len(unprocessed_triples)}') + logger.warning(f" Unprocessed: {t}") + raise ValueError(f"Unprocessed triples: {len(unprocessed_triples)}") + # Step 2: replace inline pointers with object dicts def repl(v): if isinstance(v, Pointer): v2 = obj_map[v.obj] if v2 is None: - raise Exception(f'No mapping for pointer {v}') + raise Exception(f"No mapping for pointer {v}") return v2 else: return v + objs_to_visit: list[ANYDICT] = copy(root_dicts) while len(objs_to_visit) > 0: obj = objs_to_visit.pop() - logger.debug(f'Replacing pointers for {obj}') + logger.debug(f"Replacing pointers for {obj}") for k, v in obj.items(): if v is None: continue @@ -219,13 +231,13 @@ def _get_id_dict(self, node: VALID_SUBJECT, schemaview: SchemaView, cn: ClassDef id_slot = schemaview.get_identifier_slot(cn) if not isinstance(node, BNode): id_val = self._uri_to_id(node, id_slot, schemaview) - #id_val = schemaview.namespaces().curie_for(node) + # id_val = schemaview.namespaces().curie_for(node) if id_val == None: id_val = str(node) return {id_slot.name: id_val} else: if id_slot is not None: - raise Exception(f'Unexpected blank node {node}, type {cn} expects {id_slot.name} identifier') + raise Exception(f"Unexpected blank node {node}, type {cn} expects {id_slot.name} identifier") return {} def _uri_to_id(self, node: VALID_SUBJECT, id_slot: SlotDefinition, schemaview: SchemaView) -> str: @@ -234,14 +246,14 @@ def _uri_to_id(self, node: VALID_SUBJECT, id_slot: SlotDefinition, schemaview: S else: return schemaview.namespaces().curie_for(node) - def load( self, source: Union[str, TextIO, Graph], - target_class: type[Union[BaseModel, YAMLRoot]], *, + target_class: type[Union[BaseModel, YAMLRoot]], + *, schemaview: SchemaView = None, prefix_map: Union[dict[str, str], Converter, None] = None, - fmt: Optional[str] = 'turtle', + fmt: Optional[str] = "turtle", metadata: Optional[FileInfo] = None, **kwargs, ) -> Union[BaseModel, YAMLRoot]: @@ -264,13 +276,13 @@ def load( g = source else: g = Graph() - if '\n' in source: + if "\n" in source: g.parse(data=source, format=fmt) else: g.parse(source, format=fmt) objs = self.from_rdf_graph(g, schemaview=schemaview, target_class=target_class, prefix_map=prefix_map, **kwargs) if len(objs) != 1: - raise DataNotFoundError(f'Got {len(objs)} of type {target_class} from source, expected exactly 1') + raise DataNotFoundError(f"Got {len(objs)} of type {target_class} from source, expected exactly 1") return objs[0] def loads(self, source: str, **kwargs) -> Union[BaseModel, YAMLRoot]: @@ -278,5 +290,3 @@ def loads(self, source: str, **kwargs) -> Union[BaseModel, YAMLRoot]: def load_any(self, source: str, **kwargs) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: return self.load(source, **kwargs) - - diff --git a/linkml_runtime/loaders/requests_ssl_patch.py b/linkml_runtime/loaders/requests_ssl_patch.py index 5395af7d..fb5d88cd 100644 --- a/linkml_runtime/loaders/requests_ssl_patch.py +++ b/linkml_runtime/loaders/requests_ssl_patch.py @@ -19,7 +19,7 @@ def merge_environment_settings(self, url, proxies, stream, verify, cert): opened_adapters.add(self.get_adapter(url)) settings = old_merge_environment_settings(self, url, proxies, stream, verify, cert) - settings['verify'] = False + settings["verify"] = False return settings @@ -27,7 +27,7 @@ def merge_environment_settings(self, url, proxies, stream, verify, cert): try: with warnings.catch_warnings(): - warnings.simplefilter('ignore', InsecureRequestWarning) + warnings.simplefilter("ignore", InsecureRequestWarning) yield finally: requests.Session.merge_environment_settings = old_merge_environment_settings diff --git a/linkml_runtime/loaders/tsv_loader.py b/linkml_runtime/loaders/tsv_loader.py index 0d926321..bfc0a31a 100644 --- a/linkml_runtime/loaders/tsv_loader.py +++ b/linkml_runtime/loaders/tsv_loader.py @@ -1,7 +1,8 @@ from linkml_runtime.loaders.delimited_file_loader import DelimitedFileLoader + class TSVLoader(DelimitedFileLoader): - + @property def delimiter(self): return "\t" diff --git a/linkml_runtime/loaders/yaml_loader.py b/linkml_runtime/loaders/yaml_loader.py index fa33a280..8c90b580 100644 --- a/linkml_runtime/loaders/yaml_loader.py +++ b/linkml_runtime/loaders/yaml_loader.py @@ -15,16 +15,16 @@ class YAMLLoader(Loader): A Loader that is capable of instantiating LinkML data objects from a YAML file """ - def load_as_dict(self, - source: Union[str, dict, TextIO], - *, - base_dir: Optional[str] = None, - metadata: Optional[FileInfo] = None) -> Union[dict, list[dict]]: + def load_as_dict( + self, source: Union[str, dict, TextIO], *, base_dir: Optional[str] = None, metadata: Optional[FileInfo] = None + ) -> Union[dict, list[dict]]: if metadata is None: metadata = FileInfo() if base_dir and not metadata.base_path: metadata.base_path = base_dir - data = self._read_source(source, base_dir=base_dir, metadata=metadata, accept_header="text/yaml, application/yaml;q=0.9") + data = self._read_source( + source, base_dir=base_dir, metadata=metadata, accept_header="text/yaml, application/yaml;q=0.9" + ) if isinstance(data, str): data = StringIO(data) if metadata and metadata.source_file: @@ -33,15 +33,21 @@ def load_as_dict(self, else: return data - def load_any(self, - source: Union[str, dict, TextIO], - target_class: Union[type[YAMLRoot], type[BaseModel]], - *, base_dir: Optional[str] = None, - metadata: Optional[FileInfo] = None, **_) -> Union[YAMLRoot, list[YAMLRoot]]: + def load_any( + self, + source: Union[str, dict, TextIO], + target_class: Union[type[YAMLRoot], type[BaseModel]], + *, + base_dir: Optional[str] = None, + metadata: Optional[FileInfo] = None, + **_, + ) -> Union[YAMLRoot, list[YAMLRoot]]: data_as_dict = self.load_as_dict(source, base_dir=base_dir, metadata=metadata) return self._construct_target_class(data_as_dict, target_class) - def loads_any(self, source: str, target_class: type[Union[BaseModel, YAMLRoot]], *, metadata: Optional[FileInfo] = None, **_) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: + def loads_any( + self, source: str, target_class: type[Union[BaseModel, YAMLRoot]], *, metadata: Optional[FileInfo] = None, **_ + ) -> Union[BaseModel, YAMLRoot, list[BaseModel], list[YAMLRoot]]: """ Load source as a string @param source: source diff --git a/linkml_runtime/processing/referencevalidator.py b/linkml_runtime/processing/referencevalidator.py index a167f634..72777fbb 100644 --- a/linkml_runtime/processing/referencevalidator.py +++ b/linkml_runtime/processing/referencevalidator.py @@ -5,6 +5,7 @@ - `Part 5`_ of LinkML specification - `Part 6`_ of LinkML specification """ + import decimal import re import sys @@ -38,7 +39,8 @@ ) from linkml_runtime.processing.validation_datamodel import ( ConstraintType, - ValidationResult, ValidationConfiguration, + ValidationResult, + ValidationConfiguration, ) from linkml_runtime.utils import yamlutils from linkml_runtime.utils.eval_utils import eval_expr @@ -140,6 +142,7 @@ def _linearize_nested_list_column_order(nested_list): return result + class CollectionForm(Enum): """Form of a schema element. See Part 6 of the LinkML specification""" @@ -164,6 +167,7 @@ class Normalization: @dataclass class CollectionFormNormalization(Normalization): """A normalization that maps from one collection form to another""" + input_form: CollectionForm = None output_form: CollectionForm = None @@ -383,9 +387,7 @@ def normalize( report = Report() return self.normalize_slot_value(input_object, parent_slot, report) - def _create_index_slot( - self, target: Optional[str] = None, input_object: Any = None - ) -> SlotDefinition: + def _create_index_slot(self, target: Optional[str] = None, input_object: Any = None) -> SlotDefinition: """ Create a parent slot that points at the target element. @@ -403,9 +405,7 @@ def _create_index_slot( slot.multivalued = True return slot - def _schema_root( - self, target: Optional[str] = None - ) -> Optional[ClassDefinitionName]: + def _schema_root(self, target: Optional[str] = None) -> Optional[ClassDefinitionName]: if target is not None: return ClassDefinitionName(target) roots = [r.name for r in self.derived_schema.classes.values() if r.tree_root] @@ -413,9 +413,7 @@ def _schema_root( raise ValueError(f"Cannot normalize: {len(roots)} roots found") return roots[0] - def normalize_slot_value( - self, input_object: Any, parent_slot: SlotDefinition, report: Report - ) -> Any: + def normalize_slot_value(self, input_object: Any, parent_slot: SlotDefinition, report: Report) -> Any: pk_slot_name = None range_element = self._slot_range_element(parent_slot) # Infer collection form, and normalize to this form, if necessary @@ -429,9 +427,7 @@ def normalize_slot_value( # Validate new_report = Report() if parent_slot.required and not normalized_object: - report.add_problem( - ConstraintType.RequiredConstraint, parent_slot.range, str(input_object) - ) + report.add_problem(ConstraintType.RequiredConstraint, parent_slot.range, str(input_object)) if parent_slot.recommended and not normalized_object: report.add_problem( ConstraintType.RecommendedConstraint, @@ -442,8 +438,7 @@ def normalize_slot_value( if isinstance(normalized_object, dict) and parent_slot.multivalued: if not simple_dict_value_slot: output_object = { - k: self.normalize_instance(v, parent_slot, new_report) - for k, v in normalized_object.items() + k: self.normalize_instance(v, parent_slot, new_report) for k, v in normalized_object.items() } else: output_object = { @@ -453,21 +448,14 @@ def normalize_slot_value( elif _is_list_of_lists(normalized_object): raise NotImplementedError(f"List of Lists: {normalized_object}") elif isinstance(normalized_object, list): - output_object = [ - self.normalize_instance(v, parent_slot, new_report) - for v in normalized_object - ] + output_object = [self.normalize_instance(v, parent_slot, new_report) for v in normalized_object] else: # normalize an instance - output_object = self.normalize_instance( - normalized_object, parent_slot, new_report - ) + output_object = self.normalize_instance(normalized_object, parent_slot, new_report) report.combine(new_report) return output_object - def _is_dict_collection( - self, input_object: Any, parent_slot: SlotDefinition - ) -> bool: + def _is_dict_collection(self, input_object: Any, parent_slot: SlotDefinition) -> bool: if not isinstance(input_object, dict): return False if not parent_slot.multivalued: @@ -495,10 +483,7 @@ def infer_slot_collection_form(self, parent_slot: SlotDefinition) -> CollectionF if simple_dict_value_slot: return CollectionForm.SimpleDict # TODO: provide direct metamodel method - if ( - "expanded" in parent_slot.annotations - and parent_slot.annotations["expanded"].value - ): + if "expanded" in parent_slot.annotations and parent_slot.annotations["expanded"].value: return CollectionForm.ExpandedDict return CollectionForm.CompactDict @@ -623,9 +608,7 @@ def ensure_expanded_dict( if isinstance(input_object, dict): simple_dict_value_slot = self._slot_as_simple_dict_value_slot(parent_slot) if simple_dict_value_slot and any( - v - for v in input_object.values() - if v is not None and not isinstance(v, dict) + v for v in input_object.values() if v is not None and not isinstance(v, dict) ): # SimpleDict -> ExpandedDict report.add_collection_form_normalization( @@ -634,9 +617,7 @@ def ensure_expanded_dict( CollectionForm.ExpandedDict, ) return { - k: _add_pk( - _simple_to_dict(v, simple_dict_value_slot.name), pk_slot_name, k - ) + k: _add_pk(_simple_to_dict(v, simple_dict_value_slot.name), pk_slot_name, k) for k, v in input_object.items() } else: @@ -657,14 +638,10 @@ def ensure_compact_dict( CollectionForm.List, CollectionForm.CompactDict, ) - return { - v.get(pk_slot_name): _remove_pk(v, pk_slot_name) for v in input_object - } + return {v.get(pk_slot_name): _remove_pk(v, pk_slot_name) for v in input_object} elif isinstance(input_object, dict): if pk_slot_name and any( - v - for k, v in input_object.items() - if isinstance(v, dict) and v.get(pk_slot_name, None) is not None + v for k, v in input_object.items() if isinstance(v, dict) and v.get(pk_slot_name, None) is not None ): report.add_collection_form_normalization( ConstraintType.DictCollectionFormConstraint, @@ -691,9 +668,7 @@ def ensure_simple_dict( ) -> Any: simple_dict_value_slot = self._slot_as_simple_dict_value_slot(parent_slot) if not simple_dict_value_slot: - raise AssertionError( - f"Should have simple dict slot valie: {parent_slot.name}" - ) + raise AssertionError(f"Should have simple dict slot valie: {parent_slot.name}") normalized_object = input_object if isinstance(input_object, list): normalized_object = {v[pk_slot_name]: v for v in input_object} @@ -725,9 +700,7 @@ def ensure_simple_dict( ) return normalized_object - def normalize_instance( - self, input_object: Any, parent_slot: SlotDefinition, report: Report - ) -> Any: + def normalize_instance(self, input_object: Any, parent_slot: SlotDefinition, report: Report) -> Any: range_element = self._slot_range_element(parent_slot) if input_object is None: return None @@ -752,43 +725,27 @@ def normalize_instance( else: return input_object - def normalize_reference( - self, input_object: dict, target: ClassDefinition, report: Report - ) -> dict: + def normalize_reference(self, input_object: dict, target: ClassDefinition, report: Report) -> dict: pk_slot = self._identifier_slot(target) if pk_slot is None: raise AssertionError(f"Cannot normalize: no primary key for {target.name}") - return self.normalize_type( - input_object, self.derived_schema.types.get(pk_slot.range, None), report - ) + return self.normalize_type(input_object, self.derived_schema.types.get(pk_slot.range, None), report) - def normalize_object( - self, input_object: dict, target: ClassDefinition, report: Report - ) -> dict: + def normalize_object(self, input_object: dict, target: ClassDefinition, report: Report) -> dict: if not isinstance(input_object, dict): - raise AssertionError( - f"Cannot normalize: expected dict, got {type(input_object)} for {input_object}" - ) + raise AssertionError(f"Cannot normalize: expected dict, got {type(input_object)} for {input_object}") output_object = {} # Induced slot for slot in target.attributes.values(): # TODO: required slots MUST be present UNLESS this is a CompactDict - if ( - slot.required - and slot.alias not in input_object - and not (slot.identifier or slot.key) - ): + if slot.required and slot.alias not in input_object and not (slot.identifier or slot.key): report.add_problem( ConstraintType.RequiredConstraint, slot.name, input_object, predicate=target.name, ) - if ( - slot.recommended - and slot.alias not in input_object - and not (slot.identifier or slot.key) - ): + if slot.recommended and slot.alias not in input_object and not (slot.identifier or slot.key): report.add_problem( ConstraintType.RecommendedConstraint, slot.name, @@ -796,9 +753,7 @@ def normalize_object( predicate=target.name, ) if slot.designates_type and slot.name in input_object: - induced_class_name = self._class_name_from_value( - input_object[slot.name], slot.range - ) + induced_class_name = self._class_name_from_value(input_object[slot.name], slot.range) new_target = self.derived_schema.classes[induced_class_name] if not self.subsumes(target, new_target): report.add_problem( @@ -837,20 +792,14 @@ def normalize_object( slot = target.attributes[actual_k] output_object[k] = self.normalize_slot_value(v, slot, report) if not self._matches_slot_expression(output_object[k], slot, output_object): - report.add_problem( - ConstraintType.ExpressionConstraint, target.name, output_object[k] - ) + report.add_problem(ConstraintType.ExpressionConstraint, target.name, output_object[k]) for rule in target.rules: self.evaluate_rule(output_object, rule, report) return output_object - def normalize_enum( - self, input_object: Any, target: EnumDefinition, report: Report - ) -> Any: + def normalize_enum(self, input_object: Any, target: EnumDefinition, report: Report) -> Any: if input_object not in target.permissible_values: - report.add_problem( - ConstraintType.PermissibleValueConstraint, target.name, input_object - ) + report.add_problem(ConstraintType.PermissibleValueConstraint, target.name, input_object) return input_object def normalize_type( @@ -863,16 +812,14 @@ def normalize_type( if input_object is None: return None if target is None: - return input_object + return input_object output_value = input_object if target.base in XSD_OR_BASE_TO_PYTHON: expected_python_type = XSD_OR_BASE_TO_PYTHON[target.base] elif target.uri in XSD_OR_BASE_TO_PYTHON: expected_python_type = XSD_OR_BASE_TO_PYTHON[target.uri] else: - report.add_problem( - ConstraintType.UnmappedTypeConstraint, target.name, input_object - ) + report.add_problem(ConstraintType.UnmappedTypeConstraint, target.name, input_object) return output_value current_python_type = type(input_object) if isinstance(expected_python_type, tuple): @@ -900,9 +847,7 @@ def normalize_type( output_value = normalize_func(input_object) if cast_func is not None: output_value = cast_func(output_value) - report.add_type_normalization( - current_python_type.__name__, expected_python_types[0].__name__ - ) + report.add_type_normalization(current_python_type.__name__, expected_python_types[0].__name__) except (ValueError, decimal.InvalidOperation) as e: problem = ValidationResult( ConstraintType.TypeConstraint, @@ -913,51 +858,29 @@ def normalize_type( report.results.append(problem) # validation if parent_slot: - if ( - parent_slot.maximum_value is not None - and output_value > parent_slot.maximum_value - ): - report.add_problem( - ConstraintType.MaximumValueConstraint, target.name, input_object - ) - if ( - parent_slot.minimum_value is not None - and output_value < parent_slot.minimum_value - ): - report.add_problem( - ConstraintType.MinimumValueConstraint, target.name, input_object - ) + if parent_slot.maximum_value is not None and output_value > parent_slot.maximum_value: + report.add_problem(ConstraintType.MaximumValueConstraint, target.name, input_object) + if parent_slot.minimum_value is not None and output_value < parent_slot.minimum_value: + report.add_problem(ConstraintType.MinimumValueConstraint, target.name, input_object) if parent_slot.pattern is not None: if not re.match(parent_slot.pattern, output_value): - report.add_problem( - ConstraintType.PatternConstraint, target.name, input_object - ) + report.add_problem(ConstraintType.PatternConstraint, target.name, input_object) if parent_slot.equals_string is not None: if output_value != parent_slot.equals_string: - report.add_problem( - ConstraintType.ExpressionConstraint, target.name, input_object - ) + report.add_problem(ConstraintType.ExpressionConstraint, target.name, input_object) return output_value - def evaluate_rule( - self, input_object: dict, rule: ClassRule, report: Report - ) -> None: + def evaluate_rule(self, input_object: dict, rule: ClassRule, report: Report) -> None: for cond in rule.preconditions: - if not self._matches_class_expression( - input_object.get(cond.slot, None), cond, input_object - ): + if not self._matches_class_expression(input_object.get(cond.slot, None), cond, input_object): return for cond in rule.postconditions: - if not self._matches_class_expression( - input_object.get(cond.slot, None), cond, input_object - ): + if not self._matches_class_expression(input_object.get(cond.slot, None), cond, input_object): report.add_problem(ConstraintType.RuleViolation, rule.name) return def subsumes(self, parent: ClassDefinition, child: ClassDefinition): - return parent.name in self.schemaview.class_ancestors( - child.name, reflexive=True - ) + return parent.name in self.schemaview.class_ancestors(child.name, reflexive=True) def _slot_range_element(self, slot: SlotDefinition) -> Optional[Element]: ds = self.derived_schema @@ -997,24 +920,16 @@ def _slot_inlined_as_compact_dict(self, slot: SlotDefinition) -> bool: # TODO: make this configurable return True - def _slot_as_simple_dict_value_slot( - self, slot: SlotDefinition - ) -> Optional[SlotDefinition]: + def _slot_as_simple_dict_value_slot(self, slot: SlotDefinition) -> Optional[SlotDefinition]: if not slot.inlined or slot.inlined_as_list: return False range_element = self._slot_range_element(slot) if isinstance(range_element, ClassDefinition): - non_pk_atts = [ - s - for s in range_element.attributes.values() - if not s.identifier and not s.key - ] + non_pk_atts = [s for s in range_element.attributes.values() if not s.identifier and not s.key] if len(non_pk_atts) == 1: return non_pk_atts[0] - def _identifier_slot_name( - self, cls: ClassDefinition - ) -> Optional[SlotDefinitionName]: + def _identifier_slot_name(self, cls: ClassDefinition) -> Optional[SlotDefinitionName]: for slot in cls.attributes.values(): if slot.identifier: return slot.name @@ -1043,9 +958,7 @@ def _matches_class_expression( expr: AnonymousClassExpression, ) -> bool: if expr.is_a: - if expr.is_a not in self.schemaview.class_ancestors( - target.name, reflexive=True - ): + if expr.is_a not in self.schemaview.class_ancestors(target.name, reflexive=True): return False for slot_name, slot_expression in expr.slot_conditions.items(): v = input_object.get(slot_name, None) @@ -1063,19 +976,11 @@ def _matches_slot_expression( if self._matches_slot_expression(slot_value, x, input_object): return False if expr.exactly_one_of: - vals = [ - x - for x in expr.exactly_one_of - if self._matches_slot_expression(slot_value, x, input_object) - ] + vals = [x for x in expr.exactly_one_of if self._matches_slot_expression(slot_value, x, input_object)] if len(vals) != 1: return False if expr.any_of: - vals = [ - x - for x in expr.any_of - if self._matches_slot_expression(slot_value, x, input_object) - ] + vals = [x for x in expr.any_of if self._matches_slot_expression(slot_value, x, input_object)] if not vals: return False for x in expr.all_of: @@ -1094,16 +999,13 @@ def _matches_slot_expression( @click.command -@click.option("--schema", "-s", required=True, - help="Path to LinkML schema") -@click.option("--target", "-C", - help="name of target class or element to normalize/validate against") -@click.option("--report-file", "-R", type=click.File("w"), default=sys.stderr, - show_default=True, - help="path to file for reports") +@click.option("--schema", "-s", required=True, help="Path to LinkML schema") +@click.option("--target", "-C", help="name of target class or element to normalize/validate against") +@click.option( + "--report-file", "-R", type=click.File("w"), default=sys.stderr, show_default=True, help="path to file for reports" +) @click.option("--output", "-o", type=click.File("w"), default=sys.stdout) -@click.option("--expand-all/--no-expand-all", - help="If True, expand all Dicts to ExpandedDicts") +@click.option("--expand-all/--no-expand-all", help="If True, expand all Dicts to ExpandedDicts") @click.argument("input") def cli(schema: str, target: str, input: str, report_file: TextIO, output: TextIO, **kwargs) -> None: """ diff --git a/linkml_runtime/processing/validation_datamodel.py b/linkml_runtime/processing/validation_datamodel.py index b4fb76b6..fc9dcee9 100644 --- a/linkml_runtime/processing/validation_datamodel.py +++ b/linkml_runtime/processing/validation_datamodel.py @@ -44,6 +44,7 @@ # Types + # Class references class ConstraintCheckId(URIorCURIE): pass @@ -122,9 +123,7 @@ class ValidationConfiguration(YAMLRoot): ] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): - if self.max_number_results_per_type is not None and not isinstance( - self.max_number_results_per_type, int - ): + if self.max_number_results_per_type is not None and not isinstance(self.max_number_results_per_type, int): self.max_number_results_per_type = int(self.max_number_results_per_type) self._normalize_inlined_as_dict( @@ -157,9 +156,7 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.validation_configuration is not None and not isinstance( self.validation_configuration, ValidationConfiguration ): - self.validation_configuration = ValidationConfiguration( - **as_dict(self.validation_configuration) - ) + self.validation_configuration = ValidationConfiguration(**as_dict(self.validation_configuration)) if self.dry_run is not None and not isinstance(self.dry_run, Bool): self.dry_run = Bool(self.dry_run) @@ -208,16 +205,12 @@ class Report(YAMLRoot): class_name: ClassVar[str] = "Report" class_model_uri: ClassVar[URIRef] = VM.Report - results: Optional[ - Union[Union[dict, "Result"], list[Union[dict, "Result"]]] - ] = empty_list() + results: Optional[Union[Union[dict, "Result"], list[Union[dict, "Result"]]]] = empty_list() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.results, list): self.results = [self.results] if self.results is not None else [] - self.results = [ - v if isinstance(v, Result) else Result(**as_dict(v)) for v in self.results - ] + self.results = [v if isinstance(v, Result) else Result(**as_dict(v)) for v in self.results] super().__post_init__(**kwargs) @@ -235,17 +228,12 @@ class ValidationReport(Report): class_name: ClassVar[str] = "ValidationReport" class_model_uri: ClassVar[URIRef] = VM.ValidationReport - results: Optional[ - Union[Union[dict, "ValidationResult"], list[Union[dict, "ValidationResult"]]] - ] = empty_list() + results: Optional[Union[Union[dict, "ValidationResult"], list[Union[dict, "ValidationResult"]]]] = empty_list() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.results, list): self.results = [self.results] if self.results is not None else [] - self.results = [ - v if isinstance(v, ValidationResult) else ValidationResult(**as_dict(v)) - for v in self.results - ] + self.results = [v if isinstance(v, ValidationResult) else ValidationResult(**as_dict(v)) for v in self.results] super().__post_init__(**kwargs) @@ -263,17 +251,12 @@ class RepairReport(Report): class_name: ClassVar[str] = "RepairReport" class_model_uri: ClassVar[URIRef] = VM.RepairReport - results: Optional[ - Union[Union[dict, "RepairOperation"], list[Union[dict, "RepairOperation"]]] - ] = empty_list() + results: Optional[Union[Union[dict, "RepairOperation"], list[Union[dict, "RepairOperation"]]]] = empty_list() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.results, list): self.results = [self.results] if self.results is not None else [] - self.results = [ - v if isinstance(v, RepairOperation) else RepairOperation(**as_dict(v)) - for v in self.results - ] + self.results = [v if isinstance(v, RepairOperation) else RepairOperation(**as_dict(v)) for v in self.results] super().__post_init__(**kwargs) @@ -355,19 +338,13 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.repaired is not None and not isinstance(self.repaired, Bool): self.repaired = Bool(self.repaired) - if self.source_line_number is not None and not isinstance( - self.source_line_number, int - ): + if self.source_line_number is not None and not isinstance(self.source_line_number, int): self.source_line_number = int(self.source_line_number) - if self.source_column_number is not None and not isinstance( - self.source_column_number, int - ): + if self.source_column_number is not None and not isinstance(self.source_column_number, int): self.source_column_number = int(self.source_column_number) - if self.source_location is not None and not isinstance( - self.source_location, str - ): + if self.source_location is not None and not isinstance(self.source_location, str): self.source_location = str(self.source_location) super().__post_init__(**kwargs) @@ -481,12 +458,8 @@ class ConstraintType(EnumDefinitionImpl): meaning=SH.ClosedConstraintComponent, ) DesignatesTypeConstraint = PermissibleValue(text="DesignatesTypeConstraint") - InstanceConstraint = PermissibleValue( - text="InstanceConstraint", meaning=SH.NodeConstraintComponent - ) - SlotConstraint = PermissibleValue( - text="SlotConstraint", meaning=SH.PropertyConstraintComponent - ) + InstanceConstraint = PermissibleValue(text="InstanceConstraint", meaning=SH.NodeConstraintComponent) + SlotConstraint = PermissibleValue(text="SlotConstraint", meaning=SH.PropertyConstraintComponent) PermissibleValueConstraint = PermissibleValue( text="PermissibleValueConstraint", description="constraint where the slot value must be one of a set of permissible values", @@ -508,15 +481,9 @@ class ConstraintType(EnumDefinitionImpl): text="LessThanOrEqualsExpressionConstraint", meaning=SH.LessThanOrEqualsComponent, ) - DisjointConstraint = PermissibleValue( - text="DisjointConstraint", meaning=SH.DisjointConstraintComponent - ) - MinimumValueConstraint = PermissibleValue( - text="MinimumValueConstraint", meaning=SH.MinInclusiveConstraintComponent - ) - MaximumValueConstraint = PermissibleValue( - text="MaximumValueConstraint", meaning=SH.MaxInclusiveConstraintComponent - ) + DisjointConstraint = PermissibleValue(text="DisjointConstraint", meaning=SH.DisjointConstraintComponent) + MinimumValueConstraint = PermissibleValue(text="MinimumValueConstraint", meaning=SH.MinInclusiveConstraintComponent) + MaximumValueConstraint = PermissibleValue(text="MaximumValueConstraint", meaning=SH.MaxInclusiveConstraintComponent) MinimumExclusiveValueConstraint = PermissibleValue( text="MinimumExclusiveValueConstraint", meaning=SH.MinExclusiveInclusiveConstraintComponent, @@ -528,15 +495,9 @@ class ConstraintType(EnumDefinitionImpl): CollectionFormConstraint = PermissibleValue(text="CollectionFormConstraint") ListCollectionFormConstraint = PermissibleValue(text="ListCollectionFormConstraint") DictCollectionFormConstraint = PermissibleValue(text="DictCollectionFormConstraint") - SimpleDictCollectionFormConstraint = PermissibleValue( - text="SimpleDictCollectionFormConstraint" - ) - CompactDictCollectionFormConstraint = PermissibleValue( - text="CompactDictCollectionFormConstraint" - ) - ExpandedDictCollectionFormConstraint = PermissibleValue( - text="ExpandedDictCollectionFormConstraint" - ) + SimpleDictCollectionFormConstraint = PermissibleValue(text="SimpleDictCollectionFormConstraint") + CompactDictCollectionFormConstraint = PermissibleValue(text="CompactDictCollectionFormConstraint") + ExpandedDictCollectionFormConstraint = PermissibleValue(text="ExpandedDictCollectionFormConstraint") _defn = EnumDefinition( name="ConstraintType", @@ -718,9 +679,7 @@ class slots: domain=None, range=Optional[ Union[ - dict[ - Union[str, TypeSeverityKeyValueType], Union[dict, TypeSeverityKeyValue] - ], + dict[Union[str, TypeSeverityKeyValueType], Union[dict, TypeSeverityKeyValue]], list[Union[dict, TypeSeverityKeyValue]], ] ], @@ -804,9 +763,7 @@ class slots: curie=SH.curie("result"), model_uri=VM.ValidationReport_results, domain=ValidationReport, - range=Optional[ - Union[Union[dict, "ValidationResult"], list[Union[dict, "ValidationResult"]]] - ], + range=Optional[Union[Union[dict, "ValidationResult"], list[Union[dict, "ValidationResult"]]]], ) slots.RepairReport_results = Slot( @@ -815,7 +772,5 @@ class slots: curie=SH.curie("result"), model_uri=VM.RepairReport_results, domain=RepairReport, - range=Optional[ - Union[Union[dict, "RepairOperation"], list[Union[dict, "RepairOperation"]]] - ], + range=Optional[Union[Union[dict, "RepairOperation"], list[Union[dict, "RepairOperation"]]]], ) diff --git a/linkml_runtime/utils/comparefiles.py b/linkml_runtime/utils/comparefiles.py index 7c3bd3dd..0b5ed47a 100644 --- a/linkml_runtime/utils/comparefiles.py +++ b/linkml_runtime/utils/comparefiles.py @@ -4,9 +4,9 @@ import click -def compare_files(file: str, target: str, comments: str = r'^\s+#.*\n') -> int: +def compare_files(file: str, target: str, comments: str = r"^\s+#.*\n") -> int: def filtr(txt: str) -> str: - return re.sub(comments, '', txt, flags=re.MULTILINE).strip() + return re.sub(comments, "", txt, flags=re.MULTILINE).strip() with open(target) as oldfile: oldtext = filtr(oldfile.read()) @@ -21,9 +21,9 @@ def filtr(txt: str) -> str: @click.argument("file2", type=click.Path(exists=True, dir_okay=False)) @click.option("-c", "--comments", help="Comments regexp", default="^#.*$", show_default=True) def cli(file1, file2, comments) -> None: - """ Compare file1 to file2 using a filter """ + """Compare file1 to file2 using a filter""" sys.exit(compare_files(file1, file2, comments)) -if __name__ == '__main__': +if __name__ == "__main__": cli(sys.argv[1:]) diff --git a/linkml_runtime/utils/compile_python.py b/linkml_runtime/utils/compile_python.py index 7afea08d..85556b0c 100644 --- a/linkml_runtime/utils/compile_python.py +++ b/linkml_runtime/utils/compile_python.py @@ -10,7 +10,7 @@ def file_text(txt_or_fname: str) -> str: :param txt_or_fname: :return: """ - if len(txt_or_fname) > 4 and '\n' not in txt_or_fname: + if len(txt_or_fname) > 4 and "\n" not in txt_or_fname: with open(txt_or_fname) as ef: return ef.read() return txt_or_fname @@ -27,8 +27,8 @@ def compile_python(text_or_fn: str, package_path: str = None) -> ModuleType: python_txt = file_text(text_or_fn) if package_path is None and python_txt != text_or_fn: package_path = text_or_fn - spec = compile(python_txt, 'test', 'exec') - module = ModuleType('test') + spec = compile(python_txt, "test", "exec") + module = ModuleType("test") if package_path: package_path_abs = os.path.join(os.getcwd(), package_path) # We have to calculate the path to expected path relative to the current working directory @@ -41,8 +41,10 @@ def compile_python(text_or_fn: str, package_path: str = None) -> ModuleType: break else: warning(f"There is no established path to {package_path} - compile_python may or may not work") - path_from_tests_parent = os.path.relpath(package_path, os.path.join(os.getcwd(), '..')) - module.__package__ = os.path.dirname(os.path.relpath(path_from_tests_parent, os.getcwd())).replace(os.path.sep, '.') + path_from_tests_parent = os.path.relpath(package_path, os.path.join(os.getcwd(), "..")) + module.__package__ = os.path.dirname(os.path.relpath(path_from_tests_parent, os.getcwd())).replace( + os.path.sep, "." + ) sys.modules[module.__name__] = module exec(spec, module.__dict__) return module diff --git a/linkml_runtime/utils/context_utils.py b/linkml_runtime/utils/context_utils.py index 922aaaf5..91e40748 100644 --- a/linkml_runtime/utils/context_utils.py +++ b/linkml_runtime/utils/context_utils.py @@ -11,7 +11,7 @@ def merge_contexts(contexts: CONTEXTS_PARAM_TYPE = None, base: Optional[Any] = None) -> JsonObj: - """ Take a list of JSON-LD contexts, which can be one of: + """Take a list of JSON-LD contexts, which can be one of: * the name of a JSON-LD file * the URI of a JSON-lD file * JSON-LD text @@ -27,11 +27,12 @@ def merge_contexts(contexts: CONTEXTS_PARAM_TYPE = None, base: Optional[Any] = N :param base: base to add in (optional) :return: aggregated context """ + def prune_context_node(ctxt: Union[str, JsonObj]) -> Union[str, JsonObj]: - return ctxt['@context'] if isinstance(ctxt, JsonObj) and '@context' in ctxt else ctxt + return ctxt["@context"] if isinstance(ctxt, JsonObj) and "@context" in ctxt else ctxt def to_file_uri(fname: str) -> str: - return 'file://' + fname + return "file://" + fname context_list = [] for context in [] if contexts is None else [contexts] if not isinstance(contexts, (list, tuple, set)) else contexts: @@ -39,15 +40,18 @@ def to_file_uri(fname: str) -> str: # One of filename, URL or json text if context.strip().startswith("{"): context = loads(context) - elif '://' not in context: + elif "://" not in context: context = to_file_uri(context) elif not isinstance(context, (JsonObj, str)): - context = JsonObj(**context) # dict + context = JsonObj(**context) # dict context_list.append(prune_context_node(context)) if base: - context_list.append(JsonObj(**{'@base': str(base)})) - return None if not context_list else \ - JsonObj(**{"@context": context_list[0] if len(context_list) == 1 else context_list}) + context_list.append(JsonObj(**{"@base": str(base)})) + return ( + None + if not context_list + else JsonObj(**{"@context": context_list[0] if len(context_list) == 1 else context_list}) + ) def map_import(importmap: dict[str, str], namespaces: Callable[[None], "Namespaces"], imp: Any) -> str: @@ -62,10 +66,10 @@ def map_import(importmap: dict[str, str], namespaces: Callable[[None], "Namespac :return: """ sname = str(imp) - if ':' in sname: + if ":" in sname: # the importmap may contain mappings for prefixes - prefix, lname = sname.split(':', 1) - prefix += ':' + prefix, lname = sname.split(":", 1) + prefix += ":" expanded_prefix = importmap.get(prefix) if expanded_prefix is not None: if expanded_prefix.startswith("http"): @@ -73,12 +77,13 @@ def map_import(importmap: dict[str, str], namespaces: Callable[[None], "Namespac else: sname = os.path.join(expanded_prefix, lname) sname = importmap.get(sname, sname) # Import map may use CURIE - sname = str(namespaces().uri_for(sname)) if ':' in sname else sname + sname = str(namespaces().uri_for(sname)) if ":" in sname else sname return importmap.get(sname, sname) # It may also use URI or other forms -def parse_import_map(map_: Optional[Union[str, dict[str, str], TextIOWrapper]], - base: Optional[str] = None) -> dict[str, str]: +def parse_import_map( + map_: Optional[Union[str, dict[str, str], TextIOWrapper]], base: Optional[str] = None +) -> dict[str, str]: """ Process the import map :param map_: A map location, the JSON for a map, YAML for a map or an existing dictionary @@ -92,9 +97,9 @@ def parse_import_map(map_: Optional[Union[str, dict[str, str], TextIOWrapper]], return parse_import_map(map_.read(), base) elif isinstance(map_, dict): rval = map_ - elif map_.strip().startswith('{'): + elif map_.strip().startswith("{"): rval = json.loads(map_) - elif '\n' in map_ or '\r' in map_ or ' ' in map_: + elif "\n" in map_ or "\r" in map_ or " " in map_: rval = yaml.safe_load(map_) else: with open(map_) as ml: @@ -103,7 +108,7 @@ def parse_import_map(map_: Optional[Union[str, dict[str, str], TextIOWrapper]], if base: outmap = dict() for k, v in rval.items(): - if ':' not in v: + if ":" not in v: v = os.path.join(os.path.abspath(base), v) outmap[k] = v rval = outmap diff --git a/linkml_runtime/utils/csvutils.py b/linkml_runtime/utils/csvutils.py index b841d3ca..cd66ab4a 100644 --- a/linkml_runtime/utils/csvutils.py +++ b/linkml_runtime/utils/csvutils.py @@ -30,12 +30,13 @@ def get_configmap(schemaview: SchemaView, index_slot: SlotDefinitionName) -> CON cm[sn] = config return cm else: - logger.warning(f'Index slot range not to class: {slot.range}') + logger.warning(f"Index slot range not to class: {slot.range}") else: - logger.warning(f'Index slot or schema not specified') + logger.warning(f"Index slot or schema not specified") return {} -def _get_key_config(schemaview: SchemaView, tgt_cls: ClassDefinitionName, sn: SlotDefinitionName, sep='_'): + +def _get_key_config(schemaview: SchemaView, tgt_cls: ClassDefinitionName, sn: SlotDefinitionName, sep="_"): slot = schemaview.induced_slot(sn, tgt_cls) range = slot.range all_cls = schemaview.all_classes() @@ -43,7 +44,7 @@ def _get_key_config(schemaview: SchemaView, tgt_cls: ClassDefinitionName, sn: Sl mappings = {} is_complex = False for inner_sn in schemaview.class_slots(range): - denormalized_sn = f'{sn}{sep}{inner_sn}' + denormalized_sn = f"{sn}{sep}{inner_sn}" mappings[inner_sn] = denormalized_sn inner_slot = schemaview.induced_slot(inner_sn, range) inner_slot_range = inner_slot.range @@ -53,6 +54,8 @@ def _get_key_config(schemaview: SchemaView, tgt_cls: ClassDefinitionName, sn: Sl serializers = [Serializer.json] else: serializers = [] - return KeyConfig(is_list=slot.multivalued, delete=True, flatten=True, mappings=mappings, serializers=serializers) + return KeyConfig( + is_list=slot.multivalued, delete=True, flatten=True, mappings=mappings, serializers=serializers + ) else: return None diff --git a/linkml_runtime/utils/curienamespace.py b/linkml_runtime/utils/curienamespace.py index fc342daa..b241c522 100644 --- a/linkml_runtime/utils/curienamespace.py +++ b/linkml_runtime/utils/curienamespace.py @@ -9,9 +9,9 @@ def __new__(cls, prefix: str, value: Union[str, URIRef]): try: rt = str.__new__(cls, value) except UnicodeDecodeError: - rt = str.__new__(cls, value, 'utf-8') + rt = str.__new__(cls, value, "utf-8") rt.prefix = prefix return rt - def curie(self, reference: Optional[str] = '') -> str: - return self.prefix + ':' + reference + def curie(self, reference: Optional[str] = "") -> str: + return self.prefix + ":" + reference diff --git a/linkml_runtime/utils/dictutils.py b/linkml_runtime/utils/dictutils.py index 06763832..50424694 100644 --- a/linkml_runtime/utils/dictutils.py +++ b/linkml_runtime/utils/dictutils.py @@ -3,6 +3,7 @@ from linkml_runtime.dumpers import json_dumper from linkml_runtime.utils.yamlutils import YAMLRoot + def as_simple_dict(element: YAMLRoot) -> dict: """ Returns the representation of element as a python dictionary diff --git a/linkml_runtime/utils/distroutils.py b/linkml_runtime/utils/distroutils.py index 60e7ce90..5749e6fb 100644 --- a/linkml_runtime/utils/distroutils.py +++ b/linkml_runtime/utils/distroutils.py @@ -1,6 +1,7 @@ """ Packaging for working with LinkML distributions """ + import logging import pkgutil from pathlib import PurePath @@ -18,33 +19,35 @@ def get_default_paths(file_type: str) -> list[PurePath]: paths = [] rel_dirs = [] # TODO: introspect this information - srcp = PurePath('src') - if file_type == 'yaml': - rel_dirs = [PurePath('model') /'schema', - PurePath('schema'), - PurePath('linkml'), - srcp / 'linkml', - srcp / 'model', - srcp / 'model' / 'schema', - srcp / 'schema', - ] - elif file_type == 'schema.json': - rel_dirs = [PurePath('jsonschema')] - elif file_type == 'context.jsonld': - rel_dirs = [PurePath('jsonld')] - elif '.' in file_type: + srcp = PurePath("src") + if file_type == "yaml": + rel_dirs = [ + PurePath("model") / "schema", + PurePath("schema"), + PurePath("linkml"), + srcp / "linkml", + srcp / "model", + srcp / "model" / "schema", + srcp / "schema", + ] + elif file_type == "schema.json": + rel_dirs = [PurePath("jsonschema")] + elif file_type == "context.jsonld": + rel_dirs = [PurePath("jsonld")] + elif "." in file_type: # e.g. 'owl.ttl' --> 'owl' - rel_dirs = [PurePath(file_type.split('.')[0])] + rel_dirs = [PurePath(file_type.split(".")[0])] else: rel_dirs = [] for rel_dir in rel_dirs: paths.append(rel_dir) # YAML files may be in the same directory as the python - paths.append(PurePath('.')) + paths.append(PurePath(".")) logger.debug(f"Paths to search: {paths}") return paths -def get_packaged_file_as_str(package: str, file_type: str, rel_paths: list[PurePath]=[], encoding="utf-8") -> str: + +def get_packaged_file_as_str(package: str, file_type: str, rel_paths: list[PurePath] = [], encoding="utf-8") -> str: """ Retrieve the value of a data file distributed alongside a python package @@ -54,24 +57,26 @@ def get_packaged_file_as_str(package: str, file_type: str, rel_paths: list[PureP :param encoding: :return: """ - parts = package.split('.') + parts = package.split(".") package_name = parts[-1] suffix = file_type data = None for path in get_default_paths(file_type) + rel_paths: try: - full_path = path / f'{package_name}.{suffix}' + full_path = path / f"{package_name}.{suffix}" data = pkgutil.get_data(package, str(full_path)) if data: break except FileNotFoundError: - logger.debug(f'candidate {path} not found') + logger.debug(f"candidate {path} not found") if not data: - raise FileNotFoundError(f'package: {package} file: {file_type}') + raise FileNotFoundError(f"package: {package} file: {file_type}") return data.decode(encoding) + def get_schema_string(package: str, **kwargs) -> str: - return get_packaged_file_as_str(package, file_type='yaml', **kwargs) + return get_packaged_file_as_str(package, file_type="yaml", **kwargs) + def get_jsonschema_string(package: str, **kwargs) -> str: - return get_packaged_file_as_str(package, file_type='schema.json', **kwargs) + return get_packaged_file_as_str(package, file_type="schema.json", **kwargs) diff --git a/linkml_runtime/utils/enumerations.py b/linkml_runtime/utils/enumerations.py index 6b9cd047..c6d26f50 100644 --- a/linkml_runtime/utils/enumerations.py +++ b/linkml_runtime/utils/enumerations.py @@ -20,6 +20,7 @@ def __setitem__(cls, key, value): def __setattr__(self, key, value): from linkml_runtime.linkml_model.meta import PermissibleValue + if self._defn.code_set and isinstance(value, PermissibleValue) and value.meaning: print(f"Validating {value.meaning} against {self._defn.code_set}") super().__setattr__(key, value) @@ -29,11 +30,12 @@ def __contains__(cls, item) -> bool: def isinstance_dt(cls: type, inst: str) -> bool: - """ Duck typing isinstance to prevent recursion errors """ + """Duck typing isinstance to prevent recursion errors""" return inst in [c.__name__ for c in type(cls).mro()] + class EnumDefinitionImpl(YAMLRoot, metaclass=EnumDefinitionMeta): - _defn: "EnumDefinition" = None # Overridden by implementation + _defn: "EnumDefinition" = None # Overridden by implementation def __init__(self, code: Union[str, Curie]) -> None: if isinstance_dt(code, "PermissibleValue"): @@ -51,10 +53,12 @@ def __init__(self, code: Union[str, Curie]) -> None: elif key not in self.__class__: raise ValueError(f"Unknown {self.__class__.__name__} enumeration code: {key}") elif isinstance_dt(code, "PermissibleValue"): - if getattr(self, 'code', None): + if getattr(self, "code", None): if self._code != code: - raise ValueError(f"Enumeration: {self.__class__.__name__} - " - f"Cannot change an existing permissible value entry for {code}") + raise ValueError( + f"Enumeration: {self.__class__.__name__} - " + f"Cannot change an existing permissible value entry for {code}" + ) else: self._code = code else: @@ -93,13 +97,13 @@ def curie(self): @classmethod def _addvals(cls): - """ Override this to add non-python compatible values """ + """Override this to add non-python compatible values""" pass def __str__(self) -> str: - """ The string representation of an enumerated value should be the code representing this value.""" + """The string representation of an enumerated value should be the code representing this value.""" return self._code.text def __repr__(self) -> str: rlist = [(f.name, getattr(self._code, f.name)) for f in fields(self._code)] - return self.__class__.__name__ + '(' + ', '.join([f"{f[0]}={repr(f[1])}" for f in rlist if f[1]]) + ')' + return self.__class__.__name__ + "(" + ", ".join([f"{f[0]}={repr(f[1])}" for f in rlist if f[1]]) + ")" diff --git a/linkml_runtime/utils/eval_utils.py b/linkml_runtime/utils/eval_utils.py index 31a7bdaf..6ca62916 100644 --- a/linkml_runtime/utils/eval_utils.py +++ b/linkml_runtime/utils/eval_utils.py @@ -10,11 +10,18 @@ # supported operators from typing import Any -operators = {ast.Add: op.add, ast.Sub: op.sub, ast.Mult: op.mul, - ast.Div: op.truediv, ast.Pow: op.pow, ast.BitXor: op.xor, - ast.USub: op.neg} +operators = { + ast.Add: op.add, + ast.Sub: op.sub, + ast.Mult: op.mul, + ast.Div: op.truediv, + ast.Pow: op.pow, + ast.BitXor: op.xor, + ast.USub: op.neg, +} compare_operators = {ast.Eq: op.eq, ast.Lt: op.lt, ast.LtE: op.le, ast.Gt: op.gt, ast.GtE: op.ge} + def eval_conditional(*conds: list[tuple[bool, Any]]) -> Any: """ Evaluate a collection of expression,value tuples, returing the first value whose expression is true @@ -31,12 +38,14 @@ def eval_conditional(*conds: list[tuple[bool, Any]]) -> Any: return val -funcs = {'max': (True, max), - 'min': (True, min), - 'len': (True, len), - 'str': (False, str), - 'strlen': (False, len), - 'case': (False, eval_conditional)} +funcs = { + "max": (True, max), + "min": (True, min), + "len": (True, len), + "str": (False, str), + "strlen": (False, len), + "case": (False, eval_conditional), +} class UnsetValueException(Exception): @@ -83,24 +92,23 @@ def eval_expr(expr: str, **kwargs) -> Any: :param expr: expression to evaluate """ - #if kwargs: + # if kwargs: # expr = expr.format(**kwargs) - if 'None' in expr: + if "None" in expr: # TODO: do this as part of parsing return None else: try: - return eval_(ast.parse(expr, mode='eval').body, kwargs) + return eval_(ast.parse(expr, mode="eval").body, kwargs) except UnsetValueException: return None - def eval_(node, bindings={}): if isinstance(node, ast.Num): return node.n elif isinstance(node, ast.Str): - if 's' in vars(node): + if "s" in vars(node): return node.s else: return node.value @@ -119,6 +127,7 @@ def eval_(node, bindings={}): elif isinstance(node, ast.Attribute): # e.g. for person.name, this returns the val of person v = eval_(node.value, bindings) + # lookup attribute, potentially distributing the results over collections def _get(obj: Any, k: str, recurse=True) -> Any: if isinstance(obj, dict): @@ -134,19 +143,20 @@ def _get(obj: Any, k: str, recurse=True) -> Any: return None else: return getattr(obj, k) + return _get(v, node.attr) elif isinstance(node, ast.List): return [eval_(x, bindings) for x in node.elts] elif isinstance(node, ast.Set): # sets are not part of the language; we use {x} as notation for x if len(node.elts) != 1: - raise ValueError(f'The {{}} must enclose a single variable') + raise ValueError(f"The {{}} must enclose a single variable") e = node.elts[0] if not isinstance(e, ast.Name): - raise ValueError(f'The {{}} must enclose a variable') + raise ValueError(f"The {{}} must enclose a variable") v = eval_(e, bindings) if v is None: - raise UnsetValueException(f'{e} is not set') + raise UnsetValueException(f"{e} is not set") else: return v elif isinstance(node, ast.Tuple): @@ -155,19 +165,19 @@ def _get(obj: Any, k: str, recurse=True) -> Any: return {eval_(k, bindings): eval_(v, bindings) for k, v in zip(node.keys, node.values)} elif isinstance(node, ast.Compare): # if len(node.ops) != 1: - raise ValueError(f'Must be exactly one op in {node}') + raise ValueError(f"Must be exactly one op in {node}") if type(node.ops[0]) not in compare_operators: - raise NotImplementedError(f'Not implemented: {node.ops[0]} in {node}') + raise NotImplementedError(f"Not implemented: {node.ops[0]} in {node}") py_op = compare_operators[type(node.ops[0])] if len(node.comparators) != 1: - raise ValueError(f'Must be exactly one comparator in {node}') + raise ValueError(f"Must be exactly one comparator in {node}") right = node.comparators[0] return py_op(eval_(node.left, bindings), eval_(right, bindings)) elif isinstance(node, ast.BinOp): # return operators[type(node.op)](eval_(node.left, bindings), eval_(node.right, bindings)) elif isinstance(node, ast.UnaryOp): # e.g., -1 return operators[type(node.op)](eval_(node.operand, bindings)) - #elif isinstance(node, ast.Match): + # elif isinstance(node, ast.Match): # # implementing this would restrict python version to 3.10 # # https://stackoverflow.com/questions/60208/replacements-for-switch-statement-in-python # raise NotImplementedError(f'Not supported') @@ -183,9 +193,9 @@ def _get(obj: Any, k: str, recurse=True) -> Any: takes_list, func = funcs[fn] args = [eval_(x, bindings) for x in node.args] if isinstance(args[0], list) and not takes_list: - return [func(*[x]+args[1:]) for x in args[0]] + return [func(*[x] + args[1:]) for x in args[0]] else: return func(*args) - raise NotImplementedError(f'Call {node.func} not implemented. node = {node}') + raise NotImplementedError(f"Call {node.func} not implemented. node = {node}") else: raise TypeError(node) diff --git a/linkml_runtime/utils/formatutils.py b/linkml_runtime/utils/formatutils.py index 37e437d2..5df60a56 100644 --- a/linkml_runtime/utils/formatutils.py +++ b/linkml_runtime/utils/formatutils.py @@ -4,12 +4,12 @@ from jsonasobj2 import JsonObj, as_dict, is_list, is_dict, items -ws_pattern = re.compile(r'\s+') -us_pattern = re.compile(r'_+') +ws_pattern = re.compile(r"\s+") +us_pattern = re.compile(r"_+") def uncamelcase(txt: str) -> str: - split_txt = re.split('(?=[A-Z])', txt) + split_txt = re.split("(?=[A-Z])", txt) new_text = "" for word in split_txt: if new_text == "": @@ -21,13 +21,13 @@ def uncamelcase(txt: str) -> str: def camelcase(txt: str) -> str: def _up(s: str): - return s[0].upper() + (s[1:] if len(s) > 1 else '') + return s[0].upper() + (s[1:] if len(s) > 1 else "") - return ''.join([_up(word) for word in us_pattern.sub(' ', txt.strip().replace(',', '')).split()]) + return "".join([_up(word) for word in us_pattern.sub(" ", txt.strip().replace(",", "")).split()]) def underscore(txt: str) -> str: - return ws_pattern.sub('_', txt.strip()).replace(',', '').replace('-', '_') + return ws_pattern.sub("_", txt.strip()).replace(",", "").replace("-", "_") def lcamelcase(txt: str) -> str: @@ -36,13 +36,13 @@ def lcamelcase(txt: str) -> str: def be(entry: object) -> str: - """ Return a stringified version of object replacing Nones with empty strings """ - return str(entry).strip() if entry else '' + """Return a stringified version of object replacing Nones with empty strings""" + return str(entry).strip() if entry else "" def mangled_attribute_name(clsname: str, attributename: str) -> str: - """ Return the mangling we use for attributes definitions """ - return lcamelcase(clsname) + '__' + underscore(attributename) + """Return the mangling we use for attributes definitions""" + return lcamelcase(clsname) + "__" + underscore(attributename) split_col = 115 @@ -57,15 +57,15 @@ def sfx(uri: str) -> str: :param uri: uri to be suffixed :return: URI with suffix """ - return str(uri) + ('' if uri.endswith(('/', '#', '_', ':')) else '/') + return str(uri) + ("" if uri.endswith(("/", "#", "_", ":")) else "/") def uri_for(prefix: str, suffix: str) -> str: - """ Generator for predicate and identifier URI's """ - if ':' in prefix: + """Generator for predicate and identifier URI's""" + if ":" in prefix: return sfx(prefix) + suffix else: - return prefix + ':' + suffix + return prefix + ":" + suffix def split_line(txt: str, split_len: int = split_col) -> list[str]: @@ -74,7 +74,7 @@ def split_line(txt: str, split_len: int = split_col) -> list[str]: words = txt.split() cur_line = "" for word in words: - word += ' ' + word += " " if len(cur_line) + len(word) > split_len: out_lines.append(cur_line if cur_line else word) if not cur_line: @@ -89,23 +89,24 @@ def split_line(txt: str, split_len: int = split_col) -> list[str]: def wrapped_annotation(txt: str) -> str: rval = [] - for line in [line.strip() for line in txt.split('\n')]: + for line in [line.strip() for line in txt.split("\n")]: if len(line) > split_col: rval += split_line(line) else: rval.append(line) - return '\n\t'.join(rval) + return "\n\t".join(rval) + def shex_results_as_string(rslts) -> str: - """ Pretty print ShEx Evaluation result """ + """Pretty print ShEx Evaluation result""" # TODO: Add this method to ShEx itself rval = [f"Evalutating: {str(rslts.focus)} against {str(rslts.start)}"] if rslts.result: rval.append("Result: CONFORMS") else: rval.append("Result: NonConforming") - rval += rslts.reason.split('\n') - return '\n'.join(rval) + rval += rslts.reason.split("\n") + return "\n".join(rval) def is_empty(v: Any) -> bool: @@ -141,9 +142,9 @@ def remove_empty_items(obj: Any, hide_protected_keys: bool = False, inside: bool Note that this will also convert Decimals to floats or ints; this is necessary as both json dumpers and yaml dumpers will encode Decimal types by default. See https://github.com/linkml/linkml/issues - + This is easier than fixing the individual serializers, described here: - + - JSON: https://bugs.python.org/issue16535, https://stackoverflow.com/questions/1960516/python-json-serialize-a-decimal-object - YAML: https://stackoverflow.com/questions/21695705/dump-an-python-object-as-yaml-file/51261042, https://github.com/yaml/pyyaml/pull/372 @@ -154,20 +155,31 @@ def remove_empty_items(obj: Any, hide_protected_keys: bool = False, inside: bool """ if is_list(obj): # for discussion of logic, see: https://github.com/linkml/linkml-runtime/issues/42 - obj_list = [e for e in [remove_empty_items(l, hide_protected_keys=hide_protected_keys, inside=True) - for l in obj if l != '_root'] if not is_empty(e)] + obj_list = [ + e + for e in [ + remove_empty_items(l, hide_protected_keys=hide_protected_keys, inside=True) for l in obj if l != "_root" + ] + if not is_empty(e) + ] return obj_list if not inside or not is_empty(obj_list) else None elif is_dict(obj): - obj_dict = {k: v for k, v in [(k2, remove_empty_items(v2, hide_protected_keys=hide_protected_keys, inside=True)) - for k2, v2 in items(obj)] if not is_empty(v)} + obj_dict = { + k: v + for k, v in [ + (k2, remove_empty_items(v2, hide_protected_keys=hide_protected_keys, inside=True)) + for k2, v2 in items(obj) + ] + if not is_empty(v) + } # https://github.com/linkml/linkml/issues/119 # Remove the additional level of nesting with enums - if len(obj_dict) == 1 and list(obj_dict.keys())[0] == '_code': - enum_text = list(obj_dict.values())[0].get('text', None) + if len(obj_dict) == 1 and list(obj_dict.keys())[0] == "_code": + enum_text = list(obj_dict.values())[0].get("text", None) if enum_text is not None: return enum_text - if hide_protected_keys and len(obj_dict) == 1 and str(list(obj_dict.keys())[0]).startswith('_'): + if hide_protected_keys and len(obj_dict) == 1 and str(list(obj_dict.keys())[0]).startswith("_"): inner_element = list(obj_dict.values())[0] if isinstance(inner_element, dict): obj_dict = inner_element @@ -178,7 +190,7 @@ def remove_empty_items(obj: Any, hide_protected_keys: bool = False, inside: bool # note that attempting to implement https://bugs.python.org/issue16535 # will not work for yaml serializations v = str(obj) - if '.' in v and not v.endswith('.0'): + if "." in v and not v.endswith(".0"): return float(obj) else: return int(obj) diff --git a/linkml_runtime/utils/inference_utils.py b/linkml_runtime/utils/inference_utils.py index c8545d78..2cd452bd 100644 --- a/linkml_runtime/utils/inference_utils.py +++ b/linkml_runtime/utils/inference_utils.py @@ -16,6 +16,7 @@ RESOLVE_FUNC = Callable[[str, Any], Any] + def obj_as_dict_nonrecursive(obj: YAMLRoot, resolve_function: RESOLVE_FUNC = None) -> dict[str, Any]: """ Translates an object into a dict, for the purposes of input into formatted strings @@ -29,6 +30,7 @@ def obj_as_dict_nonrecursive(obj: YAMLRoot, resolve_function: RESOLVE_FUNC = Non else: return {k: v for k, v in vars(obj).items()} + @dataclass class Config: """ @@ -37,6 +39,7 @@ class Config: - slot.string_serialization - slot.equals_expression """ + use_string_serialization: bool = field(default_factory=lambda: True) parse_string_serialization: bool = field(default_factory=lambda: False) use_rules: bool = field(default_factory=lambda: False) @@ -48,14 +51,19 @@ class Policy(Enum): """ Policy for when inferred values differ from already set values """ + STRICT = "strict" OVERRIDE = "override" KEEP = "keep" -def generate_slot_value(obj: YAMLRoot, slot_name: Union[str, SlotDefinitionName], schemaview: SchemaView, - class_name: Union[str, ClassDefinitionName] = None, - config: Config = Config()) -> Optional[Any]: +def generate_slot_value( + obj: YAMLRoot, + slot_name: Union[str, SlotDefinitionName], + schemaview: SchemaView, + class_name: Union[str, ClassDefinitionName] = None, + config: Config = Config(), +) -> Optional[Any]: """ Infer the value of a slot for a given object @@ -76,7 +84,7 @@ def generate_slot_value(obj: YAMLRoot, slot_name: Union[str, SlotDefinitionName] mapped_slot = schemaview.slot_name_mappings()[slot_name] slot_name = mapped_slot.name slot = schemaview.induced_slot(slot_name, class_name) - logger.debug(f' CONF={config}') + logger.debug(f" CONF={config}") if config.use_string_serialization: if slot.string_serialization: if isinstance(obj, JsonObj): @@ -88,13 +96,18 @@ def generate_slot_value(obj: YAMLRoot, slot_name: Union[str, SlotDefinitionName] if isinstance(obj, JsonObj): return eval_expr(slot.equals_expression, **obj_as_dict_nonrecursive(obj, config.resolve_function)) if config.use_rules: - raise NotImplementedError(f'Rules not implemented for {config}') + raise NotImplementedError(f"Rules not implemented for {config}") return None -def infer_slot_value(obj: YAMLRoot, slot_name: Union[str, SlotDefinitionName], schemaview: SchemaView, - class_name: Union[str, ClassDefinitionName] = None, - policy: Policy = Policy.STRICT, config: Config = Config()): +def infer_slot_value( + obj: YAMLRoot, + slot_name: Union[str, SlotDefinitionName], + schemaview: SchemaView, + class_name: Union[str, ClassDefinitionName] = None, + policy: Policy = Policy.STRICT, + config: Config = Config(), +): """ Infer the value of a slot for an object @@ -109,24 +122,28 @@ def infer_slot_value(obj: YAMLRoot, slot_name: Union[str, SlotDefinitionName], s if v is not None and policy == Policy.KEEP: return v new_v = generate_slot_value(obj, slot_name, schemaview, class_name=class_name, config=config) - logger.debug(f'SETTING {slot_name} = {new_v} // current={v}, {policy}') + logger.debug(f"SETTING {slot_name} = {new_v} // current={v}, {policy}") if new_v: # check if new value is different; not str check is necessary as enums may not be converted if v is not None and new_v != v and str(new_v) != str(v): if policy == Policy.STRICT: - raise ValueError(f'Inconsistent value {v} != {new_v} for {slot_name} for {obj}') + raise ValueError(f"Inconsistent value {v} != {new_v} for {slot_name} for {obj}") elif policy == Policy.OVERRIDE: setattr(obj, slot_name, new_v) obj.__post_init__() else: setattr(obj, slot_name, new_v) - #print(f'CALLING POST INIT ON {obj} from {slot_name} = {new_v}') + # print(f'CALLING POST INIT ON {obj} from {slot_name} = {new_v}') obj.__post_init__() -def infer_all_slot_values(obj: YAMLRoot, schemaview: SchemaView, - class_name: Union[str, ClassDefinitionName] = None, - policy: Policy = Policy.STRICT, config: Config = Config()): +def infer_all_slot_values( + obj: YAMLRoot, + schemaview: SchemaView, + class_name: Union[str, ClassDefinitionName] = None, + policy: Policy = Policy.STRICT, + config: Config = Config(), +): """ Walks object tree inferring all slot values. @@ -140,13 +157,17 @@ def infer_all_slot_values(obj: YAMLRoot, schemaview: SchemaView, :param config: :return: """ + def infer(in_obj: YAMLRoot): - logger.debug(f'INFER={in_obj}') - if isinstance(in_obj, YAMLRoot) and not isinstance(in_obj, EnumDefinitionImpl) and not isinstance(in_obj, PermissibleValue): + logger.debug(f"INFER={in_obj}") + if ( + isinstance(in_obj, YAMLRoot) + and not isinstance(in_obj, EnumDefinitionImpl) + and not isinstance(in_obj, PermissibleValue) + ): for k, v in vars(in_obj).items(): - #print(f' ISV={k} curr={v} policy={policy} in_obj={type(in_obj)}') + # print(f' ISV={k} curr={v} policy={policy} in_obj={type(in_obj)}') infer_slot_value(in_obj, k, schemaview, class_name=class_name, policy=policy, config=config) return in_obj - traverse_object_tree(obj, infer) - + traverse_object_tree(obj, infer) diff --git a/linkml_runtime/utils/introspection.py b/linkml_runtime/utils/introspection.py index 0f50aa77..41c0d5f2 100644 --- a/linkml_runtime/utils/introspection.py +++ b/linkml_runtime/utils/introspection.py @@ -10,7 +10,8 @@ from linkml_runtime.utils.yamlutils import YAMLRoot -SCHEMA_PATH_VAR = 'schema_path' +SCHEMA_PATH_VAR = "schema_path" + def package_schema_path(package: Union[str, ModuleType]) -> Path: if isinstance(package, str): @@ -36,6 +37,7 @@ def package_schemaview(package: str, **kwargs) -> SchemaView: """ return SchemaView(get_schema_string(package, **kwargs)) + def object_schemaview(obj: YAMLRoot) -> SchemaView: """ Given an object that instantiates a LinkML class, return the corresponding SchemaView @@ -46,6 +48,7 @@ def object_schemaview(obj: YAMLRoot) -> SchemaView: cls = type(obj) return package_schemaview(cls.__module__) + def object_class_definition(obj: YAMLRoot) -> ClassDefinition: """ Given an object that instantiates a LinkML class, return its ClassDefinition @@ -56,5 +59,3 @@ def object_class_definition(obj: YAMLRoot) -> ClassDefinition: sv = object_schemaview(obj) cls = type(obj) return sv.get_class(cls.class_name) - - diff --git a/linkml_runtime/utils/metamodelcore.py b/linkml_runtime/utils/metamodelcore.py index 26093793..0eb7c764 100644 --- a/linkml_runtime/utils/metamodelcore.py +++ b/linkml_runtime/utils/metamodelcore.py @@ -27,28 +27,28 @@ def empty_list(): - """ Return a field with a list factory """ + """Return a field with a list factory""" return field(default_factory=list) def empty_dict(): - """ Return a field with a dictionary factory """ + """Return a field with a dictionary factory""" return field(default_factory=dict) def addl_args(): rval = field(default_factory=dict) - rval.name = '**args' + rval.name = "**args" return rval def empty_set(): - """" Return a field with a set factory """ + """ " Return a field with a set factory""" return field(default_factory=set) def bnode(): - """ Return a field with a BNode factory """ + """Return a field with a BNode factory""" return field(default_factory=lambda: BNode().n3()) @@ -57,7 +57,8 @@ def bnode(): class NCName(str): - """ Wrapper for NCName class """ + """Wrapper for NCName class""" + def __init__(self, v: str) -> None: if is_strict() and not self.is_valid(v): raise ValueError(f"{TypedNode.yaml_loc(v)}{v}: Not a valid NCName") @@ -66,11 +67,12 @@ def __init__(self, v: str) -> None: @classmethod def is_valid(cls, v: str) -> bool: - return is_ncname(v) if v else True # Empty is default name + return is_ncname(v) if v else True # Empty is default name class Identifier(str, TypedNode): - """ A datatype that can be a URI, CURIE or a BNode """ + """A datatype that can be a URI, CURIE or a BNode""" + def __init__(self, v: Union[str, URIRef, BNode, "URIorCURIE", "Identifier"]) -> None: v = str(v) if not isinstance(v, str) else v if is_strict() and not self.is_valid(v): @@ -81,14 +83,14 @@ def __init__(self, v: Union[str, URIRef, BNode, "URIorCURIE", "Identifier"]) -> def is_valid(cls, v: Union[str, URIRef, BNode, "URIorCURIE", "Identifier"]) -> bool: if v is None: return False - if v.startswith('_:'): - pfx, ln = v.split(':') + if v.startswith("_:"): + pfx, ln = v.split(":") return len(ln) == 1 and bool(Curie.term_name.match(ln)) else: return URIorCURIE.is_valid(v) def as_identifier(self, nsm: Optional[Namespaces]) -> Optional[rdflib_Identifier]: - if self.startswith('_:'): + if self.startswith("_:"): return BNode(self) elif URIorCURIE.is_absolute(self): return URIRef(self) @@ -98,7 +100,8 @@ def as_identifier(self, nsm: Optional[Namespaces]) -> Optional[rdflib_Identifier class URIorCURIE(Identifier): - """ A datatype that can either be a URI or a CURIE """ + """A datatype that can either be a URI or a CURIE""" + def __init__(self, v: Union[str, URIRef, "Curie", "URIorCURIE"]) -> None: if is_strict() and not URIorCURIE.is_valid(v): raise ValueError(f"{v} is not a valid URI or CURIE") @@ -124,10 +127,11 @@ def is_absolute(v: str) -> bool: def is_curie(v: str, nsm: Optional[Namespaces] = None) -> bool: if not validate_curie(v): return False - if ':' in v and '://' not in v: - ns, ln = v.split(':', 1) - return len(ns) == 0 or (NCName.is_valid(ns) and - (nsm is None or any(ns == nsns for nsns, _ in nsm.namespaces()))) + if ":" in v and "://" not in v: + ns, ln = v.split(":", 1) + return len(ns) == 0 or ( + NCName.is_valid(ns) and (nsm is None or any(ns == nsns for nsns, _ in nsm.namespaces())) + ) return False def as_uri(self, nsm: Namespaces) -> Optional[URIRef]: @@ -137,8 +141,8 @@ def as_uri(self, nsm: Namespaces) -> Optional[URIRef]: class URI(URIorCURIE): - """ A relative absolute URI - """ + """A relative absolute URI""" + def __init__(self, v: str) -> None: if is_strict() and not URI.is_valid(v): raise ValueError(f"'{v}': is not a valid URI") @@ -155,8 +159,8 @@ def is_valid(cls, v: str) -> bool: class Curie(URIorCURIE): + """Wrapper for an element that MUST be represented as a CURIE""" - """ Wrapper for an element that MUST be represented as a CURIE """ def __init__(self, v: str) -> None: if is_strict() and not self.is_valid(v): raise ValueError(f"{v} is not a valid CURIE") @@ -168,7 +172,7 @@ def __init__(self, v: str) -> None: @classmethod def ns_ln(cls, v: str) -> Optional[tuple[str, str]]: # See if this is indeed a valid CURIE, ie, it can be split by a colon - curie_split = v.split(':', 1) + curie_split = v.split(":", 1) if len(curie_split) == 1: # there is no ':' character in the string, ie, it is not a valid CURIE return None @@ -184,12 +188,12 @@ def is_valid(cls, v: str) -> bool: if not validate_curie(v): return False pnln = cls.ns_ln(v) - #return pnln is not None and (not pnln[0] or isinstance(pnln[0], PN_PREFIX)) + # return pnln is not None and (not pnln[0] or isinstance(pnln[0], PN_PREFIX)) return pnln is not None # This code was extracted from the termorcurie package of the rdfa def as_uri(self, nsm: Namespaces) -> Optional[URIRef]: - """ Return the URI for the CURIE if a mapping is available, otherwise return None """ + """Return the URI for the CURIE if a mapping is available, otherwise return None""" try: return nsm.uri_for(self) except ValueError: @@ -198,9 +202,10 @@ def as_uri(self, nsm: Namespaces) -> Optional[URIRef]: class Bool: - """ Wrapper for boolean datatype """ - bool_true = re.compile(r'([Tt]rue)|(1)$') - bool_false = re.compile(r'([Ff]alse)|(0)$') + """Wrapper for boolean datatype""" + + bool_true = re.compile(r"([Tt]rue)|(1)$") + bool_false = re.compile(r"([Ff]alse)|(0)$") def __new__(cls, v: Union[str, bool, "Bool"]) -> bool: if isinstance(v, bool): @@ -215,12 +220,13 @@ def __new__(cls, v: Union[str, bool, "Bool"]) -> bool: @classmethod def is_valid(cls, v: str) -> bool: - """ Determine whether the string v is a valid instance of bool """ + """Determine whether the string v is a valid instance of bool""" return isinstance(v, bool) or cls.bool_true.match(str(v)) or cls.bool_false.match(str(v)) class XSDTime(str, TypedNode): - """ Wrapper for time datatype """ + """Wrapper for time datatype""" + def __new__(cls, value: Union[str, datetime.time, datetime.datetime, Literal]) -> str: if is_strict() and not cls.is_valid(value): raise ValueError(f"{value} is not a valid time") @@ -252,7 +258,8 @@ def is_valid(cls, value: Union[str, datetime.time, datetime.datetime, Literal]) class XSDDate(str, TypedNode): - """ Wrapper for date datatype """ + """Wrapper for date datatype""" + def __new__(cls, value: Union[str, datetime.date, Literal]) -> str: if is_strict() and not cls.is_valid(value): raise ValueError(f"{value} is not a valid date") @@ -276,7 +283,7 @@ def is_valid(cls, value: Union[str, datetime.date, Literal]) -> bool: value = value.value if isinstance(value, datetime.date): value = value.isoformat() - if not re.match(r'^\d{4}-\d{2}-\d{2}$', value): + if not re.match(r"^\d{4}-\d{2}-\d{2}$", value): return False try: datetime.date.fromisoformat(str(value)) @@ -286,7 +293,8 @@ def is_valid(cls, value: Union[str, datetime.date, Literal]) -> bool: class XSDDateTime(str, TypedNode): - """ Wrapper for date time dataclass """ + """Wrapper for date time dataclass""" + def __new__(cls, value: Union[str, datetime.datetime, Literal]) -> str: if is_strict() and not cls.is_valid(value): raise ValueError(f"{value} is not a valid datetime") @@ -294,7 +302,7 @@ def __new__(cls, value: Union[str, datetime.datetime, Literal]) -> str: value = value.value try: if not isinstance(value, datetime.datetime): - value = datetime.datetime.fromisoformat(value) # Note that this handles non 'T' format as well + value = datetime.datetime.fromisoformat(value) # Note that this handles non 'T' format as well return value.isoformat() except TypeError as e: pass @@ -318,10 +326,10 @@ def is_valid(cls, value: Union[str, datetime.datetime, Literal]) -> bool: class NodeIdentifier(Identifier): - """ A RDFLib Identifier that represents a URI, CURIE or BNode in a model """ + """A RDFLib Identifier that represents a URI, CURIE or BNode in a model""" def __new__(cls, v: Union[str, URIRef, URIorCURIE, "NodeIdentifier", BNode]) -> "NodeIdentifier": - if hasattr(v, 'id'): # Allows passing instances of identified objects + if hasattr(v, "id"): # Allows passing instances of identified objects v = v.id if isinstance(v, NodeIdentifier): if is_strict() and not issubclass(type(v), cls): @@ -338,12 +346,12 @@ def __post_init__(self): class ElementIdentifier(NodeIdentifier): - """ A URIorCURIE that represents an element in a model """ + """A URIorCURIE that represents an element in a model""" def __new__(cls, v: Union[str, URIRef, URIorCURIE, NodeIdentifier, "ElementIdentifier"]) -> "ElementIdentifier": - if hasattr(v, 'id'): # Allows passing instances of identified objects + if hasattr(v, "id"): # Allows passing instances of identified objects v = v.id - if is_strict() and (type(v) is BNode or str(v).startswith('_:')): + if is_strict() and (type(v) is BNode or str(v).startswith("_:")): raise ValueError(f"Invalid identifier type for {cls.__name__}: {v} ({type(v).__name__})") return super().__new__(cls, v) diff --git a/linkml_runtime/utils/namespaces.py b/linkml_runtime/utils/namespaces.py index 20d9252a..f81863b9 100644 --- a/linkml_runtime/utils/namespaces.py +++ b/linkml_runtime/utils/namespaces.py @@ -25,7 +25,7 @@ "obo_context", "ro_vocab_context", "semweb_context", - "semweb_vocab_context" + "semweb_vocab_context", ] PREFIXMAPS_CONTEXTS = [ "bioportal", @@ -36,29 +36,30 @@ "merged", "merged.oak", "obo", - "prefixcc" + "prefixcc", ] class Namespaces(CaseInsensitiveDict): - """ Namespace manager. Functions as both a dictionary and a python - namespace. + """Namespace manager. Functions as both a dictionary and a python + namespace. - Supports: namespaces.NS [= uri] - namespaces[NS] [= uri] - namespaces._default [= uri] # namespace for ':' - namespaces._base [= uri] # namespace for @base + Supports: namespaces.NS [= uri] + namespaces[NS] [= uri] + namespaces._default [= uri] # namespace for ':' + namespaces._base [= uri] # namespace for @base - Functions: namespaces.curie_for(uri) --> curie - namespaces.prefix_for(uri_or_curie) --> NCName - namespaces.add_prefixmap(map name) - """ - _default_key = '@default' - _base_key = '@base' + Functions: namespaces.curie_for(uri) --> curie + namespaces.prefix_for(uri_or_curie) --> NCName + namespaces.add_prefixmap(map name) + """ + + _default_key = "@default" + _base_key = "@base" # BNODE management -- when the namespace is '_', we map the ln via _bnodes to a new bnode - _bnodes = {} # BNode to BNode map - _empty_bnode = BNode() # Node for '_:' + _bnodes = {} # BNode to BNode map + _empty_bnode = BNode() # Node for '_:' def __init__(self, g: Optional[Graph] = None, *args, **kwargs): super().__init__(*args, **kwargs) @@ -66,7 +67,7 @@ def __init__(self, g: Optional[Graph] = None, *args, **kwargs): self.from_graph(g) def __setitem__(self, key, value): - if key == '_': + if key == "_": if not value: if self._empty_bnode not in self._bnodes: self._bnodes[self._empty_bnode] = BNode() @@ -80,8 +81,9 @@ def __setitem__(self, key, value): v = Namespace(str(value)) if key in self: if self[key] != v: - logging.getLogger('Namespaces').\ - warning(f"{key} namespace is already mapped to {self[key]} - Mapping to {v} ignored") + logging.getLogger("Namespaces").warning( + f"{key} namespace is already mapped to {self[key]} - Mapping to {v} ignored" + ) else: super().__setitem__(key, v) else: @@ -91,7 +93,7 @@ def __getattr__(self, item): return self[item] def __setattr__(self, key: str, value): - if key.startswith('_') and len(key) > 1: + if key.startswith("_") and len(key) > 1: super().__setattr__(key, value) else: self[key] = value @@ -150,7 +152,7 @@ def curie_for(self, uri: Any, default_ok: bool = True, pythonform: bool = False) if pythonform: default_ok = False - match: tuple[str, Optional[Namespace]] = ('', None) # match string / prefix + match: tuple[str, Optional[Namespace]] = ("", None) # match string / prefix uri_string = str(uri) # Find the longest match for the URI, self.items() is a list of (prefix/namespace, uri base prefix) tuples @@ -160,8 +162,9 @@ def curie_for(self, uri: Any, default_ok: bool = True, pythonform: bool = False) if uri_string.startswith(uri_base_string): # default key and base key are `@default` `@base` respectively # at this point match[0] is '', match[1] is None - if len(uri_base_string) > len(match[0]) and \ - (default_ok or namespace not in (Namespaces._default_key, Namespaces._base_key)): + if len(uri_base_string) > len(match[0]) and ( + default_ok or namespace not in (Namespaces._default_key, Namespaces._base_key) + ): match = (uri_base_string, namespace) # check if length of uri_base_string is > 0, now after basically assigning it to be the URI base string @@ -171,7 +174,7 @@ def curie_for(self, uri: Any, default_ok: bool = True, pythonform: bool = False) # uppercase the namespace namespace = match[1].upper() # match[0] is the URI base string, so we remove that from the incoming URI - leftover_uri = uri_string.replace((match[0]), '') + leftover_uri = uri_string.replace((match[0]), "") if not leftover_uri: return f"URIRef(str({namespace}))" # why? @@ -181,11 +184,11 @@ def curie_for(self, uri: Any, default_ok: bool = True, pythonform: bool = False) return f'{namespace}["{leftover_uri}"]' else: if match[1] == Namespaces._default_key: - return uri_string.replace(match[0], ':') + return uri_string.replace(match[0], ":") elif match[1] == Namespaces._base_key: - return uri_string.replace(match[0], '') + return uri_string.replace(match[0], "") else: - return uri_string.replace(match[0], match[1] + ':') + return uri_string.replace(match[0], match[1] + ":") return None def prefix_for(self, uri_or_curie: Any, case_shift: bool = True) -> Optional[str]: @@ -193,14 +196,14 @@ def prefix_for(self, uri_or_curie: Any, case_shift: bool = True) -> Optional[str def prefix_suffix(self, uri_or_curie: Any, case_shift: bool = True) -> tuple[Optional[str], Optional[str]]: uri_or_curie = str(uri_or_curie) - if '://' in uri_or_curie: + if "://" in uri_or_curie: uri_or_curie = self.curie_for(uri_or_curie) if not uri_or_curie: return None, None - if ':' in uri_or_curie: - pfx, sfx = uri_or_curie.split(':') + if ":" in uri_or_curie: + pfx, sfx = uri_or_curie.split(":") else: - pfx, sfx = uri_or_curie, '' + pfx, sfx = uri_or_curie, "" return self._cased_key(pfx) if case_shift else pfx, sfx def uri_for(self, uri_or_curie: Any) -> URIRef: @@ -211,12 +214,12 @@ def uri_for(self, uri_or_curie: Any) -> URIRef: :return: Corresponding URI """ uri_or_curie_str = str(uri_or_curie) - if '://' in uri_or_curie_str: + if "://" in uri_or_curie_str: return URIRef(uri_or_curie_str) - if ':\\' in uri_or_curie_str: # Windows drive letters + if ":\\" in uri_or_curie_str: # Windows drive letters return URIRef(uri_or_curie_str) - if ':' in uri_or_curie_str: - prefix, local = str(uri_or_curie_str).split(':', 1) + if ":" in uri_or_curie_str: + prefix, local = str(uri_or_curie_str).split(":", 1) if not prefix: prefix = self._default_key elif not is_ncname(prefix): @@ -229,27 +232,27 @@ def uri_for(self, uri_or_curie: Any) -> URIRef: return URIRef(self.join(self[prefix], local)) def uri_or_curie_for(self, prefix: Union[str, URIRef], suffix: str) -> str: - """ Return a CURIE for prefix/suffix if possible, else a URI """ - if isinstance(prefix, URIRef) or ':/' in str(prefix): + """Return a CURIE for prefix/suffix if possible, else a URI""" + if isinstance(prefix, URIRef) or ":/" in str(prefix): prefix_as_uri = str(prefix) for k, v in self.items(): - if not k.startswith('@') and prefix_as_uri == str(v): - return k + ':' + suffix + if not k.startswith("@") and prefix_as_uri == str(v): + return k + ":" + suffix return self.join(str(prefix), suffix) elif prefix not in self: raise ValueError(f"Unrecognized prefix: {prefix}") else: - return prefix + ':' + suffix + return prefix + ":" + suffix def load_graph(self, g: Graph) -> Graph: - """ Transfer all of the known namespaces into G """ + """Transfer all of the known namespaces into G""" for k, v in self.items(): - if not k.startswith('_') and not k.startswith('@'): + if not k.startswith("_") and not k.startswith("@"): g.bind(k, URIRef(v)) return g def from_graph(self, g: Graph) -> "Namespaces": - """ Transfer al bindings from G """ + """Transfer al bindings from G""" for ns, name in g.namespaces(): if ns: self[ns] = name @@ -271,7 +274,7 @@ def sfx(uri: str) -> str: :param uri: uri to be suffixed :return: URI with suffix """ - return str(uri) + ('' if uri.endswith(('/', '#')) else '/') + return str(uri) + ("" if uri.endswith(("/", "#")) else "/") def add_prefixmap(self, map_name: str, include_defaults: bool = True) -> None: """ diff --git a/linkml_runtime/utils/pattern.py b/linkml_runtime/utils/pattern.py index 941bd54e..9ae0c0c4 100644 --- a/linkml_runtime/utils/pattern.py +++ b/linkml_runtime/utils/pattern.py @@ -1,14 +1,15 @@ from functools import lru_cache import re + # We might want to deprecate this method in favor of PatternResolver in the future def generate_patterns(schema_view) -> dict[str, str]: """Generates a dictionary of slot patterns corresponding to the structured patterns in the settings. :param schema_view: SchemaView object with LinkML YAML already loaded - :return generated_patterns: dictionary with the - expanded structured patterns + :return generated_patterns: dictionary with the + expanded structured patterns """ resolver = PatternResolver(schema_view) @@ -77,11 +78,6 @@ def resolve(self, pattern: str) -> str: converted = pattern for item in reversed: - converted = ( - converted[: item["start"]] - + item["string"] - + converted[item["end"] :] - ) + converted = converted[: item["start"]] + item["string"] + converted[item["end"] :] return converted - diff --git a/linkml_runtime/utils/permissiblevalueimpl.py b/linkml_runtime/utils/permissiblevalueimpl.py index c7cd3043..bdc846ec 100644 --- a/linkml_runtime/utils/permissiblevalueimpl.py +++ b/linkml_runtime/utils/permissiblevalueimpl.py @@ -8,18 +8,21 @@ from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from utils.enumerations import EnumDefinitionImpl -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") RenderingURI = URI + class PermissibleValueText(extended_str): pass + @dataclass class PermissibleValue(YAMLRoot): """ a permissible value, accompanied by intended text and an optional mapping to a concept URI """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = LINKML.PermissibleValue @@ -87,11 +90,17 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.see_also = [self.see_also] self.see_also = [v if isinstance(v, URIorCURIE) else URIorCURIE(v) for v in self.see_also] - if self.deprecated_element_has_exact_replacement is not None and not isinstance(self.deprecated_element_has_exact_replacement, URIorCURIE): + if self.deprecated_element_has_exact_replacement is not None and not isinstance( + self.deprecated_element_has_exact_replacement, URIorCURIE + ): self.deprecated_element_has_exact_replacement = URIorCURIE(self.deprecated_element_has_exact_replacement) - if self.deprecated_element_has_possible_replacement is not None and not isinstance(self.deprecated_element_has_possible_replacement, URIorCURIE): - self.deprecated_element_has_possible_replacement = URIorCURIE(self.deprecated_element_has_possible_replacement) + if self.deprecated_element_has_possible_replacement is not None and not isinstance( + self.deprecated_element_has_possible_replacement, URIorCURIE + ): + self.deprecated_element_has_possible_replacement = URIorCURIE( + self.deprecated_element_has_possible_replacement + ) if self.is_a is not None and not isinstance(self.is_a, PermissibleValueText): self.is_a = PermissibleValueText(self.is_a) @@ -110,31 +119,35 @@ class PvFormulaOptions(EnumDefinitionImpl): """ The formula used to generate the set of permissible values from the code_set values """ - CODE = PermissibleValue(text="CODE", - description="The permissible values are the set of possible codes in the code set") - CURIE = PermissibleValue(text="CURIE", - description="The permissible values are the set of CURIES in the code set") - URI = PermissibleValue(text="URI", - description="The permissible values are the set of code URIs in the code set") - FHIR_CODING = PermissibleValue(text="FHIR_CODING", - description="The permissible values are the set of FHIR coding elements derived from the code set") + + CODE = PermissibleValue( + text="CODE", description="The permissible values are the set of possible codes in the code set" + ) + CURIE = PermissibleValue(text="CURIE", description="The permissible values are the set of CURIES in the code set") + URI = PermissibleValue(text="URI", description="The permissible values are the set of code URIs in the code set") + FHIR_CODING = PermissibleValue( + text="FHIR_CODING", + description="The permissible values are the set of FHIR coding elements derived from the code set", + ) _defn = EnumDefinition( name="PvFormulaOptions", description="The formula used to generate the set of permissible values from the code_set values", ) + class PermissibleValueImpl(PermissibleValue): """ Permissible Value implementation """ + def __init__(self, *args, defn: EnumDefinitionImpl, **kwargs) -> None: - """ Record the referencing definition to allow the entry to be fleshed out from a terminology service """ + """Record the referencing definition to allow the entry to be fleshed out from a terminology service""" super().__init__(*args, **kwargs) self._defn = defn def __post_init__(self, **kwargs: dict[str, Any]) -> None: - """ Make sure that we are correctly situated in the containing definition """ + """Make sure that we are correctly situated in the containing definition""" if self.text in self._defn: if self._defn.permissible_values[self.text] != self: raise TypeError(f"Permissible value for code: {self.text} is already assigned") diff --git a/linkml_runtime/utils/ruleutils.py b/linkml_runtime/utils/ruleutils.py index a9821e70..abce64e3 100644 --- a/linkml_runtime/utils/ruleutils.py +++ b/linkml_runtime/utils/ruleutils.py @@ -2,7 +2,16 @@ from dataclasses import dataclass from linkml_runtime.utils.schemaview import SchemaView -from linkml_runtime.linkml_model.meta import ClassDefinition, SlotDefinition, ClassExpression, ClassDefinitionName, ClassRule, AnonymousClassExpression, SlotExpression, SlotDefinitionName +from linkml_runtime.linkml_model.meta import ( + ClassDefinition, + SlotDefinition, + ClassExpression, + ClassDefinitionName, + ClassRule, + AnonymousClassExpression, + SlotExpression, + SlotDefinitionName, +) logger = logging.getLogger(__name__) @@ -11,36 +20,41 @@ class AtomicClassExpression: """ aka literal (https://en.wikipedia.org/wiki/Literal_(mathematical_logic)) """ + expression: ClassExpression negated: bool def __str__(self): if self.negated: - return f'NOT {self.expression}' + return f"NOT {self.expression}" else: return str(self.expression) + class ClassExpressionConjunction: """ conjunction of class literals """ + operands: AtomicClassExpression def __str__(self): - return ' AND '.join([str(op) for op in self.operands]) + return " AND ".join([str(op) for op in self.operands]) + @dataclass class DisjunctiveNormalFormClassExpression: """ A boolean combination of class expressions in Disjunctive Normal Form """ + operands: list[ClassExpressionConjunction] def __str__(self): - return ' OR '.join([str(op) for op in self.operands]) + return " OR ".join([str(op) for op in self.operands]) -def get_range_as_disjunction(slot: SlotExpression) -> set[ClassDefinitionName]: +def get_range_as_disjunction(slot: SlotExpression) -> set[ClassDefinitionName]: """ translate the range of a slot as defined by both range expressions and direct named class ranges to a disjunctive expression @@ -58,14 +72,16 @@ def get_range_as_disjunction(slot: SlotExpression) -> set[ClassDefinitionName]: if isinstance(slot.range_expression, ClassExpression): conjs.append(get_disjunction(slot.range_expression)) else: - logger.warning(f'Expected range_expression for {slot.name} to be a class expression, not {type(slot.range_expression)}') + logger.warning( + f"Expected range_expression for {slot.name} to be a class expression, not {type(slot.range_expression)}" + ) if len(conjs) == 0: if slot.range: conjs.append({slot.range}) else: - logger.warning(f'No range for {slot.name}') + logger.warning(f"No range for {slot.name}") if len(conjs) > 1: - raise Exception(f'Cannot determine range disjunction for {slot}, got conjunctions: {conjs}') + raise Exception(f"Cannot determine range disjunction for {slot}, got conjunctions: {conjs}") if len(conjs) == 0: return None else: @@ -82,8 +98,12 @@ def get_disjunction(cx: ClassExpression) -> set[ClassDefinitionName]: return disj -def subclass_to_rules(view: SchemaView, child: ClassDefinitionName, parent: ClassDefinitionName, - type_designator_slot: SlotDefinitionName = None) -> list[ClassRule]: +def subclass_to_rules( + view: SchemaView, + child: ClassDefinitionName, + parent: ClassDefinitionName, + type_designator_slot: SlotDefinitionName = None, +) -> list[ClassRule]: """ rolls up child class to parent class, turning class-specific slot_usages into rules :param view: @@ -98,10 +118,10 @@ def subclass_to_rules(view: SchemaView, child: ClassDefinitionName, parent: Clas if len(type_designators) == 1: type_designator_slot = type_designators[0] elif len(type_designators) > 1: - raise Exception(f'Multiple type designatirs: {type_designators}') + raise Exception(f"Multiple type designatirs: {type_designators}") else: - type_designator_slot = SlotDefinitionName('type') - rule.preconditions = AnonymousClassExpression(slot_conditions=[SlotDefinition('type', equals_string=child)]) + type_designator_slot = SlotDefinitionName("type") + rule.preconditions = AnonymousClassExpression(slot_conditions=[SlotDefinition("type", equals_string=child)]) rule.postconditions = AnonymousClassExpression(slot_conditions=child_slots) # ensure slots are declared for parent parent_slots = view.class_induced_slots(parent) @@ -130,8 +150,3 @@ def remove_redundant_rules(view: SchemaView, class_name: ClassDefinitionName): for rule in redundant_rules: cls.rules.remove(rule) return redundant_rules - - - - - diff --git a/linkml_runtime/utils/schema_as_dict.py b/linkml_runtime/utils/schema_as_dict.py index 6432479b..a5ee1468 100644 --- a/linkml_runtime/utils/schema_as_dict.py +++ b/linkml_runtime/utils/schema_as_dict.py @@ -42,7 +42,11 @@ def _remove_names(obj: Any, parent: Optional[str]) -> Any: :return: """ if isinstance(obj, dict): - return {k: _remove_names(v, k) for k, v in obj.items() if k != 'name' or parent is None or parent in ['slots', 'slot_usage', 'attributes']} + return { + k: _remove_names(v, k) + for k, v in obj.items() + if k != "name" or parent is None or parent in ["slots", "slot_usage", "attributes"] + } elif isinstance(obj, list): return [_remove_names(x, parent) for x in obj] else: @@ -61,15 +65,16 @@ def schema_as_dict(schema: SchemaDefinition) -> dict: :return: minimal canonical dictionary object """ obj = json_dumper.to_dict(schema) - if '@type' in obj: - del obj['@type'] - obj['prefixes'] = {k: v['prefix_reference'] for k, v in obj.get('prefixes', {}).items()} - for k, v in obj.get('enums', {}).items(): - for pv in v.get('permissible_values', {}).values(): - del pv['text'] + if "@type" in obj: + del obj["@type"] + obj["prefixes"] = {k: v["prefix_reference"] for k, v in obj.get("prefixes", {}).items()} + for k, v in obj.get("enums", {}).items(): + for pv in v.get("permissible_values", {}).values(): + del pv["text"] obj = _remove_names(obj, None) return obj + def schema_as_yaml_dump(schema: SchemaDefinition) -> str: """ Uses :func:`schema_as_dict` to generate a minimal YAML dump of the schema diff --git a/linkml_runtime/utils/schema_builder.py b/linkml_runtime/utils/schema_builder.py index 951a2df8..d4d73910 100644 --- a/linkml_runtime/utils/schema_builder.py +++ b/linkml_runtime/utils/schema_builder.py @@ -1,10 +1,15 @@ from dataclasses import dataclass from typing import Union, Optional -from linkml_runtime.linkml_model import (ClassDefinition, EnumDefinition, - PermissibleValue, Prefix, - SchemaDefinition, SlotDefinition, - TypeDefinition) +from linkml_runtime.linkml_model import ( + ClassDefinition, + EnumDefinition, + PermissibleValue, + Prefix, + SchemaDefinition, + SlotDefinition, + TypeDefinition, +) from linkml_runtime.utils.formatutils import underscore from linkml_runtime.utils.schema_as_dict import schema_as_dict @@ -84,9 +89,7 @@ def add_class( if isinstance(s, SlotDefinition): cls.attributes[s.name] = s else: - raise ValueError( - f"If use_attributes=True then slots must be SlotDefinitions" - ) + raise ValueError(f"If use_attributes=True then slots must be SlotDefinitions") else: if slots is not None: for s in slots: @@ -170,7 +173,7 @@ def add_enum( enum_def.permissible_values[pv.text] = pv return self - def add_prefix(self, prefix: str, url: str, replace_if_present = False) -> "SchemaBuilder": + def add_prefix(self, prefix: str, url: str, replace_if_present=False) -> "SchemaBuilder": """ Adds a prefix for use with CURIEs @@ -195,7 +198,6 @@ def add_imports(self, *imports) -> "SchemaBuilder": self.schema.imports.extend(imports) return self - def add_defaults(self) -> "SchemaBuilder": """ Sets defaults, including: @@ -216,12 +218,12 @@ def add_defaults(self) -> "SchemaBuilder": return self def add_type( - self, - type: Union[TypeDefinition, dict, str], - typeof: str = None, - uri: str = None, - replace_if_present=False, - **kwargs + self, + type: Union[TypeDefinition, dict, str], + typeof: str = None, + uri: str = None, + replace_if_present=False, + **kwargs, ) -> "SchemaBuilder": """ Adds the type to the schema diff --git a/linkml_runtime/utils/schemaops.py b/linkml_runtime/utils/schemaops.py index 361d83b1..af58203f 100644 --- a/linkml_runtime/utils/schemaops.py +++ b/linkml_runtime/utils/schemaops.py @@ -4,6 +4,7 @@ CLASS_NAME_OR_LIST = Union[CLASS_NAME, list[CLASS_NAME]] + def roll_up(sv: SchemaView, classes: CLASS_NAME_OR_LIST = None, mixins=True, is_a=True, delete=True) -> None: """ rolls slots up to a set of ancestor classes @@ -37,6 +38,7 @@ def roll_up(sv: SchemaView, classes: CLASS_NAME_OR_LIST = None, mixins=True, is_ sv.delete_class(d) sv.set_modified() + def roll_down(sv: SchemaView, classes: list[CLASS_NAME] = None, mixins=True, is_a=True, delete=True) -> None: """ rolls down to a set of descendant classes @@ -75,6 +77,3 @@ def roll_down(sv: SchemaView, classes: list[CLASS_NAME] = None, mixins=True, is_ d_cls = sv.get_class(d) sv.delete_class(d) sv.set_modified() - - - diff --git a/linkml_runtime/utils/schemaview.py b/linkml_runtime/utils/schemaview.py index d1c50ac6..4b38a5d7 100644 --- a/linkml_runtime/utils/schemaview.py +++ b/linkml_runtime/utils/schemaview.py @@ -24,11 +24,11 @@ MAPPING_TYPE = str ## e.g. broad, exact, related, ... CACHE_SIZE = 1024 -SLOTS = 'slots' -CLASSES = 'classes' -ENUMS = 'enums' -SUBSETS = 'subsets' -TYPES = 'types' +SLOTS = "slots" +CLASSES = "classes" +ENUMS = "enums" +SUBSETS = "subsets" +TYPES = "types" CLASS_NAME = Union[ClassDefinitionName, str] SLOT_NAME = Union[SlotDefinitionName, str] @@ -80,6 +80,7 @@ def _closure(f, x, reflexive=True, depth_first=True, **kwargs): def load_schema_wrap(path: str, **kwargs): # import here to avoid circular imports from linkml_runtime.loaders.yaml_loader import YAMLLoader + yaml_loader = YAMLLoader() schema: SchemaDefinition schema = yaml_loader.load(path, target_class=SchemaDefinition, **kwargs) @@ -111,6 +112,7 @@ class SchemaUsage: """ A usage of an element of a schema """ + used_by: ElementName slot: SlotDefinitionName metaslot: SlotDefinitionName @@ -149,9 +151,13 @@ class SchemaView: # cached hash _hash: Optional[int] = None - - def __init__(self, schema: Union[str, Path, SchemaDefinition], - importmap: Optional[dict[str, str]] = None, merge_imports: bool = False, base_dir: str = None): + def __init__( + self, + schema: Union[str, Path, SchemaDefinition], + importmap: Optional[dict[str, str]] = None, + merge_imports: bool = False, + base_dir: str = None, + ): if isinstance(schema, Path): schema = str(schema) if isinstance(schema, str): @@ -215,23 +221,22 @@ def load_import(self, imp: str, from_schema: SchemaDefinition = None): if from_schema is None: from_schema = self.schema from linkml_runtime import SCHEMA_DIRECTORY - default_import_map = { - "linkml:": str(SCHEMA_DIRECTORY) - } + + default_import_map = {"linkml:": str(SCHEMA_DIRECTORY)} importmap = {**default_import_map, **self.importmap} sname = map_import(importmap, self.namespaces, imp) if from_schema.source_file and not is_absolute_path(sname): base_dir = os.path.dirname(from_schema.source_file) else: base_dir = None - logger.info(f'Importing {imp} as {sname} from source {from_schema.source_file}; base_dir={base_dir}') - schema = load_schema_wrap(sname + '.yaml', base_dir=base_dir) + logger.info(f"Importing {imp} as {sname} from source {from_schema.source_file}; base_dir={base_dir}") + schema = load_schema_wrap(sname + ".yaml", base_dir=base_dir) return schema @lru_cache(None) def imports_closure( - self, imports: bool = True, traverse: Optional[bool] = None, inject_metadata=True - ) -> list[SchemaDefinitionName]: + self, imports: bool = True, traverse: Optional[bool] = None, inject_metadata=True + ) -> list[SchemaDefinitionName]: """ Return all imports @@ -269,8 +274,8 @@ def imports_closure( if traverse is not None: warnings.warn( - 'traverse behaves identically to imports and will be removed in a future version. Use imports instead.', - DeprecationWarning + "traverse behaves identically to imports and will be removed in a future version. Use imports instead.", + DeprecationWarning, ) if not imports or (not traverse and traverse is not None): @@ -305,7 +310,7 @@ def imports_closure( # - subdir/types.yaml # we should treat the two `types.yaml` as separate schemas from the POV of the # origin schema. - if sn.startswith('.') and ':' not in i: + if sn.startswith(".") and ":" not in i: i = os.path.normpath(str(Path(sn).parent / i)) todo.append(i) @@ -443,8 +448,9 @@ def all_slot(self, **kwargs) -> dict[SlotDefinitionName, SlotDefinition]: return self.all_slots(**kwargs) @lru_cache(None) - def all_slots(self, ordered_by=OrderedBy.PRESERVE, imports=True, attributes=True) -> dict[ - SlotDefinitionName, SlotDefinition]: + def all_slots( + self, ordered_by=OrderedBy.PRESERVE, imports=True, attributes=True + ) -> dict[SlotDefinitionName, SlotDefinition]: """ :param ordered_by: an enumerated parameter that returns all the slots in the order specified. :param imports: include imports closure @@ -590,7 +596,7 @@ def in_schema(self, element_name: ElementName) -> SchemaDefinitionName: """ ix = self.element_by_schema_map() if element_name not in ix: - raise ValueError(f'Element {element_name} not in any schema') + raise ValueError(f"Element {element_name} not in any schema") return ix[element_name] @lru_cache(None) @@ -713,8 +719,9 @@ def enum_parents(self, enum_name: ENUM_NAME, imports=False, mixins=False, is_a=T return self._parents(e, imports, mixins, is_a=is_a) @lru_cache(None) - def permissible_value_parent(self, permissible_value: str, enum_name: ENUM_NAME) -> Union[ - str, PermissibleValueText, None, ValueError]: + def permissible_value_parent( + self, permissible_value: str, enum_name: ENUM_NAME + ) -> Union[str, PermissibleValueText, None, ValueError]: """ :param enum_name: child enum name :param permissible_value: permissible value @@ -730,8 +737,9 @@ def permissible_value_parent(self, permissible_value: str, enum_name: ENUM_NAME) return [] @lru_cache(None) - def permissible_value_children(self, permissible_value: str, enum_name: ENUM_NAME) -> Union[ - str, PermissibleValueText, None, ValueError]: + def permissible_value_children( + self, permissible_value: str, enum_name: ENUM_NAME + ) -> Union[str, PermissibleValueText, None, ValueError]: """ :param enum_name: parent enum name :param permissible_value: permissible value @@ -832,8 +840,9 @@ def slot_children(self, slot_name: SLOT_NAME, imports=True, mixins=True, is_a=Tr return [x.name for x in elts if (x.is_a == slot_name and is_a) or (mixins and slot_name in x.mixins)] @lru_cache(None) - def class_ancestors(self, class_name: CLASS_NAME, imports=True, mixins=True, reflexive=True, is_a=True, - depth_first=True) -> list[ClassDefinitionName]: + def class_ancestors( + self, class_name: CLASS_NAME, imports=True, mixins=True, reflexive=True, is_a=True, depth_first=True + ) -> list[ClassDefinitionName]: """ Closure of class_parents method @@ -845,43 +854,49 @@ def class_ancestors(self, class_name: CLASS_NAME, imports=True, mixins=True, ref :param depth_first: :return: ancestor class names """ - return _closure(lambda x: self.class_parents(x, imports=imports, mixins=mixins, is_a=is_a), - class_name, - reflexive=reflexive, depth_first=depth_first) + return _closure( + lambda x: self.class_parents(x, imports=imports, mixins=mixins, is_a=is_a), + class_name, + reflexive=reflexive, + depth_first=depth_first, + ) @lru_cache(None) - def permissible_value_ancestors(self, permissible_value_text: str, - enum_name: ENUM_NAME, - reflexive=True, - depth_first=True) -> list[str]: + def permissible_value_ancestors( + self, permissible_value_text: str, enum_name: ENUM_NAME, reflexive=True, depth_first=True + ) -> list[str]: """ Closure of permissible_value_parents method :enum """ - return _closure(lambda x: self.permissible_value_parent(x, enum_name), - permissible_value_text, - reflexive=reflexive, - depth_first=depth_first) + return _closure( + lambda x: self.permissible_value_parent(x, enum_name), + permissible_value_text, + reflexive=reflexive, + depth_first=depth_first, + ) @lru_cache(None) - def permissible_value_descendants(self, permissible_value_text: str, - enum_name: ENUM_NAME, - reflexive=True, - depth_first=True) -> list[str]: + def permissible_value_descendants( + self, permissible_value_text: str, enum_name: ENUM_NAME, reflexive=True, depth_first=True + ) -> list[str]: """ Closure of permissible_value_children method :enum """ - return _closure(lambda x: self.permissible_value_children(x, enum_name), - permissible_value_text, - reflexive=reflexive, - depth_first=depth_first) + return _closure( + lambda x: self.permissible_value_children(x, enum_name), + permissible_value_text, + reflexive=reflexive, + depth_first=depth_first, + ) @lru_cache(None) - def enum_ancestors(self, enum_name: ENUM_NAME, imports=True, mixins=True, reflexive=True, is_a=True, - depth_first=True) -> list[EnumDefinitionName]: + def enum_ancestors( + self, enum_name: ENUM_NAME, imports=True, mixins=True, reflexive=True, is_a=True, depth_first=True + ) -> list[EnumDefinitionName]: """ Closure of enum_parents method @@ -893,13 +908,17 @@ def enum_ancestors(self, enum_name: ENUM_NAME, imports=True, mixins=True, reflex :param depth_first: :return: ancestor enum names """ - return _closure(lambda x: self.enum_parents(x, imports=imports, mixins=mixins, is_a=is_a), - enum_name, - reflexive=reflexive, depth_first=depth_first) + return _closure( + lambda x: self.enum_parents(x, imports=imports, mixins=mixins, is_a=is_a), + enum_name, + reflexive=reflexive, + depth_first=depth_first, + ) @lru_cache(None) - def type_ancestors(self, type_name: TYPES, imports=True, reflexive=True, depth_first=True) -> list[ - TypeDefinitionName]: + def type_ancestors( + self, type_name: TYPES, imports=True, reflexive=True, depth_first=True + ) -> list[TypeDefinitionName]: """ All ancestors of a type via typeof @@ -909,13 +928,14 @@ def type_ancestors(self, type_name: TYPES, imports=True, reflexive=True, depth_f :param depth_first: :return: ancestor class names """ - return _closure(lambda x: self.type_parents(x, imports=imports), - type_name, - reflexive=reflexive, depth_first=depth_first) + return _closure( + lambda x: self.type_parents(x, imports=imports), type_name, reflexive=reflexive, depth_first=depth_first + ) @lru_cache(None) - def slot_ancestors(self, slot_name: SLOT_NAME, imports=True, mixins=True, reflexive=True, is_a=True) -> list[ - SlotDefinitionName]: + def slot_ancestors( + self, slot_name: SLOT_NAME, imports=True, mixins=True, reflexive=True, is_a=True + ) -> list[SlotDefinitionName]: """ Closure of slot_parents method @@ -926,13 +946,14 @@ def slot_ancestors(self, slot_name: SLOT_NAME, imports=True, mixins=True, reflex :param reflexive: include self in set of ancestors :return: ancestor slot names """ - return _closure(lambda x: self.slot_parents(x, imports=imports, mixins=mixins, is_a=is_a), - slot_name, - reflexive=reflexive) + return _closure( + lambda x: self.slot_parents(x, imports=imports, mixins=mixins, is_a=is_a), slot_name, reflexive=reflexive + ) @lru_cache(None) - def class_descendants(self, class_name: CLASS_NAME, imports=True, mixins=True, reflexive=True, is_a=True) -> list[ - ClassDefinitionName]: + def class_descendants( + self, class_name: CLASS_NAME, imports=True, mixins=True, reflexive=True, is_a=True + ) -> list[ClassDefinitionName]: """ Closure of class_children method @@ -943,12 +964,14 @@ def class_descendants(self, class_name: CLASS_NAME, imports=True, mixins=True, r :param reflexive: include self in set of descendants :return: descendants class names """ - return _closure(lambda x: self.class_children(x, imports=imports, mixins=mixins, is_a=is_a), class_name, - reflexive=reflexive) + return _closure( + lambda x: self.class_children(x, imports=imports, mixins=mixins, is_a=is_a), class_name, reflexive=reflexive + ) @lru_cache(None) - def slot_descendants(self, slot_name: SLOT_NAME, imports=True, mixins=True, reflexive=True, is_a=True) -> list[ - SlotDefinitionName]: + def slot_descendants( + self, slot_name: SLOT_NAME, imports=True, mixins=True, reflexive=True, is_a=True + ) -> list[SlotDefinitionName]: """ Closure of slot_children method @@ -959,8 +982,9 @@ def slot_descendants(self, slot_name: SLOT_NAME, imports=True, mixins=True, refl :param reflexive: include self in set of descendants :return: descendants slot names """ - return _closure(lambda x: self.slot_children(x, imports=imports, mixins=mixins, is_a=is_a), slot_name, - reflexive=reflexive) + return _closure( + lambda x: self.slot_children(x, imports=imports, mixins=mixins, is_a=is_a), slot_name, reflexive=reflexive + ) @lru_cache(None) def class_roots(self, imports=True, mixins=True, is_a=True) -> list[ClassDefinitionName]: @@ -971,9 +995,11 @@ def class_roots(self, imports=True, mixins=True, is_a=True) -> list[ClassDefinit :param is_a: include is_a parents (default is True) :return: """ - return [c - for c in self.all_classes(imports=imports) - if self.class_parents(c, mixins=mixins, is_a=is_a, imports=imports) == []] + return [ + c + for c in self.all_classes(imports=imports) + if self.class_parents(c, mixins=mixins, is_a=is_a, imports=imports) == [] + ] @lru_cache(None) def class_leaves(self, imports=True, mixins=True, is_a=True) -> list[ClassDefinitionName]: @@ -984,9 +1010,11 @@ def class_leaves(self, imports=True, mixins=True, is_a=True) -> list[ClassDefini :param is_a: include is_a parents (default is True) :return: """ - return [c - for c in self.all_classes(imports=imports) - if self.class_children(c, mixins=mixins, is_a=is_a, imports=imports) == []] + return [ + c + for c in self.all_classes(imports=imports) + if self.class_children(c, mixins=mixins, is_a=is_a, imports=imports) == [] + ] @lru_cache(None) def slot_roots(self, imports=True, mixins=True) -> list[SlotDefinitionName]: @@ -996,9 +1024,9 @@ def slot_roots(self, imports=True, mixins=True) -> list[SlotDefinitionName]: :param mixins: :return: """ - return [c - for c in self.all_slots(imports=imports) - if self.slot_parents(c, mixins=mixins, imports=imports) == []] + return [ + c for c in self.all_slots(imports=imports) if self.slot_parents(c, mixins=mixins, imports=imports) == [] + ] @lru_cache(None) def slot_leaves(self, imports=True, mixins=True) -> list[SlotDefinitionName]: @@ -1008,9 +1036,9 @@ def slot_leaves(self, imports=True, mixins=True) -> list[SlotDefinitionName]: :param mixins: :return: """ - return [c - for c in self.all_slots(imports=imports) - if self.slot_children(c, mixins=mixins, imports=imports) == []] + return [ + c for c in self.all_slots(imports=imports) if self.slot_children(c, mixins=mixins, imports=imports) == [] + ] @lru_cache(None) def is_multivalued(self, slot_name: SlotDefinition) -> bool: @@ -1084,16 +1112,16 @@ def get_uri(self, element: Union[ElementName, Element], imports=True, expand=Fal uri = e.uri e_name = underscore(e.name) else: - raise ValueError(f'Must be class or slot or type: {e}') + raise ValueError(f"Must be class or slot or type: {e}") if uri is None or native: if e.from_schema is not None: schema = next(sc for sc in self.schema_map.values() if sc.id == e.from_schema) if schema == None: - raise ValueError(f'Cannot find {e.from_schema} in schema_map') + raise ValueError(f"Cannot find {e.from_schema} in schema_map") else: schema = self.schema_map[self.in_schema(e.name)] pfx = schema.default_prefix - uri = f'{pfx}:{e_name}' + uri = f"{pfx}:{e_name}" if expand: return self.expand_curie(uri) else: @@ -1105,8 +1133,8 @@ def expand_curie(self, uri: str) -> str: :param uri: :return: URI as a string """ - if ':' in uri: - parts = uri.split(':') + if ":" in uri: + parts = uri.split(":") if len(parts) == 2: [pfx, local_id] = parts ns = self.namespaces() @@ -1126,8 +1154,10 @@ def get_elements_applicable_by_identifier(self, identifier: str) -> list[str]: """ elements = self.get_elements_applicable_by_prefix(self.namespaces().prefix_for(identifier)) if len(elements) == 0: - logger.warning("no element found for the given curie using id_prefixes attribute" - ": %s, try get_mappings method?", identifier) + logger.warning( + "no element found for the given curie using id_prefixes attribute" ": %s, try get_mappings method?", + identifier, + ) return elements @lru_cache(CACHE_SIZE) @@ -1143,7 +1173,7 @@ def get_elements_applicable_by_prefix(self, prefix: str) -> list[str]: applicable_elements = [] elements = self.all_elements() for category, category_element in elements.items(): - if hasattr(category_element, 'id_prefixes') and prefix in category_element.id_prefixes: + if hasattr(category_element, "id_prefixes") and prefix in category_element.id_prefixes: applicable_elements.append(category_element.name) return applicable_elements @@ -1170,8 +1200,9 @@ def all_aliases(self) -> list[str]: return element_aliases @lru_cache(None) - def get_mappings(self, element_name: ElementName = None, imports=True, expand=False) -> dict[ - MAPPING_TYPE, list[URIorCURIE]]: + def get_mappings( + self, element_name: ElementName = None, imports=True, expand=False + ) -> dict[MAPPING_TYPE, list[URIorCURIE]]: """ Get all mappings for a given element @@ -1183,14 +1214,14 @@ def get_mappings(self, element_name: ElementName = None, imports=True, expand=Fa e = self.get_element(element_name, imports=imports) if isinstance(e, ClassDefinition) or isinstance(e, SlotDefinition) or isinstance(e, TypeDefinition): m_dict = { - 'self': [self.get_uri(element_name, imports=imports, expand=False)], - 'native': [self.get_uri(element_name, imports=imports, expand=False, native=True)], - 'exact': e.exact_mappings, - 'narrow': e.narrow_mappings, - 'broad': e.broad_mappings, - 'related': e.related_mappings, - 'close': e.close_mappings, - 'undefined': e.mappings + "self": [self.get_uri(element_name, imports=imports, expand=False)], + "native": [self.get_uri(element_name, imports=imports, expand=False, native=True)], + "exact": e.exact_mappings, + "narrow": e.narrow_mappings, + "broad": e.broad_mappings, + "related": e.related_mappings, + "close": e.close_mappings, + "undefined": e.mappings, } else: m_dict = {} @@ -1237,7 +1268,9 @@ def get_element_by_mapping(self, mapping_id: URIorCURIE) -> list[str]: elements = self.all_elements() for el in elements: element = self.get_element(el) - mappings = element.exact_mappings + element.close_mappings + element.narrow_mappings + element.broad_mappings + mappings = ( + element.exact_mappings + element.close_mappings + element.narrow_mappings + element.broad_mappings + ) if mapping_id in mappings: model_elements.append(element.name) return model_elements @@ -1267,7 +1300,7 @@ def is_relationship(self, class_name: CLASS_NAME = None, imports=True) -> bool: :param imports: :return: true if the class represents a relationship """ - STMT_TYPES = ['rdf:Statement', 'owl:Axiom'] + STMT_TYPES = ["rdf:Statement", "owl:Axiom"] for an in self.class_ancestors(class_name, imports=imports): if self.get_uri(an) in STMT_TYPES: return True @@ -1294,8 +1327,9 @@ def annotation_dict(self, element_name: ElementName, imports=True) -> dict[URIor return {k: v.value for k, v in e.annotations.items()} @lru_cache(None) - def class_slots(self, class_name: CLASS_NAME, imports=True, direct=False, attributes=True) -> list[ - SlotDefinitionName]: + def class_slots( + self, class_name: CLASS_NAME, imports=True, direct=False, attributes=True + ) -> list[SlotDefinitionName]: """ :param class_name: :param imports: include imports closure @@ -1320,8 +1354,9 @@ def class_slots(self, class_name: CLASS_NAME, imports=True, direct=False, attrib return slots_nr @lru_cache(None) - def induced_slot(self, slot_name: SLOT_NAME, class_name: CLASS_NAME = None, imports=True, - mangle_name=False) -> SlotDefinition: + def induced_slot( + self, slot_name: SLOT_NAME, class_name: CLASS_NAME = None, imports=True, mangle_name=False + ) -> SlotDefinition: """ Given a slot, in the context of a particular class, yield a dynamic SlotDefinition that has all properties materialized. @@ -1356,8 +1391,10 @@ def induced_slot(self, slot_name: SLOT_NAME, class_name: CLASS_NAME = None, impo slot = self.get_slot(slot_name, imports, attributes=True) if slot is None: - raise ValueError(f"No such slot {slot_name} as an attribute of {class_name} ancestors " - "or as a slot definition in the schema") + raise ValueError( + f"No such slot {slot_name} as an attribute of {class_name} ancestors " + "or as a slot definition in the schema" + ) # copy the slot, as it will be modified induced_slot = copy(slot) @@ -1370,8 +1407,8 @@ def induced_slot(self, slot_name: SLOT_NAME, class_name: CLASS_NAME = None, impo if getattr(anc_slot, metaslot_name, None): setattr(induced_slot, metaslot_name, copy(getattr(anc_slot, metaslot_name))) COMBINE = { - 'maximum_value': lambda x, y: min(x, y), - 'minimum_value': lambda x, y: max(x, y), + "maximum_value": lambda x, y: min(x, y), + "minimum_value": lambda x, y: max(x, y), } # iterate through all metaslots, and potentially populate metaslot value for induced slot for metaslot_name in self._metaslots_for_slot(): @@ -1403,9 +1440,9 @@ def induced_slot(self, slot_name: SLOT_NAME, class_name: CLASS_NAME = None, impo # ) if not is_empty(v2): v = v2 - logger.debug(f'{v} takes precedence over {v2} for {induced_slot.name}.{metaslot_name}') + logger.debug(f"{v} takes precedence over {v2} for {induced_slot.name}.{metaslot_name}") if v is None: - if metaslot_name == 'range': + if metaslot_name == "range": v = self.schema.default_range if v is not None: setattr(induced_slot, metaslot_name, v) @@ -1414,7 +1451,7 @@ def induced_slot(self, slot_name: SLOT_NAME, class_name: CLASS_NAME = None, impo if slot.identifier or slot.key: slot.required = True if mangle_name: - mangled_name = f'{camelcase(class_name)}__{underscore(slot_name)}' + mangled_name = f"{camelcase(class_name)}__{underscore(slot_name)}" induced_slot.name = mangled_name if not induced_slot.alias: induced_slot.alias = underscore(slot_name) @@ -1426,7 +1463,7 @@ def induced_slot(self, slot_name: SLOT_NAME, class_name: CLASS_NAME = None, impo @lru_cache(None) def _metaslots_for_slot(self): - fake_slot = SlotDefinition('__FAKE') + fake_slot = SlotDefinition("__FAKE") return vars(fake_slot).keys() @lru_cache(None) @@ -1578,14 +1615,14 @@ def slot_applicable_range_elements(self, slot: SlotDefinition) -> list[ClassDefi if r in self.all_classes(): range_types.append(ClassDefinition.class_name) rc = self.get_class(r) - if rc.class_uri == 'linkml:Any': + if rc.class_uri == "linkml:Any": is_any = True if is_any or r in self.all_enums(): range_types.append(EnumDefinition.class_name) if is_any or r in self.all_types(): range_types.append(TypeDefinition.class_name) if not range_types: - raise ValueError(f'Unrecognized range: {r}') + raise ValueError(f"Unrecognized range: {r}") return range_types def slot_range_as_union(self, slot: SlotDefinition) -> list[ElementName]: @@ -1605,9 +1642,7 @@ def slot_range_as_union(self, slot: SlotDefinition) -> list[ElementName]: range_union_of.append(x.range) return range_union_of - def get_classes_by_slot( - self, slot: SlotDefinition, include_induced: bool = False - ) -> list[ClassDefinitionName]: + def get_classes_by_slot(self, slot: SlotDefinition, include_induced: bool = False) -> list[ClassDefinitionName]: """Get all classes that use a given slot, either as a direct or induced slot. :param slot: slot in consideration @@ -1623,9 +1658,7 @@ def get_classes_by_slot( if include_induced: for c_name in all_classes: - induced_slot_names = [ - ind_slot.name for ind_slot in self.class_induced_slots(c_name) - ] + induced_slot_names = [ind_slot.name for ind_slot in self.class_induced_slots(c_name)] if slot.name in induced_slot_names: classes_set.add(c_name) @@ -1689,7 +1722,7 @@ def usage_index(self) -> dict[ElementName, list[SchemaUsage]]: :return: dictionary of SchemaUsages keyed by used elements """ - ROLES = ['domain', 'range', 'any_of', 'exactly_one_of', 'none_of', 'all_of'] + ROLES = ["domain", "range", "any_of", "exactly_one_of", "none_of", "all_of"] ix = defaultdict(list) for cn, c in self.all_classes().items(): direct_slots = c.slots @@ -1861,8 +1894,8 @@ def set_modified(self) -> None: self.modifications += 1 def materialize_patterns(self) -> None: - """Materialize schema by expanding structured patterns - into regular expressions based on composite patterns + """Materialize schema by expanding structured patterns + into regular expressions based on composite patterns provided in the settings dictionary. """ resolver = PatternResolver(self) @@ -1886,7 +1919,7 @@ def materialize_pattern_into_slot_definition(slot_definition: SlotDefinition) -> materialize_pattern_into_slot_definition(slot_definition) def materialize_derived_schema(self) -> SchemaDefinition: - """ Materialize a schema view into a schema definition """ + """Materialize a schema view into a schema definition""" derived_schema = deepcopy(self.schema) derived_schemaview = SchemaView(derived_schema) derived_schemaview.merge_imports() diff --git a/linkml_runtime/utils/schemaview_cli.py b/linkml_runtime/utils/schemaview_cli.py index 44256451..e6f6726a 100644 --- a/linkml_runtime/utils/schemaview_cli.py +++ b/linkml_runtime/utils/schemaview_cli.py @@ -13,29 +13,19 @@ logger = logging.getLogger(__name__) -DEFAULT_DISPLAY_COLS = [ - 'name', - 'is_a', - 'description', - 'owner' -] - -schema_option = click.option( - "-s", "--schema", help="Path to schema in LinkML yaml." -) +DEFAULT_DISPLAY_COLS = ["name", "is_a", "description", "owner"] + +schema_option = click.option("-s", "--schema", help="Path to schema in LinkML yaml.") columns_option = click.option( - "-c", "--columns", - default=','.join(DEFAULT_DISPLAY_COLS), - help="Comma separate list of columns to display." + "-c", "--columns", default=",".join(DEFAULT_DISPLAY_COLS), help="Comma separate list of columns to display." ) + @click.group() @click.option("-v", "--verbose", count=True) @click.option("-q", "--quiet") def main(verbose: int, quiet: bool): - """Main - - """ + """Main""" if verbose >= 2: logging.basicConfig(level=logging.DEBUG) elif verbose == 1: @@ -49,7 +39,7 @@ def main(verbose: int, quiet: bool): @main.command() @schema_option @columns_option -@click.option('-t', '--element-type', help='Element type') +@click.option("-t", "--element-type", help="Element type") def list(schema, columns, element_type): """List elements in schema @@ -58,18 +48,19 @@ def list(schema, columns, element_type): """ schema_view = SchemaView(schema) - logger.info(f'id={schema_view.schema.id}') - logger.info(f'name={schema_view.schema.name}') + logger.info(f"id={schema_view.schema.id}") + logger.info(f"name={schema_view.schema.name}") enames = schema_view.all_element() elements = [schema_view.get_element(ename) for ename in enames] if element_type is not None: elements = [e for e in elements if element_type in type(e).class_name] _show_elements(elements, columns=columns) + @main.command() @schema_option @columns_option -@click.argument('class_names', nargs=-1) +@click.argument("class_names", nargs=-1) def islot(schema, columns, class_names): """Show induced slots for a list of classes @@ -79,15 +70,16 @@ def islot(schema, columns, class_names): """ schema_view = SchemaView(schema) for cn in class_names: - logger.info(f'Class: {cn}') + logger.info(f"Class: {cn}") islots = schema_view.class_induced_slots(cn) _show_elements(islots, columns=columns) + @main.command() @schema_option -@click.option('--is-a/--no-is-a', default=True, help='Include is_a') -@click.option('--mixins/--no-mixins', default=True, help='Include mixins') -@click.argument('class_names', nargs=-1) +@click.option("--is-a/--no-is-a", default=True, help="Include is_a") +@click.option("--mixins/--no-mixins", default=True, help="Include mixins") +@click.argument("class_names", nargs=-1) def ancs(schema, class_names, is_a, mixins): """Show ancestors for classes @@ -97,16 +89,17 @@ def ancs(schema, class_names, is_a, mixins): """ schema_view = SchemaView(schema) for cn in class_names: - logger.info(f'Class: {cn}') + logger.info(f"Class: {cn}") ancs = schema_view.class_ancestors(cn, is_a=is_a, mixins=mixins) for a in ancs: - print(f'{cn}\t{a}') + print(f"{cn}\t{a}") + @main.command() @schema_option -@click.option('--is-a/--no-is-a', default=True, help='Include is_a') -@click.option('--mixins/--no-mixins', default=True, help='Include mixins') -@click.argument('class_names', nargs=-1) +@click.option("--is-a/--no-is-a", default=True, help="Include is_a") +@click.option("--mixins/--no-mixins", default=True, help="Include mixins") +@click.argument("class_names", nargs=-1) def descs(schema, class_names, is_a, mixins): """Show descendants for classes @@ -116,35 +109,37 @@ def descs(schema, class_names, is_a, mixins): """ schema_view = SchemaView(schema) for cn in class_names: - logger.info(f'Class: {cn}') + logger.info(f"Class: {cn}") ds = schema_view.class_descendants(cn, is_a=is_a, mixins=mixins) for d in ds: - print(f'{cn}\t{d}') + print(f"{cn}\t{d}") + @main.command() @schema_option -@click.argument('class_names', nargs=-1) +@click.argument("class_names", nargs=-1) def delete(schema, class_names): - """Deletes classes - - """ + """Deletes classes""" schema_view = SchemaView(schema) for cn in class_names: - logger.info(f'Class: {cn}') + logger.info(f"Class: {cn}") schema_view.delete_class(cn) print(yaml_dumper.dumps(schema_view.schema)) -def _show_elements(elements: builtins.list[Element], columns=None, output = io.StringIO()) -> None: +def _show_elements(elements: builtins.list[Element], columns=None, output=io.StringIO()) -> None: elements_j = json.loads(json_dumper.dumps(elements, inject_type=False)) - if columns is not None and columns != '' and columns != [] and columns != '%': + if columns is not None and columns != "" and columns != [] and columns != "%": if isinstance(columns, str): - columns = columns.split(',') + columns = columns.split(",") + def filter_columns(row: dict): return {k: row.get(k, None) for k in columns} + elements_j = [filter_columns(e) for e in elements_j] flatten_to_csv(elements_j, output) print(output.getvalue()) + if __name__ == "__main__": main() diff --git a/linkml_runtime/utils/slot.py b/linkml_runtime/utils/slot.py index 82adbf40..4a823058 100644 --- a/linkml_runtime/utils/slot.py +++ b/linkml_runtime/utils/slot.py @@ -7,7 +7,8 @@ @dataclass class Slot: - """ Runtime slot definition """ + """Runtime slot definition""" + uri: URIRef name: str curie: Optional[str] diff --git a/linkml_runtime/utils/strictness.py b/linkml_runtime/utils/strictness.py index 6d129bf4..298bb4a4 100644 --- a/linkml_runtime/utils/strictness.py +++ b/linkml_runtime/utils/strictness.py @@ -1,7 +1,6 @@ - - class BOOL: - """ Boolean container -- supports global boolean variables """ + """Boolean container -- supports global boolean variables""" + def __init__(self, v: bool) -> None: self.v = v @@ -16,19 +15,19 @@ def __str__(self): def strict() -> bool: - """ Switch to global strict mode """ + """Switch to global strict mode""" rval = GLOBAL_STRICT.v GLOBAL_STRICT.v = True return rval def lax() -> bool: - """ Switch to global lax mode """ + """Switch to global lax mode""" rval = GLOBAL_STRICT.v GLOBAL_STRICT.v = False return rval def is_strict() -> bool: - """ Return the global strictness setting """ + """Return the global strictness setting""" return bool(GLOBAL_STRICT) diff --git a/linkml_runtime/utils/uri_validator.py b/linkml_runtime/utils/uri_validator.py index f761415d..b9d12386 100644 --- a/linkml_runtime/utils/uri_validator.py +++ b/linkml_runtime/utils/uri_validator.py @@ -157,7 +157,7 @@ # # authority = [ userinfo "@" ] host [ ":" port ] -#authority = rf"""(?: (?P {userinfo} ) @)? +# authority = rf"""(?: (?P {userinfo} ) @)? authority = rf"""(?P (?: {userinfo} @)? {host} @@ -326,7 +326,7 @@ uri_validator = re.compile(f"^{URI}$", re.VERBOSE) -#uri_ref_validator = re.compile(f"^{URI_reference}$", re.VERBOSE) +# uri_ref_validator = re.compile(f"^{URI_reference}$", re.VERBOSE) uri_relative_ref_validator = re.compile(f"^{relative_ref}$", re.VERBOSE) @@ -358,4 +358,3 @@ def validate_uri_reference(input): def validate_curie(input): return curie_validator.match(input) - diff --git a/linkml_runtime/utils/walker_utils.py b/linkml_runtime/utils/walker_utils.py index 1aa0061c..c9f8953d 100644 --- a/linkml_runtime/utils/walker_utils.py +++ b/linkml_runtime/utils/walker_utils.py @@ -21,8 +21,7 @@ def traverse_object_tree(obj: YAMLRoot, func: Callable, mutate: bool = True) -> # implementation for traverse_object_tree, but also accepts lists, dicts -def _traverse_object_tree_1(obj: Union[YAMLRoot, list, dict], func: Callable, - mutate: bool = True) -> Any: +def _traverse_object_tree_1(obj: Union[YAMLRoot, list, dict], func: Callable, mutate: bool = True) -> Any: if isinstance(obj, list): return [_traverse_object_tree_1(x, func, mutate) for x in obj] elif isinstance(obj, dict): diff --git a/linkml_runtime/utils/yamlutils.py b/linkml_runtime/utils/yamlutils.py index f70f9ae1..ece911d5 100644 --- a/linkml_runtime/utils/yamlutils.py +++ b/linkml_runtime/utils/yamlutils.py @@ -26,30 +26,30 @@ class YAMLMark(yaml.error.Mark): def __str__(self): snippet = self.get_snippet() - where = "\nFile \"%s\", line %d, column %d" \ - % (self.name, self.line+1, self.column+1) + where = '\nFile "%s", line %d, column %d' % (self.name, self.line + 1, self.column + 1) if snippet is not None: - where += ":\n"+snippet + where += ":\n" + snippet return where + class YAMLRoot(JsonObj): """ The root object for all python YAML representations """ - def __post_init__(self, *args: list[str], **kwargs): + def __post_init__(self, *args: list[str], **kwargs): if args or kwargs: messages: list[str] = [] for v in args: - v = repr(v)[:40].replace('\n', '\\n') + v = repr(v)[:40].replace("\n", "\\n") messages.append(f"Unknown positional argument: {v}") for k in kwargs.keys(): - v = repr(kwargs[k])[:40].replace('\n', '\\n') + v = repr(kwargs[k])[:40].replace("\n", "\\n") messages.append(f"{TypedNode.yaml_loc(k)} Unknown argument: {k} = {v}") - raise ValueError('\n'.join(messages)) + raise ValueError("\n".join(messages)) def _default(self, obj, filtr: Callable[[dict], dict] = None): - """ JSON serializer callback. + """JSON serializer callback. 1) Filter out empty values (None, {}, [] and False) and mangle the names 2) Add ID entries for dictionary entries @@ -64,10 +64,15 @@ def _default(self, obj, filtr: Callable[[dict], dict] = None): is_classvar = k.startswith("type_") and hasattr(type(obj), k) if is_classvar: print(f"***** {k} is classvar ") - if not is_classvar and not k.startswith('_') and v is not None and\ - (not isinstance(v, (dict, list, bool)) or v): + if ( + not is_classvar + and not k.startswith("_") + and v is not None + and (not isinstance(v, (dict, list, bool)) or v) + ): from linkml_runtime.utils.enumerations import EnumDefinitionImpl + if isinstance(v, dict): itemslist = [] for vk, vv in v.items(): @@ -86,8 +91,9 @@ def _default(self, obj, filtr: Callable[[dict], dict] = None): rval[k] = v return rval else: - return obj._default(obj) if hasattr(obj, '_default') and callable(obj._default) else\ - JSONDecoder().decode(obj) + return ( + obj._default(obj) if hasattr(obj, "_default") and callable(obj._default) else JSONDecoder().decode(obj) + ) @staticmethod def _is_empty(v: Any) -> bool: @@ -100,8 +106,7 @@ def _normalize_inlined_as_list(self, slot_name: str, slot_type: type, key_name: def _normalize_inlined_as_dict(self, slot_name: str, slot_type: type, key_name: str, keyed: bool) -> None: self._normalize_inlined(slot_name, slot_type, key_name, keyed, False) - def _normalize_inlined(self, slot_name: str, slot_type: type, key_name: str, keyed: bool, is_list: bool) \ - -> None: + def _normalize_inlined(self, slot_name: str, slot_type: type, key_name: str, keyed: bool, is_list: bool) -> None: """ __post_init__ function for a list of inlined keyed or identified classes. @@ -123,11 +128,12 @@ def _normalize_inlined(self, slot_name: str, slot_type: type, key_name: str, key cooked_keys = set() def order_up(key: Any, cooked_entry: YAMLRoot) -> None: - """ A cooked entry is ready to be added to the return slot """ + """A cooked entry is ready to be added to the return slot""" if cooked_entry[key_name] != key: raise ValueError( - f"Slot: {loc(slot_name)} - attribute {loc(key_name)} " \ - f"value ({loc(cooked_entry[key_name])}) does not match key ({loc(key)})") + f"Slot: {loc(slot_name)} - attribute {loc(key_name)} " + f"value ({loc(cooked_entry[key_name])}) does not match key ({loc(key)})" + ) if keyed and key in cooked_keys: raise ValueError(f"{loc(key)}: duplicate key") cooked_keys.add(key) @@ -137,13 +143,13 @@ def order_up(key: Any, cooked_entry: YAMLRoot) -> None: cooked_slot[key] = cooked_entry def loc(s): - loc_str = TypedNode.yaml_loc(s) if isinstance(s, TypedNode) else '' - if loc_str == ': ': - loc_str = '' + loc_str = TypedNode.yaml_loc(s) if isinstance(s, TypedNode) else "" + if loc_str == ": ": + loc_str = "" return loc_str + str(s) def form_1(entries: dict[Any, Optional[Union[dict, JsonObj]]]) -> None: - """ A dictionary of key:dict entries where key is the identifier and dict is an instance of slot_type """ + """A dictionary of key:dict entries where key is the identifier and dict is an instance of slot_type""" for key, raw_obj in items(entries): if raw_obj is None: raw_obj = {} @@ -172,7 +178,7 @@ def form_1(entries: dict[Any, Optional[Union[dict, JsonObj]]]) -> None: if lek == key_name and not isinstance(lev, (list, dict, JsonObj)): # key_name:value order_up(list_entry[lek], slot_type(list_entry)) - break # Not strictly necessary, but + break # Not strictly necessary, but elif not isinstance(lev, (list, dict, JsonObj)): # key: value --> slot_type(key, value) order_up(lek, slot_type(lek, lev)) @@ -191,8 +197,11 @@ def form_1(entries: dict[Any, Optional[Union[dict, JsonObj]]]) -> None: order_up(list_entry, slot_type(**{key_name: list_entry})) else: # We have a dictionary - if key_name in raw_slot and raw_slot[key_name] is not None \ - and not isinstance(raw_slot[key_name], (list, dict, JsonObj)): + if ( + key_name in raw_slot + and raw_slot[key_name] is not None + and not isinstance(raw_slot[key_name], (list, dict, JsonObj)) + ): # Vanilla dictionary - {key: v11, s12: v12, ...} order_up(raw_slot[key_name], slot_type(**as_dict(raw_slot))) else: @@ -210,8 +219,9 @@ def form_1(entries: dict[Any, Optional[Union[dict, JsonObj]]]) -> None: raise ValueError(f"Unrecognized entry: {loc(k)}: {str(v)}") self[slot_name] = cooked_slot - def _normalize_inlined_slot(self, slot_name: str, slot_type: type, key_name: Optional[str], - inlined_as_list: Optional[bool], keyed: bool) -> None: + def _normalize_inlined_slot( + self, slot_name: str, slot_type: type, key_name: Optional[str], inlined_as_list: Optional[bool], keyed: bool + ) -> None: """ A deprecated entry point to slot normalization. Used for models generated prior to the linkml-runtime split. @@ -246,7 +256,7 @@ def _normalize_inlined_slot(self, slot_name: str, slot_type: type, key_name: Opt @classmethod def _class_for(cls, attribute: str, uri_or_curie: Union[str, URIRef]) -> Optional[type["YAMLRoot"]]: - """ Locate self or descendant class that has attribute == uri_or_curie """ + """Locate self or descendant class that has attribute == uri_or_curie""" if getattr(cls, attribute, None) == uri_or_curie: return cls for subclass in cls.__subclasses__(): @@ -260,17 +270,17 @@ def _class_for_uri(cls: type["YAMLRoot"], uri: str, use_model_uri: bool = False) """ Return the self or descendant of self having with a matching class uri """ - return cls._class_for('class_model_uri' if use_model_uri else 'class_class_uri', URIRef(uri)) + return cls._class_for("class_model_uri" if use_model_uri else "class_class_uri", URIRef(uri)) @classmethod def _class_for_curie(cls: type["YAMLRoot"], curie: str) -> Optional[type["YAMLRoot"]]: - return cls._class_for('class_class_curie', curie) + return cls._class_for("class_class_curie", curie) # ================== # Error intercepts # ================== def MissingRequiredField(self, field_name: str) -> None: - """ Generic loader error handler """ + """Generic loader error handler""" raise ValueError(f"{field_name} must be supplied") def __repr__(self): @@ -279,7 +289,8 @@ def __repr__(self): def __str__(self): return repr(self) -def _pformat(fields:dict, cls_name:str, indent:str = ' ') -> str: + +def _pformat(fields: dict, cls_name: str, indent: str = " ") -> str: """ pretty format the fields of the items of a ``YAMLRoot`` object without the wonky indentation of pformat. see ``YAMLRoot.__repr__``. @@ -296,7 +307,7 @@ def _pformat(fields:dict, cls_name:str, indent:str = ' ') -> str: # use it to split lines and as the thing of last resort, but otherwise indent = 0, we'll do that val_str = pformat(val, indent=0, compact=True, sort_dicts=False) # now we indent everything except the first line by indenting and then using regex to remove just the first indent - val_str = re.sub(rf'\A{re.escape(indent)}', '', textwrap.indent(val_str, indent)) + val_str = re.sub(rf"\A{re.escape(indent)}", "", textwrap.indent(val_str, indent)) # now recombine with the key in a format that can be re-eval'd into an object if indent is just whitespace val_str = f"'{key}': " + val_str @@ -305,18 +316,18 @@ def _pformat(fields:dict, cls_name:str, indent:str = ' ') -> str: res.append(val_str) if total_len > 80: - inside = ',\n'.join(res) + inside = ",\n".join(res) # we indent twice - once for the inner contents of every inner object, and one to # offset from the root element. that keeps us from needing to be recursive except for the # single pformat call inside = textwrap.indent(inside, indent) - return cls_name + '({\n' + inside + '\n})' + return cls_name + "({\n" + inside + "\n})" else: - return cls_name + '({' + ', '.join(res) + '})' + return cls_name + "({" + ", ".join(res) + "})" def root_representer(dumper: yaml.Dumper, data: YAMLRoot): - """ YAML callback -- used to filter out empty values (None, {}, [] and false) + """YAML callback -- used to filter out empty values (None, {}, [] and false) @param dumper: data dumper @param data: data to be dumped @@ -325,11 +336,12 @@ def root_representer(dumper: yaml.Dumper, data: YAMLRoot): # TODO: Figure out how to import EnumDefinition here # elif isinstance(v, EnumDefinition): from linkml_runtime.utils.enumerations import EnumDefinitionImpl + if isinstance(data, EnumDefinitionImpl): data = data.code rval = dict() for k, v in data.__dict__.items(): - if not k.startswith('_') and v is not None and (not isinstance(v, (dict, list)) or v): + if not k.startswith("_") and v is not None and (not isinstance(v, (dict, list)) or v): rval[k] = v return dumper.represent_data(rval) @@ -350,7 +362,7 @@ def as_yaml(element: YAMLRoot) -> str: return yaml.dump(element, Dumper=yaml.SafeDumper, sort_keys=False) -def as_json_object(element: YAMLRoot, contexts: CONTEXTS_PARAM_TYPE = None, inject_type = True) -> JsonObj: +def as_json_object(element: YAMLRoot, contexts: CONTEXTS_PARAM_TYPE = None, inject_type=True) -> JsonObj: """ Return the representation of element as a JsonObj object :param element: element to return @@ -360,10 +372,10 @@ def as_json_object(element: YAMLRoot, contexts: CONTEXTS_PARAM_TYPE = None, inje """ rval = copy(element) if inject_type: - rval['@type'] = element.__class__.__name__ + rval["@type"] = element.__class__.__name__ context_element = merge_contexts(contexts) if context_element: - rval['@context'] = context_element['@context'] + rval["@context"] = context_element["@context"] return rval @@ -383,18 +395,21 @@ def loc(self) -> str: return self._loc() def _loc(self) -> str: - return f'File "{self._s.name}", line {self._s.line + 1}, col {self._s.column + 1}' if self._s else '' + return f'File "{self._s.name}", line {self._s.line + 1}, col {self._s.column + 1}' if self._s else "" @staticmethod def yaml_loc(loc_str: Optional[Union["TypedNode", str]] = None, suffix: Optional[str] = ": ") -> str: - """ Return the yaml file and location of loc_str if it exists """ - return '' if loc_str is None or not hasattr(loc_str, "_loc" or not callable(loc_str._loc)) else\ - (loc_str._loc() + suffix) + """Return the yaml file and location of loc_str if it exists""" + return ( + "" + if loc_str is None or not hasattr(loc_str, "_loc" or not callable(loc_str._loc)) + else (loc_str._loc() + suffix) + ) class extended_str(str, TypedNode): def concat(self, *items) -> "extended_str": - rval = extended_str(str(self) + ''.join([str(item) for item in items])) + rval = extended_str(str(self) + "".join([str(item) for item in items])) for item in items[::-1]: if isinstance(item, TypedNode): rval._s = item._s @@ -420,9 +435,9 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.add_constructor(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, DupCheckYamlLoader.map_constructor) self.add_constructor(yaml.resolver.BaseResolver.DEFAULT_SEQUENCE_TAG, DupCheckYamlLoader.seq_constructor) - self.add_constructor('tag:yaml.org,2002:str', DupCheckYamlLoader.construct_yaml_str) - self.add_constructor('tag:yaml.org,2002:int', DupCheckYamlLoader.construct_yaml_int) - self.add_constructor('tag:yaml.org,2002:float', DupCheckYamlLoader.construct_yaml_float) + self.add_constructor("tag:yaml.org,2002:str", DupCheckYamlLoader.construct_yaml_str) + self.add_constructor("tag:yaml.org,2002:int", DupCheckYamlLoader.construct_yaml_int) + self.add_constructor("tag:yaml.org,2002:float", DupCheckYamlLoader.construct_yaml_float) def get_mark(self): if self.stream is None: @@ -431,22 +446,20 @@ def get_mark(self): return YAMLMark(self.name, self.index, self.line, self.column, None, None) def construct_yaml_int(self, node): - """ Scalar constructor that returns the node information as the value """ + """Scalar constructor that returns the node information as the value""" return extended_int(super().construct_yaml_int(node)).add_node(node) def construct_yaml_str(self, node): - """ Scalar constructor that returns the node information as the value """ + """Scalar constructor that returns the node information as the value""" return extended_str(super().construct_yaml_str(node)).add_node(node) def construct_yaml_float(self, node): - """ Scalar constructor that returns the node information as the value """ + """Scalar constructor that returns the node information as the value""" return extended_float(super().construct_yaml_float(node)).add_node(node) @staticmethod - def map_constructor(loader, node, deep=False): - """ Duplicate of constructor.construct_mapping w/ exception that we check for dups - - """ + def map_constructor(loader, node, deep=False): + """Duplicate of constructor.construct_mapping w/ exception that we check for dups""" if not isinstance(node, yaml.MappingNode): raise ConstructorError(None, None, f"expected a mapping node, but found {node.id}", node.start_mark) mapping = {} @@ -454,21 +467,18 @@ def map_constructor(loader, node, deep=False): key = loader.construct_object(key_node, deep=deep) value = loader.construct_object(value_node, deep=deep) if key in mapping: - raise ValueError(f"Duplicate key: \"{key}\"") + raise ValueError(f'Duplicate key: "{key}"') mapping[key] = value return mapping @staticmethod def seq_constructor(loader, node, deep=False): if not isinstance(node, yaml.SequenceNode): - raise ConstructorError(None, None, - f"expected a sequence node, but found {node.id}", - node.start_mark) + raise ConstructorError(None, None, f"expected a sequence node, but found {node.id}", node.start_mark) for child in node.value: if not child.value: raise ConstructorError(None, None, "Empty list elements are not allowed", node.start_mark) - return [loader.construct_object(child, deep=deep) - for child in node.value] + return [loader.construct_object(child, deep=deep) for child in node.value] yaml.SafeDumper.add_multi_representer(YAMLRoot, root_representer) diff --git a/tests/__init__.py b/tests/__init__.py index 396a1754..27b677c3 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,6 @@ import logging import configparser + # Global testing control variables import os @@ -15,31 +16,34 @@ # ---------------------------------------------------------------- config = configparser.ConfigParser() -config.read(os.path.join(os.path.dirname(__file__), 'test_config.ini')) -if 'test.settings' not in config.sections(): - config['test.settings'] = {} # initialize a blank setting if file doesn't exist -test_settings = config['test.settings'] +config.read(os.path.join(os.path.dirname(__file__), "test_config.ini")) +if "test.settings" not in config.sections(): + config["test.settings"] = {} # initialize a blank setting if file doesn't exist +test_settings = config["test.settings"] # Action on mismatch. One of 'Ignore', 'Report' or 'Fail' # If 'Fail', the expected file will be saved in the appropriate temp directory # NOTE: Before setting this back to Report or Ignore, you need to run cleartemp.sh in this directory -DEFAULT_MISMATCH_ACTION = eval(test_settings.get('DEFAULT_MISMATCH_ACTION', 'MismatchAction.Report')) +DEFAULT_MISMATCH_ACTION = eval(test_settings.get("DEFAULT_MISMATCH_ACTION", "MismatchAction.Report")) # Use local import map. If True, tests/input/local_import_map.json is used to create the test files. Note that this # will result in local path names being recorded in jsonld files. This should always be set to False before generating # the final output -USE_LOCAL_IMPORT_MAP = test_settings.getboolean('USE_LOCAL_IMPORT_MAP', False) +USE_LOCAL_IMPORT_MAP = test_settings.getboolean("USE_LOCAL_IMPORT_MAP", False) # There are lots of warnings emitted by the generators. Default logging level -DEFAULT_LOG_LEVEL = eval(test_settings.get('DEFAULT_LOG_LEVEL', 'logging.ERROR')) -DEFAULT_LOG_LEVEL_TEXT = test_settings.get('DEFAULT_LOG_LEVEL_TEXT', 'ERROR') +DEFAULT_LOG_LEVEL = eval(test_settings.get("DEFAULT_LOG_LEVEL", "logging.ERROR")) +DEFAULT_LOG_LEVEL_TEXT = test_settings.get("DEFAULT_LOG_LEVEL_TEXT", "ERROR") # Skip RDF comparison, as it takes a lot of time -SKIP_RDF_COMPARE = test_settings.getboolean('SKIP_RDF_COMPARE', False) -SKIP_RDF_COMPARE_REASON = test_settings.get('SKIP_RDF_COMPARE_REASON', 'tests/__init__.py RDF output not checked SKIP_RDF_COMPARE is True') +SKIP_RDF_COMPARE = test_settings.getboolean("SKIP_RDF_COMPARE", False) +SKIP_RDF_COMPARE_REASON = test_settings.get( + "SKIP_RDF_COMPARE_REASON", "tests/__init__.py RDF output not checked SKIP_RDF_COMPARE is True" +) + # Exception for use in script testing. Global to prevent redefinition class CLIExitException(Exception): diff --git a/tests/conftest.py b/tests/conftest.py index f0f30ec9..5df38531 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,6 +2,7 @@ import pytest import requests_cache + @pytest.fixture(scope="session", autouse=True) def patch_requests_cache(pytestconfig): """ @@ -19,4 +20,4 @@ def patch_requests_cache(pytestconfig): yield # If we want to delete cache, this is how we might do it! # if not pytestconfig.getoption("--with-output"): - # cache_file.unlink(missing_ok=True) \ No newline at end of file + # cache_file.unlink(missing_ok=True) diff --git a/tests/support/clicktestcase.py b/tests/support/clicktestcase.py index a35a35dc..b771597f 100644 --- a/tests/support/clicktestcase.py +++ b/tests/support/clicktestcase.py @@ -10,44 +10,45 @@ class ClickTestCase(TestEnvironmentTestCase): - """ Common tools for testing command line functions """ + """Common tools for testing command line functions""" + env: TestEnvironment = None # The variables below must be set by the inheriting class - testdir: str = None # subdirectory within outdir - click_ep = None # entry point for particular function - prog_name: str = None # executable name + testdir: str = None # subdirectory within outdir + click_ep = None # entry point for particular function + prog_name: str = None # executable name - test_base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'output')) - temp_base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'temp')) + test_base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "output")) + temp_base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "temp")) def source_file_path(self, *path: str) -> str: - """ Return the full file name of path in the input directory """ + """Return the full file name of path in the input directory""" return self.env.input_path(*path) def expected_file_path(self, *path: str) -> str: - """ Return the fill file path of the script subdirectory in the output directory """ + """Return the fill file path of the script subdirectory in the output directory""" return self.env.expected_path(self.testdir, *path) def temp_file_path(self, *path: str, is_dir: bool = False) -> str: - """ Create subdirectory in the temp directory to hold path """ + """Create subdirectory in the temp directory to hold path""" full_path = self.env.temp_file_path(self.testdir, *path) self.env.make_testing_directory(full_path if is_dir else os.path.dirname(full_path)) return full_path @staticmethod def jsonld_comparator(expected_data: str, actual_data: str) -> str: - """ Compare expected data in json-ld format to actual data in json-ld format """ + """Compare expected data in json-ld format to actual data in json-ld format""" return compare_rdf(expected_data, actual_data, "json-ld") @staticmethod def n3_comparator(expected_data: str, actual_data: str) -> str: - """ compare expected_data in n3 format to actual_data in n3 format """ + """compare expected_data in n3 format to actual_data in n3 format""" return compare_rdf(expected_data, actual_data, "n3") @staticmethod - def rdf_comparator(expected_data: str, actual_data: str, fmt: Optional[str] = 'turtle') -> str: - """ compare expected_data to actual_data using basic RDF comparator method """ + def rdf_comparator(expected_data: str, actual_data: str, fmt: Optional[str] = "turtle") -> str: + """compare expected_data to actual_data using basic RDF comparator method""" return compare_rdf(expected_data, actual_data, fmt=fmt) @staticmethod @@ -63,7 +64,7 @@ def always_pass_comparator(expected_data: str, new_data: str) -> Optional[str]: @staticmethod def closein_comparison(expected_txt: str, actual_txt: str) -> None: - """ Assist with testing comparison -- zero in on the first difference in a big string + """Assist with testing comparison -- zero in on the first difference in a big string @param expected_txt: @param actual_txt: @@ -79,22 +80,24 @@ def closein_comparison(expected_txt: str, actual_txt: str) -> None: offset += window nt = nt[window:] ot = ot[window:] - offset = max(offset-view, 0) + offset = max(offset - view, 0) print(" - - EXPECTED - -") - print(ow[offset:offset+view+view]) + print(ow[offset : offset + view + view]) print("\n - - ACTUAL - -") - print(nw[offset:offset+view+view]) - - def do_test(self, - args: Union[str, list[str]], - testFileOrDirectory: Optional[str] = None, - *, - expected_error: type(Exception) = None, - filtr: Optional[Callable[[str], str]] = None, - is_directory: bool = False, - add_yaml: bool = True, - comparator: Callable[[type(unittest.TestCase), str, str, str], str] = None, ) -> None: - """ Execute a command test + print(nw[offset : offset + view + view]) + + def do_test( + self, + args: Union[str, list[str]], + testFileOrDirectory: Optional[str] = None, + *, + expected_error: type(Exception) = None, + filtr: Optional[Callable[[str], str]] = None, + is_directory: bool = False, + add_yaml: bool = True, + comparator: Callable[[type(unittest.TestCase), str, str, str], str] = None, + ) -> None: + """Execute a command test @param args: Argument string or list to command. 'meta.yaml' is always supplied @param testFileOrDirectory: name of file or directory to record output in @@ -111,7 +114,7 @@ def do_test(self, if is_directory and (filtr or comparator): warn("filtr and comparator parameters aren't implemented for directory generation") - if add_yaml and (not arg_list or arg_list[0] != '--help'): + if add_yaml and (not arg_list or arg_list[0] != "--help"): raise NotImplementedError("This is an artifact from elsewhere") # arg_list.insert(0, self.env.meta_yaml) # arg_list += ["--importmap", self.env.import_map, "--log_level", DEFAULT_LOG_LEVEL_TEXT] @@ -121,15 +124,19 @@ def do_test(self, def do_gen(): if is_directory: - self.env.generate_directory(target, - lambda target_dir: self.click_ep(arg_list + ["-d", target_dir], - prog_name=self.prog_name, - standalone_mode=False)) + self.env.generate_directory( + target, + lambda target_dir: self.click_ep( + arg_list + ["-d", target_dir], prog_name=self.prog_name, standalone_mode=False + ), + ) else: - self.env.generate_single_file(target, - lambda: self.click_ep(arg_list, prog_name=self.prog_name, - standalone_mode=False), filtr=filtr, - comparator=comparator) + self.env.generate_single_file( + target, + lambda: self.click_ep(arg_list, prog_name=self.prog_name, standalone_mode=False), + filtr=filtr, + comparator=comparator, + ) if expected_error: with self.assertRaises(expected_error): @@ -152,5 +159,5 @@ def temp_directory(cls, base: str) -> str: return new_directory -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/support/compare_rdf.py b/tests/support/compare_rdf.py index 648dab5f..0d20171a 100644 --- a/tests/support/compare_rdf.py +++ b/tests/support/compare_rdf.py @@ -27,7 +27,7 @@ def to_graph(inp: Union[Graph, str], fmt: Optional[str] = "turtle") -> Graph: # If there is no input then return an empty graph if not inp.strip(): return g - if not inp.strip().startswith('{') and '\n' not in inp and '\r' not in inp: + if not inp.strip().startswith("{") and "\n" not in inp and "\r" not in inp: with open(inp) as f: inp = f.read() g.parse(data=inp, format=fmt) @@ -39,7 +39,7 @@ def print_triples(g: Graph) -> None: Print the contents of g into stdout :param g: graph to print """ - g_text = re.sub(r'@prefix.*\n', '', g.serialize(format="turtle")) + g_text = re.sub(r"@prefix.*\n", "", g.serialize(format="turtle")) print(g_text) @@ -51,13 +51,20 @@ def compare_rdf(expected: Union[Graph, str], actual: Union[Graph, str], fmt: Opt :param fmt: RDF format :return: None if they match else summary of difference """ + def rem_metadata(g: Graph) -> IsomorphicGraph: # Remove list declarations from target for s in g.subjects(RDF.type, RDF.List): g.remove((s, RDF.type, RDF.List)) for t in g: - if t[1] in (LINKML.generation_date, LINKML.source_file_date, LINKML.source_file_size, - TYPE.generation_date, TYPE.source_file_date, TYPE.source_file_size): + if t[1] in ( + LINKML.generation_date, + LINKML.source_file_date, + LINKML.source_file_size, + TYPE.generation_date, + TYPE.source_file_date, + TYPE.source_file_size, + ): g.remove(t) g_iso = to_isomorphic(g) return g_iso diff --git a/tests/support/dirutils.py b/tests/support/dirutils.py index 7b68f256..523cc1ee 100644 --- a/tests/support/dirutils.py +++ b/tests/support/dirutils.py @@ -8,7 +8,7 @@ def make_and_clear_directory(dirbase: str) -> None: - """ Make dirbase if necessary and then clear generated files """ + """Make dirbase if necessary and then clear generated files""" import shutil safety_file = os.path.join(dirbase, "generated") @@ -27,7 +27,7 @@ def file_text(txt_or_fname: str) -> str: :param txt_or_fname: :return: """ - if len(txt_or_fname) > 4 and '\n' not in txt_or_fname: + if len(txt_or_fname) > 4 and "\n" not in txt_or_fname: with open(txt_or_fname) as ef: return ef.read() return txt_or_fname @@ -38,27 +38,27 @@ class dircmp(filecmp.dircmp): Compare the content of dir1 and dir2. In contrast with filecmp.dircmp, this subclass compares the content of files with the same path. """ + def phase3(self): """ Find out differences between common files. Ensure we are using content comparison with shallow=False. """ - fcomp = filecmp.cmpfiles(self.left, self.right, self.common_files, - shallow=False) + fcomp = filecmp.cmpfiles(self.left, self.right, self.common_files, shallow=False) self.same_files, self.diff_files, self.funny_files = fcomp - filecmp.dircmp.methodmap['same_files'] = phase3 - filecmp.dircmp.methodmap['diff_files'] = phase3 - filecmp.dircmp.methodmap['funny_files'] = phase3 + filecmp.dircmp.methodmap["same_files"] = phase3 + filecmp.dircmp.methodmap["diff_files"] = phase3 + filecmp.dircmp.methodmap["funny_files"] = phase3 def _do_cmp(f1, f2): bufsize = filecmp.BUFSIZE - with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2: + with open(f1, "rb") as fp1, open(f2, "rb") as fp2: while True: b1 = fp1.read(bufsize) b2 = fp2.read(bufsize) - if f1.endswith('.context.jsonld'): + if f1.endswith(".context.jsonld"): b1 = ldcontext_metadata_filter(b1) b2 = ldcontext_metadata_filter(b2) if b1 != b2: @@ -79,14 +79,15 @@ def are_dir_trees_equal(dir1: str, dir2: str) -> Optional[str]: @param dir2: Second directory path @return: None if directories match, else summary of differences - """ + """ + def has_local_diffs(dc: dircmp) -> bool: return bool(dc.diff_files or dc.funny_files or dc.left_only or dc.right_only) def has_diffs(dc: dircmp) -> bool: return has_local_diffs(dc) or any(has_diffs(sd) for sd in dc.subdirs.values()) - dirs_cmp = dircmp(dir1, dir2, ignore=['generated']) + dirs_cmp = dircmp(dir1, dir2, ignore=["generated"]) if has_diffs(dirs_cmp): output = StringIO() with redirect_stdout(output): diff --git a/tests/support/filters.py b/tests/support/filters.py index fa7967db..6f0f1142 100644 --- a/tests/support/filters.py +++ b/tests/support/filters.py @@ -1,62 +1,83 @@ - """ Metadata filters for test cases -- various tools to remove metadata from output """ + import re from json import loads from jsonasobj2 import as_json + def ldcontext_metadata_filter(s: str) -> str: """ Metafilter for jsonld context :param s: jsonld context string :return: string stripped of metadata """ - return re.sub(r'Auto generated from .*? by', 'Auto generated from ... by', - re.sub(r'Generation date: .*?\\n', r'Generation date: \\n', s)) + return re.sub( + r"Auto generated from .*? by", + "Auto generated from ... by", + re.sub(r"Generation date: .*?\\n", r"Generation date: \\n", s), + ) def json_metadata_filter(s: str) -> str: - return re.sub(r'("source_file_date": )".*"', r'\1"Friday Sep 27 12:00:00 2003"', - re.sub(r'("generation_date": )".*"', r'\1"Friday Sep 27 12:00:00 2003"', - re.sub(r'("source_file_size": )".*"', r'\1 23600', s))) + return re.sub( + r'("source_file_date": )".*"', + r'\1"Friday Sep 27 12:00:00 2003"', + re.sub( + r'("generation_date": )".*"', + r'\1"Friday Sep 27 12:00:00 2003"', + re.sub(r'("source_file_size": )".*"', r"\1 23600", s), + ), + ) def json_metadata_context_filter(s: str) -> str: - return re.sub(r'file:///.*/', r'', json_metadata_filter(s)) + return re.sub(r"file:///.*/", r"", json_metadata_filter(s)) def metadata_filter(s: str) -> str: - return re.sub(r'(# Auto generated from ).*(\.yaml by pythongen\.py version:) .*', r'\1\2', - re.sub(r'(# Generation date:) .*', r'\1', re.sub(r'\r\n', '\n', s))) + return re.sub( + r"(# Auto generated from ).*(\.yaml by pythongen\.py version:) .*", + r"\1\2", + re.sub(r"(# Generation date:) .*", r"\1", re.sub(r"\r\n", "\n", s)), + ) def yaml_filter(s: str) -> str: # source_file_date: Thu Jul 9 14:37:10 2020 # source_file_size: 671 # generation_date: 2020-07-09 15:43 - return re.sub(r'(source_file_date: ).*', r'\1Friday Sep 27 12:00:00 2003', - re.sub(r'(generation_date: ).*', r'\1Friday Sep 27 12:00:00 2003', - re.sub(r'(source_file_size: ).*', r'\1 23600', s))) + return re.sub( + r"(source_file_date: ).*", + r"\1Friday Sep 27 12:00:00 2003", + re.sub( + r"(generation_date: ).*", + r"\1Friday Sep 27 12:00:00 2003", + re.sub(r"(source_file_size: ).*", r"\1 23600", s), + ), + ) def nb_filter(s: str) -> str: - """ Filter for jupyter (ipynb) notebooks """ + """Filter for jupyter (ipynb) notebooks""" # It is easier to deal with notebook content in JSON s_json = loads(ldcontext_metadata_filter(s)) for cell in s_json.cells: - if hasattr(cell, 'execution_count'): + if hasattr(cell, "execution_count"): cell.execution_count = 1 - if hasattr(cell, 'metadata'): - delattr(cell, 'metadata') - if hasattr(cell, 'outputs'): + if hasattr(cell, "metadata"): + delattr(cell, "metadata") + if hasattr(cell, "outputs"): del_outputs = [] for output in cell.outputs: to_del = [] - if hasattr(output, 'text'): + if hasattr(output, "text"): for line in output.text: - if 'WARNING: You are using pip' in line or\ - 'You should consider upgrading via' in line or\ - 'Requirement already satisfied:' in line: + if ( + "WARNING: You are using pip" in line + or "You should consider upgrading via" in line + or "Requirement already satisfied:" in line + ): to_del.append(line) for del_line in to_del: output.text.remove(del_line) @@ -65,8 +86,8 @@ def nb_filter(s: str) -> str: if del_outputs: for del_output in del_outputs: cell.outputs.remove(del_output) - if hasattr(s_json.metadata, 'language_info'): - if hasattr(s_json.metadata.language_info, 'version'): - s_json.metadata.language_info.version = '3' + if hasattr(s_json.metadata, "language_info"): + if hasattr(s_json.metadata.language_info, "version"): + s_json.metadata.language_info.version = "3" return as_json(s_json) diff --git a/tests/support/mismatchlog.py b/tests/support/mismatchlog.py index c51fb47d..baa92342 100644 --- a/tests/support/mismatchlog.py +++ b/tests/support/mismatchlog.py @@ -2,7 +2,7 @@ import sys from typing import Optional -base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) +base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")) class MismatchLog: @@ -13,6 +13,7 @@ class MismatchLog: line_no - the line number in the python file difference_text - the details on the difference. Used for RDF and other non-ascii files """ + class MismatchLogEntry: class StackFrame: def __init__(self, filename: str, method: str, line: int) -> None: @@ -29,18 +30,21 @@ def __init__(self, file_or_directory: str, msg: Optional[str]) -> None: self.call_stack = list() frame = sys._getframe(2) while True: - self.call_stack.append(MismatchLog.MismatchLogEntry.StackFrame(frame.f_code.co_filename, - frame.f_code.co_name, frame.f_lineno)) + self.call_stack.append( + MismatchLog.MismatchLogEntry.StackFrame( + frame.f_code.co_filename, frame.f_code.co_name, frame.f_lineno + ) + ) if frame.f_code.co_name.startswith("test_"): break frame = frame.f_back def __str__(self): rval = [f'Validation error: File "{os.path.relpath(self.file_or_directory, base_dir)}", line 1'] - rval.append("Stack: " + '\n\t\t'.join([str(e) for e in self.call_stack])) + rval.append("Stack: " + "\n\t\t".join([str(e) for e in self.call_stack])) if self.msg: rval.append(self.msg.rstrip().capitalize()) - return '\n'.join(rval) + '\n' + return "\n".join(rval) + "\n" def __init__(self) -> None: self.entries: list[MismatchLog.MismatchLogEntry] = list() diff --git a/tests/support/test_environment.py b/tests/support/test_environment.py index 35efa086..1b21e44f 100644 --- a/tests/support/test_environment.py +++ b/tests/support/test_environment.py @@ -17,11 +17,13 @@ def no_click_exit(_self, code=0): from tests import CLIExitException + raise CLIExitException(code) # This import has to occur here import click + click.core.Context.exit = no_click_exit @@ -29,7 +31,7 @@ class MismatchAction(Enum): Ignore = 0 Report = 1 Fail = 2 - FailOnce = 3 # Run all tests and then fail if there are any mismatches + FailOnce = 3 # Run all tests and then fail if there are any mismatches class TestEnvironment: @@ -38,16 +40,17 @@ class TestEnvironment: __test__ = False """ Testing environment """ + def __init__(self, filedir: str) -> None: - self.cwd = os.path.dirname(filedir) # base directory for indir, outdir and tempdir - self.indir = os.path.join(self.cwd, 'input') # Input files - self.outdir = os.path.join(self.cwd, 'output') # Expected/actual output files - self.tempdir = os.path.join(self.cwd, 'temp') # Scratch directory for temporary work + self.cwd = os.path.dirname(filedir) # base directory for indir, outdir and tempdir + self.indir = os.path.join(self.cwd, "input") # Input files + self.outdir = os.path.join(self.cwd, "output") # Expected/actual output files + self.tempdir = os.path.join(self.cwd, "temp") # Scratch directory for temporary work # Get the parent's directory name. If it is a test directory, borrow from its environment parent = Path(self.cwd).parts[-2] - if parent.startswith('test'): - parent_env = import_module('..environment', __package__) + if parent.startswith("test"): + parent_env = import_module("..environment", __package__) self.import_map = parent_env.env.import_map self.mismatch_action = parent_env.env.mismatch_action self.root_input_path = parent_env.env.root_input_path @@ -56,8 +59,10 @@ def __init__(self, filedir: str) -> None: self._log = parent_env.env._log else: from tests import USE_LOCAL_IMPORT_MAP - self.import_map = self.input_path('local_import_map.json') if USE_LOCAL_IMPORT_MAP else None + + self.import_map = self.input_path("local_import_map.json") if USE_LOCAL_IMPORT_MAP else None from tests import DEFAULT_MISMATCH_ACTION + self.mismatch_action = DEFAULT_MISMATCH_ACTION self.root_input_path = self.input_path self.root_expected_path = self.expected_path @@ -69,35 +74,35 @@ def _check_changed(test_file: str, runtime_file: str) -> None: if not filecmp.cmp(test_file, runtime_file): print( f"WARNING: Test file {test_file} does not match {runtime_file}. " - f"You may want to update the test version and rerun") + f"You may want to update the test version and rerun" + ) from tests import USE_LOCAL_IMPORT_MAP + if USE_LOCAL_IMPORT_MAP and not TestEnvironment.import_map_warning_emitted: - print( - f"WARNING: USE_LOCAL_IMPORT_MAP must be reset to False before completing submission." - ) + print(f"WARNING: USE_LOCAL_IMPORT_MAP must be reset to False before completing submission.") TestEnvironment.import_map_warning_emitted = True def clear_log(self) -> None: - """ Clear the output log """ + """Clear the output log""" self._log = MismatchLog() def input_path(self, *path: str) -> str: - """ Create a file path in the local input directory """ + """Create a file path in the local input directory""" return os.path.join(self.indir, *[p for p in path if p]) def expected_path(self, *path: str) -> str: - """ Create a file path in the local output directory """ + """Create a file path in the local output directory""" return os.path.join(self.outdir, *[p for p in path if p]) def actual_path(self, *path: str, is_dir: bool = False) -> str: - """ Return the full path to the path fragments in path """ + """Return the full path to the path fragments in path""" dir_path = [p for p in (path if is_dir else path[:-1]) if p] self.make_temp_dir(*dir_path, clear=False) return os.path.join(self.tempdir, *[p for p in path if p]) def temp_file_path(self, *path: str, is_dir: bool = False) -> str: - """ Create the directories down to the path fragments in path. If is_dir is True, create and clear the - innermost directory + """Create the directories down to the path fragments in path. If is_dir is True, create and clear the + innermost directory """ return self.actual_path(*path, is_dir=is_dir) @@ -106,7 +111,7 @@ def log(self, file_or_directory: str, message: Optional[str] = None) -> None: @property def verb(self) -> str: - return 'will be' if self.fail_on_error else 'was' + return "will be" if self.fail_on_error else "was" @property def fail_on_error(self) -> bool: @@ -117,11 +122,11 @@ def report_errors(self) -> bool: return self.mismatch_action != MismatchAction.Ignore def __str__(self): - """ Return the current state of the log file """ - return '\n\n'.join([str(e) for e in self._log.entries]) + """Return the current state of the log file""" + return "\n\n".join([str(e) for e in self._log.entries]) def make_temp_dir(self, *paths: str, clear: bool = True) -> str: - """ Create and initialize a list of paths """ + """Create and initialize a list of paths""" full_path = self.tempdir TestEnvironment.make_testing_directory(full_path) if len(paths): @@ -137,7 +142,7 @@ def string_comparator(self, expected: str, actual: str) -> Optional[str]: :param actual: actual string :return: Error message if mismatch else None """ - if expected.replace('\r\n', '\n').strip() != actual.replace('\r\n', '\n').strip(): + if expected.replace("\r\n", "\n").strip() != actual.replace("\r\n", "\n").strip(): return f"Output {self.verb} changed." @staticmethod @@ -184,9 +189,15 @@ def generate_directory(self, dirname: Union[str, list[str]], generator: Callable else: shutil.rmtree(temp_output_directory) - def generate_single_file(self, filename: Union[str, list[str]], generator: Callable[[Optional[str]], Optional[str]], - value_is_returned: bool = False, filtr: Callable[[str], str] = None, - comparator: Callable[[str, str], str] = None, use_testing_root: bool = False) -> str: + def generate_single_file( + self, + filename: Union[str, list[str]], + generator: Callable[[Optional[str]], Optional[str]], + value_is_returned: bool = False, + filtr: Callable[[str], str] = None, + comparator: Callable[[str, str], str] = None, + use_testing_root: bool = False, + ) -> str: """ Invoke the generator and compare the actual results to the expected. :param filename: relative file name(s) (no path) @@ -209,6 +220,7 @@ def generate_single_file(self, filename: Union[str, list[str]], generator: Calla else: outf = StringIO() from tests import CLIExitException + with contextlib.redirect_stdout(outf): try: generator() @@ -219,14 +231,19 @@ def generate_single_file(self, filename: Union[str, list[str]], generator: Calla if not self.eval_single_file(expected_file, actual, filtr, comparator): if self.fail_on_error: self.make_temp_dir(os.path.dirname(actual_file), clear=False) - with open(actual_file, 'w', encoding='UTF-8') as actualf: + with open(actual_file, "w", encoding="UTF-8") as actualf: actualf.write(actual) return actual - def eval_single_file(self, expected_file_path: str, actual_text: str, filtr: Callable[[str], str] = lambda s: s, - comparator: Callable[[str, str], str] = None) -> bool: - """ Compare actual_text to the contents of the expected file. Log a message if there is a mismatch and - overwrite the expected file if we're not in the fail on error mode + def eval_single_file( + self, + expected_file_path: str, + actual_text: str, + filtr: Callable[[str], str] = lambda s: s, + comparator: Callable[[str, str], str] = None, + ) -> bool: + """Compare actual_text to the contents of the expected file. Log a message if there is a mismatch and + overwrite the expected file if we're not in the fail on error mode """ if comparator is None: comparator = self.string_comparator @@ -238,12 +255,12 @@ def eval_single_file(self, expected_file_path: str, actual_text: str, filtr: Cal msg = f"New file {self.verb} created" cmsg = comparator(actual_text, actual_text) if cmsg: - msg = msg + '\n' + cmsg + msg = msg + "\n" + cmsg if msg: self.log(expected_file_path, msg) if msg and not self.fail_on_error: self.make_temp_dir(os.path.dirname(expected_file_path), clear=False) - with open(expected_file_path, 'w', encoding='UTF-8') as outf: + with open(expected_file_path, "w", encoding="UTF-8") as outf: outf.write(actual_text) return not msg @@ -258,6 +275,7 @@ class InheritedTestCase(TestEnvironmentTestCase): env = TestEnvironment(__file__) ... """ + env: TestEnvironment = None @classmethod diff --git a/tests/test_enumerations/environment.py b/tests/test_enumerations/environment.py index 8b9a1a7f..bdc14a95 100644 --- a/tests/test_enumerations/environment.py +++ b/tests/test_enumerations/environment.py @@ -1,4 +1,3 @@ from tests.support.test_environment import TestEnvironment env = TestEnvironment(__file__) - diff --git a/tests/test_index/__init__.py b/tests/test_index/__init__.py index 53405302..ff131072 100644 --- a/tests/test_index/__init__.py +++ b/tests/test_index/__init__.py @@ -2,5 +2,5 @@ TESTING_DIR = os.path.abspath(os.path.dirname(__file__)) -INPUT_DIR = os.path.join(TESTING_DIR, 'input') -OUTPUT_DIR = os.path.join(TESTING_DIR, 'output') +INPUT_DIR = os.path.join(TESTING_DIR, "input") +OUTPUT_DIR = os.path.join(TESTING_DIR, "output") diff --git a/tests/test_index/model/container_test.py b/tests/test_index/model/container_test.py index 84c2603c..124a6dee 100644 --- a/tests/test_index/model/container_test.py +++ b/tests/test_index/model/container_test.py @@ -25,25 +25,26 @@ version = None # Namespaces -CODE = CurieNamespace('CODE', 'http://example.org/code/') -GEO = CurieNamespace('GEO', 'http://example.org/geoloc/') -GSSO = CurieNamespace('GSSO', 'http://purl.obolibrary.org/obo/GSSO_') -P = CurieNamespace('P', 'http://example.org/P/') -ROR = CurieNamespace('ROR', 'http://example.org/ror/') -FAMREL = CurieNamespace('famrel', 'https://example.org/FamilialRelations#') -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -PERSONINFO = CurieNamespace('personinfo', 'https://w3id.org/linkml/examples/personinfo/') -PROV = CurieNamespace('prov', 'http://www.w3.org/ns/prov#') -RDF = CurieNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#') -RDFS = CurieNamespace('rdfs', 'http://www.w3.org/2000/01/rdf-schema#') -SCHEMA = CurieNamespace('schema', 'http://schema.org/') -SKOS = CurieNamespace('skos', 'http://example.org/UNKNOWN/skos/') -XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') +CODE = CurieNamespace("CODE", "http://example.org/code/") +GEO = CurieNamespace("GEO", "http://example.org/geoloc/") +GSSO = CurieNamespace("GSSO", "http://purl.obolibrary.org/obo/GSSO_") +P = CurieNamespace("P", "http://example.org/P/") +ROR = CurieNamespace("ROR", "http://example.org/ror/") +FAMREL = CurieNamespace("famrel", "https://example.org/FamilialRelations#") +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +PERSONINFO = CurieNamespace("personinfo", "https://w3id.org/linkml/examples/personinfo/") +PROV = CurieNamespace("prov", "http://www.w3.org/ns/prov#") +RDF = CurieNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") +RDFS = CurieNamespace("rdfs", "http://www.w3.org/2000/01/rdf-schema#") +SCHEMA = CurieNamespace("schema", "http://schema.org/") +SKOS = CurieNamespace("skos", "http://example.org/UNKNOWN/skos/") +XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") DEFAULT_ = PERSONINFO # Types + # Class references class NamedThingId(extended_str): pass @@ -78,6 +79,7 @@ class NamedThing(YAMLRoot): """ A generic grouping for any identifiable entity """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.NamedThing @@ -113,6 +115,7 @@ class Person(NamedThing): """ A person (alive, dead, undead, or fictional). """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCHEMA.Person @@ -126,8 +129,12 @@ class Person(NamedThing): age_in_years: Optional[int] = None gender: Optional[Union[str, "GenderType"]] = None current_address: Optional[Union[dict, "Address"]] = None - has_employment_history: Optional[Union[Union[dict, "EmploymentEvent"], list[Union[dict, "EmploymentEvent"]]]] = empty_list() - has_familial_relationships: Optional[Union[Union[dict, "FamilialRelationship"], list[Union[dict, "FamilialRelationship"]]]] = empty_list() + has_employment_history: Optional[Union[Union[dict, "EmploymentEvent"], list[Union[dict, "EmploymentEvent"]]]] = ( + empty_list() + ) + has_familial_relationships: Optional[ + Union[Union[dict, "FamilialRelationship"], list[Union[dict, "FamilialRelationship"]]] + ] = empty_list() has_medical_history: Optional[Union[Union[dict, "MedicalEvent"], list[Union[dict, "MedicalEvent"]]]] = empty_list() aliases: Optional[Union[str, list[str]]] = empty_list() @@ -153,16 +160,27 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.current_address = Address(**as_dict(self.current_address)) if not isinstance(self.has_employment_history, list): - self.has_employment_history = [self.has_employment_history] if self.has_employment_history is not None else [] - self.has_employment_history = [v if isinstance(v, EmploymentEvent) else EmploymentEvent(**as_dict(v)) for v in self.has_employment_history] + self.has_employment_history = ( + [self.has_employment_history] if self.has_employment_history is not None else [] + ) + self.has_employment_history = [ + v if isinstance(v, EmploymentEvent) else EmploymentEvent(**as_dict(v)) for v in self.has_employment_history + ] if not isinstance(self.has_familial_relationships, list): - self.has_familial_relationships = [self.has_familial_relationships] if self.has_familial_relationships is not None else [] - self.has_familial_relationships = [v if isinstance(v, FamilialRelationship) else FamilialRelationship(**as_dict(v)) for v in self.has_familial_relationships] + self.has_familial_relationships = ( + [self.has_familial_relationships] if self.has_familial_relationships is not None else [] + ) + self.has_familial_relationships = [ + v if isinstance(v, FamilialRelationship) else FamilialRelationship(**as_dict(v)) + for v in self.has_familial_relationships + ] if not isinstance(self.has_medical_history, list): self.has_medical_history = [self.has_medical_history] if self.has_medical_history is not None else [] - self.has_medical_history = [v if isinstance(v, MedicalEvent) else MedicalEvent(**as_dict(v)) for v in self.has_medical_history] + self.has_medical_history = [ + v if isinstance(v, MedicalEvent) else MedicalEvent(**as_dict(v)) for v in self.has_medical_history + ] if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] @@ -176,6 +194,7 @@ class HasAliases(YAMLRoot): """ A mixin applied to any class that can have aliases/alternateNames """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.HasAliases @@ -198,6 +217,7 @@ class Organization(NamedThing): """ An organization such as a company or university """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCHEMA.Organization @@ -510,7 +530,9 @@ class Container(YAMLRoot): class_model_uri: ClassVar[URIRef] = PERSONINFO.Container persons: Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]] = empty_dict() - organizations: Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]] = empty_dict() + organizations: Optional[ + Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]] + ] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_list(slot_name="persons", slot_type=Person, key_name="id", keyed=True) @@ -527,21 +549,19 @@ class RelationshipType(EnumDefinitionImpl): name="RelationshipType", ) + class FamilialRelationshipType(EnumDefinitionImpl): - SIBLING_OF = PermissibleValue(text="SIBLING_OF", - meaning=FAMREL["01"]) - PARENT_OF = PermissibleValue(text="PARENT_OF", - meaning=FAMREL["02"]) - CHILD_OF = PermissibleValue(text="CHILD_OF", - meaning=FAMREL["01"]) - FATHER_OF = PermissibleValue(text="FATHER_OF", - meaning=FAMREL["11"]) + SIBLING_OF = PermissibleValue(text="SIBLING_OF", meaning=FAMREL["01"]) + PARENT_OF = PermissibleValue(text="PARENT_OF", meaning=FAMREL["02"]) + CHILD_OF = PermissibleValue(text="CHILD_OF", meaning=FAMREL["01"]) + FATHER_OF = PermissibleValue(text="FATHER_OF", meaning=FAMREL["11"]) _defn = EnumDefinition( name="FamilialRelationshipType", ) + class GenderType(EnumDefinitionImpl): _defn = EnumDefinition( @@ -550,24 +570,13 @@ class GenderType(EnumDefinitionImpl): @classmethod def _addvals(cls): - setattr(cls, "nonbinary man", - PermissibleValue(text="nonbinary man", - meaning=GSSO["009254"]) ) - setattr(cls, "nonbinary woman", - PermissibleValue(text="nonbinary woman", - meaning=GSSO["009253"]) ) - setattr(cls, "transgender woman", - PermissibleValue(text="transgender woman", - meaning=GSSO["000384"]) ) - setattr(cls, "transgender man", - PermissibleValue(text="transgender man", - meaning=GSSO["000372"]) ) - setattr(cls, "cisgender man", - PermissibleValue(text="cisgender man", - meaning=GSSO["000371"]) ) - setattr(cls, "cisgender woman", - PermissibleValue(text="cisgender woman", - meaning=GSSO["000385"]) ) + setattr(cls, "nonbinary man", PermissibleValue(text="nonbinary man", meaning=GSSO["009254"])) + setattr(cls, "nonbinary woman", PermissibleValue(text="nonbinary woman", meaning=GSSO["009253"])) + setattr(cls, "transgender woman", PermissibleValue(text="transgender woman", meaning=GSSO["000384"])) + setattr(cls, "transgender man", PermissibleValue(text="transgender man", meaning=GSSO["000372"])) + setattr(cls, "cisgender man", PermissibleValue(text="cisgender man", meaning=GSSO["000371"])) + setattr(cls, "cisgender woman", PermissibleValue(text="cisgender woman", meaning=GSSO["000385"])) + class DiagnosisType(EnumDefinitionImpl): @@ -575,109 +584,315 @@ class DiagnosisType(EnumDefinitionImpl): name="DiagnosisType", ) + # Slots class slots: pass -slots.id = Slot(uri=SCHEMA.identifier, name="id", curie=SCHEMA.curie('identifier'), - model_uri=PERSONINFO.id, domain=None, range=URIRef) - -slots.name = Slot(uri=SCHEMA.name, name="name", curie=SCHEMA.curie('name'), - model_uri=PERSONINFO.name, domain=None, range=Optional[str]) - -slots.description = Slot(uri=SCHEMA.description, name="description", curie=SCHEMA.curie('description'), - model_uri=PERSONINFO.description, domain=None, range=Optional[str]) - -slots.image = Slot(uri=SCHEMA.image, name="image", curie=SCHEMA.curie('image'), - model_uri=PERSONINFO.image, domain=None, range=Optional[str]) - -slots.gender = Slot(uri=SCHEMA.gender, name="gender", curie=SCHEMA.curie('gender'), - model_uri=PERSONINFO.gender, domain=None, range=Optional[Union[str, "GenderType"]]) - -slots.primary_email = Slot(uri=SCHEMA.email, name="primary_email", curie=SCHEMA.curie('email'), - model_uri=PERSONINFO.primary_email, domain=None, range=Optional[str]) - -slots.birth_date = Slot(uri=SCHEMA.birthDate, name="birth_date", curie=SCHEMA.curie('birthDate'), - model_uri=PERSONINFO.birth_date, domain=None, range=Optional[str]) - -slots.employed_at = Slot(uri=PERSONINFO.employed_at, name="employed_at", curie=PERSONINFO.curie('employed_at'), - model_uri=PERSONINFO.employed_at, domain=None, range=Optional[Union[str, OrganizationId]]) - -slots.is_current = Slot(uri=PERSONINFO.is_current, name="is_current", curie=PERSONINFO.curie('is_current'), - model_uri=PERSONINFO.is_current, domain=None, range=Optional[Union[bool, Bool]]) - -slots.has_employment_history = Slot(uri=PERSONINFO.has_employment_history, name="has_employment_history", curie=PERSONINFO.curie('has_employment_history'), - model_uri=PERSONINFO.has_employment_history, domain=None, range=Optional[Union[Union[dict, EmploymentEvent], list[Union[dict, EmploymentEvent]]]]) - -slots.has_medical_history = Slot(uri=PERSONINFO.has_medical_history, name="has_medical_history", curie=PERSONINFO.curie('has_medical_history'), - model_uri=PERSONINFO.has_medical_history, domain=None, range=Optional[Union[Union[dict, MedicalEvent], list[Union[dict, MedicalEvent]]]]) - -slots.has_familial_relationships = Slot(uri=PERSONINFO.has_familial_relationships, name="has_familial_relationships", curie=PERSONINFO.curie('has_familial_relationships'), - model_uri=PERSONINFO.has_familial_relationships, domain=None, range=Optional[Union[Union[dict, FamilialRelationship], list[Union[dict, FamilialRelationship]]]]) - -slots.in_location = Slot(uri=PERSONINFO.in_location, name="in_location", curie=PERSONINFO.curie('in_location'), - model_uri=PERSONINFO.in_location, domain=None, range=Optional[Union[str, PlaceId]]) - -slots.current_address = Slot(uri=PERSONINFO.current_address, name="current_address", curie=PERSONINFO.curie('current_address'), - model_uri=PERSONINFO.current_address, domain=None, range=Optional[Union[dict, Address]]) - -slots.age_in_years = Slot(uri=PERSONINFO.age_in_years, name="age_in_years", curie=PERSONINFO.curie('age_in_years'), - model_uri=PERSONINFO.age_in_years, domain=None, range=Optional[int]) - -slots.related_to = Slot(uri=PERSONINFO.related_to, name="related_to", curie=PERSONINFO.curie('related_to'), - model_uri=PERSONINFO.related_to, domain=None, range=Optional[str]) - -slots.type = Slot(uri=PERSONINFO.type, name="type", curie=PERSONINFO.curie('type'), - model_uri=PERSONINFO.type, domain=None, range=Optional[Union[str, "RelationshipType"]]) - -slots.street = Slot(uri=PERSONINFO.street, name="street", curie=PERSONINFO.curie('street'), - model_uri=PERSONINFO.street, domain=None, range=Optional[str]) - -slots.city = Slot(uri=PERSONINFO.city, name="city", curie=PERSONINFO.curie('city'), - model_uri=PERSONINFO.city, domain=None, range=Optional[str]) - -slots.mission_statement = Slot(uri=PERSONINFO.mission_statement, name="mission_statement", curie=PERSONINFO.curie('mission_statement'), - model_uri=PERSONINFO.mission_statement, domain=None, range=Optional[str]) - -slots.founding_date = Slot(uri=PERSONINFO.founding_date, name="founding_date", curie=PERSONINFO.curie('founding_date'), - model_uri=PERSONINFO.founding_date, domain=None, range=Optional[str]) - -slots.founding_location = Slot(uri=PERSONINFO.founding_location, name="founding_location", curie=PERSONINFO.curie('founding_location'), - model_uri=PERSONINFO.founding_location, domain=None, range=Optional[Union[str, PlaceId]]) - -slots.postal_code = Slot(uri=PERSONINFO.postal_code, name="postal_code", curie=PERSONINFO.curie('postal_code'), - model_uri=PERSONINFO.postal_code, domain=None, range=Optional[str]) - -slots.started_at_time = Slot(uri=PROV.startedAtTime, name="started_at_time", curie=PROV.curie('startedAtTime'), - model_uri=PERSONINFO.started_at_time, domain=None, range=Optional[Union[str, XSDDate]]) - -slots.duration = Slot(uri=PERSONINFO.duration, name="duration", curie=PERSONINFO.curie('duration'), - model_uri=PERSONINFO.duration, domain=None, range=Optional[float]) - -slots.diagnosis = Slot(uri=PERSONINFO.diagnosis, name="diagnosis", curie=PERSONINFO.curie('diagnosis'), - model_uri=PERSONINFO.diagnosis, domain=None, range=Optional[Union[dict, DiagnosisConcept]]) - -slots.procedure = Slot(uri=PERSONINFO.procedure, name="procedure", curie=PERSONINFO.curie('procedure'), - model_uri=PERSONINFO.procedure, domain=None, range=Optional[Union[dict, ProcedureConcept]]) - -slots.ended_at_time = Slot(uri=PROV.endedAtTime, name="ended_at_time", curie=PROV.curie('endedAtTime'), - model_uri=PERSONINFO.ended_at_time, domain=None, range=Optional[Union[str, XSDDate]]) - -slots.persons = Slot(uri=PERSONINFO.persons, name="persons", curie=PERSONINFO.curie('persons'), - model_uri=PERSONINFO.persons, domain=None, range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]]) - -slots.organizations = Slot(uri=PERSONINFO.organizations, name="organizations", curie=PERSONINFO.curie('organizations'), - model_uri=PERSONINFO.organizations, domain=None, range=Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]]) - -slots.hasAliases__aliases = Slot(uri=PERSONINFO.aliases, name="hasAliases__aliases", curie=PERSONINFO.curie('aliases'), - model_uri=PERSONINFO.hasAliases__aliases, domain=None, range=Optional[Union[str, list[str]]]) - -slots.Person_primary_email = Slot(uri=SCHEMA.email, name="Person_primary_email", curie=SCHEMA.curie('email'), - model_uri=PERSONINFO.Person_primary_email, domain=Person, range=Optional[str], - pattern=re.compile(r'^\S+@[\S+\.]+\S+')) - -slots.FamilialRelationship_type = Slot(uri=PERSONINFO.type, name="FamilialRelationship_type", curie=PERSONINFO.curie('type'), - model_uri=PERSONINFO.FamilialRelationship_type, domain=FamilialRelationship, range=Union[str, "FamilialRelationshipType"]) -slots.FamilialRelationship_related_to = Slot(uri=PERSONINFO.related_to, name="FamilialRelationship_related_to", curie=PERSONINFO.curie('related_to'), - model_uri=PERSONINFO.FamilialRelationship_related_to, domain=FamilialRelationship, range=Union[str, PersonId]) +slots.id = Slot( + uri=SCHEMA.identifier, + name="id", + curie=SCHEMA.curie("identifier"), + model_uri=PERSONINFO.id, + domain=None, + range=URIRef, +) + +slots.name = Slot( + uri=SCHEMA.name, + name="name", + curie=SCHEMA.curie("name"), + model_uri=PERSONINFO.name, + domain=None, + range=Optional[str], +) + +slots.description = Slot( + uri=SCHEMA.description, + name="description", + curie=SCHEMA.curie("description"), + model_uri=PERSONINFO.description, + domain=None, + range=Optional[str], +) + +slots.image = Slot( + uri=SCHEMA.image, + name="image", + curie=SCHEMA.curie("image"), + model_uri=PERSONINFO.image, + domain=None, + range=Optional[str], +) + +slots.gender = Slot( + uri=SCHEMA.gender, + name="gender", + curie=SCHEMA.curie("gender"), + model_uri=PERSONINFO.gender, + domain=None, + range=Optional[Union[str, "GenderType"]], +) + +slots.primary_email = Slot( + uri=SCHEMA.email, + name="primary_email", + curie=SCHEMA.curie("email"), + model_uri=PERSONINFO.primary_email, + domain=None, + range=Optional[str], +) + +slots.birth_date = Slot( + uri=SCHEMA.birthDate, + name="birth_date", + curie=SCHEMA.curie("birthDate"), + model_uri=PERSONINFO.birth_date, + domain=None, + range=Optional[str], +) + +slots.employed_at = Slot( + uri=PERSONINFO.employed_at, + name="employed_at", + curie=PERSONINFO.curie("employed_at"), + model_uri=PERSONINFO.employed_at, + domain=None, + range=Optional[Union[str, OrganizationId]], +) + +slots.is_current = Slot( + uri=PERSONINFO.is_current, + name="is_current", + curie=PERSONINFO.curie("is_current"), + model_uri=PERSONINFO.is_current, + domain=None, + range=Optional[Union[bool, Bool]], +) + +slots.has_employment_history = Slot( + uri=PERSONINFO.has_employment_history, + name="has_employment_history", + curie=PERSONINFO.curie("has_employment_history"), + model_uri=PERSONINFO.has_employment_history, + domain=None, + range=Optional[Union[Union[dict, EmploymentEvent], list[Union[dict, EmploymentEvent]]]], +) + +slots.has_medical_history = Slot( + uri=PERSONINFO.has_medical_history, + name="has_medical_history", + curie=PERSONINFO.curie("has_medical_history"), + model_uri=PERSONINFO.has_medical_history, + domain=None, + range=Optional[Union[Union[dict, MedicalEvent], list[Union[dict, MedicalEvent]]]], +) + +slots.has_familial_relationships = Slot( + uri=PERSONINFO.has_familial_relationships, + name="has_familial_relationships", + curie=PERSONINFO.curie("has_familial_relationships"), + model_uri=PERSONINFO.has_familial_relationships, + domain=None, + range=Optional[Union[Union[dict, FamilialRelationship], list[Union[dict, FamilialRelationship]]]], +) + +slots.in_location = Slot( + uri=PERSONINFO.in_location, + name="in_location", + curie=PERSONINFO.curie("in_location"), + model_uri=PERSONINFO.in_location, + domain=None, + range=Optional[Union[str, PlaceId]], +) + +slots.current_address = Slot( + uri=PERSONINFO.current_address, + name="current_address", + curie=PERSONINFO.curie("current_address"), + model_uri=PERSONINFO.current_address, + domain=None, + range=Optional[Union[dict, Address]], +) + +slots.age_in_years = Slot( + uri=PERSONINFO.age_in_years, + name="age_in_years", + curie=PERSONINFO.curie("age_in_years"), + model_uri=PERSONINFO.age_in_years, + domain=None, + range=Optional[int], +) + +slots.related_to = Slot( + uri=PERSONINFO.related_to, + name="related_to", + curie=PERSONINFO.curie("related_to"), + model_uri=PERSONINFO.related_to, + domain=None, + range=Optional[str], +) + +slots.type = Slot( + uri=PERSONINFO.type, + name="type", + curie=PERSONINFO.curie("type"), + model_uri=PERSONINFO.type, + domain=None, + range=Optional[Union[str, "RelationshipType"]], +) + +slots.street = Slot( + uri=PERSONINFO.street, + name="street", + curie=PERSONINFO.curie("street"), + model_uri=PERSONINFO.street, + domain=None, + range=Optional[str], +) + +slots.city = Slot( + uri=PERSONINFO.city, + name="city", + curie=PERSONINFO.curie("city"), + model_uri=PERSONINFO.city, + domain=None, + range=Optional[str], +) + +slots.mission_statement = Slot( + uri=PERSONINFO.mission_statement, + name="mission_statement", + curie=PERSONINFO.curie("mission_statement"), + model_uri=PERSONINFO.mission_statement, + domain=None, + range=Optional[str], +) + +slots.founding_date = Slot( + uri=PERSONINFO.founding_date, + name="founding_date", + curie=PERSONINFO.curie("founding_date"), + model_uri=PERSONINFO.founding_date, + domain=None, + range=Optional[str], +) + +slots.founding_location = Slot( + uri=PERSONINFO.founding_location, + name="founding_location", + curie=PERSONINFO.curie("founding_location"), + model_uri=PERSONINFO.founding_location, + domain=None, + range=Optional[Union[str, PlaceId]], +) + +slots.postal_code = Slot( + uri=PERSONINFO.postal_code, + name="postal_code", + curie=PERSONINFO.curie("postal_code"), + model_uri=PERSONINFO.postal_code, + domain=None, + range=Optional[str], +) + +slots.started_at_time = Slot( + uri=PROV.startedAtTime, + name="started_at_time", + curie=PROV.curie("startedAtTime"), + model_uri=PERSONINFO.started_at_time, + domain=None, + range=Optional[Union[str, XSDDate]], +) + +slots.duration = Slot( + uri=PERSONINFO.duration, + name="duration", + curie=PERSONINFO.curie("duration"), + model_uri=PERSONINFO.duration, + domain=None, + range=Optional[float], +) + +slots.diagnosis = Slot( + uri=PERSONINFO.diagnosis, + name="diagnosis", + curie=PERSONINFO.curie("diagnosis"), + model_uri=PERSONINFO.diagnosis, + domain=None, + range=Optional[Union[dict, DiagnosisConcept]], +) + +slots.procedure = Slot( + uri=PERSONINFO.procedure, + name="procedure", + curie=PERSONINFO.curie("procedure"), + model_uri=PERSONINFO.procedure, + domain=None, + range=Optional[Union[dict, ProcedureConcept]], +) + +slots.ended_at_time = Slot( + uri=PROV.endedAtTime, + name="ended_at_time", + curie=PROV.curie("endedAtTime"), + model_uri=PERSONINFO.ended_at_time, + domain=None, + range=Optional[Union[str, XSDDate]], +) + +slots.persons = Slot( + uri=PERSONINFO.persons, + name="persons", + curie=PERSONINFO.curie("persons"), + model_uri=PERSONINFO.persons, + domain=None, + range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]], +) + +slots.organizations = Slot( + uri=PERSONINFO.organizations, + name="organizations", + curie=PERSONINFO.curie("organizations"), + model_uri=PERSONINFO.organizations, + domain=None, + range=Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]], +) + +slots.hasAliases__aliases = Slot( + uri=PERSONINFO.aliases, + name="hasAliases__aliases", + curie=PERSONINFO.curie("aliases"), + model_uri=PERSONINFO.hasAliases__aliases, + domain=None, + range=Optional[Union[str, list[str]]], +) + +slots.Person_primary_email = Slot( + uri=SCHEMA.email, + name="Person_primary_email", + curie=SCHEMA.curie("email"), + model_uri=PERSONINFO.Person_primary_email, + domain=Person, + range=Optional[str], + pattern=re.compile(r"^\S+@[\S+\.]+\S+"), +) + +slots.FamilialRelationship_type = Slot( + uri=PERSONINFO.type, + name="FamilialRelationship_type", + curie=PERSONINFO.curie("type"), + model_uri=PERSONINFO.FamilialRelationship_type, + domain=FamilialRelationship, + range=Union[str, "FamilialRelationshipType"], +) + +slots.FamilialRelationship_related_to = Slot( + uri=PERSONINFO.related_to, + name="FamilialRelationship_related_to", + curie=PERSONINFO.curie("related_to"), + model_uri=PERSONINFO.FamilialRelationship_related_to, + domain=FamilialRelationship, + range=Union[str, PersonId], +) diff --git a/tests/test_index/test_object_index.py b/tests/test_index/test_object_index.py index ea2d5e6e..1e967f65 100644 --- a/tests/test_index/test_object_index.py +++ b/tests/test_index/test_object_index.py @@ -8,8 +8,8 @@ from linkml_runtime.utils.inference_utils import infer_slot_value, Config from tests.test_index import INPUT_DIR -SCHEMA = os.path.join(INPUT_DIR, 'container_test.yaml') -DATA = os.path.join(INPUT_DIR, 'object-indexer-data.yaml') +SCHEMA = os.path.join(INPUT_DIR, "container_test.yaml") +DATA = os.path.join(INPUT_DIR, "object-indexer-data.yaml") class ObjectIndexerTestCase(unittest.TestCase): @@ -23,7 +23,7 @@ def setUp(self) -> None: self.container = yaml_loader.load(DATA, target_class=src_dm.Container) def test_object_index(self): - """ checks indexing objects """ + """checks indexing objects""" # domain object container = self.container frt = container.persons[0].has_familial_relationships[0].type @@ -93,11 +93,11 @@ def test_object_index(self): self.assertEqual("P:001", oix.eval_expr("persons[0]._parents[0][1].persons[0].id")) self.assertEqual("P:001", oix.eval_expr("persons[0].persons__inverse[0].persons[0].id")) # test inference - #infer_all_slot_values(person, self.schemaview, class_name="Person") + # infer_all_slot_values(person, self.schemaview, class_name="Person") config = Config(use_expressions=True) infer_slot_value(person, "description", schemaview=self.schemaview, class_name="Person", config=config) self.assertEqual("name: fred bloggs address: 1 oak street", person.description) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_issues/input/issue_355.py b/tests/test_issues/input/issue_355.py index 991d356c..fbee480f 100644 --- a/tests/test_issues/input/issue_355.py +++ b/tests/test_issues/input/issue_355.py @@ -20,13 +20,14 @@ metamodel_version = "1.7.0" # Namespaces -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -SCT = CurieNamespace('sct', 'http://snomed.info/id/') +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +SCT = CurieNamespace("sct", "http://snomed.info/id/") DEFAULT_ = SCT # Types + # Class references class ContaineeId(URIorCURIE): pass @@ -41,10 +42,12 @@ class Container(YAMLRoot): class_name: ClassVar[str] = "container" class_model_uri: ClassVar[URIRef] = SCT.Container - entry: Optional[Union[dict[Union[str, ContaineeId], Union[dict, "Containee"]], list[Union[dict, "Containee"]]]] = empty_dict() + entry: Optional[Union[dict[Union[str, ContaineeId], Union[dict, "Containee"]], list[Union[dict, "Containee"]]]] = ( + empty_dict() + ) def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): - self._normalize_inlined_as_dict(slot_name="entry", slot_type=Containee, key_name="id", keyed=True) + self._normalize_inlined_as_dict(slot_name="entry", slot_type=Containee, key_name="id", keyed=True) super().__post_init__(**kwargs) @@ -80,11 +83,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): class slots: pass -slots.container__entry = Slot(uri=SCT.entry, name="container__entry", curie=SCT.curie('entry'), - model_uri=SCT.container__entry, domain=None, range=Optional[Union[dict[Union[str, ContaineeId], Union[dict, Containee]], list[Union[dict, Containee]]]]) - -slots.containee__id = Slot(uri=SCT.id, name="containee__id", curie=SCT.curie('id'), - model_uri=SCT.containee__id, domain=None, range=URIRef) -slots.containee__value = Slot(uri=SCT.value, name="containee__value", curie=SCT.curie('value'), - model_uri=SCT.containee__value, domain=None, range=Optional[str]) +slots.container__entry = Slot( + uri=SCT.entry, + name="container__entry", + curie=SCT.curie("entry"), + model_uri=SCT.container__entry, + domain=None, + range=Optional[Union[dict[Union[str, ContaineeId], Union[dict, Containee]], list[Union[dict, Containee]]]], +) + +slots.containee__id = Slot( + uri=SCT.id, name="containee__id", curie=SCT.curie("id"), model_uri=SCT.containee__id, domain=None, range=URIRef +) + +slots.containee__value = Slot( + uri=SCT.value, + name="containee__value", + curie=SCT.curie("value"), + model_uri=SCT.containee__value, + domain=None, + range=Optional[str], +) diff --git a/tests/test_issues/input/issue_368.py b/tests/test_issues/input/issue_368.py index 39b6d31b..75eb7b60 100644 --- a/tests/test_issues/input/issue_368.py +++ b/tests/test_issues/input/issue_368.py @@ -18,8 +18,8 @@ metamodel_version = "1.7.0" # Namespaces -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -DEFAULT_ = CurieNamespace('', 'https://microbiomedata/schema/') +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +DEFAULT_ = CurieNamespace("", "https://microbiomedata/schema/") # Types @@ -27,7 +27,6 @@ # Class references - @dataclass class SampleClass(ParentClass): _inherited_slots: ClassVar[list[str]] = [] @@ -53,5 +52,12 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): class slots: pass -slots.slot_1 = Slot(uri=DEFAULT_.slot_1, name="slot_1", curie=DEFAULT_.curie('slot_1'), - model_uri=DEFAULT_.slot_1, domain=None, range=Optional[Union[str, "SampleEnum"]]) + +slots.slot_1 = Slot( + uri=DEFAULT_.slot_1, + name="slot_1", + curie=DEFAULT_.curie("slot_1"), + model_uri=DEFAULT_.slot_1, + domain=None, + range=Optional[Union[str, "SampleEnum"]], +) diff --git a/tests/test_issues/input/issue_368_imports.py b/tests/test_issues/input/issue_368_imports.py index 823524c0..082641ef 100644 --- a/tests/test_issues/input/issue_368_imports.py +++ b/tests/test_issues/input/issue_368_imports.py @@ -19,7 +19,7 @@ metamodel_version = "1.7.0" # Namespaces -DEFAULT_ = CurieNamespace('', 'https://microbiomedata/schema/mixs/') +DEFAULT_ = CurieNamespace("", "https://microbiomedata/schema/mixs/") # Types @@ -27,7 +27,6 @@ # Class references - class ParentClass(YAMLRoot): _inherited_slots: ClassVar[list[str]] = [] @@ -40,16 +39,14 @@ class ParentClass(YAMLRoot): # Enumerations class SampleEnum(EnumDefinitionImpl): - pva = PermissibleValue(text="pva", - description="PVA description") - pvb = PermissibleValue(text="pvb", - description="PVB description") + pva = PermissibleValue(text="pva", description="PVA description") + pvb = PermissibleValue(text="pvb", description="PVB description") _defn = EnumDefinition( name="SampleEnum", ) + # Slots class slots: pass - diff --git a/tests/test_issues/models/linkml_issue_576.py b/tests/test_issues/models/linkml_issue_576.py index 0b7bf1f9..e9d8b61c 100644 --- a/tests/test_issues/models/linkml_issue_576.py +++ b/tests/test_issues/models/linkml_issue_576.py @@ -22,17 +22,18 @@ version = None # Namespaces -EX = CurieNamespace('ex', 'https://example.org/') -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -PERSONINFO = CurieNamespace('personinfo', 'https://w3id.org/linkml/personinfo/') -SCHEMA = CurieNamespace('schema', 'http://schema.org/') -XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') +EX = CurieNamespace("ex", "https://example.org/") +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +PERSONINFO = CurieNamespace("personinfo", "https://w3id.org/linkml/personinfo/") +SCHEMA = CurieNamespace("schema", "http://schema.org/") +XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") DEFAULT_ = PERSONINFO # Types class Code(String): - """ An identifier that is encoded in a string. This is used to represent identifiers that are not URIs, but are encoded as strings. For example, a person's social security number is an encoded identifier. """ + """An identifier that is encoded in a string. This is used to represent identifiers that are not URIs, but are encoded as strings. For example, a person's social security number is an encoded identifier.""" + type_class_uri = XSD.string type_class_curie = "xsd:string" type_name = "Code" @@ -149,7 +150,9 @@ class Dataset(YAMLRoot): source: Optional[Union[str, URIorCURIE]] = None persons: Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]] = empty_dict() - organizations: Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]] = empty_dict() + organizations: Optional[ + Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]] + ] = empty_dict() pets: Optional[Union[dict[Union[str, PetId], Union[dict, Pet]], list[Union[dict, Pet]]]] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): @@ -172,41 +175,120 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): class slots: pass -slots.person__id = Slot(uri=PERSONINFO.id, name="person__id", curie=PERSONINFO.curie('id'), - model_uri=PERSONINFO.person__id, domain=None, range=URIRef) - -slots.person__name = Slot(uri=SCHEMA.name, name="person__name", curie=SCHEMA.curie('name'), - model_uri=PERSONINFO.person__name, domain=None, range=Optional[str]) - -slots.person__friends = Slot(uri=PERSONINFO.friends, name="person__friends", curie=PERSONINFO.curie('friends'), - model_uri=PERSONINFO.person__friends, domain=None, range=Optional[Union[Union[str, PersonId], list[Union[str, PersonId]]]]) - -slots.pet__id = Slot(uri=PERSONINFO.id, name="pet__id", curie=PERSONINFO.curie('id'), - model_uri=PERSONINFO.pet__id, domain=None, range=URIRef) - -slots.pet__name = Slot(uri=SCHEMA.name, name="pet__name", curie=SCHEMA.curie('name'), - model_uri=PERSONINFO.pet__name, domain=None, range=Optional[str]) - -slots.pet__owner = Slot(uri=SCHEMA.owner, name="pet__owner", curie=SCHEMA.curie('owner'), - model_uri=PERSONINFO.pet__owner, domain=None, range=Optional[Union[str, PersonId]]) - -slots.organization__id = Slot(uri=PERSONINFO.id, name="organization__id", curie=PERSONINFO.curie('id'), - model_uri=PERSONINFO.organization__id, domain=None, range=URIRef) - -slots.organization__name = Slot(uri=SCHEMA.name, name="organization__name", curie=SCHEMA.curie('name'), - model_uri=PERSONINFO.organization__name, domain=None, range=Optional[str]) - -slots.organization__part_of = Slot(uri=PERSONINFO.part_of, name="organization__part_of", curie=PERSONINFO.curie('part_of'), - model_uri=PERSONINFO.organization__part_of, domain=None, range=Optional[Union[Union[str, OrganizationId], list[Union[str, OrganizationId]]]]) - -slots.dataset__source = Slot(uri=PERSONINFO.source, name="dataset__source", curie=PERSONINFO.curie('source'), - model_uri=PERSONINFO.dataset__source, domain=None, range=Optional[Union[str, URIorCURIE]]) - -slots.dataset__persons = Slot(uri=PERSONINFO.persons, name="dataset__persons", curie=PERSONINFO.curie('persons'), - model_uri=PERSONINFO.dataset__persons, domain=None, range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]]) - -slots.dataset__organizations = Slot(uri=PERSONINFO.organizations, name="dataset__organizations", curie=PERSONINFO.curie('organizations'), - model_uri=PERSONINFO.dataset__organizations, domain=None, range=Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]]) -slots.dataset__pets = Slot(uri=PERSONINFO.pets, name="dataset__pets", curie=PERSONINFO.curie('pets'), - model_uri=PERSONINFO.dataset__pets, domain=None, range=Optional[Union[dict[Union[str, PetId], Union[dict, Pet]], list[Union[dict, Pet]]]]) +slots.person__id = Slot( + uri=PERSONINFO.id, + name="person__id", + curie=PERSONINFO.curie("id"), + model_uri=PERSONINFO.person__id, + domain=None, + range=URIRef, +) + +slots.person__name = Slot( + uri=SCHEMA.name, + name="person__name", + curie=SCHEMA.curie("name"), + model_uri=PERSONINFO.person__name, + domain=None, + range=Optional[str], +) + +slots.person__friends = Slot( + uri=PERSONINFO.friends, + name="person__friends", + curie=PERSONINFO.curie("friends"), + model_uri=PERSONINFO.person__friends, + domain=None, + range=Optional[Union[Union[str, PersonId], list[Union[str, PersonId]]]], +) + +slots.pet__id = Slot( + uri=PERSONINFO.id, + name="pet__id", + curie=PERSONINFO.curie("id"), + model_uri=PERSONINFO.pet__id, + domain=None, + range=URIRef, +) + +slots.pet__name = Slot( + uri=SCHEMA.name, + name="pet__name", + curie=SCHEMA.curie("name"), + model_uri=PERSONINFO.pet__name, + domain=None, + range=Optional[str], +) + +slots.pet__owner = Slot( + uri=SCHEMA.owner, + name="pet__owner", + curie=SCHEMA.curie("owner"), + model_uri=PERSONINFO.pet__owner, + domain=None, + range=Optional[Union[str, PersonId]], +) + +slots.organization__id = Slot( + uri=PERSONINFO.id, + name="organization__id", + curie=PERSONINFO.curie("id"), + model_uri=PERSONINFO.organization__id, + domain=None, + range=URIRef, +) + +slots.organization__name = Slot( + uri=SCHEMA.name, + name="organization__name", + curie=SCHEMA.curie("name"), + model_uri=PERSONINFO.organization__name, + domain=None, + range=Optional[str], +) + +slots.organization__part_of = Slot( + uri=PERSONINFO.part_of, + name="organization__part_of", + curie=PERSONINFO.curie("part_of"), + model_uri=PERSONINFO.organization__part_of, + domain=None, + range=Optional[Union[Union[str, OrganizationId], list[Union[str, OrganizationId]]]], +) + +slots.dataset__source = Slot( + uri=PERSONINFO.source, + name="dataset__source", + curie=PERSONINFO.curie("source"), + model_uri=PERSONINFO.dataset__source, + domain=None, + range=Optional[Union[str, URIorCURIE]], +) + +slots.dataset__persons = Slot( + uri=PERSONINFO.persons, + name="dataset__persons", + curie=PERSONINFO.curie("persons"), + model_uri=PERSONINFO.dataset__persons, + domain=None, + range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]], +) + +slots.dataset__organizations = Slot( + uri=PERSONINFO.organizations, + name="dataset__organizations", + curie=PERSONINFO.curie("organizations"), + model_uri=PERSONINFO.dataset__organizations, + domain=None, + range=Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]], +) + +slots.dataset__pets = Slot( + uri=PERSONINFO.pets, + name="dataset__pets", + curie=PERSONINFO.curie("pets"), + model_uri=PERSONINFO.dataset__pets, + domain=None, + range=Optional[Union[dict[Union[str, PetId], Union[dict, Pet]], list[Union[dict, Pet]]]], +) diff --git a/tests/test_issues/models/model_817.py b/tests/test_issues/models/model_817.py index 874a9162..10d216a5 100644 --- a/tests/test_issues/models/model_817.py +++ b/tests/test_issues/models/model_817.py @@ -23,17 +23,18 @@ version = None # Namespaces -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -PERSONINFO = CurieNamespace('personinfo', 'https://w3id.org/linkml/examples/personinfo/') -RDF = CurieNamespace('rdf', 'http://example.org/UNKNOWN/rdf/') -RDFS = CurieNamespace('rdfs', 'http://example.org/UNKNOWN/rdfs/') -SKOS = CurieNamespace('skos', 'http://example.org/UNKNOWN/skos/') -XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +PERSONINFO = CurieNamespace("personinfo", "https://w3id.org/linkml/examples/personinfo/") +RDF = CurieNamespace("rdf", "http://example.org/UNKNOWN/rdf/") +RDFS = CurieNamespace("rdfs", "http://example.org/UNKNOWN/rdfs/") +SKOS = CurieNamespace("skos", "http://example.org/UNKNOWN/skos/") +XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") DEFAULT_ = PERSONINFO # Types + # Class references class PersonId(extended_str): pass @@ -99,8 +100,12 @@ class Container(YAMLRoot): class_model_uri: ClassVar[URIRef] = PERSONINFO.Container name: Optional[str] = None - persons_as_list: Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]] = empty_dict() - persons_as_dict: Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]] = empty_dict() + persons_as_list: Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]] = ( + empty_dict() + ) + persons_as_dict: Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]] = ( + empty_dict() + ) single_person_inlined: Optional[Union[dict, Person]] = None noidobj_as_list: Optional[Union[Union[dict, PersonNoId], list[Union[dict, PersonNoId]]]] = empty_list() single_noidobj_inlined: Optional[Union[dict, PersonNoId]] = None @@ -118,7 +123,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.noidobj_as_list, list): self.noidobj_as_list = [self.noidobj_as_list] if self.noidobj_as_list is not None else [] - self.noidobj_as_list = [v if isinstance(v, PersonNoId) else PersonNoId(**as_dict(v)) for v in self.noidobj_as_list] + self.noidobj_as_list = [ + v if isinstance(v, PersonNoId) else PersonNoId(**as_dict(v)) for v in self.noidobj_as_list + ] if self.single_noidobj_inlined is not None and not isinstance(self.single_noidobj_inlined, PersonNoId): self.single_noidobj_inlined = PersonNoId(**as_dict(self.single_noidobj_inlined)) @@ -136,30 +143,75 @@ class VitalStatusEnum(EnumDefinitionImpl): name="VitalStatusEnum", ) + # Slots class slots: pass -slots.id = Slot(uri=PERSONINFO.id, name="id", curie=PERSONINFO.curie('id'), - model_uri=PERSONINFO.id, domain=None, range=URIRef) - -slots.name = Slot(uri=PERSONINFO.name, name="name", curie=PERSONINFO.curie('name'), - model_uri=PERSONINFO.name, domain=None, range=Optional[str]) - -slots.persons_as_list = Slot(uri=PERSONINFO.persons_as_list, name="persons_as_list", curie=PERSONINFO.curie('persons_as_list'), - model_uri=PERSONINFO.persons_as_list, domain=None, range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]]) - -slots.persons_as_dict = Slot(uri=PERSONINFO.persons_as_dict, name="persons_as_dict", curie=PERSONINFO.curie('persons_as_dict'), - model_uri=PERSONINFO.persons_as_dict, domain=None, range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]]) - -slots.single_person_inlined = Slot(uri=PERSONINFO.single_person_inlined, name="single_person_inlined", curie=PERSONINFO.curie('single_person_inlined'), - model_uri=PERSONINFO.single_person_inlined, domain=None, range=Optional[Union[dict, Person]]) - -slots.noidobj_as_list = Slot(uri=PERSONINFO.noidobj_as_list, name="noidobj_as_list", curie=PERSONINFO.curie('noidobj_as_list'), - model_uri=PERSONINFO.noidobj_as_list, domain=None, range=Optional[Union[Union[dict, PersonNoId], list[Union[dict, PersonNoId]]]]) - -slots.single_noidobj_inlined = Slot(uri=PERSONINFO.single_noidobj_inlined, name="single_noidobj_inlined", curie=PERSONINFO.curie('single_noidobj_inlined'), - model_uri=PERSONINFO.single_noidobj_inlined, domain=None, range=Optional[Union[dict, PersonNoId]]) -slots.vital_status = Slot(uri=PERSONINFO.vital_status, name="vital_status", curie=PERSONINFO.curie('vital_status'), - model_uri=PERSONINFO.vital_status, domain=None, range=Optional[Union[str, "VitalStatusEnum"]]) +slots.id = Slot( + uri=PERSONINFO.id, name="id", curie=PERSONINFO.curie("id"), model_uri=PERSONINFO.id, domain=None, range=URIRef +) + +slots.name = Slot( + uri=PERSONINFO.name, + name="name", + curie=PERSONINFO.curie("name"), + model_uri=PERSONINFO.name, + domain=None, + range=Optional[str], +) + +slots.persons_as_list = Slot( + uri=PERSONINFO.persons_as_list, + name="persons_as_list", + curie=PERSONINFO.curie("persons_as_list"), + model_uri=PERSONINFO.persons_as_list, + domain=None, + range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]], +) + +slots.persons_as_dict = Slot( + uri=PERSONINFO.persons_as_dict, + name="persons_as_dict", + curie=PERSONINFO.curie("persons_as_dict"), + model_uri=PERSONINFO.persons_as_dict, + domain=None, + range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]], +) + +slots.single_person_inlined = Slot( + uri=PERSONINFO.single_person_inlined, + name="single_person_inlined", + curie=PERSONINFO.curie("single_person_inlined"), + model_uri=PERSONINFO.single_person_inlined, + domain=None, + range=Optional[Union[dict, Person]], +) + +slots.noidobj_as_list = Slot( + uri=PERSONINFO.noidobj_as_list, + name="noidobj_as_list", + curie=PERSONINFO.curie("noidobj_as_list"), + model_uri=PERSONINFO.noidobj_as_list, + domain=None, + range=Optional[Union[Union[dict, PersonNoId], list[Union[dict, PersonNoId]]]], +) + +slots.single_noidobj_inlined = Slot( + uri=PERSONINFO.single_noidobj_inlined, + name="single_noidobj_inlined", + curie=PERSONINFO.curie("single_noidobj_inlined"), + model_uri=PERSONINFO.single_noidobj_inlined, + domain=None, + range=Optional[Union[dict, PersonNoId]], +) + +slots.vital_status = Slot( + uri=PERSONINFO.vital_status, + name="vital_status", + curie=PERSONINFO.curie("vital_status"), + model_uri=PERSONINFO.vital_status, + domain=None, + range=Optional[Union[str, "VitalStatusEnum"]], +) diff --git a/tests/test_issues/test_include_schema.py b/tests/test_issues/test_include_schema.py index 1ae0c22d..588c1f17 100644 --- a/tests/test_issues/test_include_schema.py +++ b/tests/test_issues/test_include_schema.py @@ -6,12 +6,12 @@ class IncludeSchemaTestCase(unittest.TestCase): - """ include_schema.yaml produces a Python exception on an uncaught error""" + """include_schema.yaml produces a Python exception on an uncaught error""" + # "Awaiting fix for issue #3" def test_include_schema(self): - inp = yaml_loader.load(env.input_path('include_schema.yaml'), SchemaDefinition) - + inp = yaml_loader.load(env.input_path("include_schema.yaml"), SchemaDefinition) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_issues/test_issue_1040.py b/tests/test_issues/test_issue_1040.py index a2a0d770..02d1e567 100644 --- a/tests/test_issues/test_issue_1040.py +++ b/tests/test_issues/test_issue_1040.py @@ -11,11 +11,12 @@ class Issue1040TestCase(TestCase): """ https://github.com/linkml/linkml/issues/1040 """ + env = env def test_issue_1040_file_name(self): - """ issue_1040.yaml has a parsing error is confusing as all getout when accompanied by a stack - trace. We use this to make sure that the file name gets in correctly. """ + """issue_1040.yaml has a parsing error is confusing as all getout when accompanied by a stack + trace. We use this to make sure that the file name gets in correctly.""" with self.assertRaises(yaml.constructor.ConstructorError) as e: - yaml_loader.load(env.input_path('issue_1040.yaml'), SchemaDefinition) + yaml_loader.load(env.input_path("issue_1040.yaml"), SchemaDefinition) self.assertIn('"issue_1040.yaml"', str(e.exception)) diff --git a/tests/test_issues/test_issue_1355.py b/tests/test_issues/test_issue_1355.py index 6175c72d..d800a629 100644 --- a/tests/test_issues/test_issue_1355.py +++ b/tests/test_issues/test_issue_1355.py @@ -1,28 +1,29 @@ -''' +""" Created on 2023-03-24 @author: wf -''' +""" + from unittest import TestCase from linkml_runtime.utils.metamodelcore import URI + class Issue1355TestCase(TestCase): """ https://github.com/linkml/linkml/issues/1355 improve invalid URL message """ - + def test_issue_1355_invalid_url_message(self): """ check that quotes are used when referencing invalid urls so that the visiblity of the problem gets better """ - # note the trailing blank - url="https://ceur-ws.org/Vol-2931/ICBO_2019_paper_20.pdf " + # note the trailing blank + url = "https://ceur-ws.org/Vol-2931/ICBO_2019_paper_20.pdf " try: - _uri=URI(url) + _uri = URI(url) except ValueError as vex: - msg=str(vex) + msg = str(vex) # 'https://ceur-ws.org/Vol-2931/ICBO_2019_paper_20.pdf ': is not a valid URI self.assertTrue(".pdf '" in msg) - diff --git a/tests/test_issues/test_issue_163.py b/tests/test_issues/test_issue_163.py index e8e2afc7..170825da 100644 --- a/tests/test_issues/test_issue_163.py +++ b/tests/test_issues/test_issue_163.py @@ -6,11 +6,11 @@ class Issue163TestCase(unittest.TestCase): def test_trailing_sep(self): - """ Test the importmap namespace """ + """Test the importmap namespace""" importmap = parse_import_map('{ "base:": "base/" }', os.path.dirname(__file__)) # TODO: see how this works in a windows environment - self.assertTrue(importmap['base:'].endswith('/'), msg="Trailing separator stripped in import map parsing") + self.assertTrue(importmap["base:"].endswith("/"), msg="Trailing separator stripped in import map parsing") -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_issues/test_issue_355.py b/tests/test_issues/test_issue_355.py index 4e44ad74..7f00512f 100644 --- a/tests/test_issues/test_issue_355.py +++ b/tests/test_issues/test_issue_355.py @@ -21,13 +21,14 @@ metamodel_version = "1.7.0" # Namespaces -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -SCT = CurieNamespace('sct', 'http://snomed.info/id/') +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +SCT = CurieNamespace("sct", "http://snomed.info/id/") DEFAULT_ = SCT # Types + # Class references class ContaineeId(URIorCURIE): pass @@ -42,7 +43,9 @@ class Container(YAMLRoot): class_name: ClassVar[str] = "container" class_model_uri: ClassVar[URIRef] = SCT.Container - entry: Optional[Union[dict[Union[str, ContaineeId], Union[dict, "Containee"]], list[Union[dict, "Containee"]]]] = empty_dict() + entry: Optional[Union[dict[Union[str, ContaineeId], Union[dict, "Containee"]], list[Union[dict, "Containee"]]]] = ( + empty_dict() + ) def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.entry, (list, dict, JsonObj)): @@ -83,11 +86,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): class slots: pass -slots.container__entry = Slot(uri=SCT.entry, name="container__entry", curie=SCT.curie('entry'), - model_uri=SCT.container__entry, domain=None, range=Optional[Union[dict[Union[str, ContaineeId], Union[dict, Containee]], list[Union[dict, Containee]]]]) - -slots.containee__id = Slot(uri=SCT.id, name="containee__id", curie=SCT.curie('id'), - model_uri=SCT.containee__id, domain=None, range=URIRef) -slots.containee__value = Slot(uri=SCT.value, name="containee__value", curie=SCT.curie('value'), - model_uri=SCT.containee__value, domain=None, range=Optional[str]) +slots.container__entry = Slot( + uri=SCT.entry, + name="container__entry", + curie=SCT.curie("entry"), + model_uri=SCT.container__entry, + domain=None, + range=Optional[Union[dict[Union[str, ContaineeId], Union[dict, Containee]], list[Union[dict, Containee]]]], +) + +slots.containee__id = Slot( + uri=SCT.id, name="containee__id", curie=SCT.curie("id"), model_uri=SCT.containee__id, domain=None, range=URIRef +) + +slots.containee__value = Slot( + uri=SCT.value, + name="containee__value", + curie=SCT.curie("value"), + model_uri=SCT.containee__value, + domain=None, + range=Optional[str], +) diff --git a/tests/test_issues/test_issue_368_enums.py b/tests/test_issues/test_issue_368_enums.py index 68443146..bac7982e 100644 --- a/tests/test_issues/test_issue_368_enums.py +++ b/tests/test_issues/test_issue_368_enums.py @@ -11,30 +11,30 @@ class Issue368TestCase(LoaderDumperTestCase): env = env def header(self, txt: str) -> str: - return '\n' + ("=" * 20) + f" {txt} " + ("=" * 20) + return "\n" + ("=" * 20) + f" {txt} " + ("=" * 20) def test_issue_368_enums(self): - """ Test Enum generation """ + """Test Enum generation""" - module = compile_python(env.input_path('issue_368.py')) + module = compile_python(env.input_path("issue_368.py")) - enum_inst = module.SampleEnum("pva") # EnumInstanceImpl + enum_inst = module.SampleEnum("pva") # EnumInstanceImpl example = module.SampleClass(slot_1="pva") assert hasattr(example, "slot_1") assert example.slot_1.code.text == enum_inst.code.text assert str(example.slot_1) == "pva" def dump_and_load(dumper: Callable, sfx: str) -> None: - fname = env.actual_path(f'issue_368_1.{sfx}') + fname = env.actual_path(f"issue_368_1.{sfx}") dumper(example, fname) with open(fname) as f: - print(f'\n----- {sfx} -----') + print(f"\n----- {sfx} -----") print(f.read()) - dump_and_load(json_dumper.dump, 'json') - dump_and_load(yaml_dumper.dump, 'yaml') - dump_and_load(lambda obj, fname: rdf_dumper.dump(obj, fname, env.input_path("issue_368.context.jsonld")), 'ttl') + dump_and_load(json_dumper.dump, "json") + dump_and_load(yaml_dumper.dump, "yaml") + dump_and_load(lambda obj, fname: rdf_dumper.dump(obj, fname, env.input_path("issue_368.context.jsonld")), "ttl") -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_issues/test_issue_6.py b/tests/test_issues/test_issue_6.py index bd9adb6b..1365ee17 100644 --- a/tests/test_issues/test_issue_6.py +++ b/tests/test_issues/test_issue_6.py @@ -16,22 +16,23 @@ class Issue6TestCase(unittest.TestCase): def test_loc_function(self): inp = yaml.load(hbreader.hbread(inp_yaml), DupCheckYamlLoader) - self.assertEqual('File "", line 3, col 8: ', TypedNode.yaml_loc(inp['foo']['x'])) - self.assertEqual('File "", line 3, col 8', TypedNode.yaml_loc(inp['foo']['x'], suffix='')) - self.assertEqual('File "", line 4, col 8: ', TypedNode.yaml_loc(inp['foo']['y'])) - self.assertEqual('File "", line 4, col 8I yam that I yam', - TypedNode.yaml_loc(inp['foo']['y'], suffix=inp['foo']['y'])) - self.assertEqual('File "", line 5, col 8: ', TypedNode.yaml_loc(inp['foo']['z'])) + self.assertEqual('File "", line 3, col 8: ', TypedNode.yaml_loc(inp["foo"]["x"])) + self.assertEqual('File "", line 3, col 8', TypedNode.yaml_loc(inp["foo"]["x"], suffix="")) + self.assertEqual('File "", line 4, col 8: ', TypedNode.yaml_loc(inp["foo"]["y"])) + self.assertEqual( + 'File "", line 4, col 8I yam that I yam', + TypedNode.yaml_loc(inp["foo"]["y"], suffix=inp["foo"]["y"]), + ) + self.assertEqual('File "", line 5, col 8: ', TypedNode.yaml_loc(inp["foo"]["z"])) with self.assertWarns(DeprecationWarning) as cm: - self.assertEqual('File "", line 3, col 8', TypedNode.loc(inp['foo']['x'])) - self.assertEqual('Call to deprecated method loc. (Use yaml_loc instead)', cm.warning.args[0]) + self.assertEqual('File "", line 3, col 8', TypedNode.loc(inp["foo"]["x"])) + self.assertEqual("Call to deprecated method loc. (Use yaml_loc instead)", cm.warning.args[0]) + self.assertEqual("", TypedNode.yaml_loc(None)) + self.assertEqual("", TypedNode.yaml_loc("abc")) + self.assertEqual("", TypedNode.yaml_loc(["a", "b"])) - self.assertEqual('', TypedNode.yaml_loc(None)) - self.assertEqual('', TypedNode.yaml_loc("abc")) - self.assertEqual('', TypedNode.yaml_loc(['a', 'b'])) - -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_issues/test_issue_626.py b/tests/test_issues/test_issue_626.py index 4b03e677..30bf5c0e 100644 --- a/tests/test_issues/test_issue_626.py +++ b/tests/test_issues/test_issue_626.py @@ -20,7 +20,7 @@ class IsolatedNameTestCase(unittest.TestCase): def test_it(self): - """ Dangling name should not throw a type error """ + """Dangling name should not throw a type error""" error_thrown = False try: from_yaml(model_txt, SchemaDefinition) @@ -28,5 +28,6 @@ def test_it(self): error_thrown = True self.assertFalse(error_thrown, msg="Type error should not be thrown") -if __name__ == '__main__': + +if __name__ == "__main__": unittest.main() diff --git a/tests/test_issues/test_issue_718.py b/tests/test_issues/test_issue_718.py index 5ad6e331..6b4968b8 100644 --- a/tests/test_issues/test_issue_718.py +++ b/tests/test_issues/test_issue_718.py @@ -7,7 +7,7 @@ from linkml_runtime.utils.yamlutils import YAMLRoot, DupCheckYamlLoader -@pytest.mark.xfail(reason='Reporting line numbers should happen at load time not when instantiating dataclasses') +@pytest.mark.xfail(reason="Reporting line numbers should happen at load time not when instantiating dataclasses") def test_issue_38(): # The goal is to provide line numbers on error messages. We've tweaked the parser so that it returns augmented # str's and int's with the line numbers on them. The problem we are trying to address now is that the dataclass @@ -30,12 +30,11 @@ class FesterBesterTester(YAMLRoot): c: sell""" parsed_yaml = yaml.load(yaml_str, DupCheckYamlLoader) - with pytest.raises(TypeError, match="File \"\", line 4, col 9"): - FesterBesterTester(**parsed_yaml['base']) + with pytest.raises(TypeError, match='File "", line 4, col 9'): + FesterBesterTester(**parsed_yaml["base"]) - parsed_yaml['base'].pop('c', None) + parsed_yaml["base"].pop("c", None) - instance = FesterBesterTester(**parsed_yaml['base']) + instance = FesterBesterTester(**parsed_yaml["base"]) assert instance.a == 17 assert instance.b == "Ice Cream" - diff --git a/tests/test_issues/test_issue_8.py b/tests/test_issues/test_issue_8.py index c9167743..fec1904b 100644 --- a/tests/test_issues/test_issue_8.py +++ b/tests/test_issues/test_issue_8.py @@ -8,9 +8,10 @@ def override(cls: type[YAMLRoot]): orig = cls.MissingRequiredField + def mrf(self, field_name: str) -> None: if isinstance(self, SchemaDefinition) and field_name == "name" and self.id: - id_parts = self.id.replace('#', '/').rsplit('/') + id_parts = self.id.replace("#", "/").rsplit("/") self.name = id_parts[-1] elif isinstance(self, SlotDefinition) and field_name == "name": self.name = "id" @@ -18,6 +19,7 @@ def mrf(self, field_name: str) -> None: self.name = "core" else: orig(self, f"{type(self).__name__}.{field_name}") + cls.MissingRequiredField = mrf return orig @@ -28,6 +30,7 @@ def mrf(self, field_name: str) -> None: def override2(): def mrf(self, field_name: str) -> None: msgs.add(f"{type(self).__name__}.{field_name} is not supplied") + orig = YAMLRoot.MissingRequiredField YAMLRoot.MissingRequiredField = mrf return orig @@ -36,34 +39,39 @@ def mrf(self, field_name: str) -> None: class TestErrorIntercept(unittest.TestCase): def test_legitimate_error(self): - """ Test that legitimate errors are emitted correctly """ - test_file = env.input_path('issue_8a.yaml') + """Test that legitimate errors are emitted correctly""" + test_file = env.input_path("issue_8a.yaml") with self.assertRaises(ValueError) as e: yaml_loader.load(test_file, SchemaDefinition) - self.assertEqual('name must be supplied', str(e.exception), "ValueError should be raised") + self.assertEqual("name must be supplied", str(e.exception), "ValueError should be raised") orig = override(SchemaDefinition) try: with self.assertRaises(ValueError) as e: yaml_loader.load(test_file, SchemaDefinition) - self.assertEqual('SchemaDefinition.name must be supplied', str(e.exception)) + self.assertEqual("SchemaDefinition.name must be supplied", str(e.exception)) finally: # SchemaDefinition.MissingRequiredField = orig delattr(SchemaDefinition, "MissingRequiredField") def test_missing_intercept(self): - test_file = env.input_path('issue_8.yaml') + test_file = env.input_path("issue_8.yaml") with self.assertRaises(ValueError) as e: yaml_loader.load(test_file, SchemaDefinition) - self.assertEqual('name must be supplied', str(e.exception), "ValueError should be raised") + self.assertEqual("name must be supplied", str(e.exception), "ValueError should be raised") try: orig = override2() yaml_loader.load(test_file, SchemaDefinition) finally: YAMLRoot.MissingRequiredField = orig - self.assertEqual({'ClassDefinition.name is not supplied', - 'SlotDefinition.name is not supplied', - 'SchemaDefinition.name is not supplied'}, msgs) + self.assertEqual( + { + "ClassDefinition.name is not supplied", + "SlotDefinition.name is not supplied", + "SchemaDefinition.name is not supplied", + }, + msgs, + ) try: origschd = override(SchemaDefinition) @@ -79,5 +87,5 @@ def test_missing_intercept(self): # ClassDefinition.MissingRequiredField = origcd -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_issues/test_linkml_issue_1126.py b/tests/test_issues/test_linkml_issue_1126.py index 93be1f6d..fdada767 100644 --- a/tests/test_issues/test_linkml_issue_1126.py +++ b/tests/test_issues/test_linkml_issue_1126.py @@ -11,10 +11,11 @@ class Issue998TestCase(TestCase): https://github.com/linkml/linkml/issues/1126 Test getting classes that modify a slot """ + env = env def test_issue_1126_slot_classes(self): - view = SchemaView(env.input_path('linkml_issue_1126.yaml')) + view = SchemaView(env.input_path("linkml_issue_1126.yaml")) slot_definition = view.get_slot("type") slot_classes = view.get_classes_modifying_slot(slot_definition) assert len(slot_classes) == 2 @@ -23,5 +24,6 @@ def test_issue_1126_slot_classes(self): assert slot_classes[0] == ClassDefinitionName("Programmer") assert slot_classes[1] == ClassDefinitionName("Administrator") + if __name__ == "__main__": unittest.main() diff --git a/tests/test_issues/test_linkml_issue_1143.py b/tests/test_issues/test_linkml_issue_1143.py index 24e163b8..0945fac1 100644 --- a/tests/test_issues/test_linkml_issue_1143.py +++ b/tests/test_issues/test_linkml_issue_1143.py @@ -2,31 +2,39 @@ from copy import deepcopy from unittest import TestCase -from linkml_runtime.linkml_model import SchemaDefinition, ClassDefinition, SlotDefinition, EnumDefinition, TypeDefinition, Prefix, \ - SubsetDefinition +from linkml_runtime.linkml_model import ( + SchemaDefinition, + ClassDefinition, + SlotDefinition, + EnumDefinition, + TypeDefinition, + Prefix, + SubsetDefinition, +) from linkml_runtime.utils.schemaview import SchemaView from tests.test_issues.environment import env -ELEMENTS = ['prefixes', 'classes', 'slots', 'enums', 'types', 'subsets'] +ELEMENTS = ["prefixes", "classes", "slots", "enums", "types", "subsets"] EXPECTED = { - 'prefixes': ['sc1p1', 'sc2p1'], - 'classes': ['sc1c1', 'sc1c2', 'sc2c1', 'sc2c2'], - 'slots': ['sc1s1', 'sc1s2', 'sc2s1', 'sc2s2'], - 'enums': ['sc1e1', 'sc2e1'], - 'types': ['sc1t1', 'sc2t1'], - 'subsets': ['sc1ss1', 'sc2ss1'], - } - - -def make_schema(name: str, - prefixes: list[Prefix] = None, - classes: list[ClassDefinition] = None, - slots: list[SlotDefinition] = None, - enums: list[EnumDefinition] = None, - types: list[TypeDefinition] = None, - subsets: list[SubsetDefinition] = None, - ) -> SchemaDefinition: + "prefixes": ["sc1p1", "sc2p1"], + "classes": ["sc1c1", "sc1c2", "sc2c1", "sc2c2"], + "slots": ["sc1s1", "sc1s2", "sc2s1", "sc2s2"], + "enums": ["sc1e1", "sc2e1"], + "types": ["sc1t1", "sc2t1"], + "subsets": ["sc1ss1", "sc2ss1"], +} + + +def make_schema( + name: str, + prefixes: list[Prefix] = None, + classes: list[ClassDefinition] = None, + slots: list[SlotDefinition] = None, + enums: list[EnumDefinition] = None, + types: list[TypeDefinition] = None, + subsets: list[SubsetDefinition] = None, +) -> SchemaDefinition: """ Make a schema with the given elements @@ -60,10 +68,12 @@ def make_schema(name: str, schema.subsets[s.name] = s return schema + class Issue1143TestCase(TestCase): """ https://github.com/linkml/linkml/issues/1143 """ + env = env def make_schemas(self) -> None: @@ -76,32 +86,38 @@ def make_schemas(self) -> None: :return: """ s1 = make_schema( - 's1', - prefixes=[Prefix(prefix_prefix='sc1p1', prefix_reference='http://example.org/sc1url1')], - classes=[ClassDefinition(name='sc1c1', slots=['sc1s1']), - ClassDefinition(name='sc1c2', slots=['sc1s2'])], - slots=[SlotDefinition(name='sc1s1', range='string'), - SlotDefinition(name='sc1s2', range='float')], - enums=[EnumDefinition(name='sc1e1', - permissible_values={'sc1e1v1': 'sc1e1v1',} - )], - types=[TypeDefinition(name='sc1t1', base='string')], - subsets=[SubsetDefinition(name='sc1ss1', description='sc1ss1')], + "s1", + prefixes=[Prefix(prefix_prefix="sc1p1", prefix_reference="http://example.org/sc1url1")], + classes=[ClassDefinition(name="sc1c1", slots=["sc1s1"]), ClassDefinition(name="sc1c2", slots=["sc1s2"])], + slots=[SlotDefinition(name="sc1s1", range="string"), SlotDefinition(name="sc1s2", range="float")], + enums=[ + EnumDefinition( + name="sc1e1", + permissible_values={ + "sc1e1v1": "sc1e1v1", + }, + ) + ], + types=[TypeDefinition(name="sc1t1", base="string")], + subsets=[SubsetDefinition(name="sc1ss1", description="sc1ss1")], ) s2 = make_schema( - 's2', - prefixes=[Prefix(prefix_prefix='sc2p1', prefix_reference='http://example.org/sc2url1')], - classes=[ClassDefinition(name='sc2c1', slots=['sc2s1']), - ClassDefinition(name='sc2c2', slots=['sc2s2'])], - slots=[SlotDefinition(name='sc2s1', range='string'), - SlotDefinition(name='sc2s2', range='float')], - enums=[EnumDefinition(name='sc2e1', - permissible_values={'sc2e1v1': 'sc2e1v1',} - )], - types=[TypeDefinition(name='sc2t1', base='string')], - subsets=[SubsetDefinition(name='sc2ss1', description='sc2ss1')], + "s2", + prefixes=[Prefix(prefix_prefix="sc2p1", prefix_reference="http://example.org/sc2url1")], + classes=[ClassDefinition(name="sc2c1", slots=["sc2s1"]), ClassDefinition(name="sc2c2", slots=["sc2s2"])], + slots=[SlotDefinition(name="sc2s1", range="string"), SlotDefinition(name="sc2s2", range="float")], + enums=[ + EnumDefinition( + name="sc2e1", + permissible_values={ + "sc2e1v1": "sc2e1v1", + }, + ) + ], + types=[TypeDefinition(name="sc2t1", base="string")], + subsets=[SubsetDefinition(name="sc2ss1", description="sc2ss1")], ) - s3 = make_schema('s3') + s3 = make_schema("s3") self.sv1 = SchemaView(s1) self.sv2 = SchemaView(s2) self.sv3 = SchemaView(s3) @@ -117,8 +133,8 @@ def is_identical(self, sv1: SchemaView, sv2: SchemaView) -> None: s1 = sv1.schema s2 = sv2.schema for k in ELEMENTS: - self.assertCountEqual(getattr(s1, k).keys(), getattr(s2, k).keys(), f'{k} keys not equal') - self.assertCountEqual(getattr(s1, k).values(), getattr(s2, k).values(), f'{k} vals not equal') + self.assertCountEqual(getattr(s1, k).keys(), getattr(s2, k).keys(), f"{k} keys not equal") + self.assertCountEqual(getattr(s1, k).values(), getattr(s2, k).values(), f"{k} vals not equal") def test_merge_empty(self): """ @@ -145,12 +161,13 @@ def test_merge_schema(self): self.sv2.merge_schema(self.sv1.schema) for k, vs in EXPECTED.items(): - self.assertCountEqual(getattr(self.sv2.schema, k).keys(), vs, f'{k} keys not equal') + self.assertCountEqual(getattr(self.sv2.schema, k).keys(), vs, f"{k} keys not equal") + def _get_clobbered_field_val(self, element: str) -> tuple[str, str]: - if element == 'prefixes': - return 'prefix_reference', 'http://example.org/clobbered' + if element == "prefixes": + return "prefix_reference", "http://example.org/clobbered" else: - return 'description', 'clobbered' + return "description", "clobbered" def test_no_clobber(self): """ @@ -168,7 +185,7 @@ def test_no_clobber(self): (field, val) = self._get_clobbered_field_val(element) for k, v in getattr(self.sv2.schema, element).items(): if k in getattr(self.sv1.schema, element): - self.assertNotEqual(getattr(v, field), val, f'{element} {k} clobbered') + self.assertNotEqual(getattr(v, field), val, f"{element} {k} clobbered") def test_clobber(self): """ @@ -186,7 +203,7 @@ def test_clobber(self): (field, val) = self._get_clobbered_field_val(element) for k, v in getattr(self.sv2.schema, element).items(): if k in getattr(self.sv1.schema, element): - self.assertEqual(getattr(v, field), val, f'{element} {k} not clobbered') + self.assertEqual(getattr(v, field), val, f"{element} {k} not clobbered") if __name__ == "__main__": diff --git a/tests/test_issues/test_linkml_issue_478.py b/tests/test_issues/test_linkml_issue_478.py index 96a3ce6c..83573469 100644 --- a/tests/test_issues/test_linkml_issue_478.py +++ b/tests/test_issues/test_linkml_issue_478.py @@ -9,22 +9,21 @@ class Issue478TestCase(TestCase): """ https://github.com/linkml/linkml/issues/478 """ + env = env def test_issue_478(self): - view = SchemaView(env.input_path('linkml_issue_478.yaml')) + view = SchemaView(env.input_path("linkml_issue_478.yaml")) for c in view.all_classes(): - print(f'c={c}') + print(f"c={c}") cnames = list(view.class_name_mappings().keys()) snames = list(view.slot_name_mappings().keys()) print(cnames) print(snames) cnames.remove("5'Sequencing") ## TODO - self.assertCountEqual(['FooBar', 'NamedThing', 'BiosampleProcessing', 'TooMuchWhitespace'], cnames) + self.assertCountEqual(["FooBar", "NamedThing", "BiosampleProcessing", "TooMuchWhitespace"], cnames) snames.remove("5'_sequence") ## TODO - self.assertCountEqual(['id', 'preferred_label', 'SOURCE', 'processingMethod'], snames) - - + self.assertCountEqual(["id", "preferred_label", "SOURCE", "processingMethod"], snames) if __name__ == "__main__": diff --git a/tests/test_issues/test_linkml_issue_576.py b/tests/test_issues/test_linkml_issue_576.py index 019a3038..5adc3b9e 100644 --- a/tests/test_issues/test_linkml_issue_576.py +++ b/tests/test_issues/test_linkml_issue_576.py @@ -10,37 +10,50 @@ from tests.test_issues.environment import env from tests.test_issues.models.linkml_issue_576 import Dataset + class Issue576TestCase(TestCase): """ https://github.com/linkml/linkml/issues/576 """ + env = env def test_issue_no_namespace(self): - view = SchemaView(env.input_path('linkml_issue_576.yaml')) - inst = yaml_loader.load(env.input_path('linkml_issue_576_data.yaml'), target_class=Dataset) - s = rdflib_dumper.dumps(inst, view, 'turtle', prefix_map={"@base": "http://example.org/default/"}) + view = SchemaView(env.input_path("linkml_issue_576.yaml")) + inst = yaml_loader.load(env.input_path("linkml_issue_576_data.yaml"), target_class=Dataset) + s = rdflib_dumper.dumps(inst, view, "turtle", prefix_map={"@base": "http://example.org/default/"}) self.assertIn("@base .", s) - g = rdflib.Graph().parse(data=s, format='turtle') + g = rdflib.Graph().parse(data=s, format="turtle") for t in g.triples((None, None, None)): print(t) cases = [ - (None, - rdflib.term.URIRef('https://w3id.org/linkml/personinfo/source'), - rdflib.term.Literal('ex:source', - datatype=rdflib.term.URIRef('http://www.w3.org/2001/XMLSchema#anyURI'))), - (None, - rdflib.term.URIRef('https://w3id.org/linkml/personinfo/pets'), - rdflib.term.URIRef('https://example.org/PetA')), - (rdflib.term.URIRef('http://example.org/default/org%201'), - rdflib.term.URIRef('http://schema.org/name'), - rdflib.term.Literal('Acme Inc. (US)')), - (rdflib.term.URIRef('https://example.org/P1'), - rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), - rdflib.term.URIRef('http://schema.org/Person')), - (rdflib.term.URIRef('https://example.org/P1'), - rdflib.term.URIRef('http://schema.org/name'), - rdflib.term.Literal('John Doe')), + ( + None, + rdflib.term.URIRef("https://w3id.org/linkml/personinfo/source"), + rdflib.term.Literal( + "ex:source", datatype=rdflib.term.URIRef("http://www.w3.org/2001/XMLSchema#anyURI") + ), + ), + ( + None, + rdflib.term.URIRef("https://w3id.org/linkml/personinfo/pets"), + rdflib.term.URIRef("https://example.org/PetA"), + ), + ( + rdflib.term.URIRef("http://example.org/default/org%201"), + rdflib.term.URIRef("http://schema.org/name"), + rdflib.term.Literal("Acme Inc. (US)"), + ), + ( + rdflib.term.URIRef("https://example.org/P1"), + rdflib.term.URIRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), + rdflib.term.URIRef("http://schema.org/Person"), + ), + ( + rdflib.term.URIRef("https://example.org/P1"), + rdflib.term.URIRef("http://schema.org/name"), + rdflib.term.Literal("John Doe"), + ), ] for case in cases: s, p, o = case @@ -49,7 +62,7 @@ def test_issue_no_namespace(self): else: self.assertIn(case, g) inst2 = rdflib_loader.load(g, target_class=Dataset, schemaview=view) - #print(yaml_dumper.dumps(inst2)) + # print(yaml_dumper.dumps(inst2)) self.assertCountEqual(inst.persons, inst2.persons) self.assertCountEqual(inst.organizations, inst2.organizations) self.assertCountEqual(inst.pets, inst2.pets) diff --git a/tests/test_issues/test_linkml_issue_590.py b/tests/test_issues/test_linkml_issue_590.py index e2b92b37..330f9987 100644 --- a/tests/test_issues/test_linkml_issue_590.py +++ b/tests/test_issues/test_linkml_issue_590.py @@ -4,7 +4,7 @@ from tests.test_issues.environment import env -SCHEMA = env.input_path('test_linkml_issue_590.yaml') +SCHEMA = env.input_path("test_linkml_issue_590.yaml") class Issue590TestCase(unittest.TestCase): @@ -15,8 +15,8 @@ def test_issue_590(self): sv = SchemaView(SCHEMA) # check that multivalued is set to False as in schema - self.assertEqual(sv.get_slot('a').multivalued, False) + self.assertEqual(sv.get_slot("a").multivalued, False) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_issues/test_linkml_issue_817.py b/tests/test_issues/test_linkml_issue_817.py index 9cf0d1e1..8cb4f800 100644 --- a/tests/test_issues/test_linkml_issue_817.py +++ b/tests/test_issues/test_linkml_issue_817.py @@ -18,18 +18,18 @@ def _roundtrip(self, c: Container): self.assertCountEqual(c2.noidobj_as_list, c.noidobj_as_list) def test_issue_817(self): - person = Person(id='x', name='x', vital_status=VitalStatusEnum('LIVING')) - person2 = Person(id='y', name='y', vital_status=VitalStatusEnum('DEAD')) - thing = PersonNoId(name='z', vital_status=VitalStatusEnum('LIVING')) - c = Container(persons_as_list=[person, person2], - persons_as_dict={person.id: person, person2.id: person2}, - single_person_inlined=person, - noidobj_as_list=[thing], - single_noidobj_inlined=thing) + person = Person(id="x", name="x", vital_status=VitalStatusEnum("LIVING")) + person2 = Person(id="y", name="y", vital_status=VitalStatusEnum("DEAD")) + thing = PersonNoId(name="z", vital_status=VitalStatusEnum("LIVING")) + c = Container( + persons_as_list=[person, person2], + persons_as_dict={person.id: person, person2.id: person2}, + single_person_inlined=person, + noidobj_as_list=[thing], + single_noidobj_inlined=thing, + ) self._roundtrip(c) - - -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_issues/test_linkml_runtime_issue_1317.py b/tests/test_issues/test_linkml_runtime_issue_1317.py index 1ca6698e..fbfbad0b 100644 --- a/tests/test_issues/test_linkml_runtime_issue_1317.py +++ b/tests/test_issues/test_linkml_runtime_issue_1317.py @@ -1,11 +1,15 @@ import unittest from linkml_runtime import SchemaView -URL = ("https://raw.githubusercontent.com/linkml/linkml-runtime/" - "2a46c65fe2e7db08e5e524342e5ff2ffb94bec92/tests/test_utils/input/kitchen_sink.yaml") +URL = ( + "https://raw.githubusercontent.com/linkml/linkml-runtime/" + "2a46c65fe2e7db08e5e524342e5ff2ffb94bec92/tests/test_utils/input/kitchen_sink.yaml" +) -MIXS_URL = ("https://raw.githubusercontent.com/GenomicsStandardsConsortium/mixs/" - "83be82a99d0a210e83b371b20b3dadb6423ec612/model/schema/mixs.yaml") +MIXS_URL = ( + "https://raw.githubusercontent.com/GenomicsStandardsConsortium/mixs/" + "83be82a99d0a210e83b371b20b3dadb6423ec612/model/schema/mixs.yaml" +) class TestRemoteModularSchemaView(unittest.TestCase): @@ -51,4 +55,4 @@ def test_mixs(self): if __name__ == "__main__": - unittest.main() \ No newline at end of file + unittest.main() diff --git a/tests/test_issues/test_linkml_runtime_issue_68.py b/tests/test_issues/test_linkml_runtime_issue_68.py index 859bbb27..9933563c 100644 --- a/tests/test_issues/test_linkml_runtime_issue_68.py +++ b/tests/test_issues/test_linkml_runtime_issue_68.py @@ -76,52 +76,52 @@ class Issue68TestCase(TestCase): """ Note: linkml-runtime issue 68 was moved to https://github.com/linkml/linkml/issues/479 """ + def test_issue_68(self): view = SchemaView(schema_str) # test descripton for slot1 s1 = view.get_slot("slot1") assert s1.description == "non-induced slot1" - assert s1.range == 'class0' + assert s1.range == "class0" s2 = view.get_slot("slot2") assert not s2.required - assert s2.range == 'class0' + assert s2.range == "class0" s2_induced = view.induced_slot("slot2", "class1") assert s2_induced.required - assert s2_induced.range == 'class1' + assert s2_induced.range == "class1" # test description for slot2 # this behavior is expected see: https://github.com/linkml/linkml-runtime/issues/68 logger.info(f"s2_induced.description: {s2_induced.description}") assert s2_induced.description == "induced slot2" - s2_induced_c2 = view.induced_slot('slot2', 'class2') + s2_induced_c2 = view.induced_slot("slot2", "class2") assert s2_induced_c2.required logger.info(f"s2_induced_c2.description: {s2_induced_c2.description}") assert s2_induced_c2.description == "induced slot2" - assert s2_induced.range == 'class1' + assert s2_induced.range == "class1" - s3_induced_c2 = view.induced_slot('slot3', 'class2') + s3_induced_c2 = view.induced_slot("slot3", "class2") assert not s3_induced_c2.required assert s3_induced_c2.description == None - assert s3_induced_c2.range == 'class0' + assert s3_induced_c2.range == "class0" # mixins take priority over is-a # mixins specified in order of priority - s2_induced_c2_1a = view.induced_slot('slot2', 'class2_1a') + s2_induced_c2_1a = view.induced_slot("slot2", "class2_1a") assert not s2_induced_c2_1a.required logger.info(f"s2_induced_c2_1a.description: {s2_induced_c2_1a.description}") assert s2_induced_c2_1a.description == "mixin slot2" - assert s2_induced_c2_1a.range == 'mixin1a' + assert s2_induced_c2_1a.range == "mixin1a" - s2_induced_c2_1b = view.induced_slot('slot2', 'class2_1b') + s2_induced_c2_1b = view.induced_slot("slot2", "class2_1b") assert not s2_induced_c2_1b.required logger.info(f"s2_induced_c2_1a.description: {s2_induced_c2_1b.description}") assert s2_induced_c2_1b.description == "mixin slot2" - assert s2_induced_c2_1b.range == 'mixin1b' - + assert s2_induced_c2_1b.range == "mixin1b" if __name__ == "__main__": diff --git a/tests/test_linkml_model/test_linkml_files.py b/tests/test_linkml_model/test_linkml_files.py index 854c55e4..e4159f06 100644 --- a/tests/test_linkml_model/test_linkml_files.py +++ b/tests/test_linkml_model/test_linkml_files.py @@ -17,65 +17,58 @@ GITHUB_IO_PATH_FOR, GITHUB_PATH_FOR, META_ONLY, - ReleaseTag + ReleaseTag, ) EXPECTED_FORMATS = [ - (source, fmt) for source, fmt in product(Source, Format) - if (fmt not in META_ONLY or source == Source.META) + (source, fmt) for source, fmt in product(Source, Format) if (fmt not in META_ONLY or source == Source.META) ] W3ID_EXTENSIONS = ( - 'html', - 'yaml', - 'graphql', - 'context.json', - 'context.jsonld', - 'schema.json', - 'json', - 'ttl', - 'owl', - 'shex', - 'shexc', - 'shexj' + "html", + "yaml", + "graphql", + "context.json", + "context.jsonld", + "schema.json", + "json", + "ttl", + "owl", + "shex", + "shexc", + "shexj", ) -W3ID_FORMATS = [ - (source, fmt) for source, fmt in EXPECTED_FORMATS - if _Path.get(fmt.name).extension in W3ID_EXTENSIONS -] +W3ID_FORMATS = [(source, fmt) for source, fmt in EXPECTED_FORMATS if _Path.get(fmt.name).extension in W3ID_EXTENSIONS] """The formats that have rewrite rules at https://github.com/perma-id/w3id.org/blob/master/linkml/.htaccess""" -@pytest.mark.parametrize( - 'source,fmt', - EXPECTED_FORMATS -) + +@pytest.mark.parametrize("source,fmt", EXPECTED_FORMATS) def test_local_paths(source, fmt): a_path = Path(LOCAL_PATH_FOR(source, fmt)) assert a_path.exists() assert a_path.is_absolute() -@pytest.mark.parametrize( - 'fmt', - Format.__iter__() -) + +@pytest.mark.parametrize("fmt", Format.__iter__()) def test_format_paths(fmt): """Every format should have an entry in _Path""" assert fmt.name in _Path.items() + def test_no_unmapped_dirs(): """ There should be no additional directories that don't have a mapping for Format. """ - EXCLUDES = ('__pycache__',) + EXCLUDES = ("__pycache__",) expected = {LOCAL_BASE / _Path.get(fmt.name).path for fmt in Format} - expected.add(LOCAL_BASE / 'model') + expected.add(LOCAL_BASE / "model") actual = {a_dir for a_dir in LOCAL_BASE.iterdir() if a_dir.is_dir() and a_dir.name not in EXCLUDES} # Special case the root directory actual.add(LOCAL_BASE) # Special case YAML which is in a subdirectory - we've checked for existence above - actual.add(LOCAL_BASE / _Path.get('YAML').path) + actual.add(LOCAL_BASE / _Path.get("YAML").path) assert expected == actual @@ -83,30 +76,19 @@ def test_no_unmapped_dirs(): # URLs # -------------------------------------------------- + @pytest.mark.skip("github paths largely unused and expensive to test due to ratelimiting") -@pytest.mark.parametrize( - 'release_type', - ReleaseTag.__iter__() -) -@pytest.mark.parametrize( - 'source,fmt', - EXPECTED_FORMATS -) -def test_github_path_exists(source,fmt, release_type): +@pytest.mark.parametrize("release_type", ReleaseTag.__iter__()) +@pytest.mark.parametrize("source,fmt", EXPECTED_FORMATS) +def test_github_path_exists(source, fmt, release_type): url = GITHUB_PATH_FOR(source, fmt, release_type) res = requests.get(url) assert res.status_code != 404, url -@pytest.mark.parametrize( - 'release_type', - ReleaseTag.__iter__() -) -@pytest.mark.parametrize( - 'source,fmt', - EXPECTED_FORMATS -) -def test_github_path_format(source,fmt, release_type): +@pytest.mark.parametrize("release_type", ReleaseTag.__iter__()) +@pytest.mark.parametrize("source,fmt", EXPECTED_FORMATS) +def test_github_path_format(source, fmt, release_type): if release_type == ReleaseTag.CURRENT: pytest.skip("Need to cache network requests for this") @@ -114,39 +96,28 @@ def test_github_path_format(source,fmt, release_type): # ensure it parses assert urlparse(url) # for windows... - assert '\\' not in url + assert "\\" not in url + @pytest.mark.skip("github paths largely unused") -@pytest.mark.parametrize( - 'source,fmt', - EXPECTED_FORMATS -) -def test_github_io_path(source,fmt): +@pytest.mark.parametrize("source,fmt", EXPECTED_FORMATS) +def test_github_io_path(source, fmt): url = GITHUB_IO_PATH_FOR(source, fmt) res = requests.get(url) assert res.status_code != 404, url -@pytest.mark.skipif(not HAVE_REQUESTS_CACHE,reason= 'Need to cache this') -@pytest.mark.parametrize( - 'source,fmt', - W3ID_FORMATS -) -def test_url_for_format(source,fmt): +@pytest.mark.skipif(not HAVE_REQUESTS_CACHE, reason="Need to cache this") +@pytest.mark.parametrize("source,fmt", W3ID_FORMATS) +def test_url_for_format(source, fmt): url = URL_FOR(source, fmt) res = requests.get(url) assert res.status_code != 404, url + def test_fixed_meta_url(): """ One fixed canary value - the METAMODEL_URI as used in linkml main shouldn't change """ - assert URL_FOR(Source.META, Format.YAML) == 'https://w3id.org/linkml/meta.yaml' - assert URL_FOR(Source.META, Format.JSONLD) == 'https://w3id.org/linkml/meta.context.jsonld' - - - - - - - + assert URL_FOR(Source.META, Format.YAML) == "https://w3id.org/linkml/meta.yaml" + assert URL_FOR(Source.META, Format.JSONLD) == "https://w3id.org/linkml/meta.context.jsonld" diff --git a/tests/test_loaders_dumpers/__init__.py b/tests/test_loaders_dumpers/__init__.py index 1e7b480a..68b771be 100644 --- a/tests/test_loaders_dumpers/__init__.py +++ b/tests/test_loaders_dumpers/__init__.py @@ -7,17 +7,17 @@ HTTPS_TEST_PORT = 8443 TESTING_DIR = os.path.abspath(os.path.dirname(__file__)) -INPUT_DIR = os.path.join(TESTING_DIR, 'input') -OUTPUT_DIR = os.path.join(TESTING_DIR, 'output') +INPUT_DIR = os.path.join(TESTING_DIR, "input") +OUTPUT_DIR = os.path.join(TESTING_DIR, "output") -LD_10_DIR = os.path.join(TESTING_DIR, 'jsonld_context/jsonld_10/') -LD_11_DIR = os.path.join(TESTING_DIR, 'jsonld_context/jsonld_11/') +LD_10_DIR = os.path.join(TESTING_DIR, "jsonld_context/jsonld_10/") +LD_11_DIR = os.path.join(TESTING_DIR, "jsonld_context/jsonld_11/") -GITHUB_DIR = 'https://raw.githubusercontent.com/HOT-Ecosystem/TermCI-model/main/' +GITHUB_DIR = "https://raw.githubusercontent.com/HOT-Ecosystem/TermCI-model/main/" GITHUB_INPUT_DIR = GITHUB_DIR + Path(os.path.relpath(INPUT_DIR, os.path.dirname(TESTING_DIR))).as_posix() -GITHUB_LD10_CONTEXT = GITHUB_DIR + Path(os.path.relpath(LD_10_DIR, os.path.dirname(TESTING_DIR))).as_posix() + '/' -GITHUB_LD11_CONTEXT = GITHUB_DIR + Path(os.path.relpath(LD_11_DIR, os.path.dirname(TESTING_DIR))).as_posix() + '/' +GITHUB_LD10_CONTEXT = GITHUB_DIR + Path(os.path.relpath(LD_10_DIR, os.path.dirname(TESTING_DIR))).as_posix() + "/" +GITHUB_LD11_CONTEXT = GITHUB_DIR + Path(os.path.relpath(LD_11_DIR, os.path.dirname(TESTING_DIR))).as_posix() + "/" SCT = Namespace("http://snomed.info/id/") OBO = Namespace("http://purl.obolibrary.org/obo/") @@ -26,10 +26,9 @@ SHACL = Namespace("http://www.w3.org/ns/shacl#") CONTEXT_SVR = f"http://localhost:{HTTP_TEST_PORT}/" -CONTEXT_SSL_SVR = f'https://localhost:{HTTPS_TEST_PORT}/' - -LD_10_SVR = CONTEXT_SVR + 'jsonld_10/' -LD_11_SVR = CONTEXT_SVR + 'jsonld_11/' -LD_10_SSL_SVR = CONTEXT_SSL_SVR + 'jsonld_10/' -LD_11_SSL_SVR = CONTEXT_SSL_SVR + 'jsonld_11/' +CONTEXT_SSL_SVR = f"https://localhost:{HTTPS_TEST_PORT}/" +LD_10_SVR = CONTEXT_SVR + "jsonld_10/" +LD_11_SVR = CONTEXT_SVR + "jsonld_11/" +LD_10_SSL_SVR = CONTEXT_SSL_SVR + "jsonld_10/" +LD_11_SSL_SVR = CONTEXT_SSL_SVR + "jsonld_11/" diff --git a/tests/test_loaders_dumpers/loaderdumpertestcase.py b/tests/test_loaders_dumpers/loaderdumpertestcase.py index e545a8cd..4aa0f03a 100644 --- a/tests/test_loaders_dumpers/loaderdumpertestcase.py +++ b/tests/test_loaders_dumpers/loaderdumpertestcase.py @@ -15,8 +15,7 @@ class LoaderDumperTestCase(TestEnvironmentTestCase): env = TestEnvironment(__file__) - def dump_test(self, filename: str, dumper: Callable[[str], None], comparator: Callable[[str], str] = None)\ - -> bool: + def dump_test(self, filename: str, dumper: Callable[[str], None], comparator: Callable[[str], str] = None) -> bool: """ Invoke the dumper passing it the output file name and then compare the result to an expected output :param filename: non-pathed file name to dump to and test @@ -25,7 +24,7 @@ def dump_test(self, filename: str, dumper: Callable[[str], None], comparator: C :returns: Success indicator """ actual_file = self.env.actual_path(filename) - expected_file = self.env.expected_path('dump', filename) + expected_file = self.env.expected_path("dump", filename) dumper(actual_file) @@ -41,7 +40,7 @@ def dumps_test(self, filename: str, dumper: Callable[[], str], comparator: Calla :param comparator: content comparator """ actual = dumper() - expected_file = self.env.expected_path('dumps', filename) + expected_file = self.env.expected_path("dumps", filename) return self.env.eval_single_file(expected_file, actual, comparator=comparator) @@ -54,8 +53,8 @@ def loader_test(self, filename: str, model: Union[type[YAMLRoot], type[BaseModel :param loader: package that contains 'load' and 'loads' operations """ metadata = FileInfo() - name, typ = filename.rsplit('.', 1) - expected_yaml = self.env.expected_path('load', name + '_' + typ + ".yaml") + name, typ = filename.rsplit(".", 1) + expected_yaml = self.env.expected_path("load", name + "_" + typ + ".yaml") if issubclass(model, YAMLRoot): python_obj: YAMLRoot = loader.load(filename, model, metadata=metadata, base_dir=self.env.indir) elif issubclass(model, BaseModel): @@ -65,14 +64,14 @@ def loader_test(self, filename: str, model: Union[type[YAMLRoot], type[BaseModel self.env.eval_single_file(expected_yaml, yaml_dumper.dumps(python_obj)) # Make sure metadata gets filled out properly - rel_path = os.path.abspath(os.path.join(test_base.env.cwd, '..')) + rel_path = os.path.abspath(os.path.join(test_base.env.cwd, "..")) self.assertEqual( - os.path.normpath('tests/test_loaders_dumpers/input'), - os.path.normpath(os.path.relpath(metadata.base_path, rel_path)) + os.path.normpath("tests/test_loaders_dumpers/input"), + os.path.normpath(os.path.relpath(metadata.base_path, rel_path)), ) self.assertEqual( - os.path.normpath(f'tests/test_loaders_dumpers/input/{filename}'), - os.path.normpath(os.path.relpath(metadata.source_file, rel_path)) + os.path.normpath(f"tests/test_loaders_dumpers/input/{filename}"), + os.path.normpath(os.path.relpath(metadata.source_file, rel_path)), ) fileinfo = FileInfo() @@ -95,9 +94,11 @@ def check_context_servers(possible_server: list[str]) -> Optional[str]: :return: Particular server to use """ + def is_listening(svr: str) -> bool: components = urlparse(svr) import socket + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: return s.connect_ex((components.hostname, components.port)) == 0 diff --git a/tests/test_loaders_dumpers/models/books_normalized.py b/tests/test_loaders_dumpers/models/books_normalized.py index 5ef2eb8d..8be09a73 100644 --- a/tests/test_loaders_dumpers/models/books_normalized.py +++ b/tests/test_loaders_dumpers/models/books_normalized.py @@ -22,13 +22,14 @@ metamodel_version = "1.7.0" # Namespaces -EXAMPLE = CurieNamespace('example', 'https://w3id.org/example') -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') +EXAMPLE = CurieNamespace("example", "https://w3id.org/example") +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") DEFAULT_ = EXAMPLE # Types + # Class references class CreativeWorkId(extended_str): pass @@ -188,7 +189,9 @@ class Shop(YAMLRoot): class_name: ClassVar[str] = "shop" class_model_uri: ClassVar[URIRef] = EXAMPLE.Shop - all_book_series: Optional[Union[dict[Union[str, BookSeriesId], Union[dict, BookSeries]], list[Union[dict, BookSeries]]]] = empty_dict() + all_book_series: Optional[ + Union[dict[Union[str, BookSeriesId], Union[dict, BookSeries]], list[Union[dict, BookSeries]]] + ] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_list(slot_name="all_book_series", slot_type=BookSeries, key_name="id", keyed=True) @@ -255,51 +258,131 @@ class GenreEnum(EnumDefinitionImpl): name="GenreEnum", ) + # Slots class slots: pass -slots.id = Slot(uri=EXAMPLE.id, name="id", curie=EXAMPLE.curie('id'), - model_uri=EXAMPLE.id, domain=None, range=URIRef) - -slots.book_category = Slot(uri=EXAMPLE.book_category, name="book_category", curie=EXAMPLE.curie('book_category'), - model_uri=EXAMPLE.book_category, domain=None, range=Optional[Union[str, list[str]]]) - -slots.name = Slot(uri=EXAMPLE.name, name="name", curie=EXAMPLE.curie('name'), - model_uri=EXAMPLE.name, domain=None, range=Optional[str]) - -slots.price = Slot(uri=EXAMPLE.price, name="price", curie=EXAMPLE.curie('price'), - model_uri=EXAMPLE.price, domain=None, range=Optional[float]) - -slots.inStock = Slot(uri=EXAMPLE.inStock, name="inStock", curie=EXAMPLE.curie('inStock'), - model_uri=EXAMPLE.inStock, domain=None, range=Optional[str]) - -slots.creator = Slot(uri=EXAMPLE.creator, name="creator", curie=EXAMPLE.curie('creator'), - model_uri=EXAMPLE.creator, domain=None, range=Optional[Union[dict, Author]]) - -slots.genres = Slot(uri=EXAMPLE.genres, name="genres", curie=EXAMPLE.curie('genres'), - model_uri=EXAMPLE.genres, domain=None, range=Optional[Union[Union[str, "GenreEnum"], list[Union[str, "GenreEnum"]]]]) - -slots.from_country = Slot(uri=EXAMPLE.from_country, name="from_country", curie=EXAMPLE.curie('from_country'), - model_uri=EXAMPLE.from_country, domain=None, range=Optional[Union[str, CountryName]]) - -slots.books = Slot(uri=EXAMPLE.books, name="books", curie=EXAMPLE.curie('books'), - model_uri=EXAMPLE.books, domain=None, range=Optional[Union[dict[Union[str, BookId], Union[dict, Book]], list[Union[dict, Book]]]]) - -slots.all_book_series = Slot(uri=EXAMPLE.all_book_series, name="all_book_series", curie=EXAMPLE.curie('all_book_series'), - model_uri=EXAMPLE.all_book_series, domain=None, range=Optional[Union[dict[Union[str, BookSeriesId], Union[dict, BookSeries]], list[Union[dict, BookSeries]]]]) - -slots.summary = Slot(uri=EXAMPLE.summary, name="summary", curie=EXAMPLE.curie('summary'), - model_uri=EXAMPLE.summary, domain=None, range=Optional[str]) - -slots.reviews = Slot(uri=EXAMPLE.reviews, name="reviews", curie=EXAMPLE.curie('reviews'), - model_uri=EXAMPLE.reviews, domain=None, range=Optional[Union[Union[dict, Review], list[Union[dict, Review]]]]) - -slots.rating = Slot(uri=EXAMPLE.rating, name="rating", curie=EXAMPLE.curie('rating'), - model_uri=EXAMPLE.rating, domain=None, range=Optional[int]) - -slots.review_text = Slot(uri=EXAMPLE.review_text, name="review_text", curie=EXAMPLE.curie('review_text'), - model_uri=EXAMPLE.review_text, domain=None, range=Optional[str]) -slots.country_name = Slot(uri=EXAMPLE.name, name="country_name", curie=EXAMPLE.curie('name'), - model_uri=EXAMPLE.country_name, domain=Country, range=Union[str, CountryName]) +slots.id = Slot(uri=EXAMPLE.id, name="id", curie=EXAMPLE.curie("id"), model_uri=EXAMPLE.id, domain=None, range=URIRef) + +slots.book_category = Slot( + uri=EXAMPLE.book_category, + name="book_category", + curie=EXAMPLE.curie("book_category"), + model_uri=EXAMPLE.book_category, + domain=None, + range=Optional[Union[str, list[str]]], +) + +slots.name = Slot( + uri=EXAMPLE.name, name="name", curie=EXAMPLE.curie("name"), model_uri=EXAMPLE.name, domain=None, range=Optional[str] +) + +slots.price = Slot( + uri=EXAMPLE.price, + name="price", + curie=EXAMPLE.curie("price"), + model_uri=EXAMPLE.price, + domain=None, + range=Optional[float], +) + +slots.inStock = Slot( + uri=EXAMPLE.inStock, + name="inStock", + curie=EXAMPLE.curie("inStock"), + model_uri=EXAMPLE.inStock, + domain=None, + range=Optional[str], +) + +slots.creator = Slot( + uri=EXAMPLE.creator, + name="creator", + curie=EXAMPLE.curie("creator"), + model_uri=EXAMPLE.creator, + domain=None, + range=Optional[Union[dict, Author]], +) + +slots.genres = Slot( + uri=EXAMPLE.genres, + name="genres", + curie=EXAMPLE.curie("genres"), + model_uri=EXAMPLE.genres, + domain=None, + range=Optional[Union[Union[str, "GenreEnum"], list[Union[str, "GenreEnum"]]]], +) + +slots.from_country = Slot( + uri=EXAMPLE.from_country, + name="from_country", + curie=EXAMPLE.curie("from_country"), + model_uri=EXAMPLE.from_country, + domain=None, + range=Optional[Union[str, CountryName]], +) + +slots.books = Slot( + uri=EXAMPLE.books, + name="books", + curie=EXAMPLE.curie("books"), + model_uri=EXAMPLE.books, + domain=None, + range=Optional[Union[dict[Union[str, BookId], Union[dict, Book]], list[Union[dict, Book]]]], +) + +slots.all_book_series = Slot( + uri=EXAMPLE.all_book_series, + name="all_book_series", + curie=EXAMPLE.curie("all_book_series"), + model_uri=EXAMPLE.all_book_series, + domain=None, + range=Optional[Union[dict[Union[str, BookSeriesId], Union[dict, BookSeries]], list[Union[dict, BookSeries]]]], +) + +slots.summary = Slot( + uri=EXAMPLE.summary, + name="summary", + curie=EXAMPLE.curie("summary"), + model_uri=EXAMPLE.summary, + domain=None, + range=Optional[str], +) + +slots.reviews = Slot( + uri=EXAMPLE.reviews, + name="reviews", + curie=EXAMPLE.curie("reviews"), + model_uri=EXAMPLE.reviews, + domain=None, + range=Optional[Union[Union[dict, Review], list[Union[dict, Review]]]], +) + +slots.rating = Slot( + uri=EXAMPLE.rating, + name="rating", + curie=EXAMPLE.curie("rating"), + model_uri=EXAMPLE.rating, + domain=None, + range=Optional[int], +) + +slots.review_text = Slot( + uri=EXAMPLE.review_text, + name="review_text", + curie=EXAMPLE.curie("review_text"), + model_uri=EXAMPLE.review_text, + domain=None, + range=Optional[str], +) + +slots.country_name = Slot( + uri=EXAMPLE.name, + name="country_name", + curie=EXAMPLE.curie("name"), + model_uri=EXAMPLE.country_name, + domain=Country, + range=Union[str, CountryName], +) diff --git a/tests/test_loaders_dumpers/models/books_normalized_pydantic.py b/tests/test_loaders_dumpers/models/books_normalized_pydantic.py index 2200fb7a..04bc1687 100644 --- a/tests/test_loaders_dumpers/models/books_normalized_pydantic.py +++ b/tests/test_loaders_dumpers/models/books_normalized_pydantic.py @@ -6,43 +6,43 @@ metamodel_version = "None" version = "None" + class WeakRefShimBaseModel(BaseModel): - __slots__ = '__weakref__' + __slots__ = "__weakref__" + class ConfiguredBaseModel(WeakRefShimBaseModel): __signature__ = { "validate_assignment": True, "validate_all": True, "underscore_attrs_are_private": True, - "extra": 'forbid', + "extra": "forbid", "arbitrary_types_allowed": True, - "use_enum_values": True + "use_enum_values": True, } class GenreEnum(str, Enum): - + scifi = "scifi" fantasy = "fantasy" western = "western" romance = "romance" modern = "modern" - - + class CreativeWork(ConfiguredBaseModel): - + id: Optional[str] = Field(None) name: Optional[str] = Field(None) genres: Optional[list[GenreEnum]] = Field(default_factory=list) creator: Optional[Author] = Field(None) summary: Optional[str] = Field(None) reviews: Optional[list[Review]] = Field(default_factory=list) - class Book(CreativeWork): - + price: Optional[float] = Field(None) inStock: Optional[str] = Field(None) id: Optional[str] = Field(None) @@ -51,11 +51,10 @@ class Book(CreativeWork): creator: Optional[Author] = Field(None) summary: Optional[str] = Field(None) reviews: Optional[list[Review]] = Field(default_factory=list) - class BookSeries(CreativeWork): - + books: Optional[list[Book]] = Field(default_factory=list) genres: Optional[list[GenreEnum]] = Field(default_factory=list) price: Optional[float] = Field(None) @@ -64,36 +63,30 @@ class BookSeries(CreativeWork): creator: Optional[Author] = Field(None) summary: Optional[str] = Field(None) reviews: Optional[list[Review]] = Field(default_factory=list) - class Author(ConfiguredBaseModel): - + name: Optional[str] = Field(None) genres: Optional[list[GenreEnum]] = Field(default_factory=list) from_country: Optional[str] = Field(None) - class Shop(ConfiguredBaseModel): - + all_book_series: Optional[list[BookSeries]] = Field(default_factory=list) - class Country(ConfiguredBaseModel): - + name: Optional[str] = Field(None) - class Review(ConfiguredBaseModel): - + creator: Optional[Author] = Field(None) rating: Optional[int] = Field(None) review_text: Optional[str] = Field(None) - - # Update forward refs @@ -105,4 +98,3 @@ class Review(ConfiguredBaseModel): Shop.update_forward_refs() Country.update_forward_refs() Review.update_forward_refs() - diff --git a/tests/test_loaders_dumpers/models/enum_model.py b/tests/test_loaders_dumpers/models/enum_model.py index 29268796..8a809305 100644 --- a/tests/test_loaders_dumpers/models/enum_model.py +++ b/tests/test_loaders_dumpers/models/enum_model.py @@ -21,7 +21,7 @@ metamodel_version = "1.7.0" # Namespaces -DEFAULT_ = CurieNamespace('', 'https://example.org/enum_test/') +DEFAULT_ = CurieNamespace("", "https://example.org/enum_test/") # Types @@ -29,7 +29,6 @@ # Class references - @dataclass class Organism(YAMLRoot): _inherited_slots: ClassVar[list[str]] = [] @@ -58,9 +57,17 @@ class StateEnum(EnumDefinitionImpl): name="StateEnum", ) + # Slots class slots: pass -slots.state = Slot(uri=DEFAULT_.state, name="state", curie=DEFAULT_.curie('state'), - model_uri=DEFAULT_.state, domain=None, range=Optional[Union[str, "StateEnum"]]) + +slots.state = Slot( + uri=DEFAULT_.state, + name="state", + curie=DEFAULT_.curie("state"), + model_uri=DEFAULT_.state, + domain=None, + range=Optional[Union[str, "StateEnum"]], +) diff --git a/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py b/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py index bc99155d..ee4e4247 100644 --- a/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py +++ b/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py @@ -7,73 +7,69 @@ metamodel_version = "None" version = "None" + class WeakRefShimBaseModel(BaseModel): - __slots__ = '__weakref__' + __slots__ = "__weakref__" + class ConfiguredBaseModel(WeakRefShimBaseModel): __signature__ = { "validate_assignment": True, "validate_all": True, "underscore_attrs_are_private": True, - "extra": 'forbid', + "extra": "forbid", "arbitrary_types_allowed": True, - "use_enum_values": True + "use_enum_values": True, } class FamilialRelationshipType(str, Enum): - + SIBLING_OF = "SIBLING_OF" PARENT_OF = "PARENT_OF" CHILD_OF = "CHILD_OF" - - + class DiagnosisType(str, Enum): - + TODO = "TODO" - - + class EmploymentEventType(str, Enum): - + HIRE = "HIRE" FIRE = "FIRE" PROMOTION = "PROMOTION" TRANSFER = "TRANSFER" - - + class OtherCodes(str, Enum): - + a_b = "a b" - - + class LifeStatusEnum(str, Enum): - + LIVING = "LIVING" DEAD = "DEAD" UNKNOWN = "UNKNOWN" - - + class HasAliases(ConfiguredBaseModel): - + aliases: Optional[list[str]] = Field(default_factory=list) - class Friend(ConfiguredBaseModel): - + name: Optional[str] = Field(None) - class Person(HasAliases): """ A person, living or dead """ + id: Optional[str] = Field(None) name: Optional[str] = Field(None) has_employment_history: Optional[list[EmploymentEvent]] = Field(None) @@ -86,117 +82,106 @@ class Person(HasAliases): stomach_count: Optional[int] = Field(None) is_living: Optional[LifeStatusEnum] = Field(None) aliases: Optional[list[str]] = Field(default_factory=list) - class Organization(HasAliases): """ - An organization. + An organization. -This description -includes newlines + This description + includes newlines -## Markdown headers + ## Markdown headers - * and - * a - * list + * and + * a + * list """ + id: Optional[str] = Field(None) name: Optional[str] = Field(None) aliases: Optional[list[str]] = Field(default_factory=list) - class Place(HasAliases): - + id: Optional[str] = Field(None) name: Optional[str] = Field(None) aliases: Optional[list[str]] = Field(default_factory=list) - class Address(ConfiguredBaseModel): - + street: Optional[str] = Field(None) city: Optional[str] = Field(None) - class Concept(ConfiguredBaseModel): - + id: Optional[str] = Field(None) name: Optional[str] = Field(None) in_code_system: Optional[str] = Field(None) - class DiagnosisConcept(Concept): - + id: Optional[str] = Field(None) name: Optional[str] = Field(None) in_code_system: Optional[str] = Field(None) - class ProcedureConcept(Concept): - + id: Optional[str] = Field(None) name: Optional[str] = Field(None) in_code_system: Optional[str] = Field(None) - class Event(ConfiguredBaseModel): - + started_at_time: Optional[date] = Field(None) ended_at_time: Optional[date] = Field(None) is_current: Optional[bool] = Field(None) metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") - class Relationship(ConfiguredBaseModel): - + started_at_time: Optional[date] = Field(None) ended_at_time: Optional[date] = Field(None) related_to: Optional[str] = Field(None) type: Optional[str] = Field(None) - class FamilialRelationship(Relationship): - + started_at_time: Optional[date] = Field(None) ended_at_time: Optional[date] = Field(None) related_to: str = Field(...) type: FamilialRelationshipType = Field(...) - class BirthEvent(Event): - + in_location: Optional[str] = Field(None) started_at_time: Optional[date] = Field(None) ended_at_time: Optional[date] = Field(None) is_current: Optional[bool] = Field(None) metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") - class EmploymentEvent(Event): - + employed_at: Optional[str] = Field(None) type: Optional[EmploymentEventType] = Field(None) started_at_time: Optional[date] = Field(None) ended_at_time: Optional[date] = Field(None) is_current: Optional[bool] = Field(None) metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") - class MedicalEvent(Event): - + in_location: Optional[str] = Field(None) diagnosis: Optional[DiagnosisConcept] = Field(None) procedure: Optional[ProcedureConcept] = Field(None) @@ -204,91 +189,82 @@ class MedicalEvent(Event): ended_at_time: Optional[date] = Field(None) is_current: Optional[bool] = Field(None) metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") - class WithLocation(ConfiguredBaseModel): - + in_location: Optional[str] = Field(None) - class MarriageEvent(WithLocation, Event): - + married_to: Optional[str] = Field(None) in_location: Optional[str] = Field(None) started_at_time: Optional[date] = Field(None) ended_at_time: Optional[date] = Field(None) is_current: Optional[bool] = Field(None) metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") - class Company(Organization): - + ceo: Optional[str] = Field(None) id: Optional[str] = Field(None) name: Optional[str] = Field(None) aliases: Optional[list[str]] = Field(default_factory=list) - class CodeSystem(ConfiguredBaseModel): - + id: Optional[str] = Field(None) name: Optional[str] = Field(None) - class Dataset(ConfiguredBaseModel): - + metadata: Optional[Any] = Field(None, description="""Example of a slot that has an unconstrained range""") persons: Optional[list[Person]] = Field(default_factory=list) companies: Optional[list[Company]] = Field(default_factory=list) activities: Optional[list[Activity]] = Field(default_factory=list) code_systems: Optional[dict[str, CodeSystem]] = Field(None) - class FakeClass(ConfiguredBaseModel): - + test_attribute: Optional[str] = Field(None) - class ClassWithSpaces(ConfiguredBaseModel): - + slot_with_space_1: Optional[str] = Field(None) - class SubclassTest(ClassWithSpaces): - + slot_with_space_2: Optional[ClassWithSpaces] = Field(None) slot_with_space_1: Optional[str] = Field(None) - class SubSubClass2(SubclassTest): - + slot_with_space_2: Optional[ClassWithSpaces] = Field(None) slot_with_space_1: Optional[str] = Field(None) - class TubSubClass1(SubclassTest): """ Same depth as Sub sub class 1 """ + slot_with_space_2: Optional[ClassWithSpaces] = Field(None) slot_with_space_1: Optional[str] = Field(None) - class Activity(ConfiguredBaseModel): """ a provence-generating activity """ + id: Optional[str] = Field(None) started_at_time: Optional[date] = Field(None) ended_at_time: Optional[date] = Field(None) @@ -296,18 +272,16 @@ class Activity(ConfiguredBaseModel): was_associated_with: Optional[str] = Field(None) used: Optional[str] = Field(None) description: Optional[str] = Field(None) - class Agent(ConfiguredBaseModel): """ a provence-generating agent """ + id: Optional[str] = Field(None) acted_on_behalf_of: Optional[str] = Field(None) was_informed_by: Optional[str] = Field(None) - - # Update forward refs @@ -339,4 +313,3 @@ class Agent(ConfiguredBaseModel): TubSubClass1.update_forward_refs() Activity.update_forward_refs() Agent.update_forward_refs() - diff --git a/tests/test_loaders_dumpers/models/node_object.py b/tests/test_loaders_dumpers/models/node_object.py index 8fbfe102..d7683432 100644 --- a/tests/test_loaders_dumpers/models/node_object.py +++ b/tests/test_loaders_dumpers/models/node_object.py @@ -20,16 +20,17 @@ metamodel_version = "1.7.0" # Namespaces -EX = CurieNamespace('ex', 'https://w3id.org/example/') -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -RDF = CurieNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#') -SH = CurieNamespace('sh', 'http://www.w3.org/ns/shacl#') -SPARQLFUN = CurieNamespace('sparqlfun', 'https://w3id.org/sparqlfun/') +EX = CurieNamespace("ex", "https://w3id.org/example/") +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +RDF = CurieNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") +SH = CurieNamespace("sh", "http://www.w3.org/ns/shacl#") +SPARQLFUN = CurieNamespace("sparqlfun", "https://w3id.org/sparqlfun/") DEFAULT_ = EX # Types + # Class references class NodeId(extended_str): pass @@ -44,6 +45,7 @@ class Triple(YAMLRoot): """ Represents an RDF triple """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = RDF.Statement @@ -120,23 +122,49 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): class slots: pass -slots.id = Slot(uri=EX.id, name="id", curie=EX.curie('id'), - model_uri=EX.id, domain=None, range=URIRef) - -slots.subject = Slot(uri=RDF.subject, name="subject", curie=RDF.curie('subject'), - model_uri=EX.subject, domain=None, range=Optional[Union[str, NodeId]]) - -slots.predicate = Slot(uri=RDF.predicate, name="predicate", curie=RDF.curie('predicate'), - model_uri=EX.predicate, domain=None, range=Optional[Union[str, NodeId]]) - -slots.object = Slot(uri=RDF.object, name="object", curie=RDF.curie('object'), - model_uri=EX.object, domain=None, range=Optional[str]) - -slots.graph = Slot(uri=EX.graph, name="graph", curie=EX.curie('graph'), - model_uri=EX.graph, domain=None, range=Optional[Union[str, NodeId]]) - -slots.statements = Slot(uri=SPARQLFUN.statements, name="statements", curie=SPARQLFUN.curie('statements'), - model_uri=EX.statements, domain=None, range=Optional[Union[Union[dict, Triple], list[Union[dict, Triple]]]]) -slots.type = Slot(uri=EX.type, name="type", curie=EX.curie('type'), - model_uri=EX.type, domain=None, range=Optional[Union[str, NodeId]]) +slots.id = Slot(uri=EX.id, name="id", curie=EX.curie("id"), model_uri=EX.id, domain=None, range=URIRef) + +slots.subject = Slot( + uri=RDF.subject, + name="subject", + curie=RDF.curie("subject"), + model_uri=EX.subject, + domain=None, + range=Optional[Union[str, NodeId]], +) + +slots.predicate = Slot( + uri=RDF.predicate, + name="predicate", + curie=RDF.curie("predicate"), + model_uri=EX.predicate, + domain=None, + range=Optional[Union[str, NodeId]], +) + +slots.object = Slot( + uri=RDF.object, name="object", curie=RDF.curie("object"), model_uri=EX.object, domain=None, range=Optional[str] +) + +slots.graph = Slot( + uri=EX.graph, + name="graph", + curie=EX.curie("graph"), + model_uri=EX.graph, + domain=None, + range=Optional[Union[str, NodeId]], +) + +slots.statements = Slot( + uri=SPARQLFUN.statements, + name="statements", + curie=SPARQLFUN.curie("statements"), + model_uri=EX.statements, + domain=None, + range=Optional[Union[Union[dict, Triple], list[Union[dict, Triple]]]], +) + +slots.type = Slot( + uri=EX.type, name="type", curie=EX.curie("type"), model_uri=EX.type, domain=None, range=Optional[Union[str, NodeId]] +) diff --git a/tests/test_loaders_dumpers/models/personinfo.py b/tests/test_loaders_dumpers/models/personinfo.py index 8b28bc49..3cc754d0 100644 --- a/tests/test_loaders_dumpers/models/personinfo.py +++ b/tests/test_loaders_dumpers/models/personinfo.py @@ -26,24 +26,25 @@ version = None # Namespaces -GSSO = CurieNamespace('GSSO', 'http://purl.obolibrary.org/obo/GSSO_') -HP = CurieNamespace('HP', 'http://purl.obolibrary.org/obo/HP_') -BIZCODES = CurieNamespace('bizcodes', 'https://example.org/bizcodes/') -FAMREL = CurieNamespace('famrel', 'https://example.org/FamilialRelations#') -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -PERSONINFO = CurieNamespace('personinfo', 'https://w3id.org/linkml/examples/personinfo/') -PROV = CurieNamespace('prov', 'http://www.w3.org/ns/prov#') -RDF = CurieNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#') -RDFS = CurieNamespace('rdfs', 'http://www.w3.org/2000/01/rdf-schema#') -SCHEMA = CurieNamespace('schema', 'http://schema.org/') -SKOS = CurieNamespace('skos', 'http://www.w3.org/2004/02/skos/core#') -XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') +GSSO = CurieNamespace("GSSO", "http://purl.obolibrary.org/obo/GSSO_") +HP = CurieNamespace("HP", "http://purl.obolibrary.org/obo/HP_") +BIZCODES = CurieNamespace("bizcodes", "https://example.org/bizcodes/") +FAMREL = CurieNamespace("famrel", "https://example.org/FamilialRelations#") +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +PERSONINFO = CurieNamespace("personinfo", "https://w3id.org/linkml/examples/personinfo/") +PROV = CurieNamespace("prov", "http://www.w3.org/ns/prov#") +RDF = CurieNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") +RDFS = CurieNamespace("rdfs", "http://www.w3.org/2000/01/rdf-schema#") +SCHEMA = CurieNamespace("schema", "http://schema.org/") +SKOS = CurieNamespace("skos", "http://www.w3.org/2004/02/skos/core#") +XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") DEFAULT_ = PERSONINFO # Types class CrossReference(Uriorcurie): - """ A string URI or CURIE representation of an external identifier, modeled as a Resource in RDF """ + """A string URI or CURIE representation of an external identifier, modeled as a Resource in RDF""" + type_class_uri = RDFS.Resource type_class_curie = "rdfs:Resource" type_name = "CrossReference" @@ -110,6 +111,7 @@ class NamedThing(YAMLRoot): """ A generic grouping for any identifiable entity """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.NamedThing @@ -149,6 +151,7 @@ class Person(NamedThing): """ A person (alive, dead, undead, or fictional). """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCHEMA.Person @@ -162,9 +165,15 @@ class Person(NamedThing): age_in_years: Optional[int] = None gender: Optional[Union[str, "GenderType"]] = None current_address: Optional[Union[dict, "Address"]] = None - has_employment_history: Optional[Union[Union[dict, "EmploymentEvent"], list[Union[dict, "EmploymentEvent"]]]] = empty_list() - has_familial_relationships: Optional[Union[Union[dict, "FamilialRelationship"], list[Union[dict, "FamilialRelationship"]]]] = empty_list() - has_interpersonal_relationships: Optional[Union[Union[dict, "InterPersonalRelationship"], list[Union[dict, "InterPersonalRelationship"]]]] = empty_list() + has_employment_history: Optional[Union[Union[dict, "EmploymentEvent"], list[Union[dict, "EmploymentEvent"]]]] = ( + empty_list() + ) + has_familial_relationships: Optional[ + Union[Union[dict, "FamilialRelationship"], list[Union[dict, "FamilialRelationship"]]] + ] = empty_list() + has_interpersonal_relationships: Optional[ + Union[Union[dict, "InterPersonalRelationship"], list[Union[dict, "InterPersonalRelationship"]]] + ] = empty_list() has_medical_history: Optional[Union[Union[dict, "MedicalEvent"], list[Union[dict, "MedicalEvent"]]]] = empty_list() aliases: Optional[Union[str, list[str]]] = empty_list() @@ -190,20 +199,36 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.current_address = Address(**as_dict(self.current_address)) if not isinstance(self.has_employment_history, list): - self.has_employment_history = [self.has_employment_history] if self.has_employment_history is not None else [] - self.has_employment_history = [v if isinstance(v, EmploymentEvent) else EmploymentEvent(**as_dict(v)) for v in self.has_employment_history] + self.has_employment_history = ( + [self.has_employment_history] if self.has_employment_history is not None else [] + ) + self.has_employment_history = [ + v if isinstance(v, EmploymentEvent) else EmploymentEvent(**as_dict(v)) for v in self.has_employment_history + ] if not isinstance(self.has_familial_relationships, list): - self.has_familial_relationships = [self.has_familial_relationships] if self.has_familial_relationships is not None else [] - self.has_familial_relationships = [v if isinstance(v, FamilialRelationship) else FamilialRelationship(**as_dict(v)) for v in self.has_familial_relationships] + self.has_familial_relationships = ( + [self.has_familial_relationships] if self.has_familial_relationships is not None else [] + ) + self.has_familial_relationships = [ + v if isinstance(v, FamilialRelationship) else FamilialRelationship(**as_dict(v)) + for v in self.has_familial_relationships + ] if not isinstance(self.has_interpersonal_relationships, list): - self.has_interpersonal_relationships = [self.has_interpersonal_relationships] if self.has_interpersonal_relationships is not None else [] - self.has_interpersonal_relationships = [v if isinstance(v, InterPersonalRelationship) else InterPersonalRelationship(**as_dict(v)) for v in self.has_interpersonal_relationships] + self.has_interpersonal_relationships = ( + [self.has_interpersonal_relationships] if self.has_interpersonal_relationships is not None else [] + ) + self.has_interpersonal_relationships = [ + v if isinstance(v, InterPersonalRelationship) else InterPersonalRelationship(**as_dict(v)) + for v in self.has_interpersonal_relationships + ] if not isinstance(self.has_medical_history, list): self.has_medical_history = [self.has_medical_history] if self.has_medical_history is not None else [] - self.has_medical_history = [v if isinstance(v, MedicalEvent) else MedicalEvent(**as_dict(v)) for v in self.has_medical_history] + self.has_medical_history = [ + v if isinstance(v, MedicalEvent) else MedicalEvent(**as_dict(v)) for v in self.has_medical_history + ] if not isinstance(self.aliases, list): self.aliases = [self.aliases] if self.aliases is not None else [] @@ -217,6 +242,7 @@ class HasAliases(YAMLRoot): """ A mixin applied to any class that can have aliases/alternateNames """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PERSONINFO.HasAliases @@ -239,6 +265,7 @@ class Organization(NamedThing): """ An organization such as a company or university """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SCHEMA.Organization @@ -671,7 +698,9 @@ class Container(YAMLRoot): class_model_uri: ClassVar[URIRef] = PERSONINFO.Container persons: Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]] = empty_dict() - organizations: Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]] = empty_dict() + organizations: Optional[ + Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]] + ] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self._normalize_inlined_as_list(slot_name="persons", slot_type=Person, key_name="id", keyed=True) @@ -684,28 +713,25 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): # Enumerations class FamilialRelationshipType(EnumDefinitionImpl): - SIBLING_OF = PermissibleValue(text="SIBLING_OF", - meaning=FAMREL["01"]) - PARENT_OF = PermissibleValue(text="PARENT_OF", - meaning=FAMREL["02"]) - CHILD_OF = PermissibleValue(text="CHILD_OF", - meaning=FAMREL["01"]) + SIBLING_OF = PermissibleValue(text="SIBLING_OF", meaning=FAMREL["01"]) + PARENT_OF = PermissibleValue(text="PARENT_OF", meaning=FAMREL["02"]) + CHILD_OF = PermissibleValue(text="CHILD_OF", meaning=FAMREL["01"]) _defn = EnumDefinition( name="FamilialRelationshipType", ) + class NonFamilialRelationshipType(EnumDefinitionImpl): - COWORKER_OF = PermissibleValue(text="COWORKER_OF", - meaning=FAMREL["70"]) - ROOMMATE_OF = PermissibleValue(text="ROOMMATE_OF", - meaning=FAMREL["70"]) + COWORKER_OF = PermissibleValue(text="COWORKER_OF", meaning=FAMREL["70"]) + ROOMMATE_OF = PermissibleValue(text="ROOMMATE_OF", meaning=FAMREL["70"]) _defn = EnumDefinition( name="NonFamilialRelationshipType", ) + class GenderType(EnumDefinitionImpl): _defn = EnumDefinition( @@ -714,24 +740,13 @@ class GenderType(EnumDefinitionImpl): @classmethod def _addvals(cls): - setattr(cls, "nonbinary man", - PermissibleValue(text="nonbinary man", - meaning=GSSO["009254"]) ) - setattr(cls, "nonbinary woman", - PermissibleValue(text="nonbinary woman", - meaning=GSSO["009253"]) ) - setattr(cls, "transgender woman", - PermissibleValue(text="transgender woman", - meaning=GSSO["000384"]) ) - setattr(cls, "transgender man", - PermissibleValue(text="transgender man", - meaning=GSSO["000372"]) ) - setattr(cls, "cisgender man", - PermissibleValue(text="cisgender man", - meaning=GSSO["000371"]) ) - setattr(cls, "cisgender woman", - PermissibleValue(text="cisgender woman", - meaning=GSSO["000385"]) ) + setattr(cls, "nonbinary man", PermissibleValue(text="nonbinary man", meaning=GSSO["009254"])) + setattr(cls, "nonbinary woman", PermissibleValue(text="nonbinary woman", meaning=GSSO["009253"])) + setattr(cls, "transgender woman", PermissibleValue(text="transgender woman", meaning=GSSO["000384"])) + setattr(cls, "transgender man", PermissibleValue(text="transgender man", meaning=GSSO["000372"])) + setattr(cls, "cisgender man", PermissibleValue(text="cisgender man", meaning=GSSO["000371"])) + setattr(cls, "cisgender woman", PermissibleValue(text="cisgender woman", meaning=GSSO["000385"])) + class DiagnosisType(EnumDefinitionImpl): @@ -741,11 +756,11 @@ class DiagnosisType(EnumDefinitionImpl): name="DiagnosisType", ) + class OrganizationType(EnumDefinitionImpl): offshore = PermissibleValue(text="offshore") - charity = PermissibleValue(text="charity", - meaning=BIZCODES["001"]) + charity = PermissibleValue(text="charity", meaning=BIZCODES["001"]) _defn = EnumDefinition( name="OrganizationType", @@ -753,157 +768,437 @@ class OrganizationType(EnumDefinitionImpl): @classmethod def _addvals(cls): - setattr(cls, "non profit", - PermissibleValue(text="non profit") ) - setattr(cls, "for profit", - PermissibleValue(text="for profit") ) - setattr(cls, "shell company", - PermissibleValue(text="shell company") ) - setattr(cls, "loose organization", - PermissibleValue(text="loose organization") ) + setattr(cls, "non profit", PermissibleValue(text="non profit")) + setattr(cls, "for profit", PermissibleValue(text="for profit")) + setattr(cls, "shell company", PermissibleValue(text="shell company")) + setattr(cls, "loose organization", PermissibleValue(text="loose organization")) + # Slots class slots: pass -slots.id = Slot(uri=SCHEMA.identifier, name="id", curie=SCHEMA.curie('identifier'), - model_uri=PERSONINFO.id, domain=None, range=URIRef) - -slots.name = Slot(uri=SCHEMA.name, name="name", curie=SCHEMA.curie('name'), - model_uri=PERSONINFO.name, domain=None, range=Optional[str]) - -slots.description = Slot(uri=SCHEMA.description, name="description", curie=SCHEMA.curie('description'), - model_uri=PERSONINFO.description, domain=None, range=Optional[str]) - -slots.image = Slot(uri=SCHEMA.image, name="image", curie=SCHEMA.curie('image'), - model_uri=PERSONINFO.image, domain=None, range=Optional[str]) - -slots.gender = Slot(uri=SCHEMA.gender, name="gender", curie=SCHEMA.curie('gender'), - model_uri=PERSONINFO.gender, domain=None, range=Optional[Union[str, "GenderType"]]) - -slots.primary_email = Slot(uri=SCHEMA.email, name="primary_email", curie=SCHEMA.curie('email'), - model_uri=PERSONINFO.primary_email, domain=None, range=Optional[str]) - -slots.birth_date = Slot(uri=SCHEMA.birthDate, name="birth_date", curie=SCHEMA.curie('birthDate'), - model_uri=PERSONINFO.birth_date, domain=None, range=Optional[str]) - -slots.employed_at = Slot(uri=PERSONINFO.employed_at, name="employed_at", curie=PERSONINFO.curie('employed_at'), - model_uri=PERSONINFO.employed_at, domain=None, range=Optional[Union[str, OrganizationId]]) - -slots.is_current = Slot(uri=PERSONINFO.is_current, name="is_current", curie=PERSONINFO.curie('is_current'), - model_uri=PERSONINFO.is_current, domain=None, range=Optional[Union[bool, Bool]]) - -slots.has_employment_history = Slot(uri=PERSONINFO.has_employment_history, name="has_employment_history", curie=PERSONINFO.curie('has_employment_history'), - model_uri=PERSONINFO.has_employment_history, domain=None, range=Optional[Union[Union[dict, EmploymentEvent], list[Union[dict, EmploymentEvent]]]]) - -slots.has_medical_history = Slot(uri=PERSONINFO.has_medical_history, name="has_medical_history", curie=PERSONINFO.curie('has_medical_history'), - model_uri=PERSONINFO.has_medical_history, domain=None, range=Optional[Union[Union[dict, MedicalEvent], list[Union[dict, MedicalEvent]]]]) - -slots.has_familial_relationships = Slot(uri=PERSONINFO.has_familial_relationships, name="has_familial_relationships", curie=PERSONINFO.curie('has_familial_relationships'), - model_uri=PERSONINFO.has_familial_relationships, domain=None, range=Optional[Union[Union[dict, FamilialRelationship], list[Union[dict, FamilialRelationship]]]]) - -slots.has_interpersonal_relationships = Slot(uri=PERSONINFO.has_interpersonal_relationships, name="has_interpersonal_relationships", curie=PERSONINFO.curie('has_interpersonal_relationships'), - model_uri=PERSONINFO.has_interpersonal_relationships, domain=None, range=Optional[Union[Union[dict, InterPersonalRelationship], list[Union[dict, InterPersonalRelationship]]]]) - -slots.in_location = Slot(uri=PERSONINFO.in_location, name="in location", curie=PERSONINFO.curie('in_location'), - model_uri=PERSONINFO.in_location, domain=None, range=Optional[Union[str, PlaceId]]) - -slots.current_address = Slot(uri=PERSONINFO.current_address, name="current_address", curie=PERSONINFO.curie('current_address'), - model_uri=PERSONINFO.current_address, domain=None, range=Optional[Union[dict, Address]]) - -slots.age_in_years = Slot(uri=PERSONINFO.age_in_years, name="age_in_years", curie=PERSONINFO.curie('age_in_years'), - model_uri=PERSONINFO.age_in_years, domain=None, range=Optional[int]) - -slots.score = Slot(uri=PERSONINFO.score, name="score", curie=PERSONINFO.curie('score'), - model_uri=PERSONINFO.score, domain=None, range=Optional[Decimal]) - -slots.related_to = Slot(uri=PERSONINFO.related_to, name="related_to", curie=PERSONINFO.curie('related_to'), - model_uri=PERSONINFO.related_to, domain=None, range=Optional[Union[str, NamedThingId]]) - -slots.depicted_by = Slot(uri=PERSONINFO.depicted_by, name="depicted_by", curie=PERSONINFO.curie('depicted_by'), - model_uri=PERSONINFO.depicted_by, domain=None, range=Optional[Union[str, ImageURL]]) - -slots.type = Slot(uri=PERSONINFO.type, name="type", curie=PERSONINFO.curie('type'), - model_uri=PERSONINFO.type, domain=None, range=Optional[str]) - -slots.subtype = Slot(uri=PERSONINFO.subtype, name="subtype", curie=PERSONINFO.curie('subtype'), - model_uri=PERSONINFO.subtype, domain=None, range=Optional[Union[str, ConceptId]]) - -slots.street = Slot(uri=PERSONINFO.street, name="street", curie=PERSONINFO.curie('street'), - model_uri=PERSONINFO.street, domain=None, range=Optional[str]) - -slots.city = Slot(uri=PERSONINFO.city, name="city", curie=PERSONINFO.curie('city'), - model_uri=PERSONINFO.city, domain=None, range=Optional[str]) - -slots.mission_statement = Slot(uri=PERSONINFO.mission_statement, name="mission_statement", curie=PERSONINFO.curie('mission_statement'), - model_uri=PERSONINFO.mission_statement, domain=None, range=Optional[str]) - -slots.founding_date = Slot(uri=PERSONINFO.founding_date, name="founding_date", curie=PERSONINFO.curie('founding_date'), - model_uri=PERSONINFO.founding_date, domain=None, range=Optional[str]) - -slots.founding_location = Slot(uri=PERSONINFO.founding_location, name="founding_location", curie=PERSONINFO.curie('founding_location'), - model_uri=PERSONINFO.founding_location, domain=None, range=Optional[Union[str, PlaceId]]) - -slots.postal_code = Slot(uri=PERSONINFO.postal_code, name="postal_code", curie=PERSONINFO.curie('postal_code'), - model_uri=PERSONINFO.postal_code, domain=None, range=Optional[str]) - -slots.started_at_time = Slot(uri=PROV.startedAtTime, name="started_at_time", curie=PROV.curie('startedAtTime'), - model_uri=PERSONINFO.started_at_time, domain=None, range=Optional[Union[str, XSDDate]]) - -slots.duration = Slot(uri=PERSONINFO.duration, name="duration", curie=PERSONINFO.curie('duration'), - model_uri=PERSONINFO.duration, domain=None, range=Optional[float]) - -slots.diagnosis = Slot(uri=PERSONINFO.diagnosis, name="diagnosis", curie=PERSONINFO.curie('diagnosis'), - model_uri=PERSONINFO.diagnosis, domain=None, range=Optional[Union[dict, DiagnosisConcept]]) - -slots.procedure = Slot(uri=PERSONINFO.procedure, name="procedure", curie=PERSONINFO.curie('procedure'), - model_uri=PERSONINFO.procedure, domain=None, range=Optional[Union[dict, ProcedureConcept]]) - -slots.ended_at_time = Slot(uri=PROV.endedAtTime, name="ended_at_time", curie=PROV.curie('endedAtTime'), - model_uri=PERSONINFO.ended_at_time, domain=None, range=Optional[Union[str, XSDDate]]) - -slots.categories = Slot(uri=PERSONINFO.categories, name="categories", curie=PERSONINFO.curie('categories'), - model_uri=PERSONINFO.categories, domain=None, range=Optional[Union[str, list[str]]]) - -slots.salary = Slot(uri=PERSONINFO.salary, name="salary", curie=PERSONINFO.curie('salary'), - model_uri=PERSONINFO.salary, domain=None, range=Optional[Union[Decimal, SalaryType]]) - -slots.min_salary = Slot(uri=PERSONINFO.min_salary, name="min_salary", curie=PERSONINFO.curie('min_salary'), - model_uri=PERSONINFO.min_salary, domain=None, range=Optional[Union[Decimal, SalaryType]]) - -slots.hasAliases__aliases = Slot(uri=PERSONINFO.aliases, name="hasAliases__aliases", curie=PERSONINFO.curie('aliases'), - model_uri=PERSONINFO.hasAliases__aliases, domain=None, range=Optional[Union[str, list[str]]]) - -slots.concept__code_system = Slot(uri=PERSONINFO.code_system, name="concept__code_system", curie=PERSONINFO.curie('code_system'), - model_uri=PERSONINFO.concept__code_system, domain=None, range=Optional[Union[str, CodeSystemId]]) - -slots.concept__mappings = Slot(uri=SKOS.exactMatch, name="concept__mappings", curie=SKOS.curie('exactMatch'), - model_uri=PERSONINFO.concept__mappings, domain=None, range=Optional[Union[Union[str, CrossReference], list[Union[str, CrossReference]]]]) - -slots.container__persons = Slot(uri=PERSONINFO.persons, name="container__persons", curie=PERSONINFO.curie('persons'), - model_uri=PERSONINFO.container__persons, domain=None, range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]]) - -slots.container__organizations = Slot(uri=PERSONINFO.organizations, name="container__organizations", curie=PERSONINFO.curie('organizations'), - model_uri=PERSONINFO.container__organizations, domain=None, range=Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]]) - -slots.related_to = Slot(uri=PERSONINFO.related_to, name="related to", curie=PERSONINFO.curie('related_to'), - model_uri=PERSONINFO.related_to, domain=None, range=Union[str, PersonId]) - -slots.Person_primary_email = Slot(uri=SCHEMA.email, name="Person_primary_email", curie=SCHEMA.curie('email'), - model_uri=PERSONINFO.Person_primary_email, domain=Person, range=Optional[str], - pattern=re.compile(r'^\S+@[\S+\.]+\S+')) - -slots.Organization_categories = Slot(uri=PERSONINFO.categories, name="Organization_categories", curie=PERSONINFO.curie('categories'), - model_uri=PERSONINFO.Organization_categories, domain=Organization, range=Optional[Union[Union[str, "OrganizationType"], list[Union[str, "OrganizationType"]]]]) - -slots.FamilialRelationship_type = Slot(uri=PERSONINFO.type, name="FamilialRelationship_type", curie=PERSONINFO.curie('type'), - model_uri=PERSONINFO.FamilialRelationship_type, domain=FamilialRelationship, range=Union[str, "FamilialRelationshipType"]) - -slots.FamilialRelationship_related_to = Slot(uri=PERSONINFO.related_to, name="FamilialRelationship_related to", curie=PERSONINFO.curie('related_to'), - model_uri=PERSONINFO.FamilialRelationship_related_to, domain=FamilialRelationship, range=Union[str, PersonId]) - -slots.InterPersonalRelationship_type = Slot(uri=PERSONINFO.type, name="InterPersonalRelationship_type", curie=PERSONINFO.curie('type'), - model_uri=PERSONINFO.InterPersonalRelationship_type, domain=InterPersonalRelationship, range=str) -slots.InterPersonalRelationship_related_to = Slot(uri=PERSONINFO.related_to, name="InterPersonalRelationship_related to", curie=PERSONINFO.curie('related_to'), - model_uri=PERSONINFO.InterPersonalRelationship_related_to, domain=InterPersonalRelationship, range=Union[str, PersonId]) +slots.id = Slot( + uri=SCHEMA.identifier, + name="id", + curie=SCHEMA.curie("identifier"), + model_uri=PERSONINFO.id, + domain=None, + range=URIRef, +) + +slots.name = Slot( + uri=SCHEMA.name, + name="name", + curie=SCHEMA.curie("name"), + model_uri=PERSONINFO.name, + domain=None, + range=Optional[str], +) + +slots.description = Slot( + uri=SCHEMA.description, + name="description", + curie=SCHEMA.curie("description"), + model_uri=PERSONINFO.description, + domain=None, + range=Optional[str], +) + +slots.image = Slot( + uri=SCHEMA.image, + name="image", + curie=SCHEMA.curie("image"), + model_uri=PERSONINFO.image, + domain=None, + range=Optional[str], +) + +slots.gender = Slot( + uri=SCHEMA.gender, + name="gender", + curie=SCHEMA.curie("gender"), + model_uri=PERSONINFO.gender, + domain=None, + range=Optional[Union[str, "GenderType"]], +) + +slots.primary_email = Slot( + uri=SCHEMA.email, + name="primary_email", + curie=SCHEMA.curie("email"), + model_uri=PERSONINFO.primary_email, + domain=None, + range=Optional[str], +) + +slots.birth_date = Slot( + uri=SCHEMA.birthDate, + name="birth_date", + curie=SCHEMA.curie("birthDate"), + model_uri=PERSONINFO.birth_date, + domain=None, + range=Optional[str], +) + +slots.employed_at = Slot( + uri=PERSONINFO.employed_at, + name="employed_at", + curie=PERSONINFO.curie("employed_at"), + model_uri=PERSONINFO.employed_at, + domain=None, + range=Optional[Union[str, OrganizationId]], +) + +slots.is_current = Slot( + uri=PERSONINFO.is_current, + name="is_current", + curie=PERSONINFO.curie("is_current"), + model_uri=PERSONINFO.is_current, + domain=None, + range=Optional[Union[bool, Bool]], +) + +slots.has_employment_history = Slot( + uri=PERSONINFO.has_employment_history, + name="has_employment_history", + curie=PERSONINFO.curie("has_employment_history"), + model_uri=PERSONINFO.has_employment_history, + domain=None, + range=Optional[Union[Union[dict, EmploymentEvent], list[Union[dict, EmploymentEvent]]]], +) + +slots.has_medical_history = Slot( + uri=PERSONINFO.has_medical_history, + name="has_medical_history", + curie=PERSONINFO.curie("has_medical_history"), + model_uri=PERSONINFO.has_medical_history, + domain=None, + range=Optional[Union[Union[dict, MedicalEvent], list[Union[dict, MedicalEvent]]]], +) + +slots.has_familial_relationships = Slot( + uri=PERSONINFO.has_familial_relationships, + name="has_familial_relationships", + curie=PERSONINFO.curie("has_familial_relationships"), + model_uri=PERSONINFO.has_familial_relationships, + domain=None, + range=Optional[Union[Union[dict, FamilialRelationship], list[Union[dict, FamilialRelationship]]]], +) + +slots.has_interpersonal_relationships = Slot( + uri=PERSONINFO.has_interpersonal_relationships, + name="has_interpersonal_relationships", + curie=PERSONINFO.curie("has_interpersonal_relationships"), + model_uri=PERSONINFO.has_interpersonal_relationships, + domain=None, + range=Optional[Union[Union[dict, InterPersonalRelationship], list[Union[dict, InterPersonalRelationship]]]], +) + +slots.in_location = Slot( + uri=PERSONINFO.in_location, + name="in location", + curie=PERSONINFO.curie("in_location"), + model_uri=PERSONINFO.in_location, + domain=None, + range=Optional[Union[str, PlaceId]], +) + +slots.current_address = Slot( + uri=PERSONINFO.current_address, + name="current_address", + curie=PERSONINFO.curie("current_address"), + model_uri=PERSONINFO.current_address, + domain=None, + range=Optional[Union[dict, Address]], +) + +slots.age_in_years = Slot( + uri=PERSONINFO.age_in_years, + name="age_in_years", + curie=PERSONINFO.curie("age_in_years"), + model_uri=PERSONINFO.age_in_years, + domain=None, + range=Optional[int], +) + +slots.score = Slot( + uri=PERSONINFO.score, + name="score", + curie=PERSONINFO.curie("score"), + model_uri=PERSONINFO.score, + domain=None, + range=Optional[Decimal], +) + +slots.related_to = Slot( + uri=PERSONINFO.related_to, + name="related_to", + curie=PERSONINFO.curie("related_to"), + model_uri=PERSONINFO.related_to, + domain=None, + range=Optional[Union[str, NamedThingId]], +) + +slots.depicted_by = Slot( + uri=PERSONINFO.depicted_by, + name="depicted_by", + curie=PERSONINFO.curie("depicted_by"), + model_uri=PERSONINFO.depicted_by, + domain=None, + range=Optional[Union[str, ImageURL]], +) + +slots.type = Slot( + uri=PERSONINFO.type, + name="type", + curie=PERSONINFO.curie("type"), + model_uri=PERSONINFO.type, + domain=None, + range=Optional[str], +) + +slots.subtype = Slot( + uri=PERSONINFO.subtype, + name="subtype", + curie=PERSONINFO.curie("subtype"), + model_uri=PERSONINFO.subtype, + domain=None, + range=Optional[Union[str, ConceptId]], +) + +slots.street = Slot( + uri=PERSONINFO.street, + name="street", + curie=PERSONINFO.curie("street"), + model_uri=PERSONINFO.street, + domain=None, + range=Optional[str], +) + +slots.city = Slot( + uri=PERSONINFO.city, + name="city", + curie=PERSONINFO.curie("city"), + model_uri=PERSONINFO.city, + domain=None, + range=Optional[str], +) + +slots.mission_statement = Slot( + uri=PERSONINFO.mission_statement, + name="mission_statement", + curie=PERSONINFO.curie("mission_statement"), + model_uri=PERSONINFO.mission_statement, + domain=None, + range=Optional[str], +) + +slots.founding_date = Slot( + uri=PERSONINFO.founding_date, + name="founding_date", + curie=PERSONINFO.curie("founding_date"), + model_uri=PERSONINFO.founding_date, + domain=None, + range=Optional[str], +) + +slots.founding_location = Slot( + uri=PERSONINFO.founding_location, + name="founding_location", + curie=PERSONINFO.curie("founding_location"), + model_uri=PERSONINFO.founding_location, + domain=None, + range=Optional[Union[str, PlaceId]], +) + +slots.postal_code = Slot( + uri=PERSONINFO.postal_code, + name="postal_code", + curie=PERSONINFO.curie("postal_code"), + model_uri=PERSONINFO.postal_code, + domain=None, + range=Optional[str], +) + +slots.started_at_time = Slot( + uri=PROV.startedAtTime, + name="started_at_time", + curie=PROV.curie("startedAtTime"), + model_uri=PERSONINFO.started_at_time, + domain=None, + range=Optional[Union[str, XSDDate]], +) + +slots.duration = Slot( + uri=PERSONINFO.duration, + name="duration", + curie=PERSONINFO.curie("duration"), + model_uri=PERSONINFO.duration, + domain=None, + range=Optional[float], +) + +slots.diagnosis = Slot( + uri=PERSONINFO.diagnosis, + name="diagnosis", + curie=PERSONINFO.curie("diagnosis"), + model_uri=PERSONINFO.diagnosis, + domain=None, + range=Optional[Union[dict, DiagnosisConcept]], +) + +slots.procedure = Slot( + uri=PERSONINFO.procedure, + name="procedure", + curie=PERSONINFO.curie("procedure"), + model_uri=PERSONINFO.procedure, + domain=None, + range=Optional[Union[dict, ProcedureConcept]], +) + +slots.ended_at_time = Slot( + uri=PROV.endedAtTime, + name="ended_at_time", + curie=PROV.curie("endedAtTime"), + model_uri=PERSONINFO.ended_at_time, + domain=None, + range=Optional[Union[str, XSDDate]], +) + +slots.categories = Slot( + uri=PERSONINFO.categories, + name="categories", + curie=PERSONINFO.curie("categories"), + model_uri=PERSONINFO.categories, + domain=None, + range=Optional[Union[str, list[str]]], +) + +slots.salary = Slot( + uri=PERSONINFO.salary, + name="salary", + curie=PERSONINFO.curie("salary"), + model_uri=PERSONINFO.salary, + domain=None, + range=Optional[Union[Decimal, SalaryType]], +) + +slots.min_salary = Slot( + uri=PERSONINFO.min_salary, + name="min_salary", + curie=PERSONINFO.curie("min_salary"), + model_uri=PERSONINFO.min_salary, + domain=None, + range=Optional[Union[Decimal, SalaryType]], +) + +slots.hasAliases__aliases = Slot( + uri=PERSONINFO.aliases, + name="hasAliases__aliases", + curie=PERSONINFO.curie("aliases"), + model_uri=PERSONINFO.hasAliases__aliases, + domain=None, + range=Optional[Union[str, list[str]]], +) + +slots.concept__code_system = Slot( + uri=PERSONINFO.code_system, + name="concept__code_system", + curie=PERSONINFO.curie("code_system"), + model_uri=PERSONINFO.concept__code_system, + domain=None, + range=Optional[Union[str, CodeSystemId]], +) + +slots.concept__mappings = Slot( + uri=SKOS.exactMatch, + name="concept__mappings", + curie=SKOS.curie("exactMatch"), + model_uri=PERSONINFO.concept__mappings, + domain=None, + range=Optional[Union[Union[str, CrossReference], list[Union[str, CrossReference]]]], +) + +slots.container__persons = Slot( + uri=PERSONINFO.persons, + name="container__persons", + curie=PERSONINFO.curie("persons"), + model_uri=PERSONINFO.container__persons, + domain=None, + range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]], +) + +slots.container__organizations = Slot( + uri=PERSONINFO.organizations, + name="container__organizations", + curie=PERSONINFO.curie("organizations"), + model_uri=PERSONINFO.container__organizations, + domain=None, + range=Optional[Union[dict[Union[str, OrganizationId], Union[dict, Organization]], list[Union[dict, Organization]]]], +) + +slots.related_to = Slot( + uri=PERSONINFO.related_to, + name="related to", + curie=PERSONINFO.curie("related_to"), + model_uri=PERSONINFO.related_to, + domain=None, + range=Union[str, PersonId], +) + +slots.Person_primary_email = Slot( + uri=SCHEMA.email, + name="Person_primary_email", + curie=SCHEMA.curie("email"), + model_uri=PERSONINFO.Person_primary_email, + domain=Person, + range=Optional[str], + pattern=re.compile(r"^\S+@[\S+\.]+\S+"), +) + +slots.Organization_categories = Slot( + uri=PERSONINFO.categories, + name="Organization_categories", + curie=PERSONINFO.curie("categories"), + model_uri=PERSONINFO.Organization_categories, + domain=Organization, + range=Optional[Union[Union[str, "OrganizationType"], list[Union[str, "OrganizationType"]]]], +) + +slots.FamilialRelationship_type = Slot( + uri=PERSONINFO.type, + name="FamilialRelationship_type", + curie=PERSONINFO.curie("type"), + model_uri=PERSONINFO.FamilialRelationship_type, + domain=FamilialRelationship, + range=Union[str, "FamilialRelationshipType"], +) + +slots.FamilialRelationship_related_to = Slot( + uri=PERSONINFO.related_to, + name="FamilialRelationship_related to", + curie=PERSONINFO.curie("related_to"), + model_uri=PERSONINFO.FamilialRelationship_related_to, + domain=FamilialRelationship, + range=Union[str, PersonId], +) + +slots.InterPersonalRelationship_type = Slot( + uri=PERSONINFO.type, + name="InterPersonalRelationship_type", + curie=PERSONINFO.curie("type"), + model_uri=PERSONINFO.InterPersonalRelationship_type, + domain=InterPersonalRelationship, + range=str, +) + +slots.InterPersonalRelationship_related_to = Slot( + uri=PERSONINFO.related_to, + name="InterPersonalRelationship_related to", + curie=PERSONINFO.curie("related_to"), + model_uri=PERSONINFO.InterPersonalRelationship_related_to, + domain=InterPersonalRelationship, + range=Union[str, PersonId], +) diff --git a/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py b/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py index 4ec14d1c..e3916290 100644 --- a/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py +++ b/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py @@ -20,15 +20,16 @@ version = None # Namespaces -ORCID = CurieNamespace('ORCID', 'https://orcid.org/') -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -PERSONINFO = CurieNamespace('personinfo', 'https://w3id.org/linkml/examples/personinfo/') -SDO = CurieNamespace('sdo', 'http://schema.org/') +ORCID = CurieNamespace("ORCID", "https://orcid.org/") +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +PERSONINFO = CurieNamespace("personinfo", "https://w3id.org/linkml/examples/personinfo/") +SDO = CurieNamespace("sdo", "http://schema.org/") DEFAULT_ = PERSONINFO # Types + # Class references class PersonId(extended_str): pass @@ -90,17 +91,43 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): class slots: pass -slots.id = Slot(uri=PERSONINFO.id, name="id", curie=PERSONINFO.curie('id'), - model_uri=PERSONINFO.id, domain=None, range=URIRef) - -slots.full_name = Slot(uri=PERSONINFO.full_name, name="full_name", curie=PERSONINFO.curie('full_name'), - model_uri=PERSONINFO.full_name, domain=None, range=Optional[str]) - -slots.age = Slot(uri=PERSONINFO.age, name="age", curie=PERSONINFO.curie('age'), - model_uri=PERSONINFO.age, domain=None, range=Optional[str]) - -slots.phone = Slot(uri=PERSONINFO.phone, name="phone", curie=PERSONINFO.curie('phone'), - model_uri=PERSONINFO.phone, domain=None, range=Optional[str]) -slots.container__persons = Slot(uri=PERSONINFO.persons, name="container__persons", curie=PERSONINFO.curie('persons'), - model_uri=PERSONINFO.container__persons, domain=None, range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]]) +slots.id = Slot( + uri=PERSONINFO.id, name="id", curie=PERSONINFO.curie("id"), model_uri=PERSONINFO.id, domain=None, range=URIRef +) + +slots.full_name = Slot( + uri=PERSONINFO.full_name, + name="full_name", + curie=PERSONINFO.curie("full_name"), + model_uri=PERSONINFO.full_name, + domain=None, + range=Optional[str], +) + +slots.age = Slot( + uri=PERSONINFO.age, + name="age", + curie=PERSONINFO.curie("age"), + model_uri=PERSONINFO.age, + domain=None, + range=Optional[str], +) + +slots.phone = Slot( + uri=PERSONINFO.phone, + name="phone", + curie=PERSONINFO.curie("phone"), + model_uri=PERSONINFO.phone, + domain=None, + range=Optional[str], +) + +slots.container__persons = Slot( + uri=PERSONINFO.persons, + name="container__persons", + curie=PERSONINFO.curie("persons"), + model_uri=PERSONINFO.container__persons, + domain=None, + range=Optional[Union[dict[Union[str, PersonId], Union[dict, Person]], list[Union[dict, Person]]]], +) diff --git a/tests/test_loaders_dumpers/models/phenopackets.py b/tests/test_loaders_dumpers/models/phenopackets.py index 5ad33459..91b20969 100644 --- a/tests/test_loaders_dumpers/models/phenopackets.py +++ b/tests/test_loaders_dumpers/models/phenopackets.py @@ -24,37 +24,38 @@ version = None # Namespaces -ARGO = CurieNamespace('ARGO', 'https://docs.icgc-argo.org/dictionary/') -GENO = CurieNamespace('GENO', 'http://purl.obolibrary.org/obo/GENO_') -HP = CurieNamespace('HP', 'http://purl.obolibrary.org/obo/HP_') -LOINC = CurieNamespace('LOINC', 'https://loinc.org/') -MONDO = CurieNamespace('MONDO', 'http://purl.obolibrary.org/obo/MONDO_') -NCIT = CurieNamespace('NCIT', 'http://purl.obolibrary.org/obo/NCIT_') -UBERON = CurieNamespace('UBERON', 'http://purl.obolibrary.org/obo/UBERON_') -UCUM = CurieNamespace('UCUM', 'http://unitsofmeasure.org/') -UO = CurieNamespace('UO', 'http://purl.obolibrary.org/obo/UO_') -ANY = CurieNamespace('any', 'https://w3id.org/linkml/phenopackets/any/') -ARGO = CurieNamespace('argo', 'https://docs.icgc-argo.org/dictionary/') -BASE = CurieNamespace('base', 'https://w3id.org/linkml/phenopackets/base/') -BIOSAMPLE = CurieNamespace('biosample', 'https://w3id.org/linkml/phenopackets/biosample/') -DISEASE = CurieNamespace('disease', 'https://w3id.org/linkml/phenopackets/disease/') -INDIVIDUAL = CurieNamespace('individual', 'https://w3id.org/linkml/phenopackets/individual/') -INTERPRETATION = CurieNamespace('interpretation', 'https://w3id.org/linkml/phenopackets/interpretation/') -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -MEASUREMENT = CurieNamespace('measurement', 'https://w3id.org/linkml/phenopackets/measurement/') -MEDICAL_ACTION = CurieNamespace('medical_action', 'https://w3id.org/linkml/phenopackets/medical_action/') -META_DATA = CurieNamespace('meta_data', 'https://w3id.org/linkml/phenopackets/meta_data/') -PEDIGREE = CurieNamespace('pedigree', 'https://w3id.org/linkml/phenopackets/pedigree/') -PHENOPACKETS = CurieNamespace('phenopackets', 'https://w3id.org/linkml/phenopackets/phenopackets/') -PHENOTYPIC_FEATURE = CurieNamespace('phenotypic_feature', 'https://w3id.org/linkml/phenopackets/phenotypic_feature/') -TIMESTAMP = CurieNamespace('timestamp', 'https://w3id.org/linkml/phenopackets/timestamp/') -VRS = CurieNamespace('vrs', 'https://w3id.org/linkml/phenopackets/vrs/') -VRSATILE = CurieNamespace('vrsatile', 'https://w3id.org/linkml/phenopackets/vrsatile/') +ARGO = CurieNamespace("ARGO", "https://docs.icgc-argo.org/dictionary/") +GENO = CurieNamespace("GENO", "http://purl.obolibrary.org/obo/GENO_") +HP = CurieNamespace("HP", "http://purl.obolibrary.org/obo/HP_") +LOINC = CurieNamespace("LOINC", "https://loinc.org/") +MONDO = CurieNamespace("MONDO", "http://purl.obolibrary.org/obo/MONDO_") +NCIT = CurieNamespace("NCIT", "http://purl.obolibrary.org/obo/NCIT_") +UBERON = CurieNamespace("UBERON", "http://purl.obolibrary.org/obo/UBERON_") +UCUM = CurieNamespace("UCUM", "http://unitsofmeasure.org/") +UO = CurieNamespace("UO", "http://purl.obolibrary.org/obo/UO_") +ANY = CurieNamespace("any", "https://w3id.org/linkml/phenopackets/any/") +ARGO = CurieNamespace("argo", "https://docs.icgc-argo.org/dictionary/") +BASE = CurieNamespace("base", "https://w3id.org/linkml/phenopackets/base/") +BIOSAMPLE = CurieNamespace("biosample", "https://w3id.org/linkml/phenopackets/biosample/") +DISEASE = CurieNamespace("disease", "https://w3id.org/linkml/phenopackets/disease/") +INDIVIDUAL = CurieNamespace("individual", "https://w3id.org/linkml/phenopackets/individual/") +INTERPRETATION = CurieNamespace("interpretation", "https://w3id.org/linkml/phenopackets/interpretation/") +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +MEASUREMENT = CurieNamespace("measurement", "https://w3id.org/linkml/phenopackets/measurement/") +MEDICAL_ACTION = CurieNamespace("medical_action", "https://w3id.org/linkml/phenopackets/medical_action/") +META_DATA = CurieNamespace("meta_data", "https://w3id.org/linkml/phenopackets/meta_data/") +PEDIGREE = CurieNamespace("pedigree", "https://w3id.org/linkml/phenopackets/pedigree/") +PHENOPACKETS = CurieNamespace("phenopackets", "https://w3id.org/linkml/phenopackets/phenopackets/") +PHENOTYPIC_FEATURE = CurieNamespace("phenotypic_feature", "https://w3id.org/linkml/phenopackets/phenotypic_feature/") +TIMESTAMP = CurieNamespace("timestamp", "https://w3id.org/linkml/phenopackets/timestamp/") +VRS = CurieNamespace("vrs", "https://w3id.org/linkml/phenopackets/vrs/") +VRSATILE = CurieNamespace("vrsatile", "https://w3id.org/linkml/phenopackets/vrsatile/") DEFAULT_ = PHENOPACKETS # Types + # Class references class OntologyClassId(extended_str): pass @@ -65,6 +66,7 @@ class Cohort(YAMLRoot): """ A group of individuals related in some phenotypic or genotypic aspect. """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PHENOPACKETS.Cohort @@ -106,6 +108,7 @@ class Family(YAMLRoot): InterpretationRequestRD https://github.com/genomicsengland/GelReportModels/blob/master/schemas/IDLs/org.gel.models.report.avro/5.0.0/InterpretationRequestRD.avdl """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PHENOPACKETS.Family @@ -156,6 +159,7 @@ class Phenopacket(YAMLRoot): expected that the resources sharing the phenopackets will define and enforce their own semantics and level of requirements for included fields. """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PHENOPACKETS.Phenopacket @@ -171,7 +175,9 @@ class Phenopacket(YAMLRoot): interpretations: Optional[Union[Union[dict, "Interpretation"], list[Union[dict, "Interpretation"]]]] = empty_list() measurements: Optional[Union[Union[dict, "Measurement"], list[Union[dict, "Measurement"]]]] = empty_list() medicalActions: Optional[Union[Union[dict, "MedicalAction"], list[Union[dict, "MedicalAction"]]]] = empty_list() - phenotypicFeatures: Optional[Union[Union[dict, "PhenotypicFeature"], list[Union[dict, "PhenotypicFeature"]]]] = empty_list() + phenotypicFeatures: Optional[Union[Union[dict, "PhenotypicFeature"], list[Union[dict, "PhenotypicFeature"]]]] = ( + empty_list() + ) subject: Optional[Union[dict, "Individual"]] = None def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): @@ -197,7 +203,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.interpretations, list): self.interpretations = [self.interpretations] if self.interpretations is not None else [] - self.interpretations = [v if isinstance(v, Interpretation) else Interpretation(**as_dict(v)) for v in self.interpretations] + self.interpretations = [ + v if isinstance(v, Interpretation) else Interpretation(**as_dict(v)) for v in self.interpretations + ] if not isinstance(self.measurements, list): self.measurements = [self.measurements] if self.measurements is not None else [] @@ -205,11 +213,15 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.medicalActions, list): self.medicalActions = [self.medicalActions] if self.medicalActions is not None else [] - self.medicalActions = [v if isinstance(v, MedicalAction) else MedicalAction(**as_dict(v)) for v in self.medicalActions] + self.medicalActions = [ + v if isinstance(v, MedicalAction) else MedicalAction(**as_dict(v)) for v in self.medicalActions + ] if not isinstance(self.phenotypicFeatures, list): self.phenotypicFeatures = [self.phenotypicFeatures] if self.phenotypicFeatures is not None else [] - self.phenotypicFeatures = [v if isinstance(v, PhenotypicFeature) else PhenotypicFeature(**as_dict(v)) for v in self.phenotypicFeatures] + self.phenotypicFeatures = [ + v if isinstance(v, PhenotypicFeature) else PhenotypicFeature(**as_dict(v)) for v in self.phenotypicFeatures + ] if self.subject is not None and not isinstance(self.subject, Individual): self.subject = Individual(**as_dict(self.subject)) @@ -223,6 +235,7 @@ class Age(YAMLRoot): See http://build.fhir.org/datatypes and http://build.fhir.org/condition-definitions.html#Condition.onset_x_ In FHIR this is represented as a UCUM measurement - http://unitsofmeasure.org/trac/ """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.Age @@ -275,6 +288,7 @@ class Evidence(YAMLRoot): """ FHIR mapping: Condition.evidence (https://www.hl7.org/fhir/condition-definitions.html#Condition.evidence) """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.Evidence @@ -300,6 +314,7 @@ class ExternalReference(YAMLRoot): """ FHIR mapping: Reference (https://www.hl7.org/fhir/references.html) """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.ExternalReference @@ -341,7 +356,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.fileAttributes is not None and not isinstance(self.fileAttributes, Dictionary): self.fileAttributes = Dictionary() - if self.individualToFileIdentifiers is not None and not isinstance(self.individualToFileIdentifiers, Dictionary): + if self.individualToFileIdentifiers is not None and not isinstance( + self.individualToFileIdentifiers, Dictionary + ): self.individualToFileIdentifiers = Dictionary() if self.uri is not None and not isinstance(self.uri, str): @@ -379,6 +396,7 @@ class OntologyClass(YAMLRoot): (http://www.hl7.org/fhir/datatypes.html#CodeableConcept) see also Coding (http://www.hl7.org/fhir/datatypes.html#Coding) """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.OntologyClass @@ -410,6 +428,7 @@ class Procedure(YAMLRoot): "body_site":{"UBERON:0003403": "skin of forearm"}} - a punch biopsy of the skin from the forearm FHIR mapping: Procedure (https://www.hl7.org/fhir/procedure.html) """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BASE.Procedure @@ -504,6 +523,7 @@ class Biosample(YAMLRoot): genomic array as well as RNA-seq experiments) may refer to the same Biosample. FHIR mapping: Specimen (http://www.hl7.org/fhir/specimen.html). """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = BIOSAMPLE.Biosample @@ -513,7 +533,9 @@ class Biosample(YAMLRoot): derivedFromId: Optional[str] = None description: Optional[str] = None - diagnosticMarkers: Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]] = empty_dict() + diagnosticMarkers: Optional[ + Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]] + ] = empty_dict() files: Optional[Union[Union[dict, File], list[Union[dict, File]]]] = empty_list() histologicalDiagnosis: Optional[Union[dict, OntologyClass]] = None id: Optional[str] = None @@ -521,8 +543,12 @@ class Biosample(YAMLRoot): materialSample: Optional[Union[dict, OntologyClass]] = None measurements: Optional[Union[Union[dict, "Measurement"], list[Union[dict, "Measurement"]]]] = empty_list() pathologicalStage: Optional[Union[dict, OntologyClass]] = None - pathologicalTnmFinding: Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]] = empty_dict() - phenotypicFeatures: Optional[Union[Union[dict, "PhenotypicFeature"], list[Union[dict, "PhenotypicFeature"]]]] = empty_list() + pathologicalTnmFinding: Optional[ + Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]] + ] = empty_dict() + phenotypicFeatures: Optional[Union[Union[dict, "PhenotypicFeature"], list[Union[dict, "PhenotypicFeature"]]]] = ( + empty_list() + ) procedure: Optional[Union[dict, Procedure]] = None sampleProcessing: Optional[Union[dict, OntologyClass]] = None sampleStorage: Optional[Union[dict, OntologyClass]] = None @@ -540,7 +566,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.description is not None and not isinstance(self.description, str): self.description = str(self.description) - self._normalize_inlined_as_dict(slot_name="diagnosticMarkers", slot_type=OntologyClass, key_name="id", keyed=True) + self._normalize_inlined_as_dict( + slot_name="diagnosticMarkers", slot_type=OntologyClass, key_name="id", keyed=True + ) if not isinstance(self.files, list): self.files = [self.files] if self.files is not None else [] @@ -565,11 +593,15 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.pathologicalStage is not None and not isinstance(self.pathologicalStage, OntologyClass): self.pathologicalStage = OntologyClass(**as_dict(self.pathologicalStage)) - self._normalize_inlined_as_dict(slot_name="pathologicalTnmFinding", slot_type=OntologyClass, key_name="id", keyed=True) + self._normalize_inlined_as_dict( + slot_name="pathologicalTnmFinding", slot_type=OntologyClass, key_name="id", keyed=True + ) if not isinstance(self.phenotypicFeatures, list): self.phenotypicFeatures = [self.phenotypicFeatures] if self.phenotypicFeatures is not None else [] - self.phenotypicFeatures = [v if isinstance(v, PhenotypicFeature) else PhenotypicFeature(**as_dict(v)) for v in self.phenotypicFeatures] + self.phenotypicFeatures = [ + v if isinstance(v, PhenotypicFeature) else PhenotypicFeature(**as_dict(v)) for v in self.phenotypicFeatures + ] if self.procedure is not None and not isinstance(self.procedure, Procedure): self.procedure = Procedure(**as_dict(self.procedure)) @@ -606,6 +638,7 @@ class Disease(YAMLRoot): """ Message to indicate a disease (diagnosis) and its recorded onset. """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = DISEASE.Disease @@ -613,8 +646,12 @@ class Disease(YAMLRoot): class_name: ClassVar[str] = "Disease" class_model_uri: ClassVar[URIRef] = PHENOPACKETS.Disease - clinicalTnmFinding: Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]] = empty_dict() - diseaseStage: Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]] = empty_dict() + clinicalTnmFinding: Optional[ + Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]] + ] = empty_dict() + diseaseStage: Optional[ + Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]] + ] = empty_dict() excluded: Optional[Union[bool, Bool]] = None laterality: Optional[Union[dict, OntologyClass]] = None onset: Optional[Union[dict, TimeElement]] = None @@ -623,7 +660,9 @@ class Disease(YAMLRoot): term: Optional[Union[dict, OntologyClass]] = None def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): - self._normalize_inlined_as_dict(slot_name="clinicalTnmFinding", slot_type=OntologyClass, key_name="id", keyed=True) + self._normalize_inlined_as_dict( + slot_name="clinicalTnmFinding", slot_type=OntologyClass, key_name="id", keyed=True + ) self._normalize_inlined_as_dict(slot_name="diseaseStage", slot_type=OntologyClass, key_name="id", keyed=True) @@ -658,15 +697,22 @@ class Diagnosis(YAMLRoot): class_model_uri: ClassVar[URIRef] = PHENOPACKETS.Diagnosis disease: Optional[Union[dict, OntologyClass]] = None - genomicInterpretations: Optional[Union[Union[dict, "GenomicInterpretation"], list[Union[dict, "GenomicInterpretation"]]]] = empty_list() + genomicInterpretations: Optional[ + Union[Union[dict, "GenomicInterpretation"], list[Union[dict, "GenomicInterpretation"]]] + ] = empty_list() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.disease is not None and not isinstance(self.disease, OntologyClass): self.disease = OntologyClass(**as_dict(self.disease)) if not isinstance(self.genomicInterpretations, list): - self.genomicInterpretations = [self.genomicInterpretations] if self.genomicInterpretations is not None else [] - self.genomicInterpretations = [v if isinstance(v, GenomicInterpretation) else GenomicInterpretation(**as_dict(v)) for v in self.genomicInterpretations] + self.genomicInterpretations = ( + [self.genomicInterpretations] if self.genomicInterpretations is not None else [] + ) + self.genomicInterpretations = [ + v if isinstance(v, GenomicInterpretation) else GenomicInterpretation(**as_dict(v)) + for v in self.genomicInterpretations + ] super().__post_init__(**kwargs) @@ -677,6 +723,7 @@ class GenomicInterpretation(YAMLRoot): A statement about the contribution of a genomic element towards the observed phenotype. Note that this does not intend to encode any knowledge or results of specific computations. """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = INTERPRETATION.GenomicInterpretation @@ -749,10 +796,14 @@ class VariantInterpretation(YAMLRoot): variationDescriptor: Optional[Union[dict, "VariationDescriptor"]] = None def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): - if self.acmgPathogenicityClassification is not None and not isinstance(self.acmgPathogenicityClassification, AcmgPathogenicityClassification): + if self.acmgPathogenicityClassification is not None and not isinstance( + self.acmgPathogenicityClassification, AcmgPathogenicityClassification + ): self.acmgPathogenicityClassification = AcmgPathogenicityClassification(self.acmgPathogenicityClassification) - if self.therapeuticActionability is not None and not isinstance(self.therapeuticActionability, TherapeuticActionability): + if self.therapeuticActionability is not None and not isinstance( + self.therapeuticActionability, TherapeuticActionability + ): self.therapeuticActionability = TherapeuticActionability(self.therapeuticActionability) if self.variationDescriptor is not None and not isinstance(self.variationDescriptor, VariationDescriptor): @@ -767,6 +818,7 @@ class Individual(YAMLRoot): An individual (or subject) typically corresponds to an individual human or another organism. FHIR mapping: Patient (https://www.hl7.org/fhir/patient.html). """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = INDIVIDUAL.Individual @@ -860,7 +912,9 @@ class ComplexValue(YAMLRoot): def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.typedQuantities, list): self.typedQuantities = [self.typedQuantities] if self.typedQuantities is not None else [] - self.typedQuantities = [v if isinstance(v, TypedQuantity) else TypedQuantity(**as_dict(v)) for v in self.typedQuantities] + self.typedQuantities = [ + v if isinstance(v, TypedQuantity) else TypedQuantity(**as_dict(v)) for v in self.typedQuantities + ] super().__post_init__(**kwargs) @@ -870,6 +924,7 @@ class Measurement(YAMLRoot): """ FHIR mapping: Observation (https://www.hl7.org/fhir/observation.html) """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEASUREMENT.Measurement @@ -964,6 +1019,7 @@ class TypedQuantity(YAMLRoot): For complex measurements, such as blood pressure where more than one component quantity is required to describe the measurement """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEASUREMENT.TypedQuantity @@ -1011,6 +1067,7 @@ class DoseInterval(YAMLRoot): """ e.g. 50mg/ml 3 times daily for two weeks """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEDICAL_ACTION.DoseInterval @@ -1040,6 +1097,7 @@ class MedicalAction(YAMLRoot): """ medication, procedure, other actions taken for clinical management """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEDICAL_ACTION.MedicalAction @@ -1047,7 +1105,9 @@ class MedicalAction(YAMLRoot): class_name: ClassVar[str] = "MedicalAction" class_model_uri: ClassVar[URIRef] = PHENOPACKETS.MedicalAction - adverseEvents: Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]] = empty_dict() + adverseEvents: Optional[ + Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]] + ] = empty_dict() procedure: Optional[Union[dict, Procedure]] = None radiationTherapy: Optional[Union[dict, "RadiationTherapy"]] = None responseToTreatment: Optional[Union[dict, OntologyClass]] = None @@ -1081,7 +1141,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.treatmentTarget is not None and not isinstance(self.treatmentTarget, OntologyClass): self.treatmentTarget = OntologyClass(**as_dict(self.treatmentTarget)) - if self.treatmentTerminationReason is not None and not isinstance(self.treatmentTerminationReason, OntologyClass): + if self.treatmentTerminationReason is not None and not isinstance( + self.treatmentTerminationReason, OntologyClass + ): self.treatmentTerminationReason = OntologyClass(**as_dict(self.treatmentTerminationReason)) super().__post_init__(**kwargs) @@ -1092,6 +1154,7 @@ class RadiationTherapy(YAMLRoot): """ RadiationTherapy """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEDICAL_ACTION.RadiationTherapy @@ -1133,6 +1196,7 @@ class TherapeuticRegimen(YAMLRoot): """ ARGO mapping radiation::radiation_therapy_type (missing) """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEDICAL_ACTION.TherapeuticRegimen @@ -1170,6 +1234,7 @@ class Treatment(YAMLRoot): """ ARGO mapping treatment::is_primary_treatment (missing) treatment with an agent, such as a drug """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = MEDICAL_ACTION.Treatment @@ -1192,7 +1257,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.doseIntervals, list): self.doseIntervals = [self.doseIntervals] if self.doseIntervals is not None else [] - self.doseIntervals = [v if isinstance(v, DoseInterval) else DoseInterval(**as_dict(v)) for v in self.doseIntervals] + self.doseIntervals = [ + v if isinstance(v, DoseInterval) else DoseInterval(**as_dict(v)) for v in self.doseIntervals + ] if self.drugType is not None and not isinstance(self.drugType, DrugType): self.drugType = DrugType(self.drugType) @@ -1214,7 +1281,9 @@ class MetaData(YAMLRoot): created: Optional[str] = None createdBy: Optional[str] = None - externalReferences: Optional[Union[Union[dict, ExternalReference], list[Union[dict, ExternalReference]]]] = empty_list() + externalReferences: Optional[Union[Union[dict, ExternalReference], list[Union[dict, ExternalReference]]]] = ( + empty_list() + ) phenopacketSchemaVersion: Optional[str] = None resources: Optional[Union[Union[dict, "Resource"], list[Union[dict, "Resource"]]]] = empty_list() submittedBy: Optional[str] = None @@ -1229,7 +1298,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if not isinstance(self.externalReferences, list): self.externalReferences = [self.externalReferences] if self.externalReferences is not None else [] - self.externalReferences = [v if isinstance(v, ExternalReference) else ExternalReference(**as_dict(v)) for v in self.externalReferences] + self.externalReferences = [ + v if isinstance(v, ExternalReference) else ExternalReference(**as_dict(v)) for v in self.externalReferences + ] if self.phenopacketSchemaVersion is not None and not isinstance(self.phenopacketSchemaVersion, str): self.phenopacketSchemaVersion = str(self.phenopacketSchemaVersion) @@ -1252,6 +1323,7 @@ class Resource(YAMLRoot): Description of an external resource used for referencing an object. For example the resource may be an ontology such as the HPO or SNOMED. FHIR mapping: CodeSystem (http://www.hl7.org/fhir/codesystem.html) """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = META_DATA.Resource @@ -1294,6 +1366,7 @@ class Update(YAMLRoot): Information about when an update to a record occurred, who or what made the update and any pertinent information regarding the content and/or reason for the update """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = META_DATA.Update @@ -1325,6 +1398,7 @@ class Pedigree(YAMLRoot): """ https://software.broadinstitute.org/gatk/documentation/article?id=11016 """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PEDIGREE.Pedigree @@ -1387,6 +1461,7 @@ class PhenotypicFeature(YAMLRoot): and frequency FHIR mapping: Condition (https://www.hl7.org/fhir/condition.html) or Observation (https://www.hl7.org/fhir/observation.html) """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = PHENOTYPIC_FEATURE.PhenotypicFeature @@ -1397,7 +1472,9 @@ class PhenotypicFeature(YAMLRoot): description: Optional[str] = None evidence: Optional[Union[Union[dict, Evidence], list[Union[dict, Evidence]]]] = empty_list() excluded: Optional[Union[bool, Bool]] = None - modifiers: Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]] = empty_dict() + modifiers: Optional[ + Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]] + ] = empty_dict() onset: Optional[Union[dict, TimeElement]] = None resolution: Optional[Union[dict, TimeElement]] = None severity: Optional[Union[dict, OntologyClass]] = None @@ -1469,6 +1546,7 @@ class Timestamp(YAMLRoot): http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D ) to obtain a formatter capable of generating timestamps in this format. """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = TIMESTAMP.Timestamp @@ -1494,6 +1572,7 @@ class Expression(YAMLRoot): """ https://vrsatile.readthedocs.io/en/latest/value_object_descriptor/vod_index.html#expression """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRSATILE.Expression @@ -1523,6 +1602,7 @@ class Extension(YAMLRoot): """ https://vrsatile.readthedocs.io/en/latest/value_object_descriptor/vod_index.html#extension """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRSATILE.Extension @@ -1549,6 +1629,7 @@ class GeneDescriptor(YAMLRoot): """ https://vrsatile.readthedocs.io/en/latest/value_object_descriptor/vod_index.html#gene-descriptor """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = VRSATILE.GeneDescriptor @@ -1733,6 +1814,7 @@ class Any(YAMLRoot): adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = ANY.Any @@ -1795,16 +1877,22 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.curie is not None and not isinstance(self.curie, str): self.curie = str(self.curie) - if self.derivedSequenceExpression is not None and not isinstance(self.derivedSequenceExpression, DerivedSequenceExpression): + if self.derivedSequenceExpression is not None and not isinstance( + self.derivedSequenceExpression, DerivedSequenceExpression + ): self.derivedSequenceExpression = DerivedSequenceExpression(**as_dict(self.derivedSequenceExpression)) if self.id is not None and not isinstance(self.id, str): self.id = str(self.id) - if self.literalSequenceExpression is not None and not isinstance(self.literalSequenceExpression, LiteralSequenceExpression): + if self.literalSequenceExpression is not None and not isinstance( + self.literalSequenceExpression, LiteralSequenceExpression + ): self.literalSequenceExpression = LiteralSequenceExpression(**as_dict(self.literalSequenceExpression)) - if self.repeatedSequenceExpression is not None and not isinstance(self.repeatedSequenceExpression, RepeatedSequenceExpression): + if self.repeatedSequenceExpression is not None and not isinstance( + self.repeatedSequenceExpression, RepeatedSequenceExpression + ): self.repeatedSequenceExpression = RepeatedSequenceExpression(**as_dict(self.repeatedSequenceExpression)) if self.sequenceLocation is not None and not isinstance(self.sequenceLocation, SequenceLocation): @@ -1874,7 +1962,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.definiteRange is not None and not isinstance(self.definiteRange, DefiniteRange): self.definiteRange = DefiniteRange(**as_dict(self.definiteRange)) - if self.derivedSequenceExpression is not None and not isinstance(self.derivedSequenceExpression, DerivedSequenceExpression): + if self.derivedSequenceExpression is not None and not isinstance( + self.derivedSequenceExpression, DerivedSequenceExpression + ): self.derivedSequenceExpression = DerivedSequenceExpression(**as_dict(self.derivedSequenceExpression)) if self.gene is not None and not isinstance(self.gene, Gene): @@ -1889,13 +1979,17 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.indefiniteRange is not None and not isinstance(self.indefiniteRange, IndefiniteRange): self.indefiniteRange = IndefiniteRange(**as_dict(self.indefiniteRange)) - if self.literalSequenceExpression is not None and not isinstance(self.literalSequenceExpression, LiteralSequenceExpression): + if self.literalSequenceExpression is not None and not isinstance( + self.literalSequenceExpression, LiteralSequenceExpression + ): self.literalSequenceExpression = LiteralSequenceExpression(**as_dict(self.literalSequenceExpression)) if self.number is not None and not isinstance(self.number, Number): self.number = Number(**as_dict(self.number)) - if self.repeatedSequenceExpression is not None and not isinstance(self.repeatedSequenceExpression, RepeatedSequenceExpression): + if self.repeatedSequenceExpression is not None and not isinstance( + self.repeatedSequenceExpression, RepeatedSequenceExpression + ): self.repeatedSequenceExpression = RepeatedSequenceExpression(**as_dict(self.repeatedSequenceExpression)) super().__post_init__(**kwargs) @@ -2180,13 +2274,17 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.definiteRange is not None and not isinstance(self.definiteRange, DefiniteRange): self.definiteRange = DefiniteRange(**as_dict(self.definiteRange)) - if self.derivedSequenceExpression is not None and not isinstance(self.derivedSequenceExpression, DerivedSequenceExpression): + if self.derivedSequenceExpression is not None and not isinstance( + self.derivedSequenceExpression, DerivedSequenceExpression + ): self.derivedSequenceExpression = DerivedSequenceExpression(**as_dict(self.derivedSequenceExpression)) if self.indefiniteRange is not None and not isinstance(self.indefiniteRange, IndefiniteRange): self.indefiniteRange = IndefiniteRange(**as_dict(self.indefiniteRange)) - if self.literalSequenceExpression is not None and not isinstance(self.literalSequenceExpression, LiteralSequenceExpression): + if self.literalSequenceExpression is not None and not isinstance( + self.literalSequenceExpression, LiteralSequenceExpression + ): self.literalSequenceExpression = LiteralSequenceExpression(**as_dict(self.literalSequenceExpression)) if self.number is not None and not isinstance(self.number, Number): @@ -2209,13 +2307,19 @@ class SequenceExpression(YAMLRoot): repeatedSequenceExpression: Optional[Union[dict, RepeatedSequenceExpression]] = None def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): - if self.derivedSequenceExpression is not None and not isinstance(self.derivedSequenceExpression, DerivedSequenceExpression): + if self.derivedSequenceExpression is not None and not isinstance( + self.derivedSequenceExpression, DerivedSequenceExpression + ): self.derivedSequenceExpression = DerivedSequenceExpression(**as_dict(self.derivedSequenceExpression)) - if self.literalSequenceExpression is not None and not isinstance(self.literalSequenceExpression, LiteralSequenceExpression): + if self.literalSequenceExpression is not None and not isinstance( + self.literalSequenceExpression, LiteralSequenceExpression + ): self.literalSequenceExpression = LiteralSequenceExpression(**as_dict(self.literalSequenceExpression)) - if self.repeatedSequenceExpression is not None and not isinstance(self.repeatedSequenceExpression, RepeatedSequenceExpression): + if self.repeatedSequenceExpression is not None and not isinstance( + self.repeatedSequenceExpression, RepeatedSequenceExpression + ): self.repeatedSequenceExpression = RepeatedSequenceExpression(**as_dict(self.repeatedSequenceExpression)) super().__post_init__(**kwargs) @@ -2436,87 +2540,105 @@ class MondoDiseaseTerms(EnumDefinitionImpl): Mondo Disease Ontology provides a comprehensive logically structured ontology of diseases that integrates multiple other disease ontologies. """ + _defn = EnumDefinition( name="MondoDiseaseTerms", description="Mondo Disease Ontology provides a comprehensive logically structured ontology of diseases that integrates multiple other disease ontologies.", ) + class NCITDiseaseTerms(EnumDefinitionImpl): """ All disease terms from the NCI Thesaurus """ + _defn = EnumDefinition( name="NCITDiseaseTerms", description="All disease terms from the NCI Thesaurus", ) + class NCITNeoplasmTerms(EnumDefinitionImpl): """ All neoplasm terms from the NCI Thesaurus """ + _defn = EnumDefinition( name="NCITNeoplasmTerms", description="All neoplasm terms from the NCI Thesaurus", ) + class HPOAbnormalityTerms(EnumDefinitionImpl): """ The Human Phenotype Ontology (HPO) provides a comprehensive logical standard to describe and computationally analyze phenotypic abnormalities found in human disease. """ + _defn = EnumDefinition( name="HPOAbnormalityTerms", description="The Human Phenotype Ontology (HPO) provides a comprehensive logical standard to describe and computationally analyze phenotypic abnormalities found in human disease.", ) + class UberonAnatomicalEntityTerms(EnumDefinitionImpl): """ UBERON is an integrated cross-species ontology with classes representing a variety of anatomical entities. """ + _defn = EnumDefinition( name="UberonAnatomicalEntityTerms", description="UBERON is an integrated cross-species ontology with classes representing a variety of anatomical entities.", ) + class HGNCGeneTerms(EnumDefinitionImpl): """ The HUGO Gene Nomenclature Committee (HGNC) provides standard names, symbols, and IDs for human genes. """ + _defn = EnumDefinition( name="HGNCGeneTerms", description="The HUGO Gene Nomenclature Committee (HGNC) provides standard names, symbols, and IDs for human genes.", ) + class UOUnitTerms(EnumDefinitionImpl): """ The Units of measurement ontology (denoted UO) provides terms for units commonly encountered in medical data. The following table shows some typical examples. """ + _defn = EnumDefinition( name="UOUnitTerms", description="The Units of measurement ontology (denoted UO) provides terms for units commonly encountered in medical data. The following table shows some typical examples.", ) + class GENOZygosityTerms(EnumDefinitionImpl): """ GENO is an ontology of genotypes their more fundamental sequence components. This enum refers to the zygosity subset of GENO """ + _defn = EnumDefinition( name="GENOZygosityTerms", description="GENO is an ontology of genotypes their more fundamental sequence components. This enum refers to the zygosity subset of GENO", ) + class LOINCMeasurementTerms(EnumDefinitionImpl): """ Logical Observation Identifiers Names and Codes (LOINC) is a database and universal standard for identifying medical laboratory observations. It can be used to denote clinical assays in the Measurement element. examples: """ + _defn = EnumDefinition( name="LOINCMeasurementTerms", description="Logical Observation Identifiers Names and Codes (LOINC) is a database and universal standard for identifying medical laboratory observations. It can be used to denote clinical assays in the Measurement element. examples:", ) + class AcmgPathogenicityClassification(EnumDefinitionImpl): BENIGN = PermissibleValue(text="BENIGN") @@ -2530,6 +2652,7 @@ class AcmgPathogenicityClassification(EnumDefinitionImpl): name="AcmgPathogenicityClassification", ) + class InterpretationStatus(EnumDefinitionImpl): CANDIDATE = PermissibleValue(text="CANDIDATE") @@ -2542,6 +2665,7 @@ class InterpretationStatus(EnumDefinitionImpl): name="InterpretationStatus", ) + class ProgressStatus(EnumDefinitionImpl): COMPLETED = PermissibleValue(text="COMPLETED") @@ -2554,6 +2678,7 @@ class ProgressStatus(EnumDefinitionImpl): name="ProgressStatus", ) + class TherapeuticActionability(EnumDefinitionImpl): ACTIONABLE = PermissibleValue(text="ACTIONABLE") @@ -2564,10 +2689,12 @@ class TherapeuticActionability(EnumDefinitionImpl): name="TherapeuticActionability", ) + class KaryotypicSex(EnumDefinitionImpl): """ Karyotypic sex of the individual """ + OTHER_KARYOTYPE = PermissibleValue(text="OTHER_KARYOTYPE") UNKNOWN_KARYOTYPE = PermissibleValue(text="UNKNOWN_KARYOTYPE") XO = PermissibleValue(text="XO") @@ -2585,29 +2712,31 @@ class KaryotypicSex(EnumDefinitionImpl): description="Karyotypic sex of the individual", ) + class Sex(EnumDefinitionImpl): """ Sex of an individual FHIR mapping: AdministrativeGender (https://www.hl7.org/fhir/codesystem-administrative-gender.html) """ - FEMALE = PermissibleValue(text="FEMALE", - description="Female") - MALE = PermissibleValue(text="MALE", - description="Male") - OTHER_SEX = PermissibleValue(text="OTHER_SEX", - description="It is not possible, to accurately assess the applicability of MALE/FEMALE.") - UNKNOWN_SEX = PermissibleValue(text="UNKNOWN_SEX", - description="Not assessed / available.") + + FEMALE = PermissibleValue(text="FEMALE", description="Female") + MALE = PermissibleValue(text="MALE", description="Male") + OTHER_SEX = PermissibleValue( + text="OTHER_SEX", description="It is not possible, to accurately assess the applicability of MALE/FEMALE." + ) + UNKNOWN_SEX = PermissibleValue(text="UNKNOWN_SEX", description="Not assessed / available.") _defn = EnumDefinition( name="Sex", description="Sex of an individual FHIR mapping: AdministrativeGender (https://www.hl7.org/fhir/codesystem-administrative-gender.html)", ) + class Status(EnumDefinitionImpl): """ Default = false i.e. the individual is alive. MUST be true if """ + ALIVE = PermissibleValue(text="ALIVE") DECEASED = PermissibleValue(text="DECEASED") UNKNOWN_STATUS = PermissibleValue(text="UNKNOWN_STATUS") @@ -2617,10 +2746,12 @@ class Status(EnumDefinitionImpl): description="Default = false i.e. the individual is alive. MUST be true if", ) + class DrugType(EnumDefinitionImpl): """ A simplified version of ODHSI-DRUG_EXPOSURE """ + ADMINISTRATION_RELATED_TO_PROCEDURE = PermissibleValue(text="ADMINISTRATION_RELATED_TO_PROCEDURE") EHR_MEDICATION_LIST = PermissibleValue(text="EHR_MEDICATION_LIST") PRESCRIPTION = PermissibleValue(text="PRESCRIPTION") @@ -2631,6 +2762,7 @@ class DrugType(EnumDefinitionImpl): description="A simplified version of ODHSI-DRUG_EXPOSURE", ) + class RegimenStatus(EnumDefinitionImpl): COMPLETED = PermissibleValue(text="COMPLETED") @@ -2642,6 +2774,7 @@ class RegimenStatus(EnumDefinitionImpl): name="RegimenStatus", ) + class AffectedStatus(EnumDefinitionImpl): AFFECTED = PermissibleValue(text="AFFECTED") @@ -2652,424 +2785,271 @@ class AffectedStatus(EnumDefinitionImpl): name="AffectedStatus", ) + class AllelicStateTerms(EnumDefinitionImpl): - HETEROZYGOUS = PermissibleValue(text="HETEROZYGOUS", - description="heterozygous", - meaning=GENO["0000135"]) - HOMOZYGOUS = PermissibleValue(text="HOMOZYGOUS", - description="homozygous", - meaning=GENO["0000136"]) - HEMIZYGOUS = PermissibleValue(text="HEMIZYGOUS", - description="hemizygous", - meaning=GENO["0000134"]) + HETEROZYGOUS = PermissibleValue(text="HETEROZYGOUS", description="heterozygous", meaning=GENO["0000135"]) + HOMOZYGOUS = PermissibleValue(text="HOMOZYGOUS", description="homozygous", meaning=GENO["0000136"]) + HEMIZYGOUS = PermissibleValue(text="HEMIZYGOUS", description="hemizygous", meaning=GENO["0000134"]) _defn = EnumDefinition( name="AllelicStateTerms", ) + class AssaysTerms(EnumDefinitionImpl): - CREATINE_KINASE = PermissibleValue(text="CREATINE_KINASE", - description="Creatine kinase [Enzymatic activity/volume] in Serum or Plasma", - meaning=LOINC["2157-6"]) + CREATINE_KINASE = PermissibleValue( + text="CREATINE_KINASE", + description="Creatine kinase [Enzymatic activity/volume] in Serum or Plasma", + meaning=LOINC["2157-6"], + ) _defn = EnumDefinition( name="AssaysTerms", ) + class GenderTerms(EnumDefinitionImpl): - IDENTIFIES_AS_MALE = PermissibleValue(text="IDENTIFIES_AS_MALE", - description="Identifies as male", - meaning=LOINC["LA22878-5"]) - IDENTIFIES_AS_FEMALE = PermissibleValue(text="IDENTIFIES_AS_FEMALE", - description="Identifies as female", - meaning=LOINC["LA22879-3"]) - FEMALE_TO_MALE_TRANSSEXUAL = PermissibleValue(text="FEMALE_TO_MALE_TRANSSEXUAL", - description="Female-to-male transsexual", - meaning=LOINC["LA22880-1"]) - MALE_TO_FEMALE_TRANSSEXUAL = PermissibleValue(text="MALE_TO_FEMALE_TRANSSEXUAL", - description="Male-to-female transsexual", - meaning=LOINC["LA22881-9"]) - IDENTIFIES_AS_NON_CONFORMING = PermissibleValue(text="IDENTIFIES_AS_NON_CONFORMING", - description="Identifies as non-conforming", - meaning=LOINC["LA22882-7"]) - OTHER_GENDER = PermissibleValue(text="OTHER_GENDER", - description="other", - meaning=LOINC["LA46-8"]) - ASKED_BUT_UNKNOWN = PermissibleValue(text="ASKED_BUT_UNKNOWN", - description="Asked but unknown", - meaning=LOINC["LA20384-6"]) + IDENTIFIES_AS_MALE = PermissibleValue( + text="IDENTIFIES_AS_MALE", description="Identifies as male", meaning=LOINC["LA22878-5"] + ) + IDENTIFIES_AS_FEMALE = PermissibleValue( + text="IDENTIFIES_AS_FEMALE", description="Identifies as female", meaning=LOINC["LA22879-3"] + ) + FEMALE_TO_MALE_TRANSSEXUAL = PermissibleValue( + text="FEMALE_TO_MALE_TRANSSEXUAL", description="Female-to-male transsexual", meaning=LOINC["LA22880-1"] + ) + MALE_TO_FEMALE_TRANSSEXUAL = PermissibleValue( + text="MALE_TO_FEMALE_TRANSSEXUAL", description="Male-to-female transsexual", meaning=LOINC["LA22881-9"] + ) + IDENTIFIES_AS_NON_CONFORMING = PermissibleValue( + text="IDENTIFIES_AS_NON_CONFORMING", description="Identifies as non-conforming", meaning=LOINC["LA22882-7"] + ) + OTHER_GENDER = PermissibleValue(text="OTHER_GENDER", description="other", meaning=LOINC["LA46-8"]) + ASKED_BUT_UNKNOWN = PermissibleValue( + text="ASKED_BUT_UNKNOWN", description="Asked but unknown", meaning=LOINC["LA20384-6"] + ) _defn = EnumDefinition( name="GenderTerms", ) + class LateralityTerms(EnumDefinitionImpl): - RIGHT = PermissibleValue(text="RIGHT", - description="Right", - meaning=HP["0012834"]) - LEFT = PermissibleValue(text="LEFT", - description="Left", - meaning=HP["0012835"]) - UNILATERAL = PermissibleValue(text="UNILATERAL", - description="Unilateral", - meaning=HP["0012833"]) - BILATERAL = PermissibleValue(text="BILATERAL", - description="Bilateral", - meaning=HP["0012832"]) + RIGHT = PermissibleValue(text="RIGHT", description="Right", meaning=HP["0012834"]) + LEFT = PermissibleValue(text="LEFT", description="Left", meaning=HP["0012835"]) + UNILATERAL = PermissibleValue(text="UNILATERAL", description="Unilateral", meaning=HP["0012833"]) + BILATERAL = PermissibleValue(text="BILATERAL", description="Bilateral", meaning=HP["0012832"]) _defn = EnumDefinition( name="LateralityTerms", ) + class MedicalActionsTerms(EnumDefinitionImpl): - ADVERSE_EVENT = PermissibleValue(text="ADVERSE_EVENT", - description="Adverse Event", - meaning=NCIT.C41331) - FOUR_TIMES_DAILY = PermissibleValue(text="FOUR_TIMES_DAILY", - description="Four Times Daily", - meaning=NCIT.C64530) - INTRA_ARTERIAL = PermissibleValue(text="INTRA_ARTERIAL", - description="Intraarterial Route of Administration", - meaning=NCIT.C38222) - IV_ADMINISTRATION = PermissibleValue(text="IV_ADMINISTRATION", - description="Intravenous Route of Administration", - meaning=NCIT.C38276) - ORAL_ADMINISTRATION = PermissibleValue(text="ORAL_ADMINISTRATION", - description="Oral Route of Administration", - meaning=NCIT.C38288) - ONCE = PermissibleValue(text="ONCE", - description="Once", - meaning=NCIT.C64576) - ONCE_DAILY = PermissibleValue(text="ONCE_DAILY", - description="Once Daily", - meaning=NCIT.C125004) - THREE_TIMES_DAILY = PermissibleValue(text="THREE_TIMES_DAILY", - description="Three Times Daily", - meaning=NCIT.C64527) - TWICE_DAILY = PermissibleValue(text="TWICE_DAILY", - description="Twice Daily", - meaning=NCIT.C64496) + ADVERSE_EVENT = PermissibleValue(text="ADVERSE_EVENT", description="Adverse Event", meaning=NCIT.C41331) + FOUR_TIMES_DAILY = PermissibleValue(text="FOUR_TIMES_DAILY", description="Four Times Daily", meaning=NCIT.C64530) + INTRA_ARTERIAL = PermissibleValue( + text="INTRA_ARTERIAL", description="Intraarterial Route of Administration", meaning=NCIT.C38222 + ) + IV_ADMINISTRATION = PermissibleValue( + text="IV_ADMINISTRATION", description="Intravenous Route of Administration", meaning=NCIT.C38276 + ) + ORAL_ADMINISTRATION = PermissibleValue( + text="ORAL_ADMINISTRATION", description="Oral Route of Administration", meaning=NCIT.C38288 + ) + ONCE = PermissibleValue(text="ONCE", description="Once", meaning=NCIT.C64576) + ONCE_DAILY = PermissibleValue(text="ONCE_DAILY", description="Once Daily", meaning=NCIT.C125004) + THREE_TIMES_DAILY = PermissibleValue(text="THREE_TIMES_DAILY", description="Three Times Daily", meaning=NCIT.C64527) + TWICE_DAILY = PermissibleValue(text="TWICE_DAILY", description="Twice Daily", meaning=NCIT.C64496) _defn = EnumDefinition( name="MedicalActionsTerms", ) + class OnsetTerms(EnumDefinitionImpl): - ANTENATAL_ONSET = PermissibleValue(text="ANTENATAL_ONSET", - description="Antenatal onset", - meaning=HP["0030674"]) - EMBRYONAL_ONSET = PermissibleValue(text="EMBRYONAL_ONSET", - description="Embryonal onset", - meaning=HP["0011460"]) - FETAL_ONSET = PermissibleValue(text="FETAL_ONSET", - description="Fetal onset", - meaning=HP["0011461"]) - LATE_FIRST_TRIMESTER_ONSET = PermissibleValue(text="LATE_FIRST_TRIMESTER_ONSET", - description="Late first trimester onset", - meaning=HP["0034199"]) - SECOND_TRIMESTER_ONSET = PermissibleValue(text="SECOND_TRIMESTER_ONSET", - description="Second trimester onset", - meaning=HP["0034198"]) - THIRD_TRIMESTER_ONSET = PermissibleValue(text="THIRD_TRIMESTER_ONSET", - description="Third trimester onset", - meaning=HP["0034197"]) - CONGENITAL_ONSET = PermissibleValue(text="CONGENITAL_ONSET", - description="Congenital onset", - meaning=HP["0003577"]) - NEONATAL_ONSET = PermissibleValue(text="NEONATAL_ONSET", - description="Neonatal onset", - meaning=HP["0003623"]) - INFANTILE_ONSET = PermissibleValue(text="INFANTILE_ONSET", - description="Infantile onset", - meaning=HP["0003593"]) - CHILDHOOD_ONSET = PermissibleValue(text="CHILDHOOD_ONSET", - description="Childhood onset", - meaning=HP["0011463"]) - JUVENILE_ONSET = PermissibleValue(text="JUVENILE_ONSET", - description="Juvenile onset", - meaning=HP["0003621"]) - ADULT_ONSET = PermissibleValue(text="ADULT_ONSET", - description="Adult onset", - meaning=HP["0003581"]) - YOUNG_ADULT_ONSET = PermissibleValue(text="YOUNG_ADULT_ONSET", - description="Young adult onset", - meaning=HP["0011462"]) - EARLY_YOUNG_ADULT_ONSET = PermissibleValue(text="EARLY_YOUNG_ADULT_ONSET", - description="Early young adult onset", - meaning=HP["0025708"]) - INTERMEDIATE_YOUNG_ADULT_ONSET = PermissibleValue(text="INTERMEDIATE_YOUNG_ADULT_ONSET", - description="Intermediate young adult onset", - meaning=HP["0025709"]) - LATE_YOUNG_ADULT_ONSET = PermissibleValue(text="LATE_YOUNG_ADULT_ONSET", - description="Late young adult onset", - meaning=HP["0025710"]) - MIDDLE_AGE_ONSET = PermissibleValue(text="MIDDLE_AGE_ONSET", - description="Middle age onset", - meaning=HP["0003596"]) - LATE_ONSET = PermissibleValue(text="LATE_ONSET", - description="Late onset", - meaning=HP["0003584"]) + ANTENATAL_ONSET = PermissibleValue(text="ANTENATAL_ONSET", description="Antenatal onset", meaning=HP["0030674"]) + EMBRYONAL_ONSET = PermissibleValue(text="EMBRYONAL_ONSET", description="Embryonal onset", meaning=HP["0011460"]) + FETAL_ONSET = PermissibleValue(text="FETAL_ONSET", description="Fetal onset", meaning=HP["0011461"]) + LATE_FIRST_TRIMESTER_ONSET = PermissibleValue( + text="LATE_FIRST_TRIMESTER_ONSET", description="Late first trimester onset", meaning=HP["0034199"] + ) + SECOND_TRIMESTER_ONSET = PermissibleValue( + text="SECOND_TRIMESTER_ONSET", description="Second trimester onset", meaning=HP["0034198"] + ) + THIRD_TRIMESTER_ONSET = PermissibleValue( + text="THIRD_TRIMESTER_ONSET", description="Third trimester onset", meaning=HP["0034197"] + ) + CONGENITAL_ONSET = PermissibleValue(text="CONGENITAL_ONSET", description="Congenital onset", meaning=HP["0003577"]) + NEONATAL_ONSET = PermissibleValue(text="NEONATAL_ONSET", description="Neonatal onset", meaning=HP["0003623"]) + INFANTILE_ONSET = PermissibleValue(text="INFANTILE_ONSET", description="Infantile onset", meaning=HP["0003593"]) + CHILDHOOD_ONSET = PermissibleValue(text="CHILDHOOD_ONSET", description="Childhood onset", meaning=HP["0011463"]) + JUVENILE_ONSET = PermissibleValue(text="JUVENILE_ONSET", description="Juvenile onset", meaning=HP["0003621"]) + ADULT_ONSET = PermissibleValue(text="ADULT_ONSET", description="Adult onset", meaning=HP["0003581"]) + YOUNG_ADULT_ONSET = PermissibleValue( + text="YOUNG_ADULT_ONSET", description="Young adult onset", meaning=HP["0011462"] + ) + EARLY_YOUNG_ADULT_ONSET = PermissibleValue( + text="EARLY_YOUNG_ADULT_ONSET", description="Early young adult onset", meaning=HP["0025708"] + ) + INTERMEDIATE_YOUNG_ADULT_ONSET = PermissibleValue( + text="INTERMEDIATE_YOUNG_ADULT_ONSET", description="Intermediate young adult onset", meaning=HP["0025709"] + ) + LATE_YOUNG_ADULT_ONSET = PermissibleValue( + text="LATE_YOUNG_ADULT_ONSET", description="Late young adult onset", meaning=HP["0025710"] + ) + MIDDLE_AGE_ONSET = PermissibleValue(text="MIDDLE_AGE_ONSET", description="Middle age onset", meaning=HP["0003596"]) + LATE_ONSET = PermissibleValue(text="LATE_ONSET", description="Late onset", meaning=HP["0003584"]) _defn = EnumDefinition( name="OnsetTerms", ) + class OrganTerms(EnumDefinitionImpl): - BRAIN = PermissibleValue(text="BRAIN", - description="brain", - meaning=UBERON["0000955"]) - CEREBELLUM = PermissibleValue(text="CEREBELLUM", - description="cerebellum", - meaning=UBERON["0002037"]) - EAR = PermissibleValue(text="EAR", - description="ear", - meaning=UBERON["0001690"]) - EYE = PermissibleValue(text="EYE", - description="eye", - meaning=UBERON["0000970"]) - HEART = PermissibleValue(text="HEART", - description="heart", - meaning=UBERON["0002107"]) - KIDNEY = PermissibleValue(text="KIDNEY", - description="kidney", - meaning=UBERON["0002113"]) - LARGE_INTESTINE = PermissibleValue(text="LARGE_INTESTINE", - description="large intestine", - meaning=UBERON["0000059"]) - LIVER = PermissibleValue(text="LIVER", - description="liver", - meaning=UBERON["0002107"]) - LUNG = PermissibleValue(text="LUNG", - description="lung", - meaning=UBERON["0002048"]) - NOSE = PermissibleValue(text="NOSE", - description="nose", - meaning=UBERON["0000004"]) - SMALL_INTESTINE = PermissibleValue(text="SMALL_INTESTINE", - description="small intestine", - meaning=UBERON["0002108"]) - SPINAL_CORD = PermissibleValue(text="SPINAL_CORD", - description="spinal cord", - meaning=UBERON["0002240"]) - SPLEEN = PermissibleValue(text="SPLEEN", - description="spleen", - meaning=UBERON["0002106"]) - TONGUE = PermissibleValue(text="TONGUE", - description="tongue", - meaning=UBERON["0001723"]) - THYMUS = PermissibleValue(text="THYMUS", - description="thymus", - meaning=UBERON["0002370"]) + BRAIN = PermissibleValue(text="BRAIN", description="brain", meaning=UBERON["0000955"]) + CEREBELLUM = PermissibleValue(text="CEREBELLUM", description="cerebellum", meaning=UBERON["0002037"]) + EAR = PermissibleValue(text="EAR", description="ear", meaning=UBERON["0001690"]) + EYE = PermissibleValue(text="EYE", description="eye", meaning=UBERON["0000970"]) + HEART = PermissibleValue(text="HEART", description="heart", meaning=UBERON["0002107"]) + KIDNEY = PermissibleValue(text="KIDNEY", description="kidney", meaning=UBERON["0002113"]) + LARGE_INTESTINE = PermissibleValue(text="LARGE_INTESTINE", description="large intestine", meaning=UBERON["0000059"]) + LIVER = PermissibleValue(text="LIVER", description="liver", meaning=UBERON["0002107"]) + LUNG = PermissibleValue(text="LUNG", description="lung", meaning=UBERON["0002048"]) + NOSE = PermissibleValue(text="NOSE", description="nose", meaning=UBERON["0000004"]) + SMALL_INTESTINE = PermissibleValue(text="SMALL_INTESTINE", description="small intestine", meaning=UBERON["0002108"]) + SPINAL_CORD = PermissibleValue(text="SPINAL_CORD", description="spinal cord", meaning=UBERON["0002240"]) + SPLEEN = PermissibleValue(text="SPLEEN", description="spleen", meaning=UBERON["0002106"]) + TONGUE = PermissibleValue(text="TONGUE", description="tongue", meaning=UBERON["0001723"]) + THYMUS = PermissibleValue(text="THYMUS", description="thymus", meaning=UBERON["0002370"]) _defn = EnumDefinition( name="OrganTerms", ) + class ResponseTerms(EnumDefinitionImpl): - FAVORABLE = PermissibleValue(text="FAVORABLE", - description="Favorable", - meaning=NCIT.C102560) - UNFAVORABLE = PermissibleValue(text="UNFAVORABLE", - description="Unfavorable", - meaning=NCIT.C102561) + FAVORABLE = PermissibleValue(text="FAVORABLE", description="Favorable", meaning=NCIT.C102560) + UNFAVORABLE = PermissibleValue(text="UNFAVORABLE", description="Unfavorable", meaning=NCIT.C102561) _defn = EnumDefinition( name="ResponseTerms", ) + class SpatialPatternTerms(EnumDefinitionImpl): - PREDOMINANT_SMALL_JOINT_LOCALIZATION = PermissibleValue(text="PREDOMINANT_SMALL_JOINT_LOCALIZATION", - description="Predominant small joint localization", - meaning=HP["0032544"]) - POLYCYCLIC = PermissibleValue(text="POLYCYCLIC", - description="Polycyclic", - meaning=HP["0031450"]) - AXIAL = PermissibleValue(text="AXIAL", - description="Axial", - meaning=HP["0025287"]) - PERILOBULAR = PermissibleValue(text="PERILOBULAR", - description="Perilobular", - meaning=HP["0033813"]) - PARASEPTAL = PermissibleValue(text="PARASEPTAL", - description="Paraseptal", - meaning=HP["0033814"]) - BRONCHOCENTRIC = PermissibleValue(text="BRONCHOCENTRIC", - description="Bronchocentric", - meaning=HP["0033815"]) - CENTRILOBULAR = PermissibleValue(text="CENTRILOBULAR", - description="Centrilobular", - meaning=HP["0033816"]) - MILIARY = PermissibleValue(text="MILIARY", - description="Miliary", - meaning=HP["0033817"]) - GENERALIZED = PermissibleValue(text="GENERALIZED", - description="Generalized", - meaning=HP["0012837"]) - PERILYMPHATIC = PermissibleValue(text="PERILYMPHATIC", - description="Perilymphatic", - meaning=HP["0033819"]) - LOCALIZED = PermissibleValue(text="LOCALIZED", - description="Localized", - meaning=HP["0012838"]) - RETICULAR = PermissibleValue(text="RETICULAR", - description="Reticular", - meaning=HP["0033818"]) - DISTAL = PermissibleValue(text="DISTAL", - description="Distal", - meaning=HP["0012839"]) - CENTRAL = PermissibleValue(text="CENTRAL", - description="Central", - meaning=HP["0030645"]) - UPPER_BODY_PREDOMINANCE = PermissibleValue(text="UPPER_BODY_PREDOMINANCE", - description="Upper-body predominance", - meaning=HP["0025290"]) - JOINT_EXTENSOR_SURFACE_LOCALIZATION = PermissibleValue(text="JOINT_EXTENSOR_SURFACE_LOCALIZATION", - description="Joint extensor surface localization", - meaning=HP["0032539"]) - HERPETIFORM = PermissibleValue(text="HERPETIFORM", - description="Herpetiform", - meaning=HP["0025295"]) - MORBILLIFORM = PermissibleValue(text="MORBILLIFORM", - description="Morbilliform", - meaning=HP["0025296"]) - PERICENTRAL = PermissibleValue(text="PERICENTRAL", - description="Pericentral", - meaning=HP["0030649"]) - DERMATOMAL = PermissibleValue(text="DERMATOMAL", - description="Dermatomal", - meaning=HP["0025294"]) - MIDPERIPHERAL = PermissibleValue(text="MIDPERIPHERAL", - description="Midperipheral", - meaning=HP["0030648"]) - DISTRIBUTED_ALONG_BLASCHKO_LINES = PermissibleValue(text="DISTRIBUTED_ALONG_BLASCHKO_LINES", - description="Distributed along Blaschko lines", - meaning=HP["0025293"]) - ACRAL = PermissibleValue(text="ACRAL", - description="Acral", - meaning=HP["0025292"]) - PARACENTRAL = PermissibleValue(text="PARACENTRAL", - description="Paracentral", - meaning=HP["0030647"]) - LATERAL = PermissibleValue(text="LATERAL", - description="Lateral", - meaning=HP["0025275"]) - PERIPHERAL = PermissibleValue(text="PERIPHERAL", - description="Peripheral", - meaning=HP["0030646"]) - LOWER_BODY_PREDOMINANCE = PermissibleValue(text="LOWER_BODY_PREDOMINANCE", - description="Lower-body predominance", - meaning=HP["0025291"]) - DIFFUSE = PermissibleValue(text="DIFFUSE", - description="Diffuse", - meaning=HP["0020034"]) - PROXIMAL = PermissibleValue(text="PROXIMAL", - description="Proximal", - meaning=HP["0012840"]) - APICAL = PermissibleValue(text="APICAL", - description="Apical", - meaning=HP["0033820"]) - FOCAL = PermissibleValue(text="FOCAL", - description="Focal", - meaning=HP["0030650"]) - MULTIFOCAL = PermissibleValue(text="MULTIFOCAL", - description="Multifocal", - meaning=HP["0030651"]) - JOINT_FLEXOR_SURFACE_LOCALIZATION = PermissibleValue(text="JOINT_FLEXOR_SURFACE_LOCALIZATION", - description="Jointflexorsurfacelocalization", - meaning=HP["0032540"]) + PREDOMINANT_SMALL_JOINT_LOCALIZATION = PermissibleValue( + text="PREDOMINANT_SMALL_JOINT_LOCALIZATION", + description="Predominant small joint localization", + meaning=HP["0032544"], + ) + POLYCYCLIC = PermissibleValue(text="POLYCYCLIC", description="Polycyclic", meaning=HP["0031450"]) + AXIAL = PermissibleValue(text="AXIAL", description="Axial", meaning=HP["0025287"]) + PERILOBULAR = PermissibleValue(text="PERILOBULAR", description="Perilobular", meaning=HP["0033813"]) + PARASEPTAL = PermissibleValue(text="PARASEPTAL", description="Paraseptal", meaning=HP["0033814"]) + BRONCHOCENTRIC = PermissibleValue(text="BRONCHOCENTRIC", description="Bronchocentric", meaning=HP["0033815"]) + CENTRILOBULAR = PermissibleValue(text="CENTRILOBULAR", description="Centrilobular", meaning=HP["0033816"]) + MILIARY = PermissibleValue(text="MILIARY", description="Miliary", meaning=HP["0033817"]) + GENERALIZED = PermissibleValue(text="GENERALIZED", description="Generalized", meaning=HP["0012837"]) + PERILYMPHATIC = PermissibleValue(text="PERILYMPHATIC", description="Perilymphatic", meaning=HP["0033819"]) + LOCALIZED = PermissibleValue(text="LOCALIZED", description="Localized", meaning=HP["0012838"]) + RETICULAR = PermissibleValue(text="RETICULAR", description="Reticular", meaning=HP["0033818"]) + DISTAL = PermissibleValue(text="DISTAL", description="Distal", meaning=HP["0012839"]) + CENTRAL = PermissibleValue(text="CENTRAL", description="Central", meaning=HP["0030645"]) + UPPER_BODY_PREDOMINANCE = PermissibleValue( + text="UPPER_BODY_PREDOMINANCE", description="Upper-body predominance", meaning=HP["0025290"] + ) + JOINT_EXTENSOR_SURFACE_LOCALIZATION = PermissibleValue( + text="JOINT_EXTENSOR_SURFACE_LOCALIZATION", + description="Joint extensor surface localization", + meaning=HP["0032539"], + ) + HERPETIFORM = PermissibleValue(text="HERPETIFORM", description="Herpetiform", meaning=HP["0025295"]) + MORBILLIFORM = PermissibleValue(text="MORBILLIFORM", description="Morbilliform", meaning=HP["0025296"]) + PERICENTRAL = PermissibleValue(text="PERICENTRAL", description="Pericentral", meaning=HP["0030649"]) + DERMATOMAL = PermissibleValue(text="DERMATOMAL", description="Dermatomal", meaning=HP["0025294"]) + MIDPERIPHERAL = PermissibleValue(text="MIDPERIPHERAL", description="Midperipheral", meaning=HP["0030648"]) + DISTRIBUTED_ALONG_BLASCHKO_LINES = PermissibleValue( + text="DISTRIBUTED_ALONG_BLASCHKO_LINES", description="Distributed along Blaschko lines", meaning=HP["0025293"] + ) + ACRAL = PermissibleValue(text="ACRAL", description="Acral", meaning=HP["0025292"]) + PARACENTRAL = PermissibleValue(text="PARACENTRAL", description="Paracentral", meaning=HP["0030647"]) + LATERAL = PermissibleValue(text="LATERAL", description="Lateral", meaning=HP["0025275"]) + PERIPHERAL = PermissibleValue(text="PERIPHERAL", description="Peripheral", meaning=HP["0030646"]) + LOWER_BODY_PREDOMINANCE = PermissibleValue( + text="LOWER_BODY_PREDOMINANCE", description="Lower-body predominance", meaning=HP["0025291"] + ) + DIFFUSE = PermissibleValue(text="DIFFUSE", description="Diffuse", meaning=HP["0020034"]) + PROXIMAL = PermissibleValue(text="PROXIMAL", description="Proximal", meaning=HP["0012840"]) + APICAL = PermissibleValue(text="APICAL", description="Apical", meaning=HP["0033820"]) + FOCAL = PermissibleValue(text="FOCAL", description="Focal", meaning=HP["0030650"]) + MULTIFOCAL = PermissibleValue(text="MULTIFOCAL", description="Multifocal", meaning=HP["0030651"]) + JOINT_FLEXOR_SURFACE_LOCALIZATION = PermissibleValue( + text="JOINT_FLEXOR_SURFACE_LOCALIZATION", description="Jointflexorsurfacelocalization", meaning=HP["0032540"] + ) _defn = EnumDefinition( name="SpatialPatternTerms", ) + class UnitTerms(EnumDefinitionImpl): - DEGREE = PermissibleValue(text="DEGREE", - description="degree (plane angle)", - meaning=UCUM.degree) - DIOPTER = PermissibleValue(text="DIOPTER", - description="diopter", - meaning=UCUM["%5Bdiop%5D"]) - GRAM = PermissibleValue(text="GRAM", - description="gram", - meaning=UCUM.g) - GRAM_PER_KG = PermissibleValue(text="GRAM_PER_KG", - description="gram per kilogram", - meaning=UCUM["g/kg"]) - KILIGRAM = PermissibleValue(text="KILIGRAM", - description="kiligram", - meaning=UCUM.kg) - LITER = PermissibleValue(text="LITER", - description="liter", - meaning=UCUM.L) - METER = PermissibleValue(text="METER", - description="meter", - meaning=UCUM.m) - MICROGRAM = PermissibleValue(text="MICROGRAM", - description="microgram", - meaning=UCUM.ug) - MICROGRAM_PER_DECILITER = PermissibleValue(text="MICROGRAM_PER_DECILITER", - description="microgram per deciliter", - meaning=UCUM["ug/dL"]) - MICROGRAM_PER_LITER = PermissibleValue(text="MICROGRAM_PER_LITER", - description="microgram per liter", - meaning=UCUM["ug/L"]) - MICROLITER = PermissibleValue(text="MICROLITER", - description="microliter", - meaning=UCUM.uL) - MICROMETER = PermissibleValue(text="MICROMETER", - description="micrometer", - meaning=UCUM.um) - MILLIGRAM = PermissibleValue(text="MILLIGRAM", - description="milligram", - meaning=UCUM.mg) - MILLIGRAM_PER_DAY = PermissibleValue(text="MILLIGRAM_PER_DAY", - description="milligram per day", - meaning=UCUM["mg/dL"]) - MILLIGRAM_PER_DL = PermissibleValue(text="MILLIGRAM_PER_DL", - description="milligram per deciliter", - meaning=UCUM["mg/dL"]) - MILLIGRAM_PER_KG = PermissibleValue(text="MILLIGRAM_PER_KG", - description="milligram per kilogram", - meaning=UCUM["mg.kg-1"]) - MILLILITER = PermissibleValue(text="MILLILITER", - description="milliliter", - meaning=UCUM.mL) - MILLIMETER = PermissibleValue(text="MILLIMETER", - description="millimeter", - meaning=UCUM.mm) - MILLIMETRES_OF_MERCURY = PermissibleValue(text="MILLIMETRES_OF_MERCURY", - description="millimetres of mercury", - meaning=UCUM["mm%5BHg%5D"]) - MILLIMOLE = PermissibleValue(text="MILLIMOLE", - description="millimole", - meaning=UCUM.mmol) - MOLE = PermissibleValue(text="MOLE", - description="mole", - meaning=UCUM.mol) - MOLE_PER_LITER = PermissibleValue(text="MOLE_PER_LITER", - description="mole per liter", - meaning=UCUM["mol/L"]) - MOLE_PER_MILLILITER = PermissibleValue(text="MOLE_PER_MILLILITER", - description="mole per milliliter", - meaning=UCUM["mol/mL"]) - ENZYME_UNIT_PER_LITER = PermissibleValue(text="ENZYME_UNIT_PER_LITER", - description="enzyme unit per liter", - meaning=UCUM["U/L"]) + DEGREE = PermissibleValue(text="DEGREE", description="degree (plane angle)", meaning=UCUM.degree) + DIOPTER = PermissibleValue(text="DIOPTER", description="diopter", meaning=UCUM["%5Bdiop%5D"]) + GRAM = PermissibleValue(text="GRAM", description="gram", meaning=UCUM.g) + GRAM_PER_KG = PermissibleValue(text="GRAM_PER_KG", description="gram per kilogram", meaning=UCUM["g/kg"]) + KILIGRAM = PermissibleValue(text="KILIGRAM", description="kiligram", meaning=UCUM.kg) + LITER = PermissibleValue(text="LITER", description="liter", meaning=UCUM.L) + METER = PermissibleValue(text="METER", description="meter", meaning=UCUM.m) + MICROGRAM = PermissibleValue(text="MICROGRAM", description="microgram", meaning=UCUM.ug) + MICROGRAM_PER_DECILITER = PermissibleValue( + text="MICROGRAM_PER_DECILITER", description="microgram per deciliter", meaning=UCUM["ug/dL"] + ) + MICROGRAM_PER_LITER = PermissibleValue( + text="MICROGRAM_PER_LITER", description="microgram per liter", meaning=UCUM["ug/L"] + ) + MICROLITER = PermissibleValue(text="MICROLITER", description="microliter", meaning=UCUM.uL) + MICROMETER = PermissibleValue(text="MICROMETER", description="micrometer", meaning=UCUM.um) + MILLIGRAM = PermissibleValue(text="MILLIGRAM", description="milligram", meaning=UCUM.mg) + MILLIGRAM_PER_DAY = PermissibleValue( + text="MILLIGRAM_PER_DAY", description="milligram per day", meaning=UCUM["mg/dL"] + ) + MILLIGRAM_PER_DL = PermissibleValue( + text="MILLIGRAM_PER_DL", description="milligram per deciliter", meaning=UCUM["mg/dL"] + ) + MILLIGRAM_PER_KG = PermissibleValue( + text="MILLIGRAM_PER_KG", description="milligram per kilogram", meaning=UCUM["mg.kg-1"] + ) + MILLILITER = PermissibleValue(text="MILLILITER", description="milliliter", meaning=UCUM.mL) + MILLIMETER = PermissibleValue(text="MILLIMETER", description="millimeter", meaning=UCUM.mm) + MILLIMETRES_OF_MERCURY = PermissibleValue( + text="MILLIMETRES_OF_MERCURY", description="millimetres of mercury", meaning=UCUM["mm%5BHg%5D"] + ) + MILLIMOLE = PermissibleValue(text="MILLIMOLE", description="millimole", meaning=UCUM.mmol) + MOLE = PermissibleValue(text="MOLE", description="mole", meaning=UCUM.mol) + MOLE_PER_LITER = PermissibleValue(text="MOLE_PER_LITER", description="mole per liter", meaning=UCUM["mol/L"]) + MOLE_PER_MILLILITER = PermissibleValue( + text="MOLE_PER_MILLILITER", description="mole per milliliter", meaning=UCUM["mol/mL"] + ) + ENZYME_UNIT_PER_LITER = PermissibleValue( + text="ENZYME_UNIT_PER_LITER", description="enzyme unit per liter", meaning=UCUM["U/L"] + ) _defn = EnumDefinition( name="UnitTerms", ) + class MoleculeContext(EnumDefinitionImpl): genomic = PermissibleValue(text="genomic") @@ -3081,882 +3061,2648 @@ class MoleculeContext(EnumDefinitionImpl): name="MoleculeContext", ) + # Slots class slots: pass -slots.cohort__description = Slot(uri=PHENOPACKETS.description, name="cohort__description", curie=PHENOPACKETS.curie('description'), - model_uri=PHENOPACKETS.cohort__description, domain=None, range=Optional[str]) - -slots.cohort__files = Slot(uri=PHENOPACKETS.files, name="cohort__files", curie=PHENOPACKETS.curie('files'), - model_uri=PHENOPACKETS.cohort__files, domain=None, range=Optional[Union[Union[dict, File], list[Union[dict, File]]]]) - -slots.cohort__id = Slot(uri=PHENOPACKETS.id, name="cohort__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.cohort__id, domain=None, range=Optional[str]) - -slots.cohort__members = Slot(uri=PHENOPACKETS.members, name="cohort__members", curie=PHENOPACKETS.curie('members'), - model_uri=PHENOPACKETS.cohort__members, domain=None, range=Optional[Union[Union[dict, Phenopacket], list[Union[dict, Phenopacket]]]]) - -slots.cohort__metaData = Slot(uri=PHENOPACKETS.metaData, name="cohort__metaData", curie=PHENOPACKETS.curie('metaData'), - model_uri=PHENOPACKETS.cohort__metaData, domain=None, range=Union[dict, MetaData]) - -slots.family__consanguinousParents = Slot(uri=PHENOPACKETS.consanguinousParents, name="family__consanguinousParents", curie=PHENOPACKETS.curie('consanguinousParents'), - model_uri=PHENOPACKETS.family__consanguinousParents, domain=None, range=Optional[Union[bool, Bool]]) - -slots.family__files = Slot(uri=PHENOPACKETS.files, name="family__files", curie=PHENOPACKETS.curie('files'), - model_uri=PHENOPACKETS.family__files, domain=None, range=Optional[Union[Union[dict, File], list[Union[dict, File]]]]) - -slots.family__id = Slot(uri=PHENOPACKETS.id, name="family__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.family__id, domain=None, range=Optional[str]) - -slots.family__metaData = Slot(uri=PHENOPACKETS.metaData, name="family__metaData", curie=PHENOPACKETS.curie('metaData'), - model_uri=PHENOPACKETS.family__metaData, domain=None, range=Union[dict, MetaData]) - -slots.family__pedigree = Slot(uri=PHENOPACKETS.pedigree, name="family__pedigree", curie=PHENOPACKETS.curie('pedigree'), - model_uri=PHENOPACKETS.family__pedigree, domain=None, range=Optional[Union[dict, Pedigree]]) - -slots.family__proband = Slot(uri=PHENOPACKETS.proband, name="family__proband", curie=PHENOPACKETS.curie('proband'), - model_uri=PHENOPACKETS.family__proband, domain=None, range=Optional[Union[dict, Phenopacket]]) - -slots.family__relatives = Slot(uri=PHENOPACKETS.relatives, name="family__relatives", curie=PHENOPACKETS.curie('relatives'), - model_uri=PHENOPACKETS.family__relatives, domain=None, range=Optional[Union[Union[dict, Phenopacket], list[Union[dict, Phenopacket]]]]) - -slots.phenopacket__biosamples = Slot(uri=PHENOPACKETS.biosamples, name="phenopacket__biosamples", curie=PHENOPACKETS.curie('biosamples'), - model_uri=PHENOPACKETS.phenopacket__biosamples, domain=None, range=Optional[Union[Union[dict, Biosample], list[Union[dict, Biosample]]]]) - -slots.phenopacket__diseases = Slot(uri=PHENOPACKETS.diseases, name="phenopacket__diseases", curie=PHENOPACKETS.curie('diseases'), - model_uri=PHENOPACKETS.phenopacket__diseases, domain=None, range=Optional[Union[Union[dict, Disease], list[Union[dict, Disease]]]]) - -slots.phenopacket__files = Slot(uri=PHENOPACKETS.files, name="phenopacket__files", curie=PHENOPACKETS.curie('files'), - model_uri=PHENOPACKETS.phenopacket__files, domain=None, range=Optional[Union[Union[dict, File], list[Union[dict, File]]]]) - -slots.phenopacket__id = Slot(uri=PHENOPACKETS.id, name="phenopacket__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.phenopacket__id, domain=None, range=Optional[str]) - -slots.phenopacket__interpretations = Slot(uri=PHENOPACKETS.interpretations, name="phenopacket__interpretations", curie=PHENOPACKETS.curie('interpretations'), - model_uri=PHENOPACKETS.phenopacket__interpretations, domain=None, range=Optional[Union[Union[dict, Interpretation], list[Union[dict, Interpretation]]]]) - -slots.phenopacket__measurements = Slot(uri=PHENOPACKETS.measurements, name="phenopacket__measurements", curie=PHENOPACKETS.curie('measurements'), - model_uri=PHENOPACKETS.phenopacket__measurements, domain=None, range=Optional[Union[Union[dict, Measurement], list[Union[dict, Measurement]]]]) - -slots.phenopacket__medicalActions = Slot(uri=PHENOPACKETS.medicalActions, name="phenopacket__medicalActions", curie=PHENOPACKETS.curie('medicalActions'), - model_uri=PHENOPACKETS.phenopacket__medicalActions, domain=None, range=Optional[Union[Union[dict, MedicalAction], list[Union[dict, MedicalAction]]]]) - -slots.phenopacket__metaData = Slot(uri=PHENOPACKETS.metaData, name="phenopacket__metaData", curie=PHENOPACKETS.curie('metaData'), - model_uri=PHENOPACKETS.phenopacket__metaData, domain=None, range=Union[dict, MetaData]) - -slots.phenopacket__phenotypicFeatures = Slot(uri=PHENOPACKETS.phenotypicFeatures, name="phenopacket__phenotypicFeatures", curie=PHENOPACKETS.curie('phenotypicFeatures'), - model_uri=PHENOPACKETS.phenopacket__phenotypicFeatures, domain=None, range=Optional[Union[Union[dict, PhenotypicFeature], list[Union[dict, PhenotypicFeature]]]]) - -slots.phenopacket__subject = Slot(uri=PHENOPACKETS.subject, name="phenopacket__subject", curie=PHENOPACKETS.curie('subject'), - model_uri=PHENOPACKETS.phenopacket__subject, domain=None, range=Optional[Union[dict, Individual]]) - -slots.age__iso8601duration = Slot(uri=PHENOPACKETS.iso8601duration, name="age__iso8601duration", curie=PHENOPACKETS.curie('iso8601duration'), - model_uri=PHENOPACKETS.age__iso8601duration, domain=None, range=Optional[str]) - -slots.ageRange__end = Slot(uri=PHENOPACKETS.end, name="ageRange__end", curie=PHENOPACKETS.curie('end'), - model_uri=PHENOPACKETS.ageRange__end, domain=None, range=Optional[Union[dict, Age]]) - -slots.ageRange__start = Slot(uri=PHENOPACKETS.start, name="ageRange__start", curie=PHENOPACKETS.curie('start'), - model_uri=PHENOPACKETS.ageRange__start, domain=None, range=Optional[Union[dict, Age]]) - -slots.evidence__evidenceCode = Slot(uri=PHENOPACKETS.evidenceCode, name="evidence__evidenceCode", curie=PHENOPACKETS.curie('evidenceCode'), - model_uri=PHENOPACKETS.evidence__evidenceCode, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.evidence__reference = Slot(uri=PHENOPACKETS.reference, name="evidence__reference", curie=PHENOPACKETS.curie('reference'), - model_uri=PHENOPACKETS.evidence__reference, domain=None, range=Optional[Union[dict, ExternalReference]]) - -slots.externalReference__description = Slot(uri=PHENOPACKETS.description, name="externalReference__description", curie=PHENOPACKETS.curie('description'), - model_uri=PHENOPACKETS.externalReference__description, domain=None, range=Optional[str]) - -slots.externalReference__id = Slot(uri=PHENOPACKETS.id, name="externalReference__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.externalReference__id, domain=None, range=Optional[str]) - -slots.externalReference__reference = Slot(uri=PHENOPACKETS.reference, name="externalReference__reference", curie=PHENOPACKETS.curie('reference'), - model_uri=PHENOPACKETS.externalReference__reference, domain=None, range=Optional[str]) - -slots.file__fileAttributes = Slot(uri=PHENOPACKETS.fileAttributes, name="file__fileAttributes", curie=PHENOPACKETS.curie('fileAttributes'), - model_uri=PHENOPACKETS.file__fileAttributes, domain=None, range=Optional[Union[dict, Dictionary]]) - -slots.file__individualToFileIdentifiers = Slot(uri=PHENOPACKETS.individualToFileIdentifiers, name="file__individualToFileIdentifiers", curie=PHENOPACKETS.curie('individualToFileIdentifiers'), - model_uri=PHENOPACKETS.file__individualToFileIdentifiers, domain=None, range=Optional[Union[dict, Dictionary]]) - -slots.file__uri = Slot(uri=PHENOPACKETS.uri, name="file__uri", curie=PHENOPACKETS.curie('uri'), - model_uri=PHENOPACKETS.file__uri, domain=None, range=Optional[str]) - -slots.gestationalAge__days = Slot(uri=PHENOPACKETS.days, name="gestationalAge__days", curie=PHENOPACKETS.curie('days'), - model_uri=PHENOPACKETS.gestationalAge__days, domain=None, range=Optional[int]) - -slots.gestationalAge__weeks = Slot(uri=PHENOPACKETS.weeks, name="gestationalAge__weeks", curie=PHENOPACKETS.curie('weeks'), - model_uri=PHENOPACKETS.gestationalAge__weeks, domain=None, range=Optional[int]) - -slots.ontologyClass__id = Slot(uri=PHENOPACKETS.id, name="ontologyClass__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.ontologyClass__id, domain=None, range=URIRef) - -slots.ontologyClass__label = Slot(uri=PHENOPACKETS.label, name="ontologyClass__label", curie=PHENOPACKETS.curie('label'), - model_uri=PHENOPACKETS.ontologyClass__label, domain=None, range=Optional[str]) - -slots.procedure__bodySite = Slot(uri=PHENOPACKETS.bodySite, name="procedure__bodySite", curie=PHENOPACKETS.curie('bodySite'), - model_uri=PHENOPACKETS.procedure__bodySite, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.procedure__code = Slot(uri=PHENOPACKETS.code, name="procedure__code", curie=PHENOPACKETS.curie('code'), - model_uri=PHENOPACKETS.procedure__code, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.procedure__performed = Slot(uri=PHENOPACKETS.performed, name="procedure__performed", curie=PHENOPACKETS.curie('performed'), - model_uri=PHENOPACKETS.procedure__performed, domain=None, range=Optional[Union[dict, TimeElement]]) - -slots.timeElement__age = Slot(uri=PHENOPACKETS.age, name="timeElement__age", curie=PHENOPACKETS.curie('age'), - model_uri=PHENOPACKETS.timeElement__age, domain=None, range=Optional[Union[dict, Age]]) - -slots.timeElement__ageRange = Slot(uri=PHENOPACKETS.ageRange, name="timeElement__ageRange", curie=PHENOPACKETS.curie('ageRange'), - model_uri=PHENOPACKETS.timeElement__ageRange, domain=None, range=Optional[Union[dict, AgeRange]]) - -slots.timeElement__gestationalAge = Slot(uri=PHENOPACKETS.gestationalAge, name="timeElement__gestationalAge", curie=PHENOPACKETS.curie('gestationalAge'), - model_uri=PHENOPACKETS.timeElement__gestationalAge, domain=None, range=Optional[Union[dict, GestationalAge]]) - -slots.timeElement__interval = Slot(uri=PHENOPACKETS.interval, name="timeElement__interval", curie=PHENOPACKETS.curie('interval'), - model_uri=PHENOPACKETS.timeElement__interval, domain=None, range=Optional[Union[dict, TimeInterval]]) - -slots.timeElement__ontologyClass = Slot(uri=PHENOPACKETS.ontologyClass, name="timeElement__ontologyClass", curie=PHENOPACKETS.curie('ontologyClass'), - model_uri=PHENOPACKETS.timeElement__ontologyClass, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.timeElement__timestamp = Slot(uri=PHENOPACKETS.timestamp, name="timeElement__timestamp", curie=PHENOPACKETS.curie('timestamp'), - model_uri=PHENOPACKETS.timeElement__timestamp, domain=None, range=Optional[str]) - -slots.timeInterval__end = Slot(uri=PHENOPACKETS.end, name="timeInterval__end", curie=PHENOPACKETS.curie('end'), - model_uri=PHENOPACKETS.timeInterval__end, domain=None, range=Optional[str]) - -slots.timeInterval__start = Slot(uri=PHENOPACKETS.start, name="timeInterval__start", curie=PHENOPACKETS.curie('start'), - model_uri=PHENOPACKETS.timeInterval__start, domain=None, range=Optional[str]) - -slots.biosample__derivedFromId = Slot(uri=PHENOPACKETS.derivedFromId, name="biosample__derivedFromId", curie=PHENOPACKETS.curie('derivedFromId'), - model_uri=PHENOPACKETS.biosample__derivedFromId, domain=None, range=Optional[str]) - -slots.biosample__description = Slot(uri=PHENOPACKETS.description, name="biosample__description", curie=PHENOPACKETS.curie('description'), - model_uri=PHENOPACKETS.biosample__description, domain=None, range=Optional[str]) - -slots.biosample__diagnosticMarkers = Slot(uri=PHENOPACKETS.diagnosticMarkers, name="biosample__diagnosticMarkers", curie=PHENOPACKETS.curie('diagnosticMarkers'), - model_uri=PHENOPACKETS.biosample__diagnosticMarkers, domain=None, range=Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]]) - -slots.biosample__files = Slot(uri=PHENOPACKETS.files, name="biosample__files", curie=PHENOPACKETS.curie('files'), - model_uri=PHENOPACKETS.biosample__files, domain=None, range=Optional[Union[Union[dict, File], list[Union[dict, File]]]]) - -slots.biosample__histologicalDiagnosis = Slot(uri=PHENOPACKETS.histologicalDiagnosis, name="biosample__histologicalDiagnosis", curie=PHENOPACKETS.curie('histologicalDiagnosis'), - model_uri=PHENOPACKETS.biosample__histologicalDiagnosis, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.biosample__id = Slot(uri=PHENOPACKETS.id, name="biosample__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.biosample__id, domain=None, range=Optional[str]) - -slots.biosample__individualId = Slot(uri=PHENOPACKETS.individualId, name="biosample__individualId", curie=PHENOPACKETS.curie('individualId'), - model_uri=PHENOPACKETS.biosample__individualId, domain=None, range=Optional[str]) - -slots.biosample__materialSample = Slot(uri=PHENOPACKETS.materialSample, name="biosample__materialSample", curie=PHENOPACKETS.curie('materialSample'), - model_uri=PHENOPACKETS.biosample__materialSample, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.biosample__measurements = Slot(uri=PHENOPACKETS.measurements, name="biosample__measurements", curie=PHENOPACKETS.curie('measurements'), - model_uri=PHENOPACKETS.biosample__measurements, domain=None, range=Optional[Union[Union[dict, Measurement], list[Union[dict, Measurement]]]]) - -slots.biosample__pathologicalStage = Slot(uri=PHENOPACKETS.pathologicalStage, name="biosample__pathologicalStage", curie=PHENOPACKETS.curie('pathologicalStage'), - model_uri=PHENOPACKETS.biosample__pathologicalStage, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.biosample__pathologicalTnmFinding = Slot(uri=PHENOPACKETS.pathologicalTnmFinding, name="biosample__pathologicalTnmFinding", curie=PHENOPACKETS.curie('pathologicalTnmFinding'), - model_uri=PHENOPACKETS.biosample__pathologicalTnmFinding, domain=None, range=Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]]) - -slots.biosample__phenotypicFeatures = Slot(uri=PHENOPACKETS.phenotypicFeatures, name="biosample__phenotypicFeatures", curie=PHENOPACKETS.curie('phenotypicFeatures'), - model_uri=PHENOPACKETS.biosample__phenotypicFeatures, domain=None, range=Optional[Union[Union[dict, PhenotypicFeature], list[Union[dict, PhenotypicFeature]]]]) - -slots.biosample__procedure = Slot(uri=PHENOPACKETS.procedure, name="biosample__procedure", curie=PHENOPACKETS.curie('procedure'), - model_uri=PHENOPACKETS.biosample__procedure, domain=None, range=Optional[Union[dict, Procedure]]) - -slots.biosample__sampleProcessing = Slot(uri=PHENOPACKETS.sampleProcessing, name="biosample__sampleProcessing", curie=PHENOPACKETS.curie('sampleProcessing'), - model_uri=PHENOPACKETS.biosample__sampleProcessing, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.biosample__sampleStorage = Slot(uri=PHENOPACKETS.sampleStorage, name="biosample__sampleStorage", curie=PHENOPACKETS.curie('sampleStorage'), - model_uri=PHENOPACKETS.biosample__sampleStorage, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.biosample__sampleType = Slot(uri=PHENOPACKETS.sampleType, name="biosample__sampleType", curie=PHENOPACKETS.curie('sampleType'), - model_uri=PHENOPACKETS.biosample__sampleType, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.biosample__sampledTissue = Slot(uri=PHENOPACKETS.sampledTissue, name="biosample__sampledTissue", curie=PHENOPACKETS.curie('sampledTissue'), - model_uri=PHENOPACKETS.biosample__sampledTissue, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.biosample__taxonomy = Slot(uri=PHENOPACKETS.taxonomy, name="biosample__taxonomy", curie=PHENOPACKETS.curie('taxonomy'), - model_uri=PHENOPACKETS.biosample__taxonomy, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.biosample__timeOfCollection = Slot(uri=PHENOPACKETS.timeOfCollection, name="biosample__timeOfCollection", curie=PHENOPACKETS.curie('timeOfCollection'), - model_uri=PHENOPACKETS.biosample__timeOfCollection, domain=None, range=Optional[Union[dict, TimeElement]]) - -slots.biosample__tumorGrade = Slot(uri=PHENOPACKETS.tumorGrade, name="biosample__tumorGrade", curie=PHENOPACKETS.curie('tumorGrade'), - model_uri=PHENOPACKETS.biosample__tumorGrade, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.biosample__tumorProgression = Slot(uri=PHENOPACKETS.tumorProgression, name="biosample__tumorProgression", curie=PHENOPACKETS.curie('tumorProgression'), - model_uri=PHENOPACKETS.biosample__tumorProgression, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.disease__clinicalTnmFinding = Slot(uri=PHENOPACKETS.clinicalTnmFinding, name="disease__clinicalTnmFinding", curie=PHENOPACKETS.curie('clinicalTnmFinding'), - model_uri=PHENOPACKETS.disease__clinicalTnmFinding, domain=None, range=Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]]) - -slots.disease__diseaseStage = Slot(uri=PHENOPACKETS.diseaseStage, name="disease__diseaseStage", curie=PHENOPACKETS.curie('diseaseStage'), - model_uri=PHENOPACKETS.disease__diseaseStage, domain=None, range=Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]]) - -slots.disease__excluded = Slot(uri=PHENOPACKETS.excluded, name="disease__excluded", curie=PHENOPACKETS.curie('excluded'), - model_uri=PHENOPACKETS.disease__excluded, domain=None, range=Optional[Union[bool, Bool]]) - -slots.disease__laterality = Slot(uri=PHENOPACKETS.laterality, name="disease__laterality", curie=PHENOPACKETS.curie('laterality'), - model_uri=PHENOPACKETS.disease__laterality, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.disease__onset = Slot(uri=PHENOPACKETS.onset, name="disease__onset", curie=PHENOPACKETS.curie('onset'), - model_uri=PHENOPACKETS.disease__onset, domain=None, range=Optional[Union[dict, TimeElement]]) - -slots.disease__primarySite = Slot(uri=PHENOPACKETS.primarySite, name="disease__primarySite", curie=PHENOPACKETS.curie('primarySite'), - model_uri=PHENOPACKETS.disease__primarySite, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.disease__resolution = Slot(uri=PHENOPACKETS.resolution, name="disease__resolution", curie=PHENOPACKETS.curie('resolution'), - model_uri=PHENOPACKETS.disease__resolution, domain=None, range=Optional[Union[dict, TimeElement]]) - -slots.disease__term = Slot(uri=PHENOPACKETS.term, name="disease__term", curie=PHENOPACKETS.curie('term'), - model_uri=PHENOPACKETS.disease__term, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.diagnosis__disease = Slot(uri=PHENOPACKETS.disease, name="diagnosis__disease", curie=PHENOPACKETS.curie('disease'), - model_uri=PHENOPACKETS.diagnosis__disease, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.diagnosis__genomicInterpretations = Slot(uri=PHENOPACKETS.genomicInterpretations, name="diagnosis__genomicInterpretations", curie=PHENOPACKETS.curie('genomicInterpretations'), - model_uri=PHENOPACKETS.diagnosis__genomicInterpretations, domain=None, range=Optional[Union[Union[dict, GenomicInterpretation], list[Union[dict, GenomicInterpretation]]]]) - -slots.genomicInterpretation__gene = Slot(uri=PHENOPACKETS.gene, name="genomicInterpretation__gene", curie=PHENOPACKETS.curie('gene'), - model_uri=PHENOPACKETS.genomicInterpretation__gene, domain=None, range=Optional[Union[dict, GeneDescriptor]]) - -slots.genomicInterpretation__interpretationStatus = Slot(uri=PHENOPACKETS.interpretationStatus, name="genomicInterpretation__interpretationStatus", curie=PHENOPACKETS.curie('interpretationStatus'), - model_uri=PHENOPACKETS.genomicInterpretation__interpretationStatus, domain=None, range=Optional[Union[str, "InterpretationStatus"]]) - -slots.genomicInterpretation__subjectOrBiosampleId = Slot(uri=PHENOPACKETS.subjectOrBiosampleId, name="genomicInterpretation__subjectOrBiosampleId", curie=PHENOPACKETS.curie('subjectOrBiosampleId'), - model_uri=PHENOPACKETS.genomicInterpretation__subjectOrBiosampleId, domain=None, range=Optional[str]) - -slots.genomicInterpretation__variantInterpretation = Slot(uri=PHENOPACKETS.variantInterpretation, name="genomicInterpretation__variantInterpretation", curie=PHENOPACKETS.curie('variantInterpretation'), - model_uri=PHENOPACKETS.genomicInterpretation__variantInterpretation, domain=None, range=Optional[Union[dict, VariantInterpretation]]) - -slots.interpretation__diagnosis = Slot(uri=PHENOPACKETS.diagnosis, name="interpretation__diagnosis", curie=PHENOPACKETS.curie('diagnosis'), - model_uri=PHENOPACKETS.interpretation__diagnosis, domain=None, range=Optional[Union[dict, Diagnosis]]) - -slots.interpretation__id = Slot(uri=PHENOPACKETS.id, name="interpretation__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.interpretation__id, domain=None, range=Optional[str]) - -slots.interpretation__progressStatus = Slot(uri=PHENOPACKETS.progressStatus, name="interpretation__progressStatus", curie=PHENOPACKETS.curie('progressStatus'), - model_uri=PHENOPACKETS.interpretation__progressStatus, domain=None, range=Optional[Union[str, "ProgressStatus"]]) - -slots.interpretation__summary = Slot(uri=PHENOPACKETS.summary, name="interpretation__summary", curie=PHENOPACKETS.curie('summary'), - model_uri=PHENOPACKETS.interpretation__summary, domain=None, range=Optional[str]) - -slots.variantInterpretation__acmgPathogenicityClassification = Slot(uri=PHENOPACKETS.acmgPathogenicityClassification, name="variantInterpretation__acmgPathogenicityClassification", curie=PHENOPACKETS.curie('acmgPathogenicityClassification'), - model_uri=PHENOPACKETS.variantInterpretation__acmgPathogenicityClassification, domain=None, range=Optional[Union[str, "AcmgPathogenicityClassification"]]) - -slots.variantInterpretation__therapeuticActionability = Slot(uri=PHENOPACKETS.therapeuticActionability, name="variantInterpretation__therapeuticActionability", curie=PHENOPACKETS.curie('therapeuticActionability'), - model_uri=PHENOPACKETS.variantInterpretation__therapeuticActionability, domain=None, range=Optional[Union[str, "TherapeuticActionability"]]) - -slots.variantInterpretation__variationDescriptor = Slot(uri=PHENOPACKETS.variationDescriptor, name="variantInterpretation__variationDescriptor", curie=PHENOPACKETS.curie('variationDescriptor'), - model_uri=PHENOPACKETS.variantInterpretation__variationDescriptor, domain=None, range=Optional[Union[dict, VariationDescriptor]]) - -slots.individual__alternateIds = Slot(uri=PHENOPACKETS.alternateIds, name="individual__alternateIds", curie=PHENOPACKETS.curie('alternateIds'), - model_uri=PHENOPACKETS.individual__alternateIds, domain=None, range=Optional[Union[str, list[str]]]) - -slots.individual__dateOfBirth = Slot(uri=PHENOPACKETS.dateOfBirth, name="individual__dateOfBirth", curie=PHENOPACKETS.curie('dateOfBirth'), - model_uri=PHENOPACKETS.individual__dateOfBirth, domain=None, range=Optional[str]) - -slots.individual__gender = Slot(uri=PHENOPACKETS.gender, name="individual__gender", curie=PHENOPACKETS.curie('gender'), - model_uri=PHENOPACKETS.individual__gender, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.individual__id = Slot(uri=PHENOPACKETS.id, name="individual__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.individual__id, domain=None, range=Optional[str]) - -slots.individual__karyotypicSex = Slot(uri=PHENOPACKETS.karyotypicSex, name="individual__karyotypicSex", curie=PHENOPACKETS.curie('karyotypicSex'), - model_uri=PHENOPACKETS.individual__karyotypicSex, domain=None, range=Optional[Union[str, "KaryotypicSex"]]) - -slots.individual__sex = Slot(uri=PHENOPACKETS.sex, name="individual__sex", curie=PHENOPACKETS.curie('sex'), - model_uri=PHENOPACKETS.individual__sex, domain=None, range=Optional[Union[str, "Sex"]]) - -slots.individual__taxonomy = Slot(uri=PHENOPACKETS.taxonomy, name="individual__taxonomy", curie=PHENOPACKETS.curie('taxonomy'), - model_uri=PHENOPACKETS.individual__taxonomy, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.individual__timeAtLastEncounter = Slot(uri=PHENOPACKETS.timeAtLastEncounter, name="individual__timeAtLastEncounter", curie=PHENOPACKETS.curie('timeAtLastEncounter'), - model_uri=PHENOPACKETS.individual__timeAtLastEncounter, domain=None, range=Optional[Union[dict, TimeElement]]) - -slots.individual__vitalStatus = Slot(uri=PHENOPACKETS.vitalStatus, name="individual__vitalStatus", curie=PHENOPACKETS.curie('vitalStatus'), - model_uri=PHENOPACKETS.individual__vitalStatus, domain=None, range=Optional[Union[dict, VitalStatus]]) - -slots.vitalStatus__causeOfDeath = Slot(uri=PHENOPACKETS.causeOfDeath, name="vitalStatus__causeOfDeath", curie=PHENOPACKETS.curie('causeOfDeath'), - model_uri=PHENOPACKETS.vitalStatus__causeOfDeath, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.vitalStatus__status = Slot(uri=PHENOPACKETS.status, name="vitalStatus__status", curie=PHENOPACKETS.curie('status'), - model_uri=PHENOPACKETS.vitalStatus__status, domain=None, range=Optional[Union[str, "Status"]]) - -slots.vitalStatus__survivalTimeInDays = Slot(uri=PHENOPACKETS.survivalTimeInDays, name="vitalStatus__survivalTimeInDays", curie=PHENOPACKETS.curie('survivalTimeInDays'), - model_uri=PHENOPACKETS.vitalStatus__survivalTimeInDays, domain=None, range=Optional[int]) - -slots.vitalStatus__timeOfDeath = Slot(uri=PHENOPACKETS.timeOfDeath, name="vitalStatus__timeOfDeath", curie=PHENOPACKETS.curie('timeOfDeath'), - model_uri=PHENOPACKETS.vitalStatus__timeOfDeath, domain=None, range=Optional[Union[dict, TimeElement]]) - -slots.complexValue__typedQuantities = Slot(uri=PHENOPACKETS.typedQuantities, name="complexValue__typedQuantities", curie=PHENOPACKETS.curie('typedQuantities'), - model_uri=PHENOPACKETS.complexValue__typedQuantities, domain=None, range=Optional[Union[Union[dict, TypedQuantity], list[Union[dict, TypedQuantity]]]]) - -slots.measurement__assay = Slot(uri=PHENOPACKETS.assay, name="measurement__assay", curie=PHENOPACKETS.curie('assay'), - model_uri=PHENOPACKETS.measurement__assay, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.measurement__complexValue = Slot(uri=PHENOPACKETS.complexValue, name="measurement__complexValue", curie=PHENOPACKETS.curie('complexValue'), - model_uri=PHENOPACKETS.measurement__complexValue, domain=None, range=Optional[Union[dict, ComplexValue]]) - -slots.measurement__description = Slot(uri=PHENOPACKETS.description, name="measurement__description", curie=PHENOPACKETS.curie('description'), - model_uri=PHENOPACKETS.measurement__description, domain=None, range=Optional[str]) - -slots.measurement__procedure = Slot(uri=PHENOPACKETS.procedure, name="measurement__procedure", curie=PHENOPACKETS.curie('procedure'), - model_uri=PHENOPACKETS.measurement__procedure, domain=None, range=Optional[Union[dict, Procedure]]) - -slots.measurement__timeObserved = Slot(uri=PHENOPACKETS.timeObserved, name="measurement__timeObserved", curie=PHENOPACKETS.curie('timeObserved'), - model_uri=PHENOPACKETS.measurement__timeObserved, domain=None, range=Optional[Union[dict, TimeElement]]) - -slots.measurement__value = Slot(uri=PHENOPACKETS.value, name="measurement__value", curie=PHENOPACKETS.curie('value'), - model_uri=PHENOPACKETS.measurement__value, domain=None, range=Optional[Union[dict, Value]]) - -slots.quantity__referenceRange = Slot(uri=PHENOPACKETS.referenceRange, name="quantity__referenceRange", curie=PHENOPACKETS.curie('referenceRange'), - model_uri=PHENOPACKETS.quantity__referenceRange, domain=None, range=Optional[Union[dict, ReferenceRange]]) - -slots.quantity__unit = Slot(uri=PHENOPACKETS.unit, name="quantity__unit", curie=PHENOPACKETS.curie('unit'), - model_uri=PHENOPACKETS.quantity__unit, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.quantity__value = Slot(uri=PHENOPACKETS.value, name="quantity__value", curie=PHENOPACKETS.curie('value'), - model_uri=PHENOPACKETS.quantity__value, domain=None, range=Optional[float]) - -slots.referenceRange__high = Slot(uri=PHENOPACKETS.high, name="referenceRange__high", curie=PHENOPACKETS.curie('high'), - model_uri=PHENOPACKETS.referenceRange__high, domain=None, range=Optional[float]) - -slots.referenceRange__low = Slot(uri=PHENOPACKETS.low, name="referenceRange__low", curie=PHENOPACKETS.curie('low'), - model_uri=PHENOPACKETS.referenceRange__low, domain=None, range=Optional[float]) - -slots.referenceRange__unit = Slot(uri=PHENOPACKETS.unit, name="referenceRange__unit", curie=PHENOPACKETS.curie('unit'), - model_uri=PHENOPACKETS.referenceRange__unit, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.typedQuantity__quantity = Slot(uri=PHENOPACKETS.quantity, name="typedQuantity__quantity", curie=PHENOPACKETS.curie('quantity'), - model_uri=PHENOPACKETS.typedQuantity__quantity, domain=None, range=Optional[Union[dict, Quantity]]) - -slots.typedQuantity__type = Slot(uri=PHENOPACKETS.type, name="typedQuantity__type", curie=PHENOPACKETS.curie('type'), - model_uri=PHENOPACKETS.typedQuantity__type, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.value__ontologyClass = Slot(uri=PHENOPACKETS.ontologyClass, name="value__ontologyClass", curie=PHENOPACKETS.curie('ontologyClass'), - model_uri=PHENOPACKETS.value__ontologyClass, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.value__quantity = Slot(uri=PHENOPACKETS.quantity, name="value__quantity", curie=PHENOPACKETS.curie('quantity'), - model_uri=PHENOPACKETS.value__quantity, domain=None, range=Optional[Union[dict, Quantity]]) - -slots.doseInterval__interval = Slot(uri=PHENOPACKETS.interval, name="doseInterval__interval", curie=PHENOPACKETS.curie('interval'), - model_uri=PHENOPACKETS.doseInterval__interval, domain=None, range=Optional[Union[dict, TimeInterval]]) - -slots.doseInterval__quantity = Slot(uri=PHENOPACKETS.quantity, name="doseInterval__quantity", curie=PHENOPACKETS.curie('quantity'), - model_uri=PHENOPACKETS.doseInterval__quantity, domain=None, range=Optional[Union[dict, Quantity]]) - -slots.doseInterval__scheduleFrequency = Slot(uri=PHENOPACKETS.scheduleFrequency, name="doseInterval__scheduleFrequency", curie=PHENOPACKETS.curie('scheduleFrequency'), - model_uri=PHENOPACKETS.doseInterval__scheduleFrequency, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.medicalAction__adverseEvents = Slot(uri=PHENOPACKETS.adverseEvents, name="medicalAction__adverseEvents", curie=PHENOPACKETS.curie('adverseEvents'), - model_uri=PHENOPACKETS.medicalAction__adverseEvents, domain=None, range=Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]]) - -slots.medicalAction__procedure = Slot(uri=PHENOPACKETS.procedure, name="medicalAction__procedure", curie=PHENOPACKETS.curie('procedure'), - model_uri=PHENOPACKETS.medicalAction__procedure, domain=None, range=Optional[Union[dict, Procedure]]) - -slots.medicalAction__radiationTherapy = Slot(uri=PHENOPACKETS.radiationTherapy, name="medicalAction__radiationTherapy", curie=PHENOPACKETS.curie('radiationTherapy'), - model_uri=PHENOPACKETS.medicalAction__radiationTherapy, domain=None, range=Optional[Union[dict, RadiationTherapy]]) - -slots.medicalAction__responseToTreatment = Slot(uri=PHENOPACKETS.responseToTreatment, name="medicalAction__responseToTreatment", curie=PHENOPACKETS.curie('responseToTreatment'), - model_uri=PHENOPACKETS.medicalAction__responseToTreatment, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.medicalAction__therapeuticRegimen = Slot(uri=PHENOPACKETS.therapeuticRegimen, name="medicalAction__therapeuticRegimen", curie=PHENOPACKETS.curie('therapeuticRegimen'), - model_uri=PHENOPACKETS.medicalAction__therapeuticRegimen, domain=None, range=Optional[Union[dict, TherapeuticRegimen]]) - -slots.medicalAction__treatment = Slot(uri=PHENOPACKETS.treatment, name="medicalAction__treatment", curie=PHENOPACKETS.curie('treatment'), - model_uri=PHENOPACKETS.medicalAction__treatment, domain=None, range=Optional[Union[dict, Treatment]]) - -slots.medicalAction__treatmentIntent = Slot(uri=PHENOPACKETS.treatmentIntent, name="medicalAction__treatmentIntent", curie=PHENOPACKETS.curie('treatmentIntent'), - model_uri=PHENOPACKETS.medicalAction__treatmentIntent, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.medicalAction__treatmentTarget = Slot(uri=PHENOPACKETS.treatmentTarget, name="medicalAction__treatmentTarget", curie=PHENOPACKETS.curie('treatmentTarget'), - model_uri=PHENOPACKETS.medicalAction__treatmentTarget, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.medicalAction__treatmentTerminationReason = Slot(uri=PHENOPACKETS.treatmentTerminationReason, name="medicalAction__treatmentTerminationReason", curie=PHENOPACKETS.curie('treatmentTerminationReason'), - model_uri=PHENOPACKETS.medicalAction__treatmentTerminationReason, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.radiationTherapy__bodySite = Slot(uri=PHENOPACKETS.bodySite, name="radiationTherapy__bodySite", curie=PHENOPACKETS.curie('bodySite'), - model_uri=PHENOPACKETS.radiationTherapy__bodySite, domain=None, range=Union[dict, OntologyClass]) - -slots.radiationTherapy__dosage = Slot(uri=PHENOPACKETS.dosage, name="radiationTherapy__dosage", curie=PHENOPACKETS.curie('dosage'), - model_uri=PHENOPACKETS.radiationTherapy__dosage, domain=None, range=int) - -slots.radiationTherapy__fractions = Slot(uri=PHENOPACKETS.fractions, name="radiationTherapy__fractions", curie=PHENOPACKETS.curie('fractions'), - model_uri=PHENOPACKETS.radiationTherapy__fractions, domain=None, range=int) - -slots.radiationTherapy__modality = Slot(uri=PHENOPACKETS.modality, name="radiationTherapy__modality", curie=PHENOPACKETS.curie('modality'), - model_uri=PHENOPACKETS.radiationTherapy__modality, domain=None, range=Union[dict, OntologyClass]) - -slots.therapeuticRegimen__endTime = Slot(uri=PHENOPACKETS.endTime, name="therapeuticRegimen__endTime", curie=PHENOPACKETS.curie('endTime'), - model_uri=PHENOPACKETS.therapeuticRegimen__endTime, domain=None, range=Optional[Union[dict, TimeElement]]) - -slots.therapeuticRegimen__externalReference = Slot(uri=PHENOPACKETS.externalReference, name="therapeuticRegimen__externalReference", curie=PHENOPACKETS.curie('externalReference'), - model_uri=PHENOPACKETS.therapeuticRegimen__externalReference, domain=None, range=Optional[Union[dict, ExternalReference]]) - -slots.therapeuticRegimen__ontologyClass = Slot(uri=PHENOPACKETS.ontologyClass, name="therapeuticRegimen__ontologyClass", curie=PHENOPACKETS.curie('ontologyClass'), - model_uri=PHENOPACKETS.therapeuticRegimen__ontologyClass, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.therapeuticRegimen__regimenStatus = Slot(uri=PHENOPACKETS.regimenStatus, name="therapeuticRegimen__regimenStatus", curie=PHENOPACKETS.curie('regimenStatus'), - model_uri=PHENOPACKETS.therapeuticRegimen__regimenStatus, domain=None, range=Optional[Union[str, "RegimenStatus"]]) - -slots.therapeuticRegimen__startTime = Slot(uri=PHENOPACKETS.startTime, name="therapeuticRegimen__startTime", curie=PHENOPACKETS.curie('startTime'), - model_uri=PHENOPACKETS.therapeuticRegimen__startTime, domain=None, range=Optional[Union[dict, TimeElement]]) - -slots.treatment__agent = Slot(uri=PHENOPACKETS.agent, name="treatment__agent", curie=PHENOPACKETS.curie('agent'), - model_uri=PHENOPACKETS.treatment__agent, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.treatment__cumulativeDose = Slot(uri=PHENOPACKETS.cumulativeDose, name="treatment__cumulativeDose", curie=PHENOPACKETS.curie('cumulativeDose'), - model_uri=PHENOPACKETS.treatment__cumulativeDose, domain=None, range=Optional[Union[dict, Quantity]]) - -slots.treatment__doseIntervals = Slot(uri=PHENOPACKETS.doseIntervals, name="treatment__doseIntervals", curie=PHENOPACKETS.curie('doseIntervals'), - model_uri=PHENOPACKETS.treatment__doseIntervals, domain=None, range=Optional[Union[Union[dict, DoseInterval], list[Union[dict, DoseInterval]]]]) - -slots.treatment__drugType = Slot(uri=PHENOPACKETS.drugType, name="treatment__drugType", curie=PHENOPACKETS.curie('drugType'), - model_uri=PHENOPACKETS.treatment__drugType, domain=None, range=Optional[Union[str, "DrugType"]]) - -slots.treatment__routeOfAdministration = Slot(uri=PHENOPACKETS.routeOfAdministration, name="treatment__routeOfAdministration", curie=PHENOPACKETS.curie('routeOfAdministration'), - model_uri=PHENOPACKETS.treatment__routeOfAdministration, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.metaData__created = Slot(uri=PHENOPACKETS.created, name="metaData__created", curie=PHENOPACKETS.curie('created'), - model_uri=PHENOPACKETS.metaData__created, domain=None, range=Optional[str]) - -slots.metaData__createdBy = Slot(uri=PHENOPACKETS.createdBy, name="metaData__createdBy", curie=PHENOPACKETS.curie('createdBy'), - model_uri=PHENOPACKETS.metaData__createdBy, domain=None, range=Optional[str]) - -slots.metaData__externalReferences = Slot(uri=PHENOPACKETS.externalReferences, name="metaData__externalReferences", curie=PHENOPACKETS.curie('externalReferences'), - model_uri=PHENOPACKETS.metaData__externalReferences, domain=None, range=Optional[Union[Union[dict, ExternalReference], list[Union[dict, ExternalReference]]]]) - -slots.metaData__phenopacketSchemaVersion = Slot(uri=PHENOPACKETS.phenopacketSchemaVersion, name="metaData__phenopacketSchemaVersion", curie=PHENOPACKETS.curie('phenopacketSchemaVersion'), - model_uri=PHENOPACKETS.metaData__phenopacketSchemaVersion, domain=None, range=Optional[str]) - -slots.metaData__resources = Slot(uri=PHENOPACKETS.resources, name="metaData__resources", curie=PHENOPACKETS.curie('resources'), - model_uri=PHENOPACKETS.metaData__resources, domain=None, range=Optional[Union[Union[dict, Resource], list[Union[dict, Resource]]]]) - -slots.metaData__submittedBy = Slot(uri=PHENOPACKETS.submittedBy, name="metaData__submittedBy", curie=PHENOPACKETS.curie('submittedBy'), - model_uri=PHENOPACKETS.metaData__submittedBy, domain=None, range=Optional[str]) - -slots.metaData__updates = Slot(uri=PHENOPACKETS.updates, name="metaData__updates", curie=PHENOPACKETS.curie('updates'), - model_uri=PHENOPACKETS.metaData__updates, domain=None, range=Optional[Union[Union[dict, Update], list[Union[dict, Update]]]]) - -slots.resource__id = Slot(uri=PHENOPACKETS.id, name="resource__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.resource__id, domain=None, range=Optional[str]) - -slots.resource__iriPrefix = Slot(uri=PHENOPACKETS.iriPrefix, name="resource__iriPrefix", curie=PHENOPACKETS.curie('iriPrefix'), - model_uri=PHENOPACKETS.resource__iriPrefix, domain=None, range=Optional[str]) - -slots.resource__name = Slot(uri=PHENOPACKETS.name, name="resource__name", curie=PHENOPACKETS.curie('name'), - model_uri=PHENOPACKETS.resource__name, domain=None, range=Optional[str]) - -slots.resource__namespacePrefix = Slot(uri=PHENOPACKETS.namespacePrefix, name="resource__namespacePrefix", curie=PHENOPACKETS.curie('namespacePrefix'), - model_uri=PHENOPACKETS.resource__namespacePrefix, domain=None, range=Optional[str]) - -slots.resource__url = Slot(uri=PHENOPACKETS.url, name="resource__url", curie=PHENOPACKETS.curie('url'), - model_uri=PHENOPACKETS.resource__url, domain=None, range=Optional[str]) - -slots.resource__version = Slot(uri=PHENOPACKETS.version, name="resource__version", curie=PHENOPACKETS.curie('version'), - model_uri=PHENOPACKETS.resource__version, domain=None, range=Optional[str]) - -slots.update__comment = Slot(uri=PHENOPACKETS.comment, name="update__comment", curie=PHENOPACKETS.curie('comment'), - model_uri=PHENOPACKETS.update__comment, domain=None, range=Optional[str]) - -slots.update__timestamp = Slot(uri=PHENOPACKETS.timestamp, name="update__timestamp", curie=PHENOPACKETS.curie('timestamp'), - model_uri=PHENOPACKETS.update__timestamp, domain=None, range=str) - -slots.update__updatedBy = Slot(uri=PHENOPACKETS.updatedBy, name="update__updatedBy", curie=PHENOPACKETS.curie('updatedBy'), - model_uri=PHENOPACKETS.update__updatedBy, domain=None, range=Optional[str]) - -slots.pedigree__persons = Slot(uri=PHENOPACKETS.persons, name="pedigree__persons", curie=PHENOPACKETS.curie('persons'), - model_uri=PHENOPACKETS.pedigree__persons, domain=None, range=Optional[Union[Union[dict, Person], list[Union[dict, Person]]]]) - -slots.person__affectedStatus = Slot(uri=PHENOPACKETS.affectedStatus, name="person__affectedStatus", curie=PHENOPACKETS.curie('affectedStatus'), - model_uri=PHENOPACKETS.person__affectedStatus, domain=None, range=Optional[Union[str, "AffectedStatus"]]) - -slots.person__familyId = Slot(uri=PHENOPACKETS.familyId, name="person__familyId", curie=PHENOPACKETS.curie('familyId'), - model_uri=PHENOPACKETS.person__familyId, domain=None, range=Optional[str]) - -slots.person__individualId = Slot(uri=PHENOPACKETS.individualId, name="person__individualId", curie=PHENOPACKETS.curie('individualId'), - model_uri=PHENOPACKETS.person__individualId, domain=None, range=Optional[str]) - -slots.person__maternalId = Slot(uri=PHENOPACKETS.maternalId, name="person__maternalId", curie=PHENOPACKETS.curie('maternalId'), - model_uri=PHENOPACKETS.person__maternalId, domain=None, range=Optional[str]) - -slots.person__paternalId = Slot(uri=PHENOPACKETS.paternalId, name="person__paternalId", curie=PHENOPACKETS.curie('paternalId'), - model_uri=PHENOPACKETS.person__paternalId, domain=None, range=Optional[str]) - -slots.person__sex = Slot(uri=PHENOPACKETS.sex, name="person__sex", curie=PHENOPACKETS.curie('sex'), - model_uri=PHENOPACKETS.person__sex, domain=None, range=Optional[Union[str, "Sex"]]) - -slots.phenotypicFeature__description = Slot(uri=PHENOPACKETS.description, name="phenotypicFeature__description", curie=PHENOPACKETS.curie('description'), - model_uri=PHENOPACKETS.phenotypicFeature__description, domain=None, range=Optional[str]) - -slots.phenotypicFeature__evidence = Slot(uri=PHENOPACKETS.evidence, name="phenotypicFeature__evidence", curie=PHENOPACKETS.curie('evidence'), - model_uri=PHENOPACKETS.phenotypicFeature__evidence, domain=None, range=Optional[Union[Union[dict, Evidence], list[Union[dict, Evidence]]]]) - -slots.phenotypicFeature__excluded = Slot(uri=PHENOPACKETS.excluded, name="phenotypicFeature__excluded", curie=PHENOPACKETS.curie('excluded'), - model_uri=PHENOPACKETS.phenotypicFeature__excluded, domain=None, range=Optional[Union[bool, Bool]]) - -slots.phenotypicFeature__modifiers = Slot(uri=PHENOPACKETS.modifiers, name="phenotypicFeature__modifiers", curie=PHENOPACKETS.curie('modifiers'), - model_uri=PHENOPACKETS.phenotypicFeature__modifiers, domain=None, range=Optional[Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]]]) - -slots.phenotypicFeature__onset = Slot(uri=PHENOPACKETS.onset, name="phenotypicFeature__onset", curie=PHENOPACKETS.curie('onset'), - model_uri=PHENOPACKETS.phenotypicFeature__onset, domain=None, range=Optional[Union[dict, TimeElement]]) - -slots.phenotypicFeature__resolution = Slot(uri=PHENOPACKETS.resolution, name="phenotypicFeature__resolution", curie=PHENOPACKETS.curie('resolution'), - model_uri=PHENOPACKETS.phenotypicFeature__resolution, domain=None, range=Optional[Union[dict, TimeElement]]) - -slots.phenotypicFeature__severity = Slot(uri=PHENOPACKETS.severity, name="phenotypicFeature__severity", curie=PHENOPACKETS.curie('severity'), - model_uri=PHENOPACKETS.phenotypicFeature__severity, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.phenotypicFeature__type = Slot(uri=PHENOPACKETS.type, name="phenotypicFeature__type", curie=PHENOPACKETS.curie('type'), - model_uri=PHENOPACKETS.phenotypicFeature__type, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.timestamp__nanos = Slot(uri=PHENOPACKETS.nanos, name="timestamp__nanos", curie=PHENOPACKETS.curie('nanos'), - model_uri=PHENOPACKETS.timestamp__nanos, domain=None, range=Optional[int]) - -slots.timestamp__seconds = Slot(uri=PHENOPACKETS.seconds, name="timestamp__seconds", curie=PHENOPACKETS.curie('seconds'), - model_uri=PHENOPACKETS.timestamp__seconds, domain=None, range=Optional[int]) - -slots.expression__syntax = Slot(uri=PHENOPACKETS.syntax, name="expression__syntax", curie=PHENOPACKETS.curie('syntax'), - model_uri=PHENOPACKETS.expression__syntax, domain=None, range=Optional[str]) - -slots.expression__value = Slot(uri=PHENOPACKETS.value, name="expression__value", curie=PHENOPACKETS.curie('value'), - model_uri=PHENOPACKETS.expression__value, domain=None, range=Optional[str]) - -slots.expression__version = Slot(uri=PHENOPACKETS.version, name="expression__version", curie=PHENOPACKETS.curie('version'), - model_uri=PHENOPACKETS.expression__version, domain=None, range=Optional[str]) - -slots.extension__name = Slot(uri=PHENOPACKETS.name, name="extension__name", curie=PHENOPACKETS.curie('name'), - model_uri=PHENOPACKETS.extension__name, domain=None, range=Optional[str]) - -slots.extension__value = Slot(uri=PHENOPACKETS.value, name="extension__value", curie=PHENOPACKETS.curie('value'), - model_uri=PHENOPACKETS.extension__value, domain=None, range=Optional[Union[Union[dict, Any], list[Union[dict, Any]]]]) - -slots.geneDescriptor__alternateIds = Slot(uri=PHENOPACKETS.alternateIds, name="geneDescriptor__alternateIds", curie=PHENOPACKETS.curie('alternateIds'), - model_uri=PHENOPACKETS.geneDescriptor__alternateIds, domain=None, range=Optional[Union[str, list[str]]]) - -slots.geneDescriptor__alternateSymbols = Slot(uri=PHENOPACKETS.alternateSymbols, name="geneDescriptor__alternateSymbols", curie=PHENOPACKETS.curie('alternateSymbols'), - model_uri=PHENOPACKETS.geneDescriptor__alternateSymbols, domain=None, range=Optional[Union[str, list[str]]]) - -slots.geneDescriptor__description = Slot(uri=PHENOPACKETS.description, name="geneDescriptor__description", curie=PHENOPACKETS.curie('description'), - model_uri=PHENOPACKETS.geneDescriptor__description, domain=None, range=Optional[str]) - -slots.geneDescriptor__symbol = Slot(uri=PHENOPACKETS.symbol, name="geneDescriptor__symbol", curie=PHENOPACKETS.curie('symbol'), - model_uri=PHENOPACKETS.geneDescriptor__symbol, domain=None, range=Optional[str]) - -slots.geneDescriptor__valueId = Slot(uri=PHENOPACKETS.valueId, name="geneDescriptor__valueId", curie=PHENOPACKETS.curie('valueId'), - model_uri=PHENOPACKETS.geneDescriptor__valueId, domain=None, range=Optional[str]) - -slots.geneDescriptor__xrefs = Slot(uri=PHENOPACKETS.xrefs, name="geneDescriptor__xrefs", curie=PHENOPACKETS.curie('xrefs'), - model_uri=PHENOPACKETS.geneDescriptor__xrefs, domain=None, range=Optional[Union[str, list[str]]]) - -slots.variationDescriptor__allelicState = Slot(uri=PHENOPACKETS.allelicState, name="variationDescriptor__allelicState", curie=PHENOPACKETS.curie('allelicState'), - model_uri=PHENOPACKETS.variationDescriptor__allelicState, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.variationDescriptor__alternateLabels = Slot(uri=PHENOPACKETS.alternateLabels, name="variationDescriptor__alternateLabels", curie=PHENOPACKETS.curie('alternateLabels'), - model_uri=PHENOPACKETS.variationDescriptor__alternateLabels, domain=None, range=Optional[Union[str, list[str]]]) - -slots.variationDescriptor__description = Slot(uri=PHENOPACKETS.description, name="variationDescriptor__description", curie=PHENOPACKETS.curie('description'), - model_uri=PHENOPACKETS.variationDescriptor__description, domain=None, range=Optional[str]) - -slots.variationDescriptor__expressions = Slot(uri=PHENOPACKETS.expressions, name="variationDescriptor__expressions", curie=PHENOPACKETS.curie('expressions'), - model_uri=PHENOPACKETS.variationDescriptor__expressions, domain=None, range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]]) - -slots.variationDescriptor__extensions = Slot(uri=PHENOPACKETS.extensions, name="variationDescriptor__extensions", curie=PHENOPACKETS.curie('extensions'), - model_uri=PHENOPACKETS.variationDescriptor__extensions, domain=None, range=Optional[Union[Union[dict, Extension], list[Union[dict, Extension]]]]) - -slots.variationDescriptor__geneContext = Slot(uri=PHENOPACKETS.geneContext, name="variationDescriptor__geneContext", curie=PHENOPACKETS.curie('geneContext'), - model_uri=PHENOPACKETS.variationDescriptor__geneContext, domain=None, range=Optional[Union[dict, GeneDescriptor]]) - -slots.variationDescriptor__id = Slot(uri=PHENOPACKETS.id, name="variationDescriptor__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.variationDescriptor__id, domain=None, range=Optional[str]) - -slots.variationDescriptor__label = Slot(uri=PHENOPACKETS.label, name="variationDescriptor__label", curie=PHENOPACKETS.curie('label'), - model_uri=PHENOPACKETS.variationDescriptor__label, domain=None, range=Optional[str]) - -slots.variationDescriptor__moleculeContext = Slot(uri=PHENOPACKETS.moleculeContext, name="variationDescriptor__moleculeContext", curie=PHENOPACKETS.curie('moleculeContext'), - model_uri=PHENOPACKETS.variationDescriptor__moleculeContext, domain=None, range=Optional[Union[str, "MoleculeContext"]]) - -slots.variationDescriptor__structuralType = Slot(uri=PHENOPACKETS.structuralType, name="variationDescriptor__structuralType", curie=PHENOPACKETS.curie('structuralType'), - model_uri=PHENOPACKETS.variationDescriptor__structuralType, domain=None, range=Optional[Union[dict, OntologyClass]]) - -slots.variationDescriptor__variation = Slot(uri=PHENOPACKETS.variation, name="variationDescriptor__variation", curie=PHENOPACKETS.curie('variation'), - model_uri=PHENOPACKETS.variationDescriptor__variation, domain=None, range=Optional[Union[dict, Variation]]) - -slots.variationDescriptor__vcfRecord = Slot(uri=PHENOPACKETS.vcfRecord, name="variationDescriptor__vcfRecord", curie=PHENOPACKETS.curie('vcfRecord'), - model_uri=PHENOPACKETS.variationDescriptor__vcfRecord, domain=None, range=Optional[Union[dict, VcfRecord]]) - -slots.variationDescriptor__vrsRefAlleleSeq = Slot(uri=PHENOPACKETS.vrsRefAlleleSeq, name="variationDescriptor__vrsRefAlleleSeq", curie=PHENOPACKETS.curie('vrsRefAlleleSeq'), - model_uri=PHENOPACKETS.variationDescriptor__vrsRefAlleleSeq, domain=None, range=Optional[str]) - -slots.variationDescriptor__xrefs = Slot(uri=PHENOPACKETS.xrefs, name="variationDescriptor__xrefs", curie=PHENOPACKETS.curie('xrefs'), - model_uri=PHENOPACKETS.variationDescriptor__xrefs, domain=None, range=Optional[Union[str, list[str]]]) - -slots.vcfRecord__alt = Slot(uri=PHENOPACKETS.alt, name="vcfRecord__alt", curie=PHENOPACKETS.curie('alt'), - model_uri=PHENOPACKETS.vcfRecord__alt, domain=None, range=Optional[str]) - -slots.vcfRecord__chrom = Slot(uri=PHENOPACKETS.chrom, name="vcfRecord__chrom", curie=PHENOPACKETS.curie('chrom'), - model_uri=PHENOPACKETS.vcfRecord__chrom, domain=None, range=Optional[str]) - -slots.vcfRecord__filter = Slot(uri=PHENOPACKETS.filter, name="vcfRecord__filter", curie=PHENOPACKETS.curie('filter'), - model_uri=PHENOPACKETS.vcfRecord__filter, domain=None, range=Optional[str]) - -slots.vcfRecord__genomeAssembly = Slot(uri=PHENOPACKETS.genomeAssembly, name="vcfRecord__genomeAssembly", curie=PHENOPACKETS.curie('genomeAssembly'), - model_uri=PHENOPACKETS.vcfRecord__genomeAssembly, domain=None, range=Optional[str]) - -slots.vcfRecord__id = Slot(uri=PHENOPACKETS.id, name="vcfRecord__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.vcfRecord__id, domain=None, range=Optional[str]) - -slots.vcfRecord__info = Slot(uri=PHENOPACKETS.info, name="vcfRecord__info", curie=PHENOPACKETS.curie('info'), - model_uri=PHENOPACKETS.vcfRecord__info, domain=None, range=Optional[str]) - -slots.vcfRecord__pos = Slot(uri=PHENOPACKETS.pos, name="vcfRecord__pos", curie=PHENOPACKETS.curie('pos'), - model_uri=PHENOPACKETS.vcfRecord__pos, domain=None, range=Optional[int]) - -slots.vcfRecord__qual = Slot(uri=PHENOPACKETS.qual, name="vcfRecord__qual", curie=PHENOPACKETS.curie('qual'), - model_uri=PHENOPACKETS.vcfRecord__qual, domain=None, range=Optional[str]) - -slots.vcfRecord__ref = Slot(uri=PHENOPACKETS.ref, name="vcfRecord__ref", curie=PHENOPACKETS.curie('ref'), - model_uri=PHENOPACKETS.vcfRecord__ref, domain=None, range=Optional[str]) - -slots.any__typeUrl = Slot(uri=PHENOPACKETS.typeUrl, name="any__typeUrl", curie=PHENOPACKETS.curie('typeUrl'), - model_uri=PHENOPACKETS.any__typeUrl, domain=None, range=Optional[str]) - -slots.any__value = Slot(uri=PHENOPACKETS.value, name="any__value", curie=PHENOPACKETS.curie('value'), - model_uri=PHENOPACKETS.any__value, domain=None, range=Optional[str]) - -slots.abundance__copyNumber = Slot(uri=PHENOPACKETS.copyNumber, name="abundance__copyNumber", curie=PHENOPACKETS.curie('copyNumber'), - model_uri=PHENOPACKETS.abundance__copyNumber, domain=None, range=Optional[Union[dict, CopyNumber]]) - -slots.allele__chromosomeLocation = Slot(uri=PHENOPACKETS.chromosomeLocation, name="allele__chromosomeLocation", curie=PHENOPACKETS.curie('chromosomeLocation'), - model_uri=PHENOPACKETS.allele__chromosomeLocation, domain=None, range=Optional[Union[dict, ChromosomeLocation]]) - -slots.allele__curie = Slot(uri=PHENOPACKETS.curie, name="allele__curie", curie=PHENOPACKETS.curie('curie'), - model_uri=PHENOPACKETS.allele__curie, domain=None, range=Optional[str]) - -slots.allele__derivedSequenceExpression = Slot(uri=PHENOPACKETS.derivedSequenceExpression, name="allele__derivedSequenceExpression", curie=PHENOPACKETS.curie('derivedSequenceExpression'), - model_uri=PHENOPACKETS.allele__derivedSequenceExpression, domain=None, range=Optional[Union[dict, DerivedSequenceExpression]]) - -slots.allele__id = Slot(uri=PHENOPACKETS.id, name="allele__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.allele__id, domain=None, range=Optional[str]) - -slots.allele__literalSequenceExpression = Slot(uri=PHENOPACKETS.literalSequenceExpression, name="allele__literalSequenceExpression", curie=PHENOPACKETS.curie('literalSequenceExpression'), - model_uri=PHENOPACKETS.allele__literalSequenceExpression, domain=None, range=Optional[Union[dict, LiteralSequenceExpression]]) - -slots.allele__repeatedSequenceExpression = Slot(uri=PHENOPACKETS.repeatedSequenceExpression, name="allele__repeatedSequenceExpression", curie=PHENOPACKETS.curie('repeatedSequenceExpression'), - model_uri=PHENOPACKETS.allele__repeatedSequenceExpression, domain=None, range=Optional[Union[dict, RepeatedSequenceExpression]]) - -slots.allele__sequenceLocation = Slot(uri=PHENOPACKETS.sequenceLocation, name="allele__sequenceLocation", curie=PHENOPACKETS.curie('sequenceLocation'), - model_uri=PHENOPACKETS.allele__sequenceLocation, domain=None, range=Optional[Union[dict, SequenceLocation]]) - -slots.chromosomeLocation__chr = Slot(uri=PHENOPACKETS.chr, name="chromosomeLocation__chr", curie=PHENOPACKETS.curie('chr'), - model_uri=PHENOPACKETS.chromosomeLocation__chr, domain=None, range=Optional[str]) - -slots.chromosomeLocation__id = Slot(uri=PHENOPACKETS.id, name="chromosomeLocation__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.chromosomeLocation__id, domain=None, range=Optional[str]) - -slots.chromosomeLocation__interval = Slot(uri=PHENOPACKETS.interval, name="chromosomeLocation__interval", curie=PHENOPACKETS.curie('interval'), - model_uri=PHENOPACKETS.chromosomeLocation__interval, domain=None, range=Optional[Union[dict, CytobandInterval]]) - -slots.chromosomeLocation__speciesId = Slot(uri=PHENOPACKETS.speciesId, name="chromosomeLocation__speciesId", curie=PHENOPACKETS.curie('speciesId'), - model_uri=PHENOPACKETS.chromosomeLocation__speciesId, domain=None, range=Optional[str]) - -slots.copyNumber__allele = Slot(uri=PHENOPACKETS.allele, name="copyNumber__allele", curie=PHENOPACKETS.curie('allele'), - model_uri=PHENOPACKETS.copyNumber__allele, domain=None, range=Optional[Union[dict, Allele]]) - -slots.copyNumber__curie = Slot(uri=PHENOPACKETS.curie, name="copyNumber__curie", curie=PHENOPACKETS.curie('curie'), - model_uri=PHENOPACKETS.copyNumber__curie, domain=None, range=Optional[str]) - -slots.copyNumber__definiteRange = Slot(uri=PHENOPACKETS.definiteRange, name="copyNumber__definiteRange", curie=PHENOPACKETS.curie('definiteRange'), - model_uri=PHENOPACKETS.copyNumber__definiteRange, domain=None, range=Optional[Union[dict, DefiniteRange]]) - -slots.copyNumber__derivedSequenceExpression = Slot(uri=PHENOPACKETS.derivedSequenceExpression, name="copyNumber__derivedSequenceExpression", curie=PHENOPACKETS.curie('derivedSequenceExpression'), - model_uri=PHENOPACKETS.copyNumber__derivedSequenceExpression, domain=None, range=Optional[Union[dict, DerivedSequenceExpression]]) - -slots.copyNumber__gene = Slot(uri=PHENOPACKETS.gene, name="copyNumber__gene", curie=PHENOPACKETS.curie('gene'), - model_uri=PHENOPACKETS.copyNumber__gene, domain=None, range=Optional[Union[dict, Gene]]) - -slots.copyNumber__haplotype = Slot(uri=PHENOPACKETS.haplotype, name="copyNumber__haplotype", curie=PHENOPACKETS.curie('haplotype'), - model_uri=PHENOPACKETS.copyNumber__haplotype, domain=None, range=Optional[Union[dict, Haplotype]]) - -slots.copyNumber__id = Slot(uri=PHENOPACKETS.id, name="copyNumber__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.copyNumber__id, domain=None, range=Optional[str]) - -slots.copyNumber__indefiniteRange = Slot(uri=PHENOPACKETS.indefiniteRange, name="copyNumber__indefiniteRange", curie=PHENOPACKETS.curie('indefiniteRange'), - model_uri=PHENOPACKETS.copyNumber__indefiniteRange, domain=None, range=Optional[Union[dict, IndefiniteRange]]) - -slots.copyNumber__literalSequenceExpression = Slot(uri=PHENOPACKETS.literalSequenceExpression, name="copyNumber__literalSequenceExpression", curie=PHENOPACKETS.curie('literalSequenceExpression'), - model_uri=PHENOPACKETS.copyNumber__literalSequenceExpression, domain=None, range=Optional[Union[dict, LiteralSequenceExpression]]) - -slots.copyNumber__number = Slot(uri=PHENOPACKETS.number, name="copyNumber__number", curie=PHENOPACKETS.curie('number'), - model_uri=PHENOPACKETS.copyNumber__number, domain=None, range=Optional[Union[dict, Number]]) - -slots.copyNumber__repeatedSequenceExpression = Slot(uri=PHENOPACKETS.repeatedSequenceExpression, name="copyNumber__repeatedSequenceExpression", curie=PHENOPACKETS.curie('repeatedSequenceExpression'), - model_uri=PHENOPACKETS.copyNumber__repeatedSequenceExpression, domain=None, range=Optional[Union[dict, RepeatedSequenceExpression]]) - -slots.cytobandInterval__end = Slot(uri=PHENOPACKETS.end, name="cytobandInterval__end", curie=PHENOPACKETS.curie('end'), - model_uri=PHENOPACKETS.cytobandInterval__end, domain=None, range=Optional[str]) - -slots.cytobandInterval__start = Slot(uri=PHENOPACKETS.start, name="cytobandInterval__start", curie=PHENOPACKETS.curie('start'), - model_uri=PHENOPACKETS.cytobandInterval__start, domain=None, range=Optional[str]) - -slots.definiteRange__max = Slot(uri=PHENOPACKETS.max, name="definiteRange__max", curie=PHENOPACKETS.curie('max'), - model_uri=PHENOPACKETS.definiteRange__max, domain=None, range=Optional[int]) - -slots.definiteRange__min = Slot(uri=PHENOPACKETS.min, name="definiteRange__min", curie=PHENOPACKETS.curie('min'), - model_uri=PHENOPACKETS.definiteRange__min, domain=None, range=Optional[int]) - -slots.derivedSequenceExpression__location = Slot(uri=PHENOPACKETS.location, name="derivedSequenceExpression__location", curie=PHENOPACKETS.curie('location'), - model_uri=PHENOPACKETS.derivedSequenceExpression__location, domain=None, range=Optional[Union[dict, SequenceLocation]]) - -slots.derivedSequenceExpression__reverseComplement = Slot(uri=PHENOPACKETS.reverseComplement, name="derivedSequenceExpression__reverseComplement", curie=PHENOPACKETS.curie('reverseComplement'), - model_uri=PHENOPACKETS.derivedSequenceExpression__reverseComplement, domain=None, range=Optional[Union[bool, Bool]]) - -slots.feature__gene = Slot(uri=PHENOPACKETS.gene, name="feature__gene", curie=PHENOPACKETS.curie('gene'), - model_uri=PHENOPACKETS.feature__gene, domain=None, range=Optional[Union[dict, Gene]]) - -slots.gene__geneId = Slot(uri=PHENOPACKETS.geneId, name="gene__geneId", curie=PHENOPACKETS.curie('geneId'), - model_uri=PHENOPACKETS.gene__geneId, domain=None, range=Optional[str]) - -slots.indefiniteRange__comparator = Slot(uri=PHENOPACKETS.comparator, name="indefiniteRange__comparator", curie=PHENOPACKETS.curie('comparator'), - model_uri=PHENOPACKETS.indefiniteRange__comparator, domain=None, range=Optional[str]) - -slots.indefiniteRange__value = Slot(uri=PHENOPACKETS.value, name="indefiniteRange__value", curie=PHENOPACKETS.curie('value'), - model_uri=PHENOPACKETS.indefiniteRange__value, domain=None, range=Optional[int]) - -slots.literalSequenceExpression__sequence = Slot(uri=PHENOPACKETS.sequence, name="literalSequenceExpression__sequence", curie=PHENOPACKETS.curie('sequence'), - model_uri=PHENOPACKETS.literalSequenceExpression__sequence, domain=None, range=Optional[str]) - -slots.location__chromosomeLocation = Slot(uri=PHENOPACKETS.chromosomeLocation, name="location__chromosomeLocation", curie=PHENOPACKETS.curie('chromosomeLocation'), - model_uri=PHENOPACKETS.location__chromosomeLocation, domain=None, range=Optional[Union[dict, ChromosomeLocation]]) - -slots.location__sequenceLocation = Slot(uri=PHENOPACKETS.sequenceLocation, name="location__sequenceLocation", curie=PHENOPACKETS.curie('sequenceLocation'), - model_uri=PHENOPACKETS.location__sequenceLocation, domain=None, range=Optional[Union[dict, SequenceLocation]]) - -slots.member__allele = Slot(uri=PHENOPACKETS.allele, name="member__allele", curie=PHENOPACKETS.curie('allele'), - model_uri=PHENOPACKETS.member__allele, domain=None, range=Optional[Union[dict, Allele]]) - -slots.member__copyNumber = Slot(uri=PHENOPACKETS.copyNumber, name="member__copyNumber", curie=PHENOPACKETS.curie('copyNumber'), - model_uri=PHENOPACKETS.member__copyNumber, domain=None, range=Optional[Union[dict, CopyNumber]]) - -slots.member__curie = Slot(uri=PHENOPACKETS.curie, name="member__curie", curie=PHENOPACKETS.curie('curie'), - model_uri=PHENOPACKETS.member__curie, domain=None, range=Optional[str]) - -slots.member__haplotype = Slot(uri=PHENOPACKETS.haplotype, name="member__haplotype", curie=PHENOPACKETS.curie('haplotype'), - model_uri=PHENOPACKETS.member__haplotype, domain=None, range=Optional[Union[dict, Haplotype]]) - -slots.member__id = Slot(uri=PHENOPACKETS.id, name="member__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.member__id, domain=None, range=Optional[str]) - -slots.member__members = Slot(uri=PHENOPACKETS.members, name="member__members", curie=PHENOPACKETS.curie('members'), - model_uri=PHENOPACKETS.member__members, domain=None, range=Optional[Union[Union[dict, Member], list[Union[dict, Member]]]]) - -slots.member__text = Slot(uri=PHENOPACKETS.text, name="member__text", curie=PHENOPACKETS.curie('text'), - model_uri=PHENOPACKETS.member__text, domain=None, range=Optional[Union[dict, Text]]) - -slots.member__variationSet = Slot(uri=PHENOPACKETS.variationSet, name="member__variationSet", curie=PHENOPACKETS.curie('variationSet'), - model_uri=PHENOPACKETS.member__variationSet, domain=None, range=Optional[Union[dict, VariationSet]]) - -slots.molecularVariation__allele = Slot(uri=PHENOPACKETS.allele, name="molecularVariation__allele", curie=PHENOPACKETS.curie('allele'), - model_uri=PHENOPACKETS.molecularVariation__allele, domain=None, range=Optional[Union[dict, Allele]]) - -slots.molecularVariation__haplotype = Slot(uri=PHENOPACKETS.haplotype, name="molecularVariation__haplotype", curie=PHENOPACKETS.curie('haplotype'), - model_uri=PHENOPACKETS.molecularVariation__haplotype, domain=None, range=Optional[Union[dict, Haplotype]]) - -slots.number__value = Slot(uri=PHENOPACKETS.value, name="number__value", curie=PHENOPACKETS.curie('value'), - model_uri=PHENOPACKETS.number__value, domain=None, range=Optional[int]) - -slots.repeatedSequenceExpression__definiteRange = Slot(uri=PHENOPACKETS.definiteRange, name="repeatedSequenceExpression__definiteRange", curie=PHENOPACKETS.curie('definiteRange'), - model_uri=PHENOPACKETS.repeatedSequenceExpression__definiteRange, domain=None, range=Optional[Union[dict, DefiniteRange]]) - -slots.repeatedSequenceExpression__derivedSequenceExpression = Slot(uri=PHENOPACKETS.derivedSequenceExpression, name="repeatedSequenceExpression__derivedSequenceExpression", curie=PHENOPACKETS.curie('derivedSequenceExpression'), - model_uri=PHENOPACKETS.repeatedSequenceExpression__derivedSequenceExpression, domain=None, range=Optional[Union[dict, DerivedSequenceExpression]]) - -slots.repeatedSequenceExpression__indefiniteRange = Slot(uri=PHENOPACKETS.indefiniteRange, name="repeatedSequenceExpression__indefiniteRange", curie=PHENOPACKETS.curie('indefiniteRange'), - model_uri=PHENOPACKETS.repeatedSequenceExpression__indefiniteRange, domain=None, range=Optional[Union[dict, IndefiniteRange]]) - -slots.repeatedSequenceExpression__literalSequenceExpression = Slot(uri=PHENOPACKETS.literalSequenceExpression, name="repeatedSequenceExpression__literalSequenceExpression", curie=PHENOPACKETS.curie('literalSequenceExpression'), - model_uri=PHENOPACKETS.repeatedSequenceExpression__literalSequenceExpression, domain=None, range=Optional[Union[dict, LiteralSequenceExpression]]) - -slots.repeatedSequenceExpression__number = Slot(uri=PHENOPACKETS.number, name="repeatedSequenceExpression__number", curie=PHENOPACKETS.curie('number'), - model_uri=PHENOPACKETS.repeatedSequenceExpression__number, domain=None, range=Optional[Union[dict, Number]]) - -slots.sequenceExpression__derivedSequenceExpression = Slot(uri=PHENOPACKETS.derivedSequenceExpression, name="sequenceExpression__derivedSequenceExpression", curie=PHENOPACKETS.curie('derivedSequenceExpression'), - model_uri=PHENOPACKETS.sequenceExpression__derivedSequenceExpression, domain=None, range=Optional[Union[dict, DerivedSequenceExpression]]) - -slots.sequenceExpression__literalSequenceExpression = Slot(uri=PHENOPACKETS.literalSequenceExpression, name="sequenceExpression__literalSequenceExpression", curie=PHENOPACKETS.curie('literalSequenceExpression'), - model_uri=PHENOPACKETS.sequenceExpression__literalSequenceExpression, domain=None, range=Optional[Union[dict, LiteralSequenceExpression]]) - -slots.sequenceExpression__repeatedSequenceExpression = Slot(uri=PHENOPACKETS.repeatedSequenceExpression, name="sequenceExpression__repeatedSequenceExpression", curie=PHENOPACKETS.curie('repeatedSequenceExpression'), - model_uri=PHENOPACKETS.sequenceExpression__repeatedSequenceExpression, domain=None, range=Optional[Union[dict, RepeatedSequenceExpression]]) - -slots.sequenceInterval__endDefiniteRange = Slot(uri=PHENOPACKETS.endDefiniteRange, name="sequenceInterval__endDefiniteRange", curie=PHENOPACKETS.curie('endDefiniteRange'), - model_uri=PHENOPACKETS.sequenceInterval__endDefiniteRange, domain=None, range=Optional[Union[dict, DefiniteRange]]) - -slots.sequenceInterval__endIndefiniteRange = Slot(uri=PHENOPACKETS.endIndefiniteRange, name="sequenceInterval__endIndefiniteRange", curie=PHENOPACKETS.curie('endIndefiniteRange'), - model_uri=PHENOPACKETS.sequenceInterval__endIndefiniteRange, domain=None, range=Optional[Union[dict, IndefiniteRange]]) - -slots.sequenceInterval__endNumber = Slot(uri=PHENOPACKETS.endNumber, name="sequenceInterval__endNumber", curie=PHENOPACKETS.curie('endNumber'), - model_uri=PHENOPACKETS.sequenceInterval__endNumber, domain=None, range=Optional[Union[dict, Number]]) - -slots.sequenceInterval__startDefiniteRange = Slot(uri=PHENOPACKETS.startDefiniteRange, name="sequenceInterval__startDefiniteRange", curie=PHENOPACKETS.curie('startDefiniteRange'), - model_uri=PHENOPACKETS.sequenceInterval__startDefiniteRange, domain=None, range=Optional[Union[dict, DefiniteRange]]) - -slots.sequenceInterval__startIndefiniteRange = Slot(uri=PHENOPACKETS.startIndefiniteRange, name="sequenceInterval__startIndefiniteRange", curie=PHENOPACKETS.curie('startIndefiniteRange'), - model_uri=PHENOPACKETS.sequenceInterval__startIndefiniteRange, domain=None, range=Optional[Union[dict, IndefiniteRange]]) - -slots.sequenceInterval__startNumber = Slot(uri=PHENOPACKETS.startNumber, name="sequenceInterval__startNumber", curie=PHENOPACKETS.curie('startNumber'), - model_uri=PHENOPACKETS.sequenceInterval__startNumber, domain=None, range=Optional[Union[dict, Number]]) - -slots.sequenceLocation__id = Slot(uri=PHENOPACKETS.id, name="sequenceLocation__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.sequenceLocation__id, domain=None, range=Optional[str]) - -slots.sequenceLocation__sequenceId = Slot(uri=PHENOPACKETS.sequenceId, name="sequenceLocation__sequenceId", curie=PHENOPACKETS.curie('sequenceId'), - model_uri=PHENOPACKETS.sequenceLocation__sequenceId, domain=None, range=Optional[str]) - -slots.sequenceLocation__sequenceInterval = Slot(uri=PHENOPACKETS.sequenceInterval, name="sequenceLocation__sequenceInterval", curie=PHENOPACKETS.curie('sequenceInterval'), - model_uri=PHENOPACKETS.sequenceLocation__sequenceInterval, domain=None, range=Optional[Union[dict, SequenceInterval]]) - -slots.sequenceState__sequence = Slot(uri=PHENOPACKETS.sequence, name="sequenceState__sequence", curie=PHENOPACKETS.curie('sequence'), - model_uri=PHENOPACKETS.sequenceState__sequence, domain=None, range=Optional[str]) - -slots.simpleInterval__end = Slot(uri=PHENOPACKETS.end, name="simpleInterval__end", curie=PHENOPACKETS.curie('end'), - model_uri=PHENOPACKETS.simpleInterval__end, domain=None, range=Optional[int]) - -slots.simpleInterval__start = Slot(uri=PHENOPACKETS.start, name="simpleInterval__start", curie=PHENOPACKETS.curie('start'), - model_uri=PHENOPACKETS.simpleInterval__start, domain=None, range=Optional[int]) - -slots.systemicVariation__copyNumber = Slot(uri=PHENOPACKETS.copyNumber, name="systemicVariation__copyNumber", curie=PHENOPACKETS.curie('copyNumber'), - model_uri=PHENOPACKETS.systemicVariation__copyNumber, domain=None, range=Optional[Union[dict, CopyNumber]]) - -slots.text__definition = Slot(uri=PHENOPACKETS.definition, name="text__definition", curie=PHENOPACKETS.curie('definition'), - model_uri=PHENOPACKETS.text__definition, domain=None, range=Optional[str]) - -slots.text__id = Slot(uri=PHENOPACKETS.id, name="text__id", curie=PHENOPACKETS.curie('id'), - model_uri=PHENOPACKETS.text__id, domain=None, range=Optional[str]) - -slots.utilityVariation__text = Slot(uri=PHENOPACKETS.text, name="utilityVariation__text", curie=PHENOPACKETS.curie('text'), - model_uri=PHENOPACKETS.utilityVariation__text, domain=None, range=Optional[Union[dict, Text]]) - -slots.utilityVariation__variationSet = Slot(uri=PHENOPACKETS.variationSet, name="utilityVariation__variationSet", curie=PHENOPACKETS.curie('variationSet'), - model_uri=PHENOPACKETS.utilityVariation__variationSet, domain=None, range=Optional[Union[dict, VariationSet]]) - -slots.variation__allele = Slot(uri=PHENOPACKETS.allele, name="variation__allele", curie=PHENOPACKETS.curie('allele'), - model_uri=PHENOPACKETS.variation__allele, domain=None, range=Optional[Union[dict, Allele]]) - -slots.variation__copyNumber = Slot(uri=PHENOPACKETS.copyNumber, name="variation__copyNumber", curie=PHENOPACKETS.curie('copyNumber'), - model_uri=PHENOPACKETS.variation__copyNumber, domain=None, range=Optional[Union[dict, CopyNumber]]) - -slots.variation__haplotype = Slot(uri=PHENOPACKETS.haplotype, name="variation__haplotype", curie=PHENOPACKETS.curie('haplotype'), - model_uri=PHENOPACKETS.variation__haplotype, domain=None, range=Optional[Union[dict, Haplotype]]) - -slots.variation__text = Slot(uri=PHENOPACKETS.text, name="variation__text", curie=PHENOPACKETS.curie('text'), - model_uri=PHENOPACKETS.variation__text, domain=None, range=Optional[Union[dict, Text]]) -slots.variation__variationSet = Slot(uri=PHENOPACKETS.variationSet, name="variation__variationSet", curie=PHENOPACKETS.curie('variationSet'), - model_uri=PHENOPACKETS.variation__variationSet, domain=None, range=Optional[Union[dict, VariationSet]]) +slots.cohort__description = Slot( + uri=PHENOPACKETS.description, + name="cohort__description", + curie=PHENOPACKETS.curie("description"), + model_uri=PHENOPACKETS.cohort__description, + domain=None, + range=Optional[str], +) + +slots.cohort__files = Slot( + uri=PHENOPACKETS.files, + name="cohort__files", + curie=PHENOPACKETS.curie("files"), + model_uri=PHENOPACKETS.cohort__files, + domain=None, + range=Optional[Union[Union[dict, File], list[Union[dict, File]]]], +) + +slots.cohort__id = Slot( + uri=PHENOPACKETS.id, + name="cohort__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.cohort__id, + domain=None, + range=Optional[str], +) + +slots.cohort__members = Slot( + uri=PHENOPACKETS.members, + name="cohort__members", + curie=PHENOPACKETS.curie("members"), + model_uri=PHENOPACKETS.cohort__members, + domain=None, + range=Optional[Union[Union[dict, Phenopacket], list[Union[dict, Phenopacket]]]], +) + +slots.cohort__metaData = Slot( + uri=PHENOPACKETS.metaData, + name="cohort__metaData", + curie=PHENOPACKETS.curie("metaData"), + model_uri=PHENOPACKETS.cohort__metaData, + domain=None, + range=Union[dict, MetaData], +) + +slots.family__consanguinousParents = Slot( + uri=PHENOPACKETS.consanguinousParents, + name="family__consanguinousParents", + curie=PHENOPACKETS.curie("consanguinousParents"), + model_uri=PHENOPACKETS.family__consanguinousParents, + domain=None, + range=Optional[Union[bool, Bool]], +) + +slots.family__files = Slot( + uri=PHENOPACKETS.files, + name="family__files", + curie=PHENOPACKETS.curie("files"), + model_uri=PHENOPACKETS.family__files, + domain=None, + range=Optional[Union[Union[dict, File], list[Union[dict, File]]]], +) + +slots.family__id = Slot( + uri=PHENOPACKETS.id, + name="family__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.family__id, + domain=None, + range=Optional[str], +) + +slots.family__metaData = Slot( + uri=PHENOPACKETS.metaData, + name="family__metaData", + curie=PHENOPACKETS.curie("metaData"), + model_uri=PHENOPACKETS.family__metaData, + domain=None, + range=Union[dict, MetaData], +) + +slots.family__pedigree = Slot( + uri=PHENOPACKETS.pedigree, + name="family__pedigree", + curie=PHENOPACKETS.curie("pedigree"), + model_uri=PHENOPACKETS.family__pedigree, + domain=None, + range=Optional[Union[dict, Pedigree]], +) + +slots.family__proband = Slot( + uri=PHENOPACKETS.proband, + name="family__proband", + curie=PHENOPACKETS.curie("proband"), + model_uri=PHENOPACKETS.family__proband, + domain=None, + range=Optional[Union[dict, Phenopacket]], +) + +slots.family__relatives = Slot( + uri=PHENOPACKETS.relatives, + name="family__relatives", + curie=PHENOPACKETS.curie("relatives"), + model_uri=PHENOPACKETS.family__relatives, + domain=None, + range=Optional[Union[Union[dict, Phenopacket], list[Union[dict, Phenopacket]]]], +) + +slots.phenopacket__biosamples = Slot( + uri=PHENOPACKETS.biosamples, + name="phenopacket__biosamples", + curie=PHENOPACKETS.curie("biosamples"), + model_uri=PHENOPACKETS.phenopacket__biosamples, + domain=None, + range=Optional[Union[Union[dict, Biosample], list[Union[dict, Biosample]]]], +) + +slots.phenopacket__diseases = Slot( + uri=PHENOPACKETS.diseases, + name="phenopacket__diseases", + curie=PHENOPACKETS.curie("diseases"), + model_uri=PHENOPACKETS.phenopacket__diseases, + domain=None, + range=Optional[Union[Union[dict, Disease], list[Union[dict, Disease]]]], +) + +slots.phenopacket__files = Slot( + uri=PHENOPACKETS.files, + name="phenopacket__files", + curie=PHENOPACKETS.curie("files"), + model_uri=PHENOPACKETS.phenopacket__files, + domain=None, + range=Optional[Union[Union[dict, File], list[Union[dict, File]]]], +) + +slots.phenopacket__id = Slot( + uri=PHENOPACKETS.id, + name="phenopacket__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.phenopacket__id, + domain=None, + range=Optional[str], +) + +slots.phenopacket__interpretations = Slot( + uri=PHENOPACKETS.interpretations, + name="phenopacket__interpretations", + curie=PHENOPACKETS.curie("interpretations"), + model_uri=PHENOPACKETS.phenopacket__interpretations, + domain=None, + range=Optional[Union[Union[dict, Interpretation], list[Union[dict, Interpretation]]]], +) + +slots.phenopacket__measurements = Slot( + uri=PHENOPACKETS.measurements, + name="phenopacket__measurements", + curie=PHENOPACKETS.curie("measurements"), + model_uri=PHENOPACKETS.phenopacket__measurements, + domain=None, + range=Optional[Union[Union[dict, Measurement], list[Union[dict, Measurement]]]], +) + +slots.phenopacket__medicalActions = Slot( + uri=PHENOPACKETS.medicalActions, + name="phenopacket__medicalActions", + curie=PHENOPACKETS.curie("medicalActions"), + model_uri=PHENOPACKETS.phenopacket__medicalActions, + domain=None, + range=Optional[Union[Union[dict, MedicalAction], list[Union[dict, MedicalAction]]]], +) + +slots.phenopacket__metaData = Slot( + uri=PHENOPACKETS.metaData, + name="phenopacket__metaData", + curie=PHENOPACKETS.curie("metaData"), + model_uri=PHENOPACKETS.phenopacket__metaData, + domain=None, + range=Union[dict, MetaData], +) + +slots.phenopacket__phenotypicFeatures = Slot( + uri=PHENOPACKETS.phenotypicFeatures, + name="phenopacket__phenotypicFeatures", + curie=PHENOPACKETS.curie("phenotypicFeatures"), + model_uri=PHENOPACKETS.phenopacket__phenotypicFeatures, + domain=None, + range=Optional[Union[Union[dict, PhenotypicFeature], list[Union[dict, PhenotypicFeature]]]], +) + +slots.phenopacket__subject = Slot( + uri=PHENOPACKETS.subject, + name="phenopacket__subject", + curie=PHENOPACKETS.curie("subject"), + model_uri=PHENOPACKETS.phenopacket__subject, + domain=None, + range=Optional[Union[dict, Individual]], +) + +slots.age__iso8601duration = Slot( + uri=PHENOPACKETS.iso8601duration, + name="age__iso8601duration", + curie=PHENOPACKETS.curie("iso8601duration"), + model_uri=PHENOPACKETS.age__iso8601duration, + domain=None, + range=Optional[str], +) + +slots.ageRange__end = Slot( + uri=PHENOPACKETS.end, + name="ageRange__end", + curie=PHENOPACKETS.curie("end"), + model_uri=PHENOPACKETS.ageRange__end, + domain=None, + range=Optional[Union[dict, Age]], +) + +slots.ageRange__start = Slot( + uri=PHENOPACKETS.start, + name="ageRange__start", + curie=PHENOPACKETS.curie("start"), + model_uri=PHENOPACKETS.ageRange__start, + domain=None, + range=Optional[Union[dict, Age]], +) + +slots.evidence__evidenceCode = Slot( + uri=PHENOPACKETS.evidenceCode, + name="evidence__evidenceCode", + curie=PHENOPACKETS.curie("evidenceCode"), + model_uri=PHENOPACKETS.evidence__evidenceCode, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.evidence__reference = Slot( + uri=PHENOPACKETS.reference, + name="evidence__reference", + curie=PHENOPACKETS.curie("reference"), + model_uri=PHENOPACKETS.evidence__reference, + domain=None, + range=Optional[Union[dict, ExternalReference]], +) + +slots.externalReference__description = Slot( + uri=PHENOPACKETS.description, + name="externalReference__description", + curie=PHENOPACKETS.curie("description"), + model_uri=PHENOPACKETS.externalReference__description, + domain=None, + range=Optional[str], +) + +slots.externalReference__id = Slot( + uri=PHENOPACKETS.id, + name="externalReference__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.externalReference__id, + domain=None, + range=Optional[str], +) + +slots.externalReference__reference = Slot( + uri=PHENOPACKETS.reference, + name="externalReference__reference", + curie=PHENOPACKETS.curie("reference"), + model_uri=PHENOPACKETS.externalReference__reference, + domain=None, + range=Optional[str], +) + +slots.file__fileAttributes = Slot( + uri=PHENOPACKETS.fileAttributes, + name="file__fileAttributes", + curie=PHENOPACKETS.curie("fileAttributes"), + model_uri=PHENOPACKETS.file__fileAttributes, + domain=None, + range=Optional[Union[dict, Dictionary]], +) + +slots.file__individualToFileIdentifiers = Slot( + uri=PHENOPACKETS.individualToFileIdentifiers, + name="file__individualToFileIdentifiers", + curie=PHENOPACKETS.curie("individualToFileIdentifiers"), + model_uri=PHENOPACKETS.file__individualToFileIdentifiers, + domain=None, + range=Optional[Union[dict, Dictionary]], +) + +slots.file__uri = Slot( + uri=PHENOPACKETS.uri, + name="file__uri", + curie=PHENOPACKETS.curie("uri"), + model_uri=PHENOPACKETS.file__uri, + domain=None, + range=Optional[str], +) + +slots.gestationalAge__days = Slot( + uri=PHENOPACKETS.days, + name="gestationalAge__days", + curie=PHENOPACKETS.curie("days"), + model_uri=PHENOPACKETS.gestationalAge__days, + domain=None, + range=Optional[int], +) + +slots.gestationalAge__weeks = Slot( + uri=PHENOPACKETS.weeks, + name="gestationalAge__weeks", + curie=PHENOPACKETS.curie("weeks"), + model_uri=PHENOPACKETS.gestationalAge__weeks, + domain=None, + range=Optional[int], +) + +slots.ontologyClass__id = Slot( + uri=PHENOPACKETS.id, + name="ontologyClass__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.ontologyClass__id, + domain=None, + range=URIRef, +) + +slots.ontologyClass__label = Slot( + uri=PHENOPACKETS.label, + name="ontologyClass__label", + curie=PHENOPACKETS.curie("label"), + model_uri=PHENOPACKETS.ontologyClass__label, + domain=None, + range=Optional[str], +) + +slots.procedure__bodySite = Slot( + uri=PHENOPACKETS.bodySite, + name="procedure__bodySite", + curie=PHENOPACKETS.curie("bodySite"), + model_uri=PHENOPACKETS.procedure__bodySite, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.procedure__code = Slot( + uri=PHENOPACKETS.code, + name="procedure__code", + curie=PHENOPACKETS.curie("code"), + model_uri=PHENOPACKETS.procedure__code, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.procedure__performed = Slot( + uri=PHENOPACKETS.performed, + name="procedure__performed", + curie=PHENOPACKETS.curie("performed"), + model_uri=PHENOPACKETS.procedure__performed, + domain=None, + range=Optional[Union[dict, TimeElement]], +) + +slots.timeElement__age = Slot( + uri=PHENOPACKETS.age, + name="timeElement__age", + curie=PHENOPACKETS.curie("age"), + model_uri=PHENOPACKETS.timeElement__age, + domain=None, + range=Optional[Union[dict, Age]], +) + +slots.timeElement__ageRange = Slot( + uri=PHENOPACKETS.ageRange, + name="timeElement__ageRange", + curie=PHENOPACKETS.curie("ageRange"), + model_uri=PHENOPACKETS.timeElement__ageRange, + domain=None, + range=Optional[Union[dict, AgeRange]], +) + +slots.timeElement__gestationalAge = Slot( + uri=PHENOPACKETS.gestationalAge, + name="timeElement__gestationalAge", + curie=PHENOPACKETS.curie("gestationalAge"), + model_uri=PHENOPACKETS.timeElement__gestationalAge, + domain=None, + range=Optional[Union[dict, GestationalAge]], +) + +slots.timeElement__interval = Slot( + uri=PHENOPACKETS.interval, + name="timeElement__interval", + curie=PHENOPACKETS.curie("interval"), + model_uri=PHENOPACKETS.timeElement__interval, + domain=None, + range=Optional[Union[dict, TimeInterval]], +) + +slots.timeElement__ontologyClass = Slot( + uri=PHENOPACKETS.ontologyClass, + name="timeElement__ontologyClass", + curie=PHENOPACKETS.curie("ontologyClass"), + model_uri=PHENOPACKETS.timeElement__ontologyClass, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.timeElement__timestamp = Slot( + uri=PHENOPACKETS.timestamp, + name="timeElement__timestamp", + curie=PHENOPACKETS.curie("timestamp"), + model_uri=PHENOPACKETS.timeElement__timestamp, + domain=None, + range=Optional[str], +) + +slots.timeInterval__end = Slot( + uri=PHENOPACKETS.end, + name="timeInterval__end", + curie=PHENOPACKETS.curie("end"), + model_uri=PHENOPACKETS.timeInterval__end, + domain=None, + range=Optional[str], +) + +slots.timeInterval__start = Slot( + uri=PHENOPACKETS.start, + name="timeInterval__start", + curie=PHENOPACKETS.curie("start"), + model_uri=PHENOPACKETS.timeInterval__start, + domain=None, + range=Optional[str], +) + +slots.biosample__derivedFromId = Slot( + uri=PHENOPACKETS.derivedFromId, + name="biosample__derivedFromId", + curie=PHENOPACKETS.curie("derivedFromId"), + model_uri=PHENOPACKETS.biosample__derivedFromId, + domain=None, + range=Optional[str], +) + +slots.biosample__description = Slot( + uri=PHENOPACKETS.description, + name="biosample__description", + curie=PHENOPACKETS.curie("description"), + model_uri=PHENOPACKETS.biosample__description, + domain=None, + range=Optional[str], +) + +slots.biosample__diagnosticMarkers = Slot( + uri=PHENOPACKETS.diagnosticMarkers, + name="biosample__diagnosticMarkers", + curie=PHENOPACKETS.curie("diagnosticMarkers"), + model_uri=PHENOPACKETS.biosample__diagnosticMarkers, + domain=None, + range=Optional[ + Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]] + ], +) + +slots.biosample__files = Slot( + uri=PHENOPACKETS.files, + name="biosample__files", + curie=PHENOPACKETS.curie("files"), + model_uri=PHENOPACKETS.biosample__files, + domain=None, + range=Optional[Union[Union[dict, File], list[Union[dict, File]]]], +) + +slots.biosample__histologicalDiagnosis = Slot( + uri=PHENOPACKETS.histologicalDiagnosis, + name="biosample__histologicalDiagnosis", + curie=PHENOPACKETS.curie("histologicalDiagnosis"), + model_uri=PHENOPACKETS.biosample__histologicalDiagnosis, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.biosample__id = Slot( + uri=PHENOPACKETS.id, + name="biosample__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.biosample__id, + domain=None, + range=Optional[str], +) + +slots.biosample__individualId = Slot( + uri=PHENOPACKETS.individualId, + name="biosample__individualId", + curie=PHENOPACKETS.curie("individualId"), + model_uri=PHENOPACKETS.biosample__individualId, + domain=None, + range=Optional[str], +) + +slots.biosample__materialSample = Slot( + uri=PHENOPACKETS.materialSample, + name="biosample__materialSample", + curie=PHENOPACKETS.curie("materialSample"), + model_uri=PHENOPACKETS.biosample__materialSample, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.biosample__measurements = Slot( + uri=PHENOPACKETS.measurements, + name="biosample__measurements", + curie=PHENOPACKETS.curie("measurements"), + model_uri=PHENOPACKETS.biosample__measurements, + domain=None, + range=Optional[Union[Union[dict, Measurement], list[Union[dict, Measurement]]]], +) + +slots.biosample__pathologicalStage = Slot( + uri=PHENOPACKETS.pathologicalStage, + name="biosample__pathologicalStage", + curie=PHENOPACKETS.curie("pathologicalStage"), + model_uri=PHENOPACKETS.biosample__pathologicalStage, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.biosample__pathologicalTnmFinding = Slot( + uri=PHENOPACKETS.pathologicalTnmFinding, + name="biosample__pathologicalTnmFinding", + curie=PHENOPACKETS.curie("pathologicalTnmFinding"), + model_uri=PHENOPACKETS.biosample__pathologicalTnmFinding, + domain=None, + range=Optional[ + Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]] + ], +) + +slots.biosample__phenotypicFeatures = Slot( + uri=PHENOPACKETS.phenotypicFeatures, + name="biosample__phenotypicFeatures", + curie=PHENOPACKETS.curie("phenotypicFeatures"), + model_uri=PHENOPACKETS.biosample__phenotypicFeatures, + domain=None, + range=Optional[Union[Union[dict, PhenotypicFeature], list[Union[dict, PhenotypicFeature]]]], +) + +slots.biosample__procedure = Slot( + uri=PHENOPACKETS.procedure, + name="biosample__procedure", + curie=PHENOPACKETS.curie("procedure"), + model_uri=PHENOPACKETS.biosample__procedure, + domain=None, + range=Optional[Union[dict, Procedure]], +) + +slots.biosample__sampleProcessing = Slot( + uri=PHENOPACKETS.sampleProcessing, + name="biosample__sampleProcessing", + curie=PHENOPACKETS.curie("sampleProcessing"), + model_uri=PHENOPACKETS.biosample__sampleProcessing, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.biosample__sampleStorage = Slot( + uri=PHENOPACKETS.sampleStorage, + name="biosample__sampleStorage", + curie=PHENOPACKETS.curie("sampleStorage"), + model_uri=PHENOPACKETS.biosample__sampleStorage, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.biosample__sampleType = Slot( + uri=PHENOPACKETS.sampleType, + name="biosample__sampleType", + curie=PHENOPACKETS.curie("sampleType"), + model_uri=PHENOPACKETS.biosample__sampleType, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.biosample__sampledTissue = Slot( + uri=PHENOPACKETS.sampledTissue, + name="biosample__sampledTissue", + curie=PHENOPACKETS.curie("sampledTissue"), + model_uri=PHENOPACKETS.biosample__sampledTissue, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.biosample__taxonomy = Slot( + uri=PHENOPACKETS.taxonomy, + name="biosample__taxonomy", + curie=PHENOPACKETS.curie("taxonomy"), + model_uri=PHENOPACKETS.biosample__taxonomy, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.biosample__timeOfCollection = Slot( + uri=PHENOPACKETS.timeOfCollection, + name="biosample__timeOfCollection", + curie=PHENOPACKETS.curie("timeOfCollection"), + model_uri=PHENOPACKETS.biosample__timeOfCollection, + domain=None, + range=Optional[Union[dict, TimeElement]], +) + +slots.biosample__tumorGrade = Slot( + uri=PHENOPACKETS.tumorGrade, + name="biosample__tumorGrade", + curie=PHENOPACKETS.curie("tumorGrade"), + model_uri=PHENOPACKETS.biosample__tumorGrade, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.biosample__tumorProgression = Slot( + uri=PHENOPACKETS.tumorProgression, + name="biosample__tumorProgression", + curie=PHENOPACKETS.curie("tumorProgression"), + model_uri=PHENOPACKETS.biosample__tumorProgression, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.disease__clinicalTnmFinding = Slot( + uri=PHENOPACKETS.clinicalTnmFinding, + name="disease__clinicalTnmFinding", + curie=PHENOPACKETS.curie("clinicalTnmFinding"), + model_uri=PHENOPACKETS.disease__clinicalTnmFinding, + domain=None, + range=Optional[ + Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]] + ], +) + +slots.disease__diseaseStage = Slot( + uri=PHENOPACKETS.diseaseStage, + name="disease__diseaseStage", + curie=PHENOPACKETS.curie("diseaseStage"), + model_uri=PHENOPACKETS.disease__diseaseStage, + domain=None, + range=Optional[ + Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]] + ], +) + +slots.disease__excluded = Slot( + uri=PHENOPACKETS.excluded, + name="disease__excluded", + curie=PHENOPACKETS.curie("excluded"), + model_uri=PHENOPACKETS.disease__excluded, + domain=None, + range=Optional[Union[bool, Bool]], +) + +slots.disease__laterality = Slot( + uri=PHENOPACKETS.laterality, + name="disease__laterality", + curie=PHENOPACKETS.curie("laterality"), + model_uri=PHENOPACKETS.disease__laterality, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.disease__onset = Slot( + uri=PHENOPACKETS.onset, + name="disease__onset", + curie=PHENOPACKETS.curie("onset"), + model_uri=PHENOPACKETS.disease__onset, + domain=None, + range=Optional[Union[dict, TimeElement]], +) + +slots.disease__primarySite = Slot( + uri=PHENOPACKETS.primarySite, + name="disease__primarySite", + curie=PHENOPACKETS.curie("primarySite"), + model_uri=PHENOPACKETS.disease__primarySite, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.disease__resolution = Slot( + uri=PHENOPACKETS.resolution, + name="disease__resolution", + curie=PHENOPACKETS.curie("resolution"), + model_uri=PHENOPACKETS.disease__resolution, + domain=None, + range=Optional[Union[dict, TimeElement]], +) + +slots.disease__term = Slot( + uri=PHENOPACKETS.term, + name="disease__term", + curie=PHENOPACKETS.curie("term"), + model_uri=PHENOPACKETS.disease__term, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.diagnosis__disease = Slot( + uri=PHENOPACKETS.disease, + name="diagnosis__disease", + curie=PHENOPACKETS.curie("disease"), + model_uri=PHENOPACKETS.diagnosis__disease, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.diagnosis__genomicInterpretations = Slot( + uri=PHENOPACKETS.genomicInterpretations, + name="diagnosis__genomicInterpretations", + curie=PHENOPACKETS.curie("genomicInterpretations"), + model_uri=PHENOPACKETS.diagnosis__genomicInterpretations, + domain=None, + range=Optional[Union[Union[dict, GenomicInterpretation], list[Union[dict, GenomicInterpretation]]]], +) + +slots.genomicInterpretation__gene = Slot( + uri=PHENOPACKETS.gene, + name="genomicInterpretation__gene", + curie=PHENOPACKETS.curie("gene"), + model_uri=PHENOPACKETS.genomicInterpretation__gene, + domain=None, + range=Optional[Union[dict, GeneDescriptor]], +) + +slots.genomicInterpretation__interpretationStatus = Slot( + uri=PHENOPACKETS.interpretationStatus, + name="genomicInterpretation__interpretationStatus", + curie=PHENOPACKETS.curie("interpretationStatus"), + model_uri=PHENOPACKETS.genomicInterpretation__interpretationStatus, + domain=None, + range=Optional[Union[str, "InterpretationStatus"]], +) + +slots.genomicInterpretation__subjectOrBiosampleId = Slot( + uri=PHENOPACKETS.subjectOrBiosampleId, + name="genomicInterpretation__subjectOrBiosampleId", + curie=PHENOPACKETS.curie("subjectOrBiosampleId"), + model_uri=PHENOPACKETS.genomicInterpretation__subjectOrBiosampleId, + domain=None, + range=Optional[str], +) + +slots.genomicInterpretation__variantInterpretation = Slot( + uri=PHENOPACKETS.variantInterpretation, + name="genomicInterpretation__variantInterpretation", + curie=PHENOPACKETS.curie("variantInterpretation"), + model_uri=PHENOPACKETS.genomicInterpretation__variantInterpretation, + domain=None, + range=Optional[Union[dict, VariantInterpretation]], +) + +slots.interpretation__diagnosis = Slot( + uri=PHENOPACKETS.diagnosis, + name="interpretation__diagnosis", + curie=PHENOPACKETS.curie("diagnosis"), + model_uri=PHENOPACKETS.interpretation__diagnosis, + domain=None, + range=Optional[Union[dict, Diagnosis]], +) + +slots.interpretation__id = Slot( + uri=PHENOPACKETS.id, + name="interpretation__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.interpretation__id, + domain=None, + range=Optional[str], +) + +slots.interpretation__progressStatus = Slot( + uri=PHENOPACKETS.progressStatus, + name="interpretation__progressStatus", + curie=PHENOPACKETS.curie("progressStatus"), + model_uri=PHENOPACKETS.interpretation__progressStatus, + domain=None, + range=Optional[Union[str, "ProgressStatus"]], +) + +slots.interpretation__summary = Slot( + uri=PHENOPACKETS.summary, + name="interpretation__summary", + curie=PHENOPACKETS.curie("summary"), + model_uri=PHENOPACKETS.interpretation__summary, + domain=None, + range=Optional[str], +) + +slots.variantInterpretation__acmgPathogenicityClassification = Slot( + uri=PHENOPACKETS.acmgPathogenicityClassification, + name="variantInterpretation__acmgPathogenicityClassification", + curie=PHENOPACKETS.curie("acmgPathogenicityClassification"), + model_uri=PHENOPACKETS.variantInterpretation__acmgPathogenicityClassification, + domain=None, + range=Optional[Union[str, "AcmgPathogenicityClassification"]], +) + +slots.variantInterpretation__therapeuticActionability = Slot( + uri=PHENOPACKETS.therapeuticActionability, + name="variantInterpretation__therapeuticActionability", + curie=PHENOPACKETS.curie("therapeuticActionability"), + model_uri=PHENOPACKETS.variantInterpretation__therapeuticActionability, + domain=None, + range=Optional[Union[str, "TherapeuticActionability"]], +) + +slots.variantInterpretation__variationDescriptor = Slot( + uri=PHENOPACKETS.variationDescriptor, + name="variantInterpretation__variationDescriptor", + curie=PHENOPACKETS.curie("variationDescriptor"), + model_uri=PHENOPACKETS.variantInterpretation__variationDescriptor, + domain=None, + range=Optional[Union[dict, VariationDescriptor]], +) + +slots.individual__alternateIds = Slot( + uri=PHENOPACKETS.alternateIds, + name="individual__alternateIds", + curie=PHENOPACKETS.curie("alternateIds"), + model_uri=PHENOPACKETS.individual__alternateIds, + domain=None, + range=Optional[Union[str, list[str]]], +) + +slots.individual__dateOfBirth = Slot( + uri=PHENOPACKETS.dateOfBirth, + name="individual__dateOfBirth", + curie=PHENOPACKETS.curie("dateOfBirth"), + model_uri=PHENOPACKETS.individual__dateOfBirth, + domain=None, + range=Optional[str], +) + +slots.individual__gender = Slot( + uri=PHENOPACKETS.gender, + name="individual__gender", + curie=PHENOPACKETS.curie("gender"), + model_uri=PHENOPACKETS.individual__gender, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.individual__id = Slot( + uri=PHENOPACKETS.id, + name="individual__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.individual__id, + domain=None, + range=Optional[str], +) + +slots.individual__karyotypicSex = Slot( + uri=PHENOPACKETS.karyotypicSex, + name="individual__karyotypicSex", + curie=PHENOPACKETS.curie("karyotypicSex"), + model_uri=PHENOPACKETS.individual__karyotypicSex, + domain=None, + range=Optional[Union[str, "KaryotypicSex"]], +) + +slots.individual__sex = Slot( + uri=PHENOPACKETS.sex, + name="individual__sex", + curie=PHENOPACKETS.curie("sex"), + model_uri=PHENOPACKETS.individual__sex, + domain=None, + range=Optional[Union[str, "Sex"]], +) + +slots.individual__taxonomy = Slot( + uri=PHENOPACKETS.taxonomy, + name="individual__taxonomy", + curie=PHENOPACKETS.curie("taxonomy"), + model_uri=PHENOPACKETS.individual__taxonomy, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.individual__timeAtLastEncounter = Slot( + uri=PHENOPACKETS.timeAtLastEncounter, + name="individual__timeAtLastEncounter", + curie=PHENOPACKETS.curie("timeAtLastEncounter"), + model_uri=PHENOPACKETS.individual__timeAtLastEncounter, + domain=None, + range=Optional[Union[dict, TimeElement]], +) + +slots.individual__vitalStatus = Slot( + uri=PHENOPACKETS.vitalStatus, + name="individual__vitalStatus", + curie=PHENOPACKETS.curie("vitalStatus"), + model_uri=PHENOPACKETS.individual__vitalStatus, + domain=None, + range=Optional[Union[dict, VitalStatus]], +) + +slots.vitalStatus__causeOfDeath = Slot( + uri=PHENOPACKETS.causeOfDeath, + name="vitalStatus__causeOfDeath", + curie=PHENOPACKETS.curie("causeOfDeath"), + model_uri=PHENOPACKETS.vitalStatus__causeOfDeath, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.vitalStatus__status = Slot( + uri=PHENOPACKETS.status, + name="vitalStatus__status", + curie=PHENOPACKETS.curie("status"), + model_uri=PHENOPACKETS.vitalStatus__status, + domain=None, + range=Optional[Union[str, "Status"]], +) + +slots.vitalStatus__survivalTimeInDays = Slot( + uri=PHENOPACKETS.survivalTimeInDays, + name="vitalStatus__survivalTimeInDays", + curie=PHENOPACKETS.curie("survivalTimeInDays"), + model_uri=PHENOPACKETS.vitalStatus__survivalTimeInDays, + domain=None, + range=Optional[int], +) + +slots.vitalStatus__timeOfDeath = Slot( + uri=PHENOPACKETS.timeOfDeath, + name="vitalStatus__timeOfDeath", + curie=PHENOPACKETS.curie("timeOfDeath"), + model_uri=PHENOPACKETS.vitalStatus__timeOfDeath, + domain=None, + range=Optional[Union[dict, TimeElement]], +) + +slots.complexValue__typedQuantities = Slot( + uri=PHENOPACKETS.typedQuantities, + name="complexValue__typedQuantities", + curie=PHENOPACKETS.curie("typedQuantities"), + model_uri=PHENOPACKETS.complexValue__typedQuantities, + domain=None, + range=Optional[Union[Union[dict, TypedQuantity], list[Union[dict, TypedQuantity]]]], +) + +slots.measurement__assay = Slot( + uri=PHENOPACKETS.assay, + name="measurement__assay", + curie=PHENOPACKETS.curie("assay"), + model_uri=PHENOPACKETS.measurement__assay, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.measurement__complexValue = Slot( + uri=PHENOPACKETS.complexValue, + name="measurement__complexValue", + curie=PHENOPACKETS.curie("complexValue"), + model_uri=PHENOPACKETS.measurement__complexValue, + domain=None, + range=Optional[Union[dict, ComplexValue]], +) + +slots.measurement__description = Slot( + uri=PHENOPACKETS.description, + name="measurement__description", + curie=PHENOPACKETS.curie("description"), + model_uri=PHENOPACKETS.measurement__description, + domain=None, + range=Optional[str], +) + +slots.measurement__procedure = Slot( + uri=PHENOPACKETS.procedure, + name="measurement__procedure", + curie=PHENOPACKETS.curie("procedure"), + model_uri=PHENOPACKETS.measurement__procedure, + domain=None, + range=Optional[Union[dict, Procedure]], +) + +slots.measurement__timeObserved = Slot( + uri=PHENOPACKETS.timeObserved, + name="measurement__timeObserved", + curie=PHENOPACKETS.curie("timeObserved"), + model_uri=PHENOPACKETS.measurement__timeObserved, + domain=None, + range=Optional[Union[dict, TimeElement]], +) + +slots.measurement__value = Slot( + uri=PHENOPACKETS.value, + name="measurement__value", + curie=PHENOPACKETS.curie("value"), + model_uri=PHENOPACKETS.measurement__value, + domain=None, + range=Optional[Union[dict, Value]], +) + +slots.quantity__referenceRange = Slot( + uri=PHENOPACKETS.referenceRange, + name="quantity__referenceRange", + curie=PHENOPACKETS.curie("referenceRange"), + model_uri=PHENOPACKETS.quantity__referenceRange, + domain=None, + range=Optional[Union[dict, ReferenceRange]], +) + +slots.quantity__unit = Slot( + uri=PHENOPACKETS.unit, + name="quantity__unit", + curie=PHENOPACKETS.curie("unit"), + model_uri=PHENOPACKETS.quantity__unit, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.quantity__value = Slot( + uri=PHENOPACKETS.value, + name="quantity__value", + curie=PHENOPACKETS.curie("value"), + model_uri=PHENOPACKETS.quantity__value, + domain=None, + range=Optional[float], +) + +slots.referenceRange__high = Slot( + uri=PHENOPACKETS.high, + name="referenceRange__high", + curie=PHENOPACKETS.curie("high"), + model_uri=PHENOPACKETS.referenceRange__high, + domain=None, + range=Optional[float], +) + +slots.referenceRange__low = Slot( + uri=PHENOPACKETS.low, + name="referenceRange__low", + curie=PHENOPACKETS.curie("low"), + model_uri=PHENOPACKETS.referenceRange__low, + domain=None, + range=Optional[float], +) + +slots.referenceRange__unit = Slot( + uri=PHENOPACKETS.unit, + name="referenceRange__unit", + curie=PHENOPACKETS.curie("unit"), + model_uri=PHENOPACKETS.referenceRange__unit, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.typedQuantity__quantity = Slot( + uri=PHENOPACKETS.quantity, + name="typedQuantity__quantity", + curie=PHENOPACKETS.curie("quantity"), + model_uri=PHENOPACKETS.typedQuantity__quantity, + domain=None, + range=Optional[Union[dict, Quantity]], +) + +slots.typedQuantity__type = Slot( + uri=PHENOPACKETS.type, + name="typedQuantity__type", + curie=PHENOPACKETS.curie("type"), + model_uri=PHENOPACKETS.typedQuantity__type, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.value__ontologyClass = Slot( + uri=PHENOPACKETS.ontologyClass, + name="value__ontologyClass", + curie=PHENOPACKETS.curie("ontologyClass"), + model_uri=PHENOPACKETS.value__ontologyClass, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.value__quantity = Slot( + uri=PHENOPACKETS.quantity, + name="value__quantity", + curie=PHENOPACKETS.curie("quantity"), + model_uri=PHENOPACKETS.value__quantity, + domain=None, + range=Optional[Union[dict, Quantity]], +) + +slots.doseInterval__interval = Slot( + uri=PHENOPACKETS.interval, + name="doseInterval__interval", + curie=PHENOPACKETS.curie("interval"), + model_uri=PHENOPACKETS.doseInterval__interval, + domain=None, + range=Optional[Union[dict, TimeInterval]], +) + +slots.doseInterval__quantity = Slot( + uri=PHENOPACKETS.quantity, + name="doseInterval__quantity", + curie=PHENOPACKETS.curie("quantity"), + model_uri=PHENOPACKETS.doseInterval__quantity, + domain=None, + range=Optional[Union[dict, Quantity]], +) + +slots.doseInterval__scheduleFrequency = Slot( + uri=PHENOPACKETS.scheduleFrequency, + name="doseInterval__scheduleFrequency", + curie=PHENOPACKETS.curie("scheduleFrequency"), + model_uri=PHENOPACKETS.doseInterval__scheduleFrequency, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.medicalAction__adverseEvents = Slot( + uri=PHENOPACKETS.adverseEvents, + name="medicalAction__adverseEvents", + curie=PHENOPACKETS.curie("adverseEvents"), + model_uri=PHENOPACKETS.medicalAction__adverseEvents, + domain=None, + range=Optional[ + Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]] + ], +) + +slots.medicalAction__procedure = Slot( + uri=PHENOPACKETS.procedure, + name="medicalAction__procedure", + curie=PHENOPACKETS.curie("procedure"), + model_uri=PHENOPACKETS.medicalAction__procedure, + domain=None, + range=Optional[Union[dict, Procedure]], +) + +slots.medicalAction__radiationTherapy = Slot( + uri=PHENOPACKETS.radiationTherapy, + name="medicalAction__radiationTherapy", + curie=PHENOPACKETS.curie("radiationTherapy"), + model_uri=PHENOPACKETS.medicalAction__radiationTherapy, + domain=None, + range=Optional[Union[dict, RadiationTherapy]], +) + +slots.medicalAction__responseToTreatment = Slot( + uri=PHENOPACKETS.responseToTreatment, + name="medicalAction__responseToTreatment", + curie=PHENOPACKETS.curie("responseToTreatment"), + model_uri=PHENOPACKETS.medicalAction__responseToTreatment, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.medicalAction__therapeuticRegimen = Slot( + uri=PHENOPACKETS.therapeuticRegimen, + name="medicalAction__therapeuticRegimen", + curie=PHENOPACKETS.curie("therapeuticRegimen"), + model_uri=PHENOPACKETS.medicalAction__therapeuticRegimen, + domain=None, + range=Optional[Union[dict, TherapeuticRegimen]], +) + +slots.medicalAction__treatment = Slot( + uri=PHENOPACKETS.treatment, + name="medicalAction__treatment", + curie=PHENOPACKETS.curie("treatment"), + model_uri=PHENOPACKETS.medicalAction__treatment, + domain=None, + range=Optional[Union[dict, Treatment]], +) + +slots.medicalAction__treatmentIntent = Slot( + uri=PHENOPACKETS.treatmentIntent, + name="medicalAction__treatmentIntent", + curie=PHENOPACKETS.curie("treatmentIntent"), + model_uri=PHENOPACKETS.medicalAction__treatmentIntent, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.medicalAction__treatmentTarget = Slot( + uri=PHENOPACKETS.treatmentTarget, + name="medicalAction__treatmentTarget", + curie=PHENOPACKETS.curie("treatmentTarget"), + model_uri=PHENOPACKETS.medicalAction__treatmentTarget, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.medicalAction__treatmentTerminationReason = Slot( + uri=PHENOPACKETS.treatmentTerminationReason, + name="medicalAction__treatmentTerminationReason", + curie=PHENOPACKETS.curie("treatmentTerminationReason"), + model_uri=PHENOPACKETS.medicalAction__treatmentTerminationReason, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.radiationTherapy__bodySite = Slot( + uri=PHENOPACKETS.bodySite, + name="radiationTherapy__bodySite", + curie=PHENOPACKETS.curie("bodySite"), + model_uri=PHENOPACKETS.radiationTherapy__bodySite, + domain=None, + range=Union[dict, OntologyClass], +) + +slots.radiationTherapy__dosage = Slot( + uri=PHENOPACKETS.dosage, + name="radiationTherapy__dosage", + curie=PHENOPACKETS.curie("dosage"), + model_uri=PHENOPACKETS.radiationTherapy__dosage, + domain=None, + range=int, +) + +slots.radiationTherapy__fractions = Slot( + uri=PHENOPACKETS.fractions, + name="radiationTherapy__fractions", + curie=PHENOPACKETS.curie("fractions"), + model_uri=PHENOPACKETS.radiationTherapy__fractions, + domain=None, + range=int, +) + +slots.radiationTherapy__modality = Slot( + uri=PHENOPACKETS.modality, + name="radiationTherapy__modality", + curie=PHENOPACKETS.curie("modality"), + model_uri=PHENOPACKETS.radiationTherapy__modality, + domain=None, + range=Union[dict, OntologyClass], +) + +slots.therapeuticRegimen__endTime = Slot( + uri=PHENOPACKETS.endTime, + name="therapeuticRegimen__endTime", + curie=PHENOPACKETS.curie("endTime"), + model_uri=PHENOPACKETS.therapeuticRegimen__endTime, + domain=None, + range=Optional[Union[dict, TimeElement]], +) + +slots.therapeuticRegimen__externalReference = Slot( + uri=PHENOPACKETS.externalReference, + name="therapeuticRegimen__externalReference", + curie=PHENOPACKETS.curie("externalReference"), + model_uri=PHENOPACKETS.therapeuticRegimen__externalReference, + domain=None, + range=Optional[Union[dict, ExternalReference]], +) + +slots.therapeuticRegimen__ontologyClass = Slot( + uri=PHENOPACKETS.ontologyClass, + name="therapeuticRegimen__ontologyClass", + curie=PHENOPACKETS.curie("ontologyClass"), + model_uri=PHENOPACKETS.therapeuticRegimen__ontologyClass, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.therapeuticRegimen__regimenStatus = Slot( + uri=PHENOPACKETS.regimenStatus, + name="therapeuticRegimen__regimenStatus", + curie=PHENOPACKETS.curie("regimenStatus"), + model_uri=PHENOPACKETS.therapeuticRegimen__regimenStatus, + domain=None, + range=Optional[Union[str, "RegimenStatus"]], +) + +slots.therapeuticRegimen__startTime = Slot( + uri=PHENOPACKETS.startTime, + name="therapeuticRegimen__startTime", + curie=PHENOPACKETS.curie("startTime"), + model_uri=PHENOPACKETS.therapeuticRegimen__startTime, + domain=None, + range=Optional[Union[dict, TimeElement]], +) + +slots.treatment__agent = Slot( + uri=PHENOPACKETS.agent, + name="treatment__agent", + curie=PHENOPACKETS.curie("agent"), + model_uri=PHENOPACKETS.treatment__agent, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.treatment__cumulativeDose = Slot( + uri=PHENOPACKETS.cumulativeDose, + name="treatment__cumulativeDose", + curie=PHENOPACKETS.curie("cumulativeDose"), + model_uri=PHENOPACKETS.treatment__cumulativeDose, + domain=None, + range=Optional[Union[dict, Quantity]], +) + +slots.treatment__doseIntervals = Slot( + uri=PHENOPACKETS.doseIntervals, + name="treatment__doseIntervals", + curie=PHENOPACKETS.curie("doseIntervals"), + model_uri=PHENOPACKETS.treatment__doseIntervals, + domain=None, + range=Optional[Union[Union[dict, DoseInterval], list[Union[dict, DoseInterval]]]], +) + +slots.treatment__drugType = Slot( + uri=PHENOPACKETS.drugType, + name="treatment__drugType", + curie=PHENOPACKETS.curie("drugType"), + model_uri=PHENOPACKETS.treatment__drugType, + domain=None, + range=Optional[Union[str, "DrugType"]], +) + +slots.treatment__routeOfAdministration = Slot( + uri=PHENOPACKETS.routeOfAdministration, + name="treatment__routeOfAdministration", + curie=PHENOPACKETS.curie("routeOfAdministration"), + model_uri=PHENOPACKETS.treatment__routeOfAdministration, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.metaData__created = Slot( + uri=PHENOPACKETS.created, + name="metaData__created", + curie=PHENOPACKETS.curie("created"), + model_uri=PHENOPACKETS.metaData__created, + domain=None, + range=Optional[str], +) + +slots.metaData__createdBy = Slot( + uri=PHENOPACKETS.createdBy, + name="metaData__createdBy", + curie=PHENOPACKETS.curie("createdBy"), + model_uri=PHENOPACKETS.metaData__createdBy, + domain=None, + range=Optional[str], +) + +slots.metaData__externalReferences = Slot( + uri=PHENOPACKETS.externalReferences, + name="metaData__externalReferences", + curie=PHENOPACKETS.curie("externalReferences"), + model_uri=PHENOPACKETS.metaData__externalReferences, + domain=None, + range=Optional[Union[Union[dict, ExternalReference], list[Union[dict, ExternalReference]]]], +) + +slots.metaData__phenopacketSchemaVersion = Slot( + uri=PHENOPACKETS.phenopacketSchemaVersion, + name="metaData__phenopacketSchemaVersion", + curie=PHENOPACKETS.curie("phenopacketSchemaVersion"), + model_uri=PHENOPACKETS.metaData__phenopacketSchemaVersion, + domain=None, + range=Optional[str], +) + +slots.metaData__resources = Slot( + uri=PHENOPACKETS.resources, + name="metaData__resources", + curie=PHENOPACKETS.curie("resources"), + model_uri=PHENOPACKETS.metaData__resources, + domain=None, + range=Optional[Union[Union[dict, Resource], list[Union[dict, Resource]]]], +) + +slots.metaData__submittedBy = Slot( + uri=PHENOPACKETS.submittedBy, + name="metaData__submittedBy", + curie=PHENOPACKETS.curie("submittedBy"), + model_uri=PHENOPACKETS.metaData__submittedBy, + domain=None, + range=Optional[str], +) + +slots.metaData__updates = Slot( + uri=PHENOPACKETS.updates, + name="metaData__updates", + curie=PHENOPACKETS.curie("updates"), + model_uri=PHENOPACKETS.metaData__updates, + domain=None, + range=Optional[Union[Union[dict, Update], list[Union[dict, Update]]]], +) + +slots.resource__id = Slot( + uri=PHENOPACKETS.id, + name="resource__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.resource__id, + domain=None, + range=Optional[str], +) + +slots.resource__iriPrefix = Slot( + uri=PHENOPACKETS.iriPrefix, + name="resource__iriPrefix", + curie=PHENOPACKETS.curie("iriPrefix"), + model_uri=PHENOPACKETS.resource__iriPrefix, + domain=None, + range=Optional[str], +) + +slots.resource__name = Slot( + uri=PHENOPACKETS.name, + name="resource__name", + curie=PHENOPACKETS.curie("name"), + model_uri=PHENOPACKETS.resource__name, + domain=None, + range=Optional[str], +) + +slots.resource__namespacePrefix = Slot( + uri=PHENOPACKETS.namespacePrefix, + name="resource__namespacePrefix", + curie=PHENOPACKETS.curie("namespacePrefix"), + model_uri=PHENOPACKETS.resource__namespacePrefix, + domain=None, + range=Optional[str], +) + +slots.resource__url = Slot( + uri=PHENOPACKETS.url, + name="resource__url", + curie=PHENOPACKETS.curie("url"), + model_uri=PHENOPACKETS.resource__url, + domain=None, + range=Optional[str], +) + +slots.resource__version = Slot( + uri=PHENOPACKETS.version, + name="resource__version", + curie=PHENOPACKETS.curie("version"), + model_uri=PHENOPACKETS.resource__version, + domain=None, + range=Optional[str], +) + +slots.update__comment = Slot( + uri=PHENOPACKETS.comment, + name="update__comment", + curie=PHENOPACKETS.curie("comment"), + model_uri=PHENOPACKETS.update__comment, + domain=None, + range=Optional[str], +) + +slots.update__timestamp = Slot( + uri=PHENOPACKETS.timestamp, + name="update__timestamp", + curie=PHENOPACKETS.curie("timestamp"), + model_uri=PHENOPACKETS.update__timestamp, + domain=None, + range=str, +) + +slots.update__updatedBy = Slot( + uri=PHENOPACKETS.updatedBy, + name="update__updatedBy", + curie=PHENOPACKETS.curie("updatedBy"), + model_uri=PHENOPACKETS.update__updatedBy, + domain=None, + range=Optional[str], +) + +slots.pedigree__persons = Slot( + uri=PHENOPACKETS.persons, + name="pedigree__persons", + curie=PHENOPACKETS.curie("persons"), + model_uri=PHENOPACKETS.pedigree__persons, + domain=None, + range=Optional[Union[Union[dict, Person], list[Union[dict, Person]]]], +) + +slots.person__affectedStatus = Slot( + uri=PHENOPACKETS.affectedStatus, + name="person__affectedStatus", + curie=PHENOPACKETS.curie("affectedStatus"), + model_uri=PHENOPACKETS.person__affectedStatus, + domain=None, + range=Optional[Union[str, "AffectedStatus"]], +) + +slots.person__familyId = Slot( + uri=PHENOPACKETS.familyId, + name="person__familyId", + curie=PHENOPACKETS.curie("familyId"), + model_uri=PHENOPACKETS.person__familyId, + domain=None, + range=Optional[str], +) + +slots.person__individualId = Slot( + uri=PHENOPACKETS.individualId, + name="person__individualId", + curie=PHENOPACKETS.curie("individualId"), + model_uri=PHENOPACKETS.person__individualId, + domain=None, + range=Optional[str], +) + +slots.person__maternalId = Slot( + uri=PHENOPACKETS.maternalId, + name="person__maternalId", + curie=PHENOPACKETS.curie("maternalId"), + model_uri=PHENOPACKETS.person__maternalId, + domain=None, + range=Optional[str], +) + +slots.person__paternalId = Slot( + uri=PHENOPACKETS.paternalId, + name="person__paternalId", + curie=PHENOPACKETS.curie("paternalId"), + model_uri=PHENOPACKETS.person__paternalId, + domain=None, + range=Optional[str], +) + +slots.person__sex = Slot( + uri=PHENOPACKETS.sex, + name="person__sex", + curie=PHENOPACKETS.curie("sex"), + model_uri=PHENOPACKETS.person__sex, + domain=None, + range=Optional[Union[str, "Sex"]], +) + +slots.phenotypicFeature__description = Slot( + uri=PHENOPACKETS.description, + name="phenotypicFeature__description", + curie=PHENOPACKETS.curie("description"), + model_uri=PHENOPACKETS.phenotypicFeature__description, + domain=None, + range=Optional[str], +) + +slots.phenotypicFeature__evidence = Slot( + uri=PHENOPACKETS.evidence, + name="phenotypicFeature__evidence", + curie=PHENOPACKETS.curie("evidence"), + model_uri=PHENOPACKETS.phenotypicFeature__evidence, + domain=None, + range=Optional[Union[Union[dict, Evidence], list[Union[dict, Evidence]]]], +) + +slots.phenotypicFeature__excluded = Slot( + uri=PHENOPACKETS.excluded, + name="phenotypicFeature__excluded", + curie=PHENOPACKETS.curie("excluded"), + model_uri=PHENOPACKETS.phenotypicFeature__excluded, + domain=None, + range=Optional[Union[bool, Bool]], +) + +slots.phenotypicFeature__modifiers = Slot( + uri=PHENOPACKETS.modifiers, + name="phenotypicFeature__modifiers", + curie=PHENOPACKETS.curie("modifiers"), + model_uri=PHENOPACKETS.phenotypicFeature__modifiers, + domain=None, + range=Optional[ + Union[dict[Union[str, OntologyClassId], Union[dict, OntologyClass]], list[Union[dict, OntologyClass]]] + ], +) + +slots.phenotypicFeature__onset = Slot( + uri=PHENOPACKETS.onset, + name="phenotypicFeature__onset", + curie=PHENOPACKETS.curie("onset"), + model_uri=PHENOPACKETS.phenotypicFeature__onset, + domain=None, + range=Optional[Union[dict, TimeElement]], +) + +slots.phenotypicFeature__resolution = Slot( + uri=PHENOPACKETS.resolution, + name="phenotypicFeature__resolution", + curie=PHENOPACKETS.curie("resolution"), + model_uri=PHENOPACKETS.phenotypicFeature__resolution, + domain=None, + range=Optional[Union[dict, TimeElement]], +) + +slots.phenotypicFeature__severity = Slot( + uri=PHENOPACKETS.severity, + name="phenotypicFeature__severity", + curie=PHENOPACKETS.curie("severity"), + model_uri=PHENOPACKETS.phenotypicFeature__severity, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.phenotypicFeature__type = Slot( + uri=PHENOPACKETS.type, + name="phenotypicFeature__type", + curie=PHENOPACKETS.curie("type"), + model_uri=PHENOPACKETS.phenotypicFeature__type, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.timestamp__nanos = Slot( + uri=PHENOPACKETS.nanos, + name="timestamp__nanos", + curie=PHENOPACKETS.curie("nanos"), + model_uri=PHENOPACKETS.timestamp__nanos, + domain=None, + range=Optional[int], +) + +slots.timestamp__seconds = Slot( + uri=PHENOPACKETS.seconds, + name="timestamp__seconds", + curie=PHENOPACKETS.curie("seconds"), + model_uri=PHENOPACKETS.timestamp__seconds, + domain=None, + range=Optional[int], +) + +slots.expression__syntax = Slot( + uri=PHENOPACKETS.syntax, + name="expression__syntax", + curie=PHENOPACKETS.curie("syntax"), + model_uri=PHENOPACKETS.expression__syntax, + domain=None, + range=Optional[str], +) + +slots.expression__value = Slot( + uri=PHENOPACKETS.value, + name="expression__value", + curie=PHENOPACKETS.curie("value"), + model_uri=PHENOPACKETS.expression__value, + domain=None, + range=Optional[str], +) + +slots.expression__version = Slot( + uri=PHENOPACKETS.version, + name="expression__version", + curie=PHENOPACKETS.curie("version"), + model_uri=PHENOPACKETS.expression__version, + domain=None, + range=Optional[str], +) + +slots.extension__name = Slot( + uri=PHENOPACKETS.name, + name="extension__name", + curie=PHENOPACKETS.curie("name"), + model_uri=PHENOPACKETS.extension__name, + domain=None, + range=Optional[str], +) + +slots.extension__value = Slot( + uri=PHENOPACKETS.value, + name="extension__value", + curie=PHENOPACKETS.curie("value"), + model_uri=PHENOPACKETS.extension__value, + domain=None, + range=Optional[Union[Union[dict, Any], list[Union[dict, Any]]]], +) + +slots.geneDescriptor__alternateIds = Slot( + uri=PHENOPACKETS.alternateIds, + name="geneDescriptor__alternateIds", + curie=PHENOPACKETS.curie("alternateIds"), + model_uri=PHENOPACKETS.geneDescriptor__alternateIds, + domain=None, + range=Optional[Union[str, list[str]]], +) + +slots.geneDescriptor__alternateSymbols = Slot( + uri=PHENOPACKETS.alternateSymbols, + name="geneDescriptor__alternateSymbols", + curie=PHENOPACKETS.curie("alternateSymbols"), + model_uri=PHENOPACKETS.geneDescriptor__alternateSymbols, + domain=None, + range=Optional[Union[str, list[str]]], +) + +slots.geneDescriptor__description = Slot( + uri=PHENOPACKETS.description, + name="geneDescriptor__description", + curie=PHENOPACKETS.curie("description"), + model_uri=PHENOPACKETS.geneDescriptor__description, + domain=None, + range=Optional[str], +) + +slots.geneDescriptor__symbol = Slot( + uri=PHENOPACKETS.symbol, + name="geneDescriptor__symbol", + curie=PHENOPACKETS.curie("symbol"), + model_uri=PHENOPACKETS.geneDescriptor__symbol, + domain=None, + range=Optional[str], +) + +slots.geneDescriptor__valueId = Slot( + uri=PHENOPACKETS.valueId, + name="geneDescriptor__valueId", + curie=PHENOPACKETS.curie("valueId"), + model_uri=PHENOPACKETS.geneDescriptor__valueId, + domain=None, + range=Optional[str], +) + +slots.geneDescriptor__xrefs = Slot( + uri=PHENOPACKETS.xrefs, + name="geneDescriptor__xrefs", + curie=PHENOPACKETS.curie("xrefs"), + model_uri=PHENOPACKETS.geneDescriptor__xrefs, + domain=None, + range=Optional[Union[str, list[str]]], +) + +slots.variationDescriptor__allelicState = Slot( + uri=PHENOPACKETS.allelicState, + name="variationDescriptor__allelicState", + curie=PHENOPACKETS.curie("allelicState"), + model_uri=PHENOPACKETS.variationDescriptor__allelicState, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.variationDescriptor__alternateLabels = Slot( + uri=PHENOPACKETS.alternateLabels, + name="variationDescriptor__alternateLabels", + curie=PHENOPACKETS.curie("alternateLabels"), + model_uri=PHENOPACKETS.variationDescriptor__alternateLabels, + domain=None, + range=Optional[Union[str, list[str]]], +) + +slots.variationDescriptor__description = Slot( + uri=PHENOPACKETS.description, + name="variationDescriptor__description", + curie=PHENOPACKETS.curie("description"), + model_uri=PHENOPACKETS.variationDescriptor__description, + domain=None, + range=Optional[str], +) + +slots.variationDescriptor__expressions = Slot( + uri=PHENOPACKETS.expressions, + name="variationDescriptor__expressions", + curie=PHENOPACKETS.curie("expressions"), + model_uri=PHENOPACKETS.variationDescriptor__expressions, + domain=None, + range=Optional[Union[Union[dict, Expression], list[Union[dict, Expression]]]], +) + +slots.variationDescriptor__extensions = Slot( + uri=PHENOPACKETS.extensions, + name="variationDescriptor__extensions", + curie=PHENOPACKETS.curie("extensions"), + model_uri=PHENOPACKETS.variationDescriptor__extensions, + domain=None, + range=Optional[Union[Union[dict, Extension], list[Union[dict, Extension]]]], +) + +slots.variationDescriptor__geneContext = Slot( + uri=PHENOPACKETS.geneContext, + name="variationDescriptor__geneContext", + curie=PHENOPACKETS.curie("geneContext"), + model_uri=PHENOPACKETS.variationDescriptor__geneContext, + domain=None, + range=Optional[Union[dict, GeneDescriptor]], +) + +slots.variationDescriptor__id = Slot( + uri=PHENOPACKETS.id, + name="variationDescriptor__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.variationDescriptor__id, + domain=None, + range=Optional[str], +) + +slots.variationDescriptor__label = Slot( + uri=PHENOPACKETS.label, + name="variationDescriptor__label", + curie=PHENOPACKETS.curie("label"), + model_uri=PHENOPACKETS.variationDescriptor__label, + domain=None, + range=Optional[str], +) + +slots.variationDescriptor__moleculeContext = Slot( + uri=PHENOPACKETS.moleculeContext, + name="variationDescriptor__moleculeContext", + curie=PHENOPACKETS.curie("moleculeContext"), + model_uri=PHENOPACKETS.variationDescriptor__moleculeContext, + domain=None, + range=Optional[Union[str, "MoleculeContext"]], +) + +slots.variationDescriptor__structuralType = Slot( + uri=PHENOPACKETS.structuralType, + name="variationDescriptor__structuralType", + curie=PHENOPACKETS.curie("structuralType"), + model_uri=PHENOPACKETS.variationDescriptor__structuralType, + domain=None, + range=Optional[Union[dict, OntologyClass]], +) + +slots.variationDescriptor__variation = Slot( + uri=PHENOPACKETS.variation, + name="variationDescriptor__variation", + curie=PHENOPACKETS.curie("variation"), + model_uri=PHENOPACKETS.variationDescriptor__variation, + domain=None, + range=Optional[Union[dict, Variation]], +) + +slots.variationDescriptor__vcfRecord = Slot( + uri=PHENOPACKETS.vcfRecord, + name="variationDescriptor__vcfRecord", + curie=PHENOPACKETS.curie("vcfRecord"), + model_uri=PHENOPACKETS.variationDescriptor__vcfRecord, + domain=None, + range=Optional[Union[dict, VcfRecord]], +) + +slots.variationDescriptor__vrsRefAlleleSeq = Slot( + uri=PHENOPACKETS.vrsRefAlleleSeq, + name="variationDescriptor__vrsRefAlleleSeq", + curie=PHENOPACKETS.curie("vrsRefAlleleSeq"), + model_uri=PHENOPACKETS.variationDescriptor__vrsRefAlleleSeq, + domain=None, + range=Optional[str], +) + +slots.variationDescriptor__xrefs = Slot( + uri=PHENOPACKETS.xrefs, + name="variationDescriptor__xrefs", + curie=PHENOPACKETS.curie("xrefs"), + model_uri=PHENOPACKETS.variationDescriptor__xrefs, + domain=None, + range=Optional[Union[str, list[str]]], +) + +slots.vcfRecord__alt = Slot( + uri=PHENOPACKETS.alt, + name="vcfRecord__alt", + curie=PHENOPACKETS.curie("alt"), + model_uri=PHENOPACKETS.vcfRecord__alt, + domain=None, + range=Optional[str], +) + +slots.vcfRecord__chrom = Slot( + uri=PHENOPACKETS.chrom, + name="vcfRecord__chrom", + curie=PHENOPACKETS.curie("chrom"), + model_uri=PHENOPACKETS.vcfRecord__chrom, + domain=None, + range=Optional[str], +) + +slots.vcfRecord__filter = Slot( + uri=PHENOPACKETS.filter, + name="vcfRecord__filter", + curie=PHENOPACKETS.curie("filter"), + model_uri=PHENOPACKETS.vcfRecord__filter, + domain=None, + range=Optional[str], +) + +slots.vcfRecord__genomeAssembly = Slot( + uri=PHENOPACKETS.genomeAssembly, + name="vcfRecord__genomeAssembly", + curie=PHENOPACKETS.curie("genomeAssembly"), + model_uri=PHENOPACKETS.vcfRecord__genomeAssembly, + domain=None, + range=Optional[str], +) + +slots.vcfRecord__id = Slot( + uri=PHENOPACKETS.id, + name="vcfRecord__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.vcfRecord__id, + domain=None, + range=Optional[str], +) + +slots.vcfRecord__info = Slot( + uri=PHENOPACKETS.info, + name="vcfRecord__info", + curie=PHENOPACKETS.curie("info"), + model_uri=PHENOPACKETS.vcfRecord__info, + domain=None, + range=Optional[str], +) + +slots.vcfRecord__pos = Slot( + uri=PHENOPACKETS.pos, + name="vcfRecord__pos", + curie=PHENOPACKETS.curie("pos"), + model_uri=PHENOPACKETS.vcfRecord__pos, + domain=None, + range=Optional[int], +) + +slots.vcfRecord__qual = Slot( + uri=PHENOPACKETS.qual, + name="vcfRecord__qual", + curie=PHENOPACKETS.curie("qual"), + model_uri=PHENOPACKETS.vcfRecord__qual, + domain=None, + range=Optional[str], +) + +slots.vcfRecord__ref = Slot( + uri=PHENOPACKETS.ref, + name="vcfRecord__ref", + curie=PHENOPACKETS.curie("ref"), + model_uri=PHENOPACKETS.vcfRecord__ref, + domain=None, + range=Optional[str], +) + +slots.any__typeUrl = Slot( + uri=PHENOPACKETS.typeUrl, + name="any__typeUrl", + curie=PHENOPACKETS.curie("typeUrl"), + model_uri=PHENOPACKETS.any__typeUrl, + domain=None, + range=Optional[str], +) + +slots.any__value = Slot( + uri=PHENOPACKETS.value, + name="any__value", + curie=PHENOPACKETS.curie("value"), + model_uri=PHENOPACKETS.any__value, + domain=None, + range=Optional[str], +) + +slots.abundance__copyNumber = Slot( + uri=PHENOPACKETS.copyNumber, + name="abundance__copyNumber", + curie=PHENOPACKETS.curie("copyNumber"), + model_uri=PHENOPACKETS.abundance__copyNumber, + domain=None, + range=Optional[Union[dict, CopyNumber]], +) + +slots.allele__chromosomeLocation = Slot( + uri=PHENOPACKETS.chromosomeLocation, + name="allele__chromosomeLocation", + curie=PHENOPACKETS.curie("chromosomeLocation"), + model_uri=PHENOPACKETS.allele__chromosomeLocation, + domain=None, + range=Optional[Union[dict, ChromosomeLocation]], +) + +slots.allele__curie = Slot( + uri=PHENOPACKETS.curie, + name="allele__curie", + curie=PHENOPACKETS.curie("curie"), + model_uri=PHENOPACKETS.allele__curie, + domain=None, + range=Optional[str], +) + +slots.allele__derivedSequenceExpression = Slot( + uri=PHENOPACKETS.derivedSequenceExpression, + name="allele__derivedSequenceExpression", + curie=PHENOPACKETS.curie("derivedSequenceExpression"), + model_uri=PHENOPACKETS.allele__derivedSequenceExpression, + domain=None, + range=Optional[Union[dict, DerivedSequenceExpression]], +) + +slots.allele__id = Slot( + uri=PHENOPACKETS.id, + name="allele__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.allele__id, + domain=None, + range=Optional[str], +) + +slots.allele__literalSequenceExpression = Slot( + uri=PHENOPACKETS.literalSequenceExpression, + name="allele__literalSequenceExpression", + curie=PHENOPACKETS.curie("literalSequenceExpression"), + model_uri=PHENOPACKETS.allele__literalSequenceExpression, + domain=None, + range=Optional[Union[dict, LiteralSequenceExpression]], +) + +slots.allele__repeatedSequenceExpression = Slot( + uri=PHENOPACKETS.repeatedSequenceExpression, + name="allele__repeatedSequenceExpression", + curie=PHENOPACKETS.curie("repeatedSequenceExpression"), + model_uri=PHENOPACKETS.allele__repeatedSequenceExpression, + domain=None, + range=Optional[Union[dict, RepeatedSequenceExpression]], +) + +slots.allele__sequenceLocation = Slot( + uri=PHENOPACKETS.sequenceLocation, + name="allele__sequenceLocation", + curie=PHENOPACKETS.curie("sequenceLocation"), + model_uri=PHENOPACKETS.allele__sequenceLocation, + domain=None, + range=Optional[Union[dict, SequenceLocation]], +) + +slots.chromosomeLocation__chr = Slot( + uri=PHENOPACKETS.chr, + name="chromosomeLocation__chr", + curie=PHENOPACKETS.curie("chr"), + model_uri=PHENOPACKETS.chromosomeLocation__chr, + domain=None, + range=Optional[str], +) + +slots.chromosomeLocation__id = Slot( + uri=PHENOPACKETS.id, + name="chromosomeLocation__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.chromosomeLocation__id, + domain=None, + range=Optional[str], +) + +slots.chromosomeLocation__interval = Slot( + uri=PHENOPACKETS.interval, + name="chromosomeLocation__interval", + curie=PHENOPACKETS.curie("interval"), + model_uri=PHENOPACKETS.chromosomeLocation__interval, + domain=None, + range=Optional[Union[dict, CytobandInterval]], +) + +slots.chromosomeLocation__speciesId = Slot( + uri=PHENOPACKETS.speciesId, + name="chromosomeLocation__speciesId", + curie=PHENOPACKETS.curie("speciesId"), + model_uri=PHENOPACKETS.chromosomeLocation__speciesId, + domain=None, + range=Optional[str], +) + +slots.copyNumber__allele = Slot( + uri=PHENOPACKETS.allele, + name="copyNumber__allele", + curie=PHENOPACKETS.curie("allele"), + model_uri=PHENOPACKETS.copyNumber__allele, + domain=None, + range=Optional[Union[dict, Allele]], +) + +slots.copyNumber__curie = Slot( + uri=PHENOPACKETS.curie, + name="copyNumber__curie", + curie=PHENOPACKETS.curie("curie"), + model_uri=PHENOPACKETS.copyNumber__curie, + domain=None, + range=Optional[str], +) + +slots.copyNumber__definiteRange = Slot( + uri=PHENOPACKETS.definiteRange, + name="copyNumber__definiteRange", + curie=PHENOPACKETS.curie("definiteRange"), + model_uri=PHENOPACKETS.copyNumber__definiteRange, + domain=None, + range=Optional[Union[dict, DefiniteRange]], +) + +slots.copyNumber__derivedSequenceExpression = Slot( + uri=PHENOPACKETS.derivedSequenceExpression, + name="copyNumber__derivedSequenceExpression", + curie=PHENOPACKETS.curie("derivedSequenceExpression"), + model_uri=PHENOPACKETS.copyNumber__derivedSequenceExpression, + domain=None, + range=Optional[Union[dict, DerivedSequenceExpression]], +) + +slots.copyNumber__gene = Slot( + uri=PHENOPACKETS.gene, + name="copyNumber__gene", + curie=PHENOPACKETS.curie("gene"), + model_uri=PHENOPACKETS.copyNumber__gene, + domain=None, + range=Optional[Union[dict, Gene]], +) + +slots.copyNumber__haplotype = Slot( + uri=PHENOPACKETS.haplotype, + name="copyNumber__haplotype", + curie=PHENOPACKETS.curie("haplotype"), + model_uri=PHENOPACKETS.copyNumber__haplotype, + domain=None, + range=Optional[Union[dict, Haplotype]], +) + +slots.copyNumber__id = Slot( + uri=PHENOPACKETS.id, + name="copyNumber__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.copyNumber__id, + domain=None, + range=Optional[str], +) + +slots.copyNumber__indefiniteRange = Slot( + uri=PHENOPACKETS.indefiniteRange, + name="copyNumber__indefiniteRange", + curie=PHENOPACKETS.curie("indefiniteRange"), + model_uri=PHENOPACKETS.copyNumber__indefiniteRange, + domain=None, + range=Optional[Union[dict, IndefiniteRange]], +) + +slots.copyNumber__literalSequenceExpression = Slot( + uri=PHENOPACKETS.literalSequenceExpression, + name="copyNumber__literalSequenceExpression", + curie=PHENOPACKETS.curie("literalSequenceExpression"), + model_uri=PHENOPACKETS.copyNumber__literalSequenceExpression, + domain=None, + range=Optional[Union[dict, LiteralSequenceExpression]], +) + +slots.copyNumber__number = Slot( + uri=PHENOPACKETS.number, + name="copyNumber__number", + curie=PHENOPACKETS.curie("number"), + model_uri=PHENOPACKETS.copyNumber__number, + domain=None, + range=Optional[Union[dict, Number]], +) + +slots.copyNumber__repeatedSequenceExpression = Slot( + uri=PHENOPACKETS.repeatedSequenceExpression, + name="copyNumber__repeatedSequenceExpression", + curie=PHENOPACKETS.curie("repeatedSequenceExpression"), + model_uri=PHENOPACKETS.copyNumber__repeatedSequenceExpression, + domain=None, + range=Optional[Union[dict, RepeatedSequenceExpression]], +) + +slots.cytobandInterval__end = Slot( + uri=PHENOPACKETS.end, + name="cytobandInterval__end", + curie=PHENOPACKETS.curie("end"), + model_uri=PHENOPACKETS.cytobandInterval__end, + domain=None, + range=Optional[str], +) + +slots.cytobandInterval__start = Slot( + uri=PHENOPACKETS.start, + name="cytobandInterval__start", + curie=PHENOPACKETS.curie("start"), + model_uri=PHENOPACKETS.cytobandInterval__start, + domain=None, + range=Optional[str], +) + +slots.definiteRange__max = Slot( + uri=PHENOPACKETS.max, + name="definiteRange__max", + curie=PHENOPACKETS.curie("max"), + model_uri=PHENOPACKETS.definiteRange__max, + domain=None, + range=Optional[int], +) + +slots.definiteRange__min = Slot( + uri=PHENOPACKETS.min, + name="definiteRange__min", + curie=PHENOPACKETS.curie("min"), + model_uri=PHENOPACKETS.definiteRange__min, + domain=None, + range=Optional[int], +) + +slots.derivedSequenceExpression__location = Slot( + uri=PHENOPACKETS.location, + name="derivedSequenceExpression__location", + curie=PHENOPACKETS.curie("location"), + model_uri=PHENOPACKETS.derivedSequenceExpression__location, + domain=None, + range=Optional[Union[dict, SequenceLocation]], +) + +slots.derivedSequenceExpression__reverseComplement = Slot( + uri=PHENOPACKETS.reverseComplement, + name="derivedSequenceExpression__reverseComplement", + curie=PHENOPACKETS.curie("reverseComplement"), + model_uri=PHENOPACKETS.derivedSequenceExpression__reverseComplement, + domain=None, + range=Optional[Union[bool, Bool]], +) + +slots.feature__gene = Slot( + uri=PHENOPACKETS.gene, + name="feature__gene", + curie=PHENOPACKETS.curie("gene"), + model_uri=PHENOPACKETS.feature__gene, + domain=None, + range=Optional[Union[dict, Gene]], +) + +slots.gene__geneId = Slot( + uri=PHENOPACKETS.geneId, + name="gene__geneId", + curie=PHENOPACKETS.curie("geneId"), + model_uri=PHENOPACKETS.gene__geneId, + domain=None, + range=Optional[str], +) + +slots.indefiniteRange__comparator = Slot( + uri=PHENOPACKETS.comparator, + name="indefiniteRange__comparator", + curie=PHENOPACKETS.curie("comparator"), + model_uri=PHENOPACKETS.indefiniteRange__comparator, + domain=None, + range=Optional[str], +) + +slots.indefiniteRange__value = Slot( + uri=PHENOPACKETS.value, + name="indefiniteRange__value", + curie=PHENOPACKETS.curie("value"), + model_uri=PHENOPACKETS.indefiniteRange__value, + domain=None, + range=Optional[int], +) + +slots.literalSequenceExpression__sequence = Slot( + uri=PHENOPACKETS.sequence, + name="literalSequenceExpression__sequence", + curie=PHENOPACKETS.curie("sequence"), + model_uri=PHENOPACKETS.literalSequenceExpression__sequence, + domain=None, + range=Optional[str], +) + +slots.location__chromosomeLocation = Slot( + uri=PHENOPACKETS.chromosomeLocation, + name="location__chromosomeLocation", + curie=PHENOPACKETS.curie("chromosomeLocation"), + model_uri=PHENOPACKETS.location__chromosomeLocation, + domain=None, + range=Optional[Union[dict, ChromosomeLocation]], +) + +slots.location__sequenceLocation = Slot( + uri=PHENOPACKETS.sequenceLocation, + name="location__sequenceLocation", + curie=PHENOPACKETS.curie("sequenceLocation"), + model_uri=PHENOPACKETS.location__sequenceLocation, + domain=None, + range=Optional[Union[dict, SequenceLocation]], +) + +slots.member__allele = Slot( + uri=PHENOPACKETS.allele, + name="member__allele", + curie=PHENOPACKETS.curie("allele"), + model_uri=PHENOPACKETS.member__allele, + domain=None, + range=Optional[Union[dict, Allele]], +) + +slots.member__copyNumber = Slot( + uri=PHENOPACKETS.copyNumber, + name="member__copyNumber", + curie=PHENOPACKETS.curie("copyNumber"), + model_uri=PHENOPACKETS.member__copyNumber, + domain=None, + range=Optional[Union[dict, CopyNumber]], +) + +slots.member__curie = Slot( + uri=PHENOPACKETS.curie, + name="member__curie", + curie=PHENOPACKETS.curie("curie"), + model_uri=PHENOPACKETS.member__curie, + domain=None, + range=Optional[str], +) + +slots.member__haplotype = Slot( + uri=PHENOPACKETS.haplotype, + name="member__haplotype", + curie=PHENOPACKETS.curie("haplotype"), + model_uri=PHENOPACKETS.member__haplotype, + domain=None, + range=Optional[Union[dict, Haplotype]], +) + +slots.member__id = Slot( + uri=PHENOPACKETS.id, + name="member__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.member__id, + domain=None, + range=Optional[str], +) + +slots.member__members = Slot( + uri=PHENOPACKETS.members, + name="member__members", + curie=PHENOPACKETS.curie("members"), + model_uri=PHENOPACKETS.member__members, + domain=None, + range=Optional[Union[Union[dict, Member], list[Union[dict, Member]]]], +) + +slots.member__text = Slot( + uri=PHENOPACKETS.text, + name="member__text", + curie=PHENOPACKETS.curie("text"), + model_uri=PHENOPACKETS.member__text, + domain=None, + range=Optional[Union[dict, Text]], +) + +slots.member__variationSet = Slot( + uri=PHENOPACKETS.variationSet, + name="member__variationSet", + curie=PHENOPACKETS.curie("variationSet"), + model_uri=PHENOPACKETS.member__variationSet, + domain=None, + range=Optional[Union[dict, VariationSet]], +) + +slots.molecularVariation__allele = Slot( + uri=PHENOPACKETS.allele, + name="molecularVariation__allele", + curie=PHENOPACKETS.curie("allele"), + model_uri=PHENOPACKETS.molecularVariation__allele, + domain=None, + range=Optional[Union[dict, Allele]], +) + +slots.molecularVariation__haplotype = Slot( + uri=PHENOPACKETS.haplotype, + name="molecularVariation__haplotype", + curie=PHENOPACKETS.curie("haplotype"), + model_uri=PHENOPACKETS.molecularVariation__haplotype, + domain=None, + range=Optional[Union[dict, Haplotype]], +) + +slots.number__value = Slot( + uri=PHENOPACKETS.value, + name="number__value", + curie=PHENOPACKETS.curie("value"), + model_uri=PHENOPACKETS.number__value, + domain=None, + range=Optional[int], +) + +slots.repeatedSequenceExpression__definiteRange = Slot( + uri=PHENOPACKETS.definiteRange, + name="repeatedSequenceExpression__definiteRange", + curie=PHENOPACKETS.curie("definiteRange"), + model_uri=PHENOPACKETS.repeatedSequenceExpression__definiteRange, + domain=None, + range=Optional[Union[dict, DefiniteRange]], +) + +slots.repeatedSequenceExpression__derivedSequenceExpression = Slot( + uri=PHENOPACKETS.derivedSequenceExpression, + name="repeatedSequenceExpression__derivedSequenceExpression", + curie=PHENOPACKETS.curie("derivedSequenceExpression"), + model_uri=PHENOPACKETS.repeatedSequenceExpression__derivedSequenceExpression, + domain=None, + range=Optional[Union[dict, DerivedSequenceExpression]], +) + +slots.repeatedSequenceExpression__indefiniteRange = Slot( + uri=PHENOPACKETS.indefiniteRange, + name="repeatedSequenceExpression__indefiniteRange", + curie=PHENOPACKETS.curie("indefiniteRange"), + model_uri=PHENOPACKETS.repeatedSequenceExpression__indefiniteRange, + domain=None, + range=Optional[Union[dict, IndefiniteRange]], +) + +slots.repeatedSequenceExpression__literalSequenceExpression = Slot( + uri=PHENOPACKETS.literalSequenceExpression, + name="repeatedSequenceExpression__literalSequenceExpression", + curie=PHENOPACKETS.curie("literalSequenceExpression"), + model_uri=PHENOPACKETS.repeatedSequenceExpression__literalSequenceExpression, + domain=None, + range=Optional[Union[dict, LiteralSequenceExpression]], +) + +slots.repeatedSequenceExpression__number = Slot( + uri=PHENOPACKETS.number, + name="repeatedSequenceExpression__number", + curie=PHENOPACKETS.curie("number"), + model_uri=PHENOPACKETS.repeatedSequenceExpression__number, + domain=None, + range=Optional[Union[dict, Number]], +) + +slots.sequenceExpression__derivedSequenceExpression = Slot( + uri=PHENOPACKETS.derivedSequenceExpression, + name="sequenceExpression__derivedSequenceExpression", + curie=PHENOPACKETS.curie("derivedSequenceExpression"), + model_uri=PHENOPACKETS.sequenceExpression__derivedSequenceExpression, + domain=None, + range=Optional[Union[dict, DerivedSequenceExpression]], +) + +slots.sequenceExpression__literalSequenceExpression = Slot( + uri=PHENOPACKETS.literalSequenceExpression, + name="sequenceExpression__literalSequenceExpression", + curie=PHENOPACKETS.curie("literalSequenceExpression"), + model_uri=PHENOPACKETS.sequenceExpression__literalSequenceExpression, + domain=None, + range=Optional[Union[dict, LiteralSequenceExpression]], +) + +slots.sequenceExpression__repeatedSequenceExpression = Slot( + uri=PHENOPACKETS.repeatedSequenceExpression, + name="sequenceExpression__repeatedSequenceExpression", + curie=PHENOPACKETS.curie("repeatedSequenceExpression"), + model_uri=PHENOPACKETS.sequenceExpression__repeatedSequenceExpression, + domain=None, + range=Optional[Union[dict, RepeatedSequenceExpression]], +) + +slots.sequenceInterval__endDefiniteRange = Slot( + uri=PHENOPACKETS.endDefiniteRange, + name="sequenceInterval__endDefiniteRange", + curie=PHENOPACKETS.curie("endDefiniteRange"), + model_uri=PHENOPACKETS.sequenceInterval__endDefiniteRange, + domain=None, + range=Optional[Union[dict, DefiniteRange]], +) + +slots.sequenceInterval__endIndefiniteRange = Slot( + uri=PHENOPACKETS.endIndefiniteRange, + name="sequenceInterval__endIndefiniteRange", + curie=PHENOPACKETS.curie("endIndefiniteRange"), + model_uri=PHENOPACKETS.sequenceInterval__endIndefiniteRange, + domain=None, + range=Optional[Union[dict, IndefiniteRange]], +) + +slots.sequenceInterval__endNumber = Slot( + uri=PHENOPACKETS.endNumber, + name="sequenceInterval__endNumber", + curie=PHENOPACKETS.curie("endNumber"), + model_uri=PHENOPACKETS.sequenceInterval__endNumber, + domain=None, + range=Optional[Union[dict, Number]], +) + +slots.sequenceInterval__startDefiniteRange = Slot( + uri=PHENOPACKETS.startDefiniteRange, + name="sequenceInterval__startDefiniteRange", + curie=PHENOPACKETS.curie("startDefiniteRange"), + model_uri=PHENOPACKETS.sequenceInterval__startDefiniteRange, + domain=None, + range=Optional[Union[dict, DefiniteRange]], +) + +slots.sequenceInterval__startIndefiniteRange = Slot( + uri=PHENOPACKETS.startIndefiniteRange, + name="sequenceInterval__startIndefiniteRange", + curie=PHENOPACKETS.curie("startIndefiniteRange"), + model_uri=PHENOPACKETS.sequenceInterval__startIndefiniteRange, + domain=None, + range=Optional[Union[dict, IndefiniteRange]], +) + +slots.sequenceInterval__startNumber = Slot( + uri=PHENOPACKETS.startNumber, + name="sequenceInterval__startNumber", + curie=PHENOPACKETS.curie("startNumber"), + model_uri=PHENOPACKETS.sequenceInterval__startNumber, + domain=None, + range=Optional[Union[dict, Number]], +) + +slots.sequenceLocation__id = Slot( + uri=PHENOPACKETS.id, + name="sequenceLocation__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.sequenceLocation__id, + domain=None, + range=Optional[str], +) + +slots.sequenceLocation__sequenceId = Slot( + uri=PHENOPACKETS.sequenceId, + name="sequenceLocation__sequenceId", + curie=PHENOPACKETS.curie("sequenceId"), + model_uri=PHENOPACKETS.sequenceLocation__sequenceId, + domain=None, + range=Optional[str], +) + +slots.sequenceLocation__sequenceInterval = Slot( + uri=PHENOPACKETS.sequenceInterval, + name="sequenceLocation__sequenceInterval", + curie=PHENOPACKETS.curie("sequenceInterval"), + model_uri=PHENOPACKETS.sequenceLocation__sequenceInterval, + domain=None, + range=Optional[Union[dict, SequenceInterval]], +) + +slots.sequenceState__sequence = Slot( + uri=PHENOPACKETS.sequence, + name="sequenceState__sequence", + curie=PHENOPACKETS.curie("sequence"), + model_uri=PHENOPACKETS.sequenceState__sequence, + domain=None, + range=Optional[str], +) + +slots.simpleInterval__end = Slot( + uri=PHENOPACKETS.end, + name="simpleInterval__end", + curie=PHENOPACKETS.curie("end"), + model_uri=PHENOPACKETS.simpleInterval__end, + domain=None, + range=Optional[int], +) + +slots.simpleInterval__start = Slot( + uri=PHENOPACKETS.start, + name="simpleInterval__start", + curie=PHENOPACKETS.curie("start"), + model_uri=PHENOPACKETS.simpleInterval__start, + domain=None, + range=Optional[int], +) + +slots.systemicVariation__copyNumber = Slot( + uri=PHENOPACKETS.copyNumber, + name="systemicVariation__copyNumber", + curie=PHENOPACKETS.curie("copyNumber"), + model_uri=PHENOPACKETS.systemicVariation__copyNumber, + domain=None, + range=Optional[Union[dict, CopyNumber]], +) + +slots.text__definition = Slot( + uri=PHENOPACKETS.definition, + name="text__definition", + curie=PHENOPACKETS.curie("definition"), + model_uri=PHENOPACKETS.text__definition, + domain=None, + range=Optional[str], +) + +slots.text__id = Slot( + uri=PHENOPACKETS.id, + name="text__id", + curie=PHENOPACKETS.curie("id"), + model_uri=PHENOPACKETS.text__id, + domain=None, + range=Optional[str], +) + +slots.utilityVariation__text = Slot( + uri=PHENOPACKETS.text, + name="utilityVariation__text", + curie=PHENOPACKETS.curie("text"), + model_uri=PHENOPACKETS.utilityVariation__text, + domain=None, + range=Optional[Union[dict, Text]], +) + +slots.utilityVariation__variationSet = Slot( + uri=PHENOPACKETS.variationSet, + name="utilityVariation__variationSet", + curie=PHENOPACKETS.curie("variationSet"), + model_uri=PHENOPACKETS.utilityVariation__variationSet, + domain=None, + range=Optional[Union[dict, VariationSet]], +) + +slots.variation__allele = Slot( + uri=PHENOPACKETS.allele, + name="variation__allele", + curie=PHENOPACKETS.curie("allele"), + model_uri=PHENOPACKETS.variation__allele, + domain=None, + range=Optional[Union[dict, Allele]], +) + +slots.variation__copyNumber = Slot( + uri=PHENOPACKETS.copyNumber, + name="variation__copyNumber", + curie=PHENOPACKETS.curie("copyNumber"), + model_uri=PHENOPACKETS.variation__copyNumber, + domain=None, + range=Optional[Union[dict, CopyNumber]], +) + +slots.variation__haplotype = Slot( + uri=PHENOPACKETS.haplotype, + name="variation__haplotype", + curie=PHENOPACKETS.curie("haplotype"), + model_uri=PHENOPACKETS.variation__haplotype, + domain=None, + range=Optional[Union[dict, Haplotype]], +) + +slots.variation__text = Slot( + uri=PHENOPACKETS.text, + name="variation__text", + curie=PHENOPACKETS.curie("text"), + model_uri=PHENOPACKETS.variation__text, + domain=None, + range=Optional[Union[dict, Text]], +) + +slots.variation__variationSet = Slot( + uri=PHENOPACKETS.variationSet, + name="variation__variationSet", + curie=PHENOPACKETS.curie("variationSet"), + model_uri=PHENOPACKETS.variation__variationSet, + domain=None, + range=Optional[Union[dict, VariationSet]], +) diff --git a/tests/test_loaders_dumpers/models/termci_schema.py b/tests/test_loaders_dumpers/models/termci_schema.py index ed47afd5..be50770e 100644 --- a/tests/test_loaders_dumpers/models/termci_schema.py +++ b/tests/test_loaders_dumpers/models/termci_schema.py @@ -19,17 +19,18 @@ metamodel_version = "1.7.0" # Namespaces -DC = CurieNamespace('dc', 'http://purl.org/dc/elements/1.1/') -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -SCT = CurieNamespace('sct', 'http://snomed.info/id/') -SH = CurieNamespace('sh', 'http://www.w3.org/ns/shacl#') -SKOS = CurieNamespace('skos', 'http://www.w3.org/2004/02/skos/core#') -TERMCI = CurieNamespace('termci', 'https://hotecosystem.org/termci/') +DC = CurieNamespace("dc", "http://purl.org/dc/elements/1.1/") +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +SCT = CurieNamespace("sct", "http://snomed.info/id/") +SH = CurieNamespace("sh", "http://www.w3.org/ns/shacl#") +SKOS = CurieNamespace("skos", "http://www.w3.org/2004/02/skos/core#") +TERMCI = CurieNamespace("termci", "https://hotecosystem.org/termci/") DEFAULT_ = TERMCI # Types + # Class references class ConceptReferenceUri(URIorCURIE): pass @@ -44,6 +45,7 @@ class ConceptReference(YAMLRoot): """ A minimal description of a class, individual, term or similar construct """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SKOS.Concept @@ -57,7 +59,9 @@ class ConceptReference(YAMLRoot): designation: Optional[str] = None definition: Optional[str] = None reference: Optional[Union[Union[str, URI], list[Union[str, URI]]]] = empty_list() - narrower_than: Optional[Union[Union[str, ConceptReferenceUri], list[Union[str, ConceptReferenceUri]]]] = empty_list() + narrower_than: Optional[Union[Union[str, ConceptReferenceUri], list[Union[str, ConceptReferenceUri]]]] = ( + empty_list() + ) def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.uri is None: @@ -91,7 +95,9 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.narrower_than = [] if not isinstance(self.narrower_than, list): self.narrower_than = [self.narrower_than] - self.narrower_than = [v if isinstance(v, ConceptReferenceUri) else ConceptReferenceUri(v) for v in self.narrower_than] + self.narrower_than = [ + v if isinstance(v, ConceptReferenceUri) else ConceptReferenceUri(v) for v in self.narrower_than + ] super().__post_init__(**kwargs) @@ -101,6 +107,7 @@ class ConceptSystem(YAMLRoot): """ A terminological resource (ontology, classification scheme, concept system, etc.) """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = SKOS.ConceptScheme @@ -113,7 +120,9 @@ class ConceptSystem(YAMLRoot): description: Optional[str] = None reference: Optional[Union[Union[str, URI], list[Union[str, URI]]]] = empty_list() root_concept: Optional[Union[Union[str, ConceptReferenceUri], list[Union[str, ConceptReferenceUri]]]] = empty_list() - contents: Optional[Union[dict[Union[str, ConceptReferenceUri], Union[dict, ConceptReference]], list[Union[dict, ConceptReference]]]] = empty_dict() + contents: Optional[ + Union[dict[Union[str, ConceptReferenceUri], Union[dict, ConceptReference]], list[Union[dict, ConceptReference]]] + ] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.namespace is None: @@ -139,13 +148,17 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): self.root_concept = [] if not isinstance(self.root_concept, list): self.root_concept = [self.root_concept] - self.root_concept = [v if isinstance(v, ConceptReferenceUri) else ConceptReferenceUri(v) for v in self.root_concept] + self.root_concept = [ + v if isinstance(v, ConceptReferenceUri) else ConceptReferenceUri(v) for v in self.root_concept + ] if self.contents is None: self.contents = [] if not isinstance(self.contents, (list, dict)): self.contents = [self.contents] - self._normalize_inlined_slot(slot_name="contents", slot_type=ConceptReference, key_name="uri", inlined_as_list=True, keyed=True) + self._normalize_inlined_slot( + slot_name="contents", slot_type=ConceptReference, key_name="uri", inlined_as_list=True, keyed=True + ) super().__post_init__(**kwargs) @@ -155,6 +168,7 @@ class Package(YAMLRoot): """ A collection of ConceptSystems """ + _inherited_slots: ClassVar[list[str]] = [] class_class_uri: ClassVar[URIRef] = TERMCI.Package @@ -162,14 +176,18 @@ class Package(YAMLRoot): class_name: ClassVar[str] = "Package" class_model_uri: ClassVar[URIRef] = TERMCI.Package - system: Optional[Union[dict[Union[str, ConceptSystemNamespace], Union[dict, ConceptSystem]], list[Union[dict, ConceptSystem]]]] = empty_dict() + system: Optional[ + Union[dict[Union[str, ConceptSystemNamespace], Union[dict, ConceptSystem]], list[Union[dict, ConceptSystem]]] + ] = empty_dict() def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): if self.system is None: self.system = [] if not isinstance(self.system, (list, dict)): self.system = [self.system] - self._normalize_inlined_slot(slot_name="system", slot_type=ConceptSystem, key_name="namespace", inlined_as_list=True, keyed=True) + self._normalize_inlined_slot( + slot_name="system", slot_type=ConceptSystem, key_name="namespace", inlined_as_list=True, keyed=True + ) super().__post_init__(**kwargs) @@ -178,4 +196,3 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): # Slots - diff --git a/tests/test_loaders_dumpers/test_csv_tsv_loader_dumper.py b/tests/test_loaders_dumpers/test_csv_tsv_loader_dumper.py index 9e6f3300..06a53455 100644 --- a/tests/test_loaders_dumpers/test_csv_tsv_loader_dumper.py +++ b/tests/test_loaders_dumpers/test_csv_tsv_loader_dumper.py @@ -18,80 +18,81 @@ ROOT = os.path.abspath(os.path.dirname(__file__)) -INPUT_DIR = os.path.join(ROOT, 'input') -OUTPUT_DIR = os.path.join(ROOT, 'output') -MODEL_DIR = os.path.join(ROOT, 'models') +INPUT_DIR = os.path.join(ROOT, "input") +OUTPUT_DIR = os.path.join(ROOT, "output") +MODEL_DIR = os.path.join(ROOT, "models") + +SCHEMA = os.path.join(MODEL_DIR, "books_normalized.yaml") +DATA = os.path.join(INPUT_DIR, "books_normalized_01.yaml") +DATA2 = os.path.join(INPUT_DIR, "books_normalized_02.yaml") +OUTPUT = os.path.join(OUTPUT_DIR, "books_flattened.tsv") +OUTPUT2 = os.path.join(OUTPUT_DIR, "books_flattened_02.tsv") -SCHEMA = os.path.join(MODEL_DIR, 'books_normalized.yaml') -DATA = os.path.join(INPUT_DIR, 'books_normalized_01.yaml') -DATA2 = os.path.join(INPUT_DIR, 'books_normalized_02.yaml') -OUTPUT = os.path.join(OUTPUT_DIR, 'books_flattened.tsv') -OUTPUT2 = os.path.join(OUTPUT_DIR, 'books_flattened_02.tsv') def _json(obj) -> str: - return json.dumps(obj, indent=' ', sort_keys=True) + return json.dumps(obj, indent=" ", sort_keys=True) class CsvAndTsvGenTestCase(unittest.TestCase): def test_object_model(self): - book = Book(id='B1', genres=['fantasy'], creator={}) + book = Book(id="B1", genres=["fantasy"], creator={}) logger.debug(as_json_obj(book.genres[0])) - assert str(book.genres[0]) == 'fantasy' - assert book.genres[0].code.text == 'fantasy' + assert str(book.genres[0]) == "fantasy" + assert book.genres[0].code.text == "fantasy" processed = remove_empty_items(book.genres) - assert processed[0] == 'fantasy' - series = BookSeries(id='S1', creator=Author(name="Q. Writer"), reviews=[Review(rating=5)]) + assert processed[0] == "fantasy" + series = BookSeries(id="S1", creator=Author(name="Q. Writer"), reviews=[Review(rating=5)]) series.books.append(book) schemaview = SchemaView(SCHEMA) shop = Shop() shop.all_book_series.append(series) - csvstr = csv_dumper.dumps(shop, index_slot='all_book_series', schemaview=schemaview) + csvstr = csv_dumper.dumps(shop, index_slot="all_book_series", schemaview=schemaview) assert "," in csvstr assert "\t" not in csvstr - tsvstr = tsv_dumper.dumps(shop, index_slot='all_book_series', schemaview=schemaview) + tsvstr = tsv_dumper.dumps(shop, index_slot="all_book_series", schemaview=schemaview) assert "\t" in tsvstr def test_csvgen_roundtrip(self): schemaview = SchemaView(SCHEMA) data = yaml_loader.load(DATA, target_class=Shop) - csv_dumper.dump(data, to_file=OUTPUT, index_slot='all_book_series', schemaview=schemaview) - roundtrip = csv_loader.load(OUTPUT, target_class=Shop, index_slot='all_book_series', schemaview=schemaview) + csv_dumper.dump(data, to_file=OUTPUT, index_slot="all_book_series", schemaview=schemaview) + roundtrip = csv_loader.load(OUTPUT, target_class=Shop, index_slot="all_book_series", schemaview=schemaview) logger.debug(json_dumper.dumps(roundtrip)) - logger.debug(f'COMPARE 1: {roundtrip}') - logger.debug(f'COMPARE 2: {data}') + logger.debug(f"COMPARE 1: {roundtrip}") + logger.debug(f"COMPARE 2: {data}") assert roundtrip == data def test_csvgen_roundtrip_to_dict(self): schemaview = SchemaView(SCHEMA) data = yaml_loader.load(DATA, target_class=Shop) - csv_dumper.dump(data, to_file=OUTPUT, index_slot='all_book_series', schemaview=schemaview) - roundtrip = csv_loader.load_as_dict(OUTPUT, index_slot='all_book_series', schemaview=schemaview) + csv_dumper.dump(data, to_file=OUTPUT, index_slot="all_book_series", schemaview=schemaview) + roundtrip = csv_loader.load_as_dict(OUTPUT, index_slot="all_book_series", schemaview=schemaview) assert roundtrip == json_dumper.to_dict(data) def test_tsvgen_roundtrip(self): schemaview = SchemaView(SCHEMA) data = yaml_loader.load(DATA, target_class=Shop) - tsv_dumper.dump(data, to_file=OUTPUT, index_slot='all_book_series', schemaview=schemaview) - roundtrip = tsv_loader.load(OUTPUT, target_class=Shop, index_slot='all_book_series', schemaview=schemaview) + tsv_dumper.dump(data, to_file=OUTPUT, index_slot="all_book_series", schemaview=schemaview) + roundtrip = tsv_loader.load(OUTPUT, target_class=Shop, index_slot="all_book_series", schemaview=schemaview) assert roundtrip == data def test_tsvgen_roundtrip_to_dict(self): schemaview = SchemaView(SCHEMA) data = yaml_loader.load(DATA, target_class=Shop) - tsv_dumper.dump(data, to_file=OUTPUT, index_slot='all_book_series', schemaview=schemaview) - roundtrip = tsv_loader.load_as_dict(OUTPUT, index_slot='all_book_series', schemaview=schemaview) + tsv_dumper.dump(data, to_file=OUTPUT, index_slot="all_book_series", schemaview=schemaview) + roundtrip = tsv_loader.load_as_dict(OUTPUT, index_slot="all_book_series", schemaview=schemaview) assert roundtrip == json_dumper.to_dict(data) def test_csvgen_unroundtrippable(self): schemaview = SchemaView(SCHEMA) - #schema = YAMLGenerator(SCHEMA).schema + # schema = YAMLGenerator(SCHEMA).schema data = yaml_loader.load(DATA2, target_class=Shop) logger.debug(data.all_book_series[0]) logger.debug(data.all_book_series[0].genres[0]) - assert str(data.all_book_series[0].genres[0]) == 'fantasy' + assert str(data.all_book_series[0].genres[0]) == "fantasy" logger.debug(yaml_dumper.dumps(data)) logger.debug(json_dumper.dumps(data)) processed = remove_empty_items(data) @@ -99,30 +100,24 @@ def test_csvgen_unroundtrippable(self): asj = as_json_object(processed, None) logger.debug(f'ASJ {asj["all_book_series"]}') reconstituted_json = json.loads(json_dumper.dumps(data)) - s0 = reconstituted_json['all_book_series'][0] + s0 = reconstituted_json["all_book_series"][0] logger.debug(s0) logger.debug(json_dumper.dumps(data)) - #logger.debug(csv_dumper.dumps(data, index_slot='all_book_series', schema=schema)) - csv_dumper.dump(data, to_file=OUTPUT2, index_slot='all_book_series', schemaview=schemaview) - #assert False - roundtrip = csv_loader.load(OUTPUT2, target_class=Shop, index_slot='all_book_series', schemaview=schemaview) + # logger.debug(csv_dumper.dumps(data, index_slot='all_book_series', schema=schema)) + csv_dumper.dump(data, to_file=OUTPUT2, index_slot="all_book_series", schemaview=schemaview) + # assert False + roundtrip = csv_loader.load(OUTPUT2, target_class=Shop, index_slot="all_book_series", schemaview=schemaview) logger.debug(json_dumper.dumps(roundtrip)) assert roundtrip == data def test_tsvgen_unroundtrippable(self): schemaview = SchemaView(SCHEMA) data = yaml_loader.load(DATA2, target_class=Shop) - assert str(data.all_book_series[0].genres[0]) == 'fantasy' - tsv_dumper.dump(data, to_file=OUTPUT2, index_slot='all_book_series', schemaview=schemaview) - roundtrip = tsv_loader.load(OUTPUT2, target_class=Shop, index_slot='all_book_series', schemaview=schemaview) + assert str(data.all_book_series[0].genres[0]) == "fantasy" + tsv_dumper.dump(data, to_file=OUTPUT2, index_slot="all_book_series", schemaview=schemaview) + roundtrip = tsv_loader.load(OUTPUT2, target_class=Shop, index_slot="all_book_series", schemaview=schemaview) assert roundtrip == data - - - - - - -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_loaders_dumpers/test_dumpers.py b/tests/test_loaders_dumpers/test_dumpers.py index 35b1526e..cbcdf160 100644 --- a/tests/test_loaders_dumpers/test_dumpers.py +++ b/tests/test_loaders_dumpers/test_dumpers.py @@ -7,8 +7,15 @@ from linkml_runtime.dumpers import yaml_dumper, json_dumper, rdf_dumper from linkml_runtime.utils.yamlutils import as_json_object from tests.support.clicktestcase import ClickTestCase -from tests.test_loaders_dumpers import LD_11_DIR, LD_11_SSL_SVR, LD_11_SVR, HTTP_TEST_PORT, HTTPS_TEST_PORT, \ - GITHUB_LD10_CONTEXT, GITHUB_LD11_CONTEXT +from tests.test_loaders_dumpers import ( + LD_11_DIR, + LD_11_SSL_SVR, + LD_11_SVR, + HTTP_TEST_PORT, + HTTPS_TEST_PORT, + GITHUB_LD10_CONTEXT, + GITHUB_LD11_CONTEXT, +) from tests.test_loaders_dumpers.loaderdumpertestcase import LoaderDumperTestCase from tests.test_loaders_dumpers.models.termci_schema import ConceptReference, ConceptSystem, Package @@ -21,72 +28,93 @@ class DumpersTestCase(LoaderDumperTestCase): @classmethod def setUpClass(cls) -> None: - """ Generate a small sample TermCI instance for testing purposes """ + """Generate a small sample TermCI instance for testing purposes""" LoaderDumperTestCase.setUpClass() - e1 = ConceptReference(OBO.NCI_C147796, code="C147796", defined_in=OBO, - designation="TSCYC - Being Frightened of Men", - definition="Trauma Symptom Checklist for Young Children (TSCYC) Please indicate how often" - " the child has done, felt, or experienced each of the following things in " - "the last month: Being frightened of men.", - narrower_than=OBO.NCI_C147557, reference=OBO.NCI_C147796) - e2 = ConceptReference(OBO.NCI_C147557, code="C147557", defined_in=OBO, - designation="TSCYC Questionnaire Question", - definition="A question associated with the TSCYC questionnaire.", - narrower_than=OBO.NCI_C91102) + e1 = ConceptReference( + OBO.NCI_C147796, + code="C147796", + defined_in=OBO, + designation="TSCYC - Being Frightened of Men", + definition="Trauma Symptom Checklist for Young Children (TSCYC) Please indicate how often" + " the child has done, felt, or experienced each of the following things in " + "the last month: Being frightened of men.", + narrower_than=OBO.NCI_C147557, + reference=OBO.NCI_C147796, + ) + e2 = ConceptReference( + OBO.NCI_C147557, + code="C147557", + defined_in=OBO, + designation="TSCYC Questionnaire Question", + definition="A question associated with the TSCYC questionnaire.", + narrower_than=OBO.NCI_C91102, + ) c1 = ConceptSystem(OBO, "OBO", contents=[e1, e2]) cls.test_package = Package([c1]) def test_yaml_dumper(self): - """ Test the yaml emitter """ + """Test the yaml emitter""" # TODO: Once this is entered into the BiolinkML test package, compare this to input/obo_test.yaml - self.dump_test('obo_sample.yaml', lambda out_fname: yaml_dumper.dump(self.test_package, out_fname)) - self.dumps_test('obo_sample.yaml', lambda: yaml_dumper.dumps(self.test_package)) + self.dump_test("obo_sample.yaml", lambda out_fname: yaml_dumper.dump(self.test_package, out_fname)) + self.dumps_test("obo_sample.yaml", lambda: yaml_dumper.dumps(self.test_package)) def test_json_dumper(self): - """ Test the json emitter """ + """Test the json emitter""" # TODO: Same as test_yaml_dumper - self.dump_test('obo_sample.json', lambda out_fname: json_dumper.dump(self.test_package, out_fname)) + self.dump_test("obo_sample.json", lambda out_fname: json_dumper.dump(self.test_package, out_fname)) obo_json_obj = cast(Package, as_json_object(self.test_package)) self.assertEqual(OBO, obo_json_obj.system[0].namespace) - self.assertEqual('C147796', obo_json_obj.system[0].contents[0].code) - - self.dumps_test('obo_sample.json', lambda: json_dumper.dumps(self.test_package)) - self.dump_test('obo_sample_context.json', - lambda out_fname: json_dumper.dump(self.test_package, out_fname, - GITHUB_LD10_CONTEXT + 'termci_schema.context.jsonld')) - self.dumps_test('obo_sample_context.json', - lambda: json_dumper.dumps(self.test_package, - GITHUB_LD11_CONTEXT + 'termci_schema_inlined.context.jsonld')) + self.assertEqual("C147796", obo_json_obj.system[0].contents[0].code) + + self.dumps_test("obo_sample.json", lambda: json_dumper.dumps(self.test_package)) + self.dump_test( + "obo_sample_context.json", + lambda out_fname: json_dumper.dump( + self.test_package, out_fname, GITHUB_LD10_CONTEXT + "termci_schema.context.jsonld" + ), + ) + self.dumps_test( + "obo_sample_context.json", + lambda: json_dumper.dumps(self.test_package, GITHUB_LD11_CONTEXT + "termci_schema_inlined.context.jsonld"), + ) @unittest.skipIf(True, "This needs an enhanced (https://github.com/hsolbrig/pyld) version of pyld") def test_rdf_dumper(self): - """ Test the rdf dumper """ - contexts = os.path.join(LD_11_DIR, 'termci_schema_inlined.context.jsonld') - self.dump_test('obo_sample.ttl', lambda out_file: rdf_dumper.dump(self.test_package, out_file, contexts), - comparator=ClickTestCase.rdf_comparator) + """Test the rdf dumper""" + contexts = os.path.join(LD_11_DIR, "termci_schema_inlined.context.jsonld") + self.dump_test( + "obo_sample.ttl", + lambda out_file: rdf_dumper.dump(self.test_package, out_file, contexts), + comparator=ClickTestCase.rdf_comparator, + ) g = rdf_dumper.as_rdf_graph(self.test_package, contexts) - self.assertIn(OBO[''], g.subjects()) + self.assertIn(OBO[""], g.subjects()) self.assertIn(NCIT.C147796, g.subjects()) - self.assertIn(Literal('C147796'), g.objects(NCIT.C147796, SKOS.notation)) + self.assertIn(Literal("C147796"), g.objects(NCIT.C147796, SKOS.notation)) - self.dumps_test('obo_sample.ttl', lambda: rdf_dumper.dumps(self.test_package, contexts), - comparator=ClickTestCase.rdf_comparator) + self.dumps_test( + "obo_sample.ttl", + lambda: rdf_dumper.dumps(self.test_package, contexts), + comparator=ClickTestCase.rdf_comparator, + ) # Build a vanilla jsonld image for subsequent testing - fname = 'obo_sample.jsonld' - self.dump_test(fname, lambda out_file: rdf_dumper.dump(self.test_package, out_file, contexts, fmt='json-ld'), - comparator=lambda e, a: ClickTestCase.rdf_comparator(e, a, fmt='json-ld')) - with open(self.env.expected_path('dump', fname)) as f: + fname = "obo_sample.jsonld" + self.dump_test( + fname, + lambda out_file: rdf_dumper.dump(self.test_package, out_file, contexts, fmt="json-ld"), + comparator=lambda e, a: ClickTestCase.rdf_comparator(e, a, fmt="json-ld"), + ) + with open(self.env.expected_path("dump", fname)) as f: txt = f.read() - with open(self.env.input_path('obo_sample.jsonld'), 'w') as f: + with open(self.env.input_path("obo_sample.jsonld"), "w") as f: f.write(txt) - @unittest.skip("Waiting until PyLD learns to handle relative context URI's") def test_nested_contexts(self): - """ Test JSON-LD with fully nested contexts """ + """Test JSON-LD with fully nested contexts""" context_servers = [] for possible_server in [LD_11_SVR, LD_11_SSL_SVR]: @@ -95,15 +123,18 @@ def test_nested_contexts(self): context_servers.append(svr) if not context_servers: - raise unittest.SkipTest(f"*****> Nested contexts test skipped - no servers found on sockets " - f"{HTTP_TEST_PORT} or {HTTPS_TEST_PORT}") + raise unittest.SkipTest( + f"*****> Nested contexts test skipped - no servers found on sockets " + f"{HTTP_TEST_PORT} or {HTTPS_TEST_PORT}" + ) for context_base in context_servers: - nested_context = context_base + 'Package.context.jsonld' - self.dump_test('obo_sample_nested.ttl', lambda out_file: rdf_dumper.dump(self.test_package, out_file, - nested_context)) - self.dumps_test('obo_sample_nested.ttl', lambda: rdf_dumper.dumps(self.test_package, nested_context)) + nested_context = context_base + "Package.context.jsonld" + self.dump_test( + "obo_sample_nested.ttl", lambda out_file: rdf_dumper.dump(self.test_package, out_file, nested_context) + ) + self.dumps_test("obo_sample_nested.ttl", lambda: rdf_dumper.dumps(self.test_package, nested_context)) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_loaders_dumpers/test_dumpers_pydantic.py b/tests/test_loaders_dumpers/test_dumpers_pydantic.py index 5e39da73..6d39bf84 100644 --- a/tests/test_loaders_dumpers/test_dumpers_pydantic.py +++ b/tests/test_loaders_dumpers/test_dumpers_pydantic.py @@ -13,41 +13,42 @@ class PydanticDumpersTestCase(LoaderDumperTestCase): @classmethod def setUpClass(cls) -> None: - """ Generate a small sample Books instance for testing purposes """ + """Generate a small sample Books instance for testing purposes""" LoaderDumperTestCase.setUpClass() - b1 = Book(name='Fellowship of the Ring', id="S001.1", price="5.99", summary="Hobbits") - b2 = Book(name='The Two Towers', id="S001.2", price="5.99", summary="More hobbits") - b3 = Book(name='Return of the King', id="S001.3", price="6.99", summary="Yet more hobbits") - jrr = Author(name='JRR Tolkein', from_country='England') - cls.bookseries = BookSeries(name='Lord of the Rings', id="S001", genres=["fantasy"], creator=jrr, books=[b1, b2, b3]) + b1 = Book(name="Fellowship of the Ring", id="S001.1", price="5.99", summary="Hobbits") + b2 = Book(name="The Two Towers", id="S001.2", price="5.99", summary="More hobbits") + b3 = Book(name="Return of the King", id="S001.3", price="6.99", summary="Yet more hobbits") + jrr = Author(name="JRR Tolkein", from_country="England") + cls.bookseries = BookSeries( + name="Lord of the Rings", id="S001", genres=["fantasy"], creator=jrr, books=[b1, b2, b3] + ) def test_yaml_dumper(self): - """ Test the yaml emitter """ - self.dump_test('book_series_lotr.yaml', lambda out_fname: yaml_dumper.dump(self.bookseries, out_fname)) - self.dumps_test('book_series_lotr.yaml', lambda: yaml_dumper.dumps(self.bookseries)) + """Test the yaml emitter""" + self.dump_test("book_series_lotr.yaml", lambda out_fname: yaml_dumper.dump(self.bookseries, out_fname)) + self.dumps_test("book_series_lotr.yaml", lambda: yaml_dumper.dumps(self.bookseries)) # test contents of yaml file with cleaned dict made from bookseries instance in setup - with open(self.env.input_path('book_series_lotr.yaml')) as f: + with open(self.env.input_path("book_series_lotr.yaml")) as f: data = yaml.safe_load(f) # explicitly confirm that unset fields aren't written to the file for i in range(3): - 'genres' not in data['books'][i].keys() - 'inStock' not in data['books'][i].keys() - 'creator' not in data['books'][i].keys() + "genres" not in data["books"][i].keys() + "inStock" not in data["books"][i].keys() + "creator" not in data["books"][i].keys() self.assertEqual(data, remove_empty_items(self.bookseries.dict())) - def test_json_dumper(self): - """ Test the json emitter """ - self.dump_test('book_series_lotr.json', lambda out_fname: json_dumper.dump(self.bookseries, out_fname)) - self.dumps_test('book_series_lotr.json', lambda: json_dumper.dumps(self.bookseries)) + """Test the json emitter""" + self.dump_test("book_series_lotr.json", lambda out_fname: json_dumper.dump(self.bookseries, out_fname)) + self.dumps_test("book_series_lotr.json", lambda: json_dumper.dumps(self.bookseries)) # test contents of json file with cleaned dict made from bookseries instance in setup - with open(self.env.input_path('book_series_lotr.json')) as f: + with open(self.env.input_path("book_series_lotr.json")) as f: data = json.load(f) # explicitly confirm that unset fields aren't written to the file for i in range(3): - 'genres' not in data['books'][i].keys() - 'inStock' not in data['books'][i].keys() - 'creator' not in data['books'][i].keys() + "genres" not in data["books"][i].keys() + "inStock" not in data["books"][i].keys() + "creator" not in data["books"][i].keys() self.assertEqual(data, remove_empty_items(self.bookseries.dict())) diff --git a/tests/test_loaders_dumpers/test_enum.py b/tests/test_loaders_dumpers/test_enum.py index ed47a9e8..ae168694 100644 --- a/tests/test_loaders_dumpers/test_enum.py +++ b/tests/test_loaders_dumpers/test_enum.py @@ -16,28 +16,23 @@ def test_enum(self): * https://github.com/linkml/linkml/issues/337 * https://github.com/linkml/linkml/issues/119 """ - i = Organism(state='LIVING') + i = Organism(state="LIVING") print(i) print(i.state) print(i.state.code) print(i.state.code.text) print(type(i.state)) print(StateEnum.LIVING) - assert str(i.state) == 'LIVING' + assert str(i.state) == "LIVING" assert i.state.code == StateEnum.LIVING obj = json.loads(json_dumper.dumps(i)) - assert obj['state'] == 'LIVING' + assert obj["state"] == "LIVING" obj = yaml.safe_load(yaml_dumper.dumps(i)) - assert obj['state'] == 'LIVING' + assert obj["state"] == "LIVING" reconstituted = json_loader.loads(json_dumper.dumps(i), target_class=Organism) - print(f'RECONSTITUTED = {reconstituted}') + print(f"RECONSTITUTED = {reconstituted}") assert reconstituted.state.code == StateEnum.LIVING - - - - - -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_loaders_dumpers/test_issue_429.py b/tests/test_loaders_dumpers/test_issue_429.py index b5b95370..84824d84 100644 --- a/tests/test_loaders_dumpers/test_issue_429.py +++ b/tests/test_loaders_dumpers/test_issue_429.py @@ -11,13 +11,13 @@ class RdfLibPrefixTestCase(unittest.TestCase): - SCHEMA = os.path.join(INPUT_DIR, 'personinfo_test_issue_429.yaml') - DATA = os.path.join(INPUT_DIR, 'example_personinfo_test_issue_429_data.yaml') - OUT = os.path.join(OUTPUT_DIR, 'example_personinfo_test_issue_429_data.ttl') + SCHEMA = os.path.join(INPUT_DIR, "personinfo_test_issue_429.yaml") + DATA = os.path.join(INPUT_DIR, "example_personinfo_test_issue_429_data.yaml") + OUT = os.path.join(OUTPUT_DIR, "example_personinfo_test_issue_429_data.ttl") - ORCID = Namespace('https://orcid.org/') - personinfo = Namespace('https://w3id.org/linkml/examples/personinfo/') - SDO = Namespace('http://schema.org/') + ORCID = Namespace("https://orcid.org/") + personinfo = Namespace("https://w3id.org/linkml/examples/personinfo/") + SDO = Namespace("http://schema.org/") def setUp(self): self.g = self.create_rdf_output() @@ -27,26 +27,26 @@ def create_rdf_output(self): container = yaml_loader.load(self.DATA, target_class=Container) rdflib_dumper.dump(container, schemaview=view, to_file=self.OUT) g = Graph() - g.parse(self.OUT, format='ttl') + g.parse(self.OUT, format="ttl") return g def test_rdf_output(self): - self.assertIn((self.ORCID['1234'], RDF.type, self.SDO.Person), self.g) - self.assertIn((self.ORCID['1234'], self.personinfo.full_name, Literal("Clark Kent")), self.g) - self.assertIn((self.ORCID['1234'], self.personinfo.age, Literal("32")), self.g) - self.assertIn((self.ORCID['1234'], self.personinfo.phone, Literal("555-555-5555")), self.g) - self.assertIn((self.ORCID['4567'], RDF.type, self.SDO.Person), self.g) - self.assertIn((self.ORCID['4567'], self.personinfo.full_name, Literal("Lois Lane")), self.g) - self.assertIn((self.ORCID['4567'], self.personinfo.age, Literal("33")), self.g) - self.assertIn((self.ORCID['4567'], self.personinfo.phone, Literal("555-555-5555")), self.g) + self.assertIn((self.ORCID["1234"], RDF.type, self.SDO.Person), self.g) + self.assertIn((self.ORCID["1234"], self.personinfo.full_name, Literal("Clark Kent")), self.g) + self.assertIn((self.ORCID["1234"], self.personinfo.age, Literal("32")), self.g) + self.assertIn((self.ORCID["1234"], self.personinfo.phone, Literal("555-555-5555")), self.g) + self.assertIn((self.ORCID["4567"], RDF.type, self.SDO.Person), self.g) + self.assertIn((self.ORCID["4567"], self.personinfo.full_name, Literal("Lois Lane")), self.g) + self.assertIn((self.ORCID["4567"], self.personinfo.age, Literal("33")), self.g) + self.assertIn((self.ORCID["4567"], self.personinfo.phone, Literal("555-555-5555")), self.g) def test_output_prefixes(self): - with open(self.OUT, encoding='UTF-8') as file: + with open(self.OUT, encoding="UTF-8") as file: file_string = file.read() - prefixes = ['prefix ORCID:', 'prefix personinfo:', 'prefix sdo:', 'sdo:Person', 'personinfo:age', 'ORCID:1234'] + prefixes = ["prefix ORCID:", "prefix personinfo:", "prefix sdo:", "sdo:Person", "personinfo:age", "ORCID:1234"] for prefix in prefixes: - assert(prefix in file_string) + assert prefix in file_string -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_loaders_dumpers/test_loaders.py b/tests/test_loaders_dumpers/test_loaders.py index af1e57fe..c084ef74 100644 --- a/tests/test_loaders_dumpers/test_loaders.py +++ b/tests/test_loaders_dumpers/test_loaders.py @@ -22,48 +22,62 @@ def setUpClass(cls) -> None: cls.context_server = LD_11_DIR def test_yaml_loader(self): - """ Load obo_sample.yaml, emit obo_sample_yaml.yaml and compare to obo_sample_output.yaml """ - self.loader_test('obo_sample.yaml', Package, yaml_loader) + """Load obo_sample.yaml, emit obo_sample_yaml.yaml and compare to obo_sample_output.yaml""" + self.loader_test("obo_sample.yaml", Package, yaml_loader) def test_json_loader(self): - """ Load obo_sample.json, emit obo_sample_json.yaml and check the results """ - self.loader_test('obo_sample.json', Package, json_loader) + """Load obo_sample.json, emit obo_sample_json.yaml and check the results""" + self.loader_test("obo_sample.json", Package, json_loader) def test_json_load_to_dict(self): - data = json_loader.load_as_dict('obo_sample.json', base_dir=self.env.indir) + data = json_loader.load_as_dict("obo_sample.json", base_dir=self.env.indir) assert isinstance(data, dict) assert "system" in data def test_yaml_load_to_dict(self): - data = yaml_loader.load_as_dict('obo_sample.yaml', base_dir=self.env.indir) + data = yaml_loader.load_as_dict("obo_sample.yaml", base_dir=self.env.indir) assert isinstance(data, dict) assert "system" in data @unittest.skipIf(True, "This test will not work until https://github.com/digitalbazaar/pyld/issues/149 is fixed") def test_rdf_loader(self): - """ Load obo_sample.ttl, emit obo_sample_ttl.yaml and check the results - Load obo_sample.jsonld, emit obo_sample_jsonld.yaml and check the results + """Load obo_sample.ttl, emit obo_sample_ttl.yaml and check the results + Load obo_sample.jsonld, emit obo_sample_jsonld.yaml and check the results """ if self.context_server == LD_11_DIR: raise unittest.SkipTest("*****> Loading skipped until JSON-LD processor can handle non-http files") - contexts = os.path.join(self.context_server, 'termci_schema_inlined.context.jsonld') - fmt = 'turtle' + contexts = os.path.join(self.context_server, "termci_schema_inlined.context.jsonld") + fmt = "turtle" class RDFLoaderWrapper(RDFLoader): - def load(self, source: Union[str, dict, TextIO], target_class: type[YAMLRoot], *, - base_dir: Optional[str] = None, metadata: Optional[FileInfo] = None, **_) -> YAMLRoot: - return rdf_loader.load(source, target_class, base_dir=LoadersUnitTest.env.indir, fmt=fmt, - metadata=metadata, contexts=contexts) - - def loads(self, source: str, target_class: type[YAMLRoot], *, metadata: Optional[FileInfo] = None, **_) \ - -> YAMLRoot: + def load( + self, + source: Union[str, dict, TextIO], + target_class: type[YAMLRoot], + *, + base_dir: Optional[str] = None, + metadata: Optional[FileInfo] = None, + **_, + ) -> YAMLRoot: + return rdf_loader.load( + source, + target_class, + base_dir=LoadersUnitTest.env.indir, + fmt=fmt, + metadata=metadata, + contexts=contexts, + ) + + def loads( + self, source: str, target_class: type[YAMLRoot], *, metadata: Optional[FileInfo] = None, **_ + ) -> YAMLRoot: return rdf_loader.loads(source, target_class, contexts=contexts, fmt=fmt, metadata=metadata) - self.loader_test('obo_sample.ttl', Package, RDFLoaderWrapper()) - fmt = 'json-ld' - self.loader_test('obo_sample.jsonld', Package, RDFLoaderWrapper()) + self.loader_test("obo_sample.ttl", Package, RDFLoaderWrapper()) + fmt = "json-ld" + self.loader_test("obo_sample.jsonld", Package, RDFLoaderWrapper()) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_loaders_dumpers/test_loaders_dumpers.py b/tests/test_loaders_dumpers/test_loaders_dumpers.py index 2ecde131..42194bee 100644 --- a/tests/test_loaders_dumpers/test_loaders_dumpers.py +++ b/tests/test_loaders_dumpers/test_loaders_dumpers.py @@ -20,28 +20,29 @@ logger = logging.getLogger(__name__) -SCHEMA = os.path.join(INPUT_DIR, 'personinfo.yaml') -DATA = os.path.join(INPUT_DIR, 'example_personinfo_data.yaml') -OUT_TTL = os.path.join(OUTPUT_DIR, 'example_out.ttl') -OUT_JSON = os.path.join(OUTPUT_DIR, 'example_out.json') -OUT_YAML = os.path.join(OUTPUT_DIR, 'example_out.yaml') +SCHEMA = os.path.join(INPUT_DIR, "personinfo.yaml") +DATA = os.path.join(INPUT_DIR, "example_personinfo_data.yaml") +OUT_TTL = os.path.join(OUTPUT_DIR, "example_out.ttl") +OUT_JSON = os.path.join(OUTPUT_DIR, "example_out.json") +OUT_YAML = os.path.join(OUTPUT_DIR, "example_out.yaml") prefix_map = { - 'CODE': 'http://example.org/code/', - 'ROR': 'http://example.org/ror/', - 'P': 'http://example.org/P/', - 'GEO': 'http://example.org/GEO/', + "CODE": "http://example.org/code/", + "ROR": "http://example.org/ror/", + "P": "http://example.org/P/", + "GEO": "http://example.org/GEO/", } -P = Namespace('http://example.org/P/') -ROR = Namespace('http://example.org/ror/') -CODE = Namespace('http://example.org/code/') -INFO = Namespace('https://w3id.org/linkml/examples/personinfo/') -SDO = Namespace('http://schema.org/') -GSSO = Namespace('http://purl.obolibrary.org/obo/GSSO_') -HP = Namespace('http://purl.obolibrary.org/obo/HP_') -SYMP = Namespace('http://purl.obolibrary.org/obo/SYMP_') -WD = Namespace('http://www.wikidata.org/entity/') +P = Namespace("http://example.org/P/") +ROR = Namespace("http://example.org/ror/") +CODE = Namespace("http://example.org/code/") +INFO = Namespace("https://w3id.org/linkml/examples/personinfo/") +SDO = Namespace("http://schema.org/") +GSSO = Namespace("http://purl.obolibrary.org/obo/GSSO_") +HP = Namespace("http://purl.obolibrary.org/obo/HP_") +SYMP = Namespace("http://purl.obolibrary.org/obo/SYMP_") +WD = Namespace("http://www.wikidata.org/entity/") + class LoadersDumpersTestCase(unittest.TestCase): @@ -69,23 +70,23 @@ def test_load_from_list(self): Tests the load_any loader method, which can be used to load directly to a list """ view = SchemaView(SCHEMA) - with open(DATA, encoding='UTF-8') as stream: + with open(DATA, encoding="UTF-8") as stream: data = yaml.safe_load(stream) - #persons = yaml_loader.load_source(data, target_class=Person) - #container = Container(persons=persons) - person_dicts = data['persons'] + # persons = yaml_loader.load_source(data, target_class=Person) + # container = Container(persons=persons) + person_dicts = data["persons"] tuples = [(yaml_loader, yaml.dump(person_dicts)), (json_loader, json.dumps(person_dicts, default=str))] for loader, person_list_str in tuples: persons = loader.loads_any(person_list_str, target_class=Person) assert isinstance(persons, list) assert isinstance(persons[0], Person) - [p1] = [p for p in persons if p.id == 'P:001'] - [p2] = [p for p in persons if p.id == 'P:002'] - self.assertEqual(p1.name, 'fred bloggs') - self.assertEqual(p2.name, 'joe schmö') + [p1] = [p for p in persons if p.id == "P:001"] + [p2] = [p for p in persons if p.id == "P:002"] + self.assertEqual(p1.name, "fred bloggs") + self.assertEqual(p2.name, "joe schmö") self.assertEqual(p1.age_in_years, 33) - self.assertEqual(p1.gender.code.text, 'cisgender man') - self.assertEqual(p2.gender.code.text, 'transgender man') + self.assertEqual(p1.gender.code.text, "cisgender man") + self.assertEqual(p2.gender.code.text, "transgender man") def test_encoding(self): """ @@ -94,47 +95,46 @@ def test_encoding(self): # pyyaml or json read non-ascii strings just fine no matter if the # file is ascii or utf-8 encoded. So we use Python's open function # to detect undesired ascii encoding. (linkml issue #634) - with open(OUT_YAML, encoding='UTF-8') as f: - [p2_name_line] = [l for l in f.readlines() if 'joe schm' in l] - self.assertIn('joe schmö', p2_name_line) - - with open(OUT_JSON, encoding='UTF-8') as f: - [p2_name_line] = [l for l in f.readlines() if 'joe schm' in l] - self.assertIn('joe schmö', p2_name_line) + with open(OUT_YAML, encoding="UTF-8") as f: + [p2_name_line] = [l for l in f.readlines() if "joe schm" in l] + self.assertIn("joe schmö", p2_name_line) + with open(OUT_JSON, encoding="UTF-8") as f: + [p2_name_line] = [l for l in f.readlines() if "joe schm" in l] + self.assertIn("joe schmö", p2_name_line) def _check_objs(self, view: SchemaView, container: Container): persons = container.persons orgs = container.organizations.values() - [p1] = [p for p in persons if p.id == 'P:001'] - [p2] = [p for p in persons if p.id == 'P:002'] - [o1] = [o for o in orgs if o.id == 'ROR:1'] - [o2] = [o for o in orgs if o.id == 'ROR:2'] - [o3] = [o for o in orgs if o.id == 'ROR:3'] - [o4] = [o for o in orgs if o.id == 'ROR:4'] + [p1] = [p for p in persons if p.id == "P:001"] + [p2] = [p for p in persons if p.id == "P:002"] + [o1] = [o for o in orgs if o.id == "ROR:1"] + [o2] = [o for o in orgs if o.id == "ROR:2"] + [o3] = [o for o in orgs if o.id == "ROR:3"] + [o4] = [o for o in orgs if o.id == "ROR:4"] o1cats = [c.code.text for c in o1.categories] o2cats = [c.code.text for c in o2.categories] - self.assertEqual(p1.name, 'fred bloggs') - self.assertEqual(p2.name, 'joe schmö') + self.assertEqual(p1.name, "fred bloggs") + self.assertEqual(p2.name, "joe schmö") self.assertEqual(p1.age_in_years, 33) - self.assertEqual(p1.gender.code.text, 'cisgender man') - self.assertEqual(p2.gender.code.text, 'transgender man') - self.assertCountEqual(o1cats, ['non profit', 'charity']) - self.assertCountEqual(o2cats, ['shell company']) + self.assertEqual(p1.gender.code.text, "cisgender man") + self.assertEqual(p2.gender.code.text, "transgender man") + self.assertCountEqual(o1cats, ["non profit", "charity"]) + self.assertCountEqual(o2cats, ["shell company"]) p2: Person emp = p2.has_employment_history[0] - self.assertEqual(emp.started_at_time, '2019-01-01') + self.assertEqual(emp.started_at_time, "2019-01-01") self.assertEqual(emp.is_current, True) self.assertEqual(emp.employed_at, o1.id) frel = p2.has_familial_relationships[0] self.assertEqual(frel.related_to, p1.id) # TODO: check PV vs PVText - self.assertEqual(str(frel.type), 'SIBLING_OF') + self.assertEqual(str(frel.type), "SIBLING_OF") med = p2.has_medical_history[0] - self.assertEqual(med.in_location, 'GEO:1234') - self.assertEqual(med.diagnosis.id, 'CODE:D0001') - self.assertEqual(med.diagnosis.name, 'headache') - self.assertEqual(med.diagnosis.code_system, 'CODE:D') + self.assertEqual(med.in_location, "GEO:1234") + self.assertEqual(med.diagnosis.id, "CODE:D0001") + self.assertEqual(med.diagnosis.name, "headache") + self.assertEqual(med.diagnosis.code_system, "CODE:D") # Check decimal representation self.assertEqual(o1.score, Decimal(1)) self.assertEqual(o2.score, Decimal("1.5")) @@ -142,7 +142,6 @@ def _check_objs(self, view: SchemaView, container: Container): self.assertEqual(o4.score, Decimal(1)) self.assertEqual(o1.min_salary, Decimal("99999.00")) - def test_edge_cases(self): """ Tests various edge cases: @@ -154,56 +153,68 @@ def test_edge_cases(self): # schema with following characterics: # - reified triples # - object has a complex union range (experimental new feature) - view = SchemaView(os.path.join(INPUT_DIR, 'complex_range_example.yaml')) + view = SchemaView(os.path.join(INPUT_DIR, "complex_range_example.yaml")) graph = Graph() taxon_prefix_map = { - 'NCBITaxon': 'http://purl.obolibrary.org/obo/NCBITaxon_', - 'RO': 'http://purl.obolibrary.org/obo/RO_', + "NCBITaxon": "http://purl.obolibrary.org/obo/NCBITaxon_", + "RO": "http://purl.obolibrary.org/obo/RO_", } # this graph has the following characteristics # - blank nodes to represent statements # - some triples not reachable from roots # - implicit schema with complex ranges (rdf:object has range of either node or literal) - graph.parse(os.path.join(INPUT_DIR, 'bacteria-taxon-class.ttl'), format='ttl') - objs = rdflib_loader.from_rdf_graph(graph, target_class=NodeObject, - schemaview=view, - cast_literals=False, ## strict - allow_unprocessed_triples=True, ## known issue - prefix_map=taxon_prefix_map) + graph.parse(os.path.join(INPUT_DIR, "bacteria-taxon-class.ttl"), format="ttl") + objs = rdflib_loader.from_rdf_graph( + graph, + target_class=NodeObject, + schemaview=view, + cast_literals=False, ## strict + allow_unprocessed_triples=True, ## known issue + prefix_map=taxon_prefix_map, + ) [obj] = objs for x in obj.statements: assert x.subject is None assert x.predicate is not None assert x.object is not None - logger.info(f' x={x}') + logger.info(f" x={x}") # ranges that are objects are contracted - assert Triple(subject=None, predicate='rdfs:subClassOf', object='owl:Thing') in obj.statements - assert Triple(subject=None, predicate='rdfs:subClassOf', object='NCBITaxon:1') in obj.statements + assert Triple(subject=None, predicate="rdfs:subClassOf", object="owl:Thing") in obj.statements + assert Triple(subject=None, predicate="rdfs:subClassOf", object="NCBITaxon:1") in obj.statements # string ranges - assert Triple(subject=None, predicate='rdfs:label', object='Bacteria') in obj.statements + assert Triple(subject=None, predicate="rdfs:label", object="Bacteria") in obj.statements with self.assertRaises(ValueError) as context: - rdflib_loader.from_rdf_graph(graph, target_class=NodeObject, - schemaview=view, - cast_literals=False, - allow_unprocessed_triples=False, - prefix_map=taxon_prefix_map) - logger.error(f'Passed unexpectedly: there are known to be unreachable triples') + rdflib_loader.from_rdf_graph( + graph, + target_class=NodeObject, + schemaview=view, + cast_literals=False, + allow_unprocessed_triples=False, + prefix_map=taxon_prefix_map, + ) + logger.error(f"Passed unexpectedly: there are known to be unreachable triples") # removing complex range, object has a range of string - view.schema.slots['object'].exactly_one_of = [] + view.schema.slots["object"].exactly_one_of = [] view.set_modified() - rdflib_loader.from_rdf_graph(graph, target_class=NodeObject, - schemaview=view, - cast_literals=True, ## required to pass - allow_unprocessed_triples=True, - prefix_map=taxon_prefix_map) + rdflib_loader.from_rdf_graph( + graph, + target_class=NodeObject, + schemaview=view, + cast_literals=True, ## required to pass + allow_unprocessed_triples=True, + prefix_map=taxon_prefix_map, + ) with self.assertRaises(ValueError) as context: - rdflib_loader.from_rdf_graph(graph, target_class=NodeObject, - schemaview=view, - cast_literals=False, - allow_unprocessed_triples=True, - prefix_map=taxon_prefix_map) - logger.error(f'Passed unexpectedly: rdf:object is known to have a mix of literals and nodes') - - -if __name__ == '__main__': + rdflib_loader.from_rdf_graph( + graph, + target_class=NodeObject, + schemaview=view, + cast_literals=False, + allow_unprocessed_triples=True, + prefix_map=taxon_prefix_map, + ) + logger.error(f"Passed unexpectedly: rdf:object is known to have a mix of literals and nodes") + + +if __name__ == "__main__": unittest.main() diff --git a/tests/test_loaders_dumpers/test_loaders_pydantic.py b/tests/test_loaders_dumpers/test_loaders_pydantic.py index 0c9c1f1d..a29d5eb5 100644 --- a/tests/test_loaders_dumpers/test_loaders_pydantic.py +++ b/tests/test_loaders_dumpers/test_loaders_pydantic.py @@ -11,18 +11,19 @@ class PydanticLoadersUnitTest(LoaderDumperTestCase): env = env def test_yaml_loader_single(self): - """ Load obo_sample.yaml, emit obo_sample_yaml.yaml and compare to obo_sample_output.yaml """ - self.loader_test('book_series_lotr.yaml', BookSeries, yaml_loader) + """Load obo_sample.yaml, emit obo_sample_yaml.yaml and compare to obo_sample_output.yaml""" + self.loader_test("book_series_lotr.yaml", BookSeries, yaml_loader) def test_json_loader(self): - """ Load obo_sample.json, emit obo_sample_json.yaml and check the results """ - self.loader_test('book_series_lotr.json', BookSeries, json_loader) + """Load obo_sample.json, emit obo_sample_json.yaml and check the results""" + self.loader_test("book_series_lotr.json", BookSeries, json_loader) def test_yaml_loader_kitchen_sink(self): - self.loader_test('kitchen_sink_normalized_inst_01.yaml', Dataset, yaml_loader) + self.loader_test("kitchen_sink_normalized_inst_01.yaml", Dataset, yaml_loader) def test_json_loader_kitchen_sink(self): - self.loader_test('kitchen_sink_normalized_inst_01.json', Dataset, json_loader) + self.loader_test("kitchen_sink_normalized_inst_01.json", Dataset, json_loader) -if __name__ == '__main__': + +if __name__ == "__main__": unittest.main() diff --git a/tests/test_loaders_dumpers/test_rdflib_dumper.py b/tests/test_loaders_dumpers/test_rdflib_dumper.py index 67a68f85..ba18e7a9 100644 --- a/tests/test_loaders_dumpers/test_rdflib_dumper.py +++ b/tests/test_loaders_dumpers/test_rdflib_dumper.py @@ -17,24 +17,29 @@ from tests.test_loaders_dumpers import INPUT_DIR, OUTPUT_DIR from tests.test_loaders_dumpers.models.personinfo import Container, Person, Address, Organization, OrganizationType from tests.test_loaders_dumpers.models.node_object import NodeObject, Triple -from tests.test_loaders_dumpers.models.phenopackets import PhenotypicFeature, OntologyClass, Phenopacket, MetaData, \ - Resource +from tests.test_loaders_dumpers.models.phenopackets import ( + PhenotypicFeature, + OntologyClass, + Phenopacket, + MetaData, + Resource, +) logger = logging.getLogger(__name__) -SCHEMA = os.path.join(INPUT_DIR, 'personinfo.yaml') -DATA = os.path.join(INPUT_DIR, 'example_personinfo_data.yaml') -DATA_TTL = os.path.join(INPUT_DIR, 'example_personinfo_data.ttl') -OUT = os.path.join(OUTPUT_DIR, 'example_personinfo_data.ttl') -DATA_ROUNDTRIP = os.path.join(OUTPUT_DIR, 'example_personinfo_data.roundtrip-rdf.yaml') -UNMAPPED_ROUNDTRIP = os.path.join(OUTPUT_DIR, 'example_personinfo_data.unmapped-preds.yaml') +SCHEMA = os.path.join(INPUT_DIR, "personinfo.yaml") +DATA = os.path.join(INPUT_DIR, "example_personinfo_data.yaml") +DATA_TTL = os.path.join(INPUT_DIR, "example_personinfo_data.ttl") +OUT = os.path.join(OUTPUT_DIR, "example_personinfo_data.ttl") +DATA_ROUNDTRIP = os.path.join(OUTPUT_DIR, "example_personinfo_data.roundtrip-rdf.yaml") +UNMAPPED_ROUNDTRIP = os.path.join(OUTPUT_DIR, "example_personinfo_data.unmapped-preds.yaml") PREFIX_MAP = { - 'CODE': 'http://example.org/code/', - 'ROR': 'http://example.org/ror/', - 'P': 'http://example.org/P/', - 'GEO': 'http://example.org/GEO/', + "CODE": "http://example.org/code/", + "ROR": "http://example.org/ror/", + "P": "http://example.org/P/", + "GEO": "http://example.org/GEO/", } unmapped_predicates_test_ttl = """ @@ -98,15 +103,16 @@ personinfo:street "1 foo street" ] . """ -P = Namespace('http://example.org/P/') -ROR = Namespace('http://example.org/ror/') -CODE = Namespace('http://example.org/code/') -INFO = Namespace('https://w3id.org/linkml/examples/personinfo/') -SDO = Namespace('http://schema.org/') -GSSO = Namespace('http://purl.obolibrary.org/obo/GSSO_') -HP = Namespace('http://purl.obolibrary.org/obo/HP_') -SYMP = Namespace('http://purl.obolibrary.org/obo/SYMP_') -WD = Namespace('http://www.wikidata.org/entity/') +P = Namespace("http://example.org/P/") +ROR = Namespace("http://example.org/ror/") +CODE = Namespace("http://example.org/code/") +INFO = Namespace("https://w3id.org/linkml/examples/personinfo/") +SDO = Namespace("http://schema.org/") +GSSO = Namespace("http://purl.obolibrary.org/obo/GSSO_") +HP = Namespace("http://purl.obolibrary.org/obo/HP_") +SYMP = Namespace("http://purl.obolibrary.org/obo/SYMP_") +WD = Namespace("http://www.wikidata.org/entity/") + class RdfLibDumperTestCase(unittest.TestCase): def setUp(self) -> None: @@ -118,47 +124,53 @@ def test_rdflib_dumper(self): self._check_objs(view, container) rdflib_dumper.dump(container, schemaview=view, to_file=OUT, prefix_map=self.prefix_map) g = Graph() - g.parse(OUT, format='ttl') - - self.assertIn((P['001'], RDF.type, SDO.Person), g) - self.assertIn((P['001'], SDO.name, Literal("fred bloggs")), g) - self.assertIn((P['001'], SDO.email, Literal("fred.bloggs@example.com")), g) - self.assertIn((P['001'], INFO.age_in_years, Literal(33)), g) - self.assertIn((P['001'], SDO.gender, GSSO['000371']), g) - self.assertIn((P['001'], INFO.depicted_by, Literal('https://example.org/pictures/fred.jpg', datatype=XSD.anyURI)), g) - self.assertNotIn((P['001'], INFO.depicted_by, Literal('https://example.org/pictures/fred.jpg', datatype=XSD.string)), g) - #for (s,p,o) in g.triples((None, None, None)): + g.parse(OUT, format="ttl") + + self.assertIn((P["001"], RDF.type, SDO.Person), g) + self.assertIn((P["001"], SDO.name, Literal("fred bloggs")), g) + self.assertIn((P["001"], SDO.email, Literal("fred.bloggs@example.com")), g) + self.assertIn((P["001"], INFO.age_in_years, Literal(33)), g) + self.assertIn((P["001"], SDO.gender, GSSO["000371"]), g) + self.assertIn( + (P["001"], INFO.depicted_by, Literal("https://example.org/pictures/fred.jpg", datatype=XSD.anyURI)), g + ) + self.assertNotIn( + (P["001"], INFO.depicted_by, Literal("https://example.org/pictures/fred.jpg", datatype=XSD.string)), g + ) + # for (s,p,o) in g.triples((None, None, None)): # print(f'{s} {p} {o}') - self.assertIn((CODE['D0001'], RDF.type, INFO.DiagnosisConcept), g) - self.assertIn((CODE['D0001'], RDF.type, INFO.DiagnosisConcept), g) - self.assertIn((CODE['D0001'], SKOS.exactMatch, HP['0002315']), g) - self.assertIn((CODE['D0001'], SKOS.exactMatch, WD.Q86), g) - self.assertIn((CODE['D0001'], SKOS.exactMatch, SYMP['0000504']), g) - self.assertNotIn((CODE['D0001'], SKOS.exactMatch, Literal(HP['0002315'])), g) + self.assertIn((CODE["D0001"], RDF.type, INFO.DiagnosisConcept), g) + self.assertIn((CODE["D0001"], RDF.type, INFO.DiagnosisConcept), g) + self.assertIn((CODE["D0001"], SKOS.exactMatch, HP["0002315"]), g) + self.assertIn((CODE["D0001"], SKOS.exactMatch, WD.Q86), g) + self.assertIn((CODE["D0001"], SKOS.exactMatch, SYMP["0000504"]), g) + self.assertNotIn((CODE["D0001"], SKOS.exactMatch, Literal(HP["0002315"])), g) [container] = g.subjects(RDF.type, INFO.Container) - self.assertIn((container, INFO.organizations, ROR['1']), g) - self.assertIn((container, INFO.organizations, ROR['2']), g) - self.assertIn((container, INFO.persons, P['001']), g) - self.assertIn((container, INFO.persons, P['002']), g) - container: Container = rdflib_loader.load(OUT, target_class=Container, schemaview=view, prefix_map=self.prefix_map) + self.assertIn((container, INFO.organizations, ROR["1"]), g) + self.assertIn((container, INFO.organizations, ROR["2"]), g) + self.assertIn((container, INFO.persons, P["001"]), g) + self.assertIn((container, INFO.persons, P["002"]), g) + container: Container = rdflib_loader.load( + OUT, target_class=Container, schemaview=view, prefix_map=self.prefix_map + ) self._check_objs(view, container) - #print(yaml_dumper.dumps(container)) - #person = next(p for p in container.persons if p.id == 'P:002') - #mh = person.has_medical_history[0] + # print(yaml_dumper.dumps(container)) + # person = next(p for p in container.persons if p.id == 'P:002') + # mh = person.has_medical_history[0] def test_enums(self): view = SchemaView(SCHEMA) - org1type1 = OrganizationType('non profit') ## no meaning declared - org1type2 = OrganizationType('charity') ## meaning URI is declared + org1type1 = OrganizationType("non profit") ## no meaning declared + org1type2 = OrganizationType("charity") ## meaning URI is declared assert not org1type1.meaning assert org1type2.meaning - org1 = Organization('ROR:1', categories=[org1type1, org1type2]) + org1 = Organization("ROR:1", categories=[org1type1, org1type2]) print(org1.categories) g = rdflib_dumper.as_rdf_graph(org1, schemaview=view, prefix_map=self.prefix_map) print(g) - cats = list(g.objects(ROR['1'], INFO['categories'])) + cats = list(g.objects(ROR["1"], INFO["categories"])) print(cats) - self.assertCountEqual([Literal('non profit'), URIRef('https://example.org/bizcodes/001')], cats) + self.assertCountEqual([Literal("non profit"), URIRef("https://example.org/bizcodes/001")], cats) orgs = rdflib_loader.from_rdf_graph(g, target_class=Organization, schemaview=view) assert len(orgs) == 1 [org1x] = orgs @@ -168,25 +180,27 @@ def test_enums(self): def test_undeclared_prefix_raises_error(self): view = SchemaView(SCHEMA) - org1 = Organization('foo') # not a CURIE or URI + org1 = Organization("foo") # not a CURIE or URI with self.assertRaises(Exception) as context: rdflib_dumper.as_rdf_graph(org1, schemaview=view) - org1 = Organization('http://example.org/foo/o1') + org1 = Organization("http://example.org/foo/o1") rdflib_dumper.as_rdf_graph(org1, schemaview=view) def test_base_prefix(self): view = SchemaView(SCHEMA) view.schema.prefixes["_base"] = Prefix("_base", "http://example.org/") - org1 = Organization('foo') # not a CURIE or URI + org1 = Organization("foo") # not a CURIE or URI g = rdflib_dumper.as_rdf_graph(org1, schemaview=view) - assert (URIRef('http://example.org/foo'), RDF.type, SDO.Organization) in g + assert (URIRef("http://example.org/foo"), RDF.type, SDO.Organization) in g def test_rdflib_loader(self): """ tests loading from an RDF graph """ view = SchemaView(SCHEMA) - container: Container = rdflib_loader.load(DATA_TTL, target_class=Container, schemaview=view, prefix_map=self.prefix_map) + container: Container = rdflib_loader.load( + DATA_TTL, target_class=Container, schemaview=view, prefix_map=self.prefix_map + ) self._check_objs(view, container) yaml_dumper.dump(container, to_file=DATA_ROUNDTRIP) @@ -198,27 +212,32 @@ def test_unmapped_predicates(self): view = SchemaView(SCHEMA) # default behavior is to raise error on unmapped predicates with self.assertRaises(MappingError) as context: - rdflib_loader.loads(unmapped_predicates_test_ttl, target_class=Person, - schemaview=view, prefix_map=self.prefix_map) + rdflib_loader.loads( + unmapped_predicates_test_ttl, target_class=Person, schemaview=view, prefix_map=self.prefix_map + ) # called can explicitly allow unmapped predicates to be dropped - person: Person = rdflib_loader.loads(unmapped_predicates_test_ttl, target_class=Person, - schemaview=view, prefix_map=self.prefix_map, - ignore_unmapped_predicates=True) - self.assertEqual(person.id, 'P:001') + person: Person = rdflib_loader.loads( + unmapped_predicates_test_ttl, + target_class=Person, + schemaview=view, + prefix_map=self.prefix_map, + ignore_unmapped_predicates=True, + ) + self.assertEqual(person.id, "P:001") self.assertEqual(person.age_in_years, 33) self.assertEqual(str(person.gender), "cisgender man") yaml_dumper.dump(person, to_file=UNMAPPED_ROUNDTRIP) - def test_any_of_enum(self): """ Tests https://github.com/linkml/linkml/issues/1023 """ view = SchemaView(SCHEMA) # default behavior is to raise error on unmapped predicates - person = rdflib_loader.loads(enum_union_type_test_ttl, target_class=Person, - schemaview=view, prefix_map=self.prefix_map) - self.assertEqual(person.id, 'P:001') + person = rdflib_loader.loads( + enum_union_type_test_ttl, target_class=Person, schemaview=view, prefix_map=self.prefix_map + ) + self.assertEqual(person.id, "P:001") self.assertEqual(person.age_in_years, 33) yaml_dumper.dump(person, to_file=UNMAPPED_ROUNDTRIP) cases = [ @@ -237,12 +256,12 @@ def test_unmapped_type(self): view = SchemaView(SCHEMA) # default behavior is to raise error on unmapped predicates with self.assertRaises(DataNotFoundError) as context: - rdflib_loader.loads(unmapped_type_test_ttl, target_class=Person, - schemaview=view, prefix_map=self.prefix_map) + rdflib_loader.loads( + unmapped_type_test_ttl, target_class=Person, schemaview=view, prefix_map=self.prefix_map + ) graph = Graph() - graph.parse(data=unmapped_type_test_ttl, format='ttl') - objs = rdflib_loader.from_rdf_graph(graph, target_class=Person, - schemaview=view, prefix_map=self.prefix_map) + graph.parse(data=unmapped_type_test_ttl, format="ttl") + objs = rdflib_loader.from_rdf_graph(graph, target_class=Person, schemaview=view, prefix_map=self.prefix_map) self.assertEqual(len(objs), 0) def test_blank_node(self): @@ -250,16 +269,20 @@ def test_blank_node(self): blank nodes should be retrievable """ view = SchemaView(SCHEMA) - address: Address = rdflib_loader.loads(blank_node_test_ttl, target_class=Address, - schemaview=view, prefix_map=self.prefix_map, - ignore_unmapped_predicates=True) - self.assertEqual(address.city, 'foo city') + address: Address = rdflib_loader.loads( + blank_node_test_ttl, + target_class=Address, + schemaview=view, + prefix_map=self.prefix_map, + ignore_unmapped_predicates=True, + ) + self.assertEqual(address.city, "foo city") ttl = rdflib_dumper.dumps(address, schemaview=view) print(ttl) g = Graph() - g.parse(data=ttl, format='ttl') - INFO = Namespace('https://w3id.org/linkml/examples/personinfo/') - SDO = Namespace('http://schema.org/') + g.parse(data=ttl, format="ttl") + INFO = Namespace("https://w3id.org/linkml/examples/personinfo/") + SDO = Namespace("http://schema.org/") [bn] = g.subjects(RDF.type, SDO.PostalAddress) self.assertIn((bn, RDF.type, SDO.PostalAddress), g) self.assertIn((bn, INFO.city, Literal("foo city")), g) @@ -268,33 +291,33 @@ def test_blank_node(self): def _check_objs(self, view: SchemaView, container: Container): persons = container.persons orgs = container.organizations.values() - [p1] = [p for p in persons if p.id == 'P:001'] - [p2] = [p for p in persons if p.id == 'P:002'] - [o1] = [o for o in orgs if o.id == 'ROR:1'] - [o2] = [o for o in orgs if o.id == 'ROR:2'] + [p1] = [p for p in persons if p.id == "P:001"] + [p2] = [p for p in persons if p.id == "P:002"] + [o1] = [o for o in orgs if o.id == "ROR:1"] + [o2] = [o for o in orgs if o.id == "ROR:2"] o1cats = [c.code.text for c in o1.categories] o2cats = [c.code.text for c in o2.categories] - self.assertEqual(p1.name, 'fred bloggs') - self.assertEqual(p2.name, 'joe schmö') + self.assertEqual(p1.name, "fred bloggs") + self.assertEqual(p2.name, "joe schmö") self.assertEqual(p1.age_in_years, 33) - self.assertEqual(p1.gender.code.text, 'cisgender man') - self.assertEqual(p2.gender.code.text, 'transgender man') - self.assertCountEqual(o1cats, ['non profit', 'charity']) - self.assertCountEqual(o2cats, ['shell company']) + self.assertEqual(p1.gender.code.text, "cisgender man") + self.assertEqual(p2.gender.code.text, "transgender man") + self.assertCountEqual(o1cats, ["non profit", "charity"]) + self.assertCountEqual(o2cats, ["shell company"]) p2: Person emp = p2.has_employment_history[0] - self.assertEqual(emp.started_at_time, '2019-01-01') + self.assertEqual(emp.started_at_time, "2019-01-01") self.assertEqual(emp.is_current, True) self.assertEqual(emp.employed_at, o1.id) frel = p2.has_familial_relationships[0] self.assertEqual(frel.related_to, p1.id) # TODO: check PV vs PVText - self.assertEqual(str(frel.type), 'SIBLING_OF') + self.assertEqual(str(frel.type), "SIBLING_OF") med = p2.has_medical_history[0] - self.assertEqual(med.in_location, 'GEO:1234') - self.assertEqual(med.diagnosis.id, 'CODE:D0001') - self.assertEqual(med.diagnosis.name, 'headache') - self.assertEqual(med.diagnosis.code_system, 'CODE:D') + self.assertEqual(med.in_location, "GEO:1234") + self.assertEqual(med.diagnosis.id, "CODE:D0001") + self.assertEqual(med.diagnosis.name, "headache") + self.assertEqual(med.diagnosis.code_system, "CODE:D") def test_edge_cases(self): """ @@ -307,92 +330,113 @@ def test_edge_cases(self): # schema with following characterics: # - reified triples # - object has a complex union range (experimental new feature) - view = SchemaView(os.path.join(INPUT_DIR, 'complex_range_example.yaml')) + view = SchemaView(os.path.join(INPUT_DIR, "complex_range_example.yaml")) graph = Graph() taxon_prefix_map = { - 'NCBITaxon': 'http://purl.obolibrary.org/obo/NCBITaxon_', - 'RO': 'http://purl.obolibrary.org/obo/RO_', + "NCBITaxon": "http://purl.obolibrary.org/obo/NCBITaxon_", + "RO": "http://purl.obolibrary.org/obo/RO_", } # this graph has the following characteristics # - blank nodes to represent statements # - some triples not reachable from roots # - implicit schema with complex ranges (rdf:object has range of either node or literal) - graph.parse(os.path.join(INPUT_DIR, 'bacteria-taxon-class.ttl'), format='ttl') - objs = rdflib_loader.from_rdf_graph(graph, target_class=NodeObject, - schemaview=view, - cast_literals=False, ## strict - allow_unprocessed_triples=True, ## known issue - prefix_map=taxon_prefix_map) + graph.parse(os.path.join(INPUT_DIR, "bacteria-taxon-class.ttl"), format="ttl") + objs = rdflib_loader.from_rdf_graph( + graph, + target_class=NodeObject, + schemaview=view, + cast_literals=False, ## strict + allow_unprocessed_triples=True, ## known issue + prefix_map=taxon_prefix_map, + ) [obj] = objs for x in obj.statements: assert x.subject is None assert x.predicate is not None assert x.object is not None - logger.info(f' x={x}') + logger.info(f" x={x}") # ranges that are objects are contracted - assert Triple(subject=None, predicate='rdfs:subClassOf', object='owl:Thing') in obj.statements - assert Triple(subject=None, predicate='rdfs:subClassOf', object='NCBITaxon:1') in obj.statements + assert Triple(subject=None, predicate="rdfs:subClassOf", object="owl:Thing") in obj.statements + assert Triple(subject=None, predicate="rdfs:subClassOf", object="NCBITaxon:1") in obj.statements # string ranges - assert Triple(subject=None, predicate='rdfs:label', object='Bacteria') in obj.statements + assert Triple(subject=None, predicate="rdfs:label", object="Bacteria") in obj.statements with self.assertRaises(ValueError) as context: - rdflib_loader.from_rdf_graph(graph, target_class=NodeObject, - schemaview=view, - cast_literals=False, - allow_unprocessed_triples=False, - prefix_map=taxon_prefix_map) - logger.error(f'Passed unexpectedly: there are known to be unreachable triples') + rdflib_loader.from_rdf_graph( + graph, + target_class=NodeObject, + schemaview=view, + cast_literals=False, + allow_unprocessed_triples=False, + prefix_map=taxon_prefix_map, + ) + logger.error(f"Passed unexpectedly: there are known to be unreachable triples") # removing complex range, object has a range of string - view.schema.slots['object'].exactly_one_of = [] + view.schema.slots["object"].exactly_one_of = [] view.set_modified() - rdflib_loader.from_rdf_graph(graph, target_class=NodeObject, - schemaview=view, - cast_literals=True, ## required to pass - allow_unprocessed_triples=True, - prefix_map=taxon_prefix_map) + rdflib_loader.from_rdf_graph( + graph, + target_class=NodeObject, + schemaview=view, + cast_literals=True, ## required to pass + allow_unprocessed_triples=True, + prefix_map=taxon_prefix_map, + ) with self.assertRaises(ValueError) as context: - rdflib_loader.from_rdf_graph(graph, target_class=NodeObject, - schemaview=view, - cast_literals=False, - allow_unprocessed_triples=True, - prefix_map=taxon_prefix_map) - logger.error(f'Passed unexpectedly: rdf:object is known to have a mix of literals and nodes') + rdflib_loader.from_rdf_graph( + graph, + target_class=NodeObject, + schemaview=view, + cast_literals=False, + allow_unprocessed_triples=True, + prefix_map=taxon_prefix_map, + ) + logger.error(f"Passed unexpectedly: rdf:object is known to have a mix of literals and nodes") def test_phenopackets(self): - view = SchemaView(str(Path(INPUT_DIR) / "phenopackets"/ "phenopackets.yaml")) - test_label = 'test label' + view = SchemaView(str(Path(INPUT_DIR) / "phenopackets" / "phenopackets.yaml")) + test_label = "test label" with self.assertRaises(ValueError) as e: - c = OntologyClass(id='NO_SUCH_PREFIX:1', label=test_label) + c = OntologyClass(id="NO_SUCH_PREFIX:1", label=test_label) rdflib_dumper.dumps(c, view) cases = [ ("HP:1", "http://purl.obolibrary.org/obo/HP_1", None), - ("FOO:1", "http://example.org/FOO_1", {'FOO': 'http://example.org/FOO_', - "@base": "http://example.org/base/"}), + ( + "FOO:1", + "http://example.org/FOO_1", + {"FOO": "http://example.org/FOO_", "@base": "http://example.org/base/"}, + ), ] for id, expected_uri, prefix_map in cases: c = OntologyClass(id=id, label=test_label) ttl = rdflib_dumper.dumps(c, view, prefix_map=prefix_map) g = Graph() - g.parse(data=ttl, format='ttl') + g.parse(data=ttl, format="ttl") self.assertEqual(len(g), 2) - self.assertIn(Literal(test_label), list(g.objects(URIRef(expected_uri))), - f'Expected label {test_label} for {expected_uri} in {ttl}') + self.assertIn( + Literal(test_label), + list(g.objects(URIRef(expected_uri))), + f"Expected label {test_label} for {expected_uri} in {ttl}", + ) pf = PhenotypicFeature(type=c) - pkt = Phenopacket(id='id with spaces', - metaData=MetaData(resources=[Resource(id='id with spaces')]), - phenotypicFeatures=[pf]) + pkt = Phenopacket( + id="id with spaces", + metaData=MetaData(resources=[Resource(id="id with spaces")]), + phenotypicFeatures=[pf], + ) ttl = rdflib_dumper.dumps(pkt, view, prefix_map=self.prefix_map) g = Graph() - g.parse(data=ttl, format='ttl') - self.assertIn(Literal(test_label), list(g.objects(URIRef(expected_uri))), - f'Expected label {test_label} for {expected_uri} in {ttl}') + g.parse(data=ttl, format="ttl") + self.assertIn( + Literal(test_label), + list(g.objects(URIRef(expected_uri))), + f"Expected label {test_label} for {expected_uri} in {ttl}", + ) if prefix_map and "@base" in prefix_map: resource_uri = URIRef(prefix_map["@base"] + "id%20with%20spaces") self.assertEqual(1, len(list(g.objects(resource_uri)))) - - class RDFLibConverterDumperTestCase(RdfLibDumperTestCase): """A test case that uses a :class:`curies.Converter` for testing loading and dumping with RDFLib.""" @@ -401,6 +445,5 @@ def setUp(self) -> None: self.prefix_map = Converter.from_prefix_map(PREFIX_MAP) - -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_processing/__init__.py b/tests/test_processing/__init__.py index 5d7473b7..ad98ac1b 100644 --- a/tests/test_processing/__init__.py +++ b/tests/test_processing/__init__.py @@ -3,5 +3,5 @@ TESTING_DIR = os.path.abspath(os.path.dirname(__file__)) -INPUT_DIR = os.path.join(TESTING_DIR, 'input') -OUTPUT_DIR = os.path.join(TESTING_DIR, 'output') +INPUT_DIR = os.path.join(TESTING_DIR, "input") +OUTPUT_DIR = os.path.join(TESTING_DIR, "output") diff --git a/tests/test_processing/test_arrays.py b/tests/test_processing/test_arrays.py index d3bb6873..4b1f8506 100644 --- a/tests/test_processing/test_arrays.py +++ b/tests/test_processing/test_arrays.py @@ -18,13 +18,11 @@ class ArrayTestCase(unittest.TestCase): See: https://linkml.io/linkml/howtos/multidimensional-arrays """ - def setUp(self) -> None: sv = SchemaView(str(Path(INPUT_DIR) / "array_example.yaml")) self.normalizer = ReferenceValidator(sv) self.matrix = yaml.safe_load(open(str(Path(INPUT_DIR) / "array_example_data.yaml"))) - def test_array_normalization(self): """Test that we can infer the collection form of a slot.""" norm = self.normalizer diff --git a/tests/test_processing/test_referencevalidator.py b/tests/test_processing/test_referencevalidator.py index 6f40799d..1593c33c 100644 --- a/tests/test_processing/test_referencevalidator.py +++ b/tests/test_processing/test_referencevalidator.py @@ -85,9 +85,7 @@ def __repr__(self) -> str: TEST_TIME = datetime.datetime(2023, 1, 21, 17, 24, 36, 385155) -def _add_core_schema_elements( - sb: SchemaBuilder, test_slot: Optional[SlotDefinition] = None -): +def _add_core_schema_elements(sb: SchemaBuilder, test_slot: Optional[SlotDefinition] = None): sb.add_slot("id", range="string", identifier=True) sb.add_class("Identified", slots=["id", "name", "description"]) sb.add_class("NonIdentified", slots=["name", "description"]) @@ -113,21 +111,11 @@ def _serialize(obj: Any) -> str: def _normalizations(report: Report) -> str: - return ", ".join( - [ - f"{f1.value}->{f2.value}" - for f1, f2 in report.collection_form_normalizations() - ] - ) + return ", ".join([f"{f1.value}->{f2.value}" for f1, f2 in report.collection_form_normalizations()]) -def _errors(report: Report) -> str: - return ", ".join( - [ - f"{r.type}" - for r in report.errors() - ] - ) +def _errors(report: Report) -> str: + return ", ".join([f"{r.type}" for r in report.errors()]) class ReferenceValidatorTestCase(unittest.TestCase): @@ -248,9 +236,7 @@ def test_01_infer_collection_form(self): CollectionForm.CompactDict, ), ( - SlotDefinition( - "s", multivalued=True, inlined=True, range="NonIdentified" - ), + SlotDefinition("s", multivalued=True, inlined=True, range="NonIdentified"), CollectionForm.CompactDict, ), ( @@ -258,27 +244,19 @@ def test_01_infer_collection_form(self): CollectionForm.SimpleDict, ), ( - SlotDefinition( - "s", multivalued=True, inlined_as_list=True, range="Identified" - ), + SlotDefinition("s", multivalued=True, inlined_as_list=True, range="Identified"), CollectionForm.List, ), ( - SlotDefinition( - "s", multivalued=True, inlined_as_list=True, range="NonIdentified" - ), + SlotDefinition("s", multivalued=True, inlined_as_list=True, range="NonIdentified"), CollectionForm.List, ), ( - SlotDefinition( - "s", multivalued=True, inlined_as_list=True, range="Simple" - ), + SlotDefinition("s", multivalued=True, inlined_as_list=True, range="Simple"), CollectionForm.List, ), ] - doc.text( - "Expected collection form for different combinations of slot properties:" - ) + doc.text("Expected collection form for different combinations of slot properties:") doc.th(METASLOTS + ["CollectionForm"]) for slot, expected in cases: sb = SchemaBuilder() @@ -296,7 +274,6 @@ def test_01_infer_collection_form(self): expected = CollectionForm.ExpandedDict self.assertEqual(expected, inferred_form, f"expand_all={normalizer.expand_all}") - def test_02_ensure_collection_forms(self): """Test normalization into a collection form.""" doc = self.doc @@ -380,9 +357,7 @@ def test_02_ensure_collection_forms(self): ), ( CollectionForm.List, - SlotDefinition( - "s", range="NonIdentified", multivalued=True - ), # inlined is inferred + SlotDefinition("s", range="NonIdentified", multivalued=True), # inlined is inferred [ ( [obj_non_identified_minimal], @@ -417,9 +392,7 @@ def test_02_ensure_collection_forms(self): ), ( CollectionForm.List, - SlotDefinition( - "s", range="Identified", multivalued=True, inlined=False - ), + SlotDefinition("s", range="Identified", multivalued=True, inlined=False), [ (["id1"], [], [], ["id1"]), ], @@ -442,12 +415,10 @@ def test_02_ensure_collection_forms(self): {"id1": obj_identified_minimal}, ), ( - {"id1": obj_identified_minimal, - "id2": obj_identified_minimal}, + {"id1": obj_identified_minimal, "id2": obj_identified_minimal}, [], [], - {"id1": obj_identified_minimal, - "id2": obj_identified_minimal}, + {"id1": obj_identified_minimal, "id2": obj_identified_minimal}, ), ( {"id1": None}, @@ -542,23 +513,15 @@ def test_02_ensure_collection_forms(self): input, expected_repairs, expected_unrepaired, expected_output = example report = Report() if form == CollectionForm.NonCollection: - output = normalizer.ensure_non_collection( - input, slot, pk_slot_name, report - ) + output = normalizer.ensure_non_collection(input, slot, pk_slot_name, report) elif form == CollectionForm.List: output = normalizer.ensure_list(input, slot, pk_slot_name, report) elif form == CollectionForm.ExpandedDict: - output = normalizer.ensure_expanded_dict( - input, slot, pk_slot_name, report - ) + output = normalizer.ensure_expanded_dict(input, slot, pk_slot_name, report) elif form == CollectionForm.CompactDict: - output = normalizer.ensure_compact_dict( - input, slot, pk_slot_name, report - ) + output = normalizer.ensure_compact_dict(input, slot, pk_slot_name, report) elif form == CollectionForm.SimpleDict: - output = normalizer.ensure_simple_dict( - input, slot, pk_slot_name, report - ) + output = normalizer.ensure_simple_dict(input, slot, pk_slot_name, report) else: raise AssertionError(f"{form} unrecognized") doc.tr( @@ -611,12 +574,8 @@ def test_03_slot_values(self): ), [ Inst_nt("empty parent object", {}, [], [], {}), - Inst_nt( - "slot value is valid empty list", {"s": []}, [], [], {"s": []} - ), - Inst_nt( - "slot value is valid list", {"s": [ref1]}, [], [], {"s": [ref1]} - ), + Inst_nt("slot value is valid empty list", {"s": []}, [], [], {"s": []}), + Inst_nt("slot value is valid list", {"s": [ref1]}, [], [], {"s": [ref1]}), Inst_nt( "slot value is expanded dict", {"s": {ref1["id"]: ref1}}, @@ -658,9 +617,7 @@ def test_03_slot_values(self): ), [ Inst_nt("parent object is empty", {}, [], [], {}), - Inst_nt( - "slot value is valid empty list", {"s": []}, [], [], {"s": []} - ), + Inst_nt("slot value is valid empty list", {"s": []}, [], [], {"s": []}), Inst_nt( "slot value is object list", {"s": [ref1ni]}, @@ -690,9 +647,7 @@ def test_03_slot_values(self): ), [ Inst_nt("parent object is empty", {}, [], [], {}), - Inst_nt( - "slot value is empty dictionary", {"s": {}}, [], [], {"s": {}} - ), + Inst_nt("slot value is empty dictionary", {"s": {}}, [], [], {"s": {}}), Inst_nt( "slot value is inlined list", {"s": [ref1]}, @@ -886,10 +841,8 @@ def test_03_slot_values(self): len(report.normalized_results()), f"Mismatch for {slot.description} => => {inst_description} . {report.normalized_results()}", ) - self._assert_unrepaired_types_the_same( - report, expected_unrepaired, inst, output_object - ) - #doc.h4("Example") + self._assert_unrepaired_types_the_same(report, expected_unrepaired, inst, output_object) + # doc.h4("Example") if False: if report.normalized_results(): @@ -902,12 +855,15 @@ def test_03_slot_values(self): doc.text("Validation Errors (Post-Normalization)") for r in report.results_excluding_normalized(): doc.object(r) - doc.tr([inst_description, - _serialize(inst), - _serialize(output_object), - _normalizations(report), - _errors(report), - ]) + doc.tr( + [ + inst_description, + _serialize(inst), + _serialize(output_object), + _normalizations(report), + _errors(report), + ] + ) def test_05_type_ranges(self): cases = [ @@ -972,9 +928,7 @@ def test_06_object_ranges(self): cn, inst, expected_problems = case report = Report() normalizer.normalize_object(inst, derived_schema.classes[cn], report) - self._assert_unrepaired_types_the_same( - report, expected_problems, inst, inst - ) + self._assert_unrepaired_types_the_same(report, expected_problems, inst, inst) def test_07_normalize_enums(self): sb = SchemaBuilder() @@ -993,14 +947,10 @@ def test_07_normalize_enums(self): expected_output, ) in cases: report = Report() - output = normalizer.normalize_enum( - input_object, derived_schema.enums["TestEnum"], report - ) + output = normalizer.normalize_enum(input_object, derived_schema.enums["TestEnum"], report) self.assertEqual(expected_output, output) self.assertCountEqual(expected_repairs, report.normalized_results()) - self._assert_unrepaired_types_the_same( - report, expected_unrepaired, input_object, output - ) + self._assert_unrepaired_types_the_same(report, expected_unrepaired, input_object, output) def test_08_normalize_types(self): doc = self.doc @@ -1109,30 +1059,20 @@ def test_08_normalize_types(self): for v, expected_repairs, expected_unrepaired, expected_value in examples: # test with custom type report = Report() - normalized_value = normalizer.normalize_type( - v, derived_schema.types[f"my_{t}"], report - ) - self.assertEqual( - expected_value, normalized_value, f"Failed to normalize {v} to {t}" - ) + normalized_value = normalizer.normalize_type(v, derived_schema.types[f"my_{t}"], report) + self.assertEqual(expected_value, normalized_value, f"Failed to normalize {v} to {t}") self.assertEqual( len(report.normalized_results()), len(expected_repairs), f"{v} -> {expected_value} type {t}: Expected {expected_repairs} repairs, got {report.normalized_results()}", ) - self._assert_unrepaired_types_the_same( - report, expected_unrepaired, v, expected_value - ) + self._assert_unrepaired_types_the_same(report, expected_unrepaired, v, expected_value) # test with built-in type report = Report() - normalized_value = normalizer.normalize_type( - v, derived_schema.types[t], report - ) + normalized_value = normalizer.normalize_type(v, derived_schema.types[t], report) self.assertEqual(expected_value, normalized_value) self.assertEqual(len(report.normalized_results()), len(expected_repairs)) - self._assert_unrepaired_types_the_same( - report, expected_unrepaired, v, expected_value - ) + self._assert_unrepaired_types_the_same(report, expected_unrepaired, v, expected_value) def test_derived_schema_for_metadata(self): view = package_schemaview("linkml_runtime.linkml_model.meta") @@ -1169,9 +1109,7 @@ def test_examples_against_metamodel(self): sdc = derived_schema.classes["schema_definition"] prefixes_slot = sdc.attributes["prefixes"] cf = validator.infer_slot_collection_form(prefixes_slot) - simple_dict_value_slot = validator._slot_as_simple_dict_value_slot( - sdc.attributes["prefixes"] - ) + simple_dict_value_slot = validator._slot_as_simple_dict_value_slot(sdc.attributes["prefixes"]) # print(simple_dict_value_slot.name) # print(cf) self.assertEqual(CollectionForm.SimpleDict, cf) @@ -1218,4 +1156,4 @@ def test_metamodel(self): if __name__ == "__main__": - unittest.main() \ No newline at end of file + unittest.main() diff --git a/tests/test_utils/__init__.py b/tests/test_utils/__init__.py index ac98c179..17e1f7eb 100644 --- a/tests/test_utils/__init__.py +++ b/tests/test_utils/__init__.py @@ -5,5 +5,5 @@ TESTING_DIR = os.path.abspath(os.path.dirname(__file__)) -INPUT_DIR = os.path.join(TESTING_DIR, 'input') -OUTPUT_DIR = os.path.join(TESTING_DIR, 'output') +INPUT_DIR = os.path.join(TESTING_DIR, "input") +OUTPUT_DIR = os.path.join(TESTING_DIR, "output") diff --git a/tests/test_utils/input/inlined_as_dict.py b/tests/test_utils/input/inlined_as_dict.py index e4ecabe6..b9b522d3 100644 --- a/tests/test_utils/input/inlined_as_dict.py +++ b/tests/test_utils/input/inlined_as_dict.py @@ -19,14 +19,15 @@ metamodel_version = "1.7.0" # Namespaces -EX = CurieNamespace('ex', 'https://example.org/inlined_as_dict#') -XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') +EX = CurieNamespace("ex", "https://example.org/inlined_as_dict#") +XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") DEFAULT_ = EX # Types class String(str): - """ A character string """ + """A character string""" + type_class_uri = XSD.string type_class_curie = "xsd:string" type_name = "string" @@ -34,7 +35,8 @@ class String(str): class Integer(int): - """ An integer """ + """An integer""" + type_class_uri = XSD.integer type_class_curie = "xsd:integer" type_name = "integer" @@ -94,4 +96,3 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): # Slots - diff --git a/tests/test_utils/input/inlined_as_list.py b/tests/test_utils/input/inlined_as_list.py index c50d2fe0..ff2bebe6 100644 --- a/tests/test_utils/input/inlined_as_list.py +++ b/tests/test_utils/input/inlined_as_list.py @@ -19,14 +19,15 @@ metamodel_version = "1.7.0" # Namespaces -EX = CurieNamespace('ex', 'https://example.org/inlined_as_dict#') -XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#') +EX = CurieNamespace("ex", "https://example.org/inlined_as_dict#") +XSD = CurieNamespace("xsd", "http://www.w3.org/2001/XMLSchema#") DEFAULT_ = EX # Types class String(str): - """ A character string """ + """A character string""" + type_class_uri = XSD.string type_class_curie = "xsd:string" type_name = "string" @@ -34,7 +35,8 @@ class String(str): class Integer(int): - """ An integer """ + """An integer""" + type_class_uri = XSD.integer type_class_curie = "xsd:integer" type_name = "integer" @@ -94,4 +96,3 @@ def __post_init__(self, *_: list[str], **kwargs: dict[str, Any]): # Slots - diff --git a/tests/test_utils/model/inference_example.py b/tests/test_utils/model/inference_example.py index 76888dd9..916424f9 100644 --- a/tests/test_utils/model/inference_example.py +++ b/tests/test_utils/model/inference_example.py @@ -24,12 +24,12 @@ metamodel_version = "1.7.0" # Namespaces -EX = CurieNamespace('ex', 'https://w3id.org/linkml/examples/inference/') -LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') -PAV = CurieNamespace('pav', 'http://purl.org/pav/') -SCHEMA = CurieNamespace('schema', 'http://schema.org/') -SH = CurieNamespace('sh', 'https://w3id.org/shacl/') -SKOS = CurieNamespace('skos', 'http://www.w3.org/2004/02/skos/core#') +EX = CurieNamespace("ex", "https://w3id.org/linkml/examples/inference/") +LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") +PAV = CurieNamespace("pav", "http://purl.org/pav/") +SCHEMA = CurieNamespace("schema", "http://schema.org/") +SH = CurieNamespace("sh", "https://w3id.org/shacl/") +SKOS = CurieNamespace("skos", "http://www.w3.org/2004/02/skos/core#") DEFAULT_ = EX @@ -38,7 +38,6 @@ # Class references - @dataclass class Term(YAMLRoot): _inherited_slots: ClassVar[list[str]] = [] @@ -240,90 +239,229 @@ class AgeEnum(EnumDefinitionImpl): name="AgeEnum", ) + # Slots class slots: pass -slots.id = Slot(uri=EX.id, name="id", curie=EX.curie('id'), - model_uri=EX.id, domain=None, range=Optional[str]) - -slots.name = Slot(uri=EX.name, name="name", curie=EX.curie('name'), - model_uri=EX.name, domain=None, range=Optional[str]) - -slots.synonyms = Slot(uri=EX.synonyms, name="synonyms", curie=EX.curie('synonyms'), - model_uri=EX.synonyms, domain=None, range=Optional[Union[str, list[str]]]) - -slots.full_name = Slot(uri=EX.full_name, name="full_name", curie=EX.curie('full_name'), - model_uri=EX.full_name, domain=None, range=Optional[str]) - -slots.first_name = Slot(uri=EX.first_name, name="first_name", curie=EX.curie('first_name'), - model_uri=EX.first_name, domain=None, range=Optional[str]) - -slots.last_name = Slot(uri=EX.last_name, name="last_name", curie=EX.curie('last_name'), - model_uri=EX.last_name, domain=None, range=Optional[str]) - -slots.age_in_years = Slot(uri=EX.age_in_years, name="age_in_years", curie=EX.curie('age_in_years'), - model_uri=EX.age_in_years, domain=None, range=Optional[Decimal]) - -slots.age_in_months = Slot(uri=EX.age_in_months, name="age_in_months", curie=EX.curie('age_in_months'), - model_uri=EX.age_in_months, domain=None, range=Optional[Decimal]) - -slots.is_juvenile = Slot(uri=EX.is_juvenile, name="is_juvenile", curie=EX.curie('is_juvenile'), - model_uri=EX.is_juvenile, domain=None, range=Optional[Union[bool, Bool]]) - -slots.age_category = Slot(uri=EX.age_category, name="age_category", curie=EX.curie('age_category'), - model_uri=EX.age_category, domain=None, range=Optional[Union[str, "AgeEnum"]]) - -slots.prohibited = Slot(uri=EX.prohibited, name="prohibited", curie=EX.curie('prohibited'), - model_uri=EX.prohibited, domain=None, range=Optional[str]) - -slots.street = Slot(uri=EX.street, name="street", curie=EX.curie('street'), - model_uri=EX.street, domain=None, range=Optional[str]) - -slots.city = Slot(uri=EX.city, name="city", curie=EX.curie('city'), - model_uri=EX.city, domain=None, range=Optional[str]) - -slots.verbatim = Slot(uri=EX.verbatim, name="verbatim", curie=EX.curie('verbatim'), - model_uri=EX.verbatim, domain=None, range=Optional[str]) - -slots.primary_address = Slot(uri=EX.primary_address, name="primary_address", curie=EX.curie('primary_address'), - model_uri=EX.primary_address, domain=None, range=Optional[Union[dict, Address]]) - -slots.description = Slot(uri=EX.description, name="description", curie=EX.curie('description'), - model_uri=EX.description, domain=None, range=Optional[str]) - -slots.summary = Slot(uri=EX.summary, name="summary", curie=EX.curie('summary'), - model_uri=EX.summary, domain=None, range=Optional[str]) - -slots.slot_with_spaces = Slot(uri=EX.slot_with_spaces, name="slot with spaces", curie=EX.curie('slot_with_spaces'), - model_uri=EX.slot_with_spaces, domain=None, range=Optional[str]) - -slots.derived_slot_with_spaces = Slot(uri=EX.derived_slot_with_spaces, name="derived slot with spaces", curie=EX.curie('derived_slot_with_spaces'), - model_uri=EX.derived_slot_with_spaces, domain=None, range=Optional[str]) - -slots.derived_expression_from_spaces = Slot(uri=EX.derived_expression_from_spaces, name="derived expression from spaces", curie=EX.curie('derived_expression_from_spaces'), - model_uri=EX.derived_expression_from_spaces, domain=None, range=Optional[str]) - -slots.relationship__person1 = Slot(uri=EX.person1, name="relationship__person1", curie=EX.curie('person1'), - model_uri=EX.relationship__person1, domain=None, range=Optional[Union[dict, Person]]) - -slots.relationship__person2 = Slot(uri=EX.person2, name="relationship__person2", curie=EX.curie('person2'), - model_uri=EX.relationship__person2, domain=None, range=Optional[Union[dict, Person]]) - -slots.relationship__type = Slot(uri=EX.type, name="relationship__type", curie=EX.curie('type'), - model_uri=EX.relationship__type, domain=None, range=Optional[str]) - -slots.relationship__description = Slot(uri=EX.description, name="relationship__description", curie=EX.curie('description'), - model_uri=EX.relationship__description, domain=None, range=Optional[str]) - -slots.relationship__description2 = Slot(uri=EX.description2, name="relationship__description2", curie=EX.curie('description2'), - model_uri=EX.relationship__description2, domain=None, range=Optional[str]) - -slots.container__persons = Slot(uri=EX.persons, name="container__persons", curie=EX.curie('persons'), - model_uri=EX.container__persons, domain=None, range=Optional[Union[Union[dict, Person], list[Union[dict, Person]]]]) - -slots.Person_description = Slot(uri=EX.description, name="Person_description", curie=EX.curie('description'), - model_uri=EX.Person_description, domain=Person, range=Optional[str]) -slots.Person_summary = Slot(uri=EX.summary, name="Person_summary", curie=EX.curie('summary'), - model_uri=EX.Person_summary, domain=Person, range=Optional[str]) +slots.id = Slot(uri=EX.id, name="id", curie=EX.curie("id"), model_uri=EX.id, domain=None, range=Optional[str]) + +slots.name = Slot(uri=EX.name, name="name", curie=EX.curie("name"), model_uri=EX.name, domain=None, range=Optional[str]) + +slots.synonyms = Slot( + uri=EX.synonyms, + name="synonyms", + curie=EX.curie("synonyms"), + model_uri=EX.synonyms, + domain=None, + range=Optional[Union[str, list[str]]], +) + +slots.full_name = Slot( + uri=EX.full_name, + name="full_name", + curie=EX.curie("full_name"), + model_uri=EX.full_name, + domain=None, + range=Optional[str], +) + +slots.first_name = Slot( + uri=EX.first_name, + name="first_name", + curie=EX.curie("first_name"), + model_uri=EX.first_name, + domain=None, + range=Optional[str], +) + +slots.last_name = Slot( + uri=EX.last_name, + name="last_name", + curie=EX.curie("last_name"), + model_uri=EX.last_name, + domain=None, + range=Optional[str], +) + +slots.age_in_years = Slot( + uri=EX.age_in_years, + name="age_in_years", + curie=EX.curie("age_in_years"), + model_uri=EX.age_in_years, + domain=None, + range=Optional[Decimal], +) + +slots.age_in_months = Slot( + uri=EX.age_in_months, + name="age_in_months", + curie=EX.curie("age_in_months"), + model_uri=EX.age_in_months, + domain=None, + range=Optional[Decimal], +) + +slots.is_juvenile = Slot( + uri=EX.is_juvenile, + name="is_juvenile", + curie=EX.curie("is_juvenile"), + model_uri=EX.is_juvenile, + domain=None, + range=Optional[Union[bool, Bool]], +) + +slots.age_category = Slot( + uri=EX.age_category, + name="age_category", + curie=EX.curie("age_category"), + model_uri=EX.age_category, + domain=None, + range=Optional[Union[str, "AgeEnum"]], +) + +slots.prohibited = Slot( + uri=EX.prohibited, + name="prohibited", + curie=EX.curie("prohibited"), + model_uri=EX.prohibited, + domain=None, + range=Optional[str], +) + +slots.street = Slot( + uri=EX.street, name="street", curie=EX.curie("street"), model_uri=EX.street, domain=None, range=Optional[str] +) + +slots.city = Slot(uri=EX.city, name="city", curie=EX.curie("city"), model_uri=EX.city, domain=None, range=Optional[str]) + +slots.verbatim = Slot( + uri=EX.verbatim, + name="verbatim", + curie=EX.curie("verbatim"), + model_uri=EX.verbatim, + domain=None, + range=Optional[str], +) + +slots.primary_address = Slot( + uri=EX.primary_address, + name="primary_address", + curie=EX.curie("primary_address"), + model_uri=EX.primary_address, + domain=None, + range=Optional[Union[dict, Address]], +) + +slots.description = Slot( + uri=EX.description, + name="description", + curie=EX.curie("description"), + model_uri=EX.description, + domain=None, + range=Optional[str], +) + +slots.summary = Slot( + uri=EX.summary, name="summary", curie=EX.curie("summary"), model_uri=EX.summary, domain=None, range=Optional[str] +) + +slots.slot_with_spaces = Slot( + uri=EX.slot_with_spaces, + name="slot with spaces", + curie=EX.curie("slot_with_spaces"), + model_uri=EX.slot_with_spaces, + domain=None, + range=Optional[str], +) + +slots.derived_slot_with_spaces = Slot( + uri=EX.derived_slot_with_spaces, + name="derived slot with spaces", + curie=EX.curie("derived_slot_with_spaces"), + model_uri=EX.derived_slot_with_spaces, + domain=None, + range=Optional[str], +) + +slots.derived_expression_from_spaces = Slot( + uri=EX.derived_expression_from_spaces, + name="derived expression from spaces", + curie=EX.curie("derived_expression_from_spaces"), + model_uri=EX.derived_expression_from_spaces, + domain=None, + range=Optional[str], +) + +slots.relationship__person1 = Slot( + uri=EX.person1, + name="relationship__person1", + curie=EX.curie("person1"), + model_uri=EX.relationship__person1, + domain=None, + range=Optional[Union[dict, Person]], +) + +slots.relationship__person2 = Slot( + uri=EX.person2, + name="relationship__person2", + curie=EX.curie("person2"), + model_uri=EX.relationship__person2, + domain=None, + range=Optional[Union[dict, Person]], +) + +slots.relationship__type = Slot( + uri=EX.type, + name="relationship__type", + curie=EX.curie("type"), + model_uri=EX.relationship__type, + domain=None, + range=Optional[str], +) + +slots.relationship__description = Slot( + uri=EX.description, + name="relationship__description", + curie=EX.curie("description"), + model_uri=EX.relationship__description, + domain=None, + range=Optional[str], +) + +slots.relationship__description2 = Slot( + uri=EX.description2, + name="relationship__description2", + curie=EX.curie("description2"), + model_uri=EX.relationship__description2, + domain=None, + range=Optional[str], +) + +slots.container__persons = Slot( + uri=EX.persons, + name="container__persons", + curie=EX.curie("persons"), + model_uri=EX.container__persons, + domain=None, + range=Optional[Union[Union[dict, Person], list[Union[dict, Person]]]], +) + +slots.Person_description = Slot( + uri=EX.description, + name="Person_description", + curie=EX.curie("description"), + model_uri=EX.Person_description, + domain=Person, + range=Optional[str], +) + +slots.Person_summary = Slot( + uri=EX.summary, + name="Person_summary", + curie=EX.curie("summary"), + model_uri=EX.Person_summary, + domain=Person, + range=Optional[str], +) diff --git a/tests/test_utils/test_context_utils.py b/tests/test_utils/test_context_utils.py index 8e8bd2b8..35342450 100644 --- a/tests/test_utils/test_context_utils.py +++ b/tests/test_utils/test_context_utils.py @@ -29,40 +29,58 @@ class ContextUtilsTestCase(unittest.TestCase): def test_merge_contexts(self): self.assertIsNone(merge_contexts()) - self.assertEqual('file://local.jsonld', merge_contexts("local.jsonld")['@context']) - self.assertEqual('file://local.jsonld', merge_contexts(["local.jsonld"])['@context']) - self.assertEqual(METAMODEL_CONTEXT_URI, merge_contexts(METAMODEL_CONTEXT_URI)['@context']) - self.assertEqual(METAMODEL_CONTEXT_URI, merge_contexts([METAMODEL_CONTEXT_URI])['@context']) - self.assertEqual(JsonObj(ex='http://example.org/test/', ex2='http://example.org/test2/'), - merge_contexts(json_1)['@context']) - self.assertEqual(JsonObj(ex='http://example.org/test/', ex2='http://example.org/test2/'), - merge_contexts([json_1])['@context']) - self.assertEqual(JsonObj(ex='http://example.org/test3/', ex2=JsonObj(**{'@id': 'http://example.org/test4/'})), - merge_contexts(json_2)['@context']) - self.assertEqual(JsonObj(ex='http://example.org/test3/', ex2=JsonObj(**{'@id': 'http://example.org/test4/'})), - merge_contexts([json_2])['@context']) - self.assertEqual([f'file://local.jsonld', - 'https://w3id.org/linkml/meta.context.jsonld', - JsonObj(ex='http://example.org/test/', ex2='http://example.org/test2/'), - JsonObj(ex='http://example.org/test3/', ex2=JsonObj(**{'@id': 'http://example.org/test4/'}))], - merge_contexts(["local.jsonld", METAMODEL_CONTEXT_URI, json_1, json_2])['@context']) - self.assertEqual(loads(context_output), - merge_contexts(["local.jsonld", METAMODEL_CONTEXT_URI, json_1, json_2])) + self.assertEqual("file://local.jsonld", merge_contexts("local.jsonld")["@context"]) + self.assertEqual("file://local.jsonld", merge_contexts(["local.jsonld"])["@context"]) + self.assertEqual(METAMODEL_CONTEXT_URI, merge_contexts(METAMODEL_CONTEXT_URI)["@context"]) + self.assertEqual(METAMODEL_CONTEXT_URI, merge_contexts([METAMODEL_CONTEXT_URI])["@context"]) + self.assertEqual( + JsonObj(ex="http://example.org/test/", ex2="http://example.org/test2/"), merge_contexts(json_1)["@context"] + ) + self.assertEqual( + JsonObj(ex="http://example.org/test/", ex2="http://example.org/test2/"), + merge_contexts([json_1])["@context"], + ) + self.assertEqual( + JsonObj(ex="http://example.org/test3/", ex2=JsonObj(**{"@id": "http://example.org/test4/"})), + merge_contexts(json_2)["@context"], + ) + self.assertEqual( + JsonObj(ex="http://example.org/test3/", ex2=JsonObj(**{"@id": "http://example.org/test4/"})), + merge_contexts([json_2])["@context"], + ) + self.assertEqual( + [ + f"file://local.jsonld", + "https://w3id.org/linkml/meta.context.jsonld", + JsonObj(ex="http://example.org/test/", ex2="http://example.org/test2/"), + JsonObj(ex="http://example.org/test3/", ex2=JsonObj(**{"@id": "http://example.org/test4/"})), + ], + merge_contexts(["local.jsonld", METAMODEL_CONTEXT_URI, json_1, json_2])["@context"], + ) + self.assertEqual(loads(context_output), merge_contexts(["local.jsonld", METAMODEL_CONTEXT_URI, json_1, json_2])) # Dups are not removed self.assertEqual( - JsonObj(**{'@context': [JsonObj(ex='http://example.org/test/', ex2='http://example.org/test2/'), - JsonObj(ex='http://example.org/test/', ex2='http://example.org/test2/')]}), - merge_contexts([json_1, json_1])) - self.assertEqual('file://local.jsonld', merge_contexts("local.jsonld")['@context']) + JsonObj( + **{ + "@context": [ + JsonObj(ex="http://example.org/test/", ex2="http://example.org/test2/"), + JsonObj(ex="http://example.org/test/", ex2="http://example.org/test2/"), + ] + } + ), + merge_contexts([json_1, json_1]), + ) + self.assertEqual("file://local.jsonld", merge_contexts("local.jsonld")["@context"]) def test_merge_contexts_base(self): self.assertEqual( - JsonObj(**{'@context': - JsonObj(**{'@base': 'file://relloc'})}), - merge_contexts(base='file://relloc')) + JsonObj(**{"@context": JsonObj(**{"@base": "file://relloc"})}), merge_contexts(base="file://relloc") + ) self.assertEqual(loads(f'{{"@context": {{"@base": "{META_BASE_URI}"}}}}'), merge_contexts(base=META_BASE_URI)) - self.assertEqual(loads(""" + self.assertEqual( + loads( + """ {"@context": [ "https://w3id.org/linkml/meta.context.jsonld", { @@ -79,8 +97,11 @@ def test_merge_contexts_base(self): "@base": "https://w3id.org/linkml/" } ] -}"""), merge_contexts([METAMODEL_CONTEXT_URI, json_1, json_2], base=META_BASE_URI)) +}""" + ), + merge_contexts([METAMODEL_CONTEXT_URI, json_1, json_2], base=META_BASE_URI), + ) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_curienamespace.py b/tests/test_utils/test_curienamespace.py index 3acec7ce..36e84346 100644 --- a/tests/test_utils/test_curienamespace.py +++ b/tests/test_utils/test_curienamespace.py @@ -7,17 +7,18 @@ class CurieNamespaceTestCase(unittest.TestCase): def test_basics(self): - BFO = CurieNamespace('bfo', "http://purl.obolibrary.org/obo/BFO_") + BFO = CurieNamespace("bfo", "http://purl.obolibrary.org/obo/BFO_") self.assertEqual(URIRef("http://purl.obolibrary.org/obo/BFO_test"), BFO.test) self.assertEqual("http://purl.obolibrary.org/obo/BFO_", BFO) - self.assertEqual("bfo:test", BFO.curie('test')) + self.assertEqual("bfo:test", BFO.curie("test")) self.assertEqual("bfo:", BFO.curie()) @unittest.expectedFailure def test_curie_as_curie(self): """ "curie can't be a local name at the moment" """ - BFO = CurieNamespace('bfo', "http://purl.obolibrary.org/obo/BFO_") + BFO = CurieNamespace("bfo", "http://purl.obolibrary.org/obo/BFO_") self.assertEqual("bfo:curie", BFO.curie) -if __name__ == '__main__': + +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_dict_utils.py b/tests/test_utils/test_dict_utils.py index e0beedce..ed4f4004 100644 --- a/tests/test_utils/test_dict_utils.py +++ b/tests/test_utils/test_dict_utils.py @@ -7,6 +7,7 @@ from tests.support.test_environment import TestEnvironmentTestCase from tests.test_utils.environment import env + def _signature(d): if isinstance(d, dict): for x in d.values(): @@ -17,10 +18,12 @@ def _signature(d): else: yield d + def _is_python_type(obj): t = type(obj) return t in [dict, list, str, int, float, type(None)] or isinstance(obj, ElementName) + def _is_basic_type(obj): return _is_python_type(obj) or isinstance(obj, ElementName) @@ -29,24 +32,24 @@ class DictUtilTestCase(TestEnvironmentTestCase): env = env def test_as_dict(self): - obj = ClassDefinition('test class') - obj2 = ClassDefinition('test class', slot_usage={'foo': SlotDefinition(name='foo', range='bar')}) - #obj2.slot_usage = {'foo': SlotDefinition(name='foo', range='bar')} + obj = ClassDefinition("test class") + obj2 = ClassDefinition("test class", slot_usage={"foo": SlotDefinition(name="foo", range="bar")}) + # obj2.slot_usage = {'foo': SlotDefinition(name='foo', range='bar')} # as dict preserves nones and empty lists d = yutils.as_dict(obj) assert isinstance(d, dict) - assert d['name'] == 'test class' - assert d['id_prefixes'] == [] - assert d['description'] is None + assert d["name"] == "test class" + assert d["id_prefixes"] == [] + assert d["description"] is None for x in _signature(d): if not _is_python_type(x): - print(f' ****={x} {type(x)}') + print(f" ****={x} {type(x)}") assert all(_is_basic_type(x) for x in _signature(d)) d2 = yutils.as_dict(obj2) print(d2) - assert d2['slot_usage']['foo']['range'] == 'bar' + assert d2["slot_usage"]["foo"]["range"] == "bar" assert all(_is_basic_type(x) for x in _signature(d2)) # as_simple_dict removes nones and empty lists @@ -54,24 +57,21 @@ def test_as_dict(self): print(d) assert isinstance(d, dict) assert all(_is_python_type(x) for x in _signature(d)) - assert d == {'name': 'test class'} + assert d == {"name": "test class"} d2 = as_simple_dict(obj2) print(d2) assert isinstance(d2, dict) - assert d2 == {'name': 'test class', 'slot_usage': {'foo': {'name': 'foo', 'range': 'bar'}}} + assert d2 == {"name": "test class", "slot_usage": {"foo": {"name": "foo", "range": "bar"}}} s = yutils.as_yaml(obj) print(s) - assert(s.strip() == 'name: test class') + assert s.strip() == "name: test class" s2 = yutils.as_yaml(obj2) print(s2) - assert(s2.strip().startswith('name: test class')) - - - + assert s2.strip().startswith("name: test class") -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_distroutils.py b/tests/test_utils/test_distroutils.py index c7235dbb..ebd587a6 100644 --- a/tests/test_utils/test_distroutils.py +++ b/tests/test_utils/test_distroutils.py @@ -6,12 +6,12 @@ class DistroUtilsTestCase(unittest.TestCase): def test_distroutils(self): - p = 'linkml_runtime.linkml_model.meta' + p = "linkml_runtime.linkml_model.meta" js = get_jsonschema_string(p) - assert 'ClassDefinition' in js + assert "ClassDefinition" in js ys = get_schema_string(p) - assert 'class_definition' in ys + assert "class_definition" in ys -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_eval_utils.py b/tests/test_utils/test_eval_utils.py index 83f082ab..a760ac3c 100644 --- a/tests/test_utils/test_eval_utils.py +++ b/tests/test_utils/test_eval_utils.py @@ -28,11 +28,11 @@ def test_eval_expressions(): assert eval_expr("1 + 2") == 3 assert eval_expr("1 + 2 + 3") == 6 assert eval_expr("{z} + 2", z=1) == 3 - assert eval_expr('{x} + {y}', x=5, y=None) is None - assert eval_expr("'x' + 'y'") == 'xy' - assert eval_expr("['a','b'] + ['c','d']") == ['a', 'b', 'c', 'd'] - assert eval_expr("{x} + {y}", x=['a', 'b'], y=['c', 'd']) == ['a', 'b', 'c', 'd'] - assert eval_expr("{'a': 1}") == {'a': 1} + assert eval_expr("{x} + {y}", x=5, y=None) is None + assert eval_expr("'x' + 'y'") == "xy" + assert eval_expr("['a','b'] + ['c','d']") == ["a", "b", "c", "d"] + assert eval_expr("{x} + {y}", x=["a", "b"], y=["c", "d"]) == ["a", "b", "c", "d"] + assert eval_expr("{'a': 1}") == {"a": 1} assert eval_expr("max([1, 5, 2])") == 5 assert eval_expr("max({x})", x=[1, 5, 2]) == 5 assert eval_expr("True") is True @@ -42,33 +42,33 @@ def test_eval_expressions(): assert eval_expr("1 <= 1") is True assert eval_expr("1 >= 1") is True assert eval_expr("2 > 1") is True - assert eval_expr("'EQ' if {x} == {y} else 'NEQ'", x=1, y=1) == 'EQ' - assert eval_expr("'EQ' if {x} == {y} else 'NEQ'", x=1, y=2) == 'NEQ' - assert eval_expr("'NOT_NULL' if x else 'NULL'", x=1) == 'NOT_NULL' - assert eval_expr("'NOT_NULL' if x else 'NULL'", x=None) == 'NULL' - assert eval_expr("'EQ' if {x} == {y} else 'NEQ'", x=1, y=2) == 'NEQ' + assert eval_expr("'EQ' if {x} == {y} else 'NEQ'", x=1, y=1) == "EQ" + assert eval_expr("'EQ' if {x} == {y} else 'NEQ'", x=1, y=2) == "NEQ" + assert eval_expr("'NOT_NULL' if x else 'NULL'", x=1) == "NOT_NULL" + assert eval_expr("'NOT_NULL' if x else 'NULL'", x=None) == "NULL" + assert eval_expr("'EQ' if {x} == {y} else 'NEQ'", x=1, y=2) == "NEQ" case = "case(({x} < 25, 'LOW'), ({x} > 75, 'HIGH'), (True, 'MEDIUM'))" - assert eval_expr(case, x=10) == 'LOW' - assert eval_expr(case, x=100) == 'HIGH' - assert eval_expr(case, x=50) == 'MEDIUM' - assert eval_expr('x', x='a') == 'a' - assert eval_expr('x+y', x=1, y=2) == 3 - assert eval_expr('x["a"] + y', x={'a': 1}, y=2) == 3 - assert eval_expr('x["a"]["b"] + y', x={'a': {'b': 1}}, y=2) == 3 - p = Person(name='x', aliases=['a', 'b', 'c'], address=Address(street='1 x street')) - assert eval_expr('p.name', p=p) == 'x' - assert eval_expr('p.address.street', p=p) == '1 x street' - assert eval_expr('len(p.aliases)', p=p) == 3 - assert eval_expr('p.aliases', p=p) == p.aliases - p2 = Person(name='x2', aliases=['a2', 'b2', 'c2'], address=Address(street='2 x street')) + assert eval_expr(case, x=10) == "LOW" + assert eval_expr(case, x=100) == "HIGH" + assert eval_expr(case, x=50) == "MEDIUM" + assert eval_expr("x", x="a") == "a" + assert eval_expr("x+y", x=1, y=2) == 3 + assert eval_expr('x["a"] + y', x={"a": 1}, y=2) == 3 + assert eval_expr('x["a"]["b"] + y', x={"a": {"b": 1}}, y=2) == 3 + p = Person(name="x", aliases=["a", "b", "c"], address=Address(street="1 x street")) + assert eval_expr("p.name", p=p) == "x" + assert eval_expr("p.address.street", p=p) == "1 x street" + assert eval_expr("len(p.aliases)", p=p) == 3 + assert eval_expr("p.aliases", p=p) == p.aliases + p2 = Person(name="x2", aliases=["a2", "b2", "c2"], address=Address(street="2 x street")) c = Container(persons=[p, p2]) - assert eval_expr('c.persons.name', c=c) == ['x', 'x2'] - assert eval_expr('c.persons.address.street', c=c) == ['1 x street', '2 x street'] - assert eval_expr('strlen(c.persons.address.street)', c=c) == [10, 10] + assert eval_expr("c.persons.name", c=c) == ["x", "x2"] + assert eval_expr("c.persons.address.street", c=c) == ["1 x street", "2 x street"] + assert eval_expr("strlen(c.persons.address.street)", c=c) == [10, 10] c = Container(person_index={p.name: p, p2.name: p2}) - assert eval_expr('c.person_index.name', c=c) == ['x', 'x2'] - assert eval_expr('c.person_index.address.street', c=c) == ['1 x street', '2 x street'] - assert eval_expr('strlen(c.person_index.name)', c=c) == [1, 2] + assert eval_expr("c.person_index.name", c=c) == ["x", "x2"] + assert eval_expr("c.person_index.address.street", c=c) == ["1 x street", "2 x street"] + assert eval_expr("strlen(c.person_index.name)", c=c) == [1, 2] def test_no_eval_prohibited(): @@ -78,4 +78,4 @@ def test_no_eval_prohibited(): def test_funcs(): with pytest.raises(NotImplementedError): - eval_expr("my_func([1,2,3])") \ No newline at end of file + eval_expr("my_func([1,2,3])") diff --git a/tests/test_utils/test_formatutils.py b/tests/test_utils/test_formatutils.py index 46a45861..df93abc4 100644 --- a/tests/test_utils/test_formatutils.py +++ b/tests/test_utils/test_formatutils.py @@ -4,33 +4,42 @@ from jsonasobj2 import JsonObj, as_json -from linkml_runtime.utils.formatutils import camelcase, underscore, lcamelcase, be, split_line, wrapped_annotation, \ - is_empty, remove_empty_items, uncamelcase +from linkml_runtime.utils.formatutils import ( + camelcase, + underscore, + lcamelcase, + be, + split_line, + wrapped_annotation, + is_empty, + remove_empty_items, + uncamelcase, +) empty_things = [None, dict(), list(), JsonObj(), JsonObj({}), JsonObj([])] -non_empty_things = [0, False, "", {'k': None}, {0:0}, [None], JsonObj(k=None), JsonObj(**{'k': None}), JsonObj([None])] - -things_removed: list[tuple[Any, Any]] = \ - [(None, None), - (dict(), {}), - (list(), []), - (JsonObj(), {}), - (JsonObj({}), {}), - (JsonObj([]), []), - (0, 0), - (False, False), - ("", ""), - ({'k': None}, {}), - ({0:0}, {0:0}), - ([None], []), - (JsonObj(k=None), {}), - (JsonObj(**{'k': None}), {}), - (JsonObj([None]), []), - ([None], []), - ([None, None],[]), - ([None, [], [{}]], []), - ({"k": [{"l": None, "m": [None]}]}, {}) - ] +non_empty_things = [0, False, "", {"k": None}, {0: 0}, [None], JsonObj(k=None), JsonObj(**{"k": None}), JsonObj([None])] + +things_removed: list[tuple[Any, Any]] = [ + (None, None), + (dict(), {}), + (list(), []), + (JsonObj(), {}), + (JsonObj({}), {}), + (JsonObj([]), []), + (0, 0), + (False, False), + ("", ""), + ({"k": None}, {}), + ({0: 0}, {0: 0}), + ([None], []), + (JsonObj(k=None), {}), + (JsonObj(**{"k": None}), {}), + (JsonObj([None]), []), + ([None], []), + ([None, None], []), + ([None, [], [{}]], []), + ({"k": [{"l": None, "m": [None]}]}, {}), +] issue_157_1 = """ [ @@ -106,27 +115,49 @@ def test_formats(self): self.assertEqual("thisIsIt", lcamelcase(" this is\t it\n")) - self.assertEqual('abc', be(' abc\n')) - self.assertEqual('', be(None)) - self.assertEqual('', be(' ')) + self.assertEqual("abc", be(" abc\n")) + self.assertEqual("", be(None)) + self.assertEqual("", be(" ")) def test_linestuff(self): - text = "This is a mess'o test that goes on for a long way. It has some carriage\n returns embedded in it " \ - "but otherwise it drags on and on and on until the cows come home. Splitline covers this we hope." - self.assertEqual(["This is a mess'o test that goes on for a long way. It has some carriage returns embedded" - " in it but otherwise it ", - 'drags on and on and on until the cows come home. Splitline covers this we hope. '], - split_line(text)) - self.assertEqual(["This is a mess'o ", 'test that goes on ', 'for a long way. It ', 'has some carriage ', - 'returns embedded in ', 'it but otherwise it ', 'drags on and on and ', 'on until the cows ', - 'come home. ', 'Splitline covers ', 'this we hope. '], split_line(text, 20)) - self.assertEqual(['X' * 100 + ' '], split_line('X'*100, 20)) - self.assertEqual("""This is a mess'o test that goes on for a long way. It has some carriage + text = ( + "This is a mess'o test that goes on for a long way. It has some carriage\n returns embedded in it " + "but otherwise it drags on and on and on until the cows come home. Splitline covers this we hope." + ) + self.assertEqual( + [ + "This is a mess'o test that goes on for a long way. It has some carriage returns embedded" + " in it but otherwise it ", + "drags on and on and on until the cows come home. Splitline covers this we hope. ", + ], + split_line(text), + ) + self.assertEqual( + [ + "This is a mess'o ", + "test that goes on ", + "for a long way. It ", + "has some carriage ", + "returns embedded in ", + "it but otherwise it ", + "drags on and on and ", + "on until the cows ", + "come home. ", + "Splitline covers ", + "this we hope. ", + ], + split_line(text, 20), + ) + self.assertEqual(["X" * 100 + " "], split_line("X" * 100, 20)) + self.assertEqual( + """This is a mess'o test that goes on for a long way. It has some carriage returns embedded in it but otherwise it drags on and on and on until the cows come home. Splitline covers this we - hope. """, wrapped_annotation(text)) + hope. """, + wrapped_annotation(text), + ) def test_empty_functions(self): - """ Test the various forms of is_empty """ + """Test the various forms of is_empty""" for thing in empty_things: self.assertTrue(is_empty(thing), msg=f"{thing} should clock in as empty") for thing in non_empty_things: @@ -135,9 +166,9 @@ def test_empty_functions(self): assert is_empty(obj) def test_remove_empty_items(self): - """ Test the various remove empty items paths """ + """Test the various remove empty items paths""" seen = set() - save = list() # Keep garbage collection from re-using ids + save = list() # Keep garbage collection from re-using ids for thing, expected in things_removed: actual = remove_empty_items(thing) self.assertEqual(expected, actual, msg=f"Input = {thing}") @@ -149,14 +180,21 @@ def test_remove_empty_items(self): seen.add(id(actual)) def test_enumerations_case(self): - self.assertEqual("""[ + self.assertEqual( + """[ "state", "1" -]""", as_json(remove_empty_items(json.loads(issue_157_1), hide_protected_keys=True))) - self.assertEqual("""[ +]""", + as_json(remove_empty_items(json.loads(issue_157_1), hide_protected_keys=True)), + ) + self.assertEqual( + """[ "namedstate", "production" -]""", as_json(remove_empty_items(json.loads(issue_157_2), hide_protected_keys=True))) +]""", + as_json(remove_empty_items(json.loads(issue_157_2), hide_protected_keys=True)), + ) + -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_inference_utils.py b/tests/test_utils/test_inference_utils.py index caa636b2..e856c9c4 100644 --- a/tests/test_utils/test_inference_utils.py +++ b/tests/test_utils/test_inference_utils.py @@ -2,19 +2,24 @@ import unittest from decimal import Decimal -from linkml_runtime.utils.inference_utils import infer_all_slot_values, generate_slot_value, infer_slot_value, Policy, \ - Config +from linkml_runtime.utils.inference_utils import ( + infer_all_slot_values, + generate_slot_value, + infer_slot_value, + Policy, + Config, +) from linkml_runtime.utils.schemaview import SchemaView from tests.test_utils.model.inference_example import Person, Container, Evil, Relationship, AgeEnum from tests.test_utils import INPUT_DIR -SCHEMA = os.path.join(INPUT_DIR, 'inference-example.yaml') +SCHEMA = os.path.join(INPUT_DIR, "inference-example.yaml") AGE_IN_YEARS = 12 -FIRST, LAST = 'x', 'y' -FULL = f'{FIRST} {LAST}' -REPLACE_ME = 'REPLACE ME' +FIRST, LAST = "x", "y" +FULL = f"{FIRST} {LAST}" +REPLACE_ME = "REPLACE ME" class InferenceUtilsTestCase(unittest.TestCase): @@ -28,7 +33,7 @@ def test_rstring_serialization(self): """ sv = SchemaView(SCHEMA) p = Person(first_name=FIRST, last_name=LAST) - v = generate_slot_value(p, 'full_name', sv) + v = generate_slot_value(p, "full_name", sv) def test_string_serialization(self): """ @@ -36,9 +41,9 @@ def test_string_serialization(self): """ sv = SchemaView(SCHEMA) p = Person(first_name=FIRST, last_name=LAST) - v = generate_slot_value(p, 'full_name', sv) + v = generate_slot_value(p, "full_name", sv) self.assertEqual(v, FULL) - infer_slot_value(p, 'full_name', sv) + infer_slot_value(p, "full_name", sv) self.assertEqual(p.full_name, FULL) p = Person(first_name=FIRST, last_name=LAST) infer_all_slot_values(p, schemaview=sv) @@ -110,12 +115,12 @@ def test_infer_expressions(self): config = Config(use_expressions=True) infer_all_slot_values(p, schemaview=sv, config=config) assert p.is_juvenile - self.assertEqual(p.age_category, AgeEnum('juvenile')) + self.assertEqual(p.age_category, AgeEnum("juvenile")) self.assertEqual(p.age_category.code, AgeEnum.juvenile) - #e1 = AgeEnum('juvenile') - #e2 = AgeEnum.juvenile - #print(f'e1={e1} c={e1.code} t={type(e1)}') - #print(f'e2={e2} {type(e2)}') + # e1 = AgeEnum('juvenile') + # e2 = AgeEnum.juvenile + # print(f'e1={e1} c={e1.code} t={type(e1)}') + # print(f'e2={e2} {type(e2)}') # test slots with spaces p = Person(slot_with_spaces="test") infer_all_slot_values(p, schemaview=sv, config=config) @@ -123,17 +128,17 @@ def test_infer_expressions(self): def test_if_then(self): sv = SchemaView(SCHEMA) - p = Person(first_name='x', last_name='y', age_in_years=Decimal(AGE_IN_YEARS)) + p = Person(first_name="x", last_name="y", age_in_years=Decimal(AGE_IN_YEARS)) config = Config(use_expressions=True) infer_all_slot_values(p, schemaview=sv, config=config) - self.assertEqual(p.summary, f'xy AGE: {AGE_IN_YEARS}') - p = Person(first_name='x', last_name='y') + self.assertEqual(p.summary, f"xy AGE: {AGE_IN_YEARS}") + p = Person(first_name="x", last_name="y") infer_all_slot_values(p, schemaview=sv, config=config) - self.assertEqual(p.summary, 'xy NO AGE SPECIFIED') + self.assertEqual(p.summary, "xy NO AGE SPECIFIED") def test_custom_function(self): sv = SchemaView(SCHEMA) - p = Person(first_name='abc', last_name='def', age_in_years=Decimal(AGE_IN_YEARS)) + p = Person(first_name="abc", last_name="def", age_in_years=Decimal(AGE_IN_YEARS)) config = Config(resolve_function=lambda x, _: f'"{x.upper()}"' if isinstance(x, str) else x) infer_all_slot_values(p, schemaview=sv, config=config) self.assertEqual(p.full_name, '"ABC" "DEF"') @@ -152,19 +157,18 @@ def test_protect_against_evil(self): with self.assertRaises(NotImplementedError): infer_all_slot_values(p, schemaview=sv, config=config, policy=policy) - def test_nesting(self): """ Tests use of nested variables """ sv = SchemaView(SCHEMA) - p1 = Person(first_name='a', last_name='b') - p2 = Person(first_name='c', last_name='d') - r = Relationship(person1=p1, person2=p2, type='SIBLING_OF') + p1 = Person(first_name="a", last_name="b") + p2 = Person(first_name="c", last_name="d") + r = Relationship(person1=p1, person2=p2, type="SIBLING_OF") infer_all_slot_values(r, schemaview=sv) self.assertEqual('"b, a" IS SIBLING_OF "d, c"', r.description) self.assertEqual('"a b" IS SIBLING_OF "c d"', r.description2) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_inlined_as_dict_forms.py b/tests/test_utils/test_inlined_as_dict_forms.py index 01aa4ac1..ebbf476c 100644 --- a/tests/test_utils/test_inlined_as_dict_forms.py +++ b/tests/test_utils/test_inlined_as_dict_forms.py @@ -6,7 +6,8 @@ class InlinedAsDictTestcase(unittest.TestCase): - """ Test the various YAML forms for inlined_as_dict entries""" + """Test the various YAML forms for inlined_as_dict entries""" + def test_list_variations(self): v = E() self.assertEqual(v.ev, {}, "No entries, period") @@ -19,89 +20,115 @@ def test_list_variations(self): # Form 5 -- list of keys v1 = JsonObj(["k1", "k2"]) v = E(v1) - self.assertEqual(v.ev, {'k1': EInst(s1='k1'), 'k2': EInst(s1='k2')}) + self.assertEqual(v.ev, {"k1": EInst(s1="k1"), "k2": EInst(s1="k2")}) # Form 4: -- list of key/object pairs - v = E([{"k1": {"s1": "k1", "s2": "v21", "s3": "v23"}}, - {"k2": {"s2": "v22", "s3": "v23"}}, - {"k3": {}}]) - self.assertEqual(v.ev, - {'k1': EInst(s1='k1', s2='v21', s3='v23'), - 'k2': EInst(s1='k2', s2='v22', s3='v23'), - 'k3': EInst(s1='k3', s2=None, s3=None)}, - "List of key value constructors") + v = E([{"k1": {"s1": "k1", "s2": "v21", "s3": "v23"}}, {"k2": {"s2": "v22", "s3": "v23"}}, {"k3": {}}]) + self.assertEqual( + v.ev, + { + "k1": EInst(s1="k1", s2="v21", s3="v23"), + "k2": EInst(s1="k2", s2="v22", s3="v23"), + "k3": EInst(s1="k3", s2=None, s3=None), + }, + "List of key value constructors", + ) with self.assertRaises(ValueError) as e: E([{"k1": None}, {"k1": "v2"}]) self.assertIn("k1: duplicate key", str(e.exception)) with self.assertRaises(ValueError) as e: - E([{"k1": {"s1":"k2"}}]) + E([{"k1": {"s1": "k2"}}]) self.assertIn("Slot: ev - attribute s1 value (k2) does not match key (k1)", str(e.exception)) # Form 5 variations - v = E([{"k1": EInst(s1="k1", s2="v21", s3="v23")}, - {"k2": JsonObj({"s2": "v22", "s3": "v23"})}, - {"k3": None}]) - self.assertEqual(v.ev, - { - 'k1': EInst(s1='k1', s2='v21', s3='v23'), - 'k2': EInst(s1='k2', s2='v22', s3='v23'), - 'k3': EInst(s1='k3', s2=None, s3=None) - }) + v = E([{"k1": EInst(s1="k1", s2="v21", s3="v23")}, {"k2": JsonObj({"s2": "v22", "s3": "v23"})}, {"k3": None}]) + self.assertEqual( + v.ev, + { + "k1": EInst(s1="k1", s2="v21", s3="v23"), + "k2": EInst(s1="k2", s2="v22", s3="v23"), + "k3": EInst(s1="k3", s2=None, s3=None), + }, + ) # More Form 5 variations v = E(["k1", "k2", {"k3": "v3"}, ["k4", "v4"], {"s1": "k5", "s2": "v52"}]) - self.assertEqual(v.ev, - {'k1': EInst(s1='k1', s2=None, s3=None), - 'k2': EInst(s1='k2', s2=None, s3=None), - 'k3': EInst(s1='k3', s2='v3', s3=None), - 'k4': EInst(s1='k4', s2='v4', s3=None), - 'k5': EInst(s1='k5', s2='v52', s3=None)}, "Key value tuples") + self.assertEqual( + v.ev, + { + "k1": EInst(s1="k1", s2=None, s3=None), + "k2": EInst(s1="k2", s2=None, s3=None), + "k3": EInst(s1="k3", s2="v3", s3=None), + "k4": EInst(s1="k4", s2="v4", s3=None), + "k5": EInst(s1="k5", s2="v52", s3=None), + }, + "Key value tuples", + ) # Form 6 - list of positional object values v = E([["k1", "v12", "v13"], ["k2", "v22"], ["k3"]]) - self.assertEqual(v.ev, - {'k1': EInst(s1='k1', s2='v12', s3='v13'), - 'k2': EInst(s1='k2', s2='v22', s3=None), - 'k3': EInst(s1='k3', s2=None, s3=None)}, "Positional objects") + self.assertEqual( + v.ev, + { + "k1": EInst(s1="k1", s2="v12", s3="v13"), + "k2": EInst(s1="k2", s2="v22", s3=None), + "k3": EInst(s1="k3", s2=None, s3=None), + }, + "Positional objects", + ) # Form 7 - list of kv dictionaries v = E([{"s1": "v11", "s2": "v12"}, {"s1": "v21", "s2": "v22", "s3": "v23"}]) - self.assertEqual(v.ev, - {'v11': EInst(s1='v11', s2='v12', s3=None), - 'v21': EInst(s1='v21', s2='v22', s3='v23')}, "List of dictionaries") - + self.assertEqual( + v.ev, + {"v11": EInst(s1="v11", s2="v12", s3=None), "v21": EInst(s1="v21", s2="v22", s3="v23")}, + "List of dictionaries", + ) def test_dict_variations(self): - """ Test various forms of inlined as dict entries """ + """Test various forms of inlined as dict entries""" # Form 1: key / object - v = E({"k1": EInst(s1="k1", s2="v21", s3="v23"), - "k2": JsonObj({"s2": "v22", "s3": "v23"}), - "k3": {"s2": "v32", "s3": "v33"}, - "k4": {"s1": "k4"}}) - self.assertEqual(v.ev, - {'k1': EInst(s1='k1', s2='v21', s3='v23'), - 'k2': EInst(s1='k2', s2='v22', s3='v23'), - 'k3': EInst(s1='k3', s2='v32', s3='v33'), - 'k4': EInst(s1='k4', s2=None, s3=None)}, - "Dictionary of key/object entries") + v = E( + { + "k1": EInst(s1="k1", s2="v21", s3="v23"), + "k2": JsonObj({"s2": "v22", "s3": "v23"}), + "k3": {"s2": "v32", "s3": "v33"}, + "k4": {"s1": "k4"}, + } + ) + self.assertEqual( + v.ev, + { + "k1": EInst(s1="k1", s2="v21", s3="v23"), + "k2": EInst(s1="k2", s2="v22", s3="v23"), + "k3": EInst(s1="k3", s2="v32", s3="v33"), + "k4": EInst(s1="k4", s2=None, s3=None), + }, + "Dictionary of key/object entries", + ) # Form 2: key/value tuples (only works when at most two values are required v = E(ev={"k1": "v11", "k2": "v21", "k3": {}}) - expected = ("E({ 'ev': { 'k1': {'s1': 'k1', 's2': 'v11'},\n" - " 'k2': {'s1': 'k2', 's2': 'v21'},\n" - " 'k3': {'s1': 'k3'}}})") - self.assertEqual(v.ev, - {'k1': EInst(s1='k1', s2='v11', s3=None), - 'k2': EInst(s1='k2', s2='v21', s3=None), - 'k3': EInst(s1='k3', s2=None, s3=None)}, - "Dictionary of two-key entries") + expected = ( + "E({ 'ev': { 'k1': {'s1': 'k1', 's2': 'v11'},\n" + " 'k2': {'s1': 'k2', 's2': 'v21'},\n" + " 'k3': {'s1': 'k3'}}})" + ) + self.assertEqual( + v.ev, + { + "k1": EInst(s1="k1", s2="v11", s3=None), + "k2": EInst(s1="k2", s2="v21", s3=None), + "k3": EInst(s1="k3", s2=None, s3=None), + }, + "Dictionary of two-key entries", + ) # Form 3: Basic single object (differentiated from form2 by the presence of the key name v = E({"s1": "k1"}) - self.assertEqual(v.ev, {'k1': EInst(s1='k1', s2=None, s3=None)}, - "Single entry dictionary") + self.assertEqual(v.ev, {"k1": EInst(s1="k1", s2=None, s3=None)}, "Single entry dictionary") v = E({"s1": "k1", "s2": "v12"}) - self.assertEqual(v.ev, {'k1': EInst(s1='k1', s2='v12', s3=None)}, "Single entry dictionary") + self.assertEqual(v.ev, {"k1": EInst(s1="k1", s2="v12", s3=None)}, "Single entry dictionary") def test_isempties(self): base = E() @@ -112,11 +139,9 @@ def test_isempties(self): self.assertTrue(base._is_empty(JsonObj([]))) self.assertFalse(base._is_empty(0)) self.assertFalse(base._is_empty("")) - self.assertFalse(base._is_empty(JsonObj({'k': 0}))) + self.assertFalse(base._is_empty(JsonObj({"k": 0}))) self.assertFalse(base._is_empty(JsonObj([None]))) - -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() - diff --git a/tests/test_utils/test_inlined_as_list_forms.py b/tests/test_utils/test_inlined_as_list_forms.py index 6c606097..a69a210d 100644 --- a/tests/test_utils/test_inlined_as_list_forms.py +++ b/tests/test_utils/test_inlined_as_list_forms.py @@ -6,7 +6,8 @@ class InlinedAsListTestcase(unittest.TestCase): - """ Test the various YAML forms for inlined_as_list entries""" + """Test the various YAML forms for inlined_as_list entries""" + def test_list_variations(self): v = E() self.assertEqual(v.ev, [], "No entries, period") @@ -19,83 +20,93 @@ def test_list_variations(self): # Form 5 -- list of keys v1 = JsonObj(["k1", "k2"]) v = E(v1) - self.assertEqual(v.ev, [EInst(s1='k1', s2=None, s3=None), EInst(s1='k2', s2=None, s3=None)]) + self.assertEqual(v.ev, [EInst(s1="k1", s2=None, s3=None), EInst(s1="k2", s2=None, s3=None)]) # Form 4: -- list of key/object pairs - v = E([{"k1": {"s1": "k1", "s2": "v21", "s3": "v23"}}, - {"k2": {"s2": "v22", "s3": "v23"}}, - {"k3": {}}]) - self.assertEqual(v.ev, - [EInst(s1='k1', s2='v21', s3='v23'), - EInst(s1='k2', s2='v22', s3='v23'), - EInst(s1='k3', s2=None, s3=None)], - "List of key value constructors") + v = E([{"k1": {"s1": "k1", "s2": "v21", "s3": "v23"}}, {"k2": {"s2": "v22", "s3": "v23"}}, {"k3": {}}]) + self.assertEqual( + v.ev, + [EInst(s1="k1", s2="v21", s3="v23"), EInst(s1="k2", s2="v22", s3="v23"), EInst(s1="k3", s2=None, s3=None)], + "List of key value constructors", + ) with self.assertRaises(ValueError) as e: E([{"k1": None}, {"k1": "v2"}]) self.assertIn("k1: duplicate key", str(e.exception)) with self.assertRaises(ValueError) as e: - E([{"k1": {"s1":"k2"}}]) + E([{"k1": {"s1": "k2"}}]) self.assertIn("Slot: ev - attribute s1 value (k2) does not match key (k1)", str(e.exception)) # Form 5 variations - v = E([{"k1": EInst(s1="k1", s2="v21", s3="v23")}, - {"k2": JsonObj({"s2": "v22", "s3": "v23"})}, - {"k3": None}]) - self.assertEqual(v.ev, - [EInst(s1='k1', s2='v21', s3='v23'), - EInst(s1='k2', s2='v22', s3='v23'), - EInst(s1='k3', s2=None, s3=None)]) + v = E([{"k1": EInst(s1="k1", s2="v21", s3="v23")}, {"k2": JsonObj({"s2": "v22", "s3": "v23"})}, {"k3": None}]) + self.assertEqual( + v.ev, + [EInst(s1="k1", s2="v21", s3="v23"), EInst(s1="k2", s2="v22", s3="v23"), EInst(s1="k3", s2=None, s3=None)], + ) # More Form 5 variations v = E(["k1", "k2", {"k3": "v3"}, ["k4", "v4"], {"s1": "k5", "s2": "v52"}]) - self.assertEqual(v.ev, - [EInst(s1='k1', s2=None, s3=None), - EInst(s1='k2', s2=None, s3=None), - EInst(s1='k3', s2='v3', s3=None), - EInst(s1='k4', s2='v4', s3=None), - EInst(s1='k5', s2='v52', s3=None)], "Key value tuples") + self.assertEqual( + v.ev, + [ + EInst(s1="k1", s2=None, s3=None), + EInst(s1="k2", s2=None, s3=None), + EInst(s1="k3", s2="v3", s3=None), + EInst(s1="k4", s2="v4", s3=None), + EInst(s1="k5", s2="v52", s3=None), + ], + "Key value tuples", + ) # Form 6 - list of positional object values v = E([["k1", "v12", "v13"], ["k2", "v22"], ["k3"]]) - self.assertEqual(v.ev, - [EInst(s1='k1', s2='v12', s3='v13'), - EInst(s1='k2', s2='v22', s3=None), - EInst(s1='k3', s2=None, s3=None)], "Positional objects") + self.assertEqual( + v.ev, + [EInst(s1="k1", s2="v12", s3="v13"), EInst(s1="k2", s2="v22", s3=None), EInst(s1="k3", s2=None, s3=None)], + "Positional objects", + ) # Form 7 - list of kv dictionaries v = E([{"s1": "v11", "s2": "v12"}, {"s1": "v21", "s2": "v22", "s3": "v23"}]) - self.assertEqual(v.ev, - [EInst(s1='v11', s2='v12', s3=None), - EInst(s1='v21', s2='v22', s3='v23')], "List of dictionaries") - + self.assertEqual( + v.ev, [EInst(s1="v11", s2="v12", s3=None), EInst(s1="v21", s2="v22", s3="v23")], "List of dictionaries" + ) def test_dict_variations(self): - """ Test various forms of inlined as list entries """ + """Test various forms of inlined as list entries""" # Form 1: key / object - v = E({"k1": EInst(s1="k1", s2="v21", s3="v23"), - "k2": JsonObj({"s2": "v22", "s3": "v23"}), - "k3": {"s2": "v32", "s3": "v33"}, - "k4": {"s1": "k4"}}) - self.assertEqual(v.ev, - [EInst(s1='k1', s2='v21', s3='v23'), - EInst(s1='k2', s2='v22', s3='v23'), - EInst(s1='k3', s2='v32', s3='v33'), - EInst(s1='k4', s2=None, s3=None)], "Dictionary of key/object entries") + v = E( + { + "k1": EInst(s1="k1", s2="v21", s3="v23"), + "k2": JsonObj({"s2": "v22", "s3": "v23"}), + "k3": {"s2": "v32", "s3": "v33"}, + "k4": {"s1": "k4"}, + } + ) + self.assertEqual( + v.ev, + [ + EInst(s1="k1", s2="v21", s3="v23"), + EInst(s1="k2", s2="v22", s3="v23"), + EInst(s1="k3", s2="v32", s3="v33"), + EInst(s1="k4", s2=None, s3=None), + ], + "Dictionary of key/object entries", + ) # Form 2: key/value tuples (only works when at most two values are required v = E(ev={"k1": "v11", "k2": "v21", "k3": {}}) - self.assertEqual(v.ev, - [EInst(s1='k1', s2='v11', s3=None), - EInst(s1='k2', s2='v21', s3=None), - EInst(s1='k3', s2=None, s3=None)], "Dictionary of two-key entries") + self.assertEqual( + v.ev, + [EInst(s1="k1", s2="v11", s3=None), EInst(s1="k2", s2="v21", s3=None), EInst(s1="k3", s2=None, s3=None)], + "Dictionary of two-key entries", + ) # Form 3: Basic single object (differentiated from form2 by the presence of the key name v = E({"s1": "k1"}) - self.assertEqual(v.ev, [EInst(s1='k1', s2=None, s3=None)], - "Single entry dictionary") + self.assertEqual(v.ev, [EInst(s1="k1", s2=None, s3=None)], "Single entry dictionary") v = E({"s1": "k1", "s2": "v12"}) - self.assertEqual(v.ev, [EInst(s1='k1', s2='v12', s3=None)], "Single entry dictionary") + self.assertEqual(v.ev, [EInst(s1="k1", s2="v12", s3=None)], "Single entry dictionary") -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_introspection.py b/tests/test_utils/test_introspection.py index 959d7ed2..bafc8a35 100644 --- a/tests/test_utils/test_introspection.py +++ b/tests/test_utils/test_introspection.py @@ -7,16 +7,15 @@ class IntrospectionTestCase(unittest.TestCase): def test_introspection_on_metamodel(self): - view = package_schemaview('linkml_runtime.linkml_model.meta') - for cn in ['class_definition', 'type_definition', 'slot_definition']: + view = package_schemaview("linkml_runtime.linkml_model.meta") + for cn in ["class_definition", "type_definition", "slot_definition"]: assert cn in view.all_classes() - for tn in ['uriorcurie', 'string', 'float']: + for tn in ["uriorcurie", "string", "float"]: assert tn in view.all_types() - obj = SchemaDefinition(id='x', name='x') + obj = SchemaDefinition(id="x", name="x") c = object_class_definition(obj) - assert 'classes' in c.slots + assert "classes" in c.slots - -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_list_strings.py b/tests/test_utils/test_list_strings.py index eff183a0..3005f33c 100644 --- a/tests/test_utils/test_list_strings.py +++ b/tests/test_utils/test_list_strings.py @@ -39,11 +39,11 @@ class ListStringsTestCase(unittest.TestCase): def test_strings_in_list_slot(self): rslt = yaml_loader.loads(sample, SchemaDefinition) - self.assertEqual(1, len(rslt.classes['AClass'].slots)) - self.assertEqual('a_slot', rslt.classes['AClass'].slots[0]) - self.assertEqual(1, len(rslt.classes['BClass'].mixins)) - self.assertEqual('AClass', rslt.classes['BClass'].mixins[0]) + self.assertEqual(1, len(rslt.classes["AClass"].slots)) + self.assertEqual("a_slot", rslt.classes["AClass"].slots[0]) + self.assertEqual(1, len(rslt.classes["BClass"].mixins)) + self.assertEqual("AClass", rslt.classes["BClass"].mixins[0]) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_metamodelcore.py b/tests/test_utils/test_metamodelcore.py index 1bc26739..b3c5c671 100644 --- a/tests/test_utils/test_metamodelcore.py +++ b/tests/test_utils/test_metamodelcore.py @@ -5,8 +5,17 @@ from jsonasobj2 import as_json from rdflib import Literal, XSD, Graph, RDF, Namespace -from linkml_runtime.utils.metamodelcore import NCName, Bool, URIorCURIE, URI, XSDDate, XSDDateTime, XSDTime, Curie, \ - NodeIdentifier +from linkml_runtime.utils.metamodelcore import ( + NCName, + Bool, + URIorCURIE, + URI, + XSDDate, + XSDDateTime, + XSDTime, + Curie, + NodeIdentifier, +) from linkml_runtime.utils.namespaces import Namespaces from linkml_runtime.utils.strictness import lax, strict from linkml_runtime.utils.yamlutils import YAMLRoot, as_rdf @@ -17,9 +26,9 @@ def tearDown(self) -> None: strict() def test_ncname(self): - self.assertEqual('A123', NCName('A123')) - x = NCName('A1.B_C-') - self.assertEqual('A1.B_C-', x) + self.assertEqual("A123", NCName("A123")) + x = NCName("A1.B_C-") + self.assertEqual("A1.B_C-", x) self.assertIsInstance(x, str) self.assertIsInstance(x, NCName) self.assertEqual(x, NCName(x)) @@ -27,12 +36,12 @@ def test_ncname(self): self.assertIsInstance(x, str) self.assertFalse(isinstance(x, NCName)) with self.assertRaises(ValueError): - NCName('1') + NCName("1") with self.assertRaises(ValueError): - NCName('A12!') + NCName("A12!") def test_uriorcuries(self): - """ Test the URI and URIorCURIE types """ + """Test the URI and URIorCURIE types""" str1 = "https://google.com/test#file?abc=1&def=4" self.assertEqual(str1, URIorCURIE(str1)) str2 = "abc:123" @@ -58,30 +67,29 @@ def test_uriorcuries(self): self.assertFalse(URIorCURIE.is_curie("http://example.org/path")) def test_curie(self): - """ Test the CURIE type """ + """Test the CURIE type""" self.assertEqual("rdf:type", Curie("rdf:type")) with self.assertRaises(ValueError): Curie("type") self.assertFalse(Curie.is_valid("type")) self.assertEqual(":type", Curie(":type")) - self.assertTrue(Curie.is_valid(':type')) - self.assertTrue(Curie.is_valid('WIKIDATA_PROPERTY:P854')) - self.assertTrue(Curie.is_valid('WIKIDATA.PROPERTY:P854')) - self.assertTrue(Curie.is_valid('CL:0000001')) + self.assertTrue(Curie.is_valid(":type")) + self.assertTrue(Curie.is_valid("WIKIDATA_PROPERTY:P854")) + self.assertTrue(Curie.is_valid("WIKIDATA.PROPERTY:P854")) + self.assertTrue(Curie.is_valid("CL:0000001")) with self.assertRaises(ValueError): Curie("1df:type") - self.assertFalse(Curie.is_valid('1df:type')) - self.assertTrue(Curie.is_valid('rdf:17')) + self.assertFalse(Curie.is_valid("1df:type")) + self.assertTrue(Curie.is_valid("rdf:17")) nsm = Namespaces(Graph()) self.assertEqual(RDF.type, Curie("rdf:type").as_uri(nsm)) self.assertIsNone(Curie("ex:foo").as_uri(nsm)) self.assertIsNone(Curie(":bar").as_uri(nsm)) nsm._default = "http://example.org/test#" - self.assertEqual(nsm._default['bear'], Curie(":bear").as_uri(nsm)) - + self.assertEqual(nsm._default["bear"], Curie(":bear").as_uri(nsm)) def test_uri(self): - """ Test the URI data type """ + """Test the URI data type""" str1 = "https://google.com/test#file?abc=1&def=4" self.assertEqual(str1, URI(str1)) self.assertEqual("http://foo.org/bargles", URI("http://foo.org/bargles")) @@ -90,18 +98,20 @@ def test_uri(self): with self.assertRaises(ValueError): URI(":123") # imports range is uriorcurie, so we allow file paths - #URI("1") + # URI("1") self.assertTrue(URI.is_valid("foo.bar")) self.assertTrue(URI.is_valid("../a/b")) self.assertTrue(URI.is_valid("abc:123")) - #with self.assertRaises(ValueError): + # with self.assertRaises(ValueError): # URI("x1") # an empty URI is a valid same-document URI reference self.assertTrue(URI.is_valid("")) x = URI("rdf:type") self.assertTrue(URI.is_valid(x)) self.assertTrue(URI.is_valid("urn:abc:123")) - self.assertTrue(URI.is_valid("https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top")) + self.assertTrue( + URI.is_valid("https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top") + ) self.assertTrue(URI.is_valid("ldap://[2001:db8::7]/c=GB?objectClass?one")) self.assertTrue(URI.is_valid("ldap://[2001:db8::7]/c=GB?objectClass?one")) self.assertTrue(URI.is_valid("mailto:John.Doe@example.com")) @@ -139,61 +149,61 @@ def test_bool(self): def test_time(self): v = datetime.time(13, 17, 43, 279000) - self.assertEqual('13:17:43.279000', XSDTime(v)) # A date can be a datetime - self.assertEqual('13:17:43.279000', XSDTime(Literal(v, datatype=XSD.time))) # An RDFLIB Literal - self.assertEqual('13:17:43.279000', v.isoformat()) # A string - self.assertEqual('13:17:43.279000', XSDTime(XSDTime(v))) # An existing date + self.assertEqual("13:17:43.279000", XSDTime(v)) # A date can be a datetime + self.assertEqual("13:17:43.279000", XSDTime(Literal(v, datatype=XSD.time))) # An RDFLIB Literal + self.assertEqual("13:17:43.279000", v.isoformat()) # A string + self.assertEqual("13:17:43.279000", XSDTime(XSDTime(v))) # An existing date strict() with self.assertRaises(ValueError): - XSDTime('Jan 12, 2019') + XSDTime("Jan 12, 2019") with self.assertRaises(ValueError): XSDTime(datetime.datetime.now()) lax() - self.assertEqual('Jan 12, 2019', XSDTime('Jan 12, 2019')) + self.assertEqual("Jan 12, 2019", XSDTime("Jan 12, 2019")) XSDDate(datetime.datetime.now()) - self.assertFalse(XSDTime.is_valid('Jan 12, 2019')) + self.assertFalse(XSDTime.is_valid("Jan 12, 2019")) self.assertFalse(XSDTime.is_valid(datetime.datetime.now())) self.assertTrue(XSDTime.is_valid(v)) def test_date(self): v = datetime.date(2019, 7, 6) - self.assertEqual('2019-07-06', XSDDate(v)) # A date can be a datetime - self.assertEqual('2019-07-06', XSDDate(Literal(v, datatype=XSD.date))) # An RDFLIB Literal - self.assertEqual('2019-07-06', v.isoformat()) # A string - self.assertEqual('2019-07-06', XSDDate(XSDDate(v))) # An existing date + self.assertEqual("2019-07-06", XSDDate(v)) # A date can be a datetime + self.assertEqual("2019-07-06", XSDDate(Literal(v, datatype=XSD.date))) # An RDFLIB Literal + self.assertEqual("2019-07-06", v.isoformat()) # A string + self.assertEqual("2019-07-06", XSDDate(XSDDate(v))) # An existing date strict() with self.assertRaises(ValueError): - XSDDate('20190706') + XSDDate("20190706") with self.assertRaises(ValueError): - XSDDate('Jan 12, 2019') + XSDDate("Jan 12, 2019") with self.assertRaises(ValueError): XSDDate(datetime.datetime.now()) lax() - bv = XSDDate('Jan 12, 2019') - self.assertEqual('Jan 12, 2019', bv) + bv = XSDDate("Jan 12, 2019") + self.assertEqual("Jan 12, 2019", bv) self.assertFalse(XSDDate.is_valid(bv)) XSDDate(datetime.datetime.now()) - self.assertFalse(XSDDate.is_valid('Jan 12, 2019')) + self.assertFalse(XSDDate.is_valid("Jan 12, 2019")) self.assertFalse(XSDDate.is_valid(datetime.datetime.now())) self.assertTrue(XSDDate.is_valid(XSDDate(datetime.datetime.now().date()))) self.assertTrue(XSDDate.is_valid(v)) def test_datetime(self): v = datetime.datetime(2019, 7, 6, 17, 22, 39, 7300) - self.assertEqual('2019-07-06T17:22:39.007300', XSDDateTime(v)) - self.assertEqual('2019-07-06T17:22:39.007300', XSDDateTime(Literal(v, datatype=XSD.dateTime))) - self.assertEqual('2019-07-06T17:22:39.007300', XSDDateTime(Literal(v).value)) - self.assertEqual('2019-07-06T17:22:39.007300', v.isoformat()) - self.assertEqual('2019-07-06T17:22:39.007300', XSDDateTime(XSDDateTime(v))) + self.assertEqual("2019-07-06T17:22:39.007300", XSDDateTime(v)) + self.assertEqual("2019-07-06T17:22:39.007300", XSDDateTime(Literal(v, datatype=XSD.dateTime))) + self.assertEqual("2019-07-06T17:22:39.007300", XSDDateTime(Literal(v).value)) + self.assertEqual("2019-07-06T17:22:39.007300", v.isoformat()) + self.assertEqual("2019-07-06T17:22:39.007300", XSDDateTime(XSDDateTime(v))) vstr = str(Literal(v).value) - self.assertEqual('2019-07-06 17:22:39.007300', vstr) # Note that this has no 'T' - self.assertEqual('2019-07-06T17:22:39.007300', XSDDateTime(vstr)) + self.assertEqual("2019-07-06 17:22:39.007300", vstr) # Note that this has no 'T' + self.assertEqual("2019-07-06T17:22:39.007300", XSDDateTime(vstr)) with self.assertRaises(ValueError): - XSDDateTime('Jan 12, 2019') + XSDDateTime("Jan 12, 2019") lax() - self.assertEqual('penguins', XSDDateTime('penguins')) + self.assertEqual("penguins", XSDDateTime("penguins")) XSDDateTime(datetime.datetime.now()) - self.assertFalse(XSDDateTime.is_valid('Jan 12, 2019')) + self.assertFalse(XSDDateTime.is_valid("Jan 12, 2019")) self.assertTrue(XSDDateTime.is_valid(datetime.datetime.now())) self.assertTrue(XSDDateTime.is_valid(XSDDate(datetime.datetime.now().date()))) self.assertTrue(XSDDateTime.is_valid(v)) @@ -221,6 +231,7 @@ def test_nodeidentifier(self): } }""" EX = Namespace("http://example.org/tests/") + class Root(NodeIdentifier): pass @@ -251,11 +262,15 @@ def __post_init__(self): s = Desc1(EX.descendant1) t = Child2(EX.child2) y = Pair(s, t) - self.assertEqual("""{ + self.assertEqual( + """{ "s": "http://example.org/tests/descendant1", "t": "http://example.org/tests/child2" -}""", as_json(y)) - self.assertEqual("""@prefix OIO: . +}""", + as_json(y), + ) + self.assertEqual( + """@prefix OIO: . @prefix dcterms: . @prefix metatype: . @prefix owl: . @@ -270,12 +285,12 @@ def __post_init__(self): rdfs:object "http://example.org/tests/child2" ; rdfs:subject "http://example.org/tests/descendant1" . -""", as_rdf(y, context).serialize(format="turtle")) +""", + as_rdf(y, context).serialize(format="turtle"), + ) with self.assertRaises(ValueError): y = Pair(s, s) - - -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_namespaces.py b/tests/test_utils/test_namespaces.py index fe08fc91..c185227b 100644 --- a/tests/test_utils/test_namespaces.py +++ b/tests/test_utils/test_namespaces.py @@ -9,16 +9,16 @@ class NamespacesTestCase(unittest.TestCase): def test_namespaces(self): ns = Namespaces() - ns['meta'] = "https://w3id.org/biolink/metamodel/" + ns["meta"] = "https://w3id.org/biolink/metamodel/" ns.skos = SKOS self.assertEqual(str(ns.skos), str(SKOS)) self.assertEqual(ns.skos.note, SKOS.note) ns.OIO = URIRef("http://www.geneontology.org/formats/oboInOwl") - ns['dc'] = "http://example.org/dc/" # Overrides 'dc' in semweb_context - ns['l1'] = "http://example.org/subset/" - ns['l2'] = "http://example.org/subset/test/" - ns['l3'] = "http://example.org/subset/t" - ns['u1'] = "urn:example:" + ns["dc"] = "http://example.org/dc/" # Overrides 'dc' in semweb_context + ns["l1"] = "http://example.org/subset/" + ns["l2"] = "http://example.org/subset/test/" + ns["l3"] = "http://example.org/subset/t" + ns["u1"] = "urn:example:" # This is now a warning instead of a value error # with self.assertRaises(ValueError): # ns['OIO'] = URIRef("http://www.geneontology.org/formats/another") @@ -33,15 +33,15 @@ def test_namespaces(self): ns.FOO self.assertEqual("'foo'", str(e.exception), "Unknown namespace should raise a KeyError with a lower case entry") - ns._default = ns['meta'] - ns._default = ns['meta'] + ns._default = ns["meta"] + ns._default = ns["meta"] with self.assertRaises(ValueError): ns._default = "http://example.org/wrong/" del ns._default with self.assertRaises(KeyError): del ns._default self.assertIsNone(ns._default) - ns._default = ns['meta'] + ns._default = ns["meta"] ns._base = "http://example.org/base/" ns._base = "http://example.org/base/" @@ -52,30 +52,30 @@ def test_namespaces(self): del ns._base ns._base = "http://example.org/wrong/" del ns._default - ns.add_prefixmap('semweb_context') - ns.add_prefixmap('monarch_context') - self.assertEqual('https://monarchinitiative.org/', str(ns._default)) + ns.add_prefixmap("semweb_context") + ns.add_prefixmap("monarch_context") + self.assertEqual("https://monarchinitiative.org/", str(ns._default)) del ns._default - ns._default = ns['meta'] - self.assertEqual('l1:foo', ns.curie_for("http://example.org/subset/foo")) - self.assertEqual('l2:foo', ns.curie_for("http://example.org/subset/test/foo")) - self.assertEqual('l3:able/foo', ns.curie_for("http://example.org/subset/table/foo")) - self.assertEqual('u1:foo', ns.curie_for("urn:example:foo")) + ns._default = ns["meta"] + self.assertEqual("l1:foo", ns.curie_for("http://example.org/subset/foo")) + self.assertEqual("l2:foo", ns.curie_for("http://example.org/subset/test/foo")) + self.assertEqual("l3:able/foo", ns.curie_for("http://example.org/subset/table/foo")) + self.assertEqual("u1:foo", ns.curie_for("urn:example:foo")) with self.assertRaises(ValueError): ns.curie_for("1abc\junk") # no comment in skos? # self.assertEqual(SKOS.comment, ns.uri_for("skos:comment")) - self.assertEqual(URIRef('http://example.org/dc/table'), ns.uri_for("dc:table")) + self.assertEqual(URIRef("http://example.org/dc/table"), ns.uri_for("dc:table")) self.assertEqual(ns.uri_for("http://something.org"), URIRef("http://something.org")) - self.assertEqual('https://w3id.org/biolink/metamodel/Schema', str(ns.uri_for(":Schema"))) - self.assertEqual(URIRef('http://example.org/wrong/Base'), ns.uri_for("Base")) + self.assertEqual("https://w3id.org/biolink/metamodel/Schema", str(ns.uri_for(":Schema"))) + self.assertEqual(URIRef("http://example.org/wrong/Base"), ns.uri_for("Base")) del ns._base with self.assertRaises(ValueError): ns.uri_for("Base") try: ns.uri_for("Base") except ValueError as e: - self.assertEqual('Unknown CURIE prefix: @base', str(e)) + self.assertEqual("Unknown CURIE prefix: @base", str(e)) self.assertIsNone(ns.curie_for("http://google.com/test")) with self.assertRaises(ValueError): @@ -84,37 +84,37 @@ def test_namespaces(self): def test_prefixmaps_integration(self): prefixmap_merged = Namespaces() - prefixmap_merged.add_prefixmap('merged') + prefixmap_merged.add_prefixmap("merged") self.assertGreater(len(prefixmap_merged), 3780) - prefixmap_merged.add_prefixmap('monarch_context') + prefixmap_merged.add_prefixmap("monarch_context") self.assertGreater(len(prefixmap_merged), 3850) - self.assertRaises(ValueError, prefixmap_merged.add_prefixmap, 'nonexistent_context') + self.assertRaises(ValueError, prefixmap_merged.add_prefixmap, "nonexistent_context") - prefixmap_merged.add_prefixmap('bioregistry') + prefixmap_merged.add_prefixmap("bioregistry") self.assertGreater(len(prefixmap_merged), 3860) - test_NCIT_curie = 'NCIT:C25300' - test_NCIT_uri = URIRef('http://purl.obolibrary.org/obo/NCIT_C25300') + test_NCIT_curie = "NCIT:C25300" + test_NCIT_uri = URIRef("http://purl.obolibrary.org/obo/NCIT_C25300") self.assertEqual(prefixmap_merged.curie_for(test_NCIT_uri), test_NCIT_curie) self.assertEqual(prefixmap_merged.uri_for(test_NCIT_curie), test_NCIT_uri) def test_prefix_suffix(self): ns = Namespaces() - ns['farm'] = 'https://example.org/farm' - ns['farm_slash'] = 'https://slash.org/farm/' + ns["farm"] = "https://example.org/farm" + ns["farm_slash"] = "https://slash.org/farm/" - self.assertEqual(('farm', 'cow'), ns.prefix_suffix('farm:cow')) - self.assertEqual(('farm', '/cow'), ns.prefix_suffix('https://example.org/farm/cow')) - self.assertEqual(('farm_slash', 'cow'), ns.prefix_suffix('https://slash.org/farm/cow')) - self.assertEqual(('farm_slash', 'cow/horns'), ns.prefix_suffix('farm_slash:cow/horns')) - self.assertEqual(('farm', '/cow/horns'), ns.prefix_suffix('farm:/cow/horns')) - self.assertEqual(('farm', '#cow/horns'), ns.prefix_suffix('farm:#cow/horns')) - self.assertEqual(('farm', ''), ns.prefix_suffix('farm:')) - self.assertEqual(('', 'cow'), ns.prefix_suffix(':cow')) - self.assertEqual((None, None), ns.prefix_suffix('https://missing-prefix.org/farm/cow')) + self.assertEqual(("farm", "cow"), ns.prefix_suffix("farm:cow")) + self.assertEqual(("farm", "/cow"), ns.prefix_suffix("https://example.org/farm/cow")) + self.assertEqual(("farm_slash", "cow"), ns.prefix_suffix("https://slash.org/farm/cow")) + self.assertEqual(("farm_slash", "cow/horns"), ns.prefix_suffix("farm_slash:cow/horns")) + self.assertEqual(("farm", "/cow/horns"), ns.prefix_suffix("farm:/cow/horns")) + self.assertEqual(("farm", "#cow/horns"), ns.prefix_suffix("farm:#cow/horns")) + self.assertEqual(("farm", ""), ns.prefix_suffix("farm:")) + self.assertEqual(("", "cow"), ns.prefix_suffix(":cow")) + self.assertEqual((None, None), ns.prefix_suffix("https://missing-prefix.org/farm/cow")) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_pattern.py b/tests/test_utils/test_pattern.py index 81df8c01..a5b9ee62 100644 --- a/tests/test_utils/test_pattern.py +++ b/tests/test_utils/test_pattern.py @@ -22,7 +22,6 @@ def test_generate_patterns(self): self.assertDictEqual(actual_dict, expected_dict) - def test_pattern_resolver(self): sv = SchemaView(env.input_path("pattern-example.yaml")) diff --git a/tests/test_utils/test_poly_dataclasses.py b/tests/test_utils/test_poly_dataclasses.py index 9f381075..1d9e386c 100644 --- a/tests/test_utils/test_poly_dataclasses.py +++ b/tests/test_utils/test_poly_dataclasses.py @@ -1,31 +1,32 @@ import unittest from linkml_runtime.linkml_model.meta import Element, LINKML + class PolyDataclassTestCase(unittest.TestCase): def test_class_for_uri(self): - """ Test various class lookup options """ + """Test various class lookup options""" e = Element # Test class URI cls = e._class_for_uri(LINKML.ClassDefinition) - self.assertEqual('ClassDefinition', cls.__name__) + self.assertEqual("ClassDefinition", cls.__name__) # Test model URI cls = e._class_for_uri(LINKML.TypeDefinition, use_model_uri=True) - self.assertEqual('TypeDefinition', cls.__name__) + self.assertEqual("TypeDefinition", cls.__name__) # Test class curie (note there isn't any model curie cls = e._class_for_curie("linkml:TypeDefinition") - self.assertEqual('TypeDefinition', cls.__name__) + self.assertEqual("TypeDefinition", cls.__name__) # Make sure the self test works cls = e._class_for_uri(LINKML.Element) - self.assertEqual('Element', cls.__name__) + self.assertEqual("Element", cls.__name__) # Make sure we fail gracefully cls = e._class_for_uri("linkml:Missing") self.assertIsNone(cls) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_ruleutils.py b/tests/test_utils/test_ruleutils.py index c1975985..006cfe0f 100644 --- a/tests/test_utils/test_ruleutils.py +++ b/tests/test_utils/test_ruleutils.py @@ -8,7 +8,7 @@ from tests.test_utils import INPUT_DIR -SCHEMA = os.path.join(INPUT_DIR, 'rules-example.yaml') +SCHEMA = os.path.join(INPUT_DIR, "rules-example.yaml") yaml_loader = YAMLLoader() @@ -18,28 +18,26 @@ class RuleUtilsTestCase(unittest.TestCase): def test_disjunction(self): # no import schema view = SchemaView(SCHEMA) - analyte = view.induced_slot('analyte', 'Sample') - #print(analyte) - #print(analyte.any_of) + analyte = view.induced_slot("analyte", "Sample") + # print(analyte) + # print(analyte.any_of) disj = get_range_as_disjunction(analyte) - #print(disj) - self.assertCountEqual(disj, {'MissingValueEnum', 'AnalyteEnum'}) + # print(disj) + self.assertCountEqual(disj, {"MissingValueEnum", "AnalyteEnum"}) for s in view.all_slots().values(): disj = get_range_as_disjunction(s) - print(f'{s.name} DISJ: {disj}') + print(f"{s.name} DISJ: {disj}") def test_roll_up(self): # no import schema view = SchemaView(SCHEMA) - c = view.get_class('ProteinCodingGene') - rules = subclass_to_rules(view, 'ProteinCodingGene', 'SeqFeature') + c = view.get_class("ProteinCodingGene") + rules = subclass_to_rules(view, "ProteinCodingGene", "SeqFeature") rule = rules[0] - print(f'IF: {rule.preconditions}') - print(f'THEN: {rule.postconditions}') + print(f"IF: {rule.preconditions}") + print(f"THEN: {rule.postconditions}") print(yaml_dumper.dumps(rule)) - - -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_schema_as_dict.py b/tests/test_utils/test_schema_as_dict.py index 90ec7042..d5c085f7 100644 --- a/tests/test_utils/test_schema_as_dict.py +++ b/tests/test_utils/test_schema_as_dict.py @@ -12,9 +12,9 @@ logger = logging.getLogger(__name__) -SCHEMA_NO_IMPORTS = os.path.join(INPUT_DIR, 'kitchen_sink_noimports.yaml') -SCHEMA_WITH_IMPORTS = os.path.join(INPUT_DIR, 'kitchen_sink.yaml') -CLEAN_SCHEMA = os.path.join(OUTPUT_DIR, 'kitchen_sink.clean.yaml') +SCHEMA_NO_IMPORTS = os.path.join(INPUT_DIR, "kitchen_sink_noimports.yaml") +SCHEMA_WITH_IMPORTS = os.path.join(INPUT_DIR, "kitchen_sink.yaml") +CLEAN_SCHEMA = os.path.join(OUTPUT_DIR, "kitchen_sink.clean.yaml") yaml_loader = YAMLLoader() @@ -27,26 +27,25 @@ def test_as_dict(self): """ view = SchemaView(SCHEMA_NO_IMPORTS) all_slots = view.all_slots() - self.assertIn('name', all_slots) + self.assertIn("name", all_slots) logger.debug(view.schema.id) ystr = schema_as_yaml_dump(view.schema) - with open(CLEAN_SCHEMA, 'w') as stream: + with open(CLEAN_SCHEMA, "w") as stream: stream.write(ystr) view2 = SchemaView(ystr) obj = schema_as_dict(view.schema) # ensure that prefixes are compacted - assert obj['prefixes']['pav'] == 'http://purl.org/pav/' - assert '@type' not in obj - for k in ['slots', 'classes', 'enums', 'subsets']: + assert obj["prefixes"]["pav"] == "http://purl.org/pav/" + assert "@type" not in obj + for k in ["slots", "classes", "enums", "subsets"]: elt_dict = obj[k] for e_name, e in elt_dict.items(): - assert 'name' not in e - if k == 'enums': + assert "name" not in e + if k == "enums": for e in elt_dict.values(): - for pv in e.get('permissible_values', {}).values(): - assert 'text' not in pv - self.assertIn('name', obj['slots']) - + for pv in e.get("permissible_values", {}).values(): + assert "text" not in pv + self.assertIn("name", obj["slots"]) def test_as_dict_with_attributes(self): """ @@ -64,14 +63,14 @@ def test_as_dict_with_attributes(self): # Verify that the 'name' slot exists in the schema view = SchemaView(builder.schema) - self.assertIn('name', view.all_slots()) + self.assertIn("name", view.all_slots()) # Convert the schema to a dict obj = schema_as_dict(view.schema) # Verify that the 'name' slot still exists, as an attribute - self.assertIn('name', obj['classes']['Patient']['attributes']) + self.assertIn("name", obj["classes"]["Patient"]["attributes"]) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_schemaview.py b/tests/test_utils/test_schemaview.py index 5ba458a1..840aadfe 100644 --- a/tests/test_utils/test_schemaview.py +++ b/tests/test_utils/test_schemaview.py @@ -6,8 +6,15 @@ from jsonasobj2 import JsonObj from linkml_runtime.dumpers import yaml_dumper -from linkml_runtime.linkml_model.meta import Example, SchemaDefinition, ClassDefinition, SlotDefinitionName, SlotDefinition, \ - ClassDefinitionName, Prefix +from linkml_runtime.linkml_model.meta import ( + Example, + SchemaDefinition, + ClassDefinition, + SlotDefinitionName, + SlotDefinition, + ClassDefinitionName, + Prefix, +) from linkml_runtime.loaders.yaml_loader import YAMLLoader from linkml_runtime.utils.introspection import package_schemaview from linkml_runtime.utils.schemaview import SchemaView, SchemaUsage, OrderedBy @@ -16,20 +23,21 @@ logger = logging.getLogger(__name__) -SCHEMA_NO_IMPORTS = Path(INPUT_DIR) / 'kitchen_sink_noimports.yaml' -SCHEMA_WITH_IMPORTS = Path(INPUT_DIR) / 'kitchen_sink.yaml' +SCHEMA_NO_IMPORTS = Path(INPUT_DIR) / "kitchen_sink_noimports.yaml" +SCHEMA_WITH_IMPORTS = Path(INPUT_DIR) / "kitchen_sink.yaml" SCHEMA_WITH_STRUCTURED_PATTERNS = Path(INPUT_DIR) / "pattern-example.yaml" -SCHEMA_IMPORT_TREE = Path(INPUT_DIR) / 'imports' / 'main.yaml' -SCHEMA_RELATIVE_IMPORT_TREE = Path(INPUT_DIR) / 'imports_relative' / 'L0_0' / 'L1_0_0' / 'main.yaml' +SCHEMA_IMPORT_TREE = Path(INPUT_DIR) / "imports" / "main.yaml" +SCHEMA_RELATIVE_IMPORT_TREE = Path(INPUT_DIR) / "imports_relative" / "L0_0" / "L1_0_0" / "main.yaml" yaml_loader = YAMLLoader() -IS_CURRENT = 'is current' -EMPLOYED_AT = 'employed at' -COMPANY = 'Company' -AGENT = 'agent' -ACTIVITY = 'activity' -RELATED_TO = 'related to' -AGE_IN_YEARS = 'age in years' +IS_CURRENT = "is current" +EMPLOYED_AT = "employed at" +COMPANY = "Company" +AGENT = "agent" +ACTIVITY = "activity" +RELATED_TO = "related to" +AGE_IN_YEARS = "age in years" + @pytest.fixture def schema_view_no_imports(): @@ -45,7 +53,7 @@ def view(): def test_children_method(schema_view_no_imports): view = schema_view_no_imports children = view.get_children("Person") - assert children == ['Adult'] + assert children == ["Adult"] def test_all_aliases(schema_view_no_imports): @@ -60,6 +68,7 @@ def test_all_aliases(schema_view_no_imports): assert "B" in aliases["subset B"] assert "dad" in aliases["Adult"] + def test_alias_slot(schema_view_no_imports): """ Tests the alias slot. @@ -73,9 +82,9 @@ def test_alias_slot(schema_view_no_imports): for s in view.class_induced_slots(c.name): assert s.alias is not None # Assert that alias is not None - postal_code_slot = view.induced_slot('postal code', 'Address') - assert postal_code_slot.name == 'postal code' # Assert name is 'postal code' - assert postal_code_slot.alias == 'zip' # Assert alias is 'zip' + postal_code_slot = view.induced_slot("postal code", "Address") + assert postal_code_slot.name == "postal code" # Assert name is 'postal code' + assert postal_code_slot.alias == "zip" # Assert alias is 'zip' def test_schemaview_enums(schema_view_no_imports): @@ -90,7 +99,7 @@ def test_schemaview_enums(schema_view_no_imports): for pv, v in e.permissible_values.items(): if pv == "CAT": assert view.permissible_value_parent(pv, e.name) is None - assert view.permissible_value_ancestors(pv, e.name) == ['CAT'] + assert view.permissible_value_ancestors(pv, e.name) == ["CAT"] assert "LION" in view.permissible_value_descendants(pv, e.name) assert "ANGRY_LION" in view.permissible_value_descendants(pv, e.name) assert "TABBY" in view.permissible_value_descendants(pv, e.name) @@ -102,13 +111,13 @@ def test_schemaview_enums(schema_view_no_imports): assert "ANGRY_LION" in view.permissible_value_children(pv, e.name) if pv == "ANGRY_LION": - assert view.permissible_value_parent(pv, e.name) == ['LION'] - assert view.permissible_value_ancestors(pv, e.name) == ['ANGRY_LION', 'LION', 'CAT'] + assert view.permissible_value_parent(pv, e.name) == ["LION"] + assert view.permissible_value_ancestors(pv, e.name) == ["ANGRY_LION", "LION", "CAT"] assert view.permissible_value_descendants(pv, e.name) == ["ANGRY_LION"] for cn, c in view.all_classes().items(): if c.name == "Adult": - assert view.class_ancestors(c.name) == ['Adult', 'Person', 'HasAliases', 'Thing'] + assert view.class_ancestors(c.name) == ["Adult", "Person", "HasAliases", "Thing"] def test_schemaview(schema_view_no_imports): @@ -117,13 +126,13 @@ def test_schemaview(schema_view_no_imports): assert len(view.imports_closure()) == 1 all_cls = view.all_classes() - logger.debug(f'n_cls = {len(all_cls)}') + logger.debug(f"n_cls = {len(all_cls)}") - assert list(view.annotation_dict(IS_CURRENT).values()) == ['bar'] + assert list(view.annotation_dict(IS_CURRENT).values()) == ["bar"] logger.debug(view.annotation_dict(EMPLOYED_AT)) e = view.get_element(EMPLOYED_AT) logger.debug(e.annotations) - e = view.get_element('has employment history') + e = view.get_element("has employment history") logger.debug(e.annotations) elements = view.get_elements_applicable_by_identifier("ORCID:1234") @@ -135,18 +144,18 @@ def test_schemaview(schema_view_no_imports): elements = view.get_elements_applicable_by_identifier("TEST:1234") assert "anatomical entity" not in elements - assert list(view.annotation_dict(SlotDefinitionName(IS_CURRENT)).values()) == ['bar'] + assert list(view.annotation_dict(SlotDefinitionName(IS_CURRENT)).values()) == ["bar"] logger.debug(view.annotation_dict(SlotDefinitionName(EMPLOYED_AT))) element = view.get_element(SlotDefinitionName(EMPLOYED_AT)) logger.debug(element.annotations) - element = view.get_element(SlotDefinitionName('has employment history')) + element = view.get_element(SlotDefinitionName("has employment history")) logger.debug(element.annotations) - assert view.is_mixin('WithLocation') - assert not view.is_mixin('BirthEvent') + assert view.is_mixin("WithLocation") + assert not view.is_mixin("BirthEvent") - assert view.inverse('employment history of') == 'has employment history' - assert view.inverse('has employment history') == 'employment history of' + assert view.inverse("employment history of") == "has employment history" + assert view.inverse("has employment history") == "employment history of" mapping = view.get_mapping_index() assert mapping is not None @@ -154,223 +163,241 @@ def test_schemaview(schema_view_no_imports): category_mapping = view.get_element_by_mapping("GO:0005198") assert category_mapping == [ACTIVITY] - assert view.is_multivalued("aliases") assert not view.is_multivalued("id") assert view.is_multivalued("dog addresses") - assert view.slot_is_true_for_metadata_property('aliases', 'multivalued') - assert view.slot_is_true_for_metadata_property('id', 'identifier') + assert view.slot_is_true_for_metadata_property("aliases", "multivalued") + assert view.slot_is_true_for_metadata_property("id", "identifier") with pytest.raises(ValueError): - view.slot_is_true_for_metadata_property('aliases', 'aliases') + view.slot_is_true_for_metadata_property("aliases", "aliases") for tn, t in view.all_types().items(): - logger.info(f'TN = {tn}') - assert t.from_schema == 'https://w3id.org/linkml/tests/kitchen_sink' + logger.info(f"TN = {tn}") + assert t.from_schema == "https://w3id.org/linkml/tests/kitchen_sink" for sn, s in view.all_slots().items(): - logger.info(f'SN = {sn} RANGE={s.range}') - assert s.from_schema == 'https://w3id.org/linkml/tests/kitchen_sink' + logger.info(f"SN = {sn} RANGE={s.range}") + assert s.from_schema == "https://w3id.org/linkml/tests/kitchen_sink" rng = view.induced_slot(sn).range assert rng is not None for cn in all_cls.keys(): c = view.get_class(cn) - assert c.from_schema == 'https://w3id.org/linkml/tests/kitchen_sink' - logger.debug(f'{cn} PARENTS = {view.class_parents(cn)}') - logger.debug(f'{cn} ANCS = {view.class_ancestors(cn)}') - logger.debug(f'{cn} CHILDREN = {view.class_children(cn)}') - logger.debug(f'{cn} DESCS = {view.class_descendants(cn)}') - logger.debug(f'{cn} SCHEMA = {view.in_schema(cn)}') - logger.debug(f' SLOTS = {view.class_slots(cn)}') + assert c.from_schema == "https://w3id.org/linkml/tests/kitchen_sink" + logger.debug(f"{cn} PARENTS = {view.class_parents(cn)}") + logger.debug(f"{cn} ANCS = {view.class_ancestors(cn)}") + logger.debug(f"{cn} CHILDREN = {view.class_children(cn)}") + logger.debug(f"{cn} DESCS = {view.class_descendants(cn)}") + logger.debug(f"{cn} SCHEMA = {view.in_schema(cn)}") + logger.debug(f" SLOTS = {view.class_slots(cn)}") for sn in view.class_slots(cn): slot = view.get_slot(sn) - assert slot.from_schema == 'https://w3id.org/linkml/tests/kitchen_sink' - logger.debug(f' SLOT {sn} R: {slot.range} U: {view.get_uri(sn)} ANCS: {view.slot_ancestors(sn)}') + assert slot.from_schema == "https://w3id.org/linkml/tests/kitchen_sink" + logger.debug(f" SLOT {sn} R: {slot.range} U: {view.get_uri(sn)} ANCS: {view.slot_ancestors(sn)}") induced_slot = view.induced_slot(sn, cn) - logger.debug(f' INDUCED {sn}={induced_slot}') + logger.debug(f" INDUCED {sn}={induced_slot}") assert induced_slot.range is not None - logger.debug(f'ALL = {view.all_elements().keys()}') + logger.debug(f"ALL = {view.all_elements().keys()}") # -- TEST ANCESTOR/DESCENDANTS FUNCTIONS -- - assert set(view.class_ancestors(COMPANY)) == {'Company', 'Organization', 'HasAliases', 'Thing'} - assert set(view.class_ancestors(COMPANY, reflexive=False)) == {'Organization', 'HasAliases', 'Thing'} - assert set(view.class_descendants('Thing')) == {'Thing', 'Person', 'Organization', COMPANY, 'Adult'} + assert set(view.class_ancestors(COMPANY)) == {"Company", "Organization", "HasAliases", "Thing"} + assert set(view.class_ancestors(COMPANY, reflexive=False)) == {"Organization", "HasAliases", "Thing"} + assert set(view.class_descendants("Thing")) == {"Thing", "Person", "Organization", COMPANY, "Adult"} # -- TEST CLASS SLOTS -- - assert set(view.class_slots('Person')) == { - 'id', 'name', 'has employment history', 'has familial relationships', - 'has medical history', AGE_IN_YEARS, 'addresses', 'has birth event', - 'reason_for_happiness', 'aliases' - } - assert view.class_slots('Person') == view.class_slots('Adult') - assert set(view.class_slots(COMPANY)) == { - 'id', 'name', 'ceo', 'aliases' + assert set(view.class_slots("Person")) == { + "id", + "name", + "has employment history", + "has familial relationships", + "has medical history", + AGE_IN_YEARS, + "addresses", + "has birth event", + "reason_for_happiness", + "aliases", } + assert view.class_slots("Person") == view.class_slots("Adult") + assert set(view.class_slots(COMPANY)) == {"id", "name", "ceo", "aliases"} - assert view.get_class(AGENT).class_uri == 'prov:Agent' - assert view.get_uri(AGENT) == 'prov:Agent' + assert view.get_class(AGENT).class_uri == "prov:Agent" + assert view.get_uri(AGENT) == "prov:Agent" logger.debug(view.get_class(COMPANY).class_uri) - assert view.get_uri(COMPANY) == 'ks:Company' + assert view.get_uri(COMPANY) == "ks:Company" # test induced slots - for c in [COMPANY, 'Person', 'Organization']: - islot = view.induced_slot('aliases', c) + for c in [COMPANY, "Person", "Organization"]: + islot = view.induced_slot("aliases", c) assert islot.multivalued is True assert islot.owner == c - assert view.get_uri(islot, expand=True) == 'https://w3id.org/linkml/tests/kitchen_sink/aliases' - - assert view.get_identifier_slot('Company').name == 'id' - assert view.get_identifier_slot('Thing').name == 'id' - assert view.get_identifier_slot('FamilialRelationship') is None - - for c in [COMPANY, 'Person', 'Organization', 'Thing']: - assert view.induced_slot('id', c).identifier - assert not view.induced_slot('name', c).identifier - assert not view.induced_slot('name', c).required - assert view.induced_slot('name', c).range == 'string' - assert view.induced_slot('id', c).owner == c - assert view.induced_slot('name', c).owner == c - - for c in ['Event', 'EmploymentEvent', 'MedicalEvent']: - s = view.induced_slot('started at time', c) - logger.debug(f's={s.range} // c = {c}') - assert s.range == 'date' - assert s.slot_uri == 'prov:startedAtTime' + assert view.get_uri(islot, expand=True) == "https://w3id.org/linkml/tests/kitchen_sink/aliases" + + assert view.get_identifier_slot("Company").name == "id" + assert view.get_identifier_slot("Thing").name == "id" + assert view.get_identifier_slot("FamilialRelationship") is None + + for c in [COMPANY, "Person", "Organization", "Thing"]: + assert view.induced_slot("id", c).identifier + assert not view.induced_slot("name", c).identifier + assert not view.induced_slot("name", c).required + assert view.induced_slot("name", c).range == "string" + assert view.induced_slot("id", c).owner == c + assert view.induced_slot("name", c).owner == c + + for c in ["Event", "EmploymentEvent", "MedicalEvent"]: + s = view.induced_slot("started at time", c) + logger.debug(f"s={s.range} // c = {c}") + assert s.range == "date" + assert s.slot_uri == "prov:startedAtTime" assert s.owner == c c_induced = view.induced_class(c) assert c_induced.slots == [] assert c_induced.attributes != [] - s2 = c_induced.attributes['started at time'] - assert s2.range == 'date' - assert s2.slot_uri == 'prov:startedAtTime' + s2 = c_induced.attributes["started at time"] + assert s2.range == "date" + assert s2.slot_uri == "prov:startedAtTime" # test slot_usage - assert view.induced_slot(AGE_IN_YEARS, 'Person').minimum_value == 0 - assert view.induced_slot(AGE_IN_YEARS, 'Adult').minimum_value == 16 - assert view.induced_slot('name', 'Person').pattern is not None - assert view.induced_slot('type', 'FamilialRelationship').range == 'FamilialRelationshipType' - assert view.induced_slot(RELATED_TO, 'FamilialRelationship').range == 'Person' - assert view.get_slot(RELATED_TO).range == 'Thing' - assert view.induced_slot(RELATED_TO, 'Relationship').range == 'Thing' - assert set(view.induced_slot('name').domain_of) == {'Thing', 'Place'} + assert view.induced_slot(AGE_IN_YEARS, "Person").minimum_value == 0 + assert view.induced_slot(AGE_IN_YEARS, "Adult").minimum_value == 16 + assert view.induced_slot("name", "Person").pattern is not None + assert view.induced_slot("type", "FamilialRelationship").range == "FamilialRelationshipType" + assert view.induced_slot(RELATED_TO, "FamilialRelationship").range == "Person" + assert view.get_slot(RELATED_TO).range == "Thing" + assert view.induced_slot(RELATED_TO, "Relationship").range == "Thing" + assert set(view.induced_slot("name").domain_of) == {"Thing", "Place"} a = view.get_class(ACTIVITY) - assert set(a.exact_mappings) == {'prov:Activity'} + assert set(a.exact_mappings) == {"prov:Activity"} logger.debug(view.get_mappings(ACTIVITY, expand=True)) - assert set(view.get_mappings(ACTIVITY)['exact']) == {'prov:Activity'} - assert set(view.get_mappings(ACTIVITY, expand=True)['exact']) == {'http://www.w3.org/ns/prov#Activity'} + assert set(view.get_mappings(ACTIVITY)["exact"]) == {"prov:Activity"} + assert set(view.get_mappings(ACTIVITY, expand=True)["exact"]) == {"http://www.w3.org/ns/prov#Activity"} u = view.usage_index() for k, v in u.items(): - logger.debug(f' {k} = {v}') - - assert SchemaUsage(used_by='FamilialRelationship', slot=RELATED_TO, - metaslot='range', used='Person', inferred=False) in u['Person'] - assert [SchemaUsage(used_by='Person', - slot='reason_for_happiness', - metaslot='any_of[range]', - used='MarriageEvent', - inferred=True - ), - SchemaUsage(used_by='Adult', - slot='reason_for_happiness', - metaslot='any_of[range]', - used='MarriageEvent', - inferred=False - )] == u['MarriageEvent'] - assert [SchemaUsage(used_by='Person', - slot='has employment history', - metaslot='range', - used='EmploymentEvent', - inferred=True), - SchemaUsage(used_by='Person', - slot='reason_for_happiness', - metaslot='any_of[range]', - used='EmploymentEvent', - inferred=True), - SchemaUsage(used_by='Adult', - slot='has employment history', - metaslot='range', - used='EmploymentEvent', - inferred=False), - SchemaUsage(used_by='Adult', - slot='reason_for_happiness', - metaslot='any_of[range]', - used='EmploymentEvent', - inferred=False)] == u['EmploymentEvent'] + logger.debug(f" {k} = {v}") + + assert ( + SchemaUsage( + used_by="FamilialRelationship", slot=RELATED_TO, metaslot="range", used="Person", inferred=False + ) + in u["Person"] + ) + assert [ + SchemaUsage( + used_by="Person", + slot="reason_for_happiness", + metaslot="any_of[range]", + used="MarriageEvent", + inferred=True, + ), + SchemaUsage( + used_by="Adult", + slot="reason_for_happiness", + metaslot="any_of[range]", + used="MarriageEvent", + inferred=False, + ), + ] == u["MarriageEvent"] + assert [ + SchemaUsage( + used_by="Person", slot="has employment history", metaslot="range", used="EmploymentEvent", inferred=True + ), + SchemaUsage( + used_by="Person", + slot="reason_for_happiness", + metaslot="any_of[range]", + used="EmploymentEvent", + inferred=True, + ), + SchemaUsage( + used_by="Adult", slot="has employment history", metaslot="range", used="EmploymentEvent", inferred=False + ), + SchemaUsage( + used_by="Adult", + slot="reason_for_happiness", + metaslot="any_of[range]", + used="EmploymentEvent", + inferred=False, + ), + ] == u["EmploymentEvent"] # test methods also work for attributes leaves = view.class_leaves() - logger.debug(f'LEAVES={leaves}') - assert 'MedicalEvent' in leaves + logger.debug(f"LEAVES={leaves}") + assert "MedicalEvent" in leaves roots = view.class_roots() - logger.debug(f'ROOTS={roots}') - assert 'Dataset' in roots - ds_slots = view.class_slots('Dataset') + logger.debug(f"ROOTS={roots}") + assert "Dataset" in roots + ds_slots = view.class_slots("Dataset") logger.debug(ds_slots) assert len(ds_slots) == 3 - assert len(['persons', 'companies', 'activities']) == len(ds_slots) + assert len(["persons", "companies", "activities"]) == len(ds_slots) for sn in ds_slots: - s = view.induced_slot(sn, 'Dataset') + s = view.induced_slot(sn, "Dataset") logger.debug(s) + def test_rollup_rolldown(schema_view_no_imports): # no import schema view = schema_view_no_imports - element_name = 'Event' + element_name = "Event" roll_up(view, element_name) for slot in view.class_induced_slots(element_name): logger.debug(slot) induced_slot_names = [s.name for s in view.class_induced_slots(element_name)] logger.debug(induced_slot_names) - assert len(['started at time', 'ended at time', IS_CURRENT, 'in location', EMPLOYED_AT, 'married to']) == len(induced_slot_names) + assert len(["started at time", "ended at time", IS_CURRENT, "in location", EMPLOYED_AT, "married to"]) == len( + induced_slot_names + ) # check to make sure rolled-up classes are deleted assert view.class_descendants(element_name, reflexive=False) == [] roll_down(view, view.class_leaves()) for element_name in view.all_classes(): - logger.debug(f'{element_name}') - logger.debug(f' {element_name} SLOTS(i) = {view.class_slots(element_name)}') - logger.debug(f' {element_name} SLOTS(d) = {view.class_slots(element_name, direct=True)}') + logger.debug(f"{element_name}") + logger.debug(f" {element_name} SLOTS(i) = {view.class_slots(element_name)}") + logger.debug(f" {element_name} SLOTS(d) = {view.class_slots(element_name, direct=True)}") assert len(view.class_slots(element_name)) == len(view.class_slots(element_name, direct=True)) - assert 'Thing' not in view.all_classes() - assert 'Person' not in view.all_classes() - assert 'Adult' in view.all_classes() + assert "Thing" not in view.all_classes() + assert "Person" not in view.all_classes() + assert "Adult" in view.all_classes() + def test_caching(): """ Determine if cache is reset after modifications made to schema """ - schema = SchemaDefinition(id='test', name='test') + schema = SchemaDefinition(id="test", name="test") view = SchemaView(schema) assert len([]) == len(view.all_classes()) - view.add_class(ClassDefinition('X')) - assert len(['X']) == len(view.all_classes()) - view.add_class(ClassDefinition('Y')) - assert len(['X', 'Y']) == len(view.all_classes()) + view.add_class(ClassDefinition("X")) + assert len(["X"]) == len(view.all_classes()) + view.add_class(ClassDefinition("Y")) + assert len(["X", "Y"]) == len(view.all_classes()) # bypass view method and add directly to schema; # in general this is not recommended as the cache will # not be updated - view.schema.classes['Z'] = ClassDefinition('Z') + view.schema.classes["Z"] = ClassDefinition("Z") # as expected, the view doesn't know about Z - assert len(['X', 'Y']) == len(view.all_classes()) + assert len(["X", "Y"]) == len(view.all_classes()) # inform the view modifications have been made view.set_modified() # should be in sync - assert len(['X', 'Y', 'Z']) == len(view.all_classes()) + assert len(["X", "Y", "Z"]) == len(view.all_classes()) # recommended way to make updates - view.delete_class('X') + view.delete_class("X") # cache will be up to date - assert len(['Y', 'Z']) == len(view.all_classes()) - view.add_class(ClassDefinition('W')) - assert len(['Y', 'Z', 'W']) == len(view.all_classes()) + assert len(["Y", "Z"]) == len(view.all_classes()) + view.add_class(ClassDefinition("W")) + assert len(["Y", "Z", "W"]) == len(view.all_classes()) def test_import_map(): @@ -385,30 +412,32 @@ def test_import_map(): for im in [None, {}, {"core": "core"}]: view = SchemaView(SCHEMA_WITH_IMPORTS, importmap=im) view.all_classes() - assert view.imports_closure().sort() == ['kitchen_sink', 'core', 'linkml:types'].sort() # Assert imports closure + assert ( + view.imports_closure().sort() == ["kitchen_sink", "core", "linkml:types"].sort() + ) # Assert imports closure assert ACTIVITY in view.all_classes() # Assert ACTIVITY is in all classes assert ACTIVITY not in view.all_classes(imports=False) # Assert ACTIVITY is not in classes without imports def test_imports(view): """view should by default dynamically include imports chain""" - assert (view.schema.source_file is not None) + assert view.schema.source_file is not None logger.debug(view.imports_closure()) - assert set(view.imports_closure()) == {'kitchen_sink', 'core', 'linkml:types'} + assert set(view.imports_closure()) == {"kitchen_sink", "core", "linkml:types"} for t in view.all_types().keys(): - logger.debug(f'T={t} in={view.in_schema(t)}') - assert view.in_schema(ClassDefinitionName('Person')) == 'kitchen_sink' - assert view.in_schema(SlotDefinitionName('id')) == 'core' - assert view.in_schema(SlotDefinitionName('name')) == 'core' - assert view.in_schema(SlotDefinitionName(ACTIVITY)) == 'core' - assert view.in_schema(SlotDefinitionName('string')) == 'types' + logger.debug(f"T={t} in={view.in_schema(t)}") + assert view.in_schema(ClassDefinitionName("Person")) == "kitchen_sink" + assert view.in_schema(SlotDefinitionName("id")) == "core" + assert view.in_schema(SlotDefinitionName("name")) == "core" + assert view.in_schema(SlotDefinitionName(ACTIVITY)) == "core" + assert view.in_schema(SlotDefinitionName("string")) == "types" assert ACTIVITY in view.all_classes() assert ACTIVITY not in view.all_classes(imports=False) - assert 'string' in view.all_types() - assert 'string' not in view.all_types(imports=False) - assert len(view.type_ancestors('SymbolString')) == len(['SymbolString', 'string']) + assert "string" in view.all_types() + assert "string" not in view.all_types(imports=False) + assert len(view.type_ancestors("SymbolString")) == len(["SymbolString", "string"]) for tn, t in view.all_types().items(): assert tn == t.name @@ -416,69 +445,69 @@ def test_imports(view): assert induced_t.uri is not None assert induced_t.base is not None if t in view.all_types(imports=False).values(): - assert t.from_schema == 'https://w3id.org/linkml/tests/kitchen_sink' + assert t.from_schema == "https://w3id.org/linkml/tests/kitchen_sink" else: - assert t.from_schema in ['https://w3id.org/linkml/tests/core', 'https://w3id.org/linkml/types'] + assert t.from_schema in ["https://w3id.org/linkml/tests/core", "https://w3id.org/linkml/types"] for en, e in view.all_enums().items(): assert en == e.name if e in view.all_enums(imports=False).values(): - assert e.from_schema == 'https://w3id.org/linkml/tests/kitchen_sink' + assert e.from_schema == "https://w3id.org/linkml/tests/kitchen_sink" else: - assert e.from_schema == 'https://w3id.org/linkml/tests/core' + assert e.from_schema == "https://w3id.org/linkml/tests/core" for sn, s in view.all_slots().items(): assert sn == s.name s_induced = view.induced_slot(sn) assert s_induced.range is not None if s in view.all_slots(imports=False).values(): - assert s.from_schema == 'https://w3id.org/linkml/tests/kitchen_sink' + assert s.from_schema == "https://w3id.org/linkml/tests/kitchen_sink" else: - assert s.from_schema == 'https://w3id.org/linkml/tests/core' + assert s.from_schema == "https://w3id.org/linkml/tests/core" for cn, c in view.all_classes().items(): assert cn == c.name if c in view.all_classes(imports=False).values(): - assert c.from_schema == 'https://w3id.org/linkml/tests/kitchen_sink' + assert c.from_schema == "https://w3id.org/linkml/tests/kitchen_sink" else: - assert c.from_schema == 'https://w3id.org/linkml/tests/core' + assert c.from_schema == "https://w3id.org/linkml/tests/core" for s in view.class_induced_slots(cn): if s in view.all_classes(imports=False).values(): assert s.slot_uri is not None - assert s.from_schema == 'https://w3id.org/linkml/tests/kitchen_sink' + assert s.from_schema == "https://w3id.org/linkml/tests/kitchen_sink" - for c in ['Company', 'Person', 'Organization', 'Thing']: - assert view.induced_slot('id', c).identifier - assert not view.induced_slot('name', c).identifier - assert not view.induced_slot('name', c).required - assert view.induced_slot('name', c).range == 'string' + for c in ["Company", "Person", "Organization", "Thing"]: + assert view.induced_slot("id", c).identifier + assert not view.induced_slot("name", c).identifier + assert not view.induced_slot("name", c).required + assert view.induced_slot("name", c).range == "string" - for c in ['Event', 'EmploymentEvent', 'MedicalEvent']: - s = view.induced_slot('started at time', c) - assert s.range == 'date' - assert s.slot_uri == 'prov:startedAtTime' + for c in ["Event", "EmploymentEvent", "MedicalEvent"]: + s = view.induced_slot("started at time", c) + assert s.range == "date" + assert s.slot_uri == "prov:startedAtTime" - assert view.induced_slot(AGE_IN_YEARS, 'Person').minimum_value == 0 - assert view.induced_slot(AGE_IN_YEARS, 'Adult').minimum_value == 16 + assert view.induced_slot(AGE_IN_YEARS, "Person").minimum_value == 0 + assert view.induced_slot(AGE_IN_YEARS, "Adult").minimum_value == 16 - assert view.get_class('agent').class_uri == 'prov:Agent' - assert view.get_uri(AGENT) == 'prov:Agent' - logger.debug(view.get_class('Company').class_uri) + assert view.get_class("agent").class_uri == "prov:Agent" + assert view.get_uri(AGENT) == "prov:Agent" + logger.debug(view.get_class("Company").class_uri) - assert view.get_uri(COMPANY) == 'ks:Company' - assert view.get_uri(COMPANY, expand=True) == 'https://w3id.org/linkml/tests/kitchen_sink/Company' - logger.debug(view.get_uri('TestClass')) - assert view.get_uri('TestClass') == 'core:TestClass' - assert view.get_uri('TestClass', expand=True) == 'https://w3id.org/linkml/tests/core/TestClass' + assert view.get_uri(COMPANY) == "ks:Company" + assert view.get_uri(COMPANY, expand=True) == "https://w3id.org/linkml/tests/kitchen_sink/Company" + logger.debug(view.get_uri("TestClass")) + assert view.get_uri("TestClass") == "core:TestClass" + assert view.get_uri("TestClass", expand=True) == "https://w3id.org/linkml/tests/core/TestClass" - assert view.get_uri('string') == 'xsd:string' + assert view.get_uri("string") == "xsd:string" # dynamic enums - e = view.get_enum('HCAExample') - assert set(e.include[0].reachable_from.source_nodes) == {'GO:0007049', 'GO:0022403'} + e = view.get_enum("HCAExample") + assert set(e.include[0].reachable_from.source_nodes) == {"GO:0007049", "GO:0022403"} # units - height = view.get_slot('height_in_m') + height = view.get_slot("height_in_m") assert height.unit.ucum_code == "m" @@ -494,14 +523,21 @@ def test_imports_closure_order(): sv = SchemaView(SCHEMA_IMPORT_TREE) closure = sv.imports_closure(imports=True) target = [ - 'linkml:types', - 's1_1', - 's1_2_1_1_1', 's1_2_1_1_2', - 's1_2_1_1', 's1_2_1', 's1_2', - 's1', - 's2_1', 's2_2', 's2', - 's3_1', 's3_2', 's3', - 'main' + "linkml:types", + "s1_1", + "s1_2_1_1_1", + "s1_2_1_1_2", + "s1_2_1_1", + "s1_2_1", + "s1_2", + "s1", + "s2_1", + "s2_2", + "s2", + "s3_1", + "s3_2", + "s3", + "main", ] assert closure == target @@ -513,7 +549,7 @@ def test_imports_overrides(): target = {} for name, cls in sv.all_classes(imports=True).items(): target[name] = name - defaults[name] = cls.attributes['value'].ifabsent + defaults[name] = cls.attributes["value"].ifabsent assert defaults == target @@ -525,28 +561,28 @@ def test_imports_relative(): assert len(closure) == len(sv.schema_map.keys()) assert closure == [ - 'linkml:types', - '../neighborhood_parent', - 'neighbor', - '../parent', - '../L1_0_1/L2_0_1_0/grandchild', - '../../L0_1/L1_1_0/L2_1_0_0/apple', - '../../L0_1/L1_1_0/L2_1_0_0/index', - '../../L0_1/L1_1_0/L2_1_0_1/banana', - '../../L0_1/L1_1_0/L2_1_0_1/index', - '../../L0_1/L1_1_0/index', - '../../L0_1/cousin', - '../L1_0_1/dupe', - './L2_0_0_0/child', - './L2_0_0_1/child', - 'main' + "linkml:types", + "../neighborhood_parent", + "neighbor", + "../parent", + "../L1_0_1/L2_0_1_0/grandchild", + "../../L0_1/L1_1_0/L2_1_0_0/apple", + "../../L0_1/L1_1_0/L2_1_0_0/index", + "../../L0_1/L1_1_0/L2_1_0_1/banana", + "../../L0_1/L1_1_0/L2_1_0_1/index", + "../../L0_1/L1_1_0/index", + "../../L0_1/cousin", + "../L1_0_1/dupe", + "./L2_0_0_0/child", + "./L2_0_0_1/child", + "main", ] # check that we can actually get the classes from the same-named schema classes = sv.all_classes(imports=True) - assert 'L110Index' in classes - assert 'L2100Index' in classes - assert 'L2101Index' in classes + assert "L110Index" in classes + assert "L2100Index" in classes + assert "L2101Index" in classes def test_direct_remote_imports(): @@ -573,6 +609,7 @@ def test_direct_remote_imports_additional(): class_count = len(view.all_classes()) assert class_count > 0 + def test_merge_imports(view): """ ensure merging and merging imports closure works @@ -586,6 +623,7 @@ def test_merge_imports(view): all_c2_noi = copy(view.all_classes(imports=False)) assert len(all_c2_noi) == len(all_c2) + def test_metamodel_imports(): """ Tests imports of the metamodel. @@ -594,7 +632,7 @@ def test_metamodel_imports(): SchemaView should make use of the version of the metamodel distributed with the package over the network available version. """ - schema = SchemaDefinition(id='test', name='metamodel-imports-test', imports=["linkml:meta"]) + schema = SchemaDefinition(id="test", name="metamodel-imports-test", imports=["linkml:meta"]) sv = SchemaView(schema) all_classes = sv.all_classes() assert len(all_classes) > 20 @@ -603,139 +641,156 @@ def test_metamodel_imports(): assert len(sv.all_classes()) > 20 assert all_classes == sv.all_classes() + def test_non_linkml_remote_import(): """ Test that a remote import _not_ using the linkml prefix works. See: https://github.com/linkml/linkml/issues/1627 """ schema = SchemaDefinition( - id='test_non_linkml_remote_import', - name='test_non_linkml_remote_import', - prefixes=[ - Prefix( - prefix_prefix="foo", - prefix_reference="https://w3id.org/linkml/" - ) - ], - imports=[ - "foo:types" - ], - slots=[ - SlotDefinition( - name="an_int", - range="integer" - ) - ], - classes=[ - ClassDefinition( - name="AClass", - slots=["an_int"] - ) - ] + id="test_non_linkml_remote_import", + name="test_non_linkml_remote_import", + prefixes=[Prefix(prefix_prefix="foo", prefix_reference="https://w3id.org/linkml/")], + imports=["foo:types"], + slots=[SlotDefinition(name="an_int", range="integer")], + classes=[ClassDefinition(name="AClass", slots=["an_int"])], ) sv = SchemaView(schema) slots = sv.class_induced_slots("AClass", imports=True) assert len(slots) == 1 + def test_traversal(): - schema = SchemaDefinition(id='test', name='traversal-test') + schema = SchemaDefinition(id="test", name="traversal-test") view = SchemaView(schema) - view.add_class(ClassDefinition('Root', mixins=['RootMixin'])) - view.add_class(ClassDefinition('A', is_a='Root', mixins=['Am1', 'Am2', 'AZ'])) - view.add_class(ClassDefinition('B', is_a='A', mixins=['Bm1', 'Bm2', 'BY'])) - view.add_class(ClassDefinition('C', is_a='B', mixins=['Cm1', 'Cm2', 'CX'])) - view.add_class(ClassDefinition('RootMixin', mixin=True)) - view.add_class(ClassDefinition('Am1', is_a='RootMixin', mixin=True)) - view.add_class(ClassDefinition('Am2', is_a='RootMixin', mixin=True)) - view.add_class(ClassDefinition('Bm1', is_a='Am1', mixin=True)) - view.add_class(ClassDefinition('Bm2', is_a='Am2', mixin=True)) - view.add_class(ClassDefinition('Cm1', is_a='Bm1', mixin=True)) - view.add_class(ClassDefinition('Cm2', is_a='Bm2', mixin=True)) - view.add_class(ClassDefinition('AZ', is_a='RootMixin', mixin=True)) - view.add_class(ClassDefinition('BY', is_a='RootMixin', mixin=True)) - view.add_class(ClassDefinition('CX', is_a='RootMixin', mixin=True)) - - assert view.class_ancestors('C', depth_first=True) == ['C', 'Cm1', 'Cm2', 'CX', 'B', 'Bm1', 'Bm2', 'BY', 'A', 'Am1', 'Am2', 'AZ', 'Root', 'RootMixin'] - assert view.class_ancestors('C', depth_first=False) == ['C', 'Cm1', 'Cm2', 'CX', 'B', 'Bm1', 'Bm2', 'RootMixin', 'BY', 'A', 'Am1', 'Am2', 'AZ', 'Root'] - assert view.class_ancestors('C', mixins=False) == ['C', 'B', 'A', 'Root'] - assert view.class_ancestors('C', is_a=False) == ['C', 'Cm1', 'Cm2', 'CX'] + view.add_class(ClassDefinition("Root", mixins=["RootMixin"])) + view.add_class(ClassDefinition("A", is_a="Root", mixins=["Am1", "Am2", "AZ"])) + view.add_class(ClassDefinition("B", is_a="A", mixins=["Bm1", "Bm2", "BY"])) + view.add_class(ClassDefinition("C", is_a="B", mixins=["Cm1", "Cm2", "CX"])) + view.add_class(ClassDefinition("RootMixin", mixin=True)) + view.add_class(ClassDefinition("Am1", is_a="RootMixin", mixin=True)) + view.add_class(ClassDefinition("Am2", is_a="RootMixin", mixin=True)) + view.add_class(ClassDefinition("Bm1", is_a="Am1", mixin=True)) + view.add_class(ClassDefinition("Bm2", is_a="Am2", mixin=True)) + view.add_class(ClassDefinition("Cm1", is_a="Bm1", mixin=True)) + view.add_class(ClassDefinition("Cm2", is_a="Bm2", mixin=True)) + view.add_class(ClassDefinition("AZ", is_a="RootMixin", mixin=True)) + view.add_class(ClassDefinition("BY", is_a="RootMixin", mixin=True)) + view.add_class(ClassDefinition("CX", is_a="RootMixin", mixin=True)) + + assert view.class_ancestors("C", depth_first=True) == [ + "C", + "Cm1", + "Cm2", + "CX", + "B", + "Bm1", + "Bm2", + "BY", + "A", + "Am1", + "Am2", + "AZ", + "Root", + "RootMixin", + ] + assert view.class_ancestors("C", depth_first=False) == [ + "C", + "Cm1", + "Cm2", + "CX", + "B", + "Bm1", + "Bm2", + "RootMixin", + "BY", + "A", + "Am1", + "Am2", + "AZ", + "Root", + ] + assert view.class_ancestors("C", mixins=False) == ["C", "B", "A", "Root"] + assert view.class_ancestors("C", is_a=False) == ["C", "Cm1", "Cm2", "CX"] + def test_slot_inheritance(): - schema = SchemaDefinition(id='test', name='test') + schema = SchemaDefinition(id="test", name="test") view = SchemaView(schema) - view.add_class(ClassDefinition('C', slots=['s1', 's2'])) - view.add_class(ClassDefinition('D')) - view.add_class(ClassDefinition('Z')) - view.add_class(ClassDefinition('W')) - - view.add_slot(SlotDefinition('s1', multivalued=True, range='D')) - view.add_slot(SlotDefinition('s2', is_a='s1')) - view.add_slot(SlotDefinition('s3', is_a='s2', mixins=['m1'])) - view.add_slot(SlotDefinition('s4', is_a='s2', mixins=['m1'], range='W')) - view.add_slot(SlotDefinition('m1', mixin=True, multivalued=False, range='Z')) - - slot1 = view.induced_slot('s1', 'C') + view.add_class(ClassDefinition("C", slots=["s1", "s2"])) + view.add_class(ClassDefinition("D")) + view.add_class(ClassDefinition("Z")) + view.add_class(ClassDefinition("W")) + + view.add_slot(SlotDefinition("s1", multivalued=True, range="D")) + view.add_slot(SlotDefinition("s2", is_a="s1")) + view.add_slot(SlotDefinition("s3", is_a="s2", mixins=["m1"])) + view.add_slot(SlotDefinition("s4", is_a="s2", mixins=["m1"], range="W")) + view.add_slot(SlotDefinition("m1", mixin=True, multivalued=False, range="Z")) + + slot1 = view.induced_slot("s1", "C") assert slot1.is_a is None - assert slot1.range == 'D' + assert slot1.range == "D" assert slot1.multivalued is not None - slot2 = view.induced_slot('s2', 'C') - assert slot2.is_a == 's1' - assert slot2.range == 'D' + slot2 = view.induced_slot("s2", "C") + assert slot2.is_a == "s1" + assert slot2.range == "D" assert slot2.multivalued is not None - slot3 = view.induced_slot('s3', 'C') + slot3 = view.induced_slot("s3", "C") assert slot3.multivalued is not None - assert slot3.range == 'Z' + assert slot3.range == "Z" - slot4 = view.induced_slot('s4', 'C') + slot4 = view.induced_slot("s4", "C") assert slot4.multivalued is not None - assert slot4.range == 'W' + assert slot4.range == "W" # Test dangling - view.add_slot(SlotDefinition('s5', is_a='does-not-exist')) + view.add_slot(SlotDefinition("s5", is_a="does-not-exist")) with pytest.raises(ValueError): - view.slot_ancestors('s5') + view.slot_ancestors("s5") + def test_attribute_inheritance(): """ Tests attribute inheritance edge cases. """ - view = SchemaView(os.path.join(INPUT_DIR, 'attribute_edge_cases.yaml')) + view = SchemaView(os.path.join(INPUT_DIR, "attribute_edge_cases.yaml")) expected = [ - ('Root', 'a1', None, "a1"), - ('Root', 'a2', None, "a2"), - ('Root', 'a3', None, "a3"), - ('C1', 'a1', True, "a1m1"), - ('C1', 'a2', True, "a2c1"), - ('C1', 'a3', None, "a3"), - ('C1', 'a4', None, "a4"), - ('C2', 'a1', False, "a1m2"), - ('C2', 'a2', True, "a2c2"), - ('C2', 'a3', None, "a3"), - ('C2', 'a4', True, "a4m2"), - ('C1x', 'a1', True, "a1m1"), - ('C1x', 'a2', True, "a2c1x"), - ('C1x', 'a3', None, "a3"), - ('C1x', 'a4', None, "a4"), + ("Root", "a1", None, "a1"), + ("Root", "a2", None, "a2"), + ("Root", "a3", None, "a3"), + ("C1", "a1", True, "a1m1"), + ("C1", "a2", True, "a2c1"), + ("C1", "a3", None, "a3"), + ("C1", "a4", None, "a4"), + ("C2", "a1", False, "a1m2"), + ("C2", "a2", True, "a2c2"), + ("C2", "a3", None, "a3"), + ("C2", "a4", True, "a4m2"), + ("C1x", "a1", True, "a1m1"), + ("C1x", "a2", True, "a2c1x"), + ("C1x", "a3", None, "a3"), + ("C1x", "a4", None, "a4"), ] for cn, sn, req, desc in expected: slot = view.induced_slot(sn, cn) assert req == slot.required, f"in: {cn}.{sn}" assert desc == slot.description, f"in: {cn}.{sn}" - assert slot.range == 'string', f"in: {cn}.{sn}" + assert slot.range == "string", f"in: {cn}.{sn}" def test_ambiguous_attributes(): - schema = SchemaDefinition(id='test', name='test') + schema = SchemaDefinition(id="test", name="test") view = SchemaView(schema) - a1 = SlotDefinition('a1', range='string') - a2 = SlotDefinition('a2', range='FooEnum') - a3 = SlotDefinition('a3', range='C3') - view.add_class(ClassDefinition('C1', attributes={a1.name: a1, a2.name: a2, a3.name: a3})) - a1x = SlotDefinition('a1', range='integer') - a2x = SlotDefinition('a2', range='BarEnum') - view.add_class(ClassDefinition('C2', attributes={a1x.name: a1x, a2x.name: a2x})) + a1 = SlotDefinition("a1", range="string") + a2 = SlotDefinition("a2", range="FooEnum") + a3 = SlotDefinition("a3", range="C3") + view.add_class(ClassDefinition("C1", attributes={a1.name: a1, a2.name: a2, a3.name: a3})) + a1x = SlotDefinition("a1", range="integer") + a2x = SlotDefinition("a2", range="BarEnum") + view.add_class(ClassDefinition("C2", attributes={a1x.name: a1x, a2x.name: a2x})) assert view.get_slot(a1.name).range is None assert view.get_slot(a2.name).range is None @@ -744,39 +799,39 @@ def test_ambiguous_attributes(): assert len(view.all_slots(attributes=False)) == 0 assert len(view.all_slots()) == 3 assert view.induced_slot(a3.name).range == a3.range - assert view.induced_slot(a1.name, 'C1').range == a1.range - assert view.induced_slot(a2.name, 'C1').range == a2.range - assert view.induced_slot(a1x.name, 'C2').range == a1x.range - assert view.induced_slot(a2x.name, 'C2').range == a2x.range + assert view.induced_slot(a1.name, "C1").range == a1.range + assert view.induced_slot(a2.name, "C1").range == a2.range + assert view.induced_slot(a1x.name, "C2").range == a1x.range + assert view.induced_slot(a2x.name, "C2").range == a2x.range def test_metamodel_in_schemaview(): - view = package_schemaview('linkml_runtime.linkml_model.meta') - assert 'meta' in view.imports_closure() - assert 'linkml:types' in view.imports_closure() - assert 'meta' in view.imports_closure(imports=False) - assert 'linkml:types' not in view.imports_closure(imports=False) + view = package_schemaview("linkml_runtime.linkml_model.meta") + assert "meta" in view.imports_closure() + assert "linkml:types" in view.imports_closure() + assert "meta" in view.imports_closure(imports=False) + assert "linkml:types" not in view.imports_closure(imports=False) assert len(view.imports_closure(imports=False)) == 1 all_classes = list(view.all_classes().keys()) all_classes_no_imports = list(view.all_classes(imports=False).keys()) - for cn in ['class_definition', 'type_definition', 'slot_definition']: + for cn in ["class_definition", "type_definition", "slot_definition"]: assert cn in all_classes assert cn in all_classes_no_imports - assert view.get_identifier_slot(cn).name == 'name' - for cn in ['annotation', 'extension']: + assert view.get_identifier_slot(cn).name == "name" + for cn in ["annotation", "extension"]: assert cn in all_classes, "imports should be included by default" assert cn not in all_classes_no_imports, "imported class unexpectedly included" - for sn in ['id', 'name', 'description']: + for sn in ["id", "name", "description"]: assert sn in view.all_slots() - for tn in ['uriorcurie', 'string', 'float']: + for tn in ["uriorcurie", "string", "float"]: assert tn in view.all_types() - for tn in ['uriorcurie', 'string', 'float']: + for tn in ["uriorcurie", "string", "float"]: assert tn not in view.all_types(imports=False) for cn, c in view.all_classes().items(): uri = view.get_uri(cn, expand=True) assert uri is not None - if cn not in ['structured_alias', 'UnitOfMeasure', 'ValidationReport', 'ValidationResult']: - assert 'https://w3id.org/linkml/' in uri + if cn not in ["structured_alias", "UnitOfMeasure", "ValidationReport", "ValidationResult"]: + assert "https://w3id.org/linkml/" in uri induced_slots = view.class_induced_slots(cn) for s in induced_slots: exp_slot_uri = view.get_uri(s, expand=True) @@ -809,7 +864,7 @@ def test_materialize_patterns_slot_usage(): sv = SchemaView(SCHEMA_WITH_STRUCTURED_PATTERNS) sv.materialize_patterns() - name_slot_usage = sv.get_class("FancyPersonInfo").slot_usage['name'] + name_slot_usage = sv.get_class("FancyPersonInfo").slot_usage["name"] assert name_slot_usage.pattern == r"\S+ \S+-\S+" @@ -817,7 +872,7 @@ def test_materialize_patterns_attribute(): sv = SchemaView(SCHEMA_WITH_STRUCTURED_PATTERNS) sv.materialize_patterns() - weight_attribute = sv.get_class('ClassWithAttributes').attributes['weight'] + weight_attribute = sv.get_class("ClassWithAttributes").attributes["weight"] assert weight_attribute.pattern == r"\d+[\.\d+] (kg|g|lbs|stone)" @@ -841,10 +896,11 @@ def test_mergeimports(): assert "was generated by" in slots_list prefixes_list = list(sv.schema.prefixes.keys()) - if 'schema' not in prefixes_list: - prefixes_list.append('schema') + if "schema" not in prefixes_list: + prefixes_list.append("schema") assert sorted(prefixes_list) == sorted( - ["pav", "dce", "lego", "linkml", "biolink", "ks", "RO", "BFO", "tax", "core", "prov", "xsd", "schema", "shex"]) + ["pav", "dce", "lego", "linkml", "biolink", "ks", "RO", "BFO", "tax", "core", "prov", "xsd", "schema", "shex"] + ) def test_is_inlined(): @@ -859,7 +915,7 @@ def test_is_inlined(): ("inlined_as_list_thing_without_id", True), ("an_integer", False), ("inlined_integer", False), - ("inlined_as_list_integer", False) + ("inlined_as_list_integer", False), ] for slot_name, expected_result in cases: slot = sv.get_slot(slot_name) @@ -884,9 +940,13 @@ def test_materialize_nonscalar_slot_usage(): assert cls.attributes["jog_wheels"].annotations.expected_value.value == "an integer between 0 and 4" assert cls.attributes["volume_faders"].annotations.expected_value.value == "an integer between 0 and 8" - assert cls.attributes["tempo"].examples == [Example(value='120.0'), Example(value='144.0'), Example(value='126.8'), - Example(value='102.6')] + assert cls.attributes["tempo"].examples == [ + Example(value="120.0"), + Example(value="144.0"), + Example(value="126.8"), + Example(value="102.6"), + ] assert cls.attributes["tempo"].annotations.expected_value.value == "a number between 0 and 200" assert cls.attributes["tempo"].annotations.preferred_unit.value == "BPM" assert cls.attributes["tempo"].domain_of == ["DJController"] - assert cls.slot_usage["tempo"].domain_of == [] \ No newline at end of file + assert cls.slot_usage["tempo"].domain_of == [] diff --git a/tests/test_utils/test_version.py b/tests/test_utils/test_version.py index 7df18eab..49ef1c4a 100644 --- a/tests/test_utils/test_version.py +++ b/tests/test_utils/test_version.py @@ -2,6 +2,7 @@ import linkml_runtime + class TestPackageVersion(unittest.TestCase): def test_package_version(self): self.assertIsNotNone(linkml_runtime.__version__) diff --git a/tests/test_utils/test_walker_utils.py b/tests/test_utils/test_walker_utils.py index 195b1100..e2307a79 100644 --- a/tests/test_utils/test_walker_utils.py +++ b/tests/test_utils/test_walker_utils.py @@ -11,8 +11,8 @@ from tests.test_utils import INPUT_DIR from tests.test_utils.test_ruleutils import yaml_loader -SCHEMA = os.path.join(INPUT_DIR, 'kitchen_sink_noimports.yaml') -INSERTED_COMMENT = 'INSERTED COMMENT' +SCHEMA = os.path.join(INPUT_DIR, "kitchen_sink_noimports.yaml") +INSERTED_COMMENT = "INSERTED COMMENT" def count_classes(obj: YAMLRoot) -> int: @@ -83,7 +83,7 @@ def tr(in_obj: YAMLRoot): self.assertNotEqual(orig, obj) self.assertEqual(obj_tr, obj) obj = SchemaDefinition(**as_dict(obj)) - assert INSERTED_COMMENT in obj.classes['Person'].comments + assert INSERTED_COMMENT in obj.classes["Person"].comments def test_non_mutating_transformer(self): """ @@ -109,8 +109,8 @@ def tr(in_obj: YAMLRoot): self.assertNotEqual(obj_tr, orig) self.assertNotEqual(obj_tr, obj) obj_tr = SchemaDefinition(**as_dict(obj_tr)) - assert INSERTED_COMMENT in obj_tr.classes['Person'].comments + assert INSERTED_COMMENT in obj_tr.classes["Person"].comments -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/tests/test_utils/test_yaml_utils.py b/tests/test_utils/test_yaml_utils.py index e10553cb..6ad93b9a 100644 --- a/tests/test_utils/test_yaml_utils.py +++ b/tests/test_utils/test_yaml_utils.py @@ -11,19 +11,19 @@ class YamlUtilTestCase(TestEnvironmentTestCase): env = env def test_dupcheck_loader(self): - """ Make sure the duplicate checker finds duplicates """ - with open(env.input_path('yaml1.yaml')) as f: + """Make sure the duplicate checker finds duplicates""" + with open(env.input_path("yaml1.yaml")) as f: y1 = yaml.safe_load(f) - self.assertEqual(17, y1['f1']) - with open(env.input_path('yaml1.yaml')) as f: + self.assertEqual(17, y1["f1"]) + with open(env.input_path("yaml1.yaml")) as f: with self.assertRaises(ValueError): yaml.load(f, DupCheckYamlLoader) - with open(env.input_path('yaml2.yaml')) as f: + with open(env.input_path("yaml2.yaml")) as f: with self.assertRaises(ValueError): yaml.load(f, DupCheckYamlLoader) - with open(env.input_path('schema1.yaml')) as f: + with open(env.input_path("schema1.yaml")) as f: s1 = yaml.load(f, DupCheckYamlLoader) - self.assertEqual('schema1', s1['name']) + self.assertEqual("schema1", s1["name"]) def test_line_numbers(self): s = """ @@ -36,16 +36,14 @@ def test_line_numbers(self): """ obj = yaml.load(s, DupCheckYamlLoader) cases = [ - ('name', 1), - ('info', 2), - ('x', 3), - ('l', 6), + ("name", 1), + ("info", 2), + ("x", 3), + ("l", 6), ] key_to_lines = [(k, k._s.line) for k in obj.keys()] self.assertCountEqual(cases, key_to_lines) - - -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() From f89d26a56c5aae9f459128be001cf89f059537ec Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 14 Oct 2024 18:16:57 -0700 Subject: [PATCH 11/17] apply ruff safe fixes --- linkml_runtime/__init__.py | 4 +- linkml_runtime/dumpers/__init__.py | 2 +- .../dumpers/delimited_file_dumper.py | 10 +-- linkml_runtime/dumpers/dumper_root.py | 3 +- linkml_runtime/dumpers/json_dumper.py | 4 +- linkml_runtime/dumpers/rdf_dumper.py | 7 +- linkml_runtime/dumpers/rdflib_dumper.py | 11 ++- linkml_runtime/dumpers/yaml_dumper.py | 3 +- linkml_runtime/index/object_index.py | 4 +- linkml_runtime/linkml_model/__init__.py | 76 +++++++++---------- linkml_runtime/linkml_model/annotations.py | 11 +-- linkml_runtime/linkml_model/datasets.py | 13 ++-- linkml_runtime/linkml_model/extensions.py | 11 ++- linkml_runtime/linkml_model/linkml_files.py | 6 +- linkml_runtime/linkml_model/mappings.py | 3 +- linkml_runtime/linkml_model/meta.py | 18 ++--- linkml_runtime/linkml_model/types.py | 3 +- linkml_runtime/linkml_model/units.py | 11 ++- linkml_runtime/linkml_model/validation.py | 15 ++-- linkml_runtime/loaders/__init__.py | 2 +- .../loaders/delimited_file_loader.py | 14 ++-- linkml_runtime/loaders/json_loader.py | 4 +- linkml_runtime/loaders/loader_root.py | 8 +- linkml_runtime/loaders/rdf_loader.py | 9 +-- linkml_runtime/loaders/rdflib_loader.py | 10 +-- linkml_runtime/loaders/requests_ssl_patch.py | 2 +- linkml_runtime/loaders/yaml_loader.py | 6 +- .../processing/referencevalidator.py | 27 ++++--- .../processing/validation_datamodel.py | 17 ++--- linkml_runtime/utils/context_utils.py | 2 +- linkml_runtime/utils/csvutils.py | 8 +- linkml_runtime/utils/enumerations.py | 2 +- linkml_runtime/utils/eval_utils.py | 4 +- linkml_runtime/utils/formatutils.py | 2 +- linkml_runtime/utils/inference_utils.py | 7 +- linkml_runtime/utils/introspection.py | 1 - linkml_runtime/utils/metamodelcore.py | 21 +++-- linkml_runtime/utils/namespaces.py | 6 +- linkml_runtime/utils/pattern.py | 2 +- linkml_runtime/utils/permissiblevalueimpl.py | 6 +- linkml_runtime/utils/ruleutils.py | 10 +-- linkml_runtime/utils/schema_as_dict.py | 2 +- linkml_runtime/utils/schema_builder.py | 4 +- linkml_runtime/utils/schemaops.py | 2 +- linkml_runtime/utils/schemaview.py | 27 +++---- linkml_runtime/utils/schemaview_cli.py | 6 +- linkml_runtime/utils/slot.py | 2 +- linkml_runtime/utils/walker_utils.py | 2 +- linkml_runtime/utils/yamlutils.py | 9 +-- tests/__init__.py | 2 +- tests/conftest.py | 1 + tests/support/clicktestcase.py | 6 +- tests/support/compare_rdf.py | 6 +- tests/support/test_environment.py | 4 +- tests/test_index/model/container_test.py | 17 ++--- tests/test_index/test_object_index.py | 6 +- tests/test_issues/models/linkml_issue_576.py | 13 ++-- tests/test_issues/models/model_817.py | 16 ++-- tests/test_issues/test_issue_1355.py | 1 + tests/test_issues/test_issue_355.py | 13 ++-- tests/test_issues/test_issue_368_enums.py | 4 +- tests/test_issues/test_issue_626.py | 2 +- tests/test_issues/test_issue_718.py | 6 +- tests/test_issues/test_issue_8.py | 2 +- tests/test_issues/test_linkml_issue_1126.py | 4 +- tests/test_issues/test_linkml_issue_1143.py | 7 +- tests/test_issues/test_linkml_issue_478.py | 2 +- tests/test_issues/test_linkml_issue_576.py | 3 +- tests/test_issues/test_linkml_issue_590.py | 1 - tests/test_issues/test_linkml_issue_817.py | 3 +- tests/test_issues/test_linkml_issue_998.py | 1 + .../test_linkml_runtime_issue_1317.py | 1 + .../test_linkml_runtime_issue_68.py | 1 + tests/test_linkml_model/test_linkml_files.py | 21 ++--- tests/test_loaders_dumpers/__init__.py | 2 +- .../loaderdumpertestcase.py | 2 +- .../models/books_normalized.py | 16 ++-- .../models/books_normalized_pydantic.py | 5 +- .../test_loaders_dumpers/models/enum_model.py | 13 ++-- .../models/kitchen_sink_pydantic.py | 5 +- .../models/node_object.py | 12 +-- .../test_loaders_dumpers/models/personinfo.py | 19 +++-- .../models/personinfo_test_issue_429.py | 10 +-- .../models/phenopackets.py | 17 ++--- .../models/termci_schema.py | 9 +-- .../test_csv_tsv_loader_dumper.py | 12 ++- tests/test_loaders_dumpers/test_dumpers.py | 12 +-- .../test_dumpers_pydantic.py | 6 +- tests/test_loaders_dumpers/test_enum.py | 5 +- tests/test_loaders_dumpers/test_issue_429.py | 5 +- tests/test_loaders_dumpers/test_loaders.py | 6 +- .../test_loaders_dumpers.py | 17 ++--- .../test_loaders_pydantic.py | 2 +- .../test_rdflib_dumper.py | 20 +++-- tests/test_processing/__init__.py | 1 - tests/test_processing/test_arrays.py | 3 +- .../test_referencevalidator.py | 21 +++-- tests/test_utils/model/inference_example.py | 19 +++-- tests/test_utils/test_context_utils.py | 4 +- tests/test_utils/test_dict_utils.py | 3 +- tests/test_utils/test_formatutils.py | 10 +-- tests/test_utils/test_inference_utils.py | 9 +-- tests/test_utils/test_introspection.py | 2 +- tests/test_utils/test_list_strings.py | 2 +- tests/test_utils/test_metamodelcore.py | 10 +-- tests/test_utils/test_pattern.py | 6 +- tests/test_utils/test_poly_dataclasses.py | 3 +- tests/test_utils/test_ruleutils.py | 3 +- tests/test_utils/test_schema_as_dict.py | 7 +- tests/test_utils/test_schemaview.py | 15 ++-- tests/test_utils/test_walker_utils.py | 3 +- 111 files changed, 439 insertions(+), 459 deletions(-) diff --git a/linkml_runtime/__init__.py b/linkml_runtime/__init__.py index a16fa884..c5ddc18f 100644 --- a/linkml_runtime/__init__.py +++ b/linkml_runtime/__init__.py @@ -1,7 +1,9 @@ from pathlib import Path + +from rdflib import OWL, RDF, RDFS, SKOS, XSD + from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.schemaview import SchemaView -from rdflib import RDF, RDFS, SKOS, XSD, OWL __all__ = [ "SchemaView", diff --git a/linkml_runtime/dumpers/__init__.py b/linkml_runtime/dumpers/__init__.py index 6a8f2fee..d69c78f5 100644 --- a/linkml_runtime/dumpers/__init__.py +++ b/linkml_runtime/dumpers/__init__.py @@ -1,9 +1,9 @@ +from linkml_runtime.dumpers.csv_dumper import CSVDumper from linkml_runtime.dumpers.json_dumper import JSONDumper from linkml_runtime.dumpers.rdf_dumper import RDFDumper from linkml_runtime.dumpers.rdflib_dumper import RDFLibDumper from linkml_runtime.dumpers.tsv_dumper import TSVDumper from linkml_runtime.dumpers.yaml_dumper import YAMLDumper -from linkml_runtime.dumpers.csv_dumper import CSVDumper json_dumper = JSONDumper() rdf_dumper = RDFDumper() diff --git a/linkml_runtime/dumpers/delimited_file_dumper.py b/linkml_runtime/dumpers/delimited_file_dumper.py index 92016fb4..e7f681de 100644 --- a/linkml_runtime/dumpers/delimited_file_dumper.py +++ b/linkml_runtime/dumpers/delimited_file_dumper.py @@ -2,16 +2,16 @@ import json from abc import ABC, abstractmethod from typing import Union + +from json_flattener import flatten_to_csv from pydantic import BaseModel from linkml_runtime.dumpers.dumper_root import Dumper from linkml_runtime.dumpers.json_dumper import JSONDumper -from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.linkml_model.meta import SlotDefinitionName, SchemaDefinition -from linkml_runtime.utils.schemaview import SchemaView - +from linkml_runtime.linkml_model.meta import SchemaDefinition, SlotDefinitionName from linkml_runtime.utils.csvutils import GlobalConfig, get_configmap -from json_flattener import flatten_to_csv +from linkml_runtime.utils.schemaview import SchemaView +from linkml_runtime.utils.yamlutils import YAMLRoot class DelimitedFileDumper(Dumper, ABC): diff --git a/linkml_runtime/dumpers/dumper_root.py b/linkml_runtime/dumpers/dumper_root.py index d31225c8..c1ffd944 100644 --- a/linkml_runtime/dumpers/dumper_root.py +++ b/linkml_runtime/dumpers/dumper_root.py @@ -1,9 +1,10 @@ from abc import ABC, abstractmethod from typing import Union -from linkml_runtime.utils.yamlutils import YAMLRoot from pydantic import BaseModel +from linkml_runtime.utils.yamlutils import YAMLRoot + class Dumper(ABC): """Abstract base class for all dumpers""" diff --git a/linkml_runtime/dumpers/json_dumper.py b/linkml_runtime/dumpers/json_dumper.py index c7cbbd1e..f5c97c98 100644 --- a/linkml_runtime/dumpers/json_dumper.py +++ b/linkml_runtime/dumpers/json_dumper.py @@ -1,16 +1,16 @@ import json from decimal import Decimal from typing import Union -from pydantic import BaseModel from deprecated.classic import deprecated +from jsonasobj2 import JsonObj +from pydantic import BaseModel from linkml_runtime.dumpers.dumper_root import Dumper from linkml_runtime.utils import formatutils from linkml_runtime.utils.context_utils import CONTEXTS_PARAM_TYPE from linkml_runtime.utils.formatutils import remove_empty_items from linkml_runtime.utils.yamlutils import YAMLRoot, as_json_object -from jsonasobj2 import JsonObj class JSONDumper(Dumper): diff --git a/linkml_runtime/dumpers/rdf_dumper.py b/linkml_runtime/dumpers/rdf_dumper.py index 7d734cb1..08110be1 100644 --- a/linkml_runtime/dumpers/rdf_dumper.py +++ b/linkml_runtime/dumpers/rdf_dumper.py @@ -1,13 +1,12 @@ import json from typing import Optional, Union -from pydantic import BaseModel from hbreader import hbread +from pydantic import BaseModel from rdflib import Graph - from linkml_runtime.dumpers.dumper_root import Dumper -from linkml_runtime.utils.context_utils import CONTEXTS_PARAM_TYPE, CONTEXT_TYPE +from linkml_runtime.utils.context_utils import CONTEXT_TYPE, CONTEXTS_PARAM_TYPE from linkml_runtime.utils.formatutils import remove_empty_items from linkml_runtime.utils.yamlutils import YAMLRoot @@ -31,7 +30,7 @@ def as_rdf_graph( :return: rdflib Graph containing element """ if contexts is None: - raise Exception(f"Must pass in JSON-LD context via contexts parameter") + raise Exception("Must pass in JSON-LD context via contexts parameter") if isinstance(contexts, list): inp_contexts = [json.loads(hbread(c)) for c in contexts] else: diff --git a/linkml_runtime/dumpers/rdflib_dumper.py b/linkml_runtime/dumpers/rdflib_dumper.py index 9eafde43..08e9d501 100644 --- a/linkml_runtime/dumpers/rdflib_dumper.py +++ b/linkml_runtime/dumpers/rdflib_dumper.py @@ -1,17 +1,16 @@ import logging import urllib -from typing import Optional, Any, Union -from pydantic import BaseModel +from typing import Any, Optional, Union from curies import Converter -from rdflib import Graph, URIRef, XSD -from rdflib.term import Node, BNode, Literal +from pydantic import BaseModel +from rdflib import XSD, Graph, URIRef from rdflib.namespace import RDF - +from rdflib.term import BNode, Literal, Node from linkml_runtime.dumpers.dumper_root import Dumper from linkml_runtime.linkml_model import SlotDefinition -from linkml_runtime.utils.schemaview import SchemaView, ElementName, PermissibleValue, PermissibleValueText +from linkml_runtime.utils.schemaview import ElementName, PermissibleValue, PermissibleValueText, SchemaView from linkml_runtime.utils.yamlutils import YAMLRoot logger = logging.getLogger(__name__) diff --git a/linkml_runtime/dumpers/yaml_dumper.py b/linkml_runtime/dumpers/yaml_dumper.py index 4929fe5e..39cc10c4 100644 --- a/linkml_runtime/dumpers/yaml_dumper.py +++ b/linkml_runtime/dumpers/yaml_dumper.py @@ -1,5 +1,6 @@ -import yaml from typing import Union + +import yaml from pydantic import BaseModel from linkml_runtime.dumpers.dumper_root import Dumper diff --git a/linkml_runtime/index/object_index.py b/linkml_runtime/index/object_index.py index 6e9ebf89..1cf583ec 100644 --- a/linkml_runtime/index/object_index.py +++ b/linkml_runtime/index/object_index.py @@ -9,10 +9,10 @@ a proxy for a domain object that "knows" its place in the index """ -import logging import inspect +import logging +from collections.abc import Iterator, Mapping from typing import Any, Union -from collections.abc import Mapping, Iterator from linkml_runtime import SchemaView from linkml_runtime.utils import eval_utils diff --git a/linkml_runtime/linkml_model/__init__.py b/linkml_runtime/linkml_model/__init__.py index 6caf947a..c43bc4af 100644 --- a/linkml_runtime/linkml_model/__init__.py +++ b/linkml_runtime/linkml_model/__init__.py @@ -1,48 +1,48 @@ -from .types import ( - String, - Integer, - Boolean, - Float, - Double, - Decimal, - Time, - Date, - Datetime, - Uriorcurie, - Uri, - Ncname, - Objectidentifier, - Nodeidentifier, -) -from .extensions import Extension, Extensible -from .annotations import Annotation, Annotatable +from .annotations import Annotatable, Annotation +from .extensions import Extensible, Extension from .meta import ( - ElementName, - SchemaDefinitionName, - TypeDefinitionName, - SubsetDefinitionName, - DefinitionName, - EnumDefinitionName, - SlotDefinitionName, - ClassDefinitionName, - PrefixPrefixPrefix, - LocalNameLocalNameSource, + AltDescription, AltDescriptionSource, - PermissibleValueText, - Element, - SchemaDefinition, - TypeDefinition, - SubsetDefinition, + ClassDefinition, + ClassDefinitionName, Definition, + DefinitionName, + Element, + ElementName, EnumDefinition, - SlotDefinition, - ClassDefinition, - Prefix, - LocalName, + EnumDefinitionName, Example, - AltDescription, + LocalName, + LocalNameLocalNameSource, PermissibleValue, + PermissibleValueText, + Prefix, + PrefixPrefixPrefix, PvFormulaOptions, + SchemaDefinition, + SchemaDefinitionName, + SlotDefinition, + SlotDefinitionName, + SubsetDefinition, + SubsetDefinitionName, + TypeDefinition, + TypeDefinitionName, +) +from .types import ( + Boolean, + Date, + Datetime, + Decimal, + Double, + Float, + Integer, + Ncname, + Nodeidentifier, + Objectidentifier, + String, + Time, + Uri, + Uriorcurie, ) __all__ = [ diff --git a/linkml_runtime/linkml_model/annotations.py b/linkml_runtime/linkml_model/annotations.py index 35a0e14d..d430d530 100644 --- a/linkml_runtime/linkml_model/annotations.py +++ b/linkml_runtime/linkml_model/annotations.py @@ -6,15 +6,16 @@ # description: Annotations mixin # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot from rdflib import URIRef + from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.metamodelcore import empty_dict +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot + from .extensions import AnyValue, Extension, ExtensionTag metamodel_version = "1.7.0" diff --git a/linkml_runtime/linkml_model/datasets.py b/linkml_runtime/linkml_model/datasets.py index 80897f2c..ce482d28 100644 --- a/linkml_runtime/linkml_model/datasets.py +++ b/linkml_runtime/linkml_model/datasets.py @@ -6,17 +6,16 @@ # description: A datamodel for datasets # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef + from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.utils.metamodelcore import URI, URIorCURIE, XSDDateTime +from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from linkml_runtime.utils.metamodelcore import URI, URIorCURIE, XSDDateTime, empty_list +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str metamodel_version = "1.7.0" version = None diff --git a/linkml_runtime/linkml_model/extensions.py b/linkml_runtime/linkml_model/extensions.py index 7c9c3cf7..63edf470 100644 --- a/linkml_runtime/linkml_model/extensions.py +++ b/linkml_runtime/linkml_model/extensions.py @@ -6,16 +6,15 @@ # description: Extension mixin # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot from rdflib import URIRef + from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.utils.metamodelcore import URIorCURIE +from linkml_runtime.utils.metamodelcore import URIorCURIE, empty_dict +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot metamodel_version = "1.7.0" version = "2.0.0" diff --git a/linkml_runtime/linkml_model/linkml_files.py b/linkml_runtime/linkml_model/linkml_files.py index 5fc76e79..4eb84a32 100644 --- a/linkml_runtime/linkml_model/linkml_files.py +++ b/linkml_runtime/linkml_model/linkml_files.py @@ -1,8 +1,8 @@ -from pathlib import Path +from dataclasses import dataclass from enum import Enum, auto -from typing import Optional, Union, NamedTuple +from pathlib import Path +from typing import NamedTuple, Optional, Union from urllib.parse import urljoin -from dataclasses import dataclass import requests from rdflib import Namespace diff --git a/linkml_runtime/linkml_model/mappings.py b/linkml_runtime/linkml_model/mappings.py index b9059930..b9888b86 100644 --- a/linkml_runtime/linkml_model/mappings.py +++ b/linkml_runtime/linkml_model/mappings.py @@ -6,12 +6,11 @@ # description: LinkML model for mappings # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses from typing import Optional, Union -from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.metamodelcore import URIorCURIE +from linkml_runtime.utils.slot import Slot metamodel_version = "1.7.0" version = "2.0.0" diff --git a/linkml_runtime/linkml_model/meta.py b/linkml_runtime/linkml_model/meta.py index e7e149b3..3075b843 100644 --- a/linkml_runtime/linkml_model/meta.py +++ b/linkml_runtime/linkml_model/meta.py @@ -30,22 +30,22 @@ # [https://w3id.org/linkml/is_a](https://w3id.org/linkml/is_a) # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from jsonasobj2 import as_dict -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.formatutils import sfx -from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from jsonasobj2 import as_dict from rdflib import URIRef + from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from linkml_runtime.utils.formatutils import sfx +from linkml_runtime.utils.metamodelcore import URI, Bool, NCName, URIorCURIE, XSDDateTime, empty_dict, empty_list +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str + from .annotations import Annotation, AnnotationTag from .extensions import Extension, ExtensionTag from .units import UnitOfMeasure -from linkml_runtime.utils.metamodelcore import Bool, NCName, URI, URIorCURIE, XSDDateTime metamodel_version = "1.7.0" version = None diff --git a/linkml_runtime/linkml_model/types.py b/linkml_runtime/linkml_model/types.py index 65864fd0..8edc121c 100644 --- a/linkml_runtime/linkml_model/types.py +++ b/linkml_runtime/linkml_model/types.py @@ -6,17 +6,16 @@ # description: Shared type definitions for the core LinkML mode and metamodel # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.metamodelcore import ( + URI, Bool, Curie, Decimal, ElementIdentifier, NCName, NodeIdentifier, - URI, URIorCURIE, XSDDate, XSDDateTime, diff --git a/linkml_runtime/linkml_model/units.py b/linkml_runtime/linkml_model/units.py index af39289a..715849ef 100644 --- a/linkml_runtime/linkml_model/units.py +++ b/linkml_runtime/linkml_model/units.py @@ -6,16 +6,15 @@ # description: Units datamodel # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list -from linkml_runtime.utils.yamlutils import YAMLRoot from rdflib import URIRef + from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.utils.metamodelcore import URIorCURIE +from linkml_runtime.utils.metamodelcore import URIorCURIE, empty_list +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot metamodel_version = "1.7.0" version = None diff --git a/linkml_runtime/linkml_model/validation.py b/linkml_runtime/linkml_model/validation.py index 423a0036..a225abc8 100644 --- a/linkml_runtime/linkml_model/validation.py +++ b/linkml_runtime/linkml_model/validation.py @@ -6,18 +6,17 @@ # description: A datamodel for reports on data, based on SHACL # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from jsonasobj2 import as_dict -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list -from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from jsonasobj2 import as_dict from rdflib import URIRef + from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.utils.metamodelcore import NodeIdentifier +from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from linkml_runtime.utils.metamodelcore import NodeIdentifier, empty_list +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot metamodel_version = "1.7.0" version = None diff --git a/linkml_runtime/loaders/__init__.py b/linkml_runtime/loaders/__init__.py index 1fe4395d..ce41824a 100644 --- a/linkml_runtime/loaders/__init__.py +++ b/linkml_runtime/loaders/__init__.py @@ -1,9 +1,9 @@ +from linkml_runtime.loaders.csv_loader import CSVLoader from linkml_runtime.loaders.json_loader import JSONLoader from linkml_runtime.loaders.rdf_loader import RDFLoader from linkml_runtime.loaders.rdflib_loader import RDFLibLoader from linkml_runtime.loaders.tsv_loader import TSVLoader from linkml_runtime.loaders.yaml_loader import YAMLLoader -from linkml_runtime.loaders.csv_loader import CSVLoader json_loader = JSONLoader() rdf_loader = RDFLoader() diff --git a/linkml_runtime/loaders/delimited_file_loader.py b/linkml_runtime/loaders/delimited_file_loader.py index 4dccc813..15fdd55d 100644 --- a/linkml_runtime/loaders/delimited_file_loader.py +++ b/linkml_runtime/loaders/delimited_file_loader.py @@ -1,16 +1,16 @@ -from abc import ABC, abstractmethod -from json_flattener import unflatten_from_csv, GlobalConfig import json +from abc import ABC, abstractmethod from typing import Union -from linkml_runtime.utils.yamlutils import YAMLRoot + +from json_flattener import GlobalConfig, unflatten_from_csv from pydantic import BaseModel -from linkml_runtime.loaders.loader_root import Loader +from linkml_runtime.linkml_model.meta import SchemaDefinition, SlotDefinitionName from linkml_runtime.loaders.json_loader import JSONLoader -from linkml_runtime.linkml_model.meta import SlotDefinitionName, SchemaDefinition -from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.schemaview import SchemaView +from linkml_runtime.loaders.loader_root import Loader from linkml_runtime.utils.csvutils import get_configmap +from linkml_runtime.utils.schemaview import SchemaView +from linkml_runtime.utils.yamlutils import YAMLRoot class DelimitedFileLoader(Loader, ABC): diff --git a/linkml_runtime/loaders/json_loader.py b/linkml_runtime/loaders/json_loader.py index 4ee1c555..39069ed3 100644 --- a/linkml_runtime/loaders/json_loader.py +++ b/linkml_runtime/loaders/json_loader.py @@ -1,12 +1,12 @@ import json import logging -from typing import Union, TextIO, Optional +from typing import Optional, TextIO, Union from hbreader import FileInfo +from pydantic import BaseModel from linkml_runtime.loaders.loader_root import Loader from linkml_runtime.utils.yamlutils import YAMLRoot -from pydantic import BaseModel logger = logging.getLogger(__name__) diff --git a/linkml_runtime/loaders/loader_root.py b/linkml_runtime/loaders/loader_root.py index 8a5c92b7..b73ecaf3 100644 --- a/linkml_runtime/loaders/loader_root.py +++ b/linkml_runtime/loaders/loader_root.py @@ -1,13 +1,13 @@ from abc import ABC, abstractmethod -from typing import TextIO, Union, Optional, Callable, Any from logging import getLogger +from typing import Any, Callable, Optional, TextIO, Union -from pydantic import BaseModel from hbreader import FileInfo, hbread -from jsonasobj2 import as_dict, JsonObj +from jsonasobj2 import JsonObj, as_dict +from pydantic import BaseModel -from linkml_runtime.utils.yamlutils import YAMLRoot from linkml_runtime import URI_TO_LOCAL +from linkml_runtime.utils.yamlutils import YAMLRoot CACHE_SIZE = 1024 diff --git a/linkml_runtime/loaders/rdf_loader.py b/linkml_runtime/loaders/rdf_loader.py index f8322e19..523fbd67 100644 --- a/linkml_runtime/loaders/rdf_loader.py +++ b/linkml_runtime/loaders/rdf_loader.py @@ -1,14 +1,13 @@ -from typing import Union, TextIO, Optional +from typing import Optional, TextIO, Union from hbreader import FileInfo - -from linkml_runtime.loaders.loader_root import Loader -from linkml_runtime.utils.context_utils import CONTEXTS_PARAM_TYPE -from linkml_runtime.utils.yamlutils import YAMLRoot from pydantic import BaseModel from rdflib import Graph +from linkml_runtime.loaders.loader_root import Loader from linkml_runtime.loaders.requests_ssl_patch import no_ssl_verification +from linkml_runtime.utils.context_utils import CONTEXTS_PARAM_TYPE +from linkml_runtime.utils.yamlutils import YAMLRoot # TODO: figure out what mime types go here. I think we can find the complete set in rdflib RDF_MIME_TYPES = "application/x-turtle;q=0.9, application/rdf+n3;q=0.8, application/rdf+xml;q=0.5, text/plain;q=0.1" diff --git a/linkml_runtime/loaders/rdflib_loader.py b/linkml_runtime/loaders/rdflib_loader.py index e0708701..206975e9 100644 --- a/linkml_runtime/loaders/rdflib_loader.py +++ b/linkml_runtime/loaders/rdflib_loader.py @@ -2,21 +2,21 @@ import urllib from copy import copy from dataclasses import dataclass -from typing import Optional, Any, Union, TextIO +from typing import Any, Optional, TextIO, Union from curies import Converter from hbreader import FileInfo +from pydantic import BaseModel from rdflib import Graph, URIRef -from rdflib.term import BNode, Literal from rdflib.namespace import RDF +from rdflib.term import BNode, Literal -from linkml_runtime import MappingError, DataNotFoundError -from linkml_runtime.linkml_model import ClassDefinitionName, TypeDefinition, EnumDefinition, ClassDefinition +from linkml_runtime import DataNotFoundError, MappingError +from linkml_runtime.linkml_model import ClassDefinition, ClassDefinitionName, EnumDefinition, TypeDefinition from linkml_runtime.loaders.loader_root import Loader from linkml_runtime.utils.formatutils import underscore from linkml_runtime.utils.schemaview import SchemaView, SlotDefinition from linkml_runtime.utils.yamlutils import YAMLRoot -from pydantic import BaseModel logger = logging.getLogger(__name__) diff --git a/linkml_runtime/loaders/requests_ssl_patch.py b/linkml_runtime/loaders/requests_ssl_patch.py index fb5d88cd..db4639ef 100644 --- a/linkml_runtime/loaders/requests_ssl_patch.py +++ b/linkml_runtime/loaders/requests_ssl_patch.py @@ -1,5 +1,5 @@ -import warnings import contextlib +import warnings import requests from urllib3.exceptions import InsecureRequestWarning diff --git a/linkml_runtime/loaders/yaml_loader.py b/linkml_runtime/loaders/yaml_loader.py index 8c90b580..30bb0821 100644 --- a/linkml_runtime/loaders/yaml_loader.py +++ b/linkml_runtime/loaders/yaml_loader.py @@ -1,13 +1,13 @@ import os from io import StringIO -from typing import Union, TextIO, Optional +from typing import Optional, TextIO, Union import yaml from hbreader import FileInfo +from pydantic import BaseModel from linkml_runtime.loaders.loader_root import Loader -from linkml_runtime.utils.yamlutils import YAMLRoot, DupCheckYamlLoader -from pydantic import BaseModel +from linkml_runtime.utils.yamlutils import DupCheckYamlLoader, YAMLRoot class YAMLLoader(Loader): diff --git a/linkml_runtime/processing/referencevalidator.py b/linkml_runtime/processing/referencevalidator.py index 72777fbb..3bd218d0 100644 --- a/linkml_runtime/processing/referencevalidator.py +++ b/linkml_runtime/processing/referencevalidator.py @@ -6,16 +6,16 @@ - `Part 6`_ of LinkML specification """ +import datetime import decimal import re import sys +from collections.abc import Iterator from copy import copy from dataclasses import dataclass, field -import datetime from decimal import Decimal from enum import Enum -from typing import Any, Optional, Union, TextIO -from collections.abc import Iterator +from typing import Any, Optional, TextIO, Union import click import yaml @@ -23,39 +23,38 @@ from linkml_runtime import SchemaView from linkml_runtime.dumpers import yaml_dumper from linkml_runtime.linkml_model import ( - SlotDefinition, ClassDefinition, - EnumDefinition, - TypeDefinition, Element, + EnumDefinition, SchemaDefinition, + SlotDefinition, SlotDefinitionName, + TypeDefinition, ) from linkml_runtime.linkml_model.meta import ( AnonymousClassExpression, AnonymousSlotExpression, - ClassRule, ClassDefinitionName, + ClassRule, ) from linkml_runtime.processing.validation_datamodel import ( ConstraintType, - ValidationResult, ValidationConfiguration, + ValidationResult, ) from linkml_runtime.utils import yamlutils from linkml_runtime.utils.eval_utils import eval_expr from linkml_runtime.utils.metamodelcore import ( - XSDTime, - Bool, - XSDDate, - URIorCURIE, URI, - NCName, + Bool, ElementIdentifier, + NCName, NodeIdentifier, + URIorCURIE, + XSDDate, + XSDTime, ) - # Mapping from either XSD types or LinkML type.base fields to Python types; # (the coerced type is the last element of the tuple, the others are # acceptable types) diff --git a/linkml_runtime/processing/validation_datamodel.py b/linkml_runtime/processing/validation_datamodel.py index fc9dcee9..ee6cc3a2 100644 --- a/linkml_runtime/processing/validation_datamodel.py +++ b/linkml_runtime/processing/validation_datamodel.py @@ -6,24 +6,23 @@ # description: A datamodel for data validation results. # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from jsonasobj2 import as_dict -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union + +from jsonasobj2 import as_dict +from rdflib import URIRef + from linkml_runtime.linkml_model.meta import ( EnumDefinition, PermissibleValue, ) - +from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from linkml_runtime.utils.metamodelcore import Bool, URIorCURIE, empty_dict, empty_list from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict from linkml_runtime.utils.yamlutils import ( YAMLRoot, ) -from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from rdflib import URIRef -from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.utils.metamodelcore import Bool, URIorCURIE metamodel_version = "1.7.0" version = None diff --git a/linkml_runtime/utils/context_utils.py b/linkml_runtime/utils/context_utils.py index 91e40748..a52acc18 100644 --- a/linkml_runtime/utils/context_utils.py +++ b/linkml_runtime/utils/context_utils.py @@ -1,7 +1,7 @@ import json import os from io import TextIOWrapper -from typing import Optional, Union, Any, Callable +from typing import Any, Callable, Optional, Union import yaml from jsonasobj2 import JsonObj, loads diff --git a/linkml_runtime/utils/csvutils.py b/linkml_runtime/utils/csvutils.py index cd66ab4a..9a5455a1 100644 --- a/linkml_runtime/utils/csvutils.py +++ b/linkml_runtime/utils/csvutils.py @@ -1,7 +1,9 @@ import logging -from json_flattener import GlobalConfig, KeyConfig, Serializer + +from json_flattener import KeyConfig, Serializer from json_flattener.flattener import CONFIGMAP -from linkml_runtime.linkml_model.meta import SlotDefinitionName, ClassDefinitionName + +from linkml_runtime.linkml_model.meta import ClassDefinitionName, SlotDefinitionName from linkml_runtime.utils.schemaview import SchemaView logger = logging.getLogger(__name__) @@ -32,7 +34,7 @@ def get_configmap(schemaview: SchemaView, index_slot: SlotDefinitionName) -> CON else: logger.warning(f"Index slot range not to class: {slot.range}") else: - logger.warning(f"Index slot or schema not specified") + logger.warning("Index slot or schema not specified") return {} diff --git a/linkml_runtime/utils/enumerations.py b/linkml_runtime/utils/enumerations.py index c6d26f50..3b26cce2 100644 --- a/linkml_runtime/utils/enumerations.py +++ b/linkml_runtime/utils/enumerations.py @@ -1,5 +1,5 @@ from dataclasses import fields -from typing import Union, Optional +from typing import Optional, Union from linkml_runtime.utils.metamodelcore import Curie from linkml_runtime.utils.yamlutils import YAMLRoot diff --git a/linkml_runtime/utils/eval_utils.py b/linkml_runtime/utils/eval_utils.py index 6ca62916..fd41af5f 100644 --- a/linkml_runtime/utils/eval_utils.py +++ b/linkml_runtime/utils/eval_utils.py @@ -150,10 +150,10 @@ def _get(obj: Any, k: str, recurse=True) -> Any: elif isinstance(node, ast.Set): # sets are not part of the language; we use {x} as notation for x if len(node.elts) != 1: - raise ValueError(f"The {{}} must enclose a single variable") + raise ValueError("The {} must enclose a single variable") e = node.elts[0] if not isinstance(e, ast.Name): - raise ValueError(f"The {{}} must enclose a variable") + raise ValueError("The {} must enclose a variable") v = eval_(e, bindings) if v is None: raise UnsetValueException(f"{e} is not set") diff --git a/linkml_runtime/utils/formatutils.py b/linkml_runtime/utils/formatutils.py index 5df60a56..11e6b2aa 100644 --- a/linkml_runtime/utils/formatutils.py +++ b/linkml_runtime/utils/formatutils.py @@ -2,7 +2,7 @@ from decimal import Decimal from typing import Any -from jsonasobj2 import JsonObj, as_dict, is_list, is_dict, items +from jsonasobj2 import JsonObj, as_dict, is_dict, is_list, items ws_pattern = re.compile(r"\s+") us_pattern = re.compile(r"_+") diff --git a/linkml_runtime/utils/inference_utils.py b/linkml_runtime/utils/inference_utils.py index 2cd452bd..c8243cee 100644 --- a/linkml_runtime/utils/inference_utils.py +++ b/linkml_runtime/utils/inference_utils.py @@ -1,11 +1,12 @@ import logging -from dataclasses import field, dataclass +from dataclasses import dataclass, field from enum import Enum -from typing import Union, Optional, Any, Callable +from typing import Any, Callable, Optional, Union + from jsonasobj2 import JsonObj, items from linkml_runtime import SchemaView -from linkml_runtime.linkml_model import SlotDefinitionName, PermissibleValue, ClassDefinitionName +from linkml_runtime.linkml_model import ClassDefinitionName, PermissibleValue, SlotDefinitionName from linkml_runtime.utils.enumerations import EnumDefinitionImpl from linkml_runtime.utils.eval_utils import eval_expr from linkml_runtime.utils.walker_utils import traverse_object_tree diff --git a/linkml_runtime/utils/introspection.py b/linkml_runtime/utils/introspection.py index 41c0d5f2..32b99e66 100644 --- a/linkml_runtime/utils/introspection.py +++ b/linkml_runtime/utils/introspection.py @@ -9,7 +9,6 @@ from linkml_runtime.utils.schemaview import SchemaView from linkml_runtime.utils.yamlutils import YAMLRoot - SCHEMA_PATH_VAR = "schema_path" diff --git a/linkml_runtime/utils/metamodelcore.py b/linkml_runtime/utils/metamodelcore.py index 0eb7c764..e9a80acd 100644 --- a/linkml_runtime/utils/metamodelcore.py +++ b/linkml_runtime/utils/metamodelcore.py @@ -3,19 +3,16 @@ import re from dataclasses import field from decimal import Decimal -from typing import Union, Optional +from typing import Optional, Union from urllib.parse import urlparse -from rdflib import Literal, BNode, URIRef +from rdflib import BNode, Literal, URIRef from rdflib.namespace import is_ncname from rdflib.term import Identifier as rdflib_Identifier from linkml_runtime.utils.namespaces import Namespaces from linkml_runtime.utils.strictness import is_strict - -from linkml_runtime.utils.uri_validator import validate_uri -from linkml_runtime.utils.uri_validator import validate_uri_reference -from linkml_runtime.utils.uri_validator import validate_curie +from linkml_runtime.utils.uri_validator import validate_curie, validate_uri, validate_uri_reference # Reference Decimal to make sure it stays in the imports _z = Decimal(1) @@ -236,9 +233,9 @@ def __new__(cls, value: Union[str, datetime.time, datetime.datetime, Literal]) - if not isinstance(value, datetime.time): value = datetime.time.fromisoformat(value) return datetime.time.fromisoformat(str(value)).isoformat() - except TypeError as e: + except TypeError: pass - except ValueError as e: + except ValueError: pass if not is_strict(): return str(value) @@ -269,9 +266,9 @@ def __new__(cls, value: Union[str, datetime.date, Literal]) -> str: if not isinstance(value, datetime.date): value = datetime.date.fromisoformat(str(value)) return value.isoformat() - except TypeError as e: + except TypeError: pass - except ValueError as e: + except ValueError: pass if not is_strict(): return str(value) @@ -304,9 +301,9 @@ def __new__(cls, value: Union[str, datetime.datetime, Literal]) -> str: if not isinstance(value, datetime.datetime): value = datetime.datetime.fromisoformat(value) # Note that this handles non 'T' format as well return value.isoformat() - except TypeError as e: + except TypeError: pass - except ValueError as e: + except ValueError: pass if not is_strict(): return str(value) diff --git a/linkml_runtime/utils/namespaces.py b/linkml_runtime/utils/namespaces.py index f81863b9..eebc145d 100644 --- a/linkml_runtime/utils/namespaces.py +++ b/linkml_runtime/utils/namespaces.py @@ -2,13 +2,13 @@ from typing import Any, Optional, Union from prefixcommons import curie_util -from rdflib import Namespace, URIRef, Graph, BNode +from prefixmaps.io.parser import load_context +from rdflib import BNode, Graph, Namespace, URIRef from rdflib.namespace import is_ncname from requests.structures import CaseInsensitiveDict -from prefixmaps.io.parser import load_context -from linkml_runtime.utils.yamlutils import TypedNode from linkml_runtime.utils.uri_validator import validate_uri +from linkml_runtime.utils.yamlutils import TypedNode META_NS = "meta" META_URI = "https://w3id.org/linkml/meta" diff --git a/linkml_runtime/utils/pattern.py b/linkml_runtime/utils/pattern.py index 9ae0c0c4..f221b7ce 100644 --- a/linkml_runtime/utils/pattern.py +++ b/linkml_runtime/utils/pattern.py @@ -1,5 +1,5 @@ -from functools import lru_cache import re +from functools import lru_cache # We might want to deprecate this method in favor of PatternResolver in the future diff --git a/linkml_runtime/utils/permissiblevalueimpl.py b/linkml_runtime/utils/permissiblevalueimpl.py index bdc846ec..7c444470 100644 --- a/linkml_runtime/utils/permissiblevalueimpl.py +++ b/linkml_runtime/utils/permissiblevalueimpl.py @@ -1,12 +1,12 @@ from dataclasses import dataclass -from typing import Any, Optional, ClassVar, Union +from typing import Any, ClassVar, Optional, Union from rdflib import URIRef +from utils.enumerations import EnumDefinitionImpl from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.utils.metamodelcore import URIorCURIE, empty_list, URI +from linkml_runtime.utils.metamodelcore import URI, URIorCURIE, empty_list from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from utils.enumerations import EnumDefinitionImpl LINKML = CurieNamespace("linkml", "https://w3id.org/linkml/") diff --git a/linkml_runtime/utils/ruleutils.py b/linkml_runtime/utils/ruleutils.py index abce64e3..b9755b4a 100644 --- a/linkml_runtime/utils/ruleutils.py +++ b/linkml_runtime/utils/ruleutils.py @@ -1,17 +1,17 @@ import logging from dataclasses import dataclass -from linkml_runtime.utils.schemaview import SchemaView from linkml_runtime.linkml_model.meta import ( + AnonymousClassExpression, ClassDefinition, - SlotDefinition, - ClassExpression, ClassDefinitionName, + ClassExpression, ClassRule, - AnonymousClassExpression, - SlotExpression, + SlotDefinition, SlotDefinitionName, + SlotExpression, ) +from linkml_runtime.utils.schemaview import SchemaView logger = logging.getLogger(__name__) diff --git a/linkml_runtime/utils/schema_as_dict.py b/linkml_runtime/utils/schema_as_dict.py index a5ee1468..7268dda5 100644 --- a/linkml_runtime/utils/schema_as_dict.py +++ b/linkml_runtime/utils/schema_as_dict.py @@ -2,8 +2,8 @@ import yaml -from linkml_runtime.linkml_model.meta import SchemaDefinition from linkml_runtime.dumpers import json_dumper +from linkml_runtime.linkml_model.meta import SchemaDefinition def _remove_names(obj: Any, parent: Optional[str]) -> Any: diff --git a/linkml_runtime/utils/schema_builder.py b/linkml_runtime/utils/schema_builder.py index d4d73910..fcb69921 100644 --- a/linkml_runtime/utils/schema_builder.py +++ b/linkml_runtime/utils/schema_builder.py @@ -1,5 +1,5 @@ from dataclasses import dataclass -from typing import Union, Optional +from typing import Optional, Union from linkml_runtime.linkml_model import ( ClassDefinition, @@ -89,7 +89,7 @@ def add_class( if isinstance(s, SlotDefinition): cls.attributes[s.name] = s else: - raise ValueError(f"If use_attributes=True then slots must be SlotDefinitions") + raise ValueError("If use_attributes=True then slots must be SlotDefinitions") else: if slots is not None: for s in slots: diff --git a/linkml_runtime/utils/schemaops.py b/linkml_runtime/utils/schemaops.py index af58203f..624fbf9b 100644 --- a/linkml_runtime/utils/schemaops.py +++ b/linkml_runtime/utils/schemaops.py @@ -1,6 +1,6 @@ from typing import Union -from linkml_runtime.utils.schemaview import SchemaView, CLASS_NAME +from linkml_runtime.utils.schemaview import CLASS_NAME, SchemaView CLASS_NAME_OR_LIST = Union[CLASS_NAME, list[CLASS_NAME]] diff --git a/linkml_runtime/utils/schemaview.py b/linkml_runtime/utils/schemaview.py index 4b38a5d7..691f0181 100644 --- a/linkml_runtime/utils/schemaview.py +++ b/linkml_runtime/utils/schemaview.py @@ -1,23 +1,24 @@ +import collections +import logging import os import uuid -import logging -import collections -from functools import lru_cache -from copy import copy, deepcopy +import warnings from collections import defaultdict, deque +from collections.abc import Mapping +from copy import copy, deepcopy +from enum import Enum +from functools import lru_cache from pathlib import Path from typing import Optional, TypeVar -from collections.abc import Mapping -import warnings -from linkml_runtime.utils.namespaces import Namespaces from deprecated.classic import deprecated -from linkml_runtime.utils.context_utils import parse_import_map, map_import -from linkml_runtime.utils.formatutils import is_empty, underscore, camelcase -from linkml_runtime.utils.pattern import PatternResolver -from linkml_runtime.linkml_model.meta import * + from linkml_runtime.exceptions import OrderingError -from enum import Enum +from linkml_runtime.linkml_model.meta import * +from linkml_runtime.utils.context_utils import map_import, parse_import_map +from linkml_runtime.utils.formatutils import camelcase, is_empty, underscore +from linkml_runtime.utils.namespaces import Namespaces +from linkml_runtime.utils.pattern import PatternResolver logger = logging.getLogger(__name__) @@ -1066,7 +1067,7 @@ def slot_is_true_for_metadata_property(self, slot_name: SlotDefinition, metadata if type(getattr(induced_slot, metadata_property)) == bool: return True if getattr(induced_slot, metadata_property) else False else: - raise ValueError(f'property to introspect must be of type "boolean"') + raise ValueError('property to introspect must be of type "boolean"') def get_element(self, element: Union[ElementName, Element], imports=True) -> Element: """ diff --git a/linkml_runtime/utils/schemaview_cli.py b/linkml_runtime/utils/schemaview_cli.py index e6f6726a..16454124 100644 --- a/linkml_runtime/utils/schemaview_cli.py +++ b/linkml_runtime/utils/schemaview_cli.py @@ -1,14 +1,14 @@ +import builtins import io import json import logging +import click from json_flattener import flatten_to_csv +from linkml_runtime.dumpers import json_dumper, yaml_dumper from linkml_runtime.linkml_model import Element from linkml_runtime.utils.schemaview import SchemaView -from linkml_runtime.dumpers import json_dumper, yaml_dumper -import click -import builtins logger = logging.getLogger(__name__) diff --git a/linkml_runtime/utils/slot.py b/linkml_runtime/utils/slot.py index 4a823058..a09e4344 100644 --- a/linkml_runtime/utils/slot.py +++ b/linkml_runtime/utils/slot.py @@ -1,6 +1,6 @@ from dataclasses import dataclass -from typing import Optional, Any from re import Pattern +from typing import Any, Optional from rdflib import URIRef diff --git a/linkml_runtime/utils/walker_utils.py b/linkml_runtime/utils/walker_utils.py index c9f8953d..ebebed63 100644 --- a/linkml_runtime/utils/walker_utils.py +++ b/linkml_runtime/utils/walker_utils.py @@ -3,7 +3,7 @@ """ from copy import deepcopy -from typing import Callable, Union, Any +from typing import Any, Callable, Union from linkml_runtime.utils.yamlutils import YAMLRoot diff --git a/linkml_runtime/utils/yamlutils.py b/linkml_runtime/utils/yamlutils.py index ece911d5..aa8f3cd6 100644 --- a/linkml_runtime/utils/yamlutils.py +++ b/linkml_runtime/utils/yamlutils.py @@ -1,14 +1,13 @@ -import pdb +import re +import textwrap from copy import copy from json import JSONDecoder -from typing import Union, Any, Optional, Callable from pprint import pformat -import textwrap -import re +from typing import Any, Callable, Optional, Union import yaml from deprecated.classic import deprecated -from jsonasobj2 import JsonObj, as_json, as_dict, JsonObjTypes, items +from jsonasobj2 import JsonObj, JsonObjTypes, as_dict, as_json, items from rdflib import Graph, URIRef from yaml.constructor import ConstructorError diff --git a/tests/__init__.py b/tests/__init__.py index 27b677c3..00d221da 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,5 @@ -import logging import configparser +import logging # Global testing control variables import os diff --git a/tests/conftest.py b/tests/conftest.py index 5df38531..faea77ef 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ from pathlib import Path + import pytest import requests_cache diff --git a/tests/support/clicktestcase.py b/tests/support/clicktestcase.py index b771597f..9c3d958c 100644 --- a/tests/support/clicktestcase.py +++ b/tests/support/clicktestcase.py @@ -1,12 +1,12 @@ import os import shlex import unittest -from typing import Union, Optional, Callable +from typing import Callable, Optional, Union from warnings import warn -from tests.support.dirutils import make_and_clear_directory from tests.support.compare_rdf import compare_rdf -from tests.support.test_environment import TestEnvironmentTestCase, TestEnvironment +from tests.support.dirutils import make_and_clear_directory +from tests.support.test_environment import TestEnvironment, TestEnvironmentTestCase class ClickTestCase(TestEnvironmentTestCase): diff --git a/tests/support/compare_rdf.py b/tests/support/compare_rdf.py index 0d20171a..ea6118d7 100644 --- a/tests/support/compare_rdf.py +++ b/tests/support/compare_rdf.py @@ -1,10 +1,10 @@ import re from contextlib import redirect_stdout from io import StringIO -from typing import Union, Optional +from typing import Optional, Union -from rdflib import Graph, RDF -from rdflib.compare import to_isomorphic, IsomorphicGraph, graph_diff +from rdflib import RDF, Graph +from rdflib.compare import IsomorphicGraph, graph_diff, to_isomorphic from linkml_runtime import LINKML diff --git a/tests/support/test_environment.py b/tests/support/test_environment.py index 1b21e44f..77558a37 100644 --- a/tests/support/test_environment.py +++ b/tests/support/test_environment.py @@ -9,7 +9,7 @@ from importlib import import_module from io import StringIO from pathlib import Path -from typing import Optional, Callable, Union +from typing import Callable, Optional, Union from tests.support.dirutils import are_dir_trees_equal from tests.support.mismatchlog import MismatchLog @@ -79,7 +79,7 @@ def _check_changed(test_file: str, runtime_file: str) -> None: from tests import USE_LOCAL_IMPORT_MAP if USE_LOCAL_IMPORT_MAP and not TestEnvironment.import_map_warning_emitted: - print(f"WARNING: USE_LOCAL_IMPORT_MAP must be reset to False before completing submission.") + print("WARNING: USE_LOCAL_IMPORT_MAP must be reset to False before completing submission.") TestEnvironment.import_map_warning_emitted = True def clear_log(self) -> None: diff --git a/tests/test_index/model/container_test.py b/tests/test_index/model/container_test.py index 124a6dee..443c13a8 100644 --- a/tests/test_index/model/container_test.py +++ b/tests/test_index/model/container_test.py @@ -6,20 +6,19 @@ # description: Information about people, based on [schema.org](http://schema.org) # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses import re -from jsonasobj2 import as_dict -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from jsonasobj2 import as_dict from rdflib import URIRef + +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.utils.metamodelcore import Bool, XSDDate +from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from linkml_runtime.utils.metamodelcore import Bool, XSDDate, empty_dict, empty_list +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str metamodel_version = "1.7.0" version = None diff --git a/tests/test_index/test_object_index.py b/tests/test_index/test_object_index.py index 1e967f65..701a3c78 100644 --- a/tests/test_index/test_object_index.py +++ b/tests/test_index/test_object_index.py @@ -1,11 +1,11 @@ import os import unittest -from linkml_runtime import SchemaView -from linkml_runtime.loaders import yaml_loader import tests.test_index.model.container_test as src_dm +from linkml_runtime import SchemaView from linkml_runtime.index.object_index import ObjectIndex, ProxyObject -from linkml_runtime.utils.inference_utils import infer_slot_value, Config +from linkml_runtime.loaders import yaml_loader +from linkml_runtime.utils.inference_utils import Config, infer_slot_value from tests.test_index import INPUT_DIR SCHEMA = os.path.join(INPUT_DIR, "container_test.yaml") diff --git a/tests/test_issues/models/linkml_issue_576.py b/tests/test_issues/models/linkml_issue_576.py index e9d8b61c..68bd953d 100644 --- a/tests/test_issues/models/linkml_issue_576.py +++ b/tests/test_issues/models/linkml_issue_576.py @@ -6,17 +6,16 @@ # description: # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from rdflib import URIRef -from linkml_runtime.utils.curienamespace import CurieNamespace + from linkml_runtime.linkml_model.types import String -from linkml_runtime.utils.metamodelcore import URIorCURIE +from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.metamodelcore import URIorCURIE, empty_dict, empty_list +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str metamodel_version = "1.7.0" version = None diff --git a/tests/test_issues/models/model_817.py b/tests/test_issues/models/model_817.py index 10d216a5..d33d0ca2 100644 --- a/tests/test_issues/models/model_817.py +++ b/tests/test_issues/models/model_817.py @@ -6,18 +6,18 @@ # description: # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from jsonasobj2 import as_dict -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from jsonasobj2 import as_dict from rdflib import URIRef + +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from linkml_runtime.utils.metamodelcore import empty_dict, empty_list +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str metamodel_version = "1.7.0" version = None diff --git a/tests/test_issues/test_issue_1355.py b/tests/test_issues/test_issue_1355.py index d800a629..450989e2 100644 --- a/tests/test_issues/test_issue_1355.py +++ b/tests/test_issues/test_issue_1355.py @@ -5,6 +5,7 @@ """ from unittest import TestCase + from linkml_runtime.utils.metamodelcore import URI diff --git a/tests/test_issues/test_issue_355.py b/tests/test_issues/test_issue_355.py index 7f00512f..4d60c0f7 100644 --- a/tests/test_issues/test_issue_355.py +++ b/tests/test_issues/test_issue_355.py @@ -6,17 +6,16 @@ # description: # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from jsonasobj2 import JsonObj -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot +from jsonasobj2 import JsonObj from rdflib import URIRef + from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.utils.metamodelcore import URIorCURIE +from linkml_runtime.utils.metamodelcore import URIorCURIE, empty_dict +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot metamodel_version = "1.7.0" diff --git a/tests/test_issues/test_issue_368_enums.py b/tests/test_issues/test_issue_368_enums.py index bac7982e..1b189e66 100644 --- a/tests/test_issues/test_issue_368_enums.py +++ b/tests/test_issues/test_issue_368_enums.py @@ -1,10 +1,10 @@ import unittest from typing import Callable -from linkml_runtime.dumpers import json_dumper, yaml_dumper, rdf_dumper +from linkml_runtime.dumpers import json_dumper, rdf_dumper, yaml_dumper +from linkml_runtime.utils.compile_python import compile_python from tests.test_issues.environment import env from tests.test_loaders_dumpers.loaderdumpertestcase import LoaderDumperTestCase -from linkml_runtime.utils.compile_python import compile_python class Issue368TestCase(LoaderDumperTestCase): diff --git a/tests/test_issues/test_issue_626.py b/tests/test_issues/test_issue_626.py index 30bf5c0e..58b24379 100644 --- a/tests/test_issues/test_issue_626.py +++ b/tests/test_issues/test_issue_626.py @@ -24,7 +24,7 @@ def test_it(self): error_thrown = False try: from_yaml(model_txt, SchemaDefinition) - except TypeError as e: + except TypeError: error_thrown = True self.assertFalse(error_thrown, msg="Type error should not be thrown") diff --git a/tests/test_issues/test_issue_718.py b/tests/test_issues/test_issue_718.py index 6b4968b8..5f7855bd 100644 --- a/tests/test_issues/test_issue_718.py +++ b/tests/test_issues/test_issue_718.py @@ -1,10 +1,10 @@ -import pytest from dataclasses import dataclass -from typing import Optional, ClassVar +from typing import ClassVar, Optional +import pytest import yaml -from linkml_runtime.utils.yamlutils import YAMLRoot, DupCheckYamlLoader +from linkml_runtime.utils.yamlutils import DupCheckYamlLoader, YAMLRoot @pytest.mark.xfail(reason="Reporting line numbers should happen at load time not when instantiating dataclasses") diff --git a/tests/test_issues/test_issue_8.py b/tests/test_issues/test_issue_8.py index fec1904b..0cc26cf2 100644 --- a/tests/test_issues/test_issue_8.py +++ b/tests/test_issues/test_issue_8.py @@ -1,6 +1,6 @@ import unittest -from linkml_runtime.linkml_model import SchemaDefinition, SlotDefinition, ClassDefinition +from linkml_runtime.linkml_model import ClassDefinition, SchemaDefinition, SlotDefinition from linkml_runtime.loaders import yaml_loader from linkml_runtime.utils.yamlutils import YAMLRoot from tests.test_issues.environment import env diff --git a/tests/test_issues/test_linkml_issue_1126.py b/tests/test_issues/test_linkml_issue_1126.py index fdada767..5d69bede 100644 --- a/tests/test_issues/test_linkml_issue_1126.py +++ b/tests/test_issues/test_linkml_issue_1126.py @@ -1,8 +1,8 @@ import unittest from unittest import TestCase -from linkml_runtime.utils.schemaview import SchemaView -from linkml_runtime.linkml_model import ClassDefinitionName +from linkml_runtime.linkml_model import ClassDefinitionName +from linkml_runtime.utils.schemaview import SchemaView from tests.test_issues.environment import env diff --git a/tests/test_issues/test_linkml_issue_1143.py b/tests/test_issues/test_linkml_issue_1143.py index 0945fac1..ce961bd6 100644 --- a/tests/test_issues/test_linkml_issue_1143.py +++ b/tests/test_issues/test_linkml_issue_1143.py @@ -3,16 +3,15 @@ from unittest import TestCase from linkml_runtime.linkml_model import ( - SchemaDefinition, ClassDefinition, - SlotDefinition, EnumDefinition, - TypeDefinition, Prefix, + SchemaDefinition, + SlotDefinition, SubsetDefinition, + TypeDefinition, ) from linkml_runtime.utils.schemaview import SchemaView - from tests.test_issues.environment import env ELEMENTS = ["prefixes", "classes", "slots", "enums", "types", "subsets"] diff --git a/tests/test_issues/test_linkml_issue_478.py b/tests/test_issues/test_linkml_issue_478.py index 83573469..61032d63 100644 --- a/tests/test_issues/test_linkml_issue_478.py +++ b/tests/test_issues/test_linkml_issue_478.py @@ -1,7 +1,7 @@ import unittest from unittest import TestCase -from linkml_runtime.utils.schemaview import SchemaView +from linkml_runtime.utils.schemaview import SchemaView from tests.test_issues.environment import env diff --git a/tests/test_issues/test_linkml_issue_576.py b/tests/test_issues/test_linkml_issue_576.py index 5adc3b9e..cf63bcd5 100644 --- a/tests/test_issues/test_linkml_issue_576.py +++ b/tests/test_issues/test_linkml_issue_576.py @@ -4,9 +4,8 @@ import rdflib from linkml_runtime.dumpers import rdflib_dumper -from linkml_runtime.loaders import yaml_loader, rdflib_loader +from linkml_runtime.loaders import rdflib_loader, yaml_loader from linkml_runtime.utils.schemaview import SchemaView - from tests.test_issues.environment import env from tests.test_issues.models.linkml_issue_576 import Dataset diff --git a/tests/test_issues/test_linkml_issue_590.py b/tests/test_issues/test_linkml_issue_590.py index 330f9987..defadf94 100644 --- a/tests/test_issues/test_linkml_issue_590.py +++ b/tests/test_issues/test_linkml_issue_590.py @@ -1,7 +1,6 @@ import unittest from linkml_runtime.utils.schemaview import SchemaView - from tests.test_issues.environment import env SCHEMA = env.input_path("test_linkml_issue_590.yaml") diff --git a/tests/test_issues/test_linkml_issue_817.py b/tests/test_issues/test_linkml_issue_817.py index 8cb4f800..5178b5c3 100644 --- a/tests/test_issues/test_linkml_issue_817.py +++ b/tests/test_issues/test_linkml_issue_817.py @@ -2,9 +2,8 @@ from linkml_runtime.dumpers import yaml_dumper from linkml_runtime.loaders import yaml_loader - from tests.test_issues.environment import env -from tests.test_issues.models.model_817 import Container, Person, VitalStatusEnum, PersonNoId +from tests.test_issues.models.model_817 import Container, Person, PersonNoId, VitalStatusEnum class Issue817TestCase(unittest.TestCase): diff --git a/tests/test_issues/test_linkml_issue_998.py b/tests/test_issues/test_linkml_issue_998.py index b847c762..26521a93 100644 --- a/tests/test_issues/test_linkml_issue_998.py +++ b/tests/test_issues/test_linkml_issue_998.py @@ -1,4 +1,5 @@ import pytest + from linkml_runtime.utils.schemaview import SchemaView schema = """ diff --git a/tests/test_issues/test_linkml_runtime_issue_1317.py b/tests/test_issues/test_linkml_runtime_issue_1317.py index fbfbad0b..a03fbaae 100644 --- a/tests/test_issues/test_linkml_runtime_issue_1317.py +++ b/tests/test_issues/test_linkml_runtime_issue_1317.py @@ -1,4 +1,5 @@ import unittest + from linkml_runtime import SchemaView URL = ( diff --git a/tests/test_issues/test_linkml_runtime_issue_68.py b/tests/test_issues/test_linkml_runtime_issue_68.py index 9933563c..166d45af 100644 --- a/tests/test_issues/test_linkml_runtime_issue_68.py +++ b/tests/test_issues/test_linkml_runtime_issue_68.py @@ -1,6 +1,7 @@ import logging import unittest from unittest import TestCase + from linkml_runtime.utils.schemaview import SchemaView logger = logging.getLogger(__name__) diff --git a/tests/test_linkml_model/test_linkml_files.py b/tests/test_linkml_model/test_linkml_files.py index e4159f06..52103496 100644 --- a/tests/test_linkml_model/test_linkml_files.py +++ b/tests/test_linkml_model/test_linkml_files.py @@ -1,23 +1,24 @@ -import pytest -import requests -from pathlib import Path +from importlib.util import find_spec from itertools import product +from pathlib import Path from urllib.parse import urlparse -from importlib.util import find_spec + +import pytest +import requests HAVE_REQUESTS_CACHE = bool(find_spec("requests_cache")) from linkml_runtime.linkml_model.linkml_files import ( - Source, - Format, - _Path, - URL_FOR, - LOCAL_PATH_FOR, - LOCAL_BASE, GITHUB_IO_PATH_FOR, GITHUB_PATH_FOR, + LOCAL_BASE, + LOCAL_PATH_FOR, META_ONLY, + URL_FOR, + Format, ReleaseTag, + Source, + _Path, ) EXPECTED_FORMATS = [ diff --git a/tests/test_loaders_dumpers/__init__.py b/tests/test_loaders_dumpers/__init__.py index 68b771be..d86898be 100644 --- a/tests/test_loaders_dumpers/__init__.py +++ b/tests/test_loaders_dumpers/__init__.py @@ -1,7 +1,7 @@ import os +from pathlib import Path from rdflib import Namespace -from pathlib import Path HTTP_TEST_PORT = 8000 HTTPS_TEST_PORT = 8443 diff --git a/tests/test_loaders_dumpers/loaderdumpertestcase.py b/tests/test_loaders_dumpers/loaderdumpertestcase.py index 4aa0f03a..966afb30 100644 --- a/tests/test_loaders_dumpers/loaderdumpertestcase.py +++ b/tests/test_loaders_dumpers/loaderdumpertestcase.py @@ -3,12 +3,12 @@ from urllib.parse import urlparse from hbreader import FileInfo, hbread +from pydantic import BaseModel import tests.environment as test_base from linkml_runtime.dumpers import yaml_dumper from linkml_runtime.loaders.loader_root import Loader from linkml_runtime.utils.yamlutils import YAMLRoot -from pydantic import BaseModel from tests.support.test_environment import TestEnvironment, TestEnvironmentTestCase diff --git a/tests/test_loaders_dumpers/models/books_normalized.py b/tests/test_loaders_dumpers/models/books_normalized.py index 8be09a73..02a1ad5f 100644 --- a/tests/test_loaders_dumpers/models/books_normalized.py +++ b/tests/test_loaders_dumpers/models/books_normalized.py @@ -6,18 +6,18 @@ # description: example # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from jsonasobj2 import as_dict -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from jsonasobj2 import as_dict from rdflib import URIRef + +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from linkml_runtime.utils.metamodelcore import empty_dict, empty_list +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str metamodel_version = "1.7.0" diff --git a/tests/test_loaders_dumpers/models/books_normalized_pydantic.py b/tests/test_loaders_dumpers/models/books_normalized_pydantic.py index 04bc1687..cf2bf996 100644 --- a/tests/test_loaders_dumpers/models/books_normalized_pydantic.py +++ b/tests/test_loaders_dumpers/models/books_normalized_pydantic.py @@ -1,7 +1,10 @@ from __future__ import annotations + from enum import Enum from typing import Optional -from pydantic import BaseModel as BaseModel, Field + +from pydantic import BaseModel as BaseModel +from pydantic import Field metamodel_version = "None" version = "None" diff --git a/tests/test_loaders_dumpers/models/enum_model.py b/tests/test_loaders_dumpers/models/enum_model.py index 8a809305..d351af20 100644 --- a/tests/test_loaders_dumpers/models/enum_model.py +++ b/tests/test_loaders_dumpers/models/enum_model.py @@ -6,17 +6,16 @@ # description: # license: -import dataclasses -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef -from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue +from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot metamodel_version = "1.7.0" diff --git a/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py b/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py index ee4e4247..44a173b5 100644 --- a/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py +++ b/tests/test_loaders_dumpers/models/kitchen_sink_pydantic.py @@ -1,8 +1,11 @@ from __future__ import annotations + from datetime import date from enum import Enum from typing import Any, Optional -from pydantic import BaseModel as BaseModel, Field + +from pydantic import BaseModel as BaseModel +from pydantic import Field metamodel_version = "None" version = "None" diff --git a/tests/test_loaders_dumpers/models/node_object.py b/tests/test_loaders_dumpers/models/node_object.py index d7683432..72c90b53 100644 --- a/tests/test_loaders_dumpers/models/node_object.py +++ b/tests/test_loaders_dumpers/models/node_object.py @@ -6,16 +6,16 @@ # description: Abstractions for working with RDF and RDFS triples # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from jsonasobj2 import as_dict -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str +from jsonasobj2 import as_dict from rdflib import URIRef + from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.metamodelcore import empty_list +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str metamodel_version = "1.7.0" diff --git a/tests/test_loaders_dumpers/models/personinfo.py b/tests/test_loaders_dumpers/models/personinfo.py index 3cc754d0..f5ce826a 100644 --- a/tests/test_loaders_dumpers/models/personinfo.py +++ b/tests/test_loaders_dumpers/models/personinfo.py @@ -6,21 +6,20 @@ # description: Information about people, based on [schema.org](http://schema.org) # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses import re -from jsonasobj2 import as_dict -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from jsonasobj2 import as_dict from rdflib import URIRef -from linkml_runtime.utils.curienamespace import CurieNamespace + +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.linkml_model.types import Decimal, Uri, Uriorcurie -from linkml_runtime.utils.metamodelcore import Bool, Decimal, XSDDate +from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from linkml_runtime.utils.metamodelcore import Bool, Decimal, XSDDate, empty_dict, empty_list +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str metamodel_version = "1.7.0" version = None diff --git a/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py b/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py index e3916290..210b8951 100644 --- a/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py +++ b/tests/test_loaders_dumpers/models/personinfo_test_issue_429.py @@ -6,15 +6,15 @@ # description: # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from rdflib import URIRef + from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.metamodelcore import empty_dict +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str metamodel_version = "1.7.0" version = None diff --git a/tests/test_loaders_dumpers/models/phenopackets.py b/tests/test_loaders_dumpers/models/phenopackets.py index 91b20969..a5cc1c5a 100644 --- a/tests/test_loaders_dumpers/models/phenopackets.py +++ b/tests/test_loaders_dumpers/models/phenopackets.py @@ -6,19 +6,18 @@ # description: Automatic translation of phenopackets protobuf to LinkML. Status: EXPERIMENTAL. # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from jsonasobj2 import as_dict -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str -from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from jsonasobj2 import as_dict from rdflib import URIRef + +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.utils.metamodelcore import Bool +from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from linkml_runtime.utils.metamodelcore import Bool, empty_dict, empty_list +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str metamodel_version = "1.7.0" version = None diff --git a/tests/test_loaders_dumpers/models/termci_schema.py b/tests/test_loaders_dumpers/models/termci_schema.py index be50770e..2b0388b3 100644 --- a/tests/test_loaders_dumpers/models/termci_schema.py +++ b/tests/test_loaders_dumpers/models/termci_schema.py @@ -6,15 +6,14 @@ # description: Terminology Code Index model # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.metamodelcore import empty_list, empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot from rdflib import URIRef + from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.utils.metamodelcore import URI, URIorCURIE +from linkml_runtime.utils.metamodelcore import URI, URIorCURIE, empty_dict, empty_list +from linkml_runtime.utils.yamlutils import YAMLRoot metamodel_version = "1.7.0" diff --git a/tests/test_loaders_dumpers/test_csv_tsv_loader_dumper.py b/tests/test_loaders_dumpers/test_csv_tsv_loader_dumper.py index 06a53455..0c04a3ad 100644 --- a/tests/test_loaders_dumpers/test_csv_tsv_loader_dumper.py +++ b/tests/test_loaders_dumpers/test_csv_tsv_loader_dumper.py @@ -1,18 +1,16 @@ -import os -import unittest import json import logging +import os +import unittest from jsonasobj2 import as_json_obj -from linkml_runtime.dumpers import json_dumper, yaml_dumper -from linkml_runtime.loaders import yaml_loader +from linkml_runtime.dumpers import csv_dumper, json_dumper, tsv_dumper, yaml_dumper +from linkml_runtime.loaders import csv_loader, tsv_loader, yaml_loader from linkml_runtime.utils.formatutils import remove_empty_items from linkml_runtime.utils.schemaview import SchemaView -from linkml_runtime.dumpers import csv_dumper, tsv_dumper -from linkml_runtime.loaders import csv_loader, tsv_loader from linkml_runtime.utils.yamlutils import as_json_object -from tests.test_loaders_dumpers.models.books_normalized import Author, Review, Shop, Book, BookSeries +from tests.test_loaders_dumpers.models.books_normalized import Author, Book, BookSeries, Review, Shop logger = logging.getLogger(__name__) diff --git a/tests/test_loaders_dumpers/test_dumpers.py b/tests/test_loaders_dumpers/test_dumpers.py index cbcdf160..d64c6514 100644 --- a/tests/test_loaders_dumpers/test_dumpers.py +++ b/tests/test_loaders_dumpers/test_dumpers.py @@ -2,19 +2,19 @@ import unittest from typing import cast -from rdflib import Namespace, SKOS, Literal +from rdflib import SKOS, Literal, Namespace -from linkml_runtime.dumpers import yaml_dumper, json_dumper, rdf_dumper +from linkml_runtime.dumpers import json_dumper, rdf_dumper, yaml_dumper from linkml_runtime.utils.yamlutils import as_json_object from tests.support.clicktestcase import ClickTestCase from tests.test_loaders_dumpers import ( + GITHUB_LD10_CONTEXT, + GITHUB_LD11_CONTEXT, + HTTP_TEST_PORT, + HTTPS_TEST_PORT, LD_11_DIR, LD_11_SSL_SVR, LD_11_SVR, - HTTP_TEST_PORT, - HTTPS_TEST_PORT, - GITHUB_LD10_CONTEXT, - GITHUB_LD11_CONTEXT, ) from tests.test_loaders_dumpers.loaderdumpertestcase import LoaderDumperTestCase from tests.test_loaders_dumpers.models.termci_schema import ConceptReference, ConceptSystem, Package diff --git a/tests/test_loaders_dumpers/test_dumpers_pydantic.py b/tests/test_loaders_dumpers/test_dumpers_pydantic.py index 6d39bf84..93e84bf4 100644 --- a/tests/test_loaders_dumpers/test_dumpers_pydantic.py +++ b/tests/test_loaders_dumpers/test_dumpers_pydantic.py @@ -2,10 +2,10 @@ import yaml -from linkml_runtime.dumpers import yaml_dumper, json_dumper -from tests.test_loaders_dumpers.loaderdumpertestcase import LoaderDumperTestCase -from tests.test_loaders_dumpers.models.books_normalized_pydantic import Book, BookSeries, Author +from linkml_runtime.dumpers import json_dumper, yaml_dumper from linkml_runtime.utils.formatutils import remove_empty_items +from tests.test_loaders_dumpers.loaderdumpertestcase import LoaderDumperTestCase +from tests.test_loaders_dumpers.models.books_normalized_pydantic import Author, Book, BookSeries class PydanticDumpersTestCase(LoaderDumperTestCase): diff --git a/tests/test_loaders_dumpers/test_enum.py b/tests/test_loaders_dumpers/test_enum.py index ae168694..0f3c81a1 100644 --- a/tests/test_loaders_dumpers/test_enum.py +++ b/tests/test_loaders_dumpers/test_enum.py @@ -1,9 +1,10 @@ -import unittest import json +import unittest + import yaml -from linkml_runtime.loaders import json_loader from linkml_runtime.dumpers import json_dumper, yaml_dumper +from linkml_runtime.loaders import json_loader from tests.test_loaders_dumpers.models.enum_model import Organism, StateEnum diff --git a/tests/test_loaders_dumpers/test_issue_429.py b/tests/test_loaders_dumpers/test_issue_429.py index 84824d84..1c33b5b6 100644 --- a/tests/test_loaders_dumpers/test_issue_429.py +++ b/tests/test_loaders_dumpers/test_issue_429.py @@ -1,8 +1,9 @@ import os import unittest -from rdflib import Graph, Literal -from rdflib import Namespace + +from rdflib import Graph, Literal, Namespace from rdflib.namespace import RDF + from linkml_runtime.dumpers import rdflib_dumper from linkml_runtime.loaders import yaml_loader from linkml_runtime.utils.schemaview import SchemaView diff --git a/tests/test_loaders_dumpers/test_loaders.py b/tests/test_loaders_dumpers/test_loaders.py index c084ef74..72ef170c 100644 --- a/tests/test_loaders_dumpers/test_loaders.py +++ b/tests/test_loaders_dumpers/test_loaders.py @@ -1,12 +1,12 @@ import os import unittest -from typing import Union, TextIO, Optional +from typing import Optional, TextIO, Union from hbreader import FileInfo -from linkml_runtime.loaders import yaml_loader, json_loader, rdf_loader, RDFLoader +from linkml_runtime.loaders import RDFLoader, json_loader, rdf_loader, yaml_loader from linkml_runtime.utils.yamlutils import YAMLRoot -from tests.test_loaders_dumpers import LD_11_SVR, LD_11_SSL_SVR, LD_11_DIR +from tests.test_loaders_dumpers import LD_11_DIR, LD_11_SSL_SVR, LD_11_SVR from tests.test_loaders_dumpers.environment import env from tests.test_loaders_dumpers.loaderdumpertestcase import LoaderDumperTestCase from tests.test_loaders_dumpers.models.termci_schema import Package diff --git a/tests/test_loaders_dumpers/test_loaders_dumpers.py b/tests/test_loaders_dumpers/test_loaders_dumpers.py index 42194bee..68f790c1 100644 --- a/tests/test_loaders_dumpers/test_loaders_dumpers.py +++ b/tests/test_loaders_dumpers/test_loaders_dumpers.py @@ -1,21 +1,18 @@ import json +import logging import os import unittest -import logging from decimal import Decimal import yaml -from rdflib import Graph -from rdflib import Namespace +from rdflib import Graph, Namespace -from linkml_runtime.loaders import json_loader -from linkml_runtime.dumpers import rdflib_dumper, yaml_dumper, json_dumper -from linkml_runtime.loaders import yaml_loader -from linkml_runtime.loaders import rdflib_loader +from linkml_runtime.dumpers import json_dumper, rdflib_dumper, yaml_dumper +from linkml_runtime.loaders import json_loader, rdflib_loader, yaml_loader from linkml_runtime.utils.schemaview import SchemaView from tests.test_loaders_dumpers import INPUT_DIR, OUTPUT_DIR -from tests.test_loaders_dumpers.models.personinfo import Container, Person from tests.test_loaders_dumpers.models.node_object import NodeObject, Triple +from tests.test_loaders_dumpers.models.personinfo import Container, Person logger = logging.getLogger(__name__) @@ -192,7 +189,7 @@ def test_edge_cases(self): allow_unprocessed_triples=False, prefix_map=taxon_prefix_map, ) - logger.error(f"Passed unexpectedly: there are known to be unreachable triples") + logger.error("Passed unexpectedly: there are known to be unreachable triples") # removing complex range, object has a range of string view.schema.slots["object"].exactly_one_of = [] view.set_modified() @@ -213,7 +210,7 @@ def test_edge_cases(self): allow_unprocessed_triples=True, prefix_map=taxon_prefix_map, ) - logger.error(f"Passed unexpectedly: rdf:object is known to have a mix of literals and nodes") + logger.error("Passed unexpectedly: rdf:object is known to have a mix of literals and nodes") if __name__ == "__main__": diff --git a/tests/test_loaders_dumpers/test_loaders_pydantic.py b/tests/test_loaders_dumpers/test_loaders_pydantic.py index a29d5eb5..fda5fd9e 100644 --- a/tests/test_loaders_dumpers/test_loaders_pydantic.py +++ b/tests/test_loaders_dumpers/test_loaders_pydantic.py @@ -1,6 +1,6 @@ import unittest -from linkml_runtime.loaders import yaml_loader, json_loader +from linkml_runtime.loaders import json_loader, yaml_loader from tests.test_loaders_dumpers.environment import env from tests.test_loaders_dumpers.loaderdumpertestcase import LoaderDumperTestCase from tests.test_loaders_dumpers.models.books_normalized_pydantic import BookSeries diff --git a/tests/test_loaders_dumpers/test_rdflib_dumper.py b/tests/test_loaders_dumpers/test_rdflib_dumper.py index ba18e7a9..542c6607 100644 --- a/tests/test_loaders_dumpers/test_rdflib_dumper.py +++ b/tests/test_loaders_dumpers/test_rdflib_dumper.py @@ -1,27 +1,25 @@ +import logging import os import unittest -import logging from pathlib import Path from curies import Converter -from rdflib import Graph, Literal, URIRef +from rdflib import Graph, Literal, Namespace, URIRef from rdflib.namespace import RDF, SKOS, XSD -from rdflib import Namespace -from linkml_runtime import MappingError, DataNotFoundError +from linkml_runtime import DataNotFoundError, MappingError from linkml_runtime.dumpers import rdflib_dumper, yaml_dumper from linkml_runtime.linkml_model import Prefix -from linkml_runtime.loaders import yaml_loader -from linkml_runtime.loaders import rdflib_loader +from linkml_runtime.loaders import rdflib_loader, yaml_loader from linkml_runtime.utils.schemaview import SchemaView from tests.test_loaders_dumpers import INPUT_DIR, OUTPUT_DIR -from tests.test_loaders_dumpers.models.personinfo import Container, Person, Address, Organization, OrganizationType from tests.test_loaders_dumpers.models.node_object import NodeObject, Triple +from tests.test_loaders_dumpers.models.personinfo import Address, Container, Organization, OrganizationType, Person from tests.test_loaders_dumpers.models.phenopackets import ( - PhenotypicFeature, + MetaData, OntologyClass, Phenopacket, - MetaData, + PhenotypicFeature, Resource, ) @@ -369,7 +367,7 @@ def test_edge_cases(self): allow_unprocessed_triples=False, prefix_map=taxon_prefix_map, ) - logger.error(f"Passed unexpectedly: there are known to be unreachable triples") + logger.error("Passed unexpectedly: there are known to be unreachable triples") # removing complex range, object has a range of string view.schema.slots["object"].exactly_one_of = [] view.set_modified() @@ -390,7 +388,7 @@ def test_edge_cases(self): allow_unprocessed_triples=True, prefix_map=taxon_prefix_map, ) - logger.error(f"Passed unexpectedly: rdf:object is known to have a mix of literals and nodes") + logger.error("Passed unexpectedly: rdf:object is known to have a mix of literals and nodes") def test_phenopackets(self): view = SchemaView(str(Path(INPUT_DIR) / "phenopackets" / "phenopackets.yaml")) diff --git a/tests/test_processing/__init__.py b/tests/test_processing/__init__.py index ad98ac1b..ff131072 100644 --- a/tests/test_processing/__init__.py +++ b/tests/test_processing/__init__.py @@ -1,6 +1,5 @@ import os - TESTING_DIR = os.path.abspath(os.path.dirname(__file__)) INPUT_DIR = os.path.join(TESTING_DIR, "input") diff --git a/tests/test_processing/test_arrays.py b/tests/test_processing/test_arrays.py index 4b1f8506..f4b38aff 100644 --- a/tests/test_processing/test_arrays.py +++ b/tests/test_processing/test_arrays.py @@ -3,11 +3,10 @@ import yaml -from linkml_runtime.utils.schemaview import SchemaView - from linkml_runtime.processing.referencevalidator import ( ReferenceValidator, ) +from linkml_runtime.utils.schemaview import SchemaView from tests.test_processing import INPUT_DIR diff --git a/tests/test_processing/test_referencevalidator.py b/tests/test_processing/test_referencevalidator.py index 1593c33c..b5468ee8 100644 --- a/tests/test_processing/test_referencevalidator.py +++ b/tests/test_processing/test_referencevalidator.py @@ -1,28 +1,27 @@ +import datetime import json import unittest -import datetime -from datetime import datetime as datetime2 from collections import namedtuple from dataclasses import dataclass, field +from datetime import datetime as datetime2 from decimal import Decimal from io import StringIO from pathlib import Path -from typing import Optional, Any, Union +from typing import Any, Optional, Union import yaml -from linkml_runtime.dumpers import yaml_dumper, json_dumper -from linkml_runtime.linkml_model import SlotDefinition, SlotDefinitionName, PermissibleValue -from linkml_runtime.utils.introspection import package_schemaview -from linkml_runtime.utils.schemaview import SchemaView - -from linkml_runtime.utils.schema_builder import SchemaBuilder +from linkml_runtime.dumpers import json_dumper, yaml_dumper +from linkml_runtime.linkml_model import PermissibleValue, SlotDefinition, SlotDefinitionName from linkml_runtime.processing.referencevalidator import ( + CollectionForm, + ConstraintType, ReferenceValidator, Report, - ConstraintType, - CollectionForm, ) +from linkml_runtime.utils.introspection import package_schemaview +from linkml_runtime.utils.schema_builder import SchemaBuilder +from linkml_runtime.utils.schemaview import SchemaView from linkml_runtime.utils.yamlutils import DupCheckYamlLoader diff --git a/tests/test_utils/model/inference_example.py b/tests/test_utils/model/inference_example.py index 916424f9..49fa4685 100644 --- a/tests/test_utils/model/inference_example.py +++ b/tests/test_utils/model/inference_example.py @@ -6,20 +6,19 @@ # description: This demonstrates the use of inference # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from jsonasobj2 import as_dict -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_list -from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from jsonasobj2 import as_dict from rdflib import URIRef -from linkml_runtime.utils.curienamespace import CurieNamespace + +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue from linkml_runtime.linkml_model.types import Decimal -from linkml_runtime.utils.metamodelcore import Bool, Decimal +from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from linkml_runtime.utils.metamodelcore import Bool, Decimal, empty_list +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot metamodel_version = "1.7.0" diff --git a/tests/test_utils/test_context_utils.py b/tests/test_utils/test_context_utils.py index 35342450..377e20d9 100644 --- a/tests/test_utils/test_context_utils.py +++ b/tests/test_utils/test_context_utils.py @@ -3,7 +3,7 @@ from jsonasobj2 import JsonObj, loads from linkml_runtime.utils.context_utils import merge_contexts -from tests.test_utils import METAMODEL_CONTEXT_URI, META_BASE_URI +from tests.test_utils import META_BASE_URI, METAMODEL_CONTEXT_URI json_1 = '{ "ex": "http://example.org/test/", "ex2": "http://example.org/test2/" }' json_2 = '{ "foo": 17, "@context": { "ex": "http://example.org/test3/", "ex2": {"@id": "http://example.org/test4/" }}}' @@ -50,7 +50,7 @@ def test_merge_contexts(self): ) self.assertEqual( [ - f"file://local.jsonld", + "file://local.jsonld", "https://w3id.org/linkml/meta.context.jsonld", JsonObj(ex="http://example.org/test/", ex2="http://example.org/test2/"), JsonObj(ex="http://example.org/test3/", ex2=JsonObj(**{"@id": "http://example.org/test4/"})), diff --git a/tests/test_utils/test_dict_utils.py b/tests/test_utils/test_dict_utils.py index ed4f4004..46dfc444 100644 --- a/tests/test_utils/test_dict_utils.py +++ b/tests/test_utils/test_dict_utils.py @@ -1,8 +1,7 @@ import unittest -from linkml_runtime.linkml_model.meta import ClassDefinition, SlotDefinition, ElementName - import linkml_runtime.utils.yamlutils as yutils +from linkml_runtime.linkml_model.meta import ClassDefinition, ElementName, SlotDefinition from linkml_runtime.utils.dictutils import as_simple_dict from tests.support.test_environment import TestEnvironmentTestCase from tests.test_utils.environment import env diff --git a/tests/test_utils/test_formatutils.py b/tests/test_utils/test_formatutils.py index df93abc4..9c52d9aa 100644 --- a/tests/test_utils/test_formatutils.py +++ b/tests/test_utils/test_formatutils.py @@ -5,15 +5,15 @@ from jsonasobj2 import JsonObj, as_json from linkml_runtime.utils.formatutils import ( - camelcase, - underscore, - lcamelcase, be, - split_line, - wrapped_annotation, + camelcase, is_empty, + lcamelcase, remove_empty_items, + split_line, uncamelcase, + underscore, + wrapped_annotation, ) empty_things = [None, dict(), list(), JsonObj(), JsonObj({}), JsonObj([])] diff --git a/tests/test_utils/test_inference_utils.py b/tests/test_utils/test_inference_utils.py index e856c9c4..a8048dba 100644 --- a/tests/test_utils/test_inference_utils.py +++ b/tests/test_utils/test_inference_utils.py @@ -3,16 +3,15 @@ from decimal import Decimal from linkml_runtime.utils.inference_utils import ( - infer_all_slot_values, + Config, + Policy, generate_slot_value, + infer_all_slot_values, infer_slot_value, - Policy, - Config, ) from linkml_runtime.utils.schemaview import SchemaView - -from tests.test_utils.model.inference_example import Person, Container, Evil, Relationship, AgeEnum from tests.test_utils import INPUT_DIR +from tests.test_utils.model.inference_example import AgeEnum, Container, Evil, Person, Relationship SCHEMA = os.path.join(INPUT_DIR, "inference-example.yaml") diff --git a/tests/test_utils/test_introspection.py b/tests/test_utils/test_introspection.py index bafc8a35..21588b6a 100644 --- a/tests/test_utils/test_introspection.py +++ b/tests/test_utils/test_introspection.py @@ -1,7 +1,7 @@ import unittest from linkml_runtime.linkml_model import SchemaDefinition -from linkml_runtime.utils.introspection import package_schemaview, object_class_definition +from linkml_runtime.utils.introspection import object_class_definition, package_schemaview class IntrospectionTestCase(unittest.TestCase): diff --git a/tests/test_utils/test_list_strings.py b/tests/test_utils/test_list_strings.py index 3005f33c..9690128b 100644 --- a/tests/test_utils/test_list_strings.py +++ b/tests/test_utils/test_list_strings.py @@ -1,7 +1,7 @@ import unittest -from linkml_runtime.loaders import yaml_loader from linkml_runtime.linkml_model.meta import SchemaDefinition +from linkml_runtime.loaders import yaml_loader sample = """id: http://examples.org/test name: test diff --git a/tests/test_utils/test_metamodelcore.py b/tests/test_utils/test_metamodelcore.py index b3c5c671..459b718d 100644 --- a/tests/test_utils/test_metamodelcore.py +++ b/tests/test_utils/test_metamodelcore.py @@ -3,18 +3,18 @@ from dataclasses import dataclass from jsonasobj2 import as_json -from rdflib import Literal, XSD, Graph, RDF, Namespace +from rdflib import RDF, XSD, Graph, Literal, Namespace from linkml_runtime.utils.metamodelcore import ( - NCName, + URI, Bool, + Curie, + NCName, + NodeIdentifier, URIorCURIE, - URI, XSDDate, XSDDateTime, XSDTime, - Curie, - NodeIdentifier, ) from linkml_runtime.utils.namespaces import Namespaces from linkml_runtime.utils.strictness import lax, strict diff --git a/tests/test_utils/test_pattern.py b/tests/test_utils/test_pattern.py index a5b9ee62..c61464fa 100644 --- a/tests/test_utils/test_pattern.py +++ b/tests/test_utils/test_pattern.py @@ -1,10 +1,8 @@ import unittest -from tests.test_utils.environment import env - -from linkml_runtime.utils.schemaview import SchemaView - from linkml_runtime.utils.pattern import PatternResolver, generate_patterns +from linkml_runtime.utils.schemaview import SchemaView +from tests.test_utils.environment import env class PatternTestCase(unittest.TestCase): diff --git a/tests/test_utils/test_poly_dataclasses.py b/tests/test_utils/test_poly_dataclasses.py index 1d9e386c..ad6f4340 100644 --- a/tests/test_utils/test_poly_dataclasses.py +++ b/tests/test_utils/test_poly_dataclasses.py @@ -1,5 +1,6 @@ import unittest -from linkml_runtime.linkml_model.meta import Element, LINKML + +from linkml_runtime.linkml_model.meta import LINKML, Element class PolyDataclassTestCase(unittest.TestCase): diff --git a/tests/test_utils/test_ruleutils.py b/tests/test_utils/test_ruleutils.py index 006cfe0f..317ec82b 100644 --- a/tests/test_utils/test_ruleutils.py +++ b/tests/test_utils/test_ruleutils.py @@ -3,9 +3,8 @@ from linkml_runtime.dumpers import yaml_dumper from linkml_runtime.loaders.yaml_loader import YAMLLoader +from linkml_runtime.utils.ruleutils import get_range_as_disjunction, subclass_to_rules from linkml_runtime.utils.schemaview import SchemaView -from linkml_runtime.utils.ruleutils import subclass_to_rules, get_range_as_disjunction - from tests.test_utils import INPUT_DIR SCHEMA = os.path.join(INPUT_DIR, "rules-example.yaml") diff --git a/tests/test_utils/test_schema_as_dict.py b/tests/test_utils/test_schema_as_dict.py index d5c085f7..052d8b89 100644 --- a/tests/test_utils/test_schema_as_dict.py +++ b/tests/test_utils/test_schema_as_dict.py @@ -1,13 +1,12 @@ +import logging import os import unittest -import logging from linkml_runtime.linkml_model.meta import ClassDefinition from linkml_runtime.loaders.yaml_loader import YAMLLoader -from linkml_runtime.utils.schema_as_dict import schema_as_yaml_dump, schema_as_dict -from linkml_runtime.utils.schemaview import SchemaView +from linkml_runtime.utils.schema_as_dict import schema_as_dict, schema_as_yaml_dump from linkml_runtime.utils.schema_builder import ClassDefinition, SchemaBuilder, SlotDefinition - +from linkml_runtime.utils.schemaview import SchemaView from tests.test_utils import INPUT_DIR, OUTPUT_DIR logger = logging.getLogger(__name__) diff --git a/tests/test_utils/test_schemaview.py b/tests/test_utils/test_schemaview.py index 840aadfe..7356698e 100644 --- a/tests/test_utils/test_schemaview.py +++ b/tests/test_utils/test_schemaview.py @@ -1,24 +1,25 @@ -import os import logging +import os from copy import copy from pathlib import Path + import pytest from jsonasobj2 import JsonObj from linkml_runtime.dumpers import yaml_dumper from linkml_runtime.linkml_model.meta import ( - Example, - SchemaDefinition, ClassDefinition, - SlotDefinitionName, - SlotDefinition, ClassDefinitionName, + Example, Prefix, + SchemaDefinition, + SlotDefinition, + SlotDefinitionName, ) from linkml_runtime.loaders.yaml_loader import YAMLLoader from linkml_runtime.utils.introspection import package_schemaview -from linkml_runtime.utils.schemaview import SchemaView, SchemaUsage, OrderedBy -from linkml_runtime.utils.schemaops import roll_up, roll_down +from linkml_runtime.utils.schemaops import roll_down, roll_up +from linkml_runtime.utils.schemaview import SchemaUsage, SchemaView from tests.test_utils import INPUT_DIR logger = logging.getLogger(__name__) diff --git a/tests/test_utils/test_walker_utils.py b/tests/test_utils/test_walker_utils.py index e2307a79..5137fe57 100644 --- a/tests/test_utils/test_walker_utils.py +++ b/tests/test_utils/test_walker_utils.py @@ -4,10 +4,9 @@ from jsonasobj2 import as_dict -from linkml_runtime.linkml_model import SchemaDefinition, ClassDefinition +from linkml_runtime.linkml_model import ClassDefinition, SchemaDefinition from linkml_runtime.utils.walker_utils import traverse_object_tree from linkml_runtime.utils.yamlutils import YAMLRoot - from tests.test_utils import INPUT_DIR from tests.test_utils.test_ruleutils import yaml_loader From 9707c6f04df82cc7c60298df15aed28146420e1e Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Tue, 15 Oct 2024 01:46:39 -0700 Subject: [PATCH 12/17] mid ruff linting --- linkml_runtime/linkml_model/__init__.py | 10 +++++++ linkml_runtime/utils/permissiblevalueimpl.py | 2 +- linkml_runtime/utils/ruleutils.py | 4 +-- linkml_runtime/utils/schemaops.py | 3 --- linkml_runtime/utils/schemaview.py | 27 ++++++++++++++++--- linkml_runtime/utils/yamlutils.py | 17 +++++++----- pyproject.toml | 8 +++++- tests/__init__.py | 5 +++- tests/support/test_environment.py | 7 ++--- .../test_linkml_runtime_issue_68.py | 2 +- tests/test_linkml_model/test_linkml_files.py | 5 ++-- tests/test_utils/test_schema_as_dict.py | 2 +- 12 files changed, 68 insertions(+), 24 deletions(-) diff --git a/linkml_runtime/linkml_model/__init__.py b/linkml_runtime/linkml_model/__init__.py index c43bc4af..38ab7d16 100644 --- a/linkml_runtime/linkml_model/__init__.py +++ b/linkml_runtime/linkml_model/__init__.py @@ -3,6 +3,11 @@ from .meta import ( AltDescription, AltDescriptionSource, + AnonymousClassExpression, + AnonymousEnumExpression, + AnonymousExpression, + AnonymousSlotExpression, + AnonymousTypeExpression, ClassDefinition, ClassDefinitionName, Definition, @@ -90,4 +95,9 @@ "AltDescription", "PermissibleValue", "PvFormulaOptions", + "AnonymousClassExpression", + "AnonymousEnumExpression", + "AnonymousExpression", + "AnonymousSlotExpression", + "AnonymousTypeExpression", ] diff --git a/linkml_runtime/utils/permissiblevalueimpl.py b/linkml_runtime/utils/permissiblevalueimpl.py index 7c444470..8cf5f04b 100644 --- a/linkml_runtime/utils/permissiblevalueimpl.py +++ b/linkml_runtime/utils/permissiblevalueimpl.py @@ -2,9 +2,9 @@ from typing import Any, ClassVar, Optional, Union from rdflib import URIRef -from utils.enumerations import EnumDefinitionImpl from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.enumerations import EnumDefinitionImpl from linkml_runtime.utils.metamodelcore import URI, URIorCURIE, empty_list from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str diff --git a/linkml_runtime/utils/ruleutils.py b/linkml_runtime/utils/ruleutils.py index b9755b4a..b84424ef 100644 --- a/linkml_runtime/utils/ruleutils.py +++ b/linkml_runtime/utils/ruleutils.py @@ -136,12 +136,12 @@ def subclass_to_rules( def rule_subsumed_by_class(view: SchemaView, rule, cls: ClassDefinition): - induced_slots = view.class_induced_slots(cls.name) + # induced_slots = view.class_induced_slots(cls.name) return False def remove_redundant_rules(view: SchemaView, class_name: ClassDefinitionName): - induced_slots = view.class_induced_slots(class_name) + # induced_slots = view.class_induced_slots(class_name) cls = view.get_class(class_name) redundant_rules = [] for rule in cls.rules: diff --git a/linkml_runtime/utils/schemaops.py b/linkml_runtime/utils/schemaops.py index 624fbf9b..c7a6e677 100644 --- a/linkml_runtime/utils/schemaops.py +++ b/linkml_runtime/utils/schemaops.py @@ -22,7 +22,6 @@ def roll_up(sv: SchemaView, classes: CLASS_NAME_OR_LIST = None, mixins=True, is_ dels = set() for cn in classes: c = sv.get_class(cn) - slots = [] for d in sv.class_descendants(cn, reflexive=False, mixins=mixins, is_a=is_a): for sn in sv.class_slots(d): s = sv.induced_slot(sn, class_name=d) @@ -54,7 +53,6 @@ def roll_down(sv: SchemaView, classes: list[CLASS_NAME] = None, mixins=True, is_ dels = set() for cn in classes: c = sv.get_class(cn) - slots = [] for d in sv.class_ancestors(cn, reflexive=False, mixins=mixins, is_a=is_a): for sn in sv.class_slots(d): s = sv.induced_slot(sn, class_name=d) @@ -74,6 +72,5 @@ def roll_down(sv: SchemaView, classes: list[CLASS_NAME] = None, mixins=True, is_ if is_a and c.is_a is not None: del c.is_a for d in dels: - d_cls = sv.get_class(d) sv.delete_class(d) sv.set_modified() diff --git a/linkml_runtime/utils/schemaview.py b/linkml_runtime/utils/schemaview.py index 691f0181..f8a25b86 100644 --- a/linkml_runtime/utils/schemaview.py +++ b/linkml_runtime/utils/schemaview.py @@ -6,17 +6,38 @@ from collections import defaultdict, deque from collections.abc import Mapping from copy import copy, deepcopy +from dataclasses import dataclass from enum import Enum from functools import lru_cache from pathlib import Path -from typing import Optional, TypeVar +from typing import Any, Optional, TypeVar, Union from deprecated.classic import deprecated from linkml_runtime.exceptions import OrderingError -from linkml_runtime.linkml_model.meta import * +from linkml_runtime.linkml_model import ( + AnonymousSlotExpression, + ClassDefinition, + ClassDefinitionName, + Definition, + DefinitionName, + Element, + ElementName, + EnumDefinition, + EnumDefinitionName, + PermissibleValueText, + SchemaDefinition, + SchemaDefinitionName, + SlotDefinition, + SlotDefinitionName, + SubsetDefinition, + SubsetDefinitionName, + TypeDefinition, + TypeDefinitionName, +) from linkml_runtime.utils.context_utils import map_import, parse_import_map from linkml_runtime.utils.formatutils import camelcase, is_empty, underscore +from linkml_runtime.utils.metamodelcore import URIorCURIE from linkml_runtime.utils.namespaces import Namespaces from linkml_runtime.utils.pattern import PatternResolver @@ -1117,7 +1138,7 @@ def get_uri(self, element: Union[ElementName, Element], imports=True, expand=Fal if uri is None or native: if e.from_schema is not None: schema = next(sc for sc in self.schema_map.values() if sc.id == e.from_schema) - if schema == None: + if schema is None: raise ValueError(f"Cannot find {e.from_schema} in schema_map") else: schema = self.schema_map[self.in_schema(e.name)] diff --git a/linkml_runtime/utils/yamlutils.py b/linkml_runtime/utils/yamlutils.py index aa8f3cd6..8483cc35 100644 --- a/linkml_runtime/utils/yamlutils.py +++ b/linkml_runtime/utils/yamlutils.py @@ -12,7 +12,7 @@ from yaml.constructor import ConstructorError from linkml_runtime.utils.context_utils import CONTEXTS_PARAM_TYPE, merge_contexts -from linkml_runtime.utils.formatutils import is_empty, items +from linkml_runtime.utils.formatutils import is_empty YAMLObjTypes = Union[JsonObjTypes, "YAMLRoot"] @@ -229,16 +229,20 @@ def _normalize_inlined_slot( self. = [] if not isinstance(self., list): self.extensions = [self.] - self._normalize_inlined_slot(slot_name="", slot_type=, key_name="", inlined_as_list=True, keyed=...) + self._normalize_inlined_slot( + slot_name="", slot_type=, key_name="", inlined_as_list=True, keyed=... + ) or if self. is None: self. = [] if not isinstance(self., (list, dict)): self.local_names = [self.] - self._normalize_inlined_slot(slot_name="", slot_type=, key_name="", inlined_as_list=None, keyed=...) + self._normalize_inlined_slot( + slot_name="", slot_type=, key_name="", inlined_as_list=None, keyed=... + ) - The above pattern broke when the new jsonasobj was introduced, which is why we have the normalization above. The code - below reverse engineers the above and invokes the new form + The above pattern broke when the new jsonasobj was introduced, which is why we have the normalization above. + The code below reverse engineers the above and invokes the new form """ if inlined_as_list: @@ -305,7 +309,8 @@ def _pformat(fields: dict, cls_name: str, indent: str = " ") -> str: # pformat handles everything else that isn't a YAMLRoot object, but it sure does look ugly # use it to split lines and as the thing of last resort, but otherwise indent = 0, we'll do that val_str = pformat(val, indent=0, compact=True, sort_dicts=False) - # now we indent everything except the first line by indenting and then using regex to remove just the first indent + # now we indent everything except the first line by indenting + # and then using regex to remove just the first indent val_str = re.sub(rf"\A{re.escape(indent)}", "", textwrap.indent(val_str, indent)) # now recombine with the key in a format that can be re-eval'd into an object if indent is just whitespace val_str = f"'{key}': " + val_str diff --git a/pyproject.toml b/pyproject.toml index 3c0fcdfb..42c18f52 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -100,7 +100,10 @@ select = [ "UP", # pyupgrade ] force-exclude = true -extend-ignore = ["E203"] +extend-ignore = [ + "E203", + "UP007", # until we drop 3.9 +] # -- Exclude files -- extend-exclude = [ @@ -110,6 +113,9 @@ extend-exclude = [ "notebooks/" ] +[tool.ruff.per-file-ignores] +"tests/**/**.py" = ["F841", "E501", "F842", "E741"] # I ain't fixing all that + [tool.codespell] skip = '.git,*.pdf,*.svg,./tests,pyproject.toml,*.dill,poetry.lock' # Ignore table where words could be split across rows diff --git a/tests/__init__.py b/tests/__init__.py index 00d221da..f7acd17a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,11 +1,14 @@ import configparser -import logging # Global testing control variables import os from tests.support.test_environment import MismatchAction +__all__ = [ + "MismatchAction", +] + # --------------------------------------------------------------- # DO NOT change this file. # To change the default test harness settings: diff --git a/tests/support/test_environment.py b/tests/support/test_environment.py index 77558a37..7d7d761f 100644 --- a/tests/support/test_environment.py +++ b/tests/support/test_environment.py @@ -22,7 +22,7 @@ def no_click_exit(_self, code=0): # This import has to occur here -import click +import click # noqa: E402 click.core.Context.exit = no_click_exit @@ -209,8 +209,9 @@ def generate_single_file( :return: the generator output """ # If no filter, default to identity function - if not filtr: - filtr = lambda s: s + if filtr is None: + def filtr(s): + return s filename = filename if isinstance(filename, list) else [filename] actual_file = self.root_temp_file_path(*filename) if use_testing_root else self.actual_path(*filename) expected_file = self.root_expected_path(*filename) if use_testing_root else self.expected_path(*filename) diff --git a/tests/test_issues/test_linkml_runtime_issue_68.py b/tests/test_issues/test_linkml_runtime_issue_68.py index 166d45af..083d95ce 100644 --- a/tests/test_issues/test_linkml_runtime_issue_68.py +++ b/tests/test_issues/test_linkml_runtime_issue_68.py @@ -107,7 +107,7 @@ def test_issue_68(self): s3_induced_c2 = view.induced_slot("slot3", "class2") assert not s3_induced_c2.required - assert s3_induced_c2.description == None + assert s3_induced_c2.description is None assert s3_induced_c2.range == "class0" # mixins take priority over is-a diff --git a/tests/test_linkml_model/test_linkml_files.py b/tests/test_linkml_model/test_linkml_files.py index 52103496..61cf913f 100644 --- a/tests/test_linkml_model/test_linkml_files.py +++ b/tests/test_linkml_model/test_linkml_files.py @@ -6,8 +6,6 @@ import pytest import requests -HAVE_REQUESTS_CACHE = bool(find_spec("requests_cache")) - from linkml_runtime.linkml_model.linkml_files import ( GITHUB_IO_PATH_FOR, GITHUB_PATH_FOR, @@ -21,6 +19,9 @@ _Path, ) +HAVE_REQUESTS_CACHE = bool(find_spec("requests_cache")) + + EXPECTED_FORMATS = [ (source, fmt) for source, fmt in product(Source, Format) if (fmt not in META_ONLY or source == Source.META) ] diff --git a/tests/test_utils/test_schema_as_dict.py b/tests/test_utils/test_schema_as_dict.py index 052d8b89..549aeedb 100644 --- a/tests/test_utils/test_schema_as_dict.py +++ b/tests/test_utils/test_schema_as_dict.py @@ -5,7 +5,7 @@ from linkml_runtime.linkml_model.meta import ClassDefinition from linkml_runtime.loaders.yaml_loader import YAMLLoader from linkml_runtime.utils.schema_as_dict import schema_as_dict, schema_as_yaml_dump -from linkml_runtime.utils.schema_builder import ClassDefinition, SchemaBuilder, SlotDefinition +from linkml_runtime.utils.schema_builder import SchemaBuilder, SlotDefinition from linkml_runtime.utils.schemaview import SchemaView from tests.test_utils import INPUT_DIR, OUTPUT_DIR From aa33028f3c479042af98e60cc6eb1f4ddc817ba0 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 28 Oct 2024 14:08:54 -0700 Subject: [PATCH 13/17] pyproject fixes - all rules, proper table format --- pyproject.toml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 42c18f52..fc84ed0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,37 +87,37 @@ force-exclude = ''' )/ ''' - [tool.ruff] line-length = 120 target-version = "py39" +force-exclude = true + +# -- Exclude files -- +extend-exclude = [ + "linkml_runtime/linkml_model/**/*.py", + "notebooks/**" +] +[tool.ruff.lint] # -- Rule selection -- select = [ "E", # pycodestyle errors "F", # Pyflakes "I", # isort "UP", # pyupgrade + "T100", # no debugger imports/usages ] -force-exclude = true extend-ignore = [ "E203", - "UP007", # until we drop 3.9 -] - -# -- Exclude files -- -extend-exclude = [ - "tests/**/output", - "tests/**/input", - "tests/**/__snapshots__", - "notebooks/" ] +pyupgrade.keep-runtime-typing = true # until we drop 3.9 -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "tests/**/**.py" = ["F841", "E501", "F842", "E741"] # I ain't fixing all that + [tool.codespell] -skip = '.git,*.pdf,*.svg,./tests,pyproject.toml,*.dill,poetry.lock' +skip = '.git,*.pdf,*.svg,./tests,pyproject.toml,*.dill,poetry.lock,*.ipynb' # Ignore table where words could be split across rows # Ignore shortcut specifications like [Ff]alse ignore-regex = '(\|.*\|.*\|.*\||\[[A-Z][a-z]\][a-z][a-z])' From 58b5fc711f916aa6a2a22d2836f28243b2b42eb6 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 28 Oct 2024 14:09:54 -0700 Subject: [PATCH 14/17] lint action with fixed tox --- .github/workflows/lint.yaml | 39 +++++++++++++++++++++++++++++++++++++ tox.ini | 10 ++++++---- 2 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 00000000..0005a6f7 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,39 @@ +name: Lint + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + poetry: + name: Poetry Lockfile Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install poetry + run: pipx install poetry + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: poetry + - name: Check pyproject.toml and poetry.lock + run: poetry check + + lint: + name: Lint Code + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: pip + - name: Install tox + run: python -m pip install tox + - name: Run code quality checks + run: tox -e lint \ No newline at end of file diff --git a/tox.ini b/tox.ini index 303079dc..5b660e25 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,10 @@ [tox] -envlist = py39, py310, py311, py312, py313 +envlist = + lint + py{39,310,311,312,313} isolated_build = true -[testenv] +[testenv:py] deps= pytest requests-cache @@ -10,7 +12,7 @@ deps= commands= python -m pytest -[lint] +[testenv:lint] skip_install = true deps = ruff @@ -21,7 +23,7 @@ commands = black --check --diff . codespell -[format] +[testenv:format] skip_install = true deps = ruff From 23b8ea9d84411ca66082082acc9abe3a7f99747c Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 28 Oct 2024 14:12:08 -0700 Subject: [PATCH 15/17] fixed linting --- linkml_runtime/index/object_index.py | 17 ++++------ linkml_runtime/loaders/rdf_loader.py | 3 +- linkml_runtime/loaders/rdflib_loader.py | 6 ++-- .../processing/referencevalidator.py | 2 +- .../processing/validation_datamodel.py | 6 ++-- linkml_runtime/utils/context_utils.py | 5 ++- linkml_runtime/utils/enumerations.py | 5 ++- linkml_runtime/utils/eval_utils.py | 2 +- linkml_runtime/utils/formatutils.py | 4 +-- linkml_runtime/utils/metamodelcore.py | 32 ++++++++----------- linkml_runtime/utils/permissiblevalueimpl.py | 8 ++--- linkml_runtime/utils/schemaview.py | 6 ++-- notebooks/SchemaView_Monarch.ipynb | 6 ++-- tests/__init__.py | 3 +- tests/support/test_environment.py | 2 ++ tests/test_issues/input/issue_355.py | 11 +++---- tests/test_issues/input/issue_368.py | 7 ++-- tests/test_issues/input/issue_368_imports.py | 9 +++--- .../test_loaders_dumpers/models/personinfo.py | 2 +- tests/test_utils/input/inlined_as_dict.py | 9 +++--- tests/test_utils/input/inlined_as_list.py | 9 +++--- tests/test_utils/model/inference_example.py | 2 +- 22 files changed, 78 insertions(+), 78 deletions(-) diff --git a/linkml_runtime/index/object_index.py b/linkml_runtime/index/object_index.py index 1cf583ec..d2a3ec7b 100644 --- a/linkml_runtime/index/object_index.py +++ b/linkml_runtime/index/object_index.py @@ -11,8 +11,8 @@ import inspect import logging -from collections.abc import Iterator, Mapping -from typing import Any, Union +from collections.abc import Iterator, MutableMapping +from typing import Any from linkml_runtime import SchemaView from linkml_runtime.utils import eval_utils @@ -56,9 +56,9 @@ def __init__(self, obj: YAMLRoot, schemaview: SchemaView): self._root_object = obj self._schemaview = schemaview self._class_map = schemaview.class_name_mappings() - self._source_object_cache: Mapping[str, Any] = {} - self._proxy_object_cache: Mapping[str, ProxyObject] = {} - self._child_to_parent: Mapping[str, list[tuple[str, str]]] = {} + self._source_object_cache: MutableMapping[str, Any] = {} + self._proxy_object_cache: MutableMapping[str, ProxyObject] = {} + self._child_to_parent: MutableMapping[str, list[tuple[str, str]]] = {} self._index(obj) def _index(self, obj: Any, parent_key=None, parent=None): @@ -70,16 +70,11 @@ def _index(self, obj: Any, parent_key=None, parent=None): return {k: self._index(v, parent_key, parent) for k, v in obj.items()} cls_name = type(obj).__name__ if cls_name in self._class_map: - cls = self._class_map[cls_name] pk_val = self._key(obj) self._source_object_cache[pk_val] = obj if pk_val not in self._child_to_parent: self._child_to_parent[pk_val] = [] self._child_to_parent[pk_val].append((parent_key, parent)) - # id_slot = self._schemaview.get_identifier_slot(cls.name) - # if id_slot: - # id_val = getattr(obj, id_slot.name) - # self._source_object_cache[(cls.name, id_val)] = obj for k, v in vars(obj).items(): self._index(v, k, obj) else: @@ -115,7 +110,7 @@ def bless(self, obj: Any) -> "ProxyObject": else: return ProxyObject(obj, _db=self) - def _key(self, obj: Any) -> tuple[Union[str, YAMLRoot], str]: + def _key(self, obj: Any) -> tuple[str, str]: """ Returns primary key value for this object. diff --git a/linkml_runtime/loaders/rdf_loader.py b/linkml_runtime/loaders/rdf_loader.py index 523fbd67..35eab24b 100644 --- a/linkml_runtime/loaders/rdf_loader.py +++ b/linkml_runtime/loaders/rdf_loader.py @@ -1,3 +1,4 @@ +import json from typing import Optional, TextIO, Union from hbreader import FileInfo @@ -85,7 +86,7 @@ def loader(data: Union[str, dict], _: FileInfo) -> Optional[dict]: # If the input is a graph, convert it to JSON-LD if isinstance(source, Graph): - source = pyld_jsonld_from_rdflib_graph(source) + source = pyld_jsonld_from_rdflib_graph(source) # noqa: F821 - no idea what this is jsonld_str = source.serialize(format="json-ld", indent=4) source = json.loads(jsonld_str) fmt = "json-ld" diff --git a/linkml_runtime/loaders/rdflib_loader.py b/linkml_runtime/loaders/rdflib_loader.py index 206975e9..ad1b9afd 100644 --- a/linkml_runtime/loaders/rdflib_loader.py +++ b/linkml_runtime/loaders/rdflib_loader.py @@ -55,7 +55,8 @@ def from_rdf_graph( :param schemaview: schema to which graph conforms :param target_class: class which root nodes should instantiate :param prefix_map: additional prefix mappings for data objects - :param ignore_unmapped_predicates: if True then a predicate that has no mapping to a slot does not raise an error + :param ignore_unmapped_predicates: + if True then a predicate that has no mapping to a slot does not raise an error :return: all instances of target class type """ namespaces = schemaview.namespaces() @@ -231,8 +232,7 @@ def _get_id_dict(self, node: VALID_SUBJECT, schemaview: SchemaView, cn: ClassDef id_slot = schemaview.get_identifier_slot(cn) if not isinstance(node, BNode): id_val = self._uri_to_id(node, id_slot, schemaview) - # id_val = schemaview.namespaces().curie_for(node) - if id_val == None: + if id_val is None: id_val = str(node) return {id_slot.name: id_val} else: diff --git a/linkml_runtime/processing/referencevalidator.py b/linkml_runtime/processing/referencevalidator.py index 3bd218d0..3f2b8684 100644 --- a/linkml_runtime/processing/referencevalidator.py +++ b/linkml_runtime/processing/referencevalidator.py @@ -667,7 +667,7 @@ def ensure_simple_dict( ) -> Any: simple_dict_value_slot = self._slot_as_simple_dict_value_slot(parent_slot) if not simple_dict_value_slot: - raise AssertionError(f"Should have simple dict slot valie: {parent_slot.name}") + raise AssertionError(f"Should have simple dict slot value: {parent_slot.name}") normalized_object = input_object if isinstance(input_object, list): normalized_object = {v[pk_slot_name]: v for v in input_object} diff --git a/linkml_runtime/processing/validation_datamodel.py b/linkml_runtime/processing/validation_datamodel.py index ee6cc3a2..3808243c 100644 --- a/linkml_runtime/processing/validation_datamodel.py +++ b/linkml_runtime/processing/validation_datamodel.py @@ -405,7 +405,8 @@ class ConstraintType(EnumDefinitionImpl): ) MinCountConstraint = PermissibleValue( text="MinCountConstraint", - description="cardinality constraint where the number of values of the slot must be greater or equal to a specified minimum", + description="cardinality constraint where the number of values of the slot must be greater than " + "or equal to a specified minimum", meaning=SH.MinCountConstraintComponent, ) RequiredConstraint = PermissibleValue( @@ -420,7 +421,8 @@ class ConstraintType(EnumDefinitionImpl): ) MaxCountConstraint = PermissibleValue( text="MaxCountConstraint", - description="cardinality constraint where the number of values of the slot must be less than or equal to a specified maximum", + description="cardinality constraint where the number of values of the slot must be less than " + "or equal to a specified maximum", meaning=SH.MaxCountConstraintComponent, ) SingleValuedConstraint = PermissibleValue( diff --git a/linkml_runtime/utils/context_utils.py b/linkml_runtime/utils/context_utils.py index a52acc18..376fd59a 100644 --- a/linkml_runtime/utils/context_utils.py +++ b/linkml_runtime/utils/context_utils.py @@ -1,11 +1,14 @@ import json import os from io import TextIOWrapper -from typing import Any, Callable, Optional, Union +from typing import TYPE_CHECKING, Any, Callable, Optional, Union import yaml from jsonasobj2 import JsonObj, loads +if TYPE_CHECKING: + from linkml_runtime.utils.namespaces import Namespaces + CONTEXT_TYPE = Union[str, dict, JsonObj] CONTEXTS_PARAM_TYPE = Optional[Union[CONTEXT_TYPE, list[CONTEXT_TYPE]]] diff --git a/linkml_runtime/utils/enumerations.py b/linkml_runtime/utils/enumerations.py index 3b26cce2..84a3ca48 100644 --- a/linkml_runtime/utils/enumerations.py +++ b/linkml_runtime/utils/enumerations.py @@ -1,9 +1,12 @@ from dataclasses import fields -from typing import Optional, Union +from typing import TYPE_CHECKING, Optional, Union from linkml_runtime.utils.metamodelcore import Curie from linkml_runtime.utils.yamlutils import YAMLRoot +if TYPE_CHECKING: + from linkml_runtime.linkml_model import EnumDefinition, PermissibleValue + class EnumDefinitionMeta(type): def __init__(cls, *args, **kwargs): diff --git a/linkml_runtime/utils/eval_utils.py b/linkml_runtime/utils/eval_utils.py index fd41af5f..105b9cf1 100644 --- a/linkml_runtime/utils/eval_utils.py +++ b/linkml_runtime/utils/eval_utils.py @@ -24,7 +24,7 @@ def eval_conditional(*conds: list[tuple[bool, Any]]) -> Any: """ - Evaluate a collection of expression,value tuples, returing the first value whose expression is true + Evaluate a collection of expression, value tuples, returning the first value whose expression is true >>> x= 40 >>> eval_conditional((x < 25, 'low'), (x > 25, 'high'), (True, 'low')) diff --git a/linkml_runtime/utils/formatutils.py b/linkml_runtime/utils/formatutils.py index 11e6b2aa..9efcd0a1 100644 --- a/linkml_runtime/utils/formatutils.py +++ b/linkml_runtime/utils/formatutils.py @@ -100,7 +100,7 @@ def wrapped_annotation(txt: str) -> str: def shex_results_as_string(rslts) -> str: """Pretty print ShEx Evaluation result""" # TODO: Add this method to ShEx itself - rval = [f"Evalutating: {str(rslts.focus)} against {str(rslts.start)}"] + rval = [f"Evaluating: {str(rslts.focus)} against {str(rslts.start)}"] if rslts.result: rval.append("Result: CONFORMS") else: @@ -158,7 +158,7 @@ def remove_empty_items(obj: Any, hide_protected_keys: bool = False, inside: bool obj_list = [ e for e in [ - remove_empty_items(l, hide_protected_keys=hide_protected_keys, inside=True) for l in obj if l != "_root" + remove_empty_items(i, hide_protected_keys=hide_protected_keys, inside=True) for i in obj if i != "_root" ] if not is_empty(e) ] diff --git a/linkml_runtime/utils/metamodelcore.py b/linkml_runtime/utils/metamodelcore.py index e9a80acd..d490ee2d 100644 --- a/linkml_runtime/utils/metamodelcore.py +++ b/linkml_runtime/utils/metamodelcore.py @@ -13,6 +13,7 @@ from linkml_runtime.utils.namespaces import Namespaces from linkml_runtime.utils.strictness import is_strict from linkml_runtime.utils.uri_validator import validate_curie, validate_uri, validate_uri_reference +from linkml_runtime.utils.yamlutils import TypedNode # Reference Decimal to make sure it stays in the imports _z = Decimal(1) @@ -20,7 +21,6 @@ # =========================== # Fields for use in dataclass # =========================== -from linkml_runtime.utils.yamlutils import TypedNode def empty_list(): @@ -233,13 +233,11 @@ def __new__(cls, value: Union[str, datetime.time, datetime.datetime, Literal]) - if not isinstance(value, datetime.time): value = datetime.time.fromisoformat(value) return datetime.time.fromisoformat(str(value)).isoformat() - except TypeError: - pass - except ValueError: - pass - if not is_strict(): + except (TypeError, ValueError): + if is_strict(): + raise + finally: return str(value) - raise e @classmethod def is_valid(cls, value: Union[str, datetime.time, datetime.datetime, Literal]) -> bool: @@ -266,13 +264,11 @@ def __new__(cls, value: Union[str, datetime.date, Literal]) -> str: if not isinstance(value, datetime.date): value = datetime.date.fromisoformat(str(value)) return value.isoformat() - except TypeError: - pass - except ValueError: - pass - if not is_strict(): + except (TypeError, ValueError): + if is_strict(): + raise + finally: return str(value) - raise e @classmethod def is_valid(cls, value: Union[str, datetime.date, Literal]) -> bool: @@ -301,13 +297,11 @@ def __new__(cls, value: Union[str, datetime.datetime, Literal]) -> str: if not isinstance(value, datetime.datetime): value = datetime.datetime.fromisoformat(value) # Note that this handles non 'T' format as well return value.isoformat() - except TypeError: - pass - except ValueError: - pass - if not is_strict(): + except (TypeError, ValueError): + if is_strict(): + raise + finally: return str(value) - raise e @classmethod def is_valid(cls, value: Union[str, datetime.datetime, Literal]) -> bool: diff --git a/linkml_runtime/utils/permissiblevalueimpl.py b/linkml_runtime/utils/permissiblevalueimpl.py index 8cf5f04b..57307aee 100644 --- a/linkml_runtime/utils/permissiblevalueimpl.py +++ b/linkml_runtime/utils/permissiblevalueimpl.py @@ -130,10 +130,10 @@ class PvFormulaOptions(EnumDefinitionImpl): description="The permissible values are the set of FHIR coding elements derived from the code set", ) - _defn = EnumDefinition( - name="PvFormulaOptions", - description="The formula used to generate the set of permissible values from the code_set values", - ) + # _defn = EnumDefinition( + # name="PvFormulaOptions", + # description="The formula used to generate the set of permissible values from the code_set values", + # ) class PermissibleValueImpl(PermissibleValue): diff --git a/linkml_runtime/utils/schemaview.py b/linkml_runtime/utils/schemaview.py index f8a25b86..3ff5dd9d 100644 --- a/linkml_runtime/utils/schemaview.py +++ b/linkml_runtime/utils/schemaview.py @@ -1080,12 +1080,12 @@ def slot_is_true_for_metadata_property(self, slot_name: SlotDefinition, metadata will return True if the slot id has the identifier property set to True. :param slot_name: slot to test for multivalued - :param metadata_property: controlled vocabulary for boolean attribtues + :param metadata_property: controlled vocabulary for boolean attributes :return: boolean """ induced_slot = self.induced_slot(slot_name) - if type(getattr(induced_slot, metadata_property)) == bool: + if type(getattr(induced_slot, metadata_property)) is bool: return True if getattr(induced_slot, metadata_property) else False else: raise ValueError('property to introspect must be of type "boolean"') @@ -1691,7 +1691,7 @@ def get_slots_by_enum(self, enum_name: ENUM_NAME = None) -> list[SlotDefinition] """Get all slots that use a given enum: schema defined, attribute, or slot_usage. :param enum_name: enum in consideration - :return: list of slots, either schem or both class attribute defined + :return: list of slots, either schema or both class attribute defined """ enum_slots = [] for s in self.all_slots().values(): diff --git a/notebooks/SchemaView_Monarch.ipynb b/notebooks/SchemaView_Monarch.ipynb index ef527bcf..69988afc 100644 --- a/notebooks/SchemaView_Monarch.ipynb +++ b/notebooks/SchemaView_Monarch.ipynb @@ -18,8 +18,10 @@ "metadata": {}, "outputs": [], "source": [ + "import requests\n", + "\n", "from linkml_runtime.utils.schemaview import SchemaView\n", - "import requests \n", + "\n", "# note you can also use a path on a local filesystem\n", "view = SchemaView(\"https://raw.githubusercontent.com/biolink/biolink-model/master/biolink-model.yaml\")" ] @@ -90,7 +92,7 @@ "# object = 'phenotypic feature'\n", "object = 'sequence variant'\n", "\n", - "query_prefix = f'https://www.ebi.ac.uk/ols/api/ontologies/_ontology/terms/'\n", + "query_prefix = 'https://www.ebi.ac.uk/ols/api/ontologies/_ontology/terms/'\n", "mappings = view.get_mappings(object)\n", "if len(mappings) == 0:\n", " print(\"no exact mappings found for: \" + object)\n", diff --git a/tests/__init__.py b/tests/__init__.py index f7acd17a..19129def 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,4 +1,5 @@ import configparser +import logging # Global testing control variables import os @@ -37,7 +38,7 @@ # There are lots of warnings emitted by the generators. Default logging level -DEFAULT_LOG_LEVEL = eval(test_settings.get("DEFAULT_LOG_LEVEL", "logging.ERROR")) +DEFAULT_LOG_LEVEL = getattr(logging, test_settings.get("DEFAULT_LOG_LEVEL", "WARNING")) DEFAULT_LOG_LEVEL_TEXT = test_settings.get("DEFAULT_LOG_LEVEL_TEXT", "ERROR") diff --git a/tests/support/test_environment.py b/tests/support/test_environment.py index 7d7d761f..c1eb62bb 100644 --- a/tests/support/test_environment.py +++ b/tests/support/test_environment.py @@ -210,8 +210,10 @@ def generate_single_file( """ # If no filter, default to identity function if filtr is None: + def filtr(s): return s + filename = filename if isinstance(filename, list) else [filename] actual_file = self.root_temp_file_path(*filename) if use_testing_root else self.actual_path(*filename) expected_file = self.root_expected_path(*filename) if use_testing_root else self.expected_path(*filename) diff --git a/tests/test_issues/input/issue_355.py b/tests/test_issues/input/issue_355.py index fbee480f..e13c5d51 100644 --- a/tests/test_issues/input/issue_355.py +++ b/tests/test_issues/input/issue_355.py @@ -6,16 +6,15 @@ # description: # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot -from linkml_runtime.utils.metamodelcore import empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot from rdflib import URIRef + from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.utils.metamodelcore import URIorCURIE +from linkml_runtime.utils.metamodelcore import URIorCURIE, empty_dict +from linkml_runtime.utils.slot import Slot +from linkml_runtime.utils.yamlutils import YAMLRoot metamodel_version = "1.7.0" diff --git a/tests/test_issues/input/issue_368.py b/tests/test_issues/input/issue_368.py index 75eb7b60..60f7d9ae 100644 --- a/tests/test_issues/input/issue_368.py +++ b/tests/test_issues/input/issue_368.py @@ -6,13 +6,14 @@ # description: # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.slot import Slot from rdflib import URIRef + from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.slot import Slot + from .issue_368_imports import ParentClass, SampleEnum metamodel_version = "1.7.0" diff --git a/tests/test_issues/input/issue_368_imports.py b/tests/test_issues/input/issue_368_imports.py index 082641ef..13864fa0 100644 --- a/tests/test_issues/input/issue_368_imports.py +++ b/tests/test_issues/input/issue_368_imports.py @@ -6,15 +6,14 @@ # description: # license: -import dataclasses from typing import ClassVar -from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue -from linkml_runtime.utils.yamlutils import YAMLRoot -from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import URIRef -from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue +from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.enumerations import EnumDefinitionImpl +from linkml_runtime.utils.yamlutils import YAMLRoot metamodel_version = "1.7.0" diff --git a/tests/test_loaders_dumpers/models/personinfo.py b/tests/test_loaders_dumpers/models/personinfo.py index f5ce826a..167a8dd0 100644 --- a/tests/test_loaders_dumpers/models/personinfo.py +++ b/tests/test_loaders_dumpers/models/personinfo.py @@ -17,7 +17,7 @@ from linkml_runtime.linkml_model.types import Decimal, Uri, Uriorcurie from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from linkml_runtime.utils.metamodelcore import Bool, Decimal, XSDDate, empty_dict, empty_list +from linkml_runtime.utils.metamodelcore import Bool, XSDDate, empty_dict, empty_list from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str diff --git a/tests/test_utils/input/inlined_as_dict.py b/tests/test_utils/input/inlined_as_dict.py index b9b522d3..e0e0ff06 100644 --- a/tests/test_utils/input/inlined_as_dict.py +++ b/tests/test_utils/input/inlined_as_dict.py @@ -6,15 +6,14 @@ # description: Test schema for inlined_as_dict # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.metamodelcore import empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from rdflib import URIRef -from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.metamodelcore import empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str metamodel_version = "1.7.0" diff --git a/tests/test_utils/input/inlined_as_list.py b/tests/test_utils/input/inlined_as_list.py index ff2bebe6..9836ccfb 100644 --- a/tests/test_utils/input/inlined_as_list.py +++ b/tests/test_utils/input/inlined_as_list.py @@ -6,15 +6,14 @@ # description: Test schema for inlined_as_dict # license: https://creativecommons.org/publicdomain/zero/1.0/ -import dataclasses -from typing import Optional, Union, ClassVar, Any from dataclasses import dataclass +from typing import Any, ClassVar, Optional, Union -from linkml_runtime.utils.metamodelcore import empty_dict -from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str from rdflib import URIRef -from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.curienamespace import CurieNamespace +from linkml_runtime.utils.metamodelcore import empty_dict +from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str metamodel_version = "1.7.0" diff --git a/tests/test_utils/model/inference_example.py b/tests/test_utils/model/inference_example.py index 49fa4685..1fc60561 100644 --- a/tests/test_utils/model/inference_example.py +++ b/tests/test_utils/model/inference_example.py @@ -16,7 +16,7 @@ from linkml_runtime.linkml_model.types import Decimal from linkml_runtime.utils.curienamespace import CurieNamespace from linkml_runtime.utils.enumerations import EnumDefinitionImpl -from linkml_runtime.utils.metamodelcore import Bool, Decimal, empty_list +from linkml_runtime.utils.metamodelcore import Bool, empty_list from linkml_runtime.utils.slot import Slot from linkml_runtime.utils.yamlutils import YAMLRoot From c71fb0c57a2ad7066479fa59a2f0b5174a09ab6d Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 28 Oct 2024 14:37:22 -0700 Subject: [PATCH 16/17] fix import locations --- linkml_runtime/dumpers/delimited_file_dumper.py | 4 ++-- linkml_runtime/dumpers/rdflib_dumper.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/linkml_runtime/dumpers/delimited_file_dumper.py b/linkml_runtime/dumpers/delimited_file_dumper.py index e7f681de..c2ec934f 100644 --- a/linkml_runtime/dumpers/delimited_file_dumper.py +++ b/linkml_runtime/dumpers/delimited_file_dumper.py @@ -3,13 +3,13 @@ from abc import ABC, abstractmethod from typing import Union -from json_flattener import flatten_to_csv +from json_flattener import GlobalConfig, flatten_to_csv from pydantic import BaseModel from linkml_runtime.dumpers.dumper_root import Dumper from linkml_runtime.dumpers.json_dumper import JSONDumper from linkml_runtime.linkml_model.meta import SchemaDefinition, SlotDefinitionName -from linkml_runtime.utils.csvutils import GlobalConfig, get_configmap +from linkml_runtime.utils.csvutils import get_configmap from linkml_runtime.utils.schemaview import SchemaView from linkml_runtime.utils.yamlutils import YAMLRoot diff --git a/linkml_runtime/dumpers/rdflib_dumper.py b/linkml_runtime/dumpers/rdflib_dumper.py index 08e9d501..038718ec 100644 --- a/linkml_runtime/dumpers/rdflib_dumper.py +++ b/linkml_runtime/dumpers/rdflib_dumper.py @@ -9,8 +9,8 @@ from rdflib.term import BNode, Literal, Node from linkml_runtime.dumpers.dumper_root import Dumper -from linkml_runtime.linkml_model import SlotDefinition -from linkml_runtime.utils.schemaview import ElementName, PermissibleValue, PermissibleValueText, SchemaView +from linkml_runtime.linkml_model import ElementName, PermissibleValue, PermissibleValueText, SlotDefinition +from linkml_runtime.utils.schemaview import SchemaView from linkml_runtime.utils.yamlutils import YAMLRoot logger = logging.getLogger(__name__) From 997c3e7a18259ee31277b7043fd619196b297e71 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 28 Oct 2024 14:37:38 -0700 Subject: [PATCH 17/17] fix error handling in XSD types - finally overrides prior returns --- linkml_runtime/utils/metamodelcore.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/linkml_runtime/utils/metamodelcore.py b/linkml_runtime/utils/metamodelcore.py index d490ee2d..fbadf7df 100644 --- a/linkml_runtime/utils/metamodelcore.py +++ b/linkml_runtime/utils/metamodelcore.py @@ -229,6 +229,7 @@ def __new__(cls, value: Union[str, datetime.time, datetime.datetime, Literal]) - raise ValueError(f"{value} is not a valid time") if isinstance(value, Literal): value = value.value + try: if not isinstance(value, datetime.time): value = datetime.time.fromisoformat(value) @@ -236,8 +237,8 @@ def __new__(cls, value: Union[str, datetime.time, datetime.datetime, Literal]) - except (TypeError, ValueError): if is_strict(): raise - finally: - return str(value) + + return str(value) @classmethod def is_valid(cls, value: Union[str, datetime.time, datetime.datetime, Literal]) -> bool: @@ -260,6 +261,7 @@ def __new__(cls, value: Union[str, datetime.date, Literal]) -> str: raise ValueError(f"{value} is not a valid date") if isinstance(value, Literal): value = value.value + try: if not isinstance(value, datetime.date): value = datetime.date.fromisoformat(str(value)) @@ -267,8 +269,8 @@ def __new__(cls, value: Union[str, datetime.date, Literal]) -> str: except (TypeError, ValueError): if is_strict(): raise - finally: - return str(value) + + return str(value) @classmethod def is_valid(cls, value: Union[str, datetime.date, Literal]) -> bool: @@ -293,6 +295,7 @@ def __new__(cls, value: Union[str, datetime.datetime, Literal]) -> str: raise ValueError(f"{value} is not a valid datetime") if isinstance(value, Literal): value = value.value + try: if not isinstance(value, datetime.datetime): value = datetime.datetime.fromisoformat(value) # Note that this handles non 'T' format as well @@ -300,8 +303,8 @@ def __new__(cls, value: Union[str, datetime.datetime, Literal]) -> str: except (TypeError, ValueError): if is_strict(): raise - finally: - return str(value) + + return str(value) @classmethod def is_valid(cls, value: Union[str, datetime.datetime, Literal]) -> bool: