MCPcopy Index your code
hub / github.com/dry-python/returns / from_io

Method from_io

returns/future.py:428–444  ·  view source on GitHub ↗

Allows to create a ``Future`` from ``IO`` container. .. code:: python >>> import anyio >>> from returns.future import Future >>> from returns.io import IO >>> async def main() -> bool: ... return (await Future.from_io(IO(1))) =

(cls, inner_value: IO[_NewValueType])

Source from the content-addressed store, hash-verified

426
427 @classmethod
428 def from_io(cls, inner_value: IO[_NewValueType]) -> 'Future[_NewValueType]':
429 """
430 Allows to create a ``Future`` from ``IO`` container.
431
432 .. code:: python
433
434 >>> import anyio
435 >>> from returns.future import Future
436 >>> from returns.io import IO
437
438 >>> async def main() -> bool:
439 ... return (await Future.from_io(IO(1))) == IO(1)
440
441 >>> assert anyio.run(main) is True
442
443 """
444 return Future(async_identity(inner_value._inner_value)) # noqa: SLF001
445
446 @classmethod
447 def from_future_result(

Callers

nothing calls this directly

Calls 2

FutureClass · 0.85
async_identityFunction · 0.85

Tested by

no test coverage detected