Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Jedi to 0.11.1 #762

Merged
merged 69 commits into from
Feb 13, 2018
Merged
Show file tree
Hide file tree
Changes from 67 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
7675901
Basic tokenizer
Dec 1, 2017
eb42669
Fixed property names
Dec 1, 2017
2756974
Tests, round I
Dec 1, 2017
c2c1ced
Tests, round II
Dec 2, 2017
a108c96
merge master
Dec 3, 2017
14864a5
tokenizer test
Dec 4, 2017
0ed51d6
Remove temorary change
Dec 4, 2017
51b544c
Fix merge issue
Dec 4, 2017
3cd11e6
Merge conflict
Dec 4, 2017
82e0ad1
Merge conflict
Dec 4, 2017
9295c1a
Completion test
Dec 4, 2017
06eb1a5
Fix last line
Dec 4, 2017
e9db8e0
Fix javascript math
Dec 4, 2017
d12ca03
Merge master
Dec 5, 2017
d8ab041
Make test await for results
Dec 5, 2017
db75cd0
Add license headers
Dec 5, 2017
9ab2c47
Rename definitions to types
Dec 5, 2017
d587485
License headers
Dec 5, 2017
1da5e0a
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Dec 5, 2017
7668cee
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Dec 11, 2017
1ac4932
Fix typo in completion details (typo)
Dec 11, 2017
2aa5a6c
Fix hover test
Dec 12, 2017
5db31bd
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Dec 12, 2017
560d2af
Russian translations
Dec 13, 2017
c71024d
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Dec 13, 2017
31aa087
Update to better translation
Dec 13, 2017
593ae05
Fix typo
Dec 13, 2017
e6d69bb
#70 How to get all parameter info when filling in a function param list
Dec 13, 2017
b5a23d3
Fix #70 How to get all parameter info when filling in a function para…
Dec 14, 2017
cd200f7
Clean up
Dec 14, 2017
7c33228
Clean imports
Dec 14, 2017
c4a6b90
CR feedback
Dec 14, 2017
f85b848
Trim whitespace for test stability
Dec 14, 2017
37c210b
More tests
Dec 15, 2017
61a5650
Better handle no-parameters documentation
Dec 15, 2017
a10305e
Better handle ellipsis and Python3
Dec 15, 2017
bfcae78
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Dec 15, 2017
42a5f79
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Dec 18, 2017
e4ba322
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Jan 8, 2018
7baec1a
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Jan 9, 2018
9cb43e7
#385 Auto-Indentation doesn't work after comment
Jan 9, 2018
5a9c3fd
#141 Auto indentation broken when return keyword involved
Jan 9, 2018
9800c4a
Undo changes
Jan 9, 2018
3205d33
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Jan 11, 2018
c1150d4
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Feb 1, 2018
30519c7
#627 Docstrings for builtin methods are not parsed correctly
Feb 5, 2018
96511cb
reStructuredText converter
Feb 5, 2018
c8670b9
Fix: period is not an operator
Feb 5, 2018
97f232f
Minor fixes
Feb 6, 2018
768bffe
Restructure
Feb 6, 2018
825f16b
Tests
Feb 6, 2018
eb36eef
Tests
Feb 6, 2018
bab4239
Code heuristics
Feb 6, 2018
2a30201
Baselines
Feb 6, 2018
e430ef8
HTML handling
Feb 6, 2018
1afa841
Lists
Feb 7, 2018
6bffb07
State machine
Feb 7, 2018
e436fde
Baselines
Feb 7, 2018
c03e619
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Feb 7, 2018
e52bcff
Squash
Feb 7, 2018
e6b8196
Merge branch 'master' of https://github.com/MikhailArkhipov/vscode-py…
Feb 7, 2018
3a0cfb1
no message
Feb 7, 2018
4616996
Merge branch 'master' of https://github.com/MikhailArkhipov/vscode-py…
Feb 7, 2018
35838b9
Whitespace difference
Feb 7, 2018
656a56b
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Feb 12, 2018
6a10786
Update Jedi to 0.11.1
Feb 12, 2018
d43f097
Enable Travis
Feb 12, 2018
f8db935
Test fixes
Feb 13, 2018
a8dc597
Undo change
Feb 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pythonFiles/release/jedi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
good text editor, while still having very good IDE features for Python.
"""

__version__ = '0.9.0'
__version__ = '0.11.1'

from jedi.api import Script, Interpreter, NotFoundError, set_debug_function
from jedi.api import preload_module, defined_names, names
from jedi.api import Script, Interpreter, set_debug_function, \
preload_module, names
from jedi import settings
19 changes: 12 additions & 7 deletions pythonFiles/release/jedi/__main__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
from sys import argv
import sys
from os.path import join, dirname, abspath, isdir


if len(argv) == 2 and argv[1] == 'repl':
# don't want to use __main__ only for repl yet, maybe we want to use it for
# something else. So just use the keyword ``repl`` for now.
print(join(dirname(abspath(__file__)), 'api', 'replstartup.py'))
elif len(argv) > 1 and argv[1] == 'linter':
def _start_linter():
"""
This is a pre-alpha API. You're not supposed to use it at all, except for
testing. It will very likely change.
"""
import jedi
import sys

if '--debug' in sys.argv:
jedi.set_debug_function()
Expand All @@ -37,7 +32,17 @@
print(error)
except Exception:
if '--pdb' in sys.argv:
import traceback
traceback.print_exc()
import pdb
pdb.post_mortem()
else:
raise


if len(sys.argv) == 2 and sys.argv[1] == 'repl':
# don't want to use __main__ only for repl yet, maybe we want to use it for
# something else. So just use the keyword ``repl`` for now.
print(join(dirname(abspath(__file__)), 'api', 'replstartup.py'))
elif len(sys.argv) > 1 and sys.argv[1] == 'linter':
_start_linter()
146 changes: 116 additions & 30 deletions pythonFiles/release/jedi/_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,60 +6,150 @@
import imp
import os
import re
import pkgutil
import warnings
try:
import importlib
except ImportError:
pass

# Cannot use sys.version.major and minor names, because in Python 2.6 it's not
# a namedtuple.
is_py3 = sys.version_info[0] >= 3
is_py33 = is_py3 and sys.version_info.minor >= 3
is_py33 = is_py3 and sys.version_info[1] >= 3
is_py34 = is_py3 and sys.version_info[1] >= 4
is_py35 = is_py3 and sys.version_info[1] >= 5
is_py26 = not is_py3 and sys.version_info[1] < 7
py_version = int(str(sys.version_info[0]) + str(sys.version_info[1]))


def find_module_py33(string, path=None):
loader = importlib.machinery.PathFinder.find_module(string, path)
class DummyFile(object):
def __init__(self, loader, string):
self.loader = loader
self.string = string

def read(self):
return self.loader.get_source(self.string)

def close(self):
del self.loader


def find_module_py34(string, path=None, fullname=None):
implicit_namespace_pkg = False
spec = None
loader = None

spec = importlib.machinery.PathFinder.find_spec(string, path)
if hasattr(spec, 'origin'):
origin = spec.origin
implicit_namespace_pkg = origin == 'namespace'

# We try to disambiguate implicit namespace pkgs with non implicit namespace pkgs
if implicit_namespace_pkg:
fullname = string if not path else fullname
implicit_ns_info = ImplicitNSInfo(fullname, spec.submodule_search_locations._path)
return None, implicit_ns_info, False

# we have found the tail end of the dotted path
if hasattr(spec, 'loader'):
loader = spec.loader
return find_module_py33(string, path, loader)

def find_module_py33(string, path=None, loader=None, fullname=None):
loader = loader or importlib.machinery.PathFinder.find_module(string, path)

if loader is None and path is None: # Fallback to find builtins
try:
loader = importlib.find_loader(string)
with warnings.catch_warnings(record=True):
# Mute "DeprecationWarning: Use importlib.util.find_spec()
# instead." While we should replace that in the future, it's
# probably good to wait until we deprecate Python 3.3, since
# it was added in Python 3.4 and find_loader hasn't been
# removed in 3.6.
loader = importlib.find_loader(string)
except ValueError as e:
# See #491. Importlib might raise a ValueError, to avoid this, we
# just raise an ImportError to fix the issue.
raise ImportError("Originally ValueError: " + e.message)
raise ImportError("Originally " + repr(e))

if loader is None:
raise ImportError("Couldn't find a loader for {0}".format(string))

try:
is_package = loader.is_package(string)
if is_package:
module_path = os.path.dirname(loader.path)
module_file = None
if hasattr(loader, 'path'):
module_path = os.path.dirname(loader.path)
else:
# At least zipimporter does not have path attribute
module_path = os.path.dirname(loader.get_filename(string))
if hasattr(loader, 'archive'):
module_file = DummyFile(loader, string)
else:
module_file = None
else:
module_path = loader.get_filename(string)
module_file = open(module_path, 'rb')
module_file = DummyFile(loader, string)
except AttributeError:
# ExtensionLoader has not attribute get_filename, instead it has a
# path attribute that we can use to retrieve the module path
try:
module_path = loader.path
module_file = open(loader.path, 'rb')
module_file = DummyFile(loader, string)
except AttributeError:
module_path = string
module_file = None
finally:
is_package = False

if hasattr(loader, 'archive'):
module_path = loader.archive

return module_file, module_path, is_package


def find_module_pre_py33(string, path=None):
module_file, module_path, description = imp.find_module(string, path)
module_type = description[2]
return module_file, module_path, module_type is imp.PKG_DIRECTORY
def find_module_pre_py33(string, path=None, fullname=None):
try:
module_file, module_path, description = imp.find_module(string, path)
module_type = description[2]
return module_file, module_path, module_type is imp.PKG_DIRECTORY
except ImportError:
pass

if path is None:
path = sys.path
for item in path:
loader = pkgutil.get_importer(item)
if loader:
try:
loader = loader.find_module(string)
if loader:
is_package = loader.is_package(string)
is_archive = hasattr(loader, 'archive')
try:
module_path = loader.get_filename(string)
except AttributeError:
# fallback for py26
try:
module_path = loader._get_filename(string)
except AttributeError:
continue
if is_package:
module_path = os.path.dirname(module_path)
if is_archive:
module_path = loader.archive
file = None
if not is_package or is_archive:
file = DummyFile(loader, string)
return (file, module_path, is_package)
except ImportError:
pass
raise ImportError("No module named {0}".format(string))


find_module = find_module_py33 if is_py33 else find_module_pre_py33
find_module = find_module_py34 if is_py34 else find_module
find_module.__doc__ = """
Provides information about a module.

Expand All @@ -71,28 +161,18 @@ def find_module_pre_py33(string, path=None):
"""


class ImplicitNSInfo(object):
"""Stores information returned from an implicit namespace spec"""
def __init__(self, name, paths):
self.name = name
self.paths = paths

# unicode function
try:
unicode = unicode
except NameError:
unicode = str

if is_py3:
u = lambda s: s
else:
u = lambda s: s.decode('utf-8')

u.__doc__ = """
Decode a raw string into unicode object. Do nothing in Python 3.
"""

# exec function
if is_py3:
def exec_function(source, global_map):
exec(source, global_map)
else:
eval(compile("""def exec_function(source, global_map):
exec source in global_map """, 'blub', 'exec'))

# re-raise function
if is_py3:
Expand Down Expand Up @@ -147,7 +227,8 @@ def u(string):
"""
if is_py3:
return str(string)
elif not isinstance(string, unicode):

if not isinstance(string, unicode):
return unicode(str(string), 'UTF-8')
return string

Expand All @@ -174,6 +255,11 @@ def literal_eval(string):
except ImportError:
from itertools import izip_longest as zip_longest # Python 2

try:
FileNotFoundError = FileNotFoundError
except NameError:
FileNotFoundError = IOError


def no_unicode_pprint(dct):
"""
Expand Down
Loading