forked from VimPlug/jedi
New "with ignored(*exceptions)" context manager
This commit is contained in:
+4
-3
@@ -1,7 +1,10 @@
|
||||
from __future__ import with_statement
|
||||
|
||||
import pydoc
|
||||
import keyword
|
||||
|
||||
from jedi._compatibility import is_py3k
|
||||
from jedi import common
|
||||
import builtin
|
||||
|
||||
try:
|
||||
@@ -63,12 +66,10 @@ def imitate_pydoc(string):
|
||||
# with unicode strings)
|
||||
string = str(string)
|
||||
h = pydoc.help
|
||||
try:
|
||||
with common.ignored(KeyError):
|
||||
# try to access symbols
|
||||
string = h.symbols[string]
|
||||
string, _, related = string.partition(' ')
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
get_target = lambda s: h.topics.get(s, h.keywords.get(s))
|
||||
while isinstance(string, str):
|
||||
|
||||
Reference in New Issue
Block a user