formats some text for debugging given a few options
180262
function formatText(text, options) {
  var finalText = text;

  if (options && options.trimmed && text.length > 25)
    finalText = finalText.substring(0,25).trim() + "…";
  if (!(options && options.preserveWhitespace))
    finalText = finalText.trim();

  return finalText;
}
508077
def pretty(self, indent=1, debug=False):
        
        debug_details = ''
        if debug:
            debug_details += '<isliteral=%r, iscanonical=%r>' % (self.isliteral, self.iscanonical)
        if self.isliteral:
            pretty_literal = self.args[0].pretty(indent=0, debug=debug)
            return (' ' * indent) + '%s(%s%s)' % (self.__class__.__name__, debug_details, pretty_literal)
        else:
            return super(NOT, self).pretty(indent=indent, debug=debug)
1357869
def format_enum(enum_def):
    '''
    '''
    text = []
    text.append('cdef enum {}:'.format(enum_def.tp_name))
    for member in enum_def.values:
        if member.value:
            text.append('{}{} = {}'.format(tab, *member))
        else:
            text.append('{}{}'.format(tab, member.name))

    for name in enum_def.names:
        text.append('ctypedef {} {}'.format(enum_def.tp_name, name))

    return text
1349690
def _format_option(opt):
    """"""
    opt = _get_help_record(opt)

    yield '.. option:: {}'.format(opt[0])
    if opt[1]:
        yield ''
        for line in statemachine.string2lines(
                opt[1], tab_width=4, convert_whitespace=True):
            yield _indent(line)
612961
def _print_options_help(self):
        for i, x in enumerate(self._help_lines[self.selection]):
            if i + 2 == self.maxY:
                break
            self._win.addstr(i+2, self._second_column, ' ' * (self._second_column - 1), curses.color_pair(5))
            self._win.addstr(i+2, self._second_column, x.replace('|',''), curses.color_pair(5))
        if len(self._help_lines[self.selection]) < self._num_of_help_lines:
            for i in range(len(self._help_lines[self.selection]), self._num_of_help_lines):
                try:
                    self._win.addstr(i+2, self._second_column, ' ' * (self._second_column - 1), curses.color_pair(5))
                except:
                    pass
        self._num_of_help_lines = len(self._help_lines[self.selection])
        
429444
def debug(context):
    

    from pprint import pformat
    output = [pformat(val) for val in context]
    output.append('\n\n')
    output.append(pformat(sys.modules))
    return ''.join(output)
210606
def _after_indentation(res, options=None, fpath=''):
    
    fname = os.path.basename(fpath)
    opts = parse_options(options)

    for msg in res['message_stack']:
        if opts.warning:
            if opts.files:
                msg['fname'] = fname
                sys.stderr.write('\n{fname}:{line}:{column}: {msg}'.format(**msg))
            else:
                # Input was passed through stdin
                sys.stderr.write('\n:{line}:{column}: {msg}'.format(**msg))

    if res['bracket_locations']:
        # If the bracket_locations list is not empty it means that there are some
        # brackets(opening) that haven't been closed.
        for bracket in res['bracket_locations']:
            line = bracket['line_number']
            column = bracket['bracket_pos']
            character = bracket['character']
            # The bracket_locations are not very accurate. The warning might be
            # misleading because it considers round and square brackets to be
            # the same.
            message = "\n%s:%d:%d: Unmatched `%s'"
            if opts.warning:
                sys.stderr.write(message % (fname, line, column, character))

    if res['newlisp_brace_locations']:
        for brace in res['newlisp_brace_locations']:
            message = "\n%s:%d:%d: Unclosed newLISP brace string"
            if opts.warning:
                sys.stderr.write(message % (fname, brace[0], brace[1]))

    if res['comment_locations']:
        for comment in res['comment_locations']:
            message = "\n%s:%d:%d: Unclosed multiline comment"
            tpl = (fname,) + comment
            if opts.warning:
                sys.stderr.write(message % tpl)

    if res['last_symbol_location']:
        message = "\n%s:%d:%d: Unclosed symbol"
        tpl = (fname,) + res['last_symbol_location']
        if opts.warning:
            sys.stderr.write(message % tpl)

    if res['in_string']:
        message = "\n%s:%d:%d: String extends to end-of-file"
        tpl = (fname,) + res['last_quote_location']
        if opts.warning:
            sys.stderr.write(message % tpl)

    if res['in_newlisp_tag_string']:
        message = "\n%s:%d:%d: Tag string extends to end-of-file"
        tpl = (fname,) + res['first_tag_string']
        if opts.warning:
            sys.stderr.write(message % tpl)

    output_file = opts.output_file
    if not output_file:
        output_file = fpath

    indented_code = res['indented_code']
    indent_result = ''.join(indented_code)
    if indented_code == res['original_code'] and opts.files:
        message = "\nFile `%s' has already been formatted. Leaving it unchanged. . .\n"
        sys.stderr.write(message % fname)
        if output_file != fpath:
            with open(output_file, 'wb') as indented_file:
                indented_file.write(indent_result.encode('utf8'))
    else:
        if opts.output_diff:
            diff = difflib.unified_diff(res['original_code'], indented_code, n=5)
            if opts.colour_diff:
                colour_diff(diff)
            else:
                print(''.join(list(diff)))
        elif opts.output:
            print(indent_result, end='')

        if opts.modify:
            # write in binary mode to preserve the original line ending
            with open(output_file, 'wb') as indented_file:
                indented_file.write(indent_result.encode('utf8'))
19511
def format_as_option(str, io)
      if Cri::Platform.color?(io)
        yellow(str)
      else
        str
      end
    end
498679
def _coloredhelp(s):
    
    newlines = []
    bigindent = (' ' * 16)
    in_opts = False
    for line in s.split('\n'):
        linestripped = line.strip('\n').strip().strip(':')
        if linestripped == 'Usage':
            # label
            line = line.replace('Usage', str(C('Usage', **ARGS_LABEL)))
        elif linestripped == 'Options':
            line = line.replace('Options', str(C('Options', **ARGS_LABEL)))
            in_opts = True
        elif (':' in line) and (not line.startswith(bigindent)):
            # opt,desc line. colorize it.
            lineparts = line.split(':')
            opt = lineparts[0]
            vals = [lineparts[1]] if len(lineparts) == 2 else lineparts[1:]

            # colorize opt
            if ',' in opt:
                opts = opt.split(',')
            else:
                opts = [opt]
            optstr = ','.join(str(C(o, **ARGS_OPTIONS)) for o in opts)

            # colorize desc
            valstr = ':'.join(str(C(val, **ARGS_DESC)) for val in vals)
            line = ':'.join((optstr, valstr))
        elif in_opts and line.startswith(bigindent):
            # continued desc string..
            # Make any 'Default:Value' parts look the same as the opt,desc.

            line = ':'.join(str(C(s, **ARGS_DESC)) for s in line.split(':'))
        elif (not line.startswith('    ')):
            # header line.
            line = str(C(line, **ARGS_HEADER))
        else:
            # Everything else, usage mainly.
            if SCRIPT:
                line = line.replace(SCRIPT, str(C(SCRIPT, **ARGS_SCRIPT)))

        newlines.append(
            '{}{}'.format(line, C('', style='reset_all'))
        )
    return '\n'.join(newlines)
423594
function optionsFromStrings(options) {
	var intOptions = ["width", "height", "textMargin", "fontSize", "margin", "marginTop", "marginBottom", "marginLeft", "marginRight"];

	for (var intOption in intOptions) {
		if (intOptions.hasOwnProperty(intOption)) {
			intOption = intOptions[intOption];
			if (typeof options[intOption] === "string") {
				options[intOption] = parseInt(options[intOption], 10);
			}
		}
	}

	if (typeof options["displayValue"] === "string") {
		options["displayValue"] = options["displayValue"] != "false";
	}

	return options;
}
96545
function _Markdown_formatOptions(options) {
    function toHighlight(code, lang) {
      if (!lang && elm$core$Maybe$isJust(options.defaultHighlighting)) {
        lang = options.defaultHighlighting.a;
      }

      if (
        typeof hljs !== "undefined" &&
        lang &&
        hljs.listLanguages().indexOf(lang) >= 0
      ) {
        return hljs.highlight(lang, code, true).value;
      }

      return code;
    }

    var gfm = options.githubFlavored.a;

    return {
      highlight: toHighlight,
      gfm: gfm,
      tables: gfm && gfm.tables,
      breaks: gfm && gfm.breaks,
      sanitize: options.sanitize,
      smartypants: options.smartypants
    };
  }
1012538
function formatAll(results, options, showName) {
    var stdout = '';
    if (showName) {
      for (var i = 0; i < results.length; ++i) {
        stdout += results[i].path + ':\n';
        if (options.l) {
          stdout += 'total ' + results[i].size + '\n';
        }
        stdout += results[i].results;
        if (i !== results.length - 1) {
          stdout += '\n\n';
        }
      }
    } else if (results.length === 1) {
      if (options.l && !options.x) {
        stdout += 'total ' + results[0].size + '\n';
      }
      stdout += results[0].results;
    }
    return stdout;
  }
598707
function formatMsg(){

        return Array.prototype.slice.call( arguments ) .concat([ " (at ", linen, ":", linec, ")." ]) .join( "" );
    }
1043641
def to_debug_message(
        self, text: str, color=None, pos: Optional[Union[Point2, Point3]] = None, size: int = 8
    ) -> debug_pb.DebugText:
        
        color = self.to_debug_color(color)
        pt3d = self.to_debug_point(pos) if isinstance(pos, Point3) else None
        virtual_pos = self.to_debug_point(pos) if not isinstance(pos, Point3) else None

        return debug_pb.DebugText(color=color, text=text, virtual_pos=virtual_pos, world_pos=pt3d, size=size)
896404
function breakpointToString(options) {
  var mq;

  if ('undefined' !== typeof options.mq) {
    mq = options.mq;
  } else {
    var max = Util.getOption(options.max, Infinity);
    var min = Util.getOption(options.min, 0);

    mq = 'only screen';
    if (max < Infinity) {
      mq += ' and (max-width: ' + max + 'px)';
    }
    if (min > 0) {
      mq += ' and (min-width: ' + min + 'px)';
    }
  }

  return mq;
}
956546
function format(source) {
  var fmtedCode = 'NotInitialized'
  try {
    fmtedCode = reason.printRE(reason.parseRE(source))
  } catch (e) {
    fmtedCode =
      'line ' +
      e.location.startLine +
      ', characters ' +
      e.location.startLineStartChar +
      '-' +
      e.location.endLineEndChar +
      ', ' +
      e.message +
      '\n' +
      source
  }

  return fmtedCode
}
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])