-
-
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:
python
version: 3.13.5django
version: 5.2.4mypy
version: 1.17.1django-stubs
version: 5.2.2
It would nice to hear your suggestions, guys!
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested