Save the in memory answer set to the answer file on disk.

 @raise [PDK::CLI::FatalError] if the answer file can not be written to.
767131
def save_to_disk
      FileUtils.mkdir_p(File.dirname(answer_file_path))

      write_file(answer_file_path, JSON.pretty_generate(answers))
    rescue SystemCallError, IOError => e
      raise PDK::CLI::FatalError, _("Unable to write '%{file}': %{msg}") % {
        file: answer_file_path,
        msg:  e.message,
      }
    end
27889
def Save(self, name_file):
        
        with open(name_file+'.bms', 'wb') as file:
            model = dill.dump(self, file)
430555
def save_fileAs(self):
        

        editor = self.get_current_editor()
        if not editor:
            return False

        file = umbra.ui.common.store_last_browsed_path(QFileDialog.getSaveFileName(self, "Save As:", editor.file))
        if not file:
            return False

        candidate_editor = self.get_editor(file)
        if candidate_editor:
            if not candidate_editor is editor:
                raise foundations.exceptions.UserError("{0} | '{1}' file is already opened!".format(
                    self.__class__.__name__, file))
            else:
                return self.save_file(file)

        LOGGER.info("{0} | Saving '{1}' file!".format(self.__class__.__name__, file))
        self.__lock_editor(editor)
        self.unregister_node_path(editor)
        if editor.save_fileAs(file):
            self.__model.update_authoring_nodes(editor)
            language = self.__languages_model.get_file_language(
                file) or self.__languages_model.get_language(self.__default_language)
            if editor.language.name != language.name:
                self.set_language(editor, language)
            return True
1216514
def save_response_to_file(self, response, filename):
        
        try:
            last_response = self.get_last_response()
            with open(filename, 'w') as f:
                f.write(last_response.content)
        except OSError, e:
            return False
        return True
943035
def add_answer_at_time(self, record, now):
        """"""
        if record is not None:
            if now == 0 or not record.is_expired(now):
                self.answers.append((record, now))
                if record.rrsig is not None:
                    self.answers.append((record.rrsig, now))
799837
def _save(self):
        
        collection = JSONClientValidated('assessment',
                                         collection='AssessmentTaken',
                                         runtime=self._runtime)
        collection.save(self._my_map)
857258
def process_question(self):
        
        # Process question
        self.question, question_files = self.set_images(self.question)

        # Process answers
        answers = []
        answer_files = []
        answer_index = 0
        for answer in self.answers:
            processed_string, afiles = self.set_images(answer['answer'])
            answers.append({"answer": processed_string, "correct": answer['correct'], "order": answer_index})
            answer_index += 1
            answer_files += afiles
        self.answers = answers

        # Process hints
        hints = []
        hint_files = []
        hint_index = 0
        for hint in self.hints:
            processed_string, hfiles = self.set_images(hint)
            hints.append({"hint": processed_string, "order": hint_index})
            hint_index += 1
            hint_files += hfiles
        self.hints = hints

        self.files += question_files + answer_files + hint_files
        return [f.filename for f in self.files]
1011958
def save(path,data)
     
      File.open(path,'w') do |file|
        file.puts data
      end

      if File.exists?(path)
        `pl -input #{path} -output #{path}`
      end

    end
165700
def addAnswers(self, answers, callback=None, errback=None, **kwargs):
        
        if not self.data:
            raise RecordException('record not loaded')
        orig_answers = self.data['answers']
        new_answers = self._rest._getAnswersForBody(answers)
        orig_answers.extend(new_answers)
        return self.update(answers=orig_answers, callback=callback,
                           errback=errback, **kwargs)
1199864
def save(options={:validate => true})
      context = self.new_record? ? :create : :update
      return false if options[:validate] && !valid?(context)
      
      run_callbacks(context) do
        if context == :create
          key = self.class.persistence.insert(self)
        else
          key = self.class.persistence.update(self)
        end
        self.persist!
        key
      end
    end
384699
def save_solution(status)
      status = case status
               when LPSolve::OPTIMAL
                 :optimized
               when LPSolve::INFEASIBLE, LPSolve::UNBOUNDED,
                    LPSolve::DEGENERATE
                 :invalid
               else
                 :unknown
               end

      if status == :optimized
        objective_value = LPSolve.get_objective @ptr
        rows = LPSolve.get_Nrows(@ptr)
        variable_values = [nil]
        @variables.each do |var|
          variable_values << LPSolve.get_var_primalresult(@ptr,
                                                          rows + var.index)
        end
      else
        objective_value = nil
        variable_values = []
      end

      @solution = Solution.new status, objective_value, variable_values
    end
1087051
def save(opts={})
    options = { :validate => true }.merge(opts)
    return false if !(new_record? || changed?)
    if options[:validate]
      return false if !valid?
    end
    begin
      save!(options)
    rescue
      return false
    end
    true
  end
1337219
def save!(_options = {})
      return false if respond_to?(:destroyed?) && destroyed?

      options = { request_namespace => attributes }

      if new_record?
        method = :post
        req_path = api_url(options)
      else
        method = :put
        req_path = api_url(options) + "/#{id}"
      end

      response = @client.make_request!(req_path, method, options)

      handle_response(response)
      self
    end
354432
def save(self, filething=None, v2_version=4, v23_sep='/', padding=None):
        """"""

        fileobj = filething.fileobj
        fileobj.seek(0)

        dsd_header = DSDChunk(fileobj)
        if dsd_header.offset_metdata_chunk == 0:
            # create a new ID3 chunk at the end of the file
            fileobj.seek(0, 2)

            # store reference to ID3 location
            dsd_header.offset_metdata_chunk = fileobj.tell()
            dsd_header.write()

        try:
            data = self._prepare_data(
                fileobj, dsd_header.offset_metdata_chunk, self.size,
                v2_version, v23_sep, padding)
        except ID3Error as e:
            reraise(error, e, sys.exc_info()[2])

        fileobj.seek(dsd_header.offset_metdata_chunk)
        fileobj.write(data)
        fileobj.truncate()

        # Update total file size
        dsd_header.total_size = fileobj.tell()
        dsd_header.write()
1111426
def save(file=nil,format=nil,opts={})
      format = @format if format.nil?
      file = @filename if file.nil?

      if format != FORMAT_BINARY && format != FORMAT_XML && format != FORMAT_PLAIN
        raise CFFormatError.new("Format #{format} not supported, use List::FORMAT_BINARY or List::FORMAT_XML")
      end

      if(!File.exists?(file)) then
        raise IOError.new("File #{file} not writable!") unless File.writable?(File.dirname(file))
      elsif(!File.writable?(file)) then
        raise IOError.new("File #{file} not writable!")
      end

      opts[:root] = @value
      opts[:formatted] = @formatted unless opts.has_key?(:formatted)

      prsr = @@parsers[format-1].new

      content = prsr.to_str(opts)

      File.open(file, 'wb') {
        |fd|
        fd.write content
      }
    end
766530
def create_store_prompt(name):
    
    def _prompt(questions, answers=None, **kwargs):
        stored_answers = _read_stored_answers(name)

        to_store = []
        for q in questions:
            if 'store' in q:
                if q.pop('store'):  # remove it so whaaaaat does not bark
                    to_store.append(q['name'])
                    if q['name'] in stored_answers:
                        q['default'] = stored_answers[q['name']]

        answers = prompt(questions, answers, **kwargs)
        if to_store:
            # save answers for questions flagged with 'store'
            for s in to_store:
                if s in answers:
                    stored_answers[s] = answers[s]
            _store_answers(name, stored_answers)
        return answers
    return _prompt
656662
def save(filename)
      stream.pos = 0
      all = stream.read.force_encoding('ascii-8bit')
      patches.each do |pos, val|
        all[pos, val.size] = val
      end
      IO.binwrite(filename, all)
    end