Update a nested dictionary or similar mapping. Modify ``source`` in place. :type source: collections.Mapping :type overrides: collections.Mapping :rtype: collections.Mapping
(source, overrides)
| 32 | |
| 33 | |
| 34 | def deep_update(source, overrides): |
| 35 | """Update a nested dictionary or similar mapping. |
| 36 | |
| 37 | Modify ``source`` in place. |
| 38 | |
| 39 | :type source: collections.Mapping |
| 40 | :type overrides: collections.Mapping |
| 41 | :rtype: collections.Mapping |
| 42 | """ |
| 43 | for key, value in overrides.items(): |
| 44 | if isinstance(value, collections.Mapping) and value: |
| 45 | returned = deep_update(source.get(key, {}), value) |
| 46 | source[key] = returned |
| 47 | else: |
| 48 | source[key] = overrides[key] |
| 49 | return source |
| 50 | |
| 51 | |
| 52 | def extract_method(wrapped_method): |