Package org.python.core
Class Py
java.lang.Object
org.python.core.Py
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic PyObjectstatic PyObjectstatic PyObjectstatic final intstatic final intstatic PySystemStatestatic PyObjectstatic PyObjectThe singleton Ellipsis Python object - written as ... when indexingstatic PyObject[]A zero-length array of PyObject's to pass to functions that expect zero-argumentsstatic PyStringA zero-length Python stringstatic PyTupleA tuple with zero elementsstatic PyObjectstatic PyObjectstatic final intstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic final intstatic PyObjectstatic PyStringA Python string containing '\n'static ObjectA unique object to indicate no conversion is possible in __tojava__ methodsstatic String[]A zero-length array of Strings to pass to functions that don't have any keyword argumentsstatic PyObjectThe singleton None Python objectstatic PyObjectThe singleton NotImplemented Python object.static PyObjectstatic PyIntegerThe Python integer 1 - also used as truestatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyStringA Python string containing ' 'static PyObjectstatic StdoutWrapperstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic final intstatic PyIntegerThe Python integer 0 - also used as falsestatic PyObject -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddTraceback(Throwable t, PyFrame frame) static voidstatic voidstatic PyExceptionAssertionError(String message) static PyExceptionAttributeError(String message) static PyCodecompile(InputStream istream, String filename, String type) static PyCodestatic PyCodestatic PyCodecompile(org.python.parser.ast.modType node, String name, String filename, boolean linenumbers, boolean printResults) static PyObjectcompile_command_flags(String string, String filename, String kind, CompilerFlags cflags, boolean stdprompt) static PyCodecompile_flags(InputStream istream, String filename, String type, CompilerFlags cflags) static PyCodecompile_flags(String data, String filename, String type, CompilerFlags cflags) static PyCodecompile_flags(org.python.parser.ast.modType node, String name, String filename, boolean linenumbers, boolean printResults, CompilerFlags cflags) static voidDeprecationWarning(String message) static voiddisplayException(PyObject type, PyObject value, PyObject tb, PyObject file) static PyExceptionstatic voidstatic Classstatic ClassfindClassEx(String name, String reason) static PyExceptionFloatingPointError(String message) static org.python.core.adapter.ExtensiblePyObjectAdapterstatic CompilerFlagsstatic CompilerFlagsgetCompilerFlags(int flags, boolean dont_inherit) static PyFramegetFrame()static StringgetName()static final PySystemStatestatic final ThreadStatestatic final ThreadStategetThreadState(PySystemState newSystemState) static longstatic Stringstatic PyExceptionImportError(String message) static PyExceptionIndexError(String message) 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 booleanstatic voidinitRunnable(String module, PyObject dict) static PyExceptionIOError(IOException ioe) static PyExceptionstatic booleanisInstance(PyObject obj, PyObject cls) static booleanisSubClass(PyObject derived, PyObject cls) static PyObjectstatic longstatic PyObjectUses the PyObjectAdapter passed toPySystemState.initialize()to turn o into a PyObject.static PyExceptionstatic PyObjectDeprecated.*static PyObjectDeprecated.*static PyExceptionstatic final PyStringstatic PyObjectstatic PyObjectstatic PyObjectmakeClass(String name, PyObject[] bases, PyCode code, PyObject doc, Class proxyClass, PyObject[] closure_cells) static PyObjectstatic PyExceptionstatic 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 voidstatic PyExceptionMemoryError(String message) static PyExceptionstatic PyIntegernewBoolean(boolean t) 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, 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) 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 PyFloatnewFloat(double v) static PyFloatnewFloat(float v) static PyComplexnewImaginary(double v) static final PyIntegernewInteger(int i) static PyObjectnewInteger(long i) static PyCodenewJavaCode(Class cls, String name) static PyObjectnewJavaFunc(Class cls, String name) static PyLongnewLong(int i) static PyLongstatic PyLongstatic PyStringnewString(char c) static PyStringstatic PyUnicodenewUnicode(char c) static PyUnicodenewUnicode(String s) static PyExceptionOverflowError(String message) static voidOverflowWarning(String message) static voidstatic voidstatic voidstatic voidprintComma(PyObject file, PyObject o) static voidstatic voidprintException(Throwable t, PyFrame f) static voidprintException(Throwable t, PyFrame f, PyObject file) static voidprintln()static voidstatic voidstatic voidstatic voidprintResult(PyObject ret) static booleanstatic bytestatic charstatic charstatic doublestatic floatstatic intstatic intstatic longstatic shortstatic voidstatic PyExceptionReferenceError(String message) static ClassrelFindClass(Class home, String name) static PyObjectstatic voidrunMain(Class mainClass, String[] args, String[] packages, String[] props, String frozenPackage, String[] modules) static voidrunMain(PyRunnable main, String[] args) Initializes a default PythonInterpreter and runs the code fromPyRunnable.getMain()as __main__ Called by the code generated inModule.addMain()static PyExceptionRuntimeError(String message) static voidRuntimeWarning(String message) static Stringstatic voidsaveClassFile(String name, ByteArrayOutputStream bytestream) static PyExceptionsetException(Throwable t, PyFrame frame) static voidstatic final PySystemStatesetSystemState(PySystemState newSystemState) static PyExceptionStopIteration(String message) static PyExceptionSyntaxError(String message) static voidSyntaxWarning(String message) static PyExceptionSystemError(String message) static ObjectDeprecated.static Objectstatic PyExceptionstatic PyExceptionUnboundLocalError(String message) static PyExceptionUnicodeError(String message) static PyObject[]unpackSequence(PyObject o, int length) static voidUserWarning(String message) static PyExceptionValueError(String message) static voidstatic voidwarning(PyObject category, String message, String filename, int lineno, String module, PyObject registry) static voidstatic 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 PyExceptionZeroDivisionError(String message)
-
Field Details
-
None
The singleton None Python object -
Ellipsis
The singleton Ellipsis Python object - written as ... when indexing -
NotImplemented
The singleton NotImplemented Python object. Used in rich comparison -
NoKeywords
A zero-length array of Strings to pass to functions that don't have any keyword arguments -
EmptyObjects
A zero-length array of PyObject's to pass to functions that expect zero-arguments -
EmptyTuple
A tuple with zero elements -
Zero
The Python integer 0 - also used as false -
One
The Python integer 1 - also used as true -
EmptyString
A zero-length Python string -
Newline
A Python string containing '\n' -
Space
A Python string containing ' ' -
NoConversion
A unique object to indicate no conversion is possible in __tojava__ methods -
OSError
-
NotImplementedError
-
EnvironmentError
-
OverflowError
-
RuntimeError
-
KeyboardInterrupt
-
FloatingPointError
-
SyntaxError
-
IndentationError
-
TabError
-
AttributeError
-
IOError
-
KeyError
-
AssertionError
-
TypeError
-
ReferenceError
-
SystemError
-
IndexError
-
ZeroDivisionError
-
NameError
-
UnboundLocalError
-
SystemExit
-
StopIteration
-
ImportError
-
ValueError
-
UnicodeError
-
EOFError
-
MemoryError
-
ArithmeticError
-
LookupError
-
StandardError
-
Exception
-
Warning
-
UserWarning
-
DeprecationWarning
-
SyntaxWarning
-
OverflowWarning
-
RuntimeWarning
-
JavaError
-
defaultSystemState
-
stderr
-
ERROR
public static final int ERROR- See Also:
-
WARNING
public static final int WARNING- See Also:
-
MESSAGE
public static final int MESSAGE- See Also:
-
COMMENT
public static final int COMMENT- See Also:
-
DEBUG
public static final int DEBUG- See Also:
-
-
Method Details
-
OverflowError
-
RuntimeError
-
FloatingPointError
-
SyntaxError
-
AttributeError
-
IOError
-
IOError
-
KeyError
-
AssertionError
-
TypeError
-
ReferenceError
-
SystemError
-
IndexError
-
ZeroDivisionError
-
NameError
-
UnboundLocalError
-
StopIteration
-
ImportError
-
ValueError
-
UnicodeError
-
EOFError
-
memory_error
-
MemoryError
-
Warning
-
UserWarning
-
DeprecationWarning
-
SyntaxWarning
-
OverflowWarning
-
RuntimeWarning
-
warning
-
warning
-
JavaError
-
tojava
Deprecated.Convert a givenPyObjectto an instance of a Java class. Identical too.__tojava__(c)except that it will raise aTypeErrorif the conversion fails.- Parameters:
o- thePyObjectto convert.c- the class to convert it to.
-
tojava
-
jfindattr
Deprecated.* -
jgetattr
Deprecated.* -
newInteger
-
newInteger
-
newLong
-
newLong
-
newLong
-
newImaginary
-
newFloat
-
newFloat
-
newString
-
newString
-
newUnicode
-
newUnicode
-
newBoolean
-
newCode
-
newCode
-
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) -
newJavaCode
-
newJavaFunc
-
initPython
public static boolean initPython() -
relFindClass
-
findClass
-
findClassEx
-
initProxy
-
initProxy
-
initRunnable
-
runMain
Initializes a default PythonInterpreter and runs the code fromPyRunnable.getMain()as __main__ Called by the code generated inModule.addMain()- Throws:
Exception
-
runMain
public static void runMain(Class mainClass, String[] args, String[] packages, String[] props, String frozenPackage, String[] modules) throws Exception - Throws:
Exception
-
printException
-
printException
-
printException
-
displayException
-
assert_
-
assert_
-
addTraceback
-
setException
-
matchException
-
makeException
-
makeException
-
makeException
-
makeException
-
runCode
-
exec
-
getThreadState
-
getThreadState
-
setSystemState
-
getSystemState
-
getFrame
-
setFrame
-
print
-
printComma
-
println
-
printlnv
-
print
-
printComma
-
println
-
println
public static void println() -
py2boolean
-
py2byte
-
py2short
-
py2int
-
py2int
-
py2long
-
py2float
-
py2double
-
py2char
-
py2char
-
py2void
-
makeCharacter
-
java2py
Uses the PyObjectAdapter passed toPySystemState.initialize()to turn o into a PyObject.- See Also:
-
- default PyObjectAdapter type
-
getAdapter
public static org.python.core.adapter.ExtensiblePyObjectAdapter getAdapter()- Returns:
- the ExtensiblePyObjectAdapter used by java2py.
-
makeClass
-
makeClass
-
makeClass
-
makeClass
-
getName
-
getCompilerFlags
-
getCompilerFlags
-
compile
-
compile
-
compile
-
compile
-
compile_flags
public static PyCode compile_flags(org.python.parser.ast.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
-
compile_command_flags
public static PyObject compile_command_flags(String string, String filename, String kind, CompilerFlags cflags, boolean stdprompt) -
unpackSequence
-
iter
-
id
-
idstr
-
java_obj_id
-
safeRepr
-
printResult
-
maybeWrite
-
writeError
-
writeWarning
-
writeMessage
-
writeComment
-
writeDebug
-
saveClassFile
-
isInstance
-
isSubClass
-