Force Yapf to wrap lines after expression/just before for-loop in list comprehension
Asked Answered
S

0

10

yapf formatter can wrap long lines in the code inside parentheses in the expression in the list comprehension:

threads = [threading.Thread(
    target=worker, args=[q], daemon=True) for _ in range(worker_count)]

I want to wrap just before the for-loop instead:

threads = [threading.Thread(target=worker, args=[q], daemon=True)
           for _ in range(worker_count)]

yapf --help-style doesn't show anything obvious that can help here.

I can add # yapf: disable at the end of the line, to disable yapf. Is there some other way to force different formatting preference?

Current yapf/style settings:

[style]
based_on_style = pep8
column_limit = 89

Version:

>>> import yapf
>>> yapf.__version__
'0.13.2' # the latest on github
Starstarboard answered 29/10, 2016 at 15:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.