Beispiel #1
0
 public string CallFunction(
     PythonFunction function,
     string argumentsBody
     )
 {
     return(PythonInterop.EvalToResult(string.Format("{0}.{1}({2})",
                                                     this.PyName, function.Function, argumentsBody
                                                     )).Value);
 }
Beispiel #2
0
        public string CallFunction(
            PythonFunction function,
            List <object> arguments  = null,
            EscapeFlags escapeMethod = EscapeFlags.Quotes | EscapeFlags.StripNullItems
            )
        {
            if (arguments == null)
            {
                arguments = new List <object>();
            }

            List <string> textArguments = PythonInterop.EscapeArguments(arguments, escapeMethod);

            return(CallFunction(function, string.Join(", ", textArguments)));
        }
Beispiel #3
0
        public string CallFunction(
            PythonFunction function,
            List <object> arguments  = null,
            EscapeFlags escapeMethod = EscapeFlags.Quotes | EscapeFlags.StripNullItems
            )
        {
            if (arguments == null)
            {
                arguments = new List <object>();
            }

            List <string> textArguments = PythonInterop.EscapeArguments(arguments, escapeMethod);

            return(PythonInterop.EvalToResult(string.Format("{0}.{1}({2})",
                                                            this.PyName, function.Function, string.Join(", ", textArguments)
                                                            )));
        }
Beispiel #4
0
        /// <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 string CallAssign(
            PythonFunction function,
            List <object> arguments  = null,
            EscapeFlags escapeMethod = EscapeFlags.Quotes | EscapeFlags.StripNullItems
            )
        {
            string argumentsText = "";

            if (arguments != null)
            {
                List <string> textArguments = PythonInterop.EscapeArguments(arguments, escapeMethod);
                argumentsText = string.Join(", ", textArguments);
            }

            PythonInterop.EvalToVar(this, "{0}({1})", new List <object> {
                function.ToString(), argumentsText
            }, EscapeFlags.None);

            return(this.Value);
        }