diff options
-rw-r--r-- | buildstream/_yaml.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py index ca12acae9..f44572ca5 100644 --- a/buildstream/_yaml.py +++ b/buildstream/_yaml.py @@ -1049,6 +1049,12 @@ class ChainMap(collections.ChainMap): for key in clearable: del self[key] + def get(self, key, default=None): + try: + return self[key] + except KeyError: + return default + def node_chain_copy(source): copy = ChainMap({}, source) |