saves configuration into a _yaml_ file named +filename+
975514
def dump(filename)
      File.open(filename,'w') do |f|
        YAML.dump(self.to_hash,f)
      end
    end
659093
def load_extended_config_yaml
      Dir.glob("#{ENV['HOME']}/.ftl/templates/*.yml").each do |file|
        yaml = YAML.load_file(file)
        name = File.basename(file).gsub(".yml", '')
        @options[:templates][name.to_sym]=@options[:templates][:defaults]
        @options[:templates][name.to_sym].merge!(yaml)
      end
    end
495934
def load_config(file)
      unless File.exist?(file)
        raise FalkorLib::Error, "Unable to find the YAML file '#{file}'"
      end
      loaded = YAML.load_file(file)
      unless loaded.is_a?(Hash)
        raise FalkorLib::Error, "Corrupted or invalid YAML file '#{file}'"
      end
      loaded
    end
1191378
def generate_yaml_file(filename, contents):
    """"""
    with open(filename, 'w') as file:
        file.write(yaml.dump(contents, default_flow_style=False))
138027
def merge_config(yaml, params)
      if params['post'].has_key? 'yaml'
        params['post']['yaml'].each do |key, value|
          if value == 'true'
            yaml[key] = true
          elsif value == 'false'
            yaml[key] = false
          else
            yaml[key] = value
          end
        end
      end

      yaml
    end
114581
def save_yamlf(data: Union[list, dict], fpath: str, encoding: str) -> str:
    
    with codecs.open(fpath, mode='w', encoding=encoding) as f:
        f.write(dump_yaml(data))
        return fpath
960980
def save_yaml(self, outFile):
        """"""
        with open(outFile,'w') as myfile:
            print(yaml.dump(self.params), file=myfile)
84562
def parse_yaml_config(yaml_config, repo_home):
    """"""
    config = collections.defaultdict(list)

    variables = {
        'DEFAULT_CONFIGS': os.path.join(os.path.dirname(__file__), 'configs'),
        'REPO_HOME': repo_home,
    }

    for name, data in yaml_config.items():
        command = _replace_variables([data['command']], variables)[0]
        requirements = _replace_variables(
            data.get('requirements', []), variables)
        arguments = _replace_variables(data.get('arguments', []), variables)

        not_found_programs = utils.programs_not_in_path([command] +
                                                        requirements)
        if not_found_programs:
            linter_command = Partial(missing_requirements_command,
                                     not_found_programs, data['installation'])
        else:
            linter_command = Partial(lint_command, name, command, arguments,
                                     data['filter'])
        for extension in data['extensions']:
            config[extension].append(linter_command)

    return config
881111
def parse_yaml(self, y):
        '''

        '''
        self.id = y['id']
        self._config_data = []
        if 'configurationData' in y:
            for d in y.get('configurationData'):
                self._config_data.append(ConfigurationData().parse_yaml(d))
        return self
1201031
def save_config
      botpart_config = Hash[@config.to_a - $bot[:config].to_a]

      unless botpart_config.empty?
        File.open @botpart_config_path, 'w' do |f|
          f.write botpart_config.to_yaml
        end
      end
    end
1029287
def save_all(yaml_dicts, filepath):
    '''
    
    '''
    yamldict.dump_all(yaml_dicts, open(filepath, 'w'),
                      default_flow_style=False)
563787
def save_conf(fn=None):
    
    if fn is None:
        fn = cfile()
    try:
        os.makedirs(os.path.dirname(fn))
    except (OSError, IOError):
        pass
    with open(fn, 'w') as f:
        yaml.dump(conf, f)
865745
def load_config(filename):
    """"""
    logger.debug("Event Definitions configuration file: %s", filename)

    with open(filename, 'r') as cf:
        config = cf.read()

    try:
        events_config = yaml.safe_load(config)
    except yaml.YAMLError as err:
        if hasattr(err, 'problem_mark'):
            mark = err.problem_mark
            errmsg = ("Invalid YAML syntax in Event Definitions file "
                      "%(file)s at line: %(line)s, column: %(column)s."
                      % dict(file=filename,
                             line=mark.line + 1,
                             column=mark.column + 1))
        else:
            errmsg = ("YAML error reading Event Definitions file "
                      "%(file)s"
                      % dict(file=filename))
        logger.error(errmsg)
        raise

    logger.info("Event Definitions: %s", events_config)
    return events_config
123695
def save_config(path, config):
    """"""
    import json
    config['version'] = 1
    with open(path, 'w') as f:
        json.dump(config, f)
486221
def cfg_from_file(self, yaml_filename, config_dict):
        """"""
        import yaml
        from easydict import EasyDict as edict
        with open(yaml_filename, 'r') as f:
            yaml_cfg = edict(yaml.load(f))

        return self._merge_a_into_b(yaml_cfg, config_dict)
663946
def write_config(path, config):
    
    config_as_string = to_nice_yaml(config)

    config_as_string = "---\n" + config_as_string

    string_to_file(path, config_as_string)
481082
def get_config(config_file):
    """"""
    config_path = os.path.abspath(config_file)

    try:
        with open(config_path, 'r') as data:
            config = yaml.safe_load(data)
    except IOError as exc:
        sys.exit(str(exc))

    return config