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

Method _clearstamp

Lib/turtle.py:3197–3217  ·  view source on GitHub ↗

does the work for clearstamp() and clearstamps()

(self, stampid)

Source from the content-addressed store, hash-verified

3195 return stitem
3196
3197 def _clearstamp(self, stampid):
3198 """does the work for clearstamp() and clearstamps()
3199 """
3200 if stampid in self.stampItems:
3201 if isinstance(stampid, tuple):
3202 for subitem in stampid:
3203 self.screen._delete(subitem)
3204 else:
3205 self.screen._delete(stampid)
3206 self.stampItems.remove(stampid)
3207 # Delete stampitem from undobuffer if necessary
3208 # if clearstamp is called directly.
3209 item = ("stamp", stampid)
3210 buf = self.undobuffer
3211 if item not in buf.buffer:
3212 return
3213 index = buf.buffer.index(item)
3214 buf.buffer.remove(item)
3215 if index <= buf.ptr:
3216 buf.ptr = (buf.ptr - 1) % buf.bufsize
3217 buf.buffer.insert((buf.ptr+1)%buf.bufsize, [None])
3218
3219 def clearstamp(self, stampid):
3220 """Delete stamp with given stampid

Callers 2

clearstampMethod · 0.95
clearstampsMethod · 0.95

Calls 4

_deleteMethod · 0.45
removeMethod · 0.45
indexMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected