mirror of
https://github.com/astral-sh/ruff
synced 2026-01-09 15:44:22 -05:00
[flake8-self] Ignore attribute accesses on instance-like variables (SLF001) (#16149)
This commit is contained in:
@@ -548,6 +548,13 @@ pub fn is_dunder(id: &str) -> bool {
|
||||
id.starts_with("__") && id.ends_with("__")
|
||||
}
|
||||
|
||||
/// Whether a name starts and ends with a single underscore.
|
||||
///
|
||||
/// `_a__` is considered neither a dunder nor a sunder name.
|
||||
pub fn is_sunder(id: &str) -> bool {
|
||||
id.starts_with('_') && id.ends_with('_') && !id.starts_with("__") && !id.ends_with("__")
|
||||
}
|
||||
|
||||
/// Return `true` if the [`Stmt`] is an assignment to a dunder (like `__all__`).
|
||||
pub fn is_assignment_to_a_dunder(stmt: &Stmt) -> bool {
|
||||
// Check whether it's an assignment to a dunder, with or without a type
|
||||
|
||||
Reference in New Issue
Block a user