diff --git a/python/helpers/pip-1.1.tar.gz b/python/helpers/pip-1.1.tar.gz deleted file mode 100644 index 57d1dc5942eb..000000000000 Binary files a/python/helpers/pip-1.1.tar.gz and /dev/null differ diff --git a/python/helpers/setuptools-1.4.2.tar.gz b/python/helpers/setuptools-1.4.2.tar.gz deleted file mode 100644 index d9598354ae30..000000000000 Binary files a/python/helpers/setuptools-1.4.2.tar.gz and /dev/null differ diff --git a/python/helpers/virtualenv-1.7.2.tar.gz b/python/helpers/virtualenv-1.7.2.tar.gz deleted file mode 100644 index 2af9ddadfdb9..000000000000 Binary files a/python/helpers/virtualenv-1.7.2.tar.gz and /dev/null differ diff --git a/python/psi-api/src/com/jetbrains/python/psi/LanguageLevel.java b/python/psi-api/src/com/jetbrains/python/psi/LanguageLevel.java index 05f06d070d03..b892b70e93f4 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/LanguageLevel.java +++ b/python/psi-api/src/com/jetbrains/python/psi/LanguageLevel.java @@ -36,6 +36,10 @@ public enum LanguageLevel { */ @Deprecated PYTHON24(24, false, true, false, false), + /** + * @deprecated This level will be removed in 2018.2. + */ + @Deprecated PYTHON25(25, false, true, false, false), PYTHON26(26, true, true, false, false), PYTHON27(27, true, true, true, false), @@ -53,7 +57,7 @@ public enum LanguageLevel { @Deprecated public static final List ALL_LEVELS = ImmutableList.copyOf(values()); - public static final List SUPPORTED_LEVELS = ImmutableList.copyOf(Stream.of(values()).filter(v -> v.myVersion >= 25).collect( + public static final List SUPPORTED_LEVELS = ImmutableList.copyOf(Stream.of(values()).filter(v -> v.myVersion >= 26).collect( Collectors.toList())); // Python versions 2.4 and 2.5 aren't supported anymore private static final LanguageLevel DEFAULT2 = PYTHON27; @@ -118,9 +122,6 @@ public enum LanguageLevel { public static LanguageLevel fromPythonVersion(@NotNull String pythonVersion) { if (pythonVersion.startsWith("2")) { - if (pythonVersion.startsWith("2.5")) { - return PYTHON25; - } if (pythonVersion.startsWith("2.6")) { return PYTHON26; } diff --git a/python/src/com/jetbrains/python/PyBundle.properties b/python/src/com/jetbrains/python/PyBundle.properties index 2d2e13c19008..e34197969e7e 100644 --- a/python/src/com/jetbrains/python/PyBundle.properties +++ b/python/src/com/jetbrains/python/PyBundle.properties @@ -87,8 +87,6 @@ QFIX.NAME.unresolved.reference.create.function=Create function ''{0}'' QFIX.introduce.variable=Introduce variable for statement -QFIX.unresolved.reference.add.future=Add 'from __future__ import with_statement'' - # RemoveUnnecessaryBackslashQuickFix QFIX.remove.unnecessary.backslash=Remove unnecessary backslash in expression diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java index 98a13d9180ce..891956607b97 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java @@ -242,12 +242,7 @@ public class ConvertFormatOperatorToMethodIntention extends PyBaseIntentionActio if (binaryExpression == null) { return false; } - final LanguageLevel languageLevel = LanguageLevel.forElement(binaryExpression); - if (languageLevel.isOlderThan(LanguageLevel.PYTHON26)) { - return false; - } - if (binaryExpression.getLeftExpression() instanceof PyStringLiteralExpression - && binaryExpression.getOperator() == PyTokenTypes.PERC) { + 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')) { return false; diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/PyConvertMethodToPropertyIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/PyConvertMethodToPropertyIntention.java index 516b2f30bd3e..38df1fe343b2 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/PyConvertMethodToPropertyIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/PyConvertMethodToPropertyIntention.java @@ -50,7 +50,6 @@ public class PyConvertMethodToPropertyIntention extends PyBaseIntentionAction { if (!(file instanceof PyFile)) { return false; } - if (!LanguageLevel.forElement(file).isAtLeast(LanguageLevel.PYTHON26)) return false; final PsiElement element = PyUtil.findNonWhitespaceAtOffset(file, editor.getCaretModel().getOffset()); final PyFunction function = PsiTreeUtil.getParentOfType(element, PyFunction.class); if (function == null) return false; diff --git a/python/src/com/jetbrains/python/inspections/PyCompatibilityInspection.java b/python/src/com/jetbrains/python/inspections/PyCompatibilityInspection.java index e747f8ed6fd2..f9b74c76dc81 100644 --- a/python/src/com/jetbrains/python/inspections/PyCompatibilityInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyCompatibilityInspection.java @@ -238,21 +238,6 @@ public class PyCompatibilityInspection extends PyInspection { } } - final PyFromImportStatement fromImportStatement = PsiTreeUtil.getParentOfType(importElement, PyFromImportStatement.class); - if (fromImportStatement != null) { - final QualifiedName qName = importElement.getImportedQName(); - final QualifiedName sourceQName = fromImportStatement.getImportSourceQName(); - - if (qName != null && sourceQName != null && qName.matches("unicode_literals") && sourceQName.matches("__future__")) { - registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON26), - " not have unicode_literals in __future__ module", - importElement, - null); - } - - return; - } - final QualifiedName qName = importElement.getImportedQName(); if (qName != null && !qName.matches("builtins") && !qName.matches("__builtin__")) { final String moduleName = qName.toString(); diff --git a/python/src/com/jetbrains/python/inspections/PyPropertyDefinitionInspection.java b/python/src/com/jetbrains/python/inspections/PyPropertyDefinitionInspection.java index 88bfa5755cfe..a17a53a7cff0 100644 --- a/python/src/com/jetbrains/python/inspections/PyPropertyDefinitionInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyPropertyDefinitionInspection.java @@ -185,34 +185,32 @@ public class PyPropertyDefinitionInspection extends PyInspection { @Override public void visitPyFunction(PyFunction node) { super.visitPyFunction(node); - if (myLevel.isAtLeast(LanguageLevel.PYTHON26)) { - // check @foo.setter and @foo.deleter - PyClass cls = node.getContainingClass(); - if (cls != null) { - final PyDecoratorList decos = node.getDecoratorList(); - if (decos != null) { - String name = node.getName(); - for (PyDecorator deco : decos.getDecorators()) { - final QualifiedName qName = deco.getQualifiedName(); - if (qName != null) { - List nameParts = qName.getComponents(); - if (nameParts.size() == 2) { - final int suffixIndex = SUFFIXES.indexOf(nameParts.get(1)); - if (suffixIndex >= 0) { - if (Comparing.equal(name, nameParts.get(0))) { - // names are ok, what about signatures? - PsiElement markable = getFunctionMarkingElement(node); - if (suffixIndex == 0) { - checkSetter(node, markable); - } - else { - checkDeleter(node, markable); - } + // check @foo.setter and @foo.deleter + PyClass cls = node.getContainingClass(); + if (cls != null) { + final PyDecoratorList decos = node.getDecoratorList(); + if (decos != null) { + String name = node.getName(); + for (PyDecorator deco : decos.getDecorators()) { + final QualifiedName qName = deco.getQualifiedName(); + if (qName != null) { + List nameParts = qName.getComponents(); + if (nameParts.size() == 2) { + final int suffixIndex = SUFFIXES.indexOf(nameParts.get(1)); + if (suffixIndex >= 0) { + if (Comparing.equal(name, nameParts.get(0))) { + // names are ok, what about signatures? + PsiElement markable = getFunctionMarkingElement(node); + if (suffixIndex == 0) { + checkSetter(node, markable); } else { - registerProblem(deco, PyBundle.message("INSP.func.property.name.mismatch")); + checkDeleter(node, markable); } } + else { + registerProblem(deco, PyBundle.message("INSP.func.property.name.mismatch")); + } } } } diff --git a/python/src/com/jetbrains/python/inspections/quickfix/UnresolvedRefAddFutureImportQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/UnresolvedRefAddFutureImportQuickFix.java deleted file mode 100644 index 50d076602c26..000000000000 --- a/python/src/com/jetbrains/python/inspections/quickfix/UnresolvedRefAddFutureImportQuickFix.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jetbrains.python.inspections.quickfix; - -import com.intellij.codeInspection.LocalQuickFix; -import com.intellij.codeInspection.ProblemDescriptor; -import com.intellij.openapi.project.Project; -import com.intellij.psi.PsiElement; -import com.jetbrains.python.PyBundle; -import com.jetbrains.python.psi.LanguageLevel; -import com.jetbrains.python.psi.PyElementGenerator; -import com.jetbrains.python.psi.PyFile; -import com.jetbrains.python.psi.PyFromImportStatement; -import org.jetbrains.annotations.NotNull; - -/** - * User: catherine - * - * QuickFix to add 'from __future__ import with_statement'' if python version is less than 2.6 - */ -public class UnresolvedRefAddFutureImportQuickFix implements LocalQuickFix { - @NotNull - public String getFamilyName() { - return PyBundle.message("QFIX.unresolved.reference.add.future"); - } - - public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { - PsiElement element = descriptor.getPsiElement(); - PyFile file = (PyFile)element.getContainingFile(); - PyElementGenerator elementGenerator = PyElementGenerator.getInstance(project); - PyFromImportStatement statement = elementGenerator.createFromText(LanguageLevel.forElement(element), PyFromImportStatement.class, - "from __future__ import with_statement"); - file.addBefore(statement, file.getStatements().get(0)); - } -} diff --git a/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java b/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java index 3248ac91b3d0..2aed26b45a53 100644 --- a/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java +++ b/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java @@ -508,11 +508,6 @@ public class PyUnresolvedReferencesInspection extends PyInspection { if (PyUnreachableCodeInspection.hasAnyInterruptedControlFlowPaths(expr)) { return; } - if (LanguageLevel.forElement(node).isOlderThan(LanguageLevel.PYTHON26)) { - if ("with".equals(refName)) { - actions.add(new UnresolvedRefAddFutureImportQuickFix()); - } - } if (refText.equals("true") || refText.equals("false")) { actions.add(new UnresolvedRefTrueFalseQuickFix(element)); } diff --git a/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java b/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java index 902263281c1c..44a559d80fc3 100644 --- a/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java +++ b/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java @@ -45,10 +45,6 @@ import java.util.concurrent.atomic.AtomicBoolean; * @author vlan */ public class PyPackageManagerImpl extends PyPackageManager { - // Python 2.4-2.5 compatible versions - private static final String SETUPTOOLS_PRE_26_VERSION = "1.4.2"; - private static final String PIP_PRE_26_VERSION = "1.1"; - private static final String VIRTUALENV_PRE_26_VERSION = "1.7.2"; private static final String SETUPTOOLS_VERSION = "28.8.0"; private static final String PIP_VERSION = "9.0.1"; @@ -88,15 +84,11 @@ public class PyPackageManagerImpl extends PyPackageManager { @Override public void installManagement() throws ExecutionException { - final Sdk sdk = getSdk(); - final boolean pre26 = PythonSdkType.getLanguageLevelForSdk(sdk).isOlderThan(LanguageLevel.PYTHON26); if (!refreshAndCheckForSetuptools()) { - final String name = PyPackageUtil.SETUPTOOLS + "-" + (pre26 ? SETUPTOOLS_PRE_26_VERSION : SETUPTOOLS_VERSION); - installManagement(name); + installManagement(PyPackageUtil.SETUPTOOLS + "-" + SETUPTOOLS_VERSION); } if (PyPackageUtil.findPackage(refreshAndGetPackages(false), PyPackageUtil.PIP) == null) { - final String name = PyPackageUtil.PIP + "-" + (pre26 ? PIP_PRE_26_VERSION : PIP_VERSION); - installManagement(name); + installManagement(PyPackageUtil.PIP + "-" + PIP_VERSION); } } @@ -314,8 +306,7 @@ public class PyPackageManagerImpl extends PyPackageManager { args.add("--system-site-packages"); } args.add(destinationDir); - final boolean pre26 = languageLevel.isOlderThan(LanguageLevel.PYTHON26); - final String name = "virtualenv-" + (pre26 ? VIRTUALENV_PRE_26_VERSION : VIRTUALENV_VERSION); + final String name = "virtualenv-" + VIRTUALENV_VERSION; final String dirName = extractHelper(name + ".tar.gz"); try { final String fileName = dirName + name + File.separatorChar + "virtualenv.py"; diff --git a/python/src/com/jetbrains/python/psi/impl/PyClassImpl.java b/python/src/com/jetbrains/python/psi/impl/PyClassImpl.java index 73ce074b7a92..09fe1bd98699 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyClassImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyClassImpl.java @@ -641,13 +641,12 @@ public class PyClassImpl extends PyBaseElementImpl implements PyCla /** * @param name name of the property * @param property_filter returns true if the property is acceptable - * @param advanced is @foo.setter syntax allowed * @return the first property that both filters accepted. */ @Nullable - private Property processPropertiesInClass(@Nullable String name, @Nullable Processor property_filter, boolean advanced) { + private Property processPropertiesInClass(@Nullable String name, @Nullable Processor property_filter) { // NOTE: fast enough to be rerun every time - Property prop = processDecoratedProperties(name, property_filter, advanced); + Property prop = processDecoratedProperties(name, property_filter); if (prop != null) return prop; if (getStub() != null) { prop = processStubProperties(name, property_filter); @@ -668,7 +667,7 @@ public class PyClassImpl extends PyBaseElementImpl implements PyCla } @Nullable - private Property processDecoratedProperties(@Nullable String name, @Nullable Processor filter, boolean useAdvancedSyntax) { + private Property processDecoratedProperties(@Nullable String name, @Nullable Processor filter) { // look at @property decorators Map> grouped = new HashMap<>(); // group suitable same-named methods, each group defines a property @@ -703,16 +702,14 @@ public class PyClassImpl extends PyBaseElementImpl implements PyCla } } if (PyNames.PROPERTY.equals(decoName) || - PyKnownDecoratorUtil.isPropertyDecorator(deco, TypeEvalContext.codeInsightFallback(getProject()))) { + PyKnownDecoratorUtil.isPropertyDecorator(deco, TypeEvalContext.codeInsightFallback(getProject())) || + qname.matches(decoratorName, PyNames.GETTER)) { getter = new Maybe<>(method); } - else if (useAdvancedSyntax && qname.matches(decoratorName, PyNames.GETTER)) { - getter = new Maybe<>(method); - } - else if (useAdvancedSyntax && qname.matches(decoratorName, PyNames.SETTER)) { + else if (qname.matches(decoratorName, PyNames.SETTER)) { setter = new Maybe<>(method); } - else if (useAdvancedSyntax && qname.matches(decoratorName, PyNames.DELETER)) { + else if (qname.matches(decoratorName, PyNames.DELETER)) { deleter = new Maybe<>(method); } } @@ -827,14 +824,7 @@ public class PyClassImpl extends PyBaseElementImpl implements PyCla @Nullable private Property processProperties(@Nullable String name, @Nullable Processor filter, boolean inherited) { PyPsiUtils.assertValid(this); - LanguageLevel level = LanguageLevel.getDefault(); - // EA-32381: A tree-based instance may not have a parent element somehow, so getContainingFile() may be not appropriate - final PsiFile file = getParentByStub() != null ? getContainingFile() : null; - if (file != null) { - level = LanguageLevel.forElement(file); - } - final boolean useAdvancedSyntax = level.isAtLeast(LanguageLevel.PYTHON26); - final Property local = processPropertiesInClass(name, filter, useAdvancedSyntax); + final Property local = processPropertiesInClass(name, filter); if (local != null) { return local; } @@ -843,7 +833,7 @@ public class PyClassImpl extends PyBaseElementImpl implements PyCla return null; } for (PyClass cls : getAncestorClasses(null)) { - final Property property = ((PyClassImpl)cls).processPropertiesInClass(name, filter, useAdvancedSyntax); + final Property property = ((PyClassImpl)cls).processPropertiesInClass(name, filter); if (property != null) { return property; } diff --git a/python/src/com/jetbrains/python/validation/CompatibilityVisitor.java b/python/src/com/jetbrains/python/validation/CompatibilityVisitor.java index 97a0e7b92900..6c6a236ce617 100644 --- a/python/src/com/jetbrains/python/validation/CompatibilityVisitor.java +++ b/python/src/com/jetbrains/python/validation/CompatibilityVisitor.java @@ -48,7 +48,6 @@ public abstract class CompatibilityVisitor extends PyAnnotator { protected List myVersionsToProcess; static { - AVAILABLE_PREFIXES.put(LanguageLevel.PYTHON25, Sets.newHashSet("R", "U", "UR")); AVAILABLE_PREFIXES.put(LanguageLevel.PYTHON26, Sets.newHashSet("R", "U", "UR", "B", "BR")); AVAILABLE_PREFIXES.put(LanguageLevel.PYTHON27, Sets.newHashSet("R", "U", "UR", "B", "BR")); AVAILABLE_PREFIXES.put(LanguageLevel.PYTHON30, Sets.newHashSet("R", "B")); @@ -116,12 +115,6 @@ public abstract class CompatibilityVisitor extends PyAnnotator { element = element.getNextSibling(); } - if (element != null && "as".equals(element.getText())) { - registerOnFirstMatchingVersion(level -> level.isOlderThan(LanguageLevel.PYTHON26), - "Python versions < 2.6 do not support this syntax.", - node); - } - if (element != null && ",".equals(element.getText())) { registerForAllMatchingVersions(LanguageLevel::isPy3K, " not support this syntax.", node, new ReplaceExceptPartQuickFix()); } @@ -580,12 +573,6 @@ public abstract class CompatibilityVisitor extends PyAnnotator { if (keywordArgumentNames.contains(keyword)) { registerProblem(argument, "Keyword argument repeated", new PyRemoveArgumentQuickFix()); } - else if (seenPositionalContainer) { - registerOnFirstMatchingVersion(level -> level.isOlderThan(LanguageLevel.PYTHON26), - "Python versions < 2.6 do not allow keyword arguments after *expression", - argument, - new PyRemoveArgumentQuickFix()); - } else if (seenKeywordContainer) { registerOnFirstMatchingVersion(level -> level.isOlderThan(LanguageLevel.PYTHON35), "Python versions < 3.5 do not allow keyword arguments after **expression", diff --git a/python/testData/inspections/DictComprehensionToCall.py b/python/testData/inspections/DictComprehensionToCall.py index 06176bee477e..51ab6baede09 100644 --- a/python/testData/inspections/DictComprehensionToCall.py +++ b/python/testData/inspections/DictComprehensionToCall.py @@ -1 +1 @@ -var = {k: v for k, v in zip('abc', range(3)) if k % 2} \ No newline at end of file +var = {k: v for k, v in zip('abc', range(3)) if k % 2} \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/argumentsUnpackingGeneralizations.py b/python/testData/inspections/PyCompatibilityInspection/argumentsUnpackingGeneralizations.py index fee1ac96b5b8..d2b2c7012b09 100644 --- a/python/testData/inspections/PyCompatibilityInspection/argumentsUnpackingGeneralizations.py +++ b/python/testData/inspections/PyCompatibilityInspection/argumentsUnpackingGeneralizations.py @@ -7,11 +7,11 @@ foo(0, 2, *[3], 4, - a='a', + a='a', *[6], - b='b', + b='b', *[7], - c='c', + c='c', **{'d': 'd'}, - e='e', + e='e', **{'f': 'f'}) diff --git a/python/testData/inspections/PyCompatibilityInspection/asyncComprehensions.py b/python/testData/inspections/PyCompatibilityInspection/asyncComprehensions.py index 6caea7af8c20..ff4289166426 100644 --- a/python/testData/inspections/PyCompatibilityInspection/asyncComprehensions.py +++ b/python/testData/inspections/PyCompatibilityInspection/asyncComprehensions.py @@ -1,16 +1,16 @@ async def asyncgen(): yield 10 async def run(): - {i async for i in asyncgen()} + {i async for i in asyncgen()} [i async for i in asyncgen()] - {i: i ** 2 async for i in asyncgen()} + {i: i ** 2 async for i in asyncgen()} (i ** 2 async for i in asyncgen()) list(i async for i in asyncgen()) - dataset = {data for line in gen() + dataset = {data for line in gen() async for data in line if check(data)} - dataset = {data async for line in asyncgen() + dataset = {data async for line in asyncgen() async for data in line if check(data)} \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/awaitInComprehensions.py b/python/testData/inspections/PyCompatibilityInspection/awaitInComprehensions.py index d4672d7c96af..6ca8c2bce2eb 100644 --- a/python/testData/inspections/PyCompatibilityInspection/awaitInComprehensions.py +++ b/python/testData/inspections/PyCompatibilityInspection/awaitInComprehensions.py @@ -1,16 +1,16 @@ async def async2(): [await fun() for fun in funcs] - {await fun() for fun in funcs} - {fun: await fun() for fun in funcs} + {await fun() for fun in funcs} + {fun: await fun() for fun in funcs} [await fun() for fun in funcs if await smth] - {await fun() for fun in funcs if await smth} - {fun: await fun() for fun in funcs if await smth} + {await fun() for fun in funcs if await smth} + {fun: await fun() for fun in funcs if await smth} [await fun() async for fun in funcs] - {await fun() async for fun in funcs} - {fun: await fun() async for fun in funcs} + {await fun() async for fun in funcs} + {fun: await fun() async for fun in funcs} [await fun() async for fun in funcs if await smth] - {await fun() async for fun in funcs if await smth} - {fun: await fun() async for fun in funcs if await smth} \ No newline at end of file + {await fun() async for fun in funcs if await smth} + {fun: await fun() async for fun in funcs if await smth} \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/callExpression.py b/python/testData/inspections/PyCompatibilityInspection/callExpression.py index 4c7a3f7b60e5..f1dbe1fba337 100644 --- a/python/testData/inspections/PyCompatibilityInspection/callExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/callExpression.py @@ -1,15 +1,8 @@ class A(B): def __init__(self): - super() + super() cmp() reduce() -buffer() - -def foo(a,b,c): - print (a,b,c) - -args=['b'] -foo('a', c='c', *args) # OK -foo('a', *args, c='c') # Not OK \ No newline at end of file +buffer() \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/dictCompExpression.py b/python/testData/inspections/PyCompatibilityInspection/dictCompExpression.py index d48265ffbb99..a43d3caae29d 100644 --- a/python/testData/inspections/PyCompatibilityInspection/dictCompExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/dictCompExpression.py @@ -1 +1 @@ -var = {i : chr(65+i) for i in range(4)} +var = {i : chr(65+i) for i in range(4)} diff --git a/python/testData/inspections/PyCompatibilityInspection/exceptBlock.py b/python/testData/inspections/PyCompatibilityInspection/exceptBlock.py index a15f3e513c66..a1fe68716884 100644 --- a/python/testData/inspections/PyCompatibilityInspection/exceptBlock.py +++ b/python/testData/inspections/PyCompatibilityInspection/exceptBlock.py @@ -1,8 +1,3 @@ -try: - do_smth() -except ImportError as e: - do() - try: do_smth() except ImportError, ImportWarning: diff --git a/python/testData/inspections/PyCompatibilityInspection/fromImportStatement.py b/python/testData/inspections/PyCompatibilityInspection/fromImportStatement.py index a522c204b251..37411f0816da 100644 --- a/python/testData/inspections/PyCompatibilityInspection/fromImportStatement.py +++ b/python/testData/inspections/PyCompatibilityInspection/fromImportStatement.py @@ -1,3 +1,3 @@ from Bastion import BastionClass -from email.Utils import formatdate +from email.Utils import formatdate diff --git a/python/testData/inspections/PyCompatibilityInspection/importStatement.py b/python/testData/inspections/PyCompatibilityInspection/importStatement.py index c6313ffb66df..5f849606c2d2 100644 --- a/python/testData/inspections/PyCompatibilityInspection/importStatement.py +++ b/python/testData/inspections/PyCompatibilityInspection/importStatement.py @@ -1,3 +1,3 @@ -import builtins +import builtins import __builtin__ \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/raiseFrom.py b/python/testData/inspections/PyCompatibilityInspection/raiseFrom.py index 2acd5642ceba..f7033897e3d2 100644 --- a/python/testData/inspections/PyCompatibilityInspection/raiseFrom.py +++ b/python/testData/inspections/PyCompatibilityInspection/raiseFrom.py @@ -1,2 +1,2 @@ -raise exception from cause +raise exception from cause a = 1 \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/setCompExpression.py b/python/testData/inspections/PyCompatibilityInspection/setCompExpression.py index 35d047f9713f..e33a83ab6ec3 100644 --- a/python/testData/inspections/PyCompatibilityInspection/setCompExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/setCompExpression.py @@ -1 +1 @@ -var = {i for i in range(2)} +var = {i for i in range(2)} diff --git a/python/testData/inspections/PyCompatibilityInspection/setLiteralExpression.py b/python/testData/inspections/PyCompatibilityInspection/setLiteralExpression.py index 5876b8335bc7..b97c93d9eece 100644 --- a/python/testData/inspections/PyCompatibilityInspection/setLiteralExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/setLiteralExpression.py @@ -1 +1 @@ -var = {1, 2} +var = {1, 2} diff --git a/python/testData/inspections/PyCompatibilityInspection/stringLiteralExpression.py b/python/testData/inspections/PyCompatibilityInspection/stringLiteralExpression.py index 15880597b7f4..93661f7023b5 100644 --- a/python/testData/inspections/PyCompatibilityInspection/stringLiteralExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/stringLiteralExpression.py @@ -2,42 +2,42 @@ a = u< # Python 3.6 -a = f"" -a = F"" -a = rf"" -a = fr"" -a = fu"" -a = uf"" -a = bf"" -a = fb"" -a = ufr"" +a = f"" +a = F"" +a = rf"" +a = fr"" +a = fu"" +a = uf"" +a = bf"" +a = fb"" +a = ufr"" # python 3.3 a = u"" a = r"" -a = b"" -a = rb"" -a = br"" +a = b"" +a = rb"" +a = br"" # python 3.2, 3.1 a = r"" -a = b"" -a = br"" +a = b"" +a = br"" # python 3.0 a = r"" -a = b"" +a = b"" # python 2.7, 2.6 a = u"" a = r"" a = ur"" -a = b"" -a = br"" +a = b"" +a = br"" # python 2.5 @@ -46,9 +46,9 @@ a = r"" a = ur"" # combined -b = u"" b"" +b = u"" b"" # never was available -a = rr"" -a = bb"" -a = uu"" \ No newline at end of file +a = rr"" +a = bb"" +a = uu"" \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/tryFinallyEmptyRaisePy2.py b/python/testData/inspections/PyCompatibilityInspection/tryFinallyEmptyRaisePy2.py index f8dd30cd7044..8fe487db0732 100644 --- a/python/testData/inspections/PyCompatibilityInspection/tryFinallyEmptyRaisePy2.py +++ b/python/testData/inspections/PyCompatibilityInspection/tryFinallyEmptyRaisePy2.py @@ -1,4 +1,4 @@ try: raise ValueError finally: - raise \ No newline at end of file + raise \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/tryFinallyEmptyRaisePy3.py b/python/testData/inspections/PyCompatibilityInspection/tryFinallyEmptyRaisePy3.py index 8e0cb99c89b5..f2bf13030630 100644 --- a/python/testData/inspections/PyCompatibilityInspection/tryFinallyEmptyRaisePy3.py +++ b/python/testData/inspections/PyCompatibilityInspection/tryFinallyEmptyRaisePy3.py @@ -1,4 +1,4 @@ try: raise ValueError finally: - raise \ No newline at end of file + raise \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/underscoreBz2Module.py b/python/testData/inspections/PyCompatibilityInspection/underscoreBz2Module.py index 33f23f7f371d..42b5f0990e13 100644 --- a/python/testData/inspections/PyCompatibilityInspection/underscoreBz2Module.py +++ b/python/testData/inspections/PyCompatibilityInspection/underscoreBz2Module.py @@ -1 +1 @@ -import _bz2 \ No newline at end of file +import _bz2 \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/underscoresInNumericLiterals.py b/python/testData/inspections/PyCompatibilityInspection/underscoresInNumericLiterals.py index b96f5b29b39e..35ec4e5a1610 100644 --- a/python/testData/inspections/PyCompatibilityInspection/underscoresInNumericLiterals.py +++ b/python/testData/inspections/PyCompatibilityInspection/underscoresInNumericLiterals.py @@ -1,58 +1,58 @@ # hex -0xCAFE_F00D +0xCAFE_F00D # oct -0o1_23 -01_23 +0o1_23 +01_23 # bin -0b_0011_1111_0100_1110 +0b_0011_1111_0100_1110 # dec -10_000_000 +10_000_000 # pointfloat -10_00.00_23 -10_00. +10_00.00_23 +10_00. # exponentfloat -10_00.00_23e1_2 -10_00.00_23E1_2 -10_00.e1_2 -10_00.E1_2 +10_00.00_23e1_2 +10_00.00_23E1_2 +10_00.e1_2 +10_00.E1_2 -10_00.00_23e+1_2 -10_00.00_23E+1_2 -10_00.e+1_2 -10_00.E+1_2 +10_00.00_23e+1_2 +10_00.00_23E+1_2 +10_00.e+1_2 +10_00.E+1_2 -10_00.00_23e-1_2 -10_00.00_23E-1_2 -10_00.e-1_2 -10_00.E-1_2 +10_00.00_23e-1_2 +10_00.00_23E-1_2 +10_00.e-1_2 +10_00.E-1_2 -10_0000_23e1_2 -10_0000_23E1_2 -10_00e1_2 -10_00E1_2 +10_0000_23e1_2 +10_0000_23E1_2 +10_00e1_2 +10_00E1_2 -10_0000_23e+1_2 -10_0000_23E+1_2 -10_00e+1_2 -10_00E+1_2 +10_0000_23e+1_2 +10_0000_23E+1_2 +10_00e+1_2 +10_00E+1_2 -10_0000_23e-1_2 -10_0000_23E-1_2 -10_00e-1_2 -10_00E-1_2 +10_0000_23e-1_2 +10_0000_23E-1_2 +10_00e-1_2 +10_00E-1_2 # imag -10_00.00_23j -10_00.00_23J +10_00.00_23j +10_00.00_23J -10_00.00_23e1_2j -10_00.00_23e1_2J +10_00.00_23e1_2j +10_00.00_23e1_2J -10_000_000j -10_000_000J \ No newline at end of file +10_000_000j +10_000_000J \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/variableAnnotations.py b/python/testData/inspections/PyCompatibilityInspection/variableAnnotations.py index 42d3b92f95d1..e8372af1e7b8 100644 --- a/python/testData/inspections/PyCompatibilityInspection/variableAnnotations.py +++ b/python/testData/inspections/PyCompatibilityInspection/variableAnnotations.py @@ -1,8 +1,8 @@ class C: - x: int - y: None = 42 + x: int + y: None = 42 def m(self, d): - x: List[bool] - d['foo']: str - (d['bar']): float + x: List[bool] + d['foo']: str + (d['bar']): float diff --git a/python/testData/inspections/PyCompatibilityInspection/withStatement.py b/python/testData/inspections/PyCompatibilityInspection/withStatement.py index a5555a110e05..46bb73ae1869 100644 --- a/python/testData/inspections/PyCompatibilityInspection/withStatement.py +++ b/python/testData/inspections/PyCompatibilityInspection/withStatement.py @@ -1,2 +1,2 @@ -with A() as a, B() as b: +with A() as a, B() as b: suite diff --git a/python/testData/inspections/PyPropertyDefinitionInspection25/test.py b/python/testData/inspections/PyPropertyDefinitionInspection25/test.py deleted file mode 100644 index 52d432315fbb..000000000000 --- a/python/testData/inspections/PyPropertyDefinitionInspection25/test.py +++ /dev/null @@ -1,89 +0,0 @@ -class A(object): - def __init__(self, bar): - self._x = 1 ; self._bar = bar - - def __getX(self): - return self._x - - def __setX(self, x): - self._x = x - - def __delX(self): - pass - - x1 = property(__getX, __setX, __delX, "doc of x1") - x2 = property(__setX) - x3 = property(__getX, __getX) - x4 = property(__getX, fdel=__getX) - x5 = property(__getX, doc=123) - - x6 = property(lambda self: self._x) - x7 = property(lambda self: self._x, lambda self: self._x) - - @property - def foo(self): - return self._x - - @foo.setter # ignored in 2.5 - def foo(self, x): - self._x = x - - @foo.deleter # ignored in 2.5 - def foo(self): - pass - - @property - def boo(self): - return self._x - - @boo.setter - def boo1(self, x): # ignored in 2.5 - self._x = x - - @boo.deleter - def boo2(self): # ignored in 2,5 - pass - - @property - def moo(self): - pass - - @moo.setter - def foo(self, x): - return 1 # ignored in 2.5 - - @foo.deleter - def foo(self): - return self._x # ignored in 2.5 - - @qoo.setter # unknown qoo is reported in ref inspection - def qoo(self, v): - self._x = v - - @property - def bar(self): - return None - -class Ghostbusters(object): - def __call__(self): - return "Who do you call?" - -gb = Ghostbusters() - -class B(object): - x = property(gb) - y = property(Ghostbusters()) - z = property(Ghostbusters) - -class Eternal(object): - def give(self): - while True: - yield 1 - - def giveAndTake(self): - x = 1 - while True: - x = (yield x) - - one = property(give) - anything = property(giveAndTake) diff --git a/python/testData/inspections/UnresolvedWith.py b/python/testData/inspections/UnresolvedWith.py deleted file mode 100644 index 3b8ca1cfe4fa..000000000000 --- a/python/testData/inspections/UnresolvedWith.py +++ /dev/null @@ -1,2 +0,0 @@ -with open("x.txt") as f: - data = f.read() \ No newline at end of file diff --git a/python/testData/inspections/UnresolvedWith_after.py b/python/testData/inspections/UnresolvedWith_after.py deleted file mode 100644 index 66b1d3d0445a..000000000000 --- a/python/testData/inspections/UnresolvedWith_after.py +++ /dev/null @@ -1,4 +0,0 @@ -from __future__ import with_statement - -with open("x.txt") as f: - data = f.read() \ No newline at end of file diff --git a/python/testData/psi/ImportStmt.py b/python/testData/psi/ImportStmt.py deleted file mode 100644 index d7dc0ba0968e..000000000000 --- a/python/testData/psi/ImportStmt.py +++ /dev/null @@ -1,22 +0,0 @@ -# import A as B -import A as B -# import A as D, A as DDD -import A as D, A as DDD -# import A.B.C as D, A as DDD -import A.B.C as D, A as DDD -# import as as as -import as as as -# import A -import A -# import A, B, C -import A, B, C -# import A.B.C -import A.B.C -# from A import B, C -from A import B, C -# from A import B as C -from A import B as C -# from A import B as C, X as Y -from A import B as C, X as Y -# from foo import as as as -from foo import as as as \ No newline at end of file diff --git a/python/testData/psi/ImportStmt.txt b/python/testData/psi/ImportStmt.txt deleted file mode 100644 index b12c29be2f17..000000000000 --- a/python/testData/psi/ImportStmt.txt +++ /dev/null @@ -1,211 +0,0 @@ -PyFile:ImportStmt.py - PsiComment(Py:END_OF_LINE_COMMENT)('# import A as B') - PsiWhiteSpace('\n') - PyImportStatement - PsiElement(Py:IMPORT_KEYWORD)('import') - PsiWhiteSpace(' ') - PyImportElement:A - PyReferenceExpression: A - PsiElement(Py:IDENTIFIER)('A') - PsiWhiteSpace(' ') - PsiElement(Py:AS_KEYWORD)('as') - PsiWhiteSpace(' ') - PyTargetExpression: B - PsiElement(Py:IDENTIFIER)('B') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# import A as D, A as DDD') - PsiWhiteSpace('\n') - PyImportStatement - PsiElement(Py:IMPORT_KEYWORD)('import') - PsiWhiteSpace(' ') - PyImportElement:A - PyReferenceExpression: A - PsiElement(Py:IDENTIFIER)('A') - PsiWhiteSpace(' ') - PsiElement(Py:AS_KEYWORD)('as') - PsiWhiteSpace(' ') - PyTargetExpression: D - PsiElement(Py:IDENTIFIER)('D') - PsiElement(Py:COMMA)(',') - PsiWhiteSpace(' ') - PyImportElement:A - PyReferenceExpression: A - PsiElement(Py:IDENTIFIER)('A') - PsiWhiteSpace(' ') - PsiElement(Py:AS_KEYWORD)('as') - PsiWhiteSpace(' ') - PyTargetExpression: DDD - PsiElement(Py:IDENTIFIER)('DDD') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# import A.B.C as D, A as DDD') - PsiWhiteSpace('\n') - PyImportStatement - PsiElement(Py:IMPORT_KEYWORD)('import') - PsiWhiteSpace(' ') - PyImportElement:A.B.C - PyReferenceExpression: C - PyReferenceExpression: B - PyReferenceExpression: A - PsiElement(Py:IDENTIFIER)('A') - PsiElement(Py:DOT)('.') - PsiElement(Py:IDENTIFIER)('B') - PsiElement(Py:DOT)('.') - PsiElement(Py:IDENTIFIER)('C') - PsiWhiteSpace(' ') - PsiElement(Py:AS_KEYWORD)('as') - PsiWhiteSpace(' ') - PyTargetExpression: D - PsiElement(Py:IDENTIFIER)('D') - PsiElement(Py:COMMA)(',') - PsiWhiteSpace(' ') - PyImportElement:A - PyReferenceExpression: A - PsiElement(Py:IDENTIFIER)('A') - PsiWhiteSpace(' ') - PsiElement(Py:AS_KEYWORD)('as') - PsiWhiteSpace(' ') - PyTargetExpression: DDD - PsiElement(Py:IDENTIFIER)('DDD') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# import as as as') - PsiWhiteSpace('\n') - PyImportStatement - PsiElement(Py:IMPORT_KEYWORD)('import') - PsiWhiteSpace(' ') - PyImportElement:as - PyReferenceExpression: as - PsiElement(Py:IDENTIFIER)('as') - PsiWhiteSpace(' ') - PsiElement(Py:AS_KEYWORD)('as') - PsiWhiteSpace(' ') - PyTargetExpression: as - PsiElement(Py:IDENTIFIER)('as') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# import A') - PsiWhiteSpace('\n') - PyImportStatement - PsiElement(Py:IMPORT_KEYWORD)('import') - PsiWhiteSpace(' ') - PyImportElement:A - PyReferenceExpression: A - PsiElement(Py:IDENTIFIER)('A') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# import A, B, C') - PsiWhiteSpace('\n') - PyImportStatement - PsiElement(Py:IMPORT_KEYWORD)('import') - PsiWhiteSpace(' ') - PyImportElement:A - PyReferenceExpression: A - PsiElement(Py:IDENTIFIER)('A') - PsiElement(Py:COMMA)(',') - PsiWhiteSpace(' ') - PyImportElement:B - PyReferenceExpression: B - PsiElement(Py:IDENTIFIER)('B') - PsiElement(Py:COMMA)(',') - PsiWhiteSpace(' ') - PyImportElement:C - PyReferenceExpression: C - PsiElement(Py:IDENTIFIER)('C') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# import A.B.C') - PsiWhiteSpace('\n') - PyImportStatement - PsiElement(Py:IMPORT_KEYWORD)('import') - PsiWhiteSpace(' ') - PyImportElement:A.B.C - PyReferenceExpression: C - PyReferenceExpression: B - PyReferenceExpression: A - PsiElement(Py:IDENTIFIER)('A') - PsiElement(Py:DOT)('.') - PsiElement(Py:IDENTIFIER)('B') - PsiElement(Py:DOT)('.') - PsiElement(Py:IDENTIFIER)('C') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# from A import B, C') - PsiWhiteSpace('\n') - PyFromImportStatement - PsiElement(Py:FROM_KEYWORD)('from') - PsiWhiteSpace(' ') - PyReferenceExpression: A - PsiElement(Py:IDENTIFIER)('A') - PsiWhiteSpace(' ') - PsiElement(Py:IMPORT_KEYWORD)('import') - PsiWhiteSpace(' ') - PyImportElement:B - PyReferenceExpression: B - PsiElement(Py:IDENTIFIER)('B') - PsiElement(Py:COMMA)(',') - PsiWhiteSpace(' ') - PyImportElement:C - PyReferenceExpression: C - PsiElement(Py:IDENTIFIER)('C') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# from A import B as C') - PsiWhiteSpace('\n') - PyFromImportStatement - PsiElement(Py:FROM_KEYWORD)('from') - PsiWhiteSpace(' ') - PyReferenceExpression: A - PsiElement(Py:IDENTIFIER)('A') - PsiWhiteSpace(' ') - PsiElement(Py:IMPORT_KEYWORD)('import') - PsiWhiteSpace(' ') - PyImportElement:B - PyReferenceExpression: B - PsiElement(Py:IDENTIFIER)('B') - PsiWhiteSpace(' ') - PsiElement(Py:AS_KEYWORD)('as') - PsiWhiteSpace(' ') - PyTargetExpression: C - PsiElement(Py:IDENTIFIER)('C') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# from A import B as C, X as Y') - PsiWhiteSpace('\n') - PyFromImportStatement - PsiElement(Py:FROM_KEYWORD)('from') - PsiWhiteSpace(' ') - PyReferenceExpression: A - PsiElement(Py:IDENTIFIER)('A') - PsiWhiteSpace(' ') - PsiElement(Py:IMPORT_KEYWORD)('import') - PsiWhiteSpace(' ') - PyImportElement:B - PyReferenceExpression: B - PsiElement(Py:IDENTIFIER)('B') - PsiWhiteSpace(' ') - PsiElement(Py:AS_KEYWORD)('as') - PsiWhiteSpace(' ') - PyTargetExpression: C - PsiElement(Py:IDENTIFIER)('C') - PsiElement(Py:COMMA)(',') - PsiWhiteSpace(' ') - PyImportElement:X - PyReferenceExpression: X - PsiElement(Py:IDENTIFIER)('X') - PsiWhiteSpace(' ') - PsiElement(Py:AS_KEYWORD)('as') - PsiWhiteSpace(' ') - PyTargetExpression: Y - PsiElement(Py:IDENTIFIER)('Y') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# from foo import as as as') - PsiWhiteSpace('\n') - PyFromImportStatement - PsiElement(Py:FROM_KEYWORD)('from') - PsiWhiteSpace(' ') - PyReferenceExpression: foo - PsiElement(Py:IDENTIFIER)('foo') - PsiWhiteSpace(' ') - PsiElement(Py:IMPORT_KEYWORD)('import') - PsiWhiteSpace(' ') - PyImportElement:as - PyReferenceExpression: as - PsiElement(Py:IDENTIFIER)('as') - PsiWhiteSpace(' ') - PsiElement(Py:AS_KEYWORD)('as') - PsiWhiteSpace(' ') - PyTargetExpression: as - PsiElement(Py:IDENTIFIER)('as') \ No newline at end of file diff --git a/python/testData/psi/WithStatement2.py b/python/testData/psi/WithStatement2.py deleted file mode 100644 index bf22b3a7b17b..000000000000 --- a/python/testData/psi/WithStatement2.py +++ /dev/null @@ -1,9 +0,0 @@ -# with = 1 # legal identifier -# with = 1 -with = 1 -# from __future__ import nested_scopes, with_statement -from __future__ import nested_scopes, with_statement -# with x.y(z)[t] as y: pass -with x.y(z)[t] as y: pass -# with = 1 # now illegal -with = 1 diff --git a/python/testData/psi/WithStatement2.txt b/python/testData/psi/WithStatement2.txt deleted file mode 100644 index eb9c941de5c3..000000000000 --- a/python/testData/psi/WithStatement2.txt +++ /dev/null @@ -1,80 +0,0 @@ -PyFile:WithStatement2.py - PsiComment(Py:END_OF_LINE_COMMENT)('# with = 1 # legal identifier') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# with = 1') - PsiWhiteSpace('\n') - PyAssignmentStatement - PyTargetExpression: with - PsiElement(Py:IDENTIFIER)('with') - PsiWhiteSpace(' ') - PsiElement(Py:EQ)('=') - PsiWhiteSpace(' ') - PyNumericLiteralExpression - PsiElement(Py:INTEGER_LITERAL)('1') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# from __future__ import nested_scopes, with_statement') - PsiWhiteSpace('\n') - PyFromImportStatement - PsiElement(Py:FROM_KEYWORD)('from') - PsiWhiteSpace(' ') - PyReferenceExpression: __future__ - PsiElement(Py:IDENTIFIER)('__future__') - PsiWhiteSpace(' ') - PsiElement(Py:IMPORT_KEYWORD)('import') - PsiWhiteSpace(' ') - PyImportElement:nested_scopes - PyReferenceExpression: nested_scopes - PsiElement(Py:IDENTIFIER)('nested_scopes') - PsiElement(Py:COMMA)(',') - PsiWhiteSpace(' ') - PyImportElement:with_statement - PyReferenceExpression: with_statement - PsiElement(Py:IDENTIFIER)('with_statement') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# with x.y(z)[t] as y: pass') - PsiWhiteSpace('\n') - PyWithStatement - PsiElement(Py:WITH_KEYWORD)('with') - PsiWhiteSpace(' ') - PyWithItem - PySubscriptionExpression - PyCallExpression: x.y - PyReferenceExpression: y - PyReferenceExpression: x - PsiElement(Py:IDENTIFIER)('x') - PsiElement(Py:DOT)('.') - PsiElement(Py:IDENTIFIER)('y') - PyArgumentList - PsiElement(Py:LPAR)('(') - PyReferenceExpression: z - PsiElement(Py:IDENTIFIER)('z') - PsiElement(Py:RPAR)(')') - PsiElement(Py:LBRACKET)('[') - PyReferenceExpression: t - PsiElement(Py:IDENTIFIER)('t') - PsiElement(Py:RBRACKET)(']') - PsiWhiteSpace(' ') - PsiElement(Py:AS_KEYWORD)('as') - PsiWhiteSpace(' ') - PyTargetExpression: y - PsiElement(Py:IDENTIFIER)('y') - PsiElement(Py:COLON)(':') - PsiWhiteSpace(' ') - PyStatementList - PyPassStatement - PsiElement(Py:PASS_KEYWORD)('pass') - PsiWhiteSpace('\n') - PsiComment(Py:END_OF_LINE_COMMENT)('# with = 1 # now illegal') - PsiWhiteSpace('\n') - PyWithStatement - PsiElement(Py:WITH_KEYWORD)('with') - PsiWhiteSpace(' ') - PyWithItem - PsiErrorElement:expression expected - - PsiErrorElement:Colon expected - PsiElement(Py:EQ)('=') - PsiWhiteSpace(' ') - PsiElement(Py:INTEGER_LITERAL)('1') - PyStatementList - \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/env/python/PythonSkeletonsTest.java b/python/testSrc/com/jetbrains/env/python/PythonSkeletonsTest.java index 93734ff40476..3a3b323e02d4 100644 --- a/python/testSrc/com/jetbrains/env/python/PythonSkeletonsTest.java +++ b/python/testSrc/com/jetbrains/env/python/PythonSkeletonsTest.java @@ -119,11 +119,6 @@ public class PythonSkeletonsTest extends PyEnvTestCase { @Override protected void runTestOn(@NotNull Sdk sdk) { final LanguageLevel languageLevel = PythonSdkType.getLanguageLevelForSdk(sdk); - // Named tuples have been introduced in Python 2.6 - if (languageLevel.isOlderThan(LanguageLevel.PYTHON26)) { - return; - } - // XXX: A workaround for invalidating VFS cache with the test file copied to our temp directory LocalFileSystem.getInstance().refresh(false); @@ -159,10 +154,6 @@ public class PythonSkeletonsTest extends PyEnvTestCase { @Override protected void runTestOn(@NotNull Sdk sdk) { final LanguageLevel languageLevel = PythonSdkType.getLanguageLevelForSdk(sdk); - // We rely on int.real property that is not explicitly annotated in the skeletons generator - if (languageLevel.isOlderThan(LanguageLevel.PYTHON26)) { - return; - } final Project project = myFixture.getProject(); ApplicationManager.getApplication().runReadAction(() -> { final PyFile builtins = PyBuiltinCache.getBuiltinsForSdk(project, sdk); diff --git a/python/testSrc/com/jetbrains/python/PyQuickFixTest.java b/python/testSrc/com/jetbrains/python/PyQuickFixTest.java index 3f755f3bacc7..779d88edbd54 100644 --- a/python/testSrc/com/jetbrains/python/PyQuickFixTest.java +++ b/python/testSrc/com/jetbrains/python/PyQuickFixTest.java @@ -311,11 +311,6 @@ public class PyQuickFixTest extends PyTestCase { doInspectionTest(PyStatementEffectInspection.class, PyBundle.message("QFIX.statement.effect.introduce.variable"), true, true); } - // PY-2083 - public void testUnresolvedWith() { - runWithLanguageLevel(LanguageLevel.PYTHON25, () -> doInspectionTest(PyUnresolvedReferencesInspection.class, PyBundle.message("QFIX.unresolved.reference.add.future"), true, true)); - } - // PY-2092 public void testUnresolvedRefCreateFunction() { doInspectionTest(PyUnresolvedReferencesInspection.class, @@ -653,9 +648,10 @@ public class PyQuickFixTest extends PyTestCase { // PY-8174 public void testChangeSignatureAddKeywordOnlyParameter() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> { - doInspectionTest(PyArgumentListInspection.class, "Change signature of func(x, *args, foo, bar)", true, true); - }); + runWithLanguageLevel( + LanguageLevel.PYTHON30, + () -> doInspectionTest(PyArgumentListInspection.class, "Change signature of func(x, *args, foo, bar)", true, true) + ); } // PY-8174 diff --git a/python/testSrc/com/jetbrains/python/PySdkFlavorTest.java b/python/testSrc/com/jetbrains/python/PySdkFlavorTest.java index e934eb90e9d7..45b013c82f9f 100644 --- a/python/testSrc/com/jetbrains/python/PySdkFlavorTest.java +++ b/python/testSrc/com/jetbrains/python/PySdkFlavorTest.java @@ -47,21 +47,21 @@ public class PySdkFlavorTest extends PyTestCase { assertEquals(LanguageLevel.PYTHON34, flavor.getLanguageLevel(mockSdk)); } - public void testJython25VersionString() { + public void testJythonVersionString() { final PythonSdkFlavor flavor = JythonSdkFlavor.INSTANCE; - final String versionOutput = "Jython 2.5.3\n"; + final String versionOutput = "Jython 2.6.3\n"; final Sdk mockSdk = createMockSdk(flavor, versionOutput); - assertEquals("Jython 2.5.3", mockSdk.getVersionString()); - assertEquals(LanguageLevel.PYTHON25, flavor.getLanguageLevel(mockSdk)); + assertEquals("Jython 2.6.3", mockSdk.getVersionString()); + assertEquals(LanguageLevel.PYTHON26, flavor.getLanguageLevel(mockSdk)); } - public void testJython25WithWarningsVersionString() { + public void testJythonWithWarningsVersionString() { final PythonSdkFlavor flavor = JythonSdkFlavor.INSTANCE; final String versionOutput = "\"my\" variable $jythonHome masks earlier declaration in same scope at /usr/bin/jython line 15.\n" + - "Jython 2.5.3\n"; + "Jython 2.6.3\n"; final Sdk mockSdk = createMockSdk(flavor, versionOutput); - assertEquals("Jython 2.5.3", mockSdk.getVersionString()); - assertEquals(LanguageLevel.PYTHON25, flavor.getLanguageLevel(mockSdk)); + assertEquals("Jython 2.6.3", mockSdk.getVersionString()); + assertEquals(LanguageLevel.PYTHON26, flavor.getLanguageLevel(mockSdk)); } public void testPyPy23VersionString() { diff --git a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java index 2c615b9ddb22..05fa901b473b 100644 --- a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java +++ b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java @@ -171,10 +171,6 @@ public class PythonInspectionsTest extends PyTestCase { myFixture.checkHighlighting(true, false, true); } - public void testPyPropertyDefinitionInspection25() { - doHighlightingTest(PyPropertyDefinitionInspection.class, LanguageLevel.PYTHON25); - } - public void testPyPropertyDefinitionInspection26() { doHighlightingTest(PyPropertyDefinitionInspection.class, LanguageLevel.PYTHON26); } diff --git a/python/testSrc/com/jetbrains/python/PythonParsingTest.java b/python/testSrc/com/jetbrains/python/PythonParsingTest.java index 08fd356d0492..950643cc20c1 100644 --- a/python/testSrc/com/jetbrains/python/PythonParsingTest.java +++ b/python/testSrc/com/jetbrains/python/PythonParsingTest.java @@ -111,14 +111,6 @@ public class PythonParsingTest extends ParsingTestCase { doTest(); } - public void testWithStatement2() { - doTest(); - } - - public void testImportStmt() { - doTest(); - } - public void testDecoratedFunction() { doTest(); } @@ -375,7 +367,7 @@ public class PythonParsingTest extends ParsingTestCase { } public void doTest() { - doTest(LanguageLevel.PYTHON25); + doTest(LanguageLevel.PYTHON26); } public void testCompoundStatementAfterSemicolon() { // PY-7660 diff --git a/python/testSrc/com/jetbrains/python/intentions/PyConvertCollectionLiteralIntentionTest.java b/python/testSrc/com/jetbrains/python/intentions/PyConvertCollectionLiteralIntentionTest.java index 649dbcf273f7..ce119c9fba58 100644 --- a/python/testSrc/com/jetbrains/python/intentions/PyConvertCollectionLiteralIntentionTest.java +++ b/python/testSrc/com/jetbrains/python/intentions/PyConvertCollectionLiteralIntentionTest.java @@ -52,7 +52,7 @@ public class PyConvertCollectionLiteralIntentionTest extends PyIntentionTestCase // PY-9419 public void testConvertTupleToSetNotAvailableWithoutSetLiterals() { - runWithLanguageLevel(LanguageLevel.PYTHON25, () -> doNegativeTest(CONVERT_TUPLE_TO_SET)); + runWithLanguageLevel(LanguageLevel.PYTHON26, () -> doNegativeTest(CONVERT_TUPLE_TO_SET)); } // PY-9419 diff --git a/python/testSrc/com/jetbrains/python/intentions/PyStringConcatenationToFormatIntentionTest.java b/python/testSrc/com/jetbrains/python/intentions/PyStringConcatenationToFormatIntentionTest.java index 8a2423680798..e93b4711ab28 100644 --- a/python/testSrc/com/jetbrains/python/intentions/PyStringConcatenationToFormatIntentionTest.java +++ b/python/testSrc/com/jetbrains/python/intentions/PyStringConcatenationToFormatIntentionTest.java @@ -24,19 +24,19 @@ import com.jetbrains.python.psi.LanguageLevel; public class PyStringConcatenationToFormatIntentionTest extends PyIntentionTestCase { public void testSimple() { - doTest(PyBundle.message("INTN.replace.plus.with.format.operator"), LanguageLevel.PYTHON25); + doTest(PyBundle.message("INTN.replace.plus.with.format.operator"), LanguageLevel.PYTHON26); } public void testAugmentAssignment() { //PY-5226 - doTest(PyBundle.message("INTN.replace.plus.with.format.operator"), LanguageLevel.PYTHON25); + doTest(PyBundle.message("INTN.replace.plus.with.format.operator"), LanguageLevel.PYTHON26); } public void testNegative() { //PY-6505 - runWithLanguageLevel(LanguageLevel.PYTHON25, () -> doNegativeTest(PyBundle.message("INTN.replace.plus.with.format.operator"))); + runWithLanguageLevel(LanguageLevel.PYTHON26, () -> doNegativeTest(PyBundle.message("INTN.replace.plus.with.format.operator"))); } public void testTwoStrings() { //PY-6505 - doTest(PyBundle.message("INTN.replace.plus.with.format.operator"), LanguageLevel.PYTHON25); + doTest(PyBundle.message("INTN.replace.plus.with.format.operator"), LanguageLevel.PYTHON26); } public void testUnknownType() { //PY-7969 @@ -48,11 +48,11 @@ public class PyStringConcatenationToFormatIntentionTest extends PyIntentionTestC } public void testUnicodeString() { //PY-7463 - doTest(PyBundle.message("INTN.replace.plus.with.format.operator"), LanguageLevel.PYTHON25); + doTest(PyBundle.message("INTN.replace.plus.with.format.operator"), LanguageLevel.PYTHON26); } public void testUnicodeSecondString() { //PY-7463 - doTest(PyBundle.message("INTN.replace.plus.with.format.operator"), LanguageLevel.PYTHON25); + doTest(PyBundle.message("INTN.replace.plus.with.format.operator"), LanguageLevel.PYTHON26); } // PY-8366 @@ -62,7 +62,7 @@ public class PyStringConcatenationToFormatIntentionTest extends PyIntentionTestC // PY-8588 public void testEscaping() { - doTest(PyBundle.message("INTN.replace.plus.with.format.operator"), LanguageLevel.PYTHON25); + doTest(PyBundle.message("INTN.replace.plus.with.format.operator"), LanguageLevel.PYTHON26); } public void testPy3() { //PY-4706