module documentation
Classes representing different types of constraints on inference values.
Class |
|
Represents a single constraint on a variable. |
Class |
|
Represents an "is None" or "is not None" constraint. |
Function | get |
Returns the constraints for the given expression. |
Constant | ALL |
All supported constraint types. |
Function | _match |
Yields all constraint patterns for node that match. |
Function | _matches |
Returns True if the two nodes match. |
Type Alias | _ |
Undocumented |
def get_constraints(expr:
_NameNodes
, frame: nodes.LocalsDictNodeNG
) -> dict[ nodes.If, set[ Constraint]]
:
(source)
¶
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.
def _match_constraint(node:
_NameNodes
, expr: nodes.NodeNG
, invert: bool
= False) -> Iterator[ Constraint]
:
(source)
¶
Yields all constraint patterns for node that match.