You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment inspection of arguments in function calls is not possible as the function is inspected instead. This is because do_inspect relies on IPython.utils.tokenutil.generate_tokens:
The behaviour of generate_tokens has changed in ipython/ipython@240eef9 . Before it would return the tokens of names, including parameters and names, even if they were inside a function call. Not all edge cases were handled correctly, but for most day-to-day inspection tasks were served fine. Now generate_tokens returns function names if the cursor is positioned inside the parentheses:
from IPython.utils.tokenutil import generate_tokens, token_at_cursor
from io import StringIO
code = 'func(param1, param2=arg)'
tokens = list(generate_tokens(StringIO(code).readline))
pos = dict(func=3, param1=8, param2=15, arg=22)
# Current behaviour
dict((k, token_at_cursor(code, v) for k, v in pos.items())
# Output: {'func': 'func', 'param1': 'func', 'param2': 'func', 'arg': 'func'}
The text was updated successfully, but these errors were encountered:
At the moment inspection of arguments in function calls is not possible as the function is inspected instead. This is because
do_inspect
relies onIPython.utils.tokenutil.generate_tokens
:ipykernel/ipykernel/ipkernel.py
Lines 544 to 546 in c24b252
The behaviour of
generate_tokens
has changed in ipython/ipython@240eef9 . Before it would return the tokens of names, including parameters and names, even if they were inside a function call. Not all edge cases were handled correctly, but for most day-to-day inspection tasks were served fine. Nowgenerate_tokens
returns function names if the cursor is positioned inside the parentheses:The text was updated successfully, but these errors were encountered: