get_component_call_stack
(function from pyomo.util.slices)
- pyomo.util.slices.get_component_call_stack(comp, context=None)[source]
Get the call stack necessary to locate a Component
The call stack is a list of tuple`s where the first entry is a code for `__getattr__ or __getitem__, using the same convention as IndexedComponent_slice. The second entry is the argument of the corresponding function. Following this sequence of calls from context (or the top-level model if context is None) will produce comp.
Parameters:
- comppyomo.core.base.component.Component
The component to locate
- contextpyomo.core.base.block.Block
The block within which to locate the component. If None, the top-level model will be used.
Returns:
- listContains the necessary method calls and their arguments.
Note that the calls should be applied in reverse order. This is the opposite direction as in IndexedComponent_slice.