def parse_yaml(path='/config/tool_destinations.yml', test=False, return_bool=False):
 try:
  if test:
   config = load(path)
  else:
   if (path == '/config/tool_destinations.yml'):
    config_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../..')
    opt_file = (config_directory + path)
   else:
    opt_file = path
   with open(opt_file, 'r') as stream:
    config = load(stream)
  try:
   if return_bool:
    valid_config = validate_config(config, return_bool)
   else:
    config = validate_config(config)
  except MalformedYMLException:
   if verbose:
    log.error(str(sys.exc_value))
   raise
 except ScannerError:
  if verbose:
   log.error('Config is too malformed to fix!')
  raise
 if return_bool:
  return valid_config
 else:
  return config

def parse_yaml ( path = '/config/tool_destinations.yml' , test = False , return_bool = False ) : try : if test : config = load ( path ) else : if ( path == '/config/tool_destinations.yml' ) : config_directory = os . path . join ( os . path . dirname ( os . path . realpath ( __file__ ) ) , '../../../..' ) opt_file = ( config_directory + path ) else : opt_file = path with open ( opt_file , 'r' ) as stream : config = load ( stream ) try : if return_bool : valid_config = validate_config ( config , return_bool ) else : config = validate_config ( config ) except MalformedYMLException : if verbose : log . error ( str ( sys . exc_value ) ) raise except ScannerError : if verbose : log . error ( 'Config is too malformed to fix!' ) raise if return_bool : return valid_config else : return config
get a yaml file from path and send it to validate_config for validation .