@Override
  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
    if (!(file instanceof PyFile)) {
      return false;
    }

    PyBinaryExpression binaryExpression  =
      PsiTreeUtil.getParentOfType(file.findElementAt(editor.getCaretModel().getOffset()), PyBinaryExpression.class, false);
    if (binaryExpression == null) {
      return false;
    }
    if (binaryExpression.getLeftExpression() instanceof PyStringLiteralExpression str && binaryExpression.getOperator() == PyTokenTypes.PERC) {
      if ((str.getText().length() > 0 && Character.toUpperCase(str.getText().charAt(0)) == 'B')) {
        return false;
      }

      final List<PyStringFormatParser.SubstitutionChunk> chunks =
        PyStringFormatParser.filterSubstitutions(PyStringFormatParser.parsePercentFormat(binaryExpression.getLeftExpression().getText()));

      for (PyStringFormatParser.SubstitutionChunk chunk : chunks) {
        if ("*".equals(chunk.getWidth()) || "*".equals(chunk.getPrecision())) {
          return false;
        }
      }

      setText(PyPsiBundle.message("INTN.replace.with.method"));
      return true;
    }
    return false;
  }
@Override
  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file)