accounting/accounting.py
def parse(self, value, decimal=None):
        """
        Summary.

         Takes a string/array of strings, removes all formatting/cruft and
         returns the raw float value

         Decimal must be included in the regular expression to match floats
          (defaults to Accounting.settings.number.decimal),
          so if the number uses a non-standard decimal
         separator, provide it as the second argument.
         *
         Also matches bracketed negatives (eg. "$ (1.99)" => -1.99)

         Doesn't throw any errors (`None`s become 0) but this may change

        Args:
            value (TYPE): Description
            decimal (TYPE): Description

        Returns:
            name (TYPE): Description
        """
        # Fails silently (need decent errors):
        value = value or 0

        # Recursively unformat arrays:
        if check_type(value, 'list'):
            return map(lambda val: self.parse(val, decimal))

        # Return the value as-is if it's already a number:
        if check_type(value, 'int') or check_type(value, 'float'):
            return value

        # Default decimal point comes from settings, but could be set to eg.","
        decimal = decimal or self.settings.number.decimal

        # Build regex to strip out everything except digits,
        # decimal point and minus sign
        regex = re.compile("[^0-9-" + decimal + "]")
        unformatted = str(value)
        unformatted = re.sub('/\((.*)\)/', "-$1", unformatted)
        unformatted = re.sub(regex, '', unformatted)
        unformatted = unformatted.replace('.', decimal)
        formatted = (lambda val: unformatted if val else 0)(
            is_num(unformatted))

        return formatted
def parse(self, value, decimal=None):
        """
        Summary.

         Takes a string/array of strings, removes all formatting/cruft and
         returns the raw float value

         Decimal must be included in the regular expression to match floats
          (defaults to Accounting.settings.number.decimal),
          so if the number uses a non-standard decimal
         separator, provide it as the second argument.
         *
         Also matches bracketed negatives (eg. "$ (1.99)" => -1.99)

         Doesn't throw any errors (`None`s become 0) but this may change

        Args:
            value (TYPE): Description
            decimal (TYPE): Description

        Returns:
            name (TYPE): Description
        """
        # Fails silently (need decent errors):
        value = value or 0

        # Recursively unformat arrays:
        if check_type(value, 'list'):
            return map(lambda val: self.parse(val, decimal))

        # Return the value as-is if it's already a number:
        if check_type(value, 'int') or check_type(value, 'float'):
            return value

        # Default decimal point comes from settings, but could be set to eg.","
        decimal = decimal or self.settings.number.decimal

        # Build regex to strip out everything except digits,
        # decimal point and minus sign
        regex = re.compile("[^0-9-" + decimal + "]")
        unformatted = str(value)
        unformatted = re.sub('/\((.*)\)/', "-$1", unformatted)
        unformatted = re.sub(regex, '', unformatted)
        unformatted = unformatted.replace('.', decimal)
        formatted = (lambda val: unformatted if val else 0)(
            is_num(unformatted))

        return formatted
Summary.

         Takes a string/array of strings, removes all formatting/cruft and
         returns the raw float value

         Decimal must be included in the regular expression to match floats
          (defaults to Accounting.settings.number.decimal),
          so if the number uses a non-standard decimal
         separator, provide it as the second argument.
         *
         Also matches bracketed negatives (eg. "$ (1.99)" => -1.99)

         Doesn't throw any errors (`None`s become 0) but this may change

        Args:
            value (TYPE): Description
            decimal (TYPE): Description

        Returns:
            name (TYPE): Description