mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Add the cache_path parameter to parso calls.
This commit is contained in:
@@ -141,6 +141,7 @@ class Script(object):
|
||||
grammar=self._grammar,
|
||||
cache=False, # No disk cache, because the current script often changes.
|
||||
diff_cache=True,
|
||||
cache_path=settings.cache_directory
|
||||
)
|
||||
|
||||
@cache.memoize_method
|
||||
|
||||
@@ -6,6 +6,7 @@ import inspect
|
||||
import os
|
||||
|
||||
from parso.python import parse
|
||||
from jedi import settings
|
||||
from jedi.evaluate import compiled
|
||||
from jedi.cache import underscore_memoization
|
||||
from jedi.evaluate import imports
|
||||
@@ -108,7 +109,8 @@ def _load_module(evaluator, path, python_object):
|
||||
grammar=evaluator.grammar,
|
||||
path=path,
|
||||
cache=True,
|
||||
diff_cache=True
|
||||
diff_cache=True,
|
||||
cache_path=settings.cache_directory
|
||||
).get_root_node()
|
||||
python_module = inspect.getmodule(python_object)
|
||||
|
||||
|
||||
@@ -471,7 +471,9 @@ def _load_module(evaluator, path=None, code=None, sys_path=None, parent_module=N
|
||||
if path is not None and path.endswith(('.py', '.zip', '.egg')) \
|
||||
and dotted_path not in settings.auto_import_modules:
|
||||
|
||||
module_node = parse(code=code, path=path, cache=True, diff_cache=True)
|
||||
module_node = parse(
|
||||
code=code, path=path, cache=True, diff_cache=True,
|
||||
cache_path=settings.cache_directory)
|
||||
|
||||
from jedi.evaluate.representation import ModuleContext
|
||||
return ModuleContext(evaluator, module_node, path=path)
|
||||
|
||||
@@ -7,10 +7,11 @@ from jedi._compatibility import exec_function, unicode
|
||||
from parso.python import tree
|
||||
from parso.python import parse
|
||||
from jedi.evaluate.cache import memoize_default
|
||||
from jedi import debug
|
||||
from jedi import common
|
||||
from jedi.evaluate.compiled import CompiledObject
|
||||
from jedi.evaluate.context import ContextualizedNode
|
||||
from jedi import settings
|
||||
from jedi import debug
|
||||
from jedi import common
|
||||
|
||||
|
||||
def get_venv_path(venv):
|
||||
@@ -214,7 +215,8 @@ def _get_paths_from_buildout_script(evaluator, buildout_script_path):
|
||||
module_node = parse(
|
||||
path=buildout_script_path,
|
||||
grammar=evaluator.grammar,
|
||||
cache=True
|
||||
cache=True,
|
||||
cache_path=settings.cache_directory
|
||||
)
|
||||
except IOError:
|
||||
debug.warning('Error trying to read buildout_script: %s', buildout_script_path)
|
||||
|
||||
@@ -239,4 +239,3 @@ def get_parent_scope(node, include_flows=False):
|
||||
break
|
||||
scope = scope.parent
|
||||
return scope
|
||||
|
||||
|
||||
Reference in New Issue
Block a user