Fix Reader.__repr__ failing when its callable lacks a __name__

This commit is contained in:
Correl Roush 2019-01-08 15:34:11 -05:00
parent 319ac3cb4d
commit cbe71da3f8
2 changed files with 2 additions and 2 deletions

View file

@ -16,7 +16,7 @@ Result = TypeVar("Result")
class Curried(Reader[A, Result]):
def __repr__(self): # pragma: no cover
module = self.function.__module__
name = self.function.__name__
name = getattr(self.function, "__name__", repr(self.function))
signature = inspect.signature(self)
return f"<Curried {module}.{name}{signature}>"

View file

@ -66,7 +66,7 @@ class Reader(Monad[T], Generic[Env, T]):
def __repr__(self): # pragma: no cover
module = self.function.__module__
name = self.function.__name__
name = getattr(self.function, "__name__", repr(self.function))
signature = inspect.signature(self)
return f"<Reader {module}.{name}{signature}>"