How to configure YAPF to use hanging indentation for long argument lists

Viewed 5385

I've using yapf to automatically format my python code. In general I'm very happy with it, but there's a style convention I can't figure out how to configure. When there's a long list of arguments inside a pair of parentheses, which expand beyond the max column_limit (e.g. 80), I'd like it to split them into separate lines, but keeping the indentation of the opening parenthesis if possible. For example:

def func(argument1, argument2, argument3, argument4, argument5, argument6, argument7):
    pass

should become

def func(argument1, 
         argument2, 
         argument3,
         argument4,
         argument5,
         argument6,
         argument7):
    pass

But I can only get it to do:

def func(
    argument1, 
    argument2, 
    argument3,
    argument4,
    argument5,
    argument6,
    argument7):
    pass

Anyone know if what I want is possible? How?

1 Answers
Related