Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
4f3e3ac1
Commit
4f3e3ac1
authored
6 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Correctly match 'dict.pop' api
parent
8ea88785
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/util/caches/expiringcache.py
+11
-3
11 additions, 3 deletions
synapse/util/caches/expiringcache.py
with
11 additions
and
3 deletions
synapse/util/caches/expiringcache.py
+
11
−
3
View file @
4f3e3ac1
...
@@ -98,10 +98,18 @@ class ExpiringCache(object):
...
@@ -98,10 +98,18 @@ class ExpiringCache(object):
return
entry
.
value
return
entry
.
value
def
pop
(
self
,
key
,
default
=
None
):
def
pop
(
self
,
key
,
default
=
SENTINEL
):
value
=
self
.
_cache
.
pop
(
key
,
SENTINEL
)
"""
Removes and returns the value with the given key from the cache.
If the key isn
'
t in the cache then `default` will be returned if
specified, otherwise `KeyError` will get raised.
Identical functionality to `dict.pop(..)`.
"""
value
=
self
.
_cache
.
pop
(
key
,
default
)
if
value
is
SENTINEL
:
if
value
is
SENTINEL
:
r
eturn
default
r
aise
KeyError
(
key
)
return
value
return
value
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment