@Override
  public void doInvoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
    final PsiElement elementAt = file.findElementAt(editor.getCaretModel().getOffset());
    final PyBinaryExpression element = PsiTreeUtil.getParentOfType(elementAt, PyBinaryExpression.class, false);
    if (element == null) return;
    final PyElementGenerator elementGenerator = PyElementGenerator.getInstance(project);
    final PyExpression rightExpression = sure(element).getRightExpression();
    if (rightExpression == null) {
      return;
    }
    final PyExpression rhs = PyPsiUtils.flattenParens(rightExpression);
    if (rhs == null) return;
    final String paramText = sure(rhs).getText();
    final TypeEvalContext context = TypeEvalContext.userInitiated(file.getProject(), file);
    final PyType rhsType = context.getType(rhs);
    String prefix = "";
    final LanguageLevel languageLevel = LanguageLevel.forElement(element);
    final PyBuiltinCache builtinCache = PyBuiltinCache.getInstance(rhs);
    if (languageLevel.isPython2() && PyTypeChecker.match(builtinCache.getUnicodeType(languageLevel), rhsType, context) &&
        !PyTypeChecker.match(builtinCache.getBytesType(languageLevel), rhsType, context)) {
      prefix = "u";
    }
    final PyStringLiteralExpression leftExpression = (PyStringLiteralExpression)element.getLeftExpression();
    final Pair<StringBuilder, Boolean> converted = convertFormat(leftExpression, prefix);
    final StringBuilder target = converted.getFirst();
    final String separator = getSeparator(leftExpression);
    target.append(separator).append(".format");

    if (rhs instanceof PyReferenceExpression && rhsType instanceof PyTupleType) {
      target.append("(*").append(paramText).append(")");
    }
    else if (rhs instanceof PyCallExpression callExpression) { // potential dict(foo=1) -> format(foo=1)
      final PyExpression callee = callExpression.getCallee();
      final PyClassType classType = PyUtil.as(rhsType, PyClassType.class);
      if (classType != null && callee != null && isDictCall(callee, classType, context)) {
        target.append(sure(sure(callExpression.getArgumentList()).getNode()).getChars());
      }
      else { // just a call, reuse
        target.append("(");
        if (converted.getSecond()) target.append("**"); // map-by-name formatting was detected
        target.append(paramText).append(")");
      }
    }
    else if (PyTypeUtil.isDict(rhsType)) {
      target.append("(**").append(paramText).append(")");
    }
    else target.append("(").append(paramText).append(")"); // tuple is ok as is
    // Correctly handle multiline implicitly concatenated string literals (PY-9176)
    target.insert(0, '(').append(')');
    final PyExpression parenthesized = elementGenerator.createExpressionFromText(LanguageLevel.forElement(element), target.toString());
    element.replace(sure(((PyParenthesizedExpression)parenthesized).getContainedExpression()));
  }
@Override
  public void doInvoke(@NotNull Project project, Editor editor, PsiFile file)