Closed proofit404 closed 3 years ago
@operation objects are designed to be called inside object which has it as a dependency.
@operation
It's totally fine to use them as asynchronous iterables inside asynchronous objects.
This feature does not require Container to be awaited before dependency injection happens.
Container
class App: def __init__(self, do): self.do = do async def run(self): async for action in self.do(): print(action) class Container(Injector): app = App @operation async def do(): yield 1 yield 2 yield 3 await Container.app.run() # prints 1, 2, and 3
Superseded by #457
@operation
objects are designed to be called inside object which has it as a dependency.It's totally fine to use them as asynchronous iterables inside asynchronous objects.
This feature does not require
Container
to be awaited before dependency injection happens.