ruff
9f0b942b - [ty] infer `name` and `value` for enum members (#20311)

Commit
153 days ago
[ty] infer `name` and `value` for enum members (#20311) ## summary - this pr implements the following attributes for `Enum` members: - `name` - `_name_` - `value` - `_value_` - adds a TODO test for `my_enum_class_instance.name` - only implements if the instance is a subclass of `Enum` re: this [comment](https://github.com/astral-sh/ruff/pull/19481#issuecomment-3103460307) and existing [test](https://github.com/thejchap/ruff/blob/c34449ed7ca4b043d514240e212335a2554d0fb1/crates/ty_python_semantic/resources/mdtest/enums.md?plain=1#L625) ### pointers - https://github.com/astral-sh/ty/issues/876 - https://typing.python.org/en/latest/spec/enums.html#enum-definition - https://github.com/astral-sh/ruff/pull/19481#issuecomment-3103460307 ## test plan - mdtests - triaged conformance diffs here: https://diffswarm.dev/d-01k531ag4nee3xmdeq4f3j66pb - triaged mypy primer diffs here for django-stubs: https://diffswarm.dev/d-01k5331n13k9yx8tvnxnkeawp3 - added a TODO test for overriding `.value` - discord diff seems reasonable --------- Co-authored-by: David Peter <mail@david-peter.de>
Author
Parents
Loading