parameters: (top)
return_statement: return tuples
docstring: Walks a directory tree, yielding (dir_path, file_paths) tuples.
  
    For each top |top| and its subdirectories, yields a tuple containing the path
    to the directory and the path to each of the contained files.  Note that
    unlike os.Walk()/gfile.Walk(), this does not list subdirectories and the file
    paths are all absolute.
  
    Args:
      top: A path to a GCS directory.
    Returns:
      A list of (dir_path, file_paths) tuples.
docstring_summary: Walks a directory tree, yielding (dir_path, file_paths) tuples.
docstring_tokens: Walks a directory tree yielding ( dir_path file_paths ) tuples .
function: def ListRecursively(top):
    """Walks a directory tree, yielding (dir_path, file_paths) tuples.
  
    For each top |top| and its subdirectories, yields a tuple containing the path
    to the directory and the path to each of the contained files.  Note that
    unlike os.Walk()/gfile.Walk(), this does not list subdirectories and the file
    paths are all absolute.
  
    Args:
      top: A path to a GCS directory.
    Returns:
      A list of (dir_path, file_paths) tuples.
  
    """
    if top.endswith('/'):
      wildcard = top + '**'
    else:
      wildcard = top + '/**'
    tuples = []
    try:
      file_paths = ListDirectory(wildcard)
    except subprocess.CalledProcessError as e:
      logging.info('%s, assuming it means no files were found', e)
      return []
    for file_path in file_paths:
      dir_path = os.path.dirname(file_path)
      if tuples and tuples[-1][0] == dir_path:
        tuples[-1][1].append(file_path)
      else:
        tuples.append((dir_path, [file_path]))
    return tuples
function_tokens: def ListRecursively ( top ) : if top . endswith ( '/' ) : wildcard = top + '**' else : wildcard = top + '/**' tuples = [ ] try : file_paths = ListDirectory ( wildcard ) except subprocess . CalledProcessError as e : logging . info ( '%s, assuming it means no files were found' , e ) return [ ] for file_path in file_paths : dir_path = os . path . dirname ( file_path ) if tuples and tuples [ - 1 ] [ 0 ] == dir_path : tuples [ - 1 ] [ 1 ] . append ( file_path ) else : tuples . append ( ( dir_path , [ file_path ] ) ) return tuples