1
0
Fork 0

[cleanup, jsinterp] Give functions names to help debugging

This commit is contained in:
pukkandan 2023-03-03 23:24:50 +05:30
commit b2e0343ba0
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39
2 changed files with 14 additions and 7 deletions

View file

@ -6057,14 +6057,16 @@ class classproperty:
class function_with_repr:
def __init__(self, func):
def __init__(self, func, repr_=None):
functools.update_wrapper(self, func)
self.func = func
self.func, self.__repr = func, repr_
def __call__(self, *args, **kwargs):
return self.func(*args, **kwargs)
def __repr__(self):
if self.__repr:
return self.__repr
return f'{self.func.__module__}.{self.func.__qualname__}'