schrodinger :: infra :: util :: DecoratorAndContextManager :: Class DecoratorAndContextManager
[hide private]
[frames] | no frames]

Class DecoratorAndContextManager

object --+
         |
        DecoratorAndContextManager
Known Subclasses:

An abstract base class for context managers that can also be used to decorate functions and classes. When a function is decorated, it is equivalent to always running it inside the context manager. When a class is decorated, it is equivalent to decorating every method of the class.

This is tested in mmerr_test.

Instance Methods [hide private]
 
__enter__(self)
Enter the context manager: must be defined in subclasses.
 
__exit__(self, exc_type, exc_value, traceback)
Exit context manager: must be defined in subclasses.
 
_decorateCallable(self, function)
Wrap a function in this context.
 
_decorateClass(self, decoratee_cls)
Wrap methods of a class in this context.
 
decorate(self, decoratee)
Decorate a function or class.
 
__call__(self, decoratee)
Allow decorating with parentheses.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__exit__(self, exc_type, exc_value, traceback)

 

Exit context manager: must be defined in subclasses.

Exception handling arguments are required by context manager signature.