From 88cf592c9534c00776789fb3c221334dbdd66d64 Mon Sep 17 00:00:00 2001 From: Robin Roth Date: Sat, 28 Oct 2017 13:34:25 +0200 Subject: [PATCH 01/13] Make goto work with await Created together with @langsamer and @davidhalter --- AUTHORS.txt | 3 ++- jedi/evaluate/__init__.py | 2 ++ jedi/evaluate/helpers.py | 4 ++++ test/completion/async_.py | 11 +++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 52204a8b..29f46765 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -44,6 +44,7 @@ Mathias Rav (@Mortal) Daniel Fiterman (@dfit99) Simon Ruggier (@sruggier) Élie Gouzien (@ElieGouzien) - +Robin Roth (@robinro) +Malte Plath (@langsamer) Note: (@user) means a github user name. diff --git a/jedi/evaluate/__init__.py b/jedi/evaluate/__init__.py index d1453f32..20461071 100644 --- a/jedi/evaluate/__init__.py +++ b/jedi/evaluate/__init__.py @@ -249,6 +249,8 @@ class Evaluator(object): else: i = trailer.parent.children.index(trailer) to_evaluate = trailer.parent.children[:i] + if to_evaluate[0] == 'await': + to_evaluate.pop(0) context_set = context.eval_node(to_evaluate[0]) for trailer in to_evaluate[1:]: context_set = eval_trailer(context, context_set, trailer) diff --git a/jedi/evaluate/helpers.py b/jedi/evaluate/helpers.py index 6652287b..44522f8b 100644 --- a/jedi/evaluate/helpers.py +++ b/jedi/evaluate/helpers.py @@ -89,6 +89,10 @@ def evaluate_call_of_leaf(context, leaf, cut_own_trailer=False): base = power.children[0] trailers = power.children[1:cut] + if base == 'await': + base = trailers[0] + trailers = trailers[1:] + values = context.eval_node(base) from jedi.evaluate.syntax_tree import eval_trailer for trailer in trailers: diff --git a/test/completion/async_.py b/test/completion/async_.py index c6035e37..b2202137 100644 --- a/test/completion/async_.py +++ b/test/completion/async_.py @@ -23,3 +23,14 @@ async def x2(): async with open('asdf') as f: #? ['readlines'] f.readlines + +class A(): + @staticmethod + async def b(c=1, d=2): + return 1 + +#! 9 ['def b'] +await A.b() + +#! 11 ['param d=2'] +await A.b(d=3) From f13b4e800a55e7a4a991456c32daf4190360b148 Mon Sep 17 00:00:00 2001 From: Robin Roth Date: Sat, 28 Oct 2017 14:14:44 +0200 Subject: [PATCH 02/13] Install docopt for dev setup --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 21db855a..72df7c53 100755 --- a/setup.py +++ b/setup.py @@ -31,6 +31,7 @@ setup(name='jedi', long_description=readme, packages=find_packages(exclude=['test']), install_requires=install_requires, + extras_require={'dev': ['docopt']}, package_data={'jedi': ['evaluate/compiled/fake/*.pym']}, platforms=['any'], classifiers=[ From 1428b67c4d315c5b7136a1a98c6a832068eb4525 Mon Sep 17 00:00:00 2001 From: langsamer <25152973+langsamer@users.noreply.github.com> Date: Sun, 29 Oct 2017 02:00:28 +0200 Subject: [PATCH 03/13] Replace TODO by explanation of the parameter 'cut_own_trailer' (it cannot be dropped!) (#978) --- jedi/evaluate/helpers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jedi/evaluate/helpers.py b/jedi/evaluate/helpers.py index 44522f8b..3b21e01b 100644 --- a/jedi/evaluate/helpers.py +++ b/jedi/evaluate/helpers.py @@ -58,8 +58,11 @@ def evaluate_call_of_leaf(context, leaf, cut_own_trailer=False): If you're using the leaf, e.g. the bracket `)` it will return ``list([])``. - # TODO remove cut_own_trailer option, since its always used with it. Just - # ignore it, It's not what we want anyway. Or document it better? + We use this function for two purposes. Given an expression ``bar.foo``, + we may want to + - infer the type of ``foo`` to offer completions after foo + - infer the type of ``bar`` to be able to jump to the definition of foo + The option ``cut_own_trailer`` must be set to true for the second purpose. """ trailer = leaf.parent # The leaf may not be the last or first child, because there exist three From 9cbcf00aa2762c23b0884dd513bacc4113305300 Mon Sep 17 00:00:00 2001 From: Samuel Bishop Date: Mon, 30 Oct 2017 11:55:50 +0800 Subject: [PATCH 04/13] Fix dead link. Hopefully this is close enough to the original video. --- docs/docs/features.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/features.rst b/docs/docs/features.rst index f00e4203..aef32708 100644 --- a/docs/docs/features.rst +++ b/docs/docs/features.rst @@ -222,7 +222,7 @@ A little history The Star Wars Jedi are awesome. My Jedi software tries to imitate a little bit of the precognition the Jedi have. There's even an awesome `scene -`_ of Monty Python Jedis :-). +`_ of Monty Python Jedis :-). But actually the name hasn't so much to do with Star Wars. It's part of my second name. From fc0397732ea87c2d641f2d2fdef0b13096d945b8 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sun, 5 Nov 2017 15:05:09 +0100 Subject: [PATCH 05/13] Update the parso dependency --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2c72b5f4..2af26c8c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -parso==0.1.0 +parso==0.1.1 From 6c355a0ac2511a66d16aeca71c50054c72f73504 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sun, 5 Nov 2017 15:07:06 +0100 Subject: [PATCH 06/13] Update version --- jedi/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jedi/__init__.py b/jedi/__init__.py index 08e41e7d..1a1080ad 100644 --- a/jedi/__init__.py +++ b/jedi/__init__.py @@ -36,7 +36,7 @@ As you see Jedi is pretty simple and allows you to concentrate on writing a good text editor, while still having very good IDE features for Python. """ -__version__ = '0.11.0' +__version__ = '0.11.1' from jedi.api import Script, Interpreter, set_debug_function, \ preload_module, names From 22c97b0917a3e9db934f7ec6586698fef63bed05 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 6 Nov 2017 10:29:06 -0800 Subject: [PATCH 07/13] FIX: install on python 3.7 (#971) * FIX: install on python 3.7 https://github.com/python/cpython/pull/46 / https://bugs.python.org/issue29463 move the module comment into the AST node and hence out of the tree which means the 2nd entry in the tree is now the import rather than the `__version__` string. Adds nightly on travis. * BLD: update python tags in setup.py * CI: switch to 3.7-dev * CI: allow failure on 3.7 dev --- .travis.yml | 4 +++- setup.py | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8bd67fff..7916832e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,11 +8,14 @@ python: - 3.5 - 3.6 - pypy + - "3.7-dev" + matrix: allow_failures: - python: pypy - env: TOXENV=cov - env: TOXENV=sith + - python: 3.7-dev include: - python: 3.5 env: TOXENV=cov @@ -27,4 +30,3 @@ after_script: pip install --quiet coveralls; coveralls; fi - diff --git a/setup.py b/setup.py index 72df7c53..3f3b7e54 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages import ast - +import sys __AUTHOR__ = 'David Halter' __AUTHOR_EMAIL__ = 'davidhalter88@gmail.com' @@ -11,7 +11,10 @@ __AUTHOR_EMAIL__ = 'davidhalter88@gmail.com' # Get the version from within jedi. It's defined in exactly one place now. with open('jedi/__init__.py') as f: tree = ast.parse(f.read()) -version = tree.body[1].value.s +if sys.version_info > (3, 7): + version = tree.body[0].value.s +else: + version = tree.body[1].value.s readme = open('README.rst').read() + '\n\n' + open('CHANGELOG.rst').read() with open('requirements.txt') as f: @@ -47,6 +50,8 @@ setup(name='jedi', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Text Editors :: Integrated Development Environments (IDE)', 'Topic :: Utilities', From 62915686afa37da21ff42605e5f8b9fd7bcdf6ab Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 14 Dec 2017 22:29:13 +0100 Subject: [PATCH 08/13] Don't use pytest 3.3+ because it removed support for Python 3.3 --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 5e0c74a7..6de6cc1e 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ envlist = py26, py27, py33, py34, py35, py36 [testenv] deps = - pytest>=2.3.5 + pytest>=2.3.5, < 3.3 pytest-cache # docopt for sith doctests docopt From e621e8590c54201d8d66d37100435d8a8035e2a0 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 29 Nov 2017 13:37:28 +0100 Subject: [PATCH 09/13] Improve IntegrationTestCase.__repr__ Having the path (together with the line only) makes it easy to go to the actual test. --- test/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/run.py b/test/run.py index 00b0c651..a3b0c0df 100755 --- a/test/run.py +++ b/test/run.py @@ -158,7 +158,7 @@ class IntegrationTestCase(object): return self.line_nr - 1 def __repr__(self): - return '<%s: %s:%s:%s>' % (self.__class__.__name__, self.module_name, + return '<%s: %s:%s %r>' % (self.__class__.__name__, self.path, self.line_nr_test, self.line.rstrip()) def script(self): From e526cb1ae3c8f58f1bb7c91e8adc4d965f247cc7 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 14 Dec 2017 22:50:13 +0100 Subject: [PATCH 10/13] Don't run Python 2.6 in tox by default Python 2.6 seems to be harder and harder to run in tox if setuptools is not properly configured for it. It's still possible to run it and it still runs on travis. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 6de6cc1e..7b0a537d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py26, py27, py33, py34, py35, py36 +envlist = py27, py33, py34, py35, py36 [testenv] deps = pytest>=2.3.5, < 3.3 From 02f238ce08f2d7f9c4af9a17cbf5754836775e2f Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 14 Dec 2017 22:51:02 +0100 Subject: [PATCH 11/13] Add the executable bit to deploy-master.sh --- deploy-master.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 deploy-master.sh diff --git a/deploy-master.sh b/deploy-master.sh old mode 100644 new mode 100755 From 69237c4aa6cec5be5b0f0f0a5cd9e6187a81b2c8 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Fri, 15 Dec 2017 10:45:27 +0100 Subject: [PATCH 12/13] Add a changelog for jedi 0.11.1 --- CHANGELOG.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1d52dc52..d9873229 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,12 @@ Changelog --------- +0.11.1 (2017-12-14) ++++++++++++++++++++ + +- Parso update - the caching layer was broken +- Better usages - a lot of internal code was ripped out and improved. + 0.11.0 (2017-09-20) +++++++++++++++++++ From f37089e54b156b562d2940d295b1781697d0a703 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Fri, 15 Dec 2017 10:47:14 +0100 Subject: [PATCH 13/13] Bump the version number --- jedi/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jedi/__init__.py b/jedi/__init__.py index 1a1080ad..0676121c 100644 --- a/jedi/__init__.py +++ b/jedi/__init__.py @@ -36,7 +36,7 @@ As you see Jedi is pretty simple and allows you to concentrate on writing a good text editor, while still having very good IDE features for Python. """ -__version__ = '0.11.1' +__version__ = '0.12.0' from jedi.api import Script, Interpreter, set_debug_function, \ preload_module, names