1
0
forked from VimPlug/jedi

previous fix had still bugs, now finally fixes #221

This commit is contained in:
David Halter
2013-08-11 22:28:41 +04:30
parent e53c6d10d6
commit 0ab4119447

View File

@@ -103,7 +103,7 @@ class BaseDefinition(object):
>>> from jedi import Script >>> from jedi import Script
>>> source = ''' >>> source = '''
... import sys ... import keyword
... ...
... class C: ... class C:
... pass ... pass
@@ -116,7 +116,7 @@ class BaseDefinition(object):
... def f(): ... def f():
... pass ... pass
... ...
... variable = sys or f or C or x''' ... variable = keyword or f or C or x'''
>>> script = Script(source, len(source.splitlines()), 3, 'example.py') >>> script = Script(source, len(source.splitlines()), 3, 'example.py')
>>> defs = script.definition() >>> defs = script.definition()
@@ -125,7 +125,7 @@ class BaseDefinition(object):
>>> defs = sorted(defs, key=lambda d: d.line) >>> defs = sorted(defs, key=lambda d: d.line)
>>> defs # doctest: +NORMALIZE_WHITESPACE >>> defs # doctest: +NORMALIZE_WHITESPACE
[<Definition module sys>, <Definition class C>, [<Definition module keyword>, <Definition class C>,
<Definition class D>, <Definition def f>] <Definition class D>, <Definition def f>]
Finally, here is what you can get from :attr:`type`: Finally, here is what you can get from :attr:`type`:
@@ -202,14 +202,14 @@ class BaseDefinition(object):
@property @property
def line(self): def line(self):
"""The line where the definition occurs (starting with 1).""" """The line where the definition occurs (starting with 1)."""
if self.in_builtin_module: if self.in_builtin_module():
return None return None
return self._start_pos[0] return self._start_pos[0]
@property @property
def column(self): def column(self):
"""The column where the definition occurs (starting with 0).""" """The column where the definition occurs (starting with 0)."""
if self.in_builtin_module: if self.in_builtin_module():
return None return None
return self._start_pos[1] return self._start_pos[1]