Package org.python.core

Examples of org.python.core.PyClass


        return processJythonType(valueStr, interpreter);
      }

      // user gave a PyClass, process as a Jython class
    } else if (valueFromUser instanceof PyClass) {
      PyClass userPyClass = (PyClass) valueFromUser;
      return processJythonType(userPyClass.__name__, interpreter);

      // user gave a PyType, process as Jython class
    } else if (valueFromUser instanceof PyType) {
      PyType userPyType = (PyType) valueFromUser;
View Full Code Here


                    PyJavaClass t = (PyJavaClass) pE.type;
                    if (t.__name__ != null && t.__name__.equals("org.python.pydev.jython.ExitScriptException")) {
                        return null;
                    }
                } else if (pE.type instanceof PyClass) {
                    PyClass t = (PyClass) pE.type;
                    if (t.__name__ != null && t.__name__.equals("SystemExit")) {
                        return null;
                    }
                }
            }
View Full Code Here

            }
        }


        final private void save_inst(PyInstance object) {
            PyClass cls = object.instclass;

            PySequence args = null;
            PyObject getinitargs = object.__findattr__("__getinitargs__");
            if (getinitargs != null) {
                args = (PySequence)getinitargs.__call__();
                // XXX Assert it's a sequence
                keep_alive(args);
            }

            file.write(MARK);
            if (protocol > 0)
                save(cls);

            if (args != null) {
                int len = args.__len__();
                for (int i = 0; i < len; i++)
                    save(args.__finditem__(i));
            }

            int mid = putMemo(get_id(object), object);
            if (protocol > 0) {
                file.write(OBJ);
                put(mid);
            } else {
                file.write(INST);
                file.write(cls.__findattr__("__module__").toString());
                file.write("\n");
                file.write(cls.__name__);
                file.write("\n");
                put(mid);
            }
View Full Code Here

                    } catch (ClassCastException e) {
                        UserMessages.showError("Incorrect file version");
                    } catch (OutOfMemoryError e) {
                        UserMessages.showError("Out of memory loading file");
                    } catch (org.python.core.PyException e) {
                        PyClass pyClass = (PyClass) e.type;
                        String value = e.value.toString();
                        if (pyClass.__name__.equals("ImportError")) {
                            if (value.equals("no module named main")) {
                                UserMessages.showError("Error: this file was "
                                        + "built using Python class definitions that "
View Full Code Here

TOP

Related Classes of org.python.core.PyClass

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.