-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly handle trailing commas that are inside a line's leading non…
- Loading branch information
Showing
8 changed files
with
240 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
zero(one,).two(three,).four(five,) | ||
|
||
func1(arg1).func2(arg2,).func3(arg3).func4(arg4,).func5(arg5) | ||
|
||
# Inner one-element tuple shouldn't explode | ||
func1(arg1).func2(arg1, (one_tuple,)).func3(arg3) | ||
|
||
(a, b, c, d,) = func1(arg1) and func2(arg2) | ||
|
||
|
||
# Example from https://github.com/psf/black/issues/3229 | ||
def refresh_token(self, device_family, refresh_token, api_key): | ||
return self.orchestration.refresh_token( | ||
data={ | ||
"refreshToken": refresh_token, | ||
}, | ||
api_key=api_key, | ||
)["extensions"]["sdk"]["token"] | ||
|
||
|
||
# Edge case where a bug in a working-in-progress version of | ||
# https://github.com/psf/black/pull/3370 causes an infinite recursion. | ||
assert ( | ||
long_module.long_class.long_func().another_func() | ||
== long_module.long_class.long_func()["some_key"].another_func(arg1) | ||
) | ||
|
||
|
||
# output | ||
|
||
|
||
zero( | ||
one, | ||
).two( | ||
three, | ||
).four( | ||
five, | ||
) | ||
|
||
func1(arg1).func2( | ||
arg2, | ||
).func3(arg3).func4( | ||
arg4, | ||
).func5(arg5) | ||
|
||
# Inner one-element tuple shouldn't explode | ||
func1(arg1).func2(arg1, (one_tuple,)).func3(arg3) | ||
|
||
( | ||
a, | ||
b, | ||
c, | ||
d, | ||
) = func1( | ||
arg1 | ||
) and func2(arg2) | ||
|
||
|
||
# Example from https://github.com/psf/black/issues/3229 | ||
def refresh_token(self, device_family, refresh_token, api_key): | ||
return self.orchestration.refresh_token( | ||
data={ | ||
"refreshToken": refresh_token, | ||
}, | ||
api_key=api_key, | ||
)["extensions"]["sdk"]["token"] | ||
|
||
|
||
# Edge case where a bug in a working-in-progress version of | ||
# https://github.com/psf/black/pull/3370 causes an infinite recursion. | ||
assert ( | ||
long_module.long_class.long_func().another_func() | ||
== long_module.long_class.long_func()["some_key"].another_func(arg1) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters