@@ -402,7 +402,7 @@ def __init__(self, inner_value: _ValueType) -> None:
402
402
"""Some constructor."""
403
403
super ().__init__ (inner_value )
404
404
405
- if not TYPE_CHECKING : # noqa: WPS604 # pragma: no branch
405
+ if not TYPE_CHECKING : # noqa: WPS604,C901 # pragma: no branch
406
406
def bind (self , function ):
407
407
"""Binds current container to a function that returns container."""
408
408
return function (self ._inner_value )
@@ -415,6 +415,12 @@ def unwrap(self):
415
415
"""Returns inner value for successful container."""
416
416
return self ._inner_value
417
417
418
+ def filter (self , function ):
419
+ """Filters internal value."""
420
+ if function (self ._inner_value ):
421
+ return self
422
+ return _Nothing ()
423
+
418
424
def map (self , function ):
419
425
"""Composes current container with a pure function."""
420
426
return Some (function (self ._inner_value ))
@@ -441,12 +447,6 @@ def failure(self):
441
447
"""Raises exception for successful container."""
442
448
raise UnwrapFailedError (self )
443
449
444
- def filter (self , function ):
445
- """Filters internal value."""
446
- if function (self ._inner_value ):
447
- return self
448
- return _Nothing ()
449
-
450
450
451
451
Maybe .success_type = Some
452
452
Maybe .failure_type = _Nothing
0 commit comments