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

Method unwrap

returns/io.py:577–593  ·  view source on GitHub ↗

Get value from successful container or raise exception for failed one. .. code:: pycon :force: >>> from returns.io import IO, IOFailure, IOSuccess >>> assert IOSuccess(1).unwrap() == IO(1) >>> IOFailure(1).unwrap() Traceback (most

(self)

Source from the content-addressed store, hash-verified

575 return IO(self._inner_value.value_or(default_value))
576
577 def unwrap(self) -> IO[_ValueType_co]:
578 """
579 Get value from successful container or raise exception for failed one.
580
581 .. code:: pycon
582 :force:
583
584 >>> from returns.io import IO, IOFailure, IOSuccess
585 >>> assert IOSuccess(1).unwrap() == IO(1)
586
587 >>> IOFailure(1).unwrap()
588 Traceback (most recent call last):
589 ...
590 returns.primitives.exceptions.UnwrapFailedError
591
592 """
593 return IO(self._inner_value.unwrap())
594
595 def failure(self) -> IO[_ErrorType_co]:
596 """

Callers 5

__iter__Method · 0.95
applyMethod · 0.45
bindMethod · 0.45
bind_resultMethod · 0.45
bind_ioMethod · 0.45

Calls 1

IOClass · 0.85

Tested by

no test coverage detected