Changeset 833470c in rtems-central for rtemsqual/items.py


Ignore:
Timestamp:
May 6, 2020, 10:36:53 AM (9 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
1767cc8
Parents:
a5f3cc1
git-author:
Sebastian Huber <sebastian.huber@…> (05/06/20 10:36:53)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/28/20 08:38:22)
Message:

items: Add Item.get()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rtemsqual/items.py

    ra5f3cc1 r833470c  
    130130        return key in self._data
    131131
    132     def __getitem__(self, name: str) -> Any:
    133         return self._data[name]
     132    def __getitem__(self, key: str) -> Any:
     133        return self._data[key]
     134
     135    def get(self, key: str, default: Any) -> Any:
     136        """
     137        Gets the attribute value if the attribute exists, otherwise the
     138        specified default value is returned.
     139        """
     140        return self._data.get(key, default)
    134141
    135142    def get_by_key_path(self,
Note: See TracChangeset for help on using the changeset viewer.