Skip to content

Commit

Permalink
Merge branch 'master' of github.com:davidhalter/jedi
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhalter committed Nov 5, 2017
2 parents fc03977 + 9cbcf00 commit e783611
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
3 changes: 2 additions & 1 deletion AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Mathias Rav (@Mortal) <[email protected]>
Daniel Fiterman (@dfit99) <[email protected]>
Simon Ruggier (@sruggier)
Élie Gouzien (@ElieGouzien)

Robin Roth (@robinro)
Malte Plath (@langsamer)

Note: (@user) means a github user name.
2 changes: 1 addition & 1 deletion docs/docs/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
<http://www.youtube.com/watch?v=5BDO3pyavOY>`_ of Monty Python Jedis :-).
<https://youtu.be/yHRJLIf7wMU>`_ of Monty Python Jedis :-).

But actually the name hasn't so much to do with Star Wars. It's part of my
second name.
Expand Down
2 changes: 2 additions & 0 deletions jedi/evaluate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ def goto(self, context, name):
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)
Expand Down
11 changes: 9 additions & 2 deletions jedi/evaluate/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -89,6 +92,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:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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=[
Expand Down
11 changes: 11 additions & 0 deletions test/completion/async_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit e783611

Please sign in to comment.