mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Add a couple of docstrings
These are based on observation of the outputs of these functions.
This commit is contained in:
@@ -51,6 +51,25 @@ class ExecutedParamName(ParamName):
|
|||||||
|
|
||||||
|
|
||||||
def get_executed_param_names_and_issues(function_value, arguments):
|
def get_executed_param_names_and_issues(function_value, arguments):
|
||||||
|
"""
|
||||||
|
Return a tuple of:
|
||||||
|
- a list of `ExecutedParamName`s corresponding to the arguments of the
|
||||||
|
function execution `function_value`, containing the inferred value of
|
||||||
|
those arguments (whether explicit or default)
|
||||||
|
- a list of the issues encountered while building that list
|
||||||
|
|
||||||
|
For example, given:
|
||||||
|
```
|
||||||
|
def foo(a, b, c=None, d='d'): ...
|
||||||
|
|
||||||
|
foo(42, c='c')
|
||||||
|
```
|
||||||
|
|
||||||
|
Then for the execution of `foo`, this will return a tuple containing:
|
||||||
|
- a list with entries for each parameter a, b, c & d; the entries for a,
|
||||||
|
c, & d will have their values (42, 'c' and 'd' respectively) included.
|
||||||
|
- a list with a single entry about the lack of a value for `b`
|
||||||
|
"""
|
||||||
def too_many_args(argument):
|
def too_many_args(argument):
|
||||||
m = _error_argument_count(funcdef, len(unpacked_va))
|
m = _error_argument_count(funcdef, len(unpacked_va))
|
||||||
# Just report an error for the first param that is not needed (like
|
# Just report an error for the first param that is not needed (like
|
||||||
@@ -207,6 +226,23 @@ def get_executed_param_names_and_issues(function_value, arguments):
|
|||||||
|
|
||||||
|
|
||||||
def get_executed_param_names(function_value, arguments):
|
def get_executed_param_names(function_value, arguments):
|
||||||
|
"""
|
||||||
|
Return a list of `ExecutedParamName`s corresponding to the arguments of the
|
||||||
|
function execution `function_value`, containing the inferred value of those
|
||||||
|
arguments (whether explicit or default). Any issues building this list (for
|
||||||
|
example required arguments which are missing in the invocation) are ignored.
|
||||||
|
|
||||||
|
For example, given:
|
||||||
|
```
|
||||||
|
def foo(a, b, c=None, d='d'): ...
|
||||||
|
|
||||||
|
foo(42, c='c')
|
||||||
|
```
|
||||||
|
|
||||||
|
Then for the execution of `foo`, this will return a list containing entries
|
||||||
|
for each parameter a, b, c & d; the entries for a, c, & d will have their
|
||||||
|
values (42, 'c' and 'd' respectively) included.
|
||||||
|
"""
|
||||||
return get_executed_param_names_and_issues(function_value, arguments)[0]
|
return get_executed_param_names_and_issues(function_value, arguments)[0]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user