-
-
Notifications
You must be signed in to change notification settings - Fork 131
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Bug report
Hi @sobolevn @asottile-sentry , This is more like a question.
After some change mypy start producing some error and this error does make sense. Therefore I need the proper suggestion from the experienced guys!
What's wrong
Before this change (#454) we were doing this:
class MyEnum(enum.StrEnum):
VALUE_1 = 'value_1'
VALUE_2 = 'value_2'
MySerializer(drf_serializers.Serializer):
my_choices = drf_serializers.ChoiceField(choices=MyEnum, ...)But after this change we are receiving this mypy error:
error: Argument "choices" to "ChoiceField" has incompatible type "type[MyEnum]"; expected "Sequence[Any]" [arg-type]
How is that should be
What is the suggested way to fix this issue? Should we somehow convert the value to "sequence"?
my_choices = drf_serializers.ChoiceField(choices=tuple(MyEnum), ...)System information
- OS:
pythonversion: 3.13.5djangoversion: 5.2.4mypyversion: 1.17.1django-stubsversion: 5.2.2
It would nice to hear your suggestions, guys!
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested