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

Class IOSuccess

returns/io.py:853–883  ·  view source on GitHub ↗

``IOSuccess`` representation.

Source from the content-addressed store, hash-verified

851
852@final
853class IOSuccess(IOResult[_ValueType_co, Any]):
854 """``IOSuccess`` representation."""
855
856 __slots__ = ()
857
858 _inner_value: Result[_ValueType_co, Any]
859
860 def __init__(self, inner_value: _ValueType_co) -> None:
861 """IOSuccess constructor."""
862 super().__init__(Success(inner_value))
863
864 if not TYPE_CHECKING: # noqa: WPS604 # pragma: no branch
865
866 def bind(self, function):
867 """Composes this container with a function returning ``IOResult``.""" # noqa: E501
868 return function(self._inner_value.unwrap())
869
870 #: Alias for `bind_ioresult` method. Part of the `IOResultBasedN` interface. # noqa: E501
871 bind_ioresult = bind
872
873 def bind_result(self, function):
874 """Binds ``Result`` returning function to current container."""
875 return self.from_result(function(self._inner_value.unwrap()))
876
877 def bind_io(self, function):
878 """Binds ``IO`` returning function to current container."""
879 return self.from_io(function(self._inner_value.unwrap()))
880
881 def lash(self, function):
882 """Does nothing for ``IOSuccess``."""
883 return self
884
885
886# Aliases:

Callers 15

from_contextMethod · 0.90
from_valueMethod · 0.90
test_full_typingFunction · 0.90
test_full_typingFunction · 0.90
_use_successFunction · 0.90
__call__Method · 0.90
test_full_typingFunction · 0.90
test_full_typingFunction · 0.90
test_inner_valueFunction · 0.90

Calls

no outgoing calls

Tested by 15

test_full_typingFunction · 0.72
test_full_typingFunction · 0.72
_use_successFunction · 0.72
__call__Method · 0.72
test_full_typingFunction · 0.72
test_full_typingFunction · 0.72
test_inner_valueFunction · 0.72
test_regression394Function · 0.72
factoryFunction · 0.72
test_bindFunction · 0.72
test_bind_regular_resultFunction · 0.72