Skip to content

Commit

Permalink
minor portal_utils refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed Dec 19, 2023
1 parent 6294aa2 commit 8dee26a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dcicutils/portal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def get_schemas_super_type_map(self) -> dict:
This is a dictionary of all types which have (one or more) sub-types whose value is
an array of all of those sub-types (direct and all descendents), in breadth first order.
"""
def breadth_first(super_type_map: dict, super_type_name: str) -> dict:
def list_breadth_first(super_type_map: dict, super_type_name: str) -> dict:
result = []
queue = deque(super_type_map.get(super_type_name, []))
while queue:
Expand All @@ -289,7 +289,7 @@ def breadth_first(super_type_map: dict, super_type_name: str) -> dict:
super_type_map[super_type_name].append(type_name)
super_type_map_flattened = {}
for super_type_name in super_type_map:
super_type_map_flattened[super_type_name] = breadth_first(super_type_map, super_type_name)
super_type_map_flattened[super_type_name] = list_breadth_first(super_type_map, super_type_name)
return super_type_map_flattened

def url(self, url: str) -> str:
Expand Down Expand Up @@ -320,7 +320,7 @@ def infer_app_from_env(env: str) -> Optional[str]: # noqa
if is_valid_app(app) or (app := infer_app_from_env(env)):
return os.path.join(Portal.KEYS_FILE_DIRECTORY, f".{app.lower()}-keys.json")

def _response(self, response: TestResponse) -> Optional[Response]:
def _response(self, response: TestResponse) -> TestResponse:
if response and isinstance(getattr(response.__class__, "json"), property):
class TestResponseWrapper(TestResponse): # For consistency change json property to method.
def __init__(self, response, **kwargs):
Expand Down

0 comments on commit 8dee26a

Please sign in to comment.