add the "__prepare__" method to the list of recognized dunder method (#9529)

## Summary
Closes #9508 .
Add `__prepare__` method to dunder method list in
`is_known_dunder_method`.

## Test Plan
1. add "__prepare__" method to `Apple` class in
crates/ruff_linter/resources/test/fixtures/pylint/bad_dunder_method_name.py.
2. run `cargo test`
This commit is contained in:
yataka
2024-01-15 23:37:19 +09:00
committed by GitHub
parent 66804eca6d
commit 0753968ef3
2 changed files with 5 additions and 0 deletions

View File

@@ -87,6 +87,10 @@ class Apples:
def __special_custom_magic__(self):
pass
@classmethod
def __prepare__():
pass
def __foo_bar__(): # this is not checked by the [bad-dunder-name] rule
...

View File

@@ -289,6 +289,7 @@ pub(super) fn is_known_dunder_method(method: &str) -> bool {
| "__pos__"
| "__post_init__"
| "__pow__"
| "__prepare__"
| "__radd__"
| "__rand__"
| "__rdivmod__"