def looks_like_a_tool_xml(path):
 full_path = os.path.abspath(path)
 if (not full_path.endswith('.xml')):
  return False
 if (not os.path.getsize(full_path)):
  return False
 if (checkers.check_binary(full_path) or checkers.check_image(full_path) or checkers.check_gzip(full_path)[0] or checkers.check_bz2(full_path)[0] or checkers.check_zip(full_path)):
  return False
 with open(path, 'r') as f:
  start_contents = f.read((5 * 1024))
  if TOOL_REGEX.search(start_contents):
   return True
 return False

def looks_like_a_tool_xml ( path ) : full_path = os . path . abspath ( path ) if ( not full_path . endswith ( '.xml' ) ) : return False if ( not os . path . getsize ( full_path ) ) : return False if ( checkers . check_binary ( full_path ) or checkers . check_image ( full_path ) or checkers . check_gzip ( full_path ) [ 0 ] or checkers . check_bz2 ( full_path ) [ 0 ] or checkers . check_zip ( full_path ) ) : return False with open ( path , 'r' ) as f : start_contents = f . read ( ( 5 * 1024 ) ) if TOOL_REGEX . search ( start_contents ) : return True return False
quick check to see if a file looks like it may be a galaxy xml tool file .