@@ -243,11 +243,12 @@ def build(self):
243
243
# from it using * import. Don't need this for lazy_loading because the
244
244
# underscore symbols are already included in __all__ when passed in and
245
245
# handled by TFModuleWrapper.
246
+ root_module_footer = ''
246
247
if not self ._lazy_loading :
247
248
underscore_names_str = ', ' .join (
248
249
'\' %s\' ' % name for name in self ._underscore_names_in_root )
249
250
250
- module_text_map [ '' ] = module_text_map . get ( '' , '' ) + '''
251
+ root_module_footer = '''
251
252
_names_with_underscore = [%s]
252
253
__all__ = [_s for _s in dir() if not _s.startswith('_')]
253
254
__all__.extend([_s for _s in _names_with_underscore])
@@ -273,7 +274,7 @@ def build(self):
273
274
footer_text_map [dest_module ] = _DEPRECATION_FOOTER % (
274
275
dest_module , public_apis_name , deprecation , has_lite )
275
276
276
- return module_text_map , footer_text_map
277
+ return module_text_map , footer_text_map , root_module_footer
277
278
278
279
def format_import (self , source_module_name , source_name , dest_name ):
279
280
"""Formats import statement.
@@ -620,7 +621,11 @@ def create_api_files(output_files, packages, root_init_template, output_dir,
620
621
os .makedirs (os .path .dirname (file_path ))
621
622
open (file_path , 'a' ).close ()
622
623
623
- module_text_map , deprecation_footer_map = get_api_init_text (
624
+ (
625
+ module_text_map ,
626
+ deprecation_footer_map ,
627
+ root_module_footer ,
628
+ ) = get_api_init_text (
624
629
packages , output_package , api_name ,
625
630
api_version , compat_api_versions , lazy_loading , use_relative_imports )
626
631
@@ -652,6 +657,7 @@ def create_api_files(output_files, packages, root_init_template, output_dir,
652
657
with open (root_init_template , 'r' ) as root_init_template_file :
653
658
contents = root_init_template_file .read ()
654
659
contents = contents .replace ('# API IMPORTS PLACEHOLDER' , text )
660
+ contents = contents .replace ('# __all__ PLACEHOLDER' , root_module_footer )
655
661
elif module in compat_module_to_template :
656
662
# Read base init file for compat module
657
663
with open (compat_module_to_template [module ], 'r' ) as init_template_file :
0 commit comments