MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / __init__

Method __init__

tensorflow/python/util/module_wrapper.py:85–119  ·  view source on GitHub ↗
(  # pylint: disable=super-on-old-class
      self,
      wrapped,
      module_name,
      public_apis=None,
      deprecation=True,
      has_lite=False)

Source from the content-addressed store, hash-verified

83 """Wrapper for TF modules to support deprecation messages and lazyloading."""
84
85 def __init__( # pylint: disable=super-on-old-class
86 self,
87 wrapped,
88 module_name,
89 public_apis=None,
90 deprecation=True,
91 has_lite=False): # pylint: enable=super-on-old-class
92 super(TFModuleWrapper, self).__init__(wrapped.__name__)
93 # A cache for all members which do not print deprecations (any more).
94 self._tfmw_attr_map = {}
95 self.__dict__.update(wrapped.__dict__)
96 # Prefix all local attributes with _tfmw_ so that we can
97 # handle them differently in attribute access methods.
98 self._tfmw_wrapped_module = wrapped
99 self._tfmw_module_name = module_name
100 self._tfmw_public_apis = public_apis
101 self._tfmw_print_deprecation_warnings = deprecation
102 self._tfmw_has_lite = has_lite
103 # Set __all__ so that import * work for lazy loaded modules
104 if self._tfmw_public_apis:
105 self._tfmw_wrapped_module.__all__ = list(self._tfmw_public_apis.keys())
106 self.__all__ = list(self._tfmw_public_apis.keys())
107 else:
108 if hasattr(self._tfmw_wrapped_module, '__all__'):
109 self.__all__ = self._tfmw_wrapped_module.__all__
110 else:
111 self._tfmw_wrapped_module.__all__ = [
112 attr for attr in dir(self._tfmw_wrapped_module)
113 if not attr.startswith('_')
114 ]
115 self.__all__ = self._tfmw_wrapped_module.__all__
116
117 # names we already checked for deprecation
118 self._tfmw_deprecated_checked = set()
119 self._tfmw_warning_count = 0
120
121 def _tfmw_add_deprecation_warning(self, name, attr):
122 """Print deprecation warning for attr with given name if necessary."""

Callers 1

__setstate__Method · 0.95

Calls 2

updateMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected