Add utility functions for working with nested dictionary keys.

Review Request #13993 — Created June 23, 2024 and submitted — Latest diff uploaded

Information

Djblets
release-5.x

Reviewers

A pattern that crops up from time to time is the need to work with
nested dictionary keys, setting or retrieving something deep in a
dictionary while handling type conflicts and avoiding unwanted
alteration of data.

This introduces two dict_get_path_value() and dict_set_path_value()
for working with this pattern. These standard methods can be used to
more easily work with path-based key management in dictionaries.

Unit tests pass.

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Add utility functions for working with nested dictionary keys.
A pattern that crops up from time to time is the need to work with nested dictionary keys, setting or retrieving something deep in a dictionary while handling type conflicts and avoiding unwanted alteration of data. This introduces two `dict_get_path_value()` and `dict_set_path_value()` for working with this pattern. These standard methods can be used to more easily work with path-based key management in dictionaries.
91496adb36fb1733fb92c8926698fc4f6e0cfa29 Christian Hammond
djblets/util/datastructures.py
djblets/util/tests/test_datastructures.py
Loading...