MCPcopy Index your code
hub / github.com/python/cpython / get_line_info

Function get_line_info

Lib/idlelib/codecontext.py:31–42  ·  view source on GitHub ↗

Return tuple of (line indent value, codeline, block start keyword). The indentation of empty lines (or comment lines) is INFINITY. If the line does not start a block, the keyword value is False.

(codeline)

Source from the content-addressed store, hash-verified

29
30
31def get_line_info(codeline):
32 """Return tuple of (line indent value, codeline, block start keyword).
33
34 The indentation of empty lines (or comment lines) is INFINITY.
35 If the line does not start a block, the keyword value is False.
36 """
37 spaces, firstword = get_spaces_firstword(codeline)
38 indent = len(spaces)
39 if len(codeline) == indent or codeline[indent] == '#':
40 indent = INFINITY
41 opener = firstword in BLOCKOPENERS and firstword
42 return indent, codeline, opener
43
44
45class CodeContext:

Callers 1

get_contextMethod · 0.85

Calls 1

get_spaces_firstwordFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…