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

Method do

Lib/_pyrepl/historical_reader.py:112–136  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

110
111class yank_arg(commands.Command):
112 def do(self) -> None:
113 r = self.reader
114 if r.last_command is self.__class__:
115 r.yank_arg_i += 1
116 else:
117 r.yank_arg_i = 0
118 if r.historyi < r.yank_arg_i:
119 r.error("beginning of history list")
120 return
121 a = r.get_arg(-1)
122 # XXX how to split?
123 words = r.get_item(r.historyi - r.yank_arg_i - 1).split()
124 if a < -len(words) or a >= len(words):
125 r.error("no such arg")
126 return
127 w = words[a]
128 b = r.buffer
129 if r.yank_arg_i > 0:
130 o = len(r.yank_arg_yanked)
131 else:
132 o = 0
133 b[r.pos - o : r.pos] = list(w)
134 r.yank_arg_yanked = w
135 r.pos += len(w) - o
136 r.dirty = True
137
138
139class forward_history_isearch(commands.Command):

Callers

nothing calls this directly

Calls 5

listClass · 0.85
get_argMethod · 0.80
get_itemMethod · 0.80
errorMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected