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

Method get

Lib/idlelib/idle_test/mock_tk.py:201–217  ·  view source on GitHub ↗

Return slice from index1 to index2 (default is 'index1+1').

(self, index1, index2=None)

Source from the content-addressed store, hash-verified

199 self.data[line+len(chars)-1] += after
200
201 def get(self, index1, index2=None):
202 "Return slice from index1 to index2 (default is 'index1+1')."
203
204 startline, startchar = self._decode(index1)
205 if index2 is None:
206 endline, endchar = startline, startchar+1
207 else:
208 endline, endchar = self._decode(index2)
209
210 if startline == endline:
211 return self.data[startline][startchar:endchar]
212 else:
213 lines = [self.data[startline][startchar:]]
214 for i in range(startline+1, endline):
215 lines.append(self.data[i])
216 lines.append(self.data[endline][:endchar])
217 return ''.join(lines)
218
219 def delete(self, index1, index2=None):
220 '''Delete slice from index1 to index2 (default is 'index1+1').

Callers

nothing calls this directly

Calls 3

_decodeMethod · 0.95
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected