/// <summary> /// Calls the specified function and assigns the result to this variable /// </summary> /// <param name="function"></param> /// <param name="arguments"></param> /// <param name="escapeMethod"></param> /// <returns></returns> public dynamic CallAssign( PyFunction function, List <object> arguments = null, EscapeFlags escapeMethod = EscapeFlags.Quotes | EscapeFlags.StripNullItems, PyVariable target = null ) { string argumentsText = ""; if (arguments != null) { List <string> textArguments = PythonInterop.EscapeArguments(arguments, escapeMethod); argumentsText = string.Join(", ", textArguments); } if (target == null) { target = this; } PythonInterop.EvalToVar(target, "{0}({1})", new List <object> { function.ToString(), argumentsText }, EscapeFlags.None); return(this.Value); }
public dynamic CallFunction( PyFunction function, string argumentsBody, PyVariable target = null ) { if (target == null) { target = PyVariableManager.LastResult; } return((PythonInterop.EvalToVar(target, string.Format("{0}.{1}({2})", this.PyName, function.Function, argumentsBody ))).Value); }
public void EvalAssign(string code) { PythonInterop.EvalToVar(this, code); }
/// <summary> /// Copies a Python variable to another by using an assignment (var_dest=var_src) /// </summary> /// <param name="dest"></param> /// <param name="source"></param> public static void CopyVariable(PyVariable dest, PyVariable source) { PythonInterop.EvalToVar(dest, source.PyName); }