PyChangeSignatureQuickFix (@NotNull PyArgumentsMapping mapping) { assert mapping.getCallableType() != null; final PyFunction function = as(mapping.getCallableType().getCallable(), PyFunction.class); assert function != null; final PyCallSiteExpression callSiteExpression = mapping.getCallSiteExpression(); int positionalParamAnchor = -1; final PyParameter[] parameters = function.getParameterList().getParameters(); for (PyParameter parameter : parameters) { final PyNamedParameter namedParam = parameter.getAsNamed(); final boolean isVararg = namedParam != null && (namedParam.isPositionalContainer() || namedParam.isKeywordContainer()); if (parameter instanceof PySingleStarParameter || parameter.hasDefaultValue() || isVararg) { break; } positionalParamAnchor++; } final List<Pair<Integer, PyParameterInfo>> newParameters = new ArrayList<>(); final TypeEvalContext context = TypeEvalContext.userInitiated(function.getProject(), callSiteExpression.getContainingFile()); final Set<String> usedParamNames = new HashSet<>(); for (PyExpression arg : mapping.getUnmappedArguments()) { if (arg instanceof PyKeywordArgument) { final PyExpression value = ((PyKeywordArgument)arg).getValueExpression(); final String valueText = value != null ? value.getText() : ""; newParameters.add(Pair.create(parameters.length - 1, new PyParameterInfo(NEW_PARAMETER, ((PyKeywordArgument)arg).getKeyword(), valueText, true))); } else { final String paramName = generateParameterName(arg, function, usedParamNames, context); newParameters.add(Pair.create(positionalParamAnchor, new PyParameterInfo(NEW_PARAMETER, paramName, arg.getText(), false))); usedParamNames.add(paramName); } } return new PyChangeSignatureQuickFix(function, newParameters, mapping.getCallSiteExpression()); }