Package org.python.core

Examples of org.python.core.PyNewWrapper


            }

        }
        dict.__setitem__("__reduce__", new PyMethodDescr("__reduce__", PyTimeTuple.class, 0, 0, new exposed___reduce__(
                null, null)));
        dict.__setitem__("__new__", new PyNewWrapper(PyTimeTuple.class, "__new__", -1, -1) {

            public PyObject new_impl(boolean init, PyType subtype, PyObject[] args, String[] keywords) {
                return struct_time_new(this, init, subtype, args, keywords);
            }
View Full Code Here


            }

        }
        dict.__setitem__("__init__", new PyMethodDescr("__init__", PySet.class, -1, -1,
                new exposed___init__(null, null)));
        dict.__setitem__("__new__", new PyNewWrapper(PySet.class, "__new__", -1, -1) {

            public PyObject new_impl(boolean init, PyType subtype, PyObject[] args, String[] keywords) {
                PySet newobj;
                if (for_type == subtype) {
                    newobj = new PySet();
View Full Code Here

            }

        }
        dict.__setitem__("__init__", new PyMethodDescr("__init__", PyImmutableSet.class, -1, -1, new exposed___init__(
                null, null)));
        dict.__setitem__("__new__", new PyNewWrapper(PyImmutableSet.class, "__new__", -1, -1) {

            public PyObject new_impl(boolean init, PyType subtype, PyObject[] args, String[] keywords) {
                PyImmutableSet newobj;
                if (for_type == subtype) {
                    newobj = new PyImmutableSet();
View Full Code Here

        ExposedTypeProcessor etp = new ExposedTypeProcessor(getClass().getClassLoader()
                .getResourceAsStream("org/python/expose/generate/TypeExposerTest$SimplestNew.class"));
        TypeBuilder te = etp.getTypeExposer().makeBuilder();
        assertEquals(true, te.getIsBaseType());
        PyType simplestType = PyType.fromClass(SimplestNew.class);
        PyNewWrapper new_ = (PyNewWrapper)te.getDict(simplestType).__finditem__("__new__");
        assertEquals(Py.One, new_.new_impl(false, null, null, null));
    }
View Full Code Here

        assertEquals("org/python/expose/generate/NewExposerTest$Instantiable$exposed___new__",
                     ne.getInternalName());
        assertEquals("org.python.expose.generate.NewExposerTest$Instantiable$exposed___new__",
                     ne.getClassName());
        Class descriptor = ne.load(new BytecodeLoader.Loader());
        PyNewWrapper instance = (PyNewWrapper)descriptor.newInstance();
        instance.setWrappedType(PyType.fromClass(Instantiable.class));
        assertSame("__new__", instance.__getattr__("__name__").toString());
        assertEquals(Py.One, instance.__call__(PyType.fromClass(Instantiable.class)));
    }
View Full Code Here

                     type,
                     created.forType);
    }

    public void testSubtype() throws Exception {
        PyType sub = (PyType)PyType.newType(new PyNewWrapper() {

            public PyObject new_impl(boolean init,
                                     PyType subtype,
                                     PyObject[] args,
                                     String[] keywords) {
View Full Code Here

TOP

Related Classes of org.python.core.PyNewWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.