def rotate(self, r):

        # Vector axis of rotation

        axis = r.rotationAxis
        isNeg = r.rotationDirection
        rotationIndcs = r.rotationIndcs
        oldValues = r.oldValues

        for idx in rotationIndcs:
            pos = Vector(idx[0]-1, idx[1]-1, idx[2]-1)
            posn = pos - (axis > pos)
            newn = axis * posn
            if isNeg:
                newn = newn * -1.
            new = newn + (pos > axis)

            # Alter the rotationkey
            (oldId, oldKey) = oldValues[idx]
            perps = CubeState.getPerps(axis)
            toSwap = [ ]
            for perp in perps:
                for i in xrange(self.size):
                    if CubeState.kthDigit(oldKey, i) == perp:
                        toSwap.append(i)
            newKey = CubeState.swapDigits(oldKey, *toSwap)
            newValue = (oldId, newKey)

            newi = (int(new.x+1), int(new.y+1), int(new.z+1))
            self.state[newi[2]][newi[1]][newi[0]] = newValue
dataset/ETHPy150Open bluquar/cubr/cube.py/CubeState.rotate/swapped operands of `>`