Skip to content

Commit

Permalink
imports order fixed by ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
turbomam committed Jul 26, 2024
1 parent 744ecce commit a3ebaf1
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/oaklib/utilities/subsets/value_set_expander.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from abc import ABC
from dataclasses import dataclass, field
from pathlib import Path
from typing import Iterator, List, Union, Optional
from typing import Iterator, List, Optional, Union

import click
from linkml_runtime.dumpers import json_dumper
Expand Down Expand Up @@ -72,23 +72,31 @@ def expand_value_set(
vset = schema.enums[inherited]
pvs.extend(
self.expand_value_set(
vset, schema=schema, source_enum_definition=source_enum_definition,
pv_syntax=pv_syntax
vset,
schema=schema,
source_enum_definition=source_enum_definition,
pv_syntax=pv_syntax,
)
)
if value_set.include:
for include in value_set.include:
if isinstance(include, AnonymousEnumExpression):
pvs.extend(
self.expand_value_set(
include, schema=schema, source_enum_definition=source_enum_definition, pv_syntax=pv_syntax
include,
schema=schema,
source_enum_definition=source_enum_definition,
pv_syntax=pv_syntax,
)
)
else:
raise ValueError(f"Unexpected type for include: {type(include)}")
pvs.extend(
self.expand_value_set(
include, schema=schema, source_enum_definition=source_enum_definition, pv_syntax=pv_syntax
include,
schema=schema,
source_enum_definition=source_enum_definition,
pv_syntax=pv_syntax,
)
)
if value_set.concepts:
Expand Down Expand Up @@ -138,7 +146,11 @@ def expand_value_set(
rq.source_nodes, predicates=predicates, reflexive=rq.include_self
)
for curie in results:
pvs.append(self._generate_permissible_value(curie, oi, source_enum_definition, pv_syntax=pv_syntax))
pvs.append(
self._generate_permissible_value(
curie, oi, source_enum_definition, pv_syntax=pv_syntax
)
)
else:
raise NotImplementedError(f"Must be an OboGraphInterface: {type(oi)}")
if value_set.minus:
Expand All @@ -147,7 +159,10 @@ def expand_value_set(
minus_vs, AnonymousEnumExpression
):
for pv in self.expand_value_set(
minus_vs, schema=schema, source_enum_definition=source_enum_definition, pv_syntax=pv_syntax
minus_vs,
schema=schema,
source_enum_definition=source_enum_definition,
pv_syntax=pv_syntax,
):
if pv in pvs:
pvs.remove(pv)
Expand Down Expand Up @@ -209,7 +224,6 @@ def _generate_permissible_value(
text = curie
return PermissibleValue(text=text, meaning=curie, description=definition, title=label)


def expand_in_place(
self,
schema_path: Union[str, Path],
Expand Down

0 comments on commit a3ebaf1

Please sign in to comment.