mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Better docstring help
This commit is contained in:
@@ -16,7 +16,7 @@ from jedi.evaluate.imports import ImportName
|
||||
from jedi.evaluate.filters import ParamName
|
||||
from jedi.evaluate.context import FunctionExecutionContext, MethodContext
|
||||
from jedi.evaluate.gradual.typeshed import StubOnlyModuleContext
|
||||
from jedi.evaluate.gradual.stub_context import name_to_stub
|
||||
from jedi.evaluate.gradual.stub_context import name_to_stub, stub_to_actual_context_set
|
||||
from jedi.api.keywords import KeywordName
|
||||
|
||||
|
||||
@@ -702,9 +702,15 @@ class _Help(object):
|
||||
|
||||
See :attr:`doc` for example.
|
||||
"""
|
||||
# TODO: Use all of the followed objects as output. Possibly divinding
|
||||
# them by a few dashes.
|
||||
# Using the first docstring that we see.
|
||||
for context in self._get_contexts(fast=fast):
|
||||
return context.py__doc__(include_call_signature=not raw)
|
||||
doc = context.py__doc__(include_call_signature=not raw)
|
||||
if doc:
|
||||
return doc
|
||||
if not context.is_stub():
|
||||
for c in stub_to_actual_context_set(context):
|
||||
doc = c.py__doc__(include_call_signature=not raw)
|
||||
if doc:
|
||||
return doc
|
||||
|
||||
return ''
|
||||
|
||||
@@ -151,15 +151,14 @@ def goto_non_stub(parent_context, tree_name):
|
||||
|
||||
|
||||
def stub_to_actual_context_set(stub_context, ignore_compiled=False):
|
||||
stub_module = stub_context.get_root_context()
|
||||
if not stub_module.is_stub():
|
||||
return ContextSet([stub_context])
|
||||
|
||||
qualified_names = stub_context.get_qualified_names()
|
||||
if qualified_names is None:
|
||||
return NO_CONTEXTS
|
||||
|
||||
stub_module = stub_context.get_root_context()
|
||||
|
||||
if not stub_module.is_stub():
|
||||
return ContextSet([stub_context])
|
||||
|
||||
assert isinstance(stub_module, StubOnlyModuleContext), stub_module
|
||||
non_stubs = stub_module.non_stub_context_set
|
||||
if ignore_compiled:
|
||||
|
||||
Reference in New Issue
Block a user