Commit 791fc88
committed
Only flag __aenter__ when neither CM method checkpoints
When both `__aenter__` and `__aexit__` are defined and neither contains
a checkpoint, we used to flag (and autofix) both methods, which produced
redundant `lowlevel.checkpoint()` calls -- only one is needed for the
async context manager to checkpoint.
Prefer to report and fix `__aenter__` in this case; `__aexit__` is
exempted since adding a checkpoint to either satisfies the rule.
https://claude.ai/code/session_014jAydKywq31Ew4fVYGJdiG1 parent f2968d4 commit 791fc88
4 files changed
Lines changed: 14 additions & 15 deletions
File tree
- flake8_async/visitors
- tests
- autofix_files
- eval_files
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
590 | 590 | | |
591 | 591 | | |
592 | 592 | | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
599 | 603 | | |
600 | 604 | | |
601 | 605 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
677 | | - | |
| 677 | + | |
678 | 678 | | |
679 | | - | |
680 | 679 | | |
681 | 680 | | |
682 | 681 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
233 | 233 | | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | 234 | | |
239 | 235 | | |
240 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
643 | 643 | | |
644 | 644 | | |
645 | 645 | | |
646 | | - | |
| 646 | + | |
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
| |||
0 commit comments