mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Annotate potentially missing import
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
import pydoc
|
import pydoc
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
|
from typing import Dict, Optional
|
||||||
|
|
||||||
from jedi.inference.names import AbstractArbitraryName
|
from jedi.inference.names import AbstractArbitraryName
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from pydoc_data import topics as pydoc_topics
|
from pydoc_data import topics
|
||||||
|
pydoc_topics: Optional[Dict[str, str]] = topics.topics
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# Python 3.6.8 embeddable does not have pydoc_data.
|
# Python 3.6.8 embeddable does not have pydoc_data.
|
||||||
pydoc_topics = None
|
pydoc_topics = None
|
||||||
@@ -44,6 +46,6 @@ def imitate_pydoc(string):
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return pydoc_topics.topics[label].strip() if pydoc_topics else ''
|
return pydoc_topics[label].strip() if pydoc_topics else ''
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return ''
|
return ''
|
||||||
|
|||||||
Reference in New Issue
Block a user