magni.reproducibility._chase module¶
Module providing functions that may be used to chase data.
Routine listings¶
- get_main_file_name()
- Function that returns the name of the main file/script.
- get_main_file_source()
- Function that returns the source code of the main file/script.
- get_main_source()
- Function that returns the ‘local’ source code of the main file/script.
- get_stack_trace()
- Function that returns the complete stack trace.
-
magni.reproducibility._chase.
get_main_file_name
()[source]¶ Return the name of the main file/script which called this function.
This will (if possible) return the name of the main file/script invoked by the Python interpreter i.e., the returned name is the name of the file, in which the bottom call on the stack is defined. Thus, the main file is still returned if the call to this function is buried deep in the code.
Returns: source_file (str) – The name of the main file/script which called this function. Notes
It may not be possible to associate the call to this function with a main file. This is for instance the case if the call is handled by an IPython kernel. If no file is found, the returned string will indicate so.
-
magni.reproducibility._chase.
get_main_file_source
()[source]¶ Return the source code of the main file/script which called this function.
This will (if possible) return the source code of the main file/script invoked by the Python interpreter i.e., the returned source code is the source code of the file, in which the bottom call on the stack is defined. Thus, the source code is still returned if the call to this function is buried deep in the code.
Returns: source (str) – The source code of the main file/script which called this function. Notes
It may not be possible to associate the call to this function with a main file. This is for instance the case if the call is handled by an IPython kernel. If no file is found, the returned string will indicate so.
-
magni.reproducibility._chase.
get_main_source
()[source]¶ Return the local source code of the main file which called this function.
This will (if possible) return the part of the source code of the main file/script surrounding (local to) the call to this function. The returned source code is a part of the source code of the file, in which the bottom call on the stack is defined. Thus, the source code is still returned if the call to this function is buried deep in the code.
Returns: source (str) – The local source code of the main file/script. Notes
It may not be possible to associate the call to this function with a main file. This is for instance the case if the call is handled by an IPython kernel. If no file is found, the returned string will indicate so.