]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
fix indentation in split_number
authorFelix Schwarz <felix.schwarz@oss.schwarz.eu>
Sat, 4 Aug 2012 20:22:49 +0000 (20:22 +0000)
committerFelix Schwarz <felix.schwarz@oss.schwarz.eu>
Sat, 4 Aug 2012 20:22:49 +0000 (20:22 +0000)
babel/numbers.py

index 88758aec1b1cc3f67c68da4dca34c49c2eca597b..8b151614460e256619bee50c88acfe94d3312447 100644 (file)
@@ -323,41 +323,41 @@ number_re = re.compile(r"%s%s%s" % (PREFIX_PATTERN, NUMBER_PATTERN,
 def split_number(value):
     """Convert a number into a (intasstring, fractionasstring) tuple"""
     if isinstance(value, Decimal):
-       # NB can't just do text = str(value) as str repr of Decimal may be
-       # in scientific notation, e.g. for small numbers.
-       
-       sign, digits, exp = value.as_tuple()
-       # build list of digits in reverse order, then reverse+join
-       # as per http://docs.python.org/library/decimal.html#recipes
-       int_part = []
-       frac_part = []
-       
-       digits = map(str, digits)
-       
-       # get figures after decimal point
-       for i in range(-exp):
-           # add digit if available, else 0
-           if digits:
-               frac_part.append(digits.pop())
-           else:
-               frac_part.append('0')
-       
-       # add in some zeroes...
-       for i in range(exp):
-           int_part.append('0')
-       
-       # and the rest
-       while digits:
-           int_part.append(digits.pop())
-       
-       # if < 1, int_part must be set to '0'
-       if len(int_part) == 0:
-           int_part = '0',
-       
-       if sign:
-           int_part.append('-')
-       
-       return ''.join(reversed(int_part)), ''.join(reversed(frac_part))
+        # NB can't just do text = str(value) as str repr of Decimal may be
+        # in scientific notation, e.g. for small numbers.
+        
+        sign, digits, exp = value.as_tuple()
+        # build list of digits in reverse order, then reverse+join
+        # as per http://docs.python.org/library/decimal.html#recipes
+        int_part = []
+        frac_part = []
+        
+        digits = map(str, digits)
+        
+        # get figures after decimal point
+        for i in range(-exp):
+            # add digit if available, else 0
+            if digits:
+                frac_part.append(digits.pop())
+            else:
+                frac_part.append('0')
+        
+        # add in some zeroes...
+        for i in range(exp):
+            int_part.append('0')
+        
+        # and the rest
+        while digits:
+            int_part.append(digits.pop())
+        
+        # if < 1, int_part must be set to '0'
+        if len(int_part) == 0:
+            int_part = '0',
+        
+        if sign:
+            int_part.append('-')
+        
+        return ''.join(reversed(int_part)), ''.join(reversed(frac_part))
     text = ('%.9f' % value).rstrip('0')
     if '.' in text:
         a, b = text.split('.', 1)