google / google/yapf

Dictionaries in dict list open and close on the same line

Open
#934 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

Hi, I'm trying to configure yapf in such a way that I can have dict lists that look like this:

```python
my_list = [
{
'key1': 'val1',
'key2': 'val2',
},
{
'key1': 'val1',
'key2': 'val2',
}
]
```

while yapf likes to format them like this:

```python
my_list = [
{
'key1': 'val1',
'key2': 'val2',
}, { # this close and open bracket on the same line is what I want to avoid
'key1': 'val1',
'key2': 'val2',
}
]
```

here's my current config:

```ini
[style]
based_on_style = pep8
split_before_first_argument = true
dedent_closing_brackets = true
```

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.