MCPcopy Index your code
hub / github.com/bpython/bpython / current_dict_key

Function current_dict_key

bpython/line.py:78–83  ·  view source on GitHub ↗

If in dictionary completion, return the current key

(cursor_offset: int, line: str)

Source from the content-addressed store, hash-verified

76
77
78def current_dict_key(cursor_offset: int, line: str) -> LinePart | None:
79 """If in dictionary completion, return the current key"""
80 for m in _current_dict_key_re.finditer(line):
81 if m.start(1) <= cursor_offset <= m.end(1):
82 return LinePart(m.start(1), m.end(1), m.group(1))
83 return None
84
85
86# capture valid identifier name if followed by `[` character

Callers

nothing calls this directly

Calls 3

LinePartClass · 0.85
finditerMethod · 0.80
startMethod · 0.80

Tested by

no test coverage detected