forked from VimPlug/jedi
Clean the path in pickling.
This commit is contained in:
@@ -118,6 +118,7 @@ class ParserPickling(object):
|
||||
greater than the original pickling time. In which case the pickled
|
||||
parser is not up to date.
|
||||
"""
|
||||
path = self._clean_path(path)
|
||||
try:
|
||||
pickle_changed_time = self._index[path]
|
||||
except KeyError:
|
||||
@@ -139,6 +140,7 @@ class ParserPickling(object):
|
||||
return parser_cache_item.parser
|
||||
|
||||
def save_parser(self, grammar, path, parser_cache_item):
|
||||
path = self._clean_path(path)
|
||||
self.__index = None
|
||||
try:
|
||||
files = self._index
|
||||
@@ -185,6 +187,9 @@ class ParserPickling(object):
|
||||
shutil.rmtree(self._cache_directory())
|
||||
self.__index = {}
|
||||
|
||||
def _clean_path(self, path):
|
||||
return os.path.expanduser(path)
|
||||
|
||||
def _get_hashed_path(self, grammar, path):
|
||||
file_hash = hashlib.sha256(path.encode("utf-8")).hexdigest()
|
||||
return self._get_path('%s-%s.pkl' % (grammar.sha256, file_hash))
|
||||
|
||||
Reference in New Issue
Block a user