From 27186707b589594783126831288947e3b5ecfb2d Mon Sep 17 00:00:00 2001 From: Rimjhim Mittal Date: Thu, 21 Mar 2024 23:11:17 +0530 Subject: [PATCH] reverting a change in create_python_function --- src/modeci_mdf/functions/standard.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modeci_mdf/functions/standard.py b/src/modeci_mdf/functions/standard.py index af989d1a..9ae3809a 100644 --- a/src/modeci_mdf/functions/standard.py +++ b/src/modeci_mdf/functions/standard.py @@ -116,7 +116,11 @@ def substitute_args(expression_string: str = None, args: Dict[str, str] = None) return expression_string -def create_python_function(name: str, expression_string: str, arguments: List[str]) -> types.FunctionType: +def create_python_function( + name: str = None, + expression_string: str = None, + arguments: List[str] = None, +) -> "types.FunctionType": """Create a Python function e.g. linear, exponential, sin, cos, ReLu Args: @@ -133,7 +137,7 @@ def create_python_function(name: str, expression_string: str, arguments: List[st # assumes expression is one line name = name.replace(":", "_") expr = create_python_expression(expression_string) - func_str = f"def {name}({','.join(arguments)}):\n\treturn {expression_string}" + func_str = f"def {name}({','.join(arguments)}):\n\treturn {expr}" res = {} exec(func_str, globals(), res)