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 infer_argument
with the corresponding function node and the argument name.
Parameters | |
callcontext | An instance of astroid.context.CallContext , that holds
the arguments for the call site. |
argument_context_map | Additional contexts per node, passed in from astroid.context.Context.extra_context |
context | An instance of astroid.context.Context . |
Class Method | from_call |
Get a CallSite object from the given Call node. |
Method | __init__ |
Undocumented |
Method | has_invalid_arguments |
Check if in the current CallSite were passed invalid arguments |
Method | has_invalid_keywords |
Check if in the current CallSite were passed invalid keyword arguments |
Method | infer_argument |
infer a function argument value according to the call context |
Instance Variable | argument_context_map |
Undocumented |
Instance Variable | duplicated_keywords |
Undocumented |
Instance Variable | keyword_arguments |
Undocumented |
Instance Variable | positional_arguments |
Undocumented |
Method | _unpack_args |
Undocumented |
Method | _unpack_keywords |
Undocumented |
Instance Variable | _unpacked_args |
Undocumented |
Instance Variable | _unpacked_kwargs |
Undocumented |
Get a CallSite object from the given Call node.
context will be used to force a single inference path.
Parameters | |
call_node | Undocumented |
context:Optional[ | Undocumented |
Undocumented
Parameters | |
callcontext:CallContext | Undocumented |
argument_context_map | Undocumented |
context | 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.