Only add ModuleWrapper when lazy loading is requested or when using TF 1.x (to

print deprecation warnings).

PiperOrigin-RevId: 266944067
This commit is contained in:
Anna R 2019-09-03 09:16:08 -07:00 committed by TensorFlower Gardener
parent 2ccea0c7f8
commit fa9b9dc241

View File

@ -242,22 +242,25 @@ __all__ = [_s for _s in dir() if not _s.startswith('_')]
__all__.extend([_s for _s in _names_with_underscore]) __all__.extend([_s for _s in _names_with_underscore])
''' % underscore_names_str ''' % underscore_names_str
for dest_module, _ in self._module_imports.items(): # Add module wrapper if we need to print deprecation messages
deprecation = 'False' # or if we use lazy loading.
has_lite = 'False' if self._api_version == 1 or self._lazy_loading:
if self._api_version == 1: # Add 1.* deprecations. for dest_module, _ in self._module_imports.items():
if not dest_module.startswith(_COMPAT_MODULE_PREFIX): deprecation = 'False'
deprecation = 'True' has_lite = 'False'
# Workaround to make sure not load lite from lite/__init__.py if self._api_version == 1: # Add 1.* deprecations.
if (not dest_module and 'lite' in self._module_imports if not dest_module.startswith(_COMPAT_MODULE_PREFIX):
and self._lazy_loading): deprecation = 'True'
has_lite = 'True' # Workaround to make sure not load lite from lite/__init__.py
if self._lazy_loading: if (not dest_module and 'lite' in self._module_imports
public_apis_name = '_PUBLIC_APIS' and self._lazy_loading):
else: has_lite = 'True'
public_apis_name = 'None' if self._lazy_loading:
footer_text_map[dest_module] = _DEPRECATION_FOOTER % ( public_apis_name = '_PUBLIC_APIS'
dest_module, public_apis_name, deprecation, has_lite) else:
public_apis_name = 'None'
footer_text_map[dest_module] = _DEPRECATION_FOOTER % (
dest_module, public_apis_name, deprecation, has_lite)
return module_text_map, footer_text_map return module_text_map, footer_text_map