Skip to content

Commit

Permalink
line_length=1 to reduce churn (#1092)
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra authored and ambv committed Oct 28, 2019
1 parent 6dca527 commit e027fc9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
4 changes: 3 additions & 1 deletion black.py
Original file line number Diff line number Diff line change
Expand Up @@ -2406,7 +2406,9 @@ def rhs(line: Line, features: Collection[Feature]) -> Iterator[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]
Expand Down
7 changes: 4 additions & 3 deletions tests/data/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@
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(
Expand Down
25 changes: 14 additions & 11 deletions tests/data/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,17 @@ def tricky_asserts(self) -> None:
_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,
}
)

0 comments on commit e027fc9

Please sign in to comment.