Exemplo n.º 1
0
    def getOperationInplaceAddShape(self, right_shape):
        """ Inplace add operation shape, for overload.

        """
        if self.iadd_shapes:
            result = self.iadd_shapes.get(right_shape)

            if result is not None:
                return result
            else:
                right_shape_type = type(right_shape)
                if right_shape_type is ShapeLoopCompleteAlternative:
                    return right_shape.getOperationBinaryAddLShape(self)

                if right_shape_type is ShapeLoopInitialAlternative:
                    return operation_result_unknown

                onMissingOperation("IAdd", self, right_shape)

                return operation_result_unknown
        else:
            # By default, inplace add is the same as plain add, the
            # only exception known right now is list, which extend
            # from all iterables, but don't add with them.
            return self.getOperationBinaryAddShape(right_shape)
Exemplo n.º 2
0
def _getComparisonLtShapeGeneric(cls, right_shape):
    if type(right_shape) is ShapeLoopCompleteAlternative:
        return right_shape.getComparisonLtLShape(cls)

    if type(right_shape) is ShapeLoopInitialAlternative:
        return operation_result_unknown

    onMissingOperation("Lt", cls, right_shape)
    return operation_result_unknown
Exemplo n.º 3
0
def _getOperationBinaryAddShapeGeneric(cls, right_shape):
    if type(right_shape) is ShapeLoopCompleteAlternative:
        return right_shape.getOperationBinaryAddLShape(cls)

    if type(right_shape) is ShapeLoopInitialAlternative:
        return operation_result_unknown

    onMissingOperation("Add", cls, right_shape)
    return operation_result_unknown
Exemplo n.º 4
0
def _getComparisonLtShapeGeneric(cls, right_shape):
    if type(right_shape) is ShapeLoopCompleteAlternative:
        return right_shape.getComparisonLtLShape(cls)

    if type(right_shape) is ShapeLoopInitialAlternative:
        return operation_result_unknown

    onMissingOperation("Lt", cls, right_shape)
    return operation_result_unknown
Exemplo n.º 5
0
def _getOperationBinaryAddShapeGeneric(cls, right_shape):
    if type(right_shape) is ShapeLoopCompleteAlternative:
        return right_shape.getOperationBinaryAddLShape(cls)

    if type(right_shape) is ShapeLoopInitialAlternative:
        return operation_result_unknown

    onMissingOperation("Add", cls, right_shape)
    return operation_result_unknown
Exemplo n.º 6
0
    def getOperationBinaryMatMultShape(self, right_shape):
        result = self.matmult_shapes.get(right_shape)

        if result is not None:
            return result
        else:
            right_shape_type = type(right_shape)
            if right_shape_type is ShapeLoopCompleteAlternative:
                return right_shape.getOperationBinaryBitMatMultLShape(self)

            if right_shape_type is ShapeLoopInitialAlternative:
                return operation_result_unknown

            onMissingOperation("MatMult", self, right_shape)

            return operation_result_unknown
Exemplo n.º 7
0
    def getOperationBinaryDivmodShape(self, right_shape):
        result = self.divmod_shapes.get(right_shape)

        if result is not None:
            return result
        else:
            right_shape_type = type(right_shape)
            if right_shape_type is ShapeLoopCompleteAlternative:
                return right_shape.getOperationBinaryDivmodLShape(self)

            if right_shape_type is ShapeLoopInitialAlternative:
                return operation_result_unknown

            onMissingOperation("Divmod", self, right_shape)

            return operation_result_unknown
Exemplo n.º 8
0
    def getOperationBinaryAddShape(cls, right_shape):
        result = cls.add_shapes.get(right_shape)

        if result is not None:
            return result
        else:
            right_shape_type = type(right_shape)
            if right_shape_type is ShapeLoopCompleteAlternative:
                return right_shape.getOperationBinaryAddLShape(cls)

            if right_shape_type is ShapeLoopInitialAlternative:
                return operation_result_unknown

            onMissingOperation("Add", cls, right_shape)

            return operation_result_unknown
Exemplo n.º 9
0
    def getComparisonLtShape(self, right_shape):
        onMissingOperation("Lt", self, right_shape)

        return operation_result_unknown
Exemplo n.º 10
0
    def getComparisonLtShape(cls, right_shape):
        onMissingOperation("Lt", cls, right_shape)

        return ShapeUnknown, ControlFlowDescriptionFullEscape
Exemplo n.º 11
0
    def getOperationBinaryAddShape(cls, right_shape):
        onMissingOperation("Add", cls, right_shape)

        return ShapeUnknown, ControlFlowDescriptionFullEscape