SimpleConstraintABC
- class jwst.associations.lib.constraint.SimpleConstraintABC(*args, **kwargs)[source]
Bases:
ABCSimple Constraint ABC.
- Parameters:
- initdict
Dictionary where the key-value pairs define the following parameters
- valueobject or None
Value that must be matched
- namestr or None
Option name for constraint
- **kwargsdict
Other initialization parameters
- Attributes:
- found_valuesset(str[,…])
Set of actual found values for this condition. True SimpleConstraints do not normally set this; the value is not different than
value.- matchedbool
Last call to
check_and_set()
Force creation of the constraint attribute dict before anything else.
- Returns:
SimpleConstraintABCNew instance of class.
Attributes Summary
Return dictionary of constraints with duplicate names.
Return identifier for the constraint.
Methods Summary
check_and_set(item)Check and set the constraint.
copy()Copy self.
get_all_attr(attribute[, name])Return the specified attribute.
preserve()Save the current state of the constraints.
restore()Restore constraint state.
Attributes Documentation
- dup_names
Return dictionary of constraints with duplicate names.
This method is meant to be overridden by classes that need to traverse a list of constraints.
- Returns:
- dups{str: [constraint[,…]][,…]}
Returns a mapping between the duplicated name and all the constraints that define that name.
- id
Return identifier for the constraint.
- Returns:
- idstr
The identifier
Methods Documentation
- abstractmethod check_and_set(item)[source]
Check and set the constraint.
- Returns:
- successbool
True if check is successful.
- reprocesslist of
ProcessList Empty list unless overrode by subclass implementation.
- get_all_attr(attribute, name=None)[source]
Return the specified attribute.
This method exists solely to support
get_all_attr(). This obviates the need for class/method checking.- Parameters:
- attributestr
The attribute to retrieve
- namestr or None
Only return attribute if the name of the current constraint matches the requested named constraints. If None, always return value.
- Returns:
- list of tuple
[(self, value)] : [(SimpleConstraint, object)] The value of the attribute in the form of
[(self, value)], where the types are[(SimpleConstraint, object)]. If there is no attribute, an empty list is returned.