Repository URL to install this package:
Version:
1:7.26.0-1 ▾
|
datadog-agent
/
opt
/
datadog-agent
/
embedded
/
lib
/
python3.8
/
site-packages
/
ddtrace
/
utils
/
merge.py
|
---|
# Borrowed from: https://stackoverflow.com/questions/20656135/python-deep-merge-dictionary-data#20666342
def deepmerge(source, destination):
"""
Merge the first provided ``dict`` into the second.
:param dict source: The ``dict`` to merge into ``destination``
:param dict destination: The ``dict`` that should get updated
:rtype: dict
:returns: ``destination`` modified
"""
for key, value in source.items():
if isinstance(value, dict):
# get node or create one
node = destination.setdefault(key, {})
deepmerge(value, node)
else:
destination[key] = value
return destination