-
-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
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
remove generics from QuerySet type #794
Conversation
Maybe like this? class QuerySet(_QuerySet[_T, _T]): ... Or: class _QuerySetAlias(_QuerySet[_T, _T]): ...
QuerySet = _QuerySetAlias |
@sobolevn Yes, trying your first variant (as it looks nicer to me). Still I wonder if the queryset base class has a model base class connection at all (have not looked up the django source). In the end it does not matter as long as the interfaces with types are announced correctly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! We still need a test case for #704
@sobolevn Are those explicit tests against |
Yes, we need them to test our internal representation of |
@sobolevn Not sure if I can help you with the test cases. I am getting tons of errors, if I try to run pytest locally in a venv with python 3.10 (bootstrapped similar to the CI setup), like these:
|
I tried this change and it causes new errors in my code. For example: MyModel.objects.annotate(
last_status=Subquery(
OtherModel.objects.values("last_status")
)
Because I think some changes are needed in the plugin code as well. |
@intgr Thats the reason why I asked if |
This seems redundant now that #794 has been merged? Feel free to re-open if I'm missing something. |
See #704 - currently it is not possible to deal with QuerySet class obj in python without getting a generics alert. By removing the
[_T, _T]
it works again without complaints.Related issues
Closes #704.
I have no idea about possible side effects of this change, so please someone with more knowledge about the typing internals of django-stubs would have to review this change.