Package org.python.core

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


        }
    }

    public void __setattr__(String name, PyObject value) {
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__setattr__");
        if (impl != null) {
            impl.__get__(this, self_type).__call__(new PyString(name), value);
            return;
        }
        super.__setattr__(name, value);
View Full Code Here


        super.__setattr__(name, value);
    }

    public void __delattr__(String name) {
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__delattr__");
        if (impl != null) {
            impl.__get__(this, self_type).__call__(new PyString(name));
            return;
        }
        super.__delattr__(name);
View Full Code Here

        super.__delattr__(name);
    }

    public PyObject __get__(PyObject obj, PyObject type) {
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__get__");
        if (impl != null) {
            if (obj == null)
                obj = Py.None;
            if (type == null)
                type = Py.None;
View Full Code Here

        return super.__get__(obj, type);
    }

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

        super.__set__(obj, value);
    }

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

    }

    public void dispatch__init__(PyType type, PyObject[] args, String[] keywords) {
        PyType self_type = getType();
        if (self_type.isSubType(type)) {
            PyObject impl = self_type.lookup("__init__");
            if (impl != null)
                impl.__get__(this, self_type).__call__(args, keywords);
        }
    }
View Full Code Here

        return super.__iand__(other);
    }

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

        return super.__ior__(other);
    }

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

        return super.__ixor__(other);
    }

    public PyObject __int__() {
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__int__");
        if (impl != null) {
            PyObject res = impl.__get__(this, self_type).__call__();
            if (res instanceof PyInteger || res instanceof PyLong)
                return (PyObject) res;
            throw Py.TypeError("__int__" + " should return an integer");
View Full Code Here

        return super.__int__();
    }

    public String toString() {
        PyType self_type = getType();
        PyObject impl = self_type.lookup("__repr__");
        if (impl != null) {
            PyObject res = impl.__get__(this, self_type).__call__();
            if (!(res instanceof PyString))
                throw Py.TypeError("__repr__ should return a string");
            return ((PyString) res).toString();
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.