Build a list of components from a yaml file
189743
def build_from_yamlfile(yamlfile):
        
        d = yaml.load(open(yamlfile))
        return MktimeFilterDict(d['aliases'], d['selections'])
395568
def load_all_yamls(cls, directories):
        
        yaml_files = []
        loaded_yamls = {}

        for d in directories:
            if d.startswith('/home') and not os.path.exists(d):
                os.makedirs(d)
            for dirname, subdirs, files in os.walk(d):
                yaml_files.extend(map(lambda x: os.path.join(dirname, x),
                                      filter(lambda x: x.endswith('.yaml'), files)))

        for f in yaml_files:
            loaded_yamls[f] = cls.load_yaml_by_path(f)

        return loaded_yamls
818409
def build_values(name, values_mods):
    """"""
    values_file = os.path.join(name, 'values.yaml')

    with open(values_file) as f:
        values = yaml.load(f)

    for key, value in values_mods.items():
        parts = key.split('.')
        mod_obj = values
        for p in parts:
            mod_obj = mod_obj[p]
        print(f"Updating {values_file}: {key}: {value}")

        if isinstance(mod_obj, MutableMapping):
            keys = IMAGE_REPOSITORY_KEYS & mod_obj.keys()
            if keys:
                for key in keys:
                    mod_obj[key] = value['repository']
            else:
                possible_keys = ' or '.join(IMAGE_REPOSITORY_KEYS)
                raise KeyError(
                    f'Could not find {possible_keys} in {values_file}:{key}'
                )

            mod_obj['tag'] = value['tag']
        else:
            raise TypeError(
                f'The key {key} in {values_file} must be a mapping.'
            )


    with open(values_file, 'w') as f:
        yaml.dump(values, f)
1292530
def _load_yml_config(self, config_file):
        
        if not isinstance(config_file, six.string_types):
            raise TypeError('config_file must be a str.')

        try:
            def construct_yaml_int(self, node):
                obj  = SafeConstructor.construct_yaml_int(self, node)
                data = ConfigInt(
                    obj,
                    node.start_mark,
                    node.end_mark
                )

                return data

            def construct_yaml_float(self, node):
                obj, = SafeConstructor.construct_yaml_float(self, node)
                data = ConfigFloat(
                    obj,
                    node.start_mark,
                    node.end_mark
                )

                return data

            def construct_yaml_str(self, node):
                # Override the default string handling function
                # to always return unicode objects
                obj = SafeConstructor.construct_scalar(self, node)

                assert isinstance(obj, six.string_types)
                data = ConfigUnicode(
                    obj,
                    node.start_mark,
                    node.end_mark
                )

                return data

            def construct_yaml_mapping(self, node):
                obj, = SafeConstructor.construct_yaml_map(self, node)
                data = ConfigDict(
                    obj,
                    node.start_mark,
                    node.end_mark
                )

                return data

            def construct_yaml_seq(self, node):
                obj, = SafeConstructor.construct_yaml_seq(self, node)
                data = ConfigSeq(
                    obj,
                    node.start_mark,
                    node.end_mark
                )

                return data

            # SafeConstructor.add_constructor(u'tag:yaml.org,2002:bool',  construct_yaml_bool)
            SafeConstructor.add_constructor(u'tag:yaml.org,2002:float', construct_yaml_float)
            SafeConstructor.add_constructor(u'tag:yaml.org,2002:int', construct_yaml_int)
            SafeConstructor.add_constructor(u'tag:yaml.org,2002:map', construct_yaml_mapping)
            SafeConstructor.add_constructor(u'tag:yaml.org,2002:seq', construct_yaml_seq)
            SafeConstructor.add_constructor(u'tag:yaml.org,2002:str', construct_yaml_str)

            data = SafeLoader(config_file).get_data()
            if data is None:
                raise AttributeError('The configuration file needs to have data in it.')

            self._data = normalize_keys(data, snake_case=False)
        except YAMLError as e:
            if hasattr(e, 'problem_mark'):
                mark = e.problem_mark
                raise SyntaxError(
                    "There is a syntax error in your freight-forwarder config file line: {0} column: {1}".format(
                        mark.line + 1,
                        mark.column + 1
                    )
                )
            else:
                raise SyntaxError("There is a syntax error in your freight-forwarder config.")
104883
def parse_yaml_config(args):
    """"""
    try:
        import yaml
    except ImportError:
        yaml = None

    yml = {}
    try:
        with open(args.coveralls_yaml, 'r') as fp:
            if not yaml:
                raise SystemExit('PyYAML is required for parsing configuration')
            yml = yaml.load(fp)
    except IOError:
        pass
    yml = yml or {}
    return yml
505638
def open_spec(f):
    
    import ruamel.yaml as yaml

    keys = ['modules', 'pths', 'test_import', 'install_hints', 'extra_paths']
    data = yaml.safe_load(f)
    parsed = dict()
    ## pattern = re.compile("^\s+|\s*,\s*|\s+$")
    for k in keys:
        v = data.get(k, [])
        # Items are always lists
        if isinstance(v, basestring):
            parsed[k] = [m for m in re.split(r",| ", v)]
            # parsed[k] = re.split(pattern, v)
        else:
            parsed[k] = v

    return parsed
74139
def build_list(self):
        """"""
        ret = []
        for p in self.args.stdout.split(','):
            if '.' in p:
                p, a = p.split('.')
            else:
                a = None
            ret.append((p, a))
        return ret
844088
def read_object_from_yaml(desired_type: Type[Any], file_object: TextIOBase, logger: Logger,
                          fix_imports: bool = True, errors: str = 'strict', *args, **kwargs) -> Any:
    
    return yaml.load(file_object)
368950
def check_yamls(cls, dap):
        ''''''
        problems = list()

        for yaml in dap.assistants_and_snippets:
            path = yaml + '.yaml'
            parsed_yaml = YamlLoader.load_yaml_by_path(dap._get_file(path, prepend=True))
            if parsed_yaml:
                try:
                    yaml_checker.check(path, parsed_yaml)
                except YamlError as e:
                    problems.append(DapProblem(exc_as_decoded_string(e), level=logging.ERROR))
            else:
                problems.append(DapProblem('Empty YAML ' + path, level=logging.WARNING))

        return problems
718814
def parse_yaml(self, node):
        '''

        '''
        self.group_id = y['groupId']
        self._members = []
        if 'members' in y:
            for m in y.get('members'):
                self._members.append(TargetComponent().parse_yaml(m))
        return self
834081
function loadYaml (filename) {
    const file = findFile(`${filename}.yml`)
    return file ? YAML.parse(fs.readFileSync(file, 'utf8')) : {}
  }
1352714
def get_yaml_files_at_env_root(self):
        """"""
        yaml_files = glob.glob(
            os.path.join(self.env_root, '*.yaml')
        )
        yml_files = glob.glob(
            os.path.join(self.env_root, '*.yml')
        )
        return yaml_files + yml_files
1086081
def __init_yaml():
    """"""
    global _yaml_initialized
    if not _yaml_initialized:
        _yaml_initialized = True
        yaml.add_constructor(u'tag:yaml.org,2002:Frame', _frame_constructor)
        yaml.add_constructor(u'tag:yaml.org,2002:Signal', _signal_constructor)
        yaml.add_representer(canmatrix.Frame, _frame_representer)
1102399
def parse_yaml(self, y):
        ''''''
        self.sequence = int(y['sequence'])
        self.target_component = \
                TargetExecutionContext().parse_yaml(y['targetComponent'])
        if RTS_EXT_NS_YAML + 'properties' in y:
            for p in y.get(RTS_EXT_NS_YAML + 'properties'):
                if 'value' in p:
                    value = p['value']
                else:
                    value = None
                self._properties[p['name']] = value
        return self
94539
def to_yaml
      YAML.dump(to_h)
    rescue => err
      raise ParseError.new(err), err
    end
1116842
public static void dumpYaml(Map conf, String file) {
        Yaml yaml = new Yaml();
        try {
            Writer writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
            yaml.dump(conf, writer);
        } catch (Exception ex) {
            LOG.error("Error:", ex);
        }
    }
514802
def from_yaml_file(f):
    
    return from_json(to_json(yaml.load(f, Loader=yaml.Loader)))