From dc2f4e06c849680cf54c62ee55cacc9d1d7db18a Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sat, 18 May 2019 20:51:42 +0200 Subject: [PATCH] Fix a few casts for Python 2/3 interopability --- jedi/evaluate/compiled/context.py | 6 +++--- jedi/evaluate/gradual/typeshed.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/jedi/evaluate/compiled/context.py b/jedi/evaluate/compiled/context.py index 52bba972..36f1936b 100644 --- a/jedi/evaluate/compiled/context.py +++ b/jedi/evaluate/compiled/context.py @@ -5,7 +5,7 @@ import re from functools import partial from jedi import debug -from jedi._compatibility import force_unicode, Parameter +from jedi._compatibility import force_unicode, Parameter, cast_path from jedi.cache import underscore_memoization, memoize_method from jedi.evaluate.filters import AbstractFilter from jedi.evaluate.names import AbstractNameDefinition, ContextNameMixin @@ -80,7 +80,7 @@ class CompiledObject(Context): @CheckAttribute() def py__path__(self): - return self.access_handle.py__path__() + return map(cast_path, self.access_handle.py__path__()) @property def string_names(self): @@ -97,7 +97,7 @@ class CompiledObject(Context): return self.access_handle.py__bool__() def py__file__(self): - return self.access_handle.py__file__() + return cast_path(self.access_handle.py__file__()) def is_class(self): return self.access_handle.is_class() diff --git a/jedi/evaluate/gradual/typeshed.py b/jedi/evaluate/gradual/typeshed.py index 377d270b..f069c0c8 100644 --- a/jedi/evaluate/gradual/typeshed.py +++ b/jedi/evaluate/gradual/typeshed.py @@ -2,7 +2,7 @@ import os import re from parso.file_io import FileIO -from jedi._compatibility import FileNotFoundError +from jedi._compatibility import FileNotFoundError, cast_path from jedi.parser_utils import get_cached_code_lines from jedi.evaluate.cache import evaluator_function_cache from jedi.evaluate.base_context import ContextSet @@ -31,6 +31,7 @@ def _create_stub_map(directory): return for entry in listed: + entry = cast_path(entry) path = os.path.join(directory, entry) if os.path.isdir(path): init = os.path.join(path, '__init__.pyi')