mirror of
https://github.com/certbot/certbot.git
synced 2026-07-27 08:09:10 +02:00
ImmutableMap.update
This commit is contained in:
@@ -57,6 +57,12 @@ class ImmutableMap(collections.Mapping, collections.Hashable):
|
||||
for slot in self.__slots__:
|
||||
object.__setattr__(self, slot, kwargs.pop(slot))
|
||||
|
||||
def update(self, **kwargs):
|
||||
"""Return updated map."""
|
||||
items = dict(self)
|
||||
items.update(kwargs)
|
||||
return type(self)(**items)
|
||||
|
||||
def __getitem__(self, key):
|
||||
try:
|
||||
return getattr(self, key)
|
||||
|
||||
Reference in New Issue
Block a user