yapf icon indicating copy to clipboard operation
yapf copied to clipboard

Dictionaries in dict list open and close on the same line

Open GabMus opened this issue 4 years ago • 0 comments

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

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

while yapf likes to format them like this:

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:

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

GabMus avatar Jul 06 '21 07:07 GabMus