Load and process the YAML file
330044
def load(self, ymlfile=None):
        """"""
        if ymlfile is not None:
            self.ymlfile = ymlfile

        try:
            # If yaml should be 'cleaned' of document references
            if self._clean:
                self.data = self.process(self.ymlfile)
            else:
                with open(self.ymlfile, 'rb') as stream:
                    for data in yaml.load_all(stream):
                        self.data.append(data)

            self.loaded = True
        except ScannerError, e:
            msg = "YAML formattting error - '" + self.ymlfile + ": '" + str(e) + "'"
            raise util.YAMLError(msg)
1253771
def load(self):
        """"""
        try:
            with open(self.config_file) as configfile:
                self.config = yaml.load(configfile)
        except TypeError:
            # no config file (use environment variables)
            pass
        if self.config:
            self.prefix = self.config.get('config_prefix', None)
        if not self.prefix:
            if os.getenv(self.config_prefix):
                self.prefix = os.getenv(self.config_prefix)
            else:
                for path in [
                    os.path.join(self.basepath, self.default_file),
                    os.path.join(self.config_root, self.default_file)
                ]:
                    if os.path.exists(path):
                        with open(path) as conf:
                            config = yaml.load(conf)
                            prefix = config.get(
                                self.config_prefix.lower(), None
                            )
                            if prefix:
                                self.prefix = prefix
                                break
220891
def _read_yaml_file(self, yaml_file):
        # type: (CliContext, pathlib.Path) -> None
        
        with yaml_file.open('r') as f:
            if self.config is None:
                self.config = ruamel.yaml.load(
                    f, Loader=ruamel.yaml.RoundTripLoader)
            else:
                self.config = blobxfer.util.merge_dict(
                    ruamel.yaml.load(f, Loader=ruamel.yaml.RoundTripLoader),
                    self.config)
795046
def load_tokens
      if File.exists?(TOKEN_PATH)
        f = File.open(TOKEN_PATH, 'r')
        tokens = YAML::load(f)
        f.close
        tokens
      end
    end
1216306
def _include_yaml(loader, node):
    
    return load_yaml(os.path.join(os.path.dirname(loader.name), node.value))
18847
def read_yaml(path)
      return unless File.exist?(path)
      source = YAML.load_file(path)
      return unless source.is_a?(Hash)

      update_with { |config| read_yaml_key(source, config[:key]) }
    end
977021
def discover_yaml(self):
        
        try:
            import yaml
            self.register('yaml', yaml.load, yaml.dump)
        except ImportError:
            pass
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
1315794
def load_yaml_file(file):
    
    if not hasattr(file, "read"):
        with io.open(file, "r", encoding="utf-8") as f:
            return yaml.load(f, yaml.FullLoader)
    return yaml.load(file, yaml.FullLoader)
987023
def load_filters
      filters_config = self.params["filters_config" ]
      if !filters_config.nil? && File.exists?(filters_config)
        begin
          YAML::load_file(filters_config)
        rescue 
          on_error.trigger($!, $@)
        end
      end
    end
140219
def register_yaml():
    """"""
    try:
        import yaml
        registry.register('yaml', yaml.safe_dump, yaml.safe_load,
                          content_type='application/x-yaml',
                          content_encoding='utf-8')
    except ImportError:

        def not_available(*args, **kwargs):
            """In case a client receives a yaml message, but yaml
            isn't installed."""
            raise SerializerNotInstalled(
                "No decoder installed for YAML. Install the PyYAML library")
        registry.register('yaml', None, not_available, 'application/x-yaml')
738249
def load_config_yaml(self, flags, config_dict):
        
        if config_dict is None:
            print('Config File not specified. Using only input flags.')
            return flags
        try:
            config_yaml_dict = self.cfg_from_file(flags['YAML_FILE'], config_dict)
        except KeyError:
            print('Yaml File not specified. Using only input flags and config file.')
            return config_dict
        print('Using input flags, config file, and yaml file.')
        config_yaml_flags_dict = self._merge_a_into_b_simple(flags, config_yaml_dict)
        return config_yaml_flags_dict
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
385336
def _load_yaml_file(yaml_file):
        
        with io.open(yaml_file, 'r', encoding='utf-8') as stream:
            yaml_content = yaml.load(stream)
            FileUtils._check_format(yaml_file, yaml_content)
            return yaml_content
1250635
def _load(content_or_fp):
    
    try:
        data = yaml.load(content_or_fp, Loader=yaml.loader.BaseLoader)
    except Exception as e:
        raise type(e)('Malformed yaml file:\n%r' % format_exc())

    try:
        ver = data['spec']
    except:
        raise ValueError('The file does not specify a spec version')

    try:
        ver = tuple(map(int, (ver.split("."))))
    except:
        raise ValueError("Invalid spec version format. Expect 'X.Y'"
                         " (X and Y integers), found %s" % ver)

    if ver > SPEC_VERSION_TUPLE:
        raise ValueError('The spec version of the file is '
                         '%s but the parser is %s. '
                         'Please update pyvisa-sim.' % (ver, SPEC_VERSION))

    return data
502564
def load_file(path)
      d = YAML.load_file(path)

      if d.is_a?(Hash) 
        d = HashWithIndifferentAccess.new(d)
        e = Evaluator.new(d)
        d = process(d, e)
      end

      @data[File.basename(path, ".yml").downcase] = d
    end
1057137
def _load_yaml_file(self, file):
        
        try:
            res = load_yaml_file(file)
        except:
            self.exception("Failed to load from {}".format(file))
            raise IOError("Loading file failed")
        return res