| 1 |
first_item, second_item = ( |
| 2 |
some_looooooooong_module.some_looooooooooooooong_function_name( |
| 3 |
first_argument, second_argument, third_argument |
| 4 |
) |
| 5 |
) |
| 6 |
|
| 7 |
some_dict["with_a_long_key"] = ( |
| 8 |
some_looooooooong_module.some_looooooooooooooong_function_name( |
| 9 |
first_argument, second_argument, third_argument |
| 10 |
) |
| 11 |
) |
| 12 |
|
| 13 |
# Make sure it works when the RHS only has one pair of (optional) parens. |
| 14 |
first_item, second_item = ( |
| 15 |
some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name |
| 16 |
) |
| 17 |
|
| 18 |
some_dict["with_a_long_key"] = ( |
| 19 |
some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name |
| 20 |
) |
| 21 |
|
| 22 |
# Make sure chaining assignments work. |
| 23 |
first_item, second_item, third_item, forth_item = m["everything"] = ( |
| 24 |
some_looooooooong_module.some_looooooooooooooong_function_name( |
| 25 |
first_argument, second_argument, third_argument |
| 26 |
) |
| 27 |
) |
| 28 |
|
| 29 |
# Make sure when the RHS's first split at the non-optional paren fits, |
| 30 |
# we split there instead of the outer RHS optional paren. |
| 31 |
first_item, second_item = some_looooooooong_module.some_loooooog_function_name( |
| 32 |
first_argument, second_argument, third_argument |
| 33 |
) |
| 34 |
|
| 35 |
( |
| 36 |
first_item, |
| 37 |
second_item, |
| 38 |
third_item, |
| 39 |
forth_item, |
| 40 |
fifth_item, |
| 41 |
last_item_very_loooooong, |
| 42 |
) = some_looooooooong_module.some_looooooooooooooong_function_name( |
| 43 |
first_argument, second_argument, third_argument |
| 44 |
) |
| 45 |
|
| 46 |
( |
| 47 |
first_item, |
| 48 |
second_item, |
| 49 |
third_item, |
| 50 |
forth_item, |
| 51 |
fifth_item, |
| 52 |
last_item_very_loooooong, |
| 53 |
) = everything = some_looooong_function_name( |
| 54 |
first_argument, second_argument, third_argument |
| 55 |
) |
| 56 |
|
| 57 |
|
| 58 |
# Make sure unsplittable type ignore won't be moved. |
| 59 |
some_kind_of_table[some_key] = util.some_function( # type: ignore # noqa: E501 |
| 60 |
some_arg |
| 61 |
).intersection(pk_cols) |
| 62 |
|
| 63 |
some_kind_of_table[ |
| 64 |
some_key |
| 65 |
] = lambda obj: obj.some_long_named_method() # type: ignore # noqa: E501 |
| 66 |
|
| 67 |
some_kind_of_table[ |
| 68 |
some_key # type: ignore # noqa: E501 |
| 69 |
] = lambda obj: obj.some_long_named_method() |
| 70 |
|
| 71 |
|
| 72 |
# Make when when the left side of assignment plus the opening paren "... = (" is |
| 73 |
# exactly line length limit + 1, it won't be split like that. |
| 74 |
xxxxxxxxx_yyy_zzzzzzzz[ |
| 75 |
xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1) |
| 76 |
] = 1 |
| 77 |
|
| 78 |
|
| 79 |
# Right side of assignment contains un-nested pairs of inner parens. |
| 80 |
some_kind_of_instance.some_kind_of_map[a_key] = ( |
| 81 |
isinstance(some_var, SomeClass) |
| 82 |
and table.something_and_something != table.something_else |
| 83 |
) or ( |
| 84 |
isinstance(some_other_var, BaseClass) and table.something != table.some_other_thing |
| 85 |
) |
| 86 |
|
| 87 |
# Multiple targets |
| 88 |
a = b = ( |
| 89 |
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
| 90 |
) |
| 91 |
|
| 92 |
a = b = c = d = e = f = g = ( |
| 93 |
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh |
| 94 |
) = i = j = ( |
| 95 |
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk |
| 96 |
) |
| 97 |
|
| 98 |
a = ( |
| 99 |
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
| 100 |
) = c |
| 101 |
|
| 102 |
a = ( |
| 103 |
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
| 104 |
) = ( |
| 105 |
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
| 106 |
) = ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd |