From adea49ee41a6839ce07be133dd3728c5d95cc96e Mon Sep 17 00:00:00 2001 From: Dhruv Manilawala Date: Thu, 7 Nov 2024 09:33:28 +0530 Subject: [PATCH 1/2] Update known dunder methods for Python 3.13 --- crates/ruff_linter/src/rules/pylint/helpers.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/ruff_linter/src/rules/pylint/helpers.rs b/crates/ruff_linter/src/rules/pylint/helpers.rs index 6091a9a6ca60e..876c6776e933b 100644 --- a/crates/ruff_linter/src/rules/pylint/helpers.rs +++ b/crates/ruff_linter/src/rules/pylint/helpers.rs @@ -265,6 +265,7 @@ pub(super) fn is_known_dunder_method(method: &str) -> bool { | "__reduce__" | "__reduce_ex__" | "__release_buffer__" + | "__replace__" | "__repr__" | "__reversed__" | "__rfloordiv__" @@ -297,11 +298,13 @@ pub(super) fn is_known_dunder_method(method: &str) -> bool { | "__xor__" // Overridable sunder names from the `Enum` class. // See: https://docs.python.org/3/library/enum.html#supported-sunder-names + | "_add_alias_" + | "_add_value_alias_" | "_name_" | "_value_" | "_missing_" | "_ignore_" | "_order_" | "_generate_next_value_" - ) + ) || method.starts_with("_repr_") } From 4665ff29b6768672214c8d6bd0d1116ff4576aaf Mon Sep 17 00:00:00 2001 From: Dhruv Manilawala Date: Thu, 7 Nov 2024 11:06:49 +0530 Subject: [PATCH 2/2] Remove `_repr_*` --- crates/ruff_linter/src/rules/pylint/helpers.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ruff_linter/src/rules/pylint/helpers.rs b/crates/ruff_linter/src/rules/pylint/helpers.rs index 876c6776e933b..7f6959341d27b 100644 --- a/crates/ruff_linter/src/rules/pylint/helpers.rs +++ b/crates/ruff_linter/src/rules/pylint/helpers.rs @@ -306,5 +306,5 @@ pub(super) fn is_known_dunder_method(method: &str) -> bool { | "_ignore_" | "_order_" | "_generate_next_value_" - ) || method.starts_with("_repr_") + ) }