1# Copyright 2015 The TensorFlow Authors. All Rights Reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# ============================================================================== 15 16"""Import router for file_io.""" 17from __future__ import absolute_import 18from __future__ import division 19from __future__ import print_function 20 21# pylint: disable=unused-import 22from tensorflow.python.lib.io.file_io import copy as Copy 23from tensorflow.python.lib.io.file_io import create_dir as MkDir 24from tensorflow.python.lib.io.file_io import delete_file as Remove 25from tensorflow.python.lib.io.file_io import delete_recursively as DeleteRecursively 26from tensorflow.python.lib.io.file_io import file_exists as Exists 27from tensorflow.python.lib.io.file_io import FileIO as _FileIO 28from tensorflow.python.lib.io.file_io import get_matching_files as Glob 29from tensorflow.python.lib.io.file_io import is_directory as IsDirectory 30from tensorflow.python.lib.io.file_io import list_directory as ListDirectory 31from tensorflow.python.lib.io.file_io import recursive_create_dir as MakeDirs 32from tensorflow.python.lib.io.file_io import rename as Rename 33from tensorflow.python.lib.io.file_io import stat as Stat 34from tensorflow.python.lib.io.file_io import walk as Walk 35# pylint: enable=unused-import 36from tensorflow.python.util.deprecation import deprecated 37from tensorflow.python.util.tf_export import tf_export 38 39 40@tf_export('io.gfile.GFile', v1=['gfile.GFile', 'gfile.Open', 'io.gfile.GFile']) 41class GFile(_FileIO): 42 """File I/O wrappers without thread locking. 43 44 Note, that this is somewhat like builtin Python file I/O, but 45 there are semantic differences to make it more efficient for 46 some backing filesystems. For example, a write mode file will 47 not be opened until the first write call (to minimize RPC 48 invocations in network filesystems). 49 """ 50 51 def __init__(self, name, mode='r'): 52 super(GFile, self).__init__(name=name, mode=mode) 53 54 55@tf_export(v1=['gfile.FastGFile']) 56class FastGFile(_FileIO): 57 """File I/O wrappers without thread locking. 58 59 Note, that this is somewhat like builtin Python file I/O, but 60 there are semantic differences to make it more efficient for 61 some backing filesystems. For example, a write mode file will 62 not be opened until the first write call (to minimize RPC 63 invocations in network filesystems). 64 """ 65 66 @deprecated(None, 'Use tf.gfile.GFile.') 67 def __init__(self, name, mode='r'): 68 super(FastGFile, self).__init__(name=name, mode=mode) 69 70 71# Does not alias to Open so that we use our version of GFile to strip 72# 'b' mode. 73Open = GFile 74