diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java index 647703486ab3..f3e2492c39b7 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java @@ -236,9 +236,13 @@ public class ConvertFormatOperatorToMethodIntention extends BaseIntentionAction if (languageLevel.isOlderThan(LanguageLevel.PYTHON26)) { return false; } - if (binaryExpression.getLeftExpression() instanceof PyStringLiteralExpression && binaryExpression.getOperator() == PyTokenTypes.PERC) { - setText(PyBundle.message("INTN.replace.with.method")); - return true; + if (binaryExpression.getLeftExpression() instanceof PyStringLiteralExpression + && binaryExpression.getOperator() == PyTokenTypes.PERC) { + final PyStringLiteralExpression str = (PyStringLiteralExpression)binaryExpression.getLeftExpression(); + if (!(str.getText().length() > 0 && Character.toUpperCase(str.getText().charAt(0)) == 'B')) { + setText(PyBundle.message("INTN.replace.with.method")); + return true; + } } return false; }