import merge_dicts from yagicard
This commit is contained in:
12
goat/util.py
12
goat/util.py
@@ -13,3 +13,15 @@ def find_nearest(path, test):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
path = parent_path
|
path = parent_path
|
||||||
|
|
||||||
|
def merge_dicts (dicts):
|
||||||
|
fusion = {}
|
||||||
|
for source in dicts:
|
||||||
|
if not source:
|
||||||
|
continue
|
||||||
|
|
||||||
|
for key, value in source.items():
|
||||||
|
if isinstance(value, dict):
|
||||||
|
value = merge_dicts([fusion.get(key, None), value])
|
||||||
|
fusion[key] = value
|
||||||
|
return fusion
|
||||||
|
|||||||
Reference in New Issue
Block a user