mirror of
https://github.com/davidhalter/jedi.git
synced 2026-03-01 13:36:51 +08:00
memoize sys_path modifications
This commit is contained in:
@@ -331,7 +331,7 @@ class _Importer(object):
|
|||||||
new = os.path.sep.join(parts[:i])
|
new = os.path.sep.join(parts[:i])
|
||||||
in_path.append(new)
|
in_path.append(new)
|
||||||
|
|
||||||
return in_path + sys_path.sys_path_with_modifications(self.module)
|
return in_path + sys_path.sys_path_with_modifications(self._evaluator, self.module)
|
||||||
|
|
||||||
def follow(self, evaluator):
|
def follow(self, evaluator):
|
||||||
scope, rest = self.follow_file_system()
|
scope, rest = self.follow_file_system()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import sys
|
|||||||
|
|
||||||
from jedi._compatibility import exec_function, unicode
|
from jedi._compatibility import exec_function, unicode
|
||||||
from jedi.parser import representation as pr
|
from jedi.parser import representation as pr
|
||||||
|
from jedi.evaluate.cache import memoize_default
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import common
|
from jedi import common
|
||||||
|
|
||||||
@@ -22,8 +23,8 @@ def get_sys_path():
|
|||||||
return [p for p in sys.path if p != ""]
|
return [p for p in sys.path if p != ""]
|
||||||
|
|
||||||
|
|
||||||
#@cache.memoize_default([]) TODO add some sort of cache again.
|
@memoize_default(evaluator_is_first_arg=True)
|
||||||
def sys_path_with_modifications(module):
|
def sys_path_with_modifications(evaluator, module):
|
||||||
def execute_code(code):
|
def execute_code(code):
|
||||||
c = "import os; from os.path import *; result=%s"
|
c = "import os; from os.path import *; result=%s"
|
||||||
variables = {'__file__': module.path}
|
variables = {'__file__': module.path}
|
||||||
|
|||||||
Reference in New Issue
Block a user