use functools.wrap for the TimeFuncton wrapper.

This commit is contained in:
rrraaaccc 2024-01-07 13:14:10 +01:00 committed by GitHub
parent 8362349bb8
commit 57704bddc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,9 +49,11 @@ def Redraw(*args, **kwargs):
return _Redraw(*args, **kwargs)
from pyngcore import Timer
from functools import wraps
def TimeFunction(func, name=None):
name = name or func.__qualname__
timer = Timer(name)
@wraps(func)
def retfunc(*args,**kwargs):
with timer:
ret = func(*args, **kwargs)