1
0
forked from VimPlug/jedi

fix python 2.7 issues. the parser now only takes unicode inputs

This commit is contained in:
Dave Halter
2014-02-23 11:44:32 +01:00
parent c5fcebde82
commit 8e847f4982
7 changed files with 63 additions and 57 deletions
+3 -2
View File
@@ -372,12 +372,13 @@ def get_names_of_scope(evaluator, scope, position=None, star_search=True, includ
This function is used to include names from outer scopes. For example, when
the current scope is function:
>>> from jedi._compatibility import u
>>> from jedi.parser import Parser
>>> parser = Parser('''
>>> parser = Parser(u('''
... x = ['a', 'b', 'c']
... def func():
... y = None
... ''')
... '''))
>>> scope = parser.module.subscopes[0]
>>> scope
<Function: func@3-4>
+5 -3
View File
@@ -18,8 +18,9 @@ which is being used in a function definition.
The easiest way to play with this module is to use :class:`parsing.Parser`.
:attr:`parsing.Parser.module` holds an instance of :class:`SubModule`:
>>> from jedi._compatibility import u
>>> from jedi.parser import Parser
>>> parser = Parser('import os', 'example.py')
>>> parser = Parser(u('import os'), 'example.py')
>>> submodule = parser.module
>>> submodule
<SubModule: example.py@1-1>
@@ -283,12 +284,13 @@ class Scope(Simple, IsScope):
"""
Get all defined names in this scope.
>>> from jedi._compatibility import u
>>> from jedi.parser import Parser
>>> parser = Parser('''
>>> parser = Parser(u('''
... a = x
... b = y
... b.c = z
... ''')
... '''))
>>> parser.module.get_defined_names()
[<Name: a@2,0>, <Name: b@3,0>]