MCPcopy Index your code
hub / github.com/python/cpython / do

Method do

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

Source from the content-addressed store, hash-verified

387
388class transpose_characters(EditCommand):
389 def do(self) -> None:
390 r = self.reader
391 b = r.buffer
392 s = r.pos - 1
393 if s < 0:
394 r.error("cannot transpose at start of buffer")
395 else:
396 if s == len(b):
397 s -= 1
398 t = min(s + r.get_arg(), len(b) - 1)
399 c = b[s]
400 del b[s]
401 b.insert(t, c)
402 r.pos = t
403 r.dirty = True
404
405
406class backspace(EditCommand):

Callers

nothing calls this directly

Calls 3

get_argMethod · 0.80
errorMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected