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

Method awaitable

returns/future.py:152–170  ·  view source on GitHub ↗

Transforms ``Future[a]`` to ``Awaitable[IO[a]]``. Use this method when you need a real coroutine. Like for ``asyncio.run`` calls. Note, that returned value will be wrapped in :class:`returns.io.IO` container. .. code:: python >>> import

(self)

Source from the content-addressed store, hash-verified

150 return self.awaitable().__await__()
151
152 async def awaitable(self) -> IO[_ValueType_co]:
153 """
154 Transforms ``Future[a]`` to ``Awaitable[IO[a]]``.
155
156 Use this method when you need a real coroutine.
157 Like for ``asyncio.run`` calls.
158
159 Note, that returned value will be wrapped
160 in :class:`returns.io.IO` container.
161
162 .. code:: python
163
164 >>> import anyio
165 >>> from returns.future import Future
166 >>> from returns.io import IO
167 >>> assert anyio.run(Future.from_value(1).awaitable) == IO(1)
168
169 """
170 return IO(await self._inner_value)
171
172 def map(
173 self,

Callers 1

__await__Method · 0.95

Calls 1

IOClass · 0.90

Tested by

no test coverage detected