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

Function current_single_word

bpython/line.py:253–258  ·  view source on GitHub ↗

the un-dotted word just before or under the cursor

(cursor_offset: int, line: str)

Source from the content-addressed store, hash-verified

251
252
253def current_single_word(cursor_offset: int, line: str) -> LinePart | None:
254 """the un-dotted word just before or under the cursor"""
255 for m in _current_single_word_re.finditer(line):
256 if m.start(1) <= cursor_offset <= m.end(1):
257 return LinePart(m.start(1), m.end(1), m.group(1))
258 return None
259
260
261def current_dotted_attribute(cursor_offset: int, line: str) -> LinePart | None:

Callers

nothing calls this directly

Calls 3

LinePartClass · 0.85
finditerMethod · 0.80
startMethod · 0.80

Tested by

no test coverage detected