File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 6
6
from returns .result import Failure , Success
7
7
8
8
9
- def is_successful (monad ):
10
- """Determins if a monad was a success or not."""
9
+ def is_successful (container ):
10
+ """
11
+ Determins if a container was successful or not.
12
+
13
+ We treat container that raise ``UnwrapFailedError`` on ``.unwrap()``
14
+ not successful.
15
+ """
11
16
try :
12
- monad .unwrap ()
17
+ container .unwrap ()
13
18
except UnwrapFailedError :
14
19
return False
15
20
else :
Original file line number Diff line number Diff line change @@ -7,20 +7,20 @@ from returns.result import Result
7
7
8
8
_ContainerType = TypeVar ('_ContainerType' , bound = Container )
9
9
_ReturnType = TypeVar ('_ReturnType' )
10
- _ReturnsMonadType = TypeVar (
11
- '_ReturnsMonadType ' ,
10
+ _ReturnsContainerType = TypeVar (
11
+ '_ReturnsContainerType ' ,
12
12
bound = Callable [..., Container ],
13
13
)
14
14
15
15
16
- def is_successful (monad : _ContainerType ) -> bool :
16
+ def is_successful (container : _ContainerType ) -> bool :
17
17
...
18
18
19
19
20
20
# Typing decorators is not an easy task, see:
21
21
# https://github.com/python/mypy/issues/3157
22
22
23
- def pipeline (function : _ReturnsMonadType ) -> _ReturnsMonadType :
23
+ def pipeline (function : _ReturnsContainerType ) -> _ReturnsContainerType :
24
24
...
25
25
26
26
You can’t perform that action at this time.
0 commit comments