mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-12526 Replace with str format method call: unnecessary u prefix for python 3
This commit is contained in:
+2
-1
@@ -140,10 +140,11 @@ public class PyStringConcatenationToFormatIntention extends BaseIntentionAction
|
||||
int paramCount = 0;
|
||||
boolean isUnicode = false;
|
||||
final PyClassTypeImpl unicodeType = PyBuiltinCache.getInstance(element).getObjectType("unicode");
|
||||
|
||||
for (PyExpression expression : getSimpleExpressions((PyBinaryExpression) element)) {
|
||||
if (expression instanceof PyStringLiteralExpression) {
|
||||
final PyType type = context.getType(expression);
|
||||
if (PyTypeChecker.match(unicodeType, type, context)) {
|
||||
if (type != null && type.equals(unicodeType)) {
|
||||
isUnicode = true;
|
||||
}
|
||||
if (!quotesDetected) {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
string = "qwer<caret>" + "asdf"
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
|
||||
string = "qwerasdf"
|
||||
+4
@@ -73,4 +73,8 @@ public class PyStringConcatenationToFormatIntentionTest extends PyIntentionTestC
|
||||
public void testPy3() { //PY-4706
|
||||
doTest(PyBundle.message("INTN.replace.plus.with.str.format"), LanguageLevel.PYTHON33);
|
||||
}
|
||||
|
||||
public void testPy3Unicode() {
|
||||
doTest(PyBundle.message("INTN.replace.plus.with.str.format"), LanguageLevel.PYTHON33);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user