class documentation

class Constraint(ABC): (source)

Known subclasses: astroid.constraint.NoneConstraint

View In Hierarchy

Represents a single constraint on a variable.

Class Method match Return a new constraint for node matched from expr, if expr matches the constraint pattern.
Method __init__ Undocumented
Method satisfied_by Return True if this constraint is satisfied by the given inferred value.
Instance Variable negate True if this constraint is negated. E.g., "is not" instead of "is".
Instance Variable node The node that this constraint applies to.

Return a new constraint for node matched from expr, if expr matches the constraint pattern. If negate is True, negate the constraint.

def __init__(self, node: nodes.NodeNG, negate: bool): (source)

Undocumented

@abstractmethod
def satisfied_by(self, inferred: InferenceResult) -> bool: (source)

Return True if this constraint is satisfied by the given inferred value.

True if this constraint is negated. E.g., "is not" instead of "is".

The node that this constraint applies to.