Package org.python.core

Examples of org.python.core.PyTuple


    final PyObject baseset___reduce__() {
        String name = getType().getFullName();
        PyObject factory = __builtin__.__import__("setsfactory");
        PyObject func = factory.__getattr__(name);
        return new PyTuple(new PyObject[] { func, new PyTuple(new PyObject[] { new PyList((PyObject) this) }) });
    }
View Full Code Here


    private BigInteger getLength(InputStream inputStream) throws IOException {
        byte[] bytes = new byte[4];
        inputStream.read(bytes);
        String stHeader = new String(bytes, ISO_8859_1);
        PyTuple tuple = struct.unpack("!L", stHeader);
        return (BigInteger) tuple.get(0);
    }
View Full Code Here

    }

    private static class PythonToJava implements Function<Object, Metric> {
        @Override
        public Metric apply(Object pyObject) {
            PyTuple pyTuple = (PyTuple) pyObject;
            Metric metric = new Metric();
            metric.setName(pyTuple.get(0).toString());
            PyTuple data = ((PyTuple) pyTuple.get(1));
            metric.setTimestamp(new Date(((Number) data.get(0)).longValue() * 1000));
            metric.setValue(new BigDecimal(((Number) data.get(1)).doubleValue()));
            return metric;
        }
View Full Code Here

            throw exc;
        }
    }

    private static PyObject importModule(String name) {
        PyObject fromlist = new PyTuple(Py.newString("__doc__"));
        return __builtin__.__import__(name, null, null, fromlist);
    }
View Full Code Here

            PyObject[] result = new PyObject[attrs.length];
            int i = 0;
            for (PyObject attr : attrs) {
                result[i++] = getattr(obj, attr);
            }
            return new PyTuple(result);
        }
View Full Code Here

            PyObject[] result = new PyObject[items.length];
            int i = 0;
            for (PyObject item : items) {
                result[i++] = obj.__getitem__(item);
            }
            return new PyTuple(result);
        }
View Full Code Here

    final PyObject deque___reduce__() {
        PyObject dict = getDict();
        if (dict == null) {
            dict = Py.None;
        }
        return new PyTuple(getType(), Py.EmptyTuple, dict, __iter__());
    }
View Full Code Here

            PyObject module = object.__findattr__("__module__");
            if (module == null || module == Py.None)
                module = whichmodule(object, name);

            if(protocol >= 2) {
                PyTuple extKey = new PyTuple(module, name);
                PyObject extCode = extension_registry.get(extKey);
                if(extCode != Py.None) {
                    int code = ((PyInteger)extCode).getValue();
                    if(code <= 0xFF) {
                        file.write(EXT1);
View Full Code Here

        }
    }


    private static PyObject importModule(String name) {
        PyObject fromlist = new PyTuple(Py.newString("__doc__"));
        return __builtin__.__import__(name, Py.None, Py.None, fromlist);
    }
View Full Code Here

        return defaultdict___reduce__();
    }

    @ExposedMethod
    final PyObject defaultdict___reduce__() {
        PyTuple args = null;
        if (defaultFactory == Py.None) {
            args = new PyTuple();
        } else {
            PyObject[] ob = {defaultFactory};
            args = new PyTuple(ob);
        }
        return new PyTuple(getType(), args, Py.None, Py.None, iteritems());
    }
View Full Code Here

TOP

Related Classes of org.python.core.PyTuple

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.