Function | infer_arguments |
Undocumented |
Function | infer_assign |
infer a AssignName/AssignAttr: need to inspect the RHS part of the assign node |
Function | infer_attribute |
infer an Attribute node by using getattr on the associated object |
Function | infer_augassign |
Undocumented |
Function | infer_binop |
Undocumented |
Function | infer_call |
infer a Call node by trying to guess what the function returns |
Function | infer_empty_node |
Undocumented |
Function | infer_end |
Inference's end for nodes that yield themselves on inference |
Function | infer_functiondef |
Undocumented |
Function | infer_global |
Undocumented |
Function | infer_ifexp |
Support IfExp inference |
Function | infer_import |
infer an Import node: return the imported module/object |
Function | infer_import_from |
infer a ImportFrom node: return the imported module/object |
Function | infer_index |
Undocumented |
Function | infer_map |
Undocumented |
Function | infer_name |
infer a Name: use name lookup rules |
Function | infer_sequence |
Undocumented |
Function | infer_subscript |
Inference for subscripts |
Function | infer_unaryop |
Infer what an UnaryOp should return when evaluated. |
Constant | COMPARE_OPS |
Undocumented |
Constant | UNINFERABLE_OPS |
Undocumented |
Variable | objects |
Undocumented |
Function | _aug_op |
Get an inference callable for an augmented binary operation. |
Function | _bin_op |
Get an inference callable for a normal binary operation. |
Function | _cached_generator |
Undocumented |
Function | _do_compare |
No summary |
Function | _filter_operation_errors |
Undocumented |
Function | _get_aug_flow |
Get the flow for augmented binary operations. |
Function | _get_binop_contexts |
Get contexts for binary operations. |
Function | _get_binop_flow |
Get the flow for binary operations. |
Function | _higher_function_scope |
No summary |
Function | _infer_augassign |
Inference logic for augmented binary operations. |
Function | _infer_binary_operation |
Infer a binary operation between a left operand and a right operand |
Function | _infer_binop |
Binary operation inference logic. |
Function | _infer_boolop |
Infer a boolean operation (and / or / not). |
Function | _infer_compare |
Chained comparison inference logic. |
Function | _infer_map |
Infer all values based on Dict.items |
Function | _infer_sequence_helper |
Infer all values based on _BaseContainer.elts |
Function | _infer_unaryop |
Infer what an UnaryOp should return when evaluated. |
Function | _invoke_binop_inference |
Invoke binary operation inference on the given instance. |
Function | _is_not_implemented |
Check if the given const node is NotImplemented. |
Function | _populate_context_lookup |
Undocumented |
Function | _same_type |
Check if type1 is the same as type2. |
Function | _to_literal |
Undocumented |
Function | _update_with_replacement |
Delete nodes that equate to duplicate keys |
Constant | _SUBSCRIPT_SENTINEL |
Undocumented |
Undocumented
Undocumented
Undocumented
Inference's end for nodes that yield themselves on inference
These are objects for which inference does not have any semantic, such as Module or Consts.
Undocumented
Support IfExp inference
If we can't infer the truthiness of the condition, we default to inferring both branches. Otherwise, we infer either branch depending on the condition.
Inference for subscripts
We're understanding if the index is a Const
or a slice, passing the result of inference
to the value's getitem
method, which should
handle each supported index type accordingly.
Undocumented
Value |
|
Get an inference callable for a normal binary operation.
If reverse is True, then the reflected method will be used instead.
If all possible combinations are either True or False, return that: >>> _do_compare([1, 2], '<=', [3, 4]) True >>> _do_compare([1, 2], '==', [3, 4]) False
If any item is uninferable, or if some combinations are True and some are False, return Uninferable: >>> _do_compare([1, 3], '<=', [2, 4]) util.Uninferable
Parameters | |
left_iter:Iterable[ | Undocumented |
op:str | Undocumented |
right_iter:Iterable[ | Undocumented |
Returns | |
bool|type[ | Undocumented |
Get the flow for augmented binary operations.
The rules are a bit messy:
- if left and right have the same type, then left.__augop__(right) is first tried and then left.__op__(right).
- if left and right are unrelated typewise, then left.__augop__(right) is tried, then left.__op__(right) is tried and then right.__rop__(left) is tried.
- if left is a subtype of right, then left.__augop__(right) is tried and then left.__op__(right).
- if left is a supertype of right, then left.__augop__(right) is tried, then right.__rop__(left) and then left.__op__(right)
Get contexts for binary operations.
This will return two inference contexts, the first one for x.__op__(y), the other one for y.__rop__(x), where only the arguments are inversed.
Get the flow for binary operations.
The rules are a bit messy:
- if left and right have the same type, then only one method will be called, left.__op__(right)
- if left and right are unrelated typewise, then first left.__op__(right) is tried and if this does not exist or returns NotImplemented, then right.__rop__(left) is tried.
- if left is a subtype of right, then only left.__op__(right) is tried.
- if left is a supertype of right, then right.__rop__(left) is first tried and then left.__op__(right)
Parameters | |
node | A scope node. |
Returns | |
None, if no parent function scope was found,
otherwise an instance of astroid.nodes.scoped_nodes.Function ,
which encloses the given node. |
Infer a binary operation between a left operand and a right operand
This is used by both normal binary operations and augmented binary operations, the only difference is the flow factory used.
Infer a boolean operation (and / or / not).
The function will calculate the boolean operation for all pairs generated through inference for each component node.
Parameters | |
context:Optional[ | Undocumented |
Returns | |
Any | Undocumented |
Delete nodes that equate to duplicate keys
Since an astroid node doesn't 'equal' another node with the same value, this function uses the as_string method to make sure duplicate keys don't get through
Note that both the key and the value are astroid nodes
Fixes issue with DictUnpack causing duplicte keys in inferred Dict items
Parameters | |
lhs_dict | Undocumented |
rhs_dict | Undocumented |
dict(nodes.NodeNG, nodes.NodeNG) lhs_dict | Dictionary to 'merge' nodes into |
dict(nodes.NodeNG, nodes.NodeNG) rhs_dict | Dictionary with nodes to pull from |
Returns | |
merged dictionary of nodes |