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

Method from_ioresult

returns/future.py:1372–1396  ·  view source on GitHub ↗

Creates ``FutureResult`` from ``IOResult`` value. .. code:: python >>> import anyio >>> from returns.io import IOSuccess, IOFailure >>> from returns.future import FutureResult >>> async def main(): ... assert await FutureResul

(
        cls,
        inner_value: IOResult[_NewValueType, _NewErrorType],
    )

Source from the content-addressed store, hash-verified

1370
1371 @classmethod
1372 def from_ioresult(
1373 cls,
1374 inner_value: IOResult[_NewValueType, _NewErrorType],
1375 ) -> 'FutureResult[_NewValueType, _NewErrorType]':
1376 """
1377 Creates ``FutureResult`` from ``IOResult`` value.
1378
1379 .. code:: python
1380
1381 >>> import anyio
1382 >>> from returns.io import IOSuccess, IOFailure
1383 >>> from returns.future import FutureResult
1384
1385 >>> async def main():
1386 ... assert await FutureResult.from_ioresult(
1387 ... IOSuccess(1),
1388 ... ) == IOSuccess(1)
1389 ... assert await FutureResult.from_ioresult(
1390 ... IOFailure(1),
1391 ... ) == IOFailure(1)
1392
1393 >>> anyio.run(main)
1394
1395 """
1396 return FutureResult(async_identity(inner_value._inner_value)) # noqa: SLF001
1397
1398 @classmethod
1399 def from_result(

Callers

nothing calls this directly

Calls 2

FutureResultClass · 0.85
async_identityFunction · 0.85

Tested by

no test coverage detected