Wraps click.echo, handles formatting and check encoding
487490
def echo(msg, *args, **kwargs):
    ''''''
    file = kwargs.pop('file', None)
    nl = kwargs.pop('nl', True)
    err = kwargs.pop('err', False)
    color = kwargs.pop('color', None)
    msg = safe_unicode(msg).format(*args, **kwargs)
    click.echo(msg, file=file, nl=nl, err=err, color=color)
844028
function translateFormat(formatString, mapping) {
  let len = formatString.length,
    i = 0,
    beginIndex = -1,
    lastChar = null,
    currentChar = "",
    resultString = "";

  for (; i < len; i++) {
    currentChar = formatString.charAt(i);

    if (lastChar === null || lastChar !== currentChar) {
      // change detected
      resultString = _appendMappedString(formatString, mapping, beginIndex, i, resultString);

      beginIndex = i;
    }

    lastChar = currentChar;
  }

  return _appendMappedString(formatString, mapping, beginIndex, i, resultString);
}
67017
def echo(
    message=None, file=None, nl=True, err=False, color=None, carriage_return=False
):
    
    message = message or ""
    if carriage_return and nl:
        click_echo(message + "\r\n", file, False, err, color)
    elif carriage_return and not nl:
        click_echo(message + "\r", file, False, err, color)
    else:
        click_echo(message, file, nl, err, color)
916468
def echo_json_response(response, pretty, limit=None, ndjson=False):
    ''''''
    indent = None
    sort_keys = False
    nl = False
    if not ndjson and (pretty or (pretty is None and sys.stdout.isatty())):
        indent = 2
        sort_keys = True
        nl = True
    try:
        if ndjson and hasattr(response, 'items_iter'):
            items = response.items_iter(limit)
            for item in items:
                click.echo(json.dumps(item))
        elif not ndjson and hasattr(response, 'json_encode'):
            response.json_encode(click.get_text_stream('stdout'), limit=limit,
                                 indent=indent, sort_keys=sort_keys)
        else:
            res = response.get_raw()
            res = json.dumps(json.loads(res), indent=indent,
                             sort_keys=sort_keys)
            click.echo(res)
        if nl:
            click.echo()
    except IOError as ioe:
        # hide scary looking broken pipe stack traces
        raise click.ClickException(str(ioe))
480232
def generate_clickable_map(self):
        # type: () -> unicode
        
        if self.clickable:
            return '\n'.join([self.content[0]] + self.clickable + [self.content[-1]])
        else:
            return ''
310197
def hrule(width=None, char=None):
    """"""
    width = width or HRWIDTH
    char = char or HRCHAR
    return echo(getline(char, width))
1341281
def default_formatter(handler, item, value):
    """"""
    if hasattr(value, '__unicode__'):
        value = value.__unicode__()

    return escape(str(value))
966748
function $(tok) {
        var tokType = typeof tok,
            match, length;

        // Either match a single character in the input,
        // or match a regexp in the current chunk (`current`).
        //
        if (tokType === "string") {
            if (input.charAt(i) !== tok) {
                return null;
            }
            skipWhitespace(1);
            return tok;
        }

        // regexp
        sync ();
        if (! (match = tok.exec(current))) {
            return null;
        }

        length = match[0].length;

        // The match is confirmed, add the match length to `i`,
        // and consume any extra white-space characters (' ' || '\n')
        // which come after that. The reason for this is that LeSS's
        // grammar is mostly white-space insensitive.
        //
        skipWhitespace(length);

        if(typeof(match) === 'string') {
            return match;
        } else {
            return match.length === 1 ? match[0] : match;
        }
    }
382497
private static String escapeJavaScriptChars(String s) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            switch (ch) {
                case '\b':
                    sb.append("\\b");
                    break;
                case '\t':
                    sb.append("\\t");
                    break;
                case '\n':
                    sb.append("\\n");
                    break;
                case '\f':
                    sb.append("\\f");
                    break;
                case '\r':
                    sb.append("\\r");
                    break;
                case '"':
                    sb.append("\\\"");
                    break;
                case '\'':
                    sb.append("\\\'");
                    break;
                case '\\':
                    sb.append("\\\\");
                    break;
                default:
                    if (ch < 32 || ch >= 127) {
                        sb.append(String.format("\\u%04X", (int)ch));
                    } else {
                        sb.append(ch);
                    }
                    break;
            }
        }
        return sb.toString();
    }
1185227
def _readline_insert(self, char, echo, insptr, line):
        """"""
        if not self._readline_do_echo(echo):
            return
        # Write out the remainder of the line
        self.write(char + ''.join(line[insptr:]))
        # Cursor Left to the current insert point
        char_count = len(line) - insptr
        self.write(self.CODES['CSRLEFT'] * char_count)
120805
function() {
      if (common.inlinescripts.length > 0) {
        var script_text = '';
        for (var i = 0; i < common.inlinescripts.length; i++) {
          if (!common.inlinescripts[i] || typeof common.inlinescripts[i] == 'undefined') 
            continue;
          else
            script_text += common.inlinescripts[i] + '\n';
        }
        try {
          eval(script_text);
        } catch(e) {
          batch.callback(script_text);
        }
      }
    }
157780
def displayhtml(public_key,
                attrs,
                use_ssl=False,
                error=None):
    """"""

    error_param = ''
    if error:
        error_param = '&error=%s' % error

    if use_ssl:
        server = API_SSL_SERVER
    else:
        server = API_SERVER

    if 'lang' not in attrs:
        attrs['lang'] = get_language()[:2]

    return render_to_string(
        WIDGET_TEMPLATE,
        {'api_server': server,
         'public_key': public_key,
         'error_param': error_param,
         'lang': attrs['lang'],
         'options': mark_safe(json.dumps(attrs, indent=2))
         })
496892
def process_bind_param(self, value, dialect):
        """"""
        if value is not None:
            value = simplejson.dumps(value)
        return value
875909
function (preserveFormatting, cb) {
    var lines = [];
    fs.createReadStream(HOSTS, 'utf8')
      .pipe(split())
      .pipe(through(function (line) {
        var matches = /^\s*?([^#]+?)\s+([^#]+?)$/.exec(line);
        if (matches && matches.length === 3) {
          // Found a hosts entry
          var ip = matches[1];
          var host = matches[2];
          lines.push([ip, host]);
        } else {
          // Found a comment, blank line, or something else
          if (preserveFormatting) {
            lines.push(line);
          }
        }
      }))
      .on('close', function () {
        cb(null, lines);
      })
      .on('error', cb);
  }
852351
function(ctx) {
				// TODO: return promise?
				var matchNode,
					stamp,
					res,
					focusNode,
					event = ctx.originalEvent,
					node = ctx.node,
					tree = ctx.tree,
					opts = ctx.options,
					which = event.which,
					// #909: Use event.key, to get unicode characters.
					// We can't use `/\w/.test(key)`, because that would
					// only detect plain ascii alpha-numerics. But we still need
					// to ignore modifier-only, whitespace, cursor-keys, etc.
					key = event.key || String.fromCharCode(which),
					specialModifiers = !!(
						event.altKey ||
						event.ctrlKey ||
						event.metaKey
					),
					isAlnum =
						!MODIFIERS[which] &&
						!SPECIAL_KEYCODES[which] &&
						!specialModifiers,
					$target = $(event.target),
					handled = true,
					activate = !(event.ctrlKey || !opts.autoActivate);

				// (node || FT).debug("ftnode.nodeKeydown(" + event.type + "): ftnode:" + this + ", charCode:" + event.charCode + ", keyCode: " + event.keyCode + ", which: " + event.which);
				// FT.debug( "eventToString(): " + FT.eventToString(event) + ", key='" + key + "', isAlnum: " + isAlnum );

				// Set focus to active (or first node) if no other node has the focus yet
				if (!node) {
					focusNode = this.getActiveNode() || this.getFirstChild();
					if (focusNode) {
						focusNode.setFocus();
						node = ctx.node = this.focusNode;
						node.debug("Keydown force focus on active node");
					}
				}

				if (
					opts.quicksearch &&
					isAlnum &&
					!$target.is(":input:enabled")
				) {
					// Allow to search for longer streaks if typed in quickly
					stamp = Date.now();
					if (stamp - tree.lastQuicksearchTime > 500) {
						tree.lastQuicksearchTerm = "";
					}
					tree.lastQuicksearchTime = stamp;
					tree.lastQuicksearchTerm += key;
					// tree.debug("quicksearch find", tree.lastQuicksearchTerm);
					matchNode = tree.findNextNode(
						tree.lastQuicksearchTerm,
						tree.getActiveNode()
					);
					if (matchNode) {
						matchNode.setActive();
					}
					event.preventDefault();
					return;
				}
				switch (FT.eventToString(event)) {
					case "+":
					case "=": // 187: '+' @ Chrome, Safari
						tree.nodeSetExpanded(ctx, true);
						break;
					case "-":
						tree.nodeSetExpanded(ctx, false);
						break;
					case "space":
						if (node.isPagingNode()) {
							tree._triggerNodeEvent("clickPaging", ctx, event);
						} else if (
							FT.evalOption("checkbox", node, node, opts, false)
						) {
							// #768
							tree.nodeToggleSelected(ctx);
						} else {
							tree.nodeSetActive(ctx, true);
						}
						break;
					case "return":
						tree.nodeSetActive(ctx, true);
						break;
					case "home":
					case "end":
					case "backspace":
					case "left":
					case "right":
					case "up":
					case "down":
						res = node.navigate(event.which, activate);
						break;
					default:
						handled = false;
				}
				if (handled) {
					event.preventDefault();
				}
			}
274725
def pprint(j, no_pretty):
    
    if not no_pretty:
        click.echo(
            json.dumps(j, cls=PotionJSONEncoder, sort_keys=True, indent=4, separators=(",", ": "))
        )
    else:
        click.echo(j)
410720
static function echojs($js, $return = false)
    {
        $out = self::charset($return);
        $out .= self::$head;
        $out .= $js;
        $out .= self::$foot;
        if (!Error::$stop or $return)
        {
            return $out;
        }
        else
        {
            echo $out;
        }
    }