Skip to content
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

Fix apps.get_model() return type #305

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yhoiseth
Copy link
Contributor

@yhoiseth
Copy link
Contributor Author

yhoiseth commented Jan 26, 2020

Troubleshooting notes

  • All jobs pass except Typecheck Django 2.2 test suite with python 3.7

Reproduce locally

Done. (Everything below UNUSED IGNORES is present on master, as well.)

Try to fix

Union[Type[Any], Type[Model]] doesn't work, either… Weird, considering that Type[Any] works.

Two models are failing: SiteManager and Food. They both have attributes/methods that aren't present on Model. Considering that they are both models, I think it makes sense that the type hint Type[Model] is more correct than Type[Any]. But the test doesn't agree.

It's unclear to me why it works with 3.0 but not with 2.2.

Appending # type: ignore to the failing test lines works, but not sure whether that's a good idea. Also unsure what the repo situation with django-sources/ is.

Next steps

I don't have any more ideas for how to proceed.

@sobolevn sobolevn requested a review from mkurnikov February 9, 2020 15:03
@mkurnikov
Copy link
Member

I think it requires plugin support, otherwise, it will create a bunch of false-positives everywhere.

@intgr intgr added the stale Pull requests that have been out of date or unmergeable for a long time. label Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Pull requests that have been out of date or unmergeable for a long time.
Development

Successfully merging this pull request may close these issues.

Too broad return value for apps.get_model()
4 participants