MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _update_nested_dict

Function _update_nested_dict

lib/matplotlib/style/__init__.py:220–231  ·  view source on GitHub ↗

Update nested dict (only level of nesting) with new values. Unlike `dict.update`, this assumes that the values of the parent dict are dicts (or dict-like), so you shouldn't replace the nested dict if it already exists. Instead you should update the sub-dict.

(main_dict, new_dict)

Source from the content-addressed store, hash-verified

218
219
220def _update_nested_dict(main_dict, new_dict):
221 """
222 Update nested dict (only level of nesting) with new values.
223
224 Unlike `dict.update`, this assumes that the values of the parent dict are
225 dicts (or dict-like), so you shouldn't replace the nested dict if it
226 already exists. Instead you should update the sub-dict.
227 """
228 # update named styles specified by user
229 for name, rc_dict in new_dict.items():
230 main_dict.setdefault(name, {}).update(rc_dict)
231 return main_dict
232
233
234@_api.deprecated("3.11")

Callers 2

_update_user_libraryFunction · 0.85
update_nested_dictFunction · 0.85

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…