class CallSite: (source)
Class for understanding arguments passed into a call site. It needs a call context, which contains the arguments and the keyword arguments that were passed into a given call site. In order to infer what an argument represents, call :meth:`infer_argument` with the corresponding function node and the argument name. :param callcontext: An instance of :class:`astroid.context.CallContext`, that holds the arguments for the call site. :param argument_context_map: Additional contexts per node, passed in from :attr:`astroid.context.Context.extra_context` :param context: An instance of :class:`astroid.context.Context`.
Class Method | from |
Get a CallSite object from the given Call node. |
Method | __init__ |
Undocumented |
Method | has |
Check if in the current CallSite were passed *invalid* arguments. |
Method | has |
Check if in the current CallSite were passed *invalid* keyword arguments. |
Method | infer |
Infer a function argument value according to the call context. |
Instance Variable | argument |
Undocumented |
Instance Variable | duplicated |
Undocumented |
Instance Variable | keyword |
Undocumented |
Instance Variable | positional |
Undocumented |
Method | _unpack |
Undocumented |
Method | _unpack |
Undocumented |
Instance Variable | _unpacked |
Undocumented |
Instance Variable | _unpacked |
Undocumented |
Get a CallSite object from the given Call node. context will be used to force a single inference path.
CallContext
, argument_context_map=None, context: InferenceContext|None
= None):
(source)
¶
Undocumented
Check if in the current CallSite were passed *invalid* arguments. This can mean multiple things. For instance, if an unpacking of an invalid object was passed, then this method will return True. Other cases can be when the arguments can't be inferred by astroid, for example, by passing objects which aren't known statically.
Check if in the current CallSite were passed *invalid* keyword arguments. For instance, unpacking a dictionary with integer keys is invalid (**{1:2}), because the keys must be strings, which will make this method to return True. Other cases where this might return True if objects which can't be inferred were passed.
Infer a function argument value according to the call context. Arguments: funcnode: The function being called. name: The name of the argument whose value is being inferred. context: Inference context object