Important
This documentation covers IPython versions 6.0 and higher. Beginning with version 6.0, IPython stopped supporting compatibility with Python versions lower than 3.3 including all versions of Python 2.7.
If you are looking for an IPython version compatible with Python 2.7, please use the IPython 5.x LTS release and refer to its documentation (LTS is the long term support release).
Module: utils.tokenutil
¶
Token-related utilities
4 Functions¶
- IPython.utils.tokenutil.generate_tokens(readline)¶
wrap generate_tkens to catch EOF errors
- IPython.utils.tokenutil.generate_tokens_catch_errors(readline, extra_errors_to_catch: List[str] | None = None)¶
- IPython.utils.tokenutil.line_at_cursor(cell, cursor_pos=0)¶
Return the line in a cell at a given cursor position
Used for calling line-based APIs that don’t support multi-line input, yet.
- Parameters:
cell (str) – multiline block of text
cursor_pos (integer) – the cursor position
- Returns:
(line, offset) – The line with the current cursor, and the character offset of the start of the line.
- Return type:
(string, integer)