mirror of
https://github.com/davidhalter/parso.git
synced 2026-01-02 17:43:43 +08:00
Fix the E20 errors.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
if x > 2:
|
||||
#: E111:2
|
||||
print x
|
||||
print(x)
|
||||
if True:
|
||||
#: E111:5
|
||||
print
|
||||
|
||||
@@ -60,14 +60,12 @@ rv.update(dict.fromkeys((
|
||||
'?'),
|
||||
"foo")
|
||||
|
||||
#: E126+1:10 E126+2:10
|
||||
abricot = 3 + \
|
||||
4 + \
|
||||
5 + 6
|
||||
print "hello", (
|
||||
|
||||
"there",
|
||||
#: E131:5
|
||||
# "john",
|
||||
"dude")
|
||||
part = set_mimetype((
|
||||
|
||||
@@ -216,7 +216,7 @@ if (a == 2 or
|
||||
"jkl mno"):
|
||||
return True
|
||||
|
||||
#: E129+1:4 E127+2:9
|
||||
#: E129+1:4
|
||||
if (a == 2 or
|
||||
b == """abc def ghi
|
||||
jkl mno"""):
|
||||
|
||||
@@ -93,7 +93,7 @@ help = ur"print total number of errors " \
|
||||
help = b"print total number of errors " \
|
||||
b"to standard error"
|
||||
|
||||
#: E126+1:5
|
||||
#: E122+1:5
|
||||
help = br"print total number of errors " \
|
||||
br"to standard error"
|
||||
|
||||
|
||||
@@ -134,11 +134,11 @@ my_list = [
|
||||
4, 5, 6,
|
||||
#: E123:8
|
||||
]
|
||||
#: E126+1:8 E126+2:8
|
||||
|
||||
abris = 3 + \
|
||||
4 + \
|
||||
5 + 6
|
||||
#: E126+1:8
|
||||
|
||||
fixed = re.sub(r'\t+', ' ', target[c::-1], 1)[::-1] + \
|
||||
target[c + 1:]
|
||||
|
||||
@@ -156,25 +156,26 @@ eat_a_dict_a_day({
|
||||
#: E129+1:4
|
||||
if (
|
||||
x == (
|
||||
#: E126:12
|
||||
3
|
||||
#: E129:4
|
||||
) or
|
||||
y == 4):
|
||||
pass
|
||||
#: E129+1:4 E129+4:4
|
||||
#: E129+1:4 E121+2:8 E129+3:4
|
||||
if (
|
||||
x == (
|
||||
3
|
||||
) or
|
||||
x == (
|
||||
#: E126:12
|
||||
x == (
|
||||
# This one has correct indentation.
|
||||
3
|
||||
#: E129:4
|
||||
) or
|
||||
y == 4):
|
||||
pass
|
||||
troublesome_hash = {
|
||||
"hash": "value",
|
||||
#: E131+1:8
|
||||
#: E135+1:8
|
||||
"long": "the quick brown fox jumps over the lazy dog before doing a "
|
||||
"somersault",
|
||||
}
|
||||
|
||||
@@ -58,10 +58,13 @@ rv.update(d=('a', 'b', 'c'),
|
||||
#: E127:13
|
||||
e=42)
|
||||
|
||||
#: E127+2:17
|
||||
#: E135+2:17
|
||||
rv.update(d=('a' + 'b', 'c'),
|
||||
e=42, f=42
|
||||
+ 42)
|
||||
rv.update(d=('a' + 'b', 'c'),
|
||||
e=42, f=42
|
||||
+ 42)
|
||||
#: E127+1:26
|
||||
input1 = {'a': {'calc': 1 + 2}, 'b': 1
|
||||
+ 42}
|
||||
@@ -102,7 +105,7 @@ print dedent(
|
||||
mkdir -p ./{build}/
|
||||
mv ./build/ ./{build}/%(revision)s/
|
||||
'''.format(
|
||||
#: E121:4 E121+1:5 E123+2:0
|
||||
#: E121:4 E123+2:0
|
||||
build='build',
|
||||
# more stuff
|
||||
)
|
||||
@@ -112,5 +115,5 @@ if True:\
|
||||
print(True)
|
||||
|
||||
#: E128+1
|
||||
print(a
|
||||
foobar(a
|
||||
, end=' ')
|
||||
|
||||
53
test/normalizer_issue_files/E20.py
Normal file
53
test/normalizer_issue_files/E20.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#: E201:5
|
||||
spam( ham[1], {eggs: 2})
|
||||
#: E201:9
|
||||
spam(ham[ 1], {eggs: 2})
|
||||
#: E201:14
|
||||
spam(ham[1], { eggs: 2})
|
||||
|
||||
# Okay
|
||||
spam(ham[1], {eggs: 2})
|
||||
|
||||
|
||||
#: E202:22
|
||||
spam(ham[1], {eggs: 2} )
|
||||
#: E202:21
|
||||
spam(ham[1], {eggs: 2 })
|
||||
#: E202:10
|
||||
spam(ham[1 ], {eggs: 2})
|
||||
# Okay
|
||||
spam(ham[1], {eggs: 2})
|
||||
|
||||
result = func(
|
||||
arg1='some value',
|
||||
arg2='another value',
|
||||
)
|
||||
|
||||
result = func(
|
||||
arg1='some value',
|
||||
arg2='another value'
|
||||
)
|
||||
|
||||
result = [
|
||||
item for item in items
|
||||
if item > 5
|
||||
]
|
||||
|
||||
#: E203:9
|
||||
if x == 4 :
|
||||
print 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
|
||||
#: E203:12
|
||||
x, y = y , x
|
||||
# Okay
|
||||
if x == 4:
|
||||
print x, y
|
||||
x, y = y, x
|
||||
a[b1, :] == a[b1, ...]
|
||||
a[b1, :1] == 3
|
||||
b = a[:, b1]
|
||||
Reference in New Issue
Block a user