IndexedComponent_slice
(class from pyomo.core.base.indexed_component_slice
)
- class pyomo.core.base.indexed_component_slice.IndexedComponent_slice(component, fixed=None, sliced=None, ellipsis=None)[source]
Bases:
object
Special class for slicing through hierarchical component trees
The basic concept is to interrupt the normal slice generation procedure to return a specialized iterable class (this object). This object supports simple getitem / getattr / call methods and caches them until it is time to actually iterate through the slice. We then walk down the cached names / indices and resolve the final objects during the iteration process. This works because all the calls to __getitem__ / __getattr__ / __call__ happen before the call to __iter__()
- __init__(component, fixed=None, sliced=None, ellipsis=None)[source]
A “slice” over an _IndexedComponent hierarchy
This class has two forms for the constructor. The first form is the standard constructor that takes a base component and indexing information. This form takes
IndexedComponent_slice(component, fixed, sliced, ellipsis)
The second form is a “copy constructor” that is used internally when building up the “call stack” for the hierarchical slice. The copy constructor takes an IndexedComponent_slice and an optional “next term” in the slice construction (from get/set/del item/attr or call):
IndexedComponent_slice(slice, next_term=None)
- Parameters:
component (IndexedComponent) – The base component for this slice
fixed (dict) – A dictionary indicating the fixed indices of component, mapping index position to value
sliced (dict) – A dictionary indicating the sliced indices of component mapping the index position to the (python) slice object
ellipsis (int) – The position of the ellipsis in the initial component slice
Methods
__init__
(component[, fixed, sliced, ellipsis])A "slice" over an _IndexedComponent hierarchy
duplicate
()expanded_items
()expanded_keys
()index_wildcard_keys
(sort)wildcard_items
([sort])wildcard_keys
([sort])wildcard_values
([sort])Return an iterator over this slice
Attributes
ATTR_MASK
CALL_MASK
DEL_MASK
GET_MASK
ITEM_MASK
SET_MASK
call
del_attribute
del_item
get_attribute
get_item
set_attribute
set_item
slice_info
Member Documentation