mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
final import renamings for the new parser package
This commit is contained in:
@@ -125,7 +125,7 @@ def get_names_of_scope(scope, position=None, star_search=True,
|
|||||||
This function is used to include names from outer scopes. For example,
|
This function is used to include names from outer scopes. For example,
|
||||||
when the current scope is function:
|
when the current scope is function:
|
||||||
|
|
||||||
>>> from jedi.parsing import Parser
|
>>> from jedi.parser import Parser
|
||||||
>>> parser = Parser('''
|
>>> parser = Parser('''
|
||||||
... x = ['a', 'b', 'c']
|
... x = ['a', 'b', 'c']
|
||||||
... def func():
|
... def func():
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ which is being used in a function definition.
|
|||||||
The easiest way to play with this module is to use :class:`parsing.Parser`.
|
The easiest way to play with this module is to use :class:`parsing.Parser`.
|
||||||
:attr:`parsing.Parser.module` holds an instance of :class:`SubModule`:
|
:attr:`parsing.Parser.module` holds an instance of :class:`SubModule`:
|
||||||
|
|
||||||
>>> from jedi.parsing import Parser
|
>>> from jedi.parser import Parser
|
||||||
>>> parser = Parser('import os', 'example.py')
|
>>> parser = Parser('import os', 'example.py')
|
||||||
>>> submodule = parser.module
|
>>> submodule = parser.module
|
||||||
>>> submodule
|
>>> submodule
|
||||||
@@ -241,7 +241,7 @@ class Scope(Simple, IsScope):
|
|||||||
"""
|
"""
|
||||||
Get all defined names in this scope.
|
Get all defined names in this scope.
|
||||||
|
|
||||||
>>> from jedi.parsing import Parser
|
>>> from jedi.parser import Parser
|
||||||
>>> parser = Parser('''
|
>>> parser = Parser('''
|
||||||
... a = x
|
... a = x
|
||||||
... b = y
|
... b = y
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from jedi.parser import Parser
|
from jedi.parser import Parser
|
||||||
from jedi import parsing_representation as pr
|
from jedi.parser import representation as pr
|
||||||
|
|
||||||
def test_user_statement_on_import():
|
def test_user_statement_on_import():
|
||||||
"""github #285"""
|
"""github #285"""
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ from .helpers import TestCase, cwd_at
|
|||||||
|
|
||||||
import jedi
|
import jedi
|
||||||
from jedi import Script
|
from jedi import Script
|
||||||
from jedi import api, parsing
|
from jedi import api
|
||||||
|
from jedi.parser import Parser
|
||||||
|
|
||||||
#jedi.set_debug_function()
|
#jedi.set_debug_function()
|
||||||
|
|
||||||
@@ -115,7 +116,7 @@ class TestRegression(TestCase):
|
|||||||
def test_end_pos(self):
|
def test_end_pos(self):
|
||||||
# jedi issue #150
|
# jedi issue #150
|
||||||
s = "x()\nx( )\nx( )\nx ( )"
|
s = "x()\nx( )\nx( )\nx ( )"
|
||||||
parser = parsing.Parser(s)
|
parser = Parser(s)
|
||||||
for i, s in enumerate(parser.module.statements, 3):
|
for i, s in enumerate(parser.module.statements, 3):
|
||||||
for c in s.get_commands():
|
for c in s.get_commands():
|
||||||
self.assertEqual(c.execution.end_pos[1], i)
|
self.assertEqual(c.execution.end_pos[1], i)
|
||||||
|
|||||||
Reference in New Issue
Block a user