i18n: Add initial support in PyCompatibilityInspection

All its warnings are extracted into the bundle, but they are still poorly
adapted for translation. Each of them in constructed from two separate
messages, a common prefix and an individual feature description, with negation
of the main verb being split. Only the first message can vary depending on
the affected versions number, but both parts of the verb need to agree in many
languages other than English. It's not clear how to address it without
overhauling inspection internals, thus it will be revised later.

I also slightly updated the warnings format. Namely, put "version" in plural,
if a warning applies to multiple Python versions, and removed trailing periods
from single-sentence messages.

GitOrigin-RevId: 51e577201b11fb4e8b6967e1f5ad27143ba9f82e
This commit is contained in:
Mikhail Golubev
2020-08-19 14:22:06 +00:00
committed by intellij-monorepo-bot
parent 7d9e25a990
commit 0adac7f9ea
49 changed files with 295 additions and 232 deletions
@@ -434,8 +434,6 @@ python.docstring.select.type=Select Docstring Type
### Inspections: INSP ###
INSP.GROUP.python=Python
INSP.compatibility.this.syntax.available.only.since.py3=This syntax available only since py3
INSP.compatibility.check.for.compatibility.with.python.versions=Check for compatibility with python versions:
INSP.abstract.class.set.as.metaclass=Set ''{0}'' as metaclass
INSP.abstract.class.add.to.superclasses=Add ''{0}'' to superclasses
INSP.pep8.naming=PEP 8 naming convention violation
@@ -663,6 +661,59 @@ INSP.oldstyle.class.super=Old-style class contains call for super method
# PyCompatibilityInspection
INSP.NAME.compatibility=Code compatibility inspection
INSP.compatibility.this.syntax.available.only.since.py3=This syntax available only since py3
INSP.compatibility.check.for.compatibility.with.python.versions=Check for compatibility with python versions:
INSP.compatibility.inspection.unsupported.feature.prefix=Python {0,choice,1#version|2#versions} {1} {0,choice,1#does|2#do} not {2}
INSP.compatibility.feature.support.variable.annotations=support variable annotations
INSP.compatibility.feature.support.dictionary.comprehensions=support dictionary comprehensions
INSP.compatibility.feature.support.set.literal.expressions=support set literal expressions
INSP.compatibility.feature.support.set.comprehensions=support set comprehensions
INSP.compatibility.feature.support.this.syntax=support this syntax
INSP.compatibility.feature.have.module.builtins=have module builtins
INSP.compatibility.feature.have.module.builtin=have module __builtin__
INSP.compatibility.feature.support.starred.expressions.as.assignment.targets=support starred expressions as assignment targets
INSP.compatibility.feature.support.starred.expressions.in.tuples.lists.and.sets=support starred expressions in tuples, lists, and sets
INSP.compatibility.feature.support.unpacking.without.parentheses.in.return.statements=support unpacking without parentheses in return statements
INSP.compatibility.feature.support.unpacking.without.parentheses.in.yield.statements=support unpacking without parentheses in yield statements
INSP.compatibility.feature.support.starred.expressions.in.dicts=support starred expressions in dicts
INSP.compatibility.feature.support.diamond.operator=support <>, use != instead
INSP.compatibility.feature.support.matrix.multiplication.operators=support matrix multiplication operators
INSP.compatibility.feature.support.long.integer.literal.suffix=support a trailing ''{0}''
INSP.compatibility.feature.support.old.style.octal.literals=support this syntax. It requires '0o' prefix for octal literals
INSP.compatibility.feature.support.underscores.in.numeric.literals=support underscores in numeric literals
INSP.compatibility.feature.support.string.literal.prefix=support a ''{0}'' prefix
INSP.compatibility.feature.allow.to.mix.bytes.and.non.bytes.literals=allow to mix bytes and non-bytes literals
INSP.compatibility.feature.support.this.syntax.in.list.comprehensions=support this syntax in list comprehensions
INSP.compatibility.feature.support.raise.with.no.arguments.outside.except.block=support this syntax. Raise with no arguments can only be used in an except block
INSP.compatibility.feature.support.backquotes=support backquotes, use repr() instead
INSP.compatibility.feature.support.multiple.context.managers=support multiple context managers
INSP.compatibility.feature.support.print.statement=support this syntax. The print statement has been replaced with a print() function
INSP.compatibility.feature.support.super.without.arguments=support this syntax. super() should have arguments in Python 2
INSP.compatibility.py35.does.not.support.yield.inside.async.functions=Python version 3.5 does not support 'yield' inside async functions
INSP.compatibility.feature.support.yield.from=support this syntax. Delegating to a subgenerator is available since Python 3.3; use explicit iteration over subgenerator instead.
INSP.compatibility.pre35.versions.do.not.allow.return.with.argument.inside.generator=Python versions < 3.3 do not allow 'return' with argument inside generator.
INSP.compatibility.feature.support.ellipsis.outside.slices=support '...' outside of sequence slicings
INSP.compatibility.feature.have.nonlocal.keyword=have nonlocal keyword
INSP.compatibility.keyword.argument.repeated=Keyword argument repeated
INSP.compatibility.feature.allow.keyword.arguments.after.kwargs=allow keyword arguments after **expression
INSP.compatibility.feature.allow.duplicate.kwargs=allow duplicate **expressions
INSP.compatibility.feature.allow.duplicate.positional.varargs=allow duplicate *expressions
INSP.compatibility.feature.allow.positional.arguments.after.expression=allow positional arguments after *expression
INSP.compatibility.positional.argument.after.keyword.argument=Positional argument after keyword argument
INSP.compatibility.positional.argument.after.kwargs=Positional argument after **expression
INSP.compatibility.feature.allow.trailing.comma.after.kwargs=allow a trailing comma after **expression
INSP.compatibility.feature.allow.trailing.comma.after.positional.vararg=allow a trailing comma after *expression
INSP.compatibility.py35.does.not.support.async.inside.comprehensions.and.generator.expressions=Python version 3.5 does not support 'async' inside comprehensions and generator expressions
INSP.compatibility.py35.does.not.support.await.inside.comprehensions=Python version 3.5 does not support 'await' inside comprehensions
INSP.compatibility.feature.support.positional.only.parameters=support positional-only parameters
INSP.compatibility.support.equality.signs.in.fstrings=support equality signs in f-strings
INSP.compatibility.feature.support.assignment.expressions=support assignment expressions
INSP.compatibility.feature.support.continue.inside.finally.clause=support 'continue' inside 'finally' clause
INSP.compatibility.feature.support.arbitrary.expressions.as.decorator=support arbitrary expressions as a decorator
INSP.compatibility.feature.have.type.long=have type long. Use int instead.
INSP.compatibility.feature.have.method=have method {0}
INSP.compatibility.feature.have.module=have module {0}
INSP.compatibility.feature.allow.async.and.await.as.names=allow 'async' and 'await' as names
# PyUnnecessaryBackslashInspection
INSP.NAME.unnecessary.backslash=Unnecessary backslash
@@ -20,6 +20,7 @@ import com.intellij.codeInspection.InspectionProfile;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.codeInspection.util.InspectionMessage;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.JDOMExternalizableStringList;
@@ -139,7 +140,7 @@ public class PyCompatibilityInspection extends PyInspection {
@Override
protected void registerProblem(@NotNull PsiElement element,
@NotNull TextRange range,
@NotNull String message,
@NotNull @InspectionMessage String message,
@Nullable LocalQuickFix quickFix,
boolean asError) {
if (element.getTextLength() == 0) {
@@ -182,7 +183,7 @@ public class PyCompatibilityInspection extends PyInspection {
final Map<LanguageLevel, Set<String>> unsupportedMethods = UnsupportedFeaturesUtil.CLASS_METHODS.get(className);
registerForAllMatchingVersions(level -> unsupportedMethods.getOrDefault(level, Collections.emptySet()).contains(functionName),
" not have method " + functionName,
PyPsiBundle.message("INSP.compatibility.feature.have.method", functionName),
node);
}
}
@@ -192,7 +193,7 @@ public class PyCompatibilityInspection extends PyInspection {
!"exec".equals(functionName) &&
!myUsedImports.contains(functionName)) {
registerForAllMatchingVersions(level -> UnsupportedFeaturesUtil.BUILTINS.get(level).contains(functionName),
" not have method " + functionName,
PyPsiBundle.message("INSP.compatibility.feature.have.method", functionName),
node);
}
}
@@ -203,7 +204,7 @@ public class PyCompatibilityInspection extends PyInspection {
PyNames.TYPE_LONG.equals(target.getName()) &&
PyBuiltinCache.getInstance(resolvedCallee).isBuiltin(resolvedCallee)) {
registerForAllMatchingVersions(level -> UnsupportedFeaturesUtil.BUILTINS.get(level).contains(PyNames.TYPE_LONG),
" not have type long. Use int instead.",
PyPsiBundle.message("INSP.compatibility.feature.have.type.long"),
node);
}
}
@@ -234,7 +235,7 @@ public class PyCompatibilityInspection extends PyInspection {
final String moduleName = qName.toString();
registerForAllMatchingVersions(level -> UnsupportedFeaturesUtil.MODULES.get(level).contains(moduleName) && !BACKPORTED_PACKAGES.contains(moduleName),
" not have module " + moduleName,
PyPsiBundle.message("INSP.compatibility.feature.have.module", moduleName),
importElement);
}
}
@@ -264,7 +265,7 @@ public class PyCompatibilityInspection extends PyInspection {
final String moduleName = name.toString();
registerForAllMatchingVersions(level -> UnsupportedFeaturesUtil.MODULES.get(level).contains(moduleName) && !BACKPORTED_PACKAGES.contains(moduleName),
" not have module " + name,
PyPsiBundle.message("INSP.compatibility.feature.have.module", name),
source);
}
}
@@ -353,7 +354,7 @@ public class PyCompatibilityInspection extends PyInspection {
ArrayUtil.contains(nameIdentifierOwner.getName(), PyNames.AWAIT, PyNames.ASYNC) &&
LanguageLevel.forElement(nameIdentifierOwner).isOlderThan(LanguageLevel.PYTHON37)) {
registerForAllMatchingVersions(level -> level.isAtLeast(LanguageLevel.PYTHON37),
" not allow 'async' and 'await' as names",
PyPsiBundle.message("INSP.compatibility.feature.allow.async.and.await.as.names"),
nameIdentifier,
PythonUiService.getInstance().createPyRenameElementQuickFix(nameIdentifierOwner));
}
@@ -3,7 +3,9 @@ package com.jetbrains.python.validation;
import com.google.common.collect.Sets;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.util.InspectionMessage;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
@@ -17,11 +19,13 @@ import com.intellij.psi.util.QualifiedName;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PyTokenTypes;
import com.jetbrains.python.codeInsight.dataflow.scope.ScopeUtil;
import com.jetbrains.python.inspections.quickfix.*;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.impl.PyPsiUtils;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -44,9 +48,6 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
@NotNull
private static final Set<String> PYTHON36_PREFIXES = Sets.newHashSet("R", "U", "B", "BR", "RB", "F", "FR", "RF");
@NotNull
protected static final String COMMON_MESSAGE = "Python version ";
@NotNull
protected List<LanguageLevel> myVersionsToProcess;
@@ -59,7 +60,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
final PsiElement parent = node.getParent();
if (!(parent instanceof PyFunction || parent instanceof PyNamedParameter)) {
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON36) && registerForLanguageLevel(level),
" not support variable annotations",
PyPsiBundle.message("INSP.compatibility.feature.support.variable.annotations"),
node);
}
}
@@ -69,7 +70,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
super.visitPyDictCompExpression(node);
registerForAllMatchingVersions(level -> !level.supportsSetLiterals() && registerForLanguageLevel(level),
" not support dictionary comprehensions",
PyPsiBundle.message("INSP.compatibility.feature.support.dictionary.comprehensions"),
node,
new ConvertDictCompQuickFix(),
false);
@@ -80,7 +81,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
super.visitPySetLiteralExpression(node);
registerForAllMatchingVersions(level -> !level.supportsSetLiterals() && registerForLanguageLevel(level),
" not support set literal expressions",
PyPsiBundle.message("INSP.compatibility.feature.support.set.literal.expressions"),
node,
new ConvertSetLiteralQuickFix(),
false);
@@ -91,7 +92,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
super.visitPySetCompExpression(node);
registerForAllMatchingVersions(level -> !level.supportsSetLiterals() && registerForLanguageLevel(level),
" not support set comprehensions",
PyPsiBundle.message("INSP.compatibility.feature.support.set.comprehensions"),
node,
null,
false);
@@ -110,7 +111,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
if (element != null && ",".equals(element.getText())) {
registerForAllMatchingVersions(level -> level.isPy3K() && registerForLanguageLevel(level),
" not support this syntax.",
PyPsiBundle.message("INSP.compatibility.feature.support.this.syntax"),
node,
new ReplaceExceptPartQuickFix());
}
@@ -130,13 +131,13 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
if (qName != null) {
if (qName.matches("builtins")) {
registerForAllMatchingVersions(level -> level.isPython2() && registerForLanguageLevel(level),
" not have module builtins",
PyPsiBundle.message("INSP.compatibility.feature.have.module.builtins"),
node,
new ReplaceBuiltinsQuickFix());
}
else if (qName.matches("__builtin__")) {
registerForAllMatchingVersions(level -> level.isPy3K() && registerForLanguageLevel(level),
" not have module __builtin__",
PyPsiBundle.message("INSP.compatibility.feature.have.module.builtin"),
node,
new ReplaceBuiltinsQuickFix());
}
@@ -150,13 +151,13 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
if (node.isAssignmentTarget()) {
registerForAllMatchingVersions(level -> level.isPython2() && registerForLanguageLevel(level),
" not support starred expressions as assignment targets",
PyPsiBundle.message("INSP.compatibility.feature.support.starred.expressions.as.assignment.targets"),
node);
}
if (node.isUnpacking()) {
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON35) && registerForLanguageLevel(level),
" not support starred expressions in tuples, lists, and sets",
PyPsiBundle.message("INSP.compatibility.feature.support.starred.expressions.in.tuples.lists.and.sets"),
node);
final PsiElement container = PsiTreeUtil.skipParentsOfType(node, PyParenthesizedExpression.class);
if (container instanceof PyTupleExpression) {
@@ -165,7 +166,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
registerForAllMatchingVersions(level -> level.isAtLeast(LanguageLevel.PYTHON35) &&
level.isOlderThan(LanguageLevel.PYTHON38) &&
registerForLanguageLevel(level),
" not support unpacking without parentheses in return statements",
PyPsiBundle.message("INSP.compatibility.feature.support.unpacking.without.parentheses.in.return.statements"),
node);
}
@@ -173,7 +174,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
registerForAllMatchingVersions(level -> level.isAtLeast(LanguageLevel.PYTHON35) &&
level.isOlderThan(LanguageLevel.PYTHON38) &&
registerForLanguageLevel(level),
" not support unpacking without parentheses in yield statements",
PyPsiBundle.message("INSP.compatibility.feature.support.unpacking.without.parentheses.in.yield.statements"),
node);
}
}
@@ -185,7 +186,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
super.visitPyDoubleStarExpression(node);
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON35) && registerForLanguageLevel(level),
" not support starred expressions in dicts",
PyPsiBundle.message("INSP.compatibility.feature.support.starred.expressions.in.dicts"),
node);
}
@@ -195,7 +196,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
if (node.isOperator("<>")) {
registerForAllMatchingVersions(level -> level.isPy3K() && registerForLanguageLevel(level),
" not support <>, use != instead.",
PyPsiBundle.message("INSP.compatibility.feature.support.diamond.operator"),
node,
new ReplaceNotEqOperatorQuickFix());
}
@@ -206,7 +207,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
private void checkMatrixMultiplicationOperator(PsiElement node) {
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON35) && registerForLanguageLevel(level),
" not support matrix multiplication operators",
PyPsiBundle.message("INSP.compatibility.feature.support.matrix.multiplication.operators"),
node);
}
@@ -220,7 +221,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
String suffix = node.getIntegerLiteralSuffix();
if ("l".equalsIgnoreCase(suffix)) {
registerForAllMatchingVersions(level -> level.isPy3K() && registerForLanguageLevel(level),
" not support a trailing '" + suffix + "'.",
PyPsiBundle.message("INSP.compatibility.feature.support.long.integer.literal.suffix", suffix),
node,
new RemoveTrailingSuffixQuickFix());
}
@@ -229,7 +230,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
final char secondChar = Character.toLowerCase(text.charAt(1));
if (secondChar != 'o' && secondChar != 'b' && secondChar != 'x' && text.chars().anyMatch(c -> c != '0')) {
registerForAllMatchingVersions(level -> level.isPy3K() && registerForLanguageLevel(level),
" not support this syntax. It requires '0o' prefix for octal literals",
PyPsiBundle.message("INSP.compatibility.feature.support.old.style.octal.literals"),
node,
new ReplaceOctalNumericLiteralQuickFix());
}
@@ -238,7 +239,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
if (text.contains("_")) {
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON36) && registerForLanguageLevel(level),
" not support underscores in numeric literals",
PyPsiBundle.message("INSP.compatibility.feature.support.underscores.in.numeric.literals"),
node,
new PyRemoveUnderscoresInNumericLiteralsQuickFix());
}
@@ -260,7 +261,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
final int elementStart = element.getTextOffset();
registerForAllMatchingVersions(level -> !getSupportedStringPrefixes(level).contains(prefix) && registerForLanguageLevel(level),
" not support a '" + prefix + "' prefix",
PyPsiBundle.message("INSP.compatibility.feature.support.string.literal.prefix", prefix),
node,
TextRange.create(elementStart, elementStart + element.getPrefixLength()),
new RemovePrefixQuickFix(prefix),
@@ -269,7 +270,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
if (seenBytes && seenNonBytes) {
registerForAllMatchingVersions(level -> level.isPy3K() && registerForLanguageLevel(level),
" not allow to mix bytes and non-bytes literals",
PyPsiBundle.message("INSP.compatibility.feature.allow.to.mix.bytes.and.non.bytes.literals"),
node);
}
}
@@ -293,7 +294,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
registerForAllMatchingVersions(
level -> registerForLanguageLevel(level) && UnsupportedFeaturesUtil.visitPyListCompExpression(node, level),
" not support this syntax in list comprehensions.",
PyPsiBundle.message("INSP.compatibility.feature.support.this.syntax.in.list.comprehensions"),
ContainerUtil.map(node.getForComponents(), PyComprehensionForComponent::getIteratedList),
new ReplaceListComprehensionsQuickFix()
);
@@ -306,19 +307,19 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
// empty raise under finally
registerForAllMatchingVersions(
level -> registerForLanguageLevel(level) && UnsupportedFeaturesUtil.raiseHasNoArgsUnderFinally(node, level),
" not support this syntax. Raise with no arguments can only be used in an except block",
PyPsiBundle.message("INSP.compatibility.feature.support.raise.with.no.arguments.outside.except.block"),
node
);
// raise 1, 2, 3
registerForAllMatchingVersions(level -> registerForLanguageLevel(level) && UnsupportedFeaturesUtil.raiseHasMoreThenOneArg(node, level),
" not support this syntax.",
PyPsiBundle.message("INSP.compatibility.feature.support.this.syntax"),
node,
new ReplaceRaiseStatementQuickFix());
// raise exception from cause
registerForAllMatchingVersions(level -> registerForLanguageLevel(level) && UnsupportedFeaturesUtil.raiseHasFromKeyword(node, level),
" not support this syntax.",
PyPsiBundle.message("INSP.compatibility.feature.support.this.syntax"),
node,
new ReplaceRaiseStatementQuickFix());
}
@@ -328,7 +329,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
super.visitPyReprExpression(node);
registerForAllMatchingVersions(level -> level.isPy3K() && registerForLanguageLevel(level),
" not support backquotes, use repr() instead",
PyPsiBundle.message("INSP.compatibility.feature.support.backquotes"),
node,
new ReplaceBackquoteExpressionQuickFix());
}
@@ -341,7 +342,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
final PyWithItem[] items = node.getWithItems();
if (items.length > 1) {
registerForAllMatchingVersions(level -> !level.supportsSetLiterals() && registerForLanguageLevel(level),
" not support multiple context managers",
PyPsiBundle.message("INSP.compatibility.feature.support.multiple.context.managers"),
Arrays.asList(items).subList(1, items.length),
null);
}
@@ -365,8 +366,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
if (arguments.length == 0 || Arrays.stream(arguments).anyMatch(nonParenthesesPredicate)) {
registerForAllMatchingVersions(level -> level.isPy3K() && registerForLanguageLevel(level),
" not support this syntax. " +
"The print statement has been replaced with a print() function",
PyPsiBundle.message("INSP.compatibility.feature.support.print.statement"),
node,
new CompatibilityPrintCallQuickFix());
}
@@ -379,7 +379,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
final PsiElement firstChild = node.getFirstChild();
if (firstChild != null && PyNames.SUPER.equals(firstChild.getText()) && ArrayUtil.isEmpty(node.getArguments())) {
registerForAllMatchingVersions(level -> level.isPython2() && registerForLanguageLevel(level),
" not support this syntax. super() should have arguments in Python 2",
PyPsiBundle.message("INSP.compatibility.feature.support.super.without.arguments"),
node);
}
@@ -398,7 +398,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
if (node.getOperator() == PyTokenTypes.AWAIT_KEYWORD) {
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON35) && registerForLanguageLevel(level),
" not support this syntax",
PyPsiBundle.message("INSP.compatibility.feature.support.this.syntax"),
node);
}
}
@@ -416,7 +416,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
if (!node.isDelegating() &&
registerForLanguageLevel(LanguageLevel.PYTHON35) &&
myVersionsToProcess.contains(LanguageLevel.PYTHON35)) {
registerProblem(node, "Python version 3.5 does not support 'yield' inside async functions");
registerProblem(node, PyPsiBundle.message("INSP.compatibility.py35.does.not.support.yield.inside.async.functions"));
}
}
);
@@ -426,8 +426,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
}
registerForAllMatchingVersions(level -> level.isPython2() && registerForLanguageLevel(level),
" not support this syntax. Delegating to a subgenerator is available since " +
"Python 3.3; use explicit iteration over subgenerator instead.",
PyPsiBundle.message("INSP.compatibility.feature.support.yield.from"),
node);
}
@@ -439,7 +438,8 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
final YieldVisitor visitor = new YieldVisitor();
function.acceptChildren(visitor);
if (visitor.haveYield()) {
registerProblem(node, "Python versions < 3.3 do not allow 'return' with argument inside generator.");
registerProblem(node,
PyPsiBundle.message("INSP.compatibility.pre35.versions.do.not.allow.return.with.argument.inside.generator"));
}
}
}
@@ -457,7 +457,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
return;
}
registerForAllMatchingVersions(level -> level.isPython2() && registerForLanguageLevel(level),
" not support '...' outside of sequence slicings.",
PyPsiBundle.message("INSP.compatibility.feature.support.ellipsis.outside.slices"),
node);
}
}
@@ -478,7 +478,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
final ASTNode asyncNode = node.getNode().findChildByType(PyTokenTypes.ASYNC_KEYWORD);
if (asyncNode != null) {
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON35) && registerForLanguageLevel(level),
" not support this syntax",
PyPsiBundle.message("INSP.compatibility.feature.support.this.syntax"),
node,
asyncNode.getTextRange(),
null,
@@ -517,15 +517,17 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
protected abstract void registerProblem(@NotNull PsiElement node,
@NotNull TextRange range,
@NotNull String message,
@NotNull @InspectionMessage String message,
@Nullable LocalQuickFix localQuickFix,
boolean asError);
protected void registerProblem(@NotNull PsiElement node, @NotNull String message, @Nullable LocalQuickFix localQuickFix) {
protected void registerProblem(@NotNull PsiElement node,
@NotNull @InspectionMessage String message,
@Nullable LocalQuickFix localQuickFix) {
registerProblem(node, node.getTextRange(), message, localQuickFix, true);
}
protected void registerProblem(@NotNull PsiElement node, @NotNull String message) {
protected void registerProblem(@NotNull PsiElement node, @NotNull @InspectionMessage String message) {
registerProblem(node, message, null);
}
@@ -534,7 +536,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
}
protected void registerForAllMatchingVersions(@NotNull Predicate<LanguageLevel> levelPredicate,
@NotNull String suffix,
@NotNull @Nls String suffix,
@NotNull Iterable<Pair<? extends PsiElement, TextRange>> nodesWithRanges,
@Nullable LocalQuickFix localQuickFix,
boolean asError) {
@@ -545,15 +547,17 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
.collect(Collectors.toList());
if (!levels.isEmpty()) {
final String result = COMMON_MESSAGE + StringUtil.join(levels, ", ") + (levels.size() == 1 ? " does" : " do") + suffix;
@NlsSafe String versions = StringUtil.join(levels, ", ");
@InspectionMessage String message = PyPsiBundle.message("INSP.compatibility.inspection.unsupported.feature.prefix",
levels.size(), versions, suffix);
for (Pair<? extends PsiElement, TextRange> nodeWithRange : nodesWithRanges) {
registerProblem(nodeWithRange.first, nodeWithRange.second, result, localQuickFix, asError);
registerProblem(nodeWithRange.first, nodeWithRange.second, message, localQuickFix, asError);
}
}
}
protected void registerForAllMatchingVersions(@NotNull Predicate<LanguageLevel> levelPredicate,
@NotNull String suffix,
@NotNull @Nls String suffix,
@NotNull Iterable<? extends PsiElement> nodes,
@Nullable LocalQuickFix localQuickFix) {
final List<Pair<? extends PsiElement, TextRange>> nodesWithRanges =
@@ -562,7 +566,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
}
protected void registerForAllMatchingVersions(@NotNull Predicate<LanguageLevel> levelPredicate,
@NotNull String suffix,
@NotNull @Nls String suffix,
@NotNull PsiElement node,
@NotNull TextRange range,
@Nullable LocalQuickFix localQuickFix,
@@ -572,7 +576,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
}
protected void registerForAllMatchingVersions(@NotNull Predicate<LanguageLevel> levelPredicate,
@NotNull String suffix,
@NotNull @Nls String suffix,
@NotNull PsiElement node,
@Nullable LocalQuickFix localQuickFix,
boolean asError) {
@@ -580,14 +584,14 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
}
protected void registerForAllMatchingVersions(@NotNull Predicate<LanguageLevel> levelPredicate,
@NotNull String suffix,
@NotNull @Nls String suffix,
@NotNull PsiElement node,
@Nullable LocalQuickFix localQuickFix) {
registerForAllMatchingVersions(levelPredicate, suffix, node, localQuickFix, true);
}
protected void registerForAllMatchingVersions(@NotNull Predicate<LanguageLevel> levelPredicate,
@NotNull String suffix,
@NotNull @Nls String suffix,
@NotNull PsiElement node) {
registerForAllMatchingVersions(levelPredicate, suffix, node, null, true);
}
@@ -595,7 +599,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
@Override
public void visitPyNonlocalStatement(final PyNonlocalStatement node) {
registerForAllMatchingVersions(level -> level.isPython2() && registerForLanguageLevel(level),
" not have nonlocal keyword",
PyPsiBundle.message("INSP.compatibility.feature.have.nonlocal.keyword"),
node);
}
@@ -611,11 +615,11 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
final String keyword = ((PyKeywordArgument)argument).getKeyword();
if (keywordArgumentNames.contains(keyword)) {
registerProblem(argument, "Keyword argument repeated", new PyRemoveArgumentQuickFix());
registerProblem(argument, PyPsiBundle.message("INSP.compatibility.keyword.argument.repeated"), new PyRemoveArgumentQuickFix());
}
else if (seenKeywordContainer) {
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON35) && registerForLanguageLevel(level),
" not allow keyword arguments after **expression",
PyPsiBundle.message("INSP.compatibility.feature.allow.keyword.arguments.after.kwargs"),
argument,
new PyRemoveArgumentQuickFix());
}
@@ -628,7 +632,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
if (starArgument.isKeyword()) {
if (seenKeywordContainer) {
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON35) && registerForLanguageLevel(level),
" not allow duplicate **expressions",
PyPsiBundle.message("INSP.compatibility.feature.allow.duplicate.kwargs"),
argument,
new PyRemoveArgumentQuickFix());
}
@@ -637,7 +641,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
else {
if (seenPositionalContainer) {
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON35) && registerForLanguageLevel(level),
" not allow duplicate *expressions",
PyPsiBundle.message("INSP.compatibility.feature.allow.duplicate.positional.varargs"),
argument,
new PyRemoveArgumentQuickFix());
}
@@ -646,16 +650,16 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
}
else {
if (seenKeywordArgument) {
registerProblem(argument, "Positional argument after keyword argument", new PyRemoveArgumentQuickFix());
registerProblem(argument, PyPsiBundle.message("INSP.compatibility.positional.argument.after.keyword.argument"), new PyRemoveArgumentQuickFix());
}
else if (seenPositionalContainer) {
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON35) && registerForLanguageLevel(level),
" not allow positional arguments after *expression",
PyPsiBundle.message("INSP.compatibility.feature.allow.positional.arguments.after.expression"),
argument,
new PyRemoveArgumentQuickFix());
}
else if (seenKeywordContainer) {
registerProblem(argument, "Positional argument after **expression", new PyRemoveArgumentQuickFix());
registerProblem(argument, PyPsiBundle.message("INSP.compatibility.positional.argument.after.kwargs"), new PyRemoveArgumentQuickFix());
}
}
}
@@ -666,9 +670,15 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
PsiElement sibling = PyPsiUtils.getNextNonWhitespaceSibling(lastArg);
if (sibling != null && sibling.getNode().getElementType() == PyTokenTypes.COMMA) {
boolean isKeyword = ((PyStarArgument)lastArg).isKeyword();
String message;
if (isKeyword) {
message = PyPsiBundle.message("INSP.compatibility.feature.allow.trailing.comma.after.kwargs");
}
else {
message = PyPsiBundle.message("INSP.compatibility.feature.allow.trailing.comma.after.positional.vararg");
}
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON35) && registerForLanguageLevel(level),
" not allow a trailing comma after "
+ (isKeyword ? "**" : "*") + "expression",
message,
sibling);
}
}
@@ -684,7 +694,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
.filter(Objects::nonNull)
.map(ASTNode::getPsi)
.forEach(element -> registerProblem(element,
"Python version 3.5 does not support 'async' inside comprehensions and generator expressions"));
PyPsiBundle.message("INSP.compatibility.py35.does.not.support.async.inside.comprehensions.and.generator.expressions")));
final Stream<PyPrefixExpression> resultPrefixExpressions = PsiTreeUtil
.collectElementsOfType(node.getResultExpression(), PyPrefixExpression.class)
@@ -700,7 +710,8 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
.map(expression -> expression.getNode().findChildByType(PyTokenTypes.AWAIT_KEYWORD))
.filter(Objects::nonNull)
.map(ASTNode::getPsi)
.forEach(element -> registerProblem(element, "Python version 3.5 does not support 'await' inside comprehensions"));
.forEach(element -> registerProblem(element,
PyPsiBundle.message("INSP.compatibility.py35.does.not.support.await.inside.comprehensions")));
}
}
@@ -709,7 +720,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
super.visitPySlashParameter(node);
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON38) && registerForLanguageLevel(level),
" not support positional-only parameters",
PyPsiBundle.message("INSP.compatibility.feature.support.positional.only.parameters"),
node);
}
@@ -720,7 +731,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
final ASTNode equalitySignInFStringFragment = node.getNode().findChildByType(PyTokenTypes.EQ);
if (equalitySignInFStringFragment != null) {
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON38) && registerForLanguageLevel(level),
" not support equality signs in f-strings", equalitySignInFStringFragment.getPsi());
PyPsiBundle.message("INSP.compatibility.support.equality.signs.in.fstrings"), equalitySignInFStringFragment.getPsi());
}
}
@@ -728,7 +739,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
public void visitPyAssignmentExpression(PyAssignmentExpression node) {
super.visitPyAssignmentExpression(node);
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON38) && registerForLanguageLevel(level),
" not support assignment expressions", node);
PyPsiBundle.message("INSP.compatibility.feature.support.assignment.expressions"), node);
}
@Override
@@ -737,7 +748,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
if (PsiTreeUtil.getParentOfType(node, PyFinallyPart.class, false, PyLoopStatement.class) != null) {
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON38) && registerForLanguageLevel(level),
" not support 'continue' inside 'finally' clause",
PyPsiBundle.message("INSP.compatibility.feature.support.continue.inside.finally.clause"),
node);
}
}
@@ -747,7 +758,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
super.visitPyDecorator(decorator);
if (PsiTreeUtil.getChildOfType(decorator, PsiErrorElement.class) == null && decorator.getQualifiedName() == null) {
registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON39) && registerForLanguageLevel(level),
" not support arbitrary expressions as a decorator", decorator);
PyPsiBundle.message("INSP.compatibility.feature.support.arbitrary.expressions.as.decorator"), decorator);
}
}
}
@@ -1 +1 @@
<error descr="Python version 3.5 does not support a trailing 'L'."><error descr="Python version 3.5 does not support this syntax. It requires '0o' prefix for octal literals">01234L</error></error>
<error descr="Python version 3.5 does not support a trailing 'L'"><error descr="Python version 3.5 does not support this syntax. It requires '0o' prefix for octal literals">01234L</error></error>
@@ -1,6 +1,6 @@
print(<error descr="Python version 3.4 does not support <>, use != instead.">a <> 3</error>)
print(<error descr="Python version 3.4 does not support <>, use != instead">a <> 3</error>)
<error descr="Python version 3.4 does not support backquotes, use repr() instead">`foo()`</error>
a = <error descr="Python version 3.4 does not support a trailing 'l'.">123l</error>
a = <error descr="Python version 3.4 does not support a trailing 'l'">123l</error>
a = <error descr="Python version 3.4 does not support this syntax. It requires '0o' prefix for octal literals">043</error>
a = 0X43
a = 0X43
@@ -11,15 +11,15 @@ a = 0B1
a = 0b1
a = 0.0
s = u"text"
<error descr="Python version 3.4 does not support this syntax.">raise a, b, c</error>
<error descr="Python version 3.4 does not support this syntax.">raise a, b</error>
<error descr="Python version 3.4 does not support this syntax">raise a, b, c</error>
<error descr="Python version 3.4 does not support this syntax">raise a, b</error>
try:
pass
<error descr="Python version 3.4 does not support this syntax.">except a, name:
<error descr="Python version 3.4 does not support this syntax">except a, name:
pass</error>
[x * 2 for x in <error descr="Python version 3.4 does not support this syntax in list comprehensions.">vec1, vec2</error>]
[x * 2 for x in <error descr="Python version 3.4 does not support this syntax in list comprehensions">vec1, vec2</error>]
<error descr="Python version 3.4 does not have module __builtin__">import __builtin__</error>
@@ -1,2 +1,2 @@
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax. The print statement has been replaced with a print() function">print 'foo'</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax. The print statement has been replaced with a print() function">print 'bar'</warning>
<warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax. The print statement has been replaced with a print() function">print 'foo'</warning>
<warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax. The print statement has been replaced with a print() function">print 'bar'</warning>
@@ -4,14 +4,14 @@ def foo(*args, **kwargs):
foo(0,
*[1],
<warning descr="Python version 2.6, 2.7, 3.4 do not allow positional arguments after *expression">2</warning>,
<warning descr="Python version 2.6, 2.7, 3.4 do not allow duplicate *expressions">*[3]</warning>,
<warning descr="Python version 2.6, 2.7, 3.4 do not allow positional arguments after *expression">4</warning>,
<warning descr="Python versions 2.6, 2.7, 3.4 do not allow positional arguments after *expression">2</warning>,
<warning descr="Python versions 2.6, 2.7, 3.4 do not allow duplicate *expressions">*[3]</warning>,
<warning descr="Python versions 2.6, 2.7, 3.4 do not allow positional arguments after *expression">4</warning>,
a='a',
<warning descr="Python version 2.6, 2.7, 3.4 do not allow duplicate *expressions">*[6]</warning>,
<warning descr="Python versions 2.6, 2.7, 3.4 do not allow duplicate *expressions">*[6]</warning>,
b='b',
<warning descr="Python version 2.6, 2.7, 3.4 do not allow duplicate *expressions">*[7]</warning>,
<warning descr="Python versions 2.6, 2.7, 3.4 do not allow duplicate *expressions">*[7]</warning>,
c='c',
**{'d': 'd'},
<warning descr="Python version 2.6, 2.7, 3.4 do not allow keyword arguments after **expression">e='e'</warning>,
<warning descr="Python version 2.6, 2.7, 3.4 do not allow duplicate **expressions">**{'f': 'f'}</warning>)
<warning descr="Python versions 2.6, 2.7, 3.4 do not allow keyword arguments after **expression">e='e'</warning>,
<warning descr="Python versions 2.6, 2.7, 3.4 do not allow duplicate **expressions">**{'f': 'f'}</warning>)
@@ -1,13 +1,13 @@
# Handle a matched regex
if (<warning descr="Python version 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support assignment expressions">match := pattern.search(data)</warning>) is not None:
if (<warning descr="Python versions 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support assignment expressions">match := pattern.search(data)</warning>) is not None:
pass
# A loop that can't be trivially rewritten using 2-arg iter()
while <warning descr="Python version 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support assignment expressions">chunk := file.read(8192)</warning>:
while <warning descr="Python versions 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support assignment expressions">chunk := file.read(8192)</warning>:
pass
# Reuse a value that's expensive to compute
[<warning descr="Python version 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support assignment expressions">y := f(x)</warning>, y**2, y**3]
[<warning descr="Python versions 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support assignment expressions">y := f(x)</warning>, y**2, y**3]
# Share a subexpression between a comprehension filter clause and its output
filtered_data = [y for x in data if (<warning descr="Python version 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support assignment expressions">y := f(x)</warning>) is not None]
filtered_data = [y for x in data if (<warning descr="Python versions 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support assignment expressions">y := f(x)</warning>) is not None]
@@ -1,7 +1,7 @@
<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax">async</warning> def foo(x):
<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax">async</warning> with x:
y = <warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax">await x</warning>
if <warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax">await y</warning>:
return <warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax">await z</warning>
<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax">async</warning> for y in x:
<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax">async</warning> def foo(x):
<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax">async</warning> with x:
y = <warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax">await x</warning>
if <warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax">await y</warning>:
return <warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax">await z</warning>
<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax">async</warning> for y in x:
pass
@@ -1,6 +1,6 @@
<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax">async</warning> def asyncgen():
<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax">async</warning> def asyncgen():
<warning descr="Python version 3.5 does not support 'yield' inside async functions">yield 10</warning>
<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax">async</warning> def run():
<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax">async</warning> def run():
<warning descr="Python version 2.6 does not support set comprehensions">{i <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for i in asyncgen()}</warning>
[i <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for i in asyncgen()]
<warning descr="Python version 2.6 does not support dictionary comprehensions">{i: i ** 2 <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for i in asyncgen()}</warning>
@@ -1,16 +1,16 @@
<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax">async</warning> def async2():
[<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> for fun in funcs]
<warning descr="Python version 2.6 does not support set comprehensions">{<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> for fun in funcs}</warning>
<warning descr="Python version 2.6 does not support dictionary comprehensions">{fun: <warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> for fun in funcs}</warning>
<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax">async</warning> def async2():
[<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> for fun in funcs]
<warning descr="Python version 2.6 does not support set comprehensions">{<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> for fun in funcs}</warning>
<warning descr="Python version 2.6 does not support dictionary comprehensions">{fun: <warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> for fun in funcs}</warning>
[<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> for fun in funcs if <warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> smth</warning>]
<warning descr="Python version 2.6 does not support set comprehensions">{<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> for fun in funcs if <warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> smth</warning>}</warning>
<warning descr="Python version 2.6 does not support dictionary comprehensions">{fun: <warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> for fun in funcs if <warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> smth</warning>}</warning>
[<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> for fun in funcs if <warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> smth</warning>]
<warning descr="Python version 2.6 does not support set comprehensions">{<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> for fun in funcs if <warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> smth</warning>}</warning>
<warning descr="Python version 2.6 does not support dictionary comprehensions">{fun: <warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> for fun in funcs if <warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> smth</warning>}</warning>
[<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for fun in funcs]
<warning descr="Python version 2.6 does not support set comprehensions">{<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for fun in funcs}</warning>
<warning descr="Python version 2.6 does not support dictionary comprehensions">{fun: <warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for fun in funcs}</warning>
[<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for fun in funcs]
<warning descr="Python version 2.6 does not support set comprehensions">{<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for fun in funcs}</warning>
<warning descr="Python version 2.6 does not support dictionary comprehensions">{fun: <warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for fun in funcs}</warning>
[<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for fun in funcs if <warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> smth</warning>]
<warning descr="Python version 2.6 does not support set comprehensions">{<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for fun in funcs if <warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> smth</warning>}</warning>
<warning descr="Python version 2.6 does not support dictionary comprehensions">{fun: <warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for fun in funcs if <warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> smth</warning>}</warning>
[<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for fun in funcs if <warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> smth</warning>]
<warning descr="Python version 2.6 does not support set comprehensions">{<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for fun in funcs if <warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> smth</warning>}</warning>
<warning descr="Python version 2.6 does not support dictionary comprehensions">{fun: <warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> fun()</warning> <warning descr="Python version 3.5 does not support 'async' inside comprehensions and generator expressions">async</warning> for fun in funcs if <warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax"><warning descr="Python version 3.5 does not support 'await' inside comprehensions">await</warning> smth</warning>}</warning>
@@ -1,4 +1,4 @@
print(<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support <>, use != instead.">a <> b</warning>)
print(<warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support <>, use != instead">a <> b</warning>)
if <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support <>, use != instead.">a <> 2</warning>:
if <warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support <>, use != instead">a <> 2</warning>:
var = a
@@ -1 +1 @@
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have type long. Use int instead.">long("abc")</warning>
<warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have type long. Use int instead.">long("abc")</warning>
@@ -1,8 +1,8 @@
class A(B):
def __init__(self):
<warning descr="Python version 2.6, 2.7 do not support this syntax. super() should have arguments in Python 2">super()</warning>
<warning descr="Python versions 2.6, 2.7 do not support this syntax. super() should have arguments in Python 2">super()</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have method cmp">cmp()</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have method reduce">reduce()</warning>
<warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have method cmp">cmp()</warning>
<warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have method reduce">reduce()</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have method buffer">buffer()</warning>
<warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have method buffer">buffer()</warning>
@@ -1,2 +1,2 @@
xs = {1: 2}
ys = {<warning descr="Python version 2.6, 2.7, 3.4 do not support starred expressions in dicts">**xs</warning>, 3: 4}
ys = {<warning descr="Python versions 2.6, 2.7, 3.4 do not support starred expressions in dicts">**xs</warning>, 3: 4}
@@ -1,2 +1,2 @@
def foo():
<warning descr="Python version 2.6, 2.7 do not support '...' outside of sequence slicings.">...</warning>
<warning descr="Python versions 2.6, 2.7 do not support '...' outside of sequence slicings">...</warning>
@@ -1,3 +1,3 @@
import math
print(<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support a 'F' prefix">f</warning>'{math.pi <warning descr="Python version 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support equality signs in f-strings">=</warning>:.2f}')
print(<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support a 'F' prefix">f</warning>'{<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support a 'F' prefix">f</warning>"{3.1415<warning descr="Python version 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support equality signs in f-strings">=</warning>:.1f}":*^20}')
print(<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support a 'F' prefix">f</warning>'{math.pi <warning descr="Python versions 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support equality signs in f-strings">=</warning>:.2f}')
print(<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support a 'F' prefix">f</warning>'{<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support a 'F' prefix">f</warning>"{3.1415<warning descr="Python versions 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support equality signs in f-strings">=</warning>:.1f}":*^20}')
@@ -1,4 +1,4 @@
try:
do_smth()
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax.">except ImportError, ImportWarning:
<warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax">except ImportError, ImportWarning:
do()</warning>
@@ -1,9 +1,9 @@
<warning descr="Python version 2.6, 2.7, 3.4, 3.5, 3.6, 3.7, 3.8 do not support arbitrary expressions as a decorator">@x[0][1]</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5, 3.6, 3.7, 3.8 do not support arbitrary expressions as a decorator">@x[0][1]</warning>
@my_decorator
def say_whee():
print("Whee!")
<warning descr="Python version 2.6, 2.7, 3.4, 3.5, 3.6, 3.7, 3.8 do not support arbitrary expressions as a decorator">@foo[0].wrapper</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5, 3.6, 3.7, 3.8 do not support arbitrary expressions as a decorator">@foo[0].wrapper</warning>
@foo.bar()
def say_whee():
print("Whee!")
@@ -1 +1 @@
from <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have module Bastion">Bastion</warning> import BastionClass
from <warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have module Bastion">Bastion</warning> import BastionClass
@@ -1,4 +1,4 @@
import <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have module Bastion">Bastion</warning>
import <warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have module Bastion">Bastion</warning>
from <warning descr="Python version 2.6, 2.7 do not have module asyncio">asyncio</warning> import Queue
from <warning descr="Python versions 2.6, 2.7 do not have module asyncio">asyncio</warning> import Queue
from io import StringIO
@@ -1,3 +1,3 @@
<error descr="Python version 2.7 does not have module builtins"><warning descr="Python version 2.6 does not have module builtins">import builtins</warning></error>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have module __builtin__">import __builtin__</warning>
<warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not have module __builtin__">import __builtin__</warning>
@@ -1 +1 @@
var = [x for x in <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax in list comprehensions.">1, 2, 3</warning>]
var = [x for x in <warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax in list comprehensions">1, 2, 3</warning>]
@@ -1,2 +1,2 @@
x <warning descr="Python version 2.6, 2.7, 3.4 do not support matrix multiplication operators">@</warning> y
x <warning descr="Python version 2.6, 2.7, 3.4 do not support matrix multiplication operators">@=</warning> y
x <warning descr="Python versions 2.6, 2.7, 3.4 do not support matrix multiplication operators">@</warning> y
x <warning descr="Python versions 2.6, 2.7, 3.4 do not support matrix multiplication operators">@=</warning> y
@@ -1,8 +1,8 @@
a = <error descr="Python does not support a trailing 'u'">12u</error>
b = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a trailing 'l'.">12l</warning>
b = <warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a trailing 'l'">12l</warning>
c = <error descr="Python does not support a trailing 'll'">12ll</error>
d = <error descr="Python does not support a trailing 'U'">12U</error>
e = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a trailing 'L'.">12L</warning>
e = <warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a trailing 'L'">12L</warning>
f = <error descr="Python does not support a trailing 'LL'">12LL</error>
g = <error descr="Python does not support a trailing 'ul'">0x12ful</error>
h = <error descr="Python does not support a trailing 'uL'">0X12fuL</error>
@@ -20,4 +20,4 @@ s = <error descr="Python does not support a trailing 'llu'">12llu</error>
t = <error descr="Python does not support a trailing 'llU'">12llU</error>
u = <error descr="Python does not support a trailing 'LLu'">12LLu</error>
v = <error descr="Python does not support a trailing 'LLU'">12LLU</error>
w = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax. It requires '0o' prefix for octal literals">04</warning><error descr="End of statement expected">8</error>
w = <warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax. It requires '0o' prefix for octal literals">04</warning><error descr="End of statement expected">8</error>
@@ -1 +1 @@
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax. The print statement has been replaced with a print() function">print "One value"</warning>
<warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax. The print statement has been replaced with a print() function">print "One value"</warning>
@@ -1,2 +1,2 @@
<warning descr="Python version 2.6, 2.7 do not support this syntax.">raise exception from cause</warning>
<warning descr="Python versions 2.6, 2.7 do not support this syntax">raise exception from cause</warning>
a = 1
@@ -1,4 +1,4 @@
try:
a
except :
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax.">raise ImportError, ImportWarning</warning>
<warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax">raise ImportError, ImportWarning</warning>
@@ -1 +1 @@
a = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support backquotes, use repr() instead">`imp.acquire_lock()`</warning>
a = <warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support backquotes, use repr() instead">`imp.acquire_lock()`</warning>
@@ -1,2 +1,2 @@
t = (1, <warning descr="Python version 2.6, 2.7, 3.4 do not support starred expressions in tuples, lists, and sets">*(2, 3)</warning>)
a, <warning descr="Python version 2.6, 2.7 do not support starred expressions as assignment targets">*b</warning>, c = t
t = (1, <warning descr="Python versions 2.6, 2.7, 3.4 do not support starred expressions in tuples, lists, and sets">*(2, 3)</warning>)
a, <warning descr="Python versions 2.6, 2.7 do not support starred expressions as assignment targets">*b</warning>, c = t
@@ -2,15 +2,15 @@ a = u"String"
# Python 3.6
a = <error descr="Python version 2.7 does not support a 'F' prefix"><warning descr="Python version 2.6, 3.4, 3.5 do not support a 'F' prefix">f</warning></error>""
a = <error descr="Python version 2.7 does not support a 'F' prefix"><warning descr="Python version 2.6, 3.4, 3.5 do not support a 'F' prefix">F</warning></error>""
a = <error descr="Python version 2.7 does not support a 'RF' prefix"><warning descr="Python version 2.6, 3.4, 3.5 do not support a 'RF' prefix">rf</warning></error>""
a = <error descr="Python version 2.7 does not support a 'FR' prefix"><warning descr="Python version 2.6, 3.4, 3.5 do not support a 'FR' prefix">fr</warning></error>""
a = <error descr="Python version 2.7 does not support a 'FU' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'FU' prefix">fu</warning></error>""
a = <error descr="Python version 2.7 does not support a 'UF' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'UF' prefix">uf</warning></error>""
a = <error descr="Python version 2.7 does not support a 'BF' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'BF' prefix">bf</warning></error>""
a = <error descr="Python version 2.7 does not support a 'FB' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'FB' prefix">fb</warning></error>""
a = <error descr="Python version 2.7 does not support a 'UFR' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'UFR' prefix">ufr</warning></error>""
a = <error descr="Python version 2.7 does not support a 'F' prefix"><warning descr="Python versions 2.6, 3.4, 3.5 do not support a 'F' prefix">f</warning></error>""
a = <error descr="Python version 2.7 does not support a 'F' prefix"><warning descr="Python versions 2.6, 3.4, 3.5 do not support a 'F' prefix">F</warning></error>""
a = <error descr="Python version 2.7 does not support a 'RF' prefix"><warning descr="Python versions 2.6, 3.4, 3.5 do not support a 'RF' prefix">rf</warning></error>""
a = <error descr="Python version 2.7 does not support a 'FR' prefix"><warning descr="Python versions 2.6, 3.4, 3.5 do not support a 'FR' prefix">fr</warning></error>""
a = <error descr="Python version 2.7 does not support a 'FU' prefix"><warning descr="Python versions 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'FU' prefix">fu</warning></error>""
a = <error descr="Python version 2.7 does not support a 'UF' prefix"><warning descr="Python versions 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'UF' prefix">uf</warning></error>""
a = <error descr="Python version 2.7 does not support a 'BF' prefix"><warning descr="Python versions 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'BF' prefix">bf</warning></error>""
a = <error descr="Python version 2.7 does not support a 'FB' prefix"><warning descr="Python versions 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'FB' prefix">fb</warning></error>""
a = <error descr="Python version 2.7 does not support a 'UFR' prefix"><warning descr="Python versions 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'UFR' prefix">ufr</warning></error>""
# python 3.3
@@ -35,7 +35,7 @@ a = b""
a = u""
a = r""
a = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'UR' prefix">ur</warning>""
a = <warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'UR' prefix">ur</warning>""
a = b""
a = br""
@@ -43,14 +43,14 @@ a = br""
a = u""
a = r""
a = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'UR' prefix">ur</warning>""
a = <warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'UR' prefix">ur</warning>""
# combined, PY-32321
b = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not allow to mix bytes and non-bytes literals">u"" b""</warning>
b = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not allow to mix bytes and non-bytes literals">r"" b""</warning>
b = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not allow to mix bytes and non-bytes literals"><error descr="Python version 2.7 does not support a 'F' prefix"><warning descr="Python version 2.6, 3.4, 3.5 do not support a 'F' prefix">f</warning></error>"" b""</warning>
b = <warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not allow to mix bytes and non-bytes literals">u"" b""</warning>
b = <warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not allow to mix bytes and non-bytes literals">r"" b""</warning>
b = <warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not allow to mix bytes and non-bytes literals"><error descr="Python version 2.7 does not support a 'F' prefix"><warning descr="Python versions 2.6, 3.4, 3.5 do not support a 'F' prefix">f</warning></error>"" b""</warning>
# never was available
a = <error descr="Python version 2.7 does not support a 'RR' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'RR' prefix">rr</warning></error>""
a = <error descr="Python version 2.7 does not support a 'BB' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'BB' prefix">bb</warning></error>""
a = <error descr="Python version 2.7 does not support a 'UU' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'UU' prefix">uu</warning></error>""
a = <error descr="Python version 2.7 does not support a 'RR' prefix"><warning descr="Python versions 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'RR' prefix">rr</warning></error>""
a = <error descr="Python version 2.7 does not support a 'BB' prefix"><warning descr="Python versions 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'BB' prefix">bb</warning></error>""
a = <error descr="Python version 2.7 does not support a 'UU' prefix"><warning descr="Python versions 2.6, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support a 'UU' prefix">uu</warning></error>""
@@ -2,5 +2,5 @@ def foo(*args, **kwargs):
print(args, kwargs)
foo(1, 2, 3, *[3]<error descr="Python version 3.4 does not allow a trailing comma after *expression"><warning descr="Python version 2.6, 2.7 do not allow a trailing comma after *expression">,</warning></error>)
foo(1, 2, 3, *[3], **{'d': 'd'}<error descr="Python version 3.4 does not allow a trailing comma after **expression"><warning descr="Python version 2.6, 2.7 do not allow a trailing comma after **expression">,</warning></error>)
foo(1, 2, 3, *[3]<error descr="Python version 3.4 does not allow a trailing comma after *expression"><warning descr="Python versions 2.6, 2.7 do not allow a trailing comma after *expression">,</warning></error>)
foo(1, 2, 3, *[3], **{'d': 'd'}<error descr="Python version 3.4 does not allow a trailing comma after **expression"><warning descr="Python versions 2.6, 2.7 do not allow a trailing comma after **expression">,</warning></error>)
@@ -1,4 +1,4 @@
try:
raise ValueError
finally:
<warning descr="Python version 2.6, 2.7 do not support this syntax. Raise with no arguments can only be used in an except block">raise</warning>
<warning descr="Python versions 2.6, 2.7 do not support this syntax. Raise with no arguments can only be used in an except block">raise</warning>
@@ -1 +1 @@
import <warning descr="Python version 2.6, 2.7 do not have module _bz2">_bz2</warning>
import <warning descr="Python versions 2.6, 2.7 do not have module _bz2">_bz2</warning>
@@ -1,58 +1,58 @@
# hex
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">0xCAFE_F00D</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">0xCAFE_F00D</warning>
# oct
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">0o1_23</warning>
<error descr="Python version 3.6 does not support this syntax. It requires '0o' prefix for octal literals"><warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals"><warning descr="Python version 3.4, 3.5, 3.7, 3.8, 3.9 do not support this syntax. It requires '0o' prefix for octal literals">01_23</warning></warning></error>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">0o1_23</warning>
<error descr="Python version 3.6 does not support this syntax. It requires '0o' prefix for octal literals"><warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals"><warning descr="Python versions 3.4, 3.5, 3.7, 3.8, 3.9 do not support this syntax. It requires '0o' prefix for octal literals">01_23</warning></warning></error>
# bin
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">0b_0011_1111_0100_1110</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">0b_0011_1111_0100_1110</warning>
# dec
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_000_000</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_000_000</warning>
# pointfloat
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.</warning>
# exponentfloat
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23e1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23E1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.e1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.E1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23e1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23E1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.e1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.E1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23e+1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23E+1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.e+1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.E+1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23e+1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23E+1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.e+1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.E+1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23e-1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23E-1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.e-1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.E-1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23e-1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23E-1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.e-1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.E-1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_0000_23e1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_0000_23E1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00e1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00E1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_0000_23e1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_0000_23E1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00e1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00E1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_0000_23e+1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_0000_23E+1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00e+1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00E+1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_0000_23e+1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_0000_23E+1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00e+1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00E+1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_0000_23e-1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_0000_23E-1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00e-1_2</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00E-1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_0000_23e-1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_0000_23E-1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00e-1_2</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00E-1_2</warning>
# imag
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23j</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23J</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23j</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23J</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23e1_2j</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23e1_2J</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23e1_2j</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_00.00_23e1_2J</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_000_000j</warning>
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_000_000J</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_000_000j</warning>
<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">10_000_000J</warning>
@@ -1,7 +1,7 @@
def gen(xs):
yield 42, <warning descr="Python version 2.6, 2.7, 3.4 do not support starred expressions in tuples, lists, and sets"><warning descr="Python version 3.5, 3.6, 3.7 do not support unpacking without parentheses in yield statements">*xs</warning></warning>
<warning descr="Python version 2.6, 2.7 do not support this syntax. Delegating to a subgenerator is available since Python 3.3; use explicit iteration over subgenerator instead.">yield from 42, <error descr="Can't use starred expression here"><warning descr="Python version 2.6, 2.7, 3.4 do not support starred expressions in tuples, lists, and sets">*xs</warning></error></warning>
yield 42, <warning descr="Python versions 2.6, 2.7, 3.4 do not support starred expressions in tuples, lists, and sets"><warning descr="Python versions 3.5, 3.6, 3.7 do not support unpacking without parentheses in yield statements">*xs</warning></warning>
<warning descr="Python versions 2.6, 2.7 do not support this syntax. Delegating to a subgenerator is available since Python 3.3; use explicit iteration over subgenerator instead.">yield from 42, <error descr="Can't use starred expression here"><warning descr="Python versions 2.6, 2.7, 3.4 do not support starred expressions in tuples, lists, and sets">*xs</warning></error></warning>
def func(xs):
return 42, <warning descr="Python version 2.6, 2.7, 3.4 do not support starred expressions in tuples, lists, and sets"><warning descr="Python version 3.5, 3.6, 3.7 do not support unpacking without parentheses in return statements">*xs</warning></warning>
return 42, <warning descr="Python versions 2.6, 2.7, 3.4 do not support starred expressions in tuples, lists, and sets"><warning descr="Python versions 3.5, 3.6, 3.7 do not support unpacking without parentheses in return statements">*xs</warning></warning>
@@ -1,8 +1,8 @@
class C:
x<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support variable annotations">: int</warning>
y<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support variable annotations">: None</warning> = 42
x<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support variable annotations">: int</warning>
y<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support variable annotations">: None</warning> = 42
def m(self, d):
x<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support variable annotations">: List[bool]</warning>
d['foo']<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support variable annotations">: str</warning>
(d['bar'])<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support variable annotations">: float</warning>
x<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support variable annotations">: List[bool]</warning>
d['foo']<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support variable annotations">: str</warning>
(d['bar'])<warning descr="Python versions 2.6, 2.7, 3.4, 3.5 do not support variable annotations">: float</warning>
@@ -1,14 +1,14 @@
class <warning descr="Python version 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">async</warning>(object):
class <warning descr="Python versions 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">async</warning>(object):
pass
class <warning descr="Python version 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">await</warning>(object):
class <warning descr="Python versions 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">await</warning>(object):
pass
def <warning descr="Python version 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">async</warning>():
def <warning descr="Python versions 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">async</warning>():
pass
def <warning descr="Python version 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">await</warning>():
def <warning descr="Python versions 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">await</warning>():
pass
<warning descr="Python version 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">async</warning> = 1
<warning descr="Python version 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">await</warning> = 2
<warning descr="Python versions 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">async</warning> = 1
<warning descr="Python versions 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">await</warning> = 2
@@ -1,5 +1,5 @@
<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax">async</warning> def foo(x):
<warning descr="Python version 2.6, 2.7, 3.4 do not support this syntax">await x</warning>
<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax">async</warning> def foo(x):
<warning descr="Python versions 2.6, 2.7, 3.4 do not support this syntax">await x</warning>
<warning descr="Python version 3.5 does not support 'yield' inside async functions">yield x</warning>
<error descr="Python does not support 'yield from' inside async functions"><warning descr="Python version 2.6, 2.7 do not support this syntax. Delegating to a subgenerator is available since Python 3.3; use explicit iteration over subgenerator instead.">yield from x</warning></error>
<error descr="Python does not support 'yield from' inside async functions"><warning descr="Python versions 2.6, 2.7 do not support this syntax. Delegating to a subgenerator is available since Python 3.3; use explicit iteration over subgenerator instead.">yield from x</warning></error>
<error descr="non-empty 'return' inside asynchronous generator"><warning descr="Python versions < 3.3 do not allow 'return' with argument inside generator.">return x</warning></error>
@@ -1 +1 @@
print(<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support <>, use != instead.">a<caret> <> b</warning>)
print(<warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support <>, use != instead">a<caret> <> b</warning>)
+1 -1
View File
@@ -1 +1 @@
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax. The print statement has been replaced with a print() function">print "foo"</warning>
<warning descr="Python versions 3.4, 3.5, 3.6, 3.7, 3.8, 3.9 do not support this syntax. The print statement has been replaced with a print() function">print "foo"</warning>
@@ -1 +1 @@
<error bundleMsg="bad-trail|l">1000l</error>
<error descr="Python version 3.9 does not support a trailing 'l'">1000l</error>
@@ -1,2 +1,2 @@
class <warning descr="Python version 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">a<caret>sync</warning>(object):
class <warning descr="Python versions 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">a<caret>sync</warning>(object):
pass
@@ -1,2 +1,2 @@
def <warning descr="Python version 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">a<caret>sync</warning>():
def <warning descr="Python versions 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">a<caret>sync</warning>():
pass
@@ -1 +1 @@
<warning descr="Python version 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">async</warning> = 1
<warning descr="Python versions 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">async</warning> = 1
@@ -1,2 +1,2 @@
class <warning descr="Python version 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">a<caret>wait</warning>(object):
class <warning descr="Python versions 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">a<caret>wait</warning>(object):
pass
@@ -1,2 +1,2 @@
def <warning descr="Python version 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">a<caret>wait</warning>():
def <warning descr="Python versions 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">a<caret>wait</warning>():
pass
@@ -1 +1 @@
<warning descr="Python version 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">await</warning> = 1
<warning descr="Python versions 3.7, 3.8, 3.9 do not allow 'async' and 'await' as names">await</warning> = 1
@@ -229,7 +229,7 @@ public class PyCompatibilityInspectionTest extends PyInspectionTestCase {
runWithLanguageLevel(
LanguageLevel.PYTHON38,
() -> doTestByText(
"def f(pos1, <warning descr=\"Python version 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support positional-only parameters\">/</warning>, pos_or_kwd, *, kwd1):\n" +
"def f(pos1, <warning descr=\"Python versions 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support positional-only parameters\">/</warning>, pos_or_kwd, *, kwd1):\n" +
" pass"
)
);
@@ -248,7 +248,7 @@ public class PyCompatibilityInspectionTest extends PyInspectionTestCase {
" try:\n" +
" print(\"a\")\n" +
" finally:\n" +
" <warning descr=\"Python version 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support 'continue' inside 'finally' clause\">continue</warning>")
" <warning descr=\"Python versions 2.6, 2.7, 3.4, 3.5, 3.6, 3.7 do not support 'continue' inside 'finally' clause\">continue</warning>")
);
}