mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-15 16:10:17 +00:00
[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:
parent
10f07d88a2
commit
16a63c88cf
12 changed files with 147 additions and 27 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue