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

Function current_object_attribute

bpython/line.py:147–160  ·  view source on GitHub ↗

If in attribute completion, the attribute being completed

(cursor_offset: int, line: str)

Source from the content-addressed store, hash-verified

145
146
147def current_object_attribute(cursor_offset: int, line: str) -> LinePart | None:
148 """If in attribute completion, the attribute being completed"""
149 # TODO replace with more general current_expression_attribute
150 match = current_word(cursor_offset, line)
151 if match is None:
152 return None
153 matches = _current_object_attribute_re.finditer(match.word)
154 next(matches)
155 for m in matches:
156 if m.start(1) + match.start <= cursor_offset <= m.end(1) + match.start:
157 return LinePart(
158 m.start(1) + match.start, m.end(1) + match.start, m.group(1)
159 )
160 return None
161
162
163_current_from_import_from_re = LazyReCompile(

Callers

nothing calls this directly

Calls 4

current_wordFunction · 0.85
LinePartClass · 0.85
finditerMethod · 0.80
startMethod · 0.80

Tested by

no test coverage detected