class documentation
class Constraint(ABC): (source)
Known subclasses: astroid.constraint.NoneConstraint
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 |
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. |
@classmethod
@abstractmethod
def match(cls:
@abstractmethod
def match(cls:
type[ Self]
, node: _NameNodes
, expr: nodes.NodeNG
, negate: bool
= False) -> Self|None
:
(source)
¶
overridden in
astroid.constraint.NoneConstraint
Return a new constraint for node matched from expr, if expr matches the constraint pattern. If negate is True, negate the constraint.
overridden in
astroid.constraint.NoneConstraint
Return True if this constraint is satisfied by the given inferred value.