Skip to content

Commit

Permalink
Rename the decorator wrapper function to make its name easier to find
Browse files Browse the repository at this point in the history
In a profile it comes up as generic "wrapper" so rename it
to timeMethod_wrapper makes it easier to find.
  • Loading branch information
timj committed Nov 19, 2021
1 parent 4337df7 commit b4beb7d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/lsst/utils/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def run(self, ...): # or any other instance method you want to time

def decorator_timer(func: Callable) -> Callable:
@functools.wraps(func)
def wrapper(self: Any, *args: Any, **keyArgs: Any) -> Any:
def timeMethod_wrapper(self: Any, *args: Any, **keyArgs: Any) -> Any:
# Adjust the stacklevel to account for the wrappers.
stacklevel = 2
logInfo(obj=self, prefix=func.__name__ + "Start", metadata=metadata, logger=logger,
Expand All @@ -317,7 +317,7 @@ def wrapper(self: Any, *args: Any, **keyArgs: Any) -> Any:
logInfo(obj=self, prefix=func.__name__ + "End", metadata=metadata, logger=logger,
logLevel=logLevel, stacklevel=stacklevel)
return res
return wrapper
return timeMethod_wrapper

if _func is None:
return decorator_timer
Expand Down

0 comments on commit b4beb7d

Please sign in to comment.