A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://ipython.readthedocs.io/en/latest/api/generated/IPython.utils.tokenutil.html below:

Website Navigation


utils.tokenutil — IPython 9.5.0.dev documentation

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

1 Class
class IPython.utils.tokenutil.Token(token, text, start, end, line)

Bases: NamedTuple

end: int

Alias for field number 3

line: str

Alias for field number 4

start: int

Alias for field number 2

text: str

Alias for field number 1

token: int

Alias for field number 0

4 Functions
IPython.utils.tokenutil.generate_tokens(readline) 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)

IPython.utils.tokenutil.token_at_cursor(cell: str, cursor_pos: int = 0) str

Get the token at a given cursor

Used for introspection.

Function calls are prioritized, so the token for the callable will be returned if the cursor is anywhere inside the call.

Parameters:
  • cell (str) – A block of Python code

  • cursor_pos (int) – The location of the cursor in the block where the token should be found


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4