org.python.core

Class Py

public final class Py extends Object

Field Summary
static PyObjectArithmeticError
static PyObjectAssertionError
static PyObjectAttributeError
static intCOMMENT
static PySystemStatedefaultSystemState
static PyObjectDeprecationWarning
static intDEBUG
static PyObjectEllipsis
The singleton Ellipsis Python object - written as ... when indexing
static PyObject[]EmptyObjects
A zero-length array of PyObject's to pass to functions that expect zero-arguments *
static PyStringEmptyString
A zero-length Python string *
static PyTupleEmptyTuple
A tuple with zero elements *
static PyObjectEnvironmentError
static PyObjectEOFError
static intERROR
static PyObjectException
static PyObjectFloatingPointError
static PyObjectImportError
static PyObjectIndentationError
static PyObjectIndexError
static PyObjectIOError
static PyObjectJavaError
static PyObjectKeyboardInterrupt
static PyObjectKeyError
static PyObjectLookupError
static PyObjectMemoryError
static intMESSAGE
static PyObjectNameError
static PyStringNewline
A Python string containing '\n' *
static ObjectNoConversion
A unique object to indicate no conversion is possible in __tojava__ methods *
static String[]NoKeywords
A zero-length array of Strings to pass to functions that don't have any keyword arguments *
static PyObjectNone
The singleton None Python object *
static PyObjectNotImplemented
The singleton NotImplemented Python object.
static PyObjectNotImplementedError
static PyIntegerOne
The Python integer 1 - also used as true *
static PyObjectOSError
static PyObjectOverflowError
static PyObjectOverflowWarning
static PyObjectReferenceError
static PyObjectRuntimeError
static PyObjectRuntimeWarning
static StdoutWrapperstderr
static PyStringSpace
A Python string containing ' ' *
static PyObjectStandardError
static PyObjectStopIteration
static PyObjectSyntaxError
static PyObjectSyntaxWarning
static PyObjectSystemError
static PyObjectSystemExit
static PyObjectTabError
static PyObjectTypeError
static PyObjectUnboundLocalError
static PyObjectUnicodeError
static PyObjectUserWarning
static PyObjectValueError
static intWARNING
static PyObjectWarning
static PyIntegerZero
The Python integer 0 - also used as false *
static PyObjectZeroDivisionError
Method Summary
static PyExceptionAssertionError(String message)
static PyExceptionAttributeError(String message)
static voidaddTraceback(Throwable t, PyFrame frame)
static voidassert_(PyObject test, PyObject message)
static voidassert_(PyObject test)
static PyCodecompile(modType node, String filename)
static PyCodecompile(modType node, String name, String filename)
static PyCodecompile(modType node, String name, String filename, boolean linenumbers, boolean printResults)
static PyCodecompile(InputStream istream, String filename, String type)
static PyObjectcompile_command_flags(String string, String filename, String kind, CompilerFlags cflags, boolean stdprompt)
static PyCodecompile_flags(modType node, String name, String filename, boolean linenumbers, boolean printResults, CompilerFlags cflags)
static PyCodecompile_flags(InputStream istream, String filename, String type, CompilerFlags cflags)
static PyCodecompile_flags(String data, String filename, String type, CompilerFlags cflags)
static voiddisplayException(PyObject type, PyObject value, PyObject tb, PyObject file)
static voidDeprecationWarning(String message)
static voidexec(PyObject o, PyObject globals, PyObject locals)
static PyExceptionEOFError(String message)
static ClassfindClass(String name)
static ClassfindClassEx(String name, String reason)
static PyExceptionFloatingPointError(String message)
static CompilerFlagsgetCompilerFlags()
static CompilerFlagsgetCompilerFlags(int flags, boolean dont_inherit)
static PyFramegetFrame()
static StringgetName()
static PySystemStategetSystemState()
static ThreadStategetThreadState()
static ThreadStategetThreadState(PySystemState newSystemState)
static longid(PyObject o)
static Stringidstr(PyObject o)
static voidinitProxy(PyProxy proxy, String module, String pyclass, Object[] args, String[] packages, String[] props, boolean frozen)
static voidinitProxy(PyProxy proxy, String module, String pyclass, Object[] args, String[] packages, String[] props, String frozenPackage, String[] modules)
static booleaninitPython()
static voidinitRunnable(String module, PyObject dict)
static booleanisInstance(PyObject obj, PyObject cls)
static booleanisSubClass(PyObject derived, PyObject cls)
static PyObjectiter(PyObject seq, String message)
static PyExceptionImportError(String message)
static PyExceptionIndexError(String message)
static PyExceptionIOError(IOException ioe)
static PyExceptionIOError(String message)
static PyObjectjava2py(Object o)
static longjava_obj_id(Object o)
static PyObjectjfindattr(PyProxy proxy, String name)
static PyObjectjgetattr(PyProxy proxy, String name)
static PyExceptionJavaError(Throwable t)
static PyExceptionKeyError(String message)
static PyObjectmakeClass(String name, PyObject[] bases, PyCode code, PyObject doc)
static PyObjectmakeClass(String name, PyObject[] bases, PyCode code, PyObject doc, PyObject[] closure_cells)
static PyObjectmakeClass(String name, PyObject[] bases, PyCode code, PyObject doc, Class proxyClass)
static PyObjectmakeClass(String name, PyObject[] bases, PyCode code, PyObject doc, Class proxyClass, PyObject[] closure_cells)
static PyExceptionmakeException()
static PyExceptionmakeException(PyObject type)
static PyExceptionmakeException(PyObject type, PyObject value)
static PyExceptionmakeException(PyObject type, PyObject value, PyObject traceback)
static booleanmatchException(PyException pye, PyObject e)
static voidmaybeWrite(String type, String msg, int level)
static voidmemory_error(OutOfMemoryError t)
static PyExceptionMemoryError(String message)
static PyIntegernewBoolean(boolean t)
static PyCodenewCode(int argcount, String[] varnames, String filename, String name, boolean args, boolean keywords, PyFunctionTable funcs, int func_id, String[] cellvars, String[] freevars, int npurecell, int moreflags)
static PyCodenewCode(int argcount, String[] varnames, String filename, String name, int firstlineno, boolean args, boolean keywords, PyFunctionTable funcs, int func_id, String[] cellvars, String[] freevars, int npurecell, int moreflags)
static PyCodenewCode(int argcount, String[] varnames, String filename, String name, boolean args, boolean keywords, PyFunctionTable funcs, int func_id)
static PyCodenewCode(int argcount, String[] varnames, String filename, String name, int firstlineno, boolean args, boolean keywords, PyFunctionTable funcs, int func_id)
static PyFloatnewFloat(float v)
static PyFloatnewFloat(double v)
static PyComplexnewImaginary(double v)
static PyIntegernewInteger(int i)
static PyObjectnewInteger(long i)
static PyCodenewJavaCode(Class cls, String name)
static PyObjectnewJavaFunc(Class cls, String name)
static PyLongnewLong(String s)
static PyLongnewLong(BigInteger i)
static PyLongnewLong(int i)
static PyStringnewString(char c)
static PyStringnewString(String s)
static PyUnicodenewUnicode(char c)
static PyUnicodenewUnicode(String s)
static PyExceptionNameError(String message)
static PyExceptionOverflowError(String message)
static voidOverflowWarning(String message)
static voidprint(PyObject file, PyObject o)
static voidprint(PyObject o)
static voidprintComma(PyObject file, PyObject o)
static voidprintComma(PyObject o)
static voidprintException(Throwable t)
static voidprintException(Throwable t, PyFrame f)
static voidprintException(Throwable t, PyFrame f, PyObject file)
static voidprintln(PyObject file, PyObject o)
static voidprintln(PyObject o)
static voidprintln()
static voidprintlnv(PyObject file)
static voidprintResult(PyObject ret)
static booleanpy2boolean(PyObject o)
static bytepy2byte(PyObject o)
static charpy2char(PyObject o)
static charpy2char(PyObject o, String msg)
static doublepy2double(PyObject o)
static floatpy2float(PyObject o)
static intpy2int(PyObject o)
static intpy2int(PyObject o, String msg)
static longpy2long(PyObject o)
static shortpy2short(PyObject o)
static voidpy2void(PyObject o)
static ClassrelFindClass(Class home, String name)
static PyObjectrunCode(PyCode code, PyObject locals, PyObject globals)
static voidrunMain(Class mainClass, String[] args, String[] packages, String[] props, String frozenPackage, String[] modules)
static PyExceptionReferenceError(String message)
static PyExceptionRuntimeError(String message)
static voidRuntimeWarning(String message)
static StringsafeRepr(PyObject o)
static voidsaveClassFile(String name, ByteArrayOutputStream bytestream)
static PyExceptionsetException(Throwable t, PyFrame frame)
static voidsetFrame(PyFrame f)
static PySystemStatesetSystemState(PySystemState newSystemState)
static PyExceptionStopIteration(String message)
static PyExceptionSyntaxError(String message)
static voidSyntaxWarning(String message)
static PyExceptionSystemError(String message)
static Objecttojava(PyObject o, Class c)
Convert a given PyObject to an instance of a Java class.
static Objecttojava(PyObject o, String s)
static PyExceptionTypeError(String message)
static PyObject[]unpackSequence(PyObject o, int length)
static PyExceptionUnboundLocalError(String message)
static PyExceptionUnicodeError(String message)
static voidUserWarning(String message)
static PyExceptionValueError(String message)
static voidwarning(PyObject category, String message)
static voidwarning(PyObject category, String message, String filename, int lineno, String module, PyObject registry)
static voidwriteComment(String type, String msg)
static voidwriteDebug(String type, String msg)
static voidwriteError(String type, String msg)
static voidwriteMessage(String type, String msg)
static voidwriteWarning(String type, String msg)
static voidWarning(String message)
static PyExceptionZeroDivisionError(String message)

Field Detail

ArithmeticError

public static PyObject ArithmeticError

AssertionError

public static PyObject AssertionError

AttributeError

public static PyObject AttributeError

COMMENT

public static final int COMMENT

defaultSystemState

public static PySystemState defaultSystemState

DeprecationWarning

public static PyObject DeprecationWarning

DEBUG

public static final int DEBUG

Ellipsis

public static PyObject Ellipsis
The singleton Ellipsis Python object - written as ... when indexing

EmptyObjects

public static PyObject[] EmptyObjects
A zero-length array of PyObject's to pass to functions that expect zero-arguments *

EmptyString

public static PyString EmptyString
A zero-length Python string *

EmptyTuple

public static PyTuple EmptyTuple
A tuple with zero elements *

EnvironmentError

public static PyObject EnvironmentError

EOFError

public static PyObject EOFError

ERROR

public static final int ERROR

Exception

public static PyObject Exception

FloatingPointError

public static PyObject FloatingPointError

ImportError

public static PyObject ImportError

IndentationError

public static PyObject IndentationError

IndexError

public static PyObject IndexError

IOError

public static PyObject IOError

JavaError

public static PyObject JavaError

KeyboardInterrupt

public static PyObject KeyboardInterrupt

KeyError

public static PyObject KeyError

LookupError

public static PyObject LookupError

MemoryError

public static PyObject MemoryError

MESSAGE

public static final int MESSAGE

NameError

public static PyObject NameError

Newline

public static PyString Newline
A Python string containing '\n' *

NoConversion

public static Object NoConversion
A unique object to indicate no conversion is possible in __tojava__ methods *

NoKeywords

public static String[] NoKeywords
A zero-length array of Strings to pass to functions that don't have any keyword arguments *

None

public static PyObject None
The singleton None Python object *

NotImplemented

public static PyObject NotImplemented
The singleton NotImplemented Python object. Used in rich comparison

NotImplementedError

public static PyObject NotImplementedError

One

public static PyInteger One
The Python integer 1 - also used as true *

OSError

public static PyObject OSError

OverflowError

public static PyObject OverflowError

OverflowWarning

public static PyObject OverflowWarning

ReferenceError

public static PyObject ReferenceError

RuntimeError

public static PyObject RuntimeError

RuntimeWarning

public static PyObject RuntimeWarning

stderr

public static StdoutWrapper stderr

Space

public static PyString Space
A Python string containing ' ' *

StandardError

public static PyObject StandardError

StopIteration

public static PyObject StopIteration

SyntaxError

public static PyObject SyntaxError

SyntaxWarning

public static PyObject SyntaxWarning

SystemError

public static PyObject SystemError

SystemExit

public static PyObject SystemExit

TabError

public static PyObject TabError

TypeError

public static PyObject TypeError

UnboundLocalError

public static PyObject UnboundLocalError

UnicodeError

public static PyObject UnicodeError

UserWarning

public static PyObject UserWarning

ValueError

public static PyObject ValueError

WARNING

public static final int WARNING

Warning

public static PyObject Warning

Zero

public static PyInteger Zero
The Python integer 0 - also used as false *

ZeroDivisionError

public static PyObject ZeroDivisionError

Method Detail

AssertionError

public static PyException AssertionError(String message)

AttributeError

public static PyException AttributeError(String message)

addTraceback

public static void addTraceback(Throwable t, PyFrame frame)

assert_

public static void assert_(PyObject test, PyObject message)

assert_

public static void assert_(PyObject test)

compile

public static PyCode compile(modType node, String filename)

compile

public static PyCode compile(modType node, String name, String filename)

compile

public static PyCode compile(modType node, String name, String filename, boolean linenumbers, boolean printResults)

compile

public static PyCode compile(InputStream istream, String filename, String type)

compile_command_flags

public static PyObject compile_command_flags(String string, String filename, String kind, CompilerFlags cflags, boolean stdprompt)

compile_flags

public static PyCode compile_flags(modType node, String name, String filename, boolean linenumbers, boolean printResults, CompilerFlags cflags)

compile_flags

public static PyCode compile_flags(InputStream istream, String filename, String type, CompilerFlags cflags)

compile_flags

public static PyCode compile_flags(String data, String filename, String type, CompilerFlags cflags)

displayException

public static void displayException(PyObject type, PyObject value, PyObject tb, PyObject file)

DeprecationWarning

public static void DeprecationWarning(String message)

exec

public static void exec(PyObject o, PyObject globals, PyObject locals)

EOFError

public static PyException EOFError(String message)

findClass

public static Class findClass(String name)

findClassEx

public static Class findClassEx(String name, String reason)

FloatingPointError

public static PyException FloatingPointError(String message)

getCompilerFlags

public static CompilerFlags getCompilerFlags()

getCompilerFlags

public static CompilerFlags getCompilerFlags(int flags, boolean dont_inherit)

getFrame

public static PyFrame getFrame()

getName

public static String getName()

getSystemState

public static final PySystemState getSystemState()

getThreadState

public static final ThreadState getThreadState()

getThreadState

public static final ThreadState getThreadState(PySystemState newSystemState)

id

public static long id(PyObject o)

idstr

public static String idstr(PyObject o)

initProxy

public static void initProxy(PyProxy proxy, String module, String pyclass, Object[] args, String[] packages, String[] props, boolean frozen)

initProxy

public static void initProxy(PyProxy proxy, String module, String pyclass, Object[] args, String[] packages, String[] props, String frozenPackage, String[] modules)

initPython

public static boolean initPython()

initRunnable

public static void initRunnable(String module, PyObject dict)

isInstance

public static boolean isInstance(PyObject obj, PyObject cls)

isSubClass

public static boolean isSubClass(PyObject derived, PyObject cls)

iter

public static PyObject iter(PyObject seq, String message)

ImportError

public static PyException ImportError(String message)

IndexError

public static PyException IndexError(String message)

IOError

public static PyException IOError(IOException ioe)

IOError

public static PyException IOError(String message)

java2py

public static PyObject java2py(Object o)

java_obj_id

public static long java_obj_id(Object o)

jfindattr

public static PyObject jfindattr(PyProxy proxy, String name)

Deprecated:

jgetattr

public static PyObject jgetattr(PyProxy proxy, String name)

Deprecated:

JavaError

public static PyException JavaError(Throwable t)

KeyError

public static PyException KeyError(String message)

makeClass

public static PyObject makeClass(String name, PyObject[] bases, PyCode code, PyObject doc)

makeClass

public static PyObject makeClass(String name, PyObject[] bases, PyCode code, PyObject doc, PyObject[] closure_cells)

makeClass

public static PyObject makeClass(String name, PyObject[] bases, PyCode code, PyObject doc, Class proxyClass)

makeClass

public static PyObject makeClass(String name, PyObject[] bases, PyCode code, PyObject doc, Class proxyClass, PyObject[] closure_cells)

makeException

public static PyException makeException()

makeException

public static PyException makeException(PyObject type)

makeException

public static PyException makeException(PyObject type, PyObject value)

makeException

public static PyException makeException(PyObject type, PyObject value, PyObject traceback)

matchException

public static boolean matchException(PyException pye, PyObject e)

maybeWrite

public static void maybeWrite(String type, String msg, int level)

memory_error

public static void memory_error(OutOfMemoryError t)

MemoryError

public static PyException MemoryError(String message)

newBoolean

public static PyInteger newBoolean(boolean t)

newCode

public static PyCode newCode(int argcount, String[] varnames, String filename, String name, boolean args, boolean keywords, PyFunctionTable funcs, int func_id, String[] cellvars, String[] freevars, int npurecell, int moreflags)

newCode

public static PyCode newCode(int argcount, String[] varnames, String filename, String name, int firstlineno, boolean args, boolean keywords, PyFunctionTable funcs, int func_id, String[] cellvars, String[] freevars, int npurecell, int moreflags)

newCode

public static PyCode newCode(int argcount, String[] varnames, String filename, String name, boolean args, boolean keywords, PyFunctionTable funcs, int func_id)

newCode

public static PyCode newCode(int argcount, String[] varnames, String filename, String name, int firstlineno, boolean args, boolean keywords, PyFunctionTable funcs, int func_id)

newFloat

public static PyFloat newFloat(float v)

newFloat

public static PyFloat newFloat(double v)

newImaginary

public static PyComplex newImaginary(double v)

newInteger

public static final PyInteger newInteger(int i)

newInteger

public static PyObject newInteger(long i)

newJavaCode

public static PyCode newJavaCode(Class cls, String name)

newJavaFunc

public static PyObject newJavaFunc(Class cls, String name)

newLong

public static PyLong newLong(String s)

newLong

public static PyLong newLong(BigInteger i)

newLong

public static PyLong newLong(int i)

newString

public static PyString newString(char c)

newString

public static PyString newString(String s)

newUnicode

public static PyUnicode newUnicode(char c)

newUnicode

public static PyUnicode newUnicode(String s)

NameError

public static PyException NameError(String message)

OverflowError

public static PyException OverflowError(String message)

OverflowWarning

public static void OverflowWarning(String message)

print

public static void print(PyObject file, PyObject o)

print

public static void print(PyObject o)

printComma

public static void printComma(PyObject file, PyObject o)

printComma

public static void printComma(PyObject o)

printException

public static void printException(Throwable t)

printException

public static void printException(Throwable t, PyFrame f)

printException

public static void printException(Throwable t, PyFrame f, PyObject file)

println

public static void println(PyObject file, PyObject o)

println

public static void println(PyObject o)

println

public static void println()

printlnv

public static void printlnv(PyObject file)

printResult

public static void printResult(PyObject ret)

py2boolean

public static boolean py2boolean(PyObject o)

py2byte

public static byte py2byte(PyObject o)

py2char

public static char py2char(PyObject o)

py2char

public static char py2char(PyObject o, String msg)

py2double

public static double py2double(PyObject o)

py2float

public static float py2float(PyObject o)

py2int

public static int py2int(PyObject o)

py2int

public static int py2int(PyObject o, String msg)

py2long

public static long py2long(PyObject o)

py2short

public static short py2short(PyObject o)

py2void

public static void py2void(PyObject o)

relFindClass

public static Class relFindClass(Class home, String name)

runCode

public static PyObject runCode(PyCode code, PyObject locals, PyObject globals)

runMain

public static void runMain(Class mainClass, String[] args, String[] packages, String[] props, String frozenPackage, String[] modules)

ReferenceError

public static PyException ReferenceError(String message)

RuntimeError

public static PyException RuntimeError(String message)

RuntimeWarning

public static void RuntimeWarning(String message)

safeRepr

public static String safeRepr(PyObject o)

saveClassFile

public static void saveClassFile(String name, ByteArrayOutputStream bytestream)

setException

public static PyException setException(Throwable t, PyFrame frame)

setFrame

public static void setFrame(PyFrame f)

setSystemState

public static final PySystemState setSystemState(PySystemState newSystemState)

StopIteration

public static PyException StopIteration(String message)

SyntaxError

public static PyException SyntaxError(String message)

SyntaxWarning

public static void SyntaxWarning(String message)

SystemError

public static PyException SystemError(String message)

tojava

public static Object tojava(PyObject o, Class c)
Convert a given PyObject to an instance of a Java class. Identical to o.__tojava__(c) except that it will raise a TypeError if the conversion fails.

Parameters: o the PyObject to convert. c the class to convert it to.

tojava

public static Object tojava(PyObject o, String s)

TypeError

public static PyException TypeError(String message)

unpackSequence

public static PyObject[] unpackSequence(PyObject o, int length)

UnboundLocalError

public static PyException UnboundLocalError(String message)

UnicodeError

public static PyException UnicodeError(String message)

UserWarning

public static void UserWarning(String message)

ValueError

public static PyException ValueError(String message)

warning

public static void warning(PyObject category, String message)

warning

public static void warning(PyObject category, String message, String filename, int lineno, String module, PyObject registry)

writeComment

public static void writeComment(String type, String msg)

writeDebug

public static void writeDebug(String type, String msg)

writeError

public static void writeError(String type, String msg)

writeMessage

public static void writeMessage(String type, String msg)

writeWarning

public static void writeWarning(String type, String msg)

Warning

public static void Warning(String message)

ZeroDivisionError

public static PyException ZeroDivisionError(String message)