Class Py
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PySystemStatestatic PyObjectstatic final PyObjectThe singleton Ellipsis Python object - written as ... when indexingstatic final PyFrozenSetA frozenset with zero elementsstatic final PyObject[]A zero-length array of PyObject's to pass to functions when we have no argumentsstatic final PyStringA zero-length Python byte stringstatic final PyTupleA tuple with zero elementsstatic final PyUnicodeA zero-length Python Unicode stringstatic PyObjectstatic PyObjectstatic PyObjectstatic final PyBooleanThe Python boolean Falsestatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic final PyStringA Python string containing '\n'static final ObjectA unique object to indicate no conversion is possible in __tojava__ methodsstatic final String[]A zero-length array of Strings to pass to functions that don't have any keyword argumentsstatic final PyObjectThe singleton None Python objectstatic final PyObjectThe singleton NotImplemented Python object.static PyObjectstatic final PyIntegerThe Python integer 1static PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic final PyStringA Python string containing ' 'static PyObjectstatic StdoutWrapperstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic final longSet if the type allows subclassingstatic final longSet if the type object is dynamically allocatedstatic final longType is abstract and cannot be instantiatedstatic final PyBooleanThe Python boolean Truestatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic final PyUnicodeA Python unicode string containing '\n'static final PyUnicodeA Python unicode string containing ' 'static PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic PyObjectstatic final PyIntegerThe Python integer 0static PyObject -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddTraceback(Throwable t, PyFrame frame) static voidstatic voidstatic PyExceptionAssertionError(String message) static PyExceptionAttributeError(String message) static PyExceptionBufferError(String message) static voidBytesWarning(String message) static PyCodecompile(InputStream istream, String filename, CompileMode kind) static PyObjectcompile_command_flags(String string, String filename, CompileMode kind, CompilerFlags cflags, boolean stdprompt) static PyCodecompile_flags(InputStream istream, String filename, CompileMode kind, CompilerFlags cflags) Compiles python source code coming from a file or another external streamstatic PyCodecompile_flags(String data, String filename, CompileMode kind, CompilerFlags cflags) Compiles python source code coming from String (raw bytes) data.static PyCodecompile_flags(org.python.antlr.base.mod node, String name, String filename, boolean linenumbers, boolean printResults, CompilerFlags cflags) Entry point for compiling modules.static PyCodecompile_flags(org.python.antlr.base.mod node, String filename, CompileMode kind, CompilerFlags cflags) static voidDeprecationWarning(String message) static voiddisplayException(PyObject type, PyObject value, PyObject tb, PyObject file) Print the description of an exception as a big string.static PyExceptionEnvironmentError(String message) static PyExceptionstatic voidstatic StringfileSystemDecode(PyObject filename) static StringfileSystemDecode(PyString filename) Return a file name or path as Unicode (Java UTF-16String), decoded if necessary from a Pythonbytesobject, using the file system encoding.static PyStringfileSystemEncode(String filename) Return a PyString object we can use as a file name or file path in places where Python expects abytes(that is astr) object in the file system encoding.static PyStringfileSystemEncode(PyString filename) Return a PyString object we can use as a file name or file path in places where Python expects abytes(that is,str) object in the file system encoding.static Class<?> Find and load a Java class by name.static Class<?> findClassEx(String name, String reason) Find and load a Java class by name.static PyExceptionFloatingPointError(String message) static voidstatic StringformatException(PyObject type, PyObject value) static StringformatException(PyObject type, PyObject value, boolean useRepr) static voidFutureWarning(String message) static PyExceptionGeneratorExit(String message) static ExtensiblePyObjectAdapterstatic CompilerFlagsstatic CompilerFlagsgetCompilerFlags(int flags, boolean dont_inherit) static CompilerFlagsgetCompilerFlags(CompilerFlags flags, boolean dont_inherit) static ConsoleGet the Jython Console (used forinput(),raw_input(), etc.) as constructed and set byPySystemStateinitialization.static StringThe same asgetenv(name, null).static StringGet the value of the environment variable named fromos.environor return the given default value.static PyStringThe same asgetenv(name, null).static PyStringGet the value of the environment variable named fromos.environor return the given default value.static PyFramegetFrame()static StringgetName()static final PySystemStatestatic final ThreadStatestatic final ThreadStategetThreadState(PySystemState newSystemState) static longstatic Stringstatic PyExceptionImportError(String message) static booleanstatic voidImportWarning(String message) static PyExceptionIndexError(String message) static voidstatic booleanstatic voidinstallConsole(Console console) Install the provided Console, first uninstalling any current one.static PyExceptionIOError(IOException ioe) static PyExceptionstatic PyExceptionIOError(jnr.constants.Constant errno) static PyExceptionstatic PyExceptionstatic booleanisInstance(PyObject inst, 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 PyObjectjavaPyClass(PyObject cls, Class<?> interfce) Returns a Python-class that extendsclsandinterfce.static PyObject[]Uses the PyObjectAdapter passed toPySystemState.initialize()to turnobjectsinto an array of PyObjects.static PyExceptionKeyboardInterrupt(String message) static PyExceptionstatic PyExceptionstatic final PyStringmakeCharacter(char c) static final PyStringstatic PyObjectstatic PyObjectstatic PyObjectCreate a new Python class.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 exc) Deprecated.static voidstatic PyExceptionMemoryError(String message) static PyExceptionstatic PyBooleannewBoolean(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 PyObjectstatic PyObjectnewDatetime(Timestamp timestamp) static PyObjectnewDecimal(String decimal) static PyFloatnewFloat(double v) static PyFloatnewFloat(float v) static PyComplexnewImaginary(double v) static final PyIntegernewInteger(int i) static PyObjectnewInteger(long i) static <T> TWorks likenewJ(PyObject, Class, Object...), but looks up the Python-class in the module-dict using the interface-name, i.e.static <T> TWorks likenewJ(PyObject, Class, String[], Object...), but looks up the Python-class in the module-dict using the interface-name, i.e.static <T> TThis method is a compact helper to access Python-constructors from Java.static <T> TThis method is a compact helper to access Python-constructors from Java.static <T> TThis method is a compact helper to access Python-constructors from Java.static PyCodenewJavaCode(Class<?> cls, String name) static PyObjectnewJavaFunc(Class<?> cls, String name) static PyLongnewLong(int i) static PyLongnewLong(long l) static PyLongstatic PyLongstatic PyStringnewString(char c) static PyStringCreate aPyStringfrom a JavaString.static PyStringMapstatic PyStringstatic PyStringnewStringOrUnicode(PyObject precedent, String s) static PyStringstatic PyObjectstatic PyUnicodenewUnicode(char c) static PyUnicodenewUnicode(String s) static PyUnicodenewUnicode(String s, boolean isBasic) static PyExceptionNotImplementedError(String message) static PyExceptionOSError(IOException ioe) static PyExceptionstatic PyExceptionOSError(jnr.constants.Constant errno) static PyExceptionstatic PyExceptionOverflowError(String message) static voidPendingDeprecationWarning(String message) static voidstatic voidstatic voidstatic voidprintComma(PyObject file, PyObject o) static voidDisplay an exception and stack trace throughprintException(Throwable, PyFrame, PyObject).static voidprintException(Throwable t, PyFrame f) Display an exception and stack trace throughprintException(Throwable, PyFrame, PyObject).static voidprintException(Throwable t, PyFrame f, PyObject file) Display an exception and stack trace.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 PyObjectstatic voidrunMain(CodeBootstrap main, String[] args) Initializes a default PythonInterpreter and runs the code loaded from theCodeBootstrapas __main__ Called by the code generated inModule.addMain()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 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 <T> TConvert a givenPyObjectto an instance of a Java class.static Objectstatic PyExceptionstatic PyExceptionUnboundLocalError(String message) static PyExceptionUnicodeDecodeError(String encoding, String object, int start, int end, String reason) static PyExceptionUnicodeEncodeError(String encoding, String object, int start, int end, String reason) static PyExceptionUnicodeError(String message) static PyExceptionUnicodeTranslateError(String object, int start, int end, String reason) static voidUnicodeWarning(String message) static PyObject[]unpackSequence(PyObject obj, int length) static voidUserWarning(String message) static PyExceptionValueError(String message) static voidstatic voidstatic voidwarning(PyObject category, String message, String filename, int lineno, String module, PyObject registry) static voidstatic voidstatic voidstatic voidwriteUnraisable(Throwable unraisable, PyObject obj) static PyExceptionZeroDivisionError(String message) Methods inherited from class org.python.core.PrePy
getCommandResult, getCommandResultWindows, getDefaultBinDir, getDefaultExecutableName, getJarFileName, getJarFileNameFromURL, getLoggingLevel, getSystemProperties, getSystemProperty, haveConsole, increaseLoggingLevel, isInteractive, isInteractive, levelFromVerbosity, maybeWrite, setLoggingLevel, verbosityFromLevel, writeComment, writeDebug, writeError, writeMessage, writeWarning
-
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 when we have no arguments -
EmptyFrozenSet
A frozenset with zero elements -
EmptyTuple
A tuple with zero elements -
Zero
The Python integer 0 -
One
The Python integer 1 -
False
The Python boolean False -
True
The Python boolean True -
EmptyString
A zero-length Python byte string -
EmptyUnicode
A zero-length Python Unicode string -
Newline
A Python string containing '\n' -
UnicodeNewline
A Python unicode string containing '\n' -
Space
A Python string containing ' ' -
UnicodeSpace
A Python unicode string containing ' ' -
TPFLAGS_HEAPTYPE
public static final long TPFLAGS_HEAPTYPESet if the type object is dynamically allocated- See Also:
-
TPFLAGS_BASETYPE
public static final long TPFLAGS_BASETYPESet if the type allows subclassing- See Also:
-
TPFLAGS_IS_ABSTRACT
public static final long TPFLAGS_IS_ABSTRACTType is abstract and cannot be instantiated- See Also:
-
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
-
GeneratorExit
-
ImportError
-
ValueError
-
UnicodeError
-
UnicodeTranslateError
-
UnicodeDecodeError
-
UnicodeEncodeError
-
EOFError
-
MemoryError
-
BufferError
-
ArithmeticError
-
LookupError
-
StandardError
-
Exception
-
BaseException
-
Warning
-
UserWarning
-
DeprecationWarning
-
PendingDeprecationWarning
-
SyntaxWarning
-
RuntimeWarning
-
FutureWarning
-
ImportWarning
-
UnicodeWarning
-
BytesWarning
-
JavaError
-
defaultSystemState
-
stderr
-
-
Method Details
-
OSError
-
OSError
-
OSError
-
OSError
-
NotImplementedError
-
EnvironmentError
-
OverflowError
-
RuntimeError
-
KeyboardInterrupt
-
FloatingPointError
-
SyntaxError
-
AttributeError
-
IOError
-
IOError
-
IOError
-
IOError
-
IOError
-
KeyError
-
KeyError
-
AssertionError
-
TypeError
-
ReferenceError
-
SystemError
-
IndexError
-
ZeroDivisionError
-
NameError
-
UnboundLocalError
-
StopIteration
-
GeneratorExit
-
ImportError
-
ValueError
-
UnicodeError
-
UnicodeTranslateError
-
UnicodeDecodeError
public static PyException UnicodeDecodeError(String encoding, String object, int start, int end, String reason) -
UnicodeEncodeError
public static PyException UnicodeEncodeError(String encoding, String object, int start, int end, String reason) -
EOFError
-
memory_error
-
MemoryError
-
BufferError
-
Warning
-
UserWarning
-
DeprecationWarning
-
PendingDeprecationWarning
-
SyntaxWarning
-
RuntimeWarning
-
FutureWarning
-
ImportWarning
-
UnicodeWarning
-
BytesWarning
-
warnPy3k
-
warnPy3k
-
warning
-
warning
-
warning
-
JavaError
-
tojava
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
-
newInteger
-
newInteger
-
newLong
-
newLong
-
newLong
-
newLong
-
newImaginary
-
newFloat
-
newFloat
-
newString
-
newString
Create aPyStringfrom a JavaString. Thethe character codes must all be all < 256. (This is checked.)- Parameters:
s- character codes are all < 256.- Returns:
- a new
PyString
-
newStringOrUnicode
Return aPyStringfor the given JavaString, if it can be represented as US-ASCII, and aPyUnicodeotherwise.- Parameters:
s- string content- Returns:
PyStringorPyUnicodeaccording to content ofs.
-
newStringOrUnicode
Return aPyStringfor the given JavaString, if it can be represented as US-ASCII and if a preceding object is not aPyUnicode, and aPyUnicodeotherwise. In some contexts, we want the result to be aPyUnicodeif some preceding result is aPyUnicode.- Parameters:
precedent- string of which the type sets a precedents- string content- Returns:
PyStringorPyUnicodeaccording to content ofs.
-
newStringUTF8
-
fileSystemDecode
Return a file name or path as Unicode (Java UTF-16String), decoded if necessary from a Pythonbytesobject, using the file system encoding. In Jython, this encoding is UTF-8, irrespective of the OS platform. This method is comparable with Python 3os.fsdecode, but for Java use, in places such as theosmodule. If the argument is not aPyUnicode, it will be decoded using the nominal Jython file system encoding. If the argument is aPyUnicode, itsStringis returned.- Parameters:
filename- asbytesto decode, or already asunicode- Returns:
- unicode version of path
-
fileSystemDecode
- Parameters:
filename- asbytesto decode, or already asunicode- Returns:
- unicode version of the file name
-
fileSystemEncode
Return a PyString object we can use as a file name or file path in places where Python expects abytes(that is astr) object in the file system encoding. In Jython, this encoding is UTF-8, irrespective of the OS platform.This is subtly different from CPython's use of "file system encoding", which tracks the platform's choice so that OS services may be called that have a bytes interface. Jython's interaction with the OS occurs via Java using String arguments representing Unicode values, so we have no need to match the encoding actually chosen by the platform (e.g. 'mbcs' on Windows). Rather we need a nominal Jython file system encoding, for use where the standard library forces byte paths on us (in Python 2). There is no reason for this choice to vary with OS platform. Methods receiving paths as
byteswillfileSystemDecode(PyString)them again for Java.- Parameters:
filename- asunicodeto encode, or already asbytes- Returns:
- encoded bytes version of path
-
fileSystemEncode
Return a PyString object we can use as a file name or file path in places where Python expects abytes(that is,str) object in the file system encoding. In Jython, this encoding is UTF-8, irrespective of the OS platform. This method is comparable with Python 3os.fsencode. If the argument is a PyString, it is returned unchanged. If the argument is a PyUnicode, it is converted to abytesusing the nominal Jython file system encoding.- Parameters:
filename- asunicodeto encode, or already asbytes- Returns:
- encoded bytes version of path
-
getenv
The same asgetenv(name, null). Seegetenv(PyString, PyString). -
getenv
Get the value of the environment variable named fromos.environor return the given default value. Empty string values are treated as undefined for this purpose.- Parameters:
name- of the environment variable.defaultValue- to return ifkeyis not defined (may benull.- Returns:
- the corresponding value or
defaultValue.
-
getenv
The same asgetenv(name, null). Seegetenv(String, String). -
getenv
Get the value of the environment variable named fromos.environor return the given default value. This is a convenience wrapper ongetenv(PyString, PyString)which takes care of the fact that environment variables are FS-encoded.- Parameters:
name- to access in the environment.defaultValue- to return ifkeyis not defined.- Returns:
- the corresponding value or
defaultValue.
-
newStringMap
-
newUnicode
-
newUnicode
-
newUnicode
-
newBoolean
-
newDate
-
newTime
-
newDatetime
-
newDecimal
-
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() -
findClass
Find and load a Java class by name.- Parameters:
name- of the Java class.- Returns:
- the class, or
nullif it wasn't found or something went wrong
-
findClassEx
Find and load a Java class by name.- Parameters:
name- Name of the Java class.reason- for finding the class. Used in debugging messages.- Returns:
- the class, or
nullif it simply wasn't found - Throws:
PyException-JavaErrorwrapping errors occurring when the class is found but cannot be loaded.
-
initProxy
-
runMain
Initializes a default PythonInterpreter and runs the code fromPyRunnable.getMain()as __main__ Called by the code generated inModule.addMain()- Throws:
Exception
-
runMain
Initializes a default PythonInterpreter and runs the code loaded from theCodeBootstrapas __main__ Called by the code generated inModule.addMain()- Throws:
Exception
-
printException
Display an exception and stack trace throughprintException(Throwable, PyFrame, PyObject).- Parameters:
t- to display
-
printException
Display an exception and stack trace throughprintException(Throwable, PyFrame, PyObject).- Parameters:
t- to displayf- frame at which to start the stack trace
-
printException
Display an exception and stack trace. If the exception wasSystemExitandOptions.inspect==false, this will exit the JVM.- Parameters:
t- to displayf- frame at which to start the stack tracefile- output onto this stream orstderrifnull
-
displayException
Print the description of an exception as a big string. The arguments are closely equivalent to the tuple returned by Pythonsys.exc_info, on standard error or a given byte-oriented file. Compare with Pythontraceback.print_exception.- Parameters:
type- of exceptionvalue- the exception parameter (second argument toraise)tb- traceback of the call stack where the exception originally occurredfile- to print encoded string to, or null meaning standard error
-
formatException
-
formatException
-
writeUnraisable
-
assert_
-
assert_
-
addTraceback
-
setException
-
matchException
Deprecated.As of Jython 2.5, usePyException.match(org.python.core.PyObject)instead. -
makeException
-
makeException
-
makeException
-
makeException
-
runCode
-
exec
-
getThreadState
-
getThreadState
-
setSystemState
-
getSystemState
-
getFrame
-
setFrame
-
getConsole
Get the Jython Console (used forinput(),raw_input(), etc.) as constructed and set byPySystemStateinitialization.- Returns:
- the Jython Console
-
installConsole
public static void installConsole(Console console) throws UnsupportedOperationException, IOException Install the provided Console, first uninstalling any current one. The Jython Console is used forraw_input()etc., and may provide line-editing and history recall at the prompt. A Console may replaceSystem.inwith its line-editing input method.- Parameters:
console- The new Console object- Throws:
UnsupportedOperationException- if some prior Console refuses to uninstallIOException- ifConsole.install()raises it
-
importSiteIfSelected
public static boolean importSiteIfSelected() -
print
-
printComma
-
println
-
printlnv
-
print
-
printComma
-
println
-
println
public static void println() -
flushLine
public static void flushLine() -
py2boolean
-
py2byte
-
py2short
-
py2int
-
py2int
-
py2long
-
py2float
-
py2double
-
py2char
-
py2char
-
py2void
-
makeCharacter
-
makeCharacter
-
java2py
Uses the PyObjectAdapter passed toPySystemState.initialize()to turn o into a PyObject.- See Also:
-
javas2pys
Uses the PyObjectAdapter passed toPySystemState.initialize()to turnobjectsinto an array of PyObjects.- See Also:
-
getAdapter
- Returns:
- the ExtensiblePyObjectAdapter used by java2py.
-
makeClass
-
makeClass
-
makeClass
-
makeClass
Create a new Python class.- Parameters:
name- the String name of the classbases- an array of PyObject base classesdict- the class's namespace, containing the class body definition- Returns:
- a new Python Class PyObject
-
getName
-
getCompilerFlags
-
getCompilerFlags
-
getCompilerFlags
-
compile
-
compile_flags
public static PyCode compile_flags(org.python.antlr.base.mod node, String name, String filename, boolean linenumbers, boolean printResults, CompilerFlags cflags) Entry point for compiling modules.- Parameters:
node- Module node, coming from the parsing processname- Internal name for the compiled code. Typically generated by callinggetName().filename- Source file namelinenumbers- True to track source line numbers on the generated codeprintResults- True to call the sys.displayhook on the result of the codecflags- Compiler flags- Returns:
- Code object for the compiled module
-
compile_flags
public static PyCode compile_flags(org.python.antlr.base.mod node, String filename, CompileMode kind, CompilerFlags cflags) -
compile_flags
public static PyCode compile_flags(InputStream istream, String filename, CompileMode kind, CompilerFlags cflags) Compiles python source code coming from a file or another external stream -
compile_flags
public static PyCode compile_flags(String data, String filename, CompileMode kind, CompilerFlags cflags) Compiles python source code coming from String (raw bytes) data. If the String is properly decoded (from PyUnicode) the PyCF_SOURCE_IS_UTF8 flag should be specified. -
compile_command_flags
public static PyObject compile_command_flags(String string, String filename, CompileMode kind, CompilerFlags cflags, boolean stdprompt) -
unpackSequence
-
iter
-
id
-
idstr
-
java_obj_id
-
printResult
-
saveClassFile
-
isInstance
-
isSubClass
-
javaPyClass
Returns a Python-class that extendsclsandinterfce. Ifclsalready extendsinterfce, simplyclsis returned. Otherwise a new class is created (if not yet cached). It caches such classes and only creates a new one if no appropriate class was cached yet.- Returns:
- a Python-class that extends
clsandinterfce
-
newJ
This method is a compact helper to access Python-constructors from Java. It creates an instance ofclsand retruns it in form ofjcls, which must be an interface. This method even works ifclsdoes not extendjclsin Python-code. In that case, it usesjavaPyClass(PyObject, Class)to create an appropriate class on the fly.It automatically converts
argstoPyObjects.
For keyword-support usenewJ(PyObject, Class, String[], Object...).- Parameters:
cls- - the class to be instanciatedjcls- - the Java-type to be returnedargs- are automatically converted to Jython-PyObjects- Returns:
- an instance of cls in form of the interface jcls
- See Also:
-
newJ
This method is a compact helper to access Python-constructors from Java. It creates an instance ofclsand retruns it in form ofjcls, which must be an interface. This method even works ifclsdoes not extendjclsin Python-code. In that case, it usesjavaPyClass(PyObject, Class)to create an appropriate class on the fly.keywordssare applied to the lastargsin the list.- Parameters:
cls- - the class to be instanciatedjcls- - the Java-type to be returnedargs- for the Python-class constructorkeywords- are applied to the last args- Returns:
- an instance of cls in form of the interface jcls
- See Also:
-
newJ
This method is a compact helper to access Python-constructors from Java. It creates an instance ofclsand retruns it in form ofjcls, which must be an interface. This method even works ifclsdoes not extendjclsin Python-code. In that case, it usesjavaPyClass(PyObject, Class)to create an appropriate class on the fly.It automatically converts
argstoPyObjects.
keywordssare applied to the lastargsin the list.- Parameters:
cls- - the class to be instanciatedjcls- - the Java-type to be returnedkeywords- are applied to the last argsargs- are automatically converted to Jython-PyObjects- Returns:
- an instance of cls in form of the interface jcls
- See Also:
-
newJ
Works likenewJ(PyObject, Class, Object...), but looks up the Python-class in the module-dict using the interface-name, i.e.jcls.getSimpleName().For keywords-support use
newJ(PyModule, Class, String[], Object...).- Parameters:
module- the module containing the desired classjcls- Java-type of the desired clas, must have the same nameargs- constructor-arguments- Returns:
- a new instance of the desired class
- See Also:
-
newJ
Works likenewJ(PyObject, Class, String[], Object...), but looks up the Python-class in the module-dict using the interface-name, i.e.jcls.getSimpleName().keywordssare applied to the lastargsin the list.- Parameters:
module- the module containing the desired classjcls- Java-type of the desired class, must have the same namekeywords- are applied to the lastargsin the listargs- constructor-arguments- Returns:
- a new instance of the desired class
- See Also:
-
PyException.match(org.python.core.PyObject)instead.