yapf
yapf copied to clipboard
split_complex_comprehension in v0.33.0 is not consistent with v0.32.0
trafficstars
Attempting to format code with v0.33.0
def test():
test = {
key_long_var: [i
for i in val_long_var]
for key_long_var, val_long_var in data.items()
}
However, using v0.32.0
def test():
test = {
key_long_var: [i for i in val_long_var]
for key_long_var, val_long_var in data.items()
}
I am expecting the results in v0.32.0.
This is the yapf arguments that I am using:
yapf --recursive --verbose --in-place --no-local-style --style="{dedent_closing_brackets: True, continuation_indent_width: 8, split_complex_comprehension: True}" .
Repro:
0.33.0
$ pipx run --spec="yapf==0.33.0" yapf --no-local-style --style="{split_complex_comprehension: True}" 2> /dev/null <<EOF
def test():
test = {
key_long_var: [i
for i in val_long_var]
for key_long_var, val_long_var in data.items()
}
EOF
def test():
test = {
key_long_var: [i
for i in val_long_var]
for key_long_var, val_long_var in data.items()
}
0.32.0
$ pipx run --spec="yapf==0.32.0" yapf --no-local-style --style="{split_complex_comprehension: True}" 2> /dev/null <<EOF
def test():
test = {
key_long_var: [i
for i in val_long_var]
for key_long_var, val_long_var in data.items()
}
EOF
def test():
test = {
key_long_var: [i for i in val_long_var]
for key_long_var, val_long_var in data.items()
}
Confirmed this persists with 0.40.0
Git bisected that bb2baba5c2bb645a88f78d0173b3f43780cfb6a0 introduced the change.