Package org.python.core
Class Py
java.lang.Object
org.python.core.Py
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic PyObject
static PyObject
static PyObject
static final int
static final int
static PySystemState
static PyObject
static PyObject
The singleton Ellipsis Python object - written as ... when indexingstatic PyObject[]
A zero-length array of PyObject's to pass to functions that expect zero-argumentsstatic PyString
A zero-length Python stringstatic PyTuple
A tuple with zero elementsstatic PyObject
static PyObject
static final int
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static final int
static PyObject
static PyString
A Python string containing '\n'static Object
A 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 PyObject
The singleton None Python objectstatic PyObject
The singleton NotImplemented Python object.static PyObject
static PyInteger
The Python integer 1 - also used as truestatic PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyString
A Python string containing ' 'static PyObject
static StdoutWrapper
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static PyObject
static final int
static PyInteger
The Python integer 0 - also used as falsestatic PyObject
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addTraceback
(Throwable t, PyFrame frame) static void
static void
static PyException
AssertionError
(String message) static PyException
AttributeError
(String message) static PyCode
compile
(InputStream istream, String filename, String type) static PyCode
static PyCode
static PyCode
compile
(org.python.parser.ast.modType node, String name, String filename, boolean linenumbers, boolean printResults) static PyObject
compile_command_flags
(String string, String filename, String kind, CompilerFlags cflags, boolean stdprompt) static PyCode
compile_flags
(InputStream istream, String filename, String type, CompilerFlags cflags) static PyCode
compile_flags
(String data, String filename, String type, CompilerFlags cflags) static PyCode
compile_flags
(org.python.parser.ast.modType node, String name, String filename, boolean linenumbers, boolean printResults, CompilerFlags cflags) static void
DeprecationWarning
(String message) static void
displayException
(PyObject type, PyObject value, PyObject tb, PyObject file) static PyException
static void
static Class
static Class
findClassEx
(String name, String reason) static PyException
FloatingPointError
(String message) static org.python.core.adapter.ExtensiblePyObjectAdapter
static CompilerFlags
static CompilerFlags
getCompilerFlags
(int flags, boolean dont_inherit) static PyFrame
getFrame()
static String
getName()
static final PySystemState
static final ThreadState
static final ThreadState
getThreadState
(PySystemState newSystemState) static long
static String
static PyException
ImportError
(String message) static PyException
IndexError
(String message) static void
initProxy
(PyProxy proxy, String module, String pyclass, Object[] args, String[] packages, String[] props, boolean frozen) static void
initProxy
(PyProxy proxy, String module, String pyclass, Object[] args, String[] packages, String[] props, String frozenPackage, String[] modules) static boolean
static void
initRunnable
(String module, PyObject dict) static PyException
IOError
(IOException ioe) static PyException
static boolean
isInstance
(PyObject obj, PyObject cls) static boolean
isSubClass
(PyObject derived, PyObject cls) static PyObject
static long
static PyObject
Uses the PyObjectAdapter passed toPySystemState.initialize()
to turn o into a PyObject.static PyException
static PyObject
Deprecated.*static PyObject
Deprecated.*static PyException
static final PyString
static PyObject
static PyObject
static PyObject
makeClass
(String name, PyObject[] bases, PyCode code, PyObject doc, Class proxyClass, PyObject[] closure_cells) static PyObject
static PyException
static PyException
makeException
(PyObject type) static PyException
makeException
(PyObject type, PyObject value) static PyException
makeException
(PyObject type, PyObject value, PyObject traceback) static boolean
matchException
(PyException pye, PyObject e) static void
maybeWrite
(String type, String msg, int level) static void
static PyException
MemoryError
(String message) static PyException
static PyInteger
newBoolean
(boolean t) static PyCode
newCode
(int argcount, String[] varnames, String filename, String name, boolean args, boolean keywords, PyFunctionTable funcs, int func_id) 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) static PyCode
newCode
(int argcount, String[] varnames, String filename, String name, int firstlineno, boolean args, boolean keywords, PyFunctionTable funcs, int func_id) 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) static PyFloat
newFloat
(double v) static PyFloat
newFloat
(float v) static PyComplex
newImaginary
(double v) static final PyInteger
newInteger
(int i) static PyObject
newInteger
(long i) static PyCode
newJavaCode
(Class cls, String name) static PyObject
newJavaFunc
(Class cls, String name) static PyLong
newLong
(int i) static PyLong
static PyLong
static PyString
newString
(char c) static PyString
static PyUnicode
newUnicode
(char c) static PyUnicode
newUnicode
(String s) static PyException
OverflowError
(String message) static void
OverflowWarning
(String message) static void
static void
static void
static void
printComma
(PyObject file, PyObject o) static void
static void
printException
(Throwable t, PyFrame f) static void
printException
(Throwable t, PyFrame f, PyObject file) static void
println()
static void
static void
static void
static void
printResult
(PyObject ret) static boolean
static byte
static char
static char
static double
static float
static int
static int
static long
static short
static void
static PyException
ReferenceError
(String message) static Class
relFindClass
(Class home, String name) static PyObject
static void
runMain
(Class mainClass, String[] args, String[] packages, String[] props, String frozenPackage, String[] modules) static void
runMain
(PyRunnable main, String[] args) Initializes a default PythonInterpreter and runs the code fromPyRunnable.getMain()
as __main__ Called by the code generated inModule.addMain()
static PyException
RuntimeError
(String message) static void
RuntimeWarning
(String message) static String
static void
saveClassFile
(String name, ByteArrayOutputStream bytestream) static PyException
setException
(Throwable t, PyFrame frame) static void
static final PySystemState
setSystemState
(PySystemState newSystemState) static PyException
StopIteration
(String message) static PyException
SyntaxError
(String message) static void
SyntaxWarning
(String message) static PyException
SystemError
(String message) static Object
Deprecated.static Object
static PyException
static PyException
UnboundLocalError
(String message) static PyException
UnicodeError
(String message) static PyObject[]
unpackSequence
(PyObject o, int length) static void
UserWarning
(String message) static PyException
ValueError
(String message) static void
static void
warning
(PyObject category, String message, String filename, int lineno, String module, PyObject registry) static void
static void
writeComment
(String type, String msg) static void
writeDebug
(String type, String msg) static void
writeError
(String type, String msg) static void
writeMessage
(String type, String msg) static void
writeWarning
(String type, String msg) static PyException
ZeroDivisionError
(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 givenPyObject
to an instance of a Java class. Identical too.__tojava__(c)
except that it will raise aTypeError
if the conversion fails.- Parameters:
o
- thePyObject
to 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
-