From 35158f693d23727f278374378c8a25b6c6e0e6cf Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Fri, 29 Dec 2017 02:45:11 +0100 Subject: [PATCH] Remove some of the last py27 errors that were caused in combination with 3.6 --- jedi/evaluate/imports.py | 2 +- jedi/evaluate/pep0484.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jedi/evaluate/imports.py b/jedi/evaluate/imports.py index eac4c69e..9ee4fec0 100644 --- a/jedi/evaluate/imports.py +++ b/jedi/evaluate/imports.py @@ -273,7 +273,7 @@ class Importer(object): This method is very similar to importlib's `_gcd_import`. """ import_parts = [ - i.value if isinstance(i, tree.Name) else i + force_unicode(i.value if isinstance(i, tree.Name) else i) for i in import_path ] diff --git a/jedi/evaluate/pep0484.py b/jedi/evaluate/pep0484.py index 7dba1b22..7df7c611 100644 --- a/jedi/evaluate/pep0484.py +++ b/jedi/evaluate/pep0484.py @@ -25,6 +25,7 @@ import re from parso import ParserSyntaxError from parso.python import tree +from jedi._compatibility import unicode, force_unicode from jedi.evaluate.cache import evaluator_method_cache from jedi.evaluate import compiled from jedi.evaluate.base_context import NO_CONTEXTS, ContextSet @@ -32,7 +33,6 @@ from jedi.evaluate.lazy_context import LazyTreeContext from jedi.evaluate.context import ModuleContext from jedi.evaluate.helpers import is_string from jedi import debug -from jedi import _compatibility from jedi import parser_utils @@ -64,7 +64,7 @@ def _fix_forward_reference(context, node): if is_string(evaled_node): try: new_node = context.evaluator.grammar.parse( - _compatibility.force_unicode(evaled_node.get_safe_value()), + force_unicode(evaled_node.get_safe_value()), start_symbol='eval_input', error_recovery=False ) @@ -120,7 +120,7 @@ def _get_typing_replacement_module(grammar): typing_path = \ os.path.abspath(os.path.join(__file__, "../jedi_typing.py")) with open(typing_path) as f: - code = _compatibility.unicode(f.read()) + code = unicode(f.read()) _typing_module = grammar.parse(code) return _typing_module @@ -216,7 +216,7 @@ def _find_type_from_comment_hint(context, node, varlist, name): if not match: return [] annotation = tree.String( - repr(str(match.group(1).strip())), + force_unicode(repr(str(match.group(1).strip()))), node.start_pos) annotation.parent = node.parent return _evaluate_for_annotation(context, annotation, index)