psf/black

List concatenation, multiple lines

オープン

#260 opened on 2018/05/26

 (2 件のコメント) (3 件のリアクション) (0 人の担当者)Python (2,693 件のフォーク)batch import
F: linebreakF: symmetryT: enhancementT: stylehelp wanted

Repository metrics

Stars
 (41,258 個のスター)
PR merge metrics
 (平均マージ 7d 22h) (30d で 26 merged PRs)

説明

Probably not a bug, but I was wondering if the code below shouldn't be formatted more like call chains are. I did not expect black to change anything other than quotes in this example. Aligned brackets feel much more readable.

# before
-    search_fields = (
-        ['file__%s' % field for field in FileAdmin.search_fields] +
-        ['resource__%s' % field for field in ResourceAdmin.search_fields]
-    )
# black output
+    search_fields = ["file__%s" % field for field in FileAdmin.search_fields] + [
+        "resource__%s" % field for field in ResourceAdmin.search_fields
+    ]

Operating system: OSX 10.11.6 Python version: 3.6.5 Black version: 18.5b0 Does also happen on master: yes

コントリビューターガイド