Import stupid yaml files, convert to something useful.
491549
def move_committees(src, dest):
    
    comm, sub_comm = import_committees(src)
    save_committees(comm, dest)
    save_subcommittees(comm, dest)
740878
def to_yamlf(self, fpath: str, encoding: str='utf8', ignore_none: bool=True, ignore_empty: bool=False) -> str:
        
        return util.save_yamlf(traverse(self, ignore_none, force_value=True, ignore_empty=ignore_empty), fpath, encoding)
396999
def from_yaml(cls, path):
        """"""
        import yaml

        with path.open(mode='r') as fp:
            source = yaml.safe_load(fp) or {}
            self = cls.from_jsonld(
                source,
                __reference__=path,
                __source__=deepcopy(source),
            )

        return self
440358
def load_yaml_from_docstring(docstring):
    """"""
    split_lines = trim_docstring(docstring).split("\n")

    # Cut YAML from rest of docstring
    for index, line in enumerate(split_lines):
        line = line.strip()
        if line.startswith("---"):
            cut_from = index
            break
    else:
        return {}

    yaml_string = "\n".join(split_lines[cut_from:])
    yaml_string = dedent(yaml_string)
    return yaml.safe_load(yaml_string) or {}
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)
78162
def yaml_to_str(data: Mapping) -> str:
    
    return yaml.dump(data, Dumper=ruamel.yaml.RoundTripDumper)
371564
def merge_config_files(fnames):
    
    def _load_yaml(fname):
        with open(fname) as in_handle:
            config = yaml.safe_load(in_handle)
        return config
    out = _load_yaml(fnames[0])
    for fname in fnames[1:]:
        cur = _load_yaml(fname)
        for k, v in cur.items():
            if k in out and isinstance(out[k], dict):
                out[k].update(v)
            else:
                out[k] = v
    return out
896854
def read_yaml(self, filename):
        '''
        
        '''
        with open(filename, 'r') as f:
            d = re.sub(r'\{\{ *([^ ]+) *\}\}', r'\1', f.read())
            y = yaml.safe_load(d)
            return y if y else {}
514802
def from_yaml_file(f):
    
    return from_json(to_json(yaml.load(f, Loader=yaml.Loader)))
1343730
def yaml?(file)
      line = open(file) { |f| line = f.gets }
      line.index "!ruby/object:Gem::Specification"
    end
483127
def to_yaml!
      @body = YAML.dump(to_h)
    rescue => err
      raise ParseError.new(err), err
    end
523723
def data
      YAML.load ERB.new(File.read File.expand_path yaml_path).result
    rescue StandardError, SyntaxError => e
      {}
    end
830079
def load_yaml(filename):
    
    try:
        with open(filename, 'rb') as f:
            return yaml.load(f, Loader=Loader)
    except (IOError, yaml.error.YAMLError) as exc:
        raise ConfigReadError(filename, exc)
942894
def create_app_from_yml(path):
    """"""

    try:
        with open(path, "rt", encoding="UTF-8") as f:
            try:
                # Substitute ALL occurrences of '%(here)s' with a path to a
                # directory with '.holocron.yml'. Please note, we also want
                # wrap the result into 'io.StringIO' in order to preserve
                # original filename in 'yaml.safe_load()' errors.
                interpolated = io.StringIO(f.read() % {
                    "here": os.path.abspath(os.path.dirname(path))})
                interpolated.name = f.name

                conf = yaml.safe_load(interpolated)
            except yaml.YAMLError as exc:
                raise RuntimeError(
                    "Cannot parse a configuration file. Context: " + str(exc))

    except FileNotFoundError:
        conf = {"metadata": None, "pipes": {}}

    return core.create_app(conf["metadata"], pipes=conf["pipes"])
216471
def load_yaml(file):
    """"""
    if hasattr(yaml, "full_load"):
        return yaml.full_load(file)
    else:
        return yaml.load(file)
1135807
def _preprocess_yml(path):
    """"""
    with open(path) as f:
        tmp_yaml = f.read()
    return re.sub(r"unicode", "str", tmp_yaml)
948953
def parse_as_yaml(strdict):
    """"""
    interm = ""
    for key, val in strdict.items():
        interm = "%s: %s, %s" % (key, val, interm)
    fin = '{%s}' % interm

    return yaml.load(fin)