Allow more immutable funcs for RUF009 (#4660)

This commit is contained in:
qdegraaf 2023-05-26 21:18:52 +02:00 committed by GitHub
parent 12e45498e8
commit ccca11839a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 155 additions and 173 deletions

View file

@ -201,12 +201,18 @@ pub fn is_immutable_annotation(model: &SemanticModel, expr: &Expr) -> bool {
}
const IMMUTABLE_FUNCS: &[&[&str]] = &[
&["", "tuple"],
&["", "bool"],
&["", "complex"],
&["", "float"],
&["", "frozenset"],
&["", "int"],
&["", "str"],
&["", "tuple"],
&["datetime", "date"],
&["datetime", "datetime"],
&["datetime", "timedelta"],
&["decimal", "Decimal"],
&["fractions", "Fraction"],
&["operator", "attrgetter"],
&["operator", "itemgetter"],
&["operator", "methodcaller"],