diff options
author | 2016-11-01 10:34:12 -0800 | |
---|---|---|
committer | 2016-11-01 11:54:04 -0700 | |
commit | 131924db31512989eeb9384346e6dc9001b5ce61 (patch) | |
tree | 2c8f4ecb03e7865cf3c8c2c873ac78d76b90018b | |
parent | 3fbd3ce4d6fc2898ac50348bb8221e4e49fefe10 (diff) |
Seal gfile.py's interface.
Change: 137849082
-rw-r--r-- | tensorflow/python/platform/gfile.py | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/tensorflow/python/platform/gfile.py b/tensorflow/python/platform/gfile.py index 16aab78773..33efb0aefa 100644 --- a/tensorflow/python/platform/gfile.py +++ b/tensorflow/python/platform/gfile.py @@ -14,23 +14,37 @@ # ============================================================================== """Import router for file_io.""" -# pylint: disable=wildcard-import from __future__ import absolute_import from __future__ import division from __future__ import print_function -from tensorflow.python.lib.io import file_io +# pylint: disable=unused-import +from tensorflow.python.lib.io.file_io import copy as Copy +from tensorflow.python.lib.io.file_io import create_dir as MkDir +from tensorflow.python.lib.io.file_io import delete_file as Remove +from tensorflow.python.lib.io.file_io import delete_recursively as DeleteRecursively +from tensorflow.python.lib.io.file_io import file_exists as Exists +from tensorflow.python.lib.io.file_io import FileIO as _FileIO +from tensorflow.python.lib.io.file_io import get_matching_files as Glob +from tensorflow.python.lib.io.file_io import is_directory as IsDirectory +from tensorflow.python.lib.io.file_io import list_directory as ListDirectory +from tensorflow.python.lib.io.file_io import recursive_create_dir as MakeDirs +from tensorflow.python.lib.io.file_io import rename as Rename +from tensorflow.python.lib.io.file_io import stat as Stat +from tensorflow.python.lib.io.file_io import walk as Walk +# pylint: enable=unused-import +from tensorflow.python.util.all_util import remove_undocumented -class GFile(file_io.FileIO): - """File I/O wrappers with thread locking.""" +class GFile(_FileIO): + """File I/O wrappers without thread locking.""" def __init__(self, name, mode='r'): mode = mode.replace('b', '') super(GFile, self).__init__(name=name, mode=mode) -class FastGFile(file_io.FileIO): +class FastGFile(_FileIO): """File I/O wrappers without thread locking.""" def __init__(self, name, mode='r'): @@ -38,23 +52,27 @@ class FastGFile(file_io.FileIO): super(FastGFile, self).__init__(name=name, mode=mode) -# This should be kept consistent with the OSS implementation -# of the gfile interface. - # Does not alias to Open so that we use our version of GFile to strip # 'b' mode. Open = GFile -# pylint: disable=invalid-name -Exists = file_io.file_exists -IsDirectory = file_io.is_directory -Glob = file_io.get_matching_files -MkDir = file_io.create_dir -MakeDirs = file_io.recursive_create_dir -Remove = file_io.delete_file -DeleteRecursively = file_io.delete_recursively -ListDirectory = file_io.list_directory -Walk = file_io.walk -Stat = file_io.stat -Rename = file_io.rename -Copy = file_io.copy +# TODO(drpng): Find the right place to document these. +_allowed_symbols = [ + 'Copy', + 'DeleteRecursively', + 'Exists', + 'FastGFile', + 'GFile', + 'Glob', + 'IsDirectory', + 'ListDirectory', + 'Open', + 'MakeDirs', + 'MkDir', + 'Remove', + 'Rename', + 'Stat', + 'Walk', +] + +remove_undocumented(__name__, _allowed_symbols) |