1
0
forked from VimPlug/jedi

clean up some docstrings in api_classes and put them in the right order

This commit is contained in:
David Halter
2013-08-13 22:23:24 +04:30
parent 93e993549a
commit cacc94acf3

View File

@@ -259,31 +259,7 @@ class BaseDefinition(object):
@property @property
def description(self): def description(self):
""" """A textual description of the object."""
A textual description of the object.
Example:
>>> from jedi import Script
>>> source = '''
... def f():
... pass
...
... class C:
... pass
...
... variable = f or C'''
>>> script = Script(source, column=3) # line is maximum by default
>>> defs = script.goto_definitions()
>>> defs = sorted(defs, key=lambda d: d.line)
>>> defs
[<Definition def f>, <Definition class C>]
>>> str(defs[0].description) # strip literals in python2
'def f'
>>> str(defs[1].description)
'class C'
"""
return unicode(self._definition) return unicode(self._definition)
@property @property
@@ -392,11 +368,7 @@ class Completion(BaseDefinition):
@property @property
def description(self): def description(self):
""" """Provide a description of the completion object."""
Provide a description of the completion object.
.. todo:: return value is just __repr__ of some objects, improve!
"""
parent = self._name.parent parent = self._name.parent
if parent is None: if parent is None:
return '' return ''
@@ -483,6 +455,28 @@ class Definition(BaseDefinition):
""" """
A description of the :class:`.Definition` object, which is heavily used A description of the :class:`.Definition` object, which is heavily used
in testing. e.g. for ``isinstance`` it returns ``def isinstance``. in testing. e.g. for ``isinstance`` it returns ``def isinstance``.
Example:
>>> from jedi import Script
>>> source = '''
... def f():
... pass
...
... class C:
... pass
...
... variable = f or C'''
>>> script = Script(source, column=3) # line is maximum by default
>>> defs = script.goto_definitions()
>>> defs = sorted(defs, key=lambda d: d.line)
>>> defs
[<Definition def f>, <Definition class C>]
>>> str(defs[0].description) # strip literals in python2
'def f'
>>> str(defs[1].description)
'class C'
""" """
d = self._definition d = self._definition
if isinstance(d, er.InstanceElement): if isinstance(d, er.InstanceElement):