lisa.utils.get_call_site#

lisa.utils.get_call_site(levels=0, exclude_caller_module=False)[source]#

Get the location of the source that called that function.

Returns:

(caller, filename, lineno) tuples. Any component can be None if nothing was found. Caller is a string containing the function name.

Parameters:
  • levels (int) – How many levels to look at in the stack

  • exclude_caller_module – Return the first function in the stack that is not defined in the same module as the direct caller of get_call_site().

Warning

That function will exclude all source files that are not part of the lisa package. It will also exclude functions of lisa.utils module.