Skip to content

Commit

Permalink
issue found!
Browse files Browse the repository at this point in the history
  • Loading branch information
CucumisSativus committed Dec 11, 2021
1 parent 3878184 commit 60950f6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions returns/maybe.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def __init__(self, inner_value: _ValueType) -> None:
"""Some constructor."""
super().__init__(inner_value)

if not TYPE_CHECKING: # noqa: WPS604 # pragma: no branch
if not TYPE_CHECKING: # noqa: WPS604,C901 # pragma: no branch
def bind(self, function):
"""Binds current container to a function that returns container."""
return function(self._inner_value)
Expand All @@ -415,6 +415,12 @@ def unwrap(self):
"""Returns inner value for successful container."""
return self._inner_value

def filter(self, function):
"""Filters internal value."""
if function(self._inner_value):
return self
return _Nothing()

def map(self, function):
"""Composes current container with a pure function."""
return Some(function(self._inner_value))
Expand All @@ -441,12 +447,6 @@ def failure(self):
"""Raises exception for successful container."""
raise UnwrapFailedError(self)

def filter(self, function):
"""Filters internal value."""
if function(self._inner_value):
return self
return _Nothing()


Maybe.success_type = Some
Maybe.failure_type = _Nothing
Expand Down

0 comments on commit 60950f6

Please sign in to comment.