Can be used by subclasses as a decorator, to return a factory that will allow instantiation with the decorated object.
(cls, func)
| 65 | |
| 66 | @classmethod |
| 67 | def wrap(cls, func): |
| 68 | """Can be used by subclasses as a decorator, to return a factory that |
| 69 | will allow instantiation with the decorated object. |
| 70 | """ |
| 71 | @functools.wraps(func) |
| 72 | def transformer_factory(**kwargs): |
| 73 | return cls(func, **kwargs) |
| 74 | |
| 75 | return transformer_factory |
| 76 | |
| 77 | class StatelessInputTransformer(InputTransformer): |
| 78 | """Wrapper for a stateless input transformer implemented as a function.""" |