You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The recursive function that manages state looks like it might be off.
To Reproduce
There is no issue to reproduce per se. It just seems like the function should be something like:
def search_state(search_dict: dict, search_key: Cluster, output: list = None) -> list:
"""
Search nested dicts and lists for the search_value (key)
and return the corresponding value.
"""
if output is None:
output = []
for k, v in search_dict.items():
if k is not search_key and isinstance(v, list):
for item in v:
if isinstance(item, dict):
search_state(item, search_key, output)
if isinstance(v, dict): # << add this if block
search(v, search_key, output)
else:
for item in v:
output.append(item)
return output
Instead of:
def search_state(search_dict: dict, search_key: Cluster, output: list = None) -> list:
"""
Search nested dicts and lists for the search_value (key)
and return the corresponding value.
"""
if output is None:
output = []
for k, v in search_dict.items():
if k is not search_key and isinstance(v, list):
for item in v:
if isinstance(item, dict):
search_state(item, search_key, output)
else:
for item in v:
output.append(item)
return output
Expected behavior
State can be searched by architectures code base
Screenshots
None.
Desktop (please complete the following information):
All
Additional context
This has not been tested directly and as mentioned does not appear to be resulting in an issue, but a recent test of this function in a difference context revealed an issue that i think might be present here.
The text was updated successfully, but these errors were encountered:
Describe the bug
The recursive function that manages state looks like it might be off.
To Reproduce
There is no issue to reproduce per se. It just seems like the function should be something like:
Instead of:
Expected behavior
State can be searched by architectures code base
Screenshots
None.
Desktop (please complete the following information):
All
Additional context
This has not been tested directly and as mentioned does not appear to be resulting in an issue, but a recent test of this function in a difference context revealed an issue that i think might be present here.
The text was updated successfully, but these errors were encountered: