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µs
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.