Format errors without a type
4398
function format(errors, type) {
  return errors
    .filter(isDefaultError)
    .reduce((accum, error) => (
      accum.concat(displayError(type, error))
    ), []);
}
331027
def format_original_error(self):
        
        # TODO eventually we'll have sass-specific errors that will want nicer
        # "names" in browser display and stderr
        return "".join((
            type(self.exc).__name__, ": ", six.text_type(self.exc), "\n",
        ))
1057240
def FormatProblem(self, d=None):
    
    if not d:
      d = self.GetDictToFormat()

    output_error_text = self.__class__.ERROR_TEXT % d
    if ('reason' in d) and d['reason']:
      return '%s\n%s' % (output_error_text, d['reason'])
    else:
      return output_error_text
454548
public static String formatErrors(Iterable<SoyError> errors) {
    int numErrors = 0;
    int numWarnings = 0;
    for (SoyError error : errors) {
      if (error.isWarning()) {
        numWarnings++;
      } else {
        numErrors++;
      }
    }
    if (numErrors + numWarnings == 0) {
      throw new IllegalArgumentException("cannot format 0 errors");
    }
    StringBuilder sb =
        new StringBuilder(numErrors == 0 ? "warnings" : "errors")
            .append(" during Soy compilation\n");
    Joiner.on('\n').appendTo(sb, errors);
    if (numErrors > 0) {
      formatNumber(numErrors, "error", sb);
    }
    if (numWarnings > 0) {
      if (numErrors > 0) {
        sb.append(' ');
      }
      formatNumber(numWarnings, "warning", sb);
    }
    return sb.append('\n').toString();
  }
934430
def format(self, typedval):
        ''
        if typedval is None:
            return None

        if isinstance(typedval, (list, tuple)):
            return '[%s]' % len(typedval)
        if isinstance(typedval, dict):
            return '{%s}' % len(typedval)
        if isinstance(typedval, bytes):
            typedval = typedval.decode(options.encoding, options.encoding_errors)

        return getType(self.type).formatter(self.fmtstr, typedval)
989665
def FormatException(self, e, output):
    """"""
    d = e.GetDictToFormat()
    for k in ('file_name', 'feedname', 'column_name'):
      if k in d.keys():
        d[k] = '<code>%s</code>' % d[k]
    if 'url' in d.keys():
      d['url'] = '<a href="%(url)s">%(url)s</a>' % d

    problem_text = e.FormatProblem(d).replace('\n', '<br>')
    problem_class = 'problem'
    if e.IsNotice():
      problem_class += ' notice'
    output.append('<li>')
    output.append('<div class="%s">%s</div>' %
                  (problem_class, transitfeed.EncodeUnicode(problem_text)))
    try:
      if hasattr(e, 'row_num'):
        line_str = 'line %d of ' % e.row_num
      else:
        line_str = ''
      output.append('in %s<code>%s</code><br>\n' %
                    (line_str, transitfeed.EncodeUnicode(e.file_name)))
      row = e.row
      headers = e.headers
      column_name = e.column_name
      table_header = ''  # HTML
      table_data = ''  # HTML
      for header, value in zip(headers, row):
        attributes = ''
        if header == column_name:
          attributes = ' class="problem"'
        table_header += '<th%s>%s</th>' % (attributes, header)
        table_data += '<td%s>%s</td>' % (attributes, value)
      # Make sure output is encoded into UTF-8
      output.append('<table class="dump"><tr>%s</tr>\n' %
                    transitfeed.EncodeUnicode(table_header))
      output.append('<tr>%s</tr></table>\n' %
                    transitfeed.EncodeUnicode(table_data))
    except AttributeError as e:
      pass  # Hope this was getting an attribute from e ;-)
    output.append('<br></li>\n')
1338866
public function errorf()
    {
        $args = func_get_args();
        $format = array_shift($args);
        $this->error(vsprintf($format, $args));
    }
1328492
def _format_type(lines, element, spacer=""):
    """"""
    rlines = []
    rlines.append(element.signature)
    _format_summary(rlines, element)

    rlines.append("")
    _format_generic(rlines, element, ["summary"])

    if len(element.executables) > 0:
        rlines.append("\nEMBEDDED PROCEDURES")
        for key, value in list(element.executables.items()):
            rlines.append("  {}".format(value.__str__()))
            target = value.target
            if target is not None:
                _format_executable(rlines, target, "  ")

    if len(element.members) > 0:
        rlines.append("\nEMBEDDED MEMBERS")
        for key, value in list(element.members.items()):
            _format_value_element(rlines, value, "  ")

    lines.extend([spacer + l for l in rlines])
421242
function errorDiff(err, type, escape) {
  return diff['diff' + type](err.actual, err.expected).map(function(str){
    if (escape) {
      str.value = str.value
        .replace(/\t/g, '<tab>')
        .replace(/\r/g, '<CR>')
        .replace(/\n/g, '<LF>\n');
    }
    if (str.added) return colorLines('diff added', str.value);
    if (str.removed) return colorLines('diff removed', str.value);
    return str.value;
  }).join('');
}
1351851
def format_errors(errors, indent=0, prefix='', suffix=''):
    
    if is_single_item_iterable(errors):
        errors = errors[0]
    if isinstance(errors, SINGULAR_TYPES):
        yield indent_message(repr(errors), indent, prefix=prefix, suffix=suffix)

    elif isinstance(errors, collections.Mapping):
        for key, value in errors.items():
            assert isinstance(key, SINGULAR_TYPES), type(key)
            if isinstance(value, SINGULAR_TYPES):
                message = "{0}: {1}".format(repr(key), repr(value))
                yield indent_message(message, indent, prefix=prefix, suffix=suffix)
            else:
                yield indent_message(repr(key), indent, prefix=prefix, suffix=':')
                for message in format_errors(value, indent + 4, prefix='- '):
                    yield message

    elif is_non_string_iterable(errors):
        # for making the rhs of the numbers line up
        extra_indent = int(math.ceil(math.log10(len(errors)))) + 2
        for index, value in enumerate(errors):
            list_prefix = "{0}. ".format(index)
            messages = format_errors(
                value,
                indent=indent + extra_indent - len(list_prefix),
                prefix=list_prefix,
            )
            for message in messages:
                yield message
    else:
        assert False, "should not be possible"
1101631
def _format_type(cls):
    """"""
    if cls.__module__ == _BUILTIN_MODULE:
        return cls.__name__
    else:
        return '%s.%s' % (cls.__module__, cls.__name__)
1072332
def format_error(error: "GraphQLError") -> dict:
    
    if not error:
        raise ValueError("Received null or undefined error.")
    formatted: Dict[str, Any] = dict(  # noqa: E701 (pycqa/flake8#394)
        message=error.message or "An unknown error occurred.",
        locations=error.locations,
        path=error.path,
    )
    if error.extensions:
        formatted.update(extensions=error.extensions)
    return formatted
1373324
public String formatErrors() {

		if (errors.size() > 0) {

			StringBuilder results = new StringBuilder();

			for (Throwable t : errors) {
				results.append(t.getMessage());
				results.append("\n");
				if (t instanceof NullPointerException
						|| t instanceof CompilerError) {

					results.append(formatStackTrace(t));

				} else if (t instanceof SystemException) {

					results.append(formatStackTrace(t));

					Throwable cause = t.getCause();
					if (cause != null) {
						results.append("\nCause:\n");
						results.append(cause.getMessage());
						results.append("\n");
					}
					results.append(formatStackTrace(t));
				}
			}
			return results.toString();
		} else {
			return null;
		}
	}
567270
def _clean(self, value):
        """"""
        if value is None:
            return None
        elif self.type_ is None:
            return value
        elif self.check_type(value):
            return value
        elif self.is_type_castable:  # noqa
            return self.type_(value)

        error_fmt = "%s must be a %s, not a %s"
        error = error_fmt % (self.name, self.type_, type(value))
        raise TypeError(error)
715481
def _FormatTypeCheck(type_):
  """"""
  if isinstance(type_, tuple):
    items = [_FormatTypeCheck(t) for t in type_]
    return "(%s)" % ", ".join(items)
  elif hasattr(type_, "__name__"):
    return type_.__name__
  else:
    return repr(type_)
1357744
def t_error(t):
    
    msg = _format("Illegal character {0!A}", t.value[0])
    t.lexer.last_msg = msg
    t.lexer.skip(1)
    return t
968835
def format_kinds(raw):
    """"""
    output = ' '.join('{} {}'.format(*kind) for kind in raw if kind)
    return output