1
0
forked from VimPlug/jedi

Use unicode sys paths always

This commit is contained in:
Dave Halter
2017-12-24 02:41:40 +01:00
parent 7bfca5bcd7
commit a38acdbe08
4 changed files with 37 additions and 9 deletions

View File

@@ -153,6 +153,15 @@ class AccessPath(object):
def __init__(self, accesses):
self.accesses = accesses
# Writing both of these methods here looks a bit ridiculous. However with
# the differences of Python 2/3 it's actually necessary, because we will
# otherwise have a accesses attribute that is bytes instead of unicode.
def __getstate__(self):
return self.accesses
def __setstate__(self, value):
self.accesses = value
def create_access_path(evaluator, obj):
access = create_access(evaluator, obj)

View File

@@ -1,12 +1,14 @@
import sys
import os
import imp
from jedi._compatibility import find_module, cast_path
from jedi.evaluate.compiled import access
from jedi._compatibility import find_module
from jedi import parser_utils
def get_sys_path():
return sys.path
return list(map(cast_path, sys.path))
def load_module(evaluator, **kwargs):
@@ -51,7 +53,7 @@ def get_module_info(evaluator, sys_path=None, full_name=None, **kwargs):
code = module_file.read()
module_file.close()
return code, module_path, is_pkg
return code, cast_path(module_path), is_pkg
def _get_init_path(directory_path):
@@ -64,3 +66,7 @@ def _get_init_path(directory_path):
if os.path.exists(path):
return path
return None
def safe_literal_eval(evaluator, value):
return parser_utils.safe_literal_eval(value)