@@ -346,41 +346,43 @@ def __repr__(self):
346346 """
347347 return '<Nothing>'
348348
349- def map (self , function ):
350- """Does nothing for ``Nothing``."""
351- return self
349+ if not TYPE_CHECKING : # noqa: WPS604 # pragma: no branch
352350
353- def apply (self , container ):
354- """Does nothing for ``Nothing``."""
355- return self
351+ def map (self , function ):
352+ """Does nothing for ``Nothing``."""
353+ return self
356354
357- def bind (self , function ):
358- """Does nothing for ``Nothing``."""
359- return self
355+ def apply (self , container ):
356+ """Does nothing for ``Nothing``."""
357+ return self
360358
361- def bind_optional (self , function ):
362- """Does nothing."""
363- return self
359+ def bind (self , function ):
360+ """Does nothing for ``Nothing`` ."""
361+ return self
364362
365- def lash (self , function ):
366- """Composes this container with a function returning container ."""
367- return function ( None )
363+ def bind_optional (self , function ):
364+ """Does nothing ."""
365+ return self
368366
369- def value_or (self , default_value ):
370- """Returns default value ."""
371- return default_value
367+ def lash (self , function ):
368+ """Composes this container with a function returning container ."""
369+ return function ( None )
372370
373- def or_else_call (self , function ):
374- """Returns the result of a passed function ."""
375- return function ()
371+ def value_or (self , default_value ):
372+ """Returns default value ."""
373+ return default_value
376374
377- def unwrap (self ):
378- """Raises an exception, since it does not have a value inside ."""
379- raise UnwrapFailedError ( self )
375+ def or_else_call (self , function ):
376+ """Returns the result of a passed function ."""
377+ return function ( )
380378
381- def failure (self ) -> None :
382- """Returns failed value."""
383- return self ._inner_value
379+ def unwrap (self ):
380+ """Raises an exception, since it does not have a value inside."""
381+ raise UnwrapFailedError (self )
382+
383+ def failure (self ) -> None :
384+ """Returns failed value."""
385+ return self ._inner_value
384386
385387 def __bool__ (self ):
386388 """Returns ``False``."""
@@ -417,29 +419,29 @@ def unwrap(self):
417419 """Returns inner value for successful container."""
418420 return self ._inner_value
419421
420- def map (self , function ):
421- """Composes current container with a pure function."""
422- return Some (function (self ._inner_value ))
422+ def map (self , function ):
423+ """Composes current container with a pure function."""
424+ return Some (function (self ._inner_value ))
423425
424- def apply (self , container ):
425- """Calls a wrapped function in a container on this container."""
426- if isinstance (container , Some ):
427- return self .map (container .unwrap ()) # type: ignore
428- return container
426+ def apply (self , container ):
427+ """Calls a wrapped function in a container on this container."""
428+ if isinstance (container , Some ):
429+ return self .map (container .unwrap ()) # type: ignore
430+ return container
429431
430- def lash (self , function ):
431- """Does nothing for ``Some``."""
432- return self
432+ def lash (self , function ):
433+ """Does nothing for ``Some``."""
434+ return self
433435
434- def value_or (self , default_value ):
435- """Returns inner value for successful container."""
436- return self ._inner_value
436+ def value_or (self , default_value ):
437+ """Returns inner value for successful container."""
438+ return self ._inner_value
437439
438- def or_else_call (self , function ):
439- """Returns inner value for successful container."""
440- return self ._inner_value
440+ def or_else_call (self , function ):
441+ """Returns inner value for successful container."""
442+ return self ._inner_value
441443
442- def failure (self ):
444+ def failure (self ) -> Never :
443445 """Raises exception for successful container."""
444446 raise UnwrapFailedError (self )
445447
0 commit comments