Examples of PyInteger


Examples of org.python.core.PyInteger

        if (cause instanceof PySyntaxError) {
            // set a clear syntax error message
            PySyntaxError syntaxError = (PySyntaxError) cause;
            try {
                PyString fileName, text;
                PyInteger lineNumber, columnNumber;
                if (syntaxError.value instanceof PyTuple) {
                    PyObject[] infos = ((PyTuple) ((PyTuple) syntaxError.value).getArray()[1]).getArray();
                    fileName = (PyString) infos[0];
                    lineNumber = (PyInteger) infos[1];
                    columnNumber = (PyInteger) infos[2];
                    text = (PyString) infos[3];
                } else {
                    fileName = (PyString) syntaxError.value.__getattr__(new PyString("filename"));
                    lineNumber = (PyInteger) syntaxError.value.__getattr__(new PyString("lineno"));
                    columnNumber = (PyInteger) syntaxError.value.__getattr__(new PyString("offset"));
                    text = (PyString) syntaxError.value.__getattr__(new PyString("text"));
                    message = "Python syntax error in file " + fileName + " at line " + lineNumber + ", column " + columnNumber + ":\n" + text;

                }
                message = "Python syntax error in file " + fileName + " at line " + lineNumber + ", column " + columnNumber + ":\n" + text;
                result.addStackTraceElement(new StackTraceElement("", "", fileName.toString(), Integer.parseInt(lineNumber.toString())));
                dumpStack = false;
            } catch (PyException pye) {
                message = "Python syntax error (Couldn't decode localization of error)";
            }
        } else if (cause instanceof PyException) {
View Full Code Here

Examples of org.python.core.PyInteger

                if (e.match(Py.SystemExit)) {
                    PyObject value = e.value;
                    if (PyException.isExceptionInstance(e.value)) {
                        value = value.__findattr__("code");
                    }
                    if (new  PyInteger(0).equals(value)) {
                        LOG.info("Script invoked sys.exit(0)");
                        return;
                    }
                }
                String message = "Python Error. " + e;
View Full Code Here

Examples of org.python.core.PyInteger

                if (e.match(Py.SystemExit)) {
                    PyObject value = e.value;
                    if (PyException.isExceptionInstance(e.value)) {
                        value = value.__findattr__("code");
                    }
                    if (new  PyInteger(0).equals(value)) {
                        LOG.info("Script invoked sys.exit(0)");
                        return;
                    }
                }
                String message = "Python Error. " + e;
View Full Code Here

Examples of org.python.core.PyInteger

                if (e.match(Py.SystemExit)) {
                    PyObject value = e.value;
                    if (PyException.isExceptionInstance(e.value)) {
                        value = value.__findattr__("code");
                    }
                    if (new  PyInteger(0).equals(value)) {
                        LOG.info("Script invoked sys.exit(0)");
                        return;
                    }
                }
                String message = "Python Error. " + e;
View Full Code Here

Examples of org.python.core.PyInteger

                    value = value.substring(1, value.length() - 1);
                    pyValue = new PyString(value);
                } else {
                    try {
                        int v = Integer.parseInt(value);
                        pyValue = new PyInteger(v);
                    } catch (NumberFormatException e) {
                        try {
                            double v = Double.parseDouble(value);
                            pyValue = new PyFloat(v);
                        } catch (NumberFormatException e1) {
View Full Code Here

Examples of org.python.core.PyInteger

                if (e.match(Py.SystemExit)) {
                    PyObject value = e.value;
                    if (PyException.isExceptionInstance(e.value)) {
                        value = value.__findattr__("code");
                    }
                    if (new  PyInteger(0).equals(value)) {
                        LOG.info("Script invoked sys.exit(0)");
                        return;
                    }
                }
                String message = "Python Error. " + e;
View Full Code Here

Examples of org.python.core.PyInteger

      value = column.getInt();
    } else {
      throw new IllegalArgumentException(
          "Column is not a byte/short/int, is " + column.hiveType());
    }
    return new PyInteger(value);
  }
View Full Code Here

Examples of org.python.core.PyInteger

                if (e.match(Py.SystemExit)) {
                    PyObject value = e.value;
                    if (PyException.isExceptionInstance(e.value)) {
                        value = value.__findattr__("code");
                    }
                    if (new  PyInteger(0).equals(value)) {
                        LOG.info("Script invoked sys.exit(0)");
                        return;
                    }
                }
                String message = "Python Error. " + e;
View Full Code Here

Examples of org.python.core.PyInteger

        int dow = cal.get(Calendar.DAY_OF_WEEK) - 2;
        if (dow < 0)
            dow = dow + 7;
        // TBD: is this date dst?
        boolean isdst = tz.inDaylightTime(cal.getTime());
        return new PyTimeTuple(new PyObject[] { new PyInteger(cal.get(Calendar.YEAR)),
                new PyInteger(cal.get(Calendar.MONTH) + 1), new PyInteger(cal.get(Calendar.DAY_OF_MONTH)),
                new PyInteger(cal.get(Calendar.HOUR) + 12 * cal.get(Calendar.AM_PM)),
                new PyInteger(cal.get(Calendar.MINUTE)), new PyInteger(cal.get(Calendar.SECOND)), new PyInteger(dow),
                new PyInteger(cal.get(Calendar.DAY_OF_YEAR)), new PyInteger(isdst ? 1 : 0) });
    }
View Full Code Here

Examples of org.python.core.PyInteger

        public NumberToPyInteger(Class c) {
            super(c);
        }

        public PyObject adapt(Object o) {
            return new PyInteger(((Number) o).intValue());
        }
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.