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

Method update

bpython/repl.py:303–327  ·  view source on GitHub ↗

Called to reset the match index and update the word being replaced Should only be called if there's a target to update - otherwise, call clear

(
        self,
        cursor_offset: int,
        current_line: str,
        matches: list[str],
        completer: autocomplete.BaseCompletionType,
    )

Source from the content-addressed store, hash-verified

301 return new_cursor_offset, new_line
302
303 def update(
304 self,
305 cursor_offset: int,
306 current_line: str,
307 matches: list[str],
308 completer: autocomplete.BaseCompletionType,
309 ) -> None:
310 """Called to reset the match index and update the word being replaced
311
312 Should only be called if there's a target to update - otherwise, call
313 clear"""
314
315 if matches is None:
316 raise ValueError("Matches may not be None.")
317
318 self.orig_cursor_offset = cursor_offset
319 self.orig_line = current_line
320 self.matches = matches
321 self.completer = completer
322 self.index = -1
323 lp = self.completer.locate(self.orig_cursor_offset, self.orig_line)
324 assert lp is not None
325 self.start = lp.start
326 self.end = lp.stop
327 self.current_word = lp.word
328
329 def clear(self) -> None:
330 self.matches = []

Callers 12

substitute_cseqMethod · 0.95
do_BpythonMethod · 0.80
__init__Method · 0.80
mainFunction · 0.80
completeMethod · 0.80
__init__Method · 0.80
completeMethod · 0.80
matchesMethod · 0.80
matchesMethod · 0.80
exec_codeFunction · 0.80
test_load_themeMethod · 0.80
test_updateMethod · 0.80

Calls 1

locateMethod · 0.45

Tested by 2

test_load_themeMethod · 0.64
test_updateMethod · 0.64