예제 #1
0
파일: value.py 프로젝트: swarupsahoo/dart
 def _do_op(cls, self, other, op):
     first, second = cls(self), cls(other)
     units = second.units or first.units
     value = op(float(first), float(second))
     value /= CONV_FACTOR.get(units, 1.0)
     return cls((value, units))
예제 #2
0
파일: value.py 프로젝트: swarupsahoo/dart
 def __float__(self):
     return self.value * CONV_FACTOR.get(self.units, 1.0)
예제 #3
0
 def __float__(self):
     return self.value * CONV_FACTOR.get(self.units, 1.0)
예제 #4
0
 def _do_op(cls, self, other, op):
     first, second = cls(self), cls(other)
     units = second.units or first.units
     value = op(float(first), float(second))
     value /= CONV_FACTOR.get(units, 1.0)
     return cls((value, units))
예제 #5
0
    def _do_op(cls, self, other, op):
        value = op(float(self), float(other))
        value /= CONV_FACTOR.get(self.units or other.units, 1.0)

        return cls((value, self.units or other.units))