From e027fc9e75daadd7e22f12e6e1e374bcca998087 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 28 Oct 2019 07:25:42 -0700 Subject: [PATCH] line_length=1 to reduce churn (#1092) --- black.py | 4 +++- tests/data/collections.py | 7 ++++--- tests/data/composition.py | 25 ++++++++++++++----------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/black.py b/black.py index 5e357ba..00de8d2 100644 --- a/black.py +++ b/black.py @@ -2406,7 +2406,9 @@ def split_line( # All splits failed, best effort split with no omits. # This mostly happens to multiline strings that are by definition # reported as not fitting a single line. - yield from right_hand_split(line, line_length, features=features) + # line_length=1 is silly, but somehow produces better formatting + # than other things we've tried so far. See #762 and #781. + yield from right_hand_split(line, line_length=1, features=features) if line.inside_brackets: split_funcs = [delimiter_split, standalone_comment_split, rhs] diff --git a/tests/data/collections.py b/tests/data/collections.py index d408bf9..ebe8d3c 100644 --- a/tests/data/collections.py +++ b/tests/data/collections.py @@ -144,9 +144,10 @@ division_result_tuple = (6 / 2,) print("foo %r", (foo.bar,)) if True: - IGNORED_TYPES_FOR_ATTRIBUTE_CHECKING = Config.IGNORED_TYPES_FOR_ATTRIBUTE_CHECKING | { - pylons.controllers.WSGIController - } + IGNORED_TYPES_FOR_ATTRIBUTE_CHECKING = ( + Config.IGNORED_TYPES_FOR_ATTRIBUTE_CHECKING + | {pylons.controllers.WSGIController} + ) if True: ec2client.get_waiter("instance_stopped").wait( diff --git a/tests/data/composition.py b/tests/data/composition.py index 31f5bd5..ac63e46 100644 --- a/tests/data/composition.py +++ b/tests/data/composition.py @@ -166,14 +166,17 @@ class C: _C.__init__.__code__.co_firstlineno + 1, ) - assert expectedexpectedexpectedexpectedexpectedexpectedexpectedexpectedexpect == { - key1: value1, - key2: value2, - key3: value3, - key4: value4, - key5: value5, - key6: value6, - key7: value7, - key8: value8, - key9: value9, - } + assert ( + expectedexpectedexpectedexpectedexpectedexpectedexpectedexpectedexpect + == { + key1: value1, + key2: value2, + key3: value3, + key4: value4, + key5: value5, + key6: value6, + key7: value7, + key8: value8, + key9: value9, + } + ) -- 2.39.5