Skip to content

Commit

Permalink
- Added method portal_utils.get_schema_super_type_names (for use by s…
Browse files Browse the repository at this point in the history
…maht-submitr).
  • Loading branch information
dmichaels-harvard committed Mar 5, 2025
1 parent ca9a460 commit aefca3c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions dcicutils/portal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,16 +473,15 @@ def list_breadth_first(super_type_map: dict, super_type_name: str) -> dict:

@lru_cache(maxsize=100)
def get_schema_super_type_names(self, schema_name: str, include_schema_name: bool = False) -> List[str]:
super_types = set()
if isinstance(schema_name, str) and (schema_name := self.schema_name(schema_name)):
if isinstance(super_type_map := self.get_schemas_super_type_map(), dict):
super_types = set()
for super_type_name in super_type_map:
if schema_name in super_type_map[super_type_name]:
super_types.add(super_type_name)
if (include_schema_name is True) and super_types and self.get_schema(schema_name):
super_types.add(schema_name)
return list(super_types)
return []
if (include_schema_name is True) and self.get_schema(schema_name):
super_types.insert(0, schema_name)
return list(super_types)

@lru_cache(maxsize=100)
def get_schema_subtype_names(self, type_name: str) -> List[str]:
Expand Down

0 comments on commit aefca3c

Please sign in to comment.