Hi,
I took a look at yapf and I think it can get closer to our preferences.
I used the following config (you can easily adapt it its command line syntax or configuration file if you want):
yapf_api.FormatFile(archive, style_config=dict(
ALLOW_SPLIT_BEFORE_DEFAULT_OR_NAMED_ASSIGNS=False,
SPLIT_BEFORE_NAMED_ASSIGNS=False,
ARITHMETIC_PRECEDENCE_INDICATION=True,
COALESCE_BRACKETS=True,
COLUMN_LIMIT=80,
CONTINUATION_ALIGN_STYLE='FIXED',
CONTINUATION_SCOPE_INDENT=True,
CONTINUATION_INDENT_WIDTH=0,
EACH_DICT_ENTRY_ON_SEPARATE_LINE=True,
FORCE_MULTILINE_DICT=False,
INDENT_DICTIONARY_VALUE=True,
SPLIT_BEFORE_CLOSING_BRACKET=False,
), in_place=True)
One of the parameters (CONTINUATION_SCOPE_INDENT) requires the use of this fork/commit I created which honours the rule of adding as many indents as parenthesis have been opened in the previous lines.
One missing would be to add an extra indent when the line is a for/with/if/while/etc. And also to make the closing brackets to be closed at that same indent level. But have not looked at any of those, just wanted a proof of concept and seems simple enough.
For me, the result is pretty good and could probably be improved further yet for me it is much better than black.
One of the issues I see with black is that it easily creates 20% more lines of code than with our existing style, which means that you have in screen 20% less code at any given time.