If in attribute completion, the object on which attribute should be looked up.
(cursor_offset: int, line: str)
| 126 | |
| 127 | |
| 128 | def 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_]*)[.]?") |
nothing calls this directly
no test coverage detected