Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class property Choices.values returns list of Members #232

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

geigerzaehler
Copy link

For any subclass E of Choices, IntegerChoices or TextChoices E.values now has type Sequence[E] instead of list[str] (or list[int]). Similarly for E.choices. The implementation is borrowed from the typeshed implementation of enum.EnumMeta.

I’m not sure about the tests, i.e. just putting a subclass of Choices into the models module. Happy to change that.

For any subclass `E` of `Choices`, `IntegerChoices` or `TextChoices`
`E.values` now has type `Sequence[E]` instead of `list[str]` (or
`list[int]`). Similarly for `E.choices`. The implementation is borrowed
from the typeshed implementation of `enum.EnumMeta`.
Copy link
Owner

@sbdchd sbdchd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, thank you!!

@kodiakhq kodiakhq bot merged commit 8508231 into sbdchd:main Apr 3, 2024
2 checks passed
@geigerzaehler geigerzaehler deleted the enum-choices branch April 4, 2024 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants