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:
parent
bdf2602e7c
commit
3c794fa980
1 changed files with 4 additions and 6 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue