Skip to content

Cannot determine type Issue with near import loops #1185

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

Closed
timabbott opened this issue Jan 28, 2016 · 3 comments
Closed

Cannot determine type Issue with near import loops #1185

timabbott opened this issue Jan 28, 2016 · 3 comments

Comments

@timabbott
Copy link

I ran into this trying to get the sqlalchemy stubs working. The error is:

<string>:1: note: In module imported here:
typeshed/third_party/2.7/stest/__init__.pyi:4: error: Cannot determine type of 'Constraint'

Here's a reproducer zipped tar archive:
foo.zip

@JukkaL
Copy link
Collaborator

JukkaL commented Jan 28, 2016

This is a known problem (though there doesn't seem to be an open issue). If there are cyclic module dependencies, type inference often needs help because mypy does only a single type checking pass.

In this particular case, you may want to rewrite cases like this:

Constraint = scheme.Constraint

into something like this:

from .scheme import Constraint as Constraint

Let me know if that works for you.

@timabbott
Copy link
Author

That workaround worked for the sqlalchemy stubs; I had actually tried it before unsuccessfully, but I now suspect that was due to an unrelated problem.

@JukkaL
Copy link
Collaborator

JukkaL commented Feb 4, 2016

Closing as this seems like a special case of #481.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants