set_global_supercontext#
- class processor_tools.context.set_global_supercontext(supercontext: Tuple[Context, str] | Context)[source]#
Sets a context object to become a global supercontext for other context objects
- Parameters:
context –
supercontext defined as context object or tuple of:
supercontext(Context) - supercontext objectsection(str) - name of section of supercontext to apply as supercontext
For example:
supercontext = Context({"section": {"val1": 1 , "val2", 2}}) (supercontext, "section")
Can be run with a
withstatement, as followsfrom processor_tools import Context, set_global_supercontext my_context = Context() with set_global_supercontext(my_context): run_process()
In this example,
my_contextis set as the global supercontext within the scope of thewithstatement and then removed after.Methods