We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heya, I've this class deriving from the (concrete) User class:
from django.contrib.auth.models import User, UserManager class DepositClient(User): objects = UserManager()
mypy with django-stubs 1.1.0 is complaining on the objects line that:
objects
error: Incompatible types in assignment (expression has type "UserManager[DepositClient]", base class "User" defined the type as "UserManager[User]")
even if DepositClient is a subclass of User and the type variable in Manager is declared as covariant by django-stubs.
DepositClient
User
Manager
This should work out-of-the-box with django-stubs, right? Or am I missing something here?
The text was updated successfully, but these errors were encountered:
This is a case specified in the https://github.com/typeddjango/django-stubs/blob/master/test-data/typecheck/managers/test_managers.yml#L281 It's a mypy limitation, smth around Liskov incompatibility.
Sorry, something went wrong.
Yes, # type: ignore + manual annotation I believe would work (can't test right now). Until python/mypy#7468 is fixed.
# type: ignore
No branches or pull requests
Heya, I've this class deriving from the (concrete) User class:
mypy with django-stubs 1.1.0 is complaining on the
objects
line that:even if
DepositClient
is a subclass ofUser
and the type variable inManager
is declared as covariant by django-stubs.This should work out-of-the-box with django-stubs, right?
Or am I missing something here?
The text was updated successfully, but these errors were encountered: