Serialize and store config data
429067
function instance_config_save($data, $nolongerused = false) {
        global $DB;

        $config = clone($data);
        // Move embedded files into a proper filearea and adjust HTML links to match
        $config->text = file_save_draft_area_files($data->text['itemid'], $this->context->id, 'block_html', 'content', 0, array('subdirs'=>true), $data->text['text']);
        $config->format = $data->text['format'];

        parent::instance_config_save($config, $nolongerused);
    }
430858
def store_config(filepath, hash, options = {})
      content  = "# " + File.basename(filepath) + "\n"
      content += "# /!\\ DO NOT EDIT THIS FILE: it has been automatically generated\n"
      if options[:header]
        options[:header].split("\n").each { |line| content += "# #{line}" }
      end
      content += hash.to_yaml
      show_diff_and_write(content, filepath, options)
      # File.open( filepath, 'w') do |f|
      #     f.print "# ", File.basename(filepath), "\n"
      #     f.puts "# /!\\ DO NOT EDIT THIS FILE: it has been automatically generated"
      #     if options[:header]
      #         options[:header].split("\n").each do |line|
      #             f.puts "# #{line}"
      #         end
      #     end
      #     f.puts hash.to_yaml
      # end
    end
284115
def save_config(template, params)
      config_file = File.join(config_dir, "#{template}.yml")
      config = File.read(config_file)

      params.map { |key, value| config = config.gsub(key, value) }

      File.open(config_file, 'w') { |file| file.write(config) }
    end
276177
def save_config(self, cmd="write memory", confirm=False, confirm_response=""):
        """"""
        return super(UbiquitiEdgeSSH, self).save_config(
            cmd=cmd, confirm=confirm, confirm_response=confirm_response
        )
106680
def save(self):
        
        with open(self._user_config_file, 'w', encoding='utf-8') as f:
            self.write(f)
937656
def serialize(self):
        
        return {
            "uuid": self.uuid, "type": self.type, "instance_id": self.instance_id,
            "prepared": self.prepared, "creation_time": self.creation_time,
            "data": self.data
        }
565612
def serialize(obj, **options):
    '''
    
    '''

    try:
        if not isinstance(obj, dict):
            raise TypeError("configparser can only serialize dictionaries, not {0}".format(type(obj)))
        fp = options.pop('fp', None)
        if six.PY3:
            cp = configparser.ConfigParser(**options)
        else:
            cp = configparser.SafeConfigParser(**options)
        _read_dict(cp, obj)

        if fp:
            return cp.write(fp)
        else:
            s = six.moves.StringIO()
            cp.write(s)
            return s.getvalue()
    except Exception as error:
        raise SerializationError(error)
1022109
def save_config(**kwargs):
    
    if kwargs == {}:
        kwargs = config._config
    current_config = _load_config()
    current_config.update(**kwargs)
    # write to disk
    fname = _get_config_fname()
    if fname is None:
        raise RuntimeError('config filename could not be determined')
    if not op.isdir(op.dirname(fname)):
        os.mkdir(op.dirname(fname))
    with open(fname, 'w') as fid:
        json.dump(current_config, fid, sort_keys=True, indent=0)
1212045
protected function serialize() {
    if (!$this->isModified() && ($cacheFile = $this->getSerializeFilename($this->addedFiles))) {
      if (self::$logger->isDebugEnabled()) {
        self::$logger->debug("Serialize configuration: ".join(',', $this->addedFiles)." to file: ".$cacheFile);
      }
      $this->fileUtil->mkdirRec(dirname($cacheFile));
      if ($fh = @fopen($cacheFile, "w")) {
        if (@fwrite($fh, serialize(array_filter(get_object_vars($this), function($value, $name) {
          return $name != 'comments'; // don't store comments
        }, ARRAY_FILTER_USE_BOTH)))) {
          @fclose($fh);
        }
      }
    }
  }
705953
def save_config(config):
    

    configfile = get_configfile()

    if not os.path.exists(configfile):
        configdir = os.path.dirname(configfile)

        if not os.path.exists(configdir):
            os.makedirs(configdir)

    data = config

    with open(configfile, 'wb') as f:
        json.dump(data, f, indent=2)
220436
def save(dir = Dir.pwd, config = {}, type = :local, options = {})
      conffile = config_file(dir, type, options)
      confdir  = File.dirname( conffile )
      unless File.directory?( confdir )
        warning "about to create the configuration directory #{confdir}"
        really_continue?  unless options[:no_interaction]
        run %( mkdir -p #{confdir} )
      end
      store_config(conffile, config, options)
    end
1362200
def serialize(self):
        """"""

        keys = self._all_keys()
        serdata = {}
        for fieldname, value in self._data.items():
            serdata[fieldname] = getattr(type(self), fieldname).python_to_cache(value)
        return json.dumps(serdata)
795951
def dump_to_store(dataset, store, writer=None, encoder=None,
                  encoding=None, unlimited_dims=None):
    """"""
    if writer is None:
        writer = ArrayWriter()

    if encoding is None:
        encoding = {}

    variables, attrs = conventions.encode_dataset_coordinates(dataset)

    check_encoding = set()
    for k, enc in encoding.items():
        # no need to shallow copy the variable again; that already happened
        # in encode_dataset_coordinates
        variables[k].encoding = enc
        check_encoding.add(k)

    if encoder:
        variables, attrs = encoder(variables, attrs)

    store.store(variables, attrs, check_encoding, writer,
                unlimited_dims=unlimited_dims)
1356021
def _serialize_data(self, data):
        

        data.update(data['include'])
        data.update(data['to_many'])
        data.update(data['to_one'])

        for key, val in data.items():
            if isinstance(val, dict):
                pass
            elif isinstance(val, list):
                pass
            else:
                str(val)
288632
def save_config(self, data: dict) -> Path:
        """"""
        out_dir = Path(self.families_dir) / data['family']
        out_dir.mkdir(parents=True, exist_ok=True)
        out_path = out_dir / 'pedigree.yaml'
        dump = ruamel.yaml.round_trip_dump(data, indent=4, block_seq_indent=2)
        out_path.write_text(dump)
        return out_path
1005543
def save_config(_config, _log, config_filename='config.json'):
    
    if 'config_filename' in _config:
        del _config['config_filename']
    _log.info('Saving config to "{}"'.format(config_filename))
    save_config_file(flatten(_config), config_filename)
464291
def dumps(self, with_defaults=False):
        
        return self._rw.dump_config_to_string(self._config, with_defaults=with_defaults)