aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tools/api/generator/create_python_api.py
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/tools/api/generator/create_python_api.py')
-rw-r--r--tensorflow/tools/api/generator/create_python_api.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tensorflow/tools/api/generator/create_python_api.py b/tensorflow/tools/api/generator/create_python_api.py
index bca9fa49eb..671b7e387e 100644
--- a/tensorflow/tools/api/generator/create_python_api.py
+++ b/tensorflow/tools/api/generator/create_python_api.py
@@ -41,7 +41,11 @@ _GENERATED_FILE_HEADER = """# This file is MACHINE GENERATED! Do not edit.
# Generated by: tensorflow/tools/api/generator/create_python_api.py script.
\"\"\"%s
\"\"\"
+
+from __future__ import print_function
+
"""
+_GENERATED_FILE_FOOTER = "\n\ndel print_function\n"
class SymbolExposedTwiceError(Exception):
@@ -149,6 +153,7 @@ class _ModuleInitCodeBuilder(object):
_names_with_underscore = [%s]
__all__ = [_s for _s in dir() if not _s.startswith('_')]
__all__.extend([_s for _s in _names_with_underscore])
+__all__.remove('print_function')
''' % underscore_names_str
return module_text_map
@@ -333,7 +338,8 @@ def create_api_files(
if module or not root_init_template:
contents = (
_GENERATED_FILE_HEADER %
- get_module_docstring(module, package, api_name) + text)
+ get_module_docstring(module, package, api_name) +
+ text + _GENERATED_FILE_FOOTER)
else:
# Read base init file
with open(root_init_template, 'r') as root_init_template_file: