ztfy/utils/profilehooks.py
branchZTK-1.1
changeset 70 82d8de021806
parent 26 06aa7b6a131c
equal deleted inserted replaced
69:ddab9a29b54b 70:82d8de021806
   156             return profile(fn, skip=skip, filename=filename,
   156             return profile(fn, skip=skip, filename=filename,
   157                            immediate=immediate)
   157                            immediate=immediate)
   158         return decorator
   158         return decorator
   159     # @profile syntax -- we are a decorator.
   159     # @profile syntax -- we are a decorator.
   160     fp = FuncProfile(fn, skip=skip, filename=filename, immediate=immediate)
   160     fp = FuncProfile(fn, skip=skip, filename=filename, immediate=immediate)
   161          # or HotShotFuncProfile
   161     # or HotShotFuncProfile
   162     # We cannot return fp or fp.__call__ directly as that would break method
   162     # We cannot return fp or fp.__call__ directly as that would break method
   163     # definitions, instead we need to return a plain function.
   163     # definitions, instead we need to return a plain function.
   164     def new_fn(*args, **kw):
   164     def new_fn(*args, **kw):
   165         return fp(*args, **kw)
   165         return fp(*args, **kw)
   166     new_fn.__doc__ = fn.__doc__
   166     new_fn.__doc__ = fn.__doc__