MCPcopy Create free account
hub / github.com/ipython/ipython / generate_tokens

Function generate_tokens

IPython/utils/tokenutil.py:15–22  ·  view source on GitHub ↗

wrap generate_tokens to catch EOF errors

(readline)

Source from the content-addressed store, hash-verified

13Token = namedtuple('Token', ['token', 'text', 'start', 'end', 'line'])
14
15def generate_tokens(readline):
16 """wrap generate_tokens to catch EOF errors"""
17 try:
18 for token in tokenize.generate_tokens(readline):
19 yield token
20 except tokenize.TokenError:
21 # catch EOF error
22 return
23
24def line_at_cursor(cell, cursor_pos=0):
25 """Return the line in a cell at a given cursor position

Callers 5

token_at_cursorFunction · 0.85
format2Method · 0.85
format_recordMethod · 0.85
reset_tokenizerMethod · 0.85
_line_tokensFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected