mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-27 04:22:18 +08:00
Add py__doc__ as a better approach to docstrings.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from jedi._compatibility import Python3Method
|
||||
from jedi.common import unite
|
||||
from jedi.parser.python.tree import ExprStmt, CompFor
|
||||
from jedi.parser_utils import clean_scope_docstring, get_doc_with_call_signature
|
||||
|
||||
|
||||
class Context(object):
|
||||
@@ -63,6 +64,18 @@ class Context(object):
|
||||
"""
|
||||
return True
|
||||
|
||||
def py__doc__(self, include_call_signature=False):
|
||||
try:
|
||||
self.tree_node.get_doc_node
|
||||
except AttributeError:
|
||||
return ''
|
||||
else:
|
||||
if include_call_signature:
|
||||
return get_doc_with_call_signature(self.tree_node)
|
||||
else:
|
||||
return clean_scope_docstring(self.tree_node)
|
||||
return None
|
||||
|
||||
|
||||
class TreeContext(Context):
|
||||
def __init__(self, evaluator, parent_context=None):
|
||||
|
||||
Reference in New Issue
Block a user