r"""Convert a function code string to a callable function object. Args: code (str): The function code as a string. Returns: Callable[..., Any]: The callable function object extracted from the code string.
(code: str)
| 383 | |
| 384 | |
| 385 | def func_string_to_callable(code: str): |
| 386 | r"""Convert a function code string to a callable function object. |
| 387 | |
| 388 | Args: |
| 389 | code (str): The function code as a string. |
| 390 | |
| 391 | Returns: |
| 392 | Callable[..., Any]: The callable function object extracted from the |
| 393 | code string. |
| 394 | """ |
| 395 | local_vars: Mapping[str, object] = {} |
| 396 | exec(code, globals(), local_vars) |
| 397 | func = local_vars.get(Constants.FUNC_NAME_FOR_STRUCTURED_OUTPUT) |
| 398 | return func |
| 399 | |
| 400 | |
| 401 | def json_to_function_code(json_obj: Dict) -> str: |
no outgoing calls
no test coverage detected