Package org.python.core

Examples of org.python.core.PyType.lookup()


        return super.__len__();
    }

    public PyObject __iter__() {
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__iter__");
        if (impl != null)
            return impl.__get__(this, self_type).__call__();
        impl = self_type.lookup("__getitem__");
        if (impl == null)
            return super.__iter__();
View Full Code Here


    public PyObject __iter__() {
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__iter__");
        if (impl != null)
            return impl.__get__(this, self_type).__call__();
        impl = self_type.lookup("__getitem__");
        if (impl == null)
            return super.__iter__();
        return new PySequenceIter(this);
    }
View Full Code Here

        return new PySequenceIter(this);
    }

    public PyObject __iternext__() {
        PyType self_type = getType();
        PyObject impl = self_type.lookup("next");
        if (impl != null) {
            try {
                return impl.__get__(this, self_type).__call__();
            } catch (PyException exc) {
                if (Py.matchException(exc, Py.StopIteration))
View Full Code Here

        return super.__iternext__(); // ???
    }

    public PyObject __finditem__(PyObject key) { // ???
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__getitem__");
        if (impl != null)
            try {
                return impl.__get__(this, self_type).__call__(key);
            } catch (PyException exc) {
                if (Py.matchException(exc, Py.LookupError))
View Full Code Here

        return super.__finditem__(key);
    }

    public void __setitem__(PyObject key, PyObject value) { // ???
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__setitem__");
        if (impl != null) {
            impl.__get__(this, self_type).__call__(key, value);
            return;
        }
        super.__setitem__(key, value);
View Full Code Here

        super.__setitem__(key, value);
    }

    public PyObject __getslice__(PyObject start, PyObject stop, PyObject step) { // ???
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__getslice__");
        if (impl != null)
            try {
                return impl.__get__(this, self_type).__call__(start, stop);
            } catch (PyException exc) {
                if (Py.matchException(exc, Py.LookupError))
View Full Code Here

        return super.__getslice__(start, stop, step);
    }

    public void __delitem__(PyObject key) { // ???
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__delitem__");
        if (impl != null) {
            impl.__get__(this, self_type).__call__(key);
            return;
        }
        super.__delitem__(key);
View Full Code Here

        ThreadState ts = Py.getThreadState();
        if (ts.recursion_depth++ > ts.systemState.getrecursionlimit())
            throw Py.RuntimeError("maximum __call__ recursion depth exceeded");
        try {
            PyType self_type = getType();
            PyObject impl = self_type.lookup("__call__");
            if (impl != null)
                return impl.__get__(this, self_type).__call__(args, keywords);
            return super.__call__(args, keywords);
        } finally {
            --ts.recursion_depth;
View Full Code Here

        }
    }

    public PyObject __findattr__(String name) {
        PyType self_type = getType();
        PyObject getattribute = self_type.lookup("__getattribute__");
        PyString py_name = null;
        try {
            if (getattribute != null) {
                return getattribute.__get__(this, self_type).__call__(py_name = new PyString(name));
            } else {
View Full Code Here

            } else {
                return super.__findattr__(name);
            }
        } catch (PyException e) {
            if (Py.matchException(e, Py.AttributeError)) {
                PyObject getattr = self_type.lookup("__getattr__");
                if (getattr != null)
                    try {
                        return getattr.__get__(this, self_type)
                                .__call__(py_name != null ? py_name : new PyString(name));
                    } catch (PyException e1) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.