Skip to content

MyPy doesn't understand types.ModuleType #1498

Closed
@wittekm

Description

@wittekm

I tried doing # type: (module) -> str and MyPy was okay with it, but our linter was not. Some discussion in our Slack channel:

Guido:
From types import ModuleType?
Oh wow. Please file a bug. Mypy uses builtins.module but that doesn't exist so can't be used at runtime; types.ModuleType exists but mypy doesn't understand it.

David Fisher:
oh interesting
we have a "class module" entry in builtins
with the comment # TODO not defined in builtins!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions