python-trio / flake8-async

Highly opinionated linter for Trio code
https://flake8-async.readthedocs.io
MIT License
17 stars 2 forks source link

Add support for the anyio library #120

Closed jakkdl closed 1 year ago

jakkdl commented 1 year ago

Fixes #61 Have fun with this tiny commit :upside_down_face:

Kind of a chore, I maybe should have gone at some parts in different ways, but the library should now have full support for anyio - and all eval files are tested with "trio" replaced with "anyio", looking to see that all the errors are still good, and that there's no instances of "trio" in the output.

If you trigger an error without importing either trio or anyio, the library will default to saying "trio" in error messages. If you trigger an error having imported both, it will say stuff like

sync call ... in async function, use [trio|anyio].open_file(...).

Otherwise it's not too much that's actually changed, just lots of small replacements in a billion places.

jakkdl commented 1 year ago

Fixed all review comments (or disabled functionality and moved out to separate issues). Also did some refactoring to make stuff cleaner, added # NOTRIO and # ANYIO_NO_ERROR (those magic markers should perhaps have some checks that they're not misspelled or something, or use some other way of being more robust)