Format possibly compound value given the FieldInfo
559921
def format_value(field_info, value, section):
    """"""
    if section == "FORMAT" and field_info.id == "FT":
        if not value:
            return "."
        elif isinstance(value, list):
            return ";".join(map(format_atomic, value))
    elif field_info.number == 1:
        if value is None:
            return "."
        else:
            return format_atomic(value)
    else:
        if not value:
            return "."
        else:
            return ",".join(map(format_atomic, value))
575842
def get_format(self, c, i):
        """"""

        index = i.index
        field = ''
        value = []

        try:
            if c == '}':
                value.append((_util.FMT_FIELD, ''))
                value.append((_util.FMT_INDEX, -1))
            else:
                # Field
                if c in _LETTERS_UNDERSCORE:
                    # Handle name
                    value.append(c)
                    c = self.format_next(i)
                    while c in _WORD:
                        value.append(c)
                        c = self.format_next(i)
                elif c in _DIGIT:
                    # Handle group number
                    value.append(c)
                    c = self.format_next(i)
                    while c in _DIGIT:
                        value.append(c)
                        c = self.format_next(i)

                # Try and covert to integer index
                field = ''.join(value).strip()
                try:
                    value = [(_util.FMT_FIELD, str(int(field, 10)))]
                except ValueError:
                    value = [(_util.FMT_FIELD, field)]
                    pass

                # Attributes and indexes
                count = 0
                while c in ('[', '.'):
                    if c == '[':
                        findex = []
                        sindex = i.index - 1
                        c = self.format_next(i)
                        try:
                            while c != ']':
                                findex.append(c)
                                c = self.format_next(i)
                        except StopIteration:
                            raise SyntaxError("Unmatched '[' at %d" % (sindex - 1))
                        idx = self.parse_format_index(''.join(findex))
                        if isinstance(idx, int):
                            value.append((_util.FMT_INDEX, idx))
                        else:
                            value.append((_util.FMT_INDEX, idx))
                        c = self.format_next(i)
                    else:
                        if count == 0:
                            value.append((_util.FMT_INDEX, -1))
                        findex = []
                        c = self.format_next(i)
                        while c in _WORD:
                            findex.append(c)
                            c = self.format_next(i)
                        value.append((_util.FMT_ATTR, ''.join(findex)))
                    count += 1

                if count == 0:
                    value.append((_util.FMT_INDEX, -1))

                # Conversion
                if c == '!':
                    c = self.format_next(i)
                    if c not in _FMT_CONV_TYPE:
                        raise SyntaxError("Invalid conversion type at %d!" % (i.index - 1))
                    value.append((_util.FMT_CONV, c))
                    c = self.format_next(i)

                # Format spec
                if c == ':':
                    fill = None
                    width = []
                    align = None
                    convert = None
                    c = self.format_next(i)

                    if c in ('<', '>', '^'):
                        # Get fill and alignment
                        align = c
                        c = self.format_next(i)
                        if c in ('<', '>', '^'):
                            fill = align
                            align = c
                            c = self.format_next(i)
                    elif c in _DIGIT:
                        # Get Width
                        fill = c
                        c = self.format_next(i)
                        if c in ('<', '>', '^'):
                            align = c
                            c = self.format_next(i)
                        else:
                            width.append(fill)
                            fill = None
                    else:
                        fill = c
                        c = self.format_next(i)
                        if fill == 's' and c == '}':
                            convert = fill
                            fill = None
                        if fill is not None:
                            if c not in ('<', '>', '^'):
                                raise SyntaxError('Invalid format spec char at %d!' % (i.index - 1))
                            align = c
                            c = self.format_next(i)

                    while c in _DIGIT:
                        width.append(c)
                        c = self.format_next(i)

                    if not align and len(width) and width[0] == '0':
                        raise ValueError("'=' alignment is not supported!")
                    if align and not fill and len(width) and width[0] == '0':
                        fill = '0'

                    if c == 's':
                        convert = c
                        c = self.format_next(i)

                    if fill and self.is_bytes:
                        fill = fill.encode('latin-1')
                    elif not fill:
                        fill = b' ' if self.is_bytes else ' '

                    value.append((_util.FMT_SPEC, (fill, align, (int(''.join(width)) if width else 0), convert)))

            if c != '}':
                raise SyntaxError("Unmatched '{' at %d" % (index - 1))
        except StopIteration:
            raise SyntaxError("Unmatched '{' at %d!" % (index - 1))

        return field, value
169045
def serialize_compound(self, tag):
        """"""
        separator, fmt = self.comma, '{{{}}}'

        with self.depth():
            if self.should_expand(tag):
                separator, fmt = self.expand(separator, fmt)

            return fmt.format(separator.join(
                f'{self.stringify_compound_key(key)}{self.colon}{self.serialize(value)}'
                for key, value in tag.items()
            ))
767987
def _value_format(self, value):
        """"""
        return super(Funnel, self)._value_format(value and abs(value))
858835
function parse(value, field, options) {
  options = options || {};
  var parsed = utils.standardizeInput(value);

  // Integer
  if (field.type.key === "BOOLEAN") {
    parsed = utils.toBoolean(parsed);
  }
  else if (field.type.key === "INTEGER") {
    parsed = utils.toInteger(parsed);
  }
  else if (field.type.key === "FLOAT") {
    parsed = utils.toFloat(parsed);
  }
  else if (field.type.key === "DATEONLY") {
    parsed = utils.toDate(parsed, options.dateFormat);
  }
  else if (field.type.key === "DATE") {
    parsed = utils.toDateTime(parsed, options.datetimeFormat);
  }
  else if (field.type.key === "STRING") {
    parsed = utils.toString(parsed);
  }

  return parsed;
}
1072813
def format_field(self, field):
        
        if field is None:
            return "NULL"
        elif isinstance(field, TypeError):
            return "TypeError"
        elif isinstance(field, Decimal):
            if field % 1 == 0:
                return str(int(field))
            return str(float(field))
        elif isinstance(field, set):
            return "(" + ", ".join([self.format_field(v) for v in field]) + ")"
        elif isinstance(field, datetime):
            return field.isoformat()
        elif isinstance(field, timedelta):
            rd = relativedelta(
                seconds=int(field.total_seconds()), microseconds=field.microseconds
            )
            return delta_to_str(rd)
        elif isinstance(field, Binary):
            return "<Binary %d>" % len(field.value)
        pretty = repr(field)
        if pretty.startswith("u'"):
            return pretty[1:]
        return pretty
1320706
def format_value(value, sf=3):
    
    if isinstance(value, str):
        return value

    elif isinstance(value, list) or isinstance(value, np.ndarray):
        value = list(value)
        for i in range(len(value)):
            vv = format_value(value[i])
            value[i] = vv
        return "[" + ", ".join(value) + "]"

    elif value is None:
        return "N/A"

    else:
        fmt_str = "{0:.%ig}" % sf
        return fmt_str.format(value)
864890
private static int parseField(String field, Input s, Character delim, int minLen, int maxLen, boolean strict) {
    int startIndex = s.index;
    int result = parseInt(s);
    if (startIndex == s.index) throw new DateFormatException("missing value for field '" + field + "'", s.str, startIndex);
    if (strict) {
      int len = s.index - startIndex;
      if (len < minLen) throw new DateFormatException("field '" + field + "' must be at least " + minLen + " digits wide", s.str, startIndex);
      if (maxLen > 0 && len > maxLen) throw new DateFormatException("field '" + field + "' must be no more than " + minLen + " digits wide", s.str, startIndex);
    }
    if (delim != null) {
      if (s.index >= s.len) throw new DateFormatException("unexpected end of input", s.str, s.index);
      if (strict && s.getChar() != delim.charValue()) throw new DateFormatException("unexpected character, expected '" + delim + "'", s.str, s.index);
      s.index++;
    }
    return result;
  }
67993
def field_value(key, label, color, padding):
    
    if not clr.has_colors and padding > 0:
        padding = 7

    if color == "bright gray" or color == "dark gray":
        bright_prefix = ""
    else:
        bright_prefix = "bright "

    field = clr.stringc(key, "{0}{1}".format(bright_prefix, color))
    field_label = clr.stringc(label, color)

    return "{0:>{1}} {2}".format(field, padding, field_label)
790761
def parse_compound_count(s):
    """"""
    m = re.match(r'^\((.*)\)$', s)
    if m:
        s = m.group(1)

    for count_type in (int, Decimal, affine.Expression):
        try:
            return count_type(s)
        except:
            pass

    raise ValueError('Unable to parse compound count: {}'.format(s))
1183047
def format_value(self, value, padding):
        """"""

        # padding = padding - 1 if value < 0 and padding > 0 else padding
        # prefix = '-' if value < 0 else ''

        if padding:
            return "{:0{pad}d}".format(value, pad=padding)

        else:
            return str(value)
741237
public String formatValue(ReportValue val) {
      if (log.isLoggable(Level.FINE) || debug) {
         log.fine("raw: " + val + ", formatted: " + doFormatValue(val));
      }
      return doFormatValue(val);
   }
461588
def format_float_field(__, prec, number, locale):
    """"""
    format_ = u'0.'
    if prec is None:
        format_ += u'#' * NUMBER_DECIMAL_DIGITS
    else:
        format_ += u'0' * int(prec)
    pattern = parse_pattern(format_)
    return pattern.apply(number, locale)
477997
def _get_info_singlevalue_subfield(info, field):
        
        search = re.search(pattern=field + " (?P<value>\d+)", string=info)
        return {field: int(search.group("value"))}
1185189
function formatValue(value) {
  if (isNumeric(value)) return t.numericLiteral(Number(value))
  if (isConvertiblePixelValue(value))
    return t.numericLiteral(Number(trimEnd(value, 'px')))
  return t.stringLiteral(value)
}
141323
def uri_from_fields(prefix, *fields):
        """"""
        string = '_'.join(AlignmentHelper.alpha_numeric(f.strip().lower(), '') for f in fields)

        if len(string) == len(fields) - 1:
            return ''

        return prefix + string
907358
def visit_FormattedValue(self, node: AST,
                             dfltChaining: bool = True) -> str:
        """"""
        format_spec = node.format_spec
        return f"{{{self.visit(node.value)}" \
               f"{self.CONV_MAP.get(node.conversion, '')}" \
               f"{':'+self._nested_str(format_spec) if format_spec else ''}}}"