module documentation

Classes representing different types of constraints on inference values.

Class Constraint Represents a single constraint on a variable.
Class NoneConstraint Represents an "is None" or "is not None" constraint.
Function get_constraints Returns the constraints for the given expression.
Constant ALL_CONSTRAINT_CLASSES All supported constraint types.
Function _match_constraint Yields all constraint patterns for node that match.
Function _matches Returns True if the two nodes match.
Type Alias _NameNodes Undocumented

Returns the constraints for the given expression. The returned dictionary maps the node where the constraint was generated to the corresponding constraint(s). Constraints are computed statically by analysing the code surrounding expr. Currently this only supports constraints generated from if conditions.

ALL_CONSTRAINT_CLASSES = (source)

All supported constraint types.

Value
frozenset((NoneConstraint))
def _match_constraint(node: _NameNodes, expr: nodes.NodeNG, invert: bool = False) -> Iterator[Constraint]: (source)

Yields all constraint patterns for node that match.

def _matches(node1: nodes.NodeNG|bases.Proxy, node2: nodes.NodeNG) -> bool: (source)

Returns True if the two nodes match.