Various helper utilities.
Function | class |
Get the value as an index for the given instance. |
Function | has |
Return whether all base classes of a class could be inferred. |
Function | is |
Check if *type1* is a subtype of *type2*. |
Function | is |
Check if *type2* is a supertype of *type1*. |
Function | object |
Check if a node 'isinstance' any node in class_or_seq. |
Function | object |
Check if a type is a subclass of any node in class_or_seq. |
Function | object |
Infer length of given node object. |
Function | object |
Obtain the type of the given node. |
Function | safe |
Return the inferred value for the given node. |
Function | _build |
Undocumented |
Function | _function |
Undocumented |
Function | _object |
Undocumented |
Function | _object |
Undocumented |
Function | _type |
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.
Check if a node 'isinstance' any node in class_or_seq. :param node: A given node :param class_or_seq: Union[nodes.NodeNG, Sequence[nodes.NodeNG]] :rtype: bool :raises AstroidTypeError: if the given ``classes_or_seq`` are not types
Check if a type is a subclass of any node in class_or_seq. :param node: A given node :param class_or_seq: Union[Nodes.NodeNG, Sequence[nodes.NodeNG]] :rtype: bool :raises AstroidTypeError: if the given ``classes_or_seq`` are not types :raises AstroidError: if the type of the given node cannot be inferred or its type's mro doesn't work
Infer length of given node object. :param Union[nodes.ClassDef, nodes.Instance] node: :param node: Node to infer length of :raises AstroidTypeError: If an invalid node is returned from __len__ method or no __len__ method exists :raises 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 :rtype int: Integer length of node
SuccessfulInferenceResult
, context: InferenceContext|None
= None) -> InferenceResult|None
:
(source)
¶
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.
nodes.NodeNG|bases.Proxy
, context: InferenceContext|None
= None) -> InferenceResult|None
:
(source)
¶
Return the inferred value for the given node. Return None if inference failed or if there is some ambiguity (more than one node has been inferred).
nodes.Lambda|bases.UnboundMethod
, builtins: nodes.Module
) -> nodes.ClassDef
:
(source)
¶
Undocumented
SuccessfulInferenceResult
, context: InferenceContext|None
= None) -> Generator[ InferenceResult|None, None, None]
:
(source)
¶
Undocumented
InferenceContext|None
= None):
(source)
¶
Undocumented