Get tox -e py27 working.

This commit is contained in:
Dave Halter
2017-07-11 00:26:24 +02:00
parent dd7c12834e
commit c93546bfd9
15 changed files with 83 additions and 73 deletions

View File

@@ -1,8 +1,8 @@
for a in 'abc': for a in 'abc':
for b in 'xyz': for b in 'xyz':
print(a) # indented with 8 spaces hello(a) # indented with 8 spaces
#: E901:1 #: E901:1
print(b) # indented with 1 tab hello(b) # indented with 1 tab
if True: if True:
#: E101:0 #: E101:0
pass pass
@@ -46,6 +46,6 @@ def test_keys(self):
if True: if True:
print(""" hello("""
tab at start of this line tab at start of this line
""") """)

View File

@@ -43,7 +43,7 @@ if start[1] > end_col and not (
def long_function_name( def long_function_name(
var_one, var_two, var_three, var_one, var_two, var_three,
var_four): var_four):
print(var_one) hello(var_one)
#: E101+2 #: E101+2
@@ -64,12 +64,12 @@ if bar:
if ((foo.bar("baz") and if ((foo.bar("baz") and
foo.bar("frop") foo.bar("frop")
)): )):
print("yes") hello("yes")
#: E101+3 #: E101+3
# also ok, but starting to look like LISP # also ok, but starting to look like LISP
if ((foo.bar("baz") and if ((foo.bar("baz") and
foo.bar("frop"))): foo.bar("frop"))):
print("yes") hello("yes")
#: E101+1 #: E101+1
if (a == 2 or b == "abc def ghi" "jkl mno"): if (a == 2 or b == "abc def ghi" "jkl mno"):
return True return True

View File

@@ -1,6 +1,6 @@
if x > 2: if x > 2:
#: E111:2 #: E111:2
print(x) hello(x)
if True: if True:
#: E111:5 #: E111:5
print print

View File

@@ -147,7 +147,7 @@ fnct(1, 2, 3,
def long_function_name( def long_function_name(
var_one, var_two, var_three, var_one, var_two, var_three,
var_four): var_four):
print(var_one) hello(var_one)
if ((row < 0 or self.moduleCount <= row or if ((row < 0 or self.moduleCount <= row or
@@ -196,12 +196,12 @@ if bar:
if ((foo.bar("baz") and if ((foo.bar("baz") and
foo.bar("frop") foo.bar("frop")
)): )):
print("yes") hello("yes")
# also ok, but starting to look like LISP # also ok, but starting to look like LISP
if ((foo.bar("baz") and if ((foo.bar("baz") and
foo.bar("frop"))): foo.bar("frop"))):
print("yes") hello("yes")
#: E129+1:4 E127+2:9 #: E129+1:4 E127+2:9
if (a == 2 or if (a == 2 or
@@ -231,7 +231,7 @@ asd = 'l.{line}\t{pos}\t{name}\t{text}'.format(
) )
#: E121+1:6 E121+2:6 #: E121+1:6 E121+2:6
print('%-7d %s per second (%d total)' % ( hello('%-7d %s per second (%d total)' % (
options.counters[key] / elapsed, key, options.counters[key] / elapsed, key,
options.counters[key])) options.counters[key]))

View File

@@ -178,7 +178,7 @@ rv.update(dict.fromkeys(
def f(): def f():
try: try:
if not Debug: if not Debug:
print(''' hello('''
If you would like to see debugging output, If you would like to see debugging output,
try: %s -d5 try: %s -d5
''' % sys.argv[0]) ''' % sys.argv[0])

View File

@@ -112,7 +112,7 @@ if foo is None and bar is "frop" and \
def long_function_name( def long_function_name(
var_one, var_two, var_three, var_one, var_two, var_three,
var_four): var_four):
print(var_one) hello(var_one)
def qualify_by_address( def qualify_by_address(
@@ -185,7 +185,7 @@ foo = long_function_name(var_one, var_two,
var_three, var_four) var_three, var_four)
#: E128+1:4 #: E128+1:4
print('l.%s\t%s\t%s\t%r' % hello('l.%s\t%s\t%s\t%r' %
(token[2][0], pos, tokenize.tok_name[token[0]], token[1])) (token[2][0], pos, tokenize.tok_name[token[0]], token[1]))

View File

@@ -96,7 +96,7 @@ for foo in """
abc abc
123 123
""".strip().split(): """.strip().split():
print(foo) hello(foo)
abc = dedent( abc = dedent(
''' '''
mkdir -p ./{build}/ mkdir -p ./{build}/
@@ -109,7 +109,7 @@ abc = dedent(
) )
#: E701+1: E122+1 #: E701+1: E122+1
if True:\ if True:\
print(True) hello(True)
#: E128+1 #: E128+1
foobar(a foobar(a

View File

@@ -35,19 +35,18 @@ result = [
#: E203:9 #: E203:9
if x == 4 : if x == 4 :
print(x, y) foo(x, y)
x, y = y, x x, y = y, x
if x == 4: if x == 4:
#: E203:12 E702:13 #: E203:12 E702:13
a = x, y ; x, y = y, x a = x, y ; x, y = y, x
if x == 4: if x == 4:
print(x, y) foo(x, y)
#: E203:12 #: E203:12
x, y = y , x x, y = y , x
# Okay # Okay
if x == 4: if x == 4:
print(x, y) foo(x, y)
x, y = y, x x, y = y, x
a[b1, :] == a[b1, ...]
a[b1, :1] == 3 a[b1, :1] == 3
b = a[:, b1] b = a[:, b1]

View File

@@ -90,8 +90,6 @@ c = (a+ b)*(a - b)
z = 2//30 z = 2//30
c = (a+b) * (a-b) c = (a+b) * (a-b)
#: E275:13 E275:14
norman = True+False
x = x*2 - 1 x = x*2 - 1
x = x/2 - 1 x = x/2 - 1
# TODO whitespace should be the other way around according to pep8. # TODO whitespace should be the other way around according to pep8.

View File

@@ -34,31 +34,3 @@ foo(bar=(1 >= 1))
foo(bar=(1 <= 1)) foo(bar=(1 <= 1))
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
d[type(None)] = _deepcopy_atomic d[type(None)] = _deepcopy_atomic
# Annotated Function Definitions
# Okay
def munge(input: AnyStr, sep: AnyStr = None, limit=1000,
extra: Union[str, dict] = None) -> AnyStr:
pass
# Okay
async def add(a: int = 0, b: int = 0) -> int:
return a + b
# Previously E251 four times
#: E221:5
async def add(a: int = 0, b: int = 0) -> int:
return a + b
#: E225:24 E225:26
def x(b: tuple = (1, 2))->int:
return a + b
#: E252:11 E252:12 E231:8
def b(a:int=1):
pass

View File

@@ -52,14 +52,6 @@ def b():
pass pass
#: E302+3:0
def a():
pass
async def b():
pass
#: E303+3:0 #: E303+3:0
print print
@@ -183,12 +175,3 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
main() main()
# Previously just E272+1:5 E272+4:5
#: E302+3 E221:5 E221+3:5
async def x():
pass
async def x(y: int = 1):
pass

View File

@@ -26,9 +26,9 @@ try:
except ImportError: except ImportError:
pass pass
else: else:
print('imported foo') hello('imported foo')
finally: finally:
print('made attempt to import foo') hello('made attempt to import foo')
import bar import bar
VERSION = '1.2.3' VERSION = '1.2.3'

View File

@@ -16,10 +16,6 @@ del a[:]; a.append(42);
def f(x): return 2 def f(x): return 2
#: E704:16
async def f(x): return 2
#: E704:10 #: E704:10
def f(x): return 2 * x def f(x): return 2 * x

View File

@@ -8,3 +8,7 @@ foo = ur'This is not possible in Python 3.'
# This is actually printing a tuple. # This is actually printing a tuple.
#: E275:5 #: E275:5
print(1, 2) print(1, 2)
# True and False are not keywords in Python 2 and therefore there's no need for
# a space.
norman = True+False

View File

@@ -3,6 +3,7 @@ from typing import ClassVar, List
print(1, 2) print(1, 2)
# Annotated function (Issue #29) # Annotated function (Issue #29)
def foo(x: int) -> int: def foo(x: int) -> int:
return x + 1 return x + 1
@@ -17,3 +18,60 @@ class Class:
def m(self): def m(self):
xs: List[int] = [] xs: List[int] = []
# True and False are keywords in Python 3 and therefore need a space.
#: E275:13 E275:14
norman = True+False
#: E302+3:0
def a():
pass
async def b():
pass
# Okay
async def add(a: int = 0, b: int = 0) -> int:
return a + b
# Previously E251 four times
#: E221:5
async def add(a: int = 0, b: int = 0) -> int:
return a + b
# Previously just E272+1:5 E272+4:5
#: E302+3 E221:5 E221+3:5
async def x():
pass
async def x(y: int = 1):
pass
#: E704:16
async def f(x): return 2
a[b1, :] == a[b1, ...]
# Annotated Function Definitions
# Okay
def munge(input: AnyStr, sep: AnyStr = None, limit=1000,
extra: Union[str, dict] = None) -> AnyStr:
pass
#: E225:24 E225:26
def x(b: tuple = (1, 2))->int:
return a + b
#: E252:11 E252:12 E231:8
def b(a:int=1):
pass