MCPcopy Index your code
hub / github.com/RustPython/RustPython / do

Method do

Lib/_pyrepl/commands.py:380–394  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

378
379class transpose_characters(EditCommand):
380 def do(self) -> None:
381 r = self.reader
382 b = r.buffer
383 s = r.pos - 1
384 if s < 0:
385 r.error("cannot transpose at start of buffer")
386 else:
387 if s == len(b):
388 s -= 1
389 t = min(s + r.get_arg(), len(b) - 1)
390 c = b[s]
391 del b[s]
392 b.insert(t, c)
393 r.pos = t
394 r.dirty = True
395
396
397class backspace(EditCommand):

Callers

nothing calls this directly

Calls 5

lenFunction · 0.85
minFunction · 0.85
errorMethod · 0.45
get_argMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected