Skip to content

Cannot determine type Issue with near import loops #1185

Closed

Description

@timabbott

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

Activity

  1. JukkaL commented on Jan 28, 2016

    @JukkaL
    Collaborator

    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.

  2. timabbott commented on Jan 28, 2016

    @timabbott
    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.

  3. JukkaL commented on Feb 4, 2016

    @JukkaL
    Collaborator

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions