[flake8-async] Update ASYNC109 to match upstream (#12236)

## Summary

Update the name of `ASYNC109` to match
[upstream](https://flake8-async.readthedocs.io/en/latest/rules.html).

Also update to the functionality to match upstream by supporting
additional context managers from `asyncio` and `anyio`. This doesn't
change any of the detection functionality, but recommends additional
context managers from `asyncio` and `anyio` depending on context.

Part of https://github.com/astral-sh/ruff/issues/12039.

## Test Plan

Added fixture for asyncio recommendation
This commit is contained in:
Auguste Lalande 2024-07-09 00:14:27 -04:00 committed by GitHub
parent 10f07d88a2
commit 16a63c88cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 147 additions and 27 deletions

View file

@ -1231,6 +1231,7 @@ impl<'a> SemanticModel<'a> {
pub fn add_module(&mut self, module: &str) {
match module {
"_typeshed" => self.seen.insert(Modules::TYPESHED),
"anyio" => self.seen.insert(Modules::ANYIO),
"builtins" => self.seen.insert(Modules::BUILTINS),
"collections" => self.seen.insert(Modules::COLLECTIONS),
"contextvars" => self.seen.insert(Modules::CONTEXTVARS),
@ -1822,6 +1823,7 @@ bitflags! {
const DATACLASSES = 1 << 17;
const BUILTINS = 1 << 18;
const CONTEXTVARS = 1 << 19;
const ANYIO = 1 << 20;
}
}