mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Use convert_context function for docs lookup
This commit is contained in:
@@ -17,8 +17,8 @@ from jedi.evaluate import compiled
|
||||
from jedi.evaluate.imports import ImportName
|
||||
from jedi.evaluate.context import FunctionExecutionContext
|
||||
from jedi.evaluate.gradual.typeshed import StubModuleContext
|
||||
from jedi.evaluate.gradual.conversion import convert_names, convert_contexts, \
|
||||
stub_to_python_context_set
|
||||
from jedi.evaluate.gradual.conversion import convert_names, convert_contexts
|
||||
from jedi.evaluate.base_context import ContextSet
|
||||
from jedi.api.keywords import KeywordName
|
||||
|
||||
|
||||
@@ -705,7 +705,8 @@ class _Help(object):
|
||||
if not raw:
|
||||
signature_text = _format_signatures(context)
|
||||
if not doc and context.is_stub():
|
||||
for c in stub_to_python_context_set(context):
|
||||
for c in convert_contexts(ContextSet({context}), ignore_compiled=False):
|
||||
print(c)
|
||||
doc = c.py__doc__()
|
||||
if doc:
|
||||
break
|
||||
|
||||
@@ -135,7 +135,7 @@ def convert_names(names, only_stubs=False, prefer_stubs=False):
|
||||
return _try_stub_to_python_names(names, prefer_stub_to_compiled=True)
|
||||
|
||||
|
||||
def convert_contexts(contexts, only_stubs=False, prefer_stubs=False):
|
||||
def convert_contexts(contexts, only_stubs=False, prefer_stubs=False, ignore_compiled=True):
|
||||
assert not (only_stubs and prefer_stubs)
|
||||
with debug.increase_indent_cm('convert contexts'):
|
||||
if only_stubs or prefer_stubs:
|
||||
@@ -146,7 +146,7 @@ def convert_contexts(contexts, only_stubs=False, prefer_stubs=False):
|
||||
)
|
||||
else:
|
||||
return ContextSet.from_sets(
|
||||
stub_to_python_context_set(stub_context, ignore_compiled=True)
|
||||
stub_to_python_context_set(stub_context, ignore_compiled=ignore_compiled)
|
||||
or ContextSet({stub_context})
|
||||
for stub_context in contexts
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user