Exemple #1
0
        public static PyDict_Items Create(PyDict dict)
        {
            var dict_items = PyTypeObject.DefaultNew <PyDict_Items>(PyDict_ItemsClass.Instance);

            dict_items.Dict = dict;
            return(dict_items);
        }
Exemple #2
0
        public static PyTuple Create(List <object> values)
        {
            var pyTuple = PyTypeObject.DefaultNew <PyTuple>(PyTupleClass.Instance);

            pyTuple.Values = values.ToArray();
            return(pyTuple);
        }
Exemple #3
0
        public static PyInteger Create(BigInteger value)
        {
            var pyInt = PyTypeObject.DefaultNew <PyInteger>(PyIntegerClass.Instance);

            pyInt.InternalValue = value;
            return(pyInt);
        }
Exemple #4
0
        public static PyKeyIterator Create(PyDict dict)
        {
            var iterator = PyTypeObject.DefaultNew <PyKeyIterator>(PyKeyIteratorClass.Instance);

            iterator.Keys = dict.dict.Keys.GetEnumerator();
            return(iterator);
        }
Exemple #5
0
        private static PyBool _makeInstance(bool value)
        {
            var instance = PyTypeObject.DefaultNew <PyBool>(PyBoolClass.Instance);

            instance.InternalValue = value;
            return(instance);
        }
Exemple #6
0
        public static PyString Create(string value)
        {
            var pyString = PyTypeObject.DefaultNew <PyString>(PyStringClass.Instance);

            pyString.InternalValue = value;
            return(pyString);
        }
Exemple #7
0
        public static PyFloat Create(double value)
        {
            var pyFloat = PyTypeObject.DefaultNew <PyFloat>(PyFloatClass.Instance);

            pyFloat.number = new Decimal(value);
            return(pyFloat);
        }
Exemple #8
0
        public static PyList Create(List <object> existingList)
        {
            var pyList = PyTypeObject.DefaultNew <PyList>(PyListClass.Instance);

            pyList.list = existingList;
            return(pyList);
        }
Exemple #9
0
        public static PyFloat Create(Decimal value)
        {
            var pyFloat = PyTypeObject.DefaultNew <PyFloat>(PyFloatClass.Instance);

            pyFloat.InternalValue = value;
            return(pyFloat);
        }
Exemple #10
0
        public static PyTuple Create(object[] values)
        {
            var pyTuple = PyTypeObject.DefaultNew <PyTuple>(PyTupleClass.Instance);

            pyTuple.Values = values;
            return(pyTuple);
        }
Exemple #11
0
        public static PyModule Create(string name)
        {
            var createdModule = PyTypeObject.DefaultNew <PyModule>(PyModuleClass.Instance);

            createdModule.Name = name;
            return(createdModule);
        }
Exemple #12
0
        public static PyTupleIterator Create(PyTuple tuple)
        {
            var iterator = PyTypeObject.DefaultNew <PyTupleIterator>(PyTupleIteratorClass.Instance);

            iterator.CurrentIdx    = 0;
            iterator.IteratedTuple = tuple;
            return(iterator);
        }
Exemple #13
0
        public static PyListIterator Create(PyList list)
        {
            var iterator = PyTypeObject.DefaultNew <PyListIterator>(PyListIteratorClass.Instance);

            iterator.CurrentIdx   = 0;
            iterator.IteratedList = list;

            return(iterator);
        }
Exemple #14
0
        public static PyModuleSpec Create(string name, ISpecLoader loader, string origin, string[] submodule_search_locations)
        {
            var spec = PyTypeObject.DefaultNew <PyModuleSpec>(PyModuleSpecClass.Instance);

            spec.Name   = name;
            spec.Loader = loader;
            spec.Origin = origin;
            spec.SubmoduleSearchLocations = submodule_search_locations;
            return(spec);
        }
Exemple #15
0
        public static PyRange Create(int min, int max, int step)
        {
            var pyRange = PyTypeObject.DefaultNew <PyRange>(PyRangeClass.Instance);

            pyRange.Min  = min;
            pyRange.Max  = max;
            pyRange.Step = step;

            return(pyRange);
        }
Exemple #16
0
        public static PyRangeIterator Create(PyRange range)
        {
            var iterator = PyTypeObject.DefaultNew <PyRangeIterator>(PyRangeIteratorClass.Instance);

            iterator.Min     = range.Min;
            iterator.Max     = range.Max;
            iterator.Step    = range.Step;
            iterator.Current = iterator.Min;

            return(iterator);
        }
Exemple #17
0
        public static PySuper Create(PyObject self, PyClass superclass)
        {
            var instance = PyTypeObject.DefaultNew <PySuper>(PySuperType.Instance);

            // TODO: Also test for NoneType and assign NoneType
            if (self == null)
            {
                instance.__setattr__("__self__", null);
                instance.__setattr__("__self_class__", null);
            }
            else
            {
                instance.__setattr__("__self__", self);
                instance.__setattr__("__self_class__", self.__class__);
            }

            instance.__setattr__("__this_class__", superclass);
            return(instance);
        }
Exemple #18
0
 public static PyInteger Create()
 {
     return(PyTypeObject.DefaultNew <PyInteger>(PyIntegerClass.Instance));
 }
Exemple #19
0
        public static PyList Create()
        {
            var pyList = PyTypeObject.DefaultNew <PyList>(PyListClass.Instance);

            return(pyList);
        }
Exemple #20
0
 public static PyFloat Create()
 {
     return(PyTypeObject.DefaultNew <PyFloat>(PyFloatClass.Instance));
 }
Exemple #21
0
 public static PyString Create()
 {
     return(PyTypeObject.DefaultNew <PyString>(PyStringClass.Instance));
 }