MCPcopy
hub / github.com/dry-python/returns / from_failure

Method from_failure

returns/io.py:797–815  ·  view source on GitHub ↗

One more value to create failure unit values. It is useful as a united way to create a new value from any container. .. code:: python >>> from returns.io import IOResult, IOFailure >>> assert IOResult.from_failure(1) == IOFailure(1) You can us

(
        cls,
        inner_value: _NewErrorType,
    )

Source from the content-addressed store, hash-verified

795
796 @classmethod
797 def from_failure(
798 cls,
799 inner_value: _NewErrorType,
800 ) -> 'IOResult[Any, _NewErrorType]':
801 """
802 One more value to create failure unit values.
803
804 It is useful as a united way to create a new value from any container.
805
806 .. code:: python
807
808 >>> from returns.io import IOResult, IOFailure
809 >>> assert IOResult.from_failure(1) == IOFailure(1)
810
811 You can use this method or :func:`~IOFailure`,
812 choose the most convenient for you.
813
814 """
815 return IOFailure(inner_value)
816
817
818@final

Callers 15

_acquire_failureFunction · 0.45
_use_failureFunction · 0.45
__call__Method · 0.45
_acquire_failureFunction · 0.45
_use_failureFunction · 0.45
__call__Method · 0.45
_use_failureFunction · 0.45
__call__Method · 0.45
test_non_flatten_futureFunction · 0.45
test_inner_valueFunction · 0.45

Calls 1

IOFailureClass · 0.85

Tested by 15

_acquire_failureFunction · 0.36
_use_failureFunction · 0.36
__call__Method · 0.36
_acquire_failureFunction · 0.36
_use_failureFunction · 0.36
__call__Method · 0.36
_use_failureFunction · 0.36
__call__Method · 0.36
test_non_flatten_futureFunction · 0.36
test_inner_valueFunction · 0.36
test_inner_valueFunction · 0.36