Saves TransitSignal.

        Calls :func:`TransitSignal.save`; default filename is
        ``trsig.pkl`` in ``self.folder``.
11978
def save_signal(self,filename=None):
        
        if filename is None:
            filename = os.path.join(self.folder,'trsig.pkl')
        self.trsig.save(filename)
1176912
def saveTM(tm):
  
  # Save the TM to a file for future use
  proto1 = TemporalMemoryProto_capnp.TemporalMemoryProto.new_message()
  tm.write(proto1)
  # Write the proto to a file and read it back into a new proto
  with open('tm.nta', 'wb') as f:
    proto1.write(f)
945424
def _save_state(self, state_file, last_pk):
        """"""
        fp = open(state_file, 'w+')
        try:
            fp.write(str(last_pk))
        finally:
            fp.close()
940478
def save_model(self, steps):
        
        with self.graph.as_default():
            last_checkpoint = self.model_path + '/model-' + str(steps) + '.cptk'
            self.saver.save(self.sess, last_checkpoint)
            tf.train.write_graph(self.graph, self.model_path,
                                 'raw_graph_def.pb', as_text=False)
547815
def save_x509s(self, x509s):
        """"""

        for file_type in TLSFileType:
            if file_type.value in x509s:
                x509 = x509s[file_type.value]
                if file_type is not TLSFileType.CA:
                    # persist this key or cert to disk
                    tlsfile = getattr(self, file_type.value)
                    if tlsfile:
                        tlsfile.save(x509)
574555
def save(self, *args, **kwargs):
        
        slug = "{}:{}".format(self.level.uid, self.code)
        if self.parent:
            self.uid = "{}_{}".format(self.parent.uid, slug)
        else:
            self.uid = slug
        self.slug = uuslug(
            self.name, instance=self, max_length=100, separator="-", start_no=2
        )
        super(Division, self).save(*args, **kwargs)
114847
def save(self, filename, incl_uniqueid=False):
        
        filename = os.path.expanduser(filename)
        f = open(filename, 'w')
        json.dump(self.to_json(incl_uniqueid=incl_uniqueid), f,
                   sort_keys=True, indent=0, separators=(',', ': '))
        f.close()

        return filename
573211
def save(self):
        
        project_paths = OrderedDict()
        for project, d in OrderedDict(self).items():
            if isinstance(d, dict):
                project_path = d['root']
                fname = osp.join(project_path, '.project', '.project.yml')
                if not osp.exists(osp.dirname(fname)):
                    os.makedirs(osp.dirname(fname))
                if osp.exists(fname):
                    os.rename(fname, fname + '~')
                d = self.rel_paths(copy.deepcopy(d))
                safe_dump(d, fname, default_flow_style=False)
                project_paths[project] = project_path
            else:
                project_paths = self.project_paths[project]
        self.project_paths = project_paths
        safe_dump(project_paths, self.all_projects, default_flow_style=False)
1164489
def _save(self):
        

        if self.__modified_flag:
            self.__filename_rep.update_id_counter()
            indexfilename = os.path.join(self.__dir, "index.dat")
            self._write_file(
                indexfilename,
                (self.__index,
                 self.__filename_rep))

            self.__modified_flag = False
902173
def save_cPkl(fpath, data, verbose=None, n=None):
    
    verbose = _rectify_verb_write(verbose)
    if verbose:
        print('[util_io] * save_cPkl(%r, data)' % (util_path.tail(fpath, n=n),))
    with open(fpath, 'wb') as file_:
        # Use protocol 2 to support python2 and 3
        pickle.dump(data, file_, protocol=2)
1054087
def do_save(self, fp=None):
        
        if fp is None:
            fp = sys.stdout
        data = {
            'settings': self.settings,
            'nodes': self.nodes,
            'backward': self.backward
        }
        json.dump(data, fp, ensure_ascii=False)
693567
def save_cert(name, master):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': ''}
    cert = "{0}trusted-master.crt".format(get_certs_path())

    # Checking if execution is needed.
    if os.path.isfile(cert):
        ret['comment'] = 'No execution needed. Cert: {0} already saved.'.format(cert)
        return ret
    if __opts__['test']:
        ret['result'] = None
        ret['comment'] = 'Certificate save for icinga2 master would be executed'
        return ret

    # Executing the command.
    cert_save = __salt__['icinga2.save_cert'](name, master)
    if not cert_save['retcode']:
        ret['comment'] = "Certificate for icinga2 master saved"
        ret['changes']['cert'] = "Executed. Certificate saved: {0}".format(cert)
    return ret
1000909
def save_pubsec_file(self, path: str) -> None:
        
        # version
        version = 1

        # base58 encode keys
        base58_signing_key = Base58Encoder.encode(self.sk)
        base58_public_key = self.pubkey

        # save file
        with open(path, 'w') as fh:
            fh.write(
                """Type: PubSec
Version: {version}
pub: {pubkey}
sec: {signkey}""".format(version=version, pubkey=base58_public_key, signkey=base58_signing_key)
            )
103960
def save(self, model_fname='model.pkl'):
        
        with open(model_fname, 'wb') as fh:
            pickle.dump(self.stmts, fh, protocol=4)
874873
def save_profile_as(self):
        
        # noinspection PyCallByClass,PyTypeChecker
        file_name_dialog = QFileDialog(self)
        file_name_dialog.setAcceptMode(QFileDialog.AcceptSave)
        file_name_dialog.setNameFilter(self.tr('JSON files (*.json *.JSON)'))
        file_name_dialog.setDefaultSuffix('json')
        dir = os.path.join(QgsApplication.qgisSettingsDirPath(),
                           'inasafe', 'minimum_needs')
        file_name_dialog.setDirectory(expanduser(dir))
        if file_name_dialog.exec_():
            file_name = file_name_dialog.selectedFiles()[0]
        else:
            return
        file_name = basename(file_name)
        file_name = file_name.replace('.json', '')
        minimum_needs = {'resources': []}
        self.mark_current_profile_as_saved()
        for index in range(self.resources_list.count()):
            item = self.resources_list.item(index)
            minimum_needs['resources'].append(item.resource_full)
        minimum_needs['provenance'] = self.provenance.text()
        minimum_needs['profile'] = file_name
        self.minimum_needs.update_minimum_needs(minimum_needs)
        self.minimum_needs.save()
        self.minimum_needs.save_profile(file_name)
        if self.profile_combo.findText(file_name) == -1:
            self.profile_combo.addItem(file_name)
        self.profile_combo.setCurrentIndex(
            self.profile_combo.findText(file_name))
1191406
def save(callLog, logFilename):
    
    with open(logFilename, "wb") as outp:
      cPickle.dump(callLog, outp)
1108153
def saveCertPem(self, cert, path):
        '''
        
        '''
        with s_common.genfile(path) as fd:
            fd.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert))