called by format processors
175119
void put(ChronoElement<?> element, int v) {

        int pos;
        Object current;
        Object[] keys = this.keys;

        if (keys == null) {
            if (element == PlainDate.YEAR) {
                if (this.duplicateKeysAllowed || (this.ints[0] == Integer.MIN_VALUE) || (this.ints[0] == v)) {
                    this.ints[0] = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else if (element == PlainDate.MONTH_AS_NUMBER) {
                if (this.duplicateKeysAllowed || (this.ints[1] == Integer.MIN_VALUE) || (this.ints[1] == v)) {
                    this.ints[1] = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else if (element == PlainDate.DAY_OF_MONTH) {
                if (this.duplicateKeysAllowed || (this.ints[2] == Integer.MIN_VALUE) || (this.ints[2] == v)) {
                    this.ints[2] = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else if (element == PlainTime.DIGITAL_HOUR_OF_DAY) {
                if (this.duplicateKeysAllowed || (this.len == Integer.MIN_VALUE) || (this.len == v)) {
                    this.len = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else if (element == PlainTime.MINUTE_OF_HOUR) {
                if (this.duplicateKeysAllowed || (this.mask == Integer.MIN_VALUE) || (this.mask == v)) {
                    this.mask = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else if (element == PlainTime.SECOND_OF_MINUTE) {
                if (this.duplicateKeysAllowed || (this.threshold == Integer.MIN_VALUE) || (this.threshold == v)) {
                    this.threshold = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else if (element == PlainTime.NANO_OF_SECOND) {
                if (this.duplicateKeysAllowed || (this.count == Integer.MIN_VALUE) || (this.count == v)) {
                    this.count = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else {
                Map<ChronoElement<?>, Object> m = this.map;
                if (m == null) {
                    m = new HashMap<>();
                    this.map = m;
                }
                Object newValue = Integer.valueOf(v);
                if (this.duplicateKeysAllowed || !m.containsKey(element) || newValue.equals(m.get(element))) {
                    m.put(element, newValue);
                    return;
                } else {
                    throw new AmbivalentValueException(element);
                }
            }
            return;
        }

        if (!((current = keys[pos = (mix(element.hashCode()) & this.mask)]) == null)) {
            if (current.equals(element)) {
                if (this.duplicateKeysAllowed || (this.ints[pos] == v)) {
                    this.ints[pos] = v;
                    return;
                } else {
                    throw new AmbivalentValueException(element);
                }
            }
            while (!((current = keys[pos = (pos + 1) & this.mask]) == null)) {
                if (current.equals(element)) {
                    if (this.duplicateKeysAllowed || (this.ints[pos] == v)) {
                        this.ints[pos] = v;
                        return;
                    } else {
                        throw new AmbivalentValueException(element);
                    }
                }
            }
        }

        keys[pos] = element;
        this.ints[pos] = v;

        if (this.count++ >= this.threshold) {
            rehash(arraySize(this.count));
        }

    }
377575
def format(
        self,
        format_string,
        module=None,
        param_dict=None,
        force_composite=False,
        attr_getter=None,
    ):
        
        # fix python 2 unicode issues
        if python2 and isinstance(format_string, str):
            format_string = format_string.decode("utf-8")

        if param_dict is None:
            param_dict = {}

        # if the processed format string is not in the cache then create it.
        if format_string not in self.block_cache:
            self.build_block(format_string)

        first_block = self.block_cache[format_string]

        def get_parameter(key):
            """
            function that finds and returns the value for a placeholder.
            """
            if key in param_dict:
                # was a supplied parameter
                param = param_dict.get(key)
            elif module and hasattr(module, key):
                param = getattr(module, key)
                if hasattr(param, "__call__"):
                    # we don't allow module methods
                    raise Exception()
            elif attr_getter:
                # get value from attr_getter function
                try:
                    param = attr_getter(key)
                except:  # noqa e722
                    raise Exception()
            else:
                raise Exception()
            if isinstance(param, Composite):
                if param.text():
                    param = param.copy()
                else:
                    param = u""
            elif python2 and isinstance(param, str):
                param = param.decode("utf-8")
            return param

        # render our processed format
        valid, output = first_block.render(get_parameter, module)

        # clean things up a little
        if isinstance(output, list):
            output = Composite(output)
        if not output:
            if force_composite:
                output = Composite()
            else:
                output = ""

        return output
487445
public void format(StringBuffer fmt, Set done, Set todo, int indent) {
    formatName(fmt, indent);
    fmt.append("[");
    if (fields != null) {
      fmt.append("\n");
      for (int i = 0; i < fields.length; i++) {
        if (i > 0)
          fmt.append(",\n");
        fields[i].format(fmt, done, todo, indent + 2);
      }
      fmt.append("\n");
      indent(fmt, indent);
    }
    fmt.append("]");
  }
361909
@Override
	public void formatTo(Formatter formatter, int flags, int width, int precision) {
		formatNodeTo(formatter, 0, root);	
	}
1085616
def make_format(format_spec):
        
        fill = ''
        align = ''
        zero = ''
        width = format_spec.width
        if format_spec.align:
            align = format_spec.align[0]
            if format_spec.fill:
                fill = format_spec.fill[0]
        if format_spec.zero:
            zero = '0'

        precision_part = ""
        if format_spec.precision:
            precision_part = ".%s" % format_spec.precision

        # -- FORMAT-SPEC: [[fill]align][0][width][.precision][type]
        return "%s%s%s%s%s%s" % (fill, align, zero, width,
                                 precision_part, format_spec.type)
835321
def format(target)
      begin
        number = number_with_precision(target, @precision)
        parts = number.split('.')
        if parts.at(1).nil?
          parts[0] + "%"
        else
          parts[0] + @separator + parts[1].to_s + "%"
        end
      rescue
        target
      end
    end
492802
def format(self, format):
    """"""

    job_id = "%d - %d" % (self.job.id, self.id)
    queue = self.job.queue_name if self.machine_name is None else self.machine_name
    status = "%s" % self.status + (" (%d)" % self.result if self.result is not None else "" )

    return format.format("", job_id, queue, status)
161771
async def result_processor(tasks):
    """"""
    output = {}
    for task in tasks:
        num, res = await task
        output[num] = res
    return output
1281781
def update_format(self, format):
        
        self.format = format
        self.request.update(format=self.format.data)
262937
private String format(double fileSize, Units units)
  {
    StringBuilder builder = new StringBuilder();
    builder.append(numberFormat.format(fileSize));
    builder.append(' ');
    builder.append(units.name());
    return builder.toString();
  }
717014
private void subFormat(int patternCharIndex, int count,
                           FieldDelegate delegate, StringBuffer buffer,
                           boolean useDateFormatSymbols)
    {
        int     maxIntCount = Integer.MAX_VALUE;
        String  current = null;
        int     beginOffset = buffer.length();

        int field = PATTERN_INDEX_TO_CALENDAR_FIELD[patternCharIndex];
        int value;
        if (field == CalendarBuilder.WEEK_YEAR) {
            if (calendar.isWeekDateSupported()) {
                value = calendar.getWeekYear();
            } else {
                // use calendar year 'y' instead
                patternCharIndex = PATTERN_YEAR;
                field = PATTERN_INDEX_TO_CALENDAR_FIELD[patternCharIndex];
                value = calendar.get(field);
            }
        } else if (field == CalendarBuilder.ISO_DAY_OF_WEEK) {
            value = CalendarBuilder.toISODayOfWeek(calendar.get(Calendar.DAY_OF_WEEK));
        } else {
            value = calendar.get(field);
        }

        int style = (count >= 4) ? Calendar.LONG : Calendar.SHORT;
        if (!useDateFormatSymbols && field != CalendarBuilder.ISO_DAY_OF_WEEK) {
            current = calendar.getDisplayName(field, style, locale);
        }

        // Note: zeroPaddingNumber() assumes that maxDigits is either
        // 2 or maxIntCount. If we make any changes to this,
        // zeroPaddingNumber() must be fixed.

        switch (patternCharIndex) {
        case PATTERN_ERA: // 'G'
            if (useDateFormatSymbols) {
                String[] eras = formatData.getEras();
                if (value < eras.length)
                    current = eras[value];
            }
            if (current == null)
                current = "";
            break;

        case PATTERN_WEEK_YEAR: // 'Y'
        case PATTERN_YEAR:      // 'y'
            if (calendar instanceof GregorianCalendar) {
                if (count != 2)
                    zeroPaddingNumber(value, count, maxIntCount, buffer);
                else // count == 2
                    zeroPaddingNumber(value, 2, 2, buffer); // clip 1996 to 96
            } else {
                if (current == null) {
                    zeroPaddingNumber(value, style == Calendar.LONG ? 1 : count,
                                      maxIntCount, buffer);
                }
            }
            break;

        case PATTERN_STANDALONE_MONTH: // 'L'
        {
            current = formatMonth(count, value, maxIntCount, buffer, useDateFormatSymbols,
                    true /* standalone */);
            break;
        }

        case PATTERN_MONTH: // 'M'
        {
            current = formatMonth(count, value, maxIntCount, buffer, useDateFormatSymbols,
                    false /* standalone */);
            break;
        }

        case PATTERN_HOUR_OF_DAY1: // 'k' 1-based.  eg, 23:59 + 1 hour =>> 24:59
            if (current == null) {
                if (value == 0)
                    zeroPaddingNumber(calendar.getMaximum(Calendar.HOUR_OF_DAY)+1,
                                      count, maxIntCount, buffer);
                else
                    zeroPaddingNumber(value, count, maxIntCount, buffer);
            }
            break;

        case PATTERN_STANDALONE_DAY_OF_WEEK: // 'c'
        {
            current = formatWeekday(count, value, useDateFormatSymbols, true /* standalone */);
            break;
        }

        case PATTERN_DAY_OF_WEEK: // 'E'
        {
            current = formatWeekday(count, value, useDateFormatSymbols, false /* standalone */);
            break;
        }

        case PATTERN_AM_PM:    // 'a'
            if (useDateFormatSymbols) {
                String[] ampm = formatData.getAmPmStrings();
                current = ampm[value];
            }
            break;

        // Android-added: Ignore 'b' and 'B' introduced in CLDR 32+ pattern data. http://b/68139386
        // Not currently supported here.
        case PATTERN_DAY_PERIOD:
        case PATTERN_FLEXIBLE_DAY_PERIOD:
            current = "";
            break;

        case PATTERN_HOUR1:    // 'h' 1-based.  eg, 11PM + 1 hour =>> 12 AM
            if (current == null) {
                if (value == 0)
                    zeroPaddingNumber(calendar.getLeastMaximum(Calendar.HOUR)+1,
                                      count, maxIntCount, buffer);
                else
                    zeroPaddingNumber(value, count, maxIntCount, buffer);
            }
            break;

        case PATTERN_ZONE_NAME: // 'z'
            if (current == null) {
                TimeZone tz = calendar.getTimeZone();
                boolean daylight = (calendar.get(Calendar.DST_OFFSET) != 0);
                int tzstyle = count < 4 ? TimeZone.SHORT : TimeZone.LONG;
                String zoneString = tz.getDisplayName(daylight, tzstyle, formatData.locale);
                if (zoneString != null) {
                    buffer.append(zoneString);
                } else {
                    int offsetMillis = calendar.get(Calendar.ZONE_OFFSET) +
                        calendar.get(Calendar.DST_OFFSET);
                    buffer.append(TimeZone.createGmtOffsetString(true, true, offsetMillis));
                }
            }
            break;

        case PATTERN_ZONE_VALUE: // 'Z' ("-/+hhmm" form)
        {
            value = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);
            final boolean includeSeparator = (count >= 4);
            final boolean includeGmt = (count == 4);
            buffer.append(TimeZone.createGmtOffsetString(includeGmt, includeSeparator, value));

            break;
        }

        case PATTERN_ISO_ZONE:   // 'X'
            value = calendar.get(Calendar.ZONE_OFFSET)
                    + calendar.get(Calendar.DST_OFFSET);

            if (value == 0) {
                buffer.append('Z');
                break;
            }

            value /=  60000;
            if (value >= 0) {
                buffer.append('+');
            } else {
                buffer.append('-');
                value = -value;
            }

            CalendarUtils.sprintf0d(buffer, value / 60, 2);
            if (count == 1) {
                break;
            }

            if (count == 3) {
                buffer.append(':');
            }
            CalendarUtils.sprintf0d(buffer, value % 60, 2);
            break;
        case PATTERN_MILLISECOND: // 'S'
            // Fractional seconds must be treated specially. We must always convert the parsed
            // value into a fractional second [0, 1) and then widen it out to the appropriate
            // formatted size. For example, an initial value of 789 will be converted
            // 0.789 and then become ".7" (S) or ".78" (SS) or "0.789" (SSS) or "0.7890" (SSSS)
            // in the resulting formatted output.
            if (current == null) {
                value = (int) (((double) value / 1000) * Math.pow(10, count));
                zeroPaddingNumber(value, count, count, buffer);
            }
            break;

        default:
     // case PATTERN_DAY_OF_MONTH:         // 'd'
     // case PATTERN_HOUR_OF_DAY0:         // 'H' 0-based.  eg, 23:59 + 1 hour =>> 00:59
     // case PATTERN_MINUTE:               // 'm'
     // case PATTERN_SECOND:               // 's'
     // case PATTERN_DAY_OF_YEAR:          // 'D'
     // case PATTERN_DAY_OF_WEEK_IN_MONTH: // 'F'
     // case PATTERN_WEEK_OF_YEAR:         // 'w'
     // case PATTERN_WEEK_OF_MONTH:        // 'W'
     // case PATTERN_HOUR0:                // 'K' eg, 11PM + 1 hour =>> 0 AM
     // case PATTERN_ISO_DAY_OF_WEEK:      // 'u' pseudo field, Monday = 1, ..., Sunday = 7
            if (current == null) {
                zeroPaddingNumber(value, count, maxIntCount, buffer);
            }
            break;
        } // switch (patternCharIndex)

        if (current != null) {
            buffer.append(current);
        }

        int fieldID = PATTERN_INDEX_TO_DATE_FORMAT_FIELD[patternCharIndex];
        Field f = PATTERN_INDEX_TO_DATE_FORMAT_FIELD_ID[patternCharIndex];

        delegate.formatted(fieldID, f, f, beginOffset, buffer.length(), buffer);
    }
926714
def check_format(formats, input)
      formats.inject(true) do |result, (key, format)|
        format.call(input[key]) && result
      end
    end
457657
def apply_preprocessors(root, src, dst, processors):
    
    matches = [(pattern, cmds) for pattern, cmds in processors.iteritems() if fnmatch(src, pattern)]
    if not matches:
        return False

    params = get_format_params(dst)

    for pattern, cmd_list in matches:
        for cmd in cmd_list:
            run_command(cmd, root=root, dst=dst, input=src, params=params)
            src = dst

    return True
893127
function format() {
  var format = 'es' // default
  var args = process.argv.slice(2)

  outer:
  for (var i = 0; i < formats.length; i++) {
    for (var j = 0; j < args.length; j++) {
      if (args[j].slice(0, 2) !== '--') { throw new TypeError('process args usage error'); break outer }
      if (args[j].toLocaleLowerCase().slice(9) === formats[i]) { format = formats[i]; break outer }
    }
  }
  return format
}
732065
def _formatinfo(format):
    
    size = struct.calcsize(format)
    return size, len(struct.unpack(format, B('\x00') * size))
37450
async def format(self, fstype, *, uuid=None):
        """"""
        self._data = await self._handler.format(
            system_id=self.node.system_id, id=self.id,
            fstype=fstype, uuid=uuid)
1310556
public void setNumberFormat(final NumberFormat FORMAT) {
        if (null == numberFormat) {
            _numberFormat = null == FORMAT ? NumberFormat.getInstance(getLocale()) : FORMAT;
            fireTileEvent(RESIZE_EVENT);
        } else {
            numberFormat.set(FORMAT);
        }
    }