Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Revert PR #3205 and #3235
  • Loading branch information
pkch committed Apr 27, 2017
commit 9d5ea093f0b46bd70aef5b280e0f6cb99c4366f5
5 changes: 0 additions & 5 deletions mypy/fixup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
)
from mypy.visitor import NodeVisitor

from mypy.semanal import rev_module_rename_map


def fixup_module_pass_one(tree: MypyFile, modules: Dict[str, MypyFile],
quick_and_dirty: bool) -> None:
Expand Down Expand Up @@ -243,9 +241,6 @@ def lookup_qualified(modules: Dict[str, MypyFile], name: str,

def lookup_qualified_stnode(modules: Dict[str, MypyFile], name: str,
quick_and_dirty: bool) -> Optional[SymbolTableNode]:
if '_importlib_modulespec' in modules:
# we are using python 3, so renaming is necessary
name = rev_module_rename_map.get(name, name)
head = name
rest = []
while True:
Expand Down
7 changes: 0 additions & 7 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,13 @@
'typing.typevar': 'typing.TypeVar',
}

# Used for python 3 only
# Rename objects placed in _importlib_modulespec due to circular imports
# Safe in python 2 because no one will ask for these keys
module_rename_map = {
'_importlib_modulespec.ModuleType': 'types.ModuleType',
'_importlib_modulespec.ModuleSpec': 'importlib.machinery.ModuleSpec',
'_importlib_modulespec.Loader': 'importlib.abc.Loader'
}

# Must not be used in python 2 (it will replace correct names with incorrect)
# The check for version is currently made at the point of use
# TODO: consider moving these maps from global scope to somewhere where python version is known
rev_module_rename_map = {v: k for (k, v) in module_rename_map.items()}

# Hard coded type promotions (shared between all Python versions).
# These add extra ad-hoc edges to the subtyping relation. For example,
# int is considered a subtype of float, even though there is no
Expand Down