### Build Jython Installer using Ant Source: https://apidia.net/java/Jython/2.7.4/README-info.html Build a snapshot installer JAR of Jython using the 'installer' Ant target. ```bash ant installer ``` -------------------------------- ### Console Installation Source: https://apidia.net/java/Jython/2.7.4/org.python.core.Py.html Installs a custom console for input/output operations. ```APIDOC ## POST /installConsole ### Description Installs the provided `Console` object, uninstalling any current console. This affects `raw_input()` and prompt behavior. A `Console` may replace `System.in`. ### Method POST ### Endpoint /installConsole ### Parameters #### Request Body - **console** (Console) - The new `Console` object to install. ### Exceptions - **UnsupportedOperationException**: If a prior `Console` refuses to uninstall. - **IOException**: If `Console#install()` raises an `IOException`. ### Response #### Success Response (200) - **void** - No content returned on successful execution. #### Response Example (No content) ``` -------------------------------- ### Run Graphical Jython Installer Source: https://apidia.net/java/Jython/2.7.4/README-info.html Execute the Jython installer JAR to launch the graphical installation process. ```bash java -jar jython-installer.jar ``` -------------------------------- ### Database Connection Example Source: https://apidia.net/java/Jython/2.7.4/com.ziclix.python.sql.zxJDBC.html Example of how to establish a database connection using zxJDBC. ```APIDOC ## Example Usage ### Connect to a MySQL Database ```python from com.ziclix.python.sql import zxJDBC db = zxJDBC.connect("jdbc:mysql://localhost:3306/MySql", None, None, "org.gjt.mm.mysql.Driver") ``` ### Parameters for connect (implied from example): - **url** (string) - The JDBC connection URL. - **user** (string) - The database username (None in example). - **password** (string) - The database password (None in example). - **driver** (string) - The JDBC driver class name. ``` -------------------------------- ### Example Jython Servlet Source: https://apidia.net/java/Jython/2.7.4/org.python.util.PyServlet.html This is an example of a Jython servlet that extends HttpServlet and handles GET requests to serve an HTML page. Ensure the servlet is configured in web.xml. ```python from javax.servlet.http import HttpServlet class hello(HttpServlet): def doGet(self, req, res): res.setContentType("text/html"); out = res.getOutputStream() print >>out, "" print >>out, "Hello World, How are we?" print >>out, "Hello World, how are we?" print >>out, "" print >>out, "" out.close() ``` -------------------------------- ### dbexts Configuration File Example Source: https://apidia.net/java/Jython/2.7.4/zxjdbc-info.html An example configuration file format for dbexts, showing connection details for MySQL and Oracle databases. ```ini [default] name=mysql [jdbc] name=mysql url=jdbc:mysql://localhost/ziclix user= pwd= driver=org.gjt.mm.mysql.Driver datahandler=com.ziclix.python.sql.handler.MySQLDataHandler [jdbc] name=ora url=jdbc:oracle:thin:@localhost:1521:ziclix user=ziclix pwd=ziclix driver=oracle.jdbc.driver.OracleDriver datahandler=com.ziclix.python.sql.handler.OracleDataHandler ``` -------------------------------- ### Run Console Jython Installer Source: https://apidia.net/java/Jython/2.7.4/README-info.html Execute the Jython installer JAR with the '--console' flag for a command-line installation. ```bash java -jar jython-installer.jar --console ``` -------------------------------- ### Console Installation and Uninstallation Source: https://apidia.net/java/Jython/2.7.4/org.python.core.PlainConsole.html Methods for installing and uninstalling the console, including handling potential exceptions. ```APIDOC ## POST /console/install ### Description Completes initialization and optionally installs a stream object with line-editing as the replacement for System.in. ### Method POST ### Endpoint /console/install ### Response #### Success Response (200) - **message** (String) - Indicates successful installation. #### Response Example ```json { "message": "Console installed successfully." } ``` ## DELETE /console/uninstall ### Description Uninstalls the console. This operation may throw an UnsupportedOperationException if the console cannot be uninstalled. ### Method DELETE ### Endpoint /console/uninstall ### Exceptions - **UnsupportedOperationException**: Thrown if this class is not exactly `PlainConsole` and thus cannot be uninstalled. ### Response #### Success Response (200) - **message** (String) - Indicates successful uninstallation. #### Response Example ```json { "message": "Console uninstalled successfully." } ``` ``` -------------------------------- ### Product Initialization Methods Source: https://apidia.net/java/Jython/2.7.4/org.python.modules.itertools.product.html Documentation for the product___init__ methods used for product initialization. ```APIDOC ## Product Initialization Methods ### product___init__ (args, kws) ### Method public final void product___init__(PyObject[] args, String[] kws) ### Annotations @ExposedMethod @ExposedNew ### product___init__ (tuples, repeat) ### Method private void product___init__(PyTuple[] tuples, int repeat) ``` -------------------------------- ### Console Interface Methods Source: https://apidia.net/java/Jython/2.7.4/org.python.core.Console.html This section details the methods available in the Console interface, including getting encoding information, installing, and uninstalling the console. ```APIDOC ## Console Interface ### Description A class named in configuration as the value of `python.console` must implement this interface, and provide a constructor with a single `String` argument, to be acceptable during initialization of the interpreter. The argument to the constructor names the encoding in use on the console. Such a class may provide line editing and history recall to an interactive console. A default implementation (that does not provide any such facilities) is available as `PlainConsole`. See Also: `org.python.core.RegistryKey#PYTHON_CONSOLE` ## Method Summary - **getEncoding()**: Returns the name of the encoding in use. - **getEncodingCharset()**: Returns the Charset of the encoding in use. - **install()**: Completes initialization and optionally installs a stream object with line-editing. - **uninstall()**: Uninstalls the Console if possible. ## Method Detail ### getEncoding ```java public String getEncoding() ``` **Description**: Name of the encoding, normally supplied during initialisation, and used for line input. This may not be the canonical name of the codec returned by `getEncodingCharset()`. **Returns**: String - name of the encoding in use. ### getEncodingCharset ```java public Charset getEncodingCharset() ``` **Description**: Accessor for encoding to use for line input as a `Charset`. **Returns**: Charset - Charset of the encoding in use. ### install ```java public void install() throws IOException ``` **Description**: Complete initialization and (optionally) install a stream object with line-editing as the replacement for `System.in`. **Throws**: - `IOException`: in case of failure related to i/o. ### uninstall ```java public void uninstall() throws UnsupportedOperationException ``` **Description**: Uninstall the Console (if possible). A Console that installs a replacement for `System.in` should put back the original value. **Throws**: - `UnsupportedOperationException`: if the Console cannot be uninstalled. ``` -------------------------------- ### Get Buffer Slice Source: https://apidia.net/java/Jython/2.7.4/org.python.core.PyBuffer.html Obtain a PyBuffer slice with specified flags, start index, count, and stride. The consumer must release the returned PyBuffer. This method translates abstract view parameters to the underlying buffer's stride and item size. ```java public PyBuffer getBufferSlice(int flags, int start, int count, int stride) ``` -------------------------------- ### runStartupFile Source: https://apidia.net/java/Jython/2.7.4/org.python.util.jython.html Attempts to execute the Jython startup file specified in the registry or environment variable. ```APIDOC ## runStartupFile ### Description Attempts to execute the file named in the registry entry `python.startup`, which may also have been set via the environment variable `JYTHONSTARTUP`. This may raise a Python exception, including `SystemExit` that propagates to the caller. If the file cannot be opened, or using it throws a Java `IOException` that is not converted to a `PyException` (i.e. not within the executing code), it is reported via `printError(String, Object...) ### Method `private static void runStartupFile(InteractiveConsole interp)` ### Parameters #### Path Parameters - **interp** (InteractiveConsole) - Required - The console to do the work. ``` -------------------------------- ### Method Detail: setup_closure (with ScopeInfo) Source: https://apidia.net/java/Jython/2.7.4/org.python.compiler.ScopeInfo.html Sets up the closure on this scope using the passed in scope. This is used by jythonc to setup its closures. ```APIDOC ## Method Detail: setup_closure ### Description Sets up the closure on this scope using the passed in scope. This is used by jythonc to setup its closures. ### Method public void setup_closure(ScopeInfo up) ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None (void method) #### Response Example None ``` -------------------------------- ### startswith (with prefix and start index) Source: https://apidia.net/java/Jython/2.7.4/org.python.core.PyShadowString.html Overrides PyString.startswith to check if a string starts with a specified prefix within a sub-range defined by the start index. ```APIDOC ## public boolean startswith(PyObject prefix, PyObject start) ### Description Overrides org.python.core.PyString.startswith. Doc from org.python.core.PyString.startswith. Equivalent to the Python `str.startswith` method, testing whether a string starts with a specified prefix, where a sub-range is specified by `[start:]`. `start` is interpreted as in slice notation, with null or `Py#None` representing "missing". `prefix` can also be a tuple of prefixes to look for. ### Method public ### Parameters #### Path Parameters - **prefix** (PyObject) - Required - string to check for (or a `PyTuple` of them). - **start** (PyObject) - Required - start of slice. ### Response #### Success Response (200) - **boolean** - True if the string starts with the prefix within the specified range, otherwise false. ``` -------------------------------- ### start() Method Source: https://apidia.net/java/Jython/2.7.4/org.python.indexer.Def.html Represents the start of a sequence or operation. ```APIDOC ## public int start() ### Description Represents the start of a sequence or operation. ### Method GET ### Endpoint /websites/apidia_net_java_jython_2_7_4/start ### Response #### Success Response (200) - **return_value** (int) - An integer indicating the start point. ``` -------------------------------- ### Method Detail: setup_closure (overloaded) Source: https://apidia.net/java/Jython/2.7.4/org.python.compiler.ScopeInfo.html Sets up the closure on this scope using the scope passed into cook as the containing scope. ```APIDOC ## Method Detail: setup_closure ### Description Sets up the closure on this scope using the scope passed into cook as the containing scope. ### Method public void setup_closure() ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None (void method) #### Response Example None ``` -------------------------------- ### Initialization and Listing Source: https://apidia.net/java/Jython/2.7.4/org.python.indexer.Builtins.html Methods for initializing and listing modules. ```APIDOC ## init ### Description Initializes the module. ### Method pack-priv void ### Endpoint init ``` ```APIDOC ## list ### Description Lists modules by name. ### Method pack-priv String[] ### Parameters #### Path Parameters - **names** (String...) - Required - The names of the modules to list. ### Endpoint list ``` -------------------------------- ### PyUnicodeConstant Method Detail: get Source: https://apidia.net/java/Jython/2.7.4/org.python.compiler.PyUnicodeConstant.html Details of the 'get' method. ```APIDOC ## Method Detail ### get |---|---| | pack-priv void **get**(Code c) **throws** IOException Implements abstract org.python.compiler.Constant.get. | ### Annotations * @Override ``` -------------------------------- ### Python Initialization and Configuration Source: https://apidia.net/java/Jython/2.7.4/org.python.core.Py.html Methods for initializing Jython and importing modules. ```APIDOC ## POST /importSiteIfSelected ### Description Imports the site-specific module if it has been selected. ### Method POST ### Endpoint /importSiteIfSelected ### Parameters None ### Response #### Success Response (200) - **result** (boolean) - True if the site module was imported, false otherwise. #### Response Example ```json { "result": true } ``` ``` ```APIDOC ## POST /initClassExceptions ### Description Initializes class exceptions within the provided dictionary. ### Method POST ### Endpoint /initClassExceptions ### Parameters #### Request Body - **dict** (PyObject) - The dictionary to initialize exceptions in. ### Response #### Success Response (200) - **void** - No content returned on successful execution. #### Response Example (No content) ``` ```APIDOC ## POST /initExc ### Description Initializes a Python exception with a given name, exceptions, and dictionary. ### Method POST ### Endpoint /initExc ### Parameters #### Request Body - **name** (String) - The name of the exception. - **exceptions** (PyObject) - The collection of exceptions. - **dict** (PyObject) - The dictionary to associate with the exception. ### Response #### Success Response (200) - **result** (PyObject) - The initialized exception object. #### Response Example ```json { "result": "" } ``` ``` ```APIDOC ## POST /initProxy ### Description Initializes a Python proxy object with module, class, and arguments. ### Method POST ### Endpoint /initProxy ### Parameters #### Request Body - **proxy** (PyProxy) - The proxy object to initialize. - **module** (String) - The module name. - **pyclass** (String) - The Python class name. - **args** (Object[]) - An array of arguments for initialization. ### Response #### Success Response (200) - **void** - No content returned on successful execution. #### Response Example (No content) ``` ```APIDOC ## POST /initPython ### Description Initializes the Jython Python environment. This method is synchronized. ### Method POST ### Endpoint /initPython ### Parameters None ### Response #### Success Response (200) - **result** (boolean) - True if initialization was successful, false otherwise. #### Response Example ```json { "result": true } ``` ``` -------------------------------- ### PyStringConstant Method Detail: get Source: https://apidia.net/java/Jython/2.7.4/org.python.compiler.PyStringConstant.html Details of the 'get' method. ```APIDOC ## Method Detail ### get pack-priv void **get**(Code c) **throws** IOException Implements abstract org.python.compiler.Constant.get. Annotations: @Override ``` -------------------------------- ### Method Detail: In___init__() Source: https://apidia.net/java/Jython/2.7.4/org.python.antlr.op.In.html Detailed information about the In___init__ method. ```APIDOC ## Method Detail: In___init__() ### `public void In___init__(PyObject[] args, String[] keywords)` #### Annotations * @ExposedNew * @ExposedMethod ``` -------------------------------- ### Method Detail: __init__ Source: https://apidia.net/java/Jython/2.7.4/org.python.core.PyBaseException.html Constructor for the object. ```APIDOC ## Method Detail: __init__ ### Method public void __init__(PyObject[] args, String[] keywords) ``` -------------------------------- ### Method Detail: get Source: https://apidia.net/java/Jython/2.7.4/org.python.compiler.PyFloatConstant.html Detailed description of the 'get' method. ```APIDOC ## Method Detail ### get pack-priv void **get**(Code c) throws IOException Implements abstract org.python.compiler.Constant.get. Annotations: @Override ``` -------------------------------- ### dbexts Initialization and Configuration Source: https://apidia.net/java/Jython/2.7.4/zxjdbc-info.html Details on how to initialize the dbexts class and configure it using a configuration file. ```APIDOC ## `__init__(self, dbname=None, cfg=None, resultformatter=format_resultset, autocommit=1)` ### Description The initialization method for the dbexts class. If `dbname` is None, the default connection, as specified in the `cfg` file will be used. ### Parameters #### Path Parameters - **dbname** (string) - Optional - The name of the database to connect to. - **cfg** (string) - Optional - The path to the configuration file. - **resultformatter** (function) - Optional - A function to format the results. - **autocommit** (int) - Optional - Whether to enable autocommit. ``` -------------------------------- ### start Methods Source: https://apidia.net/java/Jython/2.7.4/org.python.modules.sre.MatchObject.html Methods for retrieving the start position, with and without an index. ```APIDOC ## public PyObject start() ### Description Returns the start position. ### Method public ### Endpoint N/A (Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **PyObject** - The start position ``` ```APIDOC ## public PyObject start(PyObject index_) ### Description Returns the start position at a specific index. ### Method public ### Endpoint N/A (Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **PyObject** - The start position at the given index ``` -------------------------------- ### PyLongConstant Method Detail: get Source: https://apidia.net/java/Jython/2.7.4/org.python.compiler.PyLongConstant.html Detailed description of the 'get' method. ```APIDOC ## Method Detail ### get back to summary --- pack-priv void **get**(Code c) **throws** IOException Implements abstract org.python.compiler.Constant.get. Annotations @Override ``` -------------------------------- ### PyIntegerConstant Method Detail: get Source: https://apidia.net/java/Jython/2.7.4/org.python.compiler.PyIntegerConstant.html Detailed description of the 'get' method. ```APIDOC ## Method Detail ### get back to summary --- pack-priv void **get**(Code c) **throws** IOException Implements abstract org.python.compiler.Constant.get. ### Annotations * @Override ``` -------------------------------- ### Method Detail: Load___init__() Source: https://apidia.net/java/Jython/2.7.4/org.python.antlr.op.Load.html Detailed information about the Load___init__() method. ```APIDOC ## Method Detail: Load___init__() ### Load___init__(PyObject[] args, String[] keywords) - **Modifier**: `public void` - **Description**: ### Annotations * @ExposedNew * @ExposedMethod ``` -------------------------------- ### Get and Set Operations Source: https://apidia.net/java/Jython/2.7.4/org.python.core.PyObject.html Methods for getting and setting values within a container. ```APIDOC ## _doget(PyObject container) ### Description Gets a value from the specified container. ### Method public PyObject ### Parameters - **container** (PyObject) - The container to get the value from. ### Returns - **PyObject** - The retrieved value. ## _doget(PyObject container, PyObject wherefound) ### Description Gets a value from the specified container, with an additional parameter for where it was found. ### Method public PyObject ### Parameters - **container** (PyObject) - The container to get the value from. - **wherefound** (PyObject) - Information about where the value was found. ### Returns - **PyObject** - The retrieved value. ## _doset(PyObject container, PyObject value) ### Description Sets a value within the specified container. ### Method public boolean ### Parameters - **container** (PyObject) - The container to set the value in. - **value** (PyObject) - The value to set. ### Returns - **boolean** - True if the value was set successfully, false otherwise. ``` -------------------------------- ### Execute Startup File in Jython Source: https://apidia.net/java/Jython/2.7.4/org.python.util.jython.html Attempts to execute a startup file specified by the 'python.startup' registry entry or 'JYTHONSTARTUP' environment variable. ```java private static void| runStartupFile(InteractiveConsole to do the workinterp)Attempt to execute the file named in the registry entry `python.startup`, which may also have been set via the environment variable `JYTHONSTARTUP`. ``` -------------------------------- ### Initialization and Setting Methods Source: https://apidia.net/java/Jython/2.7.4/org.python.antlr.ast.List.html Methods for initializing objects and setting various properties. ```APIDOC ## List___init__ ### Description Initializes a List object. ### Method public void List___init__(PyObject[] args, String[] keywords) ### Endpoint N/A (Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **args** (PyObject[]) - Required - Positional arguments. - **keywords** (String[]) - Required - Keyword arguments. ### Request Example None ### Response #### Success Response (200) Type: void #### Response Example None ## setContext ### Description Sets the context for the object. ### Method public void setContext(expr_contextType c) ### Endpoint N/A (Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **c** (expr_contextType) - Required - The context to set. ### Request Example None ### Response #### Success Response (200) Type: void #### Response Example None ## setCtx ### Description Sets the context object. ### Method public void setCtx(PyObject ctx) ### Endpoint N/A (Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **ctx** (PyObject) - Required - The context object to set. ### Request Example None ### Response #### Success Response (200) Type: void #### Response Example None ## setElts ### Description Sets the elements of the object. ### Method public void setElts(PyObject elts) ### Endpoint N/A (Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **elts** (PyObject) - Required - The elements to set. ### Request Example None ### Response #### Success Response (200) Type: void #### Response Example None ``` -------------------------------- ### PyArray Example Usage Source: https://apidia.net/java/Jython/2.7.4/org.python.core.PyArray.html Example demonstrating the creation and usage of PyArray with a Java type. ```APIDOC ## Example Usage ```python >>> from java.math import BigDecimal >>> ax = array.array(BigDecimal, (BigDecimal(str(n)) for n in range(5))) >>> ax array(java.math.BigDecimal, [0, 1, 2, 3, 4]) >>> type(ax[2]) ``` **Description:** This example shows how to create a `PyArray` instance using a Java class (`BigDecimal`) as the item type and initializing it with a generator expression. It also demonstrates accessing elements and their types. ``` -------------------------------- ### Environment Setup API Source: https://apidia.net/java/Jython/2.7.4/org.python.core.PyFrame.html API endpoint for setting up the execution environment with closure variables. ```APIDOC ## POST /jython/setupEnv ### Description Populates the frame with closure variables, but at most once. ### Method POST ### Endpoint /jython/setupEnv ### Parameters #### Request Body - **a_PyTuple_freevars** (PyTuple) - Required - A PyTuple containing free variables. ``` -------------------------------- ### void dispatch__init__(PyObject[] args, String[] keywords) Source: https://apidia.net/java/Jython/2.7.4/org.python.antlr.op.LtEDerived.html Overrides org.python.core.PyObject.dispatch__init__. Dispatch __init__ behavior. ```APIDOC ## dispatch__init__ ### Description Overrides org.python.core.PyObject.dispatch__init__. Dispatch __init__ behavior. ### Method public void dispatch__init__(PyObject[] args, String[] keywords) ### Endpoint N/A (Method within a class) ``` -------------------------------- ### Start Method Source: https://apidia.net/java/Jython/2.7.4/org.python.expose.generate.Exposer.html Starts the process of building a method within the generated class. Requires the method name, return type, and argument types. Must be followed by endMethod before starting another method or constructor. ```java protected void startMethod(String name, Type ret, Type... args) ``` -------------------------------- ### keyword___init__ Method Source: https://apidia.net/java/Jython/2.7.4/org.python.antlr.ast.keyword.html Initializes the object with keyword arguments. Annotated with @ExposedNew and @ExposedMethod. ```APIDOC ## keyword___init__ Method ### Description Initializes the object with keyword arguments. Annotated with @ExposedNew and @ExposedMethod. ### Method public void keyword___init__(PyObject[] args, String[] keywords) ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Platform Independent Files Installation Path Source: https://apidia.net/java/Jython/2.7.4/org.python.core.PySystemState.html Details the installation path for platform-independent Python files. ```APIDOC ## Platform Independent Files Installation Path ### Description Retrieves the site-specific directory prefix where platform-independent Python files are installed. This is typically derived from `python.home` or the Jython JAR location. The `prefix/Lib` directory contains the main collection of Python library modules. ### Attribute - **prefix** (public static PyObject) - A string representing the installation prefix for platform-independent Python files. This value should be in bytes for file system encoding consistency. ``` -------------------------------- ### Method Detail: Or___init__() Source: https://apidia.net/java/Jython/2.7.4/org.python.antlr.op.Or.html Detailed information about the public void Or___init__(PyObject[] args, String[] keywords) method. ```APIDOC ## Method Detail ### Or___init__(PyObject[] args, String[] keywords) - **Modifier**: public - **Type**: void - **Description**: - **Annotations**: @ExposedNew, @ExposedMethod ``` -------------------------------- ### shadowstr_startswith Source: https://apidia.net/java/Jython/2.7.4/org.python.core.PyShadowString.html Checks if the shadow string starts with a specified prefix, with optional start and end points. ```APIDOC ## pack-priv final boolean shadowstr_startswith(PyObject prefix, PyObject startObj, PyObject endObj) ### Description Checks if the shadow string starts with a specified prefix, with optional start and end points. ### Method pack-priv final ### Parameters #### Path Parameters - **prefix** (PyObject) - Required - The prefix to check for. - **startObj** (PyObject) - Optional - The starting object. - **endObj** (PyObject) - Optional - The ending object. ### Response #### Success Response (200) - **boolean** - True if the string starts with the prefix, false otherwise. ### Annotations @ExposedMethod ### Defaults - null, null ``` -------------------------------- ### Method Detail: Continue___init__ Source: https://apidia.net/java/Jython/2.7.4/org.python.antlr.ast.Continue.html The Continue___init__ method is the constructor for the Continue class, used for initialization with arguments and keywords. ```APIDOC ## Method Detail: Continue___init__ ### Description Initializes a new instance of the Continue class with the provided arguments and keywords. This is the constructor for the Continue class. ### Method `public void Continue___init__(PyObject[] args, String[] keywords)` ### Parameters * **args** (PyObject[]) - An array of positional arguments. * **keywords** (String[]) - An array of keyword arguments. ``` -------------------------------- ### End Constructor Source: https://apidia.net/java/Jython/2.7.4/org.python.expose.generate.Exposer.html Closes the constructor that was started by a call to startConstructor. This must be called before starting another constructor or method. ```java protected void endConstructor() ``` -------------------------------- ### Initialization Method Source: https://apidia.net/java/Jython/2.7.4/org.python.antlr.ast.ExtSlice.html Constructor for the ExtSlice class. ```APIDOC ## ExtSlice Constructor ### Description Initializes an ExtSlice object. ### Method `ExtSlice___init__`: public void ExtSlice___init__(PyObject[] args, String[] keywords) ### Endpoint N/A (Constructor) ### Parameters - **args** (PyObject[]) - Required - Positional arguments. - **keywords** (String[]) - Required - Keyword arguments. ### Request Body N/A ### Response void (no return value) ### Request Example N/A ### Response Example N/A ``` -------------------------------- ### Method Detail: BaseException___init__ Source: https://apidia.net/java/Jython/2.7.4/org.python.core.PyBaseException.html Initializes the exception. See help(type(x)) for signature. ```APIDOC ## Method Detail: BaseException___init__ ### Description Initializes the exception; see help(type(x)) for signature. ### Method pack-priv final void BaseException___init__(PyObject[] args, String[] keywords) ### Annotations @ExposedNew @ExposedMethod ``` -------------------------------- ### PyByteArray startsWith Source: https://apidia.net/java/Jython/2.7.4/org.python.core.PyByteArray.html Checks if the byte array starts with a specified prefix, with optional start and end indices for the match. ```APIDOC ## startsWith ### Description Implementation of Python `startswith(prefix)` and `startswith(prefix [, start [, end]])`. Checks if this byte array (or a slice of it) begins with the given prefix. ### Method `boolean` ### Overloads 1. `startswith(PyObject prefix)` 2. `startswith(PyObject prefix, PyObject start)` 3. `startswith(PyObject prefix, PyObject start, PyObject end)` ### Parameters - **prefix** (PyObject) - The byte array or tuple of byte arrays to match. - **start** (PyObject) - Optional. The starting index of the slice in this bytearray to match. - **end** (PyObject) - Optional. The ending index of the slice in this bytearray to match. ### Returns `true` if the byte array starts with the prefix, `false` otherwise. ``` -------------------------------- ### Get Static Field Source: https://apidia.net/java/Jython/2.7.4/org.python.expose.generate.Exposer.html Gets a static field from a specified type. Requires the type, field name, and field type. ```java protected void getStatic(Type onType, String fieldName, Type ofType) ``` -------------------------------- ### PyServletInitializer Configuration Source: https://apidia.net/java/Jython/2.7.4/org.python.util.PyServletInitializer.html Configuration examples for integrating PyServletInitializer into your web application's web.xml file. ```APIDOC ## PyServletInitializer Configuration This section provides examples of how to configure the `PyServletInitializer` in your `web.xml` file. ### Listener Configuration To run the initializer, add the following to your `web.xml`: ```xml org.python.util.PyServletInitializer 1 ``` ### Python Home Configuration To use modules from Python's standard library, you can specify the `python.home` context parameter in `web.xml`: ```xml python.home /usr/local/jython-2.5 ``` ``` -------------------------------- ### PyObject Initialization and Utility Methods Source: https://apidia.net/java/Jython/2.7.4/org.python.antlr.ast.argumentsDerived.html Details methods for initializing PyObject instances and other utility functions. ```APIDOC ## dispatch__init__ ### Description Dispatch __init__ behavior. ### Method public void dispatch__init__(PyObject[] args, String[] keywords) ### Endpoint N/A (Method) ### Parameters - **args** (PyObject[]) - The arguments for initialization. - **keywords** (String[]) - The keyword arguments for initialization. ## getSlot ### Description Implements org.python.core.Slotted.getSlot. ### Method public PyObject getSlot(int index) ### Endpoint N/A (Method) ### Parameters - **index** (int) - The index of the slot. ### Response #### Success Response (200) - **PyObject** - The object in the specified slot. ## hashCode ### Description Overrides org.python.core.PyObject.hashCode. Returns a hash code value for this object. ### Method public int hashCode() ### Endpoint N/A (Method) ### Response #### Success Response (200) - **int** - A hash code value for this object. ## setSlot ### Description Implements org.python.core.Slotted.setSlot. ### Method public void setSlot(int index, PyObject value) ### Endpoint N/A (Method) ### Parameters - **index** (int) - The index of the slot. - **value** (PyObject) - The value to set. ## toString ### Description Overrides org.python.antlr.ast.arguments.toString. Returns a string representation of the object. ### Method public String toString() ### Endpoint N/A (Method) ### Response #### Success Response (200) - **String** - A string representation of the object. ## traverseDerived ### Description Implements org.python.core.TraverseprocDerived.traverseDerived. Traverses all reachable `PyObject`s. ### Method public int traverseDerived(Visitproc visit, Object arg) ### Endpoint N/A (Method) ### Parameters - **visit** (Visitproc) - The visit procedure. - **arg** (Object) - The argument for the visit procedure. ``` -------------------------------- ### SystemExit__init__ Source: https://apidia.net/java/Jython/2.7.4/org.python.core.exceptions.html Initializes the SystemExit object. ```APIDOC ## SystemExit__init__ ### Description Initializes the SystemExit object. ### Method public static void SystemExit__init__(PyObject self, PyObject[] args, String[] kwargs) ### Parameters #### Path Parameters - **self** (PyObject) - Required - **args** (PyObject[]) - Required - **kwargs** (String[]) - Required ``` -------------------------------- ### PyString.startswith(prefix, start, end) Source: https://apidia.net/java/Jython/2.7.4/org.python.core.PyShadowString.html Tests whether a string starts with a specified prefix, optionally within a given range. Supports a tuple of prefixes. ```APIDOC ## public boolean startswith(PyObject prefix, PyObject start, PyObject end) ### Description Equivalent to the Python `str.startswith` method, testing whether a string starts with a specified prefix, where a sub-range is specified by `[start:end]`. Arguments `start` and `end` are interpreted as in slice notation, with null or `Py#None` representing "missing". `prefix` can also be a tuple of prefixes to look for. ### Method public boolean startswith ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **return value** (boolean) - `true` if this string slice starts with a specified prefix, otherwise `false`. #### Response Example None ``` -------------------------------- ### NIndex Constructor Detail: NIndex(NNode n, int start, int end) Source: https://apidia.net/java/Jython/2.7.4/org.python.indexer.ast.NIndex.html Detailed information about the NIndex constructor that takes an NNode, start, and end. ```APIDOC ## Constructor Detail: NIndex(NNode n, int start, int end) - **NIndex**(NNode n, int start, int end) ``` -------------------------------- ### void dispatch__init__ Source: https://apidia.net/java/Jython/2.7.4/org.python.antlr.ASTDerived.html Overrides org.python.core.PyObject.dispatch__init__. Dispatches __init__ behavior. ```APIDOC ## public void dispatch__init__(PyObject[] args, String[] keywords) ### Description Overrides org.python.core.PyObject.dispatch__init__. Dispatches __init__ behavior. ### Method POST ### Parameters #### Path Parameters - **args** (PyObject[]) - Required - Arguments for initialization. - **keywords** (String[]) - Required - Keywords for initialization. ``` -------------------------------- ### IntegerFormatter append(CharSequence csq, int start, int end) Source: https://apidia.net/java/Jython/2.7.4/org.python.core.stringlib.IntegerFormatter.html Appends a subsequence of the specified character sequence to the Appendable, with specified start and end indices. ```APIDOC ## append(CharSequence csq, int start, int end) ### Description Appends a subsequence of the specified character sequence to this `Appendable`. An invocation of this method of the form `out.append(csq, start, end)` when `csq` is not `null`, behaves in exactly the same way as the invocation `out.append(csq.subSequence(start, end))`. The contents of this `Appendable` are unspecified if the `CharSequence` is modified during the method call or an exception is thrown when accessing the `CharSequence`. ### Method public IntegerFormatter append(CharSequence csq, int start, int end) throws IndexOutOfBoundsException ### Parameters - **csq** (CharSequence) - The character sequence from which a subsequence will be appended. If `csq` is `null`, then characters will be appended as if `csq` contained the four characters `"null"`. - **start** (int) - The index of the first character in the subsequence - **end** (int) - The index of the character following the last character in the subsequence ### Exceptions - **IndexOutOfBoundsException** - If `start` or `end` are negative, `start` is greater than `end`, or `end` is greater than `csq.length()` ### Response #### Success Response (200) - **IntegerFormatter** - A reference to this `Appendable` ``` -------------------------------- ### fromstring (int start, String input) Source: https://apidia.net/java/Jython/2.7.4/org.python.core.PyArray.html Reads primitive values from a string into a slice of the array, defined by a start index and the number of items encoded in the bytes. ```APIDOC ## fromstring (int start, String input) ### Description Reads primitive values from a stream into a slice of the array, defined by a start and the number of items encoded in the bytes. Data are read until the array slice is filled or the stream runs out. Data in the array beyond the slice are not altered. Write a slice of the array with primitive values items from the string, interpreting the string as an array of bytes (as if it had been read from a file using the `fromfile()` method). The bytes encode primitive values of the type appropriate to the array. ### Parameters #### Path Parameters - **start** (int) - first element index to read into - **input** (String) - string of bytes containing array data ### Returns - **int** - number of primitives successfully read (`=count`, if not ended by EOF) ``` -------------------------------- ### Object and String Instructions Source: https://apidia.net/java/Jython/2.7.4/org.python.modules.jffi.SkinnyMethodAdapter.html Instructions for object instantiation and method invocation. ```APIDOC ## instance_of ### Description Determines if an object is an instance of a class. ### Parameters #### Path Parameters - **arg0** (String) - Required - The name of the class. ### Method public void instance_of(String arg0) ## invokeinterface ### Description Invokes an interface method on an object. ### Parameters #### Path Parameters - **arg1** (String) - Required - The name of the method. - **arg2** (String) - Required - The method descriptor. - **arg3** (String) - Required - The number of interface method arguments. ### Method public void invokeinterface(String arg1, String arg2, String arg3) ## invokespecial ### Description Invokes a special method, typically a constructor or a private method. ### Parameters #### Path Parameters - **arg1** (String) - Required - The name of the method. - **arg2** (String) - Required - The method descriptor. - **arg3** (String) - Required - The number of interface method arguments. ### Method public void invokespecial(String arg1, String arg2, String arg3) ## invokestatic ### Description Invokes a static method. ### Parameters #### Path Parameters - **arg1** (String) - Required - The name of the method. - **arg2** (String) - Required - The method descriptor. - **arg3** (String) - Required - The number of interface method arguments. ### Method public void invokestatic(String arg1, String arg2, String arg3) ## invokevirtual ### Description Invokes a virtual method on an object. ### Parameters #### Path Parameters - **arg1** (String) - Required - The name of the method. - **arg2** (String) - Required - The method descriptor. - **arg3** (String) - Required - The number of interface method arguments. ### Method public void invokevirtual(String arg1, String arg2, String arg3) ``` -------------------------------- ### getBufferSlice(flags, start, count, stride) Source: https://apidia.net/java/Jython/2.7.4/org.python.core.buffer.SimpleStringBuffer.html Retrieves a slice of the buffer described by start index, count, and stride. The consumer must release the returned PyBuffer using PyBuffer.release(). ```APIDOC ## GET /buffer/slice/strided ### Description Get a `PyBuffer` that represents a slice of the current one described in terms of a start index, number of items to include in the slice, and the stride in the current buffer. A consumer that obtains a `PyBuffer` with `getBufferSlice` must release it with `PyBuffer#release`. ### Method GET ### Endpoint `/buffer/slice/strided` ### Parameters #### Query Parameters - **flags** (int) - Required - Specifies features demanded and navigational capabilities of the consumer. - **start** (int) - Required - The starting index in the current buffer. - **count** (int) - Required - The number of items in the required slice. - **stride** (int) - Required - The index-distance in the current buffer between consecutive items in the slice. ### Response #### Success Response (200) - **PyBuffer** - A buffer representing the slice. #### Response Example ```json { "strided_slice_data": "..." } ``` ``` -------------------------------- ### tryAddPackage Method Source: https://apidia.net/java/Jython/2.7.4/org.python.core.JavaImportHelper.html Attempts to add a Java package to the VM. ```APIDOC ## tryAddPackage ### Description Try to add the java package. ### Method protected static boolean ### Endpoint N/A ### Parameters * **packageName** (String) - The dotted name of the java package. * **fromlist** (PyObject) - A tuple with the from names to import. Can be null or empty. ### Request Example None ### Response #### Success Response (200) * **boolean** - `true` if a java package was doubtlessly identified and added, `false` otherwise. #### Response Example None ``` -------------------------------- ### Get Pointer to Item in Multi-dimensional Buffer Source: https://apidia.net/java/Jython/2.7.4/org.python.core.buffer.SimpleBuffer.html This method is used for multi-dimensional buffers to get a structure describing the position of a single item. It calculates the offset of a specific multi-dimensional index within the underlying byte array. ```java int i, j, k; // ... calculation that assigns i, j, k PyBuffer a = obj.getBuffer(PyBUF.FULL); int itemsize = a.getItemsize(); PyBuffer.Pointer b = a.getPointer(i,j,k); ``` -------------------------------- ### Get Pointer to Item in 1D Buffer Source: https://apidia.net/java/Jython/2.7.4/org.python.core.buffer.SimpleBuffer.html Use this method to get a structure describing the position of a single item in a one-dimensional contiguous buffer. It calculates the offset of a particular index within the underlying byte array. ```java int k = ... ; PyBuffer a = obj.getBuffer(PyBUF.FULL); int itemsize = a.getItemsize(); PyBuffer.Pointer b = a.getPointer(k); ``` -------------------------------- ### void dispatch__init__ Source: https://apidia.net/java/Jython/2.7.4/org.python.antlr.ast.SuiteDerived.html Overrides org.python.core.PyObject.dispatch__init__. Dispatch __init__ behavior. ```APIDOC ## dispatch__init__ ### Description Overrides org.python.core.PyObject.dispatch__init__. Dispatch __init__ behavior. ### Method public void dispatch__init__(PyObject[] args, String[] keywords) ### Endpoint N/A ``` -------------------------------- ### getStart Source: https://apidia.net/java/Jython/2.7.4/org.python.core.exceptions.html Determines the start position for UnicodeErrors. ```APIDOC ## getStart ### Description Determine the start position for UnicodeErrors. ### Method public static int getStart(PyObject self, boolean unicode) ### Parameters #### Path Parameters - **self** (PyObject) - Required - a UnicodeError value - **unicode** (boolean) - Required - whether the UnicodeError object should be unicode ### Response #### Success Response (200) - **int** - an the start position ``` -------------------------------- ### Get Address Source: https://apidia.net/java/Jython/2.7.4/org.python.modules.jffi.NativeMemory.html Retrieves the memory address. ```APIDOC ## getAddress Memory Address ### Description Retrieves the memory address of the current object. ### Method `public final long getAddress()` ### Response #### Success Response (long) * **address** (long) - The memory address. ```