Every line of 'remove decimal in python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
16 def format_decimal(value): 17 return Decimal(value.quantize(Decimal('.01'), rounding=ROUND_HALF_UP))
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
372 def test__DECIMAL_to_python(self): 373 """Convert a MySQL DECIMAL to a Python decimal.Decimal type""" 374 data = b'3.14' 375 exp = Decimal('3.14') 376 res = self.cnv._DECIMAL_to_python(data) 377 378 self.assertEqual(exp, res) 379 380 self.assertEqual(self.cnv._DECIMAL_to_python, 381 self.cnv._NEWDECIMAL_to_python)
60 def test_decimal_int(self): 61 a, b = mathfilters.handle_float_decimal_combinations(Decimal('2.0'), 1, '+') 62 self.assertTrue(isinstance(a, Decimal), 'Type is {0}'.format(type(a))) 63 self.assertTrue(isinstance(b, int), 'Type is {0}'.format(type(b)))
32 def digits(s): 33 if not s: 34 return '' 35 if type(s) is int: 36 return s 37 return re.sub('[^0-9]', '', s)