mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 15:28:37 -05:00
Allow CachedQueryMutator to be used not as a context manager.
This commit is contained in:
@@ -196,14 +196,10 @@ class CachedQueryMutator(object):
|
||||
self.to_prune = set()
|
||||
|
||||
def __enter__(self):
|
||||
self.mutator.__enter__()
|
||||
return self
|
||||
|
||||
def __exit__(self, type, value, traceback):
|
||||
self.mutator.__exit__(type, value, traceback)
|
||||
|
||||
if self.to_prune:
|
||||
CachedQuery._prune_multi(self.to_prune)
|
||||
self.send()
|
||||
|
||||
def insert(self, query, things):
|
||||
if not things:
|
||||
@@ -220,6 +216,12 @@ class CachedQueryMutator(object):
|
||||
|
||||
query._delete(self.mutator, things)
|
||||
|
||||
def send(self):
|
||||
self.mutator.send()
|
||||
|
||||
if self.to_prune:
|
||||
CachedQuery._prune_multi(self.to_prune)
|
||||
|
||||
|
||||
def filter_identity(x):
|
||||
return x
|
||||
|
||||
Reference in New Issue
Block a user