Module: utils.tokenutil
Token-related utilities
1 Class
4 Functions
- IPython.utils.tokenutil.generate_tokens(readline: Callable) Generator[TokenInfo, None, None]
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: str, cursor_pos: int = 0) tuple[str, int]
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)