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

Function Import

tensorflow/contrib/specs/python/specs_lib.py:207–224  ·  view source on GitHub ↗

Import a function by exec. Args: statements: Python statements Returns: Function-wrapped value of `f`. Raises: ValueError: the statements didn't define a value for "f"

(statements)

Source from the content-addressed store, hash-verified

205
206
207def Import(statements):
208 """Import a function by exec.
209
210 Args:
211 statements: Python statements
212
213 Returns:
214 Function-wrapped value of `f`.
215
216 Raises:
217 ValueError: the statements didn't define a value for "f"
218 """
219 environ = {}
220 exec_(statements, environ)
221 if "f" not in environ:
222 raise ValueError("failed to define \"f\": %s", statements)
223 f = environ["f"]
224 return Function(f)
225
226
227# pylint: enable=invalid-name, exec-used

Callers 1

RestoreSSDMethod · 0.50

Calls 1

FunctionClass · 0.70

Tested by

no test coverage detected