mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-23 13:51:27 +08:00
all the import changes
This commit is contained in:
@@ -13,8 +13,8 @@ import os
|
|||||||
import warnings
|
import warnings
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
||||||
from jedi import parsing
|
from jedi.parser import Parser
|
||||||
from jedi import parsing_representation as pr
|
from jedi.parser import representation as pr
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import settings
|
from jedi import settings
|
||||||
from jedi import helpers
|
from jedi import helpers
|
||||||
@@ -244,7 +244,7 @@ class Script(object):
|
|||||||
|
|
||||||
def _get_under_cursor_stmt(self, cursor_txt):
|
def _get_under_cursor_stmt(self, cursor_txt):
|
||||||
offset = self._line - 1, self._column
|
offset = self._line - 1, self._column
|
||||||
r = parsing.Parser(cursor_txt, no_docstr=True, offset=offset)
|
r = Parser(cursor_txt, no_docstr=True, offset=offset)
|
||||||
try:
|
try:
|
||||||
stmt = r.module.statements[0]
|
stmt = r.module.statements[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
@@ -668,7 +668,7 @@ def defined_names(source, path=None, source_encoding='utf-8'):
|
|||||||
|
|
||||||
:rtype: list of api_classes.Definition
|
:rtype: list of api_classes.Definition
|
||||||
"""
|
"""
|
||||||
parser = parsing.Parser(
|
parser = Parser(
|
||||||
modules.source_to_unicode(source, source_encoding),
|
modules.source_to_unicode(source, source_encoding),
|
||||||
module_path=path,
|
module_path=path,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import functools
|
|||||||
from jedi._compatibility import unicode, next
|
from jedi._compatibility import unicode, next
|
||||||
from jedi import settings
|
from jedi import settings
|
||||||
from jedi import common
|
from jedi import common
|
||||||
from jedi import parsing_representation as pr
|
from jedi.parser import representation as pr
|
||||||
from jedi import cache
|
from jedi import cache
|
||||||
import keywords
|
import keywords
|
||||||
import recursion
|
import recursion
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import inspect
|
|||||||
|
|
||||||
from jedi import common
|
from jedi import common
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import parsing
|
from jedi.parser import Parser
|
||||||
from jedi import modules
|
from jedi import modules
|
||||||
import evaluate
|
import evaluate
|
||||||
|
|
||||||
@@ -435,7 +435,7 @@ class Builtin(object):
|
|||||||
class Container(object):
|
class Container(object):
|
||||||
FunctionType = types.FunctionType
|
FunctionType = types.FunctionType
|
||||||
source = _generate_code(Container, depth=0)
|
source = _generate_code(Container, depth=0)
|
||||||
parser = parsing.Parser(source, None)
|
parser = Parser(source, None)
|
||||||
module = parser.module
|
module = parser.module
|
||||||
module.parent = self.scope
|
module.parent = self.scope
|
||||||
typ = evaluate.follow_path(iter(['FunctionType']), module, module)
|
typ = evaluate.follow_path(iter(['FunctionType']), module, module)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ annotations.
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from jedi import cache
|
from jedi import cache
|
||||||
from jedi import parsing
|
from jedi.parser import Parser
|
||||||
import evaluate
|
import evaluate
|
||||||
import evaluate_representation as er
|
import evaluate_representation as er
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ def follow_param(param):
|
|||||||
param_str)
|
param_str)
|
||||||
user_position = (2, 0)
|
user_position = (2, 0)
|
||||||
|
|
||||||
p = parsing.Parser(param_str, None, user_position,
|
p = Parser(param_str, None, user_position,
|
||||||
no_docstr=True)
|
no_docstr=True)
|
||||||
if p.user_stmt is None:
|
if p.user_stmt is None:
|
||||||
return []
|
return []
|
||||||
@@ -124,7 +124,7 @@ def find_return_types(func):
|
|||||||
if not type_str:
|
if not type_str:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
p = parsing.Parser(type_str, None, (1, 0), no_docstr=True)
|
p = Parser(type_str, None, (1, 0), no_docstr=True)
|
||||||
if p.user_stmt is None:
|
if p.user_stmt is None:
|
||||||
return []
|
return []
|
||||||
p.user_stmt.parent = func
|
p.user_stmt.parent = func
|
||||||
|
|||||||
@@ -56,12 +56,12 @@ from __future__ import with_statement
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from jedi import cache
|
from jedi import cache
|
||||||
from jedi import parsing_representation as pr
|
from jedi.parser import representation as pr
|
||||||
from jedi import modules
|
from jedi import modules
|
||||||
from jedi import settings
|
from jedi import settings
|
||||||
from jedi import common
|
from jedi import common
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import fast_parser
|
from jedi.parser import fast as fast_parser
|
||||||
import api_classes
|
import api_classes
|
||||||
import evaluate
|
import evaluate
|
||||||
import imports
|
import imports
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ import itertools
|
|||||||
from jedi._compatibility import next, hasattr, is_py3k, unicode, reraise, u
|
from jedi._compatibility import next, hasattr, is_py3k, unicode, reraise, u
|
||||||
from jedi import common
|
from jedi import common
|
||||||
from jedi import cache
|
from jedi import cache
|
||||||
from jedi import parsing_representation as pr
|
from jedi.parser import representation as pr
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
import evaluate_representation as er
|
import evaluate_representation as er
|
||||||
import recursion
|
import recursion
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import copy
|
|||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
from jedi._compatibility import use_metaclass, next, hasattr, unicode
|
from jedi._compatibility import use_metaclass, next, hasattr, unicode
|
||||||
from jedi import parsing_representation as pr
|
from jedi.parser import representation as pr
|
||||||
from jedi import cache
|
from jedi import cache
|
||||||
from jedi import helpers
|
from jedi import helpers
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from __future__ import with_statement
|
|||||||
import copy
|
import copy
|
||||||
|
|
||||||
from jedi import common
|
from jedi import common
|
||||||
from jedi import parsing_representation as pr
|
from jedi.parser import representation as pr
|
||||||
|
|
||||||
|
|
||||||
def fast_parent_copy(obj):
|
def fast_parent_copy(obj):
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ from jedi._compatibility import find_module
|
|||||||
from jedi import modules
|
from jedi import modules
|
||||||
from jedi import common
|
from jedi import common
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import parsing_representation as pr
|
from jedi.parser import representation as pr
|
||||||
from jedi import cache
|
from jedi import cache
|
||||||
import builtin
|
import builtin
|
||||||
import evaluate
|
import evaluate
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Module to handle interpreted Python objects.
|
|||||||
import itertools
|
import itertools
|
||||||
import tokenize
|
import tokenize
|
||||||
|
|
||||||
from jedi import parsing_representation as pr
|
from jedi.parser import representation as pr
|
||||||
|
|
||||||
|
|
||||||
class ObjectImporter(object):
|
class ObjectImporter(object):
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import pydoc
|
|||||||
import keyword
|
import keyword
|
||||||
|
|
||||||
from jedi._compatibility import is_py3k
|
from jedi._compatibility import is_py3k
|
||||||
from jedi import parsing_representation as pr
|
from jedi.parser import representation as pr
|
||||||
from jedi import common
|
from jedi import common
|
||||||
import builtin
|
import builtin
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ from ast import literal_eval
|
|||||||
|
|
||||||
from jedi._compatibility import exec_function, unicode
|
from jedi._compatibility import exec_function, unicode
|
||||||
from jedi import cache
|
from jedi import cache
|
||||||
from jedi import parsing_representation as pr
|
from jedi.parser import representation as pr
|
||||||
from jedi import fast_parser
|
from jedi.parser import fast
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import common
|
from jedi import common
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ class CachedModule(object):
|
|||||||
def _load_module(self):
|
def _load_module(self):
|
||||||
source = self._get_source()
|
source = self._get_source()
|
||||||
p = self.path or self.name
|
p = self.path or self.name
|
||||||
p = fast_parser.FastParser(source, p)
|
p = fast.FastParser(source, p)
|
||||||
cache.save_module(self.path, self.name, p)
|
cache.save_module(self.path, self.name, p)
|
||||||
return p
|
return p
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ class ModuleWithCursor(Module):
|
|||||||
# Call the parser already here, because it will be used anyways.
|
# Call the parser already here, because it will be used anyways.
|
||||||
# Also, the position is here important (which will not be used by
|
# Also, the position is here important (which will not be used by
|
||||||
# default), therefore fill the cache here.
|
# default), therefore fill the cache here.
|
||||||
self._parser = fast_parser.FastParser(self.source, self.path,
|
self._parser = fast.FastParser(self.source, self.path,
|
||||||
self.position)
|
self.position)
|
||||||
# don't pickle that module, because it's changing fast
|
# don't pickle that module, because it's changing fast
|
||||||
cache.save_module(self.path, self.name, self._parser,
|
cache.save_module(self.path, self.name, self._parser,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Next to :mod:`cache` this module also makes |jedi| not thread-safe. Why?
|
|||||||
``ExecutionRecursionDecorator`` uses class variables to count the function
|
``ExecutionRecursionDecorator`` uses class variables to count the function
|
||||||
calls.
|
calls.
|
||||||
"""
|
"""
|
||||||
from jedi import parsing_representation as pr
|
from jedi.parser import representation as pr
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import settings
|
from jedi import settings
|
||||||
import evaluate_representation as er
|
import evaluate_representation as er
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import difflib
|
|||||||
from jedi import common
|
from jedi import common
|
||||||
from jedi import modules
|
from jedi import modules
|
||||||
from jedi import helpers
|
from jedi import helpers
|
||||||
from jedi import parsing_representation as pr
|
from jedi.parser import representation as pr
|
||||||
|
|
||||||
|
|
||||||
class Refactoring(object):
|
class Refactoring(object):
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Tests ``from __future__ import absolute_import`` (only important for
|
|||||||
Python 2.X)
|
Python 2.X)
|
||||||
"""
|
"""
|
||||||
import jedi
|
import jedi
|
||||||
from jedi.parsing import Parser
|
from jedi.parser import Parser
|
||||||
from . import helpers
|
from . import helpers
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from jedi.parsing import Parser
|
from jedi.parser import Parser
|
||||||
from jedi import parsing_representation as pr
|
from jedi import parsing_representation as pr
|
||||||
|
|
||||||
def test_user_statement_on_import():
|
def test_user_statement_on_import():
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from jedi.parsing import Parser
|
from jedi.parser import Parser
|
||||||
|
|
||||||
def test_get_code():
|
def test_get_code():
|
||||||
"""Use the same code that the parser also generates, to compare"""
|
"""Use the same code that the parser also generates, to compare"""
|
||||||
|
|||||||
Reference in New Issue
Block a user