Package org.python.core

Examples of org.python.core.PyType$MethodCache$MethodCacheEntry


        }
        return super.__unicode__();
    }

    public int __cmp__(PyObject other) {
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__cmp__");
        if (impl != null) {
            PyObject res = impl.__get__(this, self_type).__call__(other);
            if (res instanceof PyInteger) {
                int v = ((PyInteger) res).getValue();
                return v < 0 ? -1 : v > 0 ? 1 : 0;
View Full Code Here


        }
        return super.__cmp__(other);
    }

    public boolean __nonzero__() {
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__nonzero__");
        if (impl == null) {
            impl = self_type.lookup("__len__");
            if (impl == null)
                return super.__nonzero__();
        }
        return impl.__get__(this, self_type).__call__().__nonzero__();
    }
View Full Code Here

        }
        return impl.__get__(this, self_type).__call__().__nonzero__();
    }

    public boolean __contains__(PyObject o) {
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__contains__");
        if (impl == null)
            return super.__contains__(o);
        return impl.__get__(this, self_type).__call__(o).__nonzero__();
    }
View Full Code Here

            return super.__contains__(o);
        return impl.__get__(this, self_type).__call__(o).__nonzero__();
    }

    public int __len__() {
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__len__");
        if (impl != null) {
            PyObject res = impl.__get__(this, self_type).__call__();
            if (res instanceof PyInteger)
                return ((PyInteger) res).getValue();
            throw Py.TypeError("__len__ should return a int");
View Full Code Here

        }
        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__();
        return new PySequenceIter(this);
    }
View Full Code Here

            return super.__iter__();
        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

TOP

Related Classes of org.python.core.PyType$MethodCache$MethodCacheEntry

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.