Restore sys.stderr and sys.stdout to their original objects. Resets colors to their original values.
348325
def disable():
        """"""
        if os.name != 'nt' or not Windows.is_enabled():
            return False

        getattr(sys.stderr, '_reset_colors', lambda: False)()
        getattr(sys.stdout, '_reset_colors', lambda: False)()

        if isinstance(sys.stderr, _WindowsStream):
            sys.stderr = getattr(sys.stderr, 'original_stream')
        if isinstance(sys.stderr, _WindowsStream):
            sys.stdout = getattr(sys.stdout, 'original_stream')

        return True
148752
def err(*args):
    
    for value in args:
        sys.stderr.write(value)

    sys.stderr.write(os.linesep)
79061
def disable(cls):
        
        # Skip if not on Windows.
        if not IS_WINDOWS:
            return False

        # Restore default colors.
        if hasattr(sys.stderr, '_original_stream'):
            getattr(sys, 'stderr').color = None
        if hasattr(sys.stdout, '_original_stream'):
            getattr(sys, 'stdout').color = None

        # Restore original streams.
        changed = False
        if hasattr(sys.stderr, '_original_stream'):
            changed = True
            sys.stderr = getattr(sys.stderr, '_original_stream')
        if hasattr(sys.stdout, '_original_stream'):
            changed = True
            sys.stdout = getattr(sys.stdout, '_original_stream')

        return changed
322939
def _redirect_stderr():
    
    sys.stderr.flush()
    stderr_fileno = sys.stderr.fileno()
    orig_stderr = os.dup(stderr_fileno)
    devnull = os.open(os.devnull, os.O_WRONLY)
    os.dup2(devnull, stderr_fileno)
    os.close(devnull)
    return orig_stderr
1030593
def finalize(self, result):
        """"""
        sys.stderr = self._stderr.pop()
        sys.stdout = self._stdout.pop()
        pdb.set_trace = self._set_trace.pop()
        pdb.Pdb.cmdloop = self._cmdloop.pop()
871426
def reset(self):
        
        shutil.copy2(self.config_file + ".orig", self.config_file)
        if filecmp.cmp(self.config_file + ".orig", self.config_file):
            print("{0}The reset was done{1}".format(
                self.meta.color["GREEN"], self.meta.color["ENDC"]))
        else:
            print("{0}Reset failed{1}".format(self.meta.color["RED"],
                                              self.meta.color["ENDC"]))
819029
def succ(cmd, check_stderr=True, stdout=None, stderr=None):
    '''
    
    '''
    code, out, err = run(cmd)

    # Because we're raising error, sometimes we want to process stdout/stderr after catching error
    # so we're copying these outputs if required
    if stdout is not None:
        stdout[:] = out
    if stderr is not None:
        stderr[:] = err

    if code != 0:
        for l in out:
            print(l)
    assert code == 0, 'Return: {} {}\nStderr: {}'.format(code, cmd, err)
    if check_stderr:
        assert err == [], 'Error: {} {}'.format(err, code)
    return code, out, err
1146251
def _read_stderr(self):
        
        output = self._decode(self._process.readAllStandardError().data())
        if self._formatter:
            self._formatter.append_message(output, output_format=OutputFormat.ErrorMessageFormat)
        else:
            self.insertPlainText(output)
825277
def reset(self):
        
        self._fgcolor = self.default_fgcolor
        self._bgcolor = self.default_bgcolor
716990
def reset!
      self.debug   = ENV['DEBUG']
      self.logger  = Logger.new(STDOUT)
      self.bin_dir = nil
      self.tmp_dir = '/tmp/audio_monster'
      self.file    = 'file'
      self.ffmpeg  = 'ffmpeg'
      self.ffprobe = 'ffprobe'
      self.lame    = 'lame'
      self.mp3val  = 'mp3val'
      self.sox     = 'sox'
      self.soxi    = 'soxi'
      self.twolame = 'twolame'
      self
    end
366284
def stderr(self):
        
        stream = self._log_file_handle if self._log_file_handle else osutils.stderr()
        return StreamWriter(stream, self._is_debugging)
801093
public function resetOutputStreams()
    {
        defined('STDOUT') || define('STDOUT', fopen('php://stdout', 'w'));
        defined('STDERR') || define('STDERR', fopen('php://stderr', 'w'));
        static::$streamsMap = [
            LogLevel::EMERGENCY => STDERR,
            LogLevel::ALERT => STDERR,
            LogLevel::CRITICAL => STDERR,
            LogLevel::ERROR => STDERR,
            LogLevel::WARNING => STDERR,
            LogLevel::NOTICE => STDOUT,
            LogLevel::INFO => STDOUT,
            LogLevel::DEBUG => STDOUT
        ];
    }
502976
def stderr(self):
        
        streams = self._payload.get('streams', None)
        return streams[1] if streams is not None and len(streams) >= 2 else ''
12393
function printError(error) {
    process.stderr.write(red);
    console.error(error.trace);
    process.stderr.write(yellow);
    console.error('an error occurred, please file an issue');
    process.stderr.write(reset);
    process.exit(1);
  }
1161733
def disable_if_no_tty(cls):
        
        if sys.stdout.isatty() or sys.stderr.isatty():
            return False
        cls.disable_all_colors()
        return True
725140
def restore(self):
        
        sys = set(self._sys_modules.keys())
        for mod_name in sys.difference(self._saved_modules):
            del self._sys_modules[mod_name]
287107
def stderr_avail(self):
        """"""
        data = self.interpreter.stderr_write.empty_queue()
        if data:
            self.write(data, error=True)
            self.flush(error=True)