Write dump out to file `cache_file`, defaulting to
        ``self.cache_file``
181556
def dump(self, cache_file=None):
        """"""
        if cache_file is None:
            cache_file = self.cache_file
        if cache_file is not None:
            self.cache_file = cache_file
            with open(cache_file, 'wb') as pickle_fh:
                pickle.dump(
                    (self.remote, self.backend.name, self.max_sleep_interval,
                     self.job_id, self._status, self.epilogue, self.ssh,
                     self.scp),
                    pickle_fh)
1279097
def insert(self, crc, toc):
        
        if self._rw_cache:
            try:
                filename = '%s/%08X.json' % (self._rw_cache, crc)
                cache = open(filename, 'w')
                cache.write(json.dumps(toc, indent=2,
                                       default=self._encoder))
                cache.close()
                logger.info('Saved cache to [%s]', filename)
                self._cache_files += [filename]
            except Exception as exp:
                logger.warning('Could not save cache to file [%s]: %s',
                               filename, str(exp))
        else:
            logger.warning('Could not save cache, no writable directory')
314453
function putCache(key, contents, callback) {
    key = key.replace(/\//g, '-');
    var cacheFile = __dirname + '/' + CACHE_PREFIX + key + '.cache';

    fs.writeFile(cacheFile, contents, function (err) {
        if (err) {
            console.error('Error adding response to cache at ' + cacheFile);
            throw err;
        } else if (callback) {
            callback();
            return;
        }
    });
}
329324
def _prepare_write_fs(read_fs, cache, read_path, readwrite_mode=True):
    '''
    
    '''

    with _get_write_fs() as write_fs:

        # If opening in read/write or append mode, make sure file data is
        # accessible
        if readwrite_mode:

            if not write_fs.isfile(read_path):
                _touch(write_fs, read_path)

                if read_fs.isfile(read_path):
                    fs.utils.copyfile(
                        read_fs, read_path, write_fs, read_path)

        else:
            _touch(write_fs, read_path)

        yield write_fs
1230935
def dump(self, file_name, page_size=10, vtimeout=10, sep='\n'):
        """"""
        fp = open(file_name, 'wb')
        n = 0
        l = self.get_messages(page_size, vtimeout)
        while l:
            for m in l:
                fp.write(m.get_body())
                if sep:
                    fp.write(sep)
                n += 1
            l = self.get_messages(page_size, vtimeout)
        fp.close()
        return n
654747
def CacheFileObject(self, path_spec, file_object):
    
    self._file_object_cache.CacheObject(path_spec.comparable, file_object)
1308650
def save_stack(stack):
    
    global CACHE_
    serialized = pickle.dumps(stack, PPROT)
    CACHE_['stacks']["{0}.{1}".format(stack.module, stack.caller)] = serialized
    write_out()
192707
def write_files(template, destination='./dxf'):
    
    os.makedirs(destination)
    for key, value in template.items():
        with open(os.path.join(destination, key), 'w') as f:
            f.write(replace_whitespace(value, insert=False))
98752
def example_write_file_to_disk_if_changed():
    
    my_file = FileAsObj('/tmp/example_file.txt')
    my_file.rm(my_file.egrep('^#'))
    if my_file.changed:
        my_file.save()
353927
def save_cache(data, filename):
    """"""
    with open(filename, 'wb') as handle:
        pickle.dump(data, handle)
63428
def generate_and_cache(path=user_path):
    '''
    
    '''
    data = tools.generate()
    if not path:
        return data
    try:
        directory = os.path.dirname(path)
        if not os.path.exists(directory):
            os.makedirs(directory)
        with open(path, 'wb') as f:
            pickle.dump((data_version, module_version, data), f)
    except (PermissionError, ValueError) as e:
        warnings.warn('Unable to write cache file "%s": %s' % (path, e))
    return data
458889
def global_cache_write(key, val, appname='default'):
    
    with GlobalShelfContext(appname) as shelf:
        shelf[key] = val
768664
def insert_io( args ):
    
    global CACHE_
    load_cache()
    hash = args['hash']
    record_used('cache', hash)
    packet_num = args['packet_num']
    if hash not in CACHE_['cache']:
        CACHE_['cache'][hash] = {}
    CACHE_['cache'][hash][packet_num] = pickle.dumps(args, PPROT)
    write_out()
224021
function wrapWrite(std, print) {
  process[std].write = function (data) {
    cachedData[std].push(data);

    if (print)
      originalWrites[std].apply(process[std], arguments);
  };
}
321720
def _handle_dump(self, handler, file_object, **kwargs):
    

    return handler.dump(self.__class__, to_dict(self), file_object, **kwargs)
472026
def write_conf(self):
        
        f = open(self.output_filename, 'w')
        print(self.t.render(prefixes=self.prefixes), file=f)
        f.close()
1068360
def writeFrame(self, data):
    """"""

    cachename = CACHE_FILE_NAME + str(self.sessionId) + CACHE_FILE_EXT

    try:
      file = open(cachename, "wb")
    except:
      print "file open error"

    try:
      file.write(data)
    except:
      print "file write error"

    file.close()

    return cachename