Saves files for the minimization.

        Notes
        -----
        Currently saves a logfile with best individual and a pdb of
        the best model.
198842
def log_results(self, output_path=None, run_id=None):
        
        best_ind = self.halloffame[0]
        model_params = self.parse_individual(
            best_ind)  # need to change name of 'params'
        if output_path is None:
            output_path = os.getcwd()
        if run_id is None:
            run_id = '{:%Y%m%d-%H%M%S}'.format(
                datetime.datetime.now())
        with open('{0}/{1}_opt_log.txt'.format(
                output_path, run_id), 'w') as log_file:
            log_file.write('\nEvaluated {0} models in total\n'.format(
                self._model_count))
            log_file.write('Run ID is {0}\n'.format(run_id))
            log_file.write('Best fitness is {0}\n'.format(
                self.halloffame[0].fitness))
            log_file.write(
                'Parameters of best model are {0}\n'.format(model_params))
            log_file.write(
                'Best individual is {0}\n'.format(self.halloffame[0]))
            for i, entry in enumerate(self.halloffame[0]):
                if entry > 0.95:
                    log_file.write(
                        "Warning! Parameter {0} is at or near maximum allowed "
                        "value\n".format(i + 1))
                elif entry < -0.95:
                    log_file.write(
                        "Warning! Parameter {0} is at or near minimum allowed "
                        "value\n".format(i + 1))
            log_file.write('Minimization history: \n{0}'.format(self.logbook))
        with open('{0}/{1}_opt_best_model.pdb'.format(
                output_path, run_id), 'w') as output_file:
            output_file.write(self.best_model.pdb)
        return
1282477
def save(self, fp, mode='wb'):
        
        if hasattr(fp, 'write'):
            self._record.write(fp)
        else:
            with open(fp, mode) as f:
                self._record.write(f)
1239030
def save(self, notes=None):
        ''''''
        # Capture the notes if given
        if notes:
            self._changes['notes'] = notes

        # Call the base-class save function
        super(Issue, self).save()
262989
def save(options = {})
      _run_save_callbacks do 
        raise GitModel::NullId unless self.id

        if new_record?
          raise GitModel::RecordExists if self.class.exists?(self.id)
        else
          raise GitModel::RecordDoesntExist unless self.class.exists?(self.id)
        end

        GitModel.logger.debug "Saving #{self.class.name} with id: #{id}"

        dir = File.join(self.class.db_subdir, self.id)

        transaction = options.delete(:transaction) || GitModel::Transaction.new(options) 
        result = transaction.execute do |t|
          # Write the attributes to the attributes file
          t.index.add(File.join(dir, 'attributes.json'), Yajl::Encoder.encode(attributes, nil, :pretty => true))

          # Write the blob files
          blobs.each do |name, data|
            t.index.add(File.join(dir, name), data)
          end
        end

        if result
          @path = dir
          @branch = transaction.branch
          @new_record = false
        end

        result
      end
    end
141121
def saveBestScore(self):
        
        if self.score > self.best_score:
            self.best_score = self.score
        try:
            with open(self.scores_file, 'w') as f:
                f.write(str(self.best_score))
        except:
            return False
        return True
1263923
public boolean save() 
    {
        boolean    blnRet    = false;
        File       objFile   = null;
        String     strName   = null;
        String     strTemp   = null;
        Iterator<String>   itrSec    = null;
        INISection objSec    = null;
        FileWriter objWriter = null;

        try
        {
            if (this.mhmapSections.size() == 0) return false;
            objFile = new CSFile(this.mstrFile);
            if (objFile.exists()) objFile.delete();
            objWriter = new FileWriter(objFile);
            itrSec = this.mhmapSections.keySet().iterator();
            while (itrSec.hasNext())
            {
                strName = (String) itrSec.next();
                objSec = (INISection) this.mhmapSections.get(strName);
                strTemp = objSec.toString();
                objWriter.write(strTemp);
                objWriter.write("\r\n");
                objSec = null;
            }
            blnRet = true;
        }
        catch (IOException IOExIgnore)
        {
        }
        finally
        {
            if (objWriter != null)
            {
                closeWriter(objWriter);
                objWriter = null;
            }
            if (objFile != null) objFile = null;
            if (itrSec != null) itrSec = null;
        }
        return blnRet;
    }
614852
def save(self, *args, **kwargs):
        
        ignore_default_check = kwargs.pop('ignore_default_check', False)
        # if making this status the default one
        if self.is_default != self._current_is_default and self.is_default is True:
            # uncheck other default statuses first
            for status in self.__class__.objects.filter(is_default=True):
                status.is_default = False
                status.save(ignore_default_check=True)

        super(Status, self).save(*args, **kwargs)

        # in case there are no default statuses, make this one as the default one
        if self.__class__.objects.filter(is_default=True).count() == 0 and not ignore_default_check:
            self.is_default = True
            self.save()
        # update __current_status
        self._current_is_default = self.is_default
1058382
def save(self):
        
        with open(self._filename, "w") as f:
            self.config.write(f)
444780
def save(self, *args, **kwargs):
        
        if not self.pk and not self.slug:
            self.slug = self.generate_slug()

        if self.__original_file and self.file != self.__original_file:
            self.delete_real_file(self.__original_file)

        file_changed = True
        if self.pk:
            new_value = getattr(self, 'file')
            if hasattr(new_value, "file"):
                file_changed = isinstance(new_value.file, UploadedFile)
        else:
            self.cbversion = 0

        if file_changed:
            self.user_filename = os.path.basename(self.file.name)
            self.cbversion = self.cbversion + 1

        if not self.title:
            self.title = self.user_filename

        super(AssetBase, self).save(*args, **kwargs)

        if file_changed:
            signals.file_saved.send(self.file.name)
            utils.update_cache_bust_version(self.file.url, self.cbversion)
            self.reset_crops()

        if self.__original_file and self.file.name != self.__original_file.name:
            with manager.SwitchSchemaManager(None):
                for related in self.__class__._meta.get_all_related_objects(
                        include_hidden=True):
                    field = related.field
                    if getattr(field, 'denormalize', None):
                        cname = field.get_denormalized_field_name(field.name)
                        if getattr(field, 'denormalize'):
                            related.model.objects.filter(**{
                                field.name: self.pk
                            }).update(**{
                                cname: self.file.name
                            })
220682
public function save()
    {
        if (file_exists($this->getPath())) {
            $this->setContent($this->encode());
            
            file_put_contents($this->getPath(), $this->getContent());
            
            return;
        }
    }
448125
def saveLogs(self, filename) :
		""""""
		f = open(filename, 'wb')
		cPickle.dump(self.logs, f)
		f.close()
307447
private function _saveRecords()
    {
        $offset = 50;
        if (is_array($this->records) && (count($this->records) > 0)) {
            foreach ($this->records as $index => $record) {
                //Save the record to the .shp file
                $record->saveToFile($this->SHPFile, $this->DBFFile, $index + 1);

                //Save the record to the .shx file
                fwrite($this->SHXFile, pack('N', $offset));
                fwrite($this->SHXFile, pack('N', $record->getContentLength()));
                $offset += (4 + $record->getContentLength());
            }
        }
    }
1059033
def save(self, banks_manager):
        
        self.banks_files.delete_all_banks()
        self.banks_files.save(banks_manager)
        self.index_file.save(banks_manager)
1295271
def save_log(self, log_form, *args, **kwargs):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.BinAdminSession.update_bin
        if log_form.is_for_update():
            return self.update_log(log_form, *args, **kwargs)
        else:
            return self.create_log(log_form, *args, **kwargs)
648898
def save(self, mode=0o600):
        
        if self._parent is not None:
            self._parent.save(mode=mode)
        else:
            config_dir = os.path.dirname(os.path.abspath(self.config_files[-1]))
            try:
                os.makedirs(config_dir)
            except OSError as e:
                if not (e.errno == errno.EEXIST and os.path.isdir(config_dir)):
                    raise
            with open(self.config_files[-1], "wb" if sys.version_info < (3, 0) else "w") as fh:
                self._dump(fh)
            os.chmod(self.config_files[-1], mode)
            self._logger.debug("Saved config to %s", self.config_files[-1])
986342
def save_settings(self, filename):
        '''
        '''

        data = dict()
        data['valueRanges'] = self._value_ranges
        data['best_values'] = [str(value) for value in self._best_values]
        data['minimize'] = self._minimize
        data['num_employers'] = self._num_employers
        data['best_score'] = str(self._best_score)
        data['limit'] = self._limit
        data['best_error'] = self._best_error
        with open(filename, 'w') as outfile:
            json.dump(data, outfile, indent=4, sort_keys=True)
938553
def _save_payload(self, files, directories, links):
        '''
        
        '''

        idx = 0
        for p_type, p_list in (('f', files), ('d', directories), ('l', links,),):
            for p_obj in p_list:
                stats = os.stat(p_obj)

                payload = PayloadFile()
                payload.id = idx
                payload.path = p_obj
                payload.p_type = p_type
                payload.mode = stats.st_mode
                payload.uid = stats.st_uid
                payload.gid = stats.st_gid
                payload.p_size = stats.st_size
                payload.atime = stats.st_atime
                payload.mtime = stats.st_mtime
                payload.ctime = stats.st_ctime

                idx += 1
                self.db.store(payload)