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

Method set_callback

tensorflow/python/debug/cli/cli_config.py:99–118  ·  view source on GitHub ↗

Set a set-callback for given property. Args: property_name: Name of the property. callback: The callback as a `callable` of signature: def cbk(config): where config is the config after it is set to the new value. The callback is invoked each time the set()

(self, property_name, callback)

Source from the content-addressed store, hash-verified

97 self._set_callbacks[property_name](self._config)
98
99 def set_callback(self, property_name, callback):
100 """Set a set-callback for given property.
101
102 Args:
103 property_name: Name of the property.
104 callback: The callback as a `callable` of signature:
105 def cbk(config):
106 where config is the config after it is set to the new value.
107 The callback is invoked each time the set() method is called with the
108 matching property_name.
109
110 Raises:
111 KeyError: If property_name does not exist.
112 TypeError: If `callback` is not callable.
113 """
114 if property_name not in self._config:
115 raise KeyError("%s is not a valid property name." % property_name)
116 if not callable(callback):
117 raise TypeError("The callback object provided is not callable.")
118 self._set_callbacks[property_name] = callback
119
120 def _default_config_file_path(self):
121 return os.path.join(os.path.expanduser("~"), self._CONFIG_FILE_NAME)

Callers 5

testSetCallbackMethod · 0.95
_screen_launchMethod · 0.80
__init__Method · 0.80

Calls

no outgoing calls

Tested by 3

testSetCallbackMethod · 0.76