Return a progress indicator for consoles if
        stdout is a tty.
177252
def console_progress():
    
    def progress(totalhashed, totalsize):
        "Helper"
        msg = " " * 30
        if totalhashed < totalsize:
            msg = "%5.1f%% complete" % (totalhashed * 100.0 / totalsize)
        sys.stdout.write(msg + " \r")
        sys.stdout.flush()

    try:
        return progress if sys.stdout.isatty() else None
    except AttributeError:
        return None
242348
def progress_indicator(self, fmt=None, interval=100, values=None):
        
        return ProgressIndicator(self.io, fmt, interval, values)
1183382
def _progress_print(self, sent, total):
        
        percent = min(int(sent*100.0/total), 100)
        sys.stdout.write('\r{0}[{1}{2}] {3}{4}%{5}'.
                         format(color.Green, '#'*(percent/2), ' '*(50-percent/2), color.Yellow, percent, color.Normal))
        sys.stdout.flush()
719670
def info_progress(prefix: str, value: float, max_value: float) -> None:
    
    if sys.stdout.isatty():
        percent = float(value) / max_value * 100
        sys.stdout.write(prefix + ": %.0f%%\r" % percent)
        sys.stdout.flush()
373322
def _tick(self):
        """"""
        if (self.verbose >= 3 and not IS_REDIRECTED) or self.options.get("progress"):
            stats = self.get_stats()
            prefix = DRY_RUN_PREFIX if self.dry_run else ""
            sys.stdout.write(
                "{}Touched {}/{} entries in {} directories...\r".format(
                    prefix,
                    stats["entries_touched"],
                    stats["entries_seen"],
                    stats["local_dirs"],
                )
            )
        sys.stdout.flush()
        return
381310
def _stdout_level(self):
        """"""
        for level, consumer in self.consumers:
            if consumer is sys.stdout:
                return level
        return self.FATAL
270878
def StatusLine(self):
    """"""
    pid = self.inferior.pid
    curthread = None
    threadnum = 0
    if pid:
      if not self.inferior.is_running:
        logging.warning('Inferior is not running.')
        self.Detach()
        pid = None
      else:
        try:
          # get a gdb running if it wasn't already.
          if not self.inferior.attached:
            self.inferior.StartGdb()
          curthread = self.inferior.current_thread
          threadnum = len(self.inferior.threads)
        except (inferior.ProxyError,
                inferior.TimeoutError,
                inferior.PositionError) as err:
          # This is not the kind of thing we want to be held up by
          logging.debug('Error while getting information in status line:%s'
                        % err.message)
          pass
    status = ('==> pid:[%s] #threads:[%s] current thread:[%s]' %
              (pid, threadnum, curthread))
    return status
1054790
def check_output(args):
    
    proc = Popen(args, stdout=PIPE)
    out = proc.communicate()[0]
    if proc.returncode:
        raise CalledProcessError(proc.returncode, args, output=out)
    return out
1013401
def check(self) -> z3.CheckSatResult:
        
        old_stdout = sys.stdout
        sys.stdout = open(os.devnull, "w")
        evaluate = self.raw.check()
        sys.stdout = old_stdout
        return evaluate
346452
def _console(console: Any) -> Any:
    """"""
    try:
        return console.console_c
    except AttributeError:
        warnings.warn(
            (
                "Falsy console parameters are deprecated, "
                "always use the root console instance returned by "
                "console_init_root."
            ),
            DeprecationWarning,
            stacklevel=3,
        )
        return ffi.NULL
248649
async def status(dev: Device):
    """"""
    power = await dev.get_power()
    click.echo(click.style("%s" % power, bold=power))

    vol = await dev.get_volume_information()
    click.echo(vol.pop())

    play_info = await dev.get_play_info()
    if not play_info.is_idle:
        click.echo("Playing %s" % play_info)
    else:
        click.echo("Not playing any media")

    outs = await dev.get_inputs()
    for out in outs:
        if out.active:
            click.echo("Active output: %s" % out)

    sysinfo = await dev.get_system_info()
    click.echo("System information: %s" % sysinfo)
254368
function () {
        var tty,
            width,
            height;

        try { tty = require('tty'); }
        catch (e) { tty = null; }

        if (tty && tty.isatty(1) && tty.isatty(2)) {
            if (process.stdout.getWindowSize) {
                width = process.stdout.getWindowSize(1)[0];
                height = process.stdout.getWindowSize(1)[1];
            }
            else if (tty.getWindowSize) {
                width = tty.getWindowSize()[1];
                height = tty.getWindowSize()[0];
            }
            else if (process.stdout.columns && process.stdout.rows) {
                height = process.stdout.rows;
                width = process.stdout.columns;
            }
        }

        return {
            exists: !(Boolean(process.env.CI) || !process.stdout.isTTY), // eslint-disable-line no-process-env
            width: width,
            height: height
        };
    }
1203316
def main(github_token, github_api_url, progress):
    """"""
    global progress_reporter_cls
    progress_reporter_cls.reportProgress = sys.stdout.isatty() and progress
    if progress_reporter_cls.reportProgress:
        progress_reporter_cls = _progress_bar
    global _github_token_cli_arg
    _github_token_cli_arg = github_token
    global _github_api_url
    _github_api_url = github_api_url
846602
def tty_stream(self):
        
        return hasattr(self.options.stream, "isatty") \
            and self.options.stream.isatty()
1232626
def suppress_stdout():
    
    save_stdout = sys.stdout
    sys.stdout = DevNull()
    yield
    sys.stdout = save_stdout
849514
def _progress(bytes_received, bytes_total, worker):
        """"""
        worker.sig_download_progress.emit(
            worker.url, worker.path, bytes_received, bytes_total)
283125
def console(cls, id):
        """"""
        oper = cls.call('paas.update', cls.usable_id(id), {'console': 1})
        cls.echo('Activation of the console on your PaaS instance')
        cls.display_progress(oper)
        console_url = Paas.info(cls.usable_id(id))['console']
        access = 'ssh %s' % console_url
        cls.execute(access)