Examples of ArgParser


Examples of org.python.core.ArgParser

        int argc = args.length - keywords.length;
        if (argc > 2) {
            throw Py.TypeError("register_dialect() expected at most 2 arguments, got " + argc);
        }

        ArgParser ap = parseArgs("register_dialect", args, keywords);
        PyObject name = ap.getPyObject(0);
        PyObject dialect = ap.getPyObject(1, null);

        if (!(name instanceof PyBaseString)) {
            throw Py.TypeError("dialect name must be a string or unicode");
        }
View Full Code Here

Examples of org.python.core.ArgParser

    public static PyObject list_dialects() {
        return _dialects.keys();
    }

    public static PyObject reader(PyObject[] args, String[] keywords) {
        ArgParser ap = parseArgs("reader", args, keywords);
        PyObject iterator = Py.iter(ap.getPyObject(0), "argument 1 must be an iterator");
        PyObject dialect = ap.getPyObject(1, null);
        return new PyReader(iterator, dialectFromKwargs(dialect, args, keywords));
    }
View Full Code Here

Examples of org.python.core.ArgParser

        PyObject dialect = ap.getPyObject(1, null);
        return new PyReader(iterator, dialectFromKwargs(dialect, args, keywords));
    }

    public static PyObject writer(PyObject[] args, String[] keywords) {
        ArgParser ap = parseArgs("writer", args, keywords);
        PyObject outputFile = ap.getPyObject(0);
        PyObject dialect = ap.getPyObject(1, null);

        PyObject writeline = outputFile.__findattr__("write");
        if (writeline == null || !writeline.isCallable()) {
            throw Py.TypeError("argument 1 must have a \"write\" method");
        }
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.