class jwst.associations.lib.constraint.AttrConstraint(init=None, sources=None, evaluate=False, force_reprocess=False, force_undefined=False, force_unique=True, invalid_values=None, only_on_match=False, onlyif=None, required=True, **kwargs)[source]

Bases: jwst.associations.lib.constraint.SimpleConstraintABC

Test attribute of an item

  • sources ([str[,..]]) – List of attributes to query

  • value (str, function or None) – The value to check for. If None and force_unique, any value in the first available source will become the value. If function, the function takes no arguments and returns a string.

  • evaluate (bool) – Evaluate the item’s value before checking condition.

  • force_reprocess (ProcessList.state or False) – Add item back onto the reprocess list using the specified ProcessList work over state.

  • force_unique (bool) – If the initial value is None or a list of possible values, the constraint will be modified to be the value first matched.

  • invalid_values ([str[,..]]) – List of values that are invalid in an item. Will cause a non-match.

  • name (str or None) – Name of the constraint.

  • only_on_match (bool) – If force_reprocess, only do the reprocess if the entire constraint is satisfied.

  • onlyif (function) – Boolean function that takes item as argument. If True, the rest of the condition is checked. Otherwise return as a matched condition

  • required (bool) – One of the sources must exist. Otherwise, return as a matched constraint.


Set of actual found values for this condition.




Last result of check_and_set



Methods Summary


Check and set constraints based on item

Methods Documentation


Check and set constraints based on item


item (dict) – The item to check on.


success, reprocess

Returns 2-tuple of

  • True if check is successful.

  • List of ProcessList.

Return type

bool, [ProcessList[,..]]