From 15bf85cefc2fe8541b38aabfcf7c65eb46bc1231 Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Fri, 16 Feb 2024 23:34:50 -0600 Subject: [PATCH] linted --- src/oaklib/__init__.py | 1 + src/oaklib/cli.py | 1 + .../converters/obo_graph_to_fhir_converter.py | 1 + src/oaklib/datamodels/association.py | 48 +++--- src/oaklib/datamodels/cross_ontology_diff.py | 12 +- src/oaklib/datamodels/fhir.py | 6 +- src/oaklib/datamodels/input_specification.py | 6 +- src/oaklib/datamodels/item_list.py | 24 +-- src/oaklib/datamodels/lexical_index.py | 8 +- .../datamodels/mapping_cluster_datamodel.py | 8 +- .../datamodels/mapping_rules_datamodel.py | 14 +- src/oaklib/datamodels/obograph.py | 22 +-- src/oaklib/datamodels/ontology_metadata.py | 138 +++++++++--------- src/oaklib/datamodels/search_datamodel.py | 36 ++--- src/oaklib/datamodels/taxon_constraints.py | 6 +- src/oaklib/implementations/__init__.py | 1 + .../amigo/amigo_implementation.py | 1 + .../eutils/eutils_implementation.py | 1 + .../eutils/pubmed_implementation.py | 3 +- .../implementations/llm_implementation.py | 1 + .../ncbi/ncbi_gene_implementation.py | 1 + .../implementations/ols/ols_implementation.py | 6 +- .../implementations/semsimian/profiler.py | 1 + .../semsimian/semsimian_implementation.py | 1 + .../simpleobo/simple_obo_parser.py | 1 + .../translator/translator_implementation.py | 1 + src/oaklib/indexes/edge_index.py | 1 + .../inference/relation_graph_reasoner.py | 1 + src/oaklib/io/obograph_writer.py | 1 + src/oaklib/io/streaming_csv_writer.py | 12 +- src/oaklib/mappers/base_mapper.py | 1 + src/oaklib/parsers/association_parser.py | 1 + src/oaklib/parsers/boomer_parser.py | 1 + src/oaklib/parsers/gaf_association_parser.py | 1 + .../parsers/gencc_association_parser.py | 1 + src/oaklib/parsers/hpoa_association_parser.py | 1 + .../parsers/hpoa_g2d_association_parser.py | 1 + .../parsers/hpoa_g2p_association_parser.py | 1 + src/oaklib/parsers/kgx_association_parser.py | 1 + .../parsers/mim2gene_association_parser.py | 1 + .../parsers/pairwise_association_parser.py | 1 + src/oaklib/parsers/parser_base.py | 1 + src/oaklib/parsers/phaf_association_parser.py | 1 + src/oaklib/parsers/xaf_association_parser.py | 1 + .../associations/association_index.py | 1 + src/oaklib/utilities/graph/networkx_bridge.py | 1 + .../utilities/graph/relationship_walker.py | 1 + .../utilities/lexical/lexical_indexer.py | 1 + src/oaklib/utilities/lexical/patternizer.py | 1 + src/oaklib/utilities/obograph_utils.py | 1 + src/oaklib/utilities/rate_limiter.py | 1 + .../test_converters/test_obo_graph_to_fhir.py | 1 + tests/test_implementations/__init__.py | 1 + 53 files changed, 218 insertions(+), 169 deletions(-) diff --git a/src/oaklib/__init__.py b/src/oaklib/__init__.py index 660f6e393..e0e7c0517 100644 --- a/src/oaklib/__init__.py +++ b/src/oaklib/__init__.py @@ -2,6 +2,7 @@ Oaklib ------ """ + __version__ = "0.1.0" from oaklib.interfaces import BasicOntologyInterface # noqa:F401 diff --git a/src/oaklib/cli.py b/src/oaklib/cli.py index 4bf1c40f8..a0998494f 100644 --- a/src/oaklib/cli.py +++ b/src/oaklib/cli.py @@ -4,6 +4,7 @@ Executed using "runoak" command """ + # TODO: order commands. # See https://stackoverflow.com/questions/47972638/how-can-i-define-the-order-of-click-sub-commands-in-help import itertools diff --git a/src/oaklib/converters/obo_graph_to_fhir_converter.py b/src/oaklib/converters/obo_graph_to_fhir_converter.py index 29049a30d..85616c723 100644 --- a/src/oaklib/converters/obo_graph_to_fhir_converter.py +++ b/src/oaklib/converters/obo_graph_to_fhir_converter.py @@ -4,6 +4,7 @@ - Updates issue: https://github.com/INCATools/ontology-access-kit/issues/369 - Conversion examples: https://drive.google.com/drive/folders/1lwGQ63_fedfWlGlRemq8OeZhZsvIXN01 """ + import logging from dataclasses import dataclass from typing import Any, Dict, List, Tuple, Union diff --git a/src/oaklib/datamodels/association.py b/src/oaklib/datamodels/association.py index 2da07bb06..e909fa6aa 100644 --- a/src/oaklib/datamodels/association.py +++ b/src/oaklib/datamodels/association.py @@ -98,22 +98,22 @@ class PositiveOrNegativeAssociation(YAMLRoot): predicate_label: Optional[str] = None object_label: Optional[str] = None negated: Optional[Union[bool, Bool]] = None - publications: Optional[ - Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] - ] = empty_list() + publications: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = ( + empty_list() + ) evidence_type: Optional[Union[str, URIorCURIE]] = None - supporting_objects: Optional[ - Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] - ] = empty_list() + supporting_objects: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = ( + empty_list() + ) primary_knowledge_source: Optional[Union[str, URIorCURIE]] = None aggregator_knowledge_source: Optional[Union[str, URIorCURIE]] = None - subject_closure: Optional[ - Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] - ] = empty_list() + subject_closure: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = ( + empty_list() + ) subject_closure_label: Optional[Union[str, List[str]]] = empty_list() - object_closure: Optional[ - Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] - ] = empty_list() + object_closure: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = ( + empty_list() + ) object_closure_label: Optional[Union[str, List[str]]] = empty_list() comments: Optional[Union[str, List[str]]] = empty_list() @@ -292,12 +292,12 @@ class RollupGroup(YAMLRoot): class_model_uri: ClassVar[URIRef] = ONTOASSOC.RollupGroup group_object: Optional[Union[str, URIorCURIE]] = None - sub_groups: Optional[ - Union[Union[dict, "RollupGroup"], List[Union[dict, "RollupGroup"]]] - ] = empty_list() - associations: Optional[ - Union[Union[dict, Association], List[Union[dict, Association]]] - ] = empty_list() + sub_groups: Optional[Union[Union[dict, "RollupGroup"], List[Union[dict, "RollupGroup"]]]] = ( + empty_list() + ) + associations: Optional[Union[Union[dict, Association], List[Union[dict, Association]]]] = ( + empty_list() + ) def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self.group_object is not None and not isinstance(self.group_object, URIorCURIE): @@ -458,9 +458,9 @@ class AssociationChange(YAMLRoot): new_date: Optional[str] = None primary_knowledge_source: Optional[Union[str, URIorCURIE]] = None aggregator_knowledge_source: Optional[Union[str, URIorCURIE]] = None - publications: Optional[ - Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] - ] = empty_list() + publications: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = ( + empty_list() + ) publication_is_added: Optional[Union[bool, Bool]] = None publication_is_deleted: Optional[Union[bool, Bool]] = None subject: Optional[Union[str, URIorCURIE]] = None @@ -474,9 +474,9 @@ class AssociationChange(YAMLRoot): is_specialization: Optional[Union[bool, Bool]] = None is_creation: Optional[Union[bool, Bool]] = None is_deletion: Optional[Union[bool, Bool]] = None - closure_predicates: Optional[ - Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] - ] = empty_list() + closure_predicates: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = ( + empty_list() + ) closure_delta: Optional[int] = None def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): diff --git a/src/oaklib/datamodels/cross_ontology_diff.py b/src/oaklib/datamodels/cross_ontology_diff.py index 3ccbf3fb3..8bbe15371 100644 --- a/src/oaklib/datamodels/cross_ontology_diff.py +++ b/src/oaklib/datamodels/cross_ontology_diff.py @@ -109,9 +109,9 @@ class StructureDiffResultSet(YAMLRoot): class_name: ClassVar[str] = "StructureDiffResultSet" class_model_uri: ClassVar[URIRef] = XODIFF.StructureDiffResultSet - results: Optional[ - Union[Union[dict, "RelationalDiff"], List[Union[dict, "RelationalDiff"]]] - ] = empty_list() + results: Optional[Union[Union[dict, "RelationalDiff"], List[Union[dict, "RelationalDiff"]]]] = ( + empty_list() + ) left_source: Optional[Union[str, Source]] = None right_source: Optional[Union[str, Source]] = None @@ -180,9 +180,9 @@ class RelationalDiff(YAMLRoot): ] = empty_list() right_subject_label: Optional[Union[str, Label]] = None right_object_label: Optional[Union[str, Label]] = None - right_predicate_labels: Optional[ - Union[Union[str, Label], List[Union[str, Label]]] - ] = empty_list() + right_predicate_labels: Optional[Union[Union[str, Label], List[Union[str, Label]]]] = ( + empty_list() + ) left_subject_is_functional: Optional[str] = None left_object_is_functional: Optional[str] = None subject_mapping_predicate: Optional[Union[str, EntityReference]] = None diff --git a/src/oaklib/datamodels/fhir.py b/src/oaklib/datamodels/fhir.py index 4569edc98..888f1b38d 100644 --- a/src/oaklib/datamodels/fhir.py +++ b/src/oaklib/datamodels/fhir.py @@ -418,9 +418,9 @@ class ConceptMap(YAMLRoot): sourceCanonical: Optional[Union[str, URIorCURIE]] = None targetUri: Optional[Union[str, URIorCURIE]] = None targetCanonical: Optional[Union[str, URIorCURIE]] = None - group: Optional[ - Union[Union[dict, "ConceptMapGroup"], List[Union[dict, "ConceptMapGroup"]]] - ] = empty_list() + group: Optional[Union[Union[dict, "ConceptMapGroup"], List[Union[dict, "ConceptMapGroup"]]]] = ( + empty_list() + ) def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self.id is not None and not isinstance(self.id, str): diff --git a/src/oaklib/datamodels/input_specification.py b/src/oaklib/datamodels/input_specification.py index 3aa25bb58..7a5652a60 100644 --- a/src/oaklib/datamodels/input_specification.py +++ b/src/oaklib/datamodels/input_specification.py @@ -195,9 +195,9 @@ class AssociationResource(Resource): class_model_uri: ClassVar[URIRef] = ITEMLIST.AssociationResource id: Union[str, AssociationResourceId] = None - normalizers: Optional[ - Union[Union[dict, "Normalizer"], List[Union[dict, "Normalizer"]]] - ] = empty_list() + normalizers: Optional[Union[Union[dict, "Normalizer"], List[Union[dict, "Normalizer"]]]] = ( + empty_list() + ) def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self._is_empty(self.id): diff --git a/src/oaklib/datamodels/item_list.py b/src/oaklib/datamodels/item_list.py index a90da4fa2..2945a3612 100644 --- a/src/oaklib/datamodels/item_list.py +++ b/src/oaklib/datamodels/item_list.py @@ -84,9 +84,9 @@ class ItemListCollection(YAMLRoot): class_name: ClassVar[str] = "ItemListCollection" class_model_uri: ClassVar[URIRef] = ITEMLIST.ItemListCollection - itemLists: Optional[ - Union[Union[dict, "ItemList"], List[Union[dict, "ItemList"]]] - ] = empty_list() + itemLists: Optional[Union[Union[dict, "ItemList"], List[Union[dict, "ItemList"]]]] = ( + empty_list() + ) def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if not isinstance(self.itemLists, list): @@ -126,12 +126,12 @@ class ItemList(YAMLRoot): ] = empty_dict() categories: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() keywords: Optional[Union[str, List[str]]] = empty_list() - additionalType: Optional[ - Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] - ] = empty_list() - wasGeneratedBy: Optional[ - Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] - ] = empty_list() + additionalType: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = ( + empty_list() + ) + wasGeneratedBy: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = ( + empty_list() + ) def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self.id is not None and not isinstance(self.id, URIorCURIE): @@ -236,9 +236,9 @@ class Thing(YAMLRoot): id: Union[str, ThingId] = None name: Optional[str] = None url: Optional[Union[str, URI]] = None - identifiers: Optional[ - Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] - ] = empty_list() + identifiers: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = ( + empty_list() + ) description: Optional[str] = None type: Optional[Union[str, URIorCURIE]] = None diff --git a/src/oaklib/datamodels/lexical_index.py b/src/oaklib/datamodels/lexical_index.py index 05e74f6af..3a7d93db6 100644 --- a/src/oaklib/datamodels/lexical_index.py +++ b/src/oaklib/datamodels/lexical_index.py @@ -198,9 +198,11 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if not isinstance(self.pipeline, list): self.pipeline = [self.pipeline] if self.pipeline is not None else [] self.pipeline = [ - v - if isinstance(v, LexicalTransformationPipelineName) - else LexicalTransformationPipelineName(v) + ( + v + if isinstance(v, LexicalTransformationPipelineName) + else LexicalTransformationPipelineName(v) + ) for v in self.pipeline ] diff --git a/src/oaklib/datamodels/mapping_cluster_datamodel.py b/src/oaklib/datamodels/mapping_cluster_datamodel.py index b5ca40bf4..4fbb3df06 100644 --- a/src/oaklib/datamodels/mapping_cluster_datamodel.py +++ b/src/oaklib/datamodels/mapping_cluster_datamodel.py @@ -336,9 +336,11 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): [self.predicate_probabilities] if self.predicate_probabilities is not None else [] ) self.predicate_probabilities = [ - v - if isinstance(v, PredicateProbabilityPredicateId) - else PredicateProbabilityPredicateId(v) + ( + v + if isinstance(v, PredicateProbabilityPredicateId) + else PredicateProbabilityPredicateId(v) + ) for v in self.predicate_probabilities ] diff --git a/src/oaklib/datamodels/mapping_rules_datamodel.py b/src/oaklib/datamodels/mapping_rules_datamodel.py index 9a3701dc5..20b33d294 100644 --- a/src/oaklib/datamodels/mapping_rules_datamodel.py +++ b/src/oaklib/datamodels/mapping_rules_datamodel.py @@ -88,9 +88,9 @@ class MappingRuleCollection(YAMLRoot): class_name: ClassVar[str] = "MappingRuleCollection" class_model_uri: ClassVar[URIRef] = MAPPINGRULES.MappingRuleCollection - rules: Optional[ - Union[Union[dict, "MappingRule"], List[Union[dict, "MappingRule"]]] - ] = empty_list() + rules: Optional[Union[Union[dict, "MappingRule"], List[Union[dict, "MappingRule"]]]] = ( + empty_list() + ) minimum_confidence: Optional[float] = None def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @@ -440,9 +440,11 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if not isinstance(self.pipeline, list): self.pipeline = [self.pipeline] if self.pipeline is not None else [] self.pipeline = [ - v - if isinstance(v, LexicalTransformationPipelineName) - else LexicalTransformationPipelineName(v) + ( + v + if isinstance(v, LexicalTransformationPipelineName) + else LexicalTransformationPipelineName(v) + ) for v in self.pipeline ] diff --git a/src/oaklib/datamodels/obograph.py b/src/oaklib/datamodels/obograph.py index 026ea87be..2776adecc 100644 --- a/src/oaklib/datamodels/obograph.py +++ b/src/oaklib/datamodels/obograph.py @@ -220,9 +220,9 @@ class Graph(YAMLRoot): domainRangeAxioms: Optional[ Union[Union[dict, "DomainRangeAxiom"], List[Union[dict, "DomainRangeAxiom"]]] ] = empty_list() - allValuesFromEdges: Optional[ - Union[Union[dict, "Edge"], List[Union[dict, "Edge"]]] - ] = empty_list() + allValuesFromEdges: Optional[Union[Union[dict, "Edge"], List[Union[dict, "Edge"]]]] = ( + empty_list() + ) propertyChainAxioms: Optional[ Union[Union[dict, "PropertyChainAxiom"], List[Union[dict, "PropertyChainAxiom"]]] ] = empty_list() @@ -805,9 +805,11 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if not isinstance(self.restrictions, list): self.restrictions = [self.restrictions] if self.restrictions is not None else [] self.restrictions = [ - v - if isinstance(v, ExistentialRestrictionExpression) - else ExistentialRestrictionExpression(**as_dict(v)) + ( + v + if isinstance(v, ExistentialRestrictionExpression) + else ExistentialRestrictionExpression(**as_dict(v)) + ) for v in self.restrictions ] @@ -848,9 +850,11 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): [self.classExpressions] if self.classExpressions is not None else [] ) self.classExpressions = [ - v - if isinstance(v, ExistentialRestrictionExpression) - else ExistentialRestrictionExpression(**as_dict(v)) + ( + v + if isinstance(v, ExistentialRestrictionExpression) + else ExistentialRestrictionExpression(**as_dict(v)) + ) for v in self.classExpressions ] diff --git a/src/oaklib/datamodels/ontology_metadata.py b/src/oaklib/datamodels/ontology_metadata.py index 43a5ae8b1..fe42f9975 100644 --- a/src/oaklib/datamodels/ontology_metadata.py +++ b/src/oaklib/datamodels/ontology_metadata.py @@ -212,9 +212,9 @@ class HasMinimalMetadata(AnnotationPropertyMixin): class_model_uri: ClassVar[URIRef] = OMOSCHEMA.HasMinimalMetadata label: Optional[Union[str, LabelType]] = None - definition: Optional[ - Union[Union[str, NarrativeText], List[Union[str, NarrativeText]]] - ] = empty_list() + definition: Optional[Union[Union[str, NarrativeText], List[Union[str, NarrativeText]]]] = ( + empty_list() + ) def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self.label is not None and not isinstance(self.label, LabelType): @@ -242,18 +242,18 @@ class HasSynonyms(AnnotationPropertyMixin): class_name: ClassVar[str] = "HasSynonyms" class_model_uri: ClassVar[URIRef] = OMOSCHEMA.HasSynonyms - has_exact_synonym: Optional[ - Union[Union[str, LabelType], List[Union[str, LabelType]]] - ] = empty_list() - has_narrow_synonym: Optional[ - Union[Union[str, LabelType], List[Union[str, LabelType]]] - ] = empty_list() - has_broad_synonym: Optional[ - Union[Union[str, LabelType], List[Union[str, LabelType]]] - ] = empty_list() - has_related_synonym: Optional[ - Union[Union[str, LabelType], List[Union[str, LabelType]]] - ] = empty_list() + has_exact_synonym: Optional[Union[Union[str, LabelType], List[Union[str, LabelType]]]] = ( + empty_list() + ) + has_narrow_synonym: Optional[Union[Union[str, LabelType], List[Union[str, LabelType]]]] = ( + empty_list() + ) + has_broad_synonym: Optional[Union[Union[str, LabelType], List[Union[str, LabelType]]]] = ( + empty_list() + ) + has_related_synonym: Optional[Union[Union[str, LabelType], List[Union[str, LabelType]]]] = ( + empty_list() + ) alternative_term: Optional[Union[str, List[str]]] = empty_list() ISA_alternative_term: Optional[Union[str, List[str]]] = empty_list() IEDB_alternative_term: Optional[Union[str, List[str]]] = empty_list() @@ -404,9 +404,9 @@ class HasProvenance(AnnotationPropertyMixin): created: Optional[str] = None date: Optional[Union[str, List[str]]] = empty_list() isDefinedBy: Optional[Union[str, OntologyId]] = None - editor_note: Optional[ - Union[Union[str, NarrativeText], List[Union[str, NarrativeText]]] - ] = empty_list() + editor_note: Optional[Union[Union[str, NarrativeText], List[Union[str, NarrativeText]]]] = ( + empty_list() + ) term_editor: Optional[Union[str, List[str]]] = empty_list() definition_source: Optional[Union[str, List[str]]] = empty_list() ontology_term_requester: Optional[str] = None @@ -495,13 +495,13 @@ class HasLifeCycle(AnnotationPropertyMixin): has_obsolescence_reason: Optional[str] = None term_replaced_by: Optional[Union[dict, Any]] = None consider: Optional[Union[Union[dict, Any], List[Union[dict, Any]]]] = empty_list() - has_alternative_id: Optional[ - Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] - ] = empty_list() + has_alternative_id: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = ( + empty_list() + ) excluded_from_QC_check: Optional[Union[dict, "Thing"]] = None - excluded_subClassOf: Optional[ - Union[Union[str, ClassId], List[Union[str, ClassId]]] - ] = empty_list() + excluded_subClassOf: Optional[Union[Union[str, ClassId], List[Union[str, ClassId]]]] = ( + empty_list() + ) excluded_synonym: Optional[Union[str, List[str]]] = empty_list() should_conform_to: Optional[Union[dict, "Thing"]] = None @@ -701,9 +701,9 @@ class Ontology(NamedObject): license: Union[dict, Thing] = None versionIRI: Union[str, URIorCURIE] = None versionInfo: str = None - has_ontology_root_term: Optional[ - Union[Union[str, ClassId], List[Union[str, ClassId]]] - ] = empty_list() + has_ontology_root_term: Optional[Union[Union[str, ClassId], List[Union[str, ClassId]]]] = ( + empty_list() + ) source: Optional[Union[str, List[str]]] = empty_list() comment: Optional[Union[str, List[str]]] = empty_list() creator: Optional[Union[Union[str, AgentId], List[Union[str, AgentId]]]] = empty_list() @@ -779,18 +779,18 @@ class Term(NamedObject): class_model_uri: ClassVar[URIRef] = OMOSCHEMA.Term id: Union[str, TermId] = None - has_exact_synonym: Optional[ - Union[Union[str, LabelType], List[Union[str, LabelType]]] - ] = empty_list() - has_narrow_synonym: Optional[ - Union[Union[str, LabelType], List[Union[str, LabelType]]] - ] = empty_list() - has_broad_synonym: Optional[ - Union[Union[str, LabelType], List[Union[str, LabelType]]] - ] = empty_list() - has_related_synonym: Optional[ - Union[Union[str, LabelType], List[Union[str, LabelType]]] - ] = empty_list() + has_exact_synonym: Optional[Union[Union[str, LabelType], List[Union[str, LabelType]]]] = ( + empty_list() + ) + has_narrow_synonym: Optional[Union[Union[str, LabelType], List[Union[str, LabelType]]]] = ( + empty_list() + ) + has_broad_synonym: Optional[Union[Union[str, LabelType], List[Union[str, LabelType]]]] = ( + empty_list() + ) + has_related_synonym: Optional[Union[Union[str, LabelType], List[Union[str, LabelType]]]] = ( + empty_list() + ) alternative_term: Optional[Union[str, List[str]]] = empty_list() ISA_alternative_term: Optional[Union[str, List[str]]] = empty_list() IEDB_alternative_term: Optional[Union[str, List[str]]] = empty_list() @@ -800,13 +800,13 @@ class Term(NamedObject): has_obsolescence_reason: Optional[str] = None term_replaced_by: Optional[Union[dict, Any]] = None consider: Optional[Union[Union[dict, Any], List[Union[dict, Any]]]] = empty_list() - has_alternative_id: Optional[ - Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] - ] = empty_list() + has_alternative_id: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = ( + empty_list() + ) excluded_from_QC_check: Optional[Union[dict, Thing]] = None - excluded_subClassOf: Optional[ - Union[Union[str, ClassId], List[Union[str, ClassId]]] - ] = empty_list() + excluded_subClassOf: Optional[Union[Union[str, ClassId], List[Union[str, ClassId]]]] = ( + empty_list() + ) excluded_synonym: Optional[Union[str, List[str]]] = empty_list() should_conform_to: Optional[Union[dict, Thing]] = None created_by: Optional[str] = None @@ -816,9 +816,9 @@ class Term(NamedObject): created: Optional[str] = None date: Optional[Union[str, List[str]]] = empty_list() isDefinedBy: Optional[Union[str, OntologyId]] = None - editor_note: Optional[ - Union[Union[str, NarrativeText], List[Union[str, NarrativeText]]] - ] = empty_list() + editor_note: Optional[Union[Union[str, NarrativeText], List[Union[str, NarrativeText]]]] = ( + empty_list() + ) term_editor: Optional[Union[str, List[str]]] = empty_list() definition_source: Optional[Union[str, List[str]]] = empty_list() ontology_term_requester: Optional[str] = None @@ -846,9 +846,9 @@ class Term(NamedObject): depicted_by: Optional[Union[Union[str, ImageId], List[Union[str, ImageId]]]] = empty_list() page: Optional[Union[str, List[str]]] = empty_list() label: Optional[Union[str, LabelType]] = None - definition: Optional[ - Union[Union[str, NarrativeText], List[Union[str, NarrativeText]]] - ] = empty_list() + definition: Optional[Union[Union[str, NarrativeText], List[Union[str, NarrativeText]]]] = ( + empty_list() + ) def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if not isinstance(self.has_exact_synonym, list): @@ -1134,9 +1134,9 @@ class Class(Term): never_in_taxon: Optional[Union[Union[str, ClassId], List[Union[str, ClassId]]]] = empty_list() disconnected_from: Optional[Union[str, ClassId]] = None has_rank: Optional[Union[dict, Thing]] = None - definition: Optional[ - Union[Union[str, NarrativeText], List[Union[str, NarrativeText]]] - ] = empty_list() + definition: Optional[Union[Union[str, NarrativeText], List[Union[str, NarrativeText]]]] = ( + empty_list() + ) broadMatch: Optional[Union[Union[str, ClassId], List[Union[str, ClassId]]]] = empty_list() exactMatch: Optional[Union[Union[str, ClassId], List[Union[str, ClassId]]]] = empty_list() narrowMatch: Optional[Union[Union[str, ClassId], List[Union[str, ClassId]]]] = empty_list() @@ -1247,14 +1247,14 @@ class Property(Term): is_class_level: Optional[Union[bool, Bool]] = None is_metadata_tag: Optional[Union[bool, Bool]] = None label: Optional[Union[str, LabelType]] = None - definition: Optional[ - Union[Union[str, NarrativeText], List[Union[str, NarrativeText]]] - ] = empty_list() + definition: Optional[Union[Union[str, NarrativeText], List[Union[str, NarrativeText]]]] = ( + empty_list() + ) broadMatch: Optional[Union[Union[str, PropertyId], List[Union[str, PropertyId]]]] = empty_list() exactMatch: Optional[Union[Union[str, PropertyId], List[Union[str, PropertyId]]]] = empty_list() - narrowMatch: Optional[ - Union[Union[str, PropertyId], List[Union[str, PropertyId]]] - ] = empty_list() + narrowMatch: Optional[Union[Union[str, PropertyId], List[Union[str, PropertyId]]]] = ( + empty_list() + ) closeMatch: Optional[Union[Union[str, PropertyId], List[Union[str, PropertyId]]]] = empty_list() subClassOf: Optional[Union[Union[str, PropertyId], List[Union[str, PropertyId]]]] = empty_list() @@ -1362,9 +1362,9 @@ class ObjectProperty(Property): is_cyclic: Optional[Union[bool, Bool]] = None is_transitive: Optional[Union[bool, Bool]] = None shorthand: Optional[Union[str, List[str]]] = empty_list() - equivalentProperty: Optional[ - Union[Union[str, PropertyId], List[Union[str, PropertyId]]] - ] = empty_list() + equivalentProperty: Optional[Union[Union[str, PropertyId], List[Union[str, PropertyId]]]] = ( + empty_list() + ) inverseOf: Optional[Union[str, PropertyId]] = None propertyChainAxiom: Optional[Union[str, List[str]]] = empty_list() disjointWith: Optional[Union[str, List[str]]] = empty_list() @@ -1570,9 +1570,9 @@ class Axiom(YAMLRoot): annotatedProperty: Optional[Union[str, AnnotationPropertyId]] = None annotatedSource: Optional[Union[str, NamedObjectId]] = None annotatedTarget: Optional[Union[dict, Any]] = None - annotations: Optional[ - Union[Union[dict, Annotation], List[Union[dict, Annotation]]] - ] = empty_list() + annotations: Optional[Union[Union[dict, Annotation], List[Union[dict, Annotation]]]] = ( + empty_list() + ) source: Optional[Union[str, List[str]]] = empty_list() is_inferred: Optional[Union[bool, Bool]] = None notes: Optional[Union[str, List[str]]] = empty_list() @@ -1587,9 +1587,9 @@ class Axiom(YAMLRoot): database_cross_reference: Optional[ Union[Union[str, CURIELiteral], List[Union[str, CURIELiteral]]] ] = empty_list() - has_exact_synonym: Optional[ - Union[Union[str, LabelType], List[Union[str, LabelType]]] - ] = empty_list() + has_exact_synonym: Optional[Union[Union[str, LabelType], List[Union[str, LabelType]]]] = ( + empty_list() + ) has_synonym_type: Optional[ Union[Union[str, AnnotationPropertyId], List[Union[str, AnnotationPropertyId]]] ] = empty_list() diff --git a/src/oaklib/datamodels/search_datamodel.py b/src/oaklib/datamodels/search_datamodel.py index 12acf9dfc..c1744713f 100644 --- a/src/oaklib/datamodels/search_datamodel.py +++ b/src/oaklib/datamodels/search_datamodel.py @@ -91,9 +91,9 @@ class SearchBaseConfiguration(YAMLRoot): class_name: ClassVar[str] = "SearchBaseConfiguration" class_model_uri: ClassVar[URIRef] = ONTOSEARCH.SearchBaseConfiguration - search_terms: Optional[ - Union[Union[str, SearchTerm], List[Union[str, SearchTerm]]] - ] = empty_list() + search_terms: Optional[Union[Union[str, SearchTerm], List[Union[str, SearchTerm]]]] = ( + empty_list() + ) syntax: Optional[Union[str, "SearchTermSyntax"]] = None properties: Optional[ Union[Union[str, "SearchProperty"], List[Union[str, "SearchProperty"]]] @@ -166,15 +166,15 @@ class ComplexQuery(YAMLRoot): class_name: ClassVar[str] = "ComplexQuery" class_model_uri: ClassVar[URIRef] = ONTOSEARCH.ComplexQuery - all_of: Optional[ - Union[Union[dict, "ComplexQuery"], List[Union[dict, "ComplexQuery"]]] - ] = empty_list() - any_of: Optional[ - Union[Union[dict, "ComplexQuery"], List[Union[dict, "ComplexQuery"]]] - ] = empty_list() - none_of: Optional[ - Union[Union[dict, "ComplexQuery"], List[Union[dict, "ComplexQuery"]]] - ] = empty_list() + all_of: Optional[Union[Union[dict, "ComplexQuery"], List[Union[dict, "ComplexQuery"]]]] = ( + empty_list() + ) + any_of: Optional[Union[Union[dict, "ComplexQuery"], List[Union[dict, "ComplexQuery"]]]] = ( + empty_list() + ) + none_of: Optional[Union[Union[dict, "ComplexQuery"], List[Union[dict, "ComplexQuery"]]]] = ( + empty_list() + ) path_to: Optional[str] = None atom: Optional[Union[dict, SearchBaseConfiguration]] = None @@ -220,9 +220,9 @@ class PathExpression(YAMLRoot): class_model_uri: ClassVar[URIRef] = ONTOSEARCH.PathExpression traversal: Optional[Union[str, "GraphFunction"]] = None - graph_predicates: Optional[ - Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]] - ] = empty_list() + graph_predicates: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = ( + empty_list() + ) search_term: Optional[Union[dict, SearchBaseConfiguration]] = None def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): @@ -311,9 +311,9 @@ class SearchResultSet(YAMLRoot): class_model_uri: ClassVar[URIRef] = ONTOSEARCH.SearchResultSet configuration: Optional[Union[dict, SearchBaseConfiguration]] = None - results: Optional[ - Union[Union[dict, SearchResult], List[Union[dict, SearchResult]]] - ] = empty_list() + results: Optional[Union[Union[dict, SearchResult], List[Union[dict, SearchResult]]]] = ( + empty_list() + ) result_count: Optional[int] = None cursor: Optional[int] = None diff --git a/src/oaklib/datamodels/taxon_constraints.py b/src/oaklib/datamodels/taxon_constraints.py index 852cfca72..674fb8688 100644 --- a/src/oaklib/datamodels/taxon_constraints.py +++ b/src/oaklib/datamodels/taxon_constraints.py @@ -267,9 +267,9 @@ class TaxonConstraint(YAMLRoot): List[Union[dict, SubjectTerm]], ] ] = empty_dict() - predicates: Optional[ - Union[Union[str, PredicateTermId], List[Union[str, PredicateTermId]]] - ] = empty_list() + predicates: Optional[Union[Union[str, PredicateTermId], List[Union[str, PredicateTermId]]]] = ( + empty_list() + ) sources: Optional[Union[Union[str, URIorCURIE], List[Union[str, URIorCURIE]]]] = empty_list() comments: Optional[Union[str, List[str]]] = empty_list() candidate: Optional[Union[bool, Bool]] = None diff --git a/src/oaklib/implementations/__init__.py b/src/oaklib/implementations/__init__.py index 8ef19c563..0e972c1a6 100644 --- a/src/oaklib/implementations/__init__.py +++ b/src/oaklib/implementations/__init__.py @@ -1,6 +1,7 @@ """ This package serves as the master index for all implementations. """ + from functools import cache from class_resolver import ClassResolver diff --git a/src/oaklib/implementations/amigo/amigo_implementation.py b/src/oaklib/implementations/amigo/amigo_implementation.py index 3cc46783c..7a8445598 100644 --- a/src/oaklib/implementations/amigo/amigo_implementation.py +++ b/src/oaklib/implementations/amigo/amigo_implementation.py @@ -1,4 +1,5 @@ """Adapter for AmiGO solr index.""" + import json import logging from dataclasses import dataclass diff --git a/src/oaklib/implementations/eutils/eutils_implementation.py b/src/oaklib/implementations/eutils/eutils_implementation.py index 9e586b9a1..511b84dd8 100644 --- a/src/oaklib/implementations/eutils/eutils_implementation.py +++ b/src/oaklib/implementations/eutils/eutils_implementation.py @@ -1,4 +1,5 @@ """Abstract Base Class Adapter for EUtils.""" + import logging from abc import ABC from dataclasses import dataclass, field diff --git a/src/oaklib/implementations/eutils/pubmed_implementation.py b/src/oaklib/implementations/eutils/pubmed_implementation.py index fdfd35f40..b8e389227 100644 --- a/src/oaklib/implementations/eutils/pubmed_implementation.py +++ b/src/oaklib/implementations/eutils/pubmed_implementation.py @@ -5,6 +5,7 @@ this is currently highly incomplete. """ + import logging from dataclasses import dataclass @@ -42,7 +43,7 @@ def node( n = obograph.Node( id=curie, lbl=pa.title, - meta=obograph.Meta(definition=obograph.DefinitionPropertyValue(val=pa.abstract)) + meta=obograph.Meta(definition=obograph.DefinitionPropertyValue(val=pa.abstract)), # TODO: creators, ... ) return n diff --git a/src/oaklib/implementations/llm_implementation.py b/src/oaklib/implementations/llm_implementation.py index 75b281e13..61063e365 100644 --- a/src/oaklib/implementations/llm_implementation.py +++ b/src/oaklib/implementations/llm_implementation.py @@ -1,4 +1,5 @@ """A text annotator based on LLM.""" + import json import logging from dataclasses import dataclass diff --git a/src/oaklib/implementations/ncbi/ncbi_gene_implementation.py b/src/oaklib/implementations/ncbi/ncbi_gene_implementation.py index e652dc104..2f81c14d7 100644 --- a/src/oaklib/implementations/ncbi/ncbi_gene_implementation.py +++ b/src/oaklib/implementations/ncbi/ncbi_gene_implementation.py @@ -1,4 +1,5 @@ """Adapter for NCBIGene solr index.""" + import logging from dataclasses import dataclass from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple diff --git a/src/oaklib/implementations/ols/ols_implementation.py b/src/oaklib/implementations/ols/ols_implementation.py index 74d4fab2b..fae33bdfc 100644 --- a/src/oaklib/implementations/ols/ols_implementation.py +++ b/src/oaklib/implementations/ols/ols_implementation.py @@ -122,9 +122,9 @@ def basic_search( "fieldList": "iri,label", "rows": config.limit if config.limit is not None else SEARCH_ROWS, "start": 0, - "exact": "true" - if (config.is_complete is True or config.is_partial is False) - else "false", + "exact": ( + "true" if (config.is_complete is True or config.is_partial is False) else "false" + ), } if len(query_fields) > 0: params["queryFields"] = ",".join(query_fields) diff --git a/src/oaklib/implementations/semsimian/profiler.py b/src/oaklib/implementations/semsimian/profiler.py index 04410b4c3..779dda3a5 100644 --- a/src/oaklib/implementations/semsimian/profiler.py +++ b/src/oaklib/implementations/semsimian/profiler.py @@ -1,4 +1,5 @@ """Profiler for running Semsimian performance tests""" + import pstats import sys diff --git a/src/oaklib/implementations/semsimian/semsimian_implementation.py b/src/oaklib/implementations/semsimian/semsimian_implementation.py index 43354c677..9b17c8a01 100644 --- a/src/oaklib/implementations/semsimian/semsimian_implementation.py +++ b/src/oaklib/implementations/semsimian/semsimian_implementation.py @@ -1,4 +1,5 @@ """Rust implementation of semantic similarity measures.""" + import inspect import logging import math diff --git a/src/oaklib/implementations/simpleobo/simple_obo_parser.py b/src/oaklib/implementations/simpleobo/simple_obo_parser.py index b188ca0db..b07a4bbc7 100644 --- a/src/oaklib/implementations/simpleobo/simple_obo_parser.py +++ b/src/oaklib/implementations/simpleobo/simple_obo_parser.py @@ -6,6 +6,7 @@ The precise parsing of each tag-val pair is delayed until precise semantics are required """ + import logging import re from dataclasses import dataclass, field diff --git a/src/oaklib/implementations/translator/translator_implementation.py b/src/oaklib/implementations/translator/translator_implementation.py index 3869350d7..1bdfe1bcc 100644 --- a/src/oaklib/implementations/translator/translator_implementation.py +++ b/src/oaklib/implementations/translator/translator_implementation.py @@ -7,6 +7,7 @@ Only NodeNormalizer API implemented so far """ + import logging from dataclasses import dataclass from typing import Iterable, List, Mapping, Optional, Union diff --git a/src/oaklib/indexes/edge_index.py b/src/oaklib/indexes/edge_index.py index 20c2d7cce..0cc5ac9ce 100644 --- a/src/oaklib/indexes/edge_index.py +++ b/src/oaklib/indexes/edge_index.py @@ -1,4 +1,5 @@ """Simple in-memory cache for edges.""" + import logging from collections import defaultdict from dataclasses import dataclass diff --git a/src/oaklib/inference/relation_graph_reasoner.py b/src/oaklib/inference/relation_graph_reasoner.py index 06feaa4e6..3ff7b4fa9 100644 --- a/src/oaklib/inference/relation_graph_reasoner.py +++ b/src/oaklib/inference/relation_graph_reasoner.py @@ -1,4 +1,5 @@ """A reasoner that computes entailed edges.""" + import logging import subprocess from dataclasses import dataclass, field diff --git a/src/oaklib/io/obograph_writer.py b/src/oaklib/io/obograph_writer.py index 5c5b99120..e62f23606 100644 --- a/src/oaklib/io/obograph_writer.py +++ b/src/oaklib/io/obograph_writer.py @@ -2,6 +2,7 @@ Utilities for writing out obo graphs """ + from typing import Optional, TextIO, Union from linkml_runtime.dumpers import json_dumper, yaml_dumper diff --git a/src/oaklib/io/streaming_csv_writer.py b/src/oaklib/io/streaming_csv_writer.py index 536eef4f1..1d431bb69 100644 --- a/src/oaklib/io/streaming_csv_writer.py +++ b/src/oaklib/io/streaming_csv_writer.py @@ -174,12 +174,12 @@ def _rewrite_dict(self, obj_as_dict: dict, original: Any): # if original.unionEquivalentTo: # obj_as_dict["unionEquivalentTo"] = original.unionEquivalentTo if original.unionEquivalentToExpression: - obj_as_dict[ - "unionEquivalentToFillerId" - ] = original.unionEquivalentToExpression.fillerId - obj_as_dict[ - "unionEquivalentToPropertyId" - ] = original.unionEquivalentToExpression.propertyId + obj_as_dict["unionEquivalentToFillerId"] = ( + original.unionEquivalentToExpression.fillerId + ) + obj_as_dict["unionEquivalentToPropertyId"] = ( + original.unionEquivalentToExpression.propertyId + ) del obj_as_dict["unionEquivalentToExpression"] del obj_as_dict["meta"] if isinstance(original, summary_stats.UngroupedStatistics): diff --git a/src/oaklib/mappers/base_mapper.py b/src/oaklib/mappers/base_mapper.py index e1a4a4da6..8485915df 100644 --- a/src/oaklib/mappers/base_mapper.py +++ b/src/oaklib/mappers/base_mapper.py @@ -1,4 +1,5 @@ """Base class for all mappers.""" + from abc import ABC from collections import defaultdict from dataclasses import dataclass diff --git a/src/oaklib/parsers/association_parser.py b/src/oaklib/parsers/association_parser.py index c42537145..57050ae3e 100644 --- a/src/oaklib/parsers/association_parser.py +++ b/src/oaklib/parsers/association_parser.py @@ -1,4 +1,5 @@ """Parser for GAF/HPOA and related association formats""" + from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Iterable, Iterator, Optional, TextIO, Union diff --git a/src/oaklib/parsers/boomer_parser.py b/src/oaklib/parsers/boomer_parser.py index 59fba2f7a..e9d29afa6 100644 --- a/src/oaklib/parsers/boomer_parser.py +++ b/src/oaklib/parsers/boomer_parser.py @@ -1,4 +1,5 @@ """Parser for Boomer output""" + import hashlib import logging import re diff --git a/src/oaklib/parsers/gaf_association_parser.py b/src/oaklib/parsers/gaf_association_parser.py index b713a486a..97d34bec4 100644 --- a/src/oaklib/parsers/gaf_association_parser.py +++ b/src/oaklib/parsers/gaf_association_parser.py @@ -1,4 +1,5 @@ """Parser for GAF association formats""" + from dataclasses import dataclass, field from enum import Enum from typing import List, Union diff --git a/src/oaklib/parsers/gencc_association_parser.py b/src/oaklib/parsers/gencc_association_parser.py index 40da71aa0..ce341f30a 100644 --- a/src/oaklib/parsers/gencc_association_parser.py +++ b/src/oaklib/parsers/gencc_association_parser.py @@ -1,4 +1,5 @@ """Parser for GAF association formats""" + import csv from dataclasses import dataclass from typing import Iterator, Optional, TextIO, Union diff --git a/src/oaklib/parsers/hpoa_association_parser.py b/src/oaklib/parsers/hpoa_association_parser.py index 899c619f7..418de2f63 100644 --- a/src/oaklib/parsers/hpoa_association_parser.py +++ b/src/oaklib/parsers/hpoa_association_parser.py @@ -1,4 +1,5 @@ """Parser for GAF association formats""" + from dataclasses import dataclass, field from typing import List, Union diff --git a/src/oaklib/parsers/hpoa_g2d_association_parser.py b/src/oaklib/parsers/hpoa_g2d_association_parser.py index 511e2aedb..f1db2d46f 100644 --- a/src/oaklib/parsers/hpoa_g2d_association_parser.py +++ b/src/oaklib/parsers/hpoa_g2d_association_parser.py @@ -1,4 +1,5 @@ """Parser for GAF association formats""" + import csv from dataclasses import dataclass from typing import Iterator, Optional, TextIO diff --git a/src/oaklib/parsers/hpoa_g2p_association_parser.py b/src/oaklib/parsers/hpoa_g2p_association_parser.py index d0b30d79b..a4d8fd73e 100644 --- a/src/oaklib/parsers/hpoa_g2p_association_parser.py +++ b/src/oaklib/parsers/hpoa_g2p_association_parser.py @@ -1,4 +1,5 @@ """Parser for GAF association formats""" + from dataclasses import dataclass, field from oaklib.parsers.parser_base import ColumnReference diff --git a/src/oaklib/parsers/kgx_association_parser.py b/src/oaklib/parsers/kgx_association_parser.py index dd18bb49e..609a00309 100644 --- a/src/oaklib/parsers/kgx_association_parser.py +++ b/src/oaklib/parsers/kgx_association_parser.py @@ -1,4 +1,5 @@ """Parser for KGX""" + from csv import DictReader from dataclasses import dataclass from typing import Iterator, TextIO diff --git a/src/oaklib/parsers/mim2gene_association_parser.py b/src/oaklib/parsers/mim2gene_association_parser.py index e2cb75b3b..3be41accc 100644 --- a/src/oaklib/parsers/mim2gene_association_parser.py +++ b/src/oaklib/parsers/mim2gene_association_parser.py @@ -1,4 +1,5 @@ """Parser for GAF association formats""" + import csv from dataclasses import dataclass, field from typing import Iterator, Optional, TextIO, Union diff --git a/src/oaklib/parsers/pairwise_association_parser.py b/src/oaklib/parsers/pairwise_association_parser.py index 895a32888..7124ad577 100644 --- a/src/oaklib/parsers/pairwise_association_parser.py +++ b/src/oaklib/parsers/pairwise_association_parser.py @@ -1,4 +1,5 @@ """Parser for GAF association formats""" + from dataclasses import dataclass, field from oaklib.parsers.parser_base import ColumnReference diff --git a/src/oaklib/parsers/parser_base.py b/src/oaklib/parsers/parser_base.py index 6e67f5ee6..b6a5fb4b9 100644 --- a/src/oaklib/parsers/parser_base.py +++ b/src/oaklib/parsers/parser_base.py @@ -1,4 +1,5 @@ """Base class for all parsers.""" + from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Any, Callable, Iterator, List, Optional, TextIO, Tuple diff --git a/src/oaklib/parsers/phaf_association_parser.py b/src/oaklib/parsers/phaf_association_parser.py index 775064ec5..bb31f456c 100644 --- a/src/oaklib/parsers/phaf_association_parser.py +++ b/src/oaklib/parsers/phaf_association_parser.py @@ -1,4 +1,5 @@ """Parser for PomBase PHAF association formats""" + from dataclasses import dataclass, field from oaklib.parsers.parser_base import ColumnReference diff --git a/src/oaklib/parsers/xaf_association_parser.py b/src/oaklib/parsers/xaf_association_parser.py index 753b3f5c6..186e20975 100644 --- a/src/oaklib/parsers/xaf_association_parser.py +++ b/src/oaklib/parsers/xaf_association_parser.py @@ -1,4 +1,5 @@ """Parser for GAF/HPOA and related association formats""" + import logging import re from dataclasses import dataclass, field diff --git a/src/oaklib/utilities/associations/association_index.py b/src/oaklib/utilities/associations/association_index.py index 074d3d1e3..ef89e2386 100644 --- a/src/oaklib/utilities/associations/association_index.py +++ b/src/oaklib/utilities/associations/association_index.py @@ -1,4 +1,5 @@ """An in-memory sqlite index for simple associations.""" + import logging import sqlite3 from collections import defaultdict diff --git a/src/oaklib/utilities/graph/networkx_bridge.py b/src/oaklib/utilities/graph/networkx_bridge.py index 8a6d04359..03144f5d9 100644 --- a/src/oaklib/utilities/graph/networkx_bridge.py +++ b/src/oaklib/utilities/graph/networkx_bridge.py @@ -4,6 +4,7 @@ NetworkX is a popular python package for working with graphs """ + from collections import defaultdict from typing import Dict, Iterable, List, Tuple diff --git a/src/oaklib/utilities/graph/relationship_walker.py b/src/oaklib/utilities/graph/relationship_walker.py index 3192a16ee..36472302d 100644 --- a/src/oaklib/utilities/graph/relationship_walker.py +++ b/src/oaklib/utilities/graph/relationship_walker.py @@ -4,6 +4,7 @@ """ + import logging from copy import copy from typing import Iterable, List, Union diff --git a/src/oaklib/utilities/lexical/lexical_indexer.py b/src/oaklib/utilities/lexical/lexical_indexer.py index e3e196524..d7574a19c 100644 --- a/src/oaklib/utilities/lexical/lexical_indexer.py +++ b/src/oaklib/utilities/lexical/lexical_indexer.py @@ -5,6 +5,7 @@ Various utilities for working with lexical aspects of ontologies plus mappings """ + import logging import re import typing as t diff --git a/src/oaklib/utilities/lexical/patternizer.py b/src/oaklib/utilities/lexical/patternizer.py index 4d82965c7..6fc2c2629 100644 --- a/src/oaklib/utilities/lexical/patternizer.py +++ b/src/oaklib/utilities/lexical/patternizer.py @@ -1,4 +1,5 @@ """Detect logical definitions from lexical elements in an ontology.""" + import logging import urllib from typing import Dict, Iterator, List, Optional diff --git a/src/oaklib/utilities/obograph_utils.py b/src/oaklib/utilities/obograph_utils.py index fb48c4291..4f646aa39 100644 --- a/src/oaklib/utilities/obograph_utils.py +++ b/src/oaklib/utilities/obograph_utils.py @@ -5,6 +5,7 @@ See :ref:`datamodels` """ + import io import json import logging diff --git a/src/oaklib/utilities/rate_limiter.py b/src/oaklib/utilities/rate_limiter.py index 2efd65e08..5ca42a96e 100644 --- a/src/oaklib/utilities/rate_limiter.py +++ b/src/oaklib/utilities/rate_limiter.py @@ -1,6 +1,7 @@ """ https://stackoverflow.com/questions/40748687/python-api-rate-limiting-how-to-limit-api-calls-globally """ + from ratelimit import limits, sleep_and_retry # calls per minute diff --git a/tests/test_converters/test_obo_graph_to_fhir.py b/tests/test_converters/test_obo_graph_to_fhir.py index 0056a4ed6..bd1bc75f7 100644 --- a/tests/test_converters/test_obo_graph_to_fhir.py +++ b/tests/test_converters/test_obo_graph_to_fhir.py @@ -1,4 +1,5 @@ """Tests for: Obographs to FHIR converter""" + import os import unittest from typing import List diff --git a/tests/test_implementations/__init__.py b/tests/test_implementations/__init__.py index 269eb093f..2afeca1dc 100644 --- a/tests/test_implementations/__init__.py +++ b/tests/test_implementations/__init__.py @@ -2,6 +2,7 @@ See _ """ + import json import logging import tempfile