djangorestframework-stubs icon indicating copy to clipboard operation
djangorestframework-stubs copied to clipboard

Incorrect type hint for `api_settings.DEFAULT_FILTER_BACKENDS`

Open nils-van-zuijlen opened this issue 3 years ago • 0 comments

Bug report

What's wrong

In api_settings, DEFAULT_FILTER_BACKENDS is typed as Sequence[str], but it is used in GenericAPIView, which is typed as Sequence[Union[Type[BaseFilterBackend], Type[BaseFilterProtocol[_MT_co]]]].

How is that should be

As stated in the APISettings docstring](https://github.com/encode/django-rest-framework/blob/e5fb9af0eaffde683fa0af3987085f86cf0d2640/rest_framework/settings.py#L184), the import strings are resolved to the corresponding classes, so the resulting strings should not appear in api_settings.

System information

  • OS:
  • python version: 3.10.4
  • django version: 4.0.4
  • mypy version: 0.950
  • django-stubs version: 1.11.0

nils-van-zuijlen avatar Jun 01 '22 12:06 nils-van-zuijlen