From 8dee26adf91960de91ffc3ca149363124a3cdef0 Mon Sep 17 00:00:00 2001 From: David Michaels Date: Tue, 19 Dec 2023 15:17:22 -0500 Subject: [PATCH] minor portal_utils refactoring --- dcicutils/portal_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dcicutils/portal_utils.py b/dcicutils/portal_utils.py index 3f84da3cd..d95d6ca19 100644 --- a/dcicutils/portal_utils.py +++ b/dcicutils/portal_utils.py @@ -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: @@ -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: @@ -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):