This is an archive of the discontinued LLVM Phabricator instance.

Disable mypy cache
ClosedPublic

Authored by thopre on Jan 20 2021, 4:47 AM.

Details

Summary

Mypy crashes with "AssertionError: Cannot find module for UpdatedBase"
when analyzing lnt/server/db/migrations/upgrade_0_to_1.py with a
populated cache. This leads to a number of files not being analyzed by
mypy.

Event Timeline

thopre requested review of this revision.Jan 20 2021, 4:47 AM
thopre created this revision.

Why does the cache cause this error in mypy? Is it a documented problem?

Why does the cache cause this error in mypy? Is it a documented problem?

I think it might be a problem with the sqlalchemy stub/plugin. UpdatedBase is alias to the same call to declarative_base() as Base in the same file. I'm guessing that plugin does not inform Mypy of the dynamic nature of that function call or something like that. It's still early days for that plugin apparently but without using it we get some error that cannot be fixed due to that same declarative_base. I'll try to report the bug.

cmatthews accepted this revision.Oct 25 2021, 1:51 PM

This SGTM. Can you add a note to revisit in a future version of mypy as well.

This revision is now accepted and ready to land.Oct 25 2021, 1:51 PM
This revision was automatically updated to reflect the committed changes.