Takes a string and groups it appropriately with any
        period or other appropriate punctuation so that it is
        displayed correctly.
        :param value: a string containing an integer or float
        :return: None
179556
def _group(self, value: str):
        
        reversed_v = value[::-1]

        parts = []

        has_period = False
        for c in reversed_v:
            if has_period:
                parts.append(c + '.')
                has_period = False
            elif c == '.':
                has_period = True
            else:
                parts.append(c)

        parts = parts[:len(self._digits)]

        return parts
1326630
def form(value):
    
    if isinstance(value, FLOAT + INT):
        if value <= 0:
            return str(value)
        elif value < .001:
            return '%.3E' % value
        elif value < 10 and isinstance(value, FLOAT):
            return '%.5f' % value
        elif value > 1000:
            return '{:,d}'.format(int(round(value)))
        elif numpy.isnan(value):
            return 'NaN'
        else:  # in the range 10-1000
            return str(int(value))
    elif isinstance(value, bytes):
        return decode(value)
    elif isinstance(value, str):
        return value
    elif isinstance(value, numpy.object_):
        return str(value)
    elif hasattr(value, '__len__') and len(value) > 1:
        return ' '.join(map(form, value))
    return str(value)
1221240
def _float_or_str(value):
    
    # remove any surrounding quotes
    value = QUOTE_REGEX.sub('', value)
    try:  # attempt `float()` conversion
        return float(value)
    except ValueError:  # just return the input
        return value
1024688
def str2float(text):
    

    try:
        # Note that the ending ) is sometimes missing. That is why the code has
        # been modified to treat it as optional. Same logic applies to lists.
        return float(re.sub(r"\(.+\)*", "", text))
    except TypeError:
        if isinstance(text, list) and len(text) == 1:
            return float(re.sub(r"\(.+\)*", "", text[0]))
    except ValueError as ex:
        if text.strip() == ".":
            return 0
        raise ex
558798
def format_value(value):
    
    value = decimal.Decimal(str(value))
    if int(value) == value:
        return int(value)

    # On Python 3, an explicit cast to float is required
    return float(round(value, 1))
1170379
def _set_unicode(self, value):
        
        values = list(self.unicodes)
        if value in values:
            values.remove(value)
        values.insert(0, value)
        self.unicodes = values
625743
def acceptable(value, capitalize=False):
    """"""
    name = regexes['punctuation'].sub("", regexes['joins'].sub("_", value))
    # Clean up irregularities in underscores.
    name = regexes['repeated_underscore'].sub("_", name.strip('_'))
    if capitalize:
        # We don't use python's built in capitalize method here because it
        # turns all upper chars into lower chars if not at the start of
        # the string and we only want to change the first character.
        name_parts = []
        for word in name.split('_'):
            name_parts.append(word[0].upper())
            if len(word) > 1:
                name_parts.append(word[1:])
        name = ''.join(name_parts)
    return name
1120681
def _maybe_quote(val):
    ''''''
    assert isinstance(val, str), 'We should never set non-string values.'
    needs_quoting = False
    try:
        int(val)
        needs_quoting = True
    except Exception:
        pass
    try:
        float(val)
        needs_quoting = True
    except Exception:
        pass
    if needs_quoting:
        return '"{}"'.format(val)
    else:
        return val
789481
def fixed(ctx, number, decimals=2, no_commas=False):
    
    value = _round(ctx, number, decimals)
    format_str = '{:f}' if no_commas else '{:,f}'
    return format_str.format(value)
594469
function formatPrecision(value) {
                if (!(value || value === 0)) {
                    return '';
                }
                var formattedValue = parseFloat(value).toFixed(decimals);
                formattedValue = formattedValue.replace('.', decimalSeparator);
                return numberWithCommas(formattedValue);
            }
343609
def valueFromString(self, value, context=None):
        
        if value == 'now':
            return datetime.datetime.now().time()
        elif dateutil_parser:
            return dateutil_parser.parse(value).time()
        else:
            time_struct = time.strptime(value, self.defaultFormat())
            return datetime.time(time_struct.tm_hour,
                                 time_struct.tm_min,
                                 time_struct.tm_sec)
954733
def format_value
      case @type
      when "string"
        @value
      when "date"
        @value.kind_of?(Time) ? @value.iso8601(3) : @value
      when "int"
        @value.kind_of?(Integer) ? @value : @value.to_i
      when "float"
        @value.kind_of?(Float) ? @value : @value.to_f
      when "boolean"
        @value
      when "id"
        @value
      end.to_s
    end
380654
def strip_punctuation_space(value):
    ""
    def strip_punctuation(string):
        replacement_list = (
            (' .',  '.'),
            (' :',  ':'),
            ('( ',  '('),
            (' )',  ')'),
        )
        for match, replacement in replacement_list:
            string = string.replace(match, replacement)
        return string
    if value == None:
        return None
    if type(value) == list:
        return [strip_punctuation(v) for v in value]
    return strip_punctuation(value)
87539
def encode(cls, value):
        
        try:
            coerced = [str(v) for v in value]
            if coerced == value:
                return ",".join(coerced).encode(cls._encoding) if len(
                    value) > 0 else None
        except TypeError:
            pass

        raise InvalidValue('not a list of strings')
1358014
def uniformat(value):
    """"""

    if value in GROUP_ESCAPES:
        # Escape characters that are (or will be in the future) problematic
        c = "\\x%02x\\x%02x" % (0x5c, value)
    elif value <= 0xFF:
        c = "\\x%02x" % value
    elif value <= 0xFFFF:
        c = "\\u%04x" % value
    else:
        c = "\\U%08x" % value
    return c
1263215
def validate(self, value):
        
        val = value
        if isinstance(val, str):
            #FIXME: unsafe decoding
            val = unicode(value)
        val = super(String, self).validate(val)
        if not isinstance(val, unicode):
            raise ValueError("Not a string: %r" % (value, ))
        return val
1096338
def isdigit(cls, value):
        
        if str(value).replace('.','').replace('-','').isdigit():
            return True
        return False