Skip to content

Commit

Permalink
Remove trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
dflook committed Oct 14, 2024
1 parent 8002d50 commit 4cc8487
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 105 deletions.
4 changes: 2 additions & 2 deletions test/test_assignment_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def test_pep():
if a := True:
print(a)
if self._is_special and (ans := self._check_nans(context=context)):
return ans
return ans
results = [(x, y, x/y) for x in input_data if (y := f(x)) > 0]
stuff = [[y := f(x), x/y] for x in range(5)]
stuff = [[y := f(x), x/y] for x in range(5)]
'''

expected_ast = ast.parse(source)
Expand Down
8 changes: 4 additions & 4 deletions test/test_bind_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ class LazyList:
try:
pass
except Exception as MyNonLocal:
pass
pass
'''

Expand Down Expand Up @@ -1237,7 +1237,7 @@ class LazyList:
MyAttribute = MyNonLocal
match Blah:
case MyNonLocal:
pass
pass
'''

expected_namespaces = '''
Expand Down Expand Up @@ -1293,7 +1293,7 @@ class LazyList:
MyAttribute = MyNonLocal
match Blah:
case [*MyNonLocal]:
pass
pass
'''

expected_namespaces = '''
Expand Down Expand Up @@ -1349,7 +1349,7 @@ class LazyList:
MyAttribute = MyNonLocal
match Blah:
case {**MyNonLocal}:
pass
pass
'''

expected_namespaces = '''
Expand Down
2 changes: 1 addition & 1 deletion test/test_combine_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_import_from():
from builtins import help
import collections
from collections import abc'''
expected = '''from builtins import dir, help
expected = '''from builtins import dir, help
import collections
from collections import abc'''

Expand Down
16 changes: 8 additions & 8 deletions test/test_hoist_literals.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def a():
for i in (a for a in 'Hello'):
pass
for i in (a for a in 'World'):
pass
pass
return 'World'
def c():
return 'Hello'
Expand All @@ -345,7 +345,7 @@ def a():
for i in (a for a in A):
pass
for i in (a for a in B):
pass
pass
return B
def c():
return A
Expand All @@ -363,7 +363,7 @@ def a():
for i in [a for a in 'Hello']:
pass
for i in [a for a in 'World']:
pass
pass
return 'World'
def c():
return 'Hello'
Expand All @@ -377,7 +377,7 @@ def a():
for i in [a for a in A]:
pass
for i in [a for a in B]:
pass
pass
return B
def c():
return A
Expand All @@ -398,7 +398,7 @@ def a():
for i in {a: a for a in 'Hello'}:
pass
for i in {a: a for a in 'World'}:
pass
pass
return 'World'
def c():
return 'Hello'
Expand All @@ -412,7 +412,7 @@ def a():
for i in {a: a for a in A}:
pass
for i in {a: a for a in B}:
pass
pass
return B
def c():
return A
Expand All @@ -432,7 +432,7 @@ class a:
def a():
for i in {a for a in 'Hello' + 'Hello' + 'World'}:
pass
return 'World'
return 'World'
def c():
return 'World'
'''
Expand All @@ -443,7 +443,7 @@ class a:
def a():
B = 'Hello'
for i in {a for a in B + B + A}:
pass
pass
return A
def c():
return A
Expand Down
6 changes: 3 additions & 3 deletions test/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_pep635_unparse():
match node:
case BinOp("+", a, BinOp("*", b, c)):
pass
pass
match json_pet:
case {"type": "cat", "name": name, "pattern": pattern}:
Expand Down Expand Up @@ -314,15 +314,15 @@ def test_match_unparse():
match a:
case 0|(0|0): pass
case (0|0)|0: pass
case (0|0)|0: pass
case 0|0|0: pass
match (lambda: a)():
case [action, obj]:pass
match a:= h:
case [action, obj]:pass
case {**rest}: pass
case {**rest}: pass
'''

expected_ast = ast.parse(source)
Expand Down
56 changes: 28 additions & 28 deletions test/test_match_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def func():
case hello: pass
match 'hello' + 'hello':
case 'hello': pass
case 'hello': pass
'''
expected = '''
B='hello'
Expand All @@ -66,7 +66,7 @@ def C():
case hello: pass
match B + B:
case 'hello': pass
case 'hello': pass
'''

expected_ast = ast.parse(expected)
Expand Down Expand Up @@ -105,7 +105,7 @@ def func(expensive_rename):
case None: pass
match B + B + B:
case 'hello': pass
case 'hello': pass
'''

expected_ast = ast.parse(expected)
Expand All @@ -125,8 +125,8 @@ def func(expensive_rename):
hello=0
match None:
case None if hello + hello + hello + hello: pass
case None if expensive_rename: pass
case 'hello' if 'hello' + 'hello' + 'hello' + 'hello': pass
case None if expensive_rename: pass
case 'hello' if 'hello' + 'hello' + 'hello' + 'hello': pass
'''
expected = '''
match None:
Expand All @@ -138,7 +138,7 @@ def func(expensive_rename):
match None:
case None if A + A + A + A: pass
case None if expensive_rename: pass
case 'hello' if B + B + B + B: pass
case 'hello' if B + B + B + B: pass
'''

expected_ast = ast.parse(expected)
Expand All @@ -154,29 +154,29 @@ def test_rename_guard_global():
sausage=0
match None:
case None if sausage + sausage + sausage + sausage: pass
case 'hello' if 'hello' + 'hello' + 'hello' + 'hello': pass
case 'hello' if 'hello' + 'hello' + 'hello' + 'hello': pass
def func(expensive_rename):
hello=0
match None:
case None if hello + hello + hello + hello: pass
case None if expensive_rename: pass
case 'hello' if 'hello' + 'hello' + 'hello' + 'hello': pass
case None if expensive_rename: pass
case 'hello' if 'hello' + 'hello' + 'hello' + 'hello': pass
'''

expected = '''
A='hello'
B=0
match None:
case None if B + B + B + B: pass
case 'hello' if A + A + A + A: pass
case 'hello' if A + A + A + A: pass
def C(expensive_rename):
hello=0
match None:
case None if hello + hello + hello + hello: pass
case None if expensive_rename: pass
case 'hello' if A + A + A + A: pass
case None if expensive_rename: pass
case 'hello' if A + A + A + A: pass
'''

expected_ast = ast.parse(expected)
Expand All @@ -197,19 +197,19 @@ def func(expensive_rename):
hello=0
match None:
case None: hello + hello + hello + hello
case None: expensive_rename
case None: expensive_rename
'''

expected = '''
sausage=0
sausage=0
match None:
case None: sausage + sausage + sausage + sausage
def func(expensive_rename):
A=0
match None:
case None: A + A + A + A
case None: expensive_rename
case None: expensive_rename
'''

expected_ast = ast.parse(expected)
Expand All @@ -222,15 +222,15 @@ def test_rename_body_global():
pytest.skip('Match statement not in python < 3.10')

source = '''
sausage=0
sausage=0
match None:
case None: sausage + sausage + sausage + sausage
def func(expensive_rename):
hello=0
match None:
case None: hello + hello + hello + hello
case None: expensive_rename
case None: expensive_rename
'''

expected = '''
Expand All @@ -242,7 +242,7 @@ def B(expensive_rename):
hello=0
match None:
case None: hello + hello + hello + hello
case None: expensive_rename
case None: expensive_rename
'''

expected_ast = ast.parse(expected)
Expand All @@ -263,19 +263,19 @@ class Global: pass
case ['hello', 'hello', 'hello', 'hello']: pass
case [None, None, None, None]: pass
case [True, True, True, True]: pass
case [False, False, False, False]: pass
case [False, False, False, False]: pass
def func(expensive_rename):
class Local: pass
match None:
case expensive_rename(a, b) if a: b
case Global(d, e) if d: e
case Local(f, g) if f: g
case Local(f, g) if f: g
case ['hello', 'hello', 'hello', 'hello']: pass
case [None, None, None, None]: pass
case [True, True, True, True]: pass
case [False, False, False, False]: pass
case [False, False, False, False]: pass
'''

expected = '''
Expand All @@ -287,7 +287,7 @@ class Global: pass
case ['hello', 'hello', 'hello', 'hello']: pass
case [None, None, None, None]: pass
case [True, True, True, True]: pass
case [False, False, False, False]: pass
case [False, False, False, False]: pass
def func(expensive_rename):
class A: pass
Expand All @@ -299,7 +299,7 @@ class A: pass
case ['hello', 'hello', 'hello', 'hello']: pass
case [None, None, None, None]: pass
case [True, True, True, True]: pass
case [False, False, False, False]: pass
case [False, False, False, False]: pass
'''

expected_ast = ast.parse(expected)
Expand All @@ -319,19 +319,19 @@ class Global: pass
case ['hello', 'hello', 'hello', 'hello']: pass
case [None, None, None, None]: pass
case [True, True, True, True]: pass
case [False, False, False, False]: pass
case [False, False, False, False]: pass
def func(expensive_rename):
class Local: pass
match None:
case expensive_rename(a, b) if a: b
case Global(d, e) if d: e
case Local(f, g) if f: g
case Local(f, g) if f: g
case ['hello', 'hello', 'hello', 'hello']: pass
case [None, None, None, None]: pass
case [True, True, True, True]: pass
case [False, False, False, False]: pass
case [False, False, False, False]: pass
'''

expected = '''
Expand All @@ -342,7 +342,7 @@ class A: pass
case ['hello', 'hello', 'hello', 'hello']: pass
case [None, None, None, None]: pass
case [True, True, True, True]: pass
case [False, False, False, False]: pass
case [False, False, False, False]: pass
def D(expensive_rename):
class Local: pass
Expand All @@ -354,7 +354,7 @@ class Local: pass
case ['hello', 'hello', 'hello', 'hello']: pass
case [None, None, None, None]: pass
case [True, True, True, True]: pass
case [False, False, False, False]: pass
case [False, False, False, False]: pass
'''

expected_ast = ast.parse(expected)
Expand Down
2 changes: 1 addition & 1 deletion test/test_nonlocal.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def inner():
rename_me = 'inner'
inner()
rename_me = False
rename_me = False
outer()
return rename_me
Expand Down
2 changes: 1 addition & 1 deletion test/test_remove_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ class Dummy(TypedDict):
class Dummy(HypedDict):
myfield: 0
mysecondfile: 0
mysecondfile: 0
class Dummy(typing.TypedDict):
myfield: int
Expand Down
Loading

0 comments on commit 4cc8487

Please sign in to comment.