django-stubs
django-stubs copied to clipboard
error: Missing type parameters for generic type "File"
Bug report
What's wrong
from django.core.files import File
def __call__(self, value: File) -> None:
Mypy says: Missing type parameters for generic type "File"
If I use like that:
def __call__(self, value: File[AnyStr]) -> None:
Result is: TypeError: 'type' object is not subscriptable
This will be fixed in the next release of django-stubs-ext, see https://github.com/typeddjango/django-stubs/commit/e8d52fe7daf88cfe7db5d0dd312e1b5946577051. In the meantime, you can use the extra_classes argument of django_stubs_ext.monkeypatch().
ngnpope said this should be fixed by #1050. Can this be closed now?