Change prefix for _importlib_modulespec names#1127
Change prefix for _importlib_modulespec names#1127pkch wants to merge 1 commit intopython:masterfrom
Conversation
72b69c9 to
c63f855
Compare
|
Next commit would break mypy unless python/mypy#3107 is merged. Note: I wasn't sure about this line in 2/abc.pyi: which I changed to I'm afraid I might be breaking something even though the tests pass. Also, werkzeug stubs had: I removed them, but I also suspect they may serve some non-obvious purpose. |
stdlib/2/tokenize.pyi
Outdated
| endprogs = ... # type: Dict[str, Any] | ||
| pseudoprog = ... # type: type | ||
| re = ... # type: module | ||
| re = ... # type: ModuleType |
There was a problem hiding this comment.
This probably shouldn't be here at all. (I'm guessing tokenize just imports re.)
stdlib/3/_importlib_modulespec.pyi
Outdated
| import sys | ||
| from typing import Any, Optional | ||
|
|
||
| MYPY_MODULE = 'importlib.machinery' |
There was a problem hiding this comment.
If we go down this route, we should prefix it with _ to make clear that this name isn't actually part of this module. However, I'd prefer to just hardcode the location of ModuleType in mypy and not add special handling in typeshed.
There was a problem hiding this comment.
I don't have an opinion on this, I would be happy to hard code it in mypy. Just wasn't sure if it's ok given that it's hard to find later when more circular import definitions happen.
|
I replaced the MYPY_MODULE with hard-coded remapping; so this PR simply replaces |
d247130 to
04fee7c
Compare
|
Superceded by #1156 |
(Not ready for merging)
This PR is meaningless without python/mypy#3107; if that one is approved, this would fix the type reported for modules from
_importlib_modulespec.ModuleTypetotypes.ModuleType. (There is no dependency in the other direction.)This PR is related to python/mypy#3106.