forked from VimPlug/jedi
splitlines and source_to_unicode are utils of parso.
This commit is contained in:
@@ -16,6 +16,8 @@ import sys
|
||||
from parso.python import load_grammar
|
||||
from parso.python import tree
|
||||
from parso.python import parse
|
||||
from parso.utils import source_to_unicode, splitlines
|
||||
|
||||
from jedi.parser_utils import get_executable_nodes, get_statement_of_position
|
||||
from jedi import debug
|
||||
from jedi import settings
|
||||
@@ -108,8 +110,8 @@ class Script(object):
|
||||
with open(path, 'rb') as f:
|
||||
source = f.read()
|
||||
|
||||
self._source = common.source_to_unicode(source, encoding)
|
||||
self._code_lines = common.splitlines(self._source)
|
||||
self._source = source_to_unicode(source, encoding)
|
||||
self._code_lines = splitlines(self._source)
|
||||
line = max(len(self._code_lines), 1) if line is None else line
|
||||
if not (0 < line <= len(self._code_lines)):
|
||||
raise ValueError('`line` parameter is not in a valid range.')
|
||||
|
||||
+5
-4
@@ -4,13 +4,14 @@ Helpers for the API
|
||||
import re
|
||||
from collections import namedtuple
|
||||
|
||||
from jedi._compatibility import u
|
||||
from jedi.evaluate.helpers import evaluate_call_of_leaf
|
||||
from parso.python.parser import Parser
|
||||
from parso.python import tree
|
||||
from parso import tokenize
|
||||
from parso.utils import splitlines
|
||||
|
||||
from jedi._compatibility import u
|
||||
from jedi.evaluate.helpers import evaluate_call_of_leaf
|
||||
from jedi.cache import time_cache
|
||||
from jedi import common
|
||||
|
||||
|
||||
CompletionParts = namedtuple('CompletionParts', ['path', 'has_dot', 'name'])
|
||||
@@ -52,7 +53,7 @@ class OnErrorLeaf(Exception):
|
||||
|
||||
|
||||
def _is_on_comment(leaf, position):
|
||||
comment_lines = common.splitlines(leaf.prefix)
|
||||
comment_lines = splitlines(leaf.prefix)
|
||||
difference = leaf.start_pos[0] - position[0]
|
||||
prefix_start_pos = leaf.get_start_pos_of_prefix()
|
||||
if difference == 0:
|
||||
|
||||
Reference in New Issue
Block a user