ATLAS Offline Software
Loading...
Searching...
No Matches
python.DebuggingContext Namespace Reference

Classes

class  Context

Functions

 shortCallStack ()
 createContextForDeduplication (message, compName, destContext)
 raiseWithCurrentContext (exception)

Function Documentation

◆ createContextForDeduplication()

python.DebuggingContext.createContextForDeduplication ( message,
compName,
destContext )

Definition at line 40 of file DebuggingContext.py.

40def createContextForDeduplication(message, compName, destContext):
41 return Context(f"{message} : {compName} : {destContext.get(compName, Context.hint)}")
42
43

◆ raiseWithCurrentContext()

python.DebuggingContext.raiseWithCurrentContext ( exception)
Raises the exception with the message supplemented with context information

Definition at line 44 of file DebuggingContext.py.

44def raiseWithCurrentContext(exception):
45 """
46 Raises the exception with the message supplemented with context information
47 """
48 raise type(exception)(str(exception) + '\nWith the context:\n{}'.format(Context.complete()) )

◆ shortCallStack()

python.DebuggingContext.shortCallStack ( )
Obtains (a very abbreviated) context of the current call stack (from the top, excluding the code using this function)

Definition at line 29 of file DebuggingContext.py.

29def shortCallStack():
30 """
31 Obtains (a very abbreviated) context of the current call stack (from the top, excluding the code using this function)
32 """
33 import inspect
34 compact = ' >>> '
35 for frameInfo in inspect.stack()[2:][::-1]:
36 compact += "{}:{}({}) ".format(frameInfo.filename.split('/')[-1], frameInfo.frame.f_lineno, frameInfo.function)
37 return compact
38
39