Save a SharedFile to your Shake.

        Args:
            sharekey (str): Sharekey for the file to save.

        Returns:
            SharedFile saved to your shake.
342142
def save_shared_file(self, sharekey=None):
        
        endpoint = '/api/sharedfile/{sharekey}/save'.format(sharekey=sharekey)
        data = self._make_request("POST", endpoint=endpoint, data=None)

        try:
            sf = SharedFile.NewFromJSON(data)
            sf.saved = True
            return sf
        except:
            raise Exception("{0}".format(data['error']))
1016123
def save(self, file_tag='2016', add_header='N'):
        
        fname = self.get_filename(file_tag)
        with open(fname, 'a') as f:
            if add_header == 'Y':
                f.write(self.format_hdr())
                
            for e in self.table: 
                    f.write(e.format_csv())
1009294
def save(self):
        
        d = self._to_dict()
        if len(d.get('videoIds', [])) > 0:
            if not self.id:
                self.id = self.connection.post('create_playlist', playlist=d)
            else:
                data = self.connection.post('update_playlist', playlist=d)
                if data:
                    self._load(data)
621627
def add_record(self, common_name, serial=0, parent_ca='',
                   signees=None, files=None, record=None,
                   is_ca=False, overwrite=False):
        

        if not overwrite:
            try:
                self.get_record(common_name)
                raise CertExistsError(
                    "Certificate {name} already exists!"
                    " Set overwrite=True to force add."
                    .format(name=common_name))
            except CertNotFoundError:
                pass

        record = record or {
            'serial': serial,
            'is_ca': is_ca,
            'parent_ca': parent_ca,
            'signees': signees,
            'files': files,
        }
        self.store[common_name] = record
        self.save()
651406
def save(self, filename="temp.pkl"):
    
    output = open(filename, 'wb')
    cPickle.dump(self.tm, output, protocol=cPickle.HIGHEST_PROTOCOL)
919299
def save(self, items):
        '''
        
        '''
        rows = []
        indx = self.indx

        size = 0
        tick = s_common.now()

        for item in items:

            byts = s_msgpack.en(item)

            size += len(byts)

            lkey = s_common.int64en(indx)
            indx += 1

            rows.append((lkey, byts))

        self.slab.putmulti(rows, append=True, db=self.db)
        took = s_common.now() - tick

        origindx = self.indx
        self.indx = indx
        return {'indx': indx, 'size': size, 'count': len(items), 'time': tick, 'took': took}

        return origindx
907039
public function loadResourceLinkShareKey($sharekey) {
        global $DB;

        // Clear expired share keys.
        $now = time();
        $where = "expires <= :expires";

        $DB->delete_records_select($this->sharekeytable, $where, ['expires' => $now]);

        // Load share key.
        $fields = 'resourcelinkid, autoapprove, expires';
        if ($sharekeyrecord = $DB->get_record($this->sharekeytable, ['sharekey' => $sharekey->getId()], $fields)) {
            if ($sharekeyrecord->resourcelinkid == $sharekey->resourceLinkId) {
                $sharekey->autoApprove = $sharekeyrecord->autoapprove == 1;
                $sharekey->expires = $sharekeyrecord->expires;
                return true;
            }
        }

        return false;
    }
1277840
def savetofile(self, filelike, sortkey = True):
        
        filelike.writelines(k + '=' + repr(v) + '\n' for k,v in self.config_items(sortkey))
433802
def save(self, filename):
        
        gz = filename.endswith('.gz')
        ligolw_utils.write_filename(self.outdoc, filename, gz=gz)
402505
def save(self, filename):
        

        if filename is None:
            filename = self.filename('.b26s')
        # if len(filename.split('\\\\?\\')) == 1:
        #     filename = '\\\\?\\' + filename
        with open(filename, 'w') as outfile:
            outfile.write(pickle.dumps(self.__dict__))
1011025
def save(self):
        
        config = self.profiledir + '/config'
        if not isdir(self.profiledir):
            makedirs(self.profiledir)

        cp = SafeConfigParser()

        cp.add_section('ssh')
        cp.set('ssh', 'private_key', self.ssh_private_key)
        cp.set('ssh', 'public_key', self.ssh_public_key)

        with open(config, 'w') as cfile:
            cp.write(cfile)
1281943
def copy_file_to_master(
        file_path,
        remote_path='.',
        username=None,
        key_path=None
):
    

    return copy_file(shakedown.master_ip(), file_path, remote_path, username, key_path)
339399
def save(self, file=CONFIG_FILE):
        
        os.makedirs(os.path.dirname(file), exist_ok=True)
        with open(file, "w") as f:
            yaml.dump(self._settings, f, Dumper=yaml.RoundTripDumper, width=float("inf"))
1034799
def put_file(self, key, file):
        
        try:
            return self._dstore.put_file(key, file)
        finally:
            self.cache.delete(key)
41441
def NewFromJSON(data):
        
        return SharedFile(
            sharekey=data.get('sharekey', None),
            name=data.get('name', None),
            user=User.NewFromJSON(data.get('user', None)),
            title=data.get('title', None),
            description=data.get('description', None),
            posted_at=data.get('posted_at', None),
            permalink=data.get('permalink', None),
            width=data.get('width', None),
            height=data.get('height', None),
            views=data.get('views', 0),
            likes=data.get('likes', 0),
            saves=data.get('saves', 0),
            comments=data.get('comments', None),
            nsfw=data.get('nsfw', False),
            image_url=data.get('image_url', None),
            source_url=data.get('source_url', None),
            saved=data.get('saved', False),
            liked=data.get('liked', False),
        )
108264
def _save_file(self, filename, contents):
        """"""
        with open(filename, 'w') as f:
            f.write(contents)
832713
def save_file(self, filename, content):
        
        with open(filename, 'wb') as f:
            for chunk in content.iter_content(chunk_size=1024):
                if chunk:
                    f.write(chunk)