google / google/yapf

Unpacked ternary expressions in dict literals are not reformatted.

Open
#801 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14k
Forks
904
PR merge metrics
No merged PRs in 30d

Description

Using Google style, this is above the line length limit:

```python
x = {
**(sdfdsfs if sdfdsfdsfdsf else sdfdsfdsfdsfdsfdsfsdfdsfsfdsfdsfdsfdsfdsfdsdfs),
}
```

I expected YAPF to do something to get it below the line length limit, but nothing happened. The same ternary expression in a tuple unpacking is reformatted like I'd expect:

```python
x = (
None,
*(sdfdsfs
if sdfdsfdsfdsf else sdfdsfdsfdsfdsfdsfsdfdsfsfdsfdsfdsfdsfdsfdsdfs),
)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.