Returns a formatted value as a string
163688
def formatted_value(self):
        
        # TODO: Cleanup all of this, it's just weird and unnatural maths
        val = self.value
        pval = val
        ftype = self.value_type

        if ftype == "percentage":
            pval = int(round(val * 100))

            if self.type == "negative":
                pval = 0 - (100 - pval)
            else:
                pval -= 100
        elif ftype == "additive_percentage":
            pval = int(round(val * 100))
        elif ftype == "inverted_percentage":
            pval = 100 - int(round(val * 100))

            # Can't remember what workaround this was, is it needed?
            if self.type == "negative":
                if self.value > 1:
                    pval = 0 - pval
        elif ftype == "additive" or ftype == "particle_index" or ftype == "account_id":
            if int(val) == val:
                pval = int(val)
        elif ftype == "date":
            d = time.gmtime(int(val))
            pval = time.strftime("%Y-%m-%d %H:%M:%S", d)

        return u"{0}".format(pval)
745641
function format( value ) {
      // value was wrapped in array for parsing:
      try {
         return value.map( function( item ) {
            return JSON.stringify( item, null, 3 ).replace( NEWLINE_MATCHER, '\n' );
         } ).join( ',\n' );
      }
      catch( e ) {
         // value not JSON-compatible
         return value;
      }
   }
23522
def format_string(m, l, capture, is_bytes):
    """"""

    for fmt_type, value in capture[1:]:
        if fmt_type == FMT_ATTR:
            # Attribute
            l = getattr(l, value)
        elif fmt_type == FMT_INDEX:
            # Index
            l = l[value]
        elif fmt_type == FMT_CONV:
            if is_bytes:
                # Conversion
                if value in ('r', 'a'):
                    l = repr(l).encode('ascii', 'backslashreplace')
                elif value == 's':
                    # If the object is not string or byte string already
                    l = _to_bstr(l)
            else:
                # Conversion
                if value == 'a':
                    l = ascii(l)
                elif value == 'r':
                    l = repr(l)
                elif value == 's':
                    # If the object is not string or byte string already
                    l = str(l)
        elif fmt_type == FMT_SPEC:
            # Integers and floats don't have an explicit 's' format type.
            if value[3] and value[3] == 's':
                if isinstance(l, int):  # pragma: no cover
                    raise ValueError("Unknown format code 's' for object of type 'int'")
                if isinstance(l, float):  # pragma: no cover
                    raise ValueError("Unknown format code 's' for object of type 'float'")

            # Ensure object is a byte string
            l = _to_bstr(l) if is_bytes else str(l)

            spec_type = value[1]
            if spec_type == '^':
                l = l.center(value[2], value[0])
            elif spec_type == ">":
                l = l.rjust(value[2], value[0])
            else:
                l = l.ljust(value[2], value[0])

    # Make sure the final object is a byte string
    return _to_bstr(l) if is_bytes else str(l)
138613
def pretty_str(self, indent=0):
        
        return '{}{} {} = {}'.format(' ' * indent, self.result, self.name,
                                     pretty_str(self.value))
1225930
def _value_format(self, value):
        
        return '%s: %s' % (
            self.area_names.get(self.adapt_code(value[0]), '?'),
            self._y_format(value[1])
        )
413329
def _formatter_self(name, value):
    
    __mname = value.__module__
    if __mname != '__main__':
        return '%s = <%s.%s object at 0x%x>' \
            % (name, __mname, value.__class__.__name__, id(value))
    else:
        return '%s = <%s object at 0x%x>' \
            % (name, value.__class__.__name__, id(value))
965373
def value_to_string(self, obj):
        """"""
        try:
            return force_unicode(self.__get__(obj))
        except TypeError:
            return str(self.__get__(obj))
378761
function getFormatStringFrom (formattedString) {
      var chunks = formattedString.match(R_FORMAT_CHUNKS);

      if (!chunks) {
        // chunks will be null if there were no tokens to parse in
        // formattedString (for example, if formattedString is '2').  Coerce
        // chunks to be useful here.
        chunks = ['', ''];

        // If there is only one chunk, assume that the string is a number
        // followed by a token...
        // NOTE: This may be an unwise assumption.
      } else if (chunks.length === 1 ||
          // ...or if the string starts with a number component (".", "-", or a
          // digit)...
          formattedString[0].match(R_NUMBER_COMPONENT)) {
        // ...prepend an empty string here to make sure that the formatted number
        // is properly replaced by VALUE_PLACEHOLDER
        chunks.unshift('');
      }

      return chunks.join(VALUE_PLACEHOLDER);
    }
612677
function getFormattedValues (formatString, rawValues) {
      var formattedValueString = formatString;
      var rawValuesLength = rawValues.length;

      for (var i = 0; i < rawValuesLength; i++) {
        formattedValueString = formattedValueString.replace(
          VALUE_PLACEHOLDER, +rawValues[i].toFixed(4));
      }

      return formattedValueString;
    }
1339231
def value_to_string(self, obj):
        
        value = self.value_from_object(obj)
        return self.get_prep_value(value)
981497
def format_property(name, value):
    """"""
    result = b''
    utf8_name = utf8_bytes_string(name)

    result = b'property ' + utf8_name
    if value is not None:
        utf8_value = utf8_bytes_string(value)
        result += b' ' + ('%d' % len(utf8_value)).encode('ascii') + b' ' + utf8_value

    return result
1192617
def _tostring(value):
        ''''''
        if value is True:
            value = 'true'
        elif value is False:
            value = 'false'
        elif value is None:
            value = ''
        return unicode(value)
494168
def to_string(self, format_, fps=None, **kwargs):
        
        fp = io.StringIO()
        self.to_file(fp, format_, fps=fps, **kwargs)
        return fp.getvalue()
825002
private static String formatValue(String value)
	{
		if(value == null)
			return "";
		
		value = value.trim();
		
		if(value.startsWith("\"")|| value.startsWith("'"))
			value = value.substring(1);
		
		if(value.endsWith("\"")|| value.endsWith("'"))
			value = value.substring(0, value.length() -1);
		
		return value;
	}
412245
def _str(val):
    
    if str == bytes:
        if isinstance(val, str):
            return val
        else:
            return str(val)
    else:
        if isinstance(val, str):
            return val
        else:
            return str(val, 'ascii')
843974
def format_value(value, options)
      return value.to_s.upcase if options[:type] == Symbol

      value = value.utc if options[:type] == Time

      return value.strftime(Array(options.fetch(:format)).first) if [Date, Time].include? options[:type]

      value
    end
243299
def _str(self, indent=""):
        """"""
        if self.ndim <= 1:
            return "[" + ", ".join(str(x) for x in self) + "]"
        elif self.ndim == 2:
            sep = ",\n" + indent
            return "[" + sep.join(x._str(indent + " ") for x in self) + "]"
        else:
            sep = ",\n\n" + indent
            return "[" + sep.join(x._str(indent + " ") for x in self) + "]"