From c93546bfd994ee24eb3f652cdf79dc3463f1a704 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Tue, 11 Jul 2017 00:26:24 +0200 Subject: [PATCH] Get tox -e py27 working. --- test/normalizer_issue_files/E10.py | 6 +- test/normalizer_issue_files/E101.py | 6 +- test/normalizer_issue_files/E11.py | 2 +- test/normalizer_issue_files/E12_not_first.py | 8 +-- test/normalizer_issue_files/E12_not_second.py | 2 +- test/normalizer_issue_files/E12_second.py | 4 +- test/normalizer_issue_files/E12_third.py | 4 +- test/normalizer_issue_files/E20.py | 7 +-- test/normalizer_issue_files/E22.py | 2 - test/normalizer_issue_files/E25.py | 28 --------- test/normalizer_issue_files/E30.py | 17 ------ test/normalizer_issue_files/E40.py | 4 +- test/normalizer_issue_files/E70.py | 4 -- test/normalizer_issue_files/python2.7.py | 4 ++ test/normalizer_issue_files/python3.py | 58 +++++++++++++++++++ 15 files changed, 83 insertions(+), 73 deletions(-) diff --git a/test/normalizer_issue_files/E10.py b/test/normalizer_issue_files/E10.py index 673a615..cf3cd1a 100644 --- a/test/normalizer_issue_files/E10.py +++ b/test/normalizer_issue_files/E10.py @@ -1,8 +1,8 @@ for a in 'abc': for b in 'xyz': - print(a) # indented with 8 spaces + hello(a) # indented with 8 spaces #: E901:1 - print(b) # indented with 1 tab + hello(b) # indented with 1 tab if True: #: E101:0 pass @@ -46,6 +46,6 @@ def test_keys(self): if True: - print(""" + hello(""" tab at start of this line """) diff --git a/test/normalizer_issue_files/E101.py b/test/normalizer_issue_files/E101.py index ff3c76d..e2715ac 100644 --- a/test/normalizer_issue_files/E101.py +++ b/test/normalizer_issue_files/E101.py @@ -43,7 +43,7 @@ if start[1] > end_col and not ( def long_function_name( var_one, var_two, var_three, var_four): - print(var_one) + hello(var_one) #: E101+2 @@ -64,12 +64,12 @@ if bar: if ((foo.bar("baz") and foo.bar("frop") )): - print("yes") + hello("yes") #: E101+3 # also ok, but starting to look like LISP if ((foo.bar("baz") and foo.bar("frop"))): - print("yes") + hello("yes") #: E101+1 if (a == 2 or b == "abc def ghi" "jkl mno"): return True diff --git a/test/normalizer_issue_files/E11.py b/test/normalizer_issue_files/E11.py index ead0513..9e82c86 100644 --- a/test/normalizer_issue_files/E11.py +++ b/test/normalizer_issue_files/E11.py @@ -1,6 +1,6 @@ if x > 2: #: E111:2 - print(x) + hello(x) if True: #: E111:5 print diff --git a/test/normalizer_issue_files/E12_not_first.py b/test/normalizer_issue_files/E12_not_first.py index 6d13b29..cb9c741 100644 --- a/test/normalizer_issue_files/E12_not_first.py +++ b/test/normalizer_issue_files/E12_not_first.py @@ -147,7 +147,7 @@ fnct(1, 2, 3, def long_function_name( var_one, var_two, var_three, var_four): - print(var_one) + hello(var_one) if ((row < 0 or self.moduleCount <= row or @@ -196,12 +196,12 @@ if bar: if ((foo.bar("baz") and foo.bar("frop") )): - print("yes") + hello("yes") # also ok, but starting to look like LISP if ((foo.bar("baz") and foo.bar("frop"))): - print("yes") + hello("yes") #: E129+1:4 E127+2:9 if (a == 2 or @@ -231,7 +231,7 @@ asd = 'l.{line}\t{pos}\t{name}\t{text}'.format( ) #: 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])) diff --git a/test/normalizer_issue_files/E12_not_second.py b/test/normalizer_issue_files/E12_not_second.py index 1d4e830..e7c18e0 100644 --- a/test/normalizer_issue_files/E12_not_second.py +++ b/test/normalizer_issue_files/E12_not_second.py @@ -178,7 +178,7 @@ rv.update(dict.fromkeys( def f(): try: if not Debug: - print(''' + hello(''' If you would like to see debugging output, try: %s -d5 ''' % sys.argv[0]) diff --git a/test/normalizer_issue_files/E12_second.py b/test/normalizer_issue_files/E12_second.py index 01f6fa3..9130047 100644 --- a/test/normalizer_issue_files/E12_second.py +++ b/test/normalizer_issue_files/E12_second.py @@ -112,7 +112,7 @@ if foo is None and bar is "frop" and \ def long_function_name( var_one, var_two, var_three, var_four): - print(var_one) + hello(var_one) def qualify_by_address( @@ -185,7 +185,7 @@ foo = long_function_name(var_one, var_two, var_three, var_four) #: 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])) diff --git a/test/normalizer_issue_files/E12_third.py b/test/normalizer_issue_files/E12_third.py index 7c6c8b1..26697fe 100644 --- a/test/normalizer_issue_files/E12_third.py +++ b/test/normalizer_issue_files/E12_third.py @@ -96,7 +96,7 @@ for foo in """ abc 123 """.strip().split(): - print(foo) + hello(foo) abc = dedent( ''' mkdir -p ./{build}/ @@ -109,7 +109,7 @@ abc = dedent( ) #: E701+1: E122+1 if True:\ -print(True) +hello(True) #: E128+1 foobar(a diff --git a/test/normalizer_issue_files/E20.py b/test/normalizer_issue_files/E20.py index 03d4f8b..44986fa 100644 --- a/test/normalizer_issue_files/E20.py +++ b/test/normalizer_issue_files/E20.py @@ -35,19 +35,18 @@ result = [ #: E203:9 if x == 4 : - print(x, y) + foo(x, y) x, y = y, x if x == 4: #: E203:12 E702:13 a = x, y ; x, y = y, x if x == 4: - print(x, y) + foo(x, y) #: E203:12 x, y = y , x # Okay if x == 4: - print(x, y) + foo(x, y) x, y = y, x -a[b1, :] == a[b1, ...] a[b1, :1] == 3 b = a[:, b1] diff --git a/test/normalizer_issue_files/E22.py b/test/normalizer_issue_files/E22.py index c2c8010..dcf9a4b 100644 --- a/test/normalizer_issue_files/E22.py +++ b/test/normalizer_issue_files/E22.py @@ -90,8 +90,6 @@ c = (a+ b)*(a - b) z = 2//30 c = (a+b) * (a-b) -#: E275:13 E275:14 -norman = True+False x = x*2 - 1 x = x/2 - 1 # TODO whitespace should be the other way around according to pep8. diff --git a/test/normalizer_issue_files/E25.py b/test/normalizer_issue_files/E25.py index 5b0d540..8cf5314 100644 --- a/test/normalizer_issue_files/E25.py +++ b/test/normalizer_issue_files/E25.py @@ -34,31 +34,3 @@ foo(bar=(1 >= 1)) foo(bar=(1 <= 1)) (options, args) = parser.parse_args() 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 diff --git a/test/normalizer_issue_files/E30.py b/test/normalizer_issue_files/E30.py index 6853f0c..31e241c 100644 --- a/test/normalizer_issue_files/E30.py +++ b/test/normalizer_issue_files/E30.py @@ -52,14 +52,6 @@ def b(): pass -#: E302+3:0 -def a(): - pass - -async def b(): - pass - - #: E303+3:0 print @@ -183,12 +175,3 @@ def main(): if __name__ == '__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 diff --git a/test/normalizer_issue_files/E40.py b/test/normalizer_issue_files/E40.py index 5382f79..93a2ccf 100644 --- a/test/normalizer_issue_files/E40.py +++ b/test/normalizer_issue_files/E40.py @@ -26,9 +26,9 @@ try: except ImportError: pass else: - print('imported foo') + hello('imported foo') finally: - print('made attempt to import foo') + hello('made attempt to import foo') import bar VERSION = '1.2.3' diff --git a/test/normalizer_issue_files/E70.py b/test/normalizer_issue_files/E70.py index 5b0ffdc..3d88e0a 100644 --- a/test/normalizer_issue_files/E70.py +++ b/test/normalizer_issue_files/E70.py @@ -16,10 +16,6 @@ del a[:]; a.append(42); def f(x): return 2 -#: E704:16 -async def f(x): return 2 - - #: E704:10 def f(x): return 2 * x diff --git a/test/normalizer_issue_files/python2.7.py b/test/normalizer_issue_files/python2.7.py index 08c33f7..5d10739 100644 --- a/test/normalizer_issue_files/python2.7.py +++ b/test/normalizer_issue_files/python2.7.py @@ -8,3 +8,7 @@ foo = ur'This is not possible in Python 3.' # This is actually printing a tuple. #: E275:5 print(1, 2) + +# True and False are not keywords in Python 2 and therefore there's no need for +# a space. +norman = True+False diff --git a/test/normalizer_issue_files/python3.py b/test/normalizer_issue_files/python3.py index 53f6b43..21935ee 100644 --- a/test/normalizer_issue_files/python3.py +++ b/test/normalizer_issue_files/python3.py @@ -3,6 +3,7 @@ from typing import ClassVar, List print(1, 2) + # Annotated function (Issue #29) def foo(x: int) -> int: return x + 1 @@ -17,3 +18,60 @@ class Class: def m(self): 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