Examples of ArgParser


Examples of org.python.core.ArgParser

        return weakref___call__(args, keywords);
    }

    @ExposedMethod
    final PyObject weakref___call__(PyObject args[], String keywords[]) {
        new ArgParser("__call__", args, keywords, Py.NoKeywords, 0);
        return Py.java2py(gref.get());
    }
View Full Code Here

Examples of org.python.core.ArgParser

    @ExposedNew
    public static PyObject StructLayout_new(PyNewWrapper new_, boolean init, PyType subtype,
            PyObject[] args, String[] keywords) {

        ArgParser ap = new ArgParser("__init__", args, keywords, new String[] { "fields", "union" }, 1);

        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;
        }

        return StructUtil.newStructLayout(fields, ap.getPyObject(1, Py.False).__nonzero__());
    }
View Full Code Here

Examples of org.python.core.ArgParser

        }

        @ExposedNew
        final static PyObject attrgetter___new__(PyNewWrapper new_, boolean init, PyType subtype,
                                                 PyObject[] args, String[] keywords) {
            ArgParser ap = new ArgParser("attrgetter", args, keywords, "attr");
            ap.noKeywords();
            ap.getPyObject(0);
            return new PyAttrGetter(args);
        }
View Full Code Here

Examples of org.python.core.ArgParser

            return attrgetter___call__(args, keywords);
        }

        @ExposedMethod
        final PyObject attrgetter___call__(PyObject[] args, String[] keywords) {
            ArgParser ap = new ArgParser("attrgetter", args, Py.NoKeywords, "obj");
            PyObject obj = ap.getPyObject(0);

            if (attrs.length == 1) {
                return getattr(obj, attrs[0]);
            }
View Full Code Here

Examples of org.python.core.ArgParser

        }

        @ExposedNew
        public static PyObject ScalarField_new(PyNewWrapper new_, boolean init, PyType subtype,
            PyObject[] args, String[] keywords) {
            ArgParser ap = new ArgParser("__init__", args, keywords, new String[] { "name", "type", "offset"});

            return new ScalarField(ap.getPyObject(0), CType.typeOf(ap.getPyObject(1)), ap.getInt(2));
        }
View Full Code Here

Examples of org.python.core.ArgParser

        }

        @ExposedNew
        final static PyObject itemgetter___new__(PyNewWrapper new_, boolean init, PyType subtype,
                                                 PyObject[] args, String[] keywords) {
            ArgParser ap = new ArgParser("itemgetter", args, keywords, "attr");
            ap.noKeywords();
            ap.getPyObject(0);
            return new PyItemGetter(args);
        }
View Full Code Here

Examples of org.python.core.ArgParser

            return itemgetter___call__(args, keywords);
        }

        @ExposedMethod
        final PyObject itemgetter___call__(PyObject[] args, String[] keywords) {
            ArgParser ap = new ArgParser("itemgetter", args, Py.NoKeywords, "obj");
            PyObject obj = ap.getPyObject(0);

            if (items.length == 1) {
                return obj.__getitem__(items[0]);
            }
View Full Code Here

Examples of org.python.core.ArgParser

        this(TYPE);
    }
    @ExposedNew
    @ExposedMethod
    public void Global___init__(PyObject[] args, String[] keywords) {
        ArgParser ap = new ArgParser("Global", args, keywords, new String[]
            {"names", "lineno", "col_offset"}, 1, true);
        setNames(ap.getPyObject(0, Py.None));
        int lin = ap.getInt(1, -1);
        if (lin != -1) {
            setLineno(lin);
        }

        int col = ap.getInt(2, -1);
        if (col != -1) {
            setLineno(col);
        }

    }
View Full Code Here

Examples of org.python.core.ArgParser

        this(TYPE);
    }
    @ExposedNew
    @ExposedMethod
    public void GeneratorExp___init__(PyObject[] args, String[] keywords) {
        ArgParser ap = new ArgParser("GeneratorExp", args, keywords, new String[]
            {"elt", "generators", "lineno", "col_offset"}, 2, true);
        setElt(ap.getPyObject(0, Py.None));
        setGenerators(ap.getPyObject(1, Py.None));
        int lin = ap.getInt(2, -1);
        if (lin != -1) {
            setLineno(lin);
        }

        int col = ap.getInt(3, -1);
        if (col != -1) {
            setLineno(col);
        }

    }
View Full Code Here

Examples of org.python.core.ArgParser

    }

    @ExposedNew
    final static PyObject Dialect___new__(PyNewWrapper new_, boolean init, PyType subtype,
                                          PyObject[] args, String[] keywords) {
        ArgParser ap = new ArgParser("__new__", args, keywords,
                                     new String[] {"dialect", "delimiter", "doublequote",
                                                   "escapechar", "lineterminator", "quotechar",
                                                   "quoting", "skipinitialspace", "strict"});
        PyObject dialect = ap.getPyObject(0, null);
        PyObject delimiter = ap.getPyObject(1, null);
        PyObject doublequote = ap.getPyObject(2, null);
        PyObject escapechar = ap.getPyObject(3, null);
        PyObject lineterminator = ap.getPyObject(4, null);
        PyObject quotechar = ap.getPyObject(5, null);
        PyObject quoting = ap.getPyObject(6, null);
        PyObject skipinitialspace = ap.getPyObject(7, null);
        PyObject strict = ap.getPyObject(8, null);

        if (dialect instanceof PyString) {
            dialect = _csv.get_dialect_from_registry(dialect);
        }
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.