def from_iterable( cls, inner_value: Iterable[Kind2['FutureResult', _NewValueType, _NewErrorType], ], strategy: Type[BaseIterableStrategyN] = FailFast, ) -> 'FutureResult[Sequence[_NewValueType], _NewErrorType]': """ Transforms an iterable of ``FutureResult`` containers. Returns a single container with multiple elements inside. .. code:: python >>> import anyio >>> from returns.future import FutureResult >>> from returns.io import IOSuccess >>> all_success = FutureResult.from_iterable([ ... FutureResult.from_value(1), ... FutureResult.from_value(2), ... ]) >>> assert anyio.run(all_success.awaitable) == IOSuccess((1, 2)) """ return iterable_kind(cls, inner_value, strategy)
def from_iterable( cls, inner_value: Iterable[Kind3['RequiresContextFutureResult', _FirstType, _NewErrorType, _NewEnvType, ], ], strategy: Type[BaseIterableStrategyN] = FailFast, ) -> 'ReaderFutureResult[Sequence[_FirstType], _NewErrorType, _NewEnvType]': """ Transforms an iterable of ``RequiresContextFutureResult`` containers. Returns a single container with multiple elements inside. .. code:: python >>> import anyio >>> from returns.context import RequiresContextFutureResult >>> from returns.io import IOSuccess >>> assert anyio.run( ... RequiresContextFutureResult.from_iterable([ ... RequiresContextFutureResult.from_value(1), ... RequiresContextFutureResult.from_value(2), ... ]), ... RequiresContextFutureResult.empty, ... ) == IOSuccess((1, 2)) """ return iterable_kind(cls, inner_value, strategy)
def from_iterable( cls, inner_value: Iterable[Kind2['IOResult', _NewValueType, _NewErrorType]], strategy: Type[BaseIterableStrategyN] = FailFast, ) -> 'IOResult[Sequence[_NewValueType], _NewErrorType]': """ Transforms an iterable of ``IOResult`` containers into a single one. .. code:: python >>> from returns.io import IOResult, IOSuccess >>> assert IOResult.from_iterable([ ... IOSuccess(1), ... IOSuccess(2), ... ]) == IOSuccess((1, 2)) """ return iterable_kind(cls, inner_value, strategy)
def from_iterable( cls, inner_value: Iterable[Kind1['IO', _NewValueType]], strategy: Type[BaseIterableStrategyN] = FailFast, ) -> 'IO[Sequence[_NewValueType]]': """ Transforms an iterable of ``IO`` containers into a single container. .. code:: python >>> from returns.io import IO >>> assert IO.from_iterable([ ... IO(1), ... IO(2), ... ]) == IO((1, 2)) """ return iterable_kind(cls, inner_value, strategy)
def from_iterable( cls, inner_value: Iterable[Kind1['Maybe', _NewValueType]], strategy: Type[BaseIterableStrategyN] = FailFast, ) -> 'Maybe[Sequence[_NewValueType]]': """ Transforms an iterable of ``Maybe`` containers into a single container. .. code:: python >>> from returns.maybe import Maybe, Some >>> assert Maybe.from_iterable([ ... Some(1), ... Some(2), ... ]) == Some((1, 2)) """ return iterable_kind(cls, inner_value, strategy)
def from_iterable( cls, inner_value: Iterable[Kind1['Future', _NewValueType]], strategy: Type[BaseIterableStrategyN] = FailFast, ) -> 'Future[Sequence[_NewValueType]]': """ Transforms an iterable of ``Future`` containers into a single container. .. code:: python >>> import anyio >>> from returns.future import Future >>> from returns.io import IO >>> assert anyio.run(Future.from_iterable([ ... Future.from_value(1), ... Future.from_value(2), ... ]).awaitable) == IO((1, 2)) """ return iterable_kind(cls, inner_value, strategy)
def from_iterable( cls, inner_value: Iterable[ Kind2['RequiresContext', _NewReturnType, _NewEnvType], ], strategy: Type[BaseIterableStrategyN] = FailFast, ) -> 'RequiresContext[Sequence[_NewReturnType], _NewEnvType]': """ Transforms an iterable of ``RequiresContext`` containers. Returns a single container with a sequence of values. .. code:: python >>> from returns.context import RequiresContext >>> assert RequiresContext.from_iterable([ ... RequiresContext.from_value(1), ... RequiresContext.from_value(2), ... ])(...) == (1, 2) """ return iterable_kind(cls, inner_value, strategy)