Remove Python 2 implicit relative imports feature

Python 2 is almost gone, so I don't support those old features anymore.
This commit is contained in:
Dave Halter
2019-12-01 00:45:08 +01:00
parent c77f33b73b
commit e81c241905

View File

@@ -276,7 +276,7 @@ class Importer(object):
if self._fixed_sys_path is not None:
return self._fixed_sys_path
sys_path_mod = (
return (
# For import completions we don't want to see init paths, but for
# inference we want to show the user as much as possible.
# See GH #1446.
@@ -284,14 +284,6 @@ class Importer(object):
+ sys_path.check_sys_path_modifications(self._module_context)
)
if self._inference_state.environment.version_info.major == 2:
file_path = self._module_context.py__file__()
if file_path is not None:
# Python2 uses an old strange way of importing relative imports.
sys_path_mod.append(force_unicode(os.path.dirname(file_path)))
return sys_path_mod
def follow(self):
if not self.import_path or not self._infer_possible:
return NO_VALUES