This module contains a set of functions to handle python protocols for nodes where it makes sense.
Function | arguments |
Undocumented |
Function | assend |
Undocumented |
Function | assign |
Undocumented |
Function | assign |
Undocumented |
Function | const |
Undocumented |
Function | excepthandler |
Undocumented |
Function | for |
Undocumented |
Function | instance |
Undocumented |
Function | match |
Infer MatchAs as the Match subject if it's the only MatchCase pattern else raise StopIteration to yield Uninferable. |
Function | match |
Return empty generator (return -> raises StopIteration) so inferred value is Uninferable. |
Function | match |
Return empty generator (return -> raises StopIteration) so inferred value is Uninferable. |
Function | named |
Infer names and other nodes from an assignment expression. |
Function | sequence |
Undocumented |
Function | starred |
Arguments: self: nodes.Starred node: a node related to the current underlying Node. context: Inference context used for caching already inferred objects assign_path: A list of indices, where each index specifies what item to fetch from the inference results. |
Function | tl |
Infer a binary operation on a tuple or list. |
Function | with |
Infer names and other nodes from a *with* statement. |
Constant | AUGMENTED |
Undocumented |
Constant | BIN |
Undocumented |
Constant | BIN |
Undocumented |
Constant | REFLECTED |
Undocumented |
Constant | UNARY |
Undocumented |
Variable | objects |
Undocumented |
Variable | raw |
Undocumented |
Function | _arguments |
Undocumented |
Function | _augmented |
Undocumented |
Function | _filter |
Undocumented |
Function | _infer |
Undocumented |
Function | _infer |
Perform unary operation on `obj`, unless it is `NotImplemented`. |
Function | _multiply |
Undocumented |
Function | _reflected |
Undocumented |
Function | _resolve |
Recursive function to resolve multiple assignments. |
Function | _resolve |
Recursive function to resolve multiple assignments on loops. |
Constant | _CONTEXTLIB |
Undocumented |
Constant | _UNARY |
Undocumented |
Type Variable | _ |
Undocumented |
nodes.Arguments
, node: node_classes.AssignedStmtsPossibleNode
= None, context: InferenceContext|None
= None, assign_path: list[ int]|None
= None) -> Any
:
(source)
¶
Undocumented
nodes.AssignName|nodes.AssignAttr
, node: node_classes.AssignedStmtsPossibleNode
= None, context: InferenceContext|None
= None, assign_path: list[ int]|None
= None) -> Any
:
(source)
¶
Undocumented
nodes.AnnAssign
, node: node_classes.AssignedStmtsPossibleNode
= None, context: InferenceContext|None
= None, assign_path: list[ int]|None
= None) -> Any
:
(source)
¶
Undocumented
def assign_assigned_stmts(self:
(nodes.AugAssign|nodes.Assign)|nodes.AnnAssign
, node: node_classes.AssignedStmtsPossibleNode
= None, context: InferenceContext|None
= None, assign_path: list[ int]|None
= None) -> Any
:
(source)
¶
Undocumented
def const_infer_binary_op(self:
nodes.Const
, opnode: nodes.AugAssign|nodes.BinOp
, operator: str
, other: InferenceResult
, context: InferenceContext
, _: SuccessfulInferenceResult
) -> Generator[ ConstFactoryResult|util.UninferableBase, None, None]
:
(source)
¶
Undocumented
def excepthandler_assigned_stmts(self:
nodes.ExceptHandler
, node: node_classes.AssignedStmtsPossibleNode
= None, context: InferenceContext|None
= None, assign_path: list[ int]|None
= None) -> Any
:
(source)
¶
Undocumented
def for_assigned_stmts(self:
nodes.For|nodes.Comprehension
, node: node_classes.AssignedStmtsPossibleNode
= None, context: InferenceContext|None
= None, assign_path: list[ int]|None
= None) -> Any
:
(source)
¶
Undocumented
def instance_class_infer_binary_op(self:
bases.Instance|nodes.ClassDef
, opnode: nodes.AugAssign|nodes.BinOp
, operator: str
, other: InferenceResult
, context: InferenceContext
, method: SuccessfulInferenceResult
) -> Generator[ InferenceResult, None, None]
:
(source)
¶
Undocumented
def match_as_assigned_stmts(self:
nodes.MatchAs
, node: nodes.AssignName
, context: InferenceContext|None
= None, assign_path: None
= None) -> Generator[ nodes.NodeNG, None, None]
:
(source)
¶
Infer MatchAs as the Match subject if it's the only MatchCase pattern else raise StopIteration to yield Uninferable.
def match_mapping_assigned_stmts(self:
nodes.MatchMapping
, node: nodes.AssignName
, context: InferenceContext|None
= None, assign_path: None
= None) -> Generator[ nodes.NodeNG, None, None]
:
(source)
¶
Return empty generator (return -> raises StopIteration) so inferred value is Uninferable.
def match_star_assigned_stmts(self:
nodes.MatchStar
, node: nodes.AssignName
, context: InferenceContext|None
= None, assign_path: None
= None) -> Generator[ nodes.NodeNG, None, None]
:
(source)
¶
Return empty generator (return -> raises StopIteration) so inferred value is Uninferable.
def named_expr_assigned_stmts(self:
nodes.NamedExpr
, node: node_classes.AssignedStmtsPossibleNode
, context: InferenceContext|None
= None, assign_path: list[ int]|None
= None) -> Any
:
(source)
¶
Infer names and other nodes from an assignment expression.
nodes.Tuple|nodes.List
, node: node_classes.AssignedStmtsPossibleNode
= None, context: InferenceContext|None
= None, assign_path: list[ int]|None
= None) -> Any
:
(source)
¶
Undocumented
def starred_assigned_stmts(self:
nodes.Starred
, node: node_classes.AssignedStmtsPossibleNode
= None, context: InferenceContext|None
= None, assign_path: list[ int]|None
= None) -> Any
:
(source)
¶
Arguments: self: nodes.Starred node: a node related to the current underlying Node. context: Inference context used for caching already inferred objects assign_path: A list of indices, where each index specifies what item to fetch from the inference results.
def tl_infer_binary_op(self:
_TupleListNodeT
, opnode: nodes.AugAssign|nodes.BinOp
, operator: str
, other: InferenceResult
, context: InferenceContext
, method: SuccessfulInferenceResult
) -> Generator[ (_TupleListNodeT|nodes.Const)|util.UninferableBase, None, None]
:
(source)
¶
Infer a binary operation on a tuple or list. The instance on which the binary operation is performed is a tuple or list. This refers to the left-hand side of the operation, so: 'tuple() + 1' or '[] + A()'
def with_assigned_stmts(self:
nodes.With
, node: node_classes.AssignedStmtsPossibleNode
= None, context: InferenceContext|None
= None, assign_path: list[ int]|None
= None) -> Any
:
(source)
¶
Infer names and other nodes from a *with* statement. This enables only inference for name binding in a *with* statement. For instance, in the following code, inferring `func` will return the `ContextManager` class, not whatever ``__enter__`` returns. We are doing this intentionally, because we consider that the context manager result is whatever __enter__ returns and what it is binded using the ``as`` keyword. class ContextManager(object): def __enter__(self): return 42 with ContextManager() as f: pass # ContextManager().infer() will return ContextManager # f.infer() will return 42. Arguments: self: nodes.With node: The target of the assignment, `as (a, b)` in `with foo as (a, b)`. context: Inference context used for caching already inferred objects assign_path: A list of indices, where each index specifies what item to fetch from the inference results.
Undocumented
Value |
|
Undocumented
Value |
|
str|None
, context: InferenceContext
) -> Generator[ InferenceResult, None, None]
:
(source)
¶
Undocumented
Sequence[ InferenceResult]
, context: InferenceContext
) -> Iterator[ SuccessfulInferenceResult]
:
(source)
¶
Undocumented
Perform unary operation on `obj`, unless it is `NotImplemented`. Can raise TypeError if operation is unsupported.
_TupleListNodeT
, opnode: nodes.AugAssign|nodes.BinOp
, other: nodes.Const
, context: InferenceContext
) -> _TupleListNodeT
:
(source)
¶
Undocumented
Undocumented
Value |
|