Helper function to simplify writing.
960642
def _write(self, cmd, *datas):
        """"""
        cmd = Command(write=cmd)
        cmd.write(self._transport, self._protocol, *datas)
791449
def shorten_text(self, text):
        """"""
        if len(text) > self.width:
            return text[:self.width - 3] + '...'
        return text
758691
def indent(lines, amount, ch=' '):
    """"""
    padding = amount * ch
    return padding + ('\n' + padding).join(lines.split('\n'))
842808
def stylize(text, styles, reset=True):
    """"""
    terminator = attr("reset") if reset else ""
    return "{}{}{}".format("".join(styles), text, terminator)
710829
def strippen(function):
    ""
    def wrapper(*args, **kwargs):
        return strip_strings(function(*args, **kwargs))
    return wrapper
189558
def _wr_ver_n_key(self, fout_txt, verbose):
        """"""
        with open(fout_txt, 'w') as prt:
            self._prt_ver_n_key(prt, verbose)
            print('               WROTE: {TXT}'.format(TXT=fout_txt))
833978
function write(buffer) {

    // first, trim trailing whitespace for fast searching
    buffer = buffer.replace(/[ \t]+$/gm, '')

    // compact lines if emptyLines != -1
    if (_elines >= 0)
      buffer = trimBuffer(buffer)

    if (!buffer) return

    // finished the surrounding lines, now the inners
    if (!_elines) {
      // remove empty lines and change eols in one unique operation
      buffer = buffer.replace(/\n{2,}/g, _to)
    }
    else {
      // keep max n empty lines (n+1 sucesive eols), -1 keep all
      if (_elines > 0)
        buffer = buffer.replace(_re, '$1')

      // change line terminator if not unix
      if (_to !== '\n') buffer = buffer.replace(/\n/g, _to)
    }

    // apply indentation, regex `^.` with `/m` matches non-empty lines
    if (_indent)
      buffer = buffer.replace(/^./mg, _indent + '$&')

    _lastch = buffer.slice(-1)
    // istanbul ignore else
    if (output)
      output.emit('data', buffer)
  }
1110435
def simplify(self) -> None:
        """"""
        self.raw = cast(T, z3.simplify(self.raw))
1057688
def indented(text, level, indent=2):
    """"""
    return "\n".join("%s%s" % (level * indent * " ", s) for s in text.splitlines())
923881
function MinifyWriter() {
        var self = this;
        MinifyWriter.superclass.constructor.apply(self, arguments);
        self.inPre = 0;
    }
823707
def write(self, fp):
        """"""
        if self._defaults:
            fp.write("[%s]\n" % DEFAULTSECT)
            for (key, value) in self._defaults.items():
                fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t')))
            fp.write("\n")
        for section in self._sections:
            fp.write("[%s]\n" % section)
            for (key, value) in self._sections[section].items():
                if key == "__name__":
                    continue
                if (value is not None) or (self._optcre == self.OPTCRE):
                    key = " = ".join((key, str(value).replace('\n', '\n\t')))
                fp.write("%s\n" % (key))
            fp.write("\n")
408176
def write(self, s):
        """"""
        for line in re.split(r'\n+', s):
            if line != '':
                self._logger.log(self._level, line)
387379
def indent(text: str, num: int = 2) -> str:
    """"""
    lines = text.splitlines()
    return "\n".join(indent_iterable(lines, num=num))
196090
def _write(self, fp):
        """"""
        def write_section(name, section_dict):
            fp.write(("[%s]\n" % name).encode(defenc))
            for (key, value) in section_dict.items():
                if key != "__name__":
                    fp.write(("\t%s = %s\n" % (key, self._value_to_string(value).replace('\n', '\n\t'))).encode(defenc))
                # END if key is not __name__
        # END section writing

        if self._defaults:
            write_section(cp.DEFAULTSECT, self._defaults)
        for name, value in self._sections.items():
            write_section(name, value)
66956
def simplify_recursive(typ):
    # type: (AbstractType) -> AbstractType
    """"""
    if isinstance(typ, UnionType):
        return combine_types(typ.items)
    elif isinstance(typ, ClassType):
        simplified = ClassType(typ.name, [simplify_recursive(arg) for arg in typ.args])
        args = simplified.args
        if (simplified.name == 'Dict' and len(args) == 2
                and isinstance(args[0], ClassType) and args[0].name in ('str', 'Text')
                and isinstance(args[1], UnionType) and not is_optional(args[1])):
            # Looks like a potential case for TypedDict, which we don't properly support yet.
            return ClassType('Dict', [args[0], AnyType()])
        return simplified
    elif isinstance(typ, TupleType):
        return TupleType([simplify_recursive(item) for item in typ.items])
    return typ
809787
def cli(input, verbose, quiet, output_format, precision, indent):
    """"""

    verbosity = verbose - quiet
    configure_logging(verbosity)
    logger = logging.getLogger('geomet')

    # Handle the case of file, stream, or string input.
    try:
        src = click.open_file(input).readlines()
    except IOError:
        src = [input]

    stdout = click.get_text_stream('stdout')

    # Read-write loop.
    try:
        for line in src:
            text = line.strip()
            logger.debug("Input: %r", text)
            output = translate(
                text,
                output_format=output_format,
                indent=indent,
                precision=precision
            )
            logger.debug("Output: %r", output)
            stdout.write(output)
            stdout.write('\n')
        sys.exit(0)
    except Exception:
        logger.exception("Failed. Exception caught")
        sys.exit(1)
133092
def write(p, line):
    """"""
    log.debug('%s <- %r', p.args, line)
    p.stdin.write(line)
    p.stdin.flush()