Open and return the yaml contents.
769071
def _load_yaml_config(path=None):
    """"""
    furious_yaml_path = path or find_furious_yaml()
    if furious_yaml_path is None:
        logging.debug("furious.yaml not found.")
        return None

    with open(furious_yaml_path) as yaml_file:
        return yaml_file.read()
1011613
def _load_yaml_config(path=None):
    """"""
    countour_yaml_path = path or find_contour_yaml()

    if countour_yaml_path is None:
        logging.debug("countour.yaml not found.")
        return None

    with open(countour_yaml_path) as yaml_file:
        return yaml_file.read()
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)
536446
def _load_yaml_config(self):
        
        try:
            config = self._read_config()
        except OSError as error:
            raise ValueError('Could not read configuration file: %s' % error)
        try:
            return yaml.safe_load(config)
        except yaml.YAMLError as error:
            message = '\n'.join(['    > %s' % line
                                 for line in str(error).split('\n')])
            sys.stderr.write('\n\n  Error in the configuration file:\n\n'
                             '{}\n\n'.format(message))
            sys.stderr.write('  Configuration should be a valid YAML file.\n')
            sys.stderr.write('  YAML format validation available at '
                             'http://yamllint.com\n')
            raise ValueError(error)
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)
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
834081
function loadYaml (filename) {
    const file = findFile(`${filename}.yml`)
    return file ? YAML.parse(fs.readFileSync(file, 'utf8')) : {}
  }
768541
def dump(self):
        """"""
        try:
            import yaml
            cfg_file = self._cfg_file()
            cfg_dir, __ = os.path.split(cfg_file)
            os.makedirs(cfg_dir, exist_ok=True)
            with open(cfg_file, 'w') as f:
                yaml.dump(self, f)
        except ImportError as err:
            raise RuntimeError(
                'Cannot dump the configuration settings to file. You need to '
                'install the necessary dependencies (pyyaml, appdirs).'
            ) from err
188835
def _read_file(path):
    '''
    
    '''
    try:
        with salt.utils.files.fopen(path, 'rb') as contents:
            return salt.utils.yaml.safe_load(contents)
    except (OSError, IOError):
        return {}
807283
def from_file(cls, filepath):
        """"""
        with open(filepath, "rt") as fh:
            return cls(**yaml.safe_load(fh))
953087
def read_yaml(file_path, Loader=yaml.Loader, object_pairs_hook=OrderedDict):
    ''''''
    # http://stackoverflow.com/a/21912744/943773

    class OrderedLoader(Loader):
        pass

    def construct_mapping(loader, node):
        loader.flatten_mapping(node)
        return object_pairs_hook(loader.construct_pairs(node))

    OrderedLoader.add_constructor(
        yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
        construct_mapping)

    with open(file_path, 'r') as f:

        return yaml.load(f, OrderedLoader)
630002
def load_yaml_file(file_path: str):
    """"""
    with codecs.open(file_path, 'r') as f:
        return yaml.safe_load(f)
798581
def load(self):
        """"""
        try:
            merged_configfile = self.get_merged_config()
            self.yamldocs = yaml.load(merged_configfile, Loader=Loader)

            # Strip out the top level 'None's we get from concatenation.
            # Functionally not required, but makes dumps cleaner.
            self.yamldocs = [x for x in self.yamldocs if x]
            self.logdebug('parsed_rules:\n%s\n' % pretty(self.yamldocs))

        except (yaml.scanner.ScannerError, yaml.parser.ParserError):
            self.raise_and_log_error(ConfigError, 'error parsing config.')
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)
1189403
def load_manifest(data):
    
    if isinstance(data, dict):
        return data
    doc = yaml.safe_load(data)
    if not isinstance(doc, dict):
        raise Exception("Manifest didn't result in dict.")
    return doc
977021
def discover_yaml(self):
        
        try:
            import yaml
            self.register('yaml', yaml.load, yaml.dump)
        except ImportError:
            pass
83134
def get_json_or_yaml(file_path, content):
    
    if os.path.splitext(file_path)[1] == ".json":
        return json.dumps(content, sort_keys=False, indent=4, separators=(',', ': '))
    else:
        return inginious.common.custom_yaml.dump(content)