mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Move the os.path hack
This commit is contained in:
@@ -424,13 +424,6 @@ def import_module(evaluator, import_names, sys_path):
|
|||||||
# further imports.
|
# further imports.
|
||||||
parent_module = list(bases)[0]
|
parent_module = list(bases)[0]
|
||||||
|
|
||||||
# This is a huge exception, we follow a nested import
|
|
||||||
# ``os.path``, because it's a very important one in Python
|
|
||||||
# that is being achieved by messing with ``sys.modules`` in
|
|
||||||
# ``os``.
|
|
||||||
if import_names == ('os', 'path'):
|
|
||||||
return parent_module.py__getattribute__('path')
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
method = parent_module.py__path__
|
method = parent_module.py__path__
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|||||||
@@ -77,6 +77,19 @@ class StdlibPlugin(BasePlugin):
|
|||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
def import_module(self, callback):
|
||||||
|
def wrapper(evaluator, import_names, sys_path):
|
||||||
|
# This is a huge exception, we follow a nested import
|
||||||
|
# ``os.path``, because it's a very important one in Python
|
||||||
|
# that is being achieved by messing with ``sys.modules`` in
|
||||||
|
# ``os``.
|
||||||
|
if import_names == ('os', 'path'):
|
||||||
|
return callback(evaluator, ('os',), sys_path).py__getattribute__('path')
|
||||||
|
return callback(evaluator, import_names, sys_path)
|
||||||
|
|
||||||
|
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
def _follow_param(evaluator, arguments, index):
|
def _follow_param(evaluator, arguments, index):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user