UnsupportedFeatures and PyCompatiblityInspection refactored.

This commit is contained in:
Ekaterina Tuzova
2011-02-15 13:22:41 +03:00
parent f79f77c87a
commit 4409191c74
32 changed files with 811 additions and 934 deletions
@@ -0,0 +1,5 @@
# PY-2792
<warning descr="Python version 2.4 doesn't support this syntax.">x = True if condition else False</warning>
def foo(): # PY-2796
<warning descr="Python version 2.4 doesn't support this syntax. In Python <= 2.4, yield was a statement; it didn't return any value.">a = (yield 1)</warning>
@@ -0,0 +1,4 @@
print(<warning descr="Python version 3.0, 3.1 do not support <>, use != instead.">a <> b</warning>)
if <warning descr="Python version 3.0, 3.1 do not support <>, use != instead.">a <> 2</warning>:
var = a
@@ -0,0 +1,11 @@
class A(B):
def __init__(self):
<warning descr="Python version 2.4, 2.5, 2.6, 2.7 do not support this syntax. super() should have arguments in Python 2">super()</warning>
<warning descr="Python version 3.1 does not have method cmp">cmp()</warning>
<warning descr="Python version 3.0, 3.1 do not have method reduce"><warning descr="Python version 3.0 does not have method reduce">reduce()</warning></warning>
<warning descr="Python version 2.4 does not have method all">all()</warning>
<warning descr="Python version 2.4, 2.5, 2.6, 2.7 do not have method bytearray">bytearray()</warning>
<warning descr="Python version 2.4, 2.5 do not have method next">next()</warning>
<warning descr="Python version 2.4, 2.5, 3.0, 3.1 do not have method buffer"><warning descr="Python version 3.0 does not have method buffer">buffer()</warning></warning>
@@ -0,0 +1 @@
var = <warning descr="Python version 2.4, 2.5, 2.6, 3.0 do not support dictionary comprehensions">{i : chr(65+i) for i in range(4)}</warning>
@@ -0,0 +1,9 @@
try:
do_smth()
<warning descr="Python version 2.4, 2.5 do not support this syntax.">except ImportError as e:
do()</warning>
try:
do_smth()
<warning descr="Python version 3.0, 3.1 do not support this syntax.">except ImportError, ImportWarning:
do()</warning>
@@ -0,0 +1,4 @@
<warning descr="Python version 2.4 doesn't support this syntax.">from . import smth</warning>
<warning descr="Python version 2.4 doesn't support this syntax.">from .module import name1, name2</warning>
<warning descr="Python version 3.0, 3.1 do not have module Bastion">from Bastion import BastionClass</warning>
@@ -0,0 +1 @@
import <warning descr="Python version 3.0, 3.1 do not have module Bastion">Bastion</warning>
@@ -0,0 +1,3 @@
<error descr="Python version 2.7 does not have module builtins"><warning descr="Python version 2.4, 2.5, 2.6, 2.7 do not have module builtins">import builtins</warning></error>
<warning descr="Python version 3.0, 3.1 do not have module __builtin__">import __builtin__</warning>
@@ -0,0 +1 @@
var = [x for x in <warning descr="Python version 3.0, 3.1 do not support this syntax in list comprehensions.">1, 2, 3</warning>]
@@ -0,0 +1,2 @@
a = <warning descr="Python version 3.0, 3.1 do not support a trailing 'l' or 'L'.">12l</warning>
v = <warning descr="Python version 3.0, 3.1 do not support this syntax. It requires '0o' prefix for octal literals">04</warning><error descr="end of statement expected">8</error>
@@ -0,0 +1 @@
<warning descr="Python version >= 3.0 do not support this syntax. The print statement has been replaced with a print() function">print "One value"</warning>
@@ -0,0 +1,3 @@
#PY-2719
class BaseC<warning descr="Python version 2.4 does not support this syntax.">()</warning>:
pass
@@ -0,0 +1,6 @@
try:
a
except :
<warning descr="Python version 3.0, 3.1 do not support this syntax.">raise ImportError, ImportWarning</warning>
<warning descr="Python version 3.0, 3.1 do not support this syntax. Raise with no arguments can only be used in an except block">raise</warning>
@@ -0,0 +1 @@
a = <warning descr="Python version 3.0, 3.1 do not support backquotes, use repr() instead">`imp.acquire_lock()`</warning>
@@ -0,0 +1 @@
var = <warning descr="Python version 2.4, 2.5, 2.6, 3.0 do not support set comprehensions">{i for i in range(2)}</warning>
@@ -0,0 +1 @@
var = <warning descr="Python version 2.4, 2.5, 2.6, 3.0 do not support set literal expressions">{1, 2}</warning>
@@ -0,0 +1,2 @@
t = (1, 2, 3)
a, <warning descr="Python version 2.4, 2.5, 2.6, 2.7 do not support this syntax. Starred expressions are not allowed as assignment targets in Python 2">*b</warning>, c = t
@@ -0,0 +1 @@
a = <warning descr="Python version 3.0, 3.1 do not support a leading 'u' or 'U'.">u"String"</warning>
@@ -1,10 +1,10 @@
print(<warning descr="Python versions 3.0, 3.1 do not support <>, use != instead.">a <> b</warning>)
print(<warning descr="Python version 3.0, 3.1 do not support <>, use != instead.">a <> b</warning>)
if <warning descr="Python versions 3.0, 3.1 do not support <>, use != instead.">a <> 2</warning>:
if <warning descr="Python version 3.0, 3.1 do not support <>, use != instead.">a <> 2</warning>:
var = a
########################
<warning descr="Python versions >= 3.0 do not support this syntax. The print statement has been replaced with a print() function">print "One value"</warning>
<warning descr="Python version >= 3.0 do not support this syntax. The print statement has been replaced with a print() function">print "One value"</warning>
########################
@@ -14,14 +14,14 @@ class BaseC<warning descr="Python version 2.4 does not support this syntax.">()<
########################
<warning descr="Python version 2.4 doesn't support this syntax.">with A() as a, <warning descr="Python versions 2.5, 2.6, 3.0 do not support multiple context managers">B() as b</warning>:
<warning descr="Python version 2.4 doesn't support this syntax.">with A() as a, <warning descr="Python version 2.5, 2.6, 3.0 do not support multiple context managers">B() as b</warning>:
suite
</warning>########################
a = <warning descr="Python versions 3.0, 3.1 do not support backquotes, use repr() instead">`imp.acquire_lock()`</warning>
a = <warning descr="Python version 3.0, 3.1 do not support backquotes, use repr() instead">`imp.acquire_lock()`</warning>
########################
var = [x for x in <warning descr="Python versions 3.0, 3.1 do not support this syntax in list comprehensions.">1, 2, 3</warning>]
var = [x for x in <warning descr="Python version 3.0, 3.1 do not support this syntax in list comprehensions.">1, 2, 3</warning>]
########################
class A:
@@ -33,35 +33,35 @@ a.cmp()
########################
<warning descr="Python versions 3.1 have no method cmp">cmp()</warning>
<warning descr="Python versions 3.0, 3.1 have no method reduce">reduce()</warning>
<warning descr="Python versions 2.4 have no method all">all()</warning>
<warning descr="Python version 3.1 does not have method cmp">cmp()</warning>
<warning descr="Python version 3.0, 3.1 do not have method reduce">reduce()</warning>
<warning descr="Python version 2.4 does not have method all">all()</warning>
bytearray()
next()
<warning descr="Python versions 2.4, 2.5, 3.0, 3.1 have no method buffer">buffer()</warning>
<warning descr="Python version 2.4, 2.5, 3.0, 3.1 do not have method buffer">buffer()</warning>
########################
try:
a
except :
<warning descr="Python versions 3.0, 3.1 do not support this syntax.">raise ImportError, ImportWarning</warning>
<warning descr="Python version 3.0, 3.1 do not support this syntax.">raise ImportError, ImportWarning</warning>
try:
a
<warning descr="Python versions 3.0, 3.1 do not this syntax.">except ImportError, ImportWarning:
<warning descr="Python version 3.0, 3.1 do not support this syntax.">except ImportError, ImportWarning:
b
</warning>########################
var = <warning descr="Python versions 2.4, 2.5, 2.6, 3.0 do not support dictionary comprehensions">{i : chr(65+i) for i in range(4)}</warning>
var = <warning descr="Python version 2.4, 2.5, 2.6, 3.0 do not support dictionary comprehensions">{i : chr(65+i) for i in range(4)}</warning>
########################
import <warning descr="Python versions 3.0, 3.1 do not have module Bastion">Bastion</warning>
import <warning descr="Python version 3.0, 3.1 do not have module Bastion">Bastion</warning>
var = Bastion.BastionClass()
########################
@@ -70,7 +70,7 @@ def foo(): # PY-2796
########################
<warning descr="Python versions 3.0 3.1 do not support this syntax. Raise with no arguments can only be used in an except block">raise</warning>
<warning descr="Python version 3.0, 3.1 do not support this syntax. re with no arguments can only be used in an except block">raise</warning>
########################
# PY-2792
@@ -0,0 +1,8 @@
<warning descr="Python version 2.4 doesn't support this syntax. You could use a finally block to ensure that code is always executed, or one or more except blocks to catch specific exceptions.">try:
do_smth()
except ImportError:
do()
except KeyError:
do_1()
finally:
quit()</warning>
@@ -0,0 +1,2 @@
<warning descr="Python version 2.4 doesn't support this syntax.">with A() as a, <warning descr="Python version 2.5, 2.6, 3.0 do not support multiple context managers">B() as b</warning>:
suite</warning>