def looks_like_a_cwl_artifact(path, classes=None):
 if (not _has_extension(path, CWL_EXTENSIONS)):
  return False
 with open(path, 'r') as f:
  try:
   as_dict = yaml.safe_load(f)
  except Exception:
   return False
 if (not isinstance(as_dict, dict)):
  return False
 file_class = as_dict.get('class', None)
 if ((classes is not None) and (file_class not in classes)):
  return False
 file_cwl_version = as_dict.get('cwlVersion', None)
 return (file_cwl_version is not None)

def looks_like_a_cwl_artifact ( path , classes = None ) : if ( not _has_extension ( path , CWL_EXTENSIONS ) ) : return False with open ( path , 'r' ) as f : try : as_dict = yaml . safe_load ( f ) except Exception : return False if ( not isinstance ( as_dict , dict ) ) : return False file_class = as_dict . get ( 'class' , None ) if ( ( classes is not None ) and ( file_class not in classes ) ) : return False file_cwl_version = as_dict . get ( 'cwlVersion' , None ) return ( file_cwl_version is not None )
quick check to see if a file looks like it may be a cwl artifact .