1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-19 02:17:38 +03:00

Fix deep_get not returning the correct on success

I forgot to actually return the given data if we manage to index to the
requested depth
This commit is contained in:
A_D 2020-07-13 23:01:42 +02:00 committed by Athanasius
parent 2403ed1d2f
commit b6482878f0

12
EDMC.py
View File

@ -49,16 +49,18 @@ def versioncmp(versionstring):
def deep_get(target: dict, *args: str, default=None) -> Any:
if not hasattr(target, 'get'):
raise ValueError("Cannot call get on {} ({})".format(target, type(target)))
current = target
for arg in args:
res = current.get(arg)
if res is not None:
current = res
if res is None:
return default
else:
break
current = res
return default
return current
def main():