Function | class_instance_as_index |
Get the value as an index for the given instance. |
Function | has_known_bases |
Return true if all base classes of a class could be inferred. |
Function | is_subtype |
Check if type1 is a subtype of type2. |
Function | is_supertype |
Check if type2 is a supertype of type1. |
Function | object_isinstance |
Check if a node 'isinstance' any node in class_or_seq |
Function | object_issubclass |
Check if a type is a subclass of any node in class_or_seq |
Function | object_len |
Infer length of given node object |
Function | object_type |
Obtain the type of the given node |
Function | safe_infer |
Return the inferred value for the given node. |
Function | _build_proxy_class |
Undocumented |
Function | _function_type |
Undocumented |
Function | _object_type |
Undocumented |
Function | _object_type_is_subclass |
Undocumented |
Function | _type_check |
Undocumented |
Get the value as an index for the given instance.
If an instance provides an __index__ method, then it can be used in some scenarios where an integer is expected, for instance when multiplying or subscripting a list.
Parameters | |
node | A given node |
class_or_seq | Union[nodes.NodeNG, Sequence[nodes.NodeNG]] |
context | Undocumented |
Returns | |
bool | Undocumented |
Raises | |
AstroidTypeError | if the given classes_or_seq are not types |
Parameters | |
node | A given node |
class_or_seq | Union[Nodes.NodeNG, Sequence[nodes.NodeNG]] |
context | Undocumented |
Returns | |
bool | Undocumented |
Raises | |
AstroidTypeError | if the given classes_or_seq are not types |
AstroidError | if the type of the given node cannot be inferred or its type's mro doesn't work |
Parameters | |
node | Node to infer length of |
context | Undocumented |
Union[nodes.ClassDef, nodes.Instance] node | |
Returns | |
Integer length of node | Undocumented |
Raises | |
AstroidTypeError | If an invalid node is returned from __len__ method or no __len__ method exists |
InferenceError | If the given node cannot be inferred or if multiple nodes are inferred or if the code executed in python would result in a infinite recursive check for length |
Obtain the type of the given node
This is used to implement the type builtin, which means that it's used for inferring type calls, as well as used in a couple of other places in the inference. The node will be inferred first, so this function can support all sorts of objects, as long as they support inference.