| 1 |
with \ |
| 2 |
make_context_manager1() as cm1, \ |
| 3 |
make_context_manager2() as cm2, \ |
| 4 |
make_context_manager3() as cm3, \ |
| 5 |
make_context_manager4() as cm4 \ |
| 6 |
: |
| 7 |
pass |
| 8 |
|
| 9 |
|
| 10 |
# Leading comment |
| 11 |
with \ |
| 12 |
make_context_manager1() as cm1, \ |
| 13 |
make_context_manager2(), \ |
| 14 |
make_context_manager3() as cm3, \ |
| 15 |
make_context_manager4() \ |
| 16 |
: |
| 17 |
pass |
| 18 |
|
| 19 |
|
| 20 |
with \ |
| 21 |
new_new_new1() as cm1, \ |
| 22 |
new_new_new2() \ |
| 23 |
: |
| 24 |
pass |
| 25 |
|
| 26 |
|
| 27 |
with ( |
| 28 |
new_new_new1() as cm1, |
| 29 |
new_new_new2() |
| 30 |
): |
| 31 |
pass |
| 32 |
|
| 33 |
|
| 34 |
# Leading comment. |
| 35 |
with ( |
| 36 |
# First comment. |
| 37 |
new_new_new1() as cm1, |
| 38 |
# Second comment. |
| 39 |
new_new_new2() |
| 40 |
# Last comment. |
| 41 |
): |
| 42 |
pass |
| 43 |
|
| 44 |
|
| 45 |
with \ |
| 46 |
this_is_a_very_long_call(looong_arg1=looong_value1, looong_arg2=looong_value2) as cm1, \ |
| 47 |
this_is_a_very_long_call(looong_arg1=looong_value1, looong_arg2=looong_value2, looong_arg3=looong_value3, looong_arg4=looong_value4) as cm2 \ |
| 48 |
: |
| 49 |
pass |
| 50 |
|
| 51 |
|
| 52 |
with mock.patch.object( |
| 53 |
self.my_runner, "first_method", autospec=True |
| 54 |
) as mock_run_adb, mock.patch.object( |
| 55 |
self.my_runner, "second_method", autospec=True, return_value="foo" |
| 56 |
): |
| 57 |
pass |
| 58 |
|
| 59 |
|
| 60 |
with xxxxxxxx.some_kind_of_method( |
| 61 |
some_argument=[ |
| 62 |
"first", |
| 63 |
"second", |
| 64 |
"third", |
| 65 |
] |
| 66 |
).another_method() as cmd: |
| 67 |
pass |
| 68 |
|
| 69 |
|
| 70 |
async def func(): |
| 71 |
async with \ |
| 72 |
make_context_manager1() as cm1, \ |
| 73 |
make_context_manager2() as cm2, \ |
| 74 |
make_context_manager3() as cm3, \ |
| 75 |
make_context_manager4() as cm4 \ |
| 76 |
: |
| 77 |
pass |
| 78 |
|
| 79 |
async with some_function( |
| 80 |
argument1, argument2, argument3="some_value" |
| 81 |
) as some_cm, some_other_function( |
| 82 |
argument1, argument2, argument3="some_value" |
| 83 |
): |
| 84 |
pass |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
# don't remove the brackets here, it changes the meaning of the code. |
| 89 |
with (x, y) as z: |
| 90 |
pass |
| 91 |
|
| 92 |
|
| 93 |
# output |
| 94 |
|
| 95 |
|
| 96 |
with ( |
| 97 |
make_context_manager1() as cm1, |
| 98 |
make_context_manager2() as cm2, |
| 99 |
make_context_manager3() as cm3, |
| 100 |
make_context_manager4() as cm4, |
| 101 |
): |
| 102 |
pass |
| 103 |
|
| 104 |
|
| 105 |
# Leading comment |
| 106 |
with ( |
| 107 |
make_context_manager1() as cm1, |
| 108 |
make_context_manager2(), |
| 109 |
make_context_manager3() as cm3, |
| 110 |
make_context_manager4(), |
| 111 |
): |
| 112 |
pass |
| 113 |
|
| 114 |
|
| 115 |
with new_new_new1() as cm1, new_new_new2(): |
| 116 |
pass |
| 117 |
|
| 118 |
|
| 119 |
with new_new_new1() as cm1, new_new_new2(): |
| 120 |
pass |
| 121 |
|
| 122 |
|
| 123 |
# Leading comment. |
| 124 |
with ( |
| 125 |
# First comment. |
| 126 |
new_new_new1() as cm1, |
| 127 |
# Second comment. |
| 128 |
new_new_new2(), |
| 129 |
# Last comment. |
| 130 |
): |
| 131 |
pass |
| 132 |
|
| 133 |
|
| 134 |
with ( |
| 135 |
this_is_a_very_long_call( |
| 136 |
looong_arg1=looong_value1, looong_arg2=looong_value2 |
| 137 |
) as cm1, |
| 138 |
this_is_a_very_long_call( |
| 139 |
looong_arg1=looong_value1, |
| 140 |
looong_arg2=looong_value2, |
| 141 |
looong_arg3=looong_value3, |
| 142 |
looong_arg4=looong_value4, |
| 143 |
) as cm2, |
| 144 |
): |
| 145 |
pass |
| 146 |
|
| 147 |
|
| 148 |
with ( |
| 149 |
mock.patch.object(self.my_runner, "first_method", autospec=True) as mock_run_adb, |
| 150 |
mock.patch.object( |
| 151 |
self.my_runner, "second_method", autospec=True, return_value="foo" |
| 152 |
), |
| 153 |
): |
| 154 |
pass |
| 155 |
|
| 156 |
|
| 157 |
with xxxxxxxx.some_kind_of_method( |
| 158 |
some_argument=[ |
| 159 |
"first", |
| 160 |
"second", |
| 161 |
"third", |
| 162 |
] |
| 163 |
).another_method() as cmd: |
| 164 |
pass |
| 165 |
|
| 166 |
|
| 167 |
async def func(): |
| 168 |
async with ( |
| 169 |
make_context_manager1() as cm1, |
| 170 |
make_context_manager2() as cm2, |
| 171 |
make_context_manager3() as cm3, |
| 172 |
make_context_manager4() as cm4, |
| 173 |
): |
| 174 |
pass |
| 175 |
|
| 176 |
async with ( |
| 177 |
some_function(argument1, argument2, argument3="some_value") as some_cm, |
| 178 |
some_other_function(argument1, argument2, argument3="some_value"), |
| 179 |
): |
| 180 |
pass |
| 181 |
|
| 182 |
|
| 183 |
# don't remove the brackets here, it changes the meaning of the code. |
| 184 |
with (x, y) as z: |
| 185 |
pass |