PyTypeParameterType (@NotNull PsiElement element, @NotNull Context context) { if (element instanceof PyCallExpression assignedCall) { final PyExpression callee = assignedCall.getCallee(); if (callee != null) { final Collection<String> calleeQNames = resolveToQualifiedNames(callee, context.getTypeContext()); if (calleeQNames.contains(TYPE_VAR) || calleeQNames.contains(TYPE_VAR_TUPLE)) { final PyExpression[] arguments = assignedCall.getArguments(); if (arguments.length > 0) { final PyExpression firstArgument = arguments[0]; if (firstArgument instanceof PyStringLiteralExpression) { final String name = ((PyStringLiteralExpression)firstArgument).getStringValue(); if (calleeQNames.contains(TYPE_VAR_TUPLE)) { return new PyTypeVarTupleTypeImpl(name); } else { return new PyTypeVarTypeImpl(name, getGenericTypeBound(arguments, context)); } } } } } } return null; }