Package org.python.core

Examples of org.python.core.PyList


                    }
                    PyObject items[] = new PyObject[n];
                    for (int i = 0; i < n; i++) {
                        items[i] = read_object_notnull(depth + 1);
                    }
                    return new PyList(items);
                }

                case TYPE_DICT: {
                    PyDictionary d = new PyDictionary();
                    while (true) {
View Full Code Here


            }
            parse_process_char('\0');
        } while (state != ParserState.START_RECORD);

        fields = this.fields;
        this.fields = new PyList();

        return fields;
    }
View Full Code Here

                break;
        }
    }

    private void parse_reset() {
        fields = new PyList();
        state = ParserState.START_RECORD;
        numeric_field = false;
    }
View Full Code Here

        // module code may (directly or indirectly) import itself
        PyModule mod = imp.addModule(fullname);
        mod.__dict__.__setitem__("__loader__", this);
        if (moduleCodeData.isPackage) {
            // add __path__ to the module *before* the code gets executed
            PyList pkgpath = new PyList();
            pkgpath.add(makePackagePath(fullname));
            mod.__dict__.__setitem__("__path__", pkgpath);
        }
        imp.createFromCode(fullname, moduleCodeData.code, moduleCodeData.path);
        Py.writeDebug("import", "import " + fullname + " # loaded from " + moduleCodeData.path);
        return mod;
View Full Code Here

            }
            // tuples are immutable, so we can just use its underlying array
            return new PyTimeTuple(((PyTuple)obj).getArray());
        }
        else {
            PyList seq = new PyList(obj);
            if (seq.__len__() != 9) {
                throw Py.TypeError("time.struct_time() takes a 9-sequence (1-sequence given)");
            }       
            return new PyTimeTuple((PyObject[])seq.__tojava__(PyObject[].class));           
        }
    }
View Full Code Here

        PyTuple newargs = __getnewargs__();
        return new PyTuple(getType(), newargs);
    }

    public PyTuple __getnewargs__() {
        return new PyTuple(new PyList(getArray()));
    }
View Full Code Here

public abstract class PathPackageManager extends CachedJarsPackageManager {

    public PyList searchPath;

    public PathPackageManager() {
        this.searchPath = new PyList();
    }
View Full Code Here

     * Adds "classpath" entry. Calls {@link #addDirectory} if path refers to a
     * dir, {@link #addJarToPackages(java.io.File, boolean)} with param cache
     * true if path refers to a jar.
     */
    public void addClassPath(String path) {
        PyList paths = new PyString(path).split(java.io.File.pathSeparator);

        for (int i = 0; i < paths.__len__(); i++) {
            String entry = paths.pyget(i).toString();
            if (entry.endsWith(".jar") || entry.endsWith(".zip")) {
                addJarToPackages(new File(entry), true);
            } else {
                File dir = new File(entry);
                if (entry.length() == 0 || dir.isDirectory()) {
View Full Code Here

        }
    }

    public PyList doDir(PyJavaPackage jpkg, boolean instantiate,
            boolean exclpkgs) {
        PyList basic = basicDoDir(jpkg, instantiate, exclpkgs);
        PyList ret = new PyList();

        doDir(this.searchPath, ret, jpkg, instantiate, exclpkgs);

        return merge(basic, ret);
    }
View Full Code Here

        return Py.findClassEx(name, reason);
    }

    public PyList doDir(PyJavaPackage jpkg, boolean instantiate,
            boolean exclpkgs) {
        PyList basic = basicDoDir(jpkg, instantiate, exclpkgs);
        PyList ret = new PyList();

        doDir(this.searchPath, ret, jpkg, instantiate, exclpkgs);

        PySystemState system = Py.getSystemState();
View Full Code Here

TOP

Related Classes of org.python.core.PyList

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.