Astroid hooks for various builtins.
Function | infer |
Understand bool calls. |
Function | infer |
Understand callable calls. |
Function | infer |
Try to infer a dict call to a Dict node. |
Function | infer |
Infer dict.fromkeys. |
Function | infer |
Understand getattr calls. |
Function | infer |
Understand hasattr calls. |
Function | infer |
Infer int() calls. |
Function | infer |
Infer isinstance calls. |
Function | infer |
Infer issubclass() calls. |
Function | infer |
Infer length calls. |
Function | infer |
Understand `property` class. |
Function | infer |
Understand `slice` calls. |
Function | infer |
Infer str() calls. |
Function | infer |
Understand super calls. |
Function | infer |
Understand the one-argument form of *type*. |
Function | register |
Register a new transform function for the given *builtin_name*. |
Constant | BYTES |
Undocumented |
Constant | OBJECT |
Undocumented |
Constant | STR |
Undocumented |
Variable | infer |
Undocumented |
Variable | infer |
Undocumented |
Variable | infer |
Undocumented |
Variable | infer |
Undocumented |
Function | _builtin |
Undocumented |
Function | _class |
Undocumented |
Function | _container |
Undocumented |
Function | _container |
Undocumented |
Function | _extend |
Undocumented |
Function | _extend |
Function to extend builtin str/unicode class. |
Function | _get |
Undocumented |
Function | _infer |
Undocumented |
Function | _infer |
Undocumented |
Function | _infer |
Undocumented |
Function | _infer |
Undocumented |
Function | _infer |
Predicate before inference_tip. |
Function | _infer |
Return a Const node based on the template and passed arguments. |
Function | _is |
Catch calls to str.format(). |
Understand callable calls. This follows Python's semantics, where an object is callable if it provides an attribute __call__, even though that attribute is something which can't be called.
Try to infer a dict call to a Dict node. The function treats the following cases: * dict() * dict(mapping) * dict(iterable) * dict(iterable, **kwargs) * dict(mapping, **kwargs) * dict(**kwargs) If a case can't be inferred, we'll fallback to default inference.
Infer dict.fromkeys. :param nodes.Call node: dict.fromkeys() call to infer :param context.InferenceContext context: node context :rtype nodes.Dict: a Dictionary containing the values that astroid was able to infer. In case the inference failed for any reason, an empty dictionary will be inferred instead.
Understand getattr calls. If one of the arguments is an Uninferable object, then the result will be an Uninferable object. Otherwise, the normal attribute lookup will be done.
Understand hasattr calls. This always guarantees three possible outcomes for calling hasattr: Const(False) when we are sure that the object doesn't have the intended attribute, Const(True) when we know that the object has the attribute and Uninferable when we are unsure of the outcome of the function call.
Infer int() calls. :param nodes.Call node: int() call to infer :param context.InferenceContext: node context :rtype nodes.Const: a Const containing the integer value of the int() call
Infer isinstance calls. :param nodes.Call callnode: an isinstance call :rtype nodes.Const: Boolean Const value of isinstance call :raises UseInferenceDefault: If the node cannot be inferred
Infer issubclass() calls. :param nodes.Call callnode: an `issubclass` call :param InferenceContext context: the context for the inference :rtype nodes.Const: Boolean Const value of the `issubclass` call :raises UseInferenceDefault: If the node cannot be inferred
Infer length calls. :param nodes.Call node: len call to infer :param context.InferenceContext: node context :rtype nodes.Const: a Const node with the inferred length, if possible
nodes.Call
, context: InferenceContext|None
= None) -> objects.Property
:
(source)
¶
Understand `property` class. This only infers the output of `property` call, not the arguments themselves.
Infer str() calls. :param nodes.Call node: str() call to infer :param context.InferenceContext: node context :rtype nodes.Const: a Const containing an empty string
Understand super calls. There are some restrictions for what can be understood: * unbounded super (one argument form) is not understood. * if the super call is not inside a function (classmethod or method), then the default inference will be used. * if the super arguments can't be inferred, the default inference will be used.
Register a new transform function for the given *builtin_name*. The transform function must accept two parameters, a node and an optional context.
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
nodes.Call
, context: InferenceContext|None
= None) -> Iterator[ nodes.NodeNG]
:
(source)
¶
Undocumented
nodes.Call
, context: InferenceContext|None
= None) -> Iterator[ nodes.Const|util.UninferableBase]
:
(source)
¶
Return a Const node based on the template and passed arguments.