Saves the current terminal attributes and makes the tty raw.

        This method returns None immediately.
978883
def start(self):
        

        if os.isatty(self.fd.fileno()) and self.israw():
            self.original_attributes = termios.tcgetattr(self.fd)
            tty.setraw(self.fd)
1241777
def save(self):
        """"""
        if not self._dirty:
            return

        fields = []
        formdata = dict(self._p4dict)
        del formdata['code']
        for key, value in six.iteritems(formdata):
            match = re.search('\d$', key)
            if match:
                value = '\t{}'.format(value)
                key = key[:match.start()]

            value = value.replace('\n', '\n\t')
            fields.append('{}:  {}'.format(key, value))
        form = '\n'.join(fields)
        self._connection.run([self.COMMAND, '-i'], stdin=form, marshal_output=False)
        self._dirty = False
1365134
def save(self, cachedir=None, cfgstr=None, verbose=VERBOSE, quiet=QUIET,
             ignore_keys=None):
        
        fpath = self.get_fpath(cachedir, cfgstr=cfgstr)
        if verbose:
            print('[Cachable] cache save: %r' % (basename(fpath),))

        if hasattr(self, '__getstate__'):
            statedict = self.__getstate__()
        else:
            statedict = self.__dict__

        if ignore_keys is None:
            save_dict = statedict
        else:
            save_dict = {key: val
                         for (key, val) in six.iteritems(statedict)
                         if key not in ignore_keys}

        util_io.save_data(fpath, save_dict)
        return fpath
324899
def get_terminal_converted(self, attr):
        
        value = self.data.get(attr.repr_name)
        return self.converter_registry.convert_to_representation(
                                                            value,
                                                            attr.value_type)
964184
def save(self, obj, label, format='text'):
        

        # initialize hidden state directory

        objloc = '{0}/{1}'.format(self.statedir, label)

        with open(objloc, 'w') as fp:
            if format == 'pickle':
                pickle.dump(obj, fp)
            elif format == 'text':
                fp.write(str(obj))
            else:
                print('Format {0} not recognized. Please choose either pickle or text.'.format(format))

        print('Saving {0} to label {1}'.format(obj, label))
774652
def save(self, fname: str):
        
        with open(fname, "wb") as fp:
            pickle.dump(self, fp)
210746
def ensure_tty(file=sys.stdout):
    
    isatty = getattr(file, 'isatty', None)
    if isatty is None:
        raise TypeError(
            'Cannot detect tty, file has no `isatty` method: {}'.format(
                getattr(file, 'name', type(file).__name__)
            )
        )
    if not isatty():
        raise TypeError(
            'This will not work, file object is not a tty: {}'.format(
                getattr(file, 'name', type(file).__name__)
            )
        )
    return True
1161733
def disable_if_no_tty(cls):
        
        if sys.stdout.isatty() or sys.stderr.isatty():
            return False
        cls.disable_all_colors()
        return True
715042
def save(self, *args, **kwargs):
        
        self.text = clean_text(self.text)
        self.text_formatted = format_text(self.text)
        super(BaseUserContentModel, self).save(*args, **kwargs)
558261
def save_current_as(self):
        
        if not self.current_widget():
            return
        mem = self.current_widget().file.path
        self.current_widget().file._path = None
        self.current_widget().file._old_path = mem
        CodeEditTabWidget.default_directory = os.path.dirname(mem)
        widget = self.current_widget()
        try:
            success = self.main_tab_widget.save_widget(widget)
        except Exception as e:
            QtWidgets.QMessageBox.warning(
                self, _('Failed to save file as'),
                _('Failed to save file as %s\nError=%s') % (
                    widget.file.path, str(e)))
            widget.file._path = mem
        else:
            if not success:
                widget.file._path = mem
            else:
                CodeEditTabWidget.default_directory = os.path.expanduser('~')
                self.document_saved.emit(widget.file.path, '')

                # rename tab
                tw = widget.parent_tab_widget
                tw.setTabText(tw.indexOf(widget),
                              os.path.split(widget.file.path)[1])

        return self.current_widget().file.path
202378
def save(self, obj, data, is_m2m=False):
        
        if not self.readonly:
            attrs = self.attribute.split('__')
            for attr in attrs[:-1]:
                obj = getattr(obj, attr, None)
            cleaned = self.clean(data)
            if cleaned is not None or self.saves_null_values:
                if not is_m2m:
                    setattr(obj, attrs[-1], cleaned)
                else:
                    getattr(obj, attrs[-1]).set(cleaned)
981751
def save(self):
        """"""
        with open(self.file_name, 'w') as fp:
            self.parser.write(fp)
        return self
726960
def save(self):
        """"""
        files = [f.depotFile for f in self._files]
        cmd = ['reopen', '-c', 'default']
        self._connection.run(cmd + files)
        self._dirty = False
623871
def reset_terminal():
    ''' 
    '''
    if os.name == 'nt':
        from .windows import cls
        cls()
    else:
        text = sc.reset
        _write(text)
        return text
1180092
def do_fontsave(self, arg):
        """"""
        #We need to save the full paths to the staging directories for the tests that are loaded
        #so far; then when the session is restored, we can reparse the results.
        from os import path
        import json
        fullpath = path.expanduser(arg)
        data = {
            "fonts": self.curargs["fonts"],
            "ticks": self.curargs["ticks"]
        }
        with open(fullpath, 'w') as f:
            json.dump(data, f)
        msg.okay("Saved current font settings to {}".format(fullpath))
251468
def set_terminal(self, terminal):
        
        if self.terminal is not None:
            raise RuntimeError("TerminalBox: terminal already set")
        self.terminal = terminal
        self.terminal.connect("grab-focus", self.on_terminal_focus)
        self.terminal.connect("button-press-event", self.on_button_press, None)
        self.terminal.connect('child-exited', self.on_terminal_exited)

        self.pack_start(self.terminal, True, True, 0)
        self.terminal.show()
        self.add_scroll_bar()
751397
def save_pkl(self, filename):
        
        with open(filename, 'wb') as fout:
            pickle.dump(self, fout)