
- when a trailing comma is specified in any bracket pair, that signals to Black that this bracket pair needs to be always exploded, e.g. presented as "one item per line"; - this causes some changes to previously formatted code that erroneously left trailing commas embedded into single-line expressions; - internally, Black needs to be able to identify trailing commas that it put itself compared to pre-existing trailing commas. We do this by using/abusing lib2to3's `was_checked` attribute. It's True for internally generated trailing commas and False for pre-existing ones (in fact, for all pre-existing leaves and nodes). Fixes #1288
59 lines
1.2 KiB
Python
59 lines
1.2 KiB
Python
def f(
|
|
a,
|
|
**kwargs,
|
|
) -> A:
|
|
with cache_dir():
|
|
if something:
|
|
result = (
|
|
CliRunner().invoke(black.main, [str(src1), str(src2), "--diff", "--check"])
|
|
)
|
|
limited.append(-limited.pop()) # negate top
|
|
return A(
|
|
very_long_argument_name1=very_long_value_for_the_argument,
|
|
very_long_argument_name2=-very.long.value.for_the_argument,
|
|
**kwargs,
|
|
)
|
|
def g():
|
|
"Docstring."
|
|
def inner():
|
|
pass
|
|
print("Inner defs should breathe a little.")
|
|
def h():
|
|
def inner():
|
|
pass
|
|
print("Inner defs should breathe a little.")
|
|
|
|
# output
|
|
|
|
def f(
|
|
a,
|
|
**kwargs,
|
|
) -> A:
|
|
with cache_dir():
|
|
if something:
|
|
result = CliRunner().invoke(
|
|
black.main, [str(src1), str(src2), "--diff", "--check"]
|
|
)
|
|
limited.append(-limited.pop()) # negate top
|
|
return A(
|
|
very_long_argument_name1=very_long_value_for_the_argument,
|
|
very_long_argument_name2=-very.long.value.for_the_argument,
|
|
**kwargs,
|
|
)
|
|
|
|
|
|
def g():
|
|
"Docstring."
|
|
|
|
def inner():
|
|
pass
|
|
|
|
print("Inner defs should breathe a little.")
|
|
|
|
|
|
def h():
|
|
def inner():
|
|
pass
|
|
|
|
print("Inner defs should breathe a little.")
|