This repository has been archived by the owner. It is now read-only.
Browse files

SimpleSillyStub: Add __exit__ and __exit__ for context managers

  • Loading branch information...
elnuno authored and bsimpson63 committed Mar 23, 2017
1 parent 1b66f1c commit 52728820cfc60a9a7be47272ff7fb1031c2710c7
Showing with 4 additions and 0 deletions.
  1. +4 −0 r2/r2/lib/utils/
@@ -1534,6 +1534,7 @@ def __setattr__(cls, key, val):
def __repr__(cls):
raise Hell()
class SimpleSillyStub(object):
"""A simple stub object that does nothing when you call its methods."""
def __nonzero__(self):
@@ -1545,6 +1546,9 @@ def __getattr__(self, name):
def stub(self, *args, **kwargs):
+ __exit__ = __enter__ = stub
def strordict_fullname(item, key='fullname'):
"""Sometimes we migrate AMQP queues from simple strings to pickled
dictionaries. During the migratory period there may be items in

0 comments on commit 5272882

Please sign in to comment.