Skip to content

Commit

Permalink
Allow sunder names from enum.Enum
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Oct 16, 2023
1 parent 7da4e28 commit ec3934e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ def __attrs_init__(self):
def __html__(self):
pass

# Allow _missing_, used by enum.Enum.
@classmethod
def _missing_(cls, value):
pass


def __foo_bar__(): # this is not checked by the [bad-dunder-name] rule
...
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,13 @@ fn is_known_dunder_method(method: &str) -> bool {
| "__trunc__"
| "__weakref__"
| "__xor__"
// Overridable sunder names from the `Enum` class.
// See: https://docs.python.org/3/library/enum.html#supported-sunder-names
| "_name_"
| "_value_"
| "_missing_"
| "_ignore_"
| "_order_"
| "_generate_next_value_"
)
}

0 comments on commit ec3934e

Please sign in to comment.