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

Method substitute

bpython/repl.py:270–279  ·  view source on GitHub ↗

Returns a cursor offset and line with match substituted in

(self, match: str)

Source from the content-addressed store, hash-verified

268 return self.substitute(self.current())
269
270 def substitute(self, match: str) -> tuple[int, str]:
271 """Returns a cursor offset and line with match substituted in"""
272 assert self.completer is not None
273
274 lp = self.completer.locate(self.orig_cursor_offset, self.orig_line)
275 assert lp is not None
276 return (
277 lp.start + len(match),
278 self.orig_line[: lp.start] + match + self.orig_line[lp.stop :],
279 )
280
281 def is_cseq(self) -> bool:
282 return bool(

Callers 2

cur_lineMethod · 0.95
substitute_cseqMethod · 0.95

Calls 1

locateMethod · 0.45

Tested by

no test coverage detected