mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Don't handle merging lists
Doesn't work clearly
This commit is contained in:
@@ -106,7 +106,7 @@ def _merge_dictionaries(a, b, path=None, update=True):
|
|||||||
"""
|
"""
|
||||||
Merge two dictionaries recursively.
|
Merge two dictionaries recursively.
|
||||||
|
|
||||||
From https://stackoverflow.com/a/25270947
|
From https://stackoverflow.com/a/7205107
|
||||||
"""
|
"""
|
||||||
if path is None:
|
if path is None:
|
||||||
path = []
|
path = []
|
||||||
@@ -116,14 +116,6 @@ def _merge_dictionaries(a, b, path=None, update=True):
|
|||||||
_merge_dictionaries(a[key], b[key], path + [str(key)])
|
_merge_dictionaries(a[key], b[key], path + [str(key)])
|
||||||
elif a[key] == b[key]:
|
elif a[key] == b[key]:
|
||||||
pass # same leaf value
|
pass # same leaf value
|
||||||
elif isinstance(a[key], list) and isinstance(b[key], list):
|
|
||||||
for idx, val in enumerate(b[key]):
|
|
||||||
a[key][idx] = _merge_dictionaries(
|
|
||||||
a[key][idx],
|
|
||||||
b[key][idx],
|
|
||||||
path + [str(key), str(idx)],
|
|
||||||
update=update
|
|
||||||
)
|
|
||||||
elif update:
|
elif update:
|
||||||
a[key] = b[key]
|
a[key] = b[key]
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user