1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-22 07:43:06 +00:00

hashindex: simplify .pop

This commit is contained in:
Thomas Waldmann 2024-10-26 00:37:00 +02:00
parent bdf2602e7c
commit 3c794fa980
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -141,13 +141,11 @@ class NSIndex1:
def pop(self, key, default=_NoDefault): def pop(self, key, default=_NoDefault):
try: try:
value = self[key] return self.ht.pop(key)
del self[key]
return value
except KeyError: except KeyError:
if default != _NoDefault: if default is _NoDefault:
return default raise
raise return default
def iteritems(self, marker=None): def iteritems(self, marker=None):
do_yield = marker is None do_yield = marker is None