def __setitem__(self, k, value): length = len(self) if length >= self.max_size or k > self.max_size: self.popleft() self.append(value) else: deque.__setitem__(self, k, value)
def __setitem__(self, key, value): if type(key) == slice: if all([F.reference == self.reference for F in value]): if key.start is None: start = 0 else: start = key.start if key.stop is None: stop = len(self) else: stop = key.stop if key.step is None: step = 1 else: step = key.step cnt = 0 for ind in range(start, stop, step): self[ind] = value[cnt] cnt += 1 else: raise Exception("Invalid argument: " + str(value) + "\n" + \ "Valid types: rigid.Transformation with a reference equal to\n" + str(self.reference)) else: if isinstance(value, Transformation) and value.reference == self.reference: deque.__setitem__(self, key, value) else: raise Exception("Invalid argument: " + str(value) + "\n" + \ "Valid types: rigid.Transformation with a reference equal to\n" + str(self.reference))
def __setitem__(self, pos, val): if not isinstance(val, Color): val = Color(*val) deque.__setitem__(self, pos, val)
def __setitem__( self, key, value ): if self.mtx.acquire(): values = deque.__setitem__( self, key, value ) self.mtx.release()