Add a dict-compatible API for ResourceDictField and make it immutable.
Review Request #12252 — Created April 22, 2022 and submitted — Latest diff uploaded
ResourceDictField
behaves sort of like a standarddict
, but it
wasn't one. It lacked a lot of the functions and behavior that adict
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 standarddict
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
theextra_data
support).
Unit tests pass on all supported versions of Python.