diff --git a/asteval/astutils.py b/asteval/astutils.py index 5949254..c5f9181 100644 --- a/asteval/astutils.py +++ b/asteval/astutils.py @@ -533,9 +533,18 @@ def _getdoc(self): def __repr__(self): """TODO: docstring in magic method.""" + sig = self._signature() + rep = f"" + doc = self._getdoc() + if doc is not None: + rep = f"{rep}\n {doc}" + return rep + + def _signature(self): + "call signature" sig = "" if len(self.argnames) > 0: - sig = sig + ', '.join(self.argnames) + sig = sig + ', '.join(self.argnames) if self.vararg is not None: sig = sig + f"*{self.vararg}" if len(self.kwargs) > 0: @@ -544,13 +553,9 @@ def __repr__(self): _kw = [f"{k}={v}" for k, v in self.kwargs] sig = f"{sig}{', '.join(_kw)}" - if self.varkws is not None: - sig = f"%sig, **{self.varkws}" - sig = f"" - doc = self._getdoc() - if doc is not None: - sig = f"{sig}\n {doc}" - return sig + if self.varkws is not None: + sig = f"{sig}, **{self.varkws}" + return f"{self.name}({sig})" def __call__(self, *args, **kwargs): """TODO: docstring in public method."""