Commit db3385d
committed
Ruff does not understand contextlib.suppress
Not entirely clear when F811 started triggering on this pattern (it
didn't 3 months ago but is now unhappy with this).
Use `find_spec` to perform a conditional import rather than recover
from a failing import. This is generally less efficient, but given
it's only done at import it likely doesnt matter.
- successfully importing a module takes about 65ns
- successfully find_spec-ing a module takes about 280ns
- unsuccessfully find_spec-ing a module takes about 21*µ*s
- unsuccessfully importing a modules (then recovering) takes about 26µs1 parent 8c0f5c3 commit db3385d
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
0 commit comments