Skip to content

Commit 487a587

Browse files
committed
add comments to improve the diff parsing
1 parent e457cb5 commit 487a587

3 files changed

Lines changed: 31 additions & 24 deletions

File tree

tests/autofix_files/async100.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,21 +225,24 @@ async def nursery_exit_blocks_with_start():
225225
async def autofix_multi_withitem():
226226
with open("foo"): # error: 9, "trio", "CancelScope"
227227
...
228+
229+
# this one is completely removed
228230
# error: 8, "trio", "CancelScope"
229231
# error: 8, "trio", "CancelScope"
230232
...
231233

234+
# these keep the `open`
232235
with (
233-
open("") as _, # error: 8, "trio", "fail_after"
236+
open("aa") as _, # error: 8, "trio", "fail_after"
234237
):
235238
...
236239

237240
with (
238-
open("") as _, # error: 8, "trio", "move_on_after"
241+
open("bb") as _, # error: 8, "trio", "move_on_after"
239242
):
240243
...
241244

242245
with (
243-
open("") as f,
246+
open("cc") as f,
244247
):
245248
...

tests/autofix_files/async100.py.diff

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -189,41 +189,42 @@
189189

190190

191191
# async100 does not consider *redundant* cancel scopes
192-
@@ x,29 x,23 @@
192+
@@ x,32 x,26 @@
193193

194194

195195
async def autofix_multi_withitem():
196196
- with trio.CancelScope(), open("foo"): # error: 9, "trio", "CancelScope"
197-
- ...
198197
+ with open("foo"): # error: 9, "trio", "CancelScope"
199-
+ ...
198+
...
199+
200+
# this one is completely removed
201+
- with (
202+
- trio.CancelScope(), # error: 8, "trio", "CancelScope"
203+
- trio.CancelScope(), # error: 8, "trio", "CancelScope"
204+
- ):
205+
- ...
200206
+ # error: 8, "trio", "CancelScope"
201207
+ # error: 8, "trio", "CancelScope"
202208
+ ...
203-
+
204-
with (
205-
- trio.CancelScope(), # error: 8, "trio", "CancelScope"
206-
- trio.CancelScope(), # error: 8, "trio", "CancelScope"
207-
+ open("") as _, # error: 8, "trio", "fail_after"
208-
):
209-
...
210209

210+
# these keep the `open`
211211
with (
212-
- open("") as _,
212+
- open("aa") as _,
213213
- trio.fail_after(10), # error: 8, "trio", "fail_after"
214-
+ open("") as _, # error: 8, "trio", "move_on_after"
214+
+ open("aa") as _, # error: 8, "trio", "fail_after"
215215
):
216216
...
217217

218218
with (
219219
- trio.fail_after(5), # error: 8, "trio", "fail_after"
220-
- open("") as _,
220+
- open("bb") as _,
221221
- trio.move_on_after(5), # error: 8, "trio", "move_on_after"
222-
- ):
223-
- ...
224-
-
225-
- with (
222+
+ open("bb") as _, # error: 8, "trio", "move_on_after"
223+
):
224+
...
225+
226+
with (
226227
- trio.move_on_after(10), # error: 8, "trio", "move_on_after"
227-
open("") as f,
228+
open("cc") as f,
228229
):
229230
...

tests/eval_files/async100.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,27 +225,30 @@ async def nursery_exit_blocks_with_start():
225225
async def autofix_multi_withitem():
226226
with trio.CancelScope(), open("foo"): # error: 9, "trio", "CancelScope"
227227
...
228+
229+
# this one is completely removed
228230
with (
229231
trio.CancelScope(), # error: 8, "trio", "CancelScope"
230232
trio.CancelScope(), # error: 8, "trio", "CancelScope"
231233
):
232234
...
233235

236+
# these keep the `open`
234237
with (
235-
open("") as _,
238+
open("aa") as _,
236239
trio.fail_after(10), # error: 8, "trio", "fail_after"
237240
):
238241
...
239242

240243
with (
241244
trio.fail_after(5), # error: 8, "trio", "fail_after"
242-
open("") as _,
245+
open("bb") as _,
243246
trio.move_on_after(5), # error: 8, "trio", "move_on_after"
244247
):
245248
...
246249

247250
with (
248251
trio.move_on_after(10), # error: 8, "trio", "move_on_after"
249-
open("") as f,
252+
open("cc") as f,
250253
):
251254
...

0 commit comments

Comments
 (0)