Add a dict-compatible API for ResourceDictField and make it immutable.

Review Request #12252 — Created April 22, 2022 and submitted — Latest diff uploaded

Information

RBTools
release-3.x

Reviewers

ResourceDictField behaves sort of like a standard dict, but it
wasn't one. It lacked a lot of the functions and behavior that a dict
would support. It wasn't mutable, and didn't pretend to be, but the lack
of standard mutable dictionary operations made it a bit confusing.

This change updates this class to inherit from MutableMapping, giving
it a standard dict interface. All mutable operations are now available
on the class, but will raise a helpful message explaining that the
dictionary cannot be modified and how to do an update to the resource,
which should be useful to people working with the API.

Subclasses will build upon this to offer better immutable guidance (for
the extra_data support).

Unit tests pass on all supported versions of Python.

Commits

Files