mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-23 04:55:09 +00:00
Improve TypedDict
conversion logic for shadowed builtins and dunder methods (#5038)
## Summary This PR (1) avoids flagging `TypedDict` and `NamedTuple` conversions when attributes are dunder methods, like `__dict__`, and (2) avoids flagging the `A003` shadowed-attribute rule for `TypedDict` classes at all, where it doesn't really apply (since those attributes are only accessed via subscripting anyway). Closes #5027.
This commit is contained in:
parent
4080f36850
commit
ab11dd08df
9 changed files with 78 additions and 49 deletions
|
@ -546,7 +546,7 @@ where
|
|||
body.iter().any(|stmt| any_over_stmt(stmt, func))
|
||||
}
|
||||
|
||||
fn is_dunder(id: &str) -> bool {
|
||||
pub fn is_dunder(id: &str) -> bool {
|
||||
id.starts_with("__") && id.ends_with("__")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue