python类div()的实例源码

utils.py 文件源码 项目:Scalable-PaQL-Queries 作者: mattfeel 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def op_to_opstr(op):
    if op is operator.le:
        return "<="
    elif op is operator.ge:
        return ">="
    elif op is operator.eq:
        return "="
    elif op is operator.add:
        return "+"
    elif op is operator.sub:
        return "-"
    elif op is operator.mul:
        return "*"
    elif op is operator.div:
        return "/"
    else:
        raise Exception("Operator '{}' not supported yet.", op)
fractions.py 文件源码 项目:kinect-2-libras 作者: inessadl 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __floordiv__(a, b):
        """a // b"""
        # Will be math.floor(a / b) in 3.0.
        div = a / b
        if isinstance(div, Rational):
            # trunc(math.floor(div)) doesn't work if the rational is
            # more precise than a float because the intermediate
            # rounding may cross an integer boundary.
            return div.numerator // div.denominator
        else:
            return math.floor(div)
fractions.py 文件源码 项目:kinect-2-libras 作者: inessadl 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def __rfloordiv__(b, a):
        """a // b"""
        # Will be math.floor(a / b) in 3.0.
        div = a / b
        if isinstance(div, Rational):
            # trunc(math.floor(div)) doesn't work if the rational is
            # more precise than a float because the intermediate
            # rounding may cross an integer boundary.
            return div.numerator // div.denominator
        else:
            return math.floor(div)
fractions.py 文件源码 项目:kinect-2-libras 作者: inessadl 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def __mod__(a, b):
        """a % b"""
        div = a // b
        return a - b * div
fractions.py 文件源码 项目:kinect-2-libras 作者: inessadl 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def __rmod__(b, a):
        """a % b"""
        div = a // b
        return a - b * div
arrayTools.py 文件源码 项目:otRebuilder 作者: Pal3love 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def __truediv__(self, other):
        return Vector(self._scalarOp(other, operator.div), keep=True)
arrayTools.py 文件源码 项目:otRebuilder 作者: Pal3love 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def __itruediv__(self, other):
        self.values = self._scalarOp(other, operator.div)
        return self
operators.py 文件源码 项目:Flask_Blog 作者: sugarguo 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __rdiv__(self, other):
        """Implement the ``/`` operator in reverse.

        See :meth:`.ColumnOperators.__div__`.

        """
        return self.reverse_operate(div, other)
operators.py 文件源码 项目:Flask_Blog 作者: sugarguo 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def __div__(self, other):
        """Implement the ``/`` operator.

        In a column context, produces the clause ``a / b``.

        """
        return self.operate(div, other)
fractions.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def __floordiv__(a, b):
        """a // b"""
        # Will be math.floor(a / b) in 3.0.
        div = a / b
        if isinstance(div, Rational):
            # trunc(math.floor(div)) doesn't work if the rational is
            # more precise than a float because the intermediate
            # rounding may cross an integer boundary.
            return div.numerator // div.denominator
        else:
            return math.floor(div)
fractions.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def __rfloordiv__(b, a):
        """a // b"""
        # Will be math.floor(a / b) in 3.0.
        div = a / b
        if isinstance(div, Rational):
            # trunc(math.floor(div)) doesn't work if the rational is
            # more precise than a float because the intermediate
            # rounding may cross an integer boundary.
            return div.numerator // div.denominator
        else:
            return math.floor(div)
fractions.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 40 收藏 0 点赞 0 评论 0
def __mod__(a, b):
        """a % b"""
        div = a // b
        return a - b * div
fractions.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __rmod__(b, a):
        """a % b"""
        div = a // b
        return a - b * div
Functions.py 文件源码 项目:turtle 作者: icse-turtle 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def division(self, *args):
        if not len(args) > 1:
            raise EvaluateException('\ requires at least 2 parameters!' + ' (' + str(len(args)) + ' given).')

        elif False in [isinstance(x, NumberType) for x in args]:
            raise EvaluateException('\ requires all parameters to be numbers!')

        elif 0 in [x.content for x in args[1:]]:
            raise EvaluateException('division by zero!')

        return reduce(op.div, args[1:], args[0])
operators.py 文件源码 项目:QXSConsolas 作者: qxsch 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def __rdiv__(self, other):
        """Implement the ``/`` operator in reverse.

        See :meth:`.ColumnOperators.__div__`.

        """
        return self.reverse_operate(div, other)
operators.py 文件源码 项目:QXSConsolas 作者: qxsch 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def __div__(self, other):
        """Implement the ``/`` operator.

        In a column context, produces the clause ``a / b``.

        """
        return self.operate(div, other)
expressions.py 文件源码 项目:required 作者: shezadkhan137 项目源码 文件源码 阅读 44 收藏 0 点赞 0 评论 0
def __div__(self, other):
        fieldop = FieldOp(operator.div, self, other)
        return R(fieldop)
test_ndarray_elementwise_op.py 文件源码 项目:cupy 作者: cupy 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def test_div_scalar(self):
        if six.PY3:
            return
        with testing.NumpyError(divide='ignore'):
            self.check_array_scalar_op(operator.div)
test_ndarray_elementwise_op.py 文件源码 项目:cupy 作者: cupy 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def test_rdiv_scalar(self):
        if six.PY3:
            return
        with testing.NumpyError(divide='ignore'):
            self.check_array_scalar_op(operator.div, swap=True)
test_ndarray_elementwise_op.py 文件源码 项目:cupy 作者: cupy 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def test_div_array(self):
        if six.PY3:
            return
        with testing.NumpyError(divide='ignore'):
            self.check_array_array_op(operator.div)
test_ndarray_elementwise_op.py 文件源码 项目:cupy 作者: cupy 项目源码 文件源码 阅读 42 收藏 0 点赞 0 评论 0
def test_broadcasted_div(self):
        if six.PY3:
            return
        with testing.NumpyError(divide='ignore'):
            self.check_array_broadcasted_op(operator.div)
test_ndarray_elementwise_op.py 文件源码 项目:cupy 作者: cupy 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def test_doubly_broadcasted_div(self):
        if six.PY3:
            return
        with testing.NumpyError(divide='ignore'):
            self.check_array_doubly_broadcasted_op(operator.div)
operators.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 76 收藏 0 点赞 0 评论 0
def __rdiv__(self, other):
        """Implement the ``/`` operator in reverse.

        See :meth:`.ColumnOperators.__div__`.

        """
        return self.reverse_operate(div, other)
operators.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 40 收藏 0 点赞 0 评论 0
def __div__(self, other):
        """Implement the ``/`` operator.

        In a column context, produces the clause ``a / b``.

        """
        return self.operate(div, other)
slots.py 文件源码 项目:Orator-Google-App-Engine 作者: MakarenaLabs 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def __div__(self, other):
        return operator.div(self.__wrapped__, other)
slots.py 文件源码 项目:Orator-Google-App-Engine 作者: MakarenaLabs 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __rdiv__(self, other):
        return operator.div(other, self.__wrapped__)
simple.py 文件源码 项目:Orator-Google-App-Engine 作者: MakarenaLabs 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def __rdiv__(self, other):
        return operator.div(other, self.__wrapped__)
wrappers.py 文件源码 项目:apm-agent-python 作者: elastic 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def __div__(self, other):
        return operator.div(self.__wrapped__, other)
wrappers.py 文件源码 项目:apm-agent-python 作者: elastic 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def __rdiv__(self, other):
        return operator.div(other, self.__wrapped__)
operators.py 文件源码 项目:oa_qian 作者: sunqb 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def __rdiv__(self, other):
        """Implement the ``/`` operator in reverse.

        See :meth:`.ColumnOperators.__div__`.

        """
        return self.reverse_operate(div, other)


问题


面经


文章

微信
公众号

扫码关注公众号