@@ -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
451451Maybe .success_type = Some
452452Maybe .failure_type = _Nothing
0 commit comments