1
0
forked from VimPlug/jedi

Merge with master.

This commit is contained in:
Dave Halter
2017-01-02 13:00:58 +01:00
12 changed files with 211 additions and 34 deletions

View File

@@ -105,7 +105,7 @@ class Script(object):
if source is None:
# TODO add a better warning than the traceback!
with open(path) as f:
with open(path, 'rb') as f:
source = f.read()
self._source = common.source_to_unicode(source, encoding)
@@ -206,8 +206,8 @@ class Script(object):
def goto_assignments(self, follow_imports=False):
"""
Return the first definition found. Imports and statements aren't
followed. Multiple objects may be returned, because Python itself is a
Return the first definition found, while optionally following imports.
Multiple objects may be returned, because Python itself is a
dynamic language, which means depending on an option you can have two
different versions of a function.

View File

@@ -8,8 +8,13 @@ from jedi.parser.tree import Leaf
try:
from pydoc_data import topics as pydoc_topics
except ImportError:
# Python 2.6
import pydoc_topics
# Python 2
try:
import pydoc_topics
except ImportError:
# This is for Python 3 embeddable version, which dont have
# pydoc_data module in its file python3x.zip.
pydoc_topics = None
if is_py3:
if is_py35:
@@ -108,6 +113,9 @@ def imitate_pydoc(string):
It's not possible to get the pydoc's without starting the annoying pager
stuff.
"""
if pydoc_topics is None:
return ''
# str needed because of possible unicode stuff in py2k (pydoc doesn't work
# with unicode strings)
string = str(string)