Skip to content

Commit

Permalink
Add stringification and repr to Call objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Suor committed Jul 17, 2021
1 parent 70ce02f commit c7c70a9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions funcy/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ def __getattr__(self, name):
except TypeError as e:
raise AttributeError(*e.args)

def __str__(self):
func = getattr(self._func, '__qualname__', str(self._func))
args = ", ".join(list(map(str, self._args)) + ["%s=%s" % t for t in self._kwargs.items()])
return "%s(%s)" % (func, args)

def __repr__(self):
return "<Call %s>" % self


if PY2:
def has_single_arg(func):
Expand Down

0 comments on commit c7c70a9

Please sign in to comment.