MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / _clearstamp

Method _clearstamp

Python/Turtle.py:2978–2998  ·  view source on GitHub ↗

does the work for clearstamp() and clearstamps()

(self, stampid)

Source from the content-addressed store, hash-verified

2976 return stitem
2977
2978 def _clearstamp(self, stampid):
2979 """does the work for clearstamp() and clearstamps()
2980 """
2981 if stampid in self.stampItems:
2982 if isinstance(stampid, tuple):
2983 for subitem in stampid:
2984 self.screen._delete(subitem)
2985 else:
2986 self.screen._delete(stampid)
2987 self.stampItems.remove(stampid)
2988 # Delete stampitem from undobuffer if necessary
2989 # if clearstamp is called directly.
2990 item = ("stamp", stampid)
2991 buf = self.undobuffer
2992 if item not in buf.buffer:
2993 return
2994 index = buf.buffer.index(item)
2995 buf.buffer.remove(item)
2996 if index <= buf.ptr:
2997 buf.ptr = (buf.ptr - 1) % buf.bufsize
2998 buf.buffer.insert((buf.ptr+1)%buf.bufsize, [None])
2999
3000 def clearstamp(self, stampid):
3001 """Delete stamp with given stampid

Callers 2

clearstampMethod · 0.95
clearstampsMethod · 0.95

Calls 3

_deleteMethod · 0.80
removeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected