class documentation

class NoneConstraint(Constraint): (source)

View In Hierarchy

Represents an "is None" or "is not None" constraint.

Class Method match Return a new constraint for node matched from expr, if expr matches the constraint pattern.
Method satisfied_by Return True if this constraint is satisfied by the given inferred value.
Constant CONST_NONE Undocumented

Inherited from Constraint:

Method __init__ Undocumented
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
def match(cls: type[Self], node: _NameNodes, expr: nodes.NodeNG, negate: bool = False) -> Self|None: (source)

Return a new constraint for node matched from expr, if expr matches the constraint pattern. Negate the constraint based on the value of negate.

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

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

Undocumented

Value
nodes.Const(None)