Mercurial > hgrepos > Python > libs > ConfigMix
diff configmix/__init__.py @ 11:aecb36d4025f
Deactivate the "dict_merge()" function from yconfig
| author | Franz Glasner <f.glasner@feldmann-mg.com> |
|---|---|
| date | Wed, 09 Mar 2016 11:32:08 +0100 |
| parents | 58af59d5af40 |
| children | 24ba462b9b4b |
line wrap: on
line diff
--- a/configmix/__init__.py Wed Mar 09 11:19:20 2016 +0100 +++ b/configmix/__init__.py Wed Mar 09 11:32:08 2016 +0100 @@ -19,24 +19,25 @@ __all__ = [] -# -# From: https://github.com/jet9/python-yconfig/blob/master/yconfig.py -# License: BSD License -# -def dict_merge(a, b): - """Recursively merges dict's. not just simple a['key'] = b['key'], if - both a and bhave a key who's value is a dict then dict_merge is called - on both values and the result stored in the returned dictionary.""" +if 0: + # + # From: https://github.com/jet9/python-yconfig/blob/master/yconfig.py + # License: BSD License + # + def dict_merge(a, b): + """Recursively merges dict's. not just simple a['key'] = b['key'], if + both a and bhave a key who's value is a dict then dict_merge is called + on both values and the result stored in the returned dictionary.""" - if not isinstance(b, dict): - return b - result = deepcopy(a) - for k, v in b.iteritems(): - if k in result and isinstance(result[k], dict): - result[k] = dict_merge(result[k], v) - else: - result[k] = deepcopy(v) - return result + if not isinstance(b, dict): + return b + result = deepcopy(a) + for k, v in b.iteritems(): + if k in result and isinstance(result[k], dict): + result[k] = dict_merge(result[k], v) + else: + result[k] = deepcopy(v) + return result def merge(user, default):
