mirror of
https://github.com/certbot/certbot.git
synced 2026-06-13 18:50:20 -04:00
ImmutableMap.update
This commit is contained in:
parent
b24487a14b
commit
5c40daaf1c
1 changed files with 6 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue