(cls, initializer, initargs)
| 48 | |
| 49 | @classmethod |
| 50 | def prepare(cls, initializer, initargs): |
| 51 | if initializer is not None: |
| 52 | if not callable(initializer): |
| 53 | raise TypeError("initializer must be a callable") |
| 54 | def create_context(): |
| 55 | return cls(initializer, initargs) |
| 56 | def resolve_task(fn, args, kwargs): |
| 57 | return (fn, args, kwargs) |
| 58 | return create_context, resolve_task |
| 59 | |
| 60 | def __init__(self, initializer, initargs): |
| 61 | self.initializer = initializer |