mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-08 21:54:54 +08:00
Get tox -e py27 working.
This commit is contained in:
@@ -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
|
||||
""")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
if x > 2:
|
||||
#: E111:2
|
||||
print(x)
|
||||
hello(x)
|
||||
if True:
|
||||
#: E111:5
|
||||
print
|
||||
|
||||
@@ -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]))
|
||||
|
||||
|
||||
@@ -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])
|
||||
|
||||
@@ -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]))
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user