Force Yapf to wrap lines after expression / just before loop in list comprehension

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

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

I want to wrap just before for -loop:

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

yapf --help-style shows nothing obvious that might help here.

I can add # yapf: disable to the end of the line to disable yapf. Is there any other way to force formatting?

Current yapf/style settings:

 [style] based_on_style = pep8 column_limit = 89 

Version:

 >>> import yapf >>> yapf.__version__ '0.13.2' # the latest on github 
+6
source share

Source: https://habr.com/ru/post/1011848/


All Articles