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)
| 617 | |
| 618 | @tf_export("io.gfile.listdir") |
| 619 | def 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"]) |
no test coverage detected