Ejemplo n.º 1
0
        // メンバ呼び出し
        public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
        {
            PyObject tuppleArgs = PyTuple.New(args.Length);

            for (int i = 0; i < args.Length; i++)
            {
                if (args[i] is int[] intArray)
                {
                    PyTuple.SetItem(tuppleArgs, i, (PyArray <int>)intArray);
                }
                else if (args[i] is float[] floatArray)
                {
                    PyTuple.SetItem(tuppleArgs, i, (PyArray <float>)floatArray);
                }
                else if (args[i] is double[] doubleArray)
                {
                    PyTuple.SetItem(tuppleArgs, i, (PyArray <double>)doubleArray);
                }
                else if (args[i] is PyArray <float> floatPyArray)
                {
                    PyTuple.SetItem(tuppleArgs, i, floatPyArray);
                }
                else if (args[i] is PyArray <double> doublePyArray)
                {
                    PyTuple.SetItem(tuppleArgs, i, doublePyArray);
                }
                else if (args[i] is PyArray <int> intPyArray)
                {
                    PyTuple.SetItem(tuppleArgs, i, intPyArray);
                }
                else
                {
                    PyTuple.SetItem(tuppleArgs, i, (PyObject)args[i]);
                }
            }

            result = PyObject.CallObject(_pyObject[binder.Name], tuppleArgs);

            return(true);
        }
Ejemplo n.º 2
0
 public PyObject Call(PyObject[] argNames, PyDict kw)
 {
     return(Call(_pyObject, PyTuple.Pack(argNames), kw));
 }
Ejemplo n.º 3
0
 public PyObject Call(params PyObject[] argNames)
 {
     return(CallObject(_pyObject, PyTuple.Pack(argNames)));
 }