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

Method _endex

Lib/idlelib/idle_test/mock_tk.py:172–184  ·  view source on GitHub ↗

Return position for 'end' or line overflow corresponding to endflag. -1: position before terminal \n; for .insert(), .delete 0: position after terminal \n; for .get, .delete index 1 1: same viewed as beginning of non-existent next line (for .index)

(self, endflag)

Source from the content-addressed store, hash-verified

170 return line, char
171
172 def _endex(self, endflag):
173 '''Return position for 'end' or line overflow corresponding to endflag.
174
175 -1: position before terminal \n; for .insert(), .delete
176 0: position after terminal \n; for .get, .delete index 1
177 1: same viewed as beginning of non-existent next line (for .index)
178 '''
179 n = len(self.data)
180 if endflag == 1:
181 return n, 0
182 else:
183 n -= 1
184 return n, len(self.data[n]) + endflag
185
186 def insert(self, index, chars):
187 "Insert chars before the character at index."

Callers 1

_decodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected