diff --git a/jedi/inference/star_args.py b/jedi/inference/star_args.py index 2a9dd6b1..6f7fe530 100644 --- a/jedi/inference/star_args.py +++ b/jedi/inference/star_args.py @@ -94,8 +94,20 @@ def _remove_given_params(arguments, param_names): yield p +class ParamNameFixedKind(ParamNameWrapper): + def __init__(self, param_name, new_kind): + super().__init__(param_name) + self._new_kind = new_kind + + def get_kind(self): + return self._new_kind + + @to_list -def process_params(param_names: Sequence[AnonymousParamName | ParamNameFixedKind], star_count=3, already_used=None): +def process_params( + param_names: Sequence[AnonymousParamName | ParamNameFixedKind], + star_count=3, + already_used=None): # start_count=3 means both * and ** if already_used is None: already_used = set() @@ -219,12 +231,3 @@ def process_params(param_names: Sequence[AnonymousParamName | ParamNameFixedKind yield original_kwarg_name elif kwarg_names: yield kwarg_names[0] - - -class ParamNameFixedKind(ParamNameWrapper): - def __init__(self, param_name, new_kind): - super().__init__(param_name) - self._new_kind = new_kind - - def get_kind(self): - return self._new_kind diff --git a/test/test_inference/test_signature.py b/test/test_inference/test_signature.py index 403ebfd1..8b880db4 100644 --- a/test/test_inference/test_signature.py +++ b/test/test_inference/test_signature.py @@ -165,7 +165,7 @@ def test_tree_signature(Script, environment, code, expected): ('two_kwargs_redirects(kw, kw)', '*args, a, b, c, **kwargs'), ('two_kwargs_redirects(simple, kw)', '*args, a, b, c, **kwargs'), ('two_kwargs_redirects(simple2, two_kwargs_redirects(simple, simple))', - '*args, x, a, b, c'), + '*args, x, **kwargs'), ('combined_redirect(simple, simple2)', 'a, b, /, *, x'), ('combined_redirect(simple, simple3)', 'a, b, /, *, a, x: int'), @@ -180,11 +180,11 @@ def test_tree_signature(Script, environment, code, expected): ('combined_lot_of_args(simple4, kw)', '*, b, c, **kwargs'), ('combined_redirect(combined_redirect(simple2, simple4), combined_redirect(kw, simple5))', - 'x, /, *, y'), + '*args, **kwargs'), ('combined_redirect(combined_redirect(simple4, simple2), combined_redirect(simple5, kw))', - 'a, b, x: int, /, *, a, b, c, **kwargs'), + '*args, **kwargs'), ('combined_redirect(combined_redirect(a, kw), combined_redirect(kw, simple5))', - 'a, b, /, *args, y'), + '*args, **kwargs'), ('no_redirect(kw)', '*args, **kwargs'), ('no_redirect(akw)', '*args, **kwargs'),