mirror of
https://github.com/correl/typesafe-monads.git
synced 2024-11-21 19:18:42 +00:00
Ignore coverage of repr / base class methods
This commit is contained in:
parent
1a87d73a5b
commit
e21791a8b7
6 changed files with 14 additions and 14 deletions
|
@ -9,12 +9,12 @@ S = TypeVar("S")
|
|||
|
||||
class Applicative(Functor[T]):
|
||||
@classmethod
|
||||
def pure(cls, value: T) -> Applicative[T]:
|
||||
def pure(cls, value: T) -> Applicative[T]: # pragma: no cover
|
||||
raise NotImplementedError
|
||||
|
||||
# FIXME: Functor type set to Any, as the proper value
|
||||
# (Functor[Callable[[T], S]]) is reported as incompatible with subclass
|
||||
# implementations due to a flaw in mypy:
|
||||
# https://github.com/python/mypy/issues/1317
|
||||
def apply(self, functor: Any) -> Functor[S]:
|
||||
def apply(self, functor: Any) -> Functor[S]: # pragma: no cover
|
||||
raise NotImplementedError
|
||||
|
|
|
@ -6,5 +6,5 @@ S = TypeVar("S")
|
|||
|
||||
|
||||
class Functor(Generic[T]):
|
||||
def map(self, function: Callable[[T], S]) -> Functor[S]:
|
||||
def map(self, function: Callable[[T], S]) -> Functor[S]: # pragma: no cover
|
||||
raise NotImplementedError
|
||||
|
|
|
@ -9,7 +9,7 @@ E = TypeVar("E")
|
|||
|
||||
|
||||
class Maybe(Monad[T]):
|
||||
def __init__(self) -> None:
|
||||
def __init__(self) -> None: # pragma: no cover
|
||||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
|
@ -54,7 +54,7 @@ class Just(Maybe[T]):
|
|||
def __eq__(self, other: object):
|
||||
return isinstance(other, Just) and self.value == other.value
|
||||
|
||||
def __repr__(self) -> str:
|
||||
def __repr__(self) -> str: # pragma: no cover
|
||||
return f"<Just {self.value}>"
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@ class Nothing(Maybe[T]):
|
|||
def __eq__(self, other: object):
|
||||
return isinstance(other, Nothing)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
def __repr__(self) -> str: # pragma: no cover
|
||||
return "<Nothing>"
|
||||
|
||||
|
||||
|
@ -88,7 +88,7 @@ class First(Monoid[Maybe[T]]):
|
|||
else:
|
||||
return other
|
||||
|
||||
def __repr__(self) -> str:
|
||||
def __repr__(self) -> str: # pragma: no cover
|
||||
return f"<First {self.value}>"
|
||||
|
||||
__add__ = mappend
|
||||
|
@ -109,7 +109,7 @@ class Last(Monoid[Maybe[T]]):
|
|||
else:
|
||||
return self
|
||||
|
||||
def __repr__(self) -> str:
|
||||
def __repr__(self) -> str: # pragma: no cover
|
||||
return f"<Last {self.value}>"
|
||||
|
||||
__add__ = mappend
|
||||
|
|
|
@ -13,5 +13,5 @@ class Monad(Applicative[T]):
|
|||
# (Monad[S]) is reported as incompatible with subclass
|
||||
# implementations due to a flaw in mypy:
|
||||
# https://github.com/python/mypy/issues/1317
|
||||
def bind(self, function: Callable[[T], Any]) -> Monad[S]:
|
||||
def bind(self, function: Callable[[T], Any]) -> Monad[S]: # pragma: no cover
|
||||
raise NotImplementedError
|
||||
|
|
|
@ -13,11 +13,11 @@ class Monoid(Generic[T]):
|
|||
# FIXME: Other type set to Any, as the proper value (Monoid[T]) is
|
||||
# reported as incompatible with subclass implementations due to a
|
||||
# flaw in mypy: https://github.com/python/mypy/issues/1317
|
||||
def mappend(self, other: Any) -> Monoid[T]:
|
||||
def mappend(self, other: Any) -> Monoid[T]: # pragma: no cover
|
||||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
def mzero(cls) -> Monoid[T]:
|
||||
def mzero(cls) -> Monoid[T]: # pragma: no cover
|
||||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -16,7 +16,7 @@ class Monad(Generic[T]):
|
|||
|
||||
|
||||
class Result(Monad[T], Generic[T, E]):
|
||||
def __init__(self) -> None:
|
||||
def __init__(self) -> None: # pragma: no cover
|
||||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
|
@ -67,7 +67,7 @@ class Ok(Result[T, E]):
|
|||
def __eq__(self, other: object):
|
||||
return isinstance(other, Ok) and self.value == other.value
|
||||
|
||||
def __repr__(self) -> str:
|
||||
def __repr__(self) -> str: # pragma: no cover
|
||||
return f"<Ok {self.value}>"
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ class Err(Result[T, E]):
|
|||
def __eq__(self, other: object):
|
||||
return isinstance(other, Err) and self.err == other.err
|
||||
|
||||
def __repr__(self) -> str:
|
||||
def __repr__(self) -> str: # pragma: no cover
|
||||
return f"<Err {self.err}>"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue