Package org.python.core

Examples of org.python.core.PyList


        this.restype = restype;
    }

    @ExposedGet(name = "argtypes")
    public PyObject getArgTypes() {
        return new PyList(argtypes != null ? argtypes : new PyObject[0]);
    }
View Full Code Here


        if (!(ap.getPyObject(0) instanceof PyList)) {
            throw Py.TypeError("expected list of jffi.StructLayout.Field");
        }

        PyList pyFields = (PyList) ap.getPyObject(0);
        Field[] fields = new Field[pyFields.size()];

        for (int i = 0; i < fields.length; ++i) {
            PyObject pyField = pyFields.pyget(i);
            if (!(pyField instanceof Field)) {
                throw Py.TypeError(String.format("element %d of field list is not an instance of jffi.StructLayout.Field", i));
            }
           
            fields[i] = (Field) pyField;
View Full Code Here

                references.remove(i);
            } else {
                list.add(r);
            }
        }
        return new PyList(list);
    }
View Full Code Here

     * @param object a PyObject
     * @return a PyList of references. may be empty
     */
    public static PyList getRefs(PyObject object) {
        GlobalRef ref = objects.get(new GlobalRef(object));
        return ref == null ? new PyList() : ref.refs();
    }
View Full Code Here

         * normally not be used unless someone tries to deepcopy
         * the memo itself...
         */
        final private void keep_alive(PyObject obj) {
            int id = System.identityHashCode(memo);
            PyList list = (PyList) memo.findValue(id, memo);
            if (list == null) {
                list = new PyList();
                memo.put(id, -1, list);
            }
            list.append(obj);
        }
View Full Code Here

        return Py.java2py(engine);
    }

    @ExposedMethod
    public PyObject scope_keys() {
        PyList members = new PyList();
        List<Integer> scopes = context.getScopes();
        for (int scope : scopes) {
            Bindings bindings = context.getBindings(scope);
            if (bindings == null)
                continue;
            for (String key : bindings.keySet())
                members.append(new PyString(key));
        }
        members.sort();
        return members;
    }
View Full Code Here

            }
            push(new PyTuple(data));
        }

        final private void load_empty_list() {
            push(new PyList(Py.EmptyObjects));
        }
View Full Code Here

        final private void load_list() {
            PyObject[] arr = new PyObject[marker()];
            pop(arr);
            pop();
            push(new PyList(arr));
        }
View Full Code Here

    public DBSink(PyConnection connection, Class dataHandler, String tableName, PyObject exclude, PyObject bindings, int batchsize) {

        super(connection, dataHandler, tableName);

        this.sql = Py.None;
        this.rows = new PyList();
        this.bindings = bindings;
        this.batchsize = batchsize;
        this.exclude = new HashSet();
        this.indexedBindings = new PyDictionary();
View Full Code Here

                if (len % this.batchsize == 0) {
                    this.cursor.execute(this.sql, this.rows, this.indexedBindings, Py.None);
                    this.connection.commit();

                    this.rows = new PyList();
                }
            }
        } else {
            this.createSql(row);
        }
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.