Skip to content

Commit e216c9c

Browse files
issue found!
1 parent aa3a303 commit e216c9c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

returns/maybe.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def __init__(self, inner_value: _ValueType) -> None:
402402
"""Some constructor."""
403403
super().__init__(inner_value)
404404

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

418+
def filter(self, function):
419+
"""Filters internal value."""
420+
if function(self._inner_value):
421+
return self
422+
return _Nothing()
423+
418424
def map(self, function):
419425
"""Composes current container with a pure function."""
420426
return Some(function(self._inner_value))
@@ -441,12 +447,6 @@ def failure(self):
441447
"""Raises exception for successful container."""
442448
raise UnwrapFailedError(self)
443449

444-
def filter(self, function):
445-
"""Filters internal value."""
446-
if function(self._inner_value):
447-
return self
448-
return _Nothing()
449-
450450

451451
Maybe.success_type = Some
452452
Maybe.failure_type = _Nothing

0 commit comments

Comments
 (0)