Merge pull request #55 from tkf/call-signature-in-definition

Move doc property to `parsing`, which was in api before.
This commit is contained in:
David Halter
2012-11-06 14:54:30 -08:00
2 changed files with 15 additions and 7 deletions

View File

@@ -74,14 +74,9 @@ class Completion(object):
def doc(self):
""" Return a document string for this completion object. """
try:
parent = self.name.parent()
try:
return '%s\n\n%s' % (parent.get_call_signature(),
parent.docstr)
except AttributeError:
return str(parent.docstr)
return self.name.parent().doc
except AttributeError:
return ''
return self.raw_doc
@property
def raw_doc(self):
@@ -140,6 +135,14 @@ class Definition(dynamic.BaseOutput):
@property
def doc(self):
""" Returns the docstr, behaves like `Completion.doc`. """
try:
return self.definition.doc
except AttributeError:
return self.raw_doc
@property
def raw_doc(self):
""" Returns the docstring `__doc__` for any object """
try:
return str(self.definition.docstr)
except AttributeError:

View File

@@ -410,6 +410,11 @@ class Function(Scope):
lines[-1] += ')'
return '\n'.join(lines)
@property
def doc(self):
""" Return a document string including call signature. """
return '%s\n\n%s' % (self.get_call_signature(), self.docstr)
class Flow(Scope):
"""