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

Function current_object

bpython/line.py:128–141  ·  view source on GitHub ↗

If in attribute completion, the object on which attribute should be looked up.

(cursor_offset: int, line: str)

Source from the content-addressed store, hash-verified

126
127
128def current_object(cursor_offset: int, line: str) -> LinePart | None:
129 """If in attribute completion, the object on which attribute should be
130 looked up."""
131 match = current_word(cursor_offset, line)
132 if match is None:
133 return None
134 s = ".".join(
135 m.group(1)
136 for m in _current_object_re.finditer(match.word)
137 if m.end(1) + match.start < cursor_offset
138 )
139 if not s:
140 return None
141 return LinePart(match.start, match.start + len(s), s)
142
143
144_current_object_attribute_re = LazyReCompile(r"([\w_][\w0-9_]*)[.]?")

Callers

nothing calls this directly

Calls 3

current_wordFunction · 0.85
LinePartClass · 0.85
finditerMethod · 0.80

Tested by

no test coverage detected