You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The stubs say that ReturnDict has serializer as first argument, but actually it's a keyword only argument. First argument should be a Mapping. (or whatever parent OrderedDict takes).
from rest_framework.utils.serializer_helpers import ReturnDict
from rest_framework.serializers import Serializer
d = ReturnDict({"key": "val"}, serializer=Serializer())
produces:
test.py:5: error: "ReturnDict" gets multiple values for keyword argument "serializer" [misc]
test.py:5: error: Argument 1 to "ReturnDict" has incompatible type "Dict[str, str]"; expected "BaseSerializer[Any]" [arg-type]
How is that should be
It should not give an error. That's the usage in drf itself
Bug report
What's wrong
The stubs say that
ReturnDict
hasserializer
as first argument, but actually it's a keyword only argument. First argument should be a Mapping. (or whatever parentOrderedDict
takes).produces:
How is that should be
It should not give an error. That's the usage in drf itself
https://github.com/encode/django-rest-framework/blob/3.13.1/rest_framework/utils/serializer_helpers.py#L16
https://github.com/encode/django-rest-framework/blob/3.13.1/rest_framework/serializers.py#L553
System information
django-stubs
version: 1.5.0django-rest-framework
version: 3.13.1The text was updated successfully, but these errors were encountered: