• 
      

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

    Review Request #12252 — Created April 23, 2022 and submitted

    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.

    Summary ID
    Add a dict-compatible API for ResourceDictField and make it immutable.
    `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).
    2d147b6ca8ad0a226fdd8e8db39f9cc563a9d8cc
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-3.x (77e5ba8)