Context manager decorator
(self, func)
| 275 | |
| 276 | class ContextManager(_GeneratorContextManager): |
| 277 | def __call__(self, func): |
| 278 | """Context manager decorator""" |
| 279 | return FunctionMaker.create( |
| 280 | func, "with _self_: return _func_(%(shortsignature)s)", |
| 281 | dict(_self_=self, _func_=func), __wrapped__=func) |
| 282 | |
| 283 | |
| 284 | init = getfullargspec(_GeneratorContextManager.__init__) |