mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
[refurb
] Guard hashlib
imports and mark hashlib-digest-hex
fix as safe (FURB181
) (#14694)
## Summary - Check if `hashlib` and `crypt` imports have been seen for `FURB181` and `S324` - Mark the fix for `FURB181` as safe: I think it was accidentally marked as unsafe in the first place. The rule does not support user-defined classes as the "fix safety" section suggests. - Removed `hashlib._Hash`, as it's not part of the `hashlib` module. <!-- What's the purpose of the change? What does it do, and why? --> ## Test Plan Updated the test snapshots
This commit is contained in:
parent
289a938ae8
commit
48ec3a8add
4 changed files with 33 additions and 23 deletions
|
@ -1411,6 +1411,8 @@ impl<'a> SemanticModel<'a> {
|
|||
"typing_extensions" => self.seen.insert(Modules::TYPING_EXTENSIONS),
|
||||
"attr" | "attrs" => self.seen.insert(Modules::ATTRS),
|
||||
"airflow" => self.seen.insert(Modules::AIRFLOW),
|
||||
"hashlib" => self.seen.insert(Modules::HASHLIB),
|
||||
"crypt" => self.seen.insert(Modules::CRYPT),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
@ -2039,6 +2041,8 @@ bitflags! {
|
|||
const ATTRS = 1 << 25;
|
||||
const REGEX = 1 << 26;
|
||||
const AIRFLOW = 1 << 27;
|
||||
const HASHLIB = 1 << 28;
|
||||
const CRYPT = 1 << 29;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue