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)
| 218 | |
| 219 | |
| 220 | def _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") |
no test coverage detected
searching dependent graphs…