Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

line_length=1 to reduce churn #1092

Merged
merged 2 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion black.py
Original file line number Diff line number Diff line change
Expand Up @@ -2402,7 +2402,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,
}
)