MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / list_directory_v2

Function list_directory_v2

tensorflow/python/lib/io/file_io.py:619–645  ·  view source on GitHub ↗

Returns a list of entries contained within a directory. The list is in arbitrary order. It does not contain the special entries "." and "..". Args: path: string, path to a directory Returns: [filename1, filename2, ... filenameN] as strings Raises: errors.NotFoundError if di

(path)

Source from the content-addressed store, hash-verified

617
618@tf_export("io.gfile.listdir")
619def list_directory_v2(path):
620 """Returns a list of entries contained within a directory.
621
622 The list is in arbitrary order. It does not contain the special entries "."
623 and "..".
624
625 Args:
626 path: string, path to a directory
627
628 Returns:
629 [filename1, filename2, ... filenameN] as strings
630
631 Raises:
632 errors.NotFoundError if directory doesn't exist
633 """
634 if not is_directory(path):
635 raise errors.NotFoundError(
636 node_def=None,
637 op=None,
638 message="Could not find directory {}".format(path))
639
640 # Convert each element to string, since the return values of the
641 # vector of string should be interpreted as strings, not bytes.
642 return [
643 compat.as_str_any(filename)
644 for filename in pywrap_tensorflow.GetChildren(compat.as_bytes(path))
645 ]
646
647
648@tf_export(v1=["gfile.Walk"])

Callers 1

list_directoryFunction · 0.85

Calls 3

is_directoryFunction · 0.85
formatMethod · 0.45
GetChildrenMethod · 0.45

Tested by

no test coverage detected