def _convert_value_from(self, unit, value): if not isinstance(value, float): value = float(value) if isinstance(unit, sympy.Expr): _, result = solve_linear(unit, value) return result return unit * value
def _convert_value_from(self, unit, value): if isinstance(unit, sympy.Expr): _, result = solve_linear(unit, sympy.Float(str(value))) return Decimal(str(result)) return Decimal(unit) * Decimal(value)