Method of string.Formatter that specifies the output of format().
172545
def format_field(self, value: Any, spec: str) -> str:
        """"""
        from cirq import ops  # HACK: avoids cyclic dependency.
        if isinstance(value, (float, int)):
            if isinstance(value, float):
                value = round(value, self.precision)
            if spec == 'half_turns':
                value = 'pi*{}'.format(value) if value != 0 else '0'
                spec = ''
        elif isinstance(value, ops.Qid):
            value = self.qubit_id_map[value]
        elif isinstance(value, str) and spec == 'meas':
            value = self.meas_key_id_map[value]
            spec = ''
        return super().format_field(value, spec)
139394
static String format(String messageFormat, Object... messageArgs) {
        return String.format(messageFormat, messageArgs);
    }
757101
private String format(int[] octets) {
        StringBuilder str = new StringBuilder();
        for (int i =0; i < octets.length; ++i){
            str.append(octets[i]);
            if (i != octets.length - 1) {
                str.append(".");
            }
        }
        return str.toString();
    }
1020380
public static void printInfo(Object caller, String format, Object... args)
	{
		Object msg = String.format(format, args);
		
		printInfo(caller,msg);
	}
1353575
public static String format(String format, Object... args) {
    return String.format(Locale.US, format, args);
  }
485094
public static final String format(final String format, final Object... params)
    {
        final StringBuilder b = new StringBuilder();

        int p = 0;

        while (true)
        {
            final int i = format.indexOf('{', p);

            if (i == -1)
            {
                break;// done
            }
            final int i2 = format.indexOf('}', i + 1);

            if (i2 == -1)
            {
                break;// done
            }
            if (p != i)
            {
                b.append(format.substring(p, i));
            }
            final String nstr = format.substring(i + 1, i2);

            try
            {
                final int n = Integer.parseInt(nstr);

                if ((n >= 0) && (n < params.length))
                {
                    b.append(params[n]);
                }
                else
                {
                    b.append('{').append(nstr).append('}');
                }
            }
            catch (final NumberFormatException e)
            {
                b.append('{').append(nstr).append('}');
            }
            p = i2 + 1;
        }
        b.append(format.substring(p));

        return b.toString();
    }
232056
public CharSequence format(Formatter formatter) {
    CharSequence input = format();
    return formatter.format(String.valueOf(input));
  }
471639
def dump(self, format=None, **kwargs):
        
        formatter = Formatters.get(format, None)
        if not format:
            return self.display()
        elif not formatter:
            raise FormattingException('Formatter %s not available' % format)
        else:
            return formatter(self, **kwargs)
215948
public static String format(double[][] m, String pre) {
    StringBuilder output = new StringBuilder() //
        .append(pre).append("[\n").append(pre);
    for(int i = 0; i < m.length; i++) {
      formatTo(output.append(" ["), m[i], ", ").append("]\n").append(pre);
    }
    return output.append("]\n").toString();
  }
1124094
def output(data, **kwargs):  # pylint: disable=unused-argument
    '''
    
    '''
    if isinstance(data, Exception):
        data = six.text_type(data)
    if 'output_indent' in __opts__ and __opts__['output_indent'] >= 0:
        return pprint.pformat(data, indent=__opts__['output_indent'])
    return pprint.pformat(data)
1157857
private Format getFormatter(final String pattern, final Object argument) {
		if (pattern.indexOf('|') != -1) {
			int start = pattern.indexOf('{');
			if (start >= 0 && start < pattern.lastIndexOf('}')) {
				return new ChoiceFormat(format(pattern, new Object[] { argument }));
			} else {
				return new ChoiceFormat(pattern);
			}
		} else {
			return new DecimalFormat(pattern, symbols);
		}
	}
471317
private String formatValue(String[] value) {

    String ret = "";
    for(int i=0;i<value.length;i++) {
      ret += value[i];
      if(i<value.length-1) ret+="\n";
    }
    return ret;

  }
1154884
public void format(StringBuffer fmt, Set done, Set todo, int indent) {
    formatName(fmt, indent);
    fmt.append("*(\n");
    itemType.format(fmt, done, todo, indent + 2);
    fmt.append("\n");
    indent(fmt, indent);
    fmt.append(")*");
  }
856239
public void formatTo(Formatter formatter, int flags, int width,
			int precision)
	{
		formatTo(this.toString(), formatter, flags, width, precision);
	}
272567
public static void log(String format, Object...args) {
    System.out.println(String.format(format, args));
  }
108766
def formatter_factory(show_defaults=True):
    """"""
    def get_help_string(self, action):
        lhelp = action.help
        if isinstance(show_defaults, (list, tuple)):
            if "-" + action.dest in show_defaults:
                return lhelp
        if '%(default)' not in action.help:
            if action.default is not argparse.SUPPRESS:
                defaulting_nargs = [argparse.OPTIONAL, argparse.ZERO_OR_MORE]
                if action.option_strings or action.nargs in defaulting_nargs:
                    lhelp += ' (default: %(default)s)'
        return lhelp

    def default_help_string(self, action):
        return action.help
    if show_defaults is True:
        ARPIFormatter._get_help_string = classmethod(get_help_string)
    else:
        ARPIFormatter._get_help_string = classmethod(default_help_string)
    return ARPIFormatter
74649
private void initOutputFormat() {
		ClassLoader userCodeClassLoader = getUserCodeClassLoader();
		// obtain task configuration (including stub parameters)
		Configuration taskConf = getTaskConfiguration();
		this.config = new TaskConfig(taskConf);

		try {
			this.format = config.<OutputFormat<IT>>getStubWrapper(userCodeClassLoader).getUserCodeObject(OutputFormat.class, userCodeClassLoader);

			// check if the class is a subclass, if the check is required
			if (!OutputFormat.class.isAssignableFrom(this.format.getClass())) {
				throw new RuntimeException("The class '" + this.format.getClass().getName() + "' is not a subclass of '" + 
						OutputFormat.class.getName() + "' as is required.");
			}
		}
		catch (ClassCastException ccex) {
			throw new RuntimeException("The stub class is not a proper subclass of " + OutputFormat.class.getName(), ccex);
		}

		Thread thread = Thread.currentThread();
		ClassLoader original = thread.getContextClassLoader();
		// configure the stub. catch exceptions here extra, to report them as originating from the user code 
		try {
			thread.setContextClassLoader(userCodeClassLoader);
			this.format.configure(this.config.getStubParameters());
		}
		catch (Throwable t) {
			throw new RuntimeException("The user defined 'configure()' method in the Output Format caused an error: " 
				+ t.getMessage(), t);
		}
		finally {
			thread.setContextClassLoader(original);
		}
	}