def writeIntoDestination( self, destination, value, roi ): sl = roiToSlice(roi.start, roi.stop) try: destination[:] = value[sl] except TypeError: warn_deprecated("old style slot encountered: non array-like value set -> change SlotType from ArrayLike to proper SlotType") destination = [value] return destination
def writeIntoDestination( self, destination, value, roi ): if destination is not None: if not isinstance(destination, list): assert(roi.dim == destination.ndim), "%r ndim=%r, shape=%r" % (roi.toSlice(), destination.ndim, destination.shape) sl = roiToSlice(roi.start, roi.stop) try: destination[:] = value[sl] except TypeError: warn_deprecated("old style slot encountered: non array-like value set -> change SlotType from ArrayLike to proper SlotType") destination[:] = value else: sl = roiToSlice(roi.start, roi.stop) try: destination = value[sl] except: warn_deprecated("old style slot encountered: non array-like value set -> change SlotType from ArrayLike to proper SlotType") destination = [value] if type(destination) == numpy.ndarray and destination.shape == (): # This is necessary because numpy types will not be caught in the except statement above. # They don't throw when used with __getitem__ # e.g. try this: # x = np.int64(5) # assert type(x[()]) == np.ndarray and x[()].shape == () warn_deprecated("old style slot encountered: non array-like value set -> change SlotType from ArrayLike to proper SlotType") destination = [value] return destination
def isCompatible(self, value): warn_deprecated("FIXME here") return True