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
Fix DeprecationWarning on autocompletion with jedi 0.17.0 #12218
Conversation
…unctions themselves like `Script(...).complete(line, column)`
…unctions themselves like `Script(...).complete(line, column)`
…unctions themselves like `Script(...).complete(line, column)`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! It's just now clear to me why your changes fixed the problem. Could you please give us some running examples?
(I'm unable at this moment to run the project, so that would help me)
IPython/core/completer.py
Outdated
try_jedi = True | ||
|
||
try: | ||
# find the first token in the current tree -- if it is a ' or " then we are in a string | ||
completing_string = False | ||
try: | ||
first_child = next(c for c in interpreter._get_module().tree_node.children if hasattr(c, 'value')) | ||
first_child = next(c for c in script._get_module().tree_node.children if hasattr(c, 'value')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you keep interpreter
you don't have to change the following lines.
IPython/core/completer.py
Outdated
@@ -1371,15 +1371,14 @@ def _jedi_matches(self, cursor_column:int, cursor_line:int, text:str): | |||
else: | |||
raise ValueError("Don't understand self.omit__names == {}".format(self.omit__names)) | |||
|
|||
interpreter = jedi.Interpreter( | |||
text[:offset], namespaces, column=cursor_column, line=cursor_line + 1) | |||
script = jedi.Interpreter(text[:offset],namespaces) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change the name here from interpreter
to script
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, it’s my mistake.
I will fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I changed the variable name to “interpreter”, some checks were not successful.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the change!
About the errors, I don't know why but you can check the tests results by clicking on details
right next to them. I will try to take a look with it too tomorrow!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which is your local python version? On one of the failed checks, there is the following message:
Extension error:
Could not import extension configtraits (exception: cannot import name 'l_' from 'sphinx.locale' (/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/sphinx/locale/__init__.py))
Makefile:66: recipe for target 'html' failed
make: *** [html] Error 2
make: Leaving directory '/home/travis/build/ipython/ipython/docs'
The command "if [[ "$TRAVIS_PYTHON_VERSION" == "3.7" ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
pip install -r docs/requirements.txt
python tools/fixup_whats_new_pr.py
make -C docs/ html SPHINXOPTS="-W"
fi
" exited with 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anaconda python3.7.7 is my local python version.
But why my local python version affects travis-CI checks?
…unctions themselves like `Script(...).complete(line, column)`
Running Examples IPython 8.0.0.dev [before]
[after]
No Warnings |
…unctions themselves like `Script(...).complete(line, column)`
I couldn't pass the travis-ci checks, so I closed this PR and created another PR #12227. |
with jedi 0.17.0
throws a deprecation warning below
DeprecationWarning: Providing the column is now done in the functions themselves like
Script(...).complete(line, column)
So, I fixed it.