mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:10:09 +00:00
Avoid triggering SIM117 for async with statements
This commit is contained in:
parent
d71a615b18
commit
396be5edea
2 changed files with 14 additions and 2 deletions
|
@ -16,3 +16,15 @@ with A() as a:
|
||||||
with B() as b:
|
with B() as b:
|
||||||
print("hello")
|
print("hello")
|
||||||
a()
|
a()
|
||||||
|
|
||||||
|
async with A() as a:
|
||||||
|
with B() as b:
|
||||||
|
print("hello")
|
||||||
|
|
||||||
|
with A() as a:
|
||||||
|
async with B() as b:
|
||||||
|
print("hello")
|
||||||
|
|
||||||
|
async with A() as a:
|
||||||
|
async with B() as b:
|
||||||
|
print("hello")
|
||||||
|
|
|
@ -1279,7 +1279,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StmtKind::With { items, body, .. } | StmtKind::AsyncWith { items, body, .. } => {
|
StmtKind::With { items, body, .. } => {
|
||||||
if self.settings.enabled.contains(&RuleCode::B017) {
|
if self.settings.enabled.contains(&RuleCode::B017) {
|
||||||
flake8_bugbear::rules::assert_raises_exception(self, stmt, items);
|
flake8_bugbear::rules::assert_raises_exception(self, stmt, items);
|
||||||
}
|
}
|
||||||
|
@ -1291,7 +1291,7 @@ where
|
||||||
self,
|
self,
|
||||||
stmt,
|
stmt,
|
||||||
body,
|
body,
|
||||||
self.current_stmt_parent().map(|parent| parent.0),
|
self.current_stmt_parent().map(Into::into),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue