(container, *, deps, backend: str)
| 35 | |
| 36 | |
| 37 | def _convert(container, *, deps, backend: str): |
| 38 | from returns.interfaces.specific import future, reader # noqa: PLC0415 |
| 39 | |
| 40 | if isinstance(container, future.AwaitableFutureN): |
| 41 | import anyio # noqa: PLC0415 |
| 42 | |
| 43 | return _convert( |
| 44 | anyio.run(container.awaitable, backend=backend), |
| 45 | deps=deps, |
| 46 | backend=backend, |
| 47 | ) |
| 48 | if isinstance(container, reader.Contextable): |
| 49 | return _convert( |
| 50 | container(deps), |
| 51 | deps=deps, |
| 52 | backend=backend, |
| 53 | ) |
| 54 | return container |