+++ /dev/null
-import org.python.core.*;
-
-public class PathVFS extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject i$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyFunctionTable funcTable;
- private static PyCode c$0___init__;
- private static PyCode c$1_open;
- private static PyCode c$2___repr__;
- private static PyCode c$3_JarVFS;
- private static PyCode c$4___init__;
- private static PyCode c$5_open;
- private static PyCode c$6___repr__;
- private static PyCode c$7_DirVFS;
- private static PyCode c$8_add_vfs;
- private static PyCode c$9___init__;
- private static PyCode c$10_open;
- private static PyCode c$11_PathVFS;
- private static PyCode c$12_main;
- private static void initConstants() {
- s$0 = Py.newString("<jar-vfs '%s'>");
- s$1 = Py.newString("");
- s$2 = Py.newString("/");
- s$3 = Py.newString("<dir-vfs '%s'>");
- i$4 = Py.newInteger(1);
- s$5 = Py.newString(".jar");
- s$6 = Py.newString(".zip");
- s$7 = Py.newString("python.packages.paths");
- s$8 = Py.newString("java.class.path");
- s$9 = Py.newString(",");
- s$10 = Py.newString("sun.boot.class.path");
- s$11 = Py.newString("/usr/share/jython/Tools/jythonc/PathVFS.py");
- funcTable = new _PyInner();
- c$0___init__ = Py.newCode(2, new String[] {"self", "fname"}, "/usr/share/jython/Tools/jythonc/PathVFS.py", "__init__", false, false, funcTable, 0, null, null, 0, 1);
- c$1_open = Py.newCode(2, new String[] {"self", "id", "ent"}, "/usr/share/jython/Tools/jythonc/PathVFS.py", "open", false, false, funcTable, 1, null, null, 0, 1);
- c$2___repr__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Tools/jythonc/PathVFS.py", "__repr__", false, false, funcTable, 2, null, null, 0, 1);
- c$3_JarVFS = Py.newCode(0, new String[] {}, "/usr/share/jython/Tools/jythonc/PathVFS.py", "JarVFS", false, false, funcTable, 3, null, null, 0, 0);
- c$4___init__ = Py.newCode(2, new String[] {"self", "dir"}, "/usr/share/jython/Tools/jythonc/PathVFS.py", "__init__", false, false, funcTable, 4, null, null, 0, 1);
- c$5_open = Py.newCode(2, new String[] {"self", "id", "f"}, "/usr/share/jython/Tools/jythonc/PathVFS.py", "open", false, false, funcTable, 5, null, null, 0, 1);
- c$6___repr__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Tools/jythonc/PathVFS.py", "__repr__", false, false, funcTable, 6, null, null, 0, 1);
- c$7_DirVFS = Py.newCode(0, new String[] {}, "/usr/share/jython/Tools/jythonc/PathVFS.py", "DirVFS", false, false, funcTable, 7, null, null, 0, 0);
- c$8_add_vfs = Py.newCode(2, new String[] {"self", "fname", "file", "canon"}, "/usr/share/jython/Tools/jythonc/PathVFS.py", "add_vfs", false, false, funcTable, 8, null, null, 0, 1);
- c$9___init__ = Py.newCode(2, new String[] {"self", "registry", "name", "p", "e", "paths", "path"}, "/usr/share/jython/Tools/jythonc/PathVFS.py", "__init__", false, false, funcTable, 9, null, null, 0, 1);
- c$10_open = Py.newCode(2, new String[] {"self", "id", "v", "stream"}, "/usr/share/jython/Tools/jythonc/PathVFS.py", "open", false, false, funcTable, 10, null, null, 0, 1);
- c$11_PathVFS = Py.newCode(0, new String[] {}, "/usr/share/jython/Tools/jythonc/PathVFS.py", "PathVFS", false, false, funcTable, 11, null, null, 0, 0);
- c$12_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Tools/jythonc/PathVFS.py", "main", false, false, funcTable, 12, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$12_main == null) _PyInner.initConstants();
- return c$12_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.__init__$1(frame);
- case 1:
- return _PyInner.open$2(frame);
- case 2:
- return _PyInner.__repr__$3(frame);
- case 3:
- return _PyInner.JarVFS$4(frame);
- case 4:
- return _PyInner.__init__$5(frame);
- case 5:
- return _PyInner.open$6(frame);
- case 6:
- return _PyInner.__repr__$7(frame);
- case 7:
- return _PyInner.DirVFS$8(frame);
- case 8:
- return _PyInner.add_vfs$9(frame);
- case 9:
- return _PyInner.__init__$10(frame);
- case 10:
- return _PyInner.open$11(frame);
- case 11:
- return _PyInner.PathVFS$12(frame);
- case 12:
- return _PyInner.main$13(frame);
- default:
- return null;
- }
- }
-
- private static PyObject __init__$1(PyFrame frame) {
- frame.getlocal(0).__setattr__("zipfile", frame.getglobal("zip").__getattr__("ZipFile").__call__(frame.getlocal(1)));
- return Py.None;
- }
-
- private static PyObject open$2(PyFrame frame) {
- frame.setlocal(2, frame.getlocal(0).__getattr__("zipfile").invoke("getEntry", frame.getlocal(1)));
- if (frame.getlocal(2).__nonzero__()) {
- return frame.getlocal(0).__getattr__("zipfile").invoke("getInputStream", frame.getlocal(2));
- }
- else {
- return frame.getglobal("None");
- }
- }
-
- private static PyObject __repr__$3(PyFrame frame) {
- return s$0._mod(frame.getlocal(0).__getattr__("zipfile").__getattr__("name"));
- }
-
- private static PyObject JarVFS$4(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$0___init__));
- frame.setlocal("open", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_open));
- frame.setlocal("__repr__", new PyFunction(frame.f_globals, new PyObject[] {}, c$2___repr__));
- return frame.getf_locals();
- }
-
- private static PyObject __init__$5(PyFrame frame) {
- if (frame.getlocal(1)._eq(s$1).__nonzero__()) {
- frame.getlocal(0).__setattr__("pfx", frame.getglobal("None"));
- }
- else {
- frame.getlocal(0).__setattr__("pfx", frame.getlocal(1));
- }
- return Py.None;
- }
-
- private static PyObject open$6(PyFrame frame) {
- frame.setlocal(2, frame.getglobal("io").__getattr__("File").__call__(frame.getlocal(0).__getattr__("pfx"), frame.getlocal(1).invoke("replace", s$2, frame.getglobal("io").__getattr__("File").__getattr__("separator"))));
- if (frame.getlocal(2).__getattr__("file").__nonzero__()) {
- return frame.getglobal("io").__getattr__("BufferedInputStream").__call__(frame.getglobal("io").__getattr__("FileInputStream").__call__(frame.getlocal(2)));
- }
- return frame.getglobal("None");
- }
-
- private static PyObject __repr__$7(PyFrame frame) {
- return s$3._mod(frame.getlocal(0).__getattr__("pfx"));
- }
-
- private static PyObject DirVFS$8(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$4___init__));
- frame.setlocal("open", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_open));
- frame.setlocal("__repr__", new PyFunction(frame.f_globals, new PyObject[] {}, c$6___repr__));
- return frame.getf_locals();
- }
-
- private static PyObject add_vfs$9(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- if (frame.getlocal(1)._eq(s$1).__nonzero__()) {
- if (frame.getlocal(0).__getattr__("once").invoke("has_key", s$1).__not__().__nonzero__()) {
- frame.getlocal(0).__getattr__("once").__setitem__(s$1, i$4);
- frame.getlocal(0).__getattr__("vfs").invoke("append", frame.getglobal("DirVFS").__call__(s$1));
- }
- return Py.None;
- }
- frame.setlocal(2, frame.getglobal("io").__getattr__("File").__call__(frame.getlocal(1)));
- frame.setlocal(3, frame.getlocal(2).__getattr__("canonicalPath"));
- if (frame.getlocal(0).__getattr__("once").invoke("has_key", frame.getlocal(3)).__not__().__nonzero__()) {
- frame.getlocal(0).__getattr__("once").__setitem__(frame.getlocal(3), i$4);
- try {
- if (frame.getlocal(2).__getattr__("directory").__nonzero__()) {
- frame.getlocal(0).__getattr__("vfs").invoke("append", frame.getglobal("DirVFS").__call__(frame.getlocal(1)));
- }
- else {
- if (((t$0$PyObject = frame.getlocal(2).__getattr__("exists")).__nonzero__() ? ((t$1$PyObject = frame.getlocal(1).invoke("endswith", s$5)).__nonzero__() ? t$1$PyObject : frame.getlocal(1).invoke("endswith", s$6)) : t$0$PyObject).__nonzero__()) {
- frame.getlocal(0).__getattr__("vfs").invoke("append", frame.getglobal("JarVFS").__call__(frame.getlocal(1)));
- }
- }
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- // pass
- }
- }
- return Py.None;
- }
-
- private static PyObject __init__$10(PyFrame frame) {
- // Temporary Variables
- int t$0$int, t$1$int, t$2$int;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject, t$4$PyObject, t$5$PyObject;
-
- // Code
- frame.getlocal(0).__setattr__("once", new PyDictionary(new PyObject[] {}));
- frame.getlocal(0).__setattr__("vfs", new PyList(new PyObject[] {}));
- frame.setlocal(5, frame.getlocal(1).invoke("getProperty", s$7, s$8));
- frame.setlocal(5, frame.getlocal(5).invoke("split", s$9));
- if (s$10._in(frame.getlocal(5)).__nonzero__()) {
- frame.getlocal(5).invoke("remove", s$10);
- }
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(5);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(3, t$0$PyObject);
- frame.setlocal(4, frame.getlocal(1).invoke("getProperty", frame.getlocal(3)));
- if (frame.getlocal(4)._ne(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(6, frame.getlocal(4).invoke("split", frame.getglobal("io").__getattr__("File").__getattr__("pathSeparator")));
- t$1$int = 0;
- t$3$PyObject = frame.getlocal(6);
- while ((t$2$PyObject = t$3$PyObject.__finditem__(t$1$int++)) != null) {
- frame.setlocal(2, t$2$PyObject);
- frame.getlocal(0).invoke("add_vfs", frame.getlocal(2));
- }
- }
- }
- t$2$int = 0;
- t$5$PyObject = frame.getglobal("sys").__getattr__("path");
- while ((t$4$PyObject = t$5$PyObject.__finditem__(t$2$int++)) != null) {
- frame.setlocal(2, t$4$PyObject);
- frame.getlocal(0).invoke("add_vfs", frame.getlocal(2));
- }
- frame.getlocal(0).__delattr__("once");
- return Py.None;
- }
-
- private static PyObject open$11(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0).__getattr__("vfs");
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(2, t$0$PyObject);
- frame.setlocal(3, frame.getlocal(2).invoke("open", frame.getlocal(1)));
- if (frame.getlocal(3).__nonzero__()) {
- return frame.getlocal(3);
- }
- }
- return frame.getglobal("None");
- }
-
- private static PyObject PathVFS$12(PyFrame frame) {
- frame.setlocal("add_vfs", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_add_vfs));
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$9___init__));
- frame.setlocal("open", new PyFunction(frame.f_globals, new PyObject[] {}, c$10_open));
- return frame.getf_locals();
- }
-
- private static PyObject main$13(PyFrame frame) {
- frame.setglobal("__file__", s$11);
-
- PyObject[] imp_accu;
- // Code
- frame.setlocal("sys", org.python.core.imp.importOne("sys", frame));
- imp_accu = org.python.core.imp.importFrom("java", new String[] {"io"}, frame);
- frame.setlocal("io", imp_accu[0]);
- imp_accu = null;
- imp_accu = org.python.core.imp.importFrom("java.util", new String[] {"zip"}, frame);
- frame.setlocal("zip", imp_accu[0]);
- imp_accu = null;
- frame.setlocal("JarVFS", Py.makeClass("JarVFS", new PyObject[] {}, c$3_JarVFS, null));
- frame.setlocal("DirVFS", Py.makeClass("DirVFS", new PyObject[] {}, c$7_DirVFS, null));
- frame.setlocal("PathVFS", Py.makeClass("PathVFS", new PyObject[] {}, c$11_PathVFS, null));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("PathVFS"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "PathVFS";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(PathVFS._PyInner.class, newargs, PathVFS.jpy$packages, PathVFS.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class SocketServer extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject s$16;
- private static PyObject s$17;
- private static PyObject s$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject i$22;
- private static PyObject s$23;
- private static PyObject s$24;
- private static PyObject s$25;
- private static PyObject s$26;
- private static PyObject s$27;
- private static PyObject s$28;
- private static PyObject s$29;
- private static PyObject s$30;
- private static PyObject i$31;
- private static PyObject s$32;
- private static PyObject s$33;
- private static PyObject i$34;
- private static PyObject i$35;
- private static PyObject s$36;
- private static PyObject s$37;
- private static PyObject s$38;
- private static PyObject s$39;
- private static PyObject i$40;
- private static PyObject s$41;
- private static PyObject s$42;
- private static PyObject s$43;
- private static PyObject s$44;
- private static PyObject s$45;
- private static PyObject s$46;
- private static PyObject s$47;
- private static PyObject s$48;
- private static PyObject s$49;
- private static PyObject s$50;
- private static PyObject s$51;
- private static PyFunctionTable funcTable;
- private static PyCode c$0___init__;
- private static PyCode c$1_server_activate;
- private static PyCode c$2_serve_forever;
- private static PyCode c$3_handle_request;
- private static PyCode c$4_verify_request;
- private static PyCode c$5_process_request;
- private static PyCode c$6_server_close;
- private static PyCode c$7_finish_request;
- private static PyCode c$8_close_request;
- private static PyCode c$9_handle_error;
- private static PyCode c$10_BaseServer;
- private static PyCode c$11___init__;
- private static PyCode c$12_server_bind;
- private static PyCode c$13_server_activate;
- private static PyCode c$14_server_close;
- private static PyCode c$15_fileno;
- private static PyCode c$16_get_request;
- private static PyCode c$17_close_request;
- private static PyCode c$18_TCPServer;
- private static PyCode c$19_get_request;
- private static PyCode c$20_server_activate;
- private static PyCode c$21_close_request;
- private static PyCode c$22_UDPServer;
- private static PyCode c$23_collect_children;
- private static PyCode c$24_process_request;
- private static PyCode c$25_ForkingMixIn;
- private static PyCode c$26_process_request;
- private static PyCode c$27_ThreadingMixIn;
- private static PyCode c$28_ForkingUDPServer;
- private static PyCode c$29_ForkingTCPServer;
- private static PyCode c$30_ThreadingUDPServer;
- private static PyCode c$31_ThreadingTCPServer;
- private static PyCode c$32_UnixStreamServer;
- private static PyCode c$33_UnixDatagramServer;
- private static PyCode c$34_ThreadingUnixStreamServer;
- private static PyCode c$35_ThreadingUnixDatagramServer;
- private static PyCode c$36___init__;
- private static PyCode c$37_setup;
- private static PyCode c$38___del__;
- private static PyCode c$39_handle;
- private static PyCode c$40_finish;
- private static PyCode c$41_BaseRequestHandler;
- private static PyCode c$42_setup;
- private static PyCode c$43_finish;
- private static PyCode c$44_StreamRequestHandler;
- private static PyCode c$45_setup;
- private static PyCode c$46_finish;
- private static PyCode c$47_DatagramRequestHandler;
- private static PyCode c$48_main;
- private static void initConstants() {
- s$0 = Py.newString("Generic socket server classes.\012\012This module tries to capture the various aspects of defining a server:\012\012For socket-based servers:\012\012- address family:\012 - AF_INET: IP (Internet Protocol) sockets (default)\012 - AF_UNIX: Unix domain sockets\012 - others, e.g. AF_DECNET are conceivable (see <socket.h>\012- socket type:\012 - SOCK_STREAM (reliable stream, e.g. TCP)\012 - SOCK_DGRAM (datagrams, e.g. UDP)\012\012For request-based servers (including socket-based):\012\012- client address verification before further looking at the request\012 (This is actually a hook for any processing that needs to look\012 at the request before anything else, e.g. logging)\012- how to handle multiple requests:\012 - synchronous (one request is handled at a time)\012 - forking (each request is handled by a new process)\012 - threading (each request is handled by a new thread)\012\012The classes in this module favor the server type that is simplest to\012write: a synchronous TCP/IP server. This is bad class design, but\012save some typing. (There's also the issue that a deep class hierarchy\012slows down method lookups.)\012\012There are five classes in an inheritance diagram, four of which represent\012synchronous servers of four types:\012\012 +------------+\012 | BaseServer |\012 +------------+\012 |\012 v\012 +-----------+ +------------------+\012 | TCPServer |------->| UnixStreamServer |\012 +-----------+ +------------------+\012 |\012 v\012 +-----------+ +--------------------+\012 | UDPServer |------->| UnixDatagramServer |\012 +-----------+ +--------------------+\012\012Note that UnixDatagramServer derives from UDPServer, not from\012UnixStreamServer -- the only difference between an IP and a Unix\012stream server is the address family, which is simply repeated in both\012unix server classes.\012\012Forking and threading versions of each type of server can be created\012using the ForkingServer and ThreadingServer mix-in classes. For\012instance, a threading UDP server class is created as follows:\012\012 class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass\012\012The Mix-in class must come first, since it overrides a method defined\012in UDPServer!\012\012To implement a service, you must derive a class from\012BaseRequestHandler and redefine its handle() method. You can then run\012various versions of the service by combining one of the server classes\012with your request handler class.\012\012The request handler class must be different for datagram or stream\012services. This can be hidden by using the mix-in request handler\012classes StreamRequestHandler or DatagramRequestHandler.\012\012Of course, you still have to use your head!\012\012For instance, it makes no sense to use a forking server if the service\012contains state in memory that can be modified by requests (since the\012modifications in the child process would never reach the initial state\012kept in the parent process and passed to each child). In this case,\012you can use a threading server, but you will probably have to use\012locks to avoid two requests that come in nearly simultaneous to apply\012conflicting changes to the server state.\012\012On the other hand, if you are building e.g. an HTTP server, where all\012data is stored externally (e.g. in the file system), a synchronous\012class will essentially render the service \"deaf\" while one request is\012being handled -- which may be for a very long time if a client is slow\012to reqd all the data it has requested. Here a threading or forking\012server is appropriate.\012\012In some cases, it may be appropriate to process part of a request\012synchronously, but to finish processing in a forked child depending on\012the request data. This can be implemented by using a synchronous\012server and doing an explicit fork in the request handler class\012handle() method.\012\012Another approach to handling multiple simultaneous requests in an\012environment that supports neither threads nor fork (or where these are\012too expensive or inappropriate for the service) is to maintain an\012explicit table of partially finished requests and to use select() to\012decide which request to work on next (or whether to handle a new\012incoming request). This is particularly important for stream services\012where each client can potentially be connected for a long time (if\012threads or subprocesses cannot be used).\012\012Future work:\012- Standard classes for Sun RPC (which uses either UDP or TCP)\012- Standard mix-in classes to implement various authentication\012 and encryption schemes\012- Standard framework for select-based multiplexing\012\012XXX Open problems:\012- What to do with out-of-band data?\012\012BaseServer:\012- split generic \"request\" functionality out into BaseServer class.\012 Copyright (C) 2000 Luke Kenneth Casson Leighton <lkcl@samba.org>\012\012 example: read entries from a SQL database (requires overriding\012 get_request() to return a table entry from the database).\012 entry is processed by a RequestHandlerClass.\012\012");
- s$1 = Py.newString("0.4");
- s$2 = Py.newString("TCPServer");
- s$3 = Py.newString("UDPServer");
- s$4 = Py.newString("ForkingUDPServer");
- s$5 = Py.newString("ForkingTCPServer");
- s$6 = Py.newString("ThreadingUDPServer");
- s$7 = Py.newString("ThreadingTCPServer");
- s$8 = Py.newString("BaseRequestHandler");
- s$9 = Py.newString("StreamRequestHandler");
- s$10 = Py.newString("DatagramRequestHandler");
- s$11 = Py.newString("ThreadingMixIn");
- s$12 = Py.newString("ForkingMixIn");
- s$13 = Py.newString("AF_UNIX");
- s$14 = Py.newString("UnixStreamServer");
- s$15 = Py.newString("UnixDatagramServer");
- s$16 = Py.newString("ThreadingUnixStreamServer");
- s$17 = Py.newString("ThreadingUnixDatagramServer");
- s$18 = Py.newString("Base class for server classes.\012\012 Methods for the caller:\012\012 - __init__(server_address, RequestHandlerClass)\012 - serve_forever()\012 - handle_request() # if you do not use serve_forever()\012 - fileno() -> int # for select()\012\012 Methods that may be overridden:\012\012 - server_bind()\012 - server_activate()\012 - get_request() -> request, client_address\012 - verify_request(request, client_address)\012 - server_close()\012 - process_request(request, client_address)\012 - close_request(request)\012 - handle_error()\012\012 Methods for derived classes:\012\012 - finish_request(request, client_address)\012\012 Class variables that may be overridden by derived classes or\012 instances:\012\012 - address_family\012 - socket_type\012 - reuse_address\012\012 Instance variables:\012\012 - RequestHandlerClass\012 - socket\012\012 ");
- s$19 = Py.newString("Constructor. May be extended, do not override.");
- s$20 = Py.newString("Called by constructor to activate the server.\012\012 May be overridden.\012\012 ");
- s$21 = Py.newString("Handle one request at a time until doomsday.");
- i$22 = Py.newInteger(1);
- s$23 = Py.newString("Handle one request, possibly blocking.");
- s$24 = Py.newString("Verify the request. May be overridden.\012\012 Return true if we should proceed with this request.\012\012 ");
- s$25 = Py.newString("Call finish_request.\012\012 Overridden by ForkingMixIn and ThreadingMixIn.\012\012 ");
- s$26 = Py.newString("Called to clean-up the server.\012\012 May be overridden.\012\012 ");
- s$27 = Py.newString("Finish one request by instantiating RequestHandlerClass.");
- s$28 = Py.newString("Called to clean up an individual request.");
- s$29 = Py.newString("Handle an error gracefully. May be overridden.\012\012 The default is to print a traceback and continue.\012\012 ");
- s$30 = Py.newString("-");
- i$31 = Py.newInteger(40);
- s$32 = Py.newString("Exception happened during processing of request from");
- s$33 = Py.newString("Base class for various socket-based server classes.\012\012 Defaults to synchronous IP stream (i.e., TCP).\012\012 Methods for the caller:\012\012 - __init__(server_address, RequestHandlerClass)\012 - serve_forever()\012 - handle_request() # if you don't use serve_forever()\012 - fileno() -> int # for select()\012\012 Methods that may be overridden:\012\012 - server_bind()\012 - server_activate()\012 - get_request() -> request, client_address\012 - verify_request(request, client_address)\012 - process_request(request, client_address)\012 - close_request(request)\012 - handle_error()\012\012 Methods for derived classes:\012\012 - finish_request(request, client_address)\012\012 Class variables that may be overridden by derived classes or\012 instances:\012\012 - address_family\012 - socket_type\012 - request_queue_size (only for stream sockets)\012 - reuse_address\012\012 Instance variables:\012\012 - server_address\012 - RequestHandlerClass\012 - socket\012\012 ");
- i$34 = Py.newInteger(5);
- i$35 = Py.newInteger(0);
- s$36 = Py.newString("Called by constructor to bind the socket.\012\012 May be overridden.\012\012 ");
- s$37 = Py.newString("Return socket file number.\012\012 Interface required by select().\012\012 ");
- s$38 = Py.newString("Get the request and client address from the socket.\012\012 May be overridden.\012\012 ");
- s$39 = Py.newString("UDP server class.");
- i$40 = Py.newInteger(8192);
- s$41 = Py.newString("Mix-in class to handle each request in a new process.");
- s$42 = Py.newString("Internal routine to wait for died children.");
- s$43 = Py.newString("Fork a new subprocess to process the request.");
- s$44 = Py.newString("Mix-in class to handle each request in a new thread.");
- s$45 = Py.newString("Start a new thread to process the request.");
- s$46 = Py.newString("Base class for request handler classes.\012\012 This class is instantiated for each request to be handled. The\012 constructor sets the instance variables request, client_address\012 and server, and then calls the handle() method. To implement a\012 specific service, all you need to do is to derive a class which\012 defines a handle() method.\012\012 The handle() method can find the request as self.request, the\012 client address as self.client_address, and the server (in case it\012 needs access to per-server information) as self.server. Since a\012 separate instance is created for each request, the handle() method\012 can define arbitrary other instance variariables.\012\012 ");
- s$47 = Py.newString("Define self.rfile and self.wfile for stream sockets.");
- s$48 = Py.newString("rb");
- s$49 = Py.newString("wb");
- s$50 = Py.newString("Define self.rfile and self.wfile for datagram sockets.");
- s$51 = Py.newString("/usr/share/jython/Lib-cpython/SocketServer.py");
- funcTable = new _PyInner();
- c$0___init__ = Py.newCode(3, new String[] {"self", "server_address", "RequestHandlerClass"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "__init__", false, false, funcTable, 0, null, null, 0, 1);
- c$1_server_activate = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "server_activate", false, false, funcTable, 1, null, null, 0, 1);
- c$2_serve_forever = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "serve_forever", false, false, funcTable, 2, null, null, 0, 1);
- c$3_handle_request = Py.newCode(1, new String[] {"self", "client_address", "request"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "handle_request", false, false, funcTable, 3, null, null, 0, 1);
- c$4_verify_request = Py.newCode(3, new String[] {"self", "request", "client_address"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "verify_request", false, false, funcTable, 4, null, null, 0, 1);
- c$5_process_request = Py.newCode(3, new String[] {"self", "request", "client_address"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "process_request", false, false, funcTable, 5, null, null, 0, 1);
- c$6_server_close = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "server_close", false, false, funcTable, 6, null, null, 0, 1);
- c$7_finish_request = Py.newCode(3, new String[] {"self", "request", "client_address"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "finish_request", false, false, funcTable, 7, null, null, 0, 1);
- c$8_close_request = Py.newCode(2, new String[] {"self", "request"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "close_request", false, false, funcTable, 8, null, null, 0, 1);
- c$9_handle_error = Py.newCode(3, new String[] {"self", "request", "client_address", "traceback"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "handle_error", false, false, funcTable, 9, null, null, 0, 1);
- c$10_BaseServer = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "BaseServer", false, false, funcTable, 10, null, null, 0, 0);
- c$11___init__ = Py.newCode(3, new String[] {"self", "server_address", "RequestHandlerClass"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "__init__", false, false, funcTable, 11, null, null, 0, 1);
- c$12_server_bind = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "server_bind", false, false, funcTable, 12, null, null, 0, 1);
- c$13_server_activate = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "server_activate", false, false, funcTable, 13, null, null, 0, 1);
- c$14_server_close = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "server_close", false, false, funcTable, 14, null, null, 0, 1);
- c$15_fileno = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "fileno", false, false, funcTable, 15, null, null, 0, 1);
- c$16_get_request = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "get_request", false, false, funcTable, 16, null, null, 0, 1);
- c$17_close_request = Py.newCode(2, new String[] {"self", "request"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "close_request", false, false, funcTable, 17, null, null, 0, 1);
- c$18_TCPServer = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "TCPServer", false, false, funcTable, 18, null, null, 0, 0);
- c$19_get_request = Py.newCode(1, new String[] {"self", "client_addr", "data"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "get_request", false, false, funcTable, 19, null, null, 0, 1);
- c$20_server_activate = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "server_activate", false, false, funcTable, 20, null, null, 0, 1);
- c$21_close_request = Py.newCode(2, new String[] {"self", "request"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "close_request", false, false, funcTable, 21, null, null, 0, 1);
- c$22_UDPServer = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "UDPServer", false, false, funcTable, 22, null, null, 0, 0);
- c$23_collect_children = Py.newCode(1, new String[] {"self", "status", "pid", "options"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "collect_children", false, false, funcTable, 23, null, null, 0, 1);
- c$24_process_request = Py.newCode(3, new String[] {"self", "request", "client_address", "pid"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "process_request", false, false, funcTable, 24, null, null, 0, 1);
- c$25_ForkingMixIn = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "ForkingMixIn", false, false, funcTable, 25, null, null, 0, 0);
- c$26_process_request = Py.newCode(3, new String[] {"self", "request", "client_address", "t", "threading"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "process_request", false, false, funcTable, 26, null, null, 0, 1);
- c$27_ThreadingMixIn = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "ThreadingMixIn", false, false, funcTable, 27, null, null, 0, 0);
- c$28_ForkingUDPServer = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "ForkingUDPServer", false, false, funcTable, 28, null, null, 0, 0);
- c$29_ForkingTCPServer = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "ForkingTCPServer", false, false, funcTable, 29, null, null, 0, 0);
- c$30_ThreadingUDPServer = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "ThreadingUDPServer", false, false, funcTable, 30, null, null, 0, 0);
- c$31_ThreadingTCPServer = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "ThreadingTCPServer", false, false, funcTable, 31, null, null, 0, 0);
- c$32_UnixStreamServer = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "UnixStreamServer", false, false, funcTable, 32, null, null, 0, 0);
- c$33_UnixDatagramServer = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "UnixDatagramServer", false, false, funcTable, 33, null, null, 0, 0);
- c$34_ThreadingUnixStreamServer = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "ThreadingUnixStreamServer", false, false, funcTable, 34, null, null, 0, 0);
- c$35_ThreadingUnixDatagramServer = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "ThreadingUnixDatagramServer", false, false, funcTable, 35, null, null, 0, 0);
- c$36___init__ = Py.newCode(4, new String[] {"self", "request", "client_address", "server"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "__init__", false, false, funcTable, 36, null, null, 0, 1);
- c$37_setup = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "setup", false, false, funcTable, 37, null, null, 0, 1);
- c$38___del__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "__del__", false, false, funcTable, 38, null, null, 0, 1);
- c$39_handle = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "handle", false, false, funcTable, 39, null, null, 0, 1);
- c$40_finish = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "finish", false, false, funcTable, 40, null, null, 0, 1);
- c$41_BaseRequestHandler = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "BaseRequestHandler", false, false, funcTable, 41, null, null, 0, 0);
- c$42_setup = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "setup", false, false, funcTable, 42, null, null, 0, 1);
- c$43_finish = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "finish", false, false, funcTable, 43, null, null, 0, 1);
- c$44_StreamRequestHandler = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "StreamRequestHandler", false, false, funcTable, 44, null, null, 0, 0);
- c$45_setup = Py.newCode(1, new String[] {"self", "StringIO"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "setup", false, false, funcTable, 45, null, null, 0, 1);
- c$46_finish = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/SocketServer.py", "finish", false, false, funcTable, 46, null, null, 0, 1);
- c$47_DatagramRequestHandler = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "DatagramRequestHandler", false, false, funcTable, 47, null, null, 0, 0);
- c$48_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/SocketServer.py", "main", false, false, funcTable, 48, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$48_main == null) _PyInner.initConstants();
- return c$48_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.__init__$1(frame);
- case 1:
- return _PyInner.server_activate$2(frame);
- case 2:
- return _PyInner.serve_forever$3(frame);
- case 3:
- return _PyInner.handle_request$4(frame);
- case 4:
- return _PyInner.verify_request$5(frame);
- case 5:
- return _PyInner.process_request$6(frame);
- case 6:
- return _PyInner.server_close$7(frame);
- case 7:
- return _PyInner.finish_request$8(frame);
- case 8:
- return _PyInner.close_request$9(frame);
- case 9:
- return _PyInner.handle_error$10(frame);
- case 10:
- return _PyInner.BaseServer$11(frame);
- case 11:
- return _PyInner.__init__$12(frame);
- case 12:
- return _PyInner.server_bind$13(frame);
- case 13:
- return _PyInner.server_activate$14(frame);
- case 14:
- return _PyInner.server_close$15(frame);
- case 15:
- return _PyInner.fileno$16(frame);
- case 16:
- return _PyInner.get_request$17(frame);
- case 17:
- return _PyInner.close_request$18(frame);
- case 18:
- return _PyInner.TCPServer$19(frame);
- case 19:
- return _PyInner.get_request$20(frame);
- case 20:
- return _PyInner.server_activate$21(frame);
- case 21:
- return _PyInner.close_request$22(frame);
- case 22:
- return _PyInner.UDPServer$23(frame);
- case 23:
- return _PyInner.collect_children$24(frame);
- case 24:
- return _PyInner.process_request$25(frame);
- case 25:
- return _PyInner.ForkingMixIn$26(frame);
- case 26:
- return _PyInner.process_request$27(frame);
- case 27:
- return _PyInner.ThreadingMixIn$28(frame);
- case 28:
- return _PyInner.ForkingUDPServer$29(frame);
- case 29:
- return _PyInner.ForkingTCPServer$30(frame);
- case 30:
- return _PyInner.ThreadingUDPServer$31(frame);
- case 31:
- return _PyInner.ThreadingTCPServer$32(frame);
- case 32:
- return _PyInner.UnixStreamServer$33(frame);
- case 33:
- return _PyInner.UnixDatagramServer$34(frame);
- case 34:
- return _PyInner.ThreadingUnixStreamServer$35(frame);
- case 35:
- return _PyInner.ThreadingUnixDatagramServer$36(frame);
- case 36:
- return _PyInner.__init__$37(frame);
- case 37:
- return _PyInner.setup$38(frame);
- case 38:
- return _PyInner.__del__$39(frame);
- case 39:
- return _PyInner.handle$40(frame);
- case 40:
- return _PyInner.finish$41(frame);
- case 41:
- return _PyInner.BaseRequestHandler$42(frame);
- case 42:
- return _PyInner.setup$43(frame);
- case 43:
- return _PyInner.finish$44(frame);
- case 44:
- return _PyInner.StreamRequestHandler$45(frame);
- case 45:
- return _PyInner.setup$46(frame);
- case 46:
- return _PyInner.finish$47(frame);
- case 47:
- return _PyInner.DatagramRequestHandler$48(frame);
- case 48:
- return _PyInner.main$49(frame);
- default:
- return null;
- }
- }
-
- private static PyObject __init__$1(PyFrame frame) {
- /* Constructor. May be extended, do not override. */
- frame.getlocal(0).__setattr__("server_address", frame.getlocal(1));
- frame.getlocal(0).__setattr__("RequestHandlerClass", frame.getlocal(2));
- return Py.None;
- }
-
- private static PyObject server_activate$2(PyFrame frame) {
- /* Called by constructor to activate the server.
-
- May be overridden.
-
- */
- // pass
- return Py.None;
- }
-
- private static PyObject serve_forever$3(PyFrame frame) {
- /* Handle one request at a time until doomsday. */
- while (i$22.__nonzero__()) {
- frame.getlocal(0).invoke("handle_request");
- }
- return Py.None;
- }
-
- private static PyObject handle_request$4(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
- PyException t$0$PyException;
-
- // Code
- /* Handle one request, possibly blocking. */
- try {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0).invoke("get_request"), 2);
- frame.setlocal(2, t$0$PyObject__[0]);
- frame.setlocal(1, t$0$PyObject__[1]);
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("socket").__getattr__("error"))) {
- return Py.None;
- }
- else throw t$0$PyException;
- }
- if (frame.getlocal(0).invoke("verify_request", frame.getlocal(2), frame.getlocal(1)).__nonzero__()) {
- try {
- frame.getlocal(0).invoke("process_request", frame.getlocal(2), frame.getlocal(1));
- }
- catch (Throwable x$1) {
- t$0$PyException = Py.setException(x$1, frame);
- frame.getlocal(0).invoke("handle_error", frame.getlocal(2), frame.getlocal(1));
- frame.getlocal(0).invoke("close_request", frame.getlocal(2));
- }
- }
- return Py.None;
- }
-
- private static PyObject verify_request$5(PyFrame frame) {
- /* Verify the request. May be overridden.
-
- Return true if we should proceed with this request.
-
- */
- return i$22;
- }
-
- private static PyObject process_request$6(PyFrame frame) {
- /* Call finish_request.
-
- Overridden by ForkingMixIn and ThreadingMixIn.
-
- */
- frame.getlocal(0).invoke("finish_request", frame.getlocal(1), frame.getlocal(2));
- frame.getlocal(0).invoke("close_request", frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject server_close$7(PyFrame frame) {
- /* Called to clean-up the server.
-
- May be overridden.
-
- */
- // pass
- return Py.None;
- }
-
- private static PyObject finish_request$8(PyFrame frame) {
- /* Finish one request by instantiating RequestHandlerClass. */
- frame.getlocal(0).invoke("RequestHandlerClass", new PyObject[] {frame.getlocal(1), frame.getlocal(2), frame.getlocal(0)});
- return Py.None;
- }
-
- private static PyObject close_request$9(PyFrame frame) {
- /* Called to clean up an individual request. */
- // pass
- return Py.None;
- }
-
- private static PyObject handle_error$10(PyFrame frame) {
- /* Handle an error gracefully. May be overridden.
-
- The default is to print a traceback and continue.
-
- */
- Py.println(s$30._mul(i$31));
- Py.printComma(s$32);
- Py.println(frame.getlocal(2));
- frame.setlocal(3, org.python.core.imp.importOne("traceback", frame));
- frame.getlocal(3).__getattr__("print_exc").__call__();
- Py.println(s$30._mul(i$31));
- return Py.None;
- }
-
- private static PyObject BaseServer$11(PyFrame frame) {
- /* Base class for server classes.
-
- Methods for the caller:
-
- - __init__(server_address, RequestHandlerClass)
- - serve_forever()
- - handle_request() # if you do not use serve_forever()
- - fileno() -> int # for select()
-
- Methods that may be overridden:
-
- - server_bind()
- - server_activate()
- - get_request() -> request, client_address
- - verify_request(request, client_address)
- - server_close()
- - process_request(request, client_address)
- - close_request(request)
- - handle_error()
-
- Methods for derived classes:
-
- - finish_request(request, client_address)
-
- Class variables that may be overridden by derived classes or
- instances:
-
- - address_family
- - socket_type
- - reuse_address
-
- Instance variables:
-
- - RequestHandlerClass
- - socket
-
- */
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$0___init__));
- frame.setlocal("server_activate", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_server_activate));
- frame.setlocal("serve_forever", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_serve_forever));
- frame.setlocal("handle_request", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_handle_request));
- frame.setlocal("verify_request", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_verify_request));
- frame.setlocal("process_request", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_process_request));
- frame.setlocal("server_close", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_server_close));
- frame.setlocal("finish_request", new PyFunction(frame.f_globals, new PyObject[] {}, c$7_finish_request));
- frame.setlocal("close_request", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_close_request));
- frame.setlocal("handle_error", new PyFunction(frame.f_globals, new PyObject[] {}, c$9_handle_error));
- return frame.getf_locals();
- }
-
- private static PyObject __init__$12(PyFrame frame) {
- /* Constructor. May be extended, do not override. */
- frame.getglobal("BaseServer").invoke("__init__", new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2)});
- frame.getlocal(0).__setattr__("socket", frame.getglobal("socket").__getattr__("socket").__call__(frame.getlocal(0).__getattr__("address_family"), frame.getlocal(0).__getattr__("socket_type")));
- frame.getlocal(0).invoke("server_bind");
- frame.getlocal(0).invoke("server_activate");
- return Py.None;
- }
-
- private static PyObject server_bind$13(PyFrame frame) {
- /* Called by constructor to bind the socket.
-
- May be overridden.
-
- */
- if (frame.getlocal(0).__getattr__("allow_reuse_address").__nonzero__()) {
- frame.getlocal(0).__getattr__("socket").invoke("setsockopt", new PyObject[] {frame.getglobal("socket").__getattr__("SOL_SOCKET"), frame.getglobal("socket").__getattr__("SO_REUSEADDR"), i$22});
- }
- frame.getlocal(0).__getattr__("socket").invoke("bind", frame.getlocal(0).__getattr__("server_address"));
- return Py.None;
- }
-
- private static PyObject server_activate$14(PyFrame frame) {
- /* Called by constructor to activate the server.
-
- May be overridden.
-
- */
- frame.getlocal(0).__getattr__("socket").invoke("listen", frame.getlocal(0).__getattr__("request_queue_size"));
- return Py.None;
- }
-
- private static PyObject server_close$15(PyFrame frame) {
- /* Called to clean-up the server.
-
- May be overridden.
-
- */
- frame.getlocal(0).__getattr__("socket").invoke("close");
- return Py.None;
- }
-
- private static PyObject fileno$16(PyFrame frame) {
- /* Return socket file number.
-
- Interface required by select().
-
- */
- return frame.getlocal(0).__getattr__("socket").invoke("fileno");
- }
-
- private static PyObject get_request$17(PyFrame frame) {
- /* Get the request and client address from the socket.
-
- May be overridden.
-
- */
- return frame.getlocal(0).__getattr__("socket").invoke("accept");
- }
-
- private static PyObject close_request$18(PyFrame frame) {
- /* Called to clean up an individual request. */
- frame.getlocal(1).invoke("close");
- return Py.None;
- }
-
- private static PyObject TCPServer$19(PyFrame frame) {
- /* Base class for various socket-based server classes.
-
- Defaults to synchronous IP stream (i.e., TCP).
-
- Methods for the caller:
-
- - __init__(server_address, RequestHandlerClass)
- - serve_forever()
- - handle_request() # if you don't use serve_forever()
- - fileno() -> int # for select()
-
- Methods that may be overridden:
-
- - server_bind()
- - server_activate()
- - get_request() -> request, client_address
- - verify_request(request, client_address)
- - process_request(request, client_address)
- - close_request(request)
- - handle_error()
-
- Methods for derived classes:
-
- - finish_request(request, client_address)
-
- Class variables that may be overridden by derived classes or
- instances:
-
- - address_family
- - socket_type
- - request_queue_size (only for stream sockets)
- - reuse_address
-
- Instance variables:
-
- - server_address
- - RequestHandlerClass
- - socket
-
- */
- frame.setlocal("address_family", frame.getname("socket").__getattr__("AF_INET"));
- frame.setlocal("socket_type", frame.getname("socket").__getattr__("SOCK_STREAM"));
- frame.setlocal("request_queue_size", i$34);
- frame.setlocal("allow_reuse_address", i$35);
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$11___init__));
- frame.setlocal("server_bind", new PyFunction(frame.f_globals, new PyObject[] {}, c$12_server_bind));
- frame.setlocal("server_activate", new PyFunction(frame.f_globals, new PyObject[] {}, c$13_server_activate));
- frame.setlocal("server_close", new PyFunction(frame.f_globals, new PyObject[] {}, c$14_server_close));
- frame.setlocal("fileno", new PyFunction(frame.f_globals, new PyObject[] {}, c$15_fileno));
- frame.setlocal("get_request", new PyFunction(frame.f_globals, new PyObject[] {}, c$16_get_request));
- frame.setlocal("close_request", new PyFunction(frame.f_globals, new PyObject[] {}, c$17_close_request));
- return frame.getf_locals();
- }
-
- private static PyObject get_request$20(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0).__getattr__("socket").invoke("recvfrom", frame.getlocal(0).__getattr__("max_packet_size")), 2);
- frame.setlocal(2, t$0$PyObject__[0]);
- frame.setlocal(1, t$0$PyObject__[1]);
- return new PyTuple(new PyObject[] {new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(0).__getattr__("socket")}), frame.getlocal(1)});
- }
-
- private static PyObject server_activate$21(PyFrame frame) {
- // pass
- return Py.None;
- }
-
- private static PyObject close_request$22(PyFrame frame) {
- // pass
- return Py.None;
- }
-
- private static PyObject UDPServer$23(PyFrame frame) {
- /* UDP server class. */
- frame.setlocal("allow_reuse_address", i$35);
- frame.setlocal("socket_type", frame.getname("socket").__getattr__("SOCK_DGRAM"));
- frame.setlocal("max_packet_size", i$40);
- frame.setlocal("get_request", new PyFunction(frame.f_globals, new PyObject[] {}, c$19_get_request));
- frame.setlocal("server_activate", new PyFunction(frame.f_globals, new PyObject[] {}, c$20_server_activate));
- frame.setlocal("close_request", new PyFunction(frame.f_globals, new PyObject[] {}, c$21_close_request));
- return frame.getf_locals();
- }
-
- private static PyObject collect_children$24(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
- PyException t$0$PyException;
-
- // Code
- /* Internal routine to wait for died children. */
- while (frame.getlocal(0).__getattr__("active_children").__nonzero__()) {
- if (frame.getglobal("len").__call__(frame.getlocal(0).__getattr__("active_children"))._lt(frame.getlocal(0).__getattr__("max_children")).__nonzero__()) {
- frame.setlocal(3, frame.getglobal("os").__getattr__("WNOHANG"));
- }
- else {
- frame.setlocal(3, i$35);
- }
- try {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("os").__getattr__("waitpid").__call__(i$35, frame.getlocal(3)), 2);
- frame.setlocal(2, t$0$PyObject__[0]);
- frame.setlocal(1, t$0$PyObject__[1]);
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("os").__getattr__("error"))) {
- frame.setlocal(2, frame.getglobal("None"));
- }
- else throw t$0$PyException;
- }
- if (frame.getlocal(2).__not__().__nonzero__()) {
- break;
- }
- frame.getlocal(0).__getattr__("active_children").invoke("remove", frame.getlocal(2));
- }
- return Py.None;
- }
-
- private static PyObject process_request$25(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- /* Fork a new subprocess to process the request. */
- frame.getlocal(0).invoke("collect_children");
- frame.setlocal(3, frame.getglobal("os").__getattr__("fork").__call__());
- if (frame.getlocal(3).__nonzero__()) {
- if (frame.getlocal(0).__getattr__("active_children")._is(frame.getglobal("None")).__nonzero__()) {
- frame.getlocal(0).__setattr__("active_children", new PyList(new PyObject[] {}));
- }
- frame.getlocal(0).__getattr__("active_children").invoke("append", frame.getlocal(3));
- frame.getlocal(0).invoke("close_request", frame.getlocal(1));
- return Py.None;
- }
- else {
- try {
- frame.getlocal(0).invoke("finish_request", frame.getlocal(1), frame.getlocal(2));
- frame.getglobal("os").__getattr__("_exit").__call__(i$35);
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- try {
- frame.getlocal(0).invoke("handle_error", frame.getlocal(1), frame.getlocal(2));
- }
- finally {
- frame.getglobal("os").__getattr__("_exit").__call__(i$22);
- }
- }
- }
- return Py.None;
- }
-
- private static PyObject ForkingMixIn$26(PyFrame frame) {
- /* Mix-in class to handle each request in a new process. */
- frame.setlocal("active_children", frame.getname("None"));
- frame.setlocal("max_children", i$31);
- frame.setlocal("collect_children", new PyFunction(frame.f_globals, new PyObject[] {}, c$23_collect_children));
- frame.setlocal("process_request", new PyFunction(frame.f_globals, new PyObject[] {}, c$24_process_request));
- return frame.getf_locals();
- }
-
- private static PyObject process_request$27(PyFrame frame) {
- /* Start a new thread to process the request. */
- frame.setlocal(4, org.python.core.imp.importOne("threading", frame));
- frame.setlocal(3, frame.getlocal(4).__getattr__("Thread").__call__(new PyObject[] {frame.getlocal(0).__getattr__("finish_request"), new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(2)})}, new String[] {"target", "args"}));
- frame.getlocal(3).invoke("start");
- return Py.None;
- }
-
- private static PyObject ThreadingMixIn$28(PyFrame frame) {
- /* Mix-in class to handle each request in a new thread. */
- frame.setlocal("process_request", new PyFunction(frame.f_globals, new PyObject[] {}, c$26_process_request));
- return frame.getf_locals();
- }
-
- private static PyObject ForkingUDPServer$29(PyFrame frame) {
- // pass
- return frame.getf_locals();
- }
-
- private static PyObject ForkingTCPServer$30(PyFrame frame) {
- // pass
- return frame.getf_locals();
- }
-
- private static PyObject ThreadingUDPServer$31(PyFrame frame) {
- // pass
- return frame.getf_locals();
- }
-
- private static PyObject ThreadingTCPServer$32(PyFrame frame) {
- // pass
- return frame.getf_locals();
- }
-
- private static PyObject UnixStreamServer$33(PyFrame frame) {
- frame.setlocal("address_family", frame.getname("socket").__getattr__("AF_UNIX"));
- return frame.getf_locals();
- }
-
- private static PyObject UnixDatagramServer$34(PyFrame frame) {
- frame.setlocal("address_family", frame.getname("socket").__getattr__("AF_UNIX"));
- return frame.getf_locals();
- }
-
- private static PyObject ThreadingUnixStreamServer$35(PyFrame frame) {
- // pass
- return frame.getf_locals();
- }
-
- private static PyObject ThreadingUnixDatagramServer$36(PyFrame frame) {
- // pass
- return frame.getf_locals();
- }
-
- private static PyObject __init__$37(PyFrame frame) {
- frame.getlocal(0).__setattr__("request", frame.getlocal(1));
- frame.getlocal(0).__setattr__("client_address", frame.getlocal(2));
- frame.getlocal(0).__setattr__("server", frame.getlocal(3));
- try {
- frame.getlocal(0).invoke("setup");
- frame.getlocal(0).invoke("handle");
- frame.getlocal(0).invoke("finish");
- }
- finally {
- frame.getglobal("sys").__setattr__("exc_traceback", frame.getglobal("None"));
- }
- return Py.None;
- }
-
- private static PyObject setup$38(PyFrame frame) {
- // pass
- return Py.None;
- }
-
- private static PyObject __del__$39(PyFrame frame) {
- // pass
- return Py.None;
- }
-
- private static PyObject handle$40(PyFrame frame) {
- // pass
- return Py.None;
- }
-
- private static PyObject finish$41(PyFrame frame) {
- // pass
- return Py.None;
- }
-
- private static PyObject BaseRequestHandler$42(PyFrame frame) {
- /* Base class for request handler classes.
-
- This class is instantiated for each request to be handled. The
- constructor sets the instance variables request, client_address
- and server, and then calls the handle() method. To implement a
- specific service, all you need to do is to derive a class which
- defines a handle() method.
-
- The handle() method can find the request as self.request, the
- client address as self.client_address, and the server (in case it
- needs access to per-server information) as self.server. Since a
- separate instance is created for each request, the handle() method
- can define arbitrary other instance variariables.
-
- */
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$36___init__));
- frame.setlocal("setup", new PyFunction(frame.f_globals, new PyObject[] {}, c$37_setup));
- frame.setlocal("__del__", new PyFunction(frame.f_globals, new PyObject[] {}, c$38___del__));
- frame.setlocal("handle", new PyFunction(frame.f_globals, new PyObject[] {}, c$39_handle));
- frame.setlocal("finish", new PyFunction(frame.f_globals, new PyObject[] {}, c$40_finish));
- return frame.getf_locals();
- }
-
- private static PyObject setup$43(PyFrame frame) {
- frame.getlocal(0).__setattr__("connection", frame.getlocal(0).__getattr__("request"));
- frame.getlocal(0).__setattr__("rfile", frame.getlocal(0).__getattr__("connection").invoke("makefile", s$48, frame.getlocal(0).__getattr__("rbufsize")));
- frame.getlocal(0).__setattr__("wfile", frame.getlocal(0).__getattr__("connection").invoke("makefile", s$49, frame.getlocal(0).__getattr__("wbufsize")));
- return Py.None;
- }
-
- private static PyObject finish$44(PyFrame frame) {
- frame.getlocal(0).__getattr__("wfile").invoke("flush");
- frame.getlocal(0).__getattr__("wfile").invoke("close");
- frame.getlocal(0).__getattr__("rfile").invoke("close");
- return Py.None;
- }
-
- private static PyObject StreamRequestHandler$45(PyFrame frame) {
- /* Define self.rfile and self.wfile for stream sockets. */
- frame.setlocal("rbufsize", i$22.__neg__());
- frame.setlocal("wbufsize", i$35);
- frame.setlocal("setup", new PyFunction(frame.f_globals, new PyObject[] {}, c$42_setup));
- frame.setlocal("finish", new PyFunction(frame.f_globals, new PyObject[] {}, c$43_finish));
- return frame.getf_locals();
- }
-
- private static PyObject setup$46(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- frame.setlocal(1, org.python.core.imp.importOne("StringIO", frame));
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0).__getattr__("request"), 2);
- frame.getlocal(0).__setattr__("packet", t$0$PyObject__[0]);
- frame.getlocal(0).__setattr__("socket", t$0$PyObject__[1]);
- frame.getlocal(0).__setattr__("rfile", frame.getlocal(1).__getattr__("StringIO").__call__(frame.getlocal(0).__getattr__("packet")));
- frame.getlocal(0).__setattr__("wfile", frame.getlocal(1).__getattr__("StringIO").__call__());
- return Py.None;
- }
-
- private static PyObject finish$47(PyFrame frame) {
- frame.getlocal(0).__getattr__("socket").invoke("sendto", frame.getlocal(0).__getattr__("wfile").invoke("getvalue"), frame.getlocal(0).__getattr__("client_address"));
- return Py.None;
- }
-
- private static PyObject DatagramRequestHandler$48(PyFrame frame) {
- /* Define self.rfile and self.wfile for datagram sockets. */
- frame.setlocal("setup", new PyFunction(frame.f_globals, new PyObject[] {}, c$45_setup));
- frame.setlocal("finish", new PyFunction(frame.f_globals, new PyObject[] {}, c$46_finish));
- return frame.getf_locals();
- }
-
- private static PyObject main$49(PyFrame frame) {
- frame.setglobal("__file__", s$51);
-
- /* Generic socket server classes.
-
- This module tries to capture the various aspects of defining a server:
-
- For socket-based servers:
-
- - address family:
- - AF_INET: IP (Internet Protocol) sockets (default)
- - AF_UNIX: Unix domain sockets
- - others, e.g. AF_DECNET are conceivable (see <socket.h>
- - socket type:
- - SOCK_STREAM (reliable stream, e.g. TCP)
- - SOCK_DGRAM (datagrams, e.g. UDP)
-
- For request-based servers (including socket-based):
-
- - client address verification before further looking at the request
- (This is actually a hook for any processing that needs to look
- at the request before anything else, e.g. logging)
- - how to handle multiple requests:
- - synchronous (one request is handled at a time)
- - forking (each request is handled by a new process)
- - threading (each request is handled by a new thread)
-
- The classes in this module favor the server type that is simplest to
- write: a synchronous TCP/IP server. This is bad class design, but
- save some typing. (There's also the issue that a deep class hierarchy
- slows down method lookups.)
-
- There are five classes in an inheritance diagram, four of which represent
- synchronous servers of four types:
-
- +------------+
- | BaseServer |
- +------------+
- |
- v
- +-----------+ +------------------+
- | TCPServer |------->| UnixStreamServer |
- +-----------+ +------------------+
- |
- v
- +-----------+ +--------------------+
- | UDPServer |------->| UnixDatagramServer |
- +-----------+ +--------------------+
-
- Note that UnixDatagramServer derives from UDPServer, not from
- UnixStreamServer -- the only difference between an IP and a Unix
- stream server is the address family, which is simply repeated in both
- unix server classes.
-
- Forking and threading versions of each type of server can be created
- using the ForkingServer and ThreadingServer mix-in classes. For
- instance, a threading UDP server class is created as follows:
-
- class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
-
- The Mix-in class must come first, since it overrides a method defined
- in UDPServer!
-
- To implement a service, you must derive a class from
- BaseRequestHandler and redefine its handle() method. You can then run
- various versions of the service by combining one of the server classes
- with your request handler class.
-
- The request handler class must be different for datagram or stream
- services. This can be hidden by using the mix-in request handler
- classes StreamRequestHandler or DatagramRequestHandler.
-
- Of course, you still have to use your head!
-
- For instance, it makes no sense to use a forking server if the service
- contains state in memory that can be modified by requests (since the
- modifications in the child process would never reach the initial state
- kept in the parent process and passed to each child). In this case,
- you can use a threading server, but you will probably have to use
- locks to avoid two requests that come in nearly simultaneous to apply
- conflicting changes to the server state.
-
- On the other hand, if you are building e.g. an HTTP server, where all
- data is stored externally (e.g. in the file system), a synchronous
- class will essentially render the service "deaf" while one request is
- being handled -- which may be for a very long time if a client is slow
- to reqd all the data it has requested. Here a threading or forking
- server is appropriate.
-
- In some cases, it may be appropriate to process part of a request
- synchronously, but to finish processing in a forked child depending on
- the request data. This can be implemented by using a synchronous
- server and doing an explicit fork in the request handler class
- handle() method.
-
- Another approach to handling multiple simultaneous requests in an
- environment that supports neither threads nor fork (or where these are
- too expensive or inappropriate for the service) is to maintain an
- explicit table of partially finished requests and to use select() to
- decide which request to work on next (or whether to handle a new
- incoming request). This is particularly important for stream services
- where each client can potentially be connected for a long time (if
- threads or subprocesses cannot be used).
-
- Future work:
- - Standard classes for Sun RPC (which uses either UDP or TCP)
- - Standard mix-in classes to implement various authentication
- and encryption schemes
- - Standard framework for select-based multiplexing
-
- XXX Open problems:
- - What to do with out-of-band data?
-
- BaseServer:
- - split generic "request" functionality out into BaseServer class.
- Copyright (C) 2000 Luke Kenneth Casson Leighton <lkcl@samba.org>
-
- example: read entries from a SQL database (requires overriding
- get_request() to return a table entry from the database).
- entry is processed by a RequestHandlerClass.
-
- */
- frame.setlocal("__version__", s$1);
- frame.setlocal("socket", org.python.core.imp.importOne("socket", frame));
- frame.setlocal("sys", org.python.core.imp.importOne("sys", frame));
- frame.setlocal("os", org.python.core.imp.importOne("os", frame));
- frame.setlocal("__all__", new PyList(new PyObject[] {s$2, s$3, s$4, s$5, s$6, s$7, s$8, s$9, s$10, s$11, s$12}));
- if (frame.getname("hasattr").__call__(frame.getname("socket"), s$13).__nonzero__()) {
- frame.getname("__all__").invoke("extend", new PyList(new PyObject[] {s$14, s$15, s$16, s$17}));
- }
- frame.setlocal("BaseServer", Py.makeClass("BaseServer", new PyObject[] {}, c$10_BaseServer, null));
- frame.setlocal("TCPServer", Py.makeClass("TCPServer", new PyObject[] {frame.getname("BaseServer")}, c$18_TCPServer, null));
- frame.setlocal("UDPServer", Py.makeClass("UDPServer", new PyObject[] {frame.getname("TCPServer")}, c$22_UDPServer, null));
- frame.setlocal("ForkingMixIn", Py.makeClass("ForkingMixIn", new PyObject[] {}, c$25_ForkingMixIn, null));
- frame.setlocal("ThreadingMixIn", Py.makeClass("ThreadingMixIn", new PyObject[] {}, c$27_ThreadingMixIn, null));
- frame.setlocal("ForkingUDPServer", Py.makeClass("ForkingUDPServer", new PyObject[] {frame.getname("ForkingMixIn"), frame.getname("UDPServer")}, c$28_ForkingUDPServer, null));
- frame.setlocal("ForkingTCPServer", Py.makeClass("ForkingTCPServer", new PyObject[] {frame.getname("ForkingMixIn"), frame.getname("TCPServer")}, c$29_ForkingTCPServer, null));
- frame.setlocal("ThreadingUDPServer", Py.makeClass("ThreadingUDPServer", new PyObject[] {frame.getname("ThreadingMixIn"), frame.getname("UDPServer")}, c$30_ThreadingUDPServer, null));
- frame.setlocal("ThreadingTCPServer", Py.makeClass("ThreadingTCPServer", new PyObject[] {frame.getname("ThreadingMixIn"), frame.getname("TCPServer")}, c$31_ThreadingTCPServer, null));
- if (frame.getname("hasattr").__call__(frame.getname("socket"), s$13).__nonzero__()) {
- frame.setlocal("UnixStreamServer", Py.makeClass("UnixStreamServer", new PyObject[] {frame.getname("TCPServer")}, c$32_UnixStreamServer, null));
- frame.setlocal("UnixDatagramServer", Py.makeClass("UnixDatagramServer", new PyObject[] {frame.getname("UDPServer")}, c$33_UnixDatagramServer, null));
- frame.setlocal("ThreadingUnixStreamServer", Py.makeClass("ThreadingUnixStreamServer", new PyObject[] {frame.getname("ThreadingMixIn"), frame.getname("UnixStreamServer")}, c$34_ThreadingUnixStreamServer, null));
- frame.setlocal("ThreadingUnixDatagramServer", Py.makeClass("ThreadingUnixDatagramServer", new PyObject[] {frame.getname("ThreadingMixIn"), frame.getname("UnixDatagramServer")}, c$35_ThreadingUnixDatagramServer, null));
- }
- frame.setlocal("BaseRequestHandler", Py.makeClass("BaseRequestHandler", new PyObject[] {}, c$41_BaseRequestHandler, null));
- frame.setlocal("StreamRequestHandler", Py.makeClass("StreamRequestHandler", new PyObject[] {frame.getname("BaseRequestHandler")}, c$44_StreamRequestHandler, null));
- frame.setlocal("DatagramRequestHandler", Py.makeClass("DatagramRequestHandler", new PyObject[] {frame.getname("BaseRequestHandler")}, c$47_DatagramRequestHandler, null));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("SocketServer"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "SocketServer";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(SocketServer._PyInner.class, newargs, SocketServer.jpy$packages, SocketServer.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class StringIO extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject i$1;
- private static PyObject s$2;
- private static PyObject i$3;
- private static PyObject s$4;
- private static PyObject i$5;
- private static PyObject s$6;
- private static PyObject i$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject s$16;
- private static PyObject s$17;
- private static PyObject s$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyFunctionTable funcTable;
- private static PyCode c$0___init__;
- private static PyCode c$1_close;
- private static PyCode c$2_isatty;
- private static PyCode c$3_seek;
- private static PyCode c$4_tell;
- private static PyCode c$5_read;
- private static PyCode c$6_readline;
- private static PyCode c$7_readlines;
- private static PyCode c$8_truncate;
- private static PyCode c$9_write;
- private static PyCode c$10_writelines;
- private static PyCode c$11_flush;
- private static PyCode c$12_getvalue;
- private static PyCode c$13_StringIO;
- private static PyCode c$14_test;
- private static PyCode c$15_main;
- private static void initConstants() {
- s$0 = Py.newString("File-like objects that read from or write to a string buffer.\012\012This implements (nearly) all stdio methods.\012\012f = StringIO() # ready for writing\012f = StringIO(buf) # ready for reading\012f.close() # explicitly release resources held\012flag = f.isatty() # always false\012pos = f.tell() # get current position\012f.seek(pos) # set current position\012f.seek(pos, mode) # mode 0: absolute; 1: relative; 2: relative to EOF\012buf = f.read() # read until EOF\012buf = f.read(n) # read up to n bytes\012buf = f.readline() # read until end of line ('\012') or EOF\012list = f.readlines()# list of f.readline() results until EOF\012f.truncate([size]) # truncate file at to at most size (default: current pos)\012f.write(buf) # write at current position\012f.writelines(list) # for line in list: f.write(line)\012f.getvalue() # return whole file's contents as a string\012\012Notes:\012- Using a real file is often faster (but less convenient).\012- There's also a much faster implementation in C, called cStringIO, but\012 it's not subclassable.\012- fileno() is left unimplemented so that code which uses it triggers\012 an exception early.\012- Seeking far beyond EOF and then writing will insert real null\012 bytes that occupy space in the buffer.\012- There's a simple test set (see end of this file).\012");
- i$1 = Py.newInteger(22);
- s$2 = Py.newString("StringIO");
- i$3 = Py.newInteger(0);
- s$4 = Py.newString("");
- i$5 = Py.newInteger(1);
- s$6 = Py.newString("I/O operation on closed file");
- i$7 = Py.newInteger(2);
- s$8 = Py.newString("\012");
- s$9 = Py.newString("Negative size not allowed");
- s$10 = Py.newString("\000");
- s$11 = Py.newString("/etc/passwd");
- s$12 = Py.newString("r");
- s$13 = Py.newString("write failed");
- s$14 = Py.newString("File length =");
- s$15 = Py.newString("First line =");
- s$16 = Py.newString("Second line =");
- s$17 = Py.newString("bad result after seek back");
- s$18 = Py.newString("bad result after seek back from EOF");
- s$19 = Py.newString("Read");
- s$20 = Py.newString("more lines");
- s$21 = Py.newString("bad length");
- s$22 = Py.newString("__main__");
- s$23 = Py.newString("/usr/share/jython/Lib-cpython/StringIO.py");
- funcTable = new _PyInner();
- c$0___init__ = Py.newCode(2, new String[] {"self", "buf"}, "/usr/share/jython/Lib-cpython/StringIO.py", "__init__", false, false, funcTable, 0, null, null, 0, 1);
- c$1_close = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/StringIO.py", "close", false, false, funcTable, 1, null, null, 0, 1);
- c$2_isatty = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/StringIO.py", "isatty", false, false, funcTable, 2, null, null, 0, 1);
- c$3_seek = Py.newCode(3, new String[] {"self", "pos", "mode"}, "/usr/share/jython/Lib-cpython/StringIO.py", "seek", false, false, funcTable, 3, null, null, 0, 1);
- c$4_tell = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/StringIO.py", "tell", false, false, funcTable, 4, null, null, 0, 1);
- c$5_read = Py.newCode(2, new String[] {"self", "n", "r", "newpos"}, "/usr/share/jython/Lib-cpython/StringIO.py", "read", false, false, funcTable, 5, null, null, 0, 1);
- c$6_readline = Py.newCode(2, new String[] {"self", "length", "i", "r", "newpos"}, "/usr/share/jython/Lib-cpython/StringIO.py", "readline", false, false, funcTable, 6, null, null, 0, 1);
- c$7_readlines = Py.newCode(2, new String[] {"self", "sizehint", "line", "lines", "total"}, "/usr/share/jython/Lib-cpython/StringIO.py", "readlines", false, false, funcTable, 7, null, null, 0, 1);
- c$8_truncate = Py.newCode(2, new String[] {"self", "size"}, "/usr/share/jython/Lib-cpython/StringIO.py", "truncate", false, false, funcTable, 8, null, null, 0, 1);
- c$9_write = Py.newCode(2, new String[] {"self", "s", "newpos"}, "/usr/share/jython/Lib-cpython/StringIO.py", "write", false, false, funcTable, 9, null, null, 0, 1);
- c$10_writelines = Py.newCode(2, new String[] {"self", "list"}, "/usr/share/jython/Lib-cpython/StringIO.py", "writelines", false, false, funcTable, 10, null, null, 0, 1);
- c$11_flush = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/StringIO.py", "flush", false, false, funcTable, 11, null, null, 0, 1);
- c$12_getvalue = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/StringIO.py", "getvalue", false, false, funcTable, 12, null, null, 0, 1);
- c$13_StringIO = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/StringIO.py", "StringIO", false, false, funcTable, 13, null, null, 0, 0);
- c$14_test = Py.newCode(0, new String[] {"length", "file", "f", "list", "here", "line2", "text", "sys", "lines", "line"}, "/usr/share/jython/Lib-cpython/StringIO.py", "test", false, false, funcTable, 14, null, null, 0, 1);
- c$15_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/StringIO.py", "main", false, false, funcTable, 15, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$15_main == null) _PyInner.initConstants();
- return c$15_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.__init__$1(frame);
- case 1:
- return _PyInner.close$2(frame);
- case 2:
- return _PyInner.isatty$3(frame);
- case 3:
- return _PyInner.seek$4(frame);
- case 4:
- return _PyInner.tell$5(frame);
- case 5:
- return _PyInner.read$6(frame);
- case 6:
- return _PyInner.readline$7(frame);
- case 7:
- return _PyInner.readlines$8(frame);
- case 8:
- return _PyInner.truncate$9(frame);
- case 9:
- return _PyInner.write$10(frame);
- case 10:
- return _PyInner.writelines$11(frame);
- case 11:
- return _PyInner.flush$12(frame);
- case 12:
- return _PyInner.getvalue$13(frame);
- case 13:
- return _PyInner.StringIO$14(frame);
- case 14:
- return _PyInner.test$15(frame);
- case 15:
- return _PyInner.main$16(frame);
- default:
- return null;
- }
- }
-
- private static PyObject __init__$1(PyFrame frame) {
- frame.getlocal(0).__setattr__("buf", frame.getlocal(1));
- frame.getlocal(0).__setattr__("len", frame.getglobal("len").__call__(frame.getlocal(1)));
- frame.getlocal(0).__setattr__("buflist", new PyList(new PyObject[] {}));
- frame.getlocal(0).__setattr__("pos", i$3);
- frame.getlocal(0).__setattr__("closed", i$3);
- frame.getlocal(0).__setattr__("softspace", i$3);
- return Py.None;
- }
-
- private static PyObject close$2(PyFrame frame) {
- if (frame.getlocal(0).__getattr__("closed").__not__().__nonzero__()) {
- frame.getlocal(0).__setattr__("closed", i$5);
- frame.getlocal(0).__delattr__("buf");
- frame.getlocal(0).__delattr__("pos");
- }
- return Py.None;
- }
-
- private static PyObject isatty$3(PyFrame frame) {
- if (frame.getlocal(0).__getattr__("closed").__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$6);
- }
- return i$3;
- }
-
- private static PyObject seek$4(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- if (frame.getlocal(0).__getattr__("closed").__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$6);
- }
- if (frame.getlocal(0).__getattr__("buflist").__nonzero__()) {
- t$0$PyObject = s$4.invoke("join", frame.getlocal(0).__getattr__("buflist"));
- t$1$PyObject = frame.getlocal(0);
- t$1$PyObject.__setattr__("buf", t$1$PyObject.__getattr__("buf").__iadd__(t$0$PyObject));
- frame.getlocal(0).__setattr__("buflist", new PyList(new PyObject[] {}));
- }
- if (frame.getlocal(2)._eq(i$5).__nonzero__()) {
- t$0$PyObject = frame.getlocal(0).__getattr__("pos");
- frame.setlocal(1, frame.getlocal(1).__iadd__(t$0$PyObject));
- }
- else if (frame.getlocal(2)._eq(i$7).__nonzero__()) {
- t$0$PyObject = frame.getlocal(0).__getattr__("len");
- frame.setlocal(1, frame.getlocal(1).__iadd__(t$0$PyObject));
- }
- frame.getlocal(0).__setattr__("pos", frame.getglobal("max").__call__(i$3, frame.getlocal(1)));
- return Py.None;
- }
-
- private static PyObject tell$5(PyFrame frame) {
- if (frame.getlocal(0).__getattr__("closed").__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$6);
- }
- return frame.getlocal(0).__getattr__("pos");
- }
-
- private static PyObject read$6(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- if (frame.getlocal(0).__getattr__("closed").__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$6);
- }
- if (frame.getlocal(0).__getattr__("buflist").__nonzero__()) {
- t$0$PyObject = s$4.invoke("join", frame.getlocal(0).__getattr__("buflist"));
- t$1$PyObject = frame.getlocal(0);
- t$1$PyObject.__setattr__("buf", t$1$PyObject.__getattr__("buf").__iadd__(t$0$PyObject));
- frame.getlocal(0).__setattr__("buflist", new PyList(new PyObject[] {}));
- }
- if (frame.getlocal(1)._lt(i$3).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(0).__getattr__("len"));
- }
- else {
- frame.setlocal(3, frame.getglobal("min").__call__(frame.getlocal(0).__getattr__("pos")._add(frame.getlocal(1)), frame.getlocal(0).__getattr__("len")));
- }
- frame.setlocal(2, frame.getlocal(0).__getattr__("buf").__getslice__(frame.getlocal(0).__getattr__("pos"), frame.getlocal(3), null));
- frame.getlocal(0).__setattr__("pos", frame.getlocal(3));
- return frame.getlocal(2);
- }
-
- private static PyObject readline$7(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- if (frame.getlocal(0).__getattr__("closed").__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$6);
- }
- if (frame.getlocal(0).__getattr__("buflist").__nonzero__()) {
- t$0$PyObject = s$4.invoke("join", frame.getlocal(0).__getattr__("buflist"));
- t$1$PyObject = frame.getlocal(0);
- t$1$PyObject.__setattr__("buf", t$1$PyObject.__getattr__("buf").__iadd__(t$0$PyObject));
- frame.getlocal(0).__setattr__("buflist", new PyList(new PyObject[] {}));
- }
- frame.setlocal(2, frame.getlocal(0).__getattr__("buf").invoke("find", s$8, frame.getlocal(0).__getattr__("pos")));
- if (frame.getlocal(2)._lt(i$3).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(0).__getattr__("len"));
- }
- else {
- frame.setlocal(4, frame.getlocal(2)._add(i$5));
- }
- if (frame.getlocal(1)._isnot(frame.getglobal("None")).__nonzero__()) {
- if (frame.getlocal(0).__getattr__("pos")._add(frame.getlocal(1))._lt(frame.getlocal(4)).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(0).__getattr__("pos")._add(frame.getlocal(1)));
- }
- }
- frame.setlocal(3, frame.getlocal(0).__getattr__("buf").__getslice__(frame.getlocal(0).__getattr__("pos"), frame.getlocal(4), null));
- frame.getlocal(0).__setattr__("pos", frame.getlocal(4));
- return frame.getlocal(3);
- }
-
- private static PyObject readlines$8(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- frame.setlocal(4, i$3);
- frame.setlocal(3, new PyList(new PyObject[] {}));
- frame.setlocal(2, frame.getlocal(0).invoke("readline"));
- while (frame.getlocal(2).__nonzero__()) {
- frame.getlocal(3).invoke("append", frame.getlocal(2));
- t$0$PyObject = frame.getglobal("len").__call__(frame.getlocal(2));
- frame.setlocal(4, frame.getlocal(4).__iadd__(t$0$PyObject));
- if ((i$3._lt(t$0$PyObject = frame.getlocal(1)).__nonzero__() ? t$0$PyObject._le(frame.getlocal(4)) : Py.Zero).__nonzero__()) {
- break;
- }
- frame.setlocal(2, frame.getlocal(0).invoke("readline"));
- }
- return frame.getlocal(3);
- }
-
- private static PyObject truncate$9(PyFrame frame) {
- if (frame.getlocal(0).__getattr__("closed").__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$6);
- }
- if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(0).__getattr__("pos"));
- }
- else if (frame.getlocal(1)._lt(i$3).__nonzero__()) {
- throw Py.makeException(frame.getglobal("IOError").__call__(frame.getglobal("EINVAL"), s$9));
- }
- else if (frame.getlocal(1)._lt(frame.getlocal(0).__getattr__("pos")).__nonzero__()) {
- frame.getlocal(0).__setattr__("pos", frame.getlocal(1));
- }
- frame.getlocal(0).__setattr__("buf", frame.getlocal(0).invoke("getvalue").__getslice__(null, frame.getlocal(1), null));
- return Py.None;
- }
-
- private static PyObject write$10(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- if (frame.getlocal(0).__getattr__("closed").__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$6);
- }
- if (frame.getlocal(1).__not__().__nonzero__()) {
- return Py.None;
- }
- if (frame.getlocal(0).__getattr__("pos")._gt(frame.getlocal(0).__getattr__("len")).__nonzero__()) {
- frame.getlocal(0).__getattr__("buflist").invoke("append", s$10._mul(frame.getlocal(0).__getattr__("pos")._sub(frame.getlocal(0).__getattr__("len"))));
- frame.getlocal(0).__setattr__("len", frame.getlocal(0).__getattr__("pos"));
- }
- frame.setlocal(2, frame.getlocal(0).__getattr__("pos")._add(frame.getglobal("len").__call__(frame.getlocal(1))));
- if (frame.getlocal(0).__getattr__("pos")._lt(frame.getlocal(0).__getattr__("len")).__nonzero__()) {
- if (frame.getlocal(0).__getattr__("buflist").__nonzero__()) {
- t$0$PyObject = s$4.invoke("join", frame.getlocal(0).__getattr__("buflist"));
- t$1$PyObject = frame.getlocal(0);
- t$1$PyObject.__setattr__("buf", t$1$PyObject.__getattr__("buf").__iadd__(t$0$PyObject));
- frame.getlocal(0).__setattr__("buflist", new PyList(new PyObject[] {}));
- }
- frame.getlocal(0).__setattr__("buflist", new PyList(new PyObject[] {frame.getlocal(0).__getattr__("buf").__getslice__(null, frame.getlocal(0).__getattr__("pos"), null), frame.getlocal(1), frame.getlocal(0).__getattr__("buf").__getslice__(frame.getlocal(2), null, null)}));
- frame.getlocal(0).__setattr__("buf", s$4);
- if (frame.getlocal(2)._gt(frame.getlocal(0).__getattr__("len")).__nonzero__()) {
- frame.getlocal(0).__setattr__("len", frame.getlocal(2));
- }
- }
- else {
- frame.getlocal(0).__getattr__("buflist").invoke("append", frame.getlocal(1));
- frame.getlocal(0).__setattr__("len", frame.getlocal(2));
- }
- frame.getlocal(0).__setattr__("pos", frame.getlocal(2));
- return Py.None;
- }
-
- private static PyObject writelines$11(PyFrame frame) {
- frame.getlocal(0).invoke("write", s$4.invoke("join", frame.getlocal(1)));
- return Py.None;
- }
-
- private static PyObject flush$12(PyFrame frame) {
- if (frame.getlocal(0).__getattr__("closed").__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$6);
- }
- return Py.None;
- }
-
- private static PyObject getvalue$13(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- if (frame.getlocal(0).__getattr__("buflist").__nonzero__()) {
- t$0$PyObject = s$4.invoke("join", frame.getlocal(0).__getattr__("buflist"));
- t$1$PyObject = frame.getlocal(0);
- t$1$PyObject.__setattr__("buf", t$1$PyObject.__getattr__("buf").__iadd__(t$0$PyObject));
- frame.getlocal(0).__setattr__("buflist", new PyList(new PyObject[] {}));
- }
- return frame.getlocal(0).__getattr__("buf");
- }
-
- private static PyObject StringIO$14(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {s$4}, c$0___init__));
- frame.setlocal("close", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_close));
- frame.setlocal("isatty", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_isatty));
- frame.setlocal("seek", new PyFunction(frame.f_globals, new PyObject[] {i$3}, c$3_seek));
- frame.setlocal("tell", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_tell));
- frame.setlocal("read", new PyFunction(frame.f_globals, new PyObject[] {i$5.__neg__()}, c$5_read));
- frame.setlocal("readline", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$6_readline));
- frame.setlocal("readlines", new PyFunction(frame.f_globals, new PyObject[] {i$3}, c$7_readlines));
- frame.setlocal("truncate", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$8_truncate));
- frame.setlocal("write", new PyFunction(frame.f_globals, new PyObject[] {}, c$9_write));
- frame.setlocal("writelines", new PyFunction(frame.f_globals, new PyObject[] {}, c$10_writelines));
- frame.setlocal("flush", new PyFunction(frame.f_globals, new PyObject[] {}, c$11_flush));
- frame.setlocal("getvalue", new PyFunction(frame.f_globals, new PyObject[] {}, c$12_getvalue));
- return frame.getf_locals();
- }
-
- private static PyObject test$15(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(7, org.python.core.imp.importOne("sys", frame));
- if (frame.getlocal(7).__getattr__("argv").__getslice__(i$5, null, null).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(7).__getattr__("argv").__getitem__(i$5));
- }
- else {
- frame.setlocal(1, s$11);
- }
- frame.setlocal(8, frame.getglobal("open").__call__(frame.getlocal(1), s$12).invoke("readlines"));
- frame.setlocal(6, frame.getglobal("open").__call__(frame.getlocal(1), s$12).invoke("read"));
- frame.setlocal(2, frame.getglobal("StringIO").__call__());
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(8).__getslice__(null, i$7.__neg__(), null);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(9, t$0$PyObject);
- frame.getlocal(2).invoke("write", frame.getlocal(9));
- }
- frame.getlocal(2).invoke("writelines", frame.getlocal(8).__getslice__(i$7.__neg__(), null, null));
- if (frame.getlocal(2).invoke("getvalue")._ne(frame.getlocal(6)).__nonzero__()) {
- throw Py.makeException(frame.getglobal("RuntimeError"), s$13);
- }
- frame.setlocal(0, frame.getlocal(2).invoke("tell"));
- Py.printComma(s$14);
- Py.println(frame.getlocal(0));
- frame.getlocal(2).invoke("seek", frame.getglobal("len").__call__(frame.getlocal(8).__getitem__(i$3)));
- frame.getlocal(2).invoke("write", frame.getlocal(8).__getitem__(i$5));
- frame.getlocal(2).invoke("seek", i$3);
- Py.printComma(s$15);
- Py.println(frame.getlocal(2).invoke("readline").__repr__());
- frame.setlocal(4, frame.getlocal(2).invoke("tell"));
- frame.setlocal(9, frame.getlocal(2).invoke("readline"));
- Py.printComma(s$16);
- Py.println(frame.getlocal(9).__repr__());
- frame.getlocal(2).invoke("seek", frame.getglobal("len").__call__(frame.getlocal(9)).__neg__(), i$5);
- frame.setlocal(5, frame.getlocal(2).invoke("read", frame.getglobal("len").__call__(frame.getlocal(9))));
- if (frame.getlocal(9)._ne(frame.getlocal(5)).__nonzero__()) {
- throw Py.makeException(frame.getglobal("RuntimeError"), s$17);
- }
- frame.getlocal(2).invoke("seek", frame.getglobal("len").__call__(frame.getlocal(5)), i$5);
- frame.setlocal(3, frame.getlocal(2).invoke("readlines"));
- frame.setlocal(9, frame.getlocal(3).__getitem__(i$5.__neg__()));
- frame.getlocal(2).invoke("seek", frame.getlocal(2).invoke("tell")._sub(frame.getglobal("len").__call__(frame.getlocal(9))));
- frame.setlocal(5, frame.getlocal(2).invoke("read"));
- if (frame.getlocal(9)._ne(frame.getlocal(5)).__nonzero__()) {
- throw Py.makeException(frame.getglobal("RuntimeError"), s$18);
- }
- Py.printComma(s$19);
- Py.printComma(frame.getglobal("len").__call__(frame.getlocal(3)));
- Py.println(s$20);
- Py.printComma(s$14);
- Py.println(frame.getlocal(2).invoke("tell"));
- if (frame.getlocal(2).invoke("tell")._ne(frame.getlocal(0)).__nonzero__()) {
- throw Py.makeException(frame.getglobal("RuntimeError"), s$21);
- }
- frame.getlocal(2).invoke("close");
- return Py.None;
- }
-
- private static PyObject main$16(PyFrame frame) {
- frame.setglobal("__file__", s$23);
-
- PyObject[] imp_accu;
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- /* File-like objects that read from or write to a string buffer.
-
- This implements (nearly) all stdio methods.
-
- f = StringIO() # ready for writing
- f = StringIO(buf) # ready for reading
- f.close() # explicitly release resources held
- flag = f.isatty() # always false
- pos = f.tell() # get current position
- f.seek(pos) # set current position
- f.seek(pos, mode) # mode 0: absolute; 1: relative; 2: relative to EOF
- buf = f.read() # read until EOF
- buf = f.read(n) # read up to n bytes
- buf = f.readline() # read until end of line ('
- ') or EOF
- list = f.readlines()# list of f.readline() results until EOF
- f.truncate([size]) # truncate file at to at most size (default: current pos)
- f.write(buf) # write at current position
- f.writelines(list) # for line in list: f.write(line)
- f.getvalue() # return whole file's contents as a string
-
- Notes:
- - Using a real file is often faster (but less convenient).
- - There's also a much faster implementation in C, called cStringIO, but
- it's not subclassable.
- - fileno() is left unimplemented so that code which uses it triggers
- an exception early.
- - Seeking far beyond EOF and then writing will insert real null
- bytes that occupy space in the buffer.
- - There's a simple test set (see end of this file).
- */
- try {
- imp_accu = org.python.core.imp.importFrom("errno", new String[] {"EINVAL"}, frame);
- frame.setlocal("EINVAL", imp_accu[0]);
- imp_accu = null;
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getname("ImportError"))) {
- frame.setlocal("EINVAL", i$1);
- }
- else throw t$0$PyException;
- }
- frame.setlocal("__all__", new PyList(new PyObject[] {s$2}));
- frame.setlocal("StringIO", Py.makeClass("StringIO", new PyObject[] {}, c$13_StringIO, null));
- frame.setlocal("test", new PyFunction(frame.f_globals, new PyObject[] {}, c$14_test));
- if (frame.getname("__name__")._eq(s$22).__nonzero__()) {
- frame.getname("test").__call__();
- }
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("StringIO"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "StringIO";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(StringIO._PyInner.class, newargs, StringIO.jpy$packages, StringIO.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class UserDict extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyFunctionTable funcTable;
- private static PyCode c$0___init__;
- private static PyCode c$1___repr__;
- private static PyCode c$2___cmp__;
- private static PyCode c$3___len__;
- private static PyCode c$4___getitem__;
- private static PyCode c$5___setitem__;
- private static PyCode c$6___delitem__;
- private static PyCode c$7_clear;
- private static PyCode c$8_copy;
- private static PyCode c$9_keys;
- private static PyCode c$10_items;
- private static PyCode c$11_values;
- private static PyCode c$12_has_key;
- private static PyCode c$13_update;
- private static PyCode c$14_get;
- private static PyCode c$15_setdefault;
- private static PyCode c$16_popitem;
- private static PyCode c$17_UserDict;
- private static PyCode c$18_main;
- private static void initConstants() {
- s$0 = Py.newString("A more or less complete user-defined wrapper around dictionary objects.");
- s$1 = Py.newString("/usr/share/jython/Lib-cpython/UserDict.py");
- funcTable = new _PyInner();
- c$0___init__ = Py.newCode(2, new String[] {"self", "dict"}, "/usr/share/jython/Lib-cpython/UserDict.py", "__init__", false, false, funcTable, 0, null, null, 0, 1);
- c$1___repr__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/UserDict.py", "__repr__", false, false, funcTable, 1, null, null, 0, 1);
- c$2___cmp__ = Py.newCode(2, new String[] {"self", "dict"}, "/usr/share/jython/Lib-cpython/UserDict.py", "__cmp__", false, false, funcTable, 2, null, null, 0, 1);
- c$3___len__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/UserDict.py", "__len__", false, false, funcTable, 3, null, null, 0, 1);
- c$4___getitem__ = Py.newCode(2, new String[] {"self", "key"}, "/usr/share/jython/Lib-cpython/UserDict.py", "__getitem__", false, false, funcTable, 4, null, null, 0, 1);
- c$5___setitem__ = Py.newCode(3, new String[] {"self", "key", "item"}, "/usr/share/jython/Lib-cpython/UserDict.py", "__setitem__", false, false, funcTable, 5, null, null, 0, 1);
- c$6___delitem__ = Py.newCode(2, new String[] {"self", "key"}, "/usr/share/jython/Lib-cpython/UserDict.py", "__delitem__", false, false, funcTable, 6, null, null, 0, 1);
- c$7_clear = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/UserDict.py", "clear", false, false, funcTable, 7, null, null, 0, 1);
- c$8_copy = Py.newCode(1, new String[] {"self", "copy"}, "/usr/share/jython/Lib-cpython/UserDict.py", "copy", false, false, funcTable, 8, null, null, 0, 1);
- c$9_keys = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/UserDict.py", "keys", false, false, funcTable, 9, null, null, 0, 1);
- c$10_items = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/UserDict.py", "items", false, false, funcTable, 10, null, null, 0, 1);
- c$11_values = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/UserDict.py", "values", false, false, funcTable, 11, null, null, 0, 1);
- c$12_has_key = Py.newCode(2, new String[] {"self", "key"}, "/usr/share/jython/Lib-cpython/UserDict.py", "has_key", false, false, funcTable, 12, null, null, 0, 1);
- c$13_update = Py.newCode(2, new String[] {"self", "dict", "v", "k"}, "/usr/share/jython/Lib-cpython/UserDict.py", "update", false, false, funcTable, 13, null, null, 0, 1);
- c$14_get = Py.newCode(3, new String[] {"self", "key", "failobj"}, "/usr/share/jython/Lib-cpython/UserDict.py", "get", false, false, funcTable, 14, null, null, 0, 1);
- c$15_setdefault = Py.newCode(3, new String[] {"self", "key", "failobj"}, "/usr/share/jython/Lib-cpython/UserDict.py", "setdefault", false, false, funcTable, 15, null, null, 0, 1);
- c$16_popitem = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/UserDict.py", "popitem", false, false, funcTable, 16, null, null, 0, 1);
- c$17_UserDict = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/UserDict.py", "UserDict", false, false, funcTable, 17, null, null, 0, 0);
- c$18_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/UserDict.py", "main", false, false, funcTable, 18, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$18_main == null) _PyInner.initConstants();
- return c$18_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.__init__$1(frame);
- case 1:
- return _PyInner.__repr__$2(frame);
- case 2:
- return _PyInner.__cmp__$3(frame);
- case 3:
- return _PyInner.__len__$4(frame);
- case 4:
- return _PyInner.__getitem__$5(frame);
- case 5:
- return _PyInner.__setitem__$6(frame);
- case 6:
- return _PyInner.__delitem__$7(frame);
- case 7:
- return _PyInner.clear$8(frame);
- case 8:
- return _PyInner.copy$9(frame);
- case 9:
- return _PyInner.keys$10(frame);
- case 10:
- return _PyInner.items$11(frame);
- case 11:
- return _PyInner.values$12(frame);
- case 12:
- return _PyInner.has_key$13(frame);
- case 13:
- return _PyInner.update$14(frame);
- case 14:
- return _PyInner.get$15(frame);
- case 15:
- return _PyInner.setdefault$16(frame);
- case 16:
- return _PyInner.popitem$17(frame);
- case 17:
- return _PyInner.UserDict$18(frame);
- case 18:
- return _PyInner.main$19(frame);
- default:
- return null;
- }
- }
-
- private static PyObject __init__$1(PyFrame frame) {
- frame.getlocal(0).__setattr__("data", new PyDictionary(new PyObject[] {}));
- if (frame.getlocal(1)._isnot(frame.getglobal("None")).__nonzero__()) {
- frame.getlocal(0).invoke("update", frame.getlocal(1));
- }
- return Py.None;
- }
-
- private static PyObject __repr__$2(PyFrame frame) {
- return frame.getglobal("repr").__call__(frame.getlocal(0).__getattr__("data"));
- }
-
- private static PyObject __cmp__$3(PyFrame frame) {
- if (frame.getglobal("isinstance").__call__(frame.getlocal(1), frame.getglobal("UserDict")).__nonzero__()) {
- return frame.getglobal("cmp").__call__(frame.getlocal(0).__getattr__("data"), frame.getlocal(1).__getattr__("data"));
- }
- else {
- return frame.getglobal("cmp").__call__(frame.getlocal(0).__getattr__("data"), frame.getlocal(1));
- }
- }
-
- private static PyObject __len__$4(PyFrame frame) {
- return frame.getglobal("len").__call__(frame.getlocal(0).__getattr__("data"));
- }
-
- private static PyObject __getitem__$5(PyFrame frame) {
- return frame.getlocal(0).__getattr__("data").__getitem__(frame.getlocal(1));
- }
-
- private static PyObject __setitem__$6(PyFrame frame) {
- frame.getlocal(0).__getattr__("data").__setitem__(frame.getlocal(1), frame.getlocal(2));
- return Py.None;
- }
-
- private static PyObject __delitem__$7(PyFrame frame) {
- frame.getlocal(0).__getattr__("data").__delitem__(frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject clear$8(PyFrame frame) {
- frame.getlocal(0).__getattr__("data").invoke("clear");
- return Py.None;
- }
-
- private static PyObject copy$9(PyFrame frame) {
- if (frame.getlocal(0).__getattr__("__class__")._is(frame.getglobal("UserDict")).__nonzero__()) {
- return frame.getglobal("UserDict").__call__(frame.getlocal(0).__getattr__("data"));
- }
- frame.setlocal(1, org.python.core.imp.importOne("copy", frame));
- return frame.getlocal(1).__getattr__("copy").__call__(frame.getlocal(0));
- }
-
- private static PyObject keys$10(PyFrame frame) {
- return frame.getlocal(0).__getattr__("data").invoke("keys");
- }
-
- private static PyObject items$11(PyFrame frame) {
- return frame.getlocal(0).__getattr__("data").invoke("items");
- }
-
- private static PyObject values$12(PyFrame frame) {
- return frame.getlocal(0).__getattr__("data").invoke("values");
- }
-
- private static PyObject has_key$13(PyFrame frame) {
- return frame.getlocal(0).__getattr__("data").invoke("has_key", frame.getlocal(1));
- }
-
- private static PyObject update$14(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- if (frame.getglobal("isinstance").__call__(frame.getlocal(1), frame.getglobal("UserDict")).__nonzero__()) {
- frame.getlocal(0).__getattr__("data").invoke("update", frame.getlocal(1).__getattr__("data"));
- }
- else if (frame.getglobal("isinstance").__call__(frame.getlocal(1), frame.getglobal("type").__call__(frame.getlocal(0).__getattr__("data"))).__nonzero__()) {
- frame.getlocal(0).__getattr__("data").invoke("update", frame.getlocal(1));
- }
- else {
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(1).invoke("items");
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(3, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- frame.getlocal(0).__getattr__("data").__setitem__(frame.getlocal(3), frame.getlocal(2));
- }
- }
- return Py.None;
- }
-
- private static PyObject get$15(PyFrame frame) {
- return frame.getlocal(0).__getattr__("data").invoke("get", frame.getlocal(1), frame.getlocal(2));
- }
-
- private static PyObject setdefault$16(PyFrame frame) {
- if (frame.getlocal(0).__getattr__("data").invoke("has_key", frame.getlocal(1)).__not__().__nonzero__()) {
- frame.getlocal(0).__getattr__("data").__setitem__(frame.getlocal(1), frame.getlocal(2));
- }
- return frame.getlocal(0).__getattr__("data").__getitem__(frame.getlocal(1));
- }
-
- private static PyObject popitem$17(PyFrame frame) {
- return frame.getlocal(0).__getattr__("data").invoke("popitem");
- }
-
- private static PyObject UserDict$18(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$0___init__));
- frame.setlocal("__repr__", new PyFunction(frame.f_globals, new PyObject[] {}, c$1___repr__));
- frame.setlocal("__cmp__", new PyFunction(frame.f_globals, new PyObject[] {}, c$2___cmp__));
- frame.setlocal("__len__", new PyFunction(frame.f_globals, new PyObject[] {}, c$3___len__));
- frame.setlocal("__getitem__", new PyFunction(frame.f_globals, new PyObject[] {}, c$4___getitem__));
- frame.setlocal("__setitem__", new PyFunction(frame.f_globals, new PyObject[] {}, c$5___setitem__));
- frame.setlocal("__delitem__", new PyFunction(frame.f_globals, new PyObject[] {}, c$6___delitem__));
- frame.setlocal("clear", new PyFunction(frame.f_globals, new PyObject[] {}, c$7_clear));
- frame.setlocal("copy", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_copy));
- frame.setlocal("keys", new PyFunction(frame.f_globals, new PyObject[] {}, c$9_keys));
- frame.setlocal("items", new PyFunction(frame.f_globals, new PyObject[] {}, c$10_items));
- frame.setlocal("values", new PyFunction(frame.f_globals, new PyObject[] {}, c$11_values));
- frame.setlocal("has_key", new PyFunction(frame.f_globals, new PyObject[] {}, c$12_has_key));
- frame.setlocal("update", new PyFunction(frame.f_globals, new PyObject[] {}, c$13_update));
- frame.setlocal("get", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$14_get));
- frame.setlocal("setdefault", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$15_setdefault));
- frame.setlocal("popitem", new PyFunction(frame.f_globals, new PyObject[] {}, c$16_popitem));
- return frame.getf_locals();
- }
-
- private static PyObject main$19(PyFrame frame) {
- frame.setglobal("__file__", s$1);
-
- /* A more or less complete user-defined wrapper around dictionary objects. */
- frame.setlocal("UserDict", Py.makeClass("UserDict", new PyObject[] {}, c$17_UserDict, null));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("UserDict"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "UserDict";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(UserDict._PyInner.class, newargs, UserDict.jpy$packages, UserDict.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class atexit extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject i$8;
- private static PyObject i$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyFunctionTable funcTable;
- private static PyCode c$0__run_exitfuncs;
- private static PyCode c$1_register;
- private static PyCode c$2_x1;
- private static PyCode c$3_x2;
- private static PyCode c$4_x3;
- private static PyCode c$5_main;
- private static void initConstants() {
- s$0 = Py.newString("\012atexit.py - allow programmer to define multiple exit functions to be executed\012upon normal program termination.\012\012One public function, register, is defined.\012");
- s$1 = Py.newString("register");
- s$2 = Py.newString("run any registered exit functions\012\012 _exithandlers is traversed in reverse order so functions are executed\012 last in, first out.\012 ");
- s$3 = Py.newString("register a function to be executed upon normal program termination\012\012 func - function to be called at exit\012 targs - optional arguments to pass to func\012 kargs - optional keyword arguments to pass to func\012 ");
- s$4 = Py.newString("__main__");
- s$5 = Py.newString("running x1");
- s$6 = Py.newString("running x2(%s)");
- s$7 = Py.newString("running x3(%s, kwd=%s)");
- i$8 = Py.newInteger(12);
- i$9 = Py.newInteger(5);
- s$10 = Py.newString("bar");
- s$11 = Py.newString("no kwd args");
- s$12 = Py.newString("/usr/share/jython/Lib-cpython/atexit.py");
- funcTable = new _PyInner();
- c$0__run_exitfuncs = Py.newCode(0, new String[] {"targs", "func", "kargs"}, "/usr/share/jython/Lib-cpython/atexit.py", "_run_exitfuncs", false, false, funcTable, 0, null, null, 0, 1);
- c$1_register = Py.newCode(3, new String[] {"func", "targs", "kargs"}, "/usr/share/jython/Lib-cpython/atexit.py", "register", true, true, funcTable, 1, null, null, 0, 1);
- c$2_x1 = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/atexit.py", "x1", false, false, funcTable, 2, null, null, 0, 1);
- c$3_x2 = Py.newCode(1, new String[] {"n"}, "/usr/share/jython/Lib-cpython/atexit.py", "x2", false, false, funcTable, 3, null, null, 0, 1);
- c$4_x3 = Py.newCode(2, new String[] {"n", "kwd"}, "/usr/share/jython/Lib-cpython/atexit.py", "x3", false, false, funcTable, 4, null, null, 0, 1);
- c$5_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/atexit.py", "main", false, false, funcTable, 5, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$5_main == null) _PyInner.initConstants();
- return c$5_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner._run_exitfuncs$1(frame);
- case 1:
- return _PyInner.register$2(frame);
- case 2:
- return _PyInner.x1$3(frame);
- case 3:
- return _PyInner.x2$4(frame);
- case 4:
- return _PyInner.x3$5(frame);
- case 5:
- return _PyInner.main$6(frame);
- default:
- return null;
- }
- }
-
- private static PyObject _run_exitfuncs$1(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- /* run any registered exit functions
-
- _exithandlers is traversed in reverse order so functions are executed
- last in, first out.
- */
- while (frame.getglobal("_exithandlers").__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("_exithandlers").invoke("pop"), 3);
- frame.setlocal(1, t$0$PyObject__[0]);
- frame.setlocal(0, t$0$PyObject__[1]);
- frame.setlocal(2, t$0$PyObject__[2]);
- frame.getglobal("apply").__call__(frame.getlocal(1), frame.getlocal(0), frame.getlocal(2));
- }
- return Py.None;
- }
-
- private static PyObject register$2(PyFrame frame) {
- /* register a function to be executed upon normal program termination
-
- func - function to be called at exit
- targs - optional arguments to pass to func
- kargs - optional keyword arguments to pass to func
- */
- frame.getglobal("_exithandlers").invoke("append", new PyTuple(new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2)}));
- return Py.None;
- }
-
- private static PyObject x1$3(PyFrame frame) {
- Py.println(s$5);
- return Py.None;
- }
-
- private static PyObject x2$4(PyFrame frame) {
- Py.println(s$6._mod(frame.getlocal(0).__repr__()));
- return Py.None;
- }
-
- private static PyObject x3$5(PyFrame frame) {
- Py.println(s$7._mod(new PyTuple(new PyObject[] {frame.getlocal(0).__repr__(), frame.getlocal(1).__repr__()})));
- return Py.None;
- }
-
- private static PyObject main$6(PyFrame frame) {
- frame.setglobal("__file__", s$12);
-
- // Temporary Variables
- boolean t$0$boolean;
- PyException t$0$PyException;
-
- // Code
- /*
- atexit.py - allow programmer to define multiple exit functions to be executed
- upon normal program termination.
-
- One public function, register, is defined.
- */
- frame.setlocal("__all__", new PyList(new PyObject[] {s$1}));
- frame.setlocal("_exithandlers", new PyList(new PyObject[] {}));
- frame.setlocal("_run_exitfuncs", new PyFunction(frame.f_globals, new PyObject[] {}, c$0__run_exitfuncs));
- frame.setlocal("register", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_register));
- frame.setlocal("sys", org.python.core.imp.importOne("sys", frame));
- t$0$boolean = true;
- try {
- frame.setlocal("x", frame.getname("sys").__getattr__("exitfunc"));
- }
- catch (Throwable x$0) {
- t$0$boolean = false;
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getname("AttributeError"))) {
- frame.getname("sys").__setattr__("exitfunc", frame.getname("_run_exitfuncs"));
- }
- else throw t$0$PyException;
- }
- if (t$0$boolean) {
- if (frame.getname("x")._ne(frame.getname("_run_exitfuncs")).__nonzero__()) {
- frame.getname("register").__call__(frame.getname("x"));
- }
- }
- frame.dellocal("sys");
- if (frame.getname("__name__")._eq(s$4).__nonzero__()) {
- frame.setlocal("x1", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_x1));
- frame.setlocal("x2", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_x2));
- frame.setlocal("x3", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$4_x3));
- frame.getname("register").__call__(frame.getname("x1"));
- frame.getname("register").__call__(frame.getname("x2"), i$8);
- frame.getname("register").__call__(frame.getname("x3"), i$9, s$10);
- frame.getname("register").__call__(frame.getname("x3"), s$11);
- }
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("atexit"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "atexit";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(atexit._PyInner.class, newargs, atexit.jpy$packages, atexit.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class calendar extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject i$14;
- private static PyObject i$15;
- private static PyObject i$16;
- private static PyObject i$17;
- private static PyObject i$18;
- private static PyObject i$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyObject s$24;
- private static PyObject s$25;
- private static PyObject s$26;
- private static PyObject s$27;
- private static PyObject s$28;
- private static PyObject s$29;
- private static PyObject s$30;
- private static PyObject s$31;
- private static PyObject s$32;
- private static PyObject s$33;
- private static PyObject s$34;
- private static PyObject s$35;
- private static PyObject s$36;
- private static PyObject s$37;
- private static PyObject s$38;
- private static PyObject s$39;
- private static PyObject s$40;
- private static PyObject s$41;
- private static PyObject s$42;
- private static PyObject s$43;
- private static PyObject s$44;
- private static PyObject s$45;
- private static PyObject s$46;
- private static PyObject s$47;
- private static PyObject s$48;
- private static PyObject s$49;
- private static PyObject s$50;
- private static PyObject s$51;
- private static PyObject s$52;
- private static PyObject s$53;
- private static PyObject s$54;
- private static PyObject s$55;
- private static PyObject s$56;
- private static PyObject s$57;
- private static PyObject s$58;
- private static PyObject i$59;
- private static PyObject s$60;
- private static PyObject s$61;
- private static PyObject s$62;
- private static PyObject i$63;
- private static PyObject i$64;
- private static PyObject i$65;
- private static PyObject s$66;
- private static PyObject s$67;
- private static PyObject i$68;
- private static PyObject s$69;
- private static PyObject i$70;
- private static PyObject s$71;
- private static PyObject s$72;
- private static PyObject i$73;
- private static PyObject s$74;
- private static PyObject s$75;
- private static PyObject s$76;
- private static PyObject s$77;
- private static PyObject s$78;
- private static PyObject s$79;
- private static PyObject i$80;
- private static PyObject s$81;
- private static PyObject s$82;
- private static PyObject s$83;
- private static PyObject i$84;
- private static PyObject s$85;
- private static PyObject s$86;
- private static PyObject s$87;
- private static PyObject s$88;
- private static PyObject i$89;
- private static PyObject s$90;
- private static PyObject i$91;
- private static PyObject i$92;
- private static PyObject i$93;
- private static PyObject s$94;
- private static PyFunctionTable funcTable;
- private static PyCode c$0_firstweekday;
- private static PyCode c$1_setfirstweekday;
- private static PyCode c$2_isleap;
- private static PyCode c$3_leapdays;
- private static PyCode c$4_weekday;
- private static PyCode c$5_monthrange;
- private static PyCode c$6_monthcalendar;
- private static PyCode c$7__center;
- private static PyCode c$8_prweek;
- private static PyCode c$9_week;
- private static PyCode c$10_weekheader;
- private static PyCode c$11_prmonth;
- private static PyCode c$12_month;
- private static PyCode c$13_format3c;
- private static PyCode c$14_format3cstring;
- private static PyCode c$15_prcal;
- private static PyCode c$16_calendar;
- private static PyCode c$17_timegm;
- private static PyCode c$18_main;
- private static void initConstants() {
- s$0 = Py.newString("Calendar printing functions\012\012Note when comparing these calendars to the ones printed by cal(1): By\012default, these calendars have Monday as the first day of the week, and\012Sunday as the last (the European convention). Use setfirstweekday() to\012set the first day of the week (0=Monday, 6=Sunday).");
- s$1 = Py.newString("error");
- s$2 = Py.newString("setfirstweekday");
- s$3 = Py.newString("firstweekday");
- s$4 = Py.newString("isleap");
- s$5 = Py.newString("leapdays");
- s$6 = Py.newString("weekday");
- s$7 = Py.newString("monthrange");
- s$8 = Py.newString("monthcalendar");
- s$9 = Py.newString("prmonth");
- s$10 = Py.newString("month");
- s$11 = Py.newString("prcal");
- s$12 = Py.newString("calendar");
- s$13 = Py.newString("timegm");
- i$14 = Py.newInteger(1);
- i$15 = Py.newInteger(2);
- i$16 = Py.newInteger(0);
- i$17 = Py.newInteger(31);
- i$18 = Py.newInteger(28);
- i$19 = Py.newInteger(30);
- s$20 = Py.newString("Monday");
- s$21 = Py.newString("Tuesday");
- s$22 = Py.newString("Wednesday");
- s$23 = Py.newString("Thursday");
- s$24 = Py.newString("Friday");
- s$25 = Py.newString("Saturday");
- s$26 = Py.newString("Sunday");
- s$27 = Py.newString("Mon");
- s$28 = Py.newString("Tue");
- s$29 = Py.newString("Wed");
- s$30 = Py.newString("Thu");
- s$31 = Py.newString("Fri");
- s$32 = Py.newString("Sat");
- s$33 = Py.newString("Sun");
- s$34 = Py.newString("");
- s$35 = Py.newString("January");
- s$36 = Py.newString("February");
- s$37 = Py.newString("March");
- s$38 = Py.newString("April");
- s$39 = Py.newString("May");
- s$40 = Py.newString("June");
- s$41 = Py.newString("July");
- s$42 = Py.newString("August");
- s$43 = Py.newString("September");
- s$44 = Py.newString("October");
- s$45 = Py.newString("November");
- s$46 = Py.newString("December");
- s$47 = Py.newString(" ");
- s$48 = Py.newString("Jan");
- s$49 = Py.newString("Feb");
- s$50 = Py.newString("Mar");
- s$51 = Py.newString("Apr");
- s$52 = Py.newString("Jun");
- s$53 = Py.newString("Jul");
- s$54 = Py.newString("Aug");
- s$55 = Py.newString("Sep");
- s$56 = Py.newString("Oct");
- s$57 = Py.newString("Nov");
- s$58 = Py.newString("Dec");
- i$59 = Py.newInteger(7);
- s$60 = Py.newString("Set weekday (Monday=0, Sunday=6) to start each week.");
- s$61 = Py.newString("bad weekday number; must be 0 (Monday) to 6 (Sunday)");
- s$62 = Py.newString("Return 1 for leap years, 0 for non-leap years.");
- i$63 = Py.newInteger(4);
- i$64 = Py.newInteger(100);
- i$65 = Py.newInteger(400);
- s$66 = Py.newString("Return number of leap years in range [y1, y2).\012 Assume y1 <= y2.");
- s$67 = Py.newString("Return weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12),\012 day (1-31).");
- i$68 = Py.newInteger(6);
- s$69 = Py.newString("Return weekday (0-6 ~ Mon-Sun) and number of days (28-31) for\012 year, month.");
- i$70 = Py.newInteger(12);
- s$71 = Py.newString("bad month number");
- s$72 = Py.newString("Return a matrix representing a month's calendar.\012 Each row represents a week; days outside this month are zero.");
- i$73 = Py.newInteger(5);
- s$74 = Py.newString("Center a string in a field.");
- s$75 = Py.newString(" ");
- s$76 = Py.newString("Print a single week (no newline).");
- s$77 = Py.newString("Returns a single week in a string (no newline).");
- s$78 = Py.newString("%2i");
- s$79 = Py.newString("Return a header for a week.");
- i$80 = Py.newInteger(9);
- s$81 = Py.newString("Print a month's calendar.");
- s$82 = Py.newString("Return a month's calendar string (multi-line).");
- s$83 = Py.newString("\012");
- i$84 = Py.newInteger(3);
- s$85 = Py.newString("Prints 3-column formatting for year calendars");
- s$86 = Py.newString("Returns a string formatted from 3 strings, centered within 3 columns.");
- s$87 = Py.newString("Print a year's calendar.");
- s$88 = Py.newString("Returns a year's calendar as a multi-line string.");
- i$89 = Py.newInteger(1970);
- s$90 = Py.newString("Unrelated but handy function to calculate Unix timestamp from GMT.");
- i$91 = Py.newInteger(365);
- i$92 = Py.newInteger(24);
- i$93 = Py.newInteger(60);
- s$94 = Py.newString("/usr/share/jython/Lib-cpython/calendar.py");
- funcTable = new _PyInner();
- c$0_firstweekday = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/calendar.py", "firstweekday", false, false, funcTable, 0, null, null, 0, 1);
- c$1_setfirstweekday = Py.newCode(1, new String[] {"weekday"}, "/usr/share/jython/Lib-cpython/calendar.py", "setfirstweekday", false, false, funcTable, 1, null, null, 0, 1);
- c$2_isleap = Py.newCode(1, new String[] {"year"}, "/usr/share/jython/Lib-cpython/calendar.py", "isleap", false, false, funcTable, 2, null, null, 0, 1);
- c$3_leapdays = Py.newCode(2, new String[] {"y1", "y2"}, "/usr/share/jython/Lib-cpython/calendar.py", "leapdays", false, false, funcTable, 3, null, null, 0, 1);
- c$4_weekday = Py.newCode(3, new String[] {"year", "month", "day", "tuple", "secs"}, "/usr/share/jython/Lib-cpython/calendar.py", "weekday", false, false, funcTable, 4, null, null, 0, 1);
- c$5_monthrange = Py.newCode(2, new String[] {"year", "month", "ndays", "day1"}, "/usr/share/jython/Lib-cpython/calendar.py", "monthrange", false, false, funcTable, 5, null, null, 0, 1);
- c$6_monthcalendar = Py.newCode(2, new String[] {"year", "month", "ndays", "i", "day", "day1", "r7", "row", "rows"}, "/usr/share/jython/Lib-cpython/calendar.py", "monthcalendar", false, false, funcTable, 6, null, null, 0, 1);
- c$7__center = Py.newCode(2, new String[] {"str", "width", "n"}, "/usr/share/jython/Lib-cpython/calendar.py", "_center", false, false, funcTable, 7, null, null, 0, 1);
- c$8_prweek = Py.newCode(2, new String[] {"theweek", "width"}, "/usr/share/jython/Lib-cpython/calendar.py", "prweek", false, false, funcTable, 8, null, null, 0, 1);
- c$9_week = Py.newCode(2, new String[] {"theweek", "width", "day", "s", "days"}, "/usr/share/jython/Lib-cpython/calendar.py", "week", false, false, funcTable, 9, null, null, 0, 1);
- c$10_weekheader = Py.newCode(1, new String[] {"width", "i", "names", "days"}, "/usr/share/jython/Lib-cpython/calendar.py", "weekheader", false, false, funcTable, 10, null, null, 0, 1);
- c$11_prmonth = Py.newCode(4, new String[] {"theyear", "themonth", "w", "l"}, "/usr/share/jython/Lib-cpython/calendar.py", "prmonth", false, false, funcTable, 11, null, null, 0, 1);
- c$12_month = Py.newCode(4, new String[] {"theyear", "themonth", "w", "l", "aweek", "s"}, "/usr/share/jython/Lib-cpython/calendar.py", "month", false, false, funcTable, 12, null, null, 0, 1);
- c$13_format3c = Py.newCode(5, new String[] {"a", "b", "c", "colwidth", "spacing"}, "/usr/share/jython/Lib-cpython/calendar.py", "format3c", false, false, funcTable, 13, null, null, 0, 1);
- c$14_format3cstring = Py.newCode(5, new String[] {"a", "b", "c", "colwidth", "spacing"}, "/usr/share/jython/Lib-cpython/calendar.py", "format3cstring", false, false, funcTable, 14, null, null, 0, 1);
- c$15_prcal = Py.newCode(4, new String[] {"year", "w", "l", "c"}, "/usr/share/jython/Lib-cpython/calendar.py", "prcal", false, false, funcTable, 15, null, null, 0, 1);
- c$16_calendar = Py.newCode(4, new String[] {"year", "w", "l", "c", "weeks", "cal", "s", "height", "q", "colwidth", "amonth", "i", "header", "data"}, "/usr/share/jython/Lib-cpython/calendar.py", "calendar", false, false, funcTable, 16, null, null, 0, 1);
- c$17_timegm = Py.newCode(1, new String[] {"tuple", "second", "minute", "minutes", "hour", "i", "month", "year", "day", "hours", "seconds", "days"}, "/usr/share/jython/Lib-cpython/calendar.py", "timegm", false, false, funcTable, 17, null, null, 0, 1);
- c$18_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/calendar.py", "main", false, false, funcTable, 18, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$18_main == null) _PyInner.initConstants();
- return c$18_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.firstweekday$1(frame);
- case 1:
- return _PyInner.setfirstweekday$2(frame);
- case 2:
- return _PyInner.isleap$3(frame);
- case 3:
- return _PyInner.leapdays$4(frame);
- case 4:
- return _PyInner.weekday$5(frame);
- case 5:
- return _PyInner.monthrange$6(frame);
- case 6:
- return _PyInner.monthcalendar$7(frame);
- case 7:
- return _PyInner._center$8(frame);
- case 8:
- return _PyInner.prweek$9(frame);
- case 9:
- return _PyInner.week$10(frame);
- case 10:
- return _PyInner.weekheader$11(frame);
- case 11:
- return _PyInner.prmonth$12(frame);
- case 12:
- return _PyInner.month$13(frame);
- case 13:
- return _PyInner.format3c$14(frame);
- case 14:
- return _PyInner.format3cstring$15(frame);
- case 15:
- return _PyInner.prcal$16(frame);
- case 16:
- return _PyInner.calendar$17(frame);
- case 17:
- return _PyInner.timegm$18(frame);
- case 18:
- return _PyInner.main$19(frame);
- default:
- return null;
- }
- }
-
- private static PyObject firstweekday$1(PyFrame frame) {
- return frame.getglobal("_firstweekday");
- }
-
- private static PyObject setfirstweekday$2(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- /* Set weekday (Monday=0, Sunday=6) to start each week. */
- // global _firstweekday
- if ((frame.getglobal("MONDAY")._le(t$0$PyObject = frame.getlocal(0)).__nonzero__() ? t$0$PyObject._le(frame.getglobal("SUNDAY")) : Py.Zero).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$61);
- }
- frame.setglobal("_firstweekday", frame.getlocal(0));
- return Py.None;
- }
-
- private static PyObject isleap$3(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Return 1 for leap years, 0 for non-leap years. */
- return (t$0$PyObject = frame.getlocal(0)._mod(i$63)._eq(i$16)).__nonzero__() ? ((t$1$PyObject = frame.getlocal(0)._mod(i$64)._ne(i$16)).__nonzero__() ? t$1$PyObject : frame.getlocal(0)._mod(i$65)._eq(i$16)) : t$0$PyObject;
- }
-
- private static PyObject leapdays$4(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- /* Return number of leap years in range [y1, y2).
- Assume y1 <= y2. */
- t$0$PyObject = i$14;
- frame.setlocal(0, frame.getlocal(0).__isub__(t$0$PyObject));
- t$0$PyObject = i$14;
- frame.setlocal(1, frame.getlocal(1).__isub__(t$0$PyObject));
- return frame.getlocal(1)._div(i$63)._sub(frame.getlocal(0)._div(i$63))._sub(frame.getlocal(1)._div(i$64)._sub(frame.getlocal(0)._div(i$64)))._add(frame.getlocal(1)._div(i$65)._sub(frame.getlocal(0)._div(i$65)));
- }
-
- private static PyObject weekday$5(PyFrame frame) {
- /* Return weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12),
- day (1-31). */
- frame.setlocal(4, frame.getglobal("mktime").__call__(new PyTuple(new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2), i$16, i$16, i$16, i$16, i$16, i$16})));
- frame.setlocal(3, frame.getglobal("localtime").__call__(frame.getlocal(4)));
- return frame.getlocal(3).__getitem__(i$68);
- }
-
- private static PyObject monthrange$6(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- /* Return weekday (0-6 ~ Mon-Sun) and number of days (28-31) for
- year, month. */
- if ((i$14._le(t$0$PyObject = frame.getlocal(1)).__nonzero__() ? t$0$PyObject._le(i$70) : Py.Zero).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$71);
- }
- frame.setlocal(3, frame.getglobal("weekday").__call__(frame.getlocal(0), frame.getlocal(1), i$14));
- frame.setlocal(2, frame.getglobal("mdays").__getitem__(frame.getlocal(1))._add((t$0$PyObject = frame.getlocal(1)._eq(frame.getglobal("February"))).__nonzero__() ? frame.getglobal("isleap").__call__(frame.getlocal(0)) : t$0$PyObject));
- return new PyTuple(new PyObject[] {frame.getlocal(3), frame.getlocal(2)});
- }
-
- private static PyObject monthcalendar$7(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
-
- // Code
- /* Return a matrix representing a month's calendar.
- Each row represents a week; days outside this month are zero. */
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("monthrange").__call__(frame.getlocal(0), frame.getlocal(1)), 2);
- frame.setlocal(5, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- frame.setlocal(8, new PyList(new PyObject[] {}));
- frame.setlocal(6, frame.getglobal("range").__call__(i$59));
- frame.setlocal(4, frame.getglobal("_firstweekday")._sub(frame.getlocal(5))._add(i$68)._mod(i$59)._sub(i$73));
- while (frame.getlocal(4)._le(frame.getlocal(2)).__nonzero__()) {
- frame.setlocal(7, new PyList(new PyObject[] {i$16, i$16, i$16, i$16, i$16, i$16, i$16}));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(6);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(3, t$0$PyObject);
- if ((i$14._le(t$2$PyObject = frame.getlocal(4)).__nonzero__() ? t$2$PyObject._le(frame.getlocal(2)) : Py.Zero).__nonzero__()) {
- frame.getlocal(7).__setitem__(frame.getlocal(3), frame.getlocal(4));
- }
- frame.setlocal(4, frame.getlocal(4)._add(i$14));
- }
- frame.getlocal(8).invoke("append", frame.getlocal(7));
- }
- return frame.getlocal(8);
- }
-
- private static PyObject _center$8(PyFrame frame) {
- /* Center a string in a field. */
- frame.setlocal(2, frame.getlocal(1)._sub(frame.getglobal("len").__call__(frame.getlocal(0))));
- if (frame.getlocal(2)._le(i$16).__nonzero__()) {
- return frame.getlocal(0);
- }
- return s$75._mul(frame.getlocal(2)._add(i$14)._div(i$15))._add(frame.getlocal(0))._add(s$75._mul(frame.getlocal(2)._div(i$15)));
- }
-
- private static PyObject prweek$9(PyFrame frame) {
- /* Print a single week (no newline). */
- Py.printComma(frame.getglobal("week").__call__(frame.getlocal(0), frame.getlocal(1)));
- return Py.None;
- }
-
- private static PyObject week$10(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Returns a single week in a string (no newline). */
- frame.setlocal(4, new PyList(new PyObject[] {}));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(2, t$0$PyObject);
- if (frame.getlocal(2)._eq(i$16).__nonzero__()) {
- frame.setlocal(3, s$34);
- }
- else {
- frame.setlocal(3, s$78._mod(frame.getlocal(2)));
- }
- frame.getlocal(4).invoke("append", frame.getglobal("_center").__call__(frame.getlocal(3), frame.getlocal(1)));
- }
- return s$75.invoke("join", frame.getlocal(4));
- }
-
- private static PyObject weekheader$11(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Return a header for a week. */
- if (frame.getlocal(0)._ge(i$80).__nonzero__()) {
- frame.setlocal(2, frame.getglobal("day_name"));
- }
- else {
- frame.setlocal(2, frame.getglobal("day_abbr"));
- }
- frame.setlocal(3, new PyList(new PyObject[] {}));
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("range").__call__(frame.getglobal("_firstweekday"), frame.getglobal("_firstweekday")._add(i$59));
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(1, t$0$PyObject);
- frame.getlocal(3).invoke("append", frame.getglobal("_center").__call__(frame.getlocal(2).__getitem__(frame.getlocal(1)._mod(i$59)).__getslice__(null, frame.getlocal(0), null), frame.getlocal(0)));
- }
- return s$75.invoke("join", frame.getlocal(3));
- }
-
- private static PyObject prmonth$12(PyFrame frame) {
- /* Print a month's calendar. */
- Py.printComma(frame.getglobal("month").__call__(new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2), frame.getlocal(3)}));
- return Py.None;
- }
-
- private static PyObject month$13(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Return a month's calendar string (multi-line). */
- frame.setlocal(2, frame.getglobal("max").__call__(i$15, frame.getlocal(2)));
- frame.setlocal(3, frame.getglobal("max").__call__(i$14, frame.getlocal(3)));
- frame.setlocal(5, frame.getglobal("_center").__call__(frame.getglobal("month_name").__getitem__(frame.getlocal(1))._add(s$75)._add(frame.getlocal(0).__repr__()), i$59._mul(frame.getlocal(2)._add(i$14))._sub(i$14)).invoke("rstrip")._add(s$83._mul(frame.getlocal(3)))._add(frame.getglobal("weekheader").__call__(frame.getlocal(2)).invoke("rstrip"))._add(s$83._mul(frame.getlocal(3))));
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("monthcalendar").__call__(frame.getlocal(0), frame.getlocal(1));
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(4, t$0$PyObject);
- frame.setlocal(5, frame.getlocal(5)._add(frame.getglobal("week").__call__(frame.getlocal(4), frame.getlocal(2)).invoke("rstrip"))._add(s$83._mul(frame.getlocal(3))));
- }
- return frame.getlocal(5).__getslice__(null, frame.getlocal(3).__neg__(), null)._add(s$83);
- }
-
- private static PyObject format3c$14(PyFrame frame) {
- /* Prints 3-column formatting for year calendars */
- Py.println(frame.getglobal("format3cstring").__call__(new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2), frame.getlocal(3), frame.getlocal(4)}));
- return Py.None;
- }
-
- private static PyObject format3cstring$15(PyFrame frame) {
- /* Returns a string formatted from 3 strings, centered within 3 columns. */
- return frame.getglobal("_center").__call__(frame.getlocal(0), frame.getlocal(3))._add(s$75._mul(frame.getlocal(4)))._add(frame.getglobal("_center").__call__(frame.getlocal(1), frame.getlocal(3)))._add(s$75._mul(frame.getlocal(4)))._add(frame.getglobal("_center").__call__(frame.getlocal(2), frame.getlocal(3)));
- }
-
- private static PyObject prcal$16(PyFrame frame) {
- /* Print a year's calendar. */
- Py.printComma(frame.getglobal("calendar").__call__(new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2), frame.getlocal(3)}));
- return Py.None;
- }
-
- private static PyObject calendar$17(PyFrame frame) {
- // Temporary Variables
- int t$0$int, t$1$int, t$2$int, t$3$int;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject, t$4$PyObject, t$5$PyObject, t$6$PyObject, t$7$PyObject;
-
- // Code
- /* Returns a year's calendar as a multi-line string. */
- frame.setlocal(1, frame.getglobal("max").__call__(i$15, frame.getlocal(1)));
- frame.setlocal(2, frame.getglobal("max").__call__(i$14, frame.getlocal(2)));
- frame.setlocal(3, frame.getglobal("max").__call__(i$15, frame.getlocal(3)));
- frame.setlocal(9, frame.getlocal(1)._add(i$14)._mul(i$59)._sub(i$14));
- frame.setlocal(6, frame.getglobal("_center").__call__(frame.getlocal(0).__repr__(), frame.getlocal(9)._mul(i$84)._add(frame.getlocal(3)._mul(i$15))).invoke("rstrip")._add(s$83._mul(frame.getlocal(2))));
- frame.setlocal(12, frame.getglobal("weekheader").__call__(frame.getlocal(1)));
- frame.setlocal(12, frame.getglobal("format3cstring").__call__(new PyObject[] {frame.getlocal(12), frame.getlocal(12), frame.getlocal(12), frame.getlocal(9), frame.getlocal(3)}).invoke("rstrip"));
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("range").__call__(frame.getglobal("January"), frame.getglobal("January")._add(i$70), i$84);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(8, t$0$PyObject);
- frame.setlocal(6, frame.getlocal(6)._add(s$83._mul(frame.getlocal(2)))._add(frame.getglobal("format3cstring").__call__(new PyObject[] {frame.getglobal("month_name").__getitem__(frame.getlocal(8)), frame.getglobal("month_name").__getitem__(frame.getlocal(8)._add(i$14)), frame.getglobal("month_name").__getitem__(frame.getlocal(8)._add(i$15)), frame.getlocal(9), frame.getlocal(3)}).invoke("rstrip"))._add(s$83._mul(frame.getlocal(2)))._add(frame.getlocal(12))._add(s$83._mul(frame.getlocal(2))));
- frame.setlocal(13, new PyList(new PyObject[] {}));
- frame.setlocal(7, i$16);
- t$1$int = 0;
- t$3$PyObject = frame.getglobal("range").__call__(frame.getlocal(8), frame.getlocal(8)._add(i$84));
- while ((t$2$PyObject = t$3$PyObject.__finditem__(t$1$int++)) != null) {
- frame.setlocal(10, t$2$PyObject);
- frame.setlocal(5, frame.getglobal("monthcalendar").__call__(frame.getlocal(0), frame.getlocal(10)));
- if (frame.getglobal("len").__call__(frame.getlocal(5))._gt(frame.getlocal(7)).__nonzero__()) {
- frame.setlocal(7, frame.getglobal("len").__call__(frame.getlocal(5)));
- }
- frame.getlocal(13).invoke("append", frame.getlocal(5));
- }
- t$2$int = 0;
- t$5$PyObject = frame.getglobal("range").__call__(frame.getlocal(7));
- while ((t$4$PyObject = t$5$PyObject.__finditem__(t$2$int++)) != null) {
- frame.setlocal(11, t$4$PyObject);
- frame.setlocal(4, new PyList(new PyObject[] {}));
- t$3$int = 0;
- t$7$PyObject = frame.getlocal(13);
- while ((t$6$PyObject = t$7$PyObject.__finditem__(t$3$int++)) != null) {
- frame.setlocal(5, t$6$PyObject);
- if (frame.getlocal(11)._ge(frame.getglobal("len").__call__(frame.getlocal(5))).__nonzero__()) {
- frame.getlocal(4).invoke("append", s$34);
- }
- else {
- frame.getlocal(4).invoke("append", frame.getglobal("week").__call__(frame.getlocal(5).__getitem__(frame.getlocal(11)), frame.getlocal(1)));
- }
- }
- frame.setlocal(6, frame.getlocal(6)._add(frame.getglobal("format3cstring").__call__(new PyObject[] {frame.getlocal(4).__getitem__(i$16), frame.getlocal(4).__getitem__(i$14), frame.getlocal(4).__getitem__(i$15), frame.getlocal(9), frame.getlocal(3)}).invoke("rstrip"))._add(s$83._mul(frame.getlocal(2))));
- }
- }
- return frame.getlocal(6).__getslice__(null, frame.getlocal(2).__neg__(), null)._add(s$83);
- }
-
- private static PyObject timegm$18(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
-
- // Code
- /* Unrelated but handy function to calculate Unix timestamp from GMT. */
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0).__getslice__(null, i$68, null), 6);
- frame.setlocal(7, t$0$PyObject__[0]);
- frame.setlocal(6, t$0$PyObject__[1]);
- frame.setlocal(8, t$0$PyObject__[2]);
- frame.setlocal(4, t$0$PyObject__[3]);
- frame.setlocal(2, t$0$PyObject__[4]);
- frame.setlocal(1, t$0$PyObject__[5]);
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(7)._ge(frame.getglobal("EPOCH")));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(i$14._le(t$0$PyObject = frame.getlocal(6)).__nonzero__() ? t$0$PyObject._le(i$70) : Py.Zero);
- frame.setlocal(11, i$91._mul(frame.getlocal(7)._sub(frame.getglobal("EPOCH")))._add(frame.getglobal("leapdays").__call__(frame.getglobal("EPOCH"), frame.getlocal(7))));
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("range").__call__(i$14, frame.getlocal(6));
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(5, t$0$PyObject);
- frame.setlocal(11, frame.getlocal(11)._add(frame.getglobal("mdays").__getitem__(frame.getlocal(5))));
- }
- if (((t$2$PyObject = frame.getlocal(6)._gt(i$15)).__nonzero__() ? frame.getglobal("isleap").__call__(frame.getlocal(7)) : t$2$PyObject).__nonzero__()) {
- frame.setlocal(11, frame.getlocal(11)._add(i$14));
- }
- frame.setlocal(11, frame.getlocal(11)._add(frame.getlocal(8))._sub(i$14));
- frame.setlocal(9, frame.getlocal(11)._mul(i$92)._add(frame.getlocal(4)));
- frame.setlocal(3, frame.getlocal(9)._mul(i$93)._add(frame.getlocal(2)));
- frame.setlocal(10, frame.getlocal(3)._mul(i$93)._add(frame.getlocal(1)));
- return frame.getlocal(10);
- }
-
- private static PyObject main$19(PyFrame frame) {
- frame.setglobal("__file__", s$94);
-
- PyObject[] imp_accu;
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- /* Calendar printing functions
-
- Note when comparing these calendars to the ones printed by cal(1): By
- default, these calendars have Monday as the first day of the week, and
- Sunday as the last (the European convention). Use setfirstweekday() to
- set the first day of the week (0=Monday, 6=Sunday). */
- imp_accu = org.python.core.imp.importFrom("time", new String[] {"localtime", "mktime"}, frame);
- frame.setlocal("localtime", imp_accu[0]);
- frame.setlocal("mktime", imp_accu[1]);
- imp_accu = null;
- frame.setlocal("__all__", new PyList(new PyObject[] {s$1, s$2, s$3, s$4, s$5, s$6, s$7, s$8, s$9, s$10, s$11, s$12, s$13}));
- frame.setlocal("error", frame.getname("ValueError"));
- frame.setlocal("January", i$14);
- frame.setlocal("February", i$15);
- frame.setlocal("mdays", new PyList(new PyObject[] {i$16, i$17, i$18, i$17, i$19, i$17, i$19, i$17, i$17, i$19, i$17, i$19, i$17}));
- frame.setlocal("day_name", new PyList(new PyObject[] {s$20, s$21, s$22, s$23, s$24, s$25, s$26}));
- frame.setlocal("day_abbr", new PyList(new PyObject[] {s$27, s$28, s$29, s$30, s$31, s$32, s$33}));
- frame.setlocal("month_name", new PyList(new PyObject[] {s$34, s$35, s$36, s$37, s$38, s$39, s$40, s$41, s$42, s$43, s$44, s$45, s$46}));
- frame.setlocal("month_abbr", new PyList(new PyObject[] {s$47, s$48, s$49, s$50, s$51, s$39, s$52, s$53, s$54, s$55, s$56, s$57, s$58}));
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getname("range").__call__(i$59), 7);
- frame.setlocal("MONDAY", t$0$PyObject__[0]);
- frame.setlocal("TUESDAY", t$0$PyObject__[1]);
- frame.setlocal("WEDNESDAY", t$0$PyObject__[2]);
- frame.setlocal("THURSDAY", t$0$PyObject__[3]);
- frame.setlocal("FRIDAY", t$0$PyObject__[4]);
- frame.setlocal("SATURDAY", t$0$PyObject__[5]);
- frame.setlocal("SUNDAY", t$0$PyObject__[6]);
- frame.setlocal("_firstweekday", i$16);
- frame.setlocal("firstweekday", new PyFunction(frame.f_globals, new PyObject[] {}, c$0_firstweekday));
- frame.setlocal("setfirstweekday", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_setfirstweekday));
- frame.setlocal("isleap", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_isleap));
- frame.setlocal("leapdays", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_leapdays));
- frame.setlocal("weekday", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_weekday));
- frame.setlocal("monthrange", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_monthrange));
- frame.setlocal("monthcalendar", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_monthcalendar));
- frame.setlocal("_center", new PyFunction(frame.f_globals, new PyObject[] {}, c$7__center));
- frame.setlocal("prweek", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_prweek));
- frame.setlocal("week", new PyFunction(frame.f_globals, new PyObject[] {}, c$9_week));
- frame.setlocal("weekheader", new PyFunction(frame.f_globals, new PyObject[] {}, c$10_weekheader));
- frame.setlocal("prmonth", new PyFunction(frame.f_globals, new PyObject[] {i$16, i$16}, c$11_prmonth));
- frame.setlocal("month", new PyFunction(frame.f_globals, new PyObject[] {i$16, i$16}, c$12_month));
- frame.setlocal("_colwidth", i$59._mul(i$84)._sub(i$14));
- frame.setlocal("_spacing", i$68);
- frame.setlocal("format3c", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("_colwidth"), frame.getname("_spacing")}, c$13_format3c));
- frame.setlocal("format3cstring", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("_colwidth"), frame.getname("_spacing")}, c$14_format3cstring));
- frame.setlocal("prcal", new PyFunction(frame.f_globals, new PyObject[] {i$16, i$16, frame.getname("_spacing")}, c$15_prcal));
- frame.setlocal("calendar", new PyFunction(frame.f_globals, new PyObject[] {i$16, i$16, frame.getname("_spacing")}, c$16_calendar));
- frame.setlocal("EPOCH", i$89);
- frame.setlocal("timegm", new PyFunction(frame.f_globals, new PyObject[] {}, c$17_timegm));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("calendar"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "calendar";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(calendar._PyInner.class, newargs, calendar.jpy$packages, calendar.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class copy extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject i$16;
- private static PyObject l$17;
- private static PyObject f$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject i$23;
- private static PyObject s$24;
- private static PyObject s$25;
- private static PyObject s$26;
- private static PyObject s$27;
- private static PyObject i$28;
- private static PyObject s$29;
- private static PyFunctionTable funcTable;
- private static PyCode c$0_Error;
- private static PyCode c$1_copy;
- private static PyCode c$2__copy_atomic;
- private static PyCode c$3__copy_list;
- private static PyCode c$4__copy_tuple;
- private static PyCode c$5__copy_dict;
- private static PyCode c$6__copy_inst;
- private static PyCode c$7_deepcopy;
- private static PyCode c$8__deepcopy_atomic;
- private static PyCode c$9__deepcopy_list;
- private static PyCode c$10__deepcopy_tuple;
- private static PyCode c$11__deepcopy_dict;
- private static PyCode c$12__keep_alive;
- private static PyCode c$13__deepcopy_inst;
- private static PyCode c$14__EmptyClass;
- private static PyCode c$15___del__;
- private static PyCode c$16__EmptyClassDel;
- private static PyCode c$17___init__;
- private static PyCode c$18___getstate__;
- private static PyCode c$19___setstate__;
- private static PyCode c$20___deepcopy__;
- private static PyCode c$21_C;
- private static PyCode c$22__test;
- private static PyCode c$23_main;
- private static void initConstants() {
- s$0 = Py.newString("Generic (shallow and deep) copying operations.\012\012Interface summary:\012\012 import copy\012\012 x = copy.copy(y) # make a shallow copy of y\012 x = copy.deepcopy(y) # make a deep copy of y\012\012For module specific errors, copy.error is raised.\012\012The difference between shallow and deep copying is only relevant for\012compound objects (objects that contain other objects, like lists or\012class instances).\012\012- A shallow copy constructs a new compound object and then (to the\012 extent possible) inserts *the same objects* into in that the\012 original contains.\012\012- A deep copy constructs a new compound object and then, recursively,\012 inserts *copies* into it of the objects found in the original.\012\012Two problems often exist with deep copy operations that don't exist\012with shallow copy operations:\012\012 a) recursive objects (compound objects that, directly or indirectly,\012 contain a reference to themselves) may cause a recursive loop\012\012 b) because deep copy copies *everything* it may copy too much, e.g.\012 administrative data structures that should be shared even between\012 copies\012\012Python's deep copy operation avoids these problems by:\012\012 a) keeping a table of objects already copied during the current\012 copying pass\012\012 b) letting user-defined classes override the copying operation or the\012 set of components copied\012\012This version does not copy types like module, class, function, method,\012nor stack trace, stack frame, nor file, socket, window, nor array, nor\012any similar types.\012\012Classes can use the same interfaces to control copying that they use\012to control pickling: they can define methods called __getinitargs__(),\012__getstate__() and __setstate__(). See the documentation for module\012\"pickle\" for information on these methods.\012");
- s$1 = Py.newString("Error");
- s$2 = Py.newString("error");
- s$3 = Py.newString("copy");
- s$4 = Py.newString("deepcopy");
- s$5 = Py.newString("Shallow copy operation on arbitrary Python objects.\012\012 See the module's __doc__ string for more info.\012 ");
- s$6 = Py.newString("un(shallow)copyable object of type %s");
- s$7 = Py.newString("__copy__");
- s$8 = Py.newString("__getinitargs__");
- s$9 = Py.newString("__del__");
- s$10 = Py.newString("__getstate__");
- s$11 = Py.newString("__setstate__");
- s$12 = Py.newString("Deep copy operation on arbitrary Python objects.\012\012 See the module's __doc__ string for more info.\012 ");
- s$13 = Py.newString("un-deep-copyable object of type %s");
- s$14 = Py.newString("Keeps a reference to the object x in the memo.\012\012 Because we remember objects by their id, we have\012 to assure that possibly temporary objects are kept\012 alive by referencing them.\012 We store a reference at the id of the memo, which should\012 normally not be used unless someone tries to deepcopy\012 the memo itself...\012 ");
- s$15 = Py.newString("__deepcopy__");
- i$16 = Py.newInteger(1);
- l$17 = Py.newLong("2");
- f$18 = Py.newFloat(3.14);
- s$19 = Py.newString("xyzzy");
- s$20 = Py.newString("abc");
- s$21 = Py.newString("ABC");
- s$22 = Py.newString("__main__");
- i$23 = Py.newInteger(0);
- s$24 = Py.newString("a");
- s$25 = Py.newString("arg");
- s$26 = Py.newString("argument sketch");
- s$27 = Py.newString("xyz");
- i$28 = Py.newInteger(2);
- s$29 = Py.newString("/usr/share/jython/Lib/copy.py");
- funcTable = new _PyInner();
- c$0_Error = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/copy.py", "Error", false, false, funcTable, 0, null, null, 0, 0);
- c$1_copy = Py.newCode(1, new String[] {"x", "copier", "copierfunction", "y"}, "/usr/share/jython/Lib/copy.py", "copy", false, false, funcTable, 1, null, null, 0, 1);
- c$2__copy_atomic = Py.newCode(1, new String[] {"x"}, "/usr/share/jython/Lib/copy.py", "_copy_atomic", false, false, funcTable, 2, null, null, 0, 1);
- c$3__copy_list = Py.newCode(1, new String[] {"x"}, "/usr/share/jython/Lib/copy.py", "_copy_list", false, false, funcTable, 3, null, null, 0, 1);
- c$4__copy_tuple = Py.newCode(1, new String[] {"x"}, "/usr/share/jython/Lib/copy.py", "_copy_tuple", false, false, funcTable, 4, null, null, 0, 1);
- c$5__copy_dict = Py.newCode(1, new String[] {"x"}, "/usr/share/jython/Lib/copy.py", "_copy_dict", false, false, funcTable, 5, null, null, 0, 1);
- c$6__copy_inst = Py.newCode(1, new String[] {"x", "args", "state", "y"}, "/usr/share/jython/Lib/copy.py", "_copy_inst", false, false, funcTable, 6, null, null, 0, 1);
- c$7_deepcopy = Py.newCode(2, new String[] {"x", "memo", "copier", "copierfunction", "d", "y"}, "/usr/share/jython/Lib/copy.py", "deepcopy", false, false, funcTable, 7, null, null, 0, 1);
- c$8__deepcopy_atomic = Py.newCode(2, new String[] {"x", "memo"}, "/usr/share/jython/Lib/copy.py", "_deepcopy_atomic", false, false, funcTable, 8, null, null, 0, 1);
- c$9__deepcopy_list = Py.newCode(2, new String[] {"x", "memo", "a", "y"}, "/usr/share/jython/Lib/copy.py", "_deepcopy_list", false, false, funcTable, 9, null, null, 0, 1);
- c$10__deepcopy_tuple = Py.newCode(2, new String[] {"x", "memo", "i", "d", "y", "a"}, "/usr/share/jython/Lib/copy.py", "_deepcopy_tuple", false, false, funcTable, 10, null, null, 0, 1);
- c$11__deepcopy_dict = Py.newCode(2, new String[] {"x", "memo", "key", "y"}, "/usr/share/jython/Lib/copy.py", "_deepcopy_dict", false, false, funcTable, 11, null, null, 0, 1);
- c$12__keep_alive = Py.newCode(2, new String[] {"x", "memo"}, "/usr/share/jython/Lib/copy.py", "_keep_alive", false, false, funcTable, 12, null, null, 0, 1);
- c$13__deepcopy_inst = Py.newCode(2, new String[] {"x", "memo", "state", "args", "y"}, "/usr/share/jython/Lib/copy.py", "_deepcopy_inst", false, false, funcTable, 13, null, null, 0, 1);
- c$14__EmptyClass = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/copy.py", "_EmptyClass", false, false, funcTable, 14, null, null, 0, 0);
- c$15___del__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/copy.py", "__del__", false, false, funcTable, 15, null, null, 0, 1);
- c$16__EmptyClassDel = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/copy.py", "_EmptyClassDel", false, false, funcTable, 16, null, null, 0, 0);
- c$17___init__ = Py.newCode(2, new String[] {"self", "arg", "file", "sys"}, "/usr/share/jython/Lib/copy.py", "__init__", false, false, funcTable, 17, null, null, 0, 1);
- c$18___getstate__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/copy.py", "__getstate__", false, false, funcTable, 18, null, null, 0, 1);
- c$19___setstate__ = Py.newCode(2, new String[] {"self", "state", "key"}, "/usr/share/jython/Lib/copy.py", "__setstate__", false, false, funcTable, 19, null, null, 0, 1);
- c$20___deepcopy__ = Py.newCode(2, new String[] {"self", "memo", "new"}, "/usr/share/jython/Lib/copy.py", "__deepcopy__", false, false, funcTable, 20, null, null, 0, 1);
- c$21_C = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/copy.py", "C", false, false, funcTable, 21, null, null, 0, 0);
- c$22__test = Py.newCode(0, new String[] {"C", "l3", "l2", "repr", "l", "l1", "c"}, "/usr/share/jython/Lib/copy.py", "_test", false, false, funcTable, 22, null, null, 0, 1);
- c$23_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/copy.py", "main", false, false, funcTable, 23, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$23_main == null) _PyInner.initConstants();
- return c$23_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.Error$1(frame);
- case 1:
- return _PyInner.copy$2(frame);
- case 2:
- return _PyInner._copy_atomic$3(frame);
- case 3:
- return _PyInner._copy_list$4(frame);
- case 4:
- return _PyInner._copy_tuple$5(frame);
- case 5:
- return _PyInner._copy_dict$6(frame);
- case 6:
- return _PyInner._copy_inst$7(frame);
- case 7:
- return _PyInner.deepcopy$8(frame);
- case 8:
- return _PyInner._deepcopy_atomic$9(frame);
- case 9:
- return _PyInner._deepcopy_list$10(frame);
- case 10:
- return _PyInner._deepcopy_tuple$11(frame);
- case 11:
- return _PyInner._deepcopy_dict$12(frame);
- case 12:
- return _PyInner._keep_alive$13(frame);
- case 13:
- return _PyInner._deepcopy_inst$14(frame);
- case 14:
- return _PyInner._EmptyClass$15(frame);
- case 15:
- return _PyInner.__del__$16(frame);
- case 16:
- return _PyInner._EmptyClassDel$17(frame);
- case 17:
- return _PyInner.__init__$18(frame);
- case 18:
- return _PyInner.__getstate__$19(frame);
- case 19:
- return _PyInner.__setstate__$20(frame);
- case 20:
- return _PyInner.__deepcopy__$21(frame);
- case 21:
- return _PyInner.C$22(frame);
- case 22:
- return _PyInner._test$23(frame);
- case 23:
- return _PyInner.main$24(frame);
- default:
- return null;
- }
- }
-
- private static PyObject Error$1(PyFrame frame) {
- // pass
- return frame.getf_locals();
- }
-
- private static PyObject copy$2(PyFrame frame) {
- // Temporary Variables
- boolean t$0$boolean;
- PyException t$0$PyException, t$1$PyException;
-
- // Code
- /* Shallow copy operation on arbitrary Python objects.
-
- See the module's __doc__ string for more info.
- */
- t$0$boolean = true;
- try {
- frame.setlocal(2, frame.getglobal("_copy_dispatch").__getitem__(frame.getglobal("type").__call__(frame.getlocal(0))));
- }
- catch (Throwable x$0) {
- t$0$boolean = false;
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("KeyError"))) {
- try {
- frame.setlocal(1, frame.getlocal(0).__getattr__("__copy__"));
- }
- catch (Throwable x$1) {
- t$1$PyException = Py.setException(x$1, frame);
- if (Py.matchException(t$1$PyException, frame.getglobal("AttributeError"))) {
- throw Py.makeException(frame.getglobal("error"), s$6._mod(frame.getglobal("type").__call__(frame.getlocal(0))));
- }
- else throw t$1$PyException;
- }
- frame.setlocal(3, frame.getlocal(1).__call__());
- }
- else throw t$0$PyException;
- }
- if (t$0$boolean) {
- frame.setlocal(3, frame.getlocal(2).__call__(frame.getlocal(0)));
- }
- return frame.getlocal(3);
- }
-
- private static PyObject _copy_atomic$3(PyFrame frame) {
- return frame.getlocal(0);
- }
-
- private static PyObject _copy_list$4(PyFrame frame) {
- return frame.getlocal(0).__getslice__(null, null, null);
- }
-
- private static PyObject _copy_tuple$5(PyFrame frame) {
- return frame.getlocal(0).__getslice__(null, null, null);
- }
-
- private static PyObject _copy_dict$6(PyFrame frame) {
- return frame.getlocal(0).invoke("copy");
- }
-
- private static PyObject _copy_inst$7(PyFrame frame) {
- if (frame.getglobal("hasattr").__call__(frame.getlocal(0), s$7).__nonzero__()) {
- return frame.getlocal(0).invoke("__copy__");
- }
- if (frame.getglobal("hasattr").__call__(frame.getlocal(0), s$8).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(0).invoke("__getinitargs__"));
- frame.setlocal(3, frame.getglobal("apply").__call__(frame.getlocal(0).__getattr__("__class__"), frame.getlocal(1)));
- }
- else {
- if (frame.getglobal("hasattr").__call__(frame.getlocal(0).__getattr__("__class__"), s$9).__nonzero__()) {
- frame.setlocal(3, frame.getglobal("_EmptyClassDel").__call__());
- }
- else {
- frame.setlocal(3, frame.getglobal("_EmptyClass").__call__());
- }
- frame.getlocal(3).__setattr__("__class__", frame.getlocal(0).__getattr__("__class__"));
- }
- if (frame.getglobal("hasattr").__call__(frame.getlocal(0), s$10).__nonzero__()) {
- frame.setlocal(2, frame.getlocal(0).invoke("__getstate__"));
- }
- else {
- frame.setlocal(2, frame.getlocal(0).__getattr__("__dict__"));
- }
- if (frame.getglobal("hasattr").__call__(frame.getlocal(3), s$11).__nonzero__()) {
- frame.getlocal(3).invoke("__setstate__", frame.getlocal(2));
- }
- else {
- frame.getlocal(3).__getattr__("__dict__").invoke("update", frame.getlocal(2));
- }
- return frame.getlocal(3);
- }
-
- private static PyObject deepcopy$8(PyFrame frame) {
- // Temporary Variables
- boolean t$0$boolean;
- PyException t$0$PyException, t$1$PyException;
-
- // Code
- /* Deep copy operation on arbitrary Python objects.
-
- See the module's __doc__ string for more info.
- */
- if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(1, new PyDictionary(new PyObject[] {}));
- }
- frame.setlocal(4, frame.getglobal("id").__call__(frame.getlocal(0)));
- if (frame.getlocal(1).invoke("has_key", frame.getlocal(4)).__nonzero__()) {
- return frame.getlocal(1).__getitem__(frame.getlocal(4));
- }
- t$0$boolean = true;
- try {
- frame.setlocal(3, frame.getglobal("_deepcopy_dispatch").__getitem__(frame.getglobal("type").__call__(frame.getlocal(0))));
- }
- catch (Throwable x$0) {
- t$0$boolean = false;
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("KeyError"))) {
- try {
- frame.setlocal(2, frame.getlocal(0).__getattr__("__deepcopy__"));
- }
- catch (Throwable x$1) {
- t$1$PyException = Py.setException(x$1, frame);
- if (Py.matchException(t$1$PyException, frame.getglobal("AttributeError"))) {
- throw Py.makeException(frame.getglobal("error"), s$13._mod(frame.getglobal("type").__call__(frame.getlocal(0))));
- }
- else throw t$1$PyException;
- }
- frame.setlocal(5, frame.getlocal(2).__call__(frame.getlocal(1)));
- }
- else throw t$0$PyException;
- }
- if (t$0$boolean) {
- frame.setlocal(5, frame.getlocal(3).__call__(frame.getlocal(0), frame.getlocal(1)));
- }
- frame.getlocal(1).__setitem__(frame.getlocal(4), frame.getlocal(5));
- return frame.getlocal(5);
- }
-
- private static PyObject _deepcopy_atomic$9(PyFrame frame) {
- return frame.getlocal(0);
- }
-
- private static PyObject _deepcopy_list$10(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(3, new PyList(new PyObject[] {}));
- frame.getlocal(1).__setitem__(frame.getglobal("id").__call__(frame.getlocal(0)), frame.getlocal(3));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(2, t$0$PyObject);
- frame.getlocal(3).invoke("append", frame.getglobal("deepcopy").__call__(frame.getlocal(2), frame.getlocal(1)));
- }
- return frame.getlocal(3);
- }
-
- private static PyObject _deepcopy_tuple$11(PyFrame frame) {
- // Temporary Variables
- int t$0$int, t$1$int;
- boolean t$0$boolean;
- PyException t$0$PyException;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject;
-
- // Code
- frame.setlocal(4, new PyList(new PyObject[] {}));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(5, t$0$PyObject);
- frame.getlocal(4).invoke("append", frame.getglobal("deepcopy").__call__(frame.getlocal(5), frame.getlocal(1)));
- }
- frame.setlocal(3, frame.getglobal("id").__call__(frame.getlocal(0)));
- try {
- return frame.getlocal(1).__getitem__(frame.getlocal(3));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("KeyError"))) {
- // pass
- }
- else throw t$0$PyException;
- }
- t$1$int = 0;
- t$3$PyObject = frame.getglobal("range").__call__(frame.getglobal("len").__call__(frame.getlocal(0)));
- while (t$0$boolean=(t$2$PyObject = t$3$PyObject.__finditem__(t$1$int++)) != null) {
- frame.setlocal(2, t$2$PyObject);
- if (frame.getlocal(0).__getitem__(frame.getlocal(2))._isnot(frame.getlocal(4).__getitem__(frame.getlocal(2))).__nonzero__()) {
- frame.setlocal(4, frame.getglobal("tuple").__call__(frame.getlocal(4)));
- break;
- }
- }
- if (!t$0$boolean) {
- frame.setlocal(4, frame.getlocal(0));
- }
- frame.getlocal(1).__setitem__(frame.getlocal(3), frame.getlocal(4));
- return frame.getlocal(4);
- }
-
- private static PyObject _deepcopy_dict$12(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(3, new PyDictionary(new PyObject[] {}));
- frame.getlocal(1).__setitem__(frame.getglobal("id").__call__(frame.getlocal(0)), frame.getlocal(3));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0).invoke("keys");
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(2, t$0$PyObject);
- frame.getlocal(3).__setitem__(frame.getglobal("deepcopy").__call__(frame.getlocal(2), frame.getlocal(1)), frame.getglobal("deepcopy").__call__(frame.getlocal(0).__getitem__(frame.getlocal(2)), frame.getlocal(1)));
- }
- return frame.getlocal(3);
- }
-
- private static PyObject _keep_alive$13(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- /* Keeps a reference to the object x in the memo.
-
- Because we remember objects by their id, we have
- to assure that possibly temporary objects are kept
- alive by referencing them.
- We store a reference at the id of the memo, which should
- normally not be used unless someone tries to deepcopy
- the memo itself...
- */
- try {
- frame.getlocal(1).__getitem__(frame.getglobal("id").__call__(frame.getlocal(1))).invoke("append", frame.getlocal(0));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("KeyError"))) {
- frame.getlocal(1).__setitem__(frame.getglobal("id").__call__(frame.getlocal(1)), new PyList(new PyObject[] {frame.getlocal(0)}));
- }
- else throw t$0$PyException;
- }
- return Py.None;
- }
-
- private static PyObject _deepcopy_inst$14(PyFrame frame) {
- if (frame.getglobal("hasattr").__call__(frame.getlocal(0), s$15).__nonzero__()) {
- return frame.getlocal(0).invoke("__deepcopy__", frame.getlocal(1));
- }
- if (frame.getglobal("hasattr").__call__(frame.getlocal(0), s$8).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(0).invoke("__getinitargs__"));
- frame.getglobal("_keep_alive").__call__(frame.getlocal(3), frame.getlocal(1));
- frame.setlocal(3, frame.getglobal("deepcopy").__call__(frame.getlocal(3), frame.getlocal(1)));
- frame.setlocal(4, frame.getglobal("apply").__call__(frame.getlocal(0).__getattr__("__class__"), frame.getlocal(3)));
- }
- else {
- if (frame.getglobal("hasattr").__call__(frame.getlocal(0).__getattr__("__class__"), s$9).__nonzero__()) {
- frame.setlocal(4, frame.getglobal("_EmptyClassDel").__call__());
- }
- else {
- frame.setlocal(4, frame.getglobal("_EmptyClass").__call__());
- }
- frame.getlocal(4).__setattr__("__class__", frame.getlocal(0).__getattr__("__class__"));
- }
- frame.getlocal(1).__setitem__(frame.getglobal("id").__call__(frame.getlocal(0)), frame.getlocal(4));
- if (frame.getglobal("hasattr").__call__(frame.getlocal(0), s$10).__nonzero__()) {
- frame.setlocal(2, frame.getlocal(0).invoke("__getstate__"));
- frame.getglobal("_keep_alive").__call__(frame.getlocal(2), frame.getlocal(1));
- }
- else {
- frame.setlocal(2, frame.getlocal(0).__getattr__("__dict__"));
- }
- frame.setlocal(2, frame.getglobal("deepcopy").__call__(frame.getlocal(2), frame.getlocal(1)));
- if (frame.getglobal("hasattr").__call__(frame.getlocal(4), s$11).__nonzero__()) {
- frame.getlocal(4).invoke("__setstate__", frame.getlocal(2));
- }
- else {
- frame.getlocal(4).__getattr__("__dict__").invoke("update", frame.getlocal(2));
- }
- return frame.getlocal(4);
- }
-
- private static PyObject _EmptyClass$15(PyFrame frame) {
- // pass
- return frame.getf_locals();
- }
-
- private static PyObject __del__$16(PyFrame frame) {
- // pass
- return Py.None;
- }
-
- private static PyObject _EmptyClassDel$17(PyFrame frame) {
- frame.setlocal("__del__", new PyFunction(frame.f_globals, new PyObject[] {}, c$15___del__));
- return frame.getf_locals();
- }
-
- private static PyObject __init__$18(PyFrame frame) {
- frame.getlocal(0).__setattr__("a", i$16);
- frame.getlocal(0).__setattr__("arg", frame.getlocal(1));
- if (frame.getglobal("__name__")._eq(s$22).__nonzero__()) {
- frame.setlocal(3, org.python.core.imp.importOne("sys", frame));
- frame.setlocal(2, frame.getlocal(3).__getattr__("argv").__getitem__(i$23));
- }
- else {
- frame.setlocal(2, frame.getglobal("__file__"));
- }
- frame.getlocal(0).__setattr__("fp", frame.getglobal("open").__call__(frame.getlocal(2)));
- frame.getlocal(0).__getattr__("fp").invoke("close");
- return Py.None;
- }
-
- private static PyObject __getstate__$19(PyFrame frame) {
- return new PyDictionary(new PyObject[] {s$24, frame.getlocal(0).__getattr__("a"), s$25, frame.getlocal(0).__getattr__("arg")});
- }
-
- private static PyObject __setstate__$20(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(1).invoke("keys");
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(2, t$0$PyObject);
- frame.getglobal("setattr").__call__(frame.getlocal(0), frame.getlocal(2), frame.getlocal(1).__getitem__(frame.getlocal(2)));
- }
- return Py.None;
- }
-
- private static PyObject __deepcopy__$21(PyFrame frame) {
- frame.setlocal(2, frame.getlocal(0).invoke("__class__", frame.getglobal("deepcopy").__call__(frame.getlocal(0).__getattr__("arg"), frame.getlocal(1))));
- frame.getlocal(2).__setattr__("a", frame.getlocal(0).__getattr__("a"));
- return frame.getlocal(2);
- }
-
- private static PyObject C$22(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$17___init__));
- frame.setlocal("__getstate__", new PyFunction(frame.f_globals, new PyObject[] {}, c$18___getstate__));
- frame.setlocal("__setstate__", new PyFunction(frame.f_globals, new PyObject[] {}, c$19___setstate__));
- frame.setlocal("__deepcopy__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$20___deepcopy__));
- return frame.getf_locals();
- }
-
- private static PyObject _test$23(PyFrame frame) {
- frame.setlocal(4, new PyList(new PyObject[] {frame.getglobal("None"), i$16, l$17, f$18, s$19, new PyTuple(new PyObject[] {i$16, l$17}), new PyList(new PyObject[] {f$18, s$20}), new PyDictionary(new PyObject[] {s$20, s$21}), new PyTuple(new PyObject[] {}), new PyList(new PyObject[] {}), new PyDictionary(new PyObject[] {})}));
- frame.setlocal(5, frame.getglobal("copy").__call__(frame.getlocal(4)));
- Py.println(frame.getlocal(5)._eq(frame.getlocal(4)));
- frame.setlocal(5, frame.getglobal("map").__call__(frame.getglobal("copy"), frame.getlocal(4)));
- Py.println(frame.getlocal(5)._eq(frame.getlocal(4)));
- frame.setlocal(5, frame.getglobal("deepcopy").__call__(frame.getlocal(4)));
- Py.println(frame.getlocal(5)._eq(frame.getlocal(4)));
- frame.setlocal(0, Py.makeClass("C", new PyObject[] {}, c$21_C, null));
- frame.setlocal(6, frame.getlocal(0).__call__(s$26));
- frame.getlocal(4).invoke("append", frame.getlocal(6));
- frame.setlocal(2, frame.getglobal("copy").__call__(frame.getlocal(4)));
- Py.println(frame.getlocal(4)._eq(frame.getlocal(2)));
- Py.println(frame.getlocal(4));
- Py.println(frame.getlocal(2));
- frame.setlocal(2, frame.getglobal("deepcopy").__call__(frame.getlocal(4)));
- Py.println(frame.getlocal(4)._eq(frame.getlocal(2)));
- Py.println(frame.getlocal(4));
- Py.println(frame.getlocal(2));
- frame.getlocal(4).invoke("append", new PyDictionary(new PyObject[] {frame.getlocal(4).__getitem__(i$16), frame.getlocal(4), s$27, frame.getlocal(4).__getitem__(i$28)}));
- frame.setlocal(1, frame.getglobal("copy").__call__(frame.getlocal(4)));
- frame.setlocal(3, org.python.core.imp.importOne("repr", frame));
- Py.println(frame.getglobal("map").__call__(frame.getlocal(3).__getattr__("repr"), frame.getlocal(4)));
- Py.println(frame.getglobal("map").__call__(frame.getlocal(3).__getattr__("repr"), frame.getlocal(5)));
- Py.println(frame.getglobal("map").__call__(frame.getlocal(3).__getattr__("repr"), frame.getlocal(2)));
- Py.println(frame.getglobal("map").__call__(frame.getlocal(3).__getattr__("repr"), frame.getlocal(1)));
- frame.setlocal(1, frame.getglobal("deepcopy").__call__(frame.getlocal(4)));
- frame.setlocal(3, org.python.core.imp.importOne("repr", frame));
- Py.println(frame.getglobal("map").__call__(frame.getlocal(3).__getattr__("repr"), frame.getlocal(4)));
- Py.println(frame.getglobal("map").__call__(frame.getlocal(3).__getattr__("repr"), frame.getlocal(5)));
- Py.println(frame.getglobal("map").__call__(frame.getlocal(3).__getattr__("repr"), frame.getlocal(2)));
- Py.println(frame.getglobal("map").__call__(frame.getlocal(3).__getattr__("repr"), frame.getlocal(1)));
- return Py.None;
- }
-
- private static PyObject main$24(PyFrame frame) {
- frame.setglobal("__file__", s$29);
-
- PyObject[] imp_accu;
- // Temporary Variables
- PyObject t$0$PyObject;
- PyException t$0$PyException;
-
- // Code
- /* Generic (shallow and deep) copying operations.
-
- Interface summary:
-
- import copy
-
- x = copy.copy(y) # make a shallow copy of y
- x = copy.deepcopy(y) # make a deep copy of y
-
- For module specific errors, copy.error is raised.
-
- The difference between shallow and deep copying is only relevant for
- compound objects (objects that contain other objects, like lists or
- class instances).
-
- - A shallow copy constructs a new compound object and then (to the
- extent possible) inserts *the same objects* into in that the
- original contains.
-
- - A deep copy constructs a new compound object and then, recursively,
- inserts *copies* into it of the objects found in the original.
-
- Two problems often exist with deep copy operations that don't exist
- with shallow copy operations:
-
- a) recursive objects (compound objects that, directly or indirectly,
- contain a reference to themselves) may cause a recursive loop
-
- b) because deep copy copies *everything* it may copy too much, e.g.
- administrative data structures that should be shared even between
- copies
-
- Python's deep copy operation avoids these problems by:
-
- a) keeping a table of objects already copied during the current
- copying pass
-
- b) letting user-defined classes override the copying operation or the
- set of components copied
-
- This version does not copy types like module, class, function, method,
- nor stack trace, stack frame, nor file, socket, window, nor array, nor
- any similar types.
-
- Classes can use the same interfaces to control copying that they use
- to control pickling: they can define methods called __getinitargs__(),
- __getstate__() and __setstate__(). See the documentation for module
- "pickle" for information on these methods.
- */
- frame.setlocal("types", org.python.core.imp.importOne("types", frame));
- frame.setlocal("Error", Py.makeClass("Error", new PyObject[] {frame.getname("Exception")}, c$0_Error, null));
- frame.setlocal("error", frame.getname("Error"));
- try {
- imp_accu = org.python.core.imp.importFrom("org.python.core", new String[] {"PyStringMap"}, frame);
- frame.setlocal("PyStringMap", imp_accu[0]);
- imp_accu = null;
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getname("ImportError"))) {
- frame.setlocal("PyStringMap", frame.getname("None"));
- }
- else throw t$0$PyException;
- }
- frame.setlocal("__all__", new PyList(new PyObject[] {s$1, s$2, s$3, s$4}));
- frame.setlocal("copy", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_copy));
- t$0$PyObject = new PyDictionary(new PyObject[] {});
- frame.setlocal("_copy_dispatch", t$0$PyObject);
- frame.setlocal("d", t$0$PyObject);
- frame.setlocal("_copy_atomic", new PyFunction(frame.f_globals, new PyObject[] {}, c$2__copy_atomic));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("NoneType"), frame.getname("_copy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("IntType"), frame.getname("_copy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("LongType"), frame.getname("_copy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("FloatType"), frame.getname("_copy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("StringType"), frame.getname("_copy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("UnicodeType"), frame.getname("_copy_atomic"));
- try {
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("CodeType"), frame.getname("_copy_atomic"));
- }
- catch (Throwable x$1) {
- t$0$PyException = Py.setException(x$1, frame);
- if (Py.matchException(t$0$PyException, frame.getname("AttributeError"))) {
- // pass
- }
- else throw t$0$PyException;
- }
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("TypeType"), frame.getname("_copy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("XRangeType"), frame.getname("_copy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("ClassType"), frame.getname("_copy_atomic"));
- frame.setlocal("_copy_list", new PyFunction(frame.f_globals, new PyObject[] {}, c$3__copy_list));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("ListType"), frame.getname("_copy_list"));
- frame.setlocal("_copy_tuple", new PyFunction(frame.f_globals, new PyObject[] {}, c$4__copy_tuple));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("TupleType"), frame.getname("_copy_tuple"));
- frame.setlocal("_copy_dict", new PyFunction(frame.f_globals, new PyObject[] {}, c$5__copy_dict));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("DictionaryType"), frame.getname("_copy_dict"));
- if (frame.getname("PyStringMap")._isnot(frame.getname("None")).__nonzero__()) {
- frame.getname("d").__setitem__(frame.getname("PyStringMap"), frame.getname("_copy_dict"));
- }
- frame.setlocal("_copy_inst", new PyFunction(frame.f_globals, new PyObject[] {}, c$6__copy_inst));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("InstanceType"), frame.getname("_copy_inst"));
- frame.dellocal("d");
- frame.setlocal("deepcopy", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$7_deepcopy));
- t$0$PyObject = new PyDictionary(new PyObject[] {});
- frame.setlocal("_deepcopy_dispatch", t$0$PyObject);
- frame.setlocal("d", t$0$PyObject);
- frame.setlocal("_deepcopy_atomic", new PyFunction(frame.f_globals, new PyObject[] {}, c$8__deepcopy_atomic));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("NoneType"), frame.getname("_deepcopy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("IntType"), frame.getname("_deepcopy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("LongType"), frame.getname("_deepcopy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("FloatType"), frame.getname("_deepcopy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("StringType"), frame.getname("_deepcopy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("UnicodeType"), frame.getname("_deepcopy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("CodeType"), frame.getname("_deepcopy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("TypeType"), frame.getname("_deepcopy_atomic"));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("XRangeType"), frame.getname("_deepcopy_atomic"));
- frame.setlocal("_deepcopy_list", new PyFunction(frame.f_globals, new PyObject[] {}, c$9__deepcopy_list));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("ListType"), frame.getname("_deepcopy_list"));
- frame.setlocal("_deepcopy_tuple", new PyFunction(frame.f_globals, new PyObject[] {}, c$10__deepcopy_tuple));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("TupleType"), frame.getname("_deepcopy_tuple"));
- frame.setlocal("_deepcopy_dict", new PyFunction(frame.f_globals, new PyObject[] {}, c$11__deepcopy_dict));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("DictionaryType"), frame.getname("_deepcopy_dict"));
- if (frame.getname("PyStringMap")._isnot(frame.getname("None")).__nonzero__()) {
- frame.getname("d").__setitem__(frame.getname("PyStringMap"), frame.getname("_deepcopy_dict"));
- }
- frame.setlocal("_keep_alive", new PyFunction(frame.f_globals, new PyObject[] {}, c$12__keep_alive));
- frame.setlocal("_deepcopy_inst", new PyFunction(frame.f_globals, new PyObject[] {}, c$13__deepcopy_inst));
- frame.getname("d").__setitem__(frame.getname("types").__getattr__("InstanceType"), frame.getname("_deepcopy_inst"));
- frame.dellocal("d");
- frame.dellocal("types");
- frame.setlocal("_EmptyClass", Py.makeClass("_EmptyClass", new PyObject[] {}, c$14__EmptyClass, null));
- frame.setlocal("_EmptyClassDel", Py.makeClass("_EmptyClassDel", new PyObject[] {}, c$16__EmptyClassDel, null));
- frame.setlocal("_test", new PyFunction(frame.f_globals, new PyObject[] {}, c$22__test));
- if (frame.getname("__name__")._eq(s$22).__nonzero__()) {
- frame.getname("_test").__call__();
- }
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("copy"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "copy";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(copy._PyInner.class, newargs, copy.jpy$packages, copy.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class copy_reg extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject i$6;
- private static PyObject j$7;
- private static PyObject s$8;
- private static PyFunctionTable funcTable;
- private static PyCode c$0_pickle;
- private static PyCode c$1_constructor;
- private static PyCode c$2_pickle_complex;
- private static PyCode c$3_main;
- private static void initConstants() {
- s$0 = Py.newString("Helper to provide extensibility for pickle/cPickle.\012\012This is only useful to add pickle support for extension types defined in\012C, not for instances of user-defined classes.\012");
- s$1 = Py.newString("pickle");
- s$2 = Py.newString("constructor");
- s$3 = Py.newString("copy_reg is not intended for use with classes");
- s$4 = Py.newString("reduction functions must be callable");
- s$5 = Py.newString("constructors must be callable");
- i$6 = Py.newInteger(1);
- j$7 = Py.newImaginary(1.0);
- s$8 = Py.newString("/usr/share/jython/Lib-cpython/copy_reg.py");
- funcTable = new _PyInner();
- c$0_pickle = Py.newCode(3, new String[] {"ob_type", "pickle_function", "constructor_ob"}, "/usr/share/jython/Lib-cpython/copy_reg.py", "pickle", false, false, funcTable, 0, null, null, 0, 1);
- c$1_constructor = Py.newCode(1, new String[] {"object"}, "/usr/share/jython/Lib-cpython/copy_reg.py", "constructor", false, false, funcTable, 1, null, null, 0, 1);
- c$2_pickle_complex = Py.newCode(1, new String[] {"c"}, "/usr/share/jython/Lib-cpython/copy_reg.py", "pickle_complex", false, false, funcTable, 2, null, null, 0, 1);
- c$3_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/copy_reg.py", "main", false, false, funcTable, 3, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$3_main == null) _PyInner.initConstants();
- return c$3_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.pickle$1(frame);
- case 1:
- return _PyInner.constructor$2(frame);
- case 2:
- return _PyInner.pickle_complex$3(frame);
- case 3:
- return _PyInner.main$4(frame);
- default:
- return null;
- }
- }
-
- private static PyObject pickle$1(PyFrame frame) {
- if (frame.getglobal("type").__call__(frame.getlocal(0))._is(frame.getglobal("_ClassType")).__nonzero__()) {
- throw Py.makeException(frame.getglobal("TypeError").__call__(s$3));
- }
- if (frame.getglobal("callable").__call__(frame.getlocal(1)).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("TypeError").__call__(s$4));
- }
- frame.getglobal("dispatch_table").__setitem__(frame.getlocal(0), frame.getlocal(1));
- if (frame.getlocal(2)._isnot(frame.getglobal("None")).__nonzero__()) {
- frame.getglobal("constructor").__call__(frame.getlocal(2));
- }
- return Py.None;
- }
-
- private static PyObject constructor$2(PyFrame frame) {
- if (frame.getglobal("callable").__call__(frame.getlocal(0)).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("TypeError").__call__(s$5));
- }
- frame.getglobal("safe_constructors").__setitem__(frame.getlocal(0), i$6);
- return Py.None;
- }
-
- private static PyObject pickle_complex$3(PyFrame frame) {
- return new PyTuple(new PyObject[] {frame.getglobal("complex"), new PyTuple(new PyObject[] {frame.getlocal(0).__getattr__("real"), frame.getlocal(0).__getattr__("imag")})});
- }
-
- private static PyObject main$4(PyFrame frame) {
- frame.setglobal("__file__", s$8);
-
- PyObject[] imp_accu;
- // Code
- /* Helper to provide extensibility for pickle/cPickle.
-
- This is only useful to add pickle support for extension types defined in
- C, not for instances of user-defined classes.
- */
- imp_accu = org.python.core.imp.importFrom("types", new String[] {"ClassType"}, frame);
- frame.setlocal("_ClassType", imp_accu[0]);
- imp_accu = null;
- frame.setlocal("__all__", new PyList(new PyObject[] {s$1, s$2}));
- frame.setlocal("dispatch_table", new PyDictionary(new PyObject[] {}));
- frame.setlocal("safe_constructors", new PyDictionary(new PyObject[] {}));
- frame.setlocal("pickle", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$0_pickle));
- frame.setlocal("constructor", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_constructor));
- frame.setlocal("pickle_complex", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_pickle_complex));
- frame.getname("pickle").__call__(frame.getname("type").__call__(j$7), frame.getname("pickle_complex"), frame.getname("complex"));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("copy_reg"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "copy_reg";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(copy_reg._PyInner.class, newargs, copy_reg.jpy$packages, copy_reg.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class javaos extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject i$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject s$16;
- private static PyObject s$17;
- private static PyObject s$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyObject s$24;
- private static PyObject f$25;
- private static PyObject s$26;
- private static PyObject i$27;
- private static PyObject s$28;
- private static PyObject s$29;
- private static PyObject s$30;
- private static PyObject s$31;
- private static PyObject s$32;
- private static PyObject s$33;
- private static PyObject s$34;
- private static PyObject s$35;
- private static PyObject s$36;
- private static PyObject s$37;
- private static PyObject s$38;
- private static PyObject s$39;
- private static PyObject s$40;
- private static PyObject s$41;
- private static PyObject s$42;
- private static PyObject s$43;
- private static PyObject s$44;
- private static PyObject s$45;
- private static PyObject s$46;
- private static PyObject s$47;
- private static PyObject s$48;
- private static PyObject s$49;
- private static PyObject s$50;
- private static PyObject s$51;
- private static PyObject s$52;
- private static PyObject s$53;
- private static PyObject s$54;
- private static PyObject s$55;
- private static PyObject s$56;
- private static PyObject s$57;
- private static PyObject s$58;
- private static PyObject s$59;
- private static PyObject s$60;
- private static PyObject s$61;
- private static PyObject s$62;
- private static PyObject s$63;
- private static PyObject s$64;
- private static PyObject s$65;
- private static PyObject s$66;
- private static PyObject s$67;
- private static PyObject s$68;
- private static PyObject s$69;
- private static PyObject s$70;
- private static PyObject s$71;
- private static PyObject s$72;
- private static PyObject s$73;
- private static PyObject s$74;
- private static PyObject s$75;
- private static PyObject s$76;
- private static PyObject s$77;
- private static PyObject s$78;
- private static PyObject s$79;
- private static PyObject s$80;
- private static PyObject s$81;
- private static PyObject s$82;
- private static PyObject s$83;
- private static PyObject s$84;
- private static PyObject s$85;
- private static PyObject s$86;
- private static PyObject s$87;
- private static PyObject s$88;
- private static PyObject s$89;
- private static PyObject s$90;
- private static PyObject s$91;
- private static PyObject s$92;
- private static PyObject s$93;
- private static PyObject s$94;
- private static PyObject s$95;
- private static PyObject s$96;
- private static PyObject s$97;
- private static PyObject s$98;
- private static PyObject s$99;
- private static PyObject s$100;
- private static PyObject s$101;
- private static PyObject s$102;
- private static PyObject s$103;
- private static PyObject s$104;
- private static PyObject s$105;
- private static PyObject s$106;
- private static PyObject s$107;
- private static PyObject s$108;
- private static PyObject s$109;
- private static PyFunctionTable funcTable;
- private static PyCode c$0__exit;
- private static PyCode c$1_getcwd;
- private static PyCode c$2_chdir;
- private static PyCode c$3_listdir;
- private static PyCode c$4_mkdir;
- private static PyCode c$5_makedirs;
- private static PyCode c$6_remove;
- private static PyCode c$7_rename;
- private static PyCode c$8_rmdir;
- private static PyCode c$9_stat;
- private static PyCode c$10_utime;
- private static PyCode c$11_lambda;
- private static PyCode c$12_lambda;
- private static PyCode c$13___init__;
- private static PyCode c$14__LazyDict__populate;
- private static PyCode c$15___repr__;
- private static PyCode c$16___cmp__;
- private static PyCode c$17___len__;
- private static PyCode c$18___getitem__;
- private static PyCode c$19___setitem__;
- private static PyCode c$20___delitem__;
- private static PyCode c$21_clear;
- private static PyCode c$22_copy;
- private static PyCode c$23_keys;
- private static PyCode c$24_items;
- private static PyCode c$25_values;
- private static PyCode c$26_has_key;
- private static PyCode c$27_update;
- private static PyCode c$28_get;
- private static PyCode c$29_setdefault;
- private static PyCode c$30_popitem;
- private static PyCode c$31_LazyDict;
- private static PyCode c$32___init__;
- private static PyCode c$33_println;
- private static PyCode c$34_printlnStdErr;
- private static PyCode c$35_system;
- private static PyCode c$36_execute;
- private static PyCode c$37__readLines;
- private static PyCode c$38__formatCmd;
- private static PyCode c$39__formatEnvironment;
- private static PyCode c$40__getEnvironment;
- private static PyCode c$41__ShellEnv;
- private static PyCode c$42__getOsType;
- private static PyCode c$43__getShellEnv;
- private static PyCode c$44__testGetOsType;
- private static PyCode c$45__testCmds;
- private static PyCode c$46__testSystem;
- private static PyCode c$47__testBadShell;
- private static PyCode c$48__testBadGetEnv;
- private static PyCode c$49__test;
- private static PyCode c$50_main;
- private static void initConstants() {
- s$0 = Py.newString("OS routines for Java, with some attempts to support DOS, NT, and\012Posix functionality.\012\012This exports:\012 - all functions from posix, nt, dos, os2, mac, or ce, e.g. unlink, stat, etc.\012 - os.path is one of the modules posixpath, ntpath, macpath, or dospath\012 - os.name is 'posix', 'nt', 'dos', 'os2', 'mac', 'ce' or 'riscos'\012 - os.curdir is a string representing the current directory ('.' or ':')\012 - os.pardir is a string representing the parent directory ('..' or '::')\012 - os.sep is the (or a most common) pathname separator ('/' or ':' or '\\\\')\012 - os.altsep is the alternate pathname separator (None or '/')\012 - os.pathsep is the component separator used in $PATH etc\012 - os.linesep is the line separator in text files ('\\r' or '\\n' or '\\r\\n')\012 - os.defpath is the default search path for executables\012\012Programs that import and use 'os' stand a better chance of being\012portable between different platforms. Of course, they must then\012only use functions that are defined by all platforms (e.g., unlink\012and opendir), and leave all pathname manipulation to os.path\012(e.g., split and join).\012");
- s$1 = Py.newString("altsep");
- s$2 = Py.newString("curdir");
- s$3 = Py.newString("pardir");
- s$4 = Py.newString("sep");
- s$5 = Py.newString("pathsep");
- s$6 = Py.newString("linesep");
- s$7 = Py.newString("defpath");
- s$8 = Py.newString("name");
- s$9 = Py.newString("java");
- s$10 = Py.newString(".");
- s$11 = Py.newString("..");
- s$12 = Py.newString("line.separator");
- i$13 = Py.newInteger(0);
- s$14 = Py.newString("foo");
- s$15 = Py.newString("chdir not supported in Java");
- s$16 = Py.newString("No such directory");
- s$17 = Py.newString("couldn't make directory");
- s$18 = Py.newString("ignored");
- s$19 = Py.newString("couldn't make directories");
- s$20 = Py.newString("couldn't delete file");
- s$21 = Py.newString("couldn't rename file");
- s$22 = Py.newString("couldn't delete directory");
- s$23 = Py.newString("The Java stat implementation only returns a small subset of\012 the standard fields");
- s$24 = Py.newString("No such file or directory");
- f$25 = Py.newFloat(1000.0);
- s$26 = Py.newString("setLastModified");
- i$27 = Py.newInteger(1);
- s$28 = Py.newString("A lazy-populating User Dictionary.\012 Lazy initialization is not thread-safe.\012 ");
- s$29 = Py.newString("dict: starting dictionary of values\012 populate: function that returns the populated dictionary\012 keyTransform: function to normalize the keys (e.g., toupper/None)\012 ");
- s$30 = Py.newString("Provide environment derived by spawning a subshell and parsing its\012 environment. Also supports system functions and provides empty\012 environment support for platforms with unknown shell\012 functionality.\012 ");
- s$31 = Py.newString("cmd: list of exec() arguments to run command in subshell, or None\012 getEnv: shell command to list environment variables, or None\012 keyTransform: normalization function for environment keys, or None\012 ");
- s$32 = Py.newString("Imitate the standard library 'system' call.\012 Execute 'cmd' in a shell, and send output to stdout & stderr.\012 ");
- s$33 = Py.newString("\012");
- s$34 = Py.newString("Execute cmd in a shell, and return the process instance");
- s$35 = Py.newString("Failed to execute command (%s): %s");
- s$36 = Py.newString("Read lines of stream, and either append them to return\012 array of lines, or call func on each line.\012 ");
- s$37 = Py.newString("Format a command for execution in a shell.");
- s$38 = Py.newString("Unable to execute commands in subshell because shell functionality not implemented for OS %s with shell setting %s. Failed command=%s");
- s$39 = Py.newString("Format enviroment in lines suitable for Runtime.exec");
- s$40 = Py.newString("%s=%s");
- s$41 = Py.newString("Get the environment variables by spawning a subshell.\012 This allows multi-line variables as long as subsequent lines do\012 not have '=' signs.\012 ");
- s$42 = Py.newString("=");
- s$43 = Py.newString("getEnv command (%s) did not print environment.\012Output=%s");
- s$44 = Py.newString("%s\012%s");
- s$45 = Py.newString("Failed to get environment, environ will be empty:");
- s$46 = Py.newString("Select the OS behavior based on os argument, 'python.os' registry\012 setting and 'os.name' Java property.\012 os: explicitly select desired OS. os=None to autodetect, os='None' to\012 disable \012 ");
- s$47 = Py.newString("python.os");
- s$48 = Py.newString("os.name");
- s$49 = Py.newString("nt");
- s$50 = Py.newString("(nt)|(Windows NT)|(Windows NT 4.0)|(WindowsNT)|(Windows 2000)|(Windows XP)|(Windows CE)");
- s$51 = Py.newString("dos");
- s$52 = Py.newString("(dos)|(Windows 95)|(Windows 98)|(Windows ME)");
- s$53 = Py.newString("mac");
- s$54 = Py.newString("(mac)|(MacOS.*)|(Darwin)");
- s$55 = Py.newString("None");
- s$56 = Py.newString("(None)");
- s$57 = Py.newString("posix");
- s$58 = Py.newString("(.*)");
- s$59 = Py.newString("Create the desired environment type.\012 envType: 'shell' or None\012 ");
- s$60 = Py.newString("shell");
- s$61 = Py.newString("python.environment");
- s$62 = Py.newString("cmd");
- s$63 = Py.newString("/c");
- s$64 = Py.newString("set");
- s$65 = Py.newString("command.com");
- s$66 = Py.newString("sh");
- s$67 = Py.newString("-c");
- s$68 = Py.newString("env");
- s$69 = Py.newString(":");
- s$70 = Py.newString("::");
- s$71 = Py.newString("Windows NT");
- s$72 = Py.newString("Windows 95");
- s$73 = Py.newString("MacOS");
- s$74 = Py.newString("Solaris");
- s$75 = Py.newString("Linux");
- s$76 = Py.newString("_getOsType( '%s' ) should return '%s', not '%s'");
- s$77 = Py.newString("\012Executing '%s' with %s environment");
- s$78 = Py.newString("%s failed with %s environment");
- s$79 = Py.newString("expected match for %s, got %s");
- s$80 = Py.newString("testKey");
- s$81 = Py.newString("testValue");
- s$82 = Py.newString("echo hello there");
- s$83 = Py.newString("hello there");
- s$84 = Py.newString("echo PATH=%PATH%");
- s$85 = Py.newString("(PATH=.*;.*)|(PATH=%PATH%)");
- s$86 = Py.newString("echo %s=%%%s%%");
- s$87 = Py.newString("(%s=)");
- s$88 = Py.newString("echo PATH=$PATH");
- s$89 = Py.newString("PATH=.*");
- s$90 = Py.newString("echo %s=$%s");
- s$91 = Py.newString("(%s=$%s)|(%s=)|(%s=%s)");
- s$92 = Py.newString("echo \"hello there\"");
- s$93 = Py.newString("\"?hello there\"?");
- s$94 = Py.newString("jython -c \"import sys;sys.stdout.write( 'why\\n' )\"");
- s$95 = Py.newString("why");
- s$96 = Py.newString("jython -c \"import sys;sys.stderr.write('why\\n');print \" ");
- s$97 = Py.newString("");
- s$98 = Py.newString("before population, environ._populated should be false");
- s$99 = Py.newString("default");
- s$100 = Py.newString("after population, environ._populated should be true");
- s$101 = Py.newString("expected stub to have %s set");
- s$102 = Py.newString("expected real environment to have %s set");
- s$103 = Py.newString("initialized");
- s$104 = Py.newString("PATH");
- s$105 = Py.newString("expected environment to have PATH attribute (this may not apply to all platforms!)");
- s$106 = Py.newString("badshell");
- s$107 = Py.newString("environment should be empty");
- s$108 = Py.newString("echo This command does not print environment");
- s$109 = Py.newString("/usr/share/jython/Lib/javaos.py");
- funcTable = new _PyInner();
- c$0__exit = Py.newCode(1, new String[] {"n"}, "/usr/share/jython/Lib/javaos.py", "_exit", false, false, funcTable, 0, null, null, 0, 1);
- c$1_getcwd = Py.newCode(0, new String[] {"foo"}, "/usr/share/jython/Lib/javaos.py", "getcwd", false, false, funcTable, 1, null, null, 0, 1);
- c$2_chdir = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javaos.py", "chdir", false, false, funcTable, 2, null, null, 0, 1);
- c$3_listdir = Py.newCode(1, new String[] {"path", "l"}, "/usr/share/jython/Lib/javaos.py", "listdir", false, false, funcTable, 3, null, null, 0, 1);
- c$4_mkdir = Py.newCode(2, new String[] {"path", "mode"}, "/usr/share/jython/Lib/javaos.py", "mkdir", false, false, funcTable, 4, null, null, 0, 1);
- c$5_makedirs = Py.newCode(2, new String[] {"path", "mode"}, "/usr/share/jython/Lib/javaos.py", "makedirs", false, false, funcTable, 5, null, null, 0, 1);
- c$6_remove = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javaos.py", "remove", false, false, funcTable, 6, null, null, 0, 1);
- c$7_rename = Py.newCode(2, new String[] {"path", "newpath"}, "/usr/share/jython/Lib/javaos.py", "rename", false, false, funcTable, 7, null, null, 0, 1);
- c$8_rmdir = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javaos.py", "rmdir", false, false, funcTable, 8, null, null, 0, 1);
- c$9_stat = Py.newCode(1, new String[] {"path", "mtime", "size", "f"}, "/usr/share/jython/Lib/javaos.py", "stat", false, false, funcTable, 9, null, null, 0, 1);
- c$10_utime = Py.newCode(2, new String[] {"path", "times"}, "/usr/share/jython/Lib/javaos.py", "utime", false, false, funcTable, 10, null, null, 0, 1);
- c$11_lambda = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/javaos.py", "<lambda>", false, false, funcTable, 11, null, null, 0, 1);
- c$12_lambda = Py.newCode(1, new String[] {"key"}, "/usr/share/jython/Lib/javaos.py", "<lambda>", false, false, funcTable, 12, null, null, 0, 1);
- c$13___init__ = Py.newCode(4, new String[] {"self", "dict", "populate", "keyTransform"}, "/usr/share/jython/Lib/javaos.py", "__init__", false, false, funcTable, 13, null, null, 0, 1);
- c$14__LazyDict__populate = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/javaos.py", "_LazyDict__populate", false, false, funcTable, 14, null, null, 0, 1);
- c$15___repr__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/javaos.py", "__repr__", false, false, funcTable, 15, null, null, 0, 1);
- c$16___cmp__ = Py.newCode(2, new String[] {"self", "dict"}, "/usr/share/jython/Lib/javaos.py", "__cmp__", false, false, funcTable, 16, null, null, 0, 1);
- c$17___len__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/javaos.py", "__len__", false, false, funcTable, 17, null, null, 0, 1);
- c$18___getitem__ = Py.newCode(2, new String[] {"self", "key"}, "/usr/share/jython/Lib/javaos.py", "__getitem__", false, false, funcTable, 18, null, null, 0, 1);
- c$19___setitem__ = Py.newCode(3, new String[] {"self", "key", "item"}, "/usr/share/jython/Lib/javaos.py", "__setitem__", false, false, funcTable, 19, null, null, 0, 1);
- c$20___delitem__ = Py.newCode(2, new String[] {"self", "key"}, "/usr/share/jython/Lib/javaos.py", "__delitem__", false, false, funcTable, 20, null, null, 0, 1);
- c$21_clear = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/javaos.py", "clear", false, false, funcTable, 21, null, null, 0, 1);
- c$22_copy = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/javaos.py", "copy", false, false, funcTable, 22, null, null, 0, 1);
- c$23_keys = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/javaos.py", "keys", false, false, funcTable, 23, null, null, 0, 1);
- c$24_items = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/javaos.py", "items", false, false, funcTable, 24, null, null, 0, 1);
- c$25_values = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/javaos.py", "values", false, false, funcTable, 25, null, null, 0, 1);
- c$26_has_key = Py.newCode(2, new String[] {"self", "key"}, "/usr/share/jython/Lib/javaos.py", "has_key", false, false, funcTable, 26, null, null, 0, 1);
- c$27_update = Py.newCode(2, new String[] {"self", "dict"}, "/usr/share/jython/Lib/javaos.py", "update", false, false, funcTable, 27, null, null, 0, 1);
- c$28_get = Py.newCode(3, new String[] {"self", "key", "failobj"}, "/usr/share/jython/Lib/javaos.py", "get", false, false, funcTable, 28, null, null, 0, 1);
- c$29_setdefault = Py.newCode(3, new String[] {"self", "key", "failobj"}, "/usr/share/jython/Lib/javaos.py", "setdefault", false, false, funcTable, 29, null, null, 0, 1);
- c$30_popitem = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/javaos.py", "popitem", false, false, funcTable, 30, null, null, 0, 1);
- c$31_LazyDict = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/javaos.py", "LazyDict", false, false, funcTable, 31, null, null, 0, 0);
- c$32___init__ = Py.newCode(4, new String[] {"self", "cmd", "getEnv", "keyTransform"}, "/usr/share/jython/Lib/javaos.py", "__init__", false, false, funcTable, 32, null, null, 0, 1);
- c$33_println = Py.newCode(2, new String[] {"arg", "write"}, "/usr/share/jython/Lib/javaos.py", "println", false, false, funcTable, 33, null, null, 0, 1);
- c$34_printlnStdErr = Py.newCode(2, new String[] {"arg", "write"}, "/usr/share/jython/Lib/javaos.py", "printlnStdErr", false, false, funcTable, 34, null, null, 0, 1);
- c$35_system = Py.newCode(2, new String[] {"self", "cmd", "println", "printlnStdErr", "p"}, "/usr/share/jython/Lib/javaos.py", "system", false, false, funcTable, 35, null, null, 0, 1);
- c$36_execute = Py.newCode(2, new String[] {"self", "cmd", "p", "shellCmd", "env", "ex"}, "/usr/share/jython/Lib/javaos.py", "execute", false, false, funcTable, 36, null, null, 0, 1);
- c$37__readLines = Py.newCode(3, new String[] {"self", "stream", "func", "bufStream", "lines", "line"}, "/usr/share/jython/Lib/javaos.py", "_readLines", false, false, funcTable, 37, null, null, 0, 1);
- c$38__formatCmd = Py.newCode(2, new String[] {"self", "cmd", "msgFmt"}, "/usr/share/jython/Lib/javaos.py", "_formatCmd", false, false, funcTable, 38, null, null, 0, 1);
- c$39__formatEnvironment = Py.newCode(2, new String[] {"self", "env", "lines", "keyValue"}, "/usr/share/jython/Lib/javaos.py", "_formatEnvironment", false, false, funcTable, 39, null, null, 0, 1);
- c$40__getEnvironment = Py.newCode(1, new String[] {"self", "p", "i", "env", "ex", "value", "key", "lines", "line"}, "/usr/share/jython/Lib/javaos.py", "_getEnvironment", false, false, funcTable, 40, null, null, 0, 1);
- c$41__ShellEnv = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/javaos.py", "_ShellEnv", false, false, funcTable, 41, null, null, 0, 0);
- c$42__getOsType = Py.newCode(1, new String[] {"os", "osType", "pattern", "_osTypeMap"}, "/usr/share/jython/Lib/javaos.py", "_getOsType", false, false, funcTable, 42, null, null, 0, 1);
- c$43__getShellEnv = Py.newCode(4, new String[] {"envType", "shellCmd", "envCmd", "envTransform"}, "/usr/share/jython/Lib/javaos.py", "_getShellEnv", false, false, funcTable, 43, null, null, 0, 1);
- c$44__testGetOsType = Py.newCode(0, new String[] {"got", "key", "testVals", "msgFmt", "val"}, "/usr/share/jython/Lib/javaos.py", "_testGetOsType", false, false, funcTable, 44, null, null, 0, 1);
- c$45__testCmds = Py.newCode(3, new String[] {"_shellEnv", "testCmds", "whichEnv", "line", "pattern", "cmd"}, "/usr/share/jython/Lib/javaos.py", "_testCmds", false, false, funcTable, 45, null, null, 0, 1);
- c$46__testSystem = Py.newCode(1, new String[] {"shellEnv", "testCmds", "value", "key", "org"}, "/usr/share/jython/Lib/javaos.py", "_testSystem", false, false, funcTable, 46, null, null, 0, 1);
- c$47__testBadShell = Py.newCode(0, new String[] {"se2"}, "/usr/share/jython/Lib/javaos.py", "_testBadShell", false, false, funcTable, 47, null, null, 0, 1);
- c$48__testBadGetEnv = Py.newCode(0, new String[] {"se2"}, "/usr/share/jython/Lib/javaos.py", "_testBadGetEnv", false, false, funcTable, 48, null, null, 0, 1);
- c$49__test = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/javaos.py", "_test", false, false, funcTable, 49, null, null, 0, 1);
- c$50_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/javaos.py", "main", false, false, funcTable, 50, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$50_main == null) _PyInner.initConstants();
- return c$50_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner._exit$1(frame);
- case 1:
- return _PyInner.getcwd$2(frame);
- case 2:
- return _PyInner.chdir$3(frame);
- case 3:
- return _PyInner.listdir$4(frame);
- case 4:
- return _PyInner.mkdir$5(frame);
- case 5:
- return _PyInner.makedirs$6(frame);
- case 6:
- return _PyInner.remove$7(frame);
- case 7:
- return _PyInner.rename$8(frame);
- case 8:
- return _PyInner.rmdir$9(frame);
- case 9:
- return _PyInner.stat$10(frame);
- case 10:
- return _PyInner.utime$11(frame);
- case 11:
- return _PyInner.lambda$12(frame);
- case 12:
- return _PyInner.lambda$13(frame);
- case 13:
- return _PyInner.__init__$14(frame);
- case 14:
- return _PyInner._LazyDict__populate$15(frame);
- case 15:
- return _PyInner.__repr__$16(frame);
- case 16:
- return _PyInner.__cmp__$17(frame);
- case 17:
- return _PyInner.__len__$18(frame);
- case 18:
- return _PyInner.__getitem__$19(frame);
- case 19:
- return _PyInner.__setitem__$20(frame);
- case 20:
- return _PyInner.__delitem__$21(frame);
- case 21:
- return _PyInner.clear$22(frame);
- case 22:
- return _PyInner.copy$23(frame);
- case 23:
- return _PyInner.keys$24(frame);
- case 24:
- return _PyInner.items$25(frame);
- case 25:
- return _PyInner.values$26(frame);
- case 26:
- return _PyInner.has_key$27(frame);
- case 27:
- return _PyInner.update$28(frame);
- case 28:
- return _PyInner.get$29(frame);
- case 29:
- return _PyInner.setdefault$30(frame);
- case 30:
- return _PyInner.popitem$31(frame);
- case 31:
- return _PyInner.LazyDict$32(frame);
- case 32:
- return _PyInner.__init__$33(frame);
- case 33:
- return _PyInner.println$34(frame);
- case 34:
- return _PyInner.printlnStdErr$35(frame);
- case 35:
- return _PyInner.system$36(frame);
- case 36:
- return _PyInner.execute$37(frame);
- case 37:
- return _PyInner._readLines$38(frame);
- case 38:
- return _PyInner._formatCmd$39(frame);
- case 39:
- return _PyInner._formatEnvironment$40(frame);
- case 40:
- return _PyInner._getEnvironment$41(frame);
- case 41:
- return _PyInner._ShellEnv$42(frame);
- case 42:
- return _PyInner._getOsType$43(frame);
- case 43:
- return _PyInner._getShellEnv$44(frame);
- case 44:
- return _PyInner._testGetOsType$45(frame);
- case 45:
- return _PyInner._testCmds$46(frame);
- case 46:
- return _PyInner._testSystem$47(frame);
- case 47:
- return _PyInner._testBadShell$48(frame);
- case 48:
- return _PyInner._testBadGetEnv$49(frame);
- case 49:
- return _PyInner._test$50(frame);
- case 50:
- return _PyInner.main$51(frame);
- default:
- return null;
- }
- }
-
- private static PyObject _exit$1(PyFrame frame) {
- frame.getglobal("java").__getattr__("lang").__getattr__("System").__getattr__("exit").__call__(frame.getlocal(0));
- return Py.None;
- }
-
- private static PyObject getcwd$2(PyFrame frame) {
- frame.setlocal(0, frame.getglobal("File").__call__(frame.getglobal("File").__call__(s$14).invoke("getAbsolutePath")));
- return frame.getlocal(0).invoke("getParent");
- }
-
- private static PyObject chdir$3(PyFrame frame) {
- throw Py.makeException(frame.getglobal("OSError").__call__(i$13, s$15, frame.getlocal(0)));
- }
-
- private static PyObject listdir$4(PyFrame frame) {
- frame.setlocal(1, frame.getglobal("File").__call__(frame.getlocal(0)).invoke("list"));
- if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
- throw Py.makeException(frame.getglobal("OSError").__call__(i$13, s$16, frame.getlocal(0)));
- }
- return frame.getglobal("list").__call__(frame.getlocal(1));
- }
-
- private static PyObject mkdir$5(PyFrame frame) {
- if (frame.getglobal("File").__call__(frame.getlocal(0)).invoke("mkdir").__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("OSError").__call__(i$13, s$17, frame.getlocal(0)));
- }
- return Py.None;
- }
-
- private static PyObject makedirs$6(PyFrame frame) {
- if (frame.getglobal("File").__call__(frame.getlocal(0)).invoke("mkdirs").__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("OSError").__call__(i$13, s$19, frame.getlocal(0)));
- }
- return Py.None;
- }
-
- private static PyObject remove$7(PyFrame frame) {
- if (frame.getglobal("File").__call__(frame.getlocal(0)).invoke("delete").__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("OSError").__call__(i$13, s$20, frame.getlocal(0)));
- }
- return Py.None;
- }
-
- private static PyObject rename$8(PyFrame frame) {
- if (frame.getglobal("File").__call__(frame.getlocal(0)).invoke("renameTo", frame.getglobal("File").__call__(frame.getlocal(1))).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("OSError").__call__(i$13, s$21, frame.getlocal(0)));
- }
- return Py.None;
- }
-
- private static PyObject rmdir$9(PyFrame frame) {
- if (frame.getglobal("File").__call__(frame.getlocal(0)).invoke("delete").__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("OSError").__call__(i$13, s$22, frame.getlocal(0)));
- }
- return Py.None;
- }
-
- private static PyObject stat$10(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- /* The Java stat implementation only returns a small subset of
- the standard fields */
- frame.setlocal(3, frame.getglobal("File").__call__(frame.getlocal(0)));
- frame.setlocal(2, frame.getlocal(3).invoke("length"));
- if (((t$0$PyObject = frame.getlocal(2)._eq(i$13)).__nonzero__() ? frame.getlocal(3).invoke("exists").__not__() : t$0$PyObject).__nonzero__()) {
- throw Py.makeException(frame.getglobal("OSError").__call__(i$13, s$24, frame.getlocal(0)));
- }
- frame.setlocal(1, frame.getlocal(3).invoke("lastModified")._div(f$25));
- return new PyTuple(new PyObject[] {i$13, i$13, i$13, i$13, i$13, i$13, frame.getlocal(2), frame.getlocal(1), frame.getlocal(1), i$13});
- }
-
- private static PyObject utime$11(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- if (((t$0$PyObject = frame.getlocal(1)).__nonzero__() ? frame.getglobal("hasattr").__call__(frame.getglobal("File"), s$26) : t$0$PyObject).__nonzero__()) {
- frame.getglobal("File").__call__(frame.getlocal(0)).invoke("setLastModified", frame.getglobal("long").__call__(frame.getlocal(1).__getitem__(i$27)._mul(f$25)));
- }
- return Py.None;
- }
-
- private static PyObject lambda$12(PyFrame frame) {
- return new PyDictionary(new PyObject[] {});
- }
-
- private static PyObject lambda$13(PyFrame frame) {
- return frame.getlocal(0);
- }
-
- private static PyObject __init__$14(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- /* dict: starting dictionary of values
- populate: function that returns the populated dictionary
- keyTransform: function to normalize the keys (e.g., toupper/None)
- */
- frame.getglobal("UserDict").__getattr__("__init__").__call__(frame.getlocal(0), frame.getlocal(1));
- frame.getlocal(0).__setattr__("_populated", i$13);
- frame.getlocal(0).__setattr__("_LazyDict__populateFunc", (t$0$PyObject = frame.getlocal(2)).__nonzero__() ? t$0$PyObject : new PyFunction(frame.f_globals, new PyObject[] {}, c$11_lambda));
- frame.getlocal(0).__setattr__("_keyTransform", (t$0$PyObject = frame.getlocal(3)).__nonzero__() ? t$0$PyObject : new PyFunction(frame.f_globals, new PyObject[] {}, c$12_lambda));
- return Py.None;
- }
-
- private static PyObject _LazyDict__populate$15(PyFrame frame) {
- if (frame.getlocal(0).__getattr__("_populated").__not__().__nonzero__()) {
- frame.getlocal(0).__setattr__("data", frame.getlocal(0).invoke("_LazyDict__populateFunc"));
- frame.getlocal(0).__setattr__("_populated", i$27);
- }
- return Py.None;
- }
-
- private static PyObject __repr__$16(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- return frame.getglobal("UserDict").__getattr__("__repr__").__call__(frame.getlocal(0));
- }
-
- private static PyObject __cmp__$17(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- return frame.getglobal("UserDict").__getattr__("__cmp__").__call__(frame.getlocal(0), frame.getlocal(1));
- }
-
- private static PyObject __len__$18(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- return frame.getglobal("UserDict").__getattr__("__len__").__call__(frame.getlocal(0));
- }
-
- private static PyObject __getitem__$19(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- return frame.getglobal("UserDict").__getattr__("__getitem__").__call__(frame.getlocal(0), frame.getlocal(0).invoke("_keyTransform", frame.getlocal(1)));
- }
-
- private static PyObject __setitem__$20(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- frame.getglobal("UserDict").__getattr__("__setitem__").__call__(frame.getlocal(0), frame.getlocal(0).invoke("_keyTransform", frame.getlocal(1)), frame.getlocal(2));
- return Py.None;
- }
-
- private static PyObject __delitem__$21(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- frame.getglobal("UserDict").__getattr__("__delitem__").__call__(frame.getlocal(0), frame.getlocal(0).invoke("_keyTransform", frame.getlocal(1)));
- return Py.None;
- }
-
- private static PyObject clear$22(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- frame.getglobal("UserDict").__getattr__("clear").__call__(frame.getlocal(0));
- return Py.None;
- }
-
- private static PyObject copy$23(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- return frame.getglobal("UserDict").__getattr__("copy").__call__(frame.getlocal(0));
- }
-
- private static PyObject keys$24(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- return frame.getglobal("UserDict").__getattr__("keys").__call__(frame.getlocal(0));
- }
-
- private static PyObject items$25(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- return frame.getglobal("UserDict").__getattr__("items").__call__(frame.getlocal(0));
- }
-
- private static PyObject values$26(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- return frame.getglobal("UserDict").__getattr__("values").__call__(frame.getlocal(0));
- }
-
- private static PyObject has_key$27(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- return frame.getglobal("UserDict").__getattr__("has_key").__call__(frame.getlocal(0), frame.getlocal(0).invoke("_keyTransform", frame.getlocal(1)));
- }
-
- private static PyObject update$28(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- frame.getglobal("UserDict").__getattr__("update").__call__(frame.getlocal(0), frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject get$29(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- return frame.getglobal("UserDict").__getattr__("get").__call__(frame.getlocal(0), frame.getlocal(0).invoke("_keyTransform", frame.getlocal(1)), frame.getlocal(2));
- }
-
- private static PyObject setdefault$30(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- return frame.getglobal("UserDict").__getattr__("setdefault").__call__(frame.getlocal(0), frame.getlocal(0).invoke("_keyTransform", frame.getlocal(1)), frame.getlocal(2));
- }
-
- private static PyObject popitem$31(PyFrame frame) {
- frame.getlocal(0).invoke("_LazyDict__populate");
- return frame.getglobal("UserDict").__getattr__("popitem").__call__(frame.getlocal(0));
- }
-
- private static PyObject LazyDict$32(PyFrame frame) {
- /* A lazy-populating User Dictionary.
- Lazy initialization is not thread-safe.
- */
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), frame.getname("None"), frame.getname("None")}, c$13___init__));
- frame.setlocal("_LazyDict__populate", new PyFunction(frame.f_globals, new PyObject[] {}, c$14__LazyDict__populate));
- frame.setlocal("__repr__", new PyFunction(frame.f_globals, new PyObject[] {}, c$15___repr__));
- frame.setlocal("__cmp__", new PyFunction(frame.f_globals, new PyObject[] {}, c$16___cmp__));
- frame.setlocal("__len__", new PyFunction(frame.f_globals, new PyObject[] {}, c$17___len__));
- frame.setlocal("__getitem__", new PyFunction(frame.f_globals, new PyObject[] {}, c$18___getitem__));
- frame.setlocal("__setitem__", new PyFunction(frame.f_globals, new PyObject[] {}, c$19___setitem__));
- frame.setlocal("__delitem__", new PyFunction(frame.f_globals, new PyObject[] {}, c$20___delitem__));
- frame.setlocal("clear", new PyFunction(frame.f_globals, new PyObject[] {}, c$21_clear));
- frame.setlocal("copy", new PyFunction(frame.f_globals, new PyObject[] {}, c$22_copy));
- frame.setlocal("keys", new PyFunction(frame.f_globals, new PyObject[] {}, c$23_keys));
- frame.setlocal("items", new PyFunction(frame.f_globals, new PyObject[] {}, c$24_items));
- frame.setlocal("values", new PyFunction(frame.f_globals, new PyObject[] {}, c$25_values));
- frame.setlocal("has_key", new PyFunction(frame.f_globals, new PyObject[] {}, c$26_has_key));
- frame.setlocal("update", new PyFunction(frame.f_globals, new PyObject[] {}, c$27_update));
- frame.setlocal("get", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$28_get));
- frame.setlocal("setdefault", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$29_setdefault));
- frame.setlocal("popitem", new PyFunction(frame.f_globals, new PyObject[] {}, c$30_popitem));
- return frame.getf_locals();
- }
-
- private static PyObject __init__$33(PyFrame frame) {
- /* cmd: list of exec() arguments to run command in subshell, or None
- getEnv: shell command to list environment variables, or None
- keyTransform: normalization function for environment keys, or None
- */
- frame.getlocal(0).__setattr__("cmd", frame.getlocal(1));
- frame.getlocal(0).__setattr__("getEnv", frame.getlocal(2));
- frame.getlocal(0).__setattr__("environment", frame.getglobal("LazyDict").__call__(new PyObject[] {frame.getlocal(0).__getattr__("_getEnvironment"), frame.getlocal(3)}, new String[] {"populate", "keyTransform"}));
- frame.getlocal(0).__setattr__("_keyTransform", frame.getlocal(0).__getattr__("environment").__getattr__("_keyTransform"));
- return Py.None;
- }
-
- private static PyObject println$34(PyFrame frame) {
- frame.getlocal(1).__call__(frame.getlocal(0)._add(s$33));
- return Py.None;
- }
-
- private static PyObject printlnStdErr$35(PyFrame frame) {
- frame.getlocal(1).__call__(frame.getlocal(0)._add(s$33));
- return Py.None;
- }
-
- private static PyObject system$36(PyFrame frame) {
- /* Imitate the standard library 'system' call.
- Execute 'cmd' in a shell, and send output to stdout & stderr.
- */
- frame.setlocal(4, frame.getlocal(0).invoke("execute", frame.getlocal(1)));
- frame.setlocal(2, new PyFunction(frame.f_globals, new PyObject[] {frame.getglobal("sys").__getattr__("stdout").__getattr__("write")}, c$33_println));
- frame.setlocal(3, new PyFunction(frame.f_globals, new PyObject[] {frame.getglobal("sys").__getattr__("stderr").__getattr__("write")}, c$34_printlnStdErr));
- frame.getglobal("thread").__getattr__("start_new_thread").__call__(frame.getlocal(0).__getattr__("_readLines"), new PyTuple(new PyObject[] {frame.getlocal(4).invoke("getErrorStream"), frame.getlocal(3)}));
- frame.getlocal(0).invoke("_readLines", frame.getlocal(4).invoke("getInputStream"), frame.getlocal(2));
- return frame.getlocal(4).invoke("waitFor");
- }
-
- private static PyObject execute$37(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- /* Execute cmd in a shell, and return the process instance */
- frame.setlocal(3, frame.getlocal(0).invoke("_formatCmd", frame.getlocal(1)));
- if (frame.getlocal(0).__getattr__("environment").__getattr__("_populated").__nonzero__()) {
- frame.setlocal(4, frame.getlocal(0).invoke("_formatEnvironment", frame.getlocal(0).__getattr__("environment")));
- }
- else {
- frame.setlocal(4, frame.getglobal("None"));
- }
- try {
- frame.setlocal(2, frame.getglobal("java").__getattr__("lang").__getattr__("Runtime").__getattr__("getRuntime").__call__().invoke("exec", frame.getlocal(3), frame.getlocal(4)));
- return frame.getlocal(2);
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("IOException"))) {
- frame.setlocal(5, t$0$PyException.value);
- throw Py.makeException(frame.getglobal("OSError").__call__(i$13, s$35._mod(new PyTuple(new PyObject[] {frame.getlocal(3), frame.getlocal(5)}))));
- }
- else throw t$0$PyException;
- }
- }
-
- private static PyObject _readLines$38(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- /* Read lines of stream, and either append them to return
- array of lines, or call func on each line.
- */
- frame.setlocal(4, new PyList(new PyObject[] {}));
- frame.setlocal(2, (t$0$PyObject = frame.getlocal(2)).__nonzero__() ? t$0$PyObject : frame.getlocal(4).__getattr__("append"));
- frame.setlocal(3, frame.getglobal("BufferedReader").__call__(frame.getglobal("InputStreamReader").__call__(frame.getlocal(1))));
- while (i$27.__nonzero__()) {
- frame.setlocal(5, frame.getlocal(3).invoke("readLine"));
- if (frame.getlocal(5)._is(frame.getglobal("None")).__nonzero__()) {
- break;
- }
- frame.getlocal(2).__call__(frame.getlocal(5));
- }
- return (t$0$PyObject = frame.getlocal(4)).__nonzero__() ? t$0$PyObject : frame.getglobal("None");
- }
-
- private static PyObject _formatCmd$39(PyFrame frame) {
- /* Format a command for execution in a shell. */
- if (frame.getlocal(0).__getattr__("cmd")._is(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(2, s$38);
- throw Py.makeException(frame.getglobal("OSError").__call__(i$13, frame.getlocal(2)._mod(new PyTuple(new PyObject[] {frame.getglobal("_osType"), frame.getglobal("_envType"), frame.getlocal(1)}))));
- }
- return frame.getlocal(0).__getattr__("cmd")._add(new PyList(new PyObject[] {frame.getlocal(1)}));
- }
-
- private static PyObject _formatEnvironment$40(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Format enviroment in lines suitable for Runtime.exec */
- frame.setlocal(2, new PyList(new PyObject[] {}));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(1).invoke("items");
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(3, t$0$PyObject);
- frame.getlocal(2).invoke("append", s$40._mod(frame.getlocal(3)));
- }
- return frame.getlocal(2);
- }
-
- private static PyObject _getEnvironment$41(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyException t$0$PyException;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Get the environment variables by spawning a subshell.
- This allows multi-line variables as long as subsequent lines do
- not have '=' signs.
- */
- frame.setlocal(3, new PyDictionary(new PyObject[] {}));
- if (frame.getlocal(0).__getattr__("getEnv").__nonzero__()) {
- try {
- frame.setlocal(1, frame.getlocal(0).invoke("execute", frame.getlocal(0).__getattr__("getEnv")));
- frame.setlocal(7, frame.getlocal(0).invoke("_readLines", frame.getlocal(1).invoke("getInputStream")));
- if (s$42._notin(frame.getlocal(7).__getitem__(i$13)).__nonzero__()) {
- Py.println(s$43._mod(new PyTuple(new PyObject[] {frame.getlocal(0).__getattr__("getEnv"), s$33.invoke("join", frame.getlocal(7))})));
- return frame.getlocal(3);
- }
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(7);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(8, t$0$PyObject);
- try {
- frame.setlocal(2, frame.getlocal(8).invoke("index", s$42));
- frame.setlocal(6, frame.getlocal(0).invoke("_keyTransform", frame.getlocal(8).__getslice__(null, frame.getlocal(2), null)));
- frame.setlocal(5, frame.getlocal(8).__getslice__(frame.getlocal(2)._add(i$27), null, null));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("ValueError"))) {
- frame.setlocal(5, s$44._mod(new PyTuple(new PyObject[] {frame.getlocal(5), frame.getlocal(8)})));
- }
- else throw t$0$PyException;
- }
- frame.getlocal(3).__setitem__(frame.getlocal(6), frame.getlocal(5));
- }
- }
- catch (Throwable x$1) {
- t$0$PyException = Py.setException(x$1, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("OSError"))) {
- frame.setlocal(4, t$0$PyException.value);
- Py.printComma(s$45);
- Py.println(frame.getlocal(4));
- }
- else throw t$0$PyException;
- }
- }
- return frame.getlocal(3);
- }
-
- private static PyObject _ShellEnv$42(PyFrame frame) {
- /* Provide environment derived by spawning a subshell and parsing its
- environment. Also supports system functions and provides empty
- environment support for platforms with unknown shell
- functionality.
- */
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), frame.getname("None"), frame.getname("None")}, c$32___init__));
- frame.setlocal("system", new PyFunction(frame.f_globals, new PyObject[] {}, c$35_system));
- frame.setlocal("execute", new PyFunction(frame.f_globals, new PyObject[] {}, c$36_execute));
- frame.setlocal("_readLines", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$37__readLines));
- frame.setlocal("_formatCmd", new PyFunction(frame.f_globals, new PyObject[] {}, c$38__formatCmd));
- frame.setlocal("_formatEnvironment", new PyFunction(frame.f_globals, new PyObject[] {}, c$39__formatEnvironment));
- frame.setlocal("_getEnvironment", new PyFunction(frame.f_globals, new PyObject[] {}, c$40__getEnvironment));
- return frame.getf_locals();
- }
-
- private static PyObject _getOsType$43(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Select the OS behavior based on os argument, 'python.os' registry
- setting and 'os.name' Java property.
- os: explicitly select desired OS. os=None to autodetect, os='None' to
- disable
- */
- frame.setlocal(0, (t$0$PyObject = ((t$1$PyObject = frame.getlocal(0)).__nonzero__() ? t$1$PyObject : frame.getglobal("sys").__getattr__("registry").__getattr__("getProperty").__call__(s$47))).__nonzero__() ? t$0$PyObject : frame.getglobal("java").__getattr__("lang").__getattr__("System").__getattr__("getProperty").__call__(s$48));
- frame.setlocal(3, new PyTuple(new PyObject[] {new PyTuple(new PyObject[] {s$49, s$50}), new PyTuple(new PyObject[] {s$51, s$52}), new PyTuple(new PyObject[] {s$53, s$54}), new PyTuple(new PyObject[] {s$55, s$56}), new PyTuple(new PyObject[] {s$57, s$58})}));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(3);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(1, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- if (frame.getglobal("re").__getattr__("match").__call__(frame.getlocal(2), frame.getlocal(0)).__nonzero__()) {
- break;
- }
- }
- return frame.getlocal(1);
- }
-
- private static PyObject _getShellEnv$44(PyFrame frame) {
- /* Create the desired environment type.
- envType: 'shell' or None
- */
- if (frame.getlocal(0)._eq(s$60).__nonzero__()) {
- return frame.getglobal("_ShellEnv").__call__(frame.getlocal(1), frame.getlocal(2), frame.getlocal(3));
- }
- else {
- return frame.getglobal("_ShellEnv").__call__();
- }
- }
-
- private static PyObject _testGetOsType$45(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(2, new PyDictionary(new PyObject[] {s$71, s$49, s$72, s$51, s$73, s$53, s$74, s$57, s$75, s$57, s$55, s$55}));
- frame.setlocal(3, s$76);
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(2).invoke("items");
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(1, t$0$PyObject__[0]);
- frame.setlocal(4, t$0$PyObject__[1]);
- frame.setlocal(0, frame.getglobal("_getOsType").__call__(frame.getlocal(1)));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0)._eq(frame.getlocal(4)), frame.getlocal(3)._mod(new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(4), frame.getlocal(0)})));
- }
- return Py.None;
- }
-
- private static PyObject _testCmds$46(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(1);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(5, t$0$PyObject__[0]);
- frame.setlocal(4, t$0$PyObject__[1]);
- Py.println(s$77._mod(new PyTuple(new PyObject[] {frame.getlocal(5), frame.getlocal(2)})));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).invoke("system", frame.getlocal(5)).__not__(), s$78._mod(new PyTuple(new PyObject[] {frame.getlocal(5), frame.getlocal(2)})));
- frame.setlocal(3, frame.getlocal(0).invoke("_readLines", frame.getlocal(0).invoke("execute", frame.getlocal(5)).invoke("getInputStream")).__getitem__(i$13));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getglobal("re").__getattr__("match").__call__(frame.getlocal(4), frame.getlocal(3)), s$79._mod(new PyTuple(new PyObject[] {frame.getlocal(4), frame.getlocal(3)})));
- }
- return Py.None;
- }
-
- private static PyObject _testSystem$47(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- t$0$PyObject__ = org.python.core.Py.unpackSequence(new PyTuple(new PyObject[] {s$80, s$81}), 2);
- frame.setlocal(3, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- frame.setlocal(4, frame.getglobal("environ"));
- frame.setlocal(1, new PyList(new PyObject[] {new PyTuple(new PyObject[] {s$82, s$83}), new PyTuple(new PyObject[] {s$84, s$85}), new PyTuple(new PyObject[] {s$86._mod(new PyTuple(new PyObject[] {frame.getlocal(3), frame.getlocal(3)})), s$87._mod(new PyTuple(new PyObject[] {frame.getlocal(3)}))}), new PyTuple(new PyObject[] {s$88, s$89}), new PyTuple(new PyObject[] {s$90._mod(new PyTuple(new PyObject[] {frame.getlocal(3), frame.getlocal(3)})), s$91._mod(new PyTuple(new PyObject[] {frame.getlocal(3), frame.getlocal(3), frame.getlocal(3), frame.getlocal(3), frame.getlocal(2)}))}), new PyTuple(new PyObject[] {s$92, s$93}), new PyTuple(new PyObject[] {s$94, s$95}), new PyTuple(new PyObject[] {s$96, s$97})}));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getglobal("environ").__getattr__("_populated").__not__(), s$98);
- frame.getglobal("_testCmds").__call__(frame.getglobal("_shellEnv"), frame.getlocal(1), s$99);
- frame.getglobal("environ").__setitem__(frame.getlocal(3), frame.getlocal(2));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getglobal("environ").__getattr__("_populated"), s$100);
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(4).invoke("get", frame.getlocal(3), frame.getglobal("None"))._eq(frame.getlocal(2)), s$101._mod(frame.getlocal(3)));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getglobal("environ").invoke("get", frame.getlocal(3), frame.getglobal("None"))._eq(frame.getlocal(2)), s$102._mod(frame.getlocal(3)));
- frame.getglobal("_testCmds").__call__(frame.getglobal("_shellEnv"), frame.getlocal(1), s$103);
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getglobal("environ").invoke("has_key", s$104), s$105);
- return Py.None;
- }
-
- private static PyObject _testBadShell$48(PyFrame frame) {
- frame.setlocal(0, frame.getglobal("_ShellEnv").__call__(new PyList(new PyObject[] {s$106, s$67}), s$64));
- frame.getglobal("str").__call__(frame.getlocal(0).__getattr__("environment"));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("environment").invoke("items").__not__(), s$107);
- return Py.None;
- }
-
- private static PyObject _testBadGetEnv$49(PyFrame frame) {
- frame.setlocal(0, frame.getglobal("_getShellEnv").__call__(new PyObject[] {s$60, frame.getglobal("_shellCmd"), frame.getglobal("_envCmd"), frame.getglobal("_envTransform")}));
- frame.getlocal(0).__setattr__("getEnv", s$108);
- frame.getglobal("str").__call__(frame.getlocal(0).__getattr__("environment"));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("environment").invoke("items").__not__(), s$107);
- return Py.None;
- }
-
- private static PyObject _test$50(PyFrame frame) {
- frame.getglobal("_testGetOsType").__call__();
- frame.getglobal("_testBadShell").__call__();
- frame.getglobal("_testBadGetEnv").__call__();
- frame.getglobal("_testSystem").__call__();
- return Py.None;
- }
-
- private static PyObject main$51(PyFrame frame) {
- frame.setglobal("__file__", s$109);
-
- PyObject[] imp_accu;
- // Code
- /* OS routines for Java, with some attempts to support DOS, NT, and
- Posix functionality.
-
- This exports:
- - all functions from posix, nt, dos, os2, mac, or ce, e.g. unlink, stat, etc.
- - os.path is one of the modules posixpath, ntpath, macpath, or dospath
- - os.name is 'posix', 'nt', 'dos', 'os2', 'mac', 'ce' or 'riscos'
- - os.curdir is a string representing the current directory ('.' or ':')
- - os.pardir is a string representing the parent directory ('..' or '::')
- - os.sep is the (or a most common) pathname separator ('/' or ':' or '\\')
- - os.altsep is the alternate pathname separator (None or '/')
- - os.pathsep is the component separator used in $PATH etc
- - os.linesep is the line separator in text files ('\r' or '\n' or '\r\n')
- - os.defpath is the default search path for executables
-
- Programs that import and use 'os' stand a better chance of being
- portable between different platforms. Of course, they must then
- only use functions that are defined by all platforms (e.g., unlink
- and opendir), and leave all pathname manipulation to os.path
- (e.g., split and join).
- */
- frame.setlocal("__all__", new PyList(new PyObject[] {s$1, s$2, s$3, s$4, s$5, s$6, s$7, s$8}));
- frame.setlocal("java", org.python.core.imp.importOne("java", frame));
- imp_accu = org.python.core.imp.importFrom("java.io", new String[] {"File", "BufferedReader", "InputStreamReader", "IOException"}, frame);
- frame.setlocal("File", imp_accu[0]);
- frame.setlocal("BufferedReader", imp_accu[1]);
- frame.setlocal("InputStreamReader", imp_accu[2]);
- frame.setlocal("IOException", imp_accu[3]);
- imp_accu = null;
- frame.setlocal("path", org.python.core.imp.importOneAs("javapath", frame));
- imp_accu = org.python.core.imp.importFrom("UserDict", new String[] {"UserDict"}, frame);
- frame.setlocal("UserDict", imp_accu[0]);
- imp_accu = null;
- frame.setlocal("string", org.python.core.imp.importOne("string", frame));
- frame.setlocal("exceptions", org.python.core.imp.importOne("exceptions", frame));
- frame.setlocal("re", org.python.core.imp.importOne("re", frame));
- frame.setlocal("sys", org.python.core.imp.importOne("sys", frame));
- frame.setlocal("thread", org.python.core.imp.importOne("thread", frame));
- frame.setlocal("error", frame.getname("OSError"));
- frame.setlocal("name", s$9);
- frame.setlocal("curdir", s$10);
- frame.setlocal("pardir", s$11);
- frame.setlocal("sep", frame.getname("java").__getattr__("io").__getattr__("File").__getattr__("separator"));
- frame.setlocal("altsep", frame.getname("None"));
- frame.setlocal("pathsep", frame.getname("java").__getattr__("io").__getattr__("File").__getattr__("pathSeparator"));
- frame.setlocal("defpath", s$10);
- frame.setlocal("linesep", frame.getname("java").__getattr__("lang").__getattr__("System").__getattr__("getProperty").__call__(s$12));
- frame.setlocal("_exit", new PyFunction(frame.f_globals, new PyObject[] {i$13}, c$0__exit));
- frame.setlocal("getcwd", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_getcwd));
- frame.setlocal("chdir", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_chdir));
- frame.setlocal("listdir", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_listdir));
- frame.setlocal("mkdir", new PyFunction(frame.f_globals, new PyObject[] {s$18}, c$4_mkdir));
- frame.setlocal("makedirs", new PyFunction(frame.f_globals, new PyObject[] {s$18}, c$5_makedirs));
- frame.setlocal("remove", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_remove));
- frame.setlocal("rename", new PyFunction(frame.f_globals, new PyObject[] {}, c$7_rename));
- frame.setlocal("rmdir", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_rmdir));
- frame.setlocal("unlink", frame.getname("remove"));
- frame.setlocal("stat", new PyFunction(frame.f_globals, new PyObject[] {}, c$9_stat));
- frame.setlocal("utime", new PyFunction(frame.f_globals, new PyObject[] {}, c$10_utime));
- frame.setlocal("LazyDict", Py.makeClass("LazyDict", new PyObject[] {frame.getname("UserDict")}, c$31_LazyDict, null));
- frame.setlocal("_ShellEnv", Py.makeClass("_ShellEnv", new PyObject[] {}, c$41__ShellEnv, null));
- frame.setlocal("_getOsType", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$42__getOsType));
- frame.setlocal("_getShellEnv", new PyFunction(frame.f_globals, new PyObject[] {}, c$43__getShellEnv));
- frame.setlocal("_osType", frame.getname("_getOsType").__call__());
- frame.setlocal("_envType", frame.getname("sys").__getattr__("registry").__getattr__("getProperty").__call__(s$61, s$60));
- frame.setlocal("_shellCmd", frame.getname("None"));
- frame.setlocal("_envCmd", frame.getname("None"));
- frame.setlocal("_envTransform", frame.getname("None"));
- if (frame.getname("_osType")._eq(s$49).__nonzero__()) {
- frame.setlocal("_shellCmd", new PyList(new PyObject[] {s$62, s$63}));
- frame.setlocal("_envCmd", s$64);
- frame.setlocal("_envTransform", frame.getname("string").__getattr__("upper"));
- }
- else if (frame.getname("_osType")._eq(s$51).__nonzero__()) {
- frame.setlocal("_shellCmd", new PyList(new PyObject[] {s$65, s$63}));
- frame.setlocal("_envCmd", s$64);
- frame.setlocal("_envTransform", frame.getname("string").__getattr__("upper"));
- }
- else if (frame.getname("_osType")._eq(s$57).__nonzero__()) {
- frame.setlocal("_shellCmd", new PyList(new PyObject[] {s$66, s$67}));
- frame.setlocal("_envCmd", s$68);
- }
- else if (frame.getname("_osType")._eq(s$53).__nonzero__()) {
- frame.setlocal("curdir", s$69);
- frame.setlocal("pardir", s$70);
- }
- else if (frame.getname("_osType")._eq(s$55).__nonzero__()) {
- // pass
- }
- frame.setlocal("_shellEnv", frame.getname("_getShellEnv").__call__(new PyObject[] {frame.getname("_envType"), frame.getname("_shellCmd"), frame.getname("_envCmd"), frame.getname("_envTransform")}));
- frame.setlocal("environ", frame.getname("_shellEnv").__getattr__("environment"));
- frame.setlocal("putenv", frame.getname("environ").__getattr__("__setitem__"));
- frame.setlocal("getenv", frame.getname("environ").__getattr__("__getitem__"));
- frame.setlocal("system", frame.getname("_shellEnv").__getattr__("system"));
- frame.setlocal("_testGetOsType", new PyFunction(frame.f_globals, new PyObject[] {}, c$44__testGetOsType));
- frame.setlocal("_testCmds", new PyFunction(frame.f_globals, new PyObject[] {}, c$45__testCmds));
- frame.setlocal("_testSystem", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("_shellEnv")}, c$46__testSystem));
- frame.setlocal("_testBadShell", new PyFunction(frame.f_globals, new PyObject[] {}, c$47__testBadShell));
- frame.setlocal("_testBadGetEnv", new PyFunction(frame.f_globals, new PyObject[] {}, c$48__testBadGetEnv));
- frame.setlocal("_test", new PyFunction(frame.f_globals, new PyObject[] {}, c$49__test));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("javaos"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "javaos";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(javaos._PyInner.class, newargs, javaos.jpy$packages, javaos.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class javapath extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject i$10;
- private static PyObject i$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject s$16;
- private static PyObject s$17;
- private static PyObject s$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyObject s$24;
- private static PyObject s$25;
- private static PyObject s$26;
- private static PyObject s$27;
- private static PyObject s$28;
- private static PyObject s$29;
- private static PyObject s$30;
- private static PyObject s$31;
- private static PyObject s$32;
- private static PyObject i$33;
- private static PyObject s$34;
- private static PyObject s$35;
- private static PyObject s$36;
- private static PyObject s$37;
- private static PyObject s$38;
- private static PyObject s$39;
- private static PyObject s$40;
- private static PyObject s$41;
- private static PyObject s$42;
- private static PyObject f$43;
- private static PyObject s$44;
- private static PyObject s$45;
- private static PyObject s$46;
- private static PyObject s$47;
- private static PyObject s$48;
- private static PyObject s$49;
- private static PyObject s$50;
- private static PyObject s$51;
- private static PyFunctionTable funcTable;
- private static PyCode c$0__tostr;
- private static PyCode c$1_dirname;
- private static PyCode c$2_basename;
- private static PyCode c$3_split;
- private static PyCode c$4_splitext;
- private static PyCode c$5_splitdrive;
- private static PyCode c$6_exists;
- private static PyCode c$7_isabs;
- private static PyCode c$8_isfile;
- private static PyCode c$9_isdir;
- private static PyCode c$10_join;
- private static PyCode c$11_normcase;
- private static PyCode c$12_commonprefix;
- private static PyCode c$13_islink;
- private static PyCode c$14_samefile;
- private static PyCode c$15_ismount;
- private static PyCode c$16_walk;
- private static PyCode c$17_expanduser;
- private static PyCode c$18_getuser;
- private static PyCode c$19_gethome;
- private static PyCode c$20_normpath;
- private static PyCode c$21_abspath;
- private static PyCode c$22_getsize;
- private static PyCode c$23_getmtime;
- private static PyCode c$24_getatime;
- private static PyCode c$25_expandvars;
- private static PyCode c$26_main;
- private static void initConstants() {
- s$0 = Py.newString("Common pathname manipulations, JDK version.\012\012Instead of importing this module directly, import os and refer to this\012module as os.path.\012\012");
- s$1 = Py.newString("");
- s$2 = Py.newString("%s() argument must be a string object, not %s");
- s$3 = Py.newString("Return the directory component of a pathname");
- s$4 = Py.newString("dirname");
- s$5 = Py.newString("Return the final component of a pathname");
- s$6 = Py.newString("basename");
- s$7 = Py.newString("Split a pathname.\012\012 Return tuple \"(head, tail)\" where \"tail\" is everything after the\012 final slash. Either part may be empty.\012\012 ");
- s$8 = Py.newString("split");
- s$9 = Py.newString("Split the extension from a pathname.\012\012 Extension is everything from the last dot to the end. Return\012 \"(root, ext)\", either part may be empty.\012\012 ");
- i$10 = Py.newInteger(0);
- i$11 = Py.newInteger(1);
- s$12 = Py.newString(".");
- s$13 = Py.newString("Split a pathname into drive and path.\012\012 On JDK, drive is always empty.\012 XXX This isn't correct for JDK on DOS/Windows!\012\012 ");
- s$14 = Py.newString("Test whether a path exists.\012\012 Returns false for broken symbolic links.\012\012 ");
- s$15 = Py.newString("exists");
- s$16 = Py.newString("Test whether a path is absolute");
- s$17 = Py.newString("isabs");
- s$18 = Py.newString("Test whether a path is a regular file");
- s$19 = Py.newString("isfile");
- s$20 = Py.newString("Test whether a path is a directory");
- s$21 = Py.newString("isdir");
- s$22 = Py.newString("Join two or more pathname components, inserting os.sep as needed");
- s$23 = Py.newString("join");
- s$24 = Py.newString("Normalize case of pathname.\012\012 XXX Not done right under JDK.\012\012 ");
- s$25 = Py.newString("normcase");
- s$26 = Py.newString("Given a list of pathnames, return the longest common leading component");
- s$27 = Py.newString("Test whether a path is a symbolic link.\012\012 XXX This incorrectly always returns false under JDK.\012\012 ");
- s$28 = Py.newString("Test whether two pathnames reference the same actual file");
- s$29 = Py.newString("samefile");
- s$30 = Py.newString("Test whether a path is a mount point.\012\012 XXX This incorrectly always returns false under JDK.\012\012 ");
- s$31 = Py.newString("Walk a directory tree.\012\012 walk(top,func,args) calls func(arg, d, files) for each directory\012 \"d\" in the tree rooted at \"top\" (including \"top\" itself). \"files\"\012 is a list of all the files and subdirs in directory \"d\".\012\012 ");
- s$32 = Py.newString("~");
- i$33 = Py.newInteger(2);
- s$34 = Py.newString("user.name");
- s$35 = Py.newString("user.home");
- s$36 = Py.newString("Normalize path, eliminating double slashes, etc.");
- s$37 = Py.newString("\\");
- s$38 = Py.newString("/");
- s$39 = Py.newString("abspath");
- s$40 = Py.newString("getsize");
- s$41 = Py.newString("No such file or directory");
- s$42 = Py.newString("getmtime");
- f$43 = Py.newFloat(1000.0);
- s$44 = Py.newString("getatime");
- s$45 = Py.newString("Expand shell variables of form $var and ${var}.\012\012 Unknown variables are left unchanged.");
- s$46 = Py.newString("$");
- s$47 = Py.newString("_-");
- s$48 = Py.newString("'");
- s$49 = Py.newString("{");
- s$50 = Py.newString("}");
- s$51 = Py.newString("/usr/share/jython/Lib/javapath.py");
- funcTable = new _PyInner();
- c$0__tostr = Py.newCode(2, new String[] {"s", "method", "org"}, "/usr/share/jython/Lib/javapath.py", "_tostr", false, false, funcTable, 0, null, null, 0, 1);
- c$1_dirname = Py.newCode(1, new String[] {"path", "result"}, "/usr/share/jython/Lib/javapath.py", "dirname", false, false, funcTable, 1, null, null, 0, 1);
- c$2_basename = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "basename", false, false, funcTable, 2, null, null, 0, 1);
- c$3_split = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "split", false, false, funcTable, 3, null, null, 0, 1);
- c$4_splitext = Py.newCode(1, new String[] {"path", "i", "c", "n"}, "/usr/share/jython/Lib/javapath.py", "splitext", false, false, funcTable, 4, null, null, 0, 1);
- c$5_splitdrive = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "splitdrive", false, false, funcTable, 5, null, null, 0, 1);
- c$6_exists = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "exists", false, false, funcTable, 6, null, null, 0, 1);
- c$7_isabs = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "isabs", false, false, funcTable, 7, null, null, 0, 1);
- c$8_isfile = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "isfile", false, false, funcTable, 8, null, null, 0, 1);
- c$9_isdir = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "isdir", false, false, funcTable, 9, null, null, 0, 1);
- c$10_join = Py.newCode(2, new String[] {"path", "args", "a", "g", "f"}, "/usr/share/jython/Lib/javapath.py", "join", true, false, funcTable, 10, null, null, 0, 1);
- c$11_normcase = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "normcase", false, false, funcTable, 11, null, null, 0, 1);
- c$12_commonprefix = Py.newCode(1, new String[] {"m", "i", "item", "prefix"}, "/usr/share/jython/Lib/javapath.py", "commonprefix", false, false, funcTable, 12, null, null, 0, 1);
- c$13_islink = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "islink", false, false, funcTable, 13, null, null, 0, 1);
- c$14_samefile = Py.newCode(2, new String[] {"path", "path2", "f", "f2"}, "/usr/share/jython/Lib/javapath.py", "samefile", false, false, funcTable, 14, null, null, 0, 1);
- c$15_ismount = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "ismount", false, false, funcTable, 15, null, null, 0, 1);
- c$16_walk = Py.newCode(3, new String[] {"top", "func", "arg", "name", "names"}, "/usr/share/jython/Lib/javapath.py", "walk", false, false, funcTable, 16, null, null, 0, 1);
- c$17_expanduser = Py.newCode(1, new String[] {"path", "c"}, "/usr/share/jython/Lib/javapath.py", "expanduser", false, false, funcTable, 17, null, null, 0, 1);
- c$18_getuser = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/javapath.py", "getuser", false, false, funcTable, 18, null, null, 0, 1);
- c$19_gethome = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/javapath.py", "gethome", false, false, funcTable, 19, null, null, 0, 1);
- c$20_normpath = Py.newCode(1, new String[] {"path", "comps", "i", "pardir", "string", "slashes", "curdir", "sep"}, "/usr/share/jython/Lib/javapath.py", "normpath", false, false, funcTable, 20, null, null, 0, 1);
- c$21_abspath = Py.newCode(1, new String[] {"path"}, "/usr/share/jython/Lib/javapath.py", "abspath", false, false, funcTable, 21, null, null, 0, 1);
- c$22_getsize = Py.newCode(1, new String[] {"path", "size", "f"}, "/usr/share/jython/Lib/javapath.py", "getsize", false, false, funcTable, 22, null, null, 0, 1);
- c$23_getmtime = Py.newCode(1, new String[] {"path", "f"}, "/usr/share/jython/Lib/javapath.py", "getmtime", false, false, funcTable, 23, null, null, 0, 1);
- c$24_getatime = Py.newCode(1, new String[] {"path", "f"}, "/usr/share/jython/Lib/javapath.py", "getatime", false, false, funcTable, 24, null, null, 0, 1);
- c$25_expandvars = Py.newCode(1, new String[] {"path", "varchars", "string", "index", "res", "c", "pathlen", "var"}, "/usr/share/jython/Lib/javapath.py", "expandvars", false, false, funcTable, 25, null, null, 0, 1);
- c$26_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/javapath.py", "main", false, false, funcTable, 26, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$26_main == null) _PyInner.initConstants();
- return c$26_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner._tostr$1(frame);
- case 1:
- return _PyInner.dirname$2(frame);
- case 2:
- return _PyInner.basename$3(frame);
- case 3:
- return _PyInner.split$4(frame);
- case 4:
- return _PyInner.splitext$5(frame);
- case 5:
- return _PyInner.splitdrive$6(frame);
- case 6:
- return _PyInner.exists$7(frame);
- case 7:
- return _PyInner.isabs$8(frame);
- case 8:
- return _PyInner.isfile$9(frame);
- case 9:
- return _PyInner.isdir$10(frame);
- case 10:
- return _PyInner.join$11(frame);
- case 11:
- return _PyInner.normcase$12(frame);
- case 12:
- return _PyInner.commonprefix$13(frame);
- case 13:
- return _PyInner.islink$14(frame);
- case 14:
- return _PyInner.samefile$15(frame);
- case 15:
- return _PyInner.ismount$16(frame);
- case 16:
- return _PyInner.walk$17(frame);
- case 17:
- return _PyInner.expanduser$18(frame);
- case 18:
- return _PyInner.getuser$19(frame);
- case 19:
- return _PyInner.gethome$20(frame);
- case 20:
- return _PyInner.normpath$21(frame);
- case 21:
- return _PyInner.abspath$22(frame);
- case 22:
- return _PyInner.getsize$23(frame);
- case 23:
- return _PyInner.getmtime$24(frame);
- case 24:
- return _PyInner.getatime$25(frame);
- case 25:
- return _PyInner.expandvars$26(frame);
- case 26:
- return _PyInner.main$27(frame);
- default:
- return null;
- }
- }
-
- private static PyObject _tostr$1(PyFrame frame) {
- if (frame.getglobal("isinstance").__call__(frame.getlocal(0), s$1.__getattr__("__class__")).__nonzero__()) {
- return frame.getlocal(0);
- }
- frame.setlocal(2, org.python.core.imp.importOne("org", frame));
- throw Py.makeException(frame.getglobal("TypeError"), s$2._mod(new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(2).__getattr__("python").__getattr__("core").__getattr__("Py").__getattr__("safeRepr").__call__(frame.getlocal(0))})));
- }
-
- private static PyObject dirname$2(PyFrame frame) {
- /* Return the directory component of a pathname */
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$4));
- frame.setlocal(1, frame.getglobal("File").__call__(frame.getlocal(0)).invoke("getParent"));
- if (frame.getlocal(1).__not__().__nonzero__()) {
- if (frame.getglobal("isabs").__call__(frame.getlocal(0)).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(0));
- }
- else {
- frame.setlocal(1, s$1);
- }
- }
- return frame.getlocal(1);
- }
-
- private static PyObject basename$3(PyFrame frame) {
- /* Return the final component of a pathname */
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$6));
- return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("getName");
- }
-
- private static PyObject split$4(PyFrame frame) {
- /* Split a pathname.
-
- Return tuple "(head, tail)" where "tail" is everything after the
- final slash. Either part may be empty.
-
- */
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$8));
- return new PyTuple(new PyObject[] {frame.getglobal("dirname").__call__(frame.getlocal(0)), frame.getglobal("basename").__call__(frame.getlocal(0))});
- }
-
- private static PyObject splitext$5(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Split the extension from a pathname.
-
- Extension is everything from the last dot to the end. Return
- "(root, ext)", either part may be empty.
-
- */
- frame.setlocal(1, i$10);
- frame.setlocal(3, i$11.__neg__());
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(2, t$0$PyObject);
- if (frame.getlocal(2)._eq(s$12).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(1));
- }
- frame.setlocal(1, frame.getlocal(1)._add(i$11));
- }
- if (frame.getlocal(3)._lt(i$10).__nonzero__()) {
- return new PyTuple(new PyObject[] {frame.getlocal(0), s$1});
- }
- else {
- return new PyTuple(new PyObject[] {frame.getlocal(0).__getslice__(null, frame.getlocal(3), null), frame.getlocal(0).__getslice__(frame.getlocal(3), null, null)});
- }
- }
-
- private static PyObject splitdrive$6(PyFrame frame) {
- /* Split a pathname into drive and path.
-
- On JDK, drive is always empty.
- XXX This isn't correct for JDK on DOS/Windows!
-
- */
- return new PyTuple(new PyObject[] {s$1, frame.getlocal(0)});
- }
-
- private static PyObject exists$7(PyFrame frame) {
- /* Test whether a path exists.
-
- Returns false for broken symbolic links.
-
- */
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$15));
- return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("exists");
- }
-
- private static PyObject isabs$8(PyFrame frame) {
- /* Test whether a path is absolute */
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$17));
- return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("isAbsolute");
- }
-
- private static PyObject isfile$9(PyFrame frame) {
- /* Test whether a path is a regular file */
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$19));
- return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("isFile");
- }
-
- private static PyObject isdir$10(PyFrame frame) {
- /* Test whether a path is a directory */
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$21));
- return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("isDirectory");
- }
-
- private static PyObject join$11(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
-
- // Code
- /* Join two or more pathname components, inserting os.sep as needed */
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$23));
- frame.setlocal(4, frame.getglobal("File").__call__(frame.getlocal(0)));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(1);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(2, t$0$PyObject);
- frame.setlocal(2, frame.getglobal("_tostr").__call__(frame.getlocal(2), s$23));
- frame.setlocal(3, frame.getglobal("File").__call__(frame.getlocal(2)));
- if (((t$2$PyObject = frame.getlocal(3).invoke("isAbsolute")).__nonzero__() ? t$2$PyObject : frame.getglobal("len").__call__(frame.getlocal(4).invoke("getPath"))._eq(i$10)).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(3));
- }
- else {
- frame.setlocal(4, frame.getglobal("File").__call__(frame.getlocal(4), frame.getlocal(2)));
- }
- }
- return frame.getlocal(4).invoke("getPath");
- }
-
- private static PyObject normcase$12(PyFrame frame) {
- /* Normalize case of pathname.
-
- XXX Not done right under JDK.
-
- */
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$25));
- return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("getPath");
- }
-
- private static PyObject commonprefix$13(PyFrame frame) {
- // Temporary Variables
- int t$0$int, t$1$int;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject;
-
- // Code
- /* Given a list of pathnames, return the longest common leading component */
- if (frame.getlocal(0).__not__().__nonzero__()) {
- return s$1;
- }
- frame.setlocal(3, frame.getlocal(0).__getitem__(i$10));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(2, t$0$PyObject);
- t$1$int = 0;
- t$3$PyObject = frame.getglobal("range").__call__(frame.getglobal("len").__call__(frame.getlocal(3)));
- while ((t$2$PyObject = t$3$PyObject.__finditem__(t$1$int++)) != null) {
- frame.setlocal(1, t$2$PyObject);
- if (frame.getlocal(3).__getslice__(null, frame.getlocal(1)._add(i$11), null)._ne(frame.getlocal(2).__getslice__(null, frame.getlocal(1)._add(i$11), null)).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(3).__getslice__(null, frame.getlocal(1), null));
- if (frame.getlocal(1)._eq(i$10).__nonzero__()) {
- return s$1;
- }
- break;
- }
- }
- }
- return frame.getlocal(3);
- }
-
- private static PyObject islink$14(PyFrame frame) {
- /* Test whether a path is a symbolic link.
-
- XXX This incorrectly always returns false under JDK.
-
- */
- return i$10;
- }
-
- private static PyObject samefile$15(PyFrame frame) {
- /* Test whether two pathnames reference the same actual file */
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$29));
- frame.setlocal(1, frame.getglobal("_tostr").__call__(frame.getlocal(1), s$29));
- frame.setlocal(2, frame.getglobal("File").__call__(frame.getlocal(0)));
- frame.setlocal(3, frame.getglobal("File").__call__(frame.getlocal(1)));
- return frame.getlocal(2).invoke("getCanonicalPath")._eq(frame.getlocal(3).invoke("getCanonicalPath"));
- }
-
- private static PyObject ismount$16(PyFrame frame) {
- /* Test whether a path is a mount point.
-
- XXX This incorrectly always returns false under JDK.
-
- */
- return i$10;
- }
-
- private static PyObject walk$17(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
- PyException t$0$PyException;
-
- // Code
- /* Walk a directory tree.
-
- walk(top,func,args) calls func(arg, d, files) for each directory
- "d" in the tree rooted at "top" (including "top" itself). "files"
- is a list of all the files and subdirs in directory "d".
-
- */
- try {
- frame.setlocal(4, frame.getglobal("os").__getattr__("listdir").__call__(frame.getlocal(0)));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("os").__getattr__("error"))) {
- return Py.None;
- }
- else throw t$0$PyException;
- }
- frame.getlocal(1).__call__(frame.getlocal(2), frame.getlocal(0), frame.getlocal(4));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(4);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(3, t$0$PyObject);
- frame.setlocal(3, frame.getglobal("join").__call__(frame.getlocal(0), frame.getlocal(3)));
- if (((t$2$PyObject = frame.getglobal("isdir").__call__(frame.getlocal(3))).__nonzero__() ? frame.getglobal("islink").__call__(frame.getlocal(3)).__not__() : t$2$PyObject).__nonzero__()) {
- frame.getglobal("walk").__call__(frame.getlocal(3), frame.getlocal(1), frame.getlocal(2));
- }
- }
- return Py.None;
- }
-
- private static PyObject expanduser$18(PyFrame frame) {
- if (frame.getlocal(0).__getslice__(null, i$11, null)._eq(s$32).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(0).__getslice__(i$11, i$33, null));
- if (frame.getlocal(1).__not__().__nonzero__()) {
- return frame.getglobal("gethome").__call__();
- }
- if (frame.getlocal(1)._eq(frame.getglobal("os").__getattr__("sep")).__nonzero__()) {
- return frame.getglobal("File").__call__(frame.getglobal("gethome").__call__(), frame.getlocal(0).__getslice__(i$33, null, null)).invoke("getPath");
- }
- }
- return frame.getlocal(0);
- }
-
- private static PyObject getuser$19(PyFrame frame) {
- return frame.getglobal("System").__getattr__("getProperty").__call__(s$34);
- }
-
- private static PyObject gethome$20(PyFrame frame) {
- return frame.getglobal("System").__getattr__("getProperty").__call__(s$35);
- }
-
- private static PyObject normpath$21(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Normalize path, eliminating double slashes, etc. */
- frame.setlocal(7, frame.getglobal("os").__getattr__("sep"));
- if (frame.getlocal(7)._eq(s$37).__nonzero__()) {
- frame.setlocal(0, frame.getlocal(0).invoke("replace", s$38, frame.getlocal(7)));
- }
- frame.setlocal(6, frame.getglobal("os").__getattr__("curdir"));
- frame.setlocal(3, frame.getglobal("os").__getattr__("pardir"));
- frame.setlocal(4, org.python.core.imp.importOne("string", frame));
- frame.setlocal(5, s$1);
- while (frame.getlocal(0).__getslice__(null, i$11, null)._eq(frame.getlocal(7)).__nonzero__()) {
- frame.setlocal(5, frame.getlocal(5)._add(frame.getlocal(7)));
- frame.setlocal(0, frame.getlocal(0).__getslice__(i$11, null, null));
- }
- frame.setlocal(1, frame.getlocal(4).__getattr__("splitfields").__call__(frame.getlocal(0), frame.getlocal(7)));
- frame.setlocal(2, i$10);
- while (frame.getlocal(2)._lt(frame.getglobal("len").__call__(frame.getlocal(1))).__nonzero__()) {
- if (frame.getlocal(1).__getitem__(frame.getlocal(2))._eq(frame.getlocal(6)).__nonzero__()) {
- frame.getlocal(1).__delitem__(frame.getlocal(2));
- while (((t$0$PyObject = frame.getlocal(2)._lt(frame.getglobal("len").__call__(frame.getlocal(1)))).__nonzero__() ? frame.getlocal(1).__getitem__(frame.getlocal(2))._eq(s$1) : t$0$PyObject).__nonzero__()) {
- frame.getlocal(1).__delitem__(frame.getlocal(2));
- }
- }
- else if (((t$0$PyObject = ((t$1$PyObject = frame.getlocal(1).__getitem__(frame.getlocal(2))._eq(frame.getlocal(3))).__nonzero__() ? frame.getlocal(2)._gt(i$10) : t$1$PyObject)).__nonzero__() ? frame.getlocal(1).__getitem__(frame.getlocal(2)._sub(i$11))._notin(new PyTuple(new PyObject[] {s$1, frame.getlocal(3)})) : t$0$PyObject).__nonzero__()) {
- frame.getlocal(1).__delslice__(frame.getlocal(2)._sub(i$11), frame.getlocal(2)._add(i$11), null);
- frame.setlocal(2, frame.getlocal(2)._sub(i$11));
- }
- else if (((t$0$PyObject = ((t$1$PyObject = frame.getlocal(1).__getitem__(frame.getlocal(2))._eq(s$1)).__nonzero__() ? frame.getlocal(2)._gt(i$10) : t$1$PyObject)).__nonzero__() ? frame.getlocal(1).__getitem__(frame.getlocal(2)._sub(i$11))._ne(s$1) : t$0$PyObject).__nonzero__()) {
- frame.getlocal(1).__delitem__(frame.getlocal(2));
- }
- else {
- frame.setlocal(2, frame.getlocal(2)._add(i$11));
- }
- }
- if (((t$0$PyObject = frame.getlocal(1).__not__()).__nonzero__() ? frame.getlocal(5).__not__() : t$0$PyObject).__nonzero__()) {
- frame.getlocal(1).invoke("append", frame.getlocal(6));
- }
- return frame.getlocal(5)._add(frame.getlocal(4).__getattr__("joinfields").__call__(frame.getlocal(1), frame.getlocal(7)));
- }
-
- private static PyObject abspath$22(PyFrame frame) {
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$39));
- return frame.getglobal("File").__call__(frame.getlocal(0)).invoke("getAbsolutePath");
- }
-
- private static PyObject getsize$23(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$40));
- frame.setlocal(2, frame.getglobal("File").__call__(frame.getlocal(0)));
- frame.setlocal(1, frame.getlocal(2).invoke("length"));
- if (((t$0$PyObject = frame.getlocal(1)._eq(i$10)).__nonzero__() ? frame.getlocal(2).invoke("exists").__not__() : t$0$PyObject).__nonzero__()) {
- throw Py.makeException(frame.getglobal("OSError").__call__(i$10, s$41, frame.getlocal(0)));
- }
- return frame.getlocal(1);
- }
-
- private static PyObject getmtime$24(PyFrame frame) {
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$42));
- frame.setlocal(1, frame.getglobal("File").__call__(frame.getlocal(0)));
- return frame.getlocal(1).invoke("lastModified")._div(f$43);
- }
-
- private static PyObject getatime$25(PyFrame frame) {
- frame.setlocal(0, frame.getglobal("_tostr").__call__(frame.getlocal(0), s$44));
- frame.setlocal(1, frame.getglobal("File").__call__(frame.getlocal(0)));
- return frame.getlocal(1).invoke("lastModified")._div(f$43);
- }
-
- private static PyObject expandvars$26(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
- PyException t$0$PyException;
-
- // Code
- /* Expand shell variables of form $var and ${var}.
-
- Unknown variables are left unchanged. */
- if (s$46._notin(frame.getlocal(0)).__nonzero__()) {
- return frame.getlocal(0);
- }
- frame.setlocal(2, org.python.core.imp.importOne("string", frame));
- frame.setlocal(1, frame.getlocal(2).__getattr__("letters")._add(frame.getlocal(2).__getattr__("digits"))._add(s$47));
- frame.setlocal(4, s$1);
- frame.setlocal(3, i$10);
- frame.setlocal(6, frame.getglobal("len").__call__(frame.getlocal(0)));
- while (frame.getlocal(3)._lt(frame.getlocal(6)).__nonzero__()) {
- frame.setlocal(5, frame.getlocal(0).__getitem__(frame.getlocal(3)));
- if (frame.getlocal(5)._eq(s$48).__nonzero__()) {
- frame.setlocal(0, frame.getlocal(0).__getslice__(frame.getlocal(3)._add(i$11), null, null));
- frame.setlocal(6, frame.getglobal("len").__call__(frame.getlocal(0)));
- try {
- frame.setlocal(3, frame.getlocal(0).invoke("index", s$48));
- frame.setlocal(4, frame.getlocal(4)._add(s$48)._add(frame.getlocal(0).__getslice__(null, frame.getlocal(3)._add(i$11), null)));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("ValueError"))) {
- frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(0)));
- frame.setlocal(3, frame.getlocal(6)._sub(i$11));
- }
- else throw t$0$PyException;
- }
- }
- else if (frame.getlocal(5)._eq(s$46).__nonzero__()) {
- if (frame.getlocal(0).__getslice__(frame.getlocal(3)._add(i$11), frame.getlocal(3)._add(i$33), null)._eq(s$46).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(5)));
- frame.setlocal(3, frame.getlocal(3)._add(i$11));
- }
- else if (frame.getlocal(0).__getslice__(frame.getlocal(3)._add(i$11), frame.getlocal(3)._add(i$33), null)._eq(s$49).__nonzero__()) {
- frame.setlocal(0, frame.getlocal(0).__getslice__(frame.getlocal(3)._add(i$33), null, null));
- frame.setlocal(6, frame.getglobal("len").__call__(frame.getlocal(0)));
- try {
- frame.setlocal(3, frame.getlocal(0).invoke("index", s$50));
- frame.setlocal(7, frame.getlocal(0).__getslice__(null, frame.getlocal(3), null));
- if (frame.getglobal("os").__getattr__("environ").__getattr__("has_key").__call__(frame.getlocal(7)).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(4)._add(frame.getglobal("os").__getattr__("environ").__getitem__(frame.getlocal(7))));
- }
- }
- catch (Throwable x$1) {
- t$0$PyException = Py.setException(x$1, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("ValueError"))) {
- frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(0)));
- frame.setlocal(3, frame.getlocal(6)._sub(i$11));
- }
- else throw t$0$PyException;
- }
- }
- else {
- frame.setlocal(7, s$1);
- frame.setlocal(3, frame.getlocal(3)._add(i$11));
- frame.setlocal(5, frame.getlocal(0).__getslice__(frame.getlocal(3), frame.getlocal(3)._add(i$11), null));
- while (((t$0$PyObject = frame.getlocal(5)._ne(s$1)).__nonzero__() ? frame.getlocal(5)._in(frame.getlocal(1)) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(7, frame.getlocal(7)._add(frame.getlocal(5)));
- frame.setlocal(3, frame.getlocal(3)._add(i$11));
- frame.setlocal(5, frame.getlocal(0).__getslice__(frame.getlocal(3), frame.getlocal(3)._add(i$11), null));
- }
- if (frame.getglobal("os").__getattr__("environ").__getattr__("has_key").__call__(frame.getlocal(7)).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(4)._add(frame.getglobal("os").__getattr__("environ").__getitem__(frame.getlocal(7))));
- }
- if (frame.getlocal(5)._ne(s$1).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(5)));
- }
- }
- }
- else {
- frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(5)));
- }
- frame.setlocal(3, frame.getlocal(3)._add(i$11));
- }
- return frame.getlocal(4);
- }
-
- private static PyObject main$27(PyFrame frame) {
- frame.setglobal("__file__", s$51);
-
- PyObject[] imp_accu;
- // Code
- /* Common pathname manipulations, JDK version.
-
- Instead of importing this module directly, import os and refer to this
- module as os.path.
-
- */
- frame.setlocal("java", org.python.core.imp.importOne("java", frame));
- imp_accu = org.python.core.imp.importFrom("java.io", new String[] {"File"}, frame);
- frame.setlocal("File", imp_accu[0]);
- imp_accu = null;
- imp_accu = org.python.core.imp.importFrom("java.lang", new String[] {"System"}, frame);
- frame.setlocal("System", imp_accu[0]);
- imp_accu = null;
- frame.setlocal("os", org.python.core.imp.importOne("os", frame));
- frame.setlocal("_tostr", new PyFunction(frame.f_globals, new PyObject[] {}, c$0__tostr));
- frame.setlocal("dirname", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_dirname));
- frame.setlocal("basename", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_basename));
- frame.setlocal("split", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_split));
- frame.setlocal("splitext", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_splitext));
- frame.setlocal("splitdrive", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_splitdrive));
- frame.setlocal("exists", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_exists));
- frame.setlocal("isabs", new PyFunction(frame.f_globals, new PyObject[] {}, c$7_isabs));
- frame.setlocal("isfile", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_isfile));
- frame.setlocal("isdir", new PyFunction(frame.f_globals, new PyObject[] {}, c$9_isdir));
- frame.setlocal("join", new PyFunction(frame.f_globals, new PyObject[] {}, c$10_join));
- frame.setlocal("normcase", new PyFunction(frame.f_globals, new PyObject[] {}, c$11_normcase));
- frame.setlocal("commonprefix", new PyFunction(frame.f_globals, new PyObject[] {}, c$12_commonprefix));
- frame.setlocal("islink", new PyFunction(frame.f_globals, new PyObject[] {}, c$13_islink));
- frame.setlocal("samefile", new PyFunction(frame.f_globals, new PyObject[] {}, c$14_samefile));
- frame.setlocal("ismount", new PyFunction(frame.f_globals, new PyObject[] {}, c$15_ismount));
- frame.setlocal("walk", new PyFunction(frame.f_globals, new PyObject[] {}, c$16_walk));
- frame.setlocal("expanduser", new PyFunction(frame.f_globals, new PyObject[] {}, c$17_expanduser));
- frame.setlocal("getuser", new PyFunction(frame.f_globals, new PyObject[] {}, c$18_getuser));
- frame.setlocal("gethome", new PyFunction(frame.f_globals, new PyObject[] {}, c$19_gethome));
- frame.setlocal("normpath", new PyFunction(frame.f_globals, new PyObject[] {}, c$20_normpath));
- frame.setlocal("abspath", new PyFunction(frame.f_globals, new PyObject[] {}, c$21_abspath));
- frame.setlocal("getsize", new PyFunction(frame.f_globals, new PyObject[] {}, c$22_getsize));
- frame.setlocal("getmtime", new PyFunction(frame.f_globals, new PyObject[] {}, c$23_getmtime));
- frame.setlocal("getatime", new PyFunction(frame.f_globals, new PyObject[] {}, c$24_getatime));
- frame.setlocal("expandvars", new PyFunction(frame.f_globals, new PyObject[] {}, c$25_expandvars));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("javapath"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "javapath";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(javapath._PyInner.class, newargs, javapath.jpy$packages, javapath.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class linecache extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject i$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject i$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject i$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyFunctionTable funcTable;
- private static PyCode c$0_getline;
- private static PyCode c$1_clearcache;
- private static PyCode c$2_getlines;
- private static PyCode c$3_checkcache;
- private static PyCode c$4_updatecache;
- private static PyCode c$5_main;
- private static void initConstants() {
- s$0 = Py.newString("Cache lines from files.\012\012This is intended to read lines from modules imported -- hence if a filename\012is not found, it will look down the module search path for a file by\012that name.\012");
- s$1 = Py.newString("getline");
- s$2 = Py.newString("clearcache");
- s$3 = Py.newString("checkcache");
- i$4 = Py.newInteger(1);
- s$5 = Py.newString("");
- s$6 = Py.newString("Clear the cache entirely.");
- s$7 = Py.newString("Get the lines for a file from the cache.\012 Update the cache if it doesn't contain an entry for this file already.");
- i$8 = Py.newInteger(2);
- s$9 = Py.newString("Discard cache entries that are out of date.\012 (This is not checked upon each call!)");
- s$10 = Py.newString("Update a cache entry and return its list of lines.\012 If something's wrong, print a message, discard the cache entry,\012 and return an empty list.");
- i$11 = Py.newInteger(0);
- s$12 = Py.newString("<>");
- s$13 = Py.newString("r");
- s$14 = Py.newString("/usr/share/jython/Lib-cpython/linecache.py");
- funcTable = new _PyInner();
- c$0_getline = Py.newCode(2, new String[] {"filename", "lineno", "lines"}, "/usr/share/jython/Lib-cpython/linecache.py", "getline", false, false, funcTable, 0, null, null, 0, 1);
- c$1_clearcache = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/linecache.py", "clearcache", false, false, funcTable, 1, null, null, 0, 1);
- c$2_getlines = Py.newCode(1, new String[] {"filename"}, "/usr/share/jython/Lib-cpython/linecache.py", "getlines", false, false, funcTable, 2, null, null, 0, 1);
- c$3_checkcache = Py.newCode(0, new String[] {"filename", "stat", "mtime", "fullname", "size", "lines"}, "/usr/share/jython/Lib-cpython/linecache.py", "checkcache", false, false, funcTable, 3, null, null, 0, 1);
- c$4_updatecache = Py.newCode(1, new String[] {"filename", "msg", "stat", "dirname", "fp", "basename", "mtime", "fullname", "size", "lines"}, "/usr/share/jython/Lib-cpython/linecache.py", "updatecache", false, false, funcTable, 4, null, null, 0, 1);
- c$5_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/linecache.py", "main", false, false, funcTable, 5, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$5_main == null) _PyInner.initConstants();
- return c$5_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.getline$1(frame);
- case 1:
- return _PyInner.clearcache$2(frame);
- case 2:
- return _PyInner.getlines$3(frame);
- case 3:
- return _PyInner.checkcache$4(frame);
- case 4:
- return _PyInner.updatecache$5(frame);
- case 5:
- return _PyInner.main$6(frame);
- default:
- return null;
- }
- }
-
- private static PyObject getline$1(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- frame.setlocal(2, frame.getglobal("getlines").__call__(frame.getlocal(0)));
- if ((i$4._le(t$0$PyObject = frame.getlocal(1)).__nonzero__() ? t$0$PyObject._le(frame.getglobal("len").__call__(frame.getlocal(2))) : Py.Zero).__nonzero__()) {
- return frame.getlocal(2).__getitem__(frame.getlocal(1)._sub(i$4));
- }
- else {
- return s$5;
- }
- }
-
- private static PyObject clearcache$2(PyFrame frame) {
- /* Clear the cache entirely. */
- // global cache
- frame.setglobal("cache", new PyDictionary(new PyObject[] {}));
- return Py.None;
- }
-
- private static PyObject getlines$3(PyFrame frame) {
- /* Get the lines for a file from the cache.
- Update the cache if it doesn't contain an entry for this file already. */
- if (frame.getglobal("cache").invoke("has_key", frame.getlocal(0)).__nonzero__()) {
- return frame.getglobal("cache").__getitem__(frame.getlocal(0)).__getitem__(i$8);
- }
- else {
- return frame.getglobal("updatecache").__call__(frame.getlocal(0));
- }
- }
-
- private static PyObject checkcache$4(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyException t$0$PyException;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
-
- // Code
- /* Discard cache entries that are out of date.
- (This is not checked upon each call!) */
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("cache").invoke("keys");
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(0, t$0$PyObject);
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("cache").__getitem__(frame.getlocal(0)), 4);
- frame.setlocal(4, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- frame.setlocal(5, t$0$PyObject__[2]);
- frame.setlocal(3, t$0$PyObject__[3]);
- try {
- frame.setlocal(1, frame.getglobal("os").__getattr__("stat").__call__(frame.getlocal(3)));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("os").__getattr__("error"))) {
- frame.getglobal("cache").__delitem__(frame.getlocal(0));
- continue;
- }
- else throw t$0$PyException;
- }
- if (((t$2$PyObject = frame.getlocal(4)._ne(frame.getlocal(1).__getitem__(frame.getglobal("ST_SIZE")))).__nonzero__() ? t$2$PyObject : frame.getlocal(2)._ne(frame.getlocal(1).__getitem__(frame.getglobal("ST_MTIME")))).__nonzero__()) {
- frame.getglobal("cache").__delitem__(frame.getlocal(0));
- }
- }
- return Py.None;
- }
-
- private static PyObject updatecache$5(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- boolean t$0$boolean;
- PyException t$0$PyException, t$1$PyException;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Update a cache entry and return its list of lines.
- If something's wrong, print a message, discard the cache entry,
- and return an empty list. */
- if (frame.getglobal("cache").invoke("has_key", frame.getlocal(0)).__nonzero__()) {
- frame.getglobal("cache").__delitem__(frame.getlocal(0));
- }
- if (((t$0$PyObject = frame.getlocal(0).__not__()).__nonzero__() ? t$0$PyObject : frame.getlocal(0).__getitem__(i$11)._add(frame.getlocal(0).__getitem__(i$4.__neg__()))._eq(s$12)).__nonzero__()) {
- return new PyList(new PyObject[] {});
- }
- frame.setlocal(7, frame.getlocal(0));
- try {
- frame.setlocal(2, frame.getglobal("os").__getattr__("stat").__call__(frame.getlocal(7)));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("os").__getattr__("error"))) {
- frame.setlocal(1, t$0$PyException.value);
- frame.setlocal(5, frame.getglobal("os").__getattr__("path").__getattr__("split").__call__(frame.getlocal(0)).__getitem__(i$4));
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("sys").__getattr__("path");
- while (t$0$boolean=(t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(3, t$0$PyObject);
- frame.setlocal(7, frame.getglobal("os").__getattr__("path").__getattr__("join").__call__(frame.getlocal(3), frame.getlocal(5)));
- try {
- frame.setlocal(2, frame.getglobal("os").__getattr__("stat").__call__(frame.getlocal(7)));
- break;
- }
- catch (Throwable x$1) {
- t$1$PyException = Py.setException(x$1, frame);
- if (Py.matchException(t$1$PyException, frame.getglobal("os").__getattr__("error"))) {
- // pass
- }
- else throw t$1$PyException;
- }
- }
- if (!t$0$boolean) {
- return new PyList(new PyObject[] {});
- }
- }
- else throw t$0$PyException;
- }
- try {
- frame.setlocal(4, frame.getglobal("open").__call__(frame.getlocal(7), s$13));
- frame.setlocal(9, frame.getlocal(4).invoke("readlines"));
- frame.getlocal(4).invoke("close");
- }
- catch (Throwable x$2) {
- t$0$PyException = Py.setException(x$2, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("IOError"))) {
- frame.setlocal(1, t$0$PyException.value);
- return new PyList(new PyObject[] {});
- }
- else throw t$0$PyException;
- }
- t$0$PyObject__ = org.python.core.Py.unpackSequence(new PyTuple(new PyObject[] {frame.getlocal(2).__getitem__(frame.getglobal("ST_SIZE")), frame.getlocal(2).__getitem__(frame.getglobal("ST_MTIME"))}), 2);
- frame.setlocal(8, t$0$PyObject__[0]);
- frame.setlocal(6, t$0$PyObject__[1]);
- frame.getglobal("cache").__setitem__(frame.getlocal(0), new PyTuple(new PyObject[] {frame.getlocal(8), frame.getlocal(6), frame.getlocal(9), frame.getlocal(7)}));
- return frame.getlocal(9);
- }
-
- private static PyObject main$6(PyFrame frame) {
- frame.setglobal("__file__", s$14);
-
- /* Cache lines from files.
-
- This is intended to read lines from modules imported -- hence if a filename
- is not found, it will look down the module search path for a file by
- that name.
- */
- frame.setlocal("sys", org.python.core.imp.importOne("sys", frame));
- frame.setlocal("os", org.python.core.imp.importOne("os", frame));
- org.python.core.imp.importAll("stat", frame);
- frame.setlocal("__all__", new PyList(new PyObject[] {s$1, s$2, s$3}));
- frame.setlocal("getline", new PyFunction(frame.f_globals, new PyObject[] {}, c$0_getline));
- frame.setlocal("cache", new PyDictionary(new PyObject[] {}));
- frame.setlocal("clearcache", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_clearcache));
- frame.setlocal("getlines", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_getlines));
- frame.setlocal("checkcache", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_checkcache));
- frame.setlocal("updatecache", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_updatecache));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("linecache"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "linecache";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(linecache._PyInner.class, newargs, linecache.jpy$packages, linecache.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class random extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject s$16;
- private static PyObject s$17;
- private static PyObject s$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyObject f$24;
- private static PyObject s$25;
- private static PyObject i$26;
- private static PyObject f$27;
- private static PyObject f$28;
- private static PyObject s$29;
- private static PyObject f$30;
- private static PyObject s$31;
- private static PyObject f$32;
- private static PyObject f$33;
- private static PyObject s$34;
- private static PyObject f$35;
- private static PyObject f$36;
- private static PyObject f$37;
- private static PyObject s$38;
- private static PyObject f$39;
- private static PyObject i$40;
- private static PyObject s$41;
- private static PyObject s$42;
- private static PyObject i$43;
- private static PyObject i$44;
- private static PyObject l$45;
- private static PyObject i$46;
- private static PyObject i$47;
- private static PyObject i$48;
- private static PyObject s$49;
- private static PyObject i$50;
- private static PyObject i$51;
- private static PyObject i$52;
- private static PyObject i$53;
- private static PyObject i$54;
- private static PyObject i$55;
- private static PyObject f$56;
- private static PyObject f$57;
- private static PyObject f$58;
- private static PyObject s$59;
- private static PyObject s$60;
- private static PyObject i$61;
- private static PyObject s$62;
- private static PyObject s$63;
- private static PyObject s$64;
- private static PyObject s$65;
- private static PyObject s$66;
- private static PyObject s$67;
- private static PyObject i$68;
- private static PyObject i$69;
- private static PyObject s$70;
- private static PyObject s$71;
- private static PyObject s$72;
- private static PyObject s$73;
- private static PyObject s$74;
- private static PyObject s$75;
- private static PyObject s$76;
- private static PyObject s$77;
- private static PyObject s$78;
- private static PyObject s$79;
- private static PyObject s$80;
- private static PyObject f$81;
- private static PyObject f$82;
- private static PyObject s$83;
- private static PyObject s$84;
- private static PyObject s$85;
- private static PyObject f$86;
- private static PyObject s$87;
- private static PyObject s$88;
- private static PyObject s$89;
- private static PyObject s$90;
- private static PyObject s$91;
- private static PyObject s$92;
- private static PyObject s$93;
- private static PyObject s$94;
- private static PyObject s$95;
- private static PyObject s$96;
- private static PyObject s$97;
- private static PyObject s$98;
- private static PyObject s$99;
- private static PyObject s$100;
- private static PyObject s$101;
- private static PyObject s$102;
- private static PyObject s$103;
- private static PyObject s$104;
- private static PyObject s$105;
- private static PyObject s$106;
- private static PyObject s$107;
- private static PyObject s$108;
- private static PyObject s$109;
- private static PyObject i$110;
- private static PyObject s$111;
- private static PyObject s$112;
- private static PyFunctionTable funcTable;
- private static PyCode c$0__verify;
- private static PyCode c$1___init__;
- private static PyCode c$2_seed;
- private static PyCode c$3_random;
- private static PyCode c$4_getstate;
- private static PyCode c$5_setstate;
- private static PyCode c$6_jumpahead;
- private static PyCode c$7__Random__whseed;
- private static PyCode c$8_whseed;
- private static PyCode c$9___getstate__;
- private static PyCode c$10___setstate__;
- private static PyCode c$11_randrange;
- private static PyCode c$12_randint;
- private static PyCode c$13_choice;
- private static PyCode c$14_shuffle;
- private static PyCode c$15_uniform;
- private static PyCode c$16_normalvariate;
- private static PyCode c$17_lognormvariate;
- private static PyCode c$18_cunifvariate;
- private static PyCode c$19_expovariate;
- private static PyCode c$20_vonmisesvariate;
- private static PyCode c$21_gammavariate;
- private static PyCode c$22_stdgamma;
- private static PyCode c$23_gauss;
- private static PyCode c$24_betavariate;
- private static PyCode c$25_paretovariate;
- private static PyCode c$26_weibullvariate;
- private static PyCode c$27_Random;
- private static PyCode c$28__test_generator;
- private static PyCode c$29__test;
- private static PyCode c$30_main;
- private static void initConstants() {
- s$0 = Py.newString("Random variable generators.\012\012 integers\012 --------\012 uniform within range\012\012 sequences\012 ---------\012 pick random element\012 generate random permutation\012\012 distributions on the real line:\012 ------------------------------\012 uniform\012 normal (Gaussian)\012 lognormal\012 negative exponential\012 gamma\012 beta\012\012 distributions on the circle (angles 0 to 2pi)\012 ---------------------------------------------\012 circular uniform\012 von Mises\012\012Translated from anonymously contributed C/C++ source.\012\012Multi-threading note: the random number generator used here is not thread-\012safe; it is possible that two calls return the same random value. However,\012you can instantiate a different instance of Random() in each thread to get\012generators that don't share state, then use .setstate() and .jumpahead() to\012move the generators to disjoint segments of the full period. For example,\012\012def create_generators(num, delta, firstseed=None):\012 \"\"\"Return list of num distinct generators.\012 Each generator has its own unique segment of delta elements from\012 Random.random()'s full period.\012 Seed the first generator with optional arg firstseed (default is\012 None, to seed from current time).\012 \"\"\"\012\012 from random import Random\012 g = Random(firstseed)\012 result = [g]\012 for i in range(num - 1):\012 laststate = g.getstate()\012 g = Random()\012 g.setstate(laststate)\012 g.jumpahead(delta)\012 result.append(g)\012 return result\012\012gens = create_generators(10, 1000000)\012\012That creates 10 distinct generators, which can be passed out to 10 distinct\012threads. The generators don't share state so can be called safely in\012parallel. So long as no thread calls its g.random() more than a million\012times (the second argument to create_generators), the sequences seen by\012each thread will not overlap.\012\012The period of the underlying Wichmann-Hill generator is 6,953,607,871,644,\012and that limits how far this technique can be pushed.\012\012Just for fun, note that since we know the period, .jumpahead() can also be\012used to \"move backward in time\":\012\012>>> g = Random(42) # arbitrary\012>>> g.random()\0120.25420336316883324\012>>> g.jumpahead(6953607871644L - 1) # move *back* one\012>>> g.random()\0120.25420336316883324\012");
- s$1 = Py.newString("Random");
- s$2 = Py.newString("seed");
- s$3 = Py.newString("random");
- s$4 = Py.newString("uniform");
- s$5 = Py.newString("randint");
- s$6 = Py.newString("choice");
- s$7 = Py.newString("randrange");
- s$8 = Py.newString("shuffle");
- s$9 = Py.newString("normalvariate");
- s$10 = Py.newString("lognormvariate");
- s$11 = Py.newString("cunifvariate");
- s$12 = Py.newString("expovariate");
- s$13 = Py.newString("vonmisesvariate");
- s$14 = Py.newString("gammavariate");
- s$15 = Py.newString("stdgamma");
- s$16 = Py.newString("gauss");
- s$17 = Py.newString("betavariate");
- s$18 = Py.newString("paretovariate");
- s$19 = Py.newString("weibullvariate");
- s$20 = Py.newString("getstate");
- s$21 = Py.newString("setstate");
- s$22 = Py.newString("jumpahead");
- s$23 = Py.newString("whseed");
- f$24 = Py.newFloat(1.0E-7);
- s$25 = Py.newString("computed value for %s deviates too much (computed %g, expected %g)");
- i$26 = Py.newInteger(4);
- f$27 = Py.newFloat(0.5);
- f$28 = Py.newFloat(2.0);
- s$29 = Py.newString("NV_MAGICCONST");
- f$30 = Py.newFloat(1.71552776992141);
- s$31 = Py.newString("TWOPI");
- f$32 = Py.newFloat(6.28318530718);
- f$33 = Py.newFloat(4.0);
- s$34 = Py.newString("LOG4");
- f$35 = Py.newFloat(1.38629436111989);
- f$36 = Py.newFloat(1.0);
- f$37 = Py.newFloat(4.5);
- s$38 = Py.newString("SG_MAGICCONST");
- f$39 = Py.newFloat(2.50407739677627);
- i$40 = Py.newInteger(1);
- s$41 = Py.newString("Initialize an instance.\012\012 Optional argument x controls seeding, as for Random.seed().\012 ");
- s$42 = Py.newString("Initialize internal state from hashable object.\012\012 None or no argument seeds from current time.\012\012 If a is not None or an int or long, hash(a) is used instead.\012\012 If a is an int or long, a is used directly. Distinct values between\012 0 and 27814431486575L inclusive are guaranteed to yield distinct\012 internal states (this guarantee is specific to the default\012 Wichmann-Hill generator).\012 ");
- i$43 = Py.newInteger(256);
- i$44 = Py.newInteger(3);
- l$45 = Py.newLong("3");
- i$46 = Py.newInteger(30268);
- i$47 = Py.newInteger(30306);
- i$48 = Py.newInteger(30322);
- s$49 = Py.newString("Get the next random number in the range [0.0, 1.0).");
- i$50 = Py.newInteger(171);
- i$51 = Py.newInteger(30269);
- i$52 = Py.newInteger(172);
- i$53 = Py.newInteger(30307);
- i$54 = Py.newInteger(170);
- i$55 = Py.newInteger(30323);
- f$56 = Py.newFloat(30269.0);
- f$57 = Py.newFloat(30307.0);
- f$58 = Py.newFloat(30323.0);
- s$59 = Py.newString("Return internal state; can be passed to setstate() later.");
- s$60 = Py.newString("Restore internal state from object returned by getstate().");
- i$61 = Py.newInteger(0);
- s$62 = Py.newString("state with version %s passed to Random.setstate() of version %s");
- s$63 = Py.newString("Act as if n calls to random() were made, but quickly.\012\012 n is an int, greater than or equal to 0.\012\012 Example use: If you have 2 threads and know that each will\012 consume no more than a million random numbers, create two Random\012 objects r1 and r2, then do\012 r2.setstate(r1.getstate())\012 r2.jumpahead(1000000)\012 Then r1 and r2 will use guaranteed-disjoint segments of the full\012 period.\012 ");
- s$64 = Py.newString("n must be >= 0");
- s$65 = Py.newString("Set the Wichmann-Hill seed from (x, y, z).\012\012 These must be integers in the range [0, 256).\012 ");
- s$66 = Py.newString("seeds must be integers");
- s$67 = Py.newString("seeds must be in range(0, 256)");
- i$68 = Py.newInteger(16777215);
- i$69 = Py.newInteger(24);
- s$70 = Py.newString("Seed from hashable object's hash code.\012\012 None or no argument seeds from current time. It is not guaranteed\012 that objects with distinct hash codes lead to distinct internal\012 states.\012\012 This is obsolete, provided for compatibility with the seed routine\012 used prior to Python 2.1. Use the .seed() method instead.\012 ");
- s$71 = Py.newString("Choose a random item from range(start, stop[, step]).\012\012 This fixes the problem with randint() which includes the\012 endpoint; in Python this is usually not what you want.\012 Do not supply the 'int' and 'default' arguments.\012 ");
- s$72 = Py.newString("non-integer arg 1 for randrange()");
- s$73 = Py.newString("empty range for randrange()");
- s$74 = Py.newString("non-integer stop for randrange()");
- s$75 = Py.newString("non-integer step for randrange()");
- s$76 = Py.newString("zero step for randrange()");
- s$77 = Py.newString("Return random integer in range [a, b], including both end points.\012\012 (Deprecated; use randrange(a, b+1).)\012 ");
- s$78 = Py.newString("Choose a random element from a non-empty sequence.");
- s$79 = Py.newString("x, random=random.random -> shuffle list x in place; return None.\012\012 Optional arg random is a 0-argument function returning a random\012 float in [0.0, 1.0); by default, the standard random.random.\012\012 Note that for even rather small len(x), the total number of\012 permutations of x is larger than the period of most random number\012 generators; this implies that \"most\" permutations of a long\012 sequence can never be generated.\012 ");
- s$80 = Py.newString("Get a random number in the range [a, b).");
- f$81 = Py.newFloat(1.0E-6);
- f$82 = Py.newFloat(0.0);
- s$83 = Py.newString("stdgamma: alpha must be > 0.0");
- s$84 = Py.newString("times");
- s$85 = Py.newString("eval");
- f$86 = Py.newFloat(1.0E10);
- s$87 = Py.newString("sec,");
- s$88 = Py.newString("avg %g, stddev %g, min %g, max %g");
- s$89 = Py.newString("TWOPI =");
- s$90 = Py.newString("LOG4 =");
- s$91 = Py.newString("NV_MAGICCONST =");
- s$92 = Py.newString("SG_MAGICCONST =");
- s$93 = Py.newString("random()");
- s$94 = Py.newString("normalvariate(0.0, 1.0)");
- s$95 = Py.newString("lognormvariate(0.0, 1.0)");
- s$96 = Py.newString("cunifvariate(0.0, 1.0)");
- s$97 = Py.newString("expovariate(1.0)");
- s$98 = Py.newString("vonmisesvariate(0.0, 1.0)");
- s$99 = Py.newString("gammavariate(0.5, 1.0)");
- s$100 = Py.newString("gammavariate(0.9, 1.0)");
- s$101 = Py.newString("gammavariate(1.0, 1.0)");
- s$102 = Py.newString("gammavariate(2.0, 1.0)");
- s$103 = Py.newString("gammavariate(20.0, 1.0)");
- s$104 = Py.newString("gammavariate(200.0, 1.0)");
- s$105 = Py.newString("gauss(0.0, 1.0)");
- s$106 = Py.newString("betavariate(3.0, 3.0)");
- s$107 = Py.newString("paretovariate(1.0)");
- s$108 = Py.newString("weibullvariate(1.0, 1.0)");
- s$109 = Py.newString("jumpahead test failed ");
- i$110 = Py.newInteger(200);
- s$111 = Py.newString("__main__");
- s$112 = Py.newString("/usr/share/jython/Lib/random.py");
- funcTable = new _PyInner();
- c$0__verify = Py.newCode(3, new String[] {"name", "computed", "expected"}, "/usr/share/jython/Lib/random.py", "_verify", false, false, funcTable, 0, null, null, 0, 1);
- c$1___init__ = Py.newCode(2, new String[] {"self", "x"}, "/usr/share/jython/Lib/random.py", "__init__", false, false, funcTable, 1, null, null, 0, 1);
- c$2_seed = Py.newCode(2, new String[] {"self", "a", "time", "z", "y", "x"}, "/usr/share/jython/Lib/random.py", "seed", false, false, funcTable, 2, null, null, 0, 1);
- c$3_random = Py.newCode(1, new String[] {"self", "x", "z", "y"}, "/usr/share/jython/Lib/random.py", "random", false, false, funcTable, 3, null, null, 0, 1);
- c$4_getstate = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/random.py", "getstate", false, false, funcTable, 4, null, null, 0, 1);
- c$5_setstate = Py.newCode(2, new String[] {"self", "state", "version"}, "/usr/share/jython/Lib/random.py", "setstate", false, false, funcTable, 5, null, null, 0, 1);
- c$6_jumpahead = Py.newCode(2, new String[] {"self", "n", "x", "z", "y"}, "/usr/share/jython/Lib/random.py", "jumpahead", false, false, funcTable, 6, null, null, 0, 1);
- c$7__Random__whseed = Py.newCode(4, new String[] {"self", "x", "y", "z", "time", "t"}, "/usr/share/jython/Lib/random.py", "_Random__whseed", false, false, funcTable, 7, null, null, 0, 1);
- c$8_whseed = Py.newCode(2, new String[] {"self", "a", "x", "z", "y"}, "/usr/share/jython/Lib/random.py", "whseed", false, false, funcTable, 8, null, null, 0, 1);
- c$9___getstate__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/random.py", "__getstate__", false, false, funcTable, 9, null, null, 0, 1);
- c$10___setstate__ = Py.newCode(2, new String[] {"self", "state"}, "/usr/share/jython/Lib/random.py", "__setstate__", false, false, funcTable, 10, null, null, 0, 1);
- c$11_randrange = Py.newCode(6, new String[] {"self", "start", "stop", "step", "int", "default", "istep", "n", "istart", "istop"}, "/usr/share/jython/Lib/random.py", "randrange", false, false, funcTable, 11, null, null, 0, 1);
- c$12_randint = Py.newCode(3, new String[] {"self", "a", "b"}, "/usr/share/jython/Lib/random.py", "randint", false, false, funcTable, 12, null, null, 0, 1);
- c$13_choice = Py.newCode(2, new String[] {"self", "seq"}, "/usr/share/jython/Lib/random.py", "choice", false, false, funcTable, 13, null, null, 0, 1);
- c$14_shuffle = Py.newCode(4, new String[] {"self", "x", "random", "int", "j", "i"}, "/usr/share/jython/Lib/random.py", "shuffle", false, false, funcTable, 14, null, null, 0, 1);
- c$15_uniform = Py.newCode(3, new String[] {"self", "a", "b"}, "/usr/share/jython/Lib/random.py", "uniform", false, false, funcTable, 15, null, null, 0, 1);
- c$16_normalvariate = Py.newCode(3, new String[] {"self", "mu", "sigma", "u2", "u1", "random", "zz", "z"}, "/usr/share/jython/Lib/random.py", "normalvariate", false, false, funcTable, 16, null, null, 0, 1);
- c$17_lognormvariate = Py.newCode(3, new String[] {"self", "mu", "sigma"}, "/usr/share/jython/Lib/random.py", "lognormvariate", false, false, funcTable, 17, null, null, 0, 1);
- c$18_cunifvariate = Py.newCode(3, new String[] {"self", "mean", "arc"}, "/usr/share/jython/Lib/random.py", "cunifvariate", false, false, funcTable, 18, null, null, 0, 1);
- c$19_expovariate = Py.newCode(2, new String[] {"self", "lambd", "u", "random"}, "/usr/share/jython/Lib/random.py", "expovariate", false, false, funcTable, 19, null, null, 0, 1);
- c$20_vonmisesvariate = Py.newCode(3, new String[] {"self", "mu", "kappa", "random", "theta", "z", "r", "u3", "u2", "u1", "f", "c", "b", "a"}, "/usr/share/jython/Lib/random.py", "vonmisesvariate", false, false, funcTable, 20, null, null, 0, 1);
- c$21_gammavariate = Py.newCode(3, new String[] {"self", "alpha", "beta", "ainv"}, "/usr/share/jython/Lib/random.py", "gammavariate", false, false, funcTable, 21, null, null, 0, 1);
- c$22_stdgamma = Py.newCode(5, new String[] {"self", "alpha", "ainv", "bbb", "ccc", "random", "z", "x", "v", "u", "r", "p", "u2", "u1", "b"}, "/usr/share/jython/Lib/random.py", "stdgamma", false, false, funcTable, 22, null, null, 0, 1);
- c$23_gauss = Py.newCode(3, new String[] {"self", "mu", "sigma", "x2pi", "random", "g2rad", "z"}, "/usr/share/jython/Lib/random.py", "gauss", false, false, funcTable, 23, null, null, 0, 1);
- c$24_betavariate = Py.newCode(3, new String[] {"self", "alpha", "beta", "y"}, "/usr/share/jython/Lib/random.py", "betavariate", false, false, funcTable, 24, null, null, 0, 1);
- c$25_paretovariate = Py.newCode(2, new String[] {"self", "alpha", "u"}, "/usr/share/jython/Lib/random.py", "paretovariate", false, false, funcTable, 25, null, null, 0, 1);
- c$26_weibullvariate = Py.newCode(3, new String[] {"self", "alpha", "beta", "u"}, "/usr/share/jython/Lib/random.py", "weibullvariate", false, false, funcTable, 26, null, null, 0, 1);
- c$27_Random = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/random.py", "Random", false, false, funcTable, 27, null, null, 0, 0);
- c$28__test_generator = Py.newCode(2, new String[] {"n", "funccall", "smallest", "code", "sum", "largest", "time", "x", "t1", "t0", "avg", "i", "stddev", "sqsum"}, "/usr/share/jython/Lib/random.py", "_test_generator", false, false, funcTable, 28, null, null, 0, 1);
- c$29__test = Py.newCode(1, new String[] {"N", "r2", "r1", "i", "s"}, "/usr/share/jython/Lib/random.py", "_test", false, false, funcTable, 29, null, null, 0, 1);
- c$30_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/random.py", "main", false, false, funcTable, 30, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$30_main == null) _PyInner.initConstants();
- return c$30_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner._verify$1(frame);
- case 1:
- return _PyInner.__init__$2(frame);
- case 2:
- return _PyInner.seed$3(frame);
- case 3:
- return _PyInner.random$4(frame);
- case 4:
- return _PyInner.getstate$5(frame);
- case 5:
- return _PyInner.setstate$6(frame);
- case 6:
- return _PyInner.jumpahead$7(frame);
- case 7:
- return _PyInner._Random__whseed$8(frame);
- case 8:
- return _PyInner.whseed$9(frame);
- case 9:
- return _PyInner.__getstate__$10(frame);
- case 10:
- return _PyInner.__setstate__$11(frame);
- case 11:
- return _PyInner.randrange$12(frame);
- case 12:
- return _PyInner.randint$13(frame);
- case 13:
- return _PyInner.choice$14(frame);
- case 14:
- return _PyInner.shuffle$15(frame);
- case 15:
- return _PyInner.uniform$16(frame);
- case 16:
- return _PyInner.normalvariate$17(frame);
- case 17:
- return _PyInner.lognormvariate$18(frame);
- case 18:
- return _PyInner.cunifvariate$19(frame);
- case 19:
- return _PyInner.expovariate$20(frame);
- case 20:
- return _PyInner.vonmisesvariate$21(frame);
- case 21:
- return _PyInner.gammavariate$22(frame);
- case 22:
- return _PyInner.stdgamma$23(frame);
- case 23:
- return _PyInner.gauss$24(frame);
- case 24:
- return _PyInner.betavariate$25(frame);
- case 25:
- return _PyInner.paretovariate$26(frame);
- case 26:
- return _PyInner.weibullvariate$27(frame);
- case 27:
- return _PyInner.Random$28(frame);
- case 28:
- return _PyInner._test_generator$29(frame);
- case 29:
- return _PyInner._test$30(frame);
- case 30:
- return _PyInner.main$31(frame);
- default:
- return null;
- }
- }
-
- private static PyObject _verify$1(PyFrame frame) {
- if (frame.getglobal("abs").__call__(frame.getlocal(1)._sub(frame.getlocal(2)))._gt(f$24).__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError").__call__(s$25._mod(new PyTuple(new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2)}))));
- }
- return Py.None;
- }
-
- private static PyObject __init__$2(PyFrame frame) {
- /* Initialize an instance.
-
- Optional argument x controls seeding, as for Random.seed().
- */
- frame.getlocal(0).invoke("seed", frame.getlocal(1));
- frame.getlocal(0).__setattr__("gauss_next", frame.getglobal("None"));
- return Py.None;
- }
-
- private static PyObject seed$3(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- /* Initialize internal state from hashable object.
-
- None or no argument seeds from current time.
-
- If a is not None or an int or long, hash(a) is used instead.
-
- If a is an int or long, a is used directly. Distinct values between
- 0 and 27814431486575L inclusive are guaranteed to yield distinct
- internal states (this guarantee is specific to the default
- Wichmann-Hill generator).
- */
- if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(2, org.python.core.imp.importOne("time", frame));
- frame.setlocal(1, frame.getglobal("long").__call__(frame.getlocal(2).__getattr__("time").__call__()._mul(i$43)));
- }
- if (frame.getglobal("type").__call__(frame.getlocal(1))._notin(new PyTuple(new PyObject[] {frame.getglobal("type").__call__(i$44), frame.getglobal("type").__call__(l$45)})).__nonzero__()) {
- frame.setlocal(1, frame.getglobal("hash").__call__(frame.getlocal(1)));
- }
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(1), i$46), 2);
- frame.setlocal(1, t$0$PyObject__[0]);
- frame.setlocal(5, t$0$PyObject__[1]);
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(1), i$47), 2);
- frame.setlocal(1, t$0$PyObject__[0]);
- frame.setlocal(4, t$0$PyObject__[1]);
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(1), i$48), 2);
- frame.setlocal(1, t$0$PyObject__[0]);
- frame.setlocal(3, t$0$PyObject__[1]);
- frame.getlocal(0).__setattr__("_seed", new PyTuple(new PyObject[] {frame.getglobal("int").__call__(frame.getlocal(5))._add(i$40), frame.getglobal("int").__call__(frame.getlocal(4))._add(i$40), frame.getglobal("int").__call__(frame.getlocal(3))._add(i$40)}));
- return Py.None;
- }
-
- private static PyObject random$4(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- /* Get the next random number in the range [0.0, 1.0). */
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0).__getattr__("_seed"), 3);
- frame.setlocal(1, t$0$PyObject__[0]);
- frame.setlocal(3, t$0$PyObject__[1]);
- frame.setlocal(2, t$0$PyObject__[2]);
- frame.setlocal(1, i$50._mul(frame.getlocal(1))._mod(i$51));
- frame.setlocal(3, i$52._mul(frame.getlocal(3))._mod(i$53));
- frame.setlocal(2, i$54._mul(frame.getlocal(2))._mod(i$55));
- frame.getlocal(0).__setattr__("_seed", new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(3), frame.getlocal(2)}));
- return frame.getlocal(1)._div(f$56)._add(frame.getlocal(3)._div(f$57))._add(frame.getlocal(2)._div(f$58))._mod(f$36);
- }
-
- private static PyObject getstate$5(PyFrame frame) {
- /* Return internal state; can be passed to setstate() later. */
- return new PyTuple(new PyObject[] {frame.getlocal(0).__getattr__("VERSION"), frame.getlocal(0).__getattr__("_seed"), frame.getlocal(0).__getattr__("gauss_next")});
- }
-
- private static PyObject setstate$6(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- /* Restore internal state from object returned by getstate(). */
- frame.setlocal(2, frame.getlocal(1).__getitem__(i$61));
- if (frame.getlocal(2)._eq(i$40).__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1), 3);
- frame.setlocal(2, t$0$PyObject__[0]);
- frame.getlocal(0).__setattr__("_seed", t$0$PyObject__[1]);
- frame.getlocal(0).__setattr__("gauss_next", t$0$PyObject__[2]);
- }
- else {
- throw Py.makeException(frame.getglobal("ValueError").__call__(s$62._mod(new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(0).__getattr__("VERSION")}))));
- }
- return Py.None;
- }
-
- private static PyObject jumpahead$7(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- /* Act as if n calls to random() were made, but quickly.
-
- n is an int, greater than or equal to 0.
-
- Example use: If you have 2 threads and know that each will
- consume no more than a million random numbers, create two Random
- objects r1 and r2, then do
- r2.setstate(r1.getstate())
- r2.jumpahead(1000000)
- Then r1 and r2 will use guaranteed-disjoint segments of the full
- period.
- */
- if (frame.getlocal(1)._ge(i$61).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError").__call__(s$64));
- }
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0).__getattr__("_seed"), 3);
- frame.setlocal(2, t$0$PyObject__[0]);
- frame.setlocal(4, t$0$PyObject__[1]);
- frame.setlocal(3, t$0$PyObject__[2]);
- frame.setlocal(2, frame.getglobal("int").__call__(frame.getlocal(2)._mul(frame.getglobal("pow").__call__(i$50, frame.getlocal(1), i$51)))._mod(i$51));
- frame.setlocal(4, frame.getglobal("int").__call__(frame.getlocal(4)._mul(frame.getglobal("pow").__call__(i$52, frame.getlocal(1), i$53)))._mod(i$53));
- frame.setlocal(3, frame.getglobal("int").__call__(frame.getlocal(3)._mul(frame.getglobal("pow").__call__(i$54, frame.getlocal(1), i$55)))._mod(i$55));
- frame.getlocal(0).__setattr__("_seed", new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(4), frame.getlocal(3)}));
- return Py.None;
- }
-
- private static PyObject _Random__whseed$8(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
-
- // Code
- /* Set the Wichmann-Hill seed from (x, y, z).
-
- These must be integers in the range [0, 256).
- */
- if ((frame.getglobal("type").__call__(frame.getlocal(1))._eq(t$0$PyObject = frame.getglobal("type").__call__(frame.getlocal(2))).__nonzero__() ? (t$0$PyObject._eq(t$1$PyObject = frame.getglobal("type").__call__(frame.getlocal(3))).__nonzero__() ? t$1$PyObject._eq(frame.getglobal("type").__call__(i$61)) : Py.Zero) : Py.Zero).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("TypeError").__call__(s$66));
- }
- if (((t$0$PyObject = ((t$1$PyObject = (i$61._le(t$2$PyObject = frame.getlocal(1)).__nonzero__() ? t$2$PyObject._lt(i$43) : Py.Zero)).__nonzero__() ? (i$61._le(t$2$PyObject = frame.getlocal(2)).__nonzero__() ? t$2$PyObject._lt(i$43) : Py.Zero) : t$1$PyObject)).__nonzero__() ? (i$61._le(t$1$PyObject = frame.getlocal(3)).__nonzero__() ? t$1$PyObject._lt(i$43) : Py.Zero) : t$0$PyObject).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError").__call__(s$67));
- }
- if ((i$61._eq(t$0$PyObject = frame.getlocal(1)).__nonzero__() ? (t$0$PyObject._eq(t$1$PyObject = frame.getlocal(2)).__nonzero__() ? t$1$PyObject._eq(frame.getlocal(3)) : Py.Zero) : Py.Zero).__nonzero__()) {
- frame.setlocal(4, org.python.core.imp.importOne("time", frame));
- frame.setlocal(5, frame.getglobal("long").__call__(frame.getlocal(4).__getattr__("time").__call__()._mul(i$43)));
- frame.setlocal(5, frame.getglobal("int").__call__(frame.getlocal(5)._and(i$68)._xor(frame.getlocal(5)._rshift(i$69))));
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(5), i$43), 2);
- frame.setlocal(5, t$0$PyObject__[0]);
- frame.setlocal(1, t$0$PyObject__[1]);
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(5), i$43), 2);
- frame.setlocal(5, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(5), i$43), 2);
- frame.setlocal(5, t$0$PyObject__[0]);
- frame.setlocal(3, t$0$PyObject__[1]);
- }
- frame.getlocal(0).__setattr__("_seed", new PyTuple(new PyObject[] {(t$0$PyObject = frame.getlocal(1)).__nonzero__() ? t$0$PyObject : i$40, (t$0$PyObject = frame.getlocal(2)).__nonzero__() ? t$0$PyObject : i$40, (t$0$PyObject = frame.getlocal(3)).__nonzero__() ? t$0$PyObject : i$40}));
- return Py.None;
- }
-
- private static PyObject whseed$9(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject;
-
- // Code
- /* Seed from hashable object's hash code.
-
- None or no argument seeds from current time. It is not guaranteed
- that objects with distinct hash codes lead to distinct internal
- states.
-
- This is obsolete, provided for compatibility with the seed routine
- used prior to Python 2.1. Use the .seed() method instead.
- */
- if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
- frame.getlocal(0).invoke("_Random__whseed");
- return Py.None;
- }
- frame.setlocal(1, frame.getglobal("hash").__call__(frame.getlocal(1)));
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(1), i$43), 2);
- frame.setlocal(1, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(1), i$43), 2);
- frame.setlocal(1, t$0$PyObject__[0]);
- frame.setlocal(4, t$0$PyObject__[1]);
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("divmod").__call__(frame.getlocal(1), i$43), 2);
- frame.setlocal(1, t$0$PyObject__[0]);
- frame.setlocal(3, t$0$PyObject__[1]);
- frame.setlocal(2, (t$0$PyObject = frame.getlocal(2)._add(frame.getlocal(1))._mod(i$43)).__nonzero__() ? t$0$PyObject : i$40);
- frame.setlocal(4, (t$0$PyObject = frame.getlocal(4)._add(frame.getlocal(1))._mod(i$43)).__nonzero__() ? t$0$PyObject : i$40);
- frame.setlocal(3, (t$0$PyObject = frame.getlocal(3)._add(frame.getlocal(1))._mod(i$43)).__nonzero__() ? t$0$PyObject : i$40);
- frame.getlocal(0).invoke("_Random__whseed", new PyObject[] {frame.getlocal(2), frame.getlocal(4), frame.getlocal(3)});
- return Py.None;
- }
-
- private static PyObject __getstate__$10(PyFrame frame) {
- return frame.getlocal(0).invoke("getstate");
- }
-
- private static PyObject __setstate__$11(PyFrame frame) {
- frame.getlocal(0).invoke("setstate", frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject randrange$12(PyFrame frame) {
- /* Choose a random item from range(start, stop[, step]).
-
- This fixes the problem with randint() which includes the
- endpoint; in Python this is usually not what you want.
- Do not supply the 'int' and 'default' arguments.
- */
- frame.setlocal(8, frame.getlocal(4).__call__(frame.getlocal(1)));
- if (frame.getlocal(8)._ne(frame.getlocal(1)).__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$72);
- }
- if (frame.getlocal(2)._is(frame.getlocal(5)).__nonzero__()) {
- if (frame.getlocal(8)._gt(i$61).__nonzero__()) {
- return frame.getlocal(4).__call__(frame.getlocal(0).invoke("random")._mul(frame.getlocal(8)));
- }
- throw Py.makeException(frame.getglobal("ValueError"), s$73);
- }
- frame.setlocal(9, frame.getlocal(4).__call__(frame.getlocal(2)));
- if (frame.getlocal(9)._ne(frame.getlocal(2)).__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$74);
- }
- if (frame.getlocal(3)._eq(i$40).__nonzero__()) {
- if (frame.getlocal(8)._lt(frame.getlocal(9)).__nonzero__()) {
- return frame.getlocal(8)._add(frame.getlocal(4).__call__(frame.getlocal(0).invoke("random")._mul(frame.getlocal(9)._sub(frame.getlocal(8)))));
- }
- throw Py.makeException(frame.getglobal("ValueError"), s$73);
- }
- frame.setlocal(6, frame.getlocal(4).__call__(frame.getlocal(3)));
- if (frame.getlocal(6)._ne(frame.getlocal(3)).__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$75);
- }
- if (frame.getlocal(6)._gt(i$61).__nonzero__()) {
- frame.setlocal(7, frame.getlocal(9)._sub(frame.getlocal(8))._add(frame.getlocal(6))._sub(i$40)._div(frame.getlocal(6)));
- }
- else if (frame.getlocal(6)._lt(i$61).__nonzero__()) {
- frame.setlocal(7, frame.getlocal(9)._sub(frame.getlocal(8))._add(frame.getlocal(6))._add(i$40)._div(frame.getlocal(6)));
- }
- else {
- throw Py.makeException(frame.getglobal("ValueError"), s$76);
- }
- if (frame.getlocal(7)._le(i$61).__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$73);
- }
- return frame.getlocal(8)._add(frame.getlocal(6)._mul(frame.getlocal(4).__call__(frame.getlocal(0).invoke("random")._mul(frame.getlocal(7)))));
- }
-
- private static PyObject randint$13(PyFrame frame) {
- /* Return random integer in range [a, b], including both end points.
-
- (Deprecated; use randrange(a, b+1).)
- */
- return frame.getlocal(0).invoke("randrange", frame.getlocal(1), frame.getlocal(2)._add(i$40));
- }
-
- private static PyObject choice$14(PyFrame frame) {
- /* Choose a random element from a non-empty sequence. */
- return frame.getlocal(1).__getitem__(frame.getglobal("int").__call__(frame.getlocal(0).invoke("random")._mul(frame.getglobal("len").__call__(frame.getlocal(1)))));
- }
-
- private static PyObject shuffle$15(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* x, random=random.random -> shuffle list x in place; return None.
-
- Optional arg random is a 0-argument function returning a random
- float in [0.0, 1.0); by default, the standard random.random.
-
- Note that for even rather small len(x), the total number of
- permutations of x is larger than the period of most random number
- generators; this implies that "most" permutations of a long
- sequence can never be generated.
- */
- if (frame.getlocal(2)._is(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(2, frame.getlocal(0).__getattr__("random"));
- }
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("xrange").__call__(frame.getglobal("len").__call__(frame.getlocal(1))._sub(i$40), i$61, i$40.__neg__());
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(5, t$0$PyObject);
- frame.setlocal(4, frame.getlocal(3).__call__(frame.getlocal(2).__call__()._mul(frame.getlocal(5)._add(i$40))));
- t$0$PyObject__ = org.python.core.Py.unpackSequence(new PyTuple(new PyObject[] {frame.getlocal(1).__getitem__(frame.getlocal(4)), frame.getlocal(1).__getitem__(frame.getlocal(5))}), 2);
- frame.getlocal(1).__setitem__(frame.getlocal(5), t$0$PyObject__[0]);
- frame.getlocal(1).__setitem__(frame.getlocal(4), t$0$PyObject__[1]);
- }
- return Py.None;
- }
-
- private static PyObject uniform$16(PyFrame frame) {
- /* Get a random number in the range [a, b). */
- return frame.getlocal(1)._add(frame.getlocal(2)._sub(frame.getlocal(1))._mul(frame.getlocal(0).invoke("random")));
- }
-
- private static PyObject normalvariate$17(PyFrame frame) {
- frame.setlocal(5, frame.getlocal(0).__getattr__("random"));
- while (i$40.__nonzero__()) {
- frame.setlocal(4, frame.getlocal(5).__call__());
- frame.setlocal(3, frame.getlocal(5).__call__());
- frame.setlocal(7, frame.getglobal("NV_MAGICCONST")._mul(frame.getlocal(4)._sub(f$27))._div(frame.getlocal(3)));
- frame.setlocal(6, frame.getlocal(7)._mul(frame.getlocal(7))._div(f$33));
- if (frame.getlocal(6)._le(frame.getglobal("_log").__call__(frame.getlocal(3)).__neg__()).__nonzero__()) {
- break;
- }
- }
- return frame.getlocal(1)._add(frame.getlocal(7)._mul(frame.getlocal(2)));
- }
-
- private static PyObject lognormvariate$18(PyFrame frame) {
- return frame.getglobal("_exp").__call__(frame.getlocal(0).invoke("normalvariate", frame.getlocal(1), frame.getlocal(2)));
- }
-
- private static PyObject cunifvariate$19(PyFrame frame) {
- return frame.getlocal(1)._add(frame.getlocal(2)._mul(frame.getlocal(0).invoke("random")._sub(f$27)))._mod(frame.getglobal("_pi"));
- }
-
- private static PyObject expovariate$20(PyFrame frame) {
- frame.setlocal(3, frame.getlocal(0).__getattr__("random"));
- frame.setlocal(2, frame.getlocal(3).__call__());
- while (frame.getlocal(2)._le(f$24).__nonzero__()) {
- frame.setlocal(2, frame.getlocal(3).__call__());
- }
- return frame.getglobal("_log").__call__(frame.getlocal(2)).__neg__()._div(frame.getlocal(1));
- }
-
- private static PyObject vonmisesvariate$21(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- frame.setlocal(3, frame.getlocal(0).__getattr__("random"));
- if (frame.getlocal(2)._le(f$81).__nonzero__()) {
- return frame.getglobal("TWOPI")._mul(frame.getlocal(3).__call__());
- }
- frame.setlocal(13, f$36._add(frame.getglobal("_sqrt").__call__(f$36._add(f$33._mul(frame.getlocal(2))._mul(frame.getlocal(2))))));
- frame.setlocal(12, frame.getlocal(13)._sub(frame.getglobal("_sqrt").__call__(f$28._mul(frame.getlocal(13))))._div(f$28._mul(frame.getlocal(2))));
- frame.setlocal(6, f$36._add(frame.getlocal(12)._mul(frame.getlocal(12)))._div(f$28._mul(frame.getlocal(12))));
- while (i$40.__nonzero__()) {
- frame.setlocal(9, frame.getlocal(3).__call__());
- frame.setlocal(5, frame.getglobal("_cos").__call__(frame.getglobal("_pi")._mul(frame.getlocal(9))));
- frame.setlocal(10, f$36._add(frame.getlocal(6)._mul(frame.getlocal(5)))._div(frame.getlocal(6)._add(frame.getlocal(5))));
- frame.setlocal(11, frame.getlocal(2)._mul(frame.getlocal(6)._sub(frame.getlocal(10))));
- frame.setlocal(8, frame.getlocal(3).__call__());
- if (((t$0$PyObject = frame.getlocal(8)._ge(frame.getlocal(11)._mul(f$28._sub(frame.getlocal(11))))).__nonzero__() ? frame.getlocal(8)._gt(frame.getlocal(11)._mul(frame.getglobal("_exp").__call__(f$36._sub(frame.getlocal(11))))) : t$0$PyObject).__not__().__nonzero__()) {
- break;
- }
- }
- frame.setlocal(7, frame.getlocal(3).__call__());
- if (frame.getlocal(7)._gt(f$27).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(1)._mod(frame.getglobal("TWOPI"))._add(frame.getglobal("_acos").__call__(frame.getlocal(10))));
- }
- else {
- frame.setlocal(4, frame.getlocal(1)._mod(frame.getglobal("TWOPI"))._sub(frame.getglobal("_acos").__call__(frame.getlocal(10))));
- }
- return frame.getlocal(4);
- }
-
- private static PyObject gammavariate$22(PyFrame frame) {
- frame.setlocal(3, frame.getglobal("_sqrt").__call__(f$28._mul(frame.getlocal(1))._sub(f$36)));
- return frame.getlocal(2)._mul(frame.getlocal(0).invoke("stdgamma", new PyObject[] {frame.getlocal(1), frame.getlocal(3), frame.getlocal(1)._sub(frame.getglobal("LOG4")), frame.getlocal(1)._add(frame.getlocal(3))}));
- }
-
- private static PyObject stdgamma$23(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(5, frame.getlocal(0).__getattr__("random"));
- if (frame.getlocal(1)._le(f$82).__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$83);
- }
- if (frame.getlocal(1)._gt(f$36).__nonzero__()) {
- while (i$40.__nonzero__()) {
- frame.setlocal(13, frame.getlocal(5).__call__());
- frame.setlocal(12, frame.getlocal(5).__call__());
- frame.setlocal(8, frame.getglobal("_log").__call__(frame.getlocal(13)._div(f$36._sub(frame.getlocal(13))))._div(frame.getlocal(2)));
- frame.setlocal(7, frame.getlocal(1)._mul(frame.getglobal("_exp").__call__(frame.getlocal(8))));
- frame.setlocal(6, frame.getlocal(13)._mul(frame.getlocal(13))._mul(frame.getlocal(12)));
- frame.setlocal(10, frame.getlocal(3)._add(frame.getlocal(4)._mul(frame.getlocal(8)))._sub(frame.getlocal(7)));
- if (((t$0$PyObject = frame.getlocal(10)._add(frame.getglobal("SG_MAGICCONST"))._sub(f$37._mul(frame.getlocal(6)))._ge(f$82)).__nonzero__() ? t$0$PyObject : frame.getlocal(10)._ge(frame.getglobal("_log").__call__(frame.getlocal(6)))).__nonzero__()) {
- return frame.getlocal(7);
- }
- }
- }
- else if (frame.getlocal(1)._eq(f$36).__nonzero__()) {
- frame.setlocal(9, frame.getlocal(5).__call__());
- while (frame.getlocal(9)._le(f$24).__nonzero__()) {
- frame.setlocal(9, frame.getlocal(5).__call__());
- }
- return frame.getglobal("_log").__call__(frame.getlocal(9)).__neg__();
- }
- else {
- while (i$40.__nonzero__()) {
- frame.setlocal(9, frame.getlocal(5).__call__());
- frame.setlocal(14, frame.getglobal("_e")._add(frame.getlocal(1))._div(frame.getglobal("_e")));
- frame.setlocal(11, frame.getlocal(14)._mul(frame.getlocal(9)));
- if (frame.getlocal(11)._le(f$36).__nonzero__()) {
- frame.setlocal(7, frame.getglobal("pow").__call__(frame.getlocal(11), f$36._div(frame.getlocal(1))));
- }
- else {
- frame.setlocal(7, frame.getglobal("_log").__call__(frame.getlocal(14)._sub(frame.getlocal(11))._div(frame.getlocal(1))).__neg__());
- }
- frame.setlocal(13, frame.getlocal(5).__call__());
- if (((t$0$PyObject = ((t$1$PyObject = frame.getlocal(11)._le(f$36)).__nonzero__() ? frame.getlocal(13)._gt(frame.getglobal("_exp").__call__(frame.getlocal(7).__neg__())) : t$1$PyObject)).__nonzero__() ? t$0$PyObject : ((t$1$PyObject = frame.getlocal(11)._gt(i$40)).__nonzero__() ? frame.getlocal(13)._gt(frame.getglobal("pow").__call__(frame.getlocal(7), frame.getlocal(1)._sub(f$36))) : t$1$PyObject)).__not__().__nonzero__()) {
- break;
- }
- }
- return frame.getlocal(7);
- }
- return Py.None;
- }
-
- private static PyObject gauss$24(PyFrame frame) {
- frame.setlocal(4, frame.getlocal(0).__getattr__("random"));
- frame.setlocal(6, frame.getlocal(0).__getattr__("gauss_next"));
- frame.getlocal(0).__setattr__("gauss_next", frame.getglobal("None"));
- if (frame.getlocal(6)._is(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(4).__call__()._mul(frame.getglobal("TWOPI")));
- frame.setlocal(5, frame.getglobal("_sqrt").__call__(f$28.__neg__()._mul(frame.getglobal("_log").__call__(f$36._sub(frame.getlocal(4).__call__())))));
- frame.setlocal(6, frame.getglobal("_cos").__call__(frame.getlocal(3))._mul(frame.getlocal(5)));
- frame.getlocal(0).__setattr__("gauss_next", frame.getglobal("_sin").__call__(frame.getlocal(3))._mul(frame.getlocal(5)));
- }
- return frame.getlocal(1)._add(frame.getlocal(6)._mul(frame.getlocal(2)));
- }
-
- private static PyObject betavariate$25(PyFrame frame) {
- frame.setlocal(3, frame.getlocal(0).invoke("gammavariate", frame.getlocal(1), f$36));
- if (frame.getlocal(3)._eq(i$61).__nonzero__()) {
- return f$82;
- }
- else {
- return frame.getlocal(3)._div(frame.getlocal(3)._add(frame.getlocal(0).invoke("gammavariate", frame.getlocal(2), f$36)));
- }
- }
-
- private static PyObject paretovariate$26(PyFrame frame) {
- frame.setlocal(2, frame.getlocal(0).invoke("random"));
- return f$36._div(frame.getglobal("pow").__call__(frame.getlocal(2), f$36._div(frame.getlocal(1))));
- }
-
- private static PyObject weibullvariate$27(PyFrame frame) {
- frame.setlocal(3, frame.getlocal(0).invoke("random"));
- return frame.getlocal(1)._mul(frame.getglobal("pow").__call__(frame.getglobal("_log").__call__(frame.getlocal(3)).__neg__(), f$36._div(frame.getlocal(2))));
- }
-
- private static PyObject Random$28(PyFrame frame) {
- frame.setlocal("VERSION", i$40);
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$1___init__));
- frame.setlocal("seed", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$2_seed));
- frame.setlocal("random", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_random));
- frame.setlocal("getstate", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_getstate));
- frame.setlocal("setstate", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_setstate));
- frame.setlocal("jumpahead", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_jumpahead));
- frame.setlocal("_Random__whseed", new PyFunction(frame.f_globals, new PyObject[] {i$61, i$61, i$61}, c$7__Random__whseed));
- frame.setlocal("whseed", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$8_whseed));
- frame.setlocal("__getstate__", new PyFunction(frame.f_globals, new PyObject[] {}, c$9___getstate__));
- frame.setlocal("__setstate__", new PyFunction(frame.f_globals, new PyObject[] {}, c$10___setstate__));
- frame.setlocal("randrange", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), i$40, frame.getname("int"), frame.getname("None")}, c$11_randrange));
- frame.setlocal("randint", new PyFunction(frame.f_globals, new PyObject[] {}, c$12_randint));
- frame.setlocal("choice", new PyFunction(frame.f_globals, new PyObject[] {}, c$13_choice));
- frame.setlocal("shuffle", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), frame.getname("int")}, c$14_shuffle));
- frame.setlocal("uniform", new PyFunction(frame.f_globals, new PyObject[] {}, c$15_uniform));
- frame.setlocal("normalvariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$16_normalvariate));
- frame.setlocal("lognormvariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$17_lognormvariate));
- frame.setlocal("cunifvariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$18_cunifvariate));
- frame.setlocal("expovariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$19_expovariate));
- frame.setlocal("vonmisesvariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$20_vonmisesvariate));
- frame.setlocal("gammavariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$21_gammavariate));
- frame.setlocal("stdgamma", new PyFunction(frame.f_globals, new PyObject[] {}, c$22_stdgamma));
- frame.setlocal("gauss", new PyFunction(frame.f_globals, new PyObject[] {}, c$23_gauss));
- frame.setlocal("betavariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$24_betavariate));
- frame.setlocal("paretovariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$25_paretovariate));
- frame.setlocal("weibullvariate", new PyFunction(frame.f_globals, new PyObject[] {}, c$26_weibullvariate));
- return frame.getf_locals();
- }
-
- private static PyObject _test_generator$29(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(6, org.python.core.imp.importOne("time", frame));
- Py.printComma(frame.getlocal(0));
- Py.printComma(s$84);
- Py.println(frame.getlocal(1));
- frame.setlocal(3, frame.getglobal("compile").__call__(frame.getlocal(1), frame.getlocal(1), s$85));
- frame.setlocal(4, f$82);
- frame.setlocal(13, f$82);
- frame.setlocal(2, f$86);
- frame.setlocal(5, f$86.__neg__());
- frame.setlocal(9, frame.getlocal(6).__getattr__("time").__call__());
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("range").__call__(frame.getlocal(0));
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(11, t$0$PyObject);
- frame.setlocal(7, frame.getglobal("eval").__call__(frame.getlocal(3)));
- frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(7)));
- frame.setlocal(13, frame.getlocal(13)._add(frame.getlocal(7)._mul(frame.getlocal(7))));
- frame.setlocal(2, frame.getglobal("min").__call__(frame.getlocal(7), frame.getlocal(2)));
- frame.setlocal(5, frame.getglobal("max").__call__(frame.getlocal(7), frame.getlocal(5)));
- }
- frame.setlocal(8, frame.getlocal(6).__getattr__("time").__call__());
- Py.printComma(frame.getglobal("round").__call__(frame.getlocal(8)._sub(frame.getlocal(9)), i$44));
- Py.printComma(s$87);
- frame.setlocal(10, frame.getlocal(4)._div(frame.getlocal(0)));
- frame.setlocal(12, frame.getglobal("_sqrt").__call__(frame.getlocal(13)._div(frame.getlocal(0))._sub(frame.getlocal(10)._mul(frame.getlocal(10)))));
- Py.println(s$88._mod(new PyTuple(new PyObject[] {frame.getlocal(10), frame.getlocal(12), frame.getlocal(2), frame.getlocal(5)})));
- return Py.None;
- }
-
- private static PyObject _test$30(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- Py.printComma(s$89);
- Py.println(frame.getglobal("TWOPI"));
- Py.printComma(s$90);
- Py.println(frame.getglobal("LOG4"));
- Py.printComma(s$91);
- Py.println(frame.getglobal("NV_MAGICCONST"));
- Py.printComma(s$92);
- Py.println(frame.getglobal("SG_MAGICCONST"));
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$93);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$94);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$95);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$96);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$97);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$98);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$99);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$100);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$101);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$102);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$103);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$104);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$105);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$106);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$107);
- frame.getglobal("_test_generator").__call__(frame.getlocal(0), s$108);
- frame.setlocal(4, frame.getglobal("getstate").__call__());
- frame.getglobal("jumpahead").__call__(frame.getlocal(0));
- frame.setlocal(2, frame.getglobal("random").__call__());
- frame.getglobal("setstate").__call__(frame.getlocal(4));
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("range").__call__(frame.getlocal(0));
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(3, t$0$PyObject);
- frame.getglobal("random").__call__();
- }
- frame.setlocal(1, frame.getglobal("random").__call__());
- if (frame.getlocal(2)._ne(frame.getlocal(1)).__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError").__call__(s$109._add(new PyTuple(new PyObject[] {frame.getlocal(0), frame.getlocal(2), frame.getlocal(1)}).__repr__())));
- }
- return Py.None;
- }
-
- private static PyObject main$31(PyFrame frame) {
- frame.setglobal("__file__", s$112);
-
- PyObject[] imp_accu;
- // Code
- /* Random variable generators.
-
- integers
- --------
- uniform within range
-
- sequences
- ---------
- pick random element
- generate random permutation
-
- distributions on the real line:
- ------------------------------
- uniform
- normal (Gaussian)
- lognormal
- negative exponential
- gamma
- beta
-
- distributions on the circle (angles 0 to 2pi)
- ---------------------------------------------
- circular uniform
- von Mises
-
- Translated from anonymously contributed C/C++ source.
-
- Multi-threading note: the random number generator used here is not thread-
- safe; it is possible that two calls return the same random value. However,
- you can instantiate a different instance of Random() in each thread to get
- generators that don't share state, then use .setstate() and .jumpahead() to
- move the generators to disjoint segments of the full period. For example,
-
- def create_generators(num, delta, firstseed=None):
- """Return list of num distinct generators.
- Each generator has its own unique segment of delta elements from
- Random.random()'s full period.
- Seed the first generator with optional arg firstseed (default is
- None, to seed from current time).
- """
-
- from random import Random
- g = Random(firstseed)
- result = [g]
- for i in range(num - 1):
- laststate = g.getstate()
- g = Random()
- g.setstate(laststate)
- g.jumpahead(delta)
- result.append(g)
- return result
-
- gens = create_generators(10, 1000000)
-
- That creates 10 distinct generators, which can be passed out to 10 distinct
- threads. The generators don't share state so can be called safely in
- parallel. So long as no thread calls its g.random() more than a million
- times (the second argument to create_generators), the sequences seen by
- each thread will not overlap.
-
- The period of the underlying Wichmann-Hill generator is 6,953,607,871,644,
- and that limits how far this technique can be pushed.
-
- Just for fun, note that since we know the period, .jumpahead() can also be
- used to "move backward in time":
-
- >>> g = Random(42) # arbitrary
- >>> g.random()
- 0.25420336316883324
- >>> g.jumpahead(6953607871644L - 1) # move *back* one
- >>> g.random()
- 0.25420336316883324
- */
- imp_accu = org.python.core.imp.importFrom("math", new String[] {"log", "exp", "pi", "e"}, frame);
- frame.setlocal("_log", imp_accu[0]);
- frame.setlocal("_exp", imp_accu[1]);
- frame.setlocal("_pi", imp_accu[2]);
- frame.setlocal("_e", imp_accu[3]);
- imp_accu = null;
- imp_accu = org.python.core.imp.importFrom("math", new String[] {"sqrt", "acos", "cos", "sin"}, frame);
- frame.setlocal("_sqrt", imp_accu[0]);
- frame.setlocal("_acos", imp_accu[1]);
- frame.setlocal("_cos", imp_accu[2]);
- frame.setlocal("_sin", imp_accu[3]);
- imp_accu = null;
- frame.setlocal("__all__", new PyList(new PyObject[] {s$1, s$2, s$3, s$4, s$5, s$6, s$7, s$8, s$9, s$10, s$11, s$12, s$13, s$14, s$15, s$16, s$17, s$18, s$19, s$20, s$21, s$22, s$23}));
- frame.setlocal("_verify", new PyFunction(frame.f_globals, new PyObject[] {}, c$0__verify));
- frame.setlocal("NV_MAGICCONST", i$26._mul(frame.getname("_exp").__call__(f$27.__neg__()))._div(frame.getname("_sqrt").__call__(f$28)));
- frame.getname("_verify").__call__(s$29, frame.getname("NV_MAGICCONST"), f$30);
- frame.setlocal("TWOPI", f$28._mul(frame.getname("_pi")));
- frame.getname("_verify").__call__(s$31, frame.getname("TWOPI"), f$32);
- frame.setlocal("LOG4", frame.getname("_log").__call__(f$33));
- frame.getname("_verify").__call__(s$34, frame.getname("LOG4"), f$35);
- frame.setlocal("SG_MAGICCONST", f$36._add(frame.getname("_log").__call__(f$37)));
- frame.getname("_verify").__call__(s$38, frame.getname("SG_MAGICCONST"), f$39);
- frame.dellocal("_verify");
- frame.setlocal("Random", Py.makeClass("Random", new PyObject[] {}, c$27_Random, null));
- frame.setlocal("_test_generator", new PyFunction(frame.f_globals, new PyObject[] {}, c$28__test_generator));
- frame.setlocal("_test", new PyFunction(frame.f_globals, new PyObject[] {i$110}, c$29__test));
- frame.setlocal("_inst", frame.getname("Random").__call__());
- frame.setlocal("seed", frame.getname("_inst").__getattr__("seed"));
- frame.setlocal("random", frame.getname("_inst").__getattr__("random"));
- frame.setlocal("uniform", frame.getname("_inst").__getattr__("uniform"));
- frame.setlocal("randint", frame.getname("_inst").__getattr__("randint"));
- frame.setlocal("choice", frame.getname("_inst").__getattr__("choice"));
- frame.setlocal("randrange", frame.getname("_inst").__getattr__("randrange"));
- frame.setlocal("shuffle", frame.getname("_inst").__getattr__("shuffle"));
- frame.setlocal("normalvariate", frame.getname("_inst").__getattr__("normalvariate"));
- frame.setlocal("lognormvariate", frame.getname("_inst").__getattr__("lognormvariate"));
- frame.setlocal("cunifvariate", frame.getname("_inst").__getattr__("cunifvariate"));
- frame.setlocal("expovariate", frame.getname("_inst").__getattr__("expovariate"));
- frame.setlocal("vonmisesvariate", frame.getname("_inst").__getattr__("vonmisesvariate"));
- frame.setlocal("gammavariate", frame.getname("_inst").__getattr__("gammavariate"));
- frame.setlocal("stdgamma", frame.getname("_inst").__getattr__("stdgamma"));
- frame.setlocal("gauss", frame.getname("_inst").__getattr__("gauss"));
- frame.setlocal("betavariate", frame.getname("_inst").__getattr__("betavariate"));
- frame.setlocal("paretovariate", frame.getname("_inst").__getattr__("paretovariate"));
- frame.setlocal("weibullvariate", frame.getname("_inst").__getattr__("weibullvariate"));
- frame.setlocal("getstate", frame.getname("_inst").__getattr__("getstate"));
- frame.setlocal("setstate", frame.getname("_inst").__getattr__("setstate"));
- frame.setlocal("jumpahead", frame.getname("_inst").__getattr__("jumpahead"));
- frame.setlocal("whseed", frame.getname("_inst").__getattr__("whseed"));
- if (frame.getname("__name__")._eq(s$111).__nonzero__()) {
- frame.getname("_test").__call__();
- }
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("random"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "random";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(random._PyInner.class, newargs, random.jpy$packages, random.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class re extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject s$16;
- private static PyObject s$17;
- private static PyObject s$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyObject s$24;
- private static PyFunctionTable funcTable;
- private static PyCode c$0_main;
- private static void initConstants() {
- s$0 = Py.newString("match");
- s$1 = Py.newString("search");
- s$2 = Py.newString("sub");
- s$3 = Py.newString("subn");
- s$4 = Py.newString("split");
- s$5 = Py.newString("findall");
- s$6 = Py.newString("compile");
- s$7 = Py.newString("purge");
- s$8 = Py.newString("template");
- s$9 = Py.newString("escape");
- s$10 = Py.newString("I");
- s$11 = Py.newString("L");
- s$12 = Py.newString("M");
- s$13 = Py.newString("S");
- s$14 = Py.newString("X");
- s$15 = Py.newString("U");
- s$16 = Py.newString("IGNORECASE");
- s$17 = Py.newString("LOCALE");
- s$18 = Py.newString("MULTILINE");
- s$19 = Py.newString("DOTALL");
- s$20 = Py.newString("VERBOSE");
- s$21 = Py.newString("UNICODE");
- s$22 = Py.newString("error");
- s$23 = Py.newString("re");
- s$24 = Py.newString("/usr/share/jython/Lib/re.py");
- funcTable = new _PyInner();
- c$0_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/re.py", "main", false, false, funcTable, 0, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$0_main == null) _PyInner.initConstants();
- return c$0_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.main$1(frame);
- default:
- return null;
- }
- }
-
- private static PyObject main$1(PyFrame frame) {
- frame.setglobal("__file__", s$24);
-
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal("__all__", new PyList(new PyObject[] {s$0, s$1, s$2, s$3, s$4, s$5, s$6, s$7, s$8, s$9, s$10, s$11, s$12, s$13, s$14, s$15, s$16, s$17, s$18, s$19, s$20, s$21, s$22}));
- frame.setlocal("sre", org.python.core.imp.importOne("sre", frame));
- frame.setlocal("sys", org.python.core.imp.importOne("sys", frame));
- frame.setlocal("module", frame.getname("sys").__getattr__("modules").__getitem__(s$23));
- t$0$int = 0;
- t$1$PyObject = frame.getname("__all__");
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal("name", t$0$PyObject);
- frame.getname("setattr").__call__(frame.getname("module"), frame.getname("name"), frame.getname("getattr").__call__(frame.getname("sre"), frame.getname("name")));
- }
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("re"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "re";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(re._PyInner.class, newargs, re.jpy$packages, re.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class repr extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject i$3;
- private static PyObject i$4;
- private static PyObject i$5;
- private static PyObject i$6;
- private static PyObject i$7;
- private static PyObject i$8;
- private static PyObject i$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject i$13;
- private static PyObject i$14;
- private static PyObject s$15;
- private static PyObject s$16;
- private static PyObject s$17;
- private static PyObject s$18;
- private static PyObject s$19;
- private static PyObject i$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyObject s$24;
- private static PyObject s$25;
- private static PyObject s$26;
- private static PyObject s$27;
- private static PyObject s$28;
- private static PyObject s$29;
- private static PyObject s$30;
- private static PyObject s$31;
- private static PyObject s$32;
- private static PyObject s$33;
- private static PyObject s$34;
- private static PyObject s$35;
- private static PyObject s$36;
- private static PyObject s$37;
- private static PyFunctionTable funcTable;
- private static PyCode c$0___init__;
- private static PyCode c$1_repr;
- private static PyCode c$2_repr1;
- private static PyCode c$3_repr_tuple;
- private static PyCode c$4_repr_list;
- private static PyCode c$5_repr_dictionary;
- private static PyCode c$6_repr_string;
- private static PyCode c$7_repr_long_int;
- private static PyCode c$8_repr_instance;
- private static PyCode c$9_Repr;
- private static PyCode c$10_main;
- private static void initConstants() {
- s$0 = Py.newString("Redo the `...` (representation) but with limits on most sizes.");
- s$1 = Py.newString("Repr");
- s$2 = Py.newString("repr");
- i$3 = Py.newInteger(6);
- i$4 = Py.newInteger(4);
- i$5 = Py.newInteger(30);
- i$6 = Py.newInteger(40);
- i$7 = Py.newInteger(20);
- i$8 = Py.newInteger(7);
- i$9 = Py.newInteger(2);
- s$10 = Py.newString(" ");
- s$11 = Py.newString("_");
- s$12 = Py.newString("repr_");
- i$13 = Py.newInteger(0);
- i$14 = Py.newInteger(3);
- s$15 = Py.newString("...");
- s$16 = Py.newString("()");
- s$17 = Py.newString("(...)");
- s$18 = Py.newString("");
- s$19 = Py.newString(", ");
- i$20 = Py.newInteger(1);
- s$21 = Py.newString(", ...");
- s$22 = Py.newString(",");
- s$23 = Py.newString("(");
- s$24 = Py.newString(")");
- s$25 = Py.newString("[]");
- s$26 = Py.newString("[...]");
- s$27 = Py.newString("[");
- s$28 = Py.newString("]");
- s$29 = Py.newString("{}");
- s$30 = Py.newString("{...}");
- s$31 = Py.newString(": ");
- s$32 = Py.newString("{");
- s$33 = Py.newString("}");
- s$34 = Py.newString("<");
- s$35 = Py.newString(" instance at ");
- s$36 = Py.newString(">");
- s$37 = Py.newString("/usr/share/jython/Lib-cpython/repr.py");
- funcTable = new _PyInner();
- c$0___init__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/repr.py", "__init__", false, false, funcTable, 0, null, null, 0, 1);
- c$1_repr = Py.newCode(2, new String[] {"self", "x"}, "/usr/share/jython/Lib-cpython/repr.py", "repr", false, false, funcTable, 1, null, null, 0, 1);
- c$2_repr1 = Py.newCode(3, new String[] {"self", "x", "level", "j", "parts", "i", "typename", "s"}, "/usr/share/jython/Lib-cpython/repr.py", "repr1", false, false, funcTable, 2, null, null, 0, 1);
- c$3_repr_tuple = Py.newCode(3, new String[] {"self", "x", "level", "n", "i", "s"}, "/usr/share/jython/Lib-cpython/repr.py", "repr_tuple", false, false, funcTable, 3, null, null, 0, 1);
- c$4_repr_list = Py.newCode(3, new String[] {"self", "x", "level", "n", "i", "s"}, "/usr/share/jython/Lib-cpython/repr.py", "repr_list", false, false, funcTable, 4, null, null, 0, 1);
- c$5_repr_dictionary = Py.newCode(3, new String[] {"self", "x", "level", "n", "i", "key", "keys", "s"}, "/usr/share/jython/Lib-cpython/repr.py", "repr_dictionary", false, false, funcTable, 5, null, null, 0, 1);
- c$6_repr_string = Py.newCode(3, new String[] {"self", "x", "level", "j", "i", "s"}, "/usr/share/jython/Lib-cpython/repr.py", "repr_string", false, false, funcTable, 6, null, null, 0, 1);
- c$7_repr_long_int = Py.newCode(3, new String[] {"self", "x", "level", "j", "i", "s"}, "/usr/share/jython/Lib-cpython/repr.py", "repr_long_int", false, false, funcTable, 7, null, null, 0, 1);
- c$8_repr_instance = Py.newCode(3, new String[] {"self", "x", "level", "j", "i", "s"}, "/usr/share/jython/Lib-cpython/repr.py", "repr_instance", false, false, funcTable, 8, null, null, 0, 1);
- c$9_Repr = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/repr.py", "Repr", false, false, funcTable, 9, null, null, 0, 0);
- c$10_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/repr.py", "main", false, false, funcTable, 10, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$10_main == null) _PyInner.initConstants();
- return c$10_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.__init__$1(frame);
- case 1:
- return _PyInner.repr$2(frame);
- case 2:
- return _PyInner.repr1$3(frame);
- case 3:
- return _PyInner.repr_tuple$4(frame);
- case 4:
- return _PyInner.repr_list$5(frame);
- case 5:
- return _PyInner.repr_dictionary$6(frame);
- case 6:
- return _PyInner.repr_string$7(frame);
- case 7:
- return _PyInner.repr_long_int$8(frame);
- case 8:
- return _PyInner.repr_instance$9(frame);
- case 9:
- return _PyInner.Repr$10(frame);
- case 10:
- return _PyInner.main$11(frame);
- default:
- return null;
- }
- }
-
- private static PyObject __init__$1(PyFrame frame) {
- frame.getlocal(0).__setattr__("maxlevel", i$3);
- frame.getlocal(0).__setattr__("maxtuple", i$3);
- frame.getlocal(0).__setattr__("maxlist", i$3);
- frame.getlocal(0).__setattr__("maxdict", i$4);
- frame.getlocal(0).__setattr__("maxstring", i$5);
- frame.getlocal(0).__setattr__("maxlong", i$6);
- frame.getlocal(0).__setattr__("maxother", i$7);
- return Py.None;
- }
-
- private static PyObject repr$2(PyFrame frame) {
- return frame.getlocal(0).invoke("repr1", frame.getlocal(1), frame.getlocal(0).__getattr__("maxlevel"));
- }
-
- private static PyObject repr1$3(PyFrame frame) {
- frame.setlocal(6, frame.getglobal("type").__call__(frame.getlocal(1)).__repr__().__getslice__(i$8, i$9.__neg__(), null));
- if (s$10._in(frame.getlocal(6)).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(6).invoke("split"));
- frame.setlocal(6, s$11.invoke("join", frame.getlocal(4)));
- }
- if (frame.getglobal("hasattr").__call__(frame.getlocal(0), s$12._add(frame.getlocal(6))).__nonzero__()) {
- return frame.getglobal("getattr").__call__(frame.getlocal(0), s$12._add(frame.getlocal(6))).__call__(frame.getlocal(1), frame.getlocal(2));
- }
- else {
- frame.setlocal(7, frame.getlocal(1).__repr__());
- if (frame.getglobal("len").__call__(frame.getlocal(7))._gt(frame.getlocal(0).__getattr__("maxother")).__nonzero__()) {
- frame.setlocal(5, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxother")._sub(i$14)._div(i$9)));
- frame.setlocal(3, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxother")._sub(i$14)._sub(frame.getlocal(5))));
- frame.setlocal(7, frame.getlocal(7).__getslice__(null, frame.getlocal(5), null)._add(s$15)._add(frame.getlocal(7).__getslice__(frame.getglobal("len").__call__(frame.getlocal(7))._sub(frame.getlocal(3)), null, null)));
- }
- return frame.getlocal(7);
- }
- }
-
- private static PyObject repr_tuple$4(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(3, frame.getglobal("len").__call__(frame.getlocal(1)));
- if (frame.getlocal(3)._eq(i$13).__nonzero__()) {
- return s$16;
- }
- if (frame.getlocal(2)._le(i$13).__nonzero__()) {
- return s$17;
- }
- frame.setlocal(5, s$18);
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("range").__call__(frame.getglobal("min").__call__(frame.getlocal(3), frame.getlocal(0).__getattr__("maxtuple")));
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(4, t$0$PyObject);
- if (frame.getlocal(5).__nonzero__()) {
- frame.setlocal(5, frame.getlocal(5)._add(s$19));
- }
- frame.setlocal(5, frame.getlocal(5)._add(frame.getlocal(0).invoke("repr1", frame.getlocal(1).__getitem__(frame.getlocal(4)), frame.getlocal(2)._sub(i$20))));
- }
- if (frame.getlocal(3)._gt(frame.getlocal(0).__getattr__("maxtuple")).__nonzero__()) {
- frame.setlocal(5, frame.getlocal(5)._add(s$21));
- }
- else if (frame.getlocal(3)._eq(i$20).__nonzero__()) {
- frame.setlocal(5, frame.getlocal(5)._add(s$22));
- }
- return s$23._add(frame.getlocal(5))._add(s$24);
- }
-
- private static PyObject repr_list$5(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(3, frame.getglobal("len").__call__(frame.getlocal(1)));
- if (frame.getlocal(3)._eq(i$13).__nonzero__()) {
- return s$25;
- }
- if (frame.getlocal(2)._le(i$13).__nonzero__()) {
- return s$26;
- }
- frame.setlocal(5, s$18);
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("range").__call__(frame.getglobal("min").__call__(frame.getlocal(3), frame.getlocal(0).__getattr__("maxlist")));
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(4, t$0$PyObject);
- if (frame.getlocal(5).__nonzero__()) {
- frame.setlocal(5, frame.getlocal(5)._add(s$19));
- }
- frame.setlocal(5, frame.getlocal(5)._add(frame.getlocal(0).invoke("repr1", frame.getlocal(1).__getitem__(frame.getlocal(4)), frame.getlocal(2)._sub(i$20))));
- }
- if (frame.getlocal(3)._gt(frame.getlocal(0).__getattr__("maxlist")).__nonzero__()) {
- frame.setlocal(5, frame.getlocal(5)._add(s$21));
- }
- return s$27._add(frame.getlocal(5))._add(s$28);
- }
-
- private static PyObject repr_dictionary$6(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(3, frame.getglobal("len").__call__(frame.getlocal(1)));
- if (frame.getlocal(3)._eq(i$13).__nonzero__()) {
- return s$29;
- }
- if (frame.getlocal(2)._le(i$13).__nonzero__()) {
- return s$30;
- }
- frame.setlocal(7, s$18);
- frame.setlocal(6, frame.getlocal(1).invoke("keys"));
- frame.getlocal(6).invoke("sort");
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("range").__call__(frame.getglobal("min").__call__(frame.getlocal(3), frame.getlocal(0).__getattr__("maxdict")));
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(4, t$0$PyObject);
- if (frame.getlocal(7).__nonzero__()) {
- frame.setlocal(7, frame.getlocal(7)._add(s$19));
- }
- frame.setlocal(5, frame.getlocal(6).__getitem__(frame.getlocal(4)));
- frame.setlocal(7, frame.getlocal(7)._add(frame.getlocal(0).invoke("repr1", frame.getlocal(5), frame.getlocal(2)._sub(i$20))));
- frame.setlocal(7, frame.getlocal(7)._add(s$31)._add(frame.getlocal(0).invoke("repr1", frame.getlocal(1).__getitem__(frame.getlocal(5)), frame.getlocal(2)._sub(i$20))));
- }
- if (frame.getlocal(3)._gt(frame.getlocal(0).__getattr__("maxdict")).__nonzero__()) {
- frame.setlocal(7, frame.getlocal(7)._add(s$21));
- }
- return s$32._add(frame.getlocal(7))._add(s$33);
- }
-
- private static PyObject repr_string$7(PyFrame frame) {
- frame.setlocal(5, frame.getlocal(1).__getslice__(null, frame.getlocal(0).__getattr__("maxstring"), null).__repr__());
- if (frame.getglobal("len").__call__(frame.getlocal(5))._gt(frame.getlocal(0).__getattr__("maxstring")).__nonzero__()) {
- frame.setlocal(4, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxstring")._sub(i$14)._div(i$9)));
- frame.setlocal(3, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxstring")._sub(i$14)._sub(frame.getlocal(4))));
- frame.setlocal(5, frame.getlocal(1).__getslice__(null, frame.getlocal(4), null)._add(frame.getlocal(1).__getslice__(frame.getglobal("len").__call__(frame.getlocal(1))._sub(frame.getlocal(3)), null, null)).__repr__());
- frame.setlocal(5, frame.getlocal(5).__getslice__(null, frame.getlocal(4), null)._add(s$15)._add(frame.getlocal(5).__getslice__(frame.getglobal("len").__call__(frame.getlocal(5))._sub(frame.getlocal(3)), null, null)));
- }
- return frame.getlocal(5);
- }
-
- private static PyObject repr_long_int$8(PyFrame frame) {
- frame.setlocal(5, frame.getlocal(1).__repr__());
- if (frame.getglobal("len").__call__(frame.getlocal(5))._gt(frame.getlocal(0).__getattr__("maxlong")).__nonzero__()) {
- frame.setlocal(4, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxlong")._sub(i$14)._div(i$9)));
- frame.setlocal(3, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxlong")._sub(i$14)._sub(frame.getlocal(4))));
- frame.setlocal(5, frame.getlocal(5).__getslice__(null, frame.getlocal(4), null)._add(s$15)._add(frame.getlocal(5).__getslice__(frame.getglobal("len").__call__(frame.getlocal(5))._sub(frame.getlocal(3)), null, null)));
- }
- return frame.getlocal(5);
- }
-
- private static PyObject repr_instance$9(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- try {
- frame.setlocal(5, frame.getlocal(1).__repr__());
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- return s$34._add(frame.getlocal(1).__getattr__("__class__").__getattr__("__name__"))._add(s$35)._add(frame.getglobal("hex").__call__(frame.getglobal("id").__call__(frame.getlocal(1))).__getslice__(i$9, null, null))._add(s$36);
- }
- if (frame.getglobal("len").__call__(frame.getlocal(5))._gt(frame.getlocal(0).__getattr__("maxstring")).__nonzero__()) {
- frame.setlocal(4, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxstring")._sub(i$14)._div(i$9)));
- frame.setlocal(3, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxstring")._sub(i$14)._sub(frame.getlocal(4))));
- frame.setlocal(5, frame.getlocal(5).__getslice__(null, frame.getlocal(4), null)._add(s$15)._add(frame.getlocal(5).__getslice__(frame.getglobal("len").__call__(frame.getlocal(5))._sub(frame.getlocal(3)), null, null)));
- }
- return frame.getlocal(5);
- }
-
- private static PyObject Repr$10(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$0___init__));
- frame.setlocal("repr", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_repr));
- frame.setlocal("repr1", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_repr1));
- frame.setlocal("repr_tuple", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_repr_tuple));
- frame.setlocal("repr_list", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_repr_list));
- frame.setlocal("repr_dictionary", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_repr_dictionary));
- frame.setlocal("repr_string", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_repr_string));
- frame.setlocal("repr_long_int", new PyFunction(frame.f_globals, new PyObject[] {}, c$7_repr_long_int));
- frame.setlocal("repr_instance", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_repr_instance));
- return frame.getf_locals();
- }
-
- private static PyObject main$11(PyFrame frame) {
- frame.setglobal("__file__", s$37);
-
- /* Redo the `...` (representation) but with limits on most sizes. */
- frame.setlocal("__all__", new PyList(new PyObject[] {s$1, s$2}));
- frame.setlocal("Repr", Py.makeClass("Repr", new PyObject[] {}, c$9_Repr, null));
- frame.setlocal("aRepr", frame.getname("Repr").__call__());
- frame.setlocal("repr", frame.getname("aRepr").__getattr__("repr"));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("repr"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "repr";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(repr._PyInner.class, newargs, repr.jpy$packages, repr.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class server extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject i$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject i$8;
- private static PyObject i$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject s$16;
- private static PyObject s$17;
- private static PyObject s$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyObject s$24;
- private static PyObject s$25;
- private static PyObject s$26;
- private static PyObject s$27;
- private static PyObject s$28;
- private static PyObject s$29;
- private static PyObject s$30;
- private static PyObject s$31;
- private static PyObject s$32;
- private static PyObject s$33;
- private static PyObject s$34;
- private static PyObject s$35;
- private static PyObject i$36;
- private static PyObject s$37;
- private static PyObject s$38;
- private static PyObject s$39;
- private static PyObject s$40;
- private static PyObject s$41;
- private static PyObject s$42;
- private static PyObject s$43;
- private static PyObject s$44;
- private static PyObject s$45;
- private static PyObject s$46;
- private static PyObject s$47;
- private static PyObject s$48;
- private static PyObject s$49;
- private static PyObject s$50;
- private static PyObject s$51;
- private static PyObject s$52;
- private static PyObject s$53;
- private static PyObject s$54;
- private static PyObject s$55;
- private static PyObject s$56;
- private static PyObject s$57;
- private static PyObject s$58;
- private static PyObject s$59;
- private static PyObject s$60;
- private static PyObject s$61;
- private static PyObject s$62;
- private static PyObject s$63;
- private static PyObject s$64;
- private static PyObject s$65;
- private static PyObject s$66;
- private static PyObject s$67;
- private static PyObject s$68;
- private static PyObject s$69;
- private static PyObject s$70;
- private static PyObject s$71;
- private static PyObject s$72;
- private static PyObject s$73;
- private static PyObject s$74;
- private static PyObject s$75;
- private static PyObject s$76;
- private static PyObject s$77;
- private static PyObject s$78;
- private static PyObject s$79;
- private static PyObject s$80;
- private static PyObject s$81;
- private static PyObject s$82;
- private static PyObject s$83;
- private static PyObject s$84;
- private static PyObject s$85;
- private static PyObject s$86;
- private static PyObject s$87;
- private static PyObject s$88;
- private static PyObject s$89;
- private static PyObject s$90;
- private static PyObject s$91;
- private static PyObject s$92;
- private static PyObject s$93;
- private static PyObject s$94;
- private static PyObject s$95;
- private static PyObject s$96;
- private static PyObject s$97;
- private static PyObject s$98;
- private static PyObject s$99;
- private static PyObject s$100;
- private static PyObject s$101;
- private static PyObject s$102;
- private static PyObject s$103;
- private static PyObject s$104;
- private static PyObject s$105;
- private static PyObject s$106;
- private static PyObject s$107;
- private static PyObject s$108;
- private static PyObject s$109;
- private static PyObject i$110;
- private static PyObject s$111;
- private static PyObject s$112;
- private static PyObject i$113;
- private static PyObject s$114;
- private static PyObject s$115;
- private static PyObject s$116;
- private static PyObject s$117;
- private static PyObject s$118;
- private static PyObject s$119;
- private static PyObject s$120;
- private static PyObject s$121;
- private static PyObject s$122;
- private static PyObject s$123;
- private static PyObject s$124;
- private static PyObject s$125;
- private static PyObject s$126;
- private static PyObject s$127;
- private static PyObject s$128;
- private static PyObject s$129;
- private static PyObject s$130;
- private static PyObject s$131;
- private static PyObject s$132;
- private static PyObject s$133;
- private static PyFunctionTable funcTable;
- private static PyCode c$0_register;
- private static PyCode c$1_update;
- private static PyCode c$2_remove;
- private static PyCode c$3_lookup;
- private static PyCode c$4_list;
- private static PyCode c$5_getCredential;
- private static PyCode c$6_getAccounting;
- private static PyCode c$7___init__;
- private static PyCode c$8_construct_hierarchy;
- private static PyCode c$9_sec_init;
- private static PyCode c$10_save_state;
- private static PyCode c$11_GENIServer;
- private static PyCode c$12_handle;
- private static PyCode c$13_handle_connection;
- private static PyCode c$14_main;
- private static PyCode c$15_main;
- private static void initConstants() {
- s$0 = Py.newString("127.0.0.1");
- i$1 = Py.newInteger(8002);
- s$2 = Py.newString("interface_tree_sr");
- s$3 = Py.newString("interface_tree_cr");
- s$4 = Py.newString("../");
- s$5 = Py.newString("../util");
- s$6 = Py.newString("../util/sec");
- s$7 = Py.newString("../PLCAPI/trunk");
- i$8 = Py.newInteger(0);
- i$9 = Py.newInteger(1);
- s$10 = Py.newString("type");
- s$11 = Py.newString("g_params");
- s$12 = Py.newString("Record ");
- s$13 = Py.newString("hrn");
- s$14 = Py.newString(" already exists.\012");
- s$15 = Py.newString("SA");
- s$16 = Py.newString("MA");
- s$17 = Py.newString("local");
- s$18 = Py.newString("wrapperurl");
- s$19 = Py.newString("");
- s$20 = Py.newString("slc");
- s$21 = Py.newString("comp");
- s$22 = Py.newString("(2-0)(4-0)(6-0)(7-0)(8-0)(9-0)(0-1)(1-1)(2-1)(3-1)(4-1)(5-1)(6-1)(7-1)(8-1)(9-1)");
- s$23 = Py.newString("#0:reg:");
- s$24 = Py.newString(":");
- s$25 = Py.newString("#1:reg:");
- s$26 = Py.newString("rights");
- s$27 = Py.newString("p_params");
- s$28 = Py.newString("site_id");
- s$29 = Py.newString("SELECT site_id FROM sites WHERE login_base = '");
- s$30 = Py.newString("';");
- s$31 = Py.newString("login_base");
- s$32 = Py.newString("SELECT * FROM sites WHERE login_base = '");
- s$33 = Py.newString("'");
- s$34 = Py.newString("Site login_base '");
- s$35 = Py.newString(", already exists in the system. Try another name.\012");
- i$36 = Py.newInteger(10);
- s$37 = Py.newString("slice");
- s$38 = Py.newString("component");
- s$39 = Py.newString("/");
- s$40 = Py.newString(".");
- s$41 = Py.newString("rm -rf ");
- s$42 = Py.newString(".cert");
- s$43 = Py.newString("pubkey");
- s$44 = Py.newString("pointer");
- s$45 = Py.newString("INSERT");
- s$46 = Py.newString("DROP TABLE IF EXISTS ");
- s$47 = Py.newString("CREATE TABLE ");
- s$48 = Py.newString(" ( hrn text, type text, uuid text, userlist text, rights text, description text, pubkey text, wrapperURL text, disabled text, pointer integer);");
- s$49 = Py.newString("db_info");
- s$50 = Py.newString("key_info");
- s$51 = Py.newString(".pkey");
- s$52 = Py.newString("sr");
- s$53 = Py.newString("cr");
- s$54 = Py.newString(" ");
- s$55 = Py.newString(" is successfully added.\012");
- s$56 = Py.newString("_");
- s$57 = Py.newString("name");
- s$58 = Py.newString("UPDATE ");
- s$59 = Py.newString(" SET hrn = '");
- s$60 = Py.newString("userlist");
- s$61 = Py.newString(" userlist = '");
- s$62 = Py.newString(" rights = '");
- s$63 = Py.newString(" WHERE pointer = ");
- s$64 = Py.newString("Slice ");
- s$65 = Py.newString("user");
- s$66 = Py.newString("(2-0)(4-0)(6-0)(7-0)(8-0)(9-0)");
- s$67 = Py.newString("#0:reg:slc:");
- s$68 = Py.newString("User ");
- s$69 = Py.newString("node");
- s$70 = Py.newString("Node ");
- s$71 = Py.newString("Error in 'register():");
- s$72 = Py.newString("Error in register:.");
- s$73 = Py.newString(" does not exist.\012");
- s$74 = Py.newString("geni");
- s$75 = Py.newString("INSERT INTO slice_person VALUES(");
- s$76 = Py.newString(", ");
- s$77 = Py.newString(");");
- s$78 = Py.newString("UPDATE");
- s$79 = Py.newString("The record '");
- s$80 = Py.newString("' is successfully updated.\012");
- s$81 = Py.newString("Error in 'update():'");
- s$82 = Py.newString("Error in update:");
- s$83 = Py.newString("Error in remove.\012");
- s$84 = Py.newString("Site removal should be at the leaves.\012");
- s$85 = Py.newString("DELETE");
- s$86 = Py.newString("' is successfully removed.\012");
- s$87 = Py.newString("Error in 'delete()'");
- s$88 = Py.newString("Error in delete:");
- s$89 = Py.newString("pl");
- s$90 = Py.newString("cred_name");
- s$91 = Py.newString("registry");
- s$92 = Py.newString("SELECT * FROM ");
- s$93 = Py.newString(" WHERE hrn = '");
- s$94 = Py.newString("' ");
- s$95 = Py.newString("admin");
- s$96 = Py.newString("roles");
- s$97 = Py.newString("(0-0)(1-0)(2-0)(3-0)(4-0)(5-0)(6-0)(7-0)(8-0)(9-0)");
- s$98 = Py.newString("(0-1)(1-1)(2-1)(3-1)(4-1)(5-1)(6-1)(7-1)(8-1)(9-1)");
- s$99 = Py.newString("#1:reg:comp:");
- s$100 = Py.newString("pi");
- s$101 = Py.newString("Registry credentials");
- s$102 = Py.newString("is_deleted");
- s$103 = Py.newString("expires");
- s$104 = Py.newString("f");
- s$105 = Py.newString("SELECT * FROM person_slice WHERE person_id = ");
- s$106 = Py.newString(" AND slice_id = ");
- s$107 = Py.newString("(10-0)(11-0)(12-0)(13-0)(14-0)(15-0)(16-0)(17-0)(18-0)(20-0)(21-0)(22-0)(23-0)");
- s$108 = Py.newString("#0:comp:planetlab.*");
- s$109 = Py.newString("Credential ");
- i$110 = Py.newInteger(3);
- s$111 = Py.newString("account_name");
- s$112 = Py.newString("uuid");
- i$113 = Py.newInteger(2);
- s$114 = Py.newString("register");
- s$115 = Py.newString("remove");
- s$116 = Py.newString("update");
- s$117 = Py.newString("lookup");
- s$118 = Py.newString("list");
- s$119 = Py.newString("getCredential");
- s$120 = Py.newString("getAccounting");
- s$121 = Py.newString("server");
- s$122 = Py.newString("accounting");
- s$123 = Py.newString("credential");
- s$124 = Py.newString("both");
- s$125 = Py.newString("opname");
- s$126 = Py.newString("WRONG INTERFACE");
- s$127 = Py.newString("NO FUNC");
- s$128 = Py.newString("AUTHORIZATION FAIL");
- s$129 = Py.newString("message");
- s$130 = Py.newString("Requested record does not exist.\012");
- s$131 = Py.newString("There is an error handling the request. ");
- s$132 = Py.newString("__main__");
- s$133 = Py.newString("/home/soners/work/geni/rpc/server/server.py");
- funcTable = new _PyInner();
- c$0_register = Py.newCode(3, new String[] {"self", "record", "dbinfo", "other_tree", "parent_key_info", "user_fields", "existing_res", "login_base", "slice_fields", "rights", "reg_type", "querystr", "cnx", "pointer", "tree", "new_table_name", "table", "dirname", "parent_data", "site_fields", "res", "parent_db_info", "db_info", "curdir", "node_fields", "hrn_suffix", "i", "info", "long_hrn", "e", "dir_type", "key_info", "type"}, "/home/soners/work/geni/rpc/server/server.py", "register", false, false, funcTable, 0, null, null, 0, 1);
- c$1_update = Py.newCode(3, new String[] {"self", "record", "dbinfo", "usr_dbinfo", "type", "user_pointer", "rec", "existing_res", "user_fields", "pl_res", "node_fields", "cnx", "site_fields", "pointer", "querystr", "e", "table", "long_hrn", "slice_fields", "user"}, "/home/soners/work/geni/rpc/server/server.py", "update", false, false, funcTable, 1, null, null, 0, 1);
- c$2_remove = Py.newCode(3, new String[] {"self", "record", "dbinfo", "type", "existing_res", "tree", "cnx", "pointer", "querystr", "hrn_suffix", "leaf", "e", "table", "long_hrn"}, "/home/soners/work/geni/rpc/server/server.py", "remove", false, false, funcTable, 2, null, null, 0, 1);
- c$3_lookup = Py.newCode(3, new String[] {"self", "record", "dbinfo", "pointer", "cnx", "type", "existing_res", "pl_res", "table"}, "/home/soners/work/geni/rpc/server/server.py", "lookup", false, false, funcTable, 3, null, null, 0, 1);
- c$4_list = Py.newCode(3, new String[] {"self", "record", "dbinfo", "x"}, "/home/soners/work/geni/rpc/server/server.py", "list", false, false, funcTable, 4, null, null, 0, 1);
- c$5_getCredential = Py.newCode(5, new String[] {"self", "record", "dbinfo", "keyinfo", "peerinfo", "openssl_cert", "usr_dbinfo", "cname", "has_slc", "cred_name", "slc_result", "expires", "rights", "querystr", "cnx", "pointer", "table", "usr_slc_res", "user_pointer", "cred_pem", "slc_rec", "rec", "deleted", "pl_res", "timenow", "geni_res", "type"}, "/home/soners/work/geni/rpc/server/server.py", "getCredential", false, false, funcTable, 5, null, null, 0, 1);
- c$6_getAccounting = Py.newCode(5, new String[] {"self", "record", "dbinfo", "keyinfo", "peer_cert", "uuid", "cnx", "openssl_cert", "rec", "acc", "res", "table"}, "/home/soners/work/geni/rpc/server/server.py", "getAccounting", false, false, funcTable, 6, null, null, 0, 1);
- c$7___init__ = Py.newCode(3, new String[] {"self", "socket", "handler"}, "/home/soners/work/geni/rpc/server/server.py", "__init__", false, false, funcTable, 7, null, null, 0, 1);
- c$8_construct_hierarchy = Py.newCode(1, new String[] {"self"}, "/home/soners/work/geni/rpc/server/server.py", "construct_hierarchy", false, false, funcTable, 8, null, null, 0, 1);
- c$9_sec_init = Py.newCode(1, new String[] {"self", "id_key_file", "acc_file", "id_file", "key_info", "cred_file"}, "/home/soners/work/geni/rpc/server/server.py", "sec_init", false, false, funcTable, 9, null, null, 0, 1);
- c$10_save_state = Py.newCode(2, new String[] {"self", "type"}, "/home/soners/work/geni/rpc/server/server.py", "save_state", false, false, funcTable, 10, null, null, 0, 1);
- c$11_GENIServer = Py.newCode(0, new String[] {}, "/home/soners/work/geni/rpc/server/server.py", "GENIServer", false, false, funcTable, 11, null, null, 0, 0);
- c$12_handle = Py.newCode(1, new String[] {"self", "type", "op", "peerinfo", "target_hrn", "result", "peer", "dbinfo", "tree", "operation_request", "opname", "hrn_of_call", "reg_type", "e", "params", "keyinfo"}, "/home/soners/work/geni/rpc/server/server.py", "handle", false, false, funcTable, 12, null, null, 0, 1);
- c$13_handle_connection = Py.newCode(0, new String[] {}, "/home/soners/work/geni/rpc/server/server.py", "handle_connection", false, false, funcTable, 13, null, null, 0, 0);
- c$14_main = Py.newCode(0, new String[] {}, "/home/soners/work/geni/rpc/server/server.py", "main", false, false, funcTable, 14, null, null, 0, 1);
- c$15_main = Py.newCode(0, new String[] {}, "/home/soners/work/geni/rpc/server/server.py", "main", false, false, funcTable, 15, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$15_main == null) _PyInner.initConstants();
- return c$15_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.register$1(frame);
- case 1:
- return _PyInner.update$2(frame);
- case 2:
- return _PyInner.remove$3(frame);
- case 3:
- return _PyInner.lookup$4(frame);
- case 4:
- return _PyInner.list$5(frame);
- case 5:
- return _PyInner.getCredential$6(frame);
- case 6:
- return _PyInner.getAccounting$7(frame);
- case 7:
- return _PyInner.__init__$8(frame);
- case 8:
- return _PyInner.construct_hierarchy$9(frame);
- case 9:
- return _PyInner.sec_init$10(frame);
- case 10:
- return _PyInner.save_state$11(frame);
- case 11:
- return _PyInner.GENIServer$12(frame);
- case 12:
- return _PyInner.handle$13(frame);
- case 13:
- return _PyInner.handle_connection$14(frame);
- case 14:
- return _PyInner.main$15(frame);
- case 15:
- return _PyInner.main$16(frame);
- default:
- return null;
- }
- }
-
- private static PyObject register$1(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyException t$0$PyException;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
-
- // Code
- frame.setlocal(12, frame.getlocal(2).__getitem__(i$8));
- frame.setlocal(16, frame.getlocal(2).__getitem__(i$9));
- frame.setlocal(32, frame.getlocal(1).__getitem__(s$11).__getitem__(s$10));
- try {
- frame.setlocal(6, frame.getglobal("check_exists_geni").__call__(frame.getlocal(1), frame.getlocal(2)));
- if (frame.getlocal(6).__nonzero__()) {
- throw Py.makeException(frame.getglobal("ExistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$14)));
- }
- if (((t$0$PyObject = frame.getlocal(32)._eq(s$15)).__nonzero__() ? t$0$PyObject : frame.getlocal(32)._eq(s$16)).__nonzero__()) {
- frame.getlocal(1).__getitem__(s$11).__setitem__(s$18, s$17);
- frame.setlocal(10, s$19);
- if (frame.getlocal(32)._eq(s$15).__nonzero__()) {
- frame.setlocal(10, s$20);
- }
- else {
- frame.setlocal(10, s$21);
- }
- frame.setlocal(9, s$22);
- frame.setlocal(9, frame.getlocal(9)._add(s$23)._add(frame.getlocal(10))._add(s$24)._add(frame.getglobal("obtain_authority").__call__(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13)))._add(s$25)._add(frame.getlocal(10))._add(s$24)._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13)));
- frame.getlocal(1).__getitem__(s$11).__setitem__(s$26, frame.getlocal(9));
- frame.setlocal(28, frame.getlocal(1).__getitem__(s$11).__getitem__(s$13));
- frame.setlocal(25, frame.getglobal("get_leaf").__call__(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13)));
- frame.setlocal(13, i$9.__neg__());
- frame.setlocal(7, s$19);
- frame.setlocal(19, frame.getlocal(1).__getitem__(s$27));
- frame.setlocal(3, frame.getglobal("None"));
- if (frame.getlocal(10)._eq(s$20).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(0).__getattr__("cr_tree"));
- }
- else {
- frame.setlocal(3, frame.getlocal(0).__getattr__("sr_tree"));
- }
- frame.setlocal(27, frame.getlocal(3).invoke("tree_lookup", frame.getlocal(28)));
- if (frame.getlocal(27).__nonzero__()) {
- frame.setlocal(7, frame.getlocal(27).__getattr__("login_base"));
- frame.setlocal(13, frame.getlocal(12).invoke("query", s$29._add(frame.getlocal(7))._add(s$30)).invoke("dictresult").__getitem__(i$8).__getitem__(s$28));
- }
- else {
- if (frame.getlocal(19).invoke("has_key", s$31).__nonzero__()) {
- frame.setlocal(7, frame.getlocal(19).__getitem__(s$31));
- frame.setlocal(11, s$32._add(frame.getlocal(7))._add(s$33));
- frame.setlocal(20, frame.getlocal(12).invoke("query", frame.getlocal(11)).invoke("dictresult"));
- if (frame.getlocal(20).__nonzero__()) {
- return s$34._add(frame.getlocal(7))._add(s$35);
- }
- }
- else {
- frame.setlocal(7, frame.getglobal("hrn_to_loginbase").__call__(frame.getlocal(28)));
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("range").__call__(i$9, i$36);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(26, t$0$PyObject);
- frame.setlocal(11, s$32._add(frame.getlocal(7))._add(s$33));
- frame.setlocal(20, frame.getlocal(12).invoke("query", frame.getlocal(11)).invoke("dictresult"));
- if (frame.getlocal(20).__not__().__nonzero__()) {
- break;
- }
- else {
- frame.setlocal(7, frame.getglobal("hrn_to_loginbase").__call__(frame.getlocal(28), frame.getlocal(26)));
- }
- }
- frame.getlocal(19).__setitem__(s$31, frame.getlocal(7));
- }
- frame.setlocal(13, frame.getglobal("shell").invoke("AddSite", frame.getglobal("pl_auth"), frame.getlocal(19)));
- }
- frame.setlocal(23, frame.getglobal("os").__getattr__("getcwd").__call__());
- if (frame.getlocal(10)._eq(s$20).__nonzero__()) {
- frame.setlocal(30, s$37);
- }
- else {
- frame.setlocal(30, s$38);
- }
- frame.setlocal(17, frame.getlocal(30)._add(s$39)._add(frame.getlocal(28).invoke("replace", s$40, s$39)));
- if (frame.getglobal("os").__getattr__("path").__getattr__("exists").__call__(frame.getlocal(17)).__nonzero__()) {
- frame.getglobal("os").__getattr__("system").__call__(s$41._add(frame.getlocal(17)));
- }
- frame.getglobal("os").__getattr__("makedirs").__call__(frame.getlocal(17));
- frame.getglobal("os").__getattr__("chdir").__call__(frame.getlocal(17));
- frame.getglobal("create_self_cert").__call__(frame.getlocal(25));
- frame.getglobal("os").__getattr__("chdir").__call__(frame.getlocal(23));
- frame.getlocal(1).__getitem__(s$11).__setitem__(s$13, frame.getglobal("get_leaf").__call__(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13)));
- frame.getlocal(1).__getitem__(s$11).__setitem__(s$43, frame.getglobal("X509").__getattr__("load_cert").__call__(frame.getlocal(17)._add(s$39)._add(frame.getlocal(25))._add(s$42)).invoke("get_pubkey").__getattr__("as_pem").__call__(new PyObject[] {frame.getglobal("None")}, new String[] {"cipher"}));
- frame.getlocal(1).__getitem__(s$11).__setitem__(s$44, frame.getlocal(13));
- frame.setlocal(11, frame.getglobal("generate_querystr").__call__(s$45, frame.getlocal(16), frame.getlocal(1).__getitem__(s$11)));
- frame.getlocal(12).invoke("query", frame.getlocal(11));
- frame.setlocal(15, frame.getglobal("hrn_to_tablename").__call__(frame.getlocal(28), frame.getlocal(10)));
- frame.getlocal(12).invoke("query", s$46._add(frame.getlocal(15)));
- frame.setlocal(11, s$47._add(frame.getlocal(15))._add(s$48));
- frame.getlocal(12).invoke("query", frame.getlocal(11));
- frame.setlocal(14, frame.getglobal("None"));
- if (frame.getlocal(32)._eq(s$15).__nonzero__()) {
- frame.setlocal(14, frame.getlocal(0).__getattr__("sr_tree"));
- }
- else {
- frame.setlocal(14, frame.getlocal(0).__getattr__("cr_tree"));
- }
- frame.setlocal(18, frame.getlocal(14).invoke("tree_lookup", frame.getglobal("obtain_authority").__call__(frame.getlocal(28))).__getattr__("node_data"));
- frame.setlocal(21, frame.getlocal(18).__getitem__(s$49));
- frame.setlocal(4, frame.getlocal(18).__getitem__(s$50));
- frame.setlocal(27, frame.getglobal("TreeNodeInfo").__call__());
- frame.getlocal(27).__setattr__("name", frame.getlocal(28));
- frame.getlocal(27).__setattr__("login_base", frame.getlocal(7));
- frame.setlocal(22, frame.getglobal("DbInfo").__call__());
- frame.setlocal(31, frame.getglobal("KeyInfo").__call__());
- frame.getlocal(27).__setattr__("node_data", new PyDictionary(new PyObject[] {s$49, frame.getlocal(22), s$50, frame.getlocal(31)}));
- frame.getlocal(22).__setattr__("table_name", frame.getlocal(15));
- frame.getlocal(22).__setattr__("db_name", frame.getlocal(21).__getattr__("db_name"));
- frame.getlocal(22).__setattr__("address", frame.getlocal(21).__getattr__("address"));
- frame.getlocal(22).__setattr__("port", frame.getlocal(21).__getattr__("port"));
- frame.getlocal(22).__setattr__("user", frame.getlocal(21).__getattr__("user"));
- frame.getlocal(22).__setattr__("password", frame.getlocal(21).__getattr__("password"));
- frame.getlocal(31).__setattr__("acc_file", s$19);
- frame.getlocal(31).__setattr__("cred_file", s$19);
- frame.getlocal(31).__setattr__("folder", frame.getlocal(4).__getattr__("folder")._add(s$39)._add(frame.getlocal(25)));
- frame.getlocal(31).__setattr__("id_file", frame.getlocal(25)._add(s$42));
- frame.getlocal(31).__setattr__("id_key_file", frame.getlocal(25)._add(s$51));
- frame.getlocal(14).invoke("tree_add", frame.getlocal(27));
- if (frame.getlocal(32)._eq(s$15).__nonzero__()) {
- frame.getlocal(0).invoke("save_state", s$52);
- }
- else {
- frame.getlocal(0).invoke("save_state", s$53);
- }
- return frame.getlocal(32)._add(s$54)._add(frame.getlocal(28))._add(s$55);
- }
- else if (frame.getlocal(32)._eq(s$37).__nonzero__()) {
- frame.setlocal(7, frame.getglobal("get_leaf").__call__(frame.getglobal("obtain_authority").__call__(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))));
- frame.setlocal(28, frame.getlocal(1).__getitem__(s$11).__getitem__(s$13));
- frame.setlocal(25, frame.getglobal("get_leaf").__call__(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13)));
- frame.setlocal(8, frame.getlocal(1).__getitem__(s$27));
- frame.getlocal(8).__setitem__(s$57, frame.getlocal(7)._add(s$56)._add(frame.getlocal(25)));
- frame.setlocal(13, frame.getglobal("shell").invoke("AddSlice", frame.getglobal("pl_auth"), frame.getlocal(8)));
- frame.getlocal(1).__getitem__(s$11).__setitem__(s$44, frame.getlocal(13));
- frame.setlocal(11, s$58._add(frame.getlocal(16))._add(s$59)._add(frame.getlocal(25))._add(s$33));
- if (frame.getlocal(1).__getitem__(s$11).invoke("has_key", s$60).__nonzero__()) {
- frame.setlocal(11, frame.getlocal(11)._add(s$61)._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$60))._add(s$33));
- }
- if (frame.getlocal(1).__getitem__(s$11).invoke("has_key", s$26).__nonzero__()) {
- frame.setlocal(11, frame.getlocal(11)._add(s$62)._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$26))._add(s$33));
- }
- frame.setlocal(11, frame.getlocal(11)._add(s$63)._add(frame.getglobal("str").__call__(frame.getlocal(1).__getitem__(s$11).__getitem__(s$44))));
- frame.getlocal(12).invoke("query", frame.getlocal(11));
- return s$64._add(frame.getlocal(28))._add(s$55);
- }
- else if (frame.getlocal(32)._eq(s$65).__nonzero__()) {
- frame.setlocal(28, frame.getlocal(1).__getitem__(s$11).__getitem__(s$13));
- frame.getlocal(1).__getitem__(s$11).__setitem__(s$13, frame.getglobal("get_leaf").__call__(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13)));
- frame.setlocal(9, s$66);
- frame.setlocal(9, frame.getlocal(9)._add(s$67)._add(frame.getglobal("obtain_authority").__call__(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))));
- frame.getlocal(1).__getitem__(s$11).__setitem__(s$26, frame.getlocal(9));
- frame.setlocal(5, frame.getlocal(1).__getitem__(s$27));
- frame.setlocal(13, frame.getglobal("shell").invoke("AddPerson", frame.getglobal("pl_auth"), frame.getlocal(5)));
- frame.getlocal(1).__getitem__(s$11).__setitem__(s$44, frame.getlocal(13));
- frame.setlocal(11, frame.getglobal("generate_querystr").__call__(s$45, frame.getlocal(16), frame.getlocal(1).__getitem__(s$11)));
- frame.getlocal(12).invoke("query", frame.getlocal(11));
- return s$68._add(frame.getlocal(28))._add(s$55);
- }
- else if (frame.getlocal(32)._eq(s$69).__nonzero__()) {
- frame.setlocal(28, frame.getlocal(1).__getitem__(s$11).__getitem__(s$13));
- frame.setlocal(7, frame.getlocal(0).__getattr__("cr_tree").invoke("tree_lookup", frame.getglobal("obtain_authority").__call__(frame.getlocal(28))).__getattr__("login_base"));
- frame.getlocal(1).__getitem__(s$11).__setitem__(s$13, frame.getglobal("get_leaf").__call__(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13)));
- frame.setlocal(9, s$19);
- frame.getlocal(1).__getitem__(s$11).__setitem__(s$26, frame.getlocal(9));
- frame.setlocal(24, frame.getlocal(1).__getitem__(s$27));
- frame.setlocal(13, frame.getglobal("shell").invoke("AddNode", new PyObject[] {frame.getglobal("pl_auth"), frame.getlocal(7), frame.getlocal(24)}));
- frame.getlocal(1).__getitem__(s$11).__setitem__(s$44, frame.getlocal(13));
- frame.setlocal(11, s$58._add(frame.getlocal(16))._add(s$59)._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$33));
- if (((t$2$PyObject = frame.getlocal(1).__getitem__(s$11).invoke("has_key", s$26)).__nonzero__() ? frame.getlocal(1).__getitem__(s$11).__getitem__(s$26)._ne(s$19) : t$2$PyObject).__nonzero__()) {
- frame.setlocal(11, frame.getlocal(11)._add(s$62)._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$26))._add(s$33));
- }
- frame.setlocal(11, frame.getlocal(11)._add(s$63)._add(frame.getglobal("str").__call__(frame.getlocal(1).__getitem__(s$11).__getitem__(s$44))));
- frame.getlocal(12).invoke("query", frame.getlocal(11));
- return s$70._add(frame.getlocal(28))._add(s$55);
- }
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("Exception"))) {
- frame.setlocal(29, t$0$PyException.value);
- Py.println(s$71._add(frame.getglobal("str").__call__(frame.getlocal(29))));
- return s$72._add(frame.getglobal("str").__call__(frame.getlocal(29)));
- }
- else throw t$0$PyException;
- }
- return Py.None;
- }
-
- private static PyObject update$2(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyException t$0$PyException;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(11, frame.getlocal(2).__getitem__(i$8));
- frame.setlocal(16, frame.getlocal(2).__getitem__(i$9));
- try {
- frame.setlocal(7, frame.getglobal("check_exists_geni").__call__(frame.getlocal(1), frame.getlocal(2)));
- if (frame.getlocal(7).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$73)));
- }
- frame.setlocal(4, frame.getlocal(7).__getitem__(s$10));
- frame.setlocal(13, frame.getlocal(7).__getitem__(s$44));
- frame.setlocal(17, frame.getlocal(1).__getitem__(s$11).__getitem__(s$13));
- if (((t$0$PyObject = frame.getlocal(4)._eq(s$15)).__nonzero__() ? frame.getlocal(13)._ne(i$9.__neg__()) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(9, frame.getglobal("shell").invoke("GetSites", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(13)})));
- if (frame.getlocal(9).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$73)));
- }
- frame.setlocal(12, frame.getlocal(1).__getitem__(s$27));
- frame.getglobal("shell").invoke("UpdateSite", new PyObject[] {frame.getglobal("pl_auth"), frame.getlocal(13), frame.getlocal(12)});
- }
- else if (((t$0$PyObject = frame.getlocal(4)._eq(s$16)).__nonzero__() ? frame.getlocal(13)._ne(i$9.__neg__()) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(9, frame.getglobal("shell").invoke("GetSites", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(13)})));
- if (frame.getlocal(9).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$73)));
- }
- frame.setlocal(12, frame.getlocal(1).__getitem__(s$27));
- frame.getglobal("shell").invoke("UpdateSite", new PyObject[] {frame.getglobal("pl_auth"), frame.getlocal(13), frame.getlocal(12)});
- }
- else if (frame.getlocal(4)._eq(s$37).__nonzero__()) {
- frame.setlocal(9, frame.getglobal("shell").invoke("GetSlices", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(13)})));
- if (frame.getlocal(9).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$73)));
- }
- frame.setlocal(18, frame.getlocal(1).__getitem__(s$27));
- frame.getglobal("shell").invoke("UpdateSlice", new PyObject[] {frame.getglobal("pl_auth"), frame.getlocal(13), frame.getlocal(18)});
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(1).__getitem__(s$11).__getitem__(s$60);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(19, t$0$PyObject);
- frame.setlocal(3, frame.getglobal("determine_dbinfo").__call__(frame.getglobal("get_authority").__call__(frame.getlocal(19)), frame.getlocal(0).__getattr__("tree")));
- if (frame.getlocal(3).__nonzero__()) {
- frame.setlocal(6, new PyDictionary(new PyObject[] {s$11, new PyDictionary(new PyObject[] {s$13, frame.getlocal(19)}), s$27, new PyDictionary(new PyObject[] {})}));
- frame.setlocal(5, frame.getlocal(0).invoke("lookup", frame.getlocal(6), frame.getlocal(3)).__getitem__(s$74).__getitem__(s$44));
- frame.setlocal(14, s$75._add(frame.getlocal(13))._add(s$76)._add(frame.getlocal(5))._add(s$77));
- frame.getlocal(11).invoke("query", frame.getlocal(14));
- }
- }
- }
- else if (frame.getlocal(4)._eq(s$65).__nonzero__()) {
- frame.setlocal(9, frame.getglobal("shell").invoke("GetPersons", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(13)})));
- if (frame.getlocal(9).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$73)));
- }
- frame.setlocal(8, frame.getlocal(1).__getitem__(s$27));
- frame.getglobal("shell").invoke("UpdatePerson", new PyObject[] {frame.getglobal("pl_auth"), frame.getlocal(13), frame.getlocal(8)});
- }
- else if (frame.getlocal(4)._eq(s$69).__nonzero__()) {
- frame.setlocal(9, frame.getglobal("shell").invoke("GetNodes", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(13)})));
- if (frame.getlocal(9).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$73)));
- }
- frame.setlocal(10, frame.getlocal(1).__getitem__(s$27));
- frame.getglobal("shell").invoke("UpdateNode", new PyObject[] {frame.getglobal("pl_auth"), frame.getlocal(13), frame.getlocal(10)});
- }
- frame.getlocal(1).__getitem__(s$11).__setitem__(s$13, frame.getglobal("get_leaf").__call__(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13)));
- frame.setlocal(14, frame.getglobal("generate_querystr").__call__(s$78, frame.getlocal(16), frame.getlocal(1).__getitem__(s$11)));
- frame.getlocal(11).invoke("query", frame.getlocal(14));
- return s$79._add(frame.getlocal(17))._add(s$80);
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("Exception"))) {
- frame.setlocal(15, t$0$PyException.value);
- Py.println(s$81._add(frame.getglobal("str").__call__(frame.getlocal(15))));
- return s$82._add(frame.getglobal("str").__call__(frame.getlocal(15)));
- }
- else throw t$0$PyException;
- }
- }
-
- private static PyObject remove$3(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
- PyObject t$0$PyObject;
-
- // Code
- frame.setlocal(6, frame.getlocal(2).__getitem__(i$8));
- frame.setlocal(12, frame.getlocal(2).__getitem__(i$9));
- try {
- frame.setlocal(13, frame.getlocal(1).__getitem__(s$11).__getitem__(s$13));
- frame.setlocal(9, frame.getglobal("get_leaf").__call__(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13)));
- frame.setlocal(4, frame.getglobal("check_exists_geni").__call__(frame.getlocal(1), frame.getlocal(2)));
- if (frame.getlocal(4).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$73)));
- }
- frame.setlocal(3, frame.getlocal(4).__getitem__(s$10));
- frame.setlocal(7, frame.getlocal(4).__getitem__(s$44));
- if (((t$0$PyObject = frame.getlocal(3)._eq(s$15)).__nonzero__() ? t$0$PyObject : frame.getlocal(3)._eq(s$16)).__nonzero__()) {
- frame.setlocal(5, frame.getglobal("None"));
- if (frame.getlocal(3)._eq(s$15).__nonzero__()) {
- frame.setlocal(5, frame.getlocal(0).__getattr__("sr_tree"));
- }
- else {
- frame.setlocal(5, frame.getlocal(0).__getattr__("cr_tree"));
- }
- frame.setlocal(10, frame.getlocal(5).invoke("is_leaf", frame.getlocal(13)));
- if (frame.getlocal(10)._eq(frame.getglobal("None")).__nonzero__()) {
- return s$83;
- }
- else if (frame.getlocal(10)._eq(frame.getglobal("False")).__nonzero__()) {
- return s$84;
- }
- frame.getlocal(5).invoke("tree_remove", frame.getlocal(13));
- if (frame.getlocal(3)._eq(s$15).__nonzero__()) {
- frame.getlocal(0).invoke("save_state", s$52);
- }
- else {
- frame.getlocal(0).invoke("save_state", s$53);
- }
- if (frame.getglobal("site_to_auth").__call__(frame.getlocal(7)).__not__().__nonzero__()) {
- try {
- frame.getglobal("shell").invoke("DeleteSite", frame.getglobal("pl_auth"), frame.getlocal(7));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- i$9._eq(i$9);
- }
- }
- }
- else if (frame.getlocal(3)._eq(s$65).__nonzero__()) {
- frame.getglobal("shell").invoke("DeletePerson", frame.getglobal("pl_auth"), frame.getlocal(7));
- }
- else if (frame.getlocal(3)._eq(s$37).__nonzero__()) {
- frame.getglobal("shell").invoke("DeleteSlice", frame.getglobal("pl_auth"), frame.getlocal(7));
- }
- else if (frame.getlocal(3)._eq(s$69).__nonzero__()) {
- frame.getglobal("shell").invoke("DeleteNode", frame.getglobal("pl_auth"), frame.getlocal(7));
- }
- frame.setlocal(8, frame.getglobal("generate_querystr").__call__(s$85, frame.getlocal(12), frame.getlocal(1).__getitem__(s$11)));
- frame.getlocal(6).invoke("query", frame.getlocal(8));
- return s$79._add(frame.getlocal(13))._add(s$86);
- }
- catch (Throwable x$1) {
- t$0$PyException = Py.setException(x$1, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("Exception"))) {
- frame.setlocal(11, t$0$PyException.value);
- Py.println(s$87._add(frame.getglobal("str").__call__(frame.getlocal(11))));
- return s$88._add(frame.getglobal("str").__call__(frame.getlocal(11)));
- }
- else throw t$0$PyException;
- }
- }
-
- private static PyObject lookup$4(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
- PyObject t$0$PyObject;
-
- // Code
- frame.setlocal(4, frame.getlocal(2).__getitem__(i$8));
- frame.setlocal(8, frame.getlocal(2).__getitem__(i$9));
- try {
- frame.setlocal(6, frame.getglobal("check_exists_geni").__call__(frame.getlocal(1), frame.getlocal(2)));
- if (frame.getlocal(6).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$73)));
- }
- frame.setlocal(5, frame.getlocal(6).__getitem__(s$10));
- frame.setlocal(3, frame.getlocal(6).__getitem__(s$44));
- frame.setlocal(7, frame.getglobal("None"));
- if (((t$0$PyObject = frame.getlocal(5)._eq(s$15)).__nonzero__() ? frame.getlocal(3)._ne(i$9.__neg__()) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(7, frame.getglobal("shell").invoke("GetSites", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(3)})));
- if (frame.getlocal(7).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$73)));
- }
- frame.setlocal(7, frame.getlocal(7).__getitem__(i$8));
- }
- else if (((t$0$PyObject = frame.getlocal(5)._eq(s$16)).__nonzero__() ? frame.getlocal(3)._ne(i$9.__neg__()) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(7, frame.getglobal("shell").invoke("GetSites", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(3)})));
- if (frame.getlocal(7).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$73)));
- }
- frame.setlocal(7, frame.getlocal(7).__getitem__(i$8));
- }
- else if (frame.getlocal(5)._eq(s$37).__nonzero__()) {
- frame.setlocal(7, frame.getglobal("shell").invoke("GetSlices", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(3)})));
- if (frame.getlocal(7).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$73)));
- }
- frame.setlocal(7, frame.getlocal(7).__getitem__(i$8));
- }
- else if (frame.getlocal(5)._eq(s$65).__nonzero__()) {
- frame.setlocal(7, frame.getglobal("shell").invoke("GetPersons", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(3)})));
- if (frame.getlocal(7).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$73)));
- }
- frame.setlocal(7, frame.getlocal(7).__getitem__(i$8));
- }
- else if (frame.getlocal(5)._eq(s$69).__nonzero__()) {
- frame.setlocal(7, frame.getglobal("shell").invoke("GetNodes", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(3)})));
- if (frame.getlocal(7).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$13))._add(s$73)));
- }
- frame.setlocal(7, frame.getlocal(7).__getitem__(i$8));
- }
- return frame.getglobal("str").__call__(new PyDictionary(new PyObject[] {s$89, frame.getlocal(7), s$74, frame.getlocal(6)}));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- return frame.getglobal("None");
- }
- }
-
- private static PyObject list$5(PyFrame frame) {
- frame.setlocal(3, i$9);
- return Py.None;
- }
-
- private static PyObject getCredential$6(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
- PyObject t$0$PyObject;
-
- // Code
- frame.setlocal(14, frame.getlocal(2).__getitem__(i$8));
- frame.setlocal(16, frame.getlocal(2).__getitem__(i$9));
- try {
- frame.setlocal(19, frame.getglobal("None"));
- if (frame.getlocal(1).__getitem__(s$11).__getitem__(s$90).invoke("split", s$24).__getitem__(i$8)._eq(s$91).__nonzero__()) {
- frame.setlocal(25, frame.getlocal(14).invoke("query", s$92._add(frame.getlocal(16))._add(s$93)._add(frame.getglobal("get_leaf").__call__(frame.getlocal(4).__getitem__(i$8)))._add(s$94)).invoke("dictresult"));
- if (frame.getlocal(25).__nonzero__()) {
- frame.setlocal(25, frame.getlocal(25).__getitem__(i$8));
- }
- else {
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(4).__getitem__(i$8))._add(s$73)));
- }
- frame.setlocal(26, frame.getlocal(25).__getitem__(s$10));
- frame.setlocal(15, frame.getlocal(25).__getitem__(s$44));
- frame.setlocal(12, frame.getlocal(25).__getitem__(s$26));
- frame.setlocal(23, frame.getglobal("None"));
- if (((t$0$PyObject = frame.getlocal(26)._eq(s$15)).__nonzero__() ? frame.getlocal(15)._ne(i$9.__neg__()) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(23, frame.getglobal("shell").invoke("GetSites", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(15)})));
- if (frame.getlocal(23).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(4).__getitem__(i$8))._add(s$73)));
- }
- }
- else if (((t$0$PyObject = frame.getlocal(26)._eq(s$16)).__nonzero__() ? frame.getlocal(15)._ne(i$9.__neg__()) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(23, frame.getglobal("shell").invoke("GetSites", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(15)})));
- if (frame.getlocal(23).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(4).__getitem__(i$8))._add(s$73)));
- }
- }
- else if (frame.getlocal(26)._eq(s$65).__nonzero__()) {
- frame.setlocal(23, frame.getglobal("shell").invoke("GetPersons", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(15)})));
- if (frame.getlocal(23).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(4).__getitem__(i$8))._add(s$73)));
- }
- frame.setlocal(23, frame.getglobal("shell").invoke("GetPersons", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(15)})).__getitem__(i$8));
- if (((t$0$PyObject = frame.getlocal(12)._eq(s$19)).__nonzero__() ? t$0$PyObject : frame.getlocal(12)._eq(frame.getglobal("None"))).__nonzero__()) {
- if (s$95._in(frame.getlocal(23).__getitem__(s$96)).__nonzero__()) {
- frame.setlocal(12, s$97._add(s$98));
- frame.setlocal(12, frame.getlocal(12)._add(s$67)._add(frame.getglobal("ROOT_AUTH"))._add(s$99)._add(frame.getglobal("ROOT_AUTH")));
- }
- else if (s$100._in(frame.getlocal(23).__getitem__(s$96)).__nonzero__()) {
- frame.setlocal(12, s$97._add(s$98));
- frame.setlocal(12, frame.getlocal(12)._add(s$67)._add(frame.getglobal("obtain_authority").__call__(frame.getlocal(4).__getitem__(i$8)))._add(s$99)._add(frame.getglobal("obtain_authority").__call__(frame.getlocal(4).__getitem__(i$8))));
- }
- else if (s$65._in(frame.getlocal(23).__getitem__(s$96)).__nonzero__()) {
- frame.setlocal(12, s$66);
- frame.setlocal(12, frame.getlocal(12)._add(s$67)._add(frame.getglobal("obtain_authority").__call__(frame.getlocal(4).__getitem__(i$8))));
- }
- }
- }
- else if (frame.getlocal(26)._eq(s$69).__nonzero__()) {
- frame.setlocal(23, frame.getglobal("shell").invoke("GetNodes", frame.getglobal("pl_auth"), new PyList(new PyObject[] {frame.getlocal(15)})));
- if (frame.getlocal(23).__not__().__nonzero__()) {
- frame.getlocal(0).invoke("remove", frame.getlocal(1), frame.getlocal(2));
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(4).__getitem__(i$8))._add(s$73)));
- }
- }
- frame.setlocal(7, s$101);
- frame.setlocal(5, frame.getlocal(4).__getitem__(i$9));
- frame.setlocal(19, frame.getglobal("create_cred").__call__(new PyObject[] {frame.getlocal(3).__getitem__(i$8), frame.getlocal(3).__getitem__(i$9), frame.getlocal(5).invoke("get_pubkey"), frame.getlocal(7), frame.getlocal(12)}));
- }
- else {
- frame.setlocal(9, frame.getlocal(1).__getitem__(s$11).__getitem__(s$90).invoke("split", s$24));
- if (frame.getlocal(9).__getitem__(i$8)._eq(s$37).__nonzero__()) {
- frame.setlocal(20, new PyDictionary(new PyObject[] {s$11, new PyDictionary(new PyObject[] {s$13, frame.getlocal(9).__getitem__(i$9)}), s$27, new PyDictionary(new PyObject[] {})}));
- frame.setlocal(10, frame.getlocal(0).invoke("lookup", frame.getlocal(20), frame.getlocal(2)));
- frame.setlocal(8, frame.getglobal("False"));
- frame.setlocal(22, frame.getlocal(10).__getitem__(s$27).__getitem__(s$102));
- frame.setlocal(11, frame.getglobal("time").__getattr__("strptime").__call__(frame.getlocal(10).__getitem__(s$27).__getitem__(s$103), frame.getglobal("PL_DATETIME_FORMAT")));
- frame.setlocal(11, frame.getglobal("datetime").__getattr__("timedelta").__call__(new PyObject[] {frame.getglobal("calendar").__getattr__("timegm").__call__(frame.getlocal(11))}, new String[] {"seconds"}));
- if (((t$0$PyObject = frame.getlocal(10)).__nonzero__() ? frame.getlocal(22)._eq(s$104) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(6, frame.getglobal("determine_dbinfo").__call__(frame.getglobal("get_authority").__call__(frame.getlocal(4).__getitem__(i$8)), frame.getlocal(0).__getattr__("tree")));
- if (frame.getlocal(6).__nonzero__()) {
- frame.setlocal(21, new PyDictionary(new PyObject[] {s$11, new PyDictionary(new PyObject[] {s$13, frame.getlocal(4).__getitem__(i$8)}), s$27, new PyDictionary(new PyObject[] {})}));
- frame.setlocal(18, frame.getlocal(0).invoke("lookup", frame.getlocal(21), frame.getlocal(6)).__getitem__(s$74).__getitem__(s$44));
- frame.setlocal(13, s$105._add(frame.getlocal(18))._add(s$106)._add(frame.getlocal(10).__getitem__(s$74).__getitem__(s$44)));
- frame.setlocal(17, frame.getlocal(14).invoke("query", frame.getlocal(13)).invoke("dictresult"));
- if (frame.getlocal(17).__nonzero__()) {
- frame.setlocal(8, frame.getglobal("True"));
- }
- }
- if (frame.getlocal(8).__nonzero__()) {
- frame.setlocal(12, s$19);
- if (((t$0$PyObject = frame.getlocal(10).__getitem__(s$74).__getitem__(s$26)._ne(s$19)).__nonzero__() ? t$0$PyObject : frame.getlocal(10).__getitem__(s$74).__getitem__(s$26)._ne(frame.getglobal("None"))).__nonzero__()) {
- frame.setlocal(12, frame.getlocal(10).__getitem__(s$74).__getitem__(s$26));
- }
- else {
- frame.setlocal(12, s$107);
- frame.setlocal(12, frame.getlocal(12)._add(s$108));
- }
- frame.setlocal(7, frame.getlocal(10).__getitem__(s$74).__getitem__(s$13));
- frame.setlocal(24, frame.getglobal("datetime").__getattr__("timedelta").__call__(new PyObject[] {frame.getglobal("time").__getattr__("time").__call__()}, new String[] {"seconds"}));
- if (frame.getlocal(11)._sub(frame.getlocal(24))._gt(frame.getglobal("CRED_GRANT_TIME")).__nonzero__()) {
- frame.setlocal(5, frame.getglobal("crypto").invoke("load_certificate", frame.getglobal("crypto").__getattr__("FILETYPE_PEM"), frame.getlocal(4).__getitem__(i$9)));
- frame.setlocal(19, frame.getglobal("create_cred").__call__(new PyObject[] {frame.getlocal(3).__getitem__(i$8), frame.getlocal(3).__getitem__(i$9), frame.getlocal(5).invoke("get_pubkey"), frame.getlocal(7), frame.getlocal(12)}));
- }
- }
- }
- }
- else {
- throw Py.makeException(frame.getglobal("NonexistingCredType").__call__(s$109._add(frame.getlocal(9).__getitem__(i$8))._add(s$73)));
- }
- }
- if (frame.getlocal(19)._eq(frame.getglobal("None")).__nonzero__()) {
- return frame.getlocal(19);
- }
- else {
- return frame.getglobal("crypto").invoke("dump_certificate", frame.getglobal("crypto").__getattr__("FILETYPE_PEM"), frame.getlocal(19))._add(frame.getlocal(3).__getitem__(i$110));
- }
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- return frame.getglobal("None");
- }
- }
-
- private static PyObject getAccounting$7(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- frame.setlocal(6, frame.getlocal(2).__getitem__(i$8));
- frame.setlocal(11, frame.getlocal(2).__getitem__(i$9));
- try {
- frame.setlocal(9, frame.getglobal("None"));
- frame.setlocal(8, new PyDictionary(new PyObject[] {s$11, new PyDictionary(new PyObject[] {s$13, frame.getlocal(1).__getitem__(s$11).__getitem__(s$111)}), s$27, new PyDictionary(new PyObject[] {})}));
- frame.setlocal(10, frame.getglobal("eval").__call__(frame.getlocal(0).invoke("lookup", frame.getlocal(8), frame.getlocal(2))));
- if (frame.getlocal(10).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("NonexistingRecord").__call__(s$12._add(frame.getlocal(1).__getitem__(s$11).__getitem__(s$111))._add(s$73)));
- }
- if (frame.getlocal(10).__getitem__(s$74).__getitem__(s$43)._eq(frame.getlocal(4).invoke("get_pubkey").__getattr__("as_pem").__call__(new PyObject[] {frame.getglobal("None")}, new String[] {"cipher"})).__nonzero__()) {
- frame.setlocal(7, frame.getglobal("crypto").invoke("load_certificate", frame.getglobal("crypto").__getattr__("FILETYPE_PEM"), frame.getlocal(4).invoke("as_pem")));
- frame.setlocal(5, i$8);
- if (frame.getlocal(10).__getitem__(s$89).__not__().__nonzero__()) {
- frame.setlocal(5, frame.getlocal(10).__getitem__(s$74).__getitem__(s$112));
- }
- else {
- frame.setlocal(5, frame.getlocal(10).__getitem__(s$89).__getitem__(s$112));
- }
- frame.setlocal(9, frame.getglobal("create_acc").__call__(new PyObject[] {frame.getlocal(3).__getitem__(i$8), frame.getlocal(3).__getitem__(i$9), frame.getlocal(7).invoke("get_pubkey"), frame.getlocal(1).__getitem__(s$11).__getitem__(s$111), frame.getlocal(5)}));
- }
- if (frame.getlocal(9)._eq(frame.getglobal("None")).__nonzero__()) {
- return frame.getlocal(9);
- }
- else {
- return frame.getglobal("crypto").invoke("dump_certificate", frame.getglobal("crypto").__getattr__("FILETYPE_PEM"), frame.getlocal(9))._add(frame.getlocal(3).__getitem__(i$113));
- }
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- return frame.getglobal("None");
- }
- }
-
- private static PyObject __init__$8(PyFrame frame) {
- frame.getlocal(0).__setattr__("sr_tree_file", frame.getglobal("SR_FILE"));
- frame.getlocal(0).__setattr__("cr_tree_file", frame.getglobal("CR_FILE"));
- frame.getlocal(0).__setattr__("sr_tree", frame.getglobal("None"));
- frame.getlocal(0).__setattr__("cr_tree", frame.getglobal("None"));
- frame.getlocal(0).invoke("construct_hierarchy");
- frame.getglobal("set_tree_globals").__call__(frame.getlocal(0).__getattr__("sr_tree"), frame.getlocal(0).__getattr__("cr_tree"));
- frame.getlocal(0).__setattr__("sec", frame.getglobal("None"));
- frame.getlocal(0).invoke("sec_init");
- frame.getlocal(0).__setattr__("functionList", new PyDictionary(new PyObject[] {s$114, frame.getlocal(0).__getattr__("register"), s$115, frame.getlocal(0).__getattr__("remove"), s$116, frame.getlocal(0).__getattr__("update"), s$117, frame.getlocal(0).__getattr__("lookup"), s$118, frame.getlocal(0).__getattr__("list"), s$119, frame.getlocal(0).__getattr__("getCredential"), s$120, frame.getlocal(0).__getattr__("getAccounting")}));
- frame.getglobal("SSL").__getattr__("SSLServer").__getattr__("__init__").__call__(new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2), frame.getlocal(0).__getattr__("sec").__getattr__("ctx")});
- return Py.None;
- }
-
- private static PyObject construct_hierarchy$9(PyFrame frame) {
- frame.getlocal(0).__setattr__("sr_tree", frame.getglobal("InterfaceTree").__call__(s$37, frame.getlocal(0).__getattr__("sr_tree_file"), new PyTuple(new PyObject[] {frame.getglobal("AUTH_HOST"), frame.getglobal("AUTH_PORT")})));
- frame.getlocal(0).__setattr__("cr_tree", frame.getglobal("InterfaceTree").__call__(s$38, frame.getlocal(0).__getattr__("cr_tree_file"), new PyTuple(new PyObject[] {frame.getglobal("AUTH_HOST"), frame.getglobal("AUTH_PORT")})));
- return Py.None;
- }
-
- private static PyObject sec_init$10(PyFrame frame) {
- frame.setlocal(4, frame.getlocal(0).__getattr__("sr_tree").__getattr__("my_tree").__getattr__("info").__getattr__("node_data").__getitem__(s$50));
- frame.setlocal(3, frame.getlocal(4).__getattr__("folder")._add(s$39)._add(frame.getlocal(4).__getattr__("id_file")));
- frame.setlocal(1, frame.getlocal(4).__getattr__("folder")._add(s$39)._add(frame.getlocal(4).__getattr__("id_key_file")));
- frame.setlocal(2, frame.getlocal(4).__getattr__("folder")._add(s$39)._add(frame.getlocal(4).__getattr__("acc_file")));
- frame.setlocal(5, frame.getlocal(4).__getattr__("folder")._add(s$39)._add(frame.getlocal(4).__getattr__("cred_file")));
- frame.getlocal(0).__setattr__("sec", frame.getglobal("Sec").__call__(new PyObject[] {s$121, frame.getlocal(3), frame.getlocal(1), frame.getlocal(2), frame.getlocal(5)}));
- frame.getglobal("renew_cert").__call__(new PyObject[] {s$122, frame.getlocal(4).__getattr__("folder"), s$37, frame.getlocal(0).__getattr__("sr_tree").__getattr__("my_tree").__getattr__("info").__getattr__("name"), frame.getglobal("None"), frame.getglobal("None"), new PyTuple(new PyObject[] {frame.getglobal("AUTH_HOST"), frame.getglobal("AUTH_PORT")}), frame.getlocal(0).__getattr__("sec")});
- frame.getglobal("renew_cert").__call__(new PyObject[] {s$123, frame.getlocal(4).__getattr__("folder"), s$37, frame.getlocal(0).__getattr__("sr_tree").__getattr__("my_tree").__getattr__("info").__getattr__("name"), frame.getglobal("None"), frame.getglobal("None"), new PyTuple(new PyObject[] {frame.getglobal("AUTH_HOST"), frame.getglobal("AUTH_PORT")}), frame.getlocal(0).__getattr__("sec")});
- return Py.None;
- }
-
- private static PyObject save_state$11(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- if (((t$0$PyObject = frame.getlocal(1)._eq(s$52)).__nonzero__() ? t$0$PyObject : frame.getlocal(1)._eq(s$124)).__nonzero__()) {
- frame.getlocal(0).__getattr__("sr_tree").invoke("save_tree");
- }
- if (((t$0$PyObject = frame.getlocal(1)._eq(s$53)).__nonzero__() ? t$0$PyObject : frame.getlocal(1)._eq(s$124)).__nonzero__()) {
- frame.getlocal(0).__getattr__("cr_tree").invoke("save_tree");
- }
- return Py.None;
- }
-
- private static PyObject GENIServer$12(PyFrame frame) {
- frame.setlocal("register", new PyFunction(frame.f_globals, new PyObject[] {}, c$0_register));
- frame.setlocal("update", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_update));
- frame.setlocal("remove", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_remove));
- frame.setlocal("lookup", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_lookup));
- frame.setlocal("list", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_list));
- frame.setlocal("getCredential", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_getCredential));
- frame.setlocal("getAccounting", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_getAccounting));
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$7___init__));
- frame.setlocal("construct_hierarchy", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_construct_hierarchy));
- frame.setlocal("sec_init", new PyFunction(frame.f_globals, new PyObject[] {}, c$9_sec_init));
- frame.setlocal("save_state", new PyFunction(frame.f_globals, new PyObject[] {s$124}, c$10_save_state));
- return frame.getf_locals();
- }
-
- private static PyObject handle$13(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject;
-
- // Code
- try {
- frame.setlocal(6, frame.getglobal("server").__getattr__("sec").invoke("auth_protocol", frame.getlocal(0).__getattr__("request")));
- if (frame.getlocal(6).__not__().__nonzero__()) {
- return Py.None;
- }
- frame.setlocal(9, frame.getglobal("msg_to_params").__call__(frame.getlocal(0).__getattr__("request").invoke("read")));
- frame.setlocal(11, frame.getlocal(9).__getitem__(s$11).__getitem__(s$13));
- frame.setlocal(10, frame.getlocal(9).__getitem__(s$125));
- frame.setlocal(4, s$19);
- if (((t$0$PyObject = ((t$1$PyObject = ((t$2$PyObject = frame.getlocal(10)._eq(s$114)).__nonzero__() ? t$2$PyObject : frame.getlocal(10)._eq(s$115))).__nonzero__() ? t$1$PyObject : frame.getlocal(10)._eq(s$116))).__nonzero__() ? t$0$PyObject : frame.getlocal(10)._eq(s$117)).__nonzero__()) {
- frame.setlocal(4, frame.getglobal("obtain_authority").__call__(frame.getlocal(11)));
- }
- else if (((t$0$PyObject = ((t$1$PyObject = frame.getlocal(10)._eq(s$118)).__nonzero__() ? t$1$PyObject : frame.getlocal(10)._eq(s$119))).__nonzero__() ? t$0$PyObject : frame.getlocal(10)._eq(s$120)).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(11));
- }
- frame.setlocal(12, s$19);
- if (((t$0$PyObject = ((t$1$PyObject = ((t$2$PyObject = ((t$3$PyObject = frame.getlocal(10)._eq(s$114)).__nonzero__() ? t$3$PyObject : frame.getlocal(10)._eq(s$115))).__nonzero__() ? t$2$PyObject : frame.getlocal(10)._eq(s$116))).__nonzero__() ? t$1$PyObject : frame.getlocal(10)._eq(s$117))).__nonzero__() ? t$0$PyObject : frame.getlocal(10)._eq(s$118)).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(9).__getitem__(s$11).__getitem__(s$10));
- if (((t$0$PyObject = ((t$1$PyObject = frame.getlocal(1)._eq(s$37)).__nonzero__() ? t$1$PyObject : frame.getlocal(1)._eq(s$65))).__nonzero__() ? t$0$PyObject : frame.getlocal(1)._eq(s$15)).__nonzero__()) {
- frame.setlocal(12, s$37);
- }
- else {
- frame.setlocal(12, s$38);
- }
- }
- else if (frame.getlocal(10)._eq(s$119).__nonzero__()) {
- if (frame.getlocal(9).__getitem__(s$11).__getitem__(s$90).invoke("split", s$24).__getitem__(i$9)._eq(s$20).__nonzero__()) {
- frame.setlocal(12, s$37);
- }
- else {
- frame.setlocal(12, s$38);
- }
- }
- else if (frame.getlocal(10)._eq(s$120).__nonzero__()) {
- frame.setlocal(12, frame.getlocal(9).__getitem__(s$11).__getitem__(s$91));
- }
- frame.setlocal(8, frame.getglobal("None"));
- if (frame.getlocal(12)._eq(s$37).__nonzero__()) {
- frame.setlocal(8, frame.getglobal("server").__getattr__("sr_tree"));
- }
- else {
- frame.setlocal(8, frame.getglobal("server").__getattr__("cr_tree"));
- }
- frame.setlocal(7, frame.getglobal("determine_dbinfo").__call__(frame.getlocal(4), frame.getlocal(8)));
- frame.setlocal(15, frame.getglobal("None"));
- if (frame.getlocal(10)._eq(s$120).__nonzero__()) {
- frame.setlocal(15, frame.getlocal(8).invoke("determine_keyinfo", new PyObject[] {frame.getlocal(4), frame.getglobal("server"), s$122}));
- }
- else if (frame.getlocal(10)._eq(s$119).__nonzero__()) {
- frame.setlocal(15, frame.getlocal(8).invoke("determine_keyinfo", new PyObject[] {frame.getlocal(4), frame.getglobal("server"), s$123}));
- }
- if (frame.getlocal(7)._eq(frame.getglobal("None")).__nonzero__()) {
- frame.getlocal(0).__getattr__("request").invoke("write", s$126);
- return Py.None;
- }
- if (frame.getglobal("server").__getattr__("functionList").invoke("has_key", frame.getlocal(9).__getitem__(s$125)).__not__().__nonzero__()) {
- frame.getlocal(0).__getattr__("request").invoke("write", s$127);
- return Py.None;
- }
- if (frame.getglobal("server").__getattr__("sec").invoke("check_authorization", new PyObject[] {frame.getlocal(6).__getattr__("acc"), frame.getlocal(6).__getattr__("cred"), frame.getlocal(9)}).__not__().__nonzero__()) {
- frame.getlocal(0).__getattr__("request").invoke("write", s$128);
- return Py.None;
- }
- frame.setlocal(2, frame.getglobal("server").__getattr__("functionList").__getitem__(frame.getlocal(9).__getitem__(s$125)));
- frame.setlocal(14, new PyDictionary(new PyObject[] {s$11, frame.getlocal(9).__getitem__(s$11), s$27, frame.getlocal(9).__getitem__(s$27)}));
- frame.setlocal(5, frame.getglobal("None"));
- if (frame.getlocal(2)._eq(frame.getglobal("server").__getattr__("getAccounting")).__nonzero__()) {
- frame.setlocal(5, frame.getlocal(2).__call__(new PyObject[] {frame.getlocal(14), frame.getlocal(7), frame.getlocal(15), frame.getlocal(6).__getattr__("cert")}));
- }
- else if (frame.getlocal(2)._eq(frame.getglobal("server").__getattr__("getCredential")).__nonzero__()) {
- frame.setlocal(3, new PyList(new PyObject[] {frame.getlocal(6).__getattr__("acc").invoke("get_hrn"), frame.getglobal("crypto").invoke("load_certificate", frame.getglobal("crypto").__getattr__("FILETYPE_PEM"), frame.getlocal(6).__getattr__("cert").invoke("as_pem"))}));
- frame.setlocal(5, frame.getlocal(2).__call__(new PyObject[] {frame.getlocal(14), frame.getlocal(7), frame.getlocal(15), frame.getlocal(3)}));
- }
- else if (((t$0$PyObject = ((t$1$PyObject = frame.getlocal(2)._eq(frame.getglobal("server").__getattr__("register"))).__nonzero__() ? t$1$PyObject : frame.getlocal(2)._eq(frame.getglobal("server").__getattr__("update")))).__nonzero__() ? t$0$PyObject : frame.getlocal(2)._eq(frame.getglobal("server").__getattr__("remove"))).__nonzero__()) {
- frame.setlocal(5, frame.getglobal("str").__call__(new PyDictionary(new PyObject[] {s$129, frame.getlocal(2).__call__(frame.getlocal(14), frame.getlocal(7))})));
- }
- else {
- frame.setlocal(5, frame.getlocal(2).__call__(frame.getlocal(14), frame.getlocal(7)));
- if (frame.getlocal(5).__not__().__nonzero__()) {
- frame.getlocal(0).__getattr__("request").invoke("write", frame.getglobal("str").__call__(new PyDictionary(new PyObject[] {s$129, s$130})));
- }
- }
- frame.getlocal(0).__getattr__("request").invoke("write", frame.getlocal(5));
- return Py.None;
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("Exception"))) {
- frame.setlocal(13, t$0$PyException.value);
- Py.println(s$131._add(frame.getglobal("str").__call__(frame.getlocal(13))));
- return Py.None;
- }
- else throw t$0$PyException;
- }
- }
-
- private static PyObject handle_connection$14(PyFrame frame) {
- frame.setlocal("handle", new PyFunction(frame.f_globals, new PyObject[] {}, c$12_handle));
- return frame.getf_locals();
- }
-
- private static PyObject main$15(PyFrame frame) {
- frame.getglobal("server").invoke("save_state");
- frame.getglobal("server").invoke("serve_forever");
- return Py.None;
- }
-
- private static PyObject main$16(PyFrame frame) {
- frame.setglobal("__file__", s$133);
-
- PyObject[] imp_accu;
- // Code
- frame.setlocal("LISTEN_HOST", s$0);
- frame.setlocal("LISTEN_PORT", i$1);
- frame.setlocal("SR_FILE", s$2);
- frame.setlocal("CR_FILE", s$3);
- frame.setlocal("AUTH_HOST", s$0);
- frame.setlocal("AUTH_PORT", i$1);
- frame.setlocal("SocketServer", org.python.core.imp.importOne("SocketServer", frame));
- frame.setlocal("socket", org.python.core.imp.importOne("socket", frame));
- frame.setlocal("os", org.python.core.imp.importOne("os", frame));
- frame.setlocal("sys", org.python.core.imp.importOne("sys", frame));
- imp_accu = org.python.core.imp.importFrom("M2Crypto", new String[] {"SSL"}, frame);
- frame.setlocal("SSL", imp_accu[0]);
- imp_accu = null;
- imp_accu = org.python.core.imp.importFrom("M2Crypto.SSL", new String[] {"SSLError"}, frame);
- frame.setlocal("SSLError", imp_accu[0]);
- imp_accu = null;
- imp_accu = org.python.core.imp.importFrom("M2Crypto", new String[] {"X509"}, frame);
- frame.setlocal("X509", imp_accu[0]);
- imp_accu = null;
- imp_accu = org.python.core.imp.importFrom("pg", new String[] {"DB"}, frame);
- frame.setlocal("DB", imp_accu[0]);
- imp_accu = null;
- frame.getname("sys").__getattr__("path").__getattr__("append").__call__(s$4);
- frame.getname("sys").__getattr__("path").__getattr__("append").__call__(s$5);
- frame.getname("sys").__getattr__("path").__getattr__("append").__call__(s$6);
- frame.getname("sys").__getattr__("path").__getattr__("append").__call__(s$7);
- org.python.core.imp.importAll("util", frame);
- org.python.core.imp.importAll("tree", frame);
- org.python.core.imp.importAll("excep", frame);
- org.python.core.imp.importAll("sec", frame);
- org.python.core.imp.importAll("db", frame);
- org.python.core.imp.importAll("pl_to_geni", frame);
- frame.setlocal("time", org.python.core.imp.importOne("time", frame));
- frame.setlocal("datetime", org.python.core.imp.importOne("datetime", frame));
- frame.setlocal("calendar", org.python.core.imp.importOne("calendar", frame));
- imp_accu = org.python.core.imp.importFrom("PLC.Shell", new String[] {"Shell"}, frame);
- frame.setlocal("Shell", imp_accu[0]);
- imp_accu = null;
- frame.setlocal("shell", frame.getname("Shell").__call__(new PyObject[] {frame.getname("globals").__call__()}, new String[] {"globals"}));
- frame.setlocal("GENIServer", Py.makeClass("GENIServer", new PyObject[] {frame.getname("SSL").__getattr__("SSLServer")}, c$11_GENIServer, null));
- frame.setlocal("handle_connection", Py.makeClass("handle_connection", new PyObject[] {frame.getname("SocketServer").__getattr__("BaseRequestHandler")}, c$13_handle_connection, null));
- frame.setlocal("server", frame.getname("GENIServer").__call__(new PyTuple(new PyObject[] {frame.getname("LISTEN_HOST"), frame.getname("LISTEN_PORT")}), frame.getname("handle_connection")));
- frame.setlocal("main", new PyFunction(frame.f_globals, new PyObject[] {}, c$14_main));
- if (frame.getname("__name__")._eq(s$132).__nonzero__()) {
- frame.getname("main").__call__();
- }
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("server"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "server";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(server._PyInner.class, newargs, server.jpy$packages, server.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class socket extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject i$14;
- private static PyObject i$15;
- private static PyObject i$16;
- private static PyObject i$17;
- private static PyObject i$18;
- private static PyObject i$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject i$22;
- private static PyObject s$23;
- private static PyObject s$24;
- private static PyObject s$25;
- private static PyObject i$26;
- private static PyObject s$27;
- private static PyObject s$28;
- private static PyObject s$29;
- private static PyObject s$30;
- private static PyObject s$31;
- private static PyObject i$32;
- private static PyObject s$33;
- private static PyObject i$34;
- private static PyObject s$35;
- private static PyObject s$36;
- private static PyFunctionTable funcTable;
- private static PyCode c$0__gethostbyaddr;
- private static PyCode c$1_getfqdn;
- private static PyCode c$2_gethostname;
- private static PyCode c$3_gethostbyname;
- private static PyCode c$4_gethostbyaddr;
- private static PyCode c$5_socket;
- private static PyCode c$6_bind;
- private static PyCode c$7_listen;
- private static PyCode c$8_accept;
- private static PyCode c$9_connect;
- private static PyCode c$10__setup;
- private static PyCode c$11_recv;
- private static PyCode c$12_send;
- private static PyCode c$13_getsockname;
- private static PyCode c$14_getpeername;
- private static PyCode c$15_setsockopt;
- private static PyCode c$16_getsockopt;
- private static PyCode c$17_makefile;
- private static PyCode c$18___init__;
- private static PyCode c$19_close;
- private static PyCode c$20_FileWrapper;
- private static PyCode c$21_shutdown;
- private static PyCode c$22_close;
- private static PyCode c$23__tcpsocket;
- private static PyCode c$24___init__;
- private static PyCode c$25_bind;
- private static PyCode c$26_connect;
- private static PyCode c$27_sendto;
- private static PyCode c$28_send;
- private static PyCode c$29_recvfrom;
- private static PyCode c$30_recv;
- private static PyCode c$31_getsockname;
- private static PyCode c$32_getpeername;
- private static PyCode c$33___del__;
- private static PyCode c$34_close;
- private static PyCode c$35__udpsocket;
- private static PyCode c$36_test;
- private static PyCode c$37_main;
- private static void initConstants() {
- s$0 = Py.newString("Preliminary socket module.\012\012XXX Restrictions:\012\012- Only INET sockets\012- No asynchronous behavior\012- No socket options\012- Can't do a very good gethostbyaddr() right...\012\012");
- s$1 = Py.newString("AF_INET");
- s$2 = Py.newString("SOCK_DGRAM");
- s$3 = Py.newString("SOCK_RAW");
- s$4 = Py.newString("SOCK_RDM");
- s$5 = Py.newString("SOCK_SEQPACKET");
- s$6 = Py.newString("SOCK_STREAM");
- s$7 = Py.newString("SocketType");
- s$8 = Py.newString("error");
- s$9 = Py.newString("getfqdn");
- s$10 = Py.newString("gethostbyaddr");
- s$11 = Py.newString("gethostbyname");
- s$12 = Py.newString("gethostname");
- s$13 = Py.newString("socket");
- i$14 = Py.newInteger(2);
- i$15 = Py.newInteger(1);
- i$16 = Py.newInteger(3);
- i$17 = Py.newInteger(4);
- i$18 = Py.newInteger(5);
- i$19 = Py.newInteger(65535);
- s$20 = Py.newString("\012 Return a fully qualified domain name for name. If name is omitted or empty\012 it is interpreted as the local host. To find the fully qualified name,\012 the hostname returned by gethostbyaddr() is checked, then aliases for the\012 host, if available. The first name which includes a period is selected.\012 In case no fully qualified domain name is available, the hostname is retur\012 New in version 2.0.\012 ");
- s$21 = Py.newString(".");
- i$22 = Py.newInteger(0);
- s$23 = Py.newString("This signifies a server socket");
- s$24 = Py.newString("");
- s$25 = Py.newString("setReuseAddress");
- i$26 = Py.newInteger(50);
- s$27 = Py.newString("This signifies a client socket");
- s$28 = Py.newString("b");
- s$29 = Py.newString("<socket>");
- s$30 = Py.newString("both istream and ostream have been shut down");
- s$31 = Py.newString("r");
- i$32 = Py.newInteger(80);
- s$33 = Py.newString("GET / HTTP/1.0\015\012\015\012");
- i$34 = Py.newInteger(2000);
- s$35 = Py.newString("__main__");
- s$36 = Py.newString("/usr/share/jython/Lib/socket.py");
- funcTable = new _PyInner();
- c$0__gethostbyaddr = Py.newCode(1, new String[] {"name", "addrs", "names", "addresses", "addr"}, "/usr/share/jython/Lib/socket.py", "_gethostbyaddr", false, false, funcTable, 0, null, null, 0, 1);
- c$1_getfqdn = Py.newCode(1, new String[] {"name", "a", "addrs", "names"}, "/usr/share/jython/Lib/socket.py", "getfqdn", false, false, funcTable, 1, null, null, 0, 1);
- c$2_gethostname = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/socket.py", "gethostname", false, false, funcTable, 2, null, null, 0, 1);
- c$3_gethostbyname = Py.newCode(1, new String[] {"name"}, "/usr/share/jython/Lib/socket.py", "gethostbyname", false, false, funcTable, 3, null, null, 0, 1);
- c$4_gethostbyaddr = Py.newCode(1, new String[] {"name", "addrs", "names"}, "/usr/share/jython/Lib/socket.py", "gethostbyaddr", false, false, funcTable, 4, null, null, 0, 1);
- c$5_socket = Py.newCode(3, new String[] {"family", "type", "flags"}, "/usr/share/jython/Lib/socket.py", "socket", false, false, funcTable, 5, null, null, 0, 1);
- c$6_bind = Py.newCode(3, new String[] {"self", "addr", "port", "host"}, "/usr/share/jython/Lib/socket.py", "bind", false, false, funcTable, 6, null, null, 0, 1);
- c$7_listen = Py.newCode(2, new String[] {"self", "backlog", "a", "port", "host"}, "/usr/share/jython/Lib/socket.py", "listen", false, false, funcTable, 7, null, null, 0, 1);
- c$8_accept = Py.newCode(1, new String[] {"self", "port", "sock", "conn", "host"}, "/usr/share/jython/Lib/socket.py", "accept", false, false, funcTable, 8, null, null, 0, 1);
- c$9_connect = Py.newCode(3, new String[] {"self", "addr", "port", "host"}, "/usr/share/jython/Lib/socket.py", "connect", false, false, funcTable, 9, null, null, 0, 1);
- c$10__setup = Py.newCode(2, new String[] {"self", "sock"}, "/usr/share/jython/Lib/socket.py", "_setup", false, false, funcTable, 10, null, null, 0, 1);
- c$11_recv = Py.newCode(2, new String[] {"self", "n", "m", "data"}, "/usr/share/jython/Lib/socket.py", "recv", false, false, funcTable, 11, null, null, 0, 1);
- c$12_send = Py.newCode(2, new String[] {"self", "s", "n"}, "/usr/share/jython/Lib/socket.py", "send", false, false, funcTable, 12, null, null, 0, 1);
- c$13_getsockname = Py.newCode(1, new String[] {"self", "port", "host"}, "/usr/share/jython/Lib/socket.py", "getsockname", false, false, funcTable, 13, null, null, 0, 1);
- c$14_getpeername = Py.newCode(1, new String[] {"self", "port", "host"}, "/usr/share/jython/Lib/socket.py", "getpeername", false, false, funcTable, 14, null, null, 0, 1);
- c$15_setsockopt = Py.newCode(4, new String[] {"self", "level", "optname", "value"}, "/usr/share/jython/Lib/socket.py", "setsockopt", false, false, funcTable, 15, null, null, 0, 1);
- c$16_getsockopt = Py.newCode(3, new String[] {"self", "level", "optname"}, "/usr/share/jython/Lib/socket.py", "getsockopt", false, false, funcTable, 16, null, null, 0, 1);
- c$17_makefile = Py.newCode(3, new String[] {"self", "mode", "bufsize", "file"}, "/usr/share/jython/Lib/socket.py", "makefile", false, false, funcTable, 17, null, null, 0, 1);
- c$18___init__ = Py.newCode(3, new String[] {"self", "socket", "file"}, "/usr/share/jython/Lib/socket.py", "__init__", false, false, funcTable, 18, null, null, 0, 1);
- c$19_close = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/socket.py", "close", false, false, funcTable, 19, null, null, 0, 1);
- c$20_FileWrapper = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/socket.py", "FileWrapper", false, false, funcTable, 20, null, null, 0, 0);
- c$21_shutdown = Py.newCode(2, new String[] {"self", "how"}, "/usr/share/jython/Lib/socket.py", "shutdown", false, false, funcTable, 21, null, null, 0, 1);
- c$22_close = Py.newCode(1, new String[] {"self", "ostream", "sock", "istream"}, "/usr/share/jython/Lib/socket.py", "close", false, false, funcTable, 22, null, null, 0, 1);
- c$23__tcpsocket = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/socket.py", "_tcpsocket", false, false, funcTable, 23, null, null, 0, 0);
- c$24___init__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/socket.py", "__init__", false, false, funcTable, 24, null, null, 0, 1);
- c$25_bind = Py.newCode(3, new String[] {"self", "addr", "port", "a", "host"}, "/usr/share/jython/Lib/socket.py", "bind", false, false, funcTable, 25, null, null, 0, 1);
- c$26_connect = Py.newCode(3, new String[] {"self", "addr", "port", "host"}, "/usr/share/jython/Lib/socket.py", "connect", false, false, funcTable, 26, null, null, 0, 1);
- c$27_sendto = Py.newCode(3, new String[] {"self", "data", "addr", "packet", "n", "port", "a", "host", "bytes"}, "/usr/share/jython/Lib/socket.py", "sendto", false, false, funcTable, 27, null, null, 0, 1);
- c$28_send = Py.newCode(2, new String[] {"self", "data"}, "/usr/share/jython/Lib/socket.py", "send", false, false, funcTable, 28, null, null, 0, 1);
- c$29_recvfrom = Py.newCode(2, new String[] {"self", "n", "packet", "port", "m", "host", "bytes"}, "/usr/share/jython/Lib/socket.py", "recvfrom", false, false, funcTable, 29, null, null, 0, 1);
- c$30_recv = Py.newCode(2, new String[] {"self", "n", "m", "bytes", "packet"}, "/usr/share/jython/Lib/socket.py", "recv", false, false, funcTable, 30, null, null, 0, 1);
- c$31_getsockname = Py.newCode(1, new String[] {"self", "port", "host"}, "/usr/share/jython/Lib/socket.py", "getsockname", false, false, funcTable, 31, null, null, 0, 1);
- c$32_getpeername = Py.newCode(1, new String[] {"self", "port", "host"}, "/usr/share/jython/Lib/socket.py", "getpeername", false, false, funcTable, 32, null, null, 0, 1);
- c$33___del__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib/socket.py", "__del__", false, false, funcTable, 33, null, null, 0, 1);
- c$34_close = Py.newCode(1, new String[] {"self", "sock"}, "/usr/share/jython/Lib/socket.py", "close", false, false, funcTable, 34, null, null, 0, 1);
- c$35__udpsocket = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/socket.py", "_udpsocket", false, false, funcTable, 35, null, null, 0, 0);
- c$36_test = Py.newCode(0, new String[] {"s", "data"}, "/usr/share/jython/Lib/socket.py", "test", false, false, funcTable, 36, null, null, 0, 1);
- c$37_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/socket.py", "main", false, false, funcTable, 37, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$37_main == null) _PyInner.initConstants();
- return c$37_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner._gethostbyaddr$1(frame);
- case 1:
- return _PyInner.getfqdn$2(frame);
- case 2:
- return _PyInner.gethostname$3(frame);
- case 3:
- return _PyInner.gethostbyname$4(frame);
- case 4:
- return _PyInner.gethostbyaddr$5(frame);
- case 5:
- return _PyInner.socket$6(frame);
- case 6:
- return _PyInner.bind$7(frame);
- case 7:
- return _PyInner.listen$8(frame);
- case 8:
- return _PyInner.accept$9(frame);
- case 9:
- return _PyInner.connect$10(frame);
- case 10:
- return _PyInner._setup$11(frame);
- case 11:
- return _PyInner.recv$12(frame);
- case 12:
- return _PyInner.send$13(frame);
- case 13:
- return _PyInner.getsockname$14(frame);
- case 14:
- return _PyInner.getpeername$15(frame);
- case 15:
- return _PyInner.setsockopt$16(frame);
- case 16:
- return _PyInner.getsockopt$17(frame);
- case 17:
- return _PyInner.makefile$18(frame);
- case 18:
- return _PyInner.__init__$19(frame);
- case 19:
- return _PyInner.close$20(frame);
- case 20:
- return _PyInner.FileWrapper$21(frame);
- case 21:
- return _PyInner.shutdown$22(frame);
- case 22:
- return _PyInner.close$23(frame);
- case 23:
- return _PyInner._tcpsocket$24(frame);
- case 24:
- return _PyInner.__init__$25(frame);
- case 25:
- return _PyInner.bind$26(frame);
- case 26:
- return _PyInner.connect$27(frame);
- case 27:
- return _PyInner.sendto$28(frame);
- case 28:
- return _PyInner.send$29(frame);
- case 29:
- return _PyInner.recvfrom$30(frame);
- case 30:
- return _PyInner.recv$31(frame);
- case 31:
- return _PyInner.getsockname$32(frame);
- case 32:
- return _PyInner.getpeername$33(frame);
- case 33:
- return _PyInner.__del__$34(frame);
- case 34:
- return _PyInner.close$35(frame);
- case 35:
- return _PyInner._udpsocket$36(frame);
- case 36:
- return _PyInner.test$37(frame);
- case 37:
- return _PyInner.main$38(frame);
- default:
- return null;
- }
- }
-
- private static PyObject _gethostbyaddr$1(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(3, frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getAllByName").__call__(frame.getglobal("gethostbyname").__call__(frame.getlocal(0))));
- frame.setlocal(2, new PyList(new PyObject[] {}));
- frame.setlocal(1, new PyList(new PyObject[] {}));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(3);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(4, t$0$PyObject);
- frame.getlocal(2).invoke("append", frame.getlocal(4).invoke("getHostName"));
- frame.getlocal(1).invoke("append", frame.getlocal(4).invoke("getHostAddress"));
- }
- return new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(1)});
- }
-
- private static PyObject getfqdn$2(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /*
- Return a fully qualified domain name for name. If name is omitted or empty
- it is interpreted as the local host. To find the fully qualified name,
- the hostname returned by gethostbyaddr() is checked, then aliases for the
- host, if available. The first name which includes a period is selected.
- In case no fully qualified domain name is available, the hostname is retur
- New in version 2.0.
- */
- if (frame.getlocal(0).__not__().__nonzero__()) {
- frame.setlocal(0, frame.getglobal("gethostname").__call__());
- }
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("_gethostbyaddr").__call__(frame.getlocal(0)), 2);
- frame.setlocal(3, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(3);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(1, t$0$PyObject);
- if (frame.getlocal(1).invoke("find", s$21)._ge(i$22).__nonzero__()) {
- return frame.getlocal(1);
- }
- }
- return frame.getlocal(0);
- }
-
- private static PyObject gethostname$3(PyFrame frame) {
- return frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getLocalHost").__call__().invoke("getHostName");
- }
-
- private static PyObject gethostbyname$4(PyFrame frame) {
- return frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getByName").__call__(frame.getlocal(0)).invoke("getHostAddress");
- }
-
- private static PyObject gethostbyaddr$5(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("_gethostbyaddr").__call__(frame.getlocal(0)), 2);
- frame.setlocal(2, t$0$PyObject__[0]);
- frame.setlocal(1, t$0$PyObject__[1]);
- return new PyTuple(new PyObject[] {frame.getlocal(2).__getitem__(i$22), frame.getlocal(2), frame.getlocal(1)});
- }
-
- private static PyObject socket$6(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0)._eq(frame.getglobal("AF_INET")));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(1)._in(new PyTuple(new PyObject[] {frame.getglobal("SOCK_DGRAM"), frame.getglobal("SOCK_STREAM")})));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(2)._eq(i$22));
- if (frame.getlocal(1)._eq(frame.getglobal("SOCK_STREAM")).__nonzero__()) {
- return frame.getglobal("_tcpsocket").__call__();
- }
- else {
- return frame.getglobal("_udpsocket").__call__();
- }
- }
-
- private static PyObject bind$7(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- if (frame.getlocal(2)._isnot(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(1, new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(2)}));
- }
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock").__not__());
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("addr").__not__());
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1), 2);
- frame.setlocal(3, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- frame.getlocal(0).__setattr__("addr", frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject listen$8(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- /* This signifies a server socket */
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock").__not__());
- frame.getlocal(0).__setattr__("server", i$15);
- if (frame.getlocal(0).__getattr__("addr").__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0).__getattr__("addr"), 2);
- frame.setlocal(4, t$0$PyObject__[0]);
- frame.setlocal(3, t$0$PyObject__[1]);
- }
- else {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(new PyTuple(new PyObject[] {s$24, i$22}), 2);
- frame.setlocal(4, t$0$PyObject__[0]);
- frame.setlocal(3, t$0$PyObject__[1]);
- }
- if (frame.getlocal(4).__nonzero__()) {
- frame.setlocal(2, frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getByName").__call__(frame.getlocal(4)));
- frame.getlocal(0).__setattr__("sock", frame.getglobal("java").__getattr__("net").__getattr__("ServerSocket").__call__(frame.getlocal(3), frame.getlocal(1), frame.getlocal(2)));
- }
- else {
- frame.getlocal(0).__setattr__("sock", frame.getglobal("java").__getattr__("net").__getattr__("ServerSocket").__call__(frame.getlocal(3), frame.getlocal(1)));
- }
- if (frame.getglobal("hasattr").__call__(frame.getlocal(0).__getattr__("sock"), s$25).__nonzero__()) {
- frame.getlocal(0).__getattr__("sock").invoke("setReuseAddress", frame.getlocal(0).__getattr__("reuse_addr"));
- }
- return Py.None;
- }
-
- private static PyObject accept$9(PyFrame frame) {
- /* This signifies a server socket */
- if (frame.getlocal(0).__getattr__("sock").__not__().__nonzero__()) {
- frame.getlocal(0).invoke("listen");
- }
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("server"));
- frame.setlocal(2, frame.getlocal(0).__getattr__("sock").invoke("accept"));
- frame.setlocal(4, frame.getlocal(2).invoke("getInetAddress").invoke("getHostName"));
- frame.setlocal(1, frame.getlocal(2).invoke("getPort"));
- frame.setlocal(3, frame.getglobal("_tcpsocket").__call__());
- frame.getlocal(3).invoke("_setup", frame.getlocal(2));
- return new PyTuple(new PyObject[] {frame.getlocal(3), new PyTuple(new PyObject[] {frame.getlocal(4), frame.getlocal(1)})});
- }
-
- private static PyObject connect$10(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- /* This signifies a client socket */
- if (frame.getlocal(2)._isnot(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(1, new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(2)}));
- }
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock").__not__());
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1), 2);
- frame.setlocal(3, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- if (frame.getlocal(3)._eq(s$24).__nonzero__()) {
- frame.setlocal(3, frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getLocalHost").__call__());
- }
- frame.getlocal(0).invoke("_setup", frame.getglobal("java").__getattr__("net").__getattr__("Socket").__call__(frame.getlocal(3), frame.getlocal(2)));
- return Py.None;
- }
-
- private static PyObject _setup$11(PyFrame frame) {
- frame.getlocal(0).__setattr__("sock", frame.getlocal(1));
- if (frame.getglobal("hasattr").__call__(frame.getlocal(0).__getattr__("sock"), s$25).__nonzero__()) {
- frame.getlocal(0).__getattr__("sock").invoke("setReuseAddress", frame.getlocal(0).__getattr__("reuse_addr"));
- }
- frame.getlocal(0).__setattr__("istream", frame.getlocal(1).invoke("getInputStream"));
- frame.getlocal(0).__setattr__("ostream", frame.getlocal(1).invoke("getOutputStream"));
- return Py.None;
- }
-
- private static PyObject recv$12(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
- frame.setlocal(3, frame.getglobal("jarray").__getattr__("zeros").__call__(frame.getlocal(1), s$28));
- frame.setlocal(2, frame.getlocal(0).__getattr__("istream").invoke("read", frame.getlocal(3)));
- if (frame.getlocal(2)._le(i$22).__nonzero__()) {
- return s$24;
- }
- if (frame.getlocal(2)._lt(frame.getlocal(1)).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(3).__getslice__(null, frame.getlocal(2), null));
- }
- return frame.getlocal(3).invoke("tostring");
- }
-
- private static PyObject send$13(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
- frame.setlocal(2, frame.getglobal("len").__call__(frame.getlocal(1)));
- frame.getlocal(0).__getattr__("ostream").invoke("write", frame.getlocal(1));
- return frame.getlocal(2);
- }
-
- private static PyObject getsockname$14(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject;
-
- // Code
- if (frame.getlocal(0).__getattr__("sock").__not__().__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence((t$0$PyObject = frame.getlocal(0).__getattr__("addr")).__nonzero__() ? t$0$PyObject : new PyTuple(new PyObject[] {s$24, i$22}), 2);
- frame.setlocal(2, t$0$PyObject__[0]);
- frame.setlocal(1, t$0$PyObject__[1]);
- frame.setlocal(2, frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getByName").__call__(frame.getlocal(2)).invoke("getHostAddress"));
- }
- else {
- if (frame.getlocal(0).__getattr__("server").__nonzero__()) {
- frame.setlocal(2, frame.getlocal(0).__getattr__("sock").invoke("getInetAddress").invoke("getHostAddress"));
- }
- else {
- frame.setlocal(2, frame.getlocal(0).__getattr__("sock").invoke("getLocalAddress").invoke("getHostAddress"));
- }
- frame.setlocal(1, frame.getlocal(0).__getattr__("sock").invoke("getLocalPort"));
- }
- return new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(1)});
- }
-
- private static PyObject getpeername$15(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("server").__not__());
- frame.setlocal(2, frame.getlocal(0).__getattr__("sock").invoke("getInetAddress").invoke("getHostAddress"));
- frame.setlocal(1, frame.getlocal(0).__getattr__("sock").invoke("getPort"));
- return new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(1)});
- }
-
- private static PyObject setsockopt$16(PyFrame frame) {
- if (frame.getlocal(2)._eq(frame.getglobal("SO_REUSEADDR")).__nonzero__()) {
- frame.getlocal(0).__setattr__("reuse_addr", frame.getlocal(3));
- }
- return Py.None;
- }
-
- private static PyObject getsockopt$17(PyFrame frame) {
- if (frame.getlocal(2)._eq(frame.getglobal("SO_REUSEADDR")).__nonzero__()) {
- return frame.getlocal(0).__getattr__("reuse_addr");
- }
- return Py.None;
- }
-
- private static PyObject makefile$18(PyFrame frame) {
- frame.setlocal(3, frame.getglobal("None"));
- if (frame.getlocal(0).__getattr__("istream").__nonzero__()) {
- if (frame.getlocal(0).__getattr__("ostream").__nonzero__()) {
- frame.setlocal(3, frame.getglobal("org").__getattr__("python").__getattr__("core").__getattr__("PyFile").__call__(new PyObject[] {frame.getlocal(0).__getattr__("istream"), frame.getlocal(0).__getattr__("ostream"), s$29, frame.getlocal(1)}));
- }
- else {
- frame.setlocal(3, frame.getglobal("org").__getattr__("python").__getattr__("core").__getattr__("PyFile").__call__(frame.getlocal(0).__getattr__("istream"), s$29, frame.getlocal(1)));
- }
- }
- else if (frame.getlocal(0).__getattr__("ostream").__nonzero__()) {
- frame.setlocal(3, frame.getglobal("org").__getattr__("python").__getattr__("core").__getattr__("PyFile").__call__(frame.getlocal(0).__getattr__("ostream"), s$29, frame.getlocal(1)));
- }
- else {
- throw Py.makeException(frame.getglobal("IOError"), s$30);
- }
- if (frame.getlocal(3).__nonzero__()) {
- return frame.getglobal("_tcpsocket").invoke("FileWrapper", frame.getlocal(0), frame.getlocal(3));
- }
- return Py.None;
- }
-
- private static PyObject __init__$19(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
-
- // Code
- frame.getlocal(0).__setattr__("socket", frame.getlocal(1));
- frame.getlocal(0).__setattr__("sock", frame.getlocal(1).__getattr__("sock"));
- frame.getlocal(0).__setattr__("istream", frame.getlocal(1).__getattr__("istream"));
- frame.getlocal(0).__setattr__("ostream", frame.getlocal(1).__getattr__("ostream"));
- frame.getlocal(0).__setattr__("file", frame.getlocal(2));
- frame.getlocal(0).__setattr__("read", frame.getlocal(2).__getattr__("read"));
- frame.getlocal(0).__setattr__("readline", frame.getlocal(2).__getattr__("readline"));
- frame.getlocal(0).__setattr__("readlines", frame.getlocal(2).__getattr__("readlines"));
- frame.getlocal(0).__setattr__("write", frame.getlocal(2).__getattr__("write"));
- frame.getlocal(0).__setattr__("writelines", frame.getlocal(2).__getattr__("writelines"));
- frame.getlocal(0).__setattr__("flush", frame.getlocal(2).__getattr__("flush"));
- frame.getlocal(0).__setattr__("seek", frame.getlocal(2).__getattr__("seek"));
- frame.getlocal(0).__setattr__("tell", frame.getlocal(2).__getattr__("tell"));
- t$0$PyObject = i$15;
- t$1$PyObject = frame.getlocal(0);
- t$2$PyObject = t$1$PyObject.__getattr__("socket");
- t$2$PyObject.__setattr__("file_count", t$2$PyObject.__getattr__("file_count").__iadd__(t$0$PyObject));
- return Py.None;
- }
-
- private static PyObject close$20(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
-
- // Code
- if (frame.getlocal(0).__getattr__("file").__getattr__("closed").__nonzero__()) {
- return Py.None;
- }
- t$0$PyObject = i$15;
- t$1$PyObject = frame.getlocal(0);
- t$2$PyObject = t$1$PyObject.__getattr__("socket");
- t$2$PyObject.__setattr__("file_count", t$2$PyObject.__getattr__("file_count").__isub__(t$0$PyObject));
- frame.getlocal(0).__getattr__("file").invoke("close");
- if (((t$0$PyObject = frame.getlocal(0).__getattr__("socket").__getattr__("file_count")._eq(i$22)).__nonzero__() ? frame.getlocal(0).__getattr__("socket").__getattr__("sock")._eq(i$22) : t$0$PyObject).__nonzero__()) {
- if (frame.getlocal(0).__getattr__("sock").__nonzero__()) {
- frame.getlocal(0).__getattr__("sock").invoke("close");
- }
- if (frame.getlocal(0).__getattr__("istream").__nonzero__()) {
- frame.getlocal(0).__getattr__("istream").invoke("close");
- }
- if (frame.getlocal(0).__getattr__("ostream").__nonzero__()) {
- frame.getlocal(0).__getattr__("ostream").invoke("close");
- }
- }
- return Py.None;
- }
-
- private static PyObject FileWrapper$21(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$18___init__));
- frame.setlocal("close", new PyFunction(frame.f_globals, new PyObject[] {}, c$19_close));
- return frame.getf_locals();
- }
-
- private static PyObject shutdown$22(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(1)._in(new PyTuple(new PyObject[] {i$22, i$15, i$14})));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
- if (frame.getlocal(1)._in(new PyTuple(new PyObject[] {i$22, i$14})).__nonzero__()) {
- frame.getlocal(0).__setattr__("istream", frame.getglobal("None"));
- }
- if (frame.getlocal(1)._in(new PyTuple(new PyObject[] {i$15, i$14})).__nonzero__()) {
- frame.getlocal(0).__setattr__("ostream", frame.getglobal("None"));
- }
- return Py.None;
- }
-
- private static PyObject close$23(PyFrame frame) {
- frame.setlocal(2, frame.getlocal(0).__getattr__("sock"));
- frame.setlocal(3, frame.getlocal(0).__getattr__("istream"));
- frame.setlocal(1, frame.getlocal(0).__getattr__("ostream"));
- frame.getlocal(0).__setattr__("sock", i$22);
- frame.getlocal(0).__setattr__("istream", i$22);
- frame.getlocal(0).__setattr__("ostream", i$22);
- if (frame.getlocal(0).__getattr__("file_count")._eq(i$22).__nonzero__()) {
- if (frame.getlocal(3).__nonzero__()) {
- frame.getlocal(3).invoke("close");
- }
- if (frame.getlocal(1).__nonzero__()) {
- frame.getlocal(1).invoke("close");
- }
- if (frame.getlocal(2).__nonzero__()) {
- frame.getlocal(2).invoke("close");
- }
- }
- return Py.None;
- }
-
- private static PyObject _tcpsocket$24(PyFrame frame) {
- frame.setlocal("sock", frame.getname("None"));
- frame.setlocal("istream", frame.getname("None"));
- frame.setlocal("ostream", frame.getname("None"));
- frame.setlocal("addr", frame.getname("None"));
- frame.setlocal("server", i$22);
- frame.setlocal("file_count", i$22);
- frame.setlocal("reuse_addr", i$22);
- frame.setlocal("bind", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$6_bind));
- frame.setlocal("listen", new PyFunction(frame.f_globals, new PyObject[] {i$26}, c$7_listen));
- frame.setlocal("accept", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_accept));
- frame.setlocal("connect", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$9_connect));
- frame.setlocal("_setup", new PyFunction(frame.f_globals, new PyObject[] {}, c$10__setup));
- frame.setlocal("recv", new PyFunction(frame.f_globals, new PyObject[] {}, c$11_recv));
- frame.setlocal("send", new PyFunction(frame.f_globals, new PyObject[] {}, c$12_send));
- frame.setlocal("getsockname", new PyFunction(frame.f_globals, new PyObject[] {}, c$13_getsockname));
- frame.setlocal("getpeername", new PyFunction(frame.f_globals, new PyObject[] {}, c$14_getpeername));
- frame.setlocal("setsockopt", new PyFunction(frame.f_globals, new PyObject[] {}, c$15_setsockopt));
- frame.setlocal("getsockopt", new PyFunction(frame.f_globals, new PyObject[] {}, c$16_getsockopt));
- frame.setlocal("makefile", new PyFunction(frame.f_globals, new PyObject[] {s$31, i$15.__neg__()}, c$17_makefile));
- frame.setlocal("FileWrapper", Py.makeClass("FileWrapper", new PyObject[] {}, c$20_FileWrapper, null));
- frame.setlocal("shutdown", new PyFunction(frame.f_globals, new PyObject[] {}, c$21_shutdown));
- frame.setlocal("close", new PyFunction(frame.f_globals, new PyObject[] {}, c$22_close));
- return frame.getf_locals();
- }
-
- private static PyObject __init__$25(PyFrame frame) {
- frame.getlocal(0).__setattr__("sock", frame.getglobal("None"));
- frame.getlocal(0).__setattr__("addr", frame.getglobal("None"));
- return Py.None;
- }
-
- private static PyObject bind$26(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- if (frame.getlocal(2)._isnot(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(1, new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(2)}));
- }
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock").__not__());
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1), 2);
- frame.setlocal(4, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- if (frame.getlocal(4)._eq(s$24).__nonzero__()) {
- frame.getlocal(0).__setattr__("sock", frame.getglobal("java").__getattr__("net").__getattr__("DatagramSocket").__call__(frame.getlocal(2)));
- }
- else {
- frame.setlocal(3, frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getByName").__call__(frame.getlocal(4)));
- frame.getlocal(0).__setattr__("sock", frame.getglobal("java").__getattr__("net").__getattr__("DatagramSocket").__call__(frame.getlocal(2), frame.getlocal(3)));
- }
- return Py.None;
- }
-
- private static PyObject connect$27(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- if (frame.getlocal(2)._isnot(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(1, new PyTuple(new PyObject[] {frame.getlocal(1), frame.getlocal(2)}));
- }
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1), 2);
- frame.setlocal(3, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("addr").__not__());
- if (frame.getlocal(0).__getattr__("sock").__not__().__nonzero__()) {
- frame.getlocal(0).__setattr__("sock", frame.getglobal("java").__getattr__("net").__getattr__("DatagramSocket").__call__());
- }
- frame.getlocal(0).__setattr__("addr", frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject sendto$28(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- frame.setlocal(4, frame.getglobal("len").__call__(frame.getlocal(1)));
- if (frame.getlocal(0).__getattr__("sock").__not__().__nonzero__()) {
- frame.getlocal(0).__setattr__("sock", frame.getglobal("java").__getattr__("net").__getattr__("DatagramSocket").__call__());
- }
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(2), 2);
- frame.setlocal(7, t$0$PyObject__[0]);
- frame.setlocal(5, t$0$PyObject__[1]);
- frame.setlocal(8, frame.getglobal("jarray").__getattr__("array").__call__(frame.getglobal("map").__call__(frame.getglobal("ord"), frame.getlocal(1)), s$28));
- frame.setlocal(6, frame.getglobal("java").__getattr__("net").__getattr__("InetAddress").__getattr__("getByName").__call__(frame.getlocal(7)));
- frame.setlocal(3, frame.getglobal("java").__getattr__("net").__getattr__("DatagramPacket").__call__(new PyObject[] {frame.getlocal(8), frame.getlocal(4), frame.getlocal(6), frame.getlocal(5)}));
- frame.getlocal(0).__getattr__("sock").invoke("send", frame.getlocal(3));
- return frame.getlocal(4);
- }
-
- private static PyObject send$29(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("addr"));
- return frame.getlocal(0).invoke("sendto", frame.getlocal(0).__getattr__("addr"));
- }
-
- private static PyObject recvfrom$30(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
- frame.setlocal(6, frame.getglobal("jarray").__getattr__("zeros").__call__(frame.getlocal(1), s$28));
- frame.setlocal(2, frame.getglobal("java").__getattr__("net").__getattr__("DatagramPacket").__call__(frame.getlocal(6), frame.getlocal(1)));
- frame.getlocal(0).__getattr__("sock").invoke("receive", frame.getlocal(2));
- frame.setlocal(5, frame.getlocal(2).invoke("getAddress").invoke("getHostName"));
- frame.setlocal(3, frame.getlocal(2).invoke("getPort"));
- frame.setlocal(4, frame.getlocal(2).invoke("getLength"));
- if (frame.getlocal(4)._lt(frame.getlocal(1)).__nonzero__()) {
- frame.setlocal(6, frame.getlocal(6).__getslice__(null, frame.getlocal(4), null));
- }
- return new PyTuple(new PyObject[] {frame.getlocal(6).invoke("tostring"), new PyTuple(new PyObject[] {frame.getlocal(5), frame.getlocal(3)})});
- }
-
- private static PyObject recv$31(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
- frame.setlocal(3, frame.getglobal("jarray").__getattr__("zeros").__call__(frame.getlocal(1), s$28));
- frame.setlocal(4, frame.getglobal("java").__getattr__("net").__getattr__("DatagramPacket").__call__(frame.getlocal(3), frame.getlocal(1)));
- frame.getlocal(0).__getattr__("sock").invoke("receive", frame.getlocal(4));
- frame.setlocal(2, frame.getlocal(4).invoke("getLength"));
- if (frame.getlocal(2)._lt(frame.getlocal(1)).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(3).__getslice__(null, frame.getlocal(2), null));
- }
- return frame.getlocal(3).invoke("tostring");
- }
-
- private static PyObject getsockname$32(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
- frame.setlocal(2, frame.getlocal(0).__getattr__("sock").invoke("getLocalAddress").invoke("getHostName"));
- frame.setlocal(1, frame.getlocal(0).__getattr__("sock").invoke("getLocalPort"));
- return new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(1)});
- }
-
- private static PyObject getpeername$33(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("sock"));
- frame.setlocal(2, frame.getlocal(0).__getattr__("sock").invoke("getInetAddress").invoke("getHostName"));
- frame.setlocal(1, frame.getlocal(0).__getattr__("sock").invoke("getPort"));
- return new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(1)});
- }
-
- private static PyObject __del__$34(PyFrame frame) {
- frame.getlocal(0).invoke("close");
- return Py.None;
- }
-
- private static PyObject close$35(PyFrame frame) {
- frame.setlocal(1, frame.getlocal(0).__getattr__("sock"));
- frame.getlocal(0).__setattr__("sock", i$22);
- frame.getlocal(1).invoke("close");
- return Py.None;
- }
-
- private static PyObject _udpsocket$36(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$24___init__));
- frame.setlocal("bind", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$25_bind));
- frame.setlocal("connect", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$26_connect));
- frame.setlocal("sendto", new PyFunction(frame.f_globals, new PyObject[] {}, c$27_sendto));
- frame.setlocal("send", new PyFunction(frame.f_globals, new PyObject[] {}, c$28_send));
- frame.setlocal("recvfrom", new PyFunction(frame.f_globals, new PyObject[] {}, c$29_recvfrom));
- frame.setlocal("recv", new PyFunction(frame.f_globals, new PyObject[] {}, c$30_recv));
- frame.setlocal("getsockname", new PyFunction(frame.f_globals, new PyObject[] {}, c$31_getsockname));
- frame.setlocal("getpeername", new PyFunction(frame.f_globals, new PyObject[] {}, c$32_getpeername));
- frame.setlocal("__del__", new PyFunction(frame.f_globals, new PyObject[] {}, c$33___del__));
- frame.setlocal("close", new PyFunction(frame.f_globals, new PyObject[] {}, c$34_close));
- return frame.getf_locals();
- }
-
- private static PyObject test$37(PyFrame frame) {
- frame.setlocal(0, frame.getglobal("socket").__call__(frame.getglobal("AF_INET"), frame.getglobal("SOCK_STREAM")));
- frame.getlocal(0).invoke("connect", new PyTuple(new PyObject[] {s$24, i$32}));
- frame.getlocal(0).invoke("send", s$33);
- while (i$15.__nonzero__()) {
- frame.setlocal(1, frame.getlocal(0).invoke("recv", i$34));
- Py.println(frame.getlocal(1));
- if (frame.getlocal(1).__not__().__nonzero__()) {
- break;
- }
- }
- return Py.None;
- }
-
- private static PyObject main$38(PyFrame frame) {
- frame.setglobal("__file__", s$36);
-
- /* Preliminary socket module.
-
- XXX Restrictions:
-
- - Only INET sockets
- - No asynchronous behavior
- - No socket options
- - Can't do a very good gethostbyaddr() right...
-
- */
- frame.setlocal("java", org.python.core.imp.importOne("java.net", frame));
- frame.setlocal("org", org.python.core.imp.importOne("org.python.core", frame));
- frame.setlocal("jarray", org.python.core.imp.importOne("jarray", frame));
- frame.setlocal("string", org.python.core.imp.importOne("string", frame));
- frame.setlocal("__all__", new PyList(new PyObject[] {s$1, s$2, s$3, s$4, s$5, s$6, s$7, s$8, s$9, s$10, s$11, s$12, s$13}));
- frame.setlocal("error", frame.getname("IOError"));
- frame.setlocal("AF_INET", i$14);
- frame.setlocal("SOCK_DGRAM", i$15);
- frame.setlocal("SOCK_STREAM", i$14);
- frame.setlocal("SOCK_RAW", i$16);
- frame.setlocal("SOCK_RDM", i$17);
- frame.setlocal("SOCK_SEQPACKET", i$18);
- frame.setlocal("SOL_SOCKET", i$19);
- frame.setlocal("SO_REUSEADDR", i$17);
- frame.setlocal("_gethostbyaddr", new PyFunction(frame.f_globals, new PyObject[] {}, c$0__gethostbyaddr));
- frame.setlocal("getfqdn", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$1_getfqdn));
- frame.setlocal("gethostname", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_gethostname));
- frame.setlocal("gethostbyname", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_gethostbyname));
- frame.setlocal("gethostbyaddr", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_gethostbyaddr));
- frame.setlocal("socket", new PyFunction(frame.f_globals, new PyObject[] {i$22}, c$5_socket));
- frame.setlocal("_tcpsocket", Py.makeClass("_tcpsocket", new PyObject[] {}, c$23__tcpsocket, null));
- frame.setlocal("_udpsocket", Py.makeClass("_udpsocket", new PyObject[] {}, c$35__udpsocket, null));
- frame.setlocal("SocketType", frame.getname("_tcpsocket"));
- frame.setlocal("test", new PyFunction(frame.f_globals, new PyObject[] {}, c$36_test));
- if (frame.getname("__name__")._eq(s$35).__nonzero__()) {
- frame.getname("test").__call__();
- }
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("socket"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "socket";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(socket._PyInner.class, newargs, socket.jpy$packages, socket.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class sre extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject s$16;
- private static PyObject s$17;
- private static PyObject s$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyObject s$24;
- private static PyObject i$25;
- private static PyObject s$26;
- private static PyObject s$27;
- private static PyObject s$28;
- private static PyObject s$29;
- private static PyObject s$30;
- private static PyObject s$31;
- private static PyObject s$32;
- private static PyObject s$33;
- private static PyObject s$34;
- private static PyObject s$35;
- private static PyObject s$36;
- private static PyObject s$37;
- private static PyObject s$38;
- private static PyObject s$39;
- private static PyObject s$40;
- private static PyObject s$41;
- private static PyObject s$42;
- private static PyObject s$43;
- private static PyObject i$44;
- private static PyObject i$45;
- private static PyObject s$46;
- private static PyObject s$47;
- private static PyFunctionTable funcTable;
- private static PyCode c$0_match;
- private static PyCode c$1_search;
- private static PyCode c$2_sub;
- private static PyCode c$3_subn;
- private static PyCode c$4_split;
- private static PyCode c$5_findall;
- private static PyCode c$6_compile;
- private static PyCode c$7_purge;
- private static PyCode c$8_template;
- private static PyCode c$9_escape;
- private static PyCode c$10__join;
- private static PyCode c$11__compile;
- private static PyCode c$12__compile_repl;
- private static PyCode c$13__expand;
- private static PyCode c$14__sub;
- private static PyCode c$15_filter;
- private static PyCode c$16__subn;
- private static PyCode c$17__split;
- private static PyCode c$18__pickle;
- private static PyCode c$19___init__;
- private static PyCode c$20_scan;
- private static PyCode c$21_Scanner;
- private static PyCode c$22_main;
- private static void initConstants() {
- s$0 = Py.newString("match");
- s$1 = Py.newString("search");
- s$2 = Py.newString("sub");
- s$3 = Py.newString("subn");
- s$4 = Py.newString("split");
- s$5 = Py.newString("findall");
- s$6 = Py.newString("compile");
- s$7 = Py.newString("purge");
- s$8 = Py.newString("template");
- s$9 = Py.newString("escape");
- s$10 = Py.newString("I");
- s$11 = Py.newString("L");
- s$12 = Py.newString("M");
- s$13 = Py.newString("S");
- s$14 = Py.newString("X");
- s$15 = Py.newString("U");
- s$16 = Py.newString("IGNORECASE");
- s$17 = Py.newString("LOCALE");
- s$18 = Py.newString("MULTILINE");
- s$19 = Py.newString("DOTALL");
- s$20 = Py.newString("VERBOSE");
- s$21 = Py.newString("UNICODE");
- s$22 = Py.newString("error");
- s$23 = Py.newString("2.1b2");
- s$24 = Py.newString("Try to apply the pattern at the start of the string, returning\012 a match object, or None if no match was found.");
- i$25 = Py.newInteger(0);
- s$26 = Py.newString("Scan through string looking for a match to the pattern, returning\012 a match object, or None if no match was found.");
- s$27 = Py.newString("Return the string obtained by replacing the leftmost\012 non-overlapping occurrences of the pattern in string by the\012 replacement repl");
- s$28 = Py.newString("Return a 2-tuple containing (new_string, number).\012 new_string is the string obtained by replacing the leftmost\012 non-overlapping occurrences of the pattern in the source\012 string by the replacement repl. number is the number of\012 substitutions that were made.");
- s$29 = Py.newString("Split the source string by the occurrences of the pattern,\012 returning a list containing the resulting substrings.");
- s$30 = Py.newString("Return a list of all non-overlapping matches in the string.\012\012 If one or more groups are present in the pattern, return a\012 list of groups; this will be a list of tuples if the pattern\012 has more than one group.\012\012 Empty matches are included in the result.");
- s$31 = Py.newString("Compile a regular expression pattern, returning a pattern object.");
- s$32 = Py.newString("Clear the regular expression cache");
- s$33 = Py.newString("Compile a template pattern, returning a pattern object");
- s$34 = Py.newString("Escape all non-alphanumeric characters in pattern.");
- s$35 = Py.newString("a");
- s$36 = Py.newString("z");
- s$37 = Py.newString("A");
- s$38 = Py.newString("Z");
- s$39 = Py.newString("0");
- s$40 = Py.newString("9");
- s$41 = Py.newString("\000");
- s$42 = Py.newString("\\000");
- s$43 = Py.newString("\\");
- i$44 = Py.newInteger(100);
- i$45 = Py.newInteger(1);
- s$46 = Py.newString("");
- s$47 = Py.newString("/usr/share/jython/Lib-cpython/sre.py");
- funcTable = new _PyInner();
- c$0_match = Py.newCode(3, new String[] {"pattern", "string", "flags"}, "/usr/share/jython/Lib-cpython/sre.py", "match", false, false, funcTable, 0, null, null, 0, 1);
- c$1_search = Py.newCode(3, new String[] {"pattern", "string", "flags"}, "/usr/share/jython/Lib-cpython/sre.py", "search", false, false, funcTable, 1, null, null, 0, 1);
- c$2_sub = Py.newCode(4, new String[] {"pattern", "repl", "string", "count"}, "/usr/share/jython/Lib-cpython/sre.py", "sub", false, false, funcTable, 2, null, null, 0, 1);
- c$3_subn = Py.newCode(4, new String[] {"pattern", "repl", "string", "count"}, "/usr/share/jython/Lib-cpython/sre.py", "subn", false, false, funcTable, 3, null, null, 0, 1);
- c$4_split = Py.newCode(3, new String[] {"pattern", "string", "maxsplit"}, "/usr/share/jython/Lib-cpython/sre.py", "split", false, false, funcTable, 4, null, null, 0, 1);
- c$5_findall = Py.newCode(3, new String[] {"pattern", "string", "maxsplit"}, "/usr/share/jython/Lib-cpython/sre.py", "findall", false, false, funcTable, 5, null, null, 0, 1);
- c$6_compile = Py.newCode(2, new String[] {"pattern", "flags"}, "/usr/share/jython/Lib-cpython/sre.py", "compile", false, false, funcTable, 6, null, null, 0, 1);
- c$7_purge = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/sre.py", "purge", false, false, funcTable, 7, null, null, 0, 1);
- c$8_template = Py.newCode(2, new String[] {"pattern", "flags"}, "/usr/share/jython/Lib-cpython/sre.py", "template", false, false, funcTable, 8, null, null, 0, 1);
- c$9_escape = Py.newCode(1, new String[] {"pattern", "i", "s", "c"}, "/usr/share/jython/Lib-cpython/sre.py", "escape", false, false, funcTable, 9, null, null, 0, 1);
- c$10__join = Py.newCode(2, new String[] {"seq", "sep"}, "/usr/share/jython/Lib-cpython/sre.py", "_join", false, false, funcTable, 10, null, null, 0, 1);
- c$11__compile = Py.newCode(1, new String[] {"key", "p", "flags", "pattern", "v"}, "/usr/share/jython/Lib-cpython/sre.py", "_compile", true, false, funcTable, 11, null, null, 0, 1);
- c$12__compile_repl = Py.newCode(1, new String[] {"key", "p", "repl", "pattern", "v"}, "/usr/share/jython/Lib-cpython/sre.py", "_compile_repl", true, false, funcTable, 12, null, null, 0, 1);
- c$13__expand = Py.newCode(3, new String[] {"pattern", "match", "template"}, "/usr/share/jython/Lib-cpython/sre.py", "_expand", false, false, funcTable, 13, null, null, 0, 1);
- c$14__sub = Py.newCode(4, new String[] {"pattern", "template", "string", "count"}, "/usr/share/jython/Lib-cpython/sre.py", "_sub", false, false, funcTable, 14, null, null, 0, 1);
- c$15_filter = Py.newCode(2, new String[] {"match", "template"}, "/usr/share/jython/Lib-cpython/sre.py", "filter", false, false, funcTable, 15, null, null, 0, 1);
- c$16__subn = Py.newCode(4, new String[] {"pattern", "template", "string", "count", "filter", "append", "n", "m", "i", "e", "c", "b", "s"}, "/usr/share/jython/Lib-cpython/sre.py", "_subn", false, false, funcTable, 16, null, null, 0, 1);
- c$17__split = Py.newCode(3, new String[] {"pattern", "string", "maxsplit", "append", "n", "m", "i", "g", "e", "extend", "c", "b", "s"}, "/usr/share/jython/Lib-cpython/sre.py", "_split", false, false, funcTable, 17, null, null, 0, 1);
- c$18__pickle = Py.newCode(1, new String[] {"p"}, "/usr/share/jython/Lib-cpython/sre.py", "_pickle", false, false, funcTable, 18, null, null, 0, 1);
- c$19___init__ = Py.newCode(2, new String[] {"self", "lexicon", "p", "SUBPATTERN", "phrase", "action", "BRANCH", "s"}, "/usr/share/jython/Lib-cpython/sre.py", "__init__", false, false, funcTable, 19, null, null, 0, 1);
- c$20_scan = Py.newCode(2, new String[] {"self", "string", "append", "m", "action", "j", "i", "match", "result"}, "/usr/share/jython/Lib-cpython/sre.py", "scan", false, false, funcTable, 20, null, null, 0, 1);
- c$21_Scanner = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/sre.py", "Scanner", false, false, funcTable, 21, null, null, 0, 0);
- c$22_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/sre.py", "main", false, false, funcTable, 22, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$22_main == null) _PyInner.initConstants();
- return c$22_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.match$1(frame);
- case 1:
- return _PyInner.search$2(frame);
- case 2:
- return _PyInner.sub$3(frame);
- case 3:
- return _PyInner.subn$4(frame);
- case 4:
- return _PyInner.split$5(frame);
- case 5:
- return _PyInner.findall$6(frame);
- case 6:
- return _PyInner.compile$7(frame);
- case 7:
- return _PyInner.purge$8(frame);
- case 8:
- return _PyInner.template$9(frame);
- case 9:
- return _PyInner.escape$10(frame);
- case 10:
- return _PyInner._join$11(frame);
- case 11:
- return _PyInner._compile$12(frame);
- case 12:
- return _PyInner._compile_repl$13(frame);
- case 13:
- return _PyInner._expand$14(frame);
- case 14:
- return _PyInner._sub$15(frame);
- case 15:
- return _PyInner.filter$16(frame);
- case 16:
- return _PyInner._subn$17(frame);
- case 17:
- return _PyInner._split$18(frame);
- case 18:
- return _PyInner._pickle$19(frame);
- case 19:
- return _PyInner.__init__$20(frame);
- case 20:
- return _PyInner.scan$21(frame);
- case 21:
- return _PyInner.Scanner$22(frame);
- case 22:
- return _PyInner.main$23(frame);
- default:
- return null;
- }
- }
-
- private static PyObject match$1(PyFrame frame) {
- /* Try to apply the pattern at the start of the string, returning
- a match object, or None if no match was found. */
- return frame.getglobal("_compile").__call__(frame.getlocal(0), frame.getlocal(2)).invoke("match", frame.getlocal(1));
- }
-
- private static PyObject search$2(PyFrame frame) {
- /* Scan through string looking for a match to the pattern, returning
- a match object, or None if no match was found. */
- return frame.getglobal("_compile").__call__(frame.getlocal(0), frame.getlocal(2)).invoke("search", frame.getlocal(1));
- }
-
- private static PyObject sub$3(PyFrame frame) {
- /* Return the string obtained by replacing the leftmost
- non-overlapping occurrences of the pattern in string by the
- replacement repl */
- return frame.getglobal("_compile").__call__(frame.getlocal(0), i$25).invoke("sub", new PyObject[] {frame.getlocal(1), frame.getlocal(2), frame.getlocal(3)});
- }
-
- private static PyObject subn$4(PyFrame frame) {
- /* Return a 2-tuple containing (new_string, number).
- new_string is the string obtained by replacing the leftmost
- non-overlapping occurrences of the pattern in the source
- string by the replacement repl. number is the number of
- substitutions that were made. */
- return frame.getglobal("_compile").__call__(frame.getlocal(0), i$25).invoke("subn", new PyObject[] {frame.getlocal(1), frame.getlocal(2), frame.getlocal(3)});
- }
-
- private static PyObject split$5(PyFrame frame) {
- /* Split the source string by the occurrences of the pattern,
- returning a list containing the resulting substrings. */
- return frame.getglobal("_compile").__call__(frame.getlocal(0), i$25).invoke("split", frame.getlocal(1), frame.getlocal(2));
- }
-
- private static PyObject findall$6(PyFrame frame) {
- /* Return a list of all non-overlapping matches in the string.
-
- If one or more groups are present in the pattern, return a
- list of groups; this will be a list of tuples if the pattern
- has more than one group.
-
- Empty matches are included in the result. */
- return frame.getglobal("_compile").__call__(frame.getlocal(0), i$25).invoke("findall", frame.getlocal(1), frame.getlocal(2));
- }
-
- private static PyObject compile$7(PyFrame frame) {
- /* Compile a regular expression pattern, returning a pattern object. */
- return frame.getglobal("_compile").__call__(frame.getlocal(0), frame.getlocal(1));
- }
-
- private static PyObject purge$8(PyFrame frame) {
- /* Clear the regular expression cache */
- frame.getglobal("_cache").invoke("clear");
- frame.getglobal("_cache_repl").invoke("clear");
- return Py.None;
- }
-
- private static PyObject template$9(PyFrame frame) {
- /* Compile a template pattern, returning a pattern object */
- return frame.getglobal("_compile").__call__(frame.getlocal(0), frame.getlocal(1)._or(frame.getglobal("T")));
- }
-
- private static PyObject escape$10(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject, t$4$PyObject;
-
- // Code
- /* Escape all non-alphanumeric characters in pattern. */
- frame.setlocal(2, frame.getglobal("list").__call__(frame.getlocal(0)));
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("range").__call__(frame.getglobal("len").__call__(frame.getlocal(0)));
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(1, t$0$PyObject);
- frame.setlocal(3, frame.getlocal(0).__getitem__(frame.getlocal(1)));
- if (((t$2$PyObject = ((t$3$PyObject = (s$35._le(t$4$PyObject = frame.getlocal(3)).__nonzero__() ? t$4$PyObject._le(s$36) : Py.Zero)).__nonzero__() ? t$3$PyObject : (s$37._le(t$4$PyObject = frame.getlocal(3)).__nonzero__() ? t$4$PyObject._le(s$38) : Py.Zero))).__nonzero__() ? t$2$PyObject : (s$39._le(t$3$PyObject = frame.getlocal(3)).__nonzero__() ? t$3$PyObject._le(s$40) : Py.Zero)).__not__().__nonzero__()) {
- if (frame.getlocal(3)._eq(s$41).__nonzero__()) {
- frame.getlocal(2).__setitem__(frame.getlocal(1), s$42);
- }
- else {
- frame.getlocal(2).__setitem__(frame.getlocal(1), s$43._add(frame.getlocal(3)));
- }
- }
- }
- return frame.getglobal("_join").__call__(frame.getlocal(2), frame.getlocal(0));
- }
-
- private static PyObject _join$11(PyFrame frame) {
- return frame.getglobal("string").__getattr__("join").__call__(frame.getlocal(0), frame.getlocal(1).__getslice__(null, i$25, null));
- }
-
- private static PyObject _compile$12(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
- PyException t$0$PyException;
-
- // Code
- frame.setlocal(1, frame.getglobal("_cache").invoke("get", frame.getlocal(0)));
- if (frame.getlocal(1)._isnot(frame.getglobal("None")).__nonzero__()) {
- return frame.getlocal(1);
- }
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0), 2);
- frame.setlocal(3, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- if (frame.getglobal("type").__call__(frame.getlocal(3))._notin(frame.getglobal("sre_compile").__getattr__("STRING_TYPES")).__nonzero__()) {
- return frame.getlocal(3);
- }
- try {
- frame.setlocal(1, frame.getglobal("sre_compile").__getattr__("compile").__call__(frame.getlocal(3), frame.getlocal(2)));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("error"))) {
- frame.setlocal(4, t$0$PyException.value);
- throw Py.makeException(frame.getglobal("error"), frame.getlocal(4));
- }
- else throw t$0$PyException;
- }
- if (frame.getglobal("len").__call__(frame.getglobal("_cache"))._ge(frame.getglobal("_MAXCACHE")).__nonzero__()) {
- frame.getglobal("_cache").invoke("clear");
- }
- frame.getglobal("_cache").__setitem__(frame.getlocal(0), frame.getlocal(1));
- return frame.getlocal(1);
- }
-
- private static PyObject _compile_repl$13(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
- PyException t$0$PyException;
-
- // Code
- frame.setlocal(1, frame.getglobal("_cache_repl").invoke("get", frame.getlocal(0)));
- if (frame.getlocal(1)._isnot(frame.getglobal("None")).__nonzero__()) {
- return frame.getlocal(1);
- }
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0), 2);
- frame.setlocal(2, t$0$PyObject__[0]);
- frame.setlocal(3, t$0$PyObject__[1]);
- try {
- frame.setlocal(1, frame.getglobal("sre_parse").__getattr__("parse_template").__call__(frame.getlocal(2), frame.getlocal(3)));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("error"))) {
- frame.setlocal(4, t$0$PyException.value);
- throw Py.makeException(frame.getglobal("error"), frame.getlocal(4));
- }
- else throw t$0$PyException;
- }
- if (frame.getglobal("len").__call__(frame.getglobal("_cache_repl"))._ge(frame.getglobal("_MAXCACHE")).__nonzero__()) {
- frame.getglobal("_cache_repl").invoke("clear");
- }
- frame.getglobal("_cache_repl").__setitem__(frame.getlocal(0), frame.getlocal(1));
- return frame.getlocal(1);
- }
-
- private static PyObject _expand$14(PyFrame frame) {
- frame.setlocal(2, frame.getglobal("sre_parse").__getattr__("parse_template").__call__(frame.getlocal(2), frame.getlocal(0)));
- return frame.getglobal("sre_parse").__getattr__("expand_template").__call__(frame.getlocal(2), frame.getlocal(1));
- }
-
- private static PyObject _sub$15(PyFrame frame) {
- return frame.getglobal("_subn").__call__(new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2), frame.getlocal(3)}).__getitem__(i$25);
- }
-
- private static PyObject filter$16(PyFrame frame) {
- return frame.getglobal("sre_parse").__getattr__("expand_template").__call__(frame.getlocal(1), frame.getlocal(0));
- }
-
- private static PyObject _subn$17(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject;
-
- // Code
- if (frame.getglobal("callable").__call__(frame.getlocal(1)).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(1));
- }
- else {
- frame.setlocal(1, frame.getglobal("_compile_repl").__call__(frame.getlocal(1), frame.getlocal(0)));
- frame.setlocal(4, new PyFunction(frame.f_globals, new PyObject[] {frame.getlocal(1)}, c$15_filter));
- }
- t$0$PyObject = i$25;
- frame.setlocal(6, t$0$PyObject);
- frame.setlocal(8, t$0$PyObject);
- frame.setlocal(12, new PyList(new PyObject[] {}));
- frame.setlocal(5, frame.getlocal(12).__getattr__("append"));
- frame.setlocal(10, frame.getlocal(0).invoke("scanner", frame.getlocal(2)));
- while (((t$0$PyObject = frame.getlocal(3).__not__()).__nonzero__() ? t$0$PyObject : frame.getlocal(6)._lt(frame.getlocal(3))).__nonzero__()) {
- frame.setlocal(7, frame.getlocal(10).invoke("search"));
- if (frame.getlocal(7).__not__().__nonzero__()) {
- break;
- }
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(7).invoke("span"), 2);
- frame.setlocal(11, t$0$PyObject__[0]);
- frame.setlocal(9, t$0$PyObject__[1]);
- if (frame.getlocal(8)._lt(frame.getlocal(11)).__nonzero__()) {
- frame.getlocal(5).__call__(frame.getlocal(2).__getslice__(frame.getlocal(8), frame.getlocal(11), null));
- }
- frame.getlocal(5).__call__(frame.getlocal(4).__call__(frame.getlocal(7)));
- frame.setlocal(8, frame.getlocal(9));
- frame.setlocal(6, frame.getlocal(6)._add(i$45));
- }
- frame.getlocal(5).__call__(frame.getlocal(2).__getslice__(frame.getlocal(8), null, null));
- return new PyTuple(new PyObject[] {frame.getglobal("_join").__call__(frame.getlocal(12), frame.getlocal(2).__getslice__(null, i$25, null)), frame.getlocal(6)});
- }
-
- private static PyObject _split$18(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject;
-
- // Code
- t$0$PyObject = i$25;
- frame.setlocal(4, t$0$PyObject);
- frame.setlocal(6, t$0$PyObject);
- frame.setlocal(12, new PyList(new PyObject[] {}));
- frame.setlocal(3, frame.getlocal(12).__getattr__("append"));
- frame.setlocal(9, frame.getlocal(12).__getattr__("extend"));
- frame.setlocal(10, frame.getlocal(0).invoke("scanner", frame.getlocal(1)));
- frame.setlocal(7, frame.getlocal(0).__getattr__("groups"));
- while (((t$0$PyObject = frame.getlocal(2).__not__()).__nonzero__() ? t$0$PyObject : frame.getlocal(4)._lt(frame.getlocal(2))).__nonzero__()) {
- frame.setlocal(5, frame.getlocal(10).invoke("search"));
- if (frame.getlocal(5).__not__().__nonzero__()) {
- break;
- }
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(5).invoke("span"), 2);
- frame.setlocal(11, t$0$PyObject__[0]);
- frame.setlocal(8, t$0$PyObject__[1]);
- if (frame.getlocal(11)._eq(frame.getlocal(8)).__nonzero__()) {
- if (frame.getlocal(6)._ge(frame.getglobal("len").__call__(frame.getlocal(1))).__nonzero__()) {
- break;
- }
- continue;
- }
- frame.getlocal(3).__call__(frame.getlocal(1).__getslice__(frame.getlocal(6), frame.getlocal(11), null));
- if (((t$0$PyObject = frame.getlocal(7)).__nonzero__() ? frame.getlocal(11)._ne(frame.getlocal(8)) : t$0$PyObject).__nonzero__()) {
- frame.getlocal(9).__call__(frame.getglobal("list").__call__(frame.getlocal(5).invoke("groups")));
- }
- frame.setlocal(6, frame.getlocal(8));
- frame.setlocal(4, frame.getlocal(4)._add(i$45));
- }
- frame.getlocal(3).__call__(frame.getlocal(1).__getslice__(frame.getlocal(6), null, null));
- return frame.getlocal(12);
- }
-
- private static PyObject _pickle$19(PyFrame frame) {
- return new PyTuple(new PyObject[] {frame.getglobal("_compile"), new PyTuple(new PyObject[] {frame.getlocal(0).__getattr__("pattern"), frame.getlocal(0).__getattr__("flags")})});
- }
-
- private static PyObject __init__$20(PyFrame frame) {
- PyObject[] imp_accu;
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- imp_accu = org.python.core.imp.importFrom("sre_constants", new String[] {"BRANCH", "SUBPATTERN"}, frame);
- frame.setlocal(6, imp_accu[0]);
- frame.setlocal(3, imp_accu[1]);
- imp_accu = null;
- frame.getlocal(0).__setattr__("lexicon", frame.getlocal(1));
- frame.setlocal(2, new PyList(new PyObject[] {}));
- frame.setlocal(7, frame.getglobal("sre_parse").__getattr__("Pattern").__call__());
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(1);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(4, t$0$PyObject__[0]);
- frame.setlocal(5, t$0$PyObject__[1]);
- frame.getlocal(2).invoke("append", frame.getglobal("sre_parse").__getattr__("SubPattern").__call__(frame.getlocal(7), new PyList(new PyObject[] {new PyTuple(new PyObject[] {frame.getlocal(3), new PyTuple(new PyObject[] {frame.getglobal("len").__call__(frame.getlocal(2)), frame.getglobal("sre_parse").__getattr__("parse").__call__(frame.getlocal(4))})})})));
- }
- frame.setlocal(2, frame.getglobal("sre_parse").__getattr__("SubPattern").__call__(frame.getlocal(7), new PyList(new PyObject[] {new PyTuple(new PyObject[] {frame.getlocal(6), new PyTuple(new PyObject[] {frame.getglobal("None"), frame.getlocal(2)})})})));
- frame.getlocal(7).__setattr__("groups", frame.getglobal("len").__call__(frame.getlocal(2)));
- frame.getlocal(0).__setattr__("scanner", frame.getglobal("sre_compile").__getattr__("compile").__call__(frame.getlocal(2)));
- return Py.None;
- }
-
- private static PyObject scan$21(PyFrame frame) {
- frame.setlocal(8, new PyList(new PyObject[] {}));
- frame.setlocal(2, frame.getlocal(8).__getattr__("append"));
- frame.setlocal(7, frame.getlocal(0).__getattr__("scanner").__getattr__("match"));
- frame.setlocal(6, i$25);
- while (i$45.__nonzero__()) {
- frame.setlocal(3, frame.getlocal(7).__call__(frame.getlocal(1), frame.getlocal(6)));
- if (frame.getlocal(3).__not__().__nonzero__()) {
- break;
- }
- frame.setlocal(5, frame.getlocal(3).invoke("end"));
- if (frame.getlocal(6)._eq(frame.getlocal(5)).__nonzero__()) {
- break;
- }
- frame.setlocal(4, frame.getlocal(0).__getattr__("lexicon").__getitem__(frame.getlocal(3).__getattr__("lastindex")).__getitem__(i$45));
- if (frame.getglobal("callable").__call__(frame.getlocal(4)).__nonzero__()) {
- frame.getlocal(0).__setattr__("match", frame.getlocal(3));
- frame.setlocal(4, frame.getlocal(4).__call__(frame.getlocal(0), frame.getlocal(3).invoke("group")));
- }
- if (frame.getlocal(4)._isnot(frame.getglobal("None")).__nonzero__()) {
- frame.getlocal(2).__call__(frame.getlocal(4));
- }
- frame.setlocal(6, frame.getlocal(5));
- }
- return new PyTuple(new PyObject[] {frame.getlocal(8), frame.getlocal(1).__getslice__(frame.getlocal(6), null, null)});
- }
-
- private static PyObject Scanner$22(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$19___init__));
- frame.setlocal("scan", new PyFunction(frame.f_globals, new PyObject[] {}, c$20_scan));
- return frame.getf_locals();
- }
-
- private static PyObject main$23(PyFrame frame) {
- frame.setglobal("__file__", s$47);
-
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- frame.setlocal("sre_compile", org.python.core.imp.importOne("sre_compile", frame));
- frame.setlocal("sre_parse", org.python.core.imp.importOne("sre_parse", frame));
- frame.setlocal("__all__", new PyList(new PyObject[] {s$0, s$1, s$2, s$3, s$4, s$5, s$6, s$7, s$8, s$9, s$10, s$11, s$12, s$13, s$14, s$15, s$16, s$17, s$18, s$19, s$20, s$21, s$22}));
- frame.setlocal("__version__", s$23);
- frame.setlocal("string", org.python.core.imp.importOne("string", frame));
- t$0$PyObject = frame.getname("sre_compile").__getattr__("SRE_FLAG_IGNORECASE");
- frame.setlocal("I", t$0$PyObject);
- frame.setlocal("IGNORECASE", t$0$PyObject);
- t$0$PyObject = frame.getname("sre_compile").__getattr__("SRE_FLAG_LOCALE");
- frame.setlocal("L", t$0$PyObject);
- frame.setlocal("LOCALE", t$0$PyObject);
- t$0$PyObject = frame.getname("sre_compile").__getattr__("SRE_FLAG_UNICODE");
- frame.setlocal("U", t$0$PyObject);
- frame.setlocal("UNICODE", t$0$PyObject);
- t$0$PyObject = frame.getname("sre_compile").__getattr__("SRE_FLAG_MULTILINE");
- frame.setlocal("M", t$0$PyObject);
- frame.setlocal("MULTILINE", t$0$PyObject);
- t$0$PyObject = frame.getname("sre_compile").__getattr__("SRE_FLAG_DOTALL");
- frame.setlocal("S", t$0$PyObject);
- frame.setlocal("DOTALL", t$0$PyObject);
- t$0$PyObject = frame.getname("sre_compile").__getattr__("SRE_FLAG_VERBOSE");
- frame.setlocal("X", t$0$PyObject);
- frame.setlocal("VERBOSE", t$0$PyObject);
- t$0$PyObject = frame.getname("sre_compile").__getattr__("SRE_FLAG_TEMPLATE");
- frame.setlocal("T", t$0$PyObject);
- frame.setlocal("TEMPLATE", t$0$PyObject);
- frame.setlocal("DEBUG", frame.getname("sre_compile").__getattr__("SRE_FLAG_DEBUG"));
- frame.setlocal("error", frame.getname("sre_compile").__getattr__("error"));
- frame.setlocal("match", new PyFunction(frame.f_globals, new PyObject[] {i$25}, c$0_match));
- frame.setlocal("search", new PyFunction(frame.f_globals, new PyObject[] {i$25}, c$1_search));
- frame.setlocal("sub", new PyFunction(frame.f_globals, new PyObject[] {i$25}, c$2_sub));
- frame.setlocal("subn", new PyFunction(frame.f_globals, new PyObject[] {i$25}, c$3_subn));
- frame.setlocal("split", new PyFunction(frame.f_globals, new PyObject[] {i$25}, c$4_split));
- frame.setlocal("findall", new PyFunction(frame.f_globals, new PyObject[] {i$25}, c$5_findall));
- frame.setlocal("compile", new PyFunction(frame.f_globals, new PyObject[] {i$25}, c$6_compile));
- frame.setlocal("purge", new PyFunction(frame.f_globals, new PyObject[] {}, c$7_purge));
- frame.setlocal("template", new PyFunction(frame.f_globals, new PyObject[] {i$25}, c$8_template));
- frame.setlocal("escape", new PyFunction(frame.f_globals, new PyObject[] {}, c$9_escape));
- frame.setlocal("_cache", new PyDictionary(new PyObject[] {}));
- frame.setlocal("_cache_repl", new PyDictionary(new PyObject[] {}));
- frame.setlocal("_MAXCACHE", i$44);
- frame.setlocal("_join", new PyFunction(frame.f_globals, new PyObject[] {}, c$10__join));
- frame.setlocal("_compile", new PyFunction(frame.f_globals, new PyObject[] {}, c$11__compile));
- frame.setlocal("_compile_repl", new PyFunction(frame.f_globals, new PyObject[] {}, c$12__compile_repl));
- frame.setlocal("_expand", new PyFunction(frame.f_globals, new PyObject[] {}, c$13__expand));
- frame.setlocal("_sub", new PyFunction(frame.f_globals, new PyObject[] {i$25}, c$14__sub));
- frame.setlocal("_subn", new PyFunction(frame.f_globals, new PyObject[] {i$25}, c$16__subn));
- frame.setlocal("_split", new PyFunction(frame.f_globals, new PyObject[] {i$25}, c$17__split));
- frame.setlocal("copy_reg", org.python.core.imp.importOne("copy_reg", frame));
- frame.setlocal("_pickle", new PyFunction(frame.f_globals, new PyObject[] {}, c$18__pickle));
- frame.getname("copy_reg").__getattr__("pickle").__call__(frame.getname("type").__call__(frame.getname("_compile").__call__(s$46, i$25)), frame.getname("_pickle"), frame.getname("_compile"));
- frame.setlocal("Scanner", Py.makeClass("Scanner", new PyObject[] {}, c$21_Scanner, null));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("sre"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "sre";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(sre._PyInner.class, newargs, sre.jpy$packages, sre.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class sre_compile extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject i$1;
- private static PyObject i$2;
- private static PyObject s$3;
- private static PyObject i$4;
- private static PyObject i$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject i$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject i$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyFunctionTable funcTable;
- private static PyCode c$0_fixup;
- private static PyCode c$1_lambda;
- private static PyCode c$2__compile;
- private static PyCode c$3_lambda;
- private static PyCode c$4__compile_charset;
- private static PyCode c$5__optimize_charset;
- private static PyCode c$6__simple;
- private static PyCode c$7__compile_info;
- private static PyCode c$8__code;
- private static PyCode c$9_compile;
- private static PyCode c$10_main;
- private static void initConstants() {
- s$0 = Py.newString("SRE module mismatch");
- i$1 = Py.newInteger(65535);
- i$2 = Py.newInteger(0);
- s$3 = Py.newString("internal: unsupported template operator");
- i$4 = Py.newInteger(1);
- i$5 = Py.newInteger(2);
- s$6 = Py.newString("look-behind requires fixed-width pattern");
- s$7 = Py.newString("unsupported operand type");
- s$8 = Py.newString("internal: unsupported set operator");
- i$9 = Py.newInteger(256);
- s$10 = Py.newString("nothing to repeat");
- s$11 = Py.newString("");
- i$12 = Py.newInteger(100);
- s$13 = Py.newString("sorry, but this version only supports 100 named groups");
- s$14 = Py.newString("/usr/share/jython/Lib-cpython/sre_compile.py");
- funcTable = new _PyInner();
- c$0_fixup = Py.newCode(2, new String[] {"literal", "flags"}, "/usr/share/jython/Lib-cpython/sre_compile.py", "fixup", false, false, funcTable, 0, null, null, 0, 1);
- c$1_lambda = Py.newCode(1, new String[] {"x"}, "/usr/share/jython/Lib-cpython/sre_compile.py", "<lambda>", false, false, funcTable, 1, null, null, 0, 1);
- c$2__compile = Py.newCode(3, new String[] {"code", "pattern", "flags", "av", "emit", "skip", "lo", "op", "fixup", "hi", "tail"}, "/usr/share/jython/Lib-cpython/sre_compile.py", "_compile", false, false, funcTable, 2, null, null, 0, 1);
- c$3_lambda = Py.newCode(1, new String[] {"x"}, "/usr/share/jython/Lib-cpython/sre_compile.py", "<lambda>", false, false, funcTable, 3, null, null, 0, 1);
- c$4__compile_charset = Py.newCode(4, new String[] {"charset", "flags", "code", "fixup", "op", "av", "emit"}, "/usr/share/jython/Lib-cpython/sre_compile.py", "_compile_charset", false, false, funcTable, 4, null, null, 0, 1);
- c$5__optimize_charset = Py.newCode(2, new String[] {"charset", "fixup", "op", "v", "av", "charmap", "p", "n", "m", "runs", "i", "out", "c", "data"}, "/usr/share/jython/Lib-cpython/sre_compile.py", "_optimize_charset", false, false, funcTable, 5, null, null, 0, 1);
- c$6__simple = Py.newCode(1, new String[] {"av", "hi", "lo"}, "/usr/share/jython/Lib-cpython/sre_compile.py", "_simple", false, false, funcTable, 6, null, null, 0, 1);
- c$7__compile_info = Py.newCode(3, new String[] {"code", "pattern", "flags", "hi", "charset", "lo", "op", "av", "emit", "p", "skip", "prefix", "i", "mask", "table", "c", "prefix_skip"}, "/usr/share/jython/Lib-cpython/sre_compile.py", "_compile_info", false, false, funcTable, 7, null, null, 0, 1);
- c$8__code = Py.newCode(2, new String[] {"p", "flags", "code"}, "/usr/share/jython/Lib-cpython/sre_compile.py", "_code", false, false, funcTable, 8, null, null, 0, 1);
- c$9_compile = Py.newCode(2, new String[] {"p", "flags", "groupindex", "code", "indexgroup", "k", "i", "sre_parse", "pattern"}, "/usr/share/jython/Lib-cpython/sre_compile.py", "compile", false, false, funcTable, 9, null, null, 0, 1);
- c$10_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/sre_compile.py", "main", false, false, funcTable, 10, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$10_main == null) _PyInner.initConstants();
- return c$10_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.fixup$1(frame);
- case 1:
- return _PyInner.lambda$2(frame);
- case 2:
- return _PyInner._compile$3(frame);
- case 3:
- return _PyInner.lambda$4(frame);
- case 4:
- return _PyInner._compile_charset$5(frame);
- case 5:
- return _PyInner._optimize_charset$6(frame);
- case 6:
- return _PyInner._simple$7(frame);
- case 7:
- return _PyInner._compile_info$8(frame);
- case 8:
- return _PyInner._code$9(frame);
- case 9:
- return _PyInner.compile$10(frame);
- case 10:
- return _PyInner.main$11(frame);
- default:
- return null;
- }
- }
-
- private static PyObject fixup$1(PyFrame frame) {
- return frame.getglobal("_sre").__getattr__("getlower").__call__(frame.getlocal(0), frame.getlocal(1));
- }
-
- private static PyObject lambda$2(PyFrame frame) {
- return frame.getlocal(0);
- }
-
- private static PyObject _compile$3(PyFrame frame) {
- // Temporary Variables
- int t$0$int, t$1$int, t$2$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject, t$4$PyObject, t$5$PyObject;
-
- // Code
- frame.setlocal(4, frame.getlocal(0).__getattr__("append"));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(1);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(7, t$0$PyObject__[0]);
- frame.setlocal(3, t$0$PyObject__[1]);
- if (frame.getlocal(7)._in(new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getglobal("NOT_LITERAL")})).__nonzero__()) {
- if (frame.getlocal(2)._and(frame.getglobal("SRE_FLAG_IGNORECASE")).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("OP_IGNORE").__getitem__(frame.getlocal(7))));
- frame.getlocal(4).__call__(frame.getglobal("_sre").__getattr__("getlower").__call__(frame.getlocal(3), frame.getlocal(2)));
- }
- else {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getlocal(7)));
- frame.getlocal(4).__call__(frame.getlocal(3));
- }
- }
- else if (frame.getlocal(7)._is(frame.getglobal("IN")).__nonzero__()) {
- if (frame.getlocal(2)._and(frame.getglobal("SRE_FLAG_IGNORECASE")).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("OP_IGNORE").__getitem__(frame.getlocal(7))));
- frame.setlocal(8, new PyFunction(frame.f_globals, new PyObject[] {frame.getlocal(2)}, c$0_fixup));
- }
- else {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getlocal(7)));
- frame.setlocal(8, new PyFunction(frame.f_globals, new PyObject[] {}, c$1_lambda));
- }
- frame.setlocal(5, frame.getglobal("len").__call__(frame.getlocal(0)));
- frame.getlocal(4).__call__(i$2);
- frame.getglobal("_compile_charset").__call__(new PyObject[] {frame.getlocal(3), frame.getlocal(2), frame.getlocal(0), frame.getlocal(8)});
- frame.getlocal(0).__setitem__(frame.getlocal(5), frame.getglobal("len").__call__(frame.getlocal(0))._sub(frame.getlocal(5)));
- }
- else if (frame.getlocal(7)._is(frame.getglobal("ANY")).__nonzero__()) {
- if (frame.getlocal(2)._and(frame.getglobal("SRE_FLAG_DOTALL")).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("ANY_ALL")));
- }
- else {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("ANY")));
- }
- }
- else if (frame.getlocal(7)._in(new PyTuple(new PyObject[] {frame.getglobal("REPEAT"), frame.getglobal("MIN_REPEAT"), frame.getglobal("MAX_REPEAT")})).__nonzero__()) {
- if (frame.getlocal(2)._and(frame.getglobal("SRE_FLAG_TEMPLATE")).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$3);
- }
- else if (((t$2$PyObject = frame.getglobal("_simple").__call__(frame.getlocal(3))).__nonzero__() ? frame.getlocal(7)._eq(frame.getglobal("MAX_REPEAT")) : t$2$PyObject).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("REPEAT_ONE")));
- frame.setlocal(5, frame.getglobal("len").__call__(frame.getlocal(0)));
- frame.getlocal(4).__call__(i$2);
- frame.getlocal(4).__call__(frame.getlocal(3).__getitem__(i$2));
- frame.getlocal(4).__call__(frame.getlocal(3).__getitem__(i$4));
- frame.getglobal("_compile").__call__(frame.getlocal(0), frame.getlocal(3).__getitem__(i$5), frame.getlocal(2));
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("SUCCESS")));
- frame.getlocal(0).__setitem__(frame.getlocal(5), frame.getglobal("len").__call__(frame.getlocal(0))._sub(frame.getlocal(5)));
- }
- else {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("REPEAT")));
- frame.setlocal(5, frame.getglobal("len").__call__(frame.getlocal(0)));
- frame.getlocal(4).__call__(i$2);
- frame.getlocal(4).__call__(frame.getlocal(3).__getitem__(i$2));
- frame.getlocal(4).__call__(frame.getlocal(3).__getitem__(i$4));
- frame.getglobal("_compile").__call__(frame.getlocal(0), frame.getlocal(3).__getitem__(i$5), frame.getlocal(2));
- frame.getlocal(0).__setitem__(frame.getlocal(5), frame.getglobal("len").__call__(frame.getlocal(0))._sub(frame.getlocal(5)));
- if (frame.getlocal(7)._eq(frame.getglobal("MAX_REPEAT")).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("MAX_UNTIL")));
- }
- else {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("MIN_UNTIL")));
- }
- }
- }
- else if (frame.getlocal(7)._is(frame.getglobal("SUBPATTERN")).__nonzero__()) {
- if (frame.getlocal(3).__getitem__(i$2).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("MARK")));
- frame.getlocal(4).__call__(frame.getlocal(3).__getitem__(i$2)._sub(i$4)._mul(i$5));
- }
- frame.getglobal("_compile").__call__(frame.getlocal(0), frame.getlocal(3).__getitem__(i$4), frame.getlocal(2));
- if (frame.getlocal(3).__getitem__(i$2).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("MARK")));
- frame.getlocal(4).__call__(frame.getlocal(3).__getitem__(i$2)._sub(i$4)._mul(i$5)._add(i$4));
- }
- }
- else if (frame.getlocal(7)._in(new PyTuple(new PyObject[] {frame.getglobal("SUCCESS"), frame.getglobal("FAILURE")})).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getlocal(7)));
- }
- else if (frame.getlocal(7)._in(new PyTuple(new PyObject[] {frame.getglobal("ASSERT"), frame.getglobal("ASSERT_NOT")})).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getlocal(7)));
- frame.setlocal(5, frame.getglobal("len").__call__(frame.getlocal(0)));
- frame.getlocal(4).__call__(i$2);
- if (frame.getlocal(3).__getitem__(i$2)._ge(i$2).__nonzero__()) {
- frame.getlocal(4).__call__(i$2);
- }
- else {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(3).__getitem__(i$4).invoke("getwidth"), 2);
- frame.setlocal(6, t$0$PyObject__[0]);
- frame.setlocal(9, t$0$PyObject__[1]);
- if (frame.getlocal(6)._ne(frame.getlocal(9)).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$6);
- }
- frame.getlocal(4).__call__(frame.getlocal(6));
- }
- frame.getglobal("_compile").__call__(frame.getlocal(0), frame.getlocal(3).__getitem__(i$4), frame.getlocal(2));
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("SUCCESS")));
- frame.getlocal(0).__setitem__(frame.getlocal(5), frame.getglobal("len").__call__(frame.getlocal(0))._sub(frame.getlocal(5)));
- }
- else if (frame.getlocal(7)._is(frame.getglobal("CALL")).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getlocal(7)));
- frame.setlocal(5, frame.getglobal("len").__call__(frame.getlocal(0)));
- frame.getlocal(4).__call__(i$2);
- frame.getglobal("_compile").__call__(frame.getlocal(0), frame.getlocal(3), frame.getlocal(2));
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("SUCCESS")));
- frame.getlocal(0).__setitem__(frame.getlocal(5), frame.getglobal("len").__call__(frame.getlocal(0))._sub(frame.getlocal(5)));
- }
- else if (frame.getlocal(7)._is(frame.getglobal("AT")).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getlocal(7)));
- if (frame.getlocal(2)._and(frame.getglobal("SRE_FLAG_MULTILINE")).__nonzero__()) {
- frame.setlocal(3, frame.getglobal("AT_MULTILINE").invoke("get", frame.getlocal(3), frame.getlocal(3)));
- }
- if (frame.getlocal(2)._and(frame.getglobal("SRE_FLAG_LOCALE")).__nonzero__()) {
- frame.setlocal(3, frame.getglobal("AT_LOCALE").invoke("get", frame.getlocal(3), frame.getlocal(3)));
- }
- else if (frame.getlocal(2)._and(frame.getglobal("SRE_FLAG_UNICODE")).__nonzero__()) {
- frame.setlocal(3, frame.getglobal("AT_UNICODE").invoke("get", frame.getlocal(3), frame.getlocal(3)));
- }
- frame.getlocal(4).__call__(frame.getglobal("ATCODES").__getitem__(frame.getlocal(3)));
- }
- else if (frame.getlocal(7)._is(frame.getglobal("BRANCH")).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getlocal(7)));
- frame.setlocal(10, new PyList(new PyObject[] {}));
- t$1$int = 0;
- t$3$PyObject = frame.getlocal(3).__getitem__(i$4);
- while ((t$2$PyObject = t$3$PyObject.__finditem__(t$1$int++)) != null) {
- frame.setlocal(3, t$2$PyObject);
- frame.setlocal(5, frame.getglobal("len").__call__(frame.getlocal(0)));
- frame.getlocal(4).__call__(i$2);
- frame.getglobal("_compile").__call__(frame.getlocal(0), frame.getlocal(3), frame.getlocal(2));
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("JUMP")));
- frame.getlocal(10).invoke("append", frame.getglobal("len").__call__(frame.getlocal(0)));
- frame.getlocal(4).__call__(i$2);
- frame.getlocal(0).__setitem__(frame.getlocal(5), frame.getglobal("len").__call__(frame.getlocal(0))._sub(frame.getlocal(5)));
- }
- frame.getlocal(4).__call__(i$2);
- t$2$int = 0;
- t$5$PyObject = frame.getlocal(10);
- while ((t$4$PyObject = t$5$PyObject.__finditem__(t$2$int++)) != null) {
- frame.setlocal(10, t$4$PyObject);
- frame.getlocal(0).__setitem__(frame.getlocal(10), frame.getglobal("len").__call__(frame.getlocal(0))._sub(frame.getlocal(10)));
- }
- }
- else if (frame.getlocal(7)._is(frame.getglobal("CATEGORY")).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getlocal(7)));
- if (frame.getlocal(2)._and(frame.getglobal("SRE_FLAG_LOCALE")).__nonzero__()) {
- frame.setlocal(3, frame.getglobal("CH_LOCALE").__getitem__(frame.getlocal(3)));
- }
- else if (frame.getlocal(2)._and(frame.getglobal("SRE_FLAG_UNICODE")).__nonzero__()) {
- frame.setlocal(3, frame.getglobal("CH_UNICODE").__getitem__(frame.getlocal(3)));
- }
- frame.getlocal(4).__call__(frame.getglobal("CHCODES").__getitem__(frame.getlocal(3)));
- }
- else if (frame.getlocal(7)._is(frame.getglobal("GROUPREF")).__nonzero__()) {
- if (frame.getlocal(2)._and(frame.getglobal("SRE_FLAG_IGNORECASE")).__nonzero__()) {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("OP_IGNORE").__getitem__(frame.getlocal(7))));
- }
- else {
- frame.getlocal(4).__call__(frame.getglobal("OPCODES").__getitem__(frame.getlocal(7)));
- }
- frame.getlocal(4).__call__(frame.getlocal(3)._sub(i$4));
- }
- else {
- throw Py.makeException(frame.getglobal("ValueError"), new PyTuple(new PyObject[] {s$7, frame.getlocal(7)}));
- }
- }
- return Py.None;
- }
-
- private static PyObject lambda$4(PyFrame frame) {
- return frame.getlocal(0);
- }
-
- private static PyObject _compile_charset$5(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(6, frame.getlocal(2).__getattr__("append"));
- if (frame.getlocal(3).__not__().__nonzero__()) {
- frame.setlocal(3, new PyFunction(frame.f_globals, new PyObject[] {}, c$3_lambda));
- }
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("_optimize_charset").__call__(frame.getlocal(0), frame.getlocal(3));
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(4, t$0$PyObject__[0]);
- frame.setlocal(5, t$0$PyObject__[1]);
- frame.getlocal(6).__call__(frame.getglobal("OPCODES").__getitem__(frame.getlocal(4)));
- if (frame.getlocal(4)._is(frame.getglobal("NEGATE")).__nonzero__()) {
- // pass
- }
- else if (frame.getlocal(4)._is(frame.getglobal("LITERAL")).__nonzero__()) {
- frame.getlocal(6).__call__(frame.getlocal(3).__call__(frame.getlocal(5)));
- }
- else if (frame.getlocal(4)._is(frame.getglobal("RANGE")).__nonzero__()) {
- frame.getlocal(6).__call__(frame.getlocal(3).__call__(frame.getlocal(5).__getitem__(i$2)));
- frame.getlocal(6).__call__(frame.getlocal(3).__call__(frame.getlocal(5).__getitem__(i$4)));
- }
- else if (frame.getlocal(4)._is(frame.getglobal("CHARSET")).__nonzero__()) {
- frame.getlocal(2).invoke("extend", frame.getlocal(5));
- }
- else if (frame.getlocal(4)._is(frame.getglobal("CATEGORY")).__nonzero__()) {
- if (frame.getlocal(1)._and(frame.getglobal("SRE_FLAG_LOCALE")).__nonzero__()) {
- frame.getlocal(6).__call__(frame.getglobal("CHCODES").__getitem__(frame.getglobal("CH_LOCALE").__getitem__(frame.getlocal(5))));
- }
- else if (frame.getlocal(1)._and(frame.getglobal("SRE_FLAG_UNICODE")).__nonzero__()) {
- frame.getlocal(6).__call__(frame.getglobal("CHCODES").__getitem__(frame.getglobal("CH_UNICODE").__getitem__(frame.getlocal(5))));
- }
- else {
- frame.getlocal(6).__call__(frame.getglobal("CHCODES").__getitem__(frame.getlocal(5)));
- }
- }
- else {
- throw Py.makeException(frame.getglobal("error"), s$8);
- }
- }
- frame.getlocal(6).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("FAILURE")));
- return Py.None;
- }
-
- private static PyObject _optimize_charset$6(PyFrame frame) {
- // Temporary Variables
- int t$0$int, t$1$int, t$2$int, t$3$int, t$4$int;
- PyObject[] t$0$PyObject__;
- PyException t$0$PyException;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject, t$4$PyObject, t$5$PyObject, t$6$PyObject, t$7$PyObject, t$8$PyObject, t$9$PyObject;
-
- // Code
- frame.setlocal(11, new PyList(new PyObject[] {}));
- frame.setlocal(5, new PyList(new PyObject[] {i$2})._mul(i$9));
- try {
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(2, t$0$PyObject__[0]);
- frame.setlocal(4, t$0$PyObject__[1]);
- if (frame.getlocal(2)._is(frame.getglobal("NEGATE")).__nonzero__()) {
- frame.getlocal(11).invoke("append", new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(4)}));
- }
- else if (frame.getlocal(2)._is(frame.getglobal("LITERAL")).__nonzero__()) {
- frame.getlocal(5).__setitem__(frame.getlocal(1).__call__(frame.getlocal(4)), i$4);
- }
- else if (frame.getlocal(2)._is(frame.getglobal("RANGE")).__nonzero__()) {
- t$1$int = 0;
- t$3$PyObject = frame.getglobal("range").__call__(frame.getlocal(1).__call__(frame.getlocal(4).__getitem__(i$2)), frame.getlocal(1).__call__(frame.getlocal(4).__getitem__(i$4))._add(i$4));
- while ((t$2$PyObject = t$3$PyObject.__finditem__(t$1$int++)) != null) {
- frame.setlocal(10, t$2$PyObject);
- frame.getlocal(5).__setitem__(frame.getlocal(10), i$4);
- }
- }
- else if (frame.getlocal(2)._is(frame.getglobal("CATEGORY")).__nonzero__()) {
- return frame.getlocal(0);
- }
- }
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("IndexError"))) {
- return frame.getlocal(0);
- }
- else throw t$0$PyException;
- }
- t$4$PyObject = i$2;
- frame.setlocal(10, t$4$PyObject);
- frame.setlocal(6, t$4$PyObject);
- frame.setlocal(7, t$4$PyObject);
- frame.setlocal(9, new PyList(new PyObject[] {}));
- t$2$int = 0;
- t$5$PyObject = frame.getlocal(5);
- while ((t$4$PyObject = t$5$PyObject.__finditem__(t$2$int++)) != null) {
- frame.setlocal(12, t$4$PyObject);
- if (frame.getlocal(12).__nonzero__()) {
- if (frame.getlocal(7)._eq(i$2).__nonzero__()) {
- frame.setlocal(6, frame.getlocal(10));
- }
- frame.setlocal(7, frame.getlocal(7)._add(i$4));
- }
- else if (frame.getlocal(7).__nonzero__()) {
- frame.getlocal(9).invoke("append", new PyTuple(new PyObject[] {frame.getlocal(6), frame.getlocal(7)}));
- frame.setlocal(7, i$2);
- }
- frame.setlocal(10, frame.getlocal(10)._add(i$4));
- }
- if (frame.getlocal(7).__nonzero__()) {
- frame.getlocal(9).invoke("append", new PyTuple(new PyObject[] {frame.getlocal(6), frame.getlocal(7)}));
- }
- if (frame.getglobal("len").__call__(frame.getlocal(9))._le(i$5).__nonzero__()) {
- t$3$int = 0;
- t$7$PyObject = frame.getlocal(9);
- while ((t$6$PyObject = t$7$PyObject.__finditem__(t$3$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$6$PyObject, 2);
- frame.setlocal(6, t$0$PyObject__[0]);
- frame.setlocal(7, t$0$PyObject__[1]);
- if (frame.getlocal(7)._eq(i$4).__nonzero__()) {
- frame.getlocal(11).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getlocal(6)}));
- }
- else {
- frame.getlocal(11).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("RANGE"), new PyTuple(new PyObject[] {frame.getlocal(6), frame.getlocal(6)._add(frame.getlocal(7))._sub(i$4)})}));
- }
- }
- if (frame.getglobal("len").__call__(frame.getlocal(11))._lt(frame.getglobal("len").__call__(frame.getlocal(0))).__nonzero__()) {
- return frame.getlocal(11);
- }
- }
- else {
- frame.setlocal(13, new PyList(new PyObject[] {}));
- frame.setlocal(8, i$4);
- frame.setlocal(3, i$2);
- t$4$int = 0;
- t$9$PyObject = frame.getlocal(5);
- while ((t$8$PyObject = t$9$PyObject.__finditem__(t$4$int++)) != null) {
- frame.setlocal(12, t$8$PyObject);
- if (frame.getlocal(12).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(3)._add(frame.getlocal(8)));
- }
- frame.setlocal(8, frame.getlocal(8)._lshift(i$4));
- if (frame.getlocal(8)._gt(frame.getglobal("MAXCODE")).__nonzero__()) {
- frame.getlocal(13).invoke("append", frame.getlocal(3));
- frame.setlocal(8, i$4);
- frame.setlocal(3, i$2);
- }
- }
- frame.getlocal(11).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("CHARSET"), frame.getlocal(13)}));
- return frame.getlocal(11);
- }
- return frame.getlocal(0);
- }
-
- private static PyObject _simple$7(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0).__getitem__(i$5).invoke("getwidth"), 2);
- frame.setlocal(2, t$0$PyObject__[0]);
- frame.setlocal(1, t$0$PyObject__[1]);
- if (((t$0$PyObject = frame.getlocal(2)._eq(i$2)).__nonzero__() ? frame.getlocal(1)._eq(frame.getglobal("MAXREPEAT")) : t$0$PyObject).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$10);
- }
- return (t$0$PyObject = (frame.getlocal(2)._eq(t$1$PyObject = frame.getlocal(1)).__nonzero__() ? t$1$PyObject._eq(i$4) : Py.Zero)).__nonzero__() ? frame.getlocal(0).__getitem__(i$5).__getitem__(i$2).__getitem__(i$2)._ne(frame.getglobal("SUBPATTERN")) : t$0$PyObject;
- }
-
- private static PyObject _compile_info$8(PyFrame frame) {
- // Temporary Variables
- int t$0$int, t$1$int, t$2$int, t$3$int;
- boolean t$0$boolean;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject, t$4$PyObject, t$5$PyObject, t$6$PyObject, t$7$PyObject, t$8$PyObject;
-
- // Code
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1).invoke("getwidth"), 2);
- frame.setlocal(5, t$0$PyObject__[0]);
- frame.setlocal(3, t$0$PyObject__[1]);
- if (frame.getlocal(5)._eq(i$2).__nonzero__()) {
- return Py.None;
- }
- frame.setlocal(11, new PyList(new PyObject[] {}));
- frame.setlocal(16, i$2);
- frame.setlocal(4, new PyList(new PyObject[] {}));
- if (frame.getlocal(2)._and(frame.getglobal("SRE_FLAG_IGNORECASE")).__not__().__nonzero__()) {
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(1).__getattr__("data");
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(6, t$0$PyObject__[0]);
- frame.setlocal(7, t$0$PyObject__[1]);
- if (frame.getlocal(6)._is(frame.getglobal("LITERAL")).__nonzero__()) {
- if (frame.getglobal("len").__call__(frame.getlocal(11))._eq(frame.getlocal(16)).__nonzero__()) {
- frame.setlocal(16, frame.getlocal(16)._add(i$4));
- }
- frame.getlocal(11).invoke("append", frame.getlocal(7));
- }
- else if (((t$2$PyObject = frame.getlocal(6)._is(frame.getglobal("SUBPATTERN"))).__nonzero__() ? frame.getglobal("len").__call__(frame.getlocal(7).__getitem__(i$4))._eq(i$4) : t$2$PyObject).__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(7).__getitem__(i$4).__getitem__(i$2), 2);
- frame.setlocal(6, t$0$PyObject__[0]);
- frame.setlocal(7, t$0$PyObject__[1]);
- if (frame.getlocal(6)._is(frame.getglobal("LITERAL")).__nonzero__()) {
- frame.getlocal(11).invoke("append", frame.getlocal(7));
- }
- else {
- break;
- }
- }
- else {
- break;
- }
- }
- if (((t$2$PyObject = frame.getlocal(11).__not__()).__nonzero__() ? frame.getlocal(1).__getattr__("data") : t$2$PyObject).__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1).__getattr__("data").__getitem__(i$2), 2);
- frame.setlocal(6, t$0$PyObject__[0]);
- frame.setlocal(7, t$0$PyObject__[1]);
- if (((t$2$PyObject = frame.getlocal(6)._is(frame.getglobal("SUBPATTERN"))).__nonzero__() ? frame.getlocal(7).__getitem__(i$4) : t$2$PyObject).__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(7).__getitem__(i$4).__getitem__(i$2), 2);
- frame.setlocal(6, t$0$PyObject__[0]);
- frame.setlocal(7, t$0$PyObject__[1]);
- if (frame.getlocal(6)._is(frame.getglobal("LITERAL")).__nonzero__()) {
- frame.getlocal(4).invoke("append", new PyTuple(new PyObject[] {frame.getlocal(6), frame.getlocal(7)}));
- }
- else if (frame.getlocal(6)._is(frame.getglobal("BRANCH")).__nonzero__()) {
- frame.setlocal(15, new PyList(new PyObject[] {}));
- t$1$int = 0;
- t$3$PyObject = frame.getlocal(7).__getitem__(i$4);
- while (t$0$boolean=(t$2$PyObject = t$3$PyObject.__finditem__(t$1$int++)) != null) {
- frame.setlocal(9, t$2$PyObject);
- if (frame.getlocal(9).__not__().__nonzero__()) {
- break;
- }
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(9).__getitem__(i$2), 2);
- frame.setlocal(6, t$0$PyObject__[0]);
- frame.setlocal(7, t$0$PyObject__[1]);
- if (frame.getlocal(6)._is(frame.getglobal("LITERAL")).__nonzero__()) {
- frame.getlocal(15).invoke("append", new PyTuple(new PyObject[] {frame.getlocal(6), frame.getlocal(7)}));
- }
- else {
- break;
- }
- }
- if (!t$0$boolean) {
- frame.setlocal(4, frame.getlocal(15));
- }
- }
- }
- else if (frame.getlocal(6)._is(frame.getglobal("BRANCH")).__nonzero__()) {
- frame.setlocal(15, new PyList(new PyObject[] {}));
- t$2$int = 0;
- t$5$PyObject = frame.getlocal(7).__getitem__(i$4);
- while (t$0$boolean=(t$4$PyObject = t$5$PyObject.__finditem__(t$2$int++)) != null) {
- frame.setlocal(9, t$4$PyObject);
- if (frame.getlocal(9).__not__().__nonzero__()) {
- break;
- }
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(9).__getitem__(i$2), 2);
- frame.setlocal(6, t$0$PyObject__[0]);
- frame.setlocal(7, t$0$PyObject__[1]);
- if (frame.getlocal(6)._is(frame.getglobal("LITERAL")).__nonzero__()) {
- frame.getlocal(15).invoke("append", new PyTuple(new PyObject[] {frame.getlocal(6), frame.getlocal(7)}));
- }
- else {
- break;
- }
- }
- if (!t$0$boolean) {
- frame.setlocal(4, frame.getlocal(15));
- }
- }
- else if (frame.getlocal(6)._is(frame.getglobal("IN")).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(7));
- }
- }
- }
- frame.setlocal(8, frame.getlocal(0).__getattr__("append"));
- frame.getlocal(8).__call__(frame.getglobal("OPCODES").__getitem__(frame.getglobal("INFO")));
- frame.setlocal(10, frame.getglobal("len").__call__(frame.getlocal(0)));
- frame.getlocal(8).__call__(i$2);
- frame.setlocal(13, i$2);
- if (frame.getlocal(11).__nonzero__()) {
- frame.setlocal(13, frame.getglobal("SRE_INFO_PREFIX"));
- if ((frame.getglobal("len").__call__(frame.getlocal(11))._eq(t$6$PyObject = frame.getlocal(16)).__nonzero__() ? t$6$PyObject._eq(frame.getglobal("len").__call__(frame.getlocal(1).__getattr__("data"))) : Py.Zero).__nonzero__()) {
- frame.setlocal(13, frame.getlocal(13)._add(frame.getglobal("SRE_INFO_LITERAL")));
- }
- }
- else if (frame.getlocal(4).__nonzero__()) {
- frame.setlocal(13, frame.getlocal(13)._add(frame.getglobal("SRE_INFO_CHARSET")));
- }
- frame.getlocal(8).__call__(frame.getlocal(13));
- if (frame.getlocal(5)._lt(frame.getglobal("MAXCODE")).__nonzero__()) {
- frame.getlocal(8).__call__(frame.getlocal(5));
- }
- else {
- frame.getlocal(8).__call__(frame.getglobal("MAXCODE"));
- frame.setlocal(11, frame.getlocal(11).__getslice__(null, frame.getglobal("MAXCODE"), null));
- }
- if (frame.getlocal(3)._lt(frame.getglobal("MAXCODE")).__nonzero__()) {
- frame.getlocal(8).__call__(frame.getlocal(3));
- }
- else {
- frame.getlocal(8).__call__(i$2);
- }
- if (frame.getlocal(11).__nonzero__()) {
- frame.getlocal(8).__call__(frame.getglobal("len").__call__(frame.getlocal(11)));
- frame.getlocal(8).__call__(frame.getlocal(16));
- frame.getlocal(0).invoke("extend", frame.getlocal(11));
- frame.setlocal(14, new PyList(new PyObject[] {i$4.__neg__()})._add(new PyList(new PyObject[] {i$2})._mul(frame.getglobal("len").__call__(frame.getlocal(11)))));
- t$3$int = 0;
- t$7$PyObject = frame.getglobal("range").__call__(frame.getglobal("len").__call__(frame.getlocal(11)));
- while ((t$6$PyObject = t$7$PyObject.__finditem__(t$3$int++)) != null) {
- frame.setlocal(12, t$6$PyObject);
- frame.getlocal(14).__setitem__(frame.getlocal(12)._add(i$4), frame.getlocal(14).__getitem__(frame.getlocal(12))._add(i$4));
- while (((t$8$PyObject = frame.getlocal(14).__getitem__(frame.getlocal(12)._add(i$4))._gt(i$2)).__nonzero__() ? frame.getlocal(11).__getitem__(frame.getlocal(12))._ne(frame.getlocal(11).__getitem__(frame.getlocal(14).__getitem__(frame.getlocal(12)._add(i$4))._sub(i$4))) : t$8$PyObject).__nonzero__()) {
- frame.getlocal(14).__setitem__(frame.getlocal(12)._add(i$4), frame.getlocal(14).__getitem__(frame.getlocal(14).__getitem__(frame.getlocal(12)._add(i$4))._sub(i$4))._add(i$4));
- }
- }
- frame.getlocal(0).invoke("extend", frame.getlocal(14).__getslice__(i$4, null, null));
- }
- else if (frame.getlocal(4).__nonzero__()) {
- frame.getglobal("_compile_charset").__call__(frame.getlocal(4), i$2, frame.getlocal(0));
- }
- frame.getlocal(0).__setitem__(frame.getlocal(10), frame.getglobal("len").__call__(frame.getlocal(0))._sub(frame.getlocal(10)));
- return Py.None;
- }
-
- private static PyObject _code$9(PyFrame frame) {
- frame.setlocal(1, frame.getlocal(0).__getattr__("pattern").__getattr__("flags")._or(frame.getlocal(1)));
- frame.setlocal(2, new PyList(new PyObject[] {}));
- frame.getglobal("_compile_info").__call__(frame.getlocal(2), frame.getlocal(0), frame.getlocal(1));
- frame.getglobal("_compile").__call__(frame.getlocal(2), frame.getlocal(0).__getattr__("data"), frame.getlocal(1));
- frame.getlocal(2).invoke("append", frame.getglobal("OPCODES").__getitem__(frame.getglobal("SUCCESS")));
- return frame.getlocal(2);
- }
-
- private static PyObject compile$10(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- if (frame.getglobal("type").__call__(frame.getlocal(0))._in(frame.getglobal("STRING_TYPES")).__nonzero__()) {
- frame.setlocal(7, org.python.core.imp.importOne("sre_parse", frame));
- frame.setlocal(8, frame.getlocal(0));
- frame.setlocal(0, frame.getlocal(7).__getattr__("parse").__call__(frame.getlocal(0), frame.getlocal(1)));
- }
- else {
- frame.setlocal(8, frame.getglobal("None"));
- }
- frame.setlocal(3, frame.getglobal("_code").__call__(frame.getlocal(0), frame.getlocal(1)));
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("pattern").__getattr__("groups")._le(i$12), s$13);
- frame.setlocal(2, frame.getlocal(0).__getattr__("pattern").__getattr__("groupdict"));
- frame.setlocal(4, new PyList(new PyObject[] {frame.getglobal("None")})._mul(frame.getlocal(0).__getattr__("pattern").__getattr__("groups")));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(2).invoke("items");
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(5, t$0$PyObject__[0]);
- frame.setlocal(6, t$0$PyObject__[1]);
- frame.getlocal(4).__setitem__(frame.getlocal(6), frame.getlocal(5));
- }
- return frame.getglobal("_sre").__getattr__("compile").__call__(new PyObject[] {frame.getlocal(8), frame.getlocal(1), frame.getlocal(3), frame.getlocal(0).__getattr__("pattern").__getattr__("groups")._sub(i$4), frame.getlocal(2), frame.getlocal(4)});
- }
-
- private static PyObject main$11(PyFrame frame) {
- frame.setglobal("__file__", s$14);
-
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- frame.setlocal("_sre", org.python.core.imp.importOne("_sre", frame));
- org.python.core.imp.importAll("sre_constants", frame);
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getname("_sre").__getattr__("MAGIC")._eq(frame.getname("MAGIC")), s$0);
- frame.setlocal("MAXCODE", i$1);
- frame.setlocal("_compile", new PyFunction(frame.f_globals, new PyObject[] {}, c$2__compile));
- frame.setlocal("_compile_charset", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$4__compile_charset));
- frame.setlocal("_optimize_charset", new PyFunction(frame.f_globals, new PyObject[] {}, c$5__optimize_charset));
- frame.setlocal("_simple", new PyFunction(frame.f_globals, new PyObject[] {}, c$6__simple));
- frame.setlocal("_compile_info", new PyFunction(frame.f_globals, new PyObject[] {}, c$7__compile_info));
- frame.setlocal("STRING_TYPES", new PyList(new PyObject[] {frame.getname("type").__call__(s$11)}));
- try {
- frame.getname("STRING_TYPES").invoke("append", frame.getname("type").__call__(frame.getname("unicode").__call__(s$11)));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getname("NameError"))) {
- // pass
- }
- else throw t$0$PyException;
- }
- frame.setlocal("_code", new PyFunction(frame.f_globals, new PyObject[] {}, c$8__code));
- frame.setlocal("compile", new PyFunction(frame.f_globals, new PyObject[] {i$2}, c$9_compile));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("sre_compile"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "sre_compile";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(sre_compile._PyInner.class, newargs, sre_compile.jpy$packages, sre_compile.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class sre_constants extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject i$0;
- private static PyObject i$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject s$16;
- private static PyObject s$17;
- private static PyObject s$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyObject s$24;
- private static PyObject s$25;
- private static PyObject s$26;
- private static PyObject s$27;
- private static PyObject s$28;
- private static PyObject s$29;
- private static PyObject s$30;
- private static PyObject s$31;
- private static PyObject s$32;
- private static PyObject s$33;
- private static PyObject s$34;
- private static PyObject s$35;
- private static PyObject s$36;
- private static PyObject s$37;
- private static PyObject s$38;
- private static PyObject s$39;
- private static PyObject s$40;
- private static PyObject s$41;
- private static PyObject s$42;
- private static PyObject s$43;
- private static PyObject s$44;
- private static PyObject s$45;
- private static PyObject s$46;
- private static PyObject s$47;
- private static PyObject s$48;
- private static PyObject s$49;
- private static PyObject s$50;
- private static PyObject s$51;
- private static PyObject s$52;
- private static PyObject s$53;
- private static PyObject s$54;
- private static PyObject s$55;
- private static PyObject s$56;
- private static PyObject s$57;
- private static PyObject s$58;
- private static PyObject s$59;
- private static PyObject s$60;
- private static PyObject s$61;
- private static PyObject s$62;
- private static PyObject i$63;
- private static PyObject i$64;
- private static PyObject i$65;
- private static PyObject i$66;
- private static PyObject i$67;
- private static PyObject i$68;
- private static PyObject i$69;
- private static PyObject i$70;
- private static PyObject i$71;
- private static PyObject s$72;
- private static PyObject s$73;
- private static PyObject s$74;
- private static PyObject s$75;
- private static PyObject s$76;
- private static PyObject s$77;
- private static PyObject s$78;
- private static PyObject s$79;
- private static PyObject s$80;
- private static PyObject s$81;
- private static PyObject s$82;
- private static PyObject s$83;
- private static PyObject s$84;
- private static PyObject s$85;
- private static PyObject s$86;
- private static PyObject s$87;
- private static PyObject s$88;
- private static PyObject s$89;
- private static PyObject s$90;
- private static PyObject s$91;
- private static PyFunctionTable funcTable;
- private static PyCode c$0_error;
- private static PyCode c$1_makedict;
- private static PyCode c$2_lambda;
- private static PyCode c$3_dump;
- private static PyCode c$4_main;
- private static void initConstants() {
- i$0 = Py.newInteger(20010320);
- i$1 = Py.newInteger(65535);
- s$2 = Py.newString("failure");
- s$3 = Py.newString("success");
- s$4 = Py.newString("any");
- s$5 = Py.newString("any_all");
- s$6 = Py.newString("assert");
- s$7 = Py.newString("assert_not");
- s$8 = Py.newString("at");
- s$9 = Py.newString("branch");
- s$10 = Py.newString("call");
- s$11 = Py.newString("category");
- s$12 = Py.newString("charset");
- s$13 = Py.newString("groupref");
- s$14 = Py.newString("groupref_ignore");
- s$15 = Py.newString("in");
- s$16 = Py.newString("in_ignore");
- s$17 = Py.newString("info");
- s$18 = Py.newString("jump");
- s$19 = Py.newString("literal");
- s$20 = Py.newString("literal_ignore");
- s$21 = Py.newString("mark");
- s$22 = Py.newString("max_repeat");
- s$23 = Py.newString("max_until");
- s$24 = Py.newString("min_repeat");
- s$25 = Py.newString("min_until");
- s$26 = Py.newString("negate");
- s$27 = Py.newString("not_literal");
- s$28 = Py.newString("not_literal_ignore");
- s$29 = Py.newString("range");
- s$30 = Py.newString("repeat");
- s$31 = Py.newString("repeat_one");
- s$32 = Py.newString("subpattern");
- s$33 = Py.newString("at_beginning");
- s$34 = Py.newString("at_beginning_line");
- s$35 = Py.newString("at_beginning_string");
- s$36 = Py.newString("at_boundary");
- s$37 = Py.newString("at_non_boundary");
- s$38 = Py.newString("at_end");
- s$39 = Py.newString("at_end_line");
- s$40 = Py.newString("at_end_string");
- s$41 = Py.newString("at_loc_boundary");
- s$42 = Py.newString("at_loc_non_boundary");
- s$43 = Py.newString("at_uni_boundary");
- s$44 = Py.newString("at_uni_non_boundary");
- s$45 = Py.newString("category_digit");
- s$46 = Py.newString("category_not_digit");
- s$47 = Py.newString("category_space");
- s$48 = Py.newString("category_not_space");
- s$49 = Py.newString("category_word");
- s$50 = Py.newString("category_not_word");
- s$51 = Py.newString("category_linebreak");
- s$52 = Py.newString("category_not_linebreak");
- s$53 = Py.newString("category_loc_word");
- s$54 = Py.newString("category_loc_not_word");
- s$55 = Py.newString("category_uni_digit");
- s$56 = Py.newString("category_uni_not_digit");
- s$57 = Py.newString("category_uni_space");
- s$58 = Py.newString("category_uni_not_space");
- s$59 = Py.newString("category_uni_word");
- s$60 = Py.newString("category_uni_not_word");
- s$61 = Py.newString("category_uni_linebreak");
- s$62 = Py.newString("category_uni_not_linebreak");
- i$63 = Py.newInteger(0);
- i$64 = Py.newInteger(1);
- i$65 = Py.newInteger(2);
- i$66 = Py.newInteger(4);
- i$67 = Py.newInteger(8);
- i$68 = Py.newInteger(16);
- i$69 = Py.newInteger(32);
- i$70 = Py.newInteger(64);
- i$71 = Py.newInteger(128);
- s$72 = Py.newString("__main__");
- s$73 = Py.newString("#define %s_%s %s\012");
- s$74 = Py.newString("sre_constants.h");
- s$75 = Py.newString("w");
- s$76 = Py.newString("/*\012 * Secret Labs' Regular Expression Engine\012 *\012 * regular expression matching engine\012 *\012 * NOTE: This file is generated by sre_constants.py. If you need\012 * to change anything in here, edit sre_constants.py and run it.\012 *\012 * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.\012 *\012 * See the _sre.c file for information on usage and redistribution.\012 */\012\012");
- s$77 = Py.newString("#define SRE_MAGIC %d\012");
- s$78 = Py.newString("SRE_OP");
- s$79 = Py.newString("SRE");
- s$80 = Py.newString("#define SRE_FLAG_TEMPLATE %d\012");
- s$81 = Py.newString("#define SRE_FLAG_IGNORECASE %d\012");
- s$82 = Py.newString("#define SRE_FLAG_LOCALE %d\012");
- s$83 = Py.newString("#define SRE_FLAG_MULTILINE %d\012");
- s$84 = Py.newString("#define SRE_FLAG_DOTALL %d\012");
- s$85 = Py.newString("#define SRE_FLAG_UNICODE %d\012");
- s$86 = Py.newString("#define SRE_FLAG_VERBOSE %d\012");
- s$87 = Py.newString("#define SRE_INFO_PREFIX %d\012");
- s$88 = Py.newString("#define SRE_INFO_LITERAL %d\012");
- s$89 = Py.newString("#define SRE_INFO_CHARSET %d\012");
- s$90 = Py.newString("done");
- s$91 = Py.newString("/usr/share/jython/Lib-cpython/sre_constants.py");
- funcTable = new _PyInner();
- c$0_error = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/sre_constants.py", "error", false, false, funcTable, 0, null, null, 0, 0);
- c$1_makedict = Py.newCode(1, new String[] {"list", "i", "item", "d"}, "/usr/share/jython/Lib-cpython/sre_constants.py", "makedict", false, false, funcTable, 1, null, null, 0, 1);
- c$2_lambda = Py.newCode(2, new String[] {"a", "b"}, "/usr/share/jython/Lib-cpython/sre_constants.py", "<lambda>", false, false, funcTable, 2, null, null, 0, 1);
- c$3_dump = Py.newCode(3, new String[] {"f", "d", "prefix", "v", "k", "items"}, "/usr/share/jython/Lib-cpython/sre_constants.py", "dump", false, false, funcTable, 3, null, null, 0, 1);
- c$4_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/sre_constants.py", "main", false, false, funcTable, 4, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$4_main == null) _PyInner.initConstants();
- return c$4_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.error$1(frame);
- case 1:
- return _PyInner.makedict$2(frame);
- case 2:
- return _PyInner.lambda$3(frame);
- case 3:
- return _PyInner.dump$4(frame);
- case 4:
- return _PyInner.main$5(frame);
- default:
- return null;
- }
- }
-
- private static PyObject error$1(PyFrame frame) {
- // pass
- return frame.getf_locals();
- }
-
- private static PyObject makedict$2(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(3, new PyDictionary(new PyObject[] {}));
- frame.setlocal(1, i$63);
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(2, t$0$PyObject);
- frame.getlocal(3).__setitem__(frame.getlocal(2), frame.getlocal(1));
- frame.setlocal(1, frame.getlocal(1)._add(i$64));
- }
- return frame.getlocal(3);
- }
-
- private static PyObject lambda$3(PyFrame frame) {
- return frame.getglobal("cmp").__call__(frame.getlocal(0).__getitem__(i$64), frame.getlocal(1).__getitem__(i$64));
- }
-
- private static PyObject dump$4(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(5, frame.getlocal(1).invoke("items"));
- frame.getlocal(5).invoke("sort", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_lambda));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(5);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(4, t$0$PyObject__[0]);
- frame.setlocal(3, t$0$PyObject__[1]);
- frame.getlocal(0).invoke("write", s$73._mod(new PyTuple(new PyObject[] {frame.getlocal(2), frame.getglobal("string").__getattr__("upper").__call__(frame.getlocal(4)), frame.getlocal(3)})));
- }
- return Py.None;
- }
-
- private static PyObject main$5(PyFrame frame) {
- frame.setglobal("__file__", s$91);
-
- frame.setlocal("MAGIC", i$0);
- frame.setlocal("MAXREPEAT", i$1);
- frame.setlocal("error", Py.makeClass("error", new PyObject[] {frame.getname("Exception")}, c$0_error, null));
- frame.setlocal("FAILURE", s$2);
- frame.setlocal("SUCCESS", s$3);
- frame.setlocal("ANY", s$4);
- frame.setlocal("ANY_ALL", s$5);
- frame.setlocal("ASSERT", s$6);
- frame.setlocal("ASSERT_NOT", s$7);
- frame.setlocal("AT", s$8);
- frame.setlocal("BRANCH", s$9);
- frame.setlocal("CALL", s$10);
- frame.setlocal("CATEGORY", s$11);
- frame.setlocal("CHARSET", s$12);
- frame.setlocal("GROUPREF", s$13);
- frame.setlocal("GROUPREF_IGNORE", s$14);
- frame.setlocal("IN", s$15);
- frame.setlocal("IN_IGNORE", s$16);
- frame.setlocal("INFO", s$17);
- frame.setlocal("JUMP", s$18);
- frame.setlocal("LITERAL", s$19);
- frame.setlocal("LITERAL_IGNORE", s$20);
- frame.setlocal("MARK", s$21);
- frame.setlocal("MAX_REPEAT", s$22);
- frame.setlocal("MAX_UNTIL", s$23);
- frame.setlocal("MIN_REPEAT", s$24);
- frame.setlocal("MIN_UNTIL", s$25);
- frame.setlocal("NEGATE", s$26);
- frame.setlocal("NOT_LITERAL", s$27);
- frame.setlocal("NOT_LITERAL_IGNORE", s$28);
- frame.setlocal("RANGE", s$29);
- frame.setlocal("REPEAT", s$30);
- frame.setlocal("REPEAT_ONE", s$31);
- frame.setlocal("SUBPATTERN", s$32);
- frame.setlocal("AT_BEGINNING", s$33);
- frame.setlocal("AT_BEGINNING_LINE", s$34);
- frame.setlocal("AT_BEGINNING_STRING", s$35);
- frame.setlocal("AT_BOUNDARY", s$36);
- frame.setlocal("AT_NON_BOUNDARY", s$37);
- frame.setlocal("AT_END", s$38);
- frame.setlocal("AT_END_LINE", s$39);
- frame.setlocal("AT_END_STRING", s$40);
- frame.setlocal("AT_LOC_BOUNDARY", s$41);
- frame.setlocal("AT_LOC_NON_BOUNDARY", s$42);
- frame.setlocal("AT_UNI_BOUNDARY", s$43);
- frame.setlocal("AT_UNI_NON_BOUNDARY", s$44);
- frame.setlocal("CATEGORY_DIGIT", s$45);
- frame.setlocal("CATEGORY_NOT_DIGIT", s$46);
- frame.setlocal("CATEGORY_SPACE", s$47);
- frame.setlocal("CATEGORY_NOT_SPACE", s$48);
- frame.setlocal("CATEGORY_WORD", s$49);
- frame.setlocal("CATEGORY_NOT_WORD", s$50);
- frame.setlocal("CATEGORY_LINEBREAK", s$51);
- frame.setlocal("CATEGORY_NOT_LINEBREAK", s$52);
- frame.setlocal("CATEGORY_LOC_WORD", s$53);
- frame.setlocal("CATEGORY_LOC_NOT_WORD", s$54);
- frame.setlocal("CATEGORY_UNI_DIGIT", s$55);
- frame.setlocal("CATEGORY_UNI_NOT_DIGIT", s$56);
- frame.setlocal("CATEGORY_UNI_SPACE", s$57);
- frame.setlocal("CATEGORY_UNI_NOT_SPACE", s$58);
- frame.setlocal("CATEGORY_UNI_WORD", s$59);
- frame.setlocal("CATEGORY_UNI_NOT_WORD", s$60);
- frame.setlocal("CATEGORY_UNI_LINEBREAK", s$61);
- frame.setlocal("CATEGORY_UNI_NOT_LINEBREAK", s$62);
- frame.setlocal("OPCODES", new PyList(new PyObject[] {frame.getname("FAILURE"), frame.getname("SUCCESS"), frame.getname("ANY"), frame.getname("ANY_ALL"), frame.getname("ASSERT"), frame.getname("ASSERT_NOT"), frame.getname("AT"), frame.getname("BRANCH"), frame.getname("CALL"), frame.getname("CATEGORY"), frame.getname("CHARSET"), frame.getname("GROUPREF"), frame.getname("GROUPREF_IGNORE"), frame.getname("IN"), frame.getname("IN_IGNORE"), frame.getname("INFO"), frame.getname("JUMP"), frame.getname("LITERAL"), frame.getname("LITERAL_IGNORE"), frame.getname("MARK"), frame.getname("MAX_UNTIL"), frame.getname("MIN_UNTIL"), frame.getname("NOT_LITERAL"), frame.getname("NOT_LITERAL_IGNORE"), frame.getname("NEGATE"), frame.getname("RANGE"), frame.getname("REPEAT"), frame.getname("REPEAT_ONE"), frame.getname("SUBPATTERN")}));
- frame.setlocal("ATCODES", new PyList(new PyObject[] {frame.getname("AT_BEGINNING"), frame.getname("AT_BEGINNING_LINE"), frame.getname("AT_BEGINNING_STRING"), frame.getname("AT_BOUNDARY"), frame.getname("AT_NON_BOUNDARY"), frame.getname("AT_END"), frame.getname("AT_END_LINE"), frame.getname("AT_END_STRING"), frame.getname("AT_LOC_BOUNDARY"), frame.getname("AT_LOC_NON_BOUNDARY"), frame.getname("AT_UNI_BOUNDARY"), frame.getname("AT_UNI_NON_BOUNDARY")}));
- frame.setlocal("CHCODES", new PyList(new PyObject[] {frame.getname("CATEGORY_DIGIT"), frame.getname("CATEGORY_NOT_DIGIT"), frame.getname("CATEGORY_SPACE"), frame.getname("CATEGORY_NOT_SPACE"), frame.getname("CATEGORY_WORD"), frame.getname("CATEGORY_NOT_WORD"), frame.getname("CATEGORY_LINEBREAK"), frame.getname("CATEGORY_NOT_LINEBREAK"), frame.getname("CATEGORY_LOC_WORD"), frame.getname("CATEGORY_LOC_NOT_WORD"), frame.getname("CATEGORY_UNI_DIGIT"), frame.getname("CATEGORY_UNI_NOT_DIGIT"), frame.getname("CATEGORY_UNI_SPACE"), frame.getname("CATEGORY_UNI_NOT_SPACE"), frame.getname("CATEGORY_UNI_WORD"), frame.getname("CATEGORY_UNI_NOT_WORD"), frame.getname("CATEGORY_UNI_LINEBREAK"), frame.getname("CATEGORY_UNI_NOT_LINEBREAK")}));
- frame.setlocal("makedict", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_makedict));
- frame.setlocal("OPCODES", frame.getname("makedict").__call__(frame.getname("OPCODES")));
- frame.setlocal("ATCODES", frame.getname("makedict").__call__(frame.getname("ATCODES")));
- frame.setlocal("CHCODES", frame.getname("makedict").__call__(frame.getname("CHCODES")));
- frame.setlocal("OP_IGNORE", new PyDictionary(new PyObject[] {frame.getname("GROUPREF"), frame.getname("GROUPREF_IGNORE"), frame.getname("IN"), frame.getname("IN_IGNORE"), frame.getname("LITERAL"), frame.getname("LITERAL_IGNORE"), frame.getname("NOT_LITERAL"), frame.getname("NOT_LITERAL_IGNORE")}));
- frame.setlocal("AT_MULTILINE", new PyDictionary(new PyObject[] {frame.getname("AT_BEGINNING"), frame.getname("AT_BEGINNING_LINE"), frame.getname("AT_END"), frame.getname("AT_END_LINE")}));
- frame.setlocal("AT_LOCALE", new PyDictionary(new PyObject[] {frame.getname("AT_BOUNDARY"), frame.getname("AT_LOC_BOUNDARY"), frame.getname("AT_NON_BOUNDARY"), frame.getname("AT_LOC_NON_BOUNDARY")}));
- frame.setlocal("AT_UNICODE", new PyDictionary(new PyObject[] {frame.getname("AT_BOUNDARY"), frame.getname("AT_UNI_BOUNDARY"), frame.getname("AT_NON_BOUNDARY"), frame.getname("AT_UNI_NON_BOUNDARY")}));
- frame.setlocal("CH_LOCALE", new PyDictionary(new PyObject[] {frame.getname("CATEGORY_DIGIT"), frame.getname("CATEGORY_DIGIT"), frame.getname("CATEGORY_NOT_DIGIT"), frame.getname("CATEGORY_NOT_DIGIT"), frame.getname("CATEGORY_SPACE"), frame.getname("CATEGORY_SPACE"), frame.getname("CATEGORY_NOT_SPACE"), frame.getname("CATEGORY_NOT_SPACE"), frame.getname("CATEGORY_WORD"), frame.getname("CATEGORY_LOC_WORD"), frame.getname("CATEGORY_NOT_WORD"), frame.getname("CATEGORY_LOC_NOT_WORD"), frame.getname("CATEGORY_LINEBREAK"), frame.getname("CATEGORY_LINEBREAK"), frame.getname("CATEGORY_NOT_LINEBREAK"), frame.getname("CATEGORY_NOT_LINEBREAK")}));
- frame.setlocal("CH_UNICODE", new PyDictionary(new PyObject[] {frame.getname("CATEGORY_DIGIT"), frame.getname("CATEGORY_UNI_DIGIT"), frame.getname("CATEGORY_NOT_DIGIT"), frame.getname("CATEGORY_UNI_NOT_DIGIT"), frame.getname("CATEGORY_SPACE"), frame.getname("CATEGORY_UNI_SPACE"), frame.getname("CATEGORY_NOT_SPACE"), frame.getname("CATEGORY_UNI_NOT_SPACE"), frame.getname("CATEGORY_WORD"), frame.getname("CATEGORY_UNI_WORD"), frame.getname("CATEGORY_NOT_WORD"), frame.getname("CATEGORY_UNI_NOT_WORD"), frame.getname("CATEGORY_LINEBREAK"), frame.getname("CATEGORY_UNI_LINEBREAK"), frame.getname("CATEGORY_NOT_LINEBREAK"), frame.getname("CATEGORY_UNI_NOT_LINEBREAK")}));
- frame.setlocal("SRE_FLAG_TEMPLATE", i$64);
- frame.setlocal("SRE_FLAG_IGNORECASE", i$65);
- frame.setlocal("SRE_FLAG_LOCALE", i$66);
- frame.setlocal("SRE_FLAG_MULTILINE", i$67);
- frame.setlocal("SRE_FLAG_DOTALL", i$68);
- frame.setlocal("SRE_FLAG_UNICODE", i$69);
- frame.setlocal("SRE_FLAG_VERBOSE", i$70);
- frame.setlocal("SRE_FLAG_DEBUG", i$71);
- frame.setlocal("SRE_INFO_PREFIX", i$64);
- frame.setlocal("SRE_INFO_LITERAL", i$65);
- frame.setlocal("SRE_INFO_CHARSET", i$66);
- if (frame.getname("__name__")._eq(s$72).__nonzero__()) {
- frame.setlocal("string", org.python.core.imp.importOne("string", frame));
- frame.setlocal("dump", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_dump));
- frame.setlocal("f", frame.getname("open").__call__(s$74, s$75));
- frame.getname("f").invoke("write", s$76);
- frame.getname("f").invoke("write", s$77._mod(frame.getname("MAGIC")));
- frame.getname("dump").__call__(frame.getname("f"), frame.getname("OPCODES"), s$78);
- frame.getname("dump").__call__(frame.getname("f"), frame.getname("ATCODES"), s$79);
- frame.getname("dump").__call__(frame.getname("f"), frame.getname("CHCODES"), s$79);
- frame.getname("f").invoke("write", s$80._mod(frame.getname("SRE_FLAG_TEMPLATE")));
- frame.getname("f").invoke("write", s$81._mod(frame.getname("SRE_FLAG_IGNORECASE")));
- frame.getname("f").invoke("write", s$82._mod(frame.getname("SRE_FLAG_LOCALE")));
- frame.getname("f").invoke("write", s$83._mod(frame.getname("SRE_FLAG_MULTILINE")));
- frame.getname("f").invoke("write", s$84._mod(frame.getname("SRE_FLAG_DOTALL")));
- frame.getname("f").invoke("write", s$85._mod(frame.getname("SRE_FLAG_UNICODE")));
- frame.getname("f").invoke("write", s$86._mod(frame.getname("SRE_FLAG_VERBOSE")));
- frame.getname("f").invoke("write", s$87._mod(frame.getname("SRE_INFO_PREFIX")));
- frame.getname("f").invoke("write", s$88._mod(frame.getname("SRE_INFO_LITERAL")));
- frame.getname("f").invoke("write", s$89._mod(frame.getname("SRE_INFO_CHARSET")));
- frame.getname("f").invoke("close");
- Py.println(s$90);
- }
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("sre_constants"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "sre_constants";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(sre_constants._PyInner.class, newargs, sre_constants.jpy$packages, sre_constants.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class sre_parse extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject s$16;
- private static PyObject s$17;
- private static PyObject s$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyObject s$24;
- private static PyObject s$25;
- private static PyObject s$26;
- private static PyObject s$27;
- private static PyObject s$28;
- private static PyObject s$29;
- private static PyObject s$30;
- private static PyObject s$31;
- private static PyObject s$32;
- private static PyObject s$33;
- private static PyObject s$34;
- private static PyObject s$35;
- private static PyObject s$36;
- private static PyObject s$37;
- private static PyObject s$38;
- private static PyObject i$39;
- private static PyObject i$40;
- private static PyObject i$41;
- private static PyObject s$42;
- private static PyObject s$43;
- private static PyObject s$44;
- private static PyObject s$45;
- private static PyObject l$46;
- private static PyObject i$47;
- private static PyObject s$48;
- private static PyObject s$49;
- private static PyObject s$50;
- private static PyObject s$51;
- private static PyObject s$52;
- private static PyObject s$53;
- private static PyObject s$54;
- private static PyObject s$55;
- private static PyObject i$56;
- private static PyObject s$57;
- private static PyObject i$58;
- private static PyObject i$59;
- private static PyObject i$60;
- private static PyObject s$61;
- private static PyObject s$62;
- private static PyObject s$63;
- private static PyObject s$64;
- private static PyObject s$65;
- private static PyObject s$66;
- private static PyObject s$67;
- private static PyObject s$68;
- private static PyObject s$69;
- private static PyObject s$70;
- private static PyObject s$71;
- private static PyObject s$72;
- private static PyObject s$73;
- private static PyObject s$74;
- private static PyObject s$75;
- private static PyObject s$76;
- private static PyObject s$77;
- private static PyObject s$78;
- private static PyObject s$79;
- private static PyObject s$80;
- private static PyObject s$81;
- private static PyObject s$82;
- private static PyObject s$83;
- private static PyObject s$84;
- private static PyObject s$85;
- private static PyObject s$86;
- private static PyObject s$87;
- private static PyObject s$88;
- private static PyObject s$89;
- private static PyObject s$90;
- private static PyObject s$91;
- private static PyObject s$92;
- private static PyObject s$93;
- private static PyObject s$94;
- private static PyObject s$95;
- private static PyObject s$96;
- private static PyObject s$97;
- private static PyObject s$98;
- private static PyObject s$99;
- private static PyObject s$100;
- private static PyObject s$101;
- private static PyObject s$102;
- private static PyObject s$103;
- private static PyObject s$104;
- private static PyObject i$105;
- private static PyObject s$106;
- private static PyObject s$107;
- private static PyFunctionTable funcTable;
- private static PyCode c$0___init__;
- private static PyCode c$1_opengroup;
- private static PyCode c$2_closegroup;
- private static PyCode c$3_checkgroup;
- private static PyCode c$4_Pattern;
- private static PyCode c$5___init__;
- private static PyCode c$6_dump;
- private static PyCode c$7___repr__;
- private static PyCode c$8___len__;
- private static PyCode c$9___delitem__;
- private static PyCode c$10___getitem__;
- private static PyCode c$11___setitem__;
- private static PyCode c$12___getslice__;
- private static PyCode c$13_insert;
- private static PyCode c$14_append;
- private static PyCode c$15_getwidth;
- private static PyCode c$16_SubPattern;
- private static PyCode c$17___init__;
- private static PyCode c$18__Tokenizer__next;
- private static PyCode c$19_match;
- private static PyCode c$20_get;
- private static PyCode c$21_tell;
- private static PyCode c$22_seek;
- private static PyCode c$23_Tokenizer;
- private static PyCode c$24_isident;
- private static PyCode c$25_isdigit;
- private static PyCode c$26_isname;
- private static PyCode c$27__group;
- private static PyCode c$28__class_escape;
- private static PyCode c$29__escape;
- private static PyCode c$30__parse_sub;
- private static PyCode c$31__parse;
- private static PyCode c$32_parse;
- private static PyCode c$33_literal;
- private static PyCode c$34_parse_template;
- private static PyCode c$35_expand_template;
- private static PyCode c$36_main;
- private static void initConstants() {
- s$0 = Py.newString(".\\[{()*+?^$|");
- s$1 = Py.newString("*+?{");
- s$2 = Py.newString("0123456789");
- s$3 = Py.newString("01234567");
- s$4 = Py.newString("0123456789abcdefABCDEF");
- s$5 = Py.newString(" \011\012\015\013\014");
- s$6 = Py.newString("\\a");
- s$7 = Py.newString("\007");
- s$8 = Py.newString("\\b");
- s$9 = Py.newString("\010");
- s$10 = Py.newString("\\f");
- s$11 = Py.newString("\014");
- s$12 = Py.newString("\\n");
- s$13 = Py.newString("\012");
- s$14 = Py.newString("\\r");
- s$15 = Py.newString("\015");
- s$16 = Py.newString("\\t");
- s$17 = Py.newString("\011");
- s$18 = Py.newString("\\v");
- s$19 = Py.newString("\013");
- s$20 = Py.newString("\\\\");
- s$21 = Py.newString("\\");
- s$22 = Py.newString("\\A");
- s$23 = Py.newString("\\B");
- s$24 = Py.newString("\\d");
- s$25 = Py.newString("\\D");
- s$26 = Py.newString("\\s");
- s$27 = Py.newString("\\S");
- s$28 = Py.newString("\\w");
- s$29 = Py.newString("\\W");
- s$30 = Py.newString("\\Z");
- s$31 = Py.newString("i");
- s$32 = Py.newString("L");
- s$33 = Py.newString("m");
- s$34 = Py.newString("s");
- s$35 = Py.newString("x");
- s$36 = Py.newString("t");
- s$37 = Py.newString("u");
- s$38 = Py.newString("10");
- i$39 = Py.newInteger(8);
- i$40 = Py.newInteger(0);
- i$41 = Py.newInteger(1);
- s$42 = Py.newString(" ");
- s$43 = Py.newString("in");
- s$44 = Py.newString("branch");
- s$45 = Py.newString("or");
- l$46 = Py.newLong("0");
- i$47 = Py.newInteger(2);
- s$48 = Py.newString("bogus escape");
- s$49 = Py.newString("a");
- s$50 = Py.newString("z");
- s$51 = Py.newString("A");
- s$52 = Py.newString("Z");
- s$53 = Py.newString("_");
- s$54 = Py.newString("0");
- s$55 = Py.newString("9");
- i$56 = Py.newInteger(4);
- s$57 = Py.newString("bogus escape: %s");
- i$58 = Py.newInteger(16);
- i$59 = Py.newInteger(255);
- i$60 = Py.newInteger(5);
- s$61 = Py.newString("cannot refer to open group");
- s$62 = Py.newString("|");
- s$63 = Py.newString(")");
- s$64 = Py.newString("pattern not properly closed");
- s$65 = Py.newString("#");
- s$66 = Py.newString("[");
- s$67 = Py.newString("^");
- s$68 = Py.newString("]");
- s$69 = Py.newString("unexpected end of regular expression");
- s$70 = Py.newString("-");
- s$71 = Py.newString("bad character range");
- s$72 = Py.newString("?");
- s$73 = Py.newString("*");
- s$74 = Py.newString("+");
- s$75 = Py.newString("{");
- s$76 = Py.newString("");
- s$77 = Py.newString(",");
- s$78 = Py.newString("}");
- s$79 = Py.newString("bad repeat interval");
- s$80 = Py.newString("not supported");
- s$81 = Py.newString("nothing to repeat");
- s$82 = Py.newString("multiple repeat");
- s$83 = Py.newString(".");
- s$84 = Py.newString("(");
- s$85 = Py.newString("P");
- s$86 = Py.newString("<");
- s$87 = Py.newString("unterminated name");
- s$88 = Py.newString(">");
- s$89 = Py.newString("bad character in group name");
- s$90 = Py.newString("=");
- s$91 = Py.newString("unknown group name");
- s$92 = Py.newString("unexpected end of pattern");
- s$93 = Py.newString("unknown specifier: ?P%s");
- s$94 = Py.newString(":");
- s$95 = Py.newString("unbalanced parenthesis");
- s$96 = Py.newString("!");
- s$97 = Py.newString("syntax error");
- s$98 = Py.newString("unknown extension");
- s$99 = Py.newString("$");
- s$100 = Py.newString("parser error");
- s$101 = Py.newString("bogus characters at end of regular expression");
- s$102 = Py.newString("\\g");
- s$103 = Py.newString("unterminated group name");
- s$104 = Py.newString("bad group name");
- i$105 = Py.newInteger(6);
- s$106 = Py.newString("empty group");
- s$107 = Py.newString("/usr/share/jython/Lib-cpython/sre_parse.py");
- funcTable = new _PyInner();
- c$0___init__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "__init__", false, false, funcTable, 0, null, null, 0, 1);
- c$1_opengroup = Py.newCode(2, new String[] {"self", "name", "gid"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "opengroup", false, false, funcTable, 1, null, null, 0, 1);
- c$2_closegroup = Py.newCode(2, new String[] {"self", "gid"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "closegroup", false, false, funcTable, 2, null, null, 0, 1);
- c$3_checkgroup = Py.newCode(2, new String[] {"self", "gid"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "checkgroup", false, false, funcTable, 3, null, null, 0, 1);
- c$4_Pattern = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/sre_parse.py", "Pattern", false, false, funcTable, 4, null, null, 0, 0);
- c$5___init__ = Py.newCode(3, new String[] {"self", "pattern", "data"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "__init__", false, false, funcTable, 5, null, null, 0, 1);
- c$6_dump = Py.newCode(2, new String[] {"self", "level", "nl", "av", "i", "op", "a"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "dump", false, false, funcTable, 6, null, null, 0, 1);
- c$7___repr__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "__repr__", false, false, funcTable, 7, null, null, 0, 1);
- c$8___len__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "__len__", false, false, funcTable, 8, null, null, 0, 1);
- c$9___delitem__ = Py.newCode(2, new String[] {"self", "index"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "__delitem__", false, false, funcTable, 9, null, null, 0, 1);
- c$10___getitem__ = Py.newCode(2, new String[] {"self", "index"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "__getitem__", false, false, funcTable, 10, null, null, 0, 1);
- c$11___setitem__ = Py.newCode(3, new String[] {"self", "index", "code"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "__setitem__", false, false, funcTable, 11, null, null, 0, 1);
- c$12___getslice__ = Py.newCode(3, new String[] {"self", "start", "stop"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "__getslice__", false, false, funcTable, 12, null, null, 0, 1);
- c$13_insert = Py.newCode(3, new String[] {"self", "index", "code"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "insert", false, false, funcTable, 13, null, null, 0, 1);
- c$14_append = Py.newCode(2, new String[] {"self", "code"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "append", false, false, funcTable, 14, null, null, 0, 1);
- c$15_getwidth = Py.newCode(1, new String[] {"self", "hi", "lo", "op", "av", "l", "j", "i", "h"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "getwidth", false, false, funcTable, 15, null, null, 0, 1);
- c$16_SubPattern = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/sre_parse.py", "SubPattern", false, false, funcTable, 16, null, null, 0, 0);
- c$17___init__ = Py.newCode(2, new String[] {"self", "string"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "__init__", false, false, funcTable, 17, null, null, 0, 1);
- c$18__Tokenizer__next = Py.newCode(1, new String[] {"self", "char", "c"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "_Tokenizer__next", false, false, funcTable, 18, null, null, 0, 1);
- c$19_match = Py.newCode(3, new String[] {"self", "char", "skip"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "match", false, false, funcTable, 19, null, null, 0, 1);
- c$20_get = Py.newCode(1, new String[] {"self", "this"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "get", false, false, funcTable, 20, null, null, 0, 1);
- c$21_tell = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "tell", false, false, funcTable, 21, null, null, 0, 1);
- c$22_seek = Py.newCode(2, new String[] {"self", "index"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "seek", false, false, funcTable, 22, null, null, 0, 1);
- c$23_Tokenizer = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/sre_parse.py", "Tokenizer", false, false, funcTable, 23, null, null, 0, 0);
- c$24_isident = Py.newCode(1, new String[] {"char"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "isident", false, false, funcTable, 24, null, null, 0, 1);
- c$25_isdigit = Py.newCode(1, new String[] {"char"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "isdigit", false, false, funcTable, 25, null, null, 0, 1);
- c$26_isname = Py.newCode(1, new String[] {"name", "char"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "isname", false, false, funcTable, 26, null, null, 0, 1);
- c$27__group = Py.newCode(2, new String[] {"escape", "groups", "gid"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "_group", false, false, funcTable, 27, null, null, 0, 1);
- c$28__class_escape = Py.newCode(2, new String[] {"source", "escape", "code"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "_class_escape", false, false, funcTable, 28, null, null, 0, 1);
- c$29__escape = Py.newCode(3, new String[] {"source", "escape", "state", "here", "code", "group"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "_escape", false, false, funcTable, 29, null, null, 0, 1);
- c$30__parse_sub = Py.newCode(3, new String[] {"source", "state", "nested", "subpattern", "prefix", "items", "set", "item"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "_parse_sub", false, false, funcTable, 30, null, null, 0, 1);
- c$31__parse = Py.newCode(2, new String[] {"source", "state", "code", "this", "name", "group", "code2", "code1", "max", "start", "set", "item", "subpattern", "lo", "here", "char", "gid", "p", "dir", "min", "hi"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "_parse", false, false, funcTable, 31, null, null, 0, 1);
- c$32_parse = Py.newCode(3, new String[] {"str", "flags", "pattern", "source", "p", "tail"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "parse", false, false, funcTable, 32, null, null, 0, 1);
- c$33_literal = Py.newCode(2, new String[] {"literal", "p"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "literal", false, false, funcTable, 33, null, null, 0, 1);
- c$34_parse_template = Py.newCode(2, new String[] {"source", "pattern", "code", "this", "literals", "index", "group", "s", "sep", "p", "i", "literal", "groups", "char", "c", "a", "name"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "parse_template", false, false, funcTable, 34, null, null, 0, 1);
- c$35_expand_template = Py.newCode(2, new String[] {"template", "match", "literals", "groups", "g", "index", "group", "s", "sep"}, "/usr/share/jython/Lib-cpython/sre_parse.py", "expand_template", false, false, funcTable, 35, null, null, 0, 1);
- c$36_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/sre_parse.py", "main", false, false, funcTable, 36, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$36_main == null) _PyInner.initConstants();
- return c$36_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.__init__$1(frame);
- case 1:
- return _PyInner.opengroup$2(frame);
- case 2:
- return _PyInner.closegroup$3(frame);
- case 3:
- return _PyInner.checkgroup$4(frame);
- case 4:
- return _PyInner.Pattern$5(frame);
- case 5:
- return _PyInner.__init__$6(frame);
- case 6:
- return _PyInner.dump$7(frame);
- case 7:
- return _PyInner.__repr__$8(frame);
- case 8:
- return _PyInner.__len__$9(frame);
- case 9:
- return _PyInner.__delitem__$10(frame);
- case 10:
- return _PyInner.__getitem__$11(frame);
- case 11:
- return _PyInner.__setitem__$12(frame);
- case 12:
- return _PyInner.__getslice__$13(frame);
- case 13:
- return _PyInner.insert$14(frame);
- case 14:
- return _PyInner.append$15(frame);
- case 15:
- return _PyInner.getwidth$16(frame);
- case 16:
- return _PyInner.SubPattern$17(frame);
- case 17:
- return _PyInner.__init__$18(frame);
- case 18:
- return _PyInner._Tokenizer__next$19(frame);
- case 19:
- return _PyInner.match$20(frame);
- case 20:
- return _PyInner.get$21(frame);
- case 21:
- return _PyInner.tell$22(frame);
- case 22:
- return _PyInner.seek$23(frame);
- case 23:
- return _PyInner.Tokenizer$24(frame);
- case 24:
- return _PyInner.isident$25(frame);
- case 25:
- return _PyInner.isdigit$26(frame);
- case 26:
- return _PyInner.isname$27(frame);
- case 27:
- return _PyInner._group$28(frame);
- case 28:
- return _PyInner._class_escape$29(frame);
- case 29:
- return _PyInner._escape$30(frame);
- case 30:
- return _PyInner._parse_sub$31(frame);
- case 31:
- return _PyInner._parse$32(frame);
- case 32:
- return _PyInner.parse$33(frame);
- case 33:
- return _PyInner.literal$34(frame);
- case 34:
- return _PyInner.parse_template$35(frame);
- case 35:
- return _PyInner.expand_template$36(frame);
- case 36:
- return _PyInner.main$37(frame);
- default:
- return null;
- }
- }
-
- private static PyObject __init__$1(PyFrame frame) {
- frame.getlocal(0).__setattr__("flags", i$40);
- frame.getlocal(0).__setattr__("open", new PyList(new PyObject[] {}));
- frame.getlocal(0).__setattr__("groups", i$41);
- frame.getlocal(0).__setattr__("groupdict", new PyDictionary(new PyObject[] {}));
- return Py.None;
- }
-
- private static PyObject opengroup$2(PyFrame frame) {
- frame.setlocal(2, frame.getlocal(0).__getattr__("groups"));
- frame.getlocal(0).__setattr__("groups", frame.getlocal(2)._add(i$41));
- if (frame.getlocal(1).__nonzero__()) {
- frame.getlocal(0).__getattr__("groupdict").__setitem__(frame.getlocal(1), frame.getlocal(2));
- }
- frame.getlocal(0).__getattr__("open").invoke("append", frame.getlocal(2));
- return frame.getlocal(2);
- }
-
- private static PyObject closegroup$3(PyFrame frame) {
- frame.getlocal(0).__getattr__("open").invoke("remove", frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject checkgroup$4(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- return (t$0$PyObject = frame.getlocal(1)._lt(frame.getlocal(0).__getattr__("groups"))).__nonzero__() ? frame.getlocal(1)._notin(frame.getlocal(0).__getattr__("open")) : t$0$PyObject;
- }
-
- private static PyObject Pattern$5(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$0___init__));
- frame.setlocal("opengroup", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$1_opengroup));
- frame.setlocal("closegroup", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_closegroup));
- frame.setlocal("checkgroup", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_checkgroup));
- return frame.getf_locals();
- }
-
- private static PyObject __init__$6(PyFrame frame) {
- frame.getlocal(0).__setattr__("pattern", frame.getlocal(1));
- if (frame.getlocal(2).__not__().__nonzero__()) {
- frame.setlocal(2, new PyList(new PyObject[] {}));
- }
- frame.getlocal(0).__setattr__("data", frame.getlocal(2));
- frame.getlocal(0).__setattr__("width", frame.getglobal("None"));
- return Py.None;
- }
-
- private static PyObject dump$7(PyFrame frame) {
- // Temporary Variables
- int t$0$int, t$1$int, t$2$int, t$3$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject, t$4$PyObject, t$5$PyObject, t$6$PyObject, t$7$PyObject;
-
- // Code
- frame.setlocal(2, i$41);
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0).__getattr__("data");
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(5, t$0$PyObject__[0]);
- frame.setlocal(3, t$0$PyObject__[1]);
- Py.printComma(frame.getlocal(1)._mul(s$42)._add(frame.getlocal(5)));
- frame.setlocal(2, i$40);
- if (frame.getlocal(5)._eq(s$43).__nonzero__()) {
- Py.println();
- frame.setlocal(2, i$41);
- t$1$int = 0;
- t$3$PyObject = frame.getlocal(3);
- while ((t$2$PyObject = t$3$PyObject.__finditem__(t$1$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$2$PyObject, 2);
- frame.setlocal(5, t$0$PyObject__[0]);
- frame.setlocal(6, t$0$PyObject__[1]);
- Py.printComma(frame.getlocal(1)._add(i$41)._mul(s$42)._add(frame.getlocal(5)));
- Py.println(frame.getlocal(6));
- }
- }
- else if (frame.getlocal(5)._eq(s$44).__nonzero__()) {
- Py.println();
- frame.setlocal(2, i$41);
- frame.setlocal(4, i$40);
- t$2$int = 0;
- t$5$PyObject = frame.getlocal(3).__getitem__(i$41);
- while ((t$4$PyObject = t$5$PyObject.__finditem__(t$2$int++)) != null) {
- frame.setlocal(6, t$4$PyObject);
- if (frame.getlocal(4)._gt(i$40).__nonzero__()) {
- Py.println(frame.getlocal(1)._mul(s$42)._add(s$45));
- }
- frame.getlocal(6).invoke("dump", frame.getlocal(1)._add(i$41));
- frame.setlocal(2, i$41);
- frame.setlocal(4, frame.getlocal(4)._add(i$41));
- }
- }
- else if (frame.getglobal("type").__call__(frame.getlocal(3))._in(new PyTuple(new PyObject[] {frame.getglobal("type").__call__(new PyTuple(new PyObject[] {})), frame.getglobal("type").__call__(new PyList(new PyObject[] {}))})).__nonzero__()) {
- t$3$int = 0;
- t$7$PyObject = frame.getlocal(3);
- while ((t$6$PyObject = t$7$PyObject.__finditem__(t$3$int++)) != null) {
- frame.setlocal(6, t$6$PyObject);
- if (frame.getglobal("isinstance").__call__(frame.getlocal(6), frame.getglobal("SubPattern")).__nonzero__()) {
- if (frame.getlocal(2).__not__().__nonzero__()) {
- Py.println();
- }
- frame.getlocal(6).invoke("dump", frame.getlocal(1)._add(i$41));
- frame.setlocal(2, i$41);
- }
- else {
- Py.printComma(frame.getlocal(6));
- frame.setlocal(2, i$40);
- }
- }
- }
- else {
- Py.printComma(frame.getlocal(3));
- frame.setlocal(2, i$40);
- }
- if (frame.getlocal(2).__not__().__nonzero__()) {
- Py.println();
- }
- }
- return Py.None;
- }
-
- private static PyObject __repr__$8(PyFrame frame) {
- return frame.getglobal("repr").__call__(frame.getlocal(0).__getattr__("data"));
- }
-
- private static PyObject __len__$9(PyFrame frame) {
- return frame.getglobal("len").__call__(frame.getlocal(0).__getattr__("data"));
- }
-
- private static PyObject __delitem__$10(PyFrame frame) {
- frame.getlocal(0).__getattr__("data").__delitem__(frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject __getitem__$11(PyFrame frame) {
- return frame.getlocal(0).__getattr__("data").__getitem__(frame.getlocal(1));
- }
-
- private static PyObject __setitem__$12(PyFrame frame) {
- frame.getlocal(0).__getattr__("data").__setitem__(frame.getlocal(1), frame.getlocal(2));
- return Py.None;
- }
-
- private static PyObject __getslice__$13(PyFrame frame) {
- return frame.getglobal("SubPattern").__call__(frame.getlocal(0).__getattr__("pattern"), frame.getlocal(0).__getattr__("data").__getslice__(frame.getlocal(1), frame.getlocal(2), null));
- }
-
- private static PyObject insert$14(PyFrame frame) {
- frame.getlocal(0).__getattr__("data").invoke("insert", frame.getlocal(1), frame.getlocal(2));
- return Py.None;
- }
-
- private static PyObject append$15(PyFrame frame) {
- frame.getlocal(0).__getattr__("data").invoke("append", frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject getwidth$16(PyFrame frame) {
- // Temporary Variables
- int t$0$int, t$1$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject;
-
- // Code
- if (frame.getlocal(0).__getattr__("width").__nonzero__()) {
- return frame.getlocal(0).__getattr__("width");
- }
- t$0$PyObject = l$46;
- frame.setlocal(2, t$0$PyObject);
- frame.setlocal(1, t$0$PyObject);
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0).__getattr__("data");
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(3, t$0$PyObject__[0]);
- frame.setlocal(4, t$0$PyObject__[1]);
- if (frame.getlocal(3)._is(frame.getglobal("BRANCH")).__nonzero__()) {
- frame.setlocal(7, frame.getglobal("sys").__getattr__("maxint"));
- frame.setlocal(6, i$40);
- t$1$int = 0;
- t$3$PyObject = frame.getlocal(4).__getitem__(i$41);
- while ((t$2$PyObject = t$3$PyObject.__finditem__(t$1$int++)) != null) {
- frame.setlocal(4, t$2$PyObject);
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(4).invoke("getwidth"), 2);
- frame.setlocal(5, t$0$PyObject__[0]);
- frame.setlocal(8, t$0$PyObject__[1]);
- frame.setlocal(7, frame.getglobal("min").__call__(frame.getlocal(7), frame.getlocal(5)));
- frame.setlocal(6, frame.getglobal("max").__call__(frame.getlocal(6), frame.getlocal(8)));
- }
- frame.setlocal(2, frame.getlocal(2)._add(frame.getlocal(7)));
- frame.setlocal(1, frame.getlocal(1)._add(frame.getlocal(6)));
- }
- else if (frame.getlocal(3)._is(frame.getglobal("CALL")).__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(4).invoke("getwidth"), 2);
- frame.setlocal(7, t$0$PyObject__[0]);
- frame.setlocal(6, t$0$PyObject__[1]);
- frame.setlocal(2, frame.getlocal(2)._add(frame.getlocal(7)));
- frame.setlocal(1, frame.getlocal(1)._add(frame.getlocal(6)));
- }
- else if (frame.getlocal(3)._is(frame.getglobal("SUBPATTERN")).__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(4).__getitem__(i$41).invoke("getwidth"), 2);
- frame.setlocal(7, t$0$PyObject__[0]);
- frame.setlocal(6, t$0$PyObject__[1]);
- frame.setlocal(2, frame.getlocal(2)._add(frame.getlocal(7)));
- frame.setlocal(1, frame.getlocal(1)._add(frame.getlocal(6)));
- }
- else if (frame.getlocal(3)._in(new PyTuple(new PyObject[] {frame.getglobal("MIN_REPEAT"), frame.getglobal("MAX_REPEAT")})).__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(4).__getitem__(i$47).invoke("getwidth"), 2);
- frame.setlocal(7, t$0$PyObject__[0]);
- frame.setlocal(6, t$0$PyObject__[1]);
- frame.setlocal(2, frame.getlocal(2)._add(frame.getglobal("long").__call__(frame.getlocal(7))._mul(frame.getlocal(4).__getitem__(i$40))));
- frame.setlocal(1, frame.getlocal(1)._add(frame.getglobal("long").__call__(frame.getlocal(6))._mul(frame.getlocal(4).__getitem__(i$41))));
- }
- else if (frame.getlocal(3)._in(new PyTuple(new PyObject[] {frame.getglobal("ANY"), frame.getglobal("RANGE"), frame.getglobal("IN"), frame.getglobal("LITERAL"), frame.getglobal("NOT_LITERAL"), frame.getglobal("CATEGORY")})).__nonzero__()) {
- frame.setlocal(2, frame.getlocal(2)._add(i$41));
- frame.setlocal(1, frame.getlocal(1)._add(i$41));
- }
- else if (frame.getlocal(3)._eq(frame.getglobal("SUCCESS")).__nonzero__()) {
- break;
- }
- }
- frame.getlocal(0).__setattr__("width", new PyTuple(new PyObject[] {frame.getglobal("int").__call__(frame.getglobal("min").__call__(frame.getlocal(2), frame.getglobal("sys").__getattr__("maxint"))), frame.getglobal("int").__call__(frame.getglobal("min").__call__(frame.getlocal(1), frame.getglobal("sys").__getattr__("maxint")))}));
- return frame.getlocal(0).__getattr__("width");
- }
-
- private static PyObject SubPattern$17(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$5___init__));
- frame.setlocal("dump", new PyFunction(frame.f_globals, new PyObject[] {i$40}, c$6_dump));
- frame.setlocal("__repr__", new PyFunction(frame.f_globals, new PyObject[] {}, c$7___repr__));
- frame.setlocal("__len__", new PyFunction(frame.f_globals, new PyObject[] {}, c$8___len__));
- frame.setlocal("__delitem__", new PyFunction(frame.f_globals, new PyObject[] {}, c$9___delitem__));
- frame.setlocal("__getitem__", new PyFunction(frame.f_globals, new PyObject[] {}, c$10___getitem__));
- frame.setlocal("__setitem__", new PyFunction(frame.f_globals, new PyObject[] {}, c$11___setitem__));
- frame.setlocal("__getslice__", new PyFunction(frame.f_globals, new PyObject[] {}, c$12___getslice__));
- frame.setlocal("insert", new PyFunction(frame.f_globals, new PyObject[] {}, c$13_insert));
- frame.setlocal("append", new PyFunction(frame.f_globals, new PyObject[] {}, c$14_append));
- frame.setlocal("getwidth", new PyFunction(frame.f_globals, new PyObject[] {}, c$15_getwidth));
- return frame.getf_locals();
- }
-
- private static PyObject __init__$18(PyFrame frame) {
- frame.getlocal(0).__setattr__("string", frame.getlocal(1));
- frame.getlocal(0).__setattr__("index", i$40);
- frame.getlocal(0).invoke("_Tokenizer__next");
- return Py.None;
- }
-
- private static PyObject _Tokenizer__next$19(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- if (frame.getlocal(0).__getattr__("index")._ge(frame.getglobal("len").__call__(frame.getlocal(0).__getattr__("string"))).__nonzero__()) {
- frame.getlocal(0).__setattr__("next", frame.getglobal("None"));
- return Py.None;
- }
- frame.setlocal(1, frame.getlocal(0).__getattr__("string").__getitem__(frame.getlocal(0).__getattr__("index")));
- if (frame.getlocal(1).__getitem__(i$40)._eq(s$21).__nonzero__()) {
- try {
- frame.setlocal(2, frame.getlocal(0).__getattr__("string").__getitem__(frame.getlocal(0).__getattr__("index")._add(i$41)));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("IndexError"))) {
- throw Py.makeException(frame.getglobal("error"), s$48);
- }
- else throw t$0$PyException;
- }
- frame.setlocal(1, frame.getlocal(1)._add(frame.getlocal(2)));
- }
- frame.getlocal(0).__setattr__("index", frame.getlocal(0).__getattr__("index")._add(frame.getglobal("len").__call__(frame.getlocal(1))));
- frame.getlocal(0).__setattr__("next", frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject match$20(PyFrame frame) {
- if (frame.getlocal(1)._eq(frame.getlocal(0).__getattr__("next")).__nonzero__()) {
- if (frame.getlocal(2).__nonzero__()) {
- frame.getlocal(0).invoke("_Tokenizer__next");
- }
- return i$41;
- }
- return i$40;
- }
-
- private static PyObject get$21(PyFrame frame) {
- frame.setlocal(1, frame.getlocal(0).__getattr__("next"));
- frame.getlocal(0).invoke("_Tokenizer__next");
- return frame.getlocal(1);
- }
-
- private static PyObject tell$22(PyFrame frame) {
- return new PyTuple(new PyObject[] {frame.getlocal(0).__getattr__("index"), frame.getlocal(0).__getattr__("next")});
- }
-
- private static PyObject seek$23(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1), 2);
- frame.getlocal(0).__setattr__("index", t$0$PyObject__[0]);
- frame.getlocal(0).__setattr__("next", t$0$PyObject__[1]);
- return Py.None;
- }
-
- private static PyObject Tokenizer$24(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$17___init__));
- frame.setlocal("_Tokenizer__next", new PyFunction(frame.f_globals, new PyObject[] {}, c$18__Tokenizer__next));
- frame.setlocal("match", new PyFunction(frame.f_globals, new PyObject[] {i$41}, c$19_match));
- frame.setlocal("get", new PyFunction(frame.f_globals, new PyObject[] {}, c$20_get));
- frame.setlocal("tell", new PyFunction(frame.f_globals, new PyObject[] {}, c$21_tell));
- frame.setlocal("seek", new PyFunction(frame.f_globals, new PyObject[] {}, c$22_seek));
- return frame.getf_locals();
- }
-
- private static PyObject isident$25(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
-
- // Code
- return (t$0$PyObject = ((t$1$PyObject = (s$49._le(t$2$PyObject = frame.getlocal(0)).__nonzero__() ? t$2$PyObject._le(s$50) : Py.Zero)).__nonzero__() ? t$1$PyObject : (s$51._le(t$2$PyObject = frame.getlocal(0)).__nonzero__() ? t$2$PyObject._le(s$52) : Py.Zero))).__nonzero__() ? t$0$PyObject : frame.getlocal(0)._eq(s$53);
- }
-
- private static PyObject isdigit$26(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- return s$54._le(t$0$PyObject = frame.getlocal(0)).__nonzero__() ? t$0$PyObject._le(s$55) : Py.Zero;
- }
-
- private static PyObject isname$27(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
-
- // Code
- if (frame.getglobal("isident").__call__(frame.getlocal(0).__getitem__(i$40)).__not__().__nonzero__()) {
- return i$40;
- }
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(1, t$0$PyObject);
- if (((t$2$PyObject = frame.getglobal("isident").__call__(frame.getlocal(1)).__not__()).__nonzero__() ? frame.getglobal("isdigit").__call__(frame.getlocal(1)).__not__() : t$2$PyObject).__nonzero__()) {
- return i$40;
- }
- }
- return i$41;
- }
-
- private static PyObject _group$28(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
- PyObject t$0$PyObject;
-
- // Code
- try {
- frame.setlocal(2, frame.getglobal("atoi").__call__(frame.getlocal(0).__getslice__(i$41, null, null)));
- if (((t$0$PyObject = frame.getlocal(2)).__nonzero__() ? frame.getlocal(2)._lt(frame.getlocal(1)) : t$0$PyObject).__nonzero__()) {
- return frame.getlocal(2);
- }
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("ValueError"))) {
- // pass
- }
- else throw t$0$PyException;
- }
- return frame.getglobal("None");
- }
-
- private static PyObject _class_escape$29(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
- PyObject t$0$PyObject;
-
- // Code
- frame.setlocal(2, frame.getglobal("ESCAPES").invoke("get", frame.getlocal(1)));
- if (frame.getlocal(2).__nonzero__()) {
- return frame.getlocal(2);
- }
- frame.setlocal(2, frame.getglobal("CATEGORIES").invoke("get", frame.getlocal(1)));
- if (frame.getlocal(2).__nonzero__()) {
- return frame.getlocal(2);
- }
- try {
- if (frame.getlocal(1).__getslice__(i$41, i$47, null)._eq(s$35).__nonzero__()) {
- while (((t$0$PyObject = frame.getlocal(0).__getattr__("next")._in(frame.getglobal("HEXDIGITS"))).__nonzero__() ? frame.getglobal("len").__call__(frame.getlocal(1))._lt(i$56) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(1)._add(frame.getlocal(0).invoke("get")));
- }
- frame.setlocal(1, frame.getlocal(1).__getslice__(i$47, null, null));
- if (frame.getglobal("len").__call__(frame.getlocal(1))._ne(i$47).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$57._mod(frame.getglobal("repr").__call__(s$21._add(frame.getlocal(1)))));
- }
- return new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getglobal("atoi").__call__(frame.getlocal(1), i$58)._and(i$59)});
- }
- else if (frame.getglobal("str").__call__(frame.getlocal(1).__getslice__(i$41, i$47, null))._in(frame.getglobal("OCTDIGITS")).__nonzero__()) {
- while (((t$0$PyObject = frame.getlocal(0).__getattr__("next")._in(frame.getglobal("OCTDIGITS"))).__nonzero__() ? frame.getglobal("len").__call__(frame.getlocal(1))._lt(i$60) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(1)._add(frame.getlocal(0).invoke("get")));
- }
- frame.setlocal(1, frame.getlocal(1).__getslice__(i$41, null, null));
- return new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getglobal("atoi").__call__(frame.getlocal(1), i$39)._and(i$59)});
- }
- if (frame.getglobal("len").__call__(frame.getlocal(1))._eq(i$47).__nonzero__()) {
- return new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getglobal("ord").__call__(frame.getlocal(1).__getitem__(i$41))});
- }
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("ValueError"))) {
- // pass
- }
- else throw t$0$PyException;
- }
- throw Py.makeException(frame.getglobal("error"), s$57._mod(frame.getglobal("repr").__call__(frame.getlocal(1))));
- }
-
- private static PyObject _escape$30(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(4, frame.getglobal("CATEGORIES").invoke("get", frame.getlocal(1)));
- if (frame.getlocal(4).__nonzero__()) {
- return frame.getlocal(4);
- }
- frame.setlocal(4, frame.getglobal("ESCAPES").invoke("get", frame.getlocal(1)));
- if (frame.getlocal(4).__nonzero__()) {
- return frame.getlocal(4);
- }
- try {
- if (frame.getlocal(1).__getslice__(i$41, i$47, null)._eq(s$35).__nonzero__()) {
- while (((t$0$PyObject = frame.getlocal(0).__getattr__("next")._in(frame.getglobal("HEXDIGITS"))).__nonzero__() ? frame.getglobal("len").__call__(frame.getlocal(1))._lt(i$56) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(1)._add(frame.getlocal(0).invoke("get")));
- }
- if (frame.getglobal("len").__call__(frame.getlocal(1))._ne(i$56).__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"));
- }
- return new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getglobal("atoi").__call__(frame.getlocal(1).__getslice__(i$47, null, null), i$58)._and(i$59)});
- }
- else if (frame.getlocal(1).__getslice__(i$41, i$47, null)._eq(s$54).__nonzero__()) {
- while (((t$0$PyObject = frame.getlocal(0).__getattr__("next")._in(frame.getglobal("OCTDIGITS"))).__nonzero__() ? frame.getglobal("len").__call__(frame.getlocal(1))._lt(i$56) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(1)._add(frame.getlocal(0).invoke("get")));
- }
- return new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getglobal("atoi").__call__(frame.getlocal(1).__getslice__(i$41, null, null), i$39)._and(i$59)});
- }
- else if (frame.getlocal(1).__getslice__(i$41, i$47, null)._in(frame.getglobal("DIGITS")).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(0).invoke("tell"));
- if (frame.getlocal(0).__getattr__("next")._in(frame.getglobal("DIGITS")).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(1)._add(frame.getlocal(0).invoke("get")));
- if (((t$0$PyObject = ((t$1$PyObject = frame.getlocal(1).__getitem__(i$41)._in(frame.getglobal("OCTDIGITS"))).__nonzero__() ? frame.getlocal(1).__getitem__(i$47)._in(frame.getglobal("OCTDIGITS")) : t$1$PyObject)).__nonzero__() ? frame.getlocal(0).__getattr__("next")._in(frame.getglobal("OCTDIGITS")) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(1)._add(frame.getlocal(0).invoke("get")));
- return new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getglobal("atoi").__call__(frame.getlocal(1).__getslice__(i$41, null, null), i$39)._and(i$59)});
- }
- }
- frame.setlocal(5, frame.getglobal("_group").__call__(frame.getlocal(1), frame.getlocal(2).__getattr__("groups")));
- if (frame.getlocal(5).__nonzero__()) {
- if (frame.getlocal(2).invoke("checkgroup", frame.getlocal(5)).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$61);
- }
- return new PyTuple(new PyObject[] {frame.getglobal("GROUPREF"), frame.getlocal(5)});
- }
- throw Py.makeException(frame.getglobal("ValueError"));
- }
- if (frame.getglobal("len").__call__(frame.getlocal(1))._eq(i$47).__nonzero__()) {
- return new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getglobal("ord").__call__(frame.getlocal(1).__getitem__(i$41))});
- }
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("ValueError"))) {
- // pass
- }
- else throw t$0$PyException;
- }
- throw Py.makeException(frame.getglobal("error"), s$57._mod(frame.getglobal("repr").__call__(frame.getlocal(1))));
- }
-
- private static PyObject _parse_sub$31(PyFrame frame) {
- // Temporary Variables
- int t$0$int, t$1$int, t$2$int, t$3$int;
- boolean t$0$boolean;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject, t$4$PyObject, t$5$PyObject, t$6$PyObject, t$7$PyObject;
-
- // Code
- frame.setlocal(5, new PyList(new PyObject[] {}));
- while (i$41.__nonzero__()) {
- frame.getlocal(5).invoke("append", frame.getglobal("_parse").__call__(frame.getlocal(0), frame.getlocal(1)));
- if (frame.getlocal(0).invoke("match", s$62).__nonzero__()) {
- continue;
- }
- if (frame.getlocal(2).__not__().__nonzero__()) {
- break;
- }
- if (((t$0$PyObject = frame.getlocal(0).__getattr__("next").__not__()).__nonzero__() ? t$0$PyObject : frame.getlocal(0).invoke("match", s$63, i$40)).__nonzero__()) {
- break;
- }
- else {
- throw Py.makeException(frame.getglobal("error"), s$64);
- }
- }
- if (frame.getglobal("len").__call__(frame.getlocal(5))._eq(i$41).__nonzero__()) {
- return frame.getlocal(5).__getitem__(i$40);
- }
- frame.setlocal(3, frame.getglobal("SubPattern").__call__(frame.getlocal(1)));
- while (i$41.__nonzero__()) {
- frame.setlocal(4, frame.getglobal("None"));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(5);
- while (t$0$boolean=(t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(7, t$0$PyObject);
- if (frame.getlocal(7).__not__().__nonzero__()) {
- break;
- }
- if (frame.getlocal(4)._is(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(7).__getitem__(i$40));
- }
- else if (frame.getlocal(7).__getitem__(i$40)._ne(frame.getlocal(4)).__nonzero__()) {
- break;
- }
- }
- if (!t$0$boolean) {
- t$1$int = 0;
- t$3$PyObject = frame.getlocal(5);
- while ((t$2$PyObject = t$3$PyObject.__finditem__(t$1$int++)) != null) {
- frame.setlocal(7, t$2$PyObject);
- frame.getlocal(7).__delitem__(i$40);
- }
- frame.getlocal(3).invoke("append", frame.getlocal(4));
- continue;
- }
- break;
- }
- t$2$int = 0;
- t$5$PyObject = frame.getlocal(5);
- while (t$0$boolean=(t$4$PyObject = t$5$PyObject.__finditem__(t$2$int++)) != null) {
- frame.setlocal(7, t$4$PyObject);
- if (((t$6$PyObject = frame.getglobal("len").__call__(frame.getlocal(7))._ne(i$41)).__nonzero__() ? t$6$PyObject : frame.getlocal(7).__getitem__(i$40).__getitem__(i$40)._ne(frame.getglobal("LITERAL"))).__nonzero__()) {
- break;
- }
- }
- if (!t$0$boolean) {
- frame.setlocal(6, new PyList(new PyObject[] {}));
- t$3$int = 0;
- t$7$PyObject = frame.getlocal(5);
- while ((t$6$PyObject = t$7$PyObject.__finditem__(t$3$int++)) != null) {
- frame.setlocal(7, t$6$PyObject);
- frame.getlocal(6).invoke("append", frame.getlocal(7).__getitem__(i$40));
- }
- frame.getlocal(3).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("IN"), frame.getlocal(6)}));
- return frame.getlocal(3);
- }
- frame.getlocal(3).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("BRANCH"), new PyTuple(new PyObject[] {frame.getglobal("None"), frame.getlocal(5)})}));
- return frame.getlocal(3);
- }
-
- private static PyObject _parse$32(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(12, frame.getglobal("SubPattern").__call__(frame.getlocal(1)));
- while (i$41.__nonzero__()) {
- if (frame.getlocal(0).__getattr__("next")._in(new PyTuple(new PyObject[] {s$62, s$63})).__nonzero__()) {
- break;
- }
- frame.setlocal(3, frame.getlocal(0).invoke("get"));
- if (frame.getlocal(3)._is(frame.getglobal("None")).__nonzero__()) {
- break;
- }
- if (frame.getlocal(1).__getattr__("flags")._and(frame.getglobal("SRE_FLAG_VERBOSE")).__nonzero__()) {
- if (frame.getlocal(3)._in(frame.getglobal("WHITESPACE")).__nonzero__()) {
- continue;
- }
- if (frame.getlocal(3)._eq(s$65).__nonzero__()) {
- while (i$41.__nonzero__()) {
- frame.setlocal(3, frame.getlocal(0).invoke("get"));
- if (frame.getlocal(3)._in(new PyTuple(new PyObject[] {frame.getglobal("None"), s$13})).__nonzero__()) {
- break;
- }
- }
- continue;
- }
- }
- if (((t$0$PyObject = frame.getlocal(3)).__nonzero__() ? frame.getlocal(3).__getitem__(i$40)._notin(frame.getglobal("SPECIAL_CHARS")) : t$0$PyObject).__nonzero__()) {
- frame.getlocal(12).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getglobal("ord").__call__(frame.getlocal(3))}));
- }
- else if (frame.getlocal(3)._eq(s$66).__nonzero__()) {
- frame.setlocal(10, new PyList(new PyObject[] {}));
- if (frame.getlocal(0).invoke("match", s$67).__nonzero__()) {
- frame.getlocal(10).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("NEGATE"), frame.getglobal("None")}));
- }
- frame.setlocal(9, frame.getlocal(10).__getslice__(null, null, null));
- while (i$41.__nonzero__()) {
- frame.setlocal(3, frame.getlocal(0).invoke("get"));
- if (((t$0$PyObject = frame.getlocal(3)._eq(s$68)).__nonzero__() ? frame.getlocal(10)._ne(frame.getlocal(9)) : t$0$PyObject).__nonzero__()) {
- break;
- }
- else if (((t$0$PyObject = frame.getlocal(3)).__nonzero__() ? frame.getlocal(3).__getitem__(i$40)._eq(s$21) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(7, frame.getglobal("_class_escape").__call__(frame.getlocal(0), frame.getlocal(3)));
- }
- else if (frame.getlocal(3).__nonzero__()) {
- frame.setlocal(7, new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getglobal("ord").__call__(frame.getlocal(3))}));
- }
- else {
- throw Py.makeException(frame.getglobal("error"), s$69);
- }
- if (frame.getlocal(0).invoke("match", s$70).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(0).invoke("get"));
- if (frame.getlocal(3)._eq(s$68).__nonzero__()) {
- if (frame.getlocal(7).__getitem__(i$40)._is(frame.getglobal("IN")).__nonzero__()) {
- frame.setlocal(7, frame.getlocal(7).__getitem__(i$41).__getitem__(i$40));
- }
- frame.getlocal(10).invoke("append", frame.getlocal(7));
- frame.getlocal(10).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getglobal("ord").__call__(s$70)}));
- break;
- }
- else {
- if (frame.getlocal(3).__getitem__(i$40)._eq(s$21).__nonzero__()) {
- frame.setlocal(6, frame.getglobal("_class_escape").__call__(frame.getlocal(0), frame.getlocal(3)));
- }
- else {
- frame.setlocal(6, new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getglobal("ord").__call__(frame.getlocal(3))}));
- }
- if (((t$0$PyObject = frame.getlocal(7).__getitem__(i$40)._ne(frame.getglobal("LITERAL"))).__nonzero__() ? t$0$PyObject : frame.getlocal(6).__getitem__(i$40)._ne(frame.getglobal("LITERAL"))).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$71);
- }
- frame.setlocal(13, frame.getlocal(7).__getitem__(i$41));
- frame.setlocal(20, frame.getlocal(6).__getitem__(i$41));
- if (frame.getlocal(20)._lt(frame.getlocal(13)).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$71);
- }
- frame.getlocal(10).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("RANGE"), new PyTuple(new PyObject[] {frame.getlocal(13), frame.getlocal(20)})}));
- }
- }
- else {
- if (frame.getlocal(7).__getitem__(i$40)._is(frame.getglobal("IN")).__nonzero__()) {
- frame.setlocal(7, frame.getlocal(7).__getitem__(i$41).__getitem__(i$40));
- }
- frame.getlocal(10).invoke("append", frame.getlocal(7));
- }
- }
- if (((t$0$PyObject = frame.getglobal("len").__call__(frame.getlocal(10))._eq(i$41)).__nonzero__() ? frame.getlocal(10).__getitem__(i$40).__getitem__(i$40)._is(frame.getglobal("LITERAL")) : t$0$PyObject).__nonzero__()) {
- frame.getlocal(12).invoke("append", frame.getlocal(10).__getitem__(i$40));
- }
- else if (((t$0$PyObject = ((t$1$PyObject = frame.getglobal("len").__call__(frame.getlocal(10))._eq(i$47)).__nonzero__() ? frame.getlocal(10).__getitem__(i$40).__getitem__(i$40)._is(frame.getglobal("NEGATE")) : t$1$PyObject)).__nonzero__() ? frame.getlocal(10).__getitem__(i$41).__getitem__(i$40)._is(frame.getglobal("LITERAL")) : t$0$PyObject).__nonzero__()) {
- frame.getlocal(12).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("NOT_LITERAL"), frame.getlocal(10).__getitem__(i$41).__getitem__(i$41)}));
- }
- else {
- frame.getlocal(12).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("IN"), frame.getlocal(10)}));
- }
- }
- else if (((t$0$PyObject = frame.getlocal(3)).__nonzero__() ? frame.getlocal(3).__getitem__(i$40)._in(frame.getglobal("REPEAT_CHARS")) : t$0$PyObject).__nonzero__()) {
- if (frame.getlocal(3)._eq(s$72).__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(new PyTuple(new PyObject[] {i$40, i$41}), 2);
- frame.setlocal(19, t$0$PyObject__[0]);
- frame.setlocal(8, t$0$PyObject__[1]);
- }
- else if (frame.getlocal(3)._eq(s$73).__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(new PyTuple(new PyObject[] {i$40, frame.getglobal("MAXREPEAT")}), 2);
- frame.setlocal(19, t$0$PyObject__[0]);
- frame.setlocal(8, t$0$PyObject__[1]);
- }
- else if (frame.getlocal(3)._eq(s$74).__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(new PyTuple(new PyObject[] {i$41, frame.getglobal("MAXREPEAT")}), 2);
- frame.setlocal(19, t$0$PyObject__[0]);
- frame.setlocal(8, t$0$PyObject__[1]);
- }
- else if (frame.getlocal(3)._eq(s$75).__nonzero__()) {
- frame.setlocal(14, frame.getlocal(0).invoke("tell"));
- t$0$PyObject__ = org.python.core.Py.unpackSequence(new PyTuple(new PyObject[] {i$40, frame.getglobal("MAXREPEAT")}), 2);
- frame.setlocal(19, t$0$PyObject__[0]);
- frame.setlocal(8, t$0$PyObject__[1]);
- t$0$PyObject = s$76;
- frame.setlocal(13, t$0$PyObject);
- frame.setlocal(20, t$0$PyObject);
- while (frame.getlocal(0).__getattr__("next")._in(frame.getglobal("DIGITS")).__nonzero__()) {
- frame.setlocal(13, frame.getlocal(13)._add(frame.getlocal(0).invoke("get")));
- }
- if (frame.getlocal(0).invoke("match", s$77).__nonzero__()) {
- while (frame.getlocal(0).__getattr__("next")._in(frame.getglobal("DIGITS")).__nonzero__()) {
- frame.setlocal(20, frame.getlocal(20)._add(frame.getlocal(0).invoke("get")));
- }
- }
- else {
- frame.setlocal(20, frame.getlocal(13));
- }
- if (frame.getlocal(0).invoke("match", s$78).__not__().__nonzero__()) {
- frame.getlocal(12).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getglobal("ord").__call__(frame.getlocal(3))}));
- frame.getlocal(0).invoke("seek", frame.getlocal(14));
- continue;
- }
- if (frame.getlocal(13).__nonzero__()) {
- frame.setlocal(19, frame.getglobal("atoi").__call__(frame.getlocal(13)));
- }
- if (frame.getlocal(20).__nonzero__()) {
- frame.setlocal(8, frame.getglobal("atoi").__call__(frame.getlocal(20)));
- }
- if (frame.getlocal(8)._lt(frame.getlocal(19)).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$79);
- }
- }
- else {
- throw Py.makeException(frame.getglobal("error"), s$80);
- }
- if (frame.getlocal(12).__nonzero__()) {
- frame.setlocal(11, frame.getlocal(12).__getslice__(i$41.__neg__(), null, null));
- }
- else {
- frame.setlocal(11, frame.getglobal("None"));
- }
- if (((t$0$PyObject = frame.getlocal(11).__not__()).__nonzero__() ? t$0$PyObject : ((t$1$PyObject = frame.getglobal("len").__call__(frame.getlocal(11))._eq(i$41)).__nonzero__() ? frame.getlocal(11).__getitem__(i$40).__getitem__(i$40)._eq(frame.getglobal("AT")) : t$1$PyObject)).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$81);
- }
- if (frame.getlocal(11).__getitem__(i$40).__getitem__(i$40)._in(new PyTuple(new PyObject[] {frame.getglobal("MIN_REPEAT"), frame.getglobal("MAX_REPEAT")})).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$82);
- }
- if (frame.getlocal(0).invoke("match", s$72).__nonzero__()) {
- frame.getlocal(12).__setitem__(i$41.__neg__(), new PyTuple(new PyObject[] {frame.getglobal("MIN_REPEAT"), new PyTuple(new PyObject[] {frame.getlocal(19), frame.getlocal(8), frame.getlocal(11)})}));
- }
- else {
- frame.getlocal(12).__setitem__(i$41.__neg__(), new PyTuple(new PyObject[] {frame.getglobal("MAX_REPEAT"), new PyTuple(new PyObject[] {frame.getlocal(19), frame.getlocal(8), frame.getlocal(11)})}));
- }
- }
- else if (frame.getlocal(3)._eq(s$83).__nonzero__()) {
- frame.getlocal(12).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("ANY"), frame.getglobal("None")}));
- }
- else if (frame.getlocal(3)._eq(s$84).__nonzero__()) {
- frame.setlocal(5, i$41);
- frame.setlocal(4, frame.getglobal("None"));
- if (frame.getlocal(0).invoke("match", s$72).__nonzero__()) {
- frame.setlocal(5, i$40);
- if (frame.getlocal(0).invoke("match", s$85).__nonzero__()) {
- if (frame.getlocal(0).invoke("match", s$86).__nonzero__()) {
- frame.setlocal(4, s$76);
- while (i$41.__nonzero__()) {
- frame.setlocal(15, frame.getlocal(0).invoke("get"));
- if (frame.getlocal(15)._is(frame.getglobal("None")).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$87);
- }
- if (frame.getlocal(15)._eq(s$88).__nonzero__()) {
- break;
- }
- frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(15)));
- }
- frame.setlocal(5, i$41);
- if (frame.getglobal("isname").__call__(frame.getlocal(4)).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$89);
- }
- }
- else if (frame.getlocal(0).invoke("match", s$90).__nonzero__()) {
- frame.setlocal(4, s$76);
- while (i$41.__nonzero__()) {
- frame.setlocal(15, frame.getlocal(0).invoke("get"));
- if (frame.getlocal(15)._is(frame.getglobal("None")).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$87);
- }
- if (frame.getlocal(15)._eq(s$63).__nonzero__()) {
- break;
- }
- frame.setlocal(4, frame.getlocal(4)._add(frame.getlocal(15)));
- }
- if (frame.getglobal("isname").__call__(frame.getlocal(4)).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$89);
- }
- frame.setlocal(16, frame.getlocal(1).__getattr__("groupdict").invoke("get", frame.getlocal(4)));
- if (frame.getlocal(16)._is(frame.getglobal("None")).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$91);
- }
- frame.getlocal(12).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("GROUPREF"), frame.getlocal(16)}));
- continue;
- }
- else {
- frame.setlocal(15, frame.getlocal(0).invoke("get"));
- if (frame.getlocal(15)._is(frame.getglobal("None")).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$92);
- }
- throw Py.makeException(frame.getglobal("error"), s$93._mod(frame.getlocal(15)));
- }
- }
- else if (frame.getlocal(0).invoke("match", s$94).__nonzero__()) {
- frame.setlocal(5, i$47);
- }
- else if (frame.getlocal(0).invoke("match", s$65).__nonzero__()) {
- while (i$41.__nonzero__()) {
- if (((t$0$PyObject = frame.getlocal(0).__getattr__("next")._is(frame.getglobal("None"))).__nonzero__() ? t$0$PyObject : frame.getlocal(0).__getattr__("next")._eq(s$63)).__nonzero__()) {
- break;
- }
- frame.getlocal(0).invoke("get");
- }
- if (frame.getlocal(0).invoke("match", s$63).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$95);
- }
- continue;
- }
- else if (frame.getlocal(0).__getattr__("next")._in(new PyTuple(new PyObject[] {s$90, s$96, s$86})).__nonzero__()) {
- frame.setlocal(15, frame.getlocal(0).invoke("get"));
- frame.setlocal(18, i$41);
- if (frame.getlocal(15)._eq(s$86).__nonzero__()) {
- if (frame.getlocal(0).__getattr__("next")._notin(new PyTuple(new PyObject[] {s$90, s$96})).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$97);
- }
- frame.setlocal(18, i$41.__neg__());
- frame.setlocal(15, frame.getlocal(0).invoke("get"));
- }
- frame.setlocal(17, frame.getglobal("_parse_sub").__call__(frame.getlocal(0), frame.getlocal(1)));
- if (frame.getlocal(0).invoke("match", s$63).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$95);
- }
- if (frame.getlocal(15)._eq(s$90).__nonzero__()) {
- frame.getlocal(12).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("ASSERT"), new PyTuple(new PyObject[] {frame.getlocal(18), frame.getlocal(17)})}));
- }
- else {
- frame.getlocal(12).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("ASSERT_NOT"), new PyTuple(new PyObject[] {frame.getlocal(18), frame.getlocal(17)})}));
- }
- continue;
- }
- else {
- if (frame.getglobal("FLAGS").invoke("has_key", frame.getlocal(0).__getattr__("next")).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$92);
- }
- while (frame.getglobal("FLAGS").invoke("has_key", frame.getlocal(0).__getattr__("next")).__nonzero__()) {
- frame.getlocal(1).__setattr__("flags", frame.getlocal(1).__getattr__("flags")._or(frame.getglobal("FLAGS").__getitem__(frame.getlocal(0).invoke("get"))));
- }
- }
- }
- if (frame.getlocal(5).__nonzero__()) {
- if (frame.getlocal(5)._eq(i$47).__nonzero__()) {
- frame.setlocal(5, frame.getglobal("None"));
- }
- else {
- frame.setlocal(5, frame.getlocal(1).invoke("opengroup", frame.getlocal(4)));
- }
- frame.setlocal(17, frame.getglobal("_parse_sub").__call__(frame.getlocal(0), frame.getlocal(1)));
- if (frame.getlocal(0).invoke("match", s$63).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$95);
- }
- if (frame.getlocal(5)._isnot(frame.getglobal("None")).__nonzero__()) {
- frame.getlocal(1).invoke("closegroup", frame.getlocal(5));
- }
- frame.getlocal(12).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("SUBPATTERN"), new PyTuple(new PyObject[] {frame.getlocal(5), frame.getlocal(17)})}));
- }
- else {
- while (i$41.__nonzero__()) {
- frame.setlocal(15, frame.getlocal(0).invoke("get"));
- if (frame.getlocal(15)._is(frame.getglobal("None")).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$92);
- }
- if (frame.getlocal(15)._eq(s$63).__nonzero__()) {
- break;
- }
- throw Py.makeException(frame.getglobal("error"), s$98);
- }
- }
- }
- else if (frame.getlocal(3)._eq(s$67).__nonzero__()) {
- frame.getlocal(12).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("AT"), frame.getglobal("AT_BEGINNING")}));
- }
- else if (frame.getlocal(3)._eq(s$99).__nonzero__()) {
- frame.getlocal(12).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("AT"), frame.getglobal("AT_END")}));
- }
- else if (((t$0$PyObject = frame.getlocal(3)).__nonzero__() ? frame.getlocal(3).__getitem__(i$40)._eq(s$21) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(2, frame.getglobal("_escape").__call__(frame.getlocal(0), frame.getlocal(3), frame.getlocal(1)));
- frame.getlocal(12).invoke("append", frame.getlocal(2));
- }
- else {
- throw Py.makeException(frame.getglobal("error"), s$100);
- }
- }
- return frame.getlocal(12);
- }
-
- private static PyObject parse$33(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- frame.setlocal(3, frame.getglobal("Tokenizer").__call__(frame.getlocal(0)));
- if (frame.getlocal(2)._is(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(2, frame.getglobal("Pattern").__call__());
- }
- frame.getlocal(2).__setattr__("flags", frame.getlocal(1));
- frame.getlocal(2).__setattr__("str", frame.getlocal(0));
- frame.setlocal(4, frame.getglobal("_parse_sub").__call__(frame.getlocal(3), frame.getlocal(2), i$40));
- frame.setlocal(5, frame.getlocal(3).invoke("get"));
- if (frame.getlocal(5)._eq(s$63).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$95);
- }
- else if (frame.getlocal(5).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$101);
- }
- if (frame.getlocal(1)._and(frame.getglobal("SRE_FLAG_DEBUG")).__nonzero__()) {
- frame.getlocal(4).invoke("dump");
- }
- if (((t$0$PyObject = frame.getlocal(1)._and(frame.getglobal("SRE_FLAG_VERBOSE")).__not__()).__nonzero__() ? frame.getlocal(4).__getattr__("pattern").__getattr__("flags")._and(frame.getglobal("SRE_FLAG_VERBOSE")) : t$0$PyObject).__nonzero__()) {
- return frame.getglobal("parse").__call__(frame.getlocal(0), frame.getlocal(4).__getattr__("pattern").__getattr__("flags"));
- }
- return frame.getlocal(4);
- }
-
- private static PyObject literal$34(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- if (((t$0$PyObject = frame.getlocal(1)).__nonzero__() ? frame.getlocal(1).__getitem__(i$41.__neg__()).__getitem__(i$40)._is(frame.getglobal("LITERAL")) : t$0$PyObject).__nonzero__()) {
- frame.getlocal(1).__setitem__(i$41.__neg__(), new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getlocal(1).__getitem__(i$41.__neg__()).__getitem__(i$41)._add(frame.getlocal(0))}));
- }
- else {
- frame.getlocal(1).invoke("append", new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getlocal(0)}));
- }
- return Py.None;
- }
-
- private static PyObject parse_template$35(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyException t$0$PyException, t$1$PyException;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(7, frame.getglobal("Tokenizer").__call__(frame.getlocal(0)));
- frame.setlocal(9, new PyList(new PyObject[] {}));
- frame.setlocal(15, frame.getlocal(9).__getattr__("append"));
- frame.setlocal(11, new PyFunction(frame.f_globals, new PyObject[] {frame.getlocal(9)}, c$33_literal));
- frame.setlocal(8, frame.getlocal(0).__getslice__(null, i$40, null));
- if (frame.getglobal("type").__call__(frame.getlocal(8))._is(frame.getglobal("type").__call__(s$76)).__nonzero__()) {
- frame.setlocal(13, frame.getglobal("chr"));
- }
- else {
- frame.setlocal(13, frame.getglobal("unichr"));
- }
- while (i$41.__nonzero__()) {
- frame.setlocal(3, frame.getlocal(7).invoke("get"));
- if (frame.getlocal(3)._is(frame.getglobal("None")).__nonzero__()) {
- break;
- }
- if (((t$0$PyObject = frame.getlocal(3)).__nonzero__() ? frame.getlocal(3).__getitem__(i$40)._eq(s$21) : t$0$PyObject).__nonzero__()) {
- if (frame.getlocal(3)._eq(s$102).__nonzero__()) {
- frame.setlocal(16, s$76);
- if (frame.getlocal(7).invoke("match", s$86).__nonzero__()) {
- while (i$41.__nonzero__()) {
- frame.setlocal(13, frame.getlocal(7).invoke("get"));
- if (frame.getlocal(13)._is(frame.getglobal("None")).__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$103);
- }
- if (frame.getlocal(13)._eq(s$88).__nonzero__()) {
- break;
- }
- frame.setlocal(16, frame.getlocal(16)._add(frame.getlocal(13)));
- }
- }
- if (frame.getlocal(16).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$104);
- }
- try {
- frame.setlocal(5, frame.getglobal("atoi").__call__(frame.getlocal(16)));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("ValueError"))) {
- if (frame.getglobal("isname").__call__(frame.getlocal(16)).__not__().__nonzero__()) {
- throw Py.makeException(frame.getglobal("error"), s$89);
- }
- try {
- frame.setlocal(5, frame.getlocal(1).__getattr__("groupindex").__getitem__(frame.getlocal(16)));
- }
- catch (Throwable x$1) {
- t$1$PyException = Py.setException(x$1, frame);
- if (Py.matchException(t$1$PyException, frame.getglobal("KeyError"))) {
- throw Py.makeException(frame.getglobal("IndexError"), s$91);
- }
- else throw t$1$PyException;
- }
- }
- else throw t$0$PyException;
- }
- frame.getlocal(15).__call__(new PyTuple(new PyObject[] {frame.getglobal("MARK"), frame.getlocal(5)}));
- }
- else if (((t$0$PyObject = frame.getglobal("len").__call__(frame.getlocal(3))._gt(i$41)).__nonzero__() ? frame.getlocal(3).__getitem__(i$41)._in(frame.getglobal("DIGITS")) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(2, frame.getglobal("None"));
- while (i$41.__nonzero__()) {
- frame.setlocal(6, frame.getglobal("_group").__call__(frame.getlocal(3), frame.getlocal(1).__getattr__("groups")._add(i$41)));
- if (frame.getlocal(6).__nonzero__()) {
- if (((t$0$PyObject = frame.getlocal(7).__getattr__("next")._notin(frame.getglobal("DIGITS"))).__nonzero__() ? t$0$PyObject : frame.getglobal("_group").__call__(frame.getlocal(3)._add(frame.getlocal(7).__getattr__("next")), frame.getlocal(1).__getattr__("groups")._add(i$41)).__not__()).__nonzero__()) {
- frame.setlocal(2, new PyTuple(new PyObject[] {frame.getglobal("MARK"), frame.getlocal(6)}));
- break;
- }
- }
- else if (frame.getlocal(7).__getattr__("next")._in(frame.getglobal("OCTDIGITS")).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(3)._add(frame.getlocal(7).invoke("get")));
- }
- else {
- break;
- }
- }
- if (frame.getlocal(2).__not__().__nonzero__()) {
- frame.setlocal(3, frame.getlocal(3).__getslice__(i$41, null, null));
- frame.setlocal(2, new PyTuple(new PyObject[] {frame.getglobal("LITERAL"), frame.getlocal(13).__call__(frame.getglobal("atoi").__call__(frame.getlocal(3).__getslice__(i$105.__neg__(), null, null), i$39)._and(i$59))}));
- }
- if (frame.getlocal(2).__getitem__(i$40)._is(frame.getglobal("LITERAL")).__nonzero__()) {
- frame.getlocal(11).__call__(frame.getlocal(2).__getitem__(i$41));
- }
- else {
- frame.getlocal(15).__call__(frame.getlocal(2));
- }
- }
- else {
- try {
- frame.setlocal(3, frame.getlocal(13).__call__(frame.getglobal("ESCAPES").__getitem__(frame.getlocal(3)).__getitem__(i$41)));
- }
- catch (Throwable x$2) {
- t$0$PyException = Py.setException(x$2, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("KeyError"))) {
- // pass
- }
- else throw t$0$PyException;
- }
- frame.getlocal(11).__call__(frame.getlocal(3));
- }
- }
- else {
- frame.getlocal(11).__call__(frame.getlocal(3));
- }
- }
- frame.setlocal(10, i$40);
- frame.setlocal(12, new PyList(new PyObject[] {}));
- frame.setlocal(4, new PyList(new PyObject[] {}));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(9);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(14, t$0$PyObject__[0]);
- frame.setlocal(7, t$0$PyObject__[1]);
- if (frame.getlocal(14)._is(frame.getglobal("MARK")).__nonzero__()) {
- frame.getlocal(12).invoke("append", new PyTuple(new PyObject[] {frame.getlocal(10), frame.getlocal(7)}));
- frame.getlocal(4).invoke("append", frame.getglobal("None"));
- }
- else {
- frame.getlocal(4).invoke("append", frame.getlocal(7));
- }
- frame.setlocal(10, frame.getlocal(10)._add(i$41));
- }
- return new PyTuple(new PyObject[] {frame.getlocal(12), frame.getlocal(4)});
- }
-
- private static PyObject expand_template$36(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyException t$0$PyException;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
-
- // Code
- frame.setlocal(4, frame.getlocal(1).__getattr__("group"));
- frame.setlocal(8, frame.getlocal(1).__getattr__("string").__getslice__(null, i$40, null));
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0), 2);
- frame.setlocal(3, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- frame.setlocal(2, frame.getlocal(2).__getslice__(null, null, null));
- try {
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(3);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 2);
- frame.setlocal(5, t$0$PyObject__[0]);
- frame.setlocal(6, t$0$PyObject__[1]);
- t$2$PyObject = frame.getlocal(4).__call__(frame.getlocal(6));
- frame.getlocal(2).__setitem__(frame.getlocal(5), t$2$PyObject);
- frame.setlocal(7, t$2$PyObject);
- if (frame.getlocal(7)._is(frame.getglobal("None")).__nonzero__()) {
- throw Py.makeException(frame.getglobal("IndexError"));
- }
- }
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("IndexError"))) {
- throw Py.makeException(frame.getglobal("error"), s$106);
- }
- else throw t$0$PyException;
- }
- return frame.getglobal("string").__getattr__("join").__call__(frame.getlocal(2), frame.getlocal(8));
- }
-
- private static PyObject main$37(PyFrame frame) {
- frame.setglobal("__file__", s$107);
-
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- frame.setlocal("string", org.python.core.imp.importOne("string", frame));
- frame.setlocal("sys", org.python.core.imp.importOne("sys", frame));
- org.python.core.imp.importAll("sre_constants", frame);
- frame.setlocal("SPECIAL_CHARS", s$0);
- frame.setlocal("REPEAT_CHARS", s$1);
- frame.setlocal("DIGITS", frame.getname("tuple").__call__(s$2));
- frame.setlocal("OCTDIGITS", frame.getname("tuple").__call__(s$3));
- frame.setlocal("HEXDIGITS", frame.getname("tuple").__call__(s$4));
- frame.setlocal("WHITESPACE", frame.getname("tuple").__call__(s$5));
- frame.setlocal("ESCAPES", new PyDictionary(new PyObject[] {s$6, new PyTuple(new PyObject[] {frame.getname("LITERAL"), frame.getname("ord").__call__(s$7)}), s$8, new PyTuple(new PyObject[] {frame.getname("LITERAL"), frame.getname("ord").__call__(s$9)}), s$10, new PyTuple(new PyObject[] {frame.getname("LITERAL"), frame.getname("ord").__call__(s$11)}), s$12, new PyTuple(new PyObject[] {frame.getname("LITERAL"), frame.getname("ord").__call__(s$13)}), s$14, new PyTuple(new PyObject[] {frame.getname("LITERAL"), frame.getname("ord").__call__(s$15)}), s$16, new PyTuple(new PyObject[] {frame.getname("LITERAL"), frame.getname("ord").__call__(s$17)}), s$18, new PyTuple(new PyObject[] {frame.getname("LITERAL"), frame.getname("ord").__call__(s$19)}), s$20, new PyTuple(new PyObject[] {frame.getname("LITERAL"), frame.getname("ord").__call__(s$21)})}));
- frame.setlocal("CATEGORIES", new PyDictionary(new PyObject[] {s$22, new PyTuple(new PyObject[] {frame.getname("AT"), frame.getname("AT_BEGINNING_STRING")}), s$8, new PyTuple(new PyObject[] {frame.getname("AT"), frame.getname("AT_BOUNDARY")}), s$23, new PyTuple(new PyObject[] {frame.getname("AT"), frame.getname("AT_NON_BOUNDARY")}), s$24, new PyTuple(new PyObject[] {frame.getname("IN"), new PyList(new PyObject[] {new PyTuple(new PyObject[] {frame.getname("CATEGORY"), frame.getname("CATEGORY_DIGIT")})})}), s$25, new PyTuple(new PyObject[] {frame.getname("IN"), new PyList(new PyObject[] {new PyTuple(new PyObject[] {frame.getname("CATEGORY"), frame.getname("CATEGORY_NOT_DIGIT")})})}), s$26, new PyTuple(new PyObject[] {frame.getname("IN"), new PyList(new PyObject[] {new PyTuple(new PyObject[] {frame.getname("CATEGORY"), frame.getname("CATEGORY_SPACE")})})}), s$27, new PyTuple(new PyObject[] {frame.getname("IN"), new PyList(new PyObject[] {new PyTuple(new PyObject[] {frame.getname("CATEGORY"), frame.getname("CATEGORY_NOT_SPACE")})})}), s$28, new PyTuple(new PyObject[] {frame.getname("IN"), new PyList(new PyObject[] {new PyTuple(new PyObject[] {frame.getname("CATEGORY"), frame.getname("CATEGORY_WORD")})})}), s$29, new PyTuple(new PyObject[] {frame.getname("IN"), new PyList(new PyObject[] {new PyTuple(new PyObject[] {frame.getname("CATEGORY"), frame.getname("CATEGORY_NOT_WORD")})})}), s$30, new PyTuple(new PyObject[] {frame.getname("AT"), frame.getname("AT_END_STRING")})}));
- frame.setlocal("FLAGS", new PyDictionary(new PyObject[] {s$31, frame.getname("SRE_FLAG_IGNORECASE"), s$32, frame.getname("SRE_FLAG_LOCALE"), s$33, frame.getname("SRE_FLAG_MULTILINE"), s$34, frame.getname("SRE_FLAG_DOTALL"), s$35, frame.getname("SRE_FLAG_VERBOSE"), s$36, frame.getname("SRE_FLAG_TEMPLATE"), s$37, frame.getname("SRE_FLAG_UNICODE")}));
- try {
- frame.getname("int").__call__(s$38, i$39);
- frame.setlocal("atoi", frame.getname("int"));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getname("TypeError"))) {
- frame.setlocal("atoi", frame.getname("string").__getattr__("atoi"));
- }
- else throw t$0$PyException;
- }
- frame.setlocal("Pattern", Py.makeClass("Pattern", new PyObject[] {}, c$4_Pattern, null));
- frame.setlocal("SubPattern", Py.makeClass("SubPattern", new PyObject[] {}, c$16_SubPattern, null));
- frame.setlocal("Tokenizer", Py.makeClass("Tokenizer", new PyObject[] {}, c$23_Tokenizer, null));
- frame.setlocal("isident", new PyFunction(frame.f_globals, new PyObject[] {}, c$24_isident));
- frame.setlocal("isdigit", new PyFunction(frame.f_globals, new PyObject[] {}, c$25_isdigit));
- frame.setlocal("isname", new PyFunction(frame.f_globals, new PyObject[] {}, c$26_isname));
- frame.setlocal("_group", new PyFunction(frame.f_globals, new PyObject[] {}, c$27__group));
- frame.setlocal("_class_escape", new PyFunction(frame.f_globals, new PyObject[] {}, c$28__class_escape));
- frame.setlocal("_escape", new PyFunction(frame.f_globals, new PyObject[] {}, c$29__escape));
- frame.setlocal("_parse_sub", new PyFunction(frame.f_globals, new PyObject[] {i$41}, c$30__parse_sub));
- frame.setlocal("_parse", new PyFunction(frame.f_globals, new PyObject[] {}, c$31__parse));
- frame.setlocal("parse", new PyFunction(frame.f_globals, new PyObject[] {i$40, frame.getname("None")}, c$32_parse));
- frame.setlocal("parse_template", new PyFunction(frame.f_globals, new PyObject[] {}, c$34_parse_template));
- frame.setlocal("expand_template", new PyFunction(frame.f_globals, new PyObject[] {}, c$35_expand_template));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("sre_parse"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "sre_parse";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(sre_parse._PyInner.class, newargs, sre_parse.jpy$packages, sre_parse.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class stat extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject i$1;
- private static PyObject i$2;
- private static PyObject i$3;
- private static PyObject i$4;
- private static PyObject i$5;
- private static PyObject i$6;
- private static PyObject i$7;
- private static PyObject i$8;
- private static PyObject i$9;
- private static PyObject i$10;
- private static PyObject i$11;
- private static PyObject i$12;
- private static PyObject i$13;
- private static PyObject i$14;
- private static PyObject i$15;
- private static PyObject i$16;
- private static PyObject i$17;
- private static PyObject i$18;
- private static PyObject i$19;
- private static PyObject i$20;
- private static PyObject i$21;
- private static PyObject i$22;
- private static PyObject i$23;
- private static PyObject i$24;
- private static PyObject i$25;
- private static PyObject i$26;
- private static PyObject i$27;
- private static PyObject i$28;
- private static PyObject i$29;
- private static PyObject s$30;
- private static PyFunctionTable funcTable;
- private static PyCode c$0_S_IMODE;
- private static PyCode c$1_S_IFMT;
- private static PyCode c$2_S_ISDIR;
- private static PyCode c$3_S_ISCHR;
- private static PyCode c$4_S_ISBLK;
- private static PyCode c$5_S_ISREG;
- private static PyCode c$6_S_ISFIFO;
- private static PyCode c$7_S_ISLNK;
- private static PyCode c$8_S_ISSOCK;
- private static PyCode c$9_main;
- private static void initConstants() {
- s$0 = Py.newString("Constants/functions for interpreting results of os.stat() and os.lstat().\012\012Suggested usage: from stat import *\012");
- i$1 = Py.newInteger(0);
- i$2 = Py.newInteger(1);
- i$3 = Py.newInteger(2);
- i$4 = Py.newInteger(3);
- i$5 = Py.newInteger(4);
- i$6 = Py.newInteger(5);
- i$7 = Py.newInteger(6);
- i$8 = Py.newInteger(7);
- i$9 = Py.newInteger(8);
- i$10 = Py.newInteger(9);
- i$11 = Py.newInteger(4095);
- i$12 = Py.newInteger(61440);
- i$13 = Py.newInteger(16384);
- i$14 = Py.newInteger(8192);
- i$15 = Py.newInteger(24576);
- i$16 = Py.newInteger(32768);
- i$17 = Py.newInteger(4096);
- i$18 = Py.newInteger(40960);
- i$19 = Py.newInteger(49152);
- i$20 = Py.newInteger(2048);
- i$21 = Py.newInteger(1024);
- i$22 = Py.newInteger(512);
- i$23 = Py.newInteger(256);
- i$24 = Py.newInteger(128);
- i$25 = Py.newInteger(64);
- i$26 = Py.newInteger(448);
- i$27 = Py.newInteger(56);
- i$28 = Py.newInteger(32);
- i$29 = Py.newInteger(16);
- s$30 = Py.newString("/usr/share/jython/Lib-cpython/stat.py");
- funcTable = new _PyInner();
- c$0_S_IMODE = Py.newCode(1, new String[] {"mode"}, "/usr/share/jython/Lib-cpython/stat.py", "S_IMODE", false, false, funcTable, 0, null, null, 0, 1);
- c$1_S_IFMT = Py.newCode(1, new String[] {"mode"}, "/usr/share/jython/Lib-cpython/stat.py", "S_IFMT", false, false, funcTable, 1, null, null, 0, 1);
- c$2_S_ISDIR = Py.newCode(1, new String[] {"mode"}, "/usr/share/jython/Lib-cpython/stat.py", "S_ISDIR", false, false, funcTable, 2, null, null, 0, 1);
- c$3_S_ISCHR = Py.newCode(1, new String[] {"mode"}, "/usr/share/jython/Lib-cpython/stat.py", "S_ISCHR", false, false, funcTable, 3, null, null, 0, 1);
- c$4_S_ISBLK = Py.newCode(1, new String[] {"mode"}, "/usr/share/jython/Lib-cpython/stat.py", "S_ISBLK", false, false, funcTable, 4, null, null, 0, 1);
- c$5_S_ISREG = Py.newCode(1, new String[] {"mode"}, "/usr/share/jython/Lib-cpython/stat.py", "S_ISREG", false, false, funcTable, 5, null, null, 0, 1);
- c$6_S_ISFIFO = Py.newCode(1, new String[] {"mode"}, "/usr/share/jython/Lib-cpython/stat.py", "S_ISFIFO", false, false, funcTable, 6, null, null, 0, 1);
- c$7_S_ISLNK = Py.newCode(1, new String[] {"mode"}, "/usr/share/jython/Lib-cpython/stat.py", "S_ISLNK", false, false, funcTable, 7, null, null, 0, 1);
- c$8_S_ISSOCK = Py.newCode(1, new String[] {"mode"}, "/usr/share/jython/Lib-cpython/stat.py", "S_ISSOCK", false, false, funcTable, 8, null, null, 0, 1);
- c$9_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/stat.py", "main", false, false, funcTable, 9, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$9_main == null) _PyInner.initConstants();
- return c$9_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.S_IMODE$1(frame);
- case 1:
- return _PyInner.S_IFMT$2(frame);
- case 2:
- return _PyInner.S_ISDIR$3(frame);
- case 3:
- return _PyInner.S_ISCHR$4(frame);
- case 4:
- return _PyInner.S_ISBLK$5(frame);
- case 5:
- return _PyInner.S_ISREG$6(frame);
- case 6:
- return _PyInner.S_ISFIFO$7(frame);
- case 7:
- return _PyInner.S_ISLNK$8(frame);
- case 8:
- return _PyInner.S_ISSOCK$9(frame);
- case 9:
- return _PyInner.main$10(frame);
- default:
- return null;
- }
- }
-
- private static PyObject S_IMODE$1(PyFrame frame) {
- return frame.getlocal(0)._and(i$11);
- }
-
- private static PyObject S_IFMT$2(PyFrame frame) {
- return frame.getlocal(0)._and(i$12);
- }
-
- private static PyObject S_ISDIR$3(PyFrame frame) {
- return frame.getglobal("S_IFMT").__call__(frame.getlocal(0))._eq(frame.getglobal("S_IFDIR"));
- }
-
- private static PyObject S_ISCHR$4(PyFrame frame) {
- return frame.getglobal("S_IFMT").__call__(frame.getlocal(0))._eq(frame.getglobal("S_IFCHR"));
- }
-
- private static PyObject S_ISBLK$5(PyFrame frame) {
- return frame.getglobal("S_IFMT").__call__(frame.getlocal(0))._eq(frame.getglobal("S_IFBLK"));
- }
-
- private static PyObject S_ISREG$6(PyFrame frame) {
- return frame.getglobal("S_IFMT").__call__(frame.getlocal(0))._eq(frame.getglobal("S_IFREG"));
- }
-
- private static PyObject S_ISFIFO$7(PyFrame frame) {
- return frame.getglobal("S_IFMT").__call__(frame.getlocal(0))._eq(frame.getglobal("S_IFIFO"));
- }
-
- private static PyObject S_ISLNK$8(PyFrame frame) {
- return frame.getglobal("S_IFMT").__call__(frame.getlocal(0))._eq(frame.getglobal("S_IFLNK"));
- }
-
- private static PyObject S_ISSOCK$9(PyFrame frame) {
- return frame.getglobal("S_IFMT").__call__(frame.getlocal(0))._eq(frame.getglobal("S_IFSOCK"));
- }
-
- private static PyObject main$10(PyFrame frame) {
- frame.setglobal("__file__", s$30);
-
- /* Constants/functions for interpreting results of os.stat() and os.lstat().
-
- Suggested usage: from stat import *
- */
- frame.setlocal("ST_MODE", i$1);
- frame.setlocal("ST_INO", i$2);
- frame.setlocal("ST_DEV", i$3);
- frame.setlocal("ST_NLINK", i$4);
- frame.setlocal("ST_UID", i$5);
- frame.setlocal("ST_GID", i$6);
- frame.setlocal("ST_SIZE", i$7);
- frame.setlocal("ST_ATIME", i$8);
- frame.setlocal("ST_MTIME", i$9);
- frame.setlocal("ST_CTIME", i$10);
- frame.setlocal("S_IMODE", new PyFunction(frame.f_globals, new PyObject[] {}, c$0_S_IMODE));
- frame.setlocal("S_IFMT", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_S_IFMT));
- frame.setlocal("S_IFDIR", i$13);
- frame.setlocal("S_IFCHR", i$14);
- frame.setlocal("S_IFBLK", i$15);
- frame.setlocal("S_IFREG", i$16);
- frame.setlocal("S_IFIFO", i$17);
- frame.setlocal("S_IFLNK", i$18);
- frame.setlocal("S_IFSOCK", i$19);
- frame.setlocal("S_ISDIR", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_S_ISDIR));
- frame.setlocal("S_ISCHR", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_S_ISCHR));
- frame.setlocal("S_ISBLK", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_S_ISBLK));
- frame.setlocal("S_ISREG", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_S_ISREG));
- frame.setlocal("S_ISFIFO", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_S_ISFIFO));
- frame.setlocal("S_ISLNK", new PyFunction(frame.f_globals, new PyObject[] {}, c$7_S_ISLNK));
- frame.setlocal("S_ISSOCK", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_S_ISSOCK));
- frame.setlocal("S_ISUID", i$20);
- frame.setlocal("S_ISGID", i$21);
- frame.setlocal("S_ENFMT", frame.getname("S_ISGID"));
- frame.setlocal("S_ISVTX", i$22);
- frame.setlocal("S_IREAD", i$23);
- frame.setlocal("S_IWRITE", i$24);
- frame.setlocal("S_IEXEC", i$25);
- frame.setlocal("S_IRWXU", i$26);
- frame.setlocal("S_IRUSR", i$23);
- frame.setlocal("S_IWUSR", i$24);
- frame.setlocal("S_IXUSR", i$25);
- frame.setlocal("S_IRWXG", i$27);
- frame.setlocal("S_IRGRP", i$28);
- frame.setlocal("S_IWGRP", i$29);
- frame.setlocal("S_IXGRP", i$9);
- frame.setlocal("S_IRWXO", i$8);
- frame.setlocal("S_IROTH", i$5);
- frame.setlocal("S_IWOTH", i$3);
- frame.setlocal("S_IXOTH", i$2);
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("stat"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "stat";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(stat._PyInner.class, newargs, stat.jpy$packages, stat.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class string extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject i$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject s$16;
- private static PyObject i$17;
- private static PyObject s$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyObject s$24;
- private static PyObject s$25;
- private static PyObject s$26;
- private static PyObject s$27;
- private static PyObject i$28;
- private static PyObject s$29;
- private static PyObject s$30;
- private static PyObject s$31;
- private static PyObject s$32;
- private static PyObject s$33;
- private static PyObject i$34;
- private static PyObject s$35;
- private static PyObject s$36;
- private static PyObject s$37;
- private static PyObject s$38;
- private static PyObject s$39;
- private static PyObject s$40;
- private static PyObject s$41;
- private static PyObject i$42;
- private static PyObject s$43;
- private static PyObject s$44;
- private static PyObject s$45;
- private static PyObject s$46;
- private static PyObject s$47;
- private static PyObject s$48;
- private static PyObject s$49;
- private static PyFunctionTable funcTable;
- private static PyCode c$0_lower;
- private static PyCode c$1_upper;
- private static PyCode c$2_swapcase;
- private static PyCode c$3_strip;
- private static PyCode c$4_lstrip;
- private static PyCode c$5_rstrip;
- private static PyCode c$6_split;
- private static PyCode c$7_join;
- private static PyCode c$8_index;
- private static PyCode c$9_rindex;
- private static PyCode c$10_count;
- private static PyCode c$11_find;
- private static PyCode c$12_rfind;
- private static PyCode c$13_atof;
- private static PyCode c$14_atoi;
- private static PyCode c$15_atol;
- private static PyCode c$16_ljust;
- private static PyCode c$17_rjust;
- private static PyCode c$18_center;
- private static PyCode c$19_zfill;
- private static PyCode c$20_expandtabs;
- private static PyCode c$21_translate;
- private static PyCode c$22_capitalize;
- private static PyCode c$23_capwords;
- private static PyCode c$24_maketrans;
- private static PyCode c$25_replace;
- private static PyCode c$26_main;
- private static void initConstants() {
- s$0 = Py.newString("Common string manipulations.\012\012Public module variables:\012\012whitespace -- a string containing all characters considered whitespace\012lowercase -- a string containing all characters considered lowercase letters\012uppercase -- a string containing all characters considered uppercase letters\012letters -- a string containing all characters considered letters\012digits -- a string containing all characters considered decimal digits\012hexdigits -- a string containing all characters considered hexadecimal digits\012octdigits -- a string containing all characters considered octal digits\012\012");
- s$1 = Py.newString(" \011\012\015\013\014");
- s$2 = Py.newString("abcdefghijklmnopqrstuvwxyz");
- s$3 = Py.newString("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- s$4 = Py.newString("0123456789");
- s$5 = Py.newString("abcdef");
- s$6 = Py.newString("ABCDEF");
- s$7 = Py.newString("01234567");
- s$8 = Py.newString("");
- i$9 = Py.newInteger(256);
- s$10 = Py.newString("lower(s) -> string\012\012 Return a copy of the string s converted to lowercase.\012\012 ");
- s$11 = Py.newString("upper(s) -> string\012\012 Return a copy of the string s converted to uppercase.\012\012 ");
- s$12 = Py.newString("swapcase(s) -> string\012\012 Return a copy of the string s with upper case characters\012 converted to lowercase and vice versa.\012\012 ");
- s$13 = Py.newString("strip(s) -> string\012\012 Return a copy of the string s with leading and trailing\012 whitespace removed.\012\012 ");
- s$14 = Py.newString("lstrip(s) -> string\012\012 Return a copy of the string s with leading whitespace removed.\012\012 ");
- s$15 = Py.newString("rstrip(s) -> string\012\012 Return a copy of the string s with trailing whitespace\012 removed.\012\012 ");
- s$16 = Py.newString("split(str [,sep [,maxsplit]]) -> list of strings\012\012 Return a list of the words in the string s, using sep as the\012 delimiter string. If maxsplit is nonzero, splits into at most\012 maxsplit words If sep is not specified, any whitespace string\012 is a separator. Maxsplit defaults to -1.\012\012 (split and splitfields are synonymous)\012\012 ");
- i$17 = Py.newInteger(1);
- s$18 = Py.newString("join(list [,sep]) -> string\012\012 Return a string composed of the words in list, with\012 intervening occurences of sep. The default separator is a\012 single space.\012\012 (joinfields and join are synonymous)\012\012 ");
- s$19 = Py.newString(" ");
- s$20 = Py.newString("index(s, sub [,start [,end]]) -> int\012\012 Like find but raises ValueError when the substring is not found.\012\012 ");
- s$21 = Py.newString("rindex(s, sub [,start [,end]]) -> int\012\012 Like rfind but raises ValueError when the substring is not found.\012\012 ");
- s$22 = Py.newString("count(s, sub[, start[,end]]) -> int\012\012 Return the number of occurrences of substring sub in string\012 s[start:end]. Optional arguments start and end are\012 interpreted as in slice notation.\012\012 ");
- s$23 = Py.newString("find(s, sub [,start [,end]]) -> in\012\012 Return the lowest index in s where substring sub is found,\012 such that sub is contained within s[start,end]. Optional\012 arguments start and end are interpreted as in slice notation.\012\012 Return -1 on failure.\012\012 ");
- s$24 = Py.newString("rfind(s, sub [,start [,end]]) -> int\012\012 Return the highest index in s where substring sub is found,\012 such that sub is contained within s[start,end]. Optional\012 arguments start and end are interpreted as in slice notation.\012\012 Return -1 on failure.\012\012 ");
- s$25 = Py.newString("atof(s) -> float\012\012 Return the floating point number represented by the string s.\012\012 ");
- s$26 = Py.newString("argument 1: expected string, %s found");
- s$27 = Py.newString("atoi(s [,base]) -> int\012\012 Return the integer represented by the string s in the given\012 base, which defaults to 10. The string s must consist of one\012 or more digits, possibly preceded by a sign. If base is 0, it\012 is chosen from the leading characters of s, 0 for octal, 0x or\012 0X for hexadecimal. If base is 16, a preceding 0x or 0X is\012 accepted.\012\012 ");
- i$28 = Py.newInteger(0);
- s$29 = Py.newString("function requires at least 1 argument: %d given");
- s$30 = Py.newString("atol(s [,base]) -> long\012\012 Return the long integer represented by the string s in the\012 given base, which defaults to 10. The string s must consist\012 of one or more digits, possibly preceded by a sign. If base\012 is 0, it is chosen from the leading characters of s, 0 for\012 octal, 0x or 0X for hexadecimal. If base is 16, a preceding\012 0x or 0X is accepted. A trailing L or l is not accepted,\012 unless base is 0.\012\012 ");
- s$31 = Py.newString("ljust(s, width) -> string\012\012 Return a left-justified version of s, in a field of the\012 specified width, padded with spaces as needed. The string is\012 never truncated.\012\012 ");
- s$32 = Py.newString("rjust(s, width) -> string\012\012 Return a right-justified version of s, in a field of the\012 specified width, padded with spaces as needed. The string is\012 never truncated.\012\012 ");
- s$33 = Py.newString("center(s, width) -> string\012\012 Return a center version of s, in a field of the specified\012 width. padded with spaces as needed. The string is never\012 truncated.\012\012 ");
- i$34 = Py.newInteger(2);
- s$35 = Py.newString("zfill(x, width) -> string\012\012 Pad a numeric string x with zeros on the left, to fill a field\012 of the specified width. The string x is never truncated.\012\012 ");
- s$36 = Py.newString("-");
- s$37 = Py.newString("+");
- s$38 = Py.newString("0");
- s$39 = Py.newString("expandtabs(s [,tabsize]) -> string\012\012 Return a copy of the string s with all tab characters replaced\012 by the appropriate number of spaces, depending on the current\012 column, and the tabsize (default 8).\012\012 ");
- s$40 = Py.newString("\011");
- s$41 = Py.newString("\012");
- i$42 = Py.newInteger(8);
- s$43 = Py.newString("translate(s,table [,deletechars]) -> string\012\012 Return a copy of the string s, where all characters occurring\012 in the optional argument deletechars are removed, and the\012 remaining characters have been mapped through the given\012 translation table, which must be a string of length 256.\012\012 ");
- s$44 = Py.newString("capitalize(s) -> string\012\012 Return a copy of the string s with only its first character\012 capitalized.\012\012 ");
- s$45 = Py.newString("capwords(s, [sep]) -> string\012\012 Split the argument into words using split, capitalize each\012 word using capitalize, and join the capitalized words using\012 join. Note that this replaces runs of whitespace characters by\012 a single space.\012\012 ");
- s$46 = Py.newString("maketrans(frm, to) -> string\012\012 Return a translation table (a string of 256 bytes long)\012 suitable for use in string.translate. The strings frm and to\012 must be of the same length.\012\012 ");
- s$47 = Py.newString("maketrans arguments must have same length");
- s$48 = Py.newString("replace (str, old, new[, maxsplit]) -> string\012\012 Return a copy of string str with all occurrences of substring\012 old replaced by new. If the optional argument maxsplit is\012 given, only the first maxsplit occurrences are replaced.\012\012 ");
- s$49 = Py.newString("/usr/share/jython/Lib/string.py");
- funcTable = new _PyInner();
- c$0_lower = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "lower", false, false, funcTable, 0, null, null, 0, 1);
- c$1_upper = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "upper", false, false, funcTable, 1, null, null, 0, 1);
- c$2_swapcase = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "swapcase", false, false, funcTable, 2, null, null, 0, 1);
- c$3_strip = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "strip", false, false, funcTable, 3, null, null, 0, 1);
- c$4_lstrip = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "lstrip", false, false, funcTable, 4, null, null, 0, 1);
- c$5_rstrip = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "rstrip", false, false, funcTable, 5, null, null, 0, 1);
- c$6_split = Py.newCode(3, new String[] {"s", "sep", "maxsplit"}, "/usr/share/jython/Lib/string.py", "split", false, false, funcTable, 6, null, null, 0, 1);
- c$7_join = Py.newCode(2, new String[] {"words", "sep"}, "/usr/share/jython/Lib/string.py", "join", false, false, funcTable, 7, null, null, 0, 1);
- c$8_index = Py.newCode(2, new String[] {"s", "args"}, "/usr/share/jython/Lib/string.py", "index", true, false, funcTable, 8, null, null, 0, 1);
- c$9_rindex = Py.newCode(2, new String[] {"s", "args"}, "/usr/share/jython/Lib/string.py", "rindex", true, false, funcTable, 9, null, null, 0, 1);
- c$10_count = Py.newCode(2, new String[] {"s", "args"}, "/usr/share/jython/Lib/string.py", "count", true, false, funcTable, 10, null, null, 0, 1);
- c$11_find = Py.newCode(2, new String[] {"s", "args"}, "/usr/share/jython/Lib/string.py", "find", true, false, funcTable, 11, null, null, 0, 1);
- c$12_rfind = Py.newCode(2, new String[] {"s", "args"}, "/usr/share/jython/Lib/string.py", "rfind", true, false, funcTable, 12, null, null, 0, 1);
- c$13_atof = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "atof", false, false, funcTable, 13, null, null, 0, 1);
- c$14_atoi = Py.newCode(1, new String[] {"args", "s"}, "/usr/share/jython/Lib/string.py", "atoi", true, false, funcTable, 14, null, null, 0, 1);
- c$15_atol = Py.newCode(1, new String[] {"args", "s"}, "/usr/share/jython/Lib/string.py", "atol", true, false, funcTable, 15, null, null, 0, 1);
- c$16_ljust = Py.newCode(2, new String[] {"s", "width", "n"}, "/usr/share/jython/Lib/string.py", "ljust", false, false, funcTable, 16, null, null, 0, 1);
- c$17_rjust = Py.newCode(2, new String[] {"s", "width", "n"}, "/usr/share/jython/Lib/string.py", "rjust", false, false, funcTable, 17, null, null, 0, 1);
- c$18_center = Py.newCode(2, new String[] {"s", "width", "half", "n"}, "/usr/share/jython/Lib/string.py", "center", false, false, funcTable, 18, null, null, 0, 1);
- c$19_zfill = Py.newCode(2, new String[] {"x", "width", "sign", "s", "n"}, "/usr/share/jython/Lib/string.py", "zfill", false, false, funcTable, 19, null, null, 0, 1);
- c$20_expandtabs = Py.newCode(2, new String[] {"s", "tabsize", "line", "res", "c"}, "/usr/share/jython/Lib/string.py", "expandtabs", false, false, funcTable, 20, null, null, 0, 1);
- c$21_translate = Py.newCode(3, new String[] {"s", "table", "deletions"}, "/usr/share/jython/Lib/string.py", "translate", false, false, funcTable, 21, null, null, 0, 1);
- c$22_capitalize = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "capitalize", false, false, funcTable, 22, null, null, 0, 1);
- c$23_capwords = Py.newCode(2, new String[] {"s", "sep"}, "/usr/share/jython/Lib/string.py", "capwords", false, false, funcTable, 23, null, null, 0, 1);
- c$24_maketrans = Py.newCode(2, new String[] {"fromstr", "tostr", "i", "L"}, "/usr/share/jython/Lib/string.py", "maketrans", false, false, funcTable, 24, null, null, 0, 1);
- c$25_replace = Py.newCode(4, new String[] {"s", "old", "new", "maxsplit"}, "/usr/share/jython/Lib/string.py", "replace", false, false, funcTable, 25, null, null, 0, 1);
- c$26_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/string.py", "main", false, false, funcTable, 26, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$26_main == null) _PyInner.initConstants();
- return c$26_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.lower$1(frame);
- case 1:
- return _PyInner.upper$2(frame);
- case 2:
- return _PyInner.swapcase$3(frame);
- case 3:
- return _PyInner.strip$4(frame);
- case 4:
- return _PyInner.lstrip$5(frame);
- case 5:
- return _PyInner.rstrip$6(frame);
- case 6:
- return _PyInner.split$7(frame);
- case 7:
- return _PyInner.join$8(frame);
- case 8:
- return _PyInner.index$9(frame);
- case 9:
- return _PyInner.rindex$10(frame);
- case 10:
- return _PyInner.count$11(frame);
- case 11:
- return _PyInner.find$12(frame);
- case 12:
- return _PyInner.rfind$13(frame);
- case 13:
- return _PyInner.atof$14(frame);
- case 14:
- return _PyInner.atoi$15(frame);
- case 15:
- return _PyInner.atol$16(frame);
- case 16:
- return _PyInner.ljust$17(frame);
- case 17:
- return _PyInner.rjust$18(frame);
- case 18:
- return _PyInner.center$19(frame);
- case 19:
- return _PyInner.zfill$20(frame);
- case 20:
- return _PyInner.expandtabs$21(frame);
- case 21:
- return _PyInner.translate$22(frame);
- case 22:
- return _PyInner.capitalize$23(frame);
- case 23:
- return _PyInner.capwords$24(frame);
- case 24:
- return _PyInner.maketrans$25(frame);
- case 25:
- return _PyInner.replace$26(frame);
- case 26:
- return _PyInner.main$27(frame);
- default:
- return null;
- }
- }
-
- private static PyObject lower$1(PyFrame frame) {
- /* lower(s) -> string
-
- Return a copy of the string s converted to lowercase.
-
- */
- return frame.getlocal(0).invoke("lower");
- }
-
- private static PyObject upper$2(PyFrame frame) {
- /* upper(s) -> string
-
- Return a copy of the string s converted to uppercase.
-
- */
- return frame.getlocal(0).invoke("upper");
- }
-
- private static PyObject swapcase$3(PyFrame frame) {
- /* swapcase(s) -> string
-
- Return a copy of the string s with upper case characters
- converted to lowercase and vice versa.
-
- */
- return frame.getlocal(0).invoke("swapcase");
- }
-
- private static PyObject strip$4(PyFrame frame) {
- /* strip(s) -> string
-
- Return a copy of the string s with leading and trailing
- whitespace removed.
-
- */
- return frame.getlocal(0).invoke("strip");
- }
-
- private static PyObject lstrip$5(PyFrame frame) {
- /* lstrip(s) -> string
-
- Return a copy of the string s with leading whitespace removed.
-
- */
- return frame.getlocal(0).invoke("lstrip");
- }
-
- private static PyObject rstrip$6(PyFrame frame) {
- /* rstrip(s) -> string
-
- Return a copy of the string s with trailing whitespace
- removed.
-
- */
- return frame.getlocal(0).invoke("rstrip");
- }
-
- private static PyObject split$7(PyFrame frame) {
- /* split(str [,sep [,maxsplit]]) -> list of strings
-
- Return a list of the words in the string s, using sep as the
- delimiter string. If maxsplit is nonzero, splits into at most
- maxsplit words If sep is not specified, any whitespace string
- is a separator. Maxsplit defaults to -1.
-
- (split and splitfields are synonymous)
-
- */
- return frame.getlocal(0).invoke("split", frame.getlocal(1), frame.getlocal(2));
- }
-
- private static PyObject join$8(PyFrame frame) {
- /* join(list [,sep]) -> string
-
- Return a string composed of the words in list, with
- intervening occurences of sep. The default separator is a
- single space.
-
- (joinfields and join are synonymous)
-
- */
- return frame.getlocal(1).invoke("join", frame.getlocal(0));
- }
-
- private static PyObject index$9(PyFrame frame) {
- /* index(s, sub [,start [,end]]) -> int
-
- Like find but raises ValueError when the substring is not found.
-
- */
- return frame.getglobal("_apply").__call__(frame.getlocal(0).__getattr__("index"), frame.getlocal(1));
- }
-
- private static PyObject rindex$10(PyFrame frame) {
- /* rindex(s, sub [,start [,end]]) -> int
-
- Like rfind but raises ValueError when the substring is not found.
-
- */
- return frame.getglobal("_apply").__call__(frame.getlocal(0).__getattr__("rindex"), frame.getlocal(1));
- }
-
- private static PyObject count$11(PyFrame frame) {
- /* count(s, sub[, start[,end]]) -> int
-
- Return the number of occurrences of substring sub in string
- s[start:end]. Optional arguments start and end are
- interpreted as in slice notation.
-
- */
- return frame.getglobal("_apply").__call__(frame.getlocal(0).__getattr__("count"), frame.getlocal(1));
- }
-
- private static PyObject find$12(PyFrame frame) {
- /* find(s, sub [,start [,end]]) -> in
-
- Return the lowest index in s where substring sub is found,
- such that sub is contained within s[start,end]. Optional
- arguments start and end are interpreted as in slice notation.
-
- Return -1 on failure.
-
- */
- return frame.getglobal("_apply").__call__(frame.getlocal(0).__getattr__("find"), frame.getlocal(1));
- }
-
- private static PyObject rfind$13(PyFrame frame) {
- /* rfind(s, sub [,start [,end]]) -> int
-
- Return the highest index in s where substring sub is found,
- such that sub is contained within s[start,end]. Optional
- arguments start and end are interpreted as in slice notation.
-
- Return -1 on failure.
-
- */
- return frame.getglobal("_apply").__call__(frame.getlocal(0).__getattr__("rfind"), frame.getlocal(1));
- }
-
- private static PyObject atof$14(PyFrame frame) {
- /* atof(s) -> float
-
- Return the floating point number represented by the string s.
-
- */
- if (frame.getglobal("type").__call__(frame.getlocal(0))._eq(frame.getglobal("_StringType")).__nonzero__()) {
- return frame.getglobal("_float").__call__(frame.getlocal(0));
- }
- else {
- throw Py.makeException(frame.getglobal("TypeError").__call__(s$26._mod(frame.getglobal("type").__call__(frame.getlocal(0)).__getattr__("__name__"))));
- }
- }
-
- private static PyObject atoi$15(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- /* atoi(s [,base]) -> int
-
- Return the integer represented by the string s in the given
- base, which defaults to 10. The string s must consist of one
- or more digits, possibly preceded by a sign. If base is 0, it
- is chosen from the leading characters of s, 0 for octal, 0x or
- 0X for hexadecimal. If base is 16, a preceding 0x or 0X is
- accepted.
-
- */
- try {
- frame.setlocal(1, frame.getlocal(0).__getitem__(i$28));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("IndexError"))) {
- throw Py.makeException(frame.getglobal("TypeError").__call__(s$29._mod(frame.getglobal("len").__call__(frame.getlocal(0)))));
- }
- else throw t$0$PyException;
- }
- if (frame.getglobal("type").__call__(frame.getlocal(1))._eq(frame.getglobal("_StringType")).__nonzero__()) {
- return frame.getglobal("_apply").__call__(frame.getglobal("_int"), frame.getlocal(0));
- }
- else {
- throw Py.makeException(frame.getglobal("TypeError").__call__(s$26._mod(frame.getglobal("type").__call__(frame.getlocal(1)).__getattr__("__name__"))));
- }
- }
-
- private static PyObject atol$16(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- /* atol(s [,base]) -> long
-
- Return the long integer represented by the string s in the
- given base, which defaults to 10. The string s must consist
- of one or more digits, possibly preceded by a sign. If base
- is 0, it is chosen from the leading characters of s, 0 for
- octal, 0x or 0X for hexadecimal. If base is 16, a preceding
- 0x or 0X is accepted. A trailing L or l is not accepted,
- unless base is 0.
-
- */
- try {
- frame.setlocal(1, frame.getlocal(0).__getitem__(i$28));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("IndexError"))) {
- throw Py.makeException(frame.getglobal("TypeError").__call__(s$29._mod(frame.getglobal("len").__call__(frame.getlocal(0)))));
- }
- else throw t$0$PyException;
- }
- if (frame.getglobal("type").__call__(frame.getlocal(1))._eq(frame.getglobal("_StringType")).__nonzero__()) {
- return frame.getglobal("_apply").__call__(frame.getglobal("_long"), frame.getlocal(0));
- }
- else {
- throw Py.makeException(frame.getglobal("TypeError").__call__(s$26._mod(frame.getglobal("type").__call__(frame.getlocal(1)).__getattr__("__name__"))));
- }
- }
-
- private static PyObject ljust$17(PyFrame frame) {
- /* ljust(s, width) -> string
-
- Return a left-justified version of s, in a field of the
- specified width, padded with spaces as needed. The string is
- never truncated.
-
- */
- frame.setlocal(2, frame.getlocal(1)._sub(frame.getglobal("len").__call__(frame.getlocal(0))));
- if (frame.getlocal(2)._le(i$28).__nonzero__()) {
- return frame.getlocal(0);
- }
- return frame.getlocal(0)._add(s$19._mul(frame.getlocal(2)));
- }
-
- private static PyObject rjust$18(PyFrame frame) {
- /* rjust(s, width) -> string
-
- Return a right-justified version of s, in a field of the
- specified width, padded with spaces as needed. The string is
- never truncated.
-
- */
- frame.setlocal(2, frame.getlocal(1)._sub(frame.getglobal("len").__call__(frame.getlocal(0))));
- if (frame.getlocal(2)._le(i$28).__nonzero__()) {
- return frame.getlocal(0);
- }
- return s$19._mul(frame.getlocal(2))._add(frame.getlocal(0));
- }
-
- private static PyObject center$19(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- /* center(s, width) -> string
-
- Return a center version of s, in a field of the specified
- width. padded with spaces as needed. The string is never
- truncated.
-
- */
- frame.setlocal(3, frame.getlocal(1)._sub(frame.getglobal("len").__call__(frame.getlocal(0))));
- if (frame.getlocal(3)._le(i$28).__nonzero__()) {
- return frame.getlocal(0);
- }
- frame.setlocal(2, frame.getlocal(3)._div(i$34));
- if (((t$0$PyObject = frame.getlocal(3)._mod(i$34)).__nonzero__() ? frame.getlocal(1)._mod(i$34) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(2, frame.getlocal(2)._add(i$17));
- }
- return s$19._mul(frame.getlocal(2))._add(frame.getlocal(0))._add(s$19._mul(frame.getlocal(3)._sub(frame.getlocal(2))));
- }
-
- private static PyObject zfill$20(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- /* zfill(x, width) -> string
-
- Pad a numeric string x with zeros on the left, to fill a field
- of the specified width. The string x is never truncated.
-
- */
- if (frame.getglobal("type").__call__(frame.getlocal(0))._eq(frame.getglobal("type").__call__(s$8)).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(0));
- }
- else {
- frame.setlocal(3, frame.getlocal(0).__repr__());
- }
- frame.setlocal(4, frame.getglobal("len").__call__(frame.getlocal(3)));
- if (frame.getlocal(4)._ge(frame.getlocal(1)).__nonzero__()) {
- return frame.getlocal(3);
- }
- frame.setlocal(2, s$8);
- if (frame.getlocal(3).__getitem__(i$28)._in(new PyTuple(new PyObject[] {s$36, s$37})).__nonzero__()) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(new PyTuple(new PyObject[] {frame.getlocal(3).__getitem__(i$28), frame.getlocal(3).__getslice__(i$17, null, null)}), 2);
- frame.setlocal(2, t$0$PyObject__[0]);
- frame.setlocal(3, t$0$PyObject__[1]);
- }
- return frame.getlocal(2)._add(s$38._mul(frame.getlocal(1)._sub(frame.getlocal(4))))._add(frame.getlocal(3));
- }
-
- private static PyObject expandtabs$21(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* expandtabs(s [,tabsize]) -> string
-
- Return a copy of the string s with all tab characters replaced
- by the appropriate number of spaces, depending on the current
- column, and the tabsize (default 8).
-
- */
- t$0$PyObject = s$8;
- frame.setlocal(3, t$0$PyObject);
- frame.setlocal(2, t$0$PyObject);
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(4, t$0$PyObject);
- if (frame.getlocal(4)._eq(s$40).__nonzero__()) {
- frame.setlocal(4, s$19._mul(frame.getlocal(1)._sub(frame.getglobal("len").__call__(frame.getlocal(2))._mod(frame.getlocal(1)))));
- }
- frame.setlocal(2, frame.getlocal(2)._add(frame.getlocal(4)));
- if (frame.getlocal(4)._eq(s$41).__nonzero__()) {
- frame.setlocal(3, frame.getlocal(3)._add(frame.getlocal(2)));
- frame.setlocal(2, s$8);
- }
- }
- return frame.getlocal(3)._add(frame.getlocal(2));
- }
-
- private static PyObject translate$22(PyFrame frame) {
- /* translate(s,table [,deletechars]) -> string
-
- Return a copy of the string s, where all characters occurring
- in the optional argument deletechars are removed, and the
- remaining characters have been mapped through the given
- translation table, which must be a string of length 256.
-
- */
- return frame.getlocal(0).invoke("translate", frame.getlocal(1), frame.getlocal(2));
- }
-
- private static PyObject capitalize$23(PyFrame frame) {
- /* capitalize(s) -> string
-
- Return a copy of the string s with only its first character
- capitalized.
-
- */
- return frame.getlocal(0).invoke("capitalize");
- }
-
- private static PyObject capwords$24(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- /* capwords(s, [sep]) -> string
-
- Split the argument into words using split, capitalize each
- word using capitalize, and join the capitalized words using
- join. Note that this replaces runs of whitespace characters by
- a single space.
-
- */
- return frame.getglobal("join").__call__(frame.getglobal("map").__call__(frame.getglobal("capitalize"), frame.getlocal(0).invoke("split", frame.getlocal(1))), (t$0$PyObject = frame.getlocal(1)).__nonzero__() ? t$0$PyObject : s$19);
- }
-
- private static PyObject maketrans$25(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* maketrans(frm, to) -> string
-
- Return a translation table (a string of 256 bytes long)
- suitable for use in string.translate. The strings frm and to
- must be of the same length.
-
- */
- if (frame.getglobal("len").__call__(frame.getlocal(0))._ne(frame.getglobal("len").__call__(frame.getlocal(1))).__nonzero__()) {
- throw Py.makeException(frame.getglobal("ValueError"), s$47);
- }
- // global _idmapL
- if (frame.getglobal("_idmapL").__not__().__nonzero__()) {
- frame.setglobal("_idmapL", frame.getglobal("map").__call__(frame.getglobal("None"), frame.getglobal("_idmap")));
- }
- frame.setlocal(3, frame.getglobal("_idmapL").__getslice__(null, null, null));
- frame.setlocal(0, frame.getglobal("map").__call__(frame.getglobal("ord"), frame.getlocal(0)));
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("range").__call__(frame.getglobal("len").__call__(frame.getlocal(0)));
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(2, t$0$PyObject);
- frame.getlocal(3).__setitem__(frame.getlocal(0).__getitem__(frame.getlocal(2)), frame.getlocal(1).__getitem__(frame.getlocal(2)));
- }
- return frame.getglobal("joinfields").__call__(frame.getlocal(3), s$8);
- }
-
- private static PyObject replace$26(PyFrame frame) {
- /* replace (str, old, new[, maxsplit]) -> string
-
- Return a copy of string str with all occurrences of substring
- old replaced by new. If the optional argument maxsplit is
- given, only the first maxsplit occurrences are replaced.
-
- */
- return frame.getlocal(0).invoke("replace", new PyObject[] {frame.getlocal(1), frame.getlocal(2), frame.getlocal(3)});
- }
-
- private static PyObject main$27(PyFrame frame) {
- frame.setglobal("__file__", s$49);
-
- PyObject[] imp_accu;
- // Temporary Variables
- int t$0$int;
- PyException t$0$PyException;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Common string manipulations.
-
- Public module variables:
-
- whitespace -- a string containing all characters considered whitespace
- lowercase -- a string containing all characters considered lowercase letters
- uppercase -- a string containing all characters considered uppercase letters
- letters -- a string containing all characters considered letters
- digits -- a string containing all characters considered decimal digits
- hexdigits -- a string containing all characters considered hexadecimal digits
- octdigits -- a string containing all characters considered octal digits
-
- */
- frame.setlocal("whitespace", s$1);
- frame.setlocal("lowercase", s$2);
- frame.setlocal("uppercase", s$3);
- frame.setlocal("letters", frame.getname("lowercase")._add(frame.getname("uppercase")));
- frame.setlocal("digits", s$4);
- frame.setlocal("hexdigits", frame.getname("digits")._add(s$5)._add(s$6));
- frame.setlocal("octdigits", s$7);
- frame.setlocal("_idmap", s$8);
- t$0$int = 0;
- t$1$PyObject = frame.getname("range").__call__(i$9);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal("i", t$0$PyObject);
- frame.setlocal("_idmap", frame.getname("_idmap")._add(frame.getname("chr").__call__(frame.getname("i"))));
- }
- frame.dellocal("i");
- frame.setlocal("index_error", frame.getname("ValueError"));
- frame.setlocal("atoi_error", frame.getname("ValueError"));
- frame.setlocal("atof_error", frame.getname("ValueError"));
- frame.setlocal("atol_error", frame.getname("ValueError"));
- frame.setlocal("lower", new PyFunction(frame.f_globals, new PyObject[] {}, c$0_lower));
- frame.setlocal("upper", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_upper));
- frame.setlocal("swapcase", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_swapcase));
- frame.setlocal("strip", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_strip));
- frame.setlocal("lstrip", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_lstrip));
- frame.setlocal("rstrip", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_rstrip));
- frame.setlocal("split", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), i$17.__neg__()}, c$6_split));
- frame.setlocal("splitfields", frame.getname("split"));
- frame.setlocal("join", new PyFunction(frame.f_globals, new PyObject[] {s$19}, c$7_join));
- frame.setlocal("joinfields", frame.getname("join"));
- frame.setlocal("_apply", frame.getname("apply"));
- frame.setlocal("index", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_index));
- frame.setlocal("rindex", new PyFunction(frame.f_globals, new PyObject[] {}, c$9_rindex));
- frame.setlocal("count", new PyFunction(frame.f_globals, new PyObject[] {}, c$10_count));
- frame.setlocal("find", new PyFunction(frame.f_globals, new PyObject[] {}, c$11_find));
- frame.setlocal("rfind", new PyFunction(frame.f_globals, new PyObject[] {}, c$12_rfind));
- frame.setlocal("_float", frame.getname("float"));
- frame.setlocal("_int", frame.getname("int"));
- frame.setlocal("_long", frame.getname("long"));
- frame.setlocal("_StringType", frame.getname("type").__call__(s$8));
- frame.setlocal("atof", new PyFunction(frame.f_globals, new PyObject[] {}, c$13_atof));
- frame.setlocal("atoi", new PyFunction(frame.f_globals, new PyObject[] {}, c$14_atoi));
- frame.setlocal("atol", new PyFunction(frame.f_globals, new PyObject[] {}, c$15_atol));
- frame.setlocal("ljust", new PyFunction(frame.f_globals, new PyObject[] {}, c$16_ljust));
- frame.setlocal("rjust", new PyFunction(frame.f_globals, new PyObject[] {}, c$17_rjust));
- frame.setlocal("center", new PyFunction(frame.f_globals, new PyObject[] {}, c$18_center));
- frame.setlocal("zfill", new PyFunction(frame.f_globals, new PyObject[] {}, c$19_zfill));
- frame.setlocal("expandtabs", new PyFunction(frame.f_globals, new PyObject[] {i$42}, c$20_expandtabs));
- frame.setlocal("translate", new PyFunction(frame.f_globals, new PyObject[] {s$8}, c$21_translate));
- frame.setlocal("capitalize", new PyFunction(frame.f_globals, new PyObject[] {}, c$22_capitalize));
- frame.setlocal("capwords", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$23_capwords));
- frame.setlocal("_idmapL", frame.getname("None"));
- frame.setlocal("maketrans", new PyFunction(frame.f_globals, new PyObject[] {}, c$24_maketrans));
- frame.setlocal("replace", new PyFunction(frame.f_globals, new PyObject[] {i$17.__neg__()}, c$25_replace));
- try {
- imp_accu = org.python.core.imp.importFrom("strop", new String[] {"maketrans", "lowercase", "uppercase", "whitespace"}, frame);
- frame.setlocal("maketrans", imp_accu[0]);
- frame.setlocal("lowercase", imp_accu[1]);
- frame.setlocal("uppercase", imp_accu[2]);
- frame.setlocal("whitespace", imp_accu[3]);
- imp_accu = null;
- frame.setlocal("letters", frame.getname("lowercase")._add(frame.getname("uppercase")));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getname("ImportError"))) {
- // pass
- }
- else throw t$0$PyException;
- }
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("string"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "string";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(string._PyInner.class, newargs, string.jpy$packages, string.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class threading extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject i$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject i$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject f$16;
- private static PyObject f$17;
- private static PyObject f$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyObject s$24;
- private static PyObject s$25;
- private static PyObject s$26;
- private static PyObject s$27;
- private static PyObject s$28;
- private static PyObject s$29;
- private static PyObject s$30;
- private static PyObject s$31;
- private static PyObject s$32;
- private static PyObject s$33;
- private static PyObject s$34;
- private static PyObject s$35;
- private static PyObject s$36;
- private static PyObject s$37;
- private static PyObject s$38;
- private static PyObject s$39;
- private static PyObject s$40;
- private static PyObject s$41;
- private static PyObject s$42;
- private static PyObject s$43;
- private static PyObject s$44;
- private static PyObject s$45;
- private static PyObject s$46;
- private static PyObject s$47;
- private static PyObject s$48;
- private static PyObject s$49;
- private static PyObject s$50;
- private static PyObject s$51;
- private static PyObject s$52;
- private static PyObject s$53;
- private static PyObject s$54;
- private static PyObject s$55;
- private static PyObject s$56;
- private static PyObject s$57;
- private static PyObject s$58;
- private static PyObject s$59;
- private static PyObject f$60;
- private static PyObject s$61;
- private static PyObject i$62;
- private static PyObject i$63;
- private static PyObject i$64;
- private static PyObject s$65;
- private static PyObject s$66;
- private static PyObject s$67;
- private static PyFunctionTable funcTable;
- private static PyCode c$0___init__;
- private static PyCode c$1__note;
- private static PyCode c$2__Verbose;
- private static PyCode c$3___init__;
- private static PyCode c$4__note;
- private static PyCode c$5__Verbose;
- private static PyCode c$6_RLock;
- private static PyCode c$7___init__;
- private static PyCode c$8___repr__;
- private static PyCode c$9_acquire;
- private static PyCode c$10_release;
- private static PyCode c$11__acquire_restore;
- private static PyCode c$12__release_save;
- private static PyCode c$13__is_owned;
- private static PyCode c$14__RLock;
- private static PyCode c$15_Condition;
- private static PyCode c$16___init__;
- private static PyCode c$17___repr__;
- private static PyCode c$18__release_save;
- private static PyCode c$19__acquire_restore;
- private static PyCode c$20__is_owned;
- private static PyCode c$21_wait;
- private static PyCode c$22_notify;
- private static PyCode c$23_notifyAll;
- private static PyCode c$24__Condition;
- private static PyCode c$25_Semaphore;
- private static PyCode c$26___init__;
- private static PyCode c$27_acquire;
- private static PyCode c$28_release;
- private static PyCode c$29__Semaphore;
- private static PyCode c$30_Event;
- private static PyCode c$31___init__;
- private static PyCode c$32_isSet;
- private static PyCode c$33_set;
- private static PyCode c$34_clear;
- private static PyCode c$35_wait;
- private static PyCode c$36__Event;
- private static PyCode c$37__newname;
- private static PyCode c$38___init__;
- private static PyCode c$39__set_daemon;
- private static PyCode c$40___repr__;
- private static PyCode c$41_start;
- private static PyCode c$42_run;
- private static PyCode c$43__Thread__bootstrap;
- private static PyCode c$44__Thread__stop;
- private static PyCode c$45__Thread__delete;
- private static PyCode c$46_join;
- private static PyCode c$47_getName;
- private static PyCode c$48_setName;
- private static PyCode c$49_isAlive;
- private static PyCode c$50_isDaemon;
- private static PyCode c$51_setDaemon;
- private static PyCode c$52_Thread;
- private static PyCode c$53___init__;
- private static PyCode c$54__set_daemon;
- private static PyCode c$55___MainThread__exitfunc;
- private static PyCode c$56__MainThread;
- private static PyCode c$57__pickSomeNonDaemonThread;
- private static PyCode c$58___init__;
- private static PyCode c$59__set_daemon;
- private static PyCode c$60_join;
- private static PyCode c$61__DummyThread;
- private static PyCode c$62_currentThread;
- private static PyCode c$63_activeCount;
- private static PyCode c$64_enumerate;
- private static PyCode c$65___init__;
- private static PyCode c$66_put;
- private static PyCode c$67_get;
- private static PyCode c$68_BoundedQueue;
- private static PyCode c$69___init__;
- private static PyCode c$70_run;
- private static PyCode c$71_ProducerThread;
- private static PyCode c$72___init__;
- private static PyCode c$73_run;
- private static PyCode c$74_ConsumerThread;
- private static PyCode c$75__test;
- private static PyCode c$76_main;
- private static void initConstants() {
- s$0 = Py.newString("Proposed new threading module, emulating a subset of Java's threading model.");
- i$1 = Py.newInteger(0);
- s$2 = Py.newString("%s: %s\012");
- s$3 = Py.newString("<%s(%s, %d)>");
- i$4 = Py.newInteger(1);
- s$5 = Py.newString("%s.acquire(%s): recursive success");
- s$6 = Py.newString("%s.acquire(%s): initial succes");
- s$7 = Py.newString("%s.acquire(%s): failure");
- s$8 = Py.newString("release() of un-acquire()d lock");
- s$9 = Py.newString("%s.release(): final release");
- s$10 = Py.newString("%s.release(): non-final release");
- s$11 = Py.newString("%s._acquire_restore()");
- s$12 = Py.newString("%s._release_save()");
- s$13 = Py.newString("<Condition(%s, %d)>");
- s$14 = Py.newString("wait() of un-acquire()d lock");
- s$15 = Py.newString("%s.wait(): got it");
- f$16 = Py.newFloat(1.0E-6);
- f$17 = Py.newFloat(1.0);
- f$18 = Py.newFloat(2.0);
- s$19 = Py.newString("%s.wait(%s): timed out");
- s$20 = Py.newString("%s.wait(%s): got it");
- s$21 = Py.newString("notify() of un-acquire()d lock");
- s$22 = Py.newString("%s.notify(): no waiters");
- s$23 = Py.newString("%s.notify(): notifying %d waiter%s");
- s$24 = Py.newString("s");
- s$25 = Py.newString("");
- s$26 = Py.newString("Semaphore initial value must be >= 0");
- s$27 = Py.newString("Thread-%d");
- s$28 = Py.newString("group argument must be None for now");
- s$29 = Py.newString("Thread.__init__() was not called");
- s$30 = Py.newString("initial");
- s$31 = Py.newString("started");
- s$32 = Py.newString("stopped");
- s$33 = Py.newString(" daemon");
- s$34 = Py.newString("<%s(%s, %s)>");
- s$35 = Py.newString("Thread.__init__() not called");
- s$36 = Py.newString("thread already started");
- s$37 = Py.newString("%s.start(): starting thread");
- s$38 = Py.newString("%s.__bootstrap(): thread started");
- s$39 = Py.newString("%s.__bootstrap(): raised SystemExit");
- s$40 = Py.newString("%s.__bootstrap(): unhandled exception");
- s$41 = Py.newString("Exception in thread %s:\012%s\012");
- s$42 = Py.newString("%s.__bootstrap(): normal return");
- s$43 = Py.newString("cannot join thread before it is started");
- s$44 = Py.newString("cannot join current thread");
- s$45 = Py.newString("%s.join(): waiting until thread stops");
- s$46 = Py.newString("%s.join(): thread stopped");
- s$47 = Py.newString("%s.join(): timed out");
- s$48 = Py.newString("cannot set daemon status of active thread");
- s$49 = Py.newString("MainThread");
- s$50 = Py.newString("%s: waiting for other threads");
- s$51 = Py.newString("%s: exiting");
- s$52 = Py.newString("Dummy-%d");
- s$53 = Py.newString("cannot join a dummy thread");
- s$54 = Py.newString("put(%s): queue full");
- s$55 = Py.newString("put(%s): appended, length now %d");
- s$56 = Py.newString("get(): queue empty");
- s$57 = Py.newString("get(): got %s, %d left");
- s$58 = Py.newString("Producer");
- s$59 = Py.newString("%s.%d");
- f$60 = Py.newFloat(1.0E-5);
- s$61 = Py.newString("Consumer");
- i$62 = Py.newInteger(3);
- i$63 = Py.newInteger(4);
- i$64 = Py.newInteger(5);
- s$65 = Py.newString("Producer-%d");
- s$66 = Py.newString("__main__");
- s$67 = Py.newString("/usr/share/jython/Lib-cpython/threading.py");
- funcTable = new _PyInner();
- c$0___init__ = Py.newCode(2, new String[] {"self", "verbose"}, "/usr/share/jython/Lib-cpython/threading.py", "__init__", false, false, funcTable, 0, null, null, 0, 1);
- c$1__note = Py.newCode(3, new String[] {"self", "format", "args"}, "/usr/share/jython/Lib-cpython/threading.py", "_note", true, false, funcTable, 1, null, null, 0, 1);
- c$2__Verbose = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "_Verbose", false, false, funcTable, 2, null, null, 0, 0);
- c$3___init__ = Py.newCode(2, new String[] {"self", "verbose"}, "/usr/share/jython/Lib-cpython/threading.py", "__init__", false, false, funcTable, 3, null, null, 0, 1);
- c$4__note = Py.newCode(2, new String[] {"self", "args"}, "/usr/share/jython/Lib-cpython/threading.py", "_note", true, false, funcTable, 4, null, null, 0, 1);
- c$5__Verbose = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "_Verbose", false, false, funcTable, 5, null, null, 0, 0);
- c$6_RLock = Py.newCode(2, new String[] {"args", "kwargs"}, "/usr/share/jython/Lib-cpython/threading.py", "RLock", true, true, funcTable, 6, null, null, 0, 1);
- c$7___init__ = Py.newCode(2, new String[] {"self", "verbose"}, "/usr/share/jython/Lib-cpython/threading.py", "__init__", false, false, funcTable, 7, null, null, 0, 1);
- c$8___repr__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "__repr__", false, false, funcTable, 8, null, null, 0, 1);
- c$9_acquire = Py.newCode(2, new String[] {"self", "blocking", "me", "rc"}, "/usr/share/jython/Lib-cpython/threading.py", "acquire", false, false, funcTable, 9, null, null, 0, 1);
- c$10_release = Py.newCode(1, new String[] {"self", "count", "me"}, "/usr/share/jython/Lib-cpython/threading.py", "release", false, false, funcTable, 10, null, null, 0, 1);
- c$11__acquire_restore = Py.newCode(2, new String[] {"self", "(count, owner)", "owner", "count"}, "/usr/share/jython/Lib-cpython/threading.py", "_acquire_restore", false, false, funcTable, 11, null, null, 0, 1);
- c$12__release_save = Py.newCode(1, new String[] {"self", "owner", "count"}, "/usr/share/jython/Lib-cpython/threading.py", "_release_save", false, false, funcTable, 12, null, null, 0, 1);
- c$13__is_owned = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "_is_owned", false, false, funcTable, 13, null, null, 0, 1);
- c$14__RLock = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "_RLock", false, false, funcTable, 14, null, null, 0, 0);
- c$15_Condition = Py.newCode(2, new String[] {"args", "kwargs"}, "/usr/share/jython/Lib-cpython/threading.py", "Condition", true, true, funcTable, 15, null, null, 0, 1);
- c$16___init__ = Py.newCode(3, new String[] {"self", "lock", "verbose"}, "/usr/share/jython/Lib-cpython/threading.py", "__init__", false, false, funcTable, 16, null, null, 0, 1);
- c$17___repr__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "__repr__", false, false, funcTable, 17, null, null, 0, 1);
- c$18__release_save = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "_release_save", false, false, funcTable, 18, null, null, 0, 1);
- c$19__acquire_restore = Py.newCode(2, new String[] {"self", "x"}, "/usr/share/jython/Lib-cpython/threading.py", "_acquire_restore", false, false, funcTable, 19, null, null, 0, 1);
- c$20__is_owned = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "_is_owned", false, false, funcTable, 20, null, null, 0, 1);
- c$21_wait = Py.newCode(2, new String[] {"self", "timeout", "endtime", "saved_state", "delay", "me", "gotit", "waiter"}, "/usr/share/jython/Lib-cpython/threading.py", "wait", false, false, funcTable, 21, null, null, 0, 1);
- c$22_notify = Py.newCode(2, new String[] {"self", "n", "__waiters", "waiters", "me", "waiter"}, "/usr/share/jython/Lib-cpython/threading.py", "notify", false, false, funcTable, 22, null, null, 0, 1);
- c$23_notifyAll = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "notifyAll", false, false, funcTable, 23, null, null, 0, 1);
- c$24__Condition = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "_Condition", false, false, funcTable, 24, null, null, 0, 0);
- c$25_Semaphore = Py.newCode(2, new String[] {"args", "kwargs"}, "/usr/share/jython/Lib-cpython/threading.py", "Semaphore", true, true, funcTable, 25, null, null, 0, 1);
- c$26___init__ = Py.newCode(3, new String[] {"self", "value", "verbose"}, "/usr/share/jython/Lib-cpython/threading.py", "__init__", false, false, funcTable, 26, null, null, 0, 1);
- c$27_acquire = Py.newCode(2, new String[] {"self", "blocking", "rc"}, "/usr/share/jython/Lib-cpython/threading.py", "acquire", false, false, funcTable, 27, null, null, 0, 1);
- c$28_release = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "release", false, false, funcTable, 28, null, null, 0, 1);
- c$29__Semaphore = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "_Semaphore", false, false, funcTable, 29, null, null, 0, 0);
- c$30_Event = Py.newCode(2, new String[] {"args", "kwargs"}, "/usr/share/jython/Lib-cpython/threading.py", "Event", true, true, funcTable, 30, null, null, 0, 1);
- c$31___init__ = Py.newCode(2, new String[] {"self", "verbose"}, "/usr/share/jython/Lib-cpython/threading.py", "__init__", false, false, funcTable, 31, null, null, 0, 1);
- c$32_isSet = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "isSet", false, false, funcTable, 32, null, null, 0, 1);
- c$33_set = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "set", false, false, funcTable, 33, null, null, 0, 1);
- c$34_clear = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "clear", false, false, funcTable, 34, null, null, 0, 1);
- c$35_wait = Py.newCode(2, new String[] {"self", "timeout"}, "/usr/share/jython/Lib-cpython/threading.py", "wait", false, false, funcTable, 35, null, null, 0, 1);
- c$36__Event = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "_Event", false, false, funcTable, 36, null, null, 0, 0);
- c$37__newname = Py.newCode(1, new String[] {"template"}, "/usr/share/jython/Lib-cpython/threading.py", "_newname", false, false, funcTable, 37, null, null, 0, 1);
- c$38___init__ = Py.newCode(7, new String[] {"self", "group", "target", "name", "args", "kwargs", "verbose"}, "/usr/share/jython/Lib-cpython/threading.py", "__init__", false, false, funcTable, 38, null, null, 0, 1);
- c$39__set_daemon = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "_set_daemon", false, false, funcTable, 39, null, null, 0, 1);
- c$40___repr__ = Py.newCode(1, new String[] {"self", "status"}, "/usr/share/jython/Lib-cpython/threading.py", "__repr__", false, false, funcTable, 40, null, null, 0, 1);
- c$41_start = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "start", false, false, funcTable, 41, null, null, 0, 1);
- c$42_run = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "run", false, false, funcTable, 42, null, null, 0, 1);
- c$43__Thread__bootstrap = Py.newCode(1, new String[] {"self", "s"}, "/usr/share/jython/Lib-cpython/threading.py", "_Thread__bootstrap", false, false, funcTable, 43, null, null, 0, 1);
- c$44__Thread__stop = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "_Thread__stop", false, false, funcTable, 44, null, null, 0, 1);
- c$45__Thread__delete = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "_Thread__delete", false, false, funcTable, 45, null, null, 0, 1);
- c$46_join = Py.newCode(2, new String[] {"self", "timeout", "delay", "deadline"}, "/usr/share/jython/Lib-cpython/threading.py", "join", false, false, funcTable, 46, null, null, 0, 1);
- c$47_getName = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "getName", false, false, funcTable, 47, null, null, 0, 1);
- c$48_setName = Py.newCode(2, new String[] {"self", "name"}, "/usr/share/jython/Lib-cpython/threading.py", "setName", false, false, funcTable, 48, null, null, 0, 1);
- c$49_isAlive = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "isAlive", false, false, funcTable, 49, null, null, 0, 1);
- c$50_isDaemon = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "isDaemon", false, false, funcTable, 50, null, null, 0, 1);
- c$51_setDaemon = Py.newCode(2, new String[] {"self", "daemonic"}, "/usr/share/jython/Lib-cpython/threading.py", "setDaemon", false, false, funcTable, 51, null, null, 0, 1);
- c$52_Thread = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "Thread", false, false, funcTable, 52, null, null, 0, 0);
- c$53___init__ = Py.newCode(1, new String[] {"self", "atexit"}, "/usr/share/jython/Lib-cpython/threading.py", "__init__", false, false, funcTable, 53, null, null, 0, 1);
- c$54__set_daemon = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "_set_daemon", false, false, funcTable, 54, null, null, 0, 1);
- c$55___MainThread__exitfunc = Py.newCode(1, new String[] {"self", "t"}, "/usr/share/jython/Lib-cpython/threading.py", "__MainThread__exitfunc", false, false, funcTable, 55, null, null, 0, 1);
- c$56__MainThread = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "_MainThread", false, false, funcTable, 56, null, null, 0, 0);
- c$57__pickSomeNonDaemonThread = Py.newCode(0, new String[] {"t"}, "/usr/share/jython/Lib-cpython/threading.py", "_pickSomeNonDaemonThread", false, false, funcTable, 57, null, null, 0, 1);
- c$58___init__ = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "__init__", false, false, funcTable, 58, null, null, 0, 1);
- c$59__set_daemon = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "_set_daemon", false, false, funcTable, 59, null, null, 0, 1);
- c$60_join = Py.newCode(1, new String[] {"self"}, "/usr/share/jython/Lib-cpython/threading.py", "join", false, false, funcTable, 60, null, null, 0, 1);
- c$61__DummyThread = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "_DummyThread", false, false, funcTable, 61, null, null, 0, 0);
- c$62_currentThread = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "currentThread", false, false, funcTable, 62, null, null, 0, 1);
- c$63_activeCount = Py.newCode(0, new String[] {"count"}, "/usr/share/jython/Lib-cpython/threading.py", "activeCount", false, false, funcTable, 63, null, null, 0, 1);
- c$64_enumerate = Py.newCode(0, new String[] {"active"}, "/usr/share/jython/Lib-cpython/threading.py", "enumerate", false, false, funcTable, 64, null, null, 0, 1);
- c$65___init__ = Py.newCode(2, new String[] {"self", "limit"}, "/usr/share/jython/Lib-cpython/threading.py", "__init__", false, false, funcTable, 65, null, null, 0, 1);
- c$66_put = Py.newCode(2, new String[] {"self", "item"}, "/usr/share/jython/Lib-cpython/threading.py", "put", false, false, funcTable, 66, null, null, 0, 1);
- c$67_get = Py.newCode(1, new String[] {"self", "item"}, "/usr/share/jython/Lib-cpython/threading.py", "get", false, false, funcTable, 67, null, null, 0, 1);
- c$68_BoundedQueue = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "BoundedQueue", false, false, funcTable, 68, null, null, 0, 0);
- c$69___init__ = Py.newCode(3, new String[] {"self", "queue", "quota"}, "/usr/share/jython/Lib-cpython/threading.py", "__init__", false, false, funcTable, 69, null, null, 0, 1);
- c$70_run = Py.newCode(1, new String[] {"self", "counter", "random"}, "/usr/share/jython/Lib-cpython/threading.py", "run", false, false, funcTable, 70, null, null, 0, 1);
- c$71_ProducerThread = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "ProducerThread", false, false, funcTable, 71, null, null, 0, 0);
- c$72___init__ = Py.newCode(3, new String[] {"self", "queue", "count"}, "/usr/share/jython/Lib-cpython/threading.py", "__init__", false, false, funcTable, 72, null, null, 0, 1);
- c$73_run = Py.newCode(1, new String[] {"self", "item"}, "/usr/share/jython/Lib-cpython/threading.py", "run", false, false, funcTable, 73, null, null, 0, 1);
- c$74_ConsumerThread = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "ConsumerThread", false, false, funcTable, 74, null, null, 0, 0);
- c$75__test = Py.newCode(0, new String[] {"random", "Q", "P", "time", "ProducerThread", "t", "C", "BoundedQueue", "ConsumerThread", "i", "NP", "QL", "NI"}, "/usr/share/jython/Lib-cpython/threading.py", "_test", false, false, funcTable, 75, null, null, 0, 1);
- c$76_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/threading.py", "main", false, false, funcTable, 76, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$76_main == null) _PyInner.initConstants();
- return c$76_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.__init__$1(frame);
- case 1:
- return _PyInner._note$2(frame);
- case 2:
- return _PyInner._Verbose$3(frame);
- case 3:
- return _PyInner.__init__$4(frame);
- case 4:
- return _PyInner._note$5(frame);
- case 5:
- return _PyInner._Verbose$6(frame);
- case 6:
- return _PyInner.RLock$7(frame);
- case 7:
- return _PyInner.__init__$8(frame);
- case 8:
- return _PyInner.__repr__$9(frame);
- case 9:
- return _PyInner.acquire$10(frame);
- case 10:
- return _PyInner.release$11(frame);
- case 11:
- return _PyInner._acquire_restore$12(frame);
- case 12:
- return _PyInner._release_save$13(frame);
- case 13:
- return _PyInner._is_owned$14(frame);
- case 14:
- return _PyInner._RLock$15(frame);
- case 15:
- return _PyInner.Condition$16(frame);
- case 16:
- return _PyInner.__init__$17(frame);
- case 17:
- return _PyInner.__repr__$18(frame);
- case 18:
- return _PyInner._release_save$19(frame);
- case 19:
- return _PyInner._acquire_restore$20(frame);
- case 20:
- return _PyInner._is_owned$21(frame);
- case 21:
- return _PyInner.wait$22(frame);
- case 22:
- return _PyInner.notify$23(frame);
- case 23:
- return _PyInner.notifyAll$24(frame);
- case 24:
- return _PyInner._Condition$25(frame);
- case 25:
- return _PyInner.Semaphore$26(frame);
- case 26:
- return _PyInner.__init__$27(frame);
- case 27:
- return _PyInner.acquire$28(frame);
- case 28:
- return _PyInner.release$29(frame);
- case 29:
- return _PyInner._Semaphore$30(frame);
- case 30:
- return _PyInner.Event$31(frame);
- case 31:
- return _PyInner.__init__$32(frame);
- case 32:
- return _PyInner.isSet$33(frame);
- case 33:
- return _PyInner.set$34(frame);
- case 34:
- return _PyInner.clear$35(frame);
- case 35:
- return _PyInner.wait$36(frame);
- case 36:
- return _PyInner._Event$37(frame);
- case 37:
- return _PyInner._newname$38(frame);
- case 38:
- return _PyInner.__init__$39(frame);
- case 39:
- return _PyInner._set_daemon$40(frame);
- case 40:
- return _PyInner.__repr__$41(frame);
- case 41:
- return _PyInner.start$42(frame);
- case 42:
- return _PyInner.run$43(frame);
- case 43:
- return _PyInner._Thread__bootstrap$44(frame);
- case 44:
- return _PyInner._Thread__stop$45(frame);
- case 45:
- return _PyInner._Thread__delete$46(frame);
- case 46:
- return _PyInner.join$47(frame);
- case 47:
- return _PyInner.getName$48(frame);
- case 48:
- return _PyInner.setName$49(frame);
- case 49:
- return _PyInner.isAlive$50(frame);
- case 50:
- return _PyInner.isDaemon$51(frame);
- case 51:
- return _PyInner.setDaemon$52(frame);
- case 52:
- return _PyInner.Thread$53(frame);
- case 53:
- return _PyInner.__init__$54(frame);
- case 54:
- return _PyInner._set_daemon$55(frame);
- case 55:
- return _PyInner.__MainThread__exitfunc$56(frame);
- case 56:
- return _PyInner._MainThread$57(frame);
- case 57:
- return _PyInner._pickSomeNonDaemonThread$58(frame);
- case 58:
- return _PyInner.__init__$59(frame);
- case 59:
- return _PyInner._set_daemon$60(frame);
- case 60:
- return _PyInner.join$61(frame);
- case 61:
- return _PyInner._DummyThread$62(frame);
- case 62:
- return _PyInner.currentThread$63(frame);
- case 63:
- return _PyInner.activeCount$64(frame);
- case 64:
- return _PyInner.enumerate$65(frame);
- case 65:
- return _PyInner.__init__$66(frame);
- case 66:
- return _PyInner.put$67(frame);
- case 67:
- return _PyInner.get$68(frame);
- case 68:
- return _PyInner.BoundedQueue$69(frame);
- case 69:
- return _PyInner.__init__$70(frame);
- case 70:
- return _PyInner.run$71(frame);
- case 71:
- return _PyInner.ProducerThread$72(frame);
- case 72:
- return _PyInner.__init__$73(frame);
- case 73:
- return _PyInner.run$74(frame);
- case 74:
- return _PyInner.ConsumerThread$75(frame);
- case 75:
- return _PyInner._test$76(frame);
- case 76:
- return _PyInner.main$77(frame);
- default:
- return null;
- }
- }
-
- private static PyObject __init__$1(PyFrame frame) {
- if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(1, frame.getglobal("_VERBOSE"));
- }
- frame.getlocal(0).__setattr__("__Verbose__verbose", frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject _note$2(PyFrame frame) {
- if (frame.getlocal(0).__getattr__("__Verbose__verbose").__nonzero__()) {
- frame.setlocal(1, frame.getlocal(1)._mod(frame.getlocal(2)));
- frame.setlocal(1, s$2._mod(new PyTuple(new PyObject[] {frame.getglobal("currentThread").__call__().invoke("getName"), frame.getlocal(1)})));
- frame.getglobal("_sys").__getattr__("stderr").__getattr__("write").__call__(frame.getlocal(1));
- }
- return Py.None;
- }
-
- private static PyObject _Verbose$3(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$0___init__));
- frame.setlocal("_note", new PyFunction(frame.f_globals, new PyObject[] {}, c$1__note));
- return frame.getf_locals();
- }
-
- private static PyObject __init__$4(PyFrame frame) {
- // pass
- return Py.None;
- }
-
- private static PyObject _note$5(PyFrame frame) {
- // pass
- return Py.None;
- }
-
- private static PyObject _Verbose$6(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$3___init__));
- frame.setlocal("_note", new PyFunction(frame.f_globals, new PyObject[] {}, c$4__note));
- return frame.getf_locals();
- }
-
- private static PyObject RLock$7(PyFrame frame) {
- return frame.getglobal("apply").__call__(frame.getglobal("_RLock"), frame.getlocal(0), frame.getlocal(1));
- }
-
- private static PyObject __init__$8(PyFrame frame) {
- frame.getglobal("_Verbose").invoke("__init__", frame.getlocal(0), frame.getlocal(1));
- frame.getlocal(0).__setattr__("__RLock__block", frame.getglobal("_allocate_lock").__call__());
- frame.getlocal(0).__setattr__("__RLock__owner", frame.getglobal("None"));
- frame.getlocal(0).__setattr__("__RLock__count", i$1);
- return Py.None;
- }
-
- private static PyObject __repr__$9(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- return s$3._mod(new PyTuple(new PyObject[] {frame.getlocal(0).__getattr__("__class__").__getattr__("__name__"), (t$0$PyObject = frame.getlocal(0).__getattr__("__RLock__owner")).__nonzero__() ? frame.getlocal(0).__getattr__("__RLock__owner").invoke("getName") : t$0$PyObject, frame.getlocal(0).__getattr__("__RLock__count")}));
- }
-
- private static PyObject acquire$10(PyFrame frame) {
- frame.setlocal(2, frame.getglobal("currentThread").__call__());
- if (frame.getlocal(0).__getattr__("__RLock__owner")._is(frame.getlocal(2)).__nonzero__()) {
- frame.getlocal(0).__setattr__("__RLock__count", frame.getlocal(0).__getattr__("__RLock__count")._add(i$4));
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", new PyObject[] {s$5, frame.getlocal(0), frame.getlocal(1)});
- }
- return i$4;
- }
- frame.setlocal(3, frame.getlocal(0).__getattr__("__RLock__block").invoke("acquire", frame.getlocal(1)));
- if (frame.getlocal(3).__nonzero__()) {
- frame.getlocal(0).__setattr__("__RLock__owner", frame.getlocal(2));
- frame.getlocal(0).__setattr__("__RLock__count", i$4);
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", new PyObject[] {s$6, frame.getlocal(0), frame.getlocal(1)});
- }
- }
- else {
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", new PyObject[] {s$7, frame.getlocal(0), frame.getlocal(1)});
- }
- }
- return frame.getlocal(3);
- }
-
- private static PyObject release$11(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- frame.setlocal(2, frame.getglobal("currentThread").__call__());
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("__RLock__owner")._is(frame.getlocal(2)), s$8);
- t$0$PyObject = frame.getlocal(0).__getattr__("__RLock__count")._sub(i$4);
- frame.getlocal(0).__setattr__("__RLock__count", t$0$PyObject);
- frame.setlocal(1, t$0$PyObject);
- if (frame.getlocal(1).__not__().__nonzero__()) {
- frame.getlocal(0).__setattr__("__RLock__owner", frame.getglobal("None"));
- frame.getlocal(0).__getattr__("__RLock__block").invoke("release");
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$9, frame.getlocal(0));
- }
- }
- else {
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$10, frame.getlocal(0));
- }
- }
- return Py.None;
- }
-
- private static PyObject _acquire_restore$12(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1), 2);
- frame.setlocal(3, t$0$PyObject__[0]);
- frame.setlocal(2, t$0$PyObject__[1]);
- frame.getlocal(0).__getattr__("__RLock__block").invoke("acquire");
- frame.getlocal(0).__setattr__("__RLock__count", frame.getlocal(3));
- frame.getlocal(0).__setattr__("__RLock__owner", frame.getlocal(2));
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$11, frame.getlocal(0));
- }
- return Py.None;
- }
-
- private static PyObject _release_save$13(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$12, frame.getlocal(0));
- }
- frame.setlocal(2, frame.getlocal(0).__getattr__("__RLock__count"));
- frame.getlocal(0).__setattr__("__RLock__count", i$1);
- frame.setlocal(1, frame.getlocal(0).__getattr__("__RLock__owner"));
- frame.getlocal(0).__setattr__("__RLock__owner", frame.getglobal("None"));
- frame.getlocal(0).__getattr__("__RLock__block").invoke("release");
- return new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(1)});
- }
-
- private static PyObject _is_owned$14(PyFrame frame) {
- return frame.getlocal(0).__getattr__("__RLock__owner")._is(frame.getglobal("currentThread").__call__());
- }
-
- private static PyObject _RLock$15(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$7___init__));
- frame.setlocal("__repr__", new PyFunction(frame.f_globals, new PyObject[] {}, c$8___repr__));
- frame.setlocal("acquire", new PyFunction(frame.f_globals, new PyObject[] {i$4}, c$9_acquire));
- frame.setlocal("release", new PyFunction(frame.f_globals, new PyObject[] {}, c$10_release));
- frame.setlocal("_acquire_restore", new PyFunction(frame.f_globals, new PyObject[] {}, c$11__acquire_restore));
- frame.setlocal("_release_save", new PyFunction(frame.f_globals, new PyObject[] {}, c$12__release_save));
- frame.setlocal("_is_owned", new PyFunction(frame.f_globals, new PyObject[] {}, c$13__is_owned));
- return frame.getf_locals();
- }
-
- private static PyObject Condition$16(PyFrame frame) {
- return frame.getglobal("apply").__call__(frame.getglobal("_Condition"), frame.getlocal(0), frame.getlocal(1));
- }
-
- private static PyObject __init__$17(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- frame.getglobal("_Verbose").invoke("__init__", frame.getlocal(0), frame.getlocal(2));
- if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(1, frame.getglobal("RLock").__call__());
- }
- frame.getlocal(0).__setattr__("__Condition__lock", frame.getlocal(1));
- frame.getlocal(0).__setattr__("acquire", frame.getlocal(1).__getattr__("acquire"));
- frame.getlocal(0).__setattr__("release", frame.getlocal(1).__getattr__("release"));
- try {
- frame.getlocal(0).__setattr__("_release_save", frame.getlocal(1).__getattr__("_release_save"));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("AttributeError"))) {
- // pass
- }
- else throw t$0$PyException;
- }
- try {
- frame.getlocal(0).__setattr__("_acquire_restore", frame.getlocal(1).__getattr__("_acquire_restore"));
- }
- catch (Throwable x$1) {
- t$0$PyException = Py.setException(x$1, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("AttributeError"))) {
- // pass
- }
- else throw t$0$PyException;
- }
- try {
- frame.getlocal(0).__setattr__("_is_owned", frame.getlocal(1).__getattr__("_is_owned"));
- }
- catch (Throwable x$2) {
- t$0$PyException = Py.setException(x$2, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("AttributeError"))) {
- // pass
- }
- else throw t$0$PyException;
- }
- frame.getlocal(0).__setattr__("__Condition__waiters", new PyList(new PyObject[] {}));
- return Py.None;
- }
-
- private static PyObject __repr__$18(PyFrame frame) {
- return s$13._mod(new PyTuple(new PyObject[] {frame.getlocal(0).__getattr__("__Condition__lock"), frame.getglobal("len").__call__(frame.getlocal(0).__getattr__("__Condition__waiters"))}));
- }
-
- private static PyObject _release_save$19(PyFrame frame) {
- frame.getlocal(0).__getattr__("__Condition__lock").invoke("release");
- return Py.None;
- }
-
- private static PyObject _acquire_restore$20(PyFrame frame) {
- frame.getlocal(0).__getattr__("__Condition__lock").invoke("acquire");
- return Py.None;
- }
-
- private static PyObject _is_owned$21(PyFrame frame) {
- if (frame.getlocal(0).__getattr__("__Condition__lock").invoke("acquire", i$1).__nonzero__()) {
- frame.getlocal(0).__getattr__("__Condition__lock").invoke("release");
- return i$1;
- }
- else {
- return i$4;
- }
- }
-
- private static PyObject wait$22(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
- PyObject t$0$PyObject;
-
- // Code
- frame.setlocal(5, frame.getglobal("currentThread").__call__());
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).invoke("_is_owned"), s$14);
- frame.setlocal(7, frame.getglobal("_allocate_lock").__call__());
- frame.getlocal(7).invoke("acquire");
- frame.getlocal(0).__getattr__("__Condition__waiters").invoke("append", frame.getlocal(7));
- frame.setlocal(3, frame.getlocal(0).invoke("_release_save"));
- try {
- if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
- frame.getlocal(7).invoke("acquire");
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$15, frame.getlocal(0));
- }
- }
- else {
- frame.setlocal(2, frame.getglobal("_time").__call__()._add(frame.getlocal(1)));
- frame.setlocal(4, f$16);
- while (i$4.__nonzero__()) {
- frame.setlocal(6, frame.getlocal(7).invoke("acquire", i$1));
- if (((t$0$PyObject = frame.getlocal(6)).__nonzero__() ? t$0$PyObject : frame.getglobal("_time").__call__()._ge(frame.getlocal(2))).__nonzero__()) {
- break;
- }
- frame.getglobal("_sleep").__call__(frame.getlocal(4));
- if (frame.getlocal(4)._lt(f$17).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(4)._mul(f$18));
- }
- }
- if (frame.getlocal(6).__not__().__nonzero__()) {
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", new PyObject[] {s$19, frame.getlocal(0), frame.getlocal(1)});
- }
- try {
- frame.getlocal(0).__getattr__("__Condition__waiters").invoke("remove", frame.getlocal(7));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("ValueError"))) {
- // pass
- }
- else throw t$0$PyException;
- }
- }
- else {
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", new PyObject[] {s$20, frame.getlocal(0), frame.getlocal(1)});
- }
- }
- }
- }
- finally {
- frame.getlocal(0).invoke("_acquire_restore", frame.getlocal(3));
- }
- return Py.None;
- }
-
- private static PyObject notify$23(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyException t$0$PyException;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(4, frame.getglobal("currentThread").__call__());
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).invoke("_is_owned"), s$21);
- frame.setlocal(2, frame.getlocal(0).__getattr__("__Condition__waiters"));
- frame.setlocal(3, frame.getlocal(2).__getslice__(null, frame.getlocal(1), null));
- if (frame.getlocal(3).__not__().__nonzero__()) {
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$22, frame.getlocal(0));
- }
- return Py.None;
- }
- frame.getlocal(0).invoke("_note", new PyObject[] {s$23, frame.getlocal(0), frame.getlocal(1), (t$0$PyObject = ((t$1$PyObject = frame.getlocal(1)._ne(i$4)).__nonzero__() ? s$24 : t$1$PyObject)).__nonzero__() ? t$0$PyObject : s$25});
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(3);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(5, t$0$PyObject);
- frame.getlocal(5).invoke("release");
- try {
- frame.getlocal(2).invoke("remove", frame.getlocal(5));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("ValueError"))) {
- // pass
- }
- else throw t$0$PyException;
- }
- }
- return Py.None;
- }
-
- private static PyObject notifyAll$24(PyFrame frame) {
- frame.getlocal(0).invoke("notify", frame.getglobal("len").__call__(frame.getlocal(0).__getattr__("__Condition__waiters")));
- return Py.None;
- }
-
- private static PyObject _Condition$25(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), frame.getname("None")}, c$16___init__));
- frame.setlocal("__repr__", new PyFunction(frame.f_globals, new PyObject[] {}, c$17___repr__));
- frame.setlocal("_release_save", new PyFunction(frame.f_globals, new PyObject[] {}, c$18__release_save));
- frame.setlocal("_acquire_restore", new PyFunction(frame.f_globals, new PyObject[] {}, c$19__acquire_restore));
- frame.setlocal("_is_owned", new PyFunction(frame.f_globals, new PyObject[] {}, c$20__is_owned));
- frame.setlocal("wait", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$21_wait));
- frame.setlocal("notify", new PyFunction(frame.f_globals, new PyObject[] {i$4}, c$22_notify));
- frame.setlocal("notifyAll", new PyFunction(frame.f_globals, new PyObject[] {}, c$23_notifyAll));
- return frame.getf_locals();
- }
-
- private static PyObject Semaphore$26(PyFrame frame) {
- return frame.getglobal("apply").__call__(frame.getglobal("_Semaphore"), frame.getlocal(0), frame.getlocal(1));
- }
-
- private static PyObject __init__$27(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(1)._ge(i$1), s$26);
- frame.getglobal("_Verbose").invoke("__init__", frame.getlocal(0), frame.getlocal(2));
- frame.getlocal(0).__setattr__("__Semaphore__cond", frame.getglobal("Condition").__call__(frame.getglobal("Lock").__call__()));
- frame.getlocal(0).__setattr__("__Semaphore__value", frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject acquire$28(PyFrame frame) {
- // Temporary Variables
- boolean t$0$boolean;
-
- // Code
- frame.setlocal(2, i$1);
- frame.getlocal(0).__getattr__("__Semaphore__cond").invoke("acquire");
- while (t$0$boolean=frame.getlocal(0).__getattr__("__Semaphore__value")._eq(i$1).__nonzero__()) {
- if (frame.getlocal(1).__not__().__nonzero__()) {
- break;
- }
- frame.getlocal(0).__getattr__("__Semaphore__cond").invoke("wait");
- }
- if (!t$0$boolean) {
- frame.getlocal(0).__setattr__("__Semaphore__value", frame.getlocal(0).__getattr__("__Semaphore__value")._sub(i$4));
- frame.setlocal(2, i$4);
- }
- frame.getlocal(0).__getattr__("__Semaphore__cond").invoke("release");
- return frame.getlocal(2);
- }
-
- private static PyObject release$29(PyFrame frame) {
- frame.getlocal(0).__getattr__("__Semaphore__cond").invoke("acquire");
- frame.getlocal(0).__setattr__("__Semaphore__value", frame.getlocal(0).__getattr__("__Semaphore__value")._add(i$4));
- frame.getlocal(0).__getattr__("__Semaphore__cond").invoke("notify");
- frame.getlocal(0).__getattr__("__Semaphore__cond").invoke("release");
- return Py.None;
- }
-
- private static PyObject _Semaphore$30(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {i$4, frame.getname("None")}, c$26___init__));
- frame.setlocal("acquire", new PyFunction(frame.f_globals, new PyObject[] {i$4}, c$27_acquire));
- frame.setlocal("release", new PyFunction(frame.f_globals, new PyObject[] {}, c$28_release));
- return frame.getf_locals();
- }
-
- private static PyObject Event$31(PyFrame frame) {
- return frame.getglobal("apply").__call__(frame.getglobal("_Event"), frame.getlocal(0), frame.getlocal(1));
- }
-
- private static PyObject __init__$32(PyFrame frame) {
- frame.getglobal("_Verbose").invoke("__init__", frame.getlocal(0), frame.getlocal(1));
- frame.getlocal(0).__setattr__("__Event__cond", frame.getglobal("Condition").__call__(frame.getglobal("Lock").__call__()));
- frame.getlocal(0).__setattr__("__Event__flag", i$1);
- return Py.None;
- }
-
- private static PyObject isSet$33(PyFrame frame) {
- return frame.getlocal(0).__getattr__("__Event__flag");
- }
-
- private static PyObject set$34(PyFrame frame) {
- frame.getlocal(0).__getattr__("__Event__cond").invoke("acquire");
- frame.getlocal(0).__setattr__("__Event__flag", i$4);
- frame.getlocal(0).__getattr__("__Event__cond").invoke("notifyAll");
- frame.getlocal(0).__getattr__("__Event__cond").invoke("release");
- return Py.None;
- }
-
- private static PyObject clear$35(PyFrame frame) {
- frame.getlocal(0).__getattr__("__Event__cond").invoke("acquire");
- frame.getlocal(0).__setattr__("__Event__flag", i$1);
- frame.getlocal(0).__getattr__("__Event__cond").invoke("release");
- return Py.None;
- }
-
- private static PyObject wait$36(PyFrame frame) {
- frame.getlocal(0).__getattr__("__Event__cond").invoke("acquire");
- if (frame.getlocal(0).__getattr__("__Event__flag").__not__().__nonzero__()) {
- frame.getlocal(0).__getattr__("__Event__cond").invoke("wait", frame.getlocal(1));
- }
- frame.getlocal(0).__getattr__("__Event__cond").invoke("release");
- return Py.None;
- }
-
- private static PyObject _Event$37(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$31___init__));
- frame.setlocal("isSet", new PyFunction(frame.f_globals, new PyObject[] {}, c$32_isSet));
- frame.setlocal("set", new PyFunction(frame.f_globals, new PyObject[] {}, c$33_set));
- frame.setlocal("clear", new PyFunction(frame.f_globals, new PyObject[] {}, c$34_clear));
- frame.setlocal("wait", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$35_wait));
- return frame.getf_locals();
- }
-
- private static PyObject _newname$38(PyFrame frame) {
- // global _counter
- frame.setglobal("_counter", frame.getglobal("_counter")._add(i$4));
- return frame.getlocal(0)._mod(frame.getglobal("_counter"));
- }
-
- private static PyObject __init__$39(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(1)._is(frame.getglobal("None")), s$28);
- frame.getglobal("_Verbose").invoke("__init__", frame.getlocal(0), frame.getlocal(6));
- frame.getlocal(0).__setattr__("_Thread__target", frame.getlocal(2));
- frame.getlocal(0).__setattr__("_Thread__name", frame.getglobal("str").__call__((t$0$PyObject = frame.getlocal(3)).__nonzero__() ? t$0$PyObject : frame.getglobal("_newname").__call__()));
- frame.getlocal(0).__setattr__("_Thread__args", frame.getlocal(4));
- frame.getlocal(0).__setattr__("_Thread__kwargs", frame.getlocal(5));
- frame.getlocal(0).__setattr__("_Thread__daemonic", frame.getlocal(0).invoke("_set_daemon"));
- frame.getlocal(0).__setattr__("_Thread__started", i$1);
- frame.getlocal(0).__setattr__("_Thread__stopped", i$1);
- frame.getlocal(0).__setattr__("_Thread__block", frame.getglobal("Condition").__call__(frame.getglobal("Lock").__call__()));
- frame.getlocal(0).__setattr__("_Thread__initialized", i$4);
- return Py.None;
- }
-
- private static PyObject _set_daemon$40(PyFrame frame) {
- return frame.getglobal("currentThread").__call__().invoke("isDaemon");
- }
-
- private static PyObject __repr__$41(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("_Thread__initialized"), s$29);
- frame.setlocal(1, s$30);
- if (frame.getlocal(0).__getattr__("_Thread__started").__nonzero__()) {
- frame.setlocal(1, s$31);
- }
- if (frame.getlocal(0).__getattr__("_Thread__stopped").__nonzero__()) {
- frame.setlocal(1, s$32);
- }
- if (frame.getlocal(0).__getattr__("_Thread__daemonic").__nonzero__()) {
- frame.setlocal(1, frame.getlocal(1)._add(s$33));
- }
- return s$34._mod(new PyTuple(new PyObject[] {frame.getlocal(0).__getattr__("__class__").__getattr__("__name__"), frame.getlocal(0).__getattr__("_Thread__name"), frame.getlocal(1)}));
- }
-
- private static PyObject start$42(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("_Thread__initialized"), s$35);
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("_Thread__started").__not__(), s$36);
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$37, frame.getlocal(0));
- }
- frame.getglobal("_active_limbo_lock").invoke("acquire");
- frame.getglobal("_limbo").__setitem__(frame.getlocal(0), frame.getlocal(0));
- frame.getglobal("_active_limbo_lock").invoke("release");
- frame.getglobal("_start_new_thread").__call__(frame.getlocal(0).__getattr__("_Thread__bootstrap"), new PyTuple(new PyObject[] {}));
- frame.getlocal(0).__setattr__("_Thread__started", i$4);
- frame.getglobal("_sleep").__call__(f$16);
- return Py.None;
- }
-
- private static PyObject run$43(PyFrame frame) {
- if (frame.getlocal(0).__getattr__("_Thread__target").__nonzero__()) {
- frame.getglobal("apply").__call__(frame.getlocal(0).__getattr__("_Thread__target"), frame.getlocal(0).__getattr__("_Thread__args"), frame.getlocal(0).__getattr__("_Thread__kwargs"));
- }
- return Py.None;
- }
-
- private static PyObject _Thread__bootstrap$44(PyFrame frame) {
- // Temporary Variables
- boolean t$0$boolean;
- PyException t$0$PyException;
-
- // Code
- try {
- frame.getlocal(0).__setattr__("_Thread__started", i$4);
- frame.getglobal("_active_limbo_lock").invoke("acquire");
- frame.getglobal("_active").__setitem__(frame.getglobal("_get_ident").__call__(), frame.getlocal(0));
- frame.getglobal("_limbo").__delitem__(frame.getlocal(0));
- frame.getglobal("_active_limbo_lock").invoke("release");
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$38, frame.getlocal(0));
- }
- t$0$boolean = true;
- try {
- frame.getlocal(0).invoke("run");
- }
- catch (Throwable x$0) {
- t$0$boolean = false;
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("SystemExit"))) {
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$39, frame.getlocal(0));
- }
- }
- else {
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$40, frame.getlocal(0));
- }
- frame.setlocal(1, frame.getglobal("_StringIO").__call__());
- frame.getglobal("_print_exc").__call__(new PyObject[] {frame.getlocal(1)}, new String[] {"file"});
- frame.getglobal("_sys").__getattr__("stderr").__getattr__("write").__call__(s$41._mod(new PyTuple(new PyObject[] {frame.getlocal(0).invoke("getName"), frame.getlocal(1).invoke("getvalue")})));
- }
- }
- if (t$0$boolean) {
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$42, frame.getlocal(0));
- }
- }
- }
- finally {
- frame.getlocal(0).invoke("_Thread__stop");
- try {
- frame.getlocal(0).invoke("_Thread__delete");
- }
- catch (Throwable x$1) {
- t$0$PyException = Py.setException(x$1, frame);
- // pass
- }
- }
- return Py.None;
- }
-
- private static PyObject _Thread__stop$45(PyFrame frame) {
- frame.getlocal(0).__getattr__("_Thread__block").invoke("acquire");
- frame.getlocal(0).__setattr__("_Thread__stopped", i$4);
- frame.getlocal(0).__getattr__("_Thread__block").invoke("notifyAll");
- frame.getlocal(0).__getattr__("_Thread__block").invoke("release");
- return Py.None;
- }
-
- private static PyObject _Thread__delete$46(PyFrame frame) {
- frame.getglobal("_active_limbo_lock").invoke("acquire");
- frame.getglobal("_active").__delitem__(frame.getglobal("_get_ident").__call__());
- frame.getglobal("_active_limbo_lock").invoke("release");
- return Py.None;
- }
-
- private static PyObject join$47(PyFrame frame) {
- // Temporary Variables
- boolean t$0$boolean;
-
- // Code
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("_Thread__initialized"), s$35);
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("_Thread__started"), s$43);
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0)._isnot(frame.getglobal("currentThread").__call__()), s$44);
- if (frame.getglobal("__debug__").__nonzero__()) {
- if (frame.getlocal(0).__getattr__("_Thread__stopped").__not__().__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$45, frame.getlocal(0));
- }
- }
- frame.getlocal(0).__getattr__("_Thread__block").invoke("acquire");
- if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
- while (frame.getlocal(0).__getattr__("_Thread__stopped").__not__().__nonzero__()) {
- frame.getlocal(0).__getattr__("_Thread__block").invoke("wait");
- }
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$46, frame.getlocal(0));
- }
- }
- else {
- frame.setlocal(3, frame.getglobal("_time").__call__()._add(frame.getlocal(1)));
- while (t$0$boolean=frame.getlocal(0).__getattr__("_Thread__stopped").__not__().__nonzero__()) {
- frame.setlocal(2, frame.getlocal(3)._sub(frame.getglobal("_time").__call__()));
- if (frame.getlocal(2)._le(i$1).__nonzero__()) {
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$47, frame.getlocal(0));
- }
- break;
- }
- frame.getlocal(0).__getattr__("_Thread__block").invoke("wait", frame.getlocal(2));
- }
- if (!t$0$boolean) {
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$46, frame.getlocal(0));
- }
- }
- }
- frame.getlocal(0).__getattr__("_Thread__block").invoke("release");
- return Py.None;
- }
-
- private static PyObject getName$48(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("_Thread__initialized"), s$35);
- return frame.getlocal(0).__getattr__("_Thread__name");
- }
-
- private static PyObject setName$49(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("_Thread__initialized"), s$35);
- frame.getlocal(0).__setattr__("_Thread__name", frame.getglobal("str").__call__(frame.getlocal(1)));
- return Py.None;
- }
-
- private static PyObject isAlive$50(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("_Thread__initialized"), s$35);
- return (t$0$PyObject = frame.getlocal(0).__getattr__("_Thread__started")).__nonzero__() ? frame.getlocal(0).__getattr__("_Thread__stopped").__not__() : t$0$PyObject;
- }
-
- private static PyObject isDaemon$51(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("_Thread__initialized"), s$35);
- return frame.getlocal(0).__getattr__("_Thread__daemonic");
- }
-
- private static PyObject setDaemon$52(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("_Thread__initialized"), s$35);
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("_Thread__started").__not__(), s$48);
- frame.getlocal(0).__setattr__("_Thread__daemonic", frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject Thread$53(PyFrame frame) {
- frame.setlocal("_Thread__initialized", i$1);
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), frame.getname("None"), frame.getname("None"), new PyTuple(new PyObject[] {}), new PyDictionary(new PyObject[] {}), frame.getname("None")}, c$38___init__));
- frame.setlocal("_set_daemon", new PyFunction(frame.f_globals, new PyObject[] {}, c$39__set_daemon));
- frame.setlocal("__repr__", new PyFunction(frame.f_globals, new PyObject[] {}, c$40___repr__));
- frame.setlocal("start", new PyFunction(frame.f_globals, new PyObject[] {}, c$41_start));
- frame.setlocal("run", new PyFunction(frame.f_globals, new PyObject[] {}, c$42_run));
- frame.setlocal("_Thread__bootstrap", new PyFunction(frame.f_globals, new PyObject[] {}, c$43__Thread__bootstrap));
- frame.setlocal("_Thread__stop", new PyFunction(frame.f_globals, new PyObject[] {}, c$44__Thread__stop));
- frame.setlocal("_Thread__delete", new PyFunction(frame.f_globals, new PyObject[] {}, c$45__Thread__delete));
- frame.setlocal("join", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$46_join));
- frame.setlocal("getName", new PyFunction(frame.f_globals, new PyObject[] {}, c$47_getName));
- frame.setlocal("setName", new PyFunction(frame.f_globals, new PyObject[] {}, c$48_setName));
- frame.setlocal("isAlive", new PyFunction(frame.f_globals, new PyObject[] {}, c$49_isAlive));
- frame.setlocal("isDaemon", new PyFunction(frame.f_globals, new PyObject[] {}, c$50_isDaemon));
- frame.setlocal("setDaemon", new PyFunction(frame.f_globals, new PyObject[] {}, c$51_setDaemon));
- return frame.getf_locals();
- }
-
- private static PyObject __init__$54(PyFrame frame) {
- frame.getglobal("Thread").__getattr__("__init__").__call__(new PyObject[] {frame.getlocal(0), s$49}, new String[] {"name"});
- frame.getlocal(0).__setattr__("_Thread__started", i$4);
- frame.getglobal("_active_limbo_lock").invoke("acquire");
- frame.getglobal("_active").__setitem__(frame.getglobal("_get_ident").__call__(), frame.getlocal(0));
- frame.getglobal("_active_limbo_lock").invoke("release");
- frame.setlocal(1, org.python.core.imp.importOne("atexit", frame));
- frame.getlocal(1).__getattr__("register").__call__(frame.getlocal(0).__getattr__("__MainThread__exitfunc"));
- return Py.None;
- }
-
- private static PyObject _set_daemon$55(PyFrame frame) {
- return i$1;
- }
-
- private static PyObject __MainThread__exitfunc$56(PyFrame frame) {
- frame.getlocal(0).invoke("_Thread__stop");
- frame.setlocal(1, frame.getglobal("_pickSomeNonDaemonThread").__call__());
- if (frame.getlocal(1).__nonzero__()) {
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$50, frame.getlocal(0));
- }
- }
- while (frame.getlocal(1).__nonzero__()) {
- frame.getlocal(1).invoke("join");
- frame.setlocal(1, frame.getglobal("_pickSomeNonDaemonThread").__call__());
- }
- if (frame.getglobal("__debug__").__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$51, frame.getlocal(0));
- }
- frame.getlocal(0).invoke("_Thread__delete");
- return Py.None;
- }
-
- private static PyObject _MainThread$57(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$53___init__));
- frame.setlocal("_set_daemon", new PyFunction(frame.f_globals, new PyObject[] {}, c$54__set_daemon));
- frame.setlocal("__MainThread__exitfunc", new PyFunction(frame.f_globals, new PyObject[] {}, c$55___MainThread__exitfunc));
- return frame.getf_locals();
- }
-
- private static PyObject _pickSomeNonDaemonThread$58(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
-
- // Code
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("enumerate").__call__();
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(0, t$0$PyObject);
- if (((t$2$PyObject = frame.getlocal(0).invoke("isDaemon").__not__()).__nonzero__() ? frame.getlocal(0).invoke("isAlive") : t$2$PyObject).__nonzero__()) {
- return frame.getlocal(0);
- }
- }
- return frame.getglobal("None");
- }
-
- private static PyObject __init__$59(PyFrame frame) {
- frame.getglobal("Thread").__getattr__("__init__").__call__(new PyObject[] {frame.getlocal(0), frame.getglobal("_newname").__call__(s$52)}, new String[] {"name"});
- frame.getlocal(0).__setattr__("_Thread__started", i$4);
- frame.getglobal("_active_limbo_lock").invoke("acquire");
- frame.getglobal("_active").__setitem__(frame.getglobal("_get_ident").__call__(), frame.getlocal(0));
- frame.getglobal("_active_limbo_lock").invoke("release");
- return Py.None;
- }
-
- private static PyObject _set_daemon$60(PyFrame frame) {
- return i$4;
- }
-
- private static PyObject join$61(PyFrame frame) {
- if (frame.getglobal("__debug__").__nonzero__()) Py.assert(i$1, s$53);
- return Py.None;
- }
-
- private static PyObject _DummyThread$62(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$58___init__));
- frame.setlocal("_set_daemon", new PyFunction(frame.f_globals, new PyObject[] {}, c$59__set_daemon));
- frame.setlocal("join", new PyFunction(frame.f_globals, new PyObject[] {}, c$60_join));
- return frame.getf_locals();
- }
-
- private static PyObject currentThread$63(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- try {
- return frame.getglobal("_active").__getitem__(frame.getglobal("_get_ident").__call__());
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("KeyError"))) {
- return frame.getglobal("_DummyThread").__call__();
- }
- else throw t$0$PyException;
- }
- }
-
- private static PyObject activeCount$64(PyFrame frame) {
- frame.getglobal("_active_limbo_lock").invoke("acquire");
- frame.setlocal(0, frame.getglobal("len").__call__(frame.getglobal("_active"))._add(frame.getglobal("len").__call__(frame.getglobal("_limbo"))));
- frame.getglobal("_active_limbo_lock").invoke("release");
- return frame.getlocal(0);
- }
-
- private static PyObject enumerate$65(PyFrame frame) {
- frame.getglobal("_active_limbo_lock").invoke("acquire");
- frame.setlocal(0, frame.getglobal("_active").invoke("values")._add(frame.getglobal("_limbo").invoke("values")));
- frame.getglobal("_active_limbo_lock").invoke("release");
- return frame.getlocal(0);
- }
-
- private static PyObject __init__$66(PyFrame frame) {
- frame.getglobal("_Verbose").invoke("__init__", frame.getlocal(0));
- frame.getlocal(0).__setattr__("mon", frame.getglobal("RLock").__call__());
- frame.getlocal(0).__setattr__("rc", frame.getglobal("Condition").__call__(frame.getlocal(0).__getattr__("mon")));
- frame.getlocal(0).__setattr__("wc", frame.getglobal("Condition").__call__(frame.getlocal(0).__getattr__("mon")));
- frame.getlocal(0).__setattr__("limit", frame.getlocal(1));
- frame.getlocal(0).__setattr__("queue", new PyList(new PyObject[] {}));
- return Py.None;
- }
-
- private static PyObject put$67(PyFrame frame) {
- frame.getlocal(0).__getattr__("mon").invoke("acquire");
- while (frame.getglobal("len").__call__(frame.getlocal(0).__getattr__("queue"))._ge(frame.getlocal(0).__getattr__("limit")).__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$54, frame.getlocal(1));
- frame.getlocal(0).__getattr__("wc").invoke("wait");
- }
- frame.getlocal(0).__getattr__("queue").invoke("append", frame.getlocal(1));
- frame.getlocal(0).invoke("_note", new PyObject[] {s$55, frame.getlocal(1), frame.getglobal("len").__call__(frame.getlocal(0).__getattr__("queue"))});
- frame.getlocal(0).__getattr__("rc").invoke("notify");
- frame.getlocal(0).__getattr__("mon").invoke("release");
- return Py.None;
- }
-
- private static PyObject get$68(PyFrame frame) {
- frame.getlocal(0).__getattr__("mon").invoke("acquire");
- while (frame.getlocal(0).__getattr__("queue").__not__().__nonzero__()) {
- frame.getlocal(0).invoke("_note", s$56);
- frame.getlocal(0).__getattr__("rc").invoke("wait");
- }
- frame.setlocal(1, frame.getlocal(0).__getattr__("queue").__getitem__(i$1));
- frame.getlocal(0).__getattr__("queue").__delitem__(i$1);
- frame.getlocal(0).invoke("_note", new PyObject[] {s$57, frame.getlocal(1), frame.getglobal("len").__call__(frame.getlocal(0).__getattr__("queue"))});
- frame.getlocal(0).__getattr__("wc").invoke("notify");
- frame.getlocal(0).__getattr__("mon").invoke("release");
- return frame.getlocal(1);
- }
-
- private static PyObject BoundedQueue$69(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$65___init__));
- frame.setlocal("put", new PyFunction(frame.f_globals, new PyObject[] {}, c$66_put));
- frame.setlocal("get", new PyFunction(frame.f_globals, new PyObject[] {}, c$67_get));
- return frame.getf_locals();
- }
-
- private static PyObject __init__$70(PyFrame frame) {
- frame.getglobal("Thread").__getattr__("__init__").__call__(new PyObject[] {frame.getlocal(0), s$58}, new String[] {"name"});
- frame.getlocal(0).__setattr__("queue", frame.getlocal(1));
- frame.getlocal(0).__setattr__("quota", frame.getlocal(2));
- return Py.None;
- }
-
- private static PyObject run$71(PyFrame frame) {
- PyObject[] imp_accu;
- // Code
- imp_accu = org.python.core.imp.importFrom("random", new String[] {"random"}, frame);
- frame.setlocal(2, imp_accu[0]);
- imp_accu = null;
- frame.setlocal(1, i$1);
- while (frame.getlocal(1)._lt(frame.getlocal(0).__getattr__("quota")).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(1)._add(i$4));
- frame.getlocal(0).__getattr__("queue").invoke("put", s$59._mod(new PyTuple(new PyObject[] {frame.getlocal(0).invoke("getName"), frame.getlocal(1)})));
- frame.getglobal("_sleep").__call__(frame.getlocal(2).__call__()._mul(f$60));
- }
- return Py.None;
- }
-
- private static PyObject ProducerThread$72(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$69___init__));
- frame.setlocal("run", new PyFunction(frame.f_globals, new PyObject[] {}, c$70_run));
- return frame.getf_locals();
- }
-
- private static PyObject __init__$73(PyFrame frame) {
- frame.getglobal("Thread").__getattr__("__init__").__call__(new PyObject[] {frame.getlocal(0), s$61}, new String[] {"name"});
- frame.getlocal(0).__setattr__("queue", frame.getlocal(1));
- frame.getlocal(0).__setattr__("count", frame.getlocal(2));
- return Py.None;
- }
-
- private static PyObject run$74(PyFrame frame) {
- while (frame.getlocal(0).__getattr__("count")._gt(i$1).__nonzero__()) {
- frame.setlocal(1, frame.getlocal(0).__getattr__("queue").invoke("get"));
- Py.println(frame.getlocal(1));
- frame.getlocal(0).__setattr__("count", frame.getlocal(0).__getattr__("count")._sub(i$4));
- }
- return Py.None;
- }
-
- private static PyObject ConsumerThread$75(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$72___init__));
- frame.setlocal("run", new PyFunction(frame.f_globals, new PyObject[] {}, c$73_run));
- return frame.getf_locals();
- }
-
- private static PyObject _test$76(PyFrame frame) {
- // Temporary Variables
- int t$0$int, t$1$int, t$2$int;
- PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject, t$4$PyObject, t$5$PyObject;
-
- // Code
- frame.setlocal(0, org.python.core.imp.importOne("random", frame));
- frame.setlocal(7, Py.makeClass("BoundedQueue", new PyObject[] {frame.getglobal("_Verbose")}, c$68_BoundedQueue, null));
- frame.setlocal(4, Py.makeClass("ProducerThread", new PyObject[] {frame.getglobal("Thread")}, c$71_ProducerThread, null));
- frame.setlocal(8, Py.makeClass("ConsumerThread", new PyObject[] {frame.getglobal("Thread")}, c$74_ConsumerThread, null));
- frame.setlocal(3, org.python.core.imp.importOne("time", frame));
- frame.setlocal(10, i$62);
- frame.setlocal(11, i$63);
- frame.setlocal(12, i$64);
- frame.setlocal(1, frame.getlocal(7).__call__(frame.getlocal(11)));
- frame.setlocal(2, new PyList(new PyObject[] {}));
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("range").__call__(frame.getlocal(10));
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(9, t$0$PyObject);
- frame.setlocal(5, frame.getlocal(4).__call__(frame.getlocal(1), frame.getlocal(12)));
- frame.getlocal(5).invoke("setName", s$65._mod(frame.getlocal(9)._add(i$4)));
- frame.getlocal(2).invoke("append", frame.getlocal(5));
- }
- frame.setlocal(6, frame.getlocal(8).__call__(frame.getlocal(1), frame.getlocal(12)._mul(frame.getlocal(10))));
- t$1$int = 0;
- t$3$PyObject = frame.getlocal(2);
- while ((t$2$PyObject = t$3$PyObject.__finditem__(t$1$int++)) != null) {
- frame.setlocal(5, t$2$PyObject);
- frame.getlocal(5).invoke("start");
- frame.getglobal("_sleep").__call__(f$16);
- }
- frame.getlocal(6).invoke("start");
- t$2$int = 0;
- t$5$PyObject = frame.getlocal(2);
- while ((t$4$PyObject = t$5$PyObject.__finditem__(t$2$int++)) != null) {
- frame.setlocal(5, t$4$PyObject);
- frame.getlocal(5).invoke("join");
- }
- frame.getlocal(6).invoke("join");
- return Py.None;
- }
-
- private static PyObject main$77(PyFrame frame) {
- frame.setglobal("__file__", s$67);
-
- /* Proposed new threading module, emulating a subset of Java's threading model. */
- frame.setlocal("sys", org.python.core.imp.importOne("sys", frame));
- frame.setlocal("time", org.python.core.imp.importOne("time", frame));
- frame.setlocal("thread", org.python.core.imp.importOne("thread", frame));
- frame.setlocal("traceback", org.python.core.imp.importOne("traceback", frame));
- frame.setlocal("StringIO", org.python.core.imp.importOne("StringIO", frame));
- frame.setlocal("_sys", frame.getname("sys"));
- frame.dellocal("sys");
- frame.setlocal("_time", frame.getname("time").__getattr__("time"));
- frame.setlocal("_sleep", frame.getname("time").__getattr__("sleep"));
- frame.dellocal("time");
- frame.setlocal("_start_new_thread", frame.getname("thread").__getattr__("start_new_thread"));
- frame.setlocal("_allocate_lock", frame.getname("thread").__getattr__("allocate_lock"));
- frame.setlocal("_get_ident", frame.getname("thread").__getattr__("get_ident"));
- frame.setlocal("ThreadError", frame.getname("thread").__getattr__("error"));
- frame.dellocal("thread");
- frame.setlocal("_print_exc", frame.getname("traceback").__getattr__("print_exc"));
- frame.dellocal("traceback");
- frame.setlocal("_StringIO", frame.getname("StringIO").__getattr__("StringIO"));
- frame.dellocal("StringIO");
- frame.setlocal("_VERBOSE", i$1);
- if (frame.getname("__debug__").__nonzero__()) {
- frame.setlocal("_Verbose", Py.makeClass("_Verbose", new PyObject[] {}, c$2__Verbose, null));
- }
- else {
- frame.setlocal("_Verbose", Py.makeClass("_Verbose", new PyObject[] {}, c$5__Verbose, null));
- }
- frame.setlocal("Lock", frame.getname("_allocate_lock"));
- frame.setlocal("RLock", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_RLock));
- frame.setlocal("_RLock", Py.makeClass("_RLock", new PyObject[] {frame.getname("_Verbose")}, c$14__RLock, null));
- frame.setlocal("Condition", new PyFunction(frame.f_globals, new PyObject[] {}, c$15_Condition));
- frame.setlocal("_Condition", Py.makeClass("_Condition", new PyObject[] {frame.getname("_Verbose")}, c$24__Condition, null));
- frame.setlocal("Semaphore", new PyFunction(frame.f_globals, new PyObject[] {}, c$25_Semaphore));
- frame.setlocal("_Semaphore", Py.makeClass("_Semaphore", new PyObject[] {frame.getname("_Verbose")}, c$29__Semaphore, null));
- frame.setlocal("Event", new PyFunction(frame.f_globals, new PyObject[] {}, c$30_Event));
- frame.setlocal("_Event", Py.makeClass("_Event", new PyObject[] {frame.getname("_Verbose")}, c$36__Event, null));
- frame.setlocal("_counter", i$1);
- frame.setlocal("_newname", new PyFunction(frame.f_globals, new PyObject[] {s$27}, c$37__newname));
- frame.setlocal("_active_limbo_lock", frame.getname("_allocate_lock").__call__());
- frame.setlocal("_active", new PyDictionary(new PyObject[] {}));
- frame.setlocal("_limbo", new PyDictionary(new PyObject[] {}));
- frame.setlocal("Thread", Py.makeClass("Thread", new PyObject[] {frame.getname("_Verbose")}, c$52_Thread, null));
- frame.setlocal("_MainThread", Py.makeClass("_MainThread", new PyObject[] {frame.getname("Thread")}, c$56__MainThread, null));
- frame.setlocal("_pickSomeNonDaemonThread", new PyFunction(frame.f_globals, new PyObject[] {}, c$57__pickSomeNonDaemonThread));
- frame.setlocal("_DummyThread", Py.makeClass("_DummyThread", new PyObject[] {frame.getname("Thread")}, c$61__DummyThread, null));
- frame.setlocal("currentThread", new PyFunction(frame.f_globals, new PyObject[] {}, c$62_currentThread));
- frame.setlocal("activeCount", new PyFunction(frame.f_globals, new PyObject[] {}, c$63_activeCount));
- frame.setlocal("enumerate", new PyFunction(frame.f_globals, new PyObject[] {}, c$64_enumerate));
- frame.getname("_MainThread").__call__();
- frame.setlocal("_test", new PyFunction(frame.f_globals, new PyObject[] {}, c$75__test));
- if (frame.getname("__name__")._eq(s$66).__nonzero__()) {
- frame.getname("_test").__call__();
- }
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("threading"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "threading";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(threading._PyInner.class, newargs, threading.jpy$packages, threading.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class traceback extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyObject s$7;
- private static PyObject s$8;
- private static PyObject s$9;
- private static PyObject s$10;
- private static PyObject s$11;
- private static PyObject s$12;
- private static PyObject s$13;
- private static PyObject s$14;
- private static PyObject s$15;
- private static PyObject s$16;
- private static PyObject s$17;
- private static PyObject s$18;
- private static PyObject s$19;
- private static PyObject s$20;
- private static PyObject s$21;
- private static PyObject s$22;
- private static PyObject s$23;
- private static PyObject i$24;
- private static PyObject s$25;
- private static PyObject i$26;
- private static PyObject s$27;
- private static PyObject s$28;
- private static PyObject s$29;
- private static PyObject s$30;
- private static PyObject s$31;
- private static PyObject s$32;
- private static PyObject s$33;
- private static PyObject s$34;
- private static PyObject s$35;
- private static PyObject s$36;
- private static PyObject s$37;
- private static PyObject s$38;
- private static PyObject s$39;
- private static PyObject s$40;
- private static PyObject s$41;
- private static PyObject s$42;
- private static PyObject s$43;
- private static PyObject i$44;
- private static PyObject s$45;
- private static PyObject s$46;
- private static PyObject s$47;
- private static PyObject s$48;
- private static PyObject s$49;
- private static PyFunctionTable funcTable;
- private static PyCode c$0__print;
- private static PyCode c$1_print_list;
- private static PyCode c$2_format_list;
- private static PyCode c$3_print_tb;
- private static PyCode c$4_format_tb;
- private static PyCode c$5_extract_tb;
- private static PyCode c$6_print_exception;
- private static PyCode c$7_format_exception;
- private static PyCode c$8_format_exception_only;
- private static PyCode c$9__some_str;
- private static PyCode c$10_print_exc;
- private static PyCode c$11_print_last;
- private static PyCode c$12_print_stack;
- private static PyCode c$13_format_stack;
- private static PyCode c$14_extract_stack;
- private static PyCode c$15_tb_lineno;
- private static PyCode c$16_main;
- private static void initConstants() {
- s$0 = Py.newString("Extract, format and print information about Python stack traces.");
- s$1 = Py.newString("extract_stack");
- s$2 = Py.newString("extract_tb");
- s$3 = Py.newString("format_exception");
- s$4 = Py.newString("format_exception_only");
- s$5 = Py.newString("format_list");
- s$6 = Py.newString("format_stack");
- s$7 = Py.newString("format_tb");
- s$8 = Py.newString("print_exc");
- s$9 = Py.newString("print_exception");
- s$10 = Py.newString("print_last");
- s$11 = Py.newString("print_stack");
- s$12 = Py.newString("print_tb");
- s$13 = Py.newString("tb_lineno");
- s$14 = Py.newString("");
- s$15 = Py.newString("\012");
- s$16 = Py.newString("Print the list of tuples as returned by extract_tb() or\012 extract_stack() as a formatted stack trace to the given file.");
- s$17 = Py.newString(" File \"%s\", line %d, in %s");
- s$18 = Py.newString(" %s");
- s$19 = Py.newString("Format a list of traceback entry tuples for printing.\012\012 Given a list of tuples as returned by extract_tb() or\012 extract_stack(), return a list of strings ready for printing.\012 Each string in the resulting list corresponds to the item with the\012 same index in the argument list. Each string ends in a newline;\012 the strings may contain internal newlines as well, for those items\012 whose source text line is not None.\012 ");
- s$20 = Py.newString(" File \"%s\", line %d, in %s\012");
- s$21 = Py.newString(" %s\012");
- s$22 = Py.newString("Print up to 'limit' stack trace entries from the traceback 'tb'.\012\012 If 'limit' is omitted or None, all entries are printed. If 'file'\012 is omitted or None, the output goes to sys.stderr; otherwise\012 'file' should be an open file or file-like object with a write()\012 method.\012 ");
- s$23 = Py.newString("tracebacklimit");
- i$24 = Py.newInteger(0);
- s$25 = Py.newString(" ");
- i$26 = Py.newInteger(1);
- s$27 = Py.newString("A shorthand for 'format_list(extract_stack(f, limit)).");
- s$28 = Py.newString("Return list of up to limit pre-processed entries from traceback.\012\012 This is useful for alternate formatting of stack traces. If\012 'limit' is omitted or None, all entries are extracted. A\012 pre-processed stack trace entry is a quadruple (filename, line\012 number, function name, text) representing the information that is\012 usually printed for a stack trace. The text is a string with\012 leading and trailing whitespace stripped; if the source is not\012 available it is None.\012 ");
- s$29 = Py.newString("Print exception up to 'limit' stack trace entries from 'tb' to 'file'.\012\012 This differs from print_tb() in the following ways: (1) if\012 traceback is not None, it prints a header \"Traceback (most recent\012 call last):\"; (2) it prints the exception type and value after the\012 stack trace; (3) if type is SyntaxError and value has the\012 appropriate format, it prints the line where the syntax error\012 occurred with a caret on the next line indicating the approximate\012 position of the error.\012 ");
- s$30 = Py.newString("Traceback (most recent call last):");
- s$31 = Py.newString(" ");
- s$32 = Py.newString("Format a stack trace and the exception information.\012\012 The arguments have the same meaning as the corresponding arguments\012 to print_exception(). The return value is a list of strings, each\012 ending in a newline and some containing internal newlines. When\012 these lines are concatenated and printed, exactly the same text is\012 printed as does print_exception().\012 ");
- s$33 = Py.newString("Traceback (most recent call last):\012");
- s$34 = Py.newString("Format the exception part of a traceback.\012\012 The arguments are the exception type and value such as given by\012 sys.last_type and sys.last_value. The return value is a list of\012 strings, each ending in a newline. Normally, the list contains a\012 single string; however, for SyntaxError exceptions, it contains\012 several lines that (when printed) display detailed information\012 about where the syntax error occurred. The message indicating\012 which exception occurred is the always last string in the list.\012 ");
- s$35 = Py.newString("<string>");
- s$36 = Py.newString(" File \"%s\", line %d\012");
- s$37 = Py.newString("%s^\012");
- s$38 = Py.newString("%s: %s\012");
- s$39 = Py.newString("%s\012");
- s$40 = Py.newString("<unprintable %s object>");
- s$41 = Py.newString("Shorthand for 'print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback, limit, file)'.\012 (In fact, it uses sys.exc_info() to retrieve the same information\012 in a thread-safe way.)");
- s$42 = Py.newString("This is a shorthand for 'print_exception(sys.last_type,\012 sys.last_value, sys.last_traceback, limit, file)'.");
- s$43 = Py.newString("Print a stack trace from its invocation point.\012\012 The optional 'f' argument can be used to specify an alternate\012 stack frame at which to start. The optional 'limit' and 'file'\012 arguments have the same meaning as for print_exception().\012 ");
- i$44 = Py.newInteger(2);
- s$45 = Py.newString("Shorthand for 'format_list(extract_stack(f, limit))'.");
- s$46 = Py.newString("Extract the raw traceback from the current stack frame.\012\012 The return value has the same format as for extract_tb(). The\012 optional 'f' and 'limit' arguments have the same meaning as for\012 print_stack(). Each item in the list is a quadruple (filename,\012 line number, function name, text), and the entries are in order\012 from oldest to newest stack frame.\012 ");
- s$47 = Py.newString("Calculate correct line number of traceback given in tb.\012\012 Even works with -O on.\012 ");
- s$48 = Py.newString("co_lnotab");
- s$49 = Py.newString("/usr/share/jython/Lib-cpython/traceback.py");
- funcTable = new _PyInner();
- c$0__print = Py.newCode(3, new String[] {"file", "str", "terminator"}, "/usr/share/jython/Lib-cpython/traceback.py", "_print", false, false, funcTable, 0, null, null, 0, 1);
- c$1_print_list = Py.newCode(2, new String[] {"extracted_list", "file", "line", "filename", "name", "lineno"}, "/usr/share/jython/Lib-cpython/traceback.py", "print_list", false, false, funcTable, 1, null, null, 0, 1);
- c$2_format_list = Py.newCode(1, new String[] {"extracted_list", "line", "filename", "name", "item", "list", "lineno"}, "/usr/share/jython/Lib-cpython/traceback.py", "format_list", false, false, funcTable, 2, null, null, 0, 1);
- c$3_print_tb = Py.newCode(3, new String[] {"tb", "limit", "file", "filename", "name", "lineno", "n", "f", "co", "line"}, "/usr/share/jython/Lib-cpython/traceback.py", "print_tb", false, false, funcTable, 3, null, null, 0, 1);
- c$4_format_tb = Py.newCode(2, new String[] {"tb", "limit"}, "/usr/share/jython/Lib-cpython/traceback.py", "format_tb", false, false, funcTable, 4, null, null, 0, 1);
- c$5_extract_tb = Py.newCode(2, new String[] {"tb", "limit", "filename", "name", "lineno", "n", "f", "list", "co", "line"}, "/usr/share/jython/Lib-cpython/traceback.py", "extract_tb", false, false, funcTable, 5, null, null, 0, 1);
- c$6_print_exception = Py.newCode(5, new String[] {"etype", "value", "tb", "limit", "file", "line", "lines"}, "/usr/share/jython/Lib-cpython/traceback.py", "print_exception", false, false, funcTable, 6, null, null, 0, 1);
- c$7_format_exception = Py.newCode(4, new String[] {"etype", "value", "tb", "limit", "list"}, "/usr/share/jython/Lib-cpython/traceback.py", "format_exception", false, false, funcTable, 7, null, null, 0, 1);
- c$8_format_exception_only = Py.newCode(2, new String[] {"etype", "value", "stype", "msg", "offset", "lineno", "line", "s", "filename", "i", "list", "c"}, "/usr/share/jython/Lib-cpython/traceback.py", "format_exception_only", false, false, funcTable, 8, null, null, 0, 1);
- c$9__some_str = Py.newCode(1, new String[] {"value"}, "/usr/share/jython/Lib-cpython/traceback.py", "_some_str", false, false, funcTable, 9, null, null, 0, 1);
- c$10_print_exc = Py.newCode(2, new String[] {"limit", "file", "tb", "etype", "value"}, "/usr/share/jython/Lib-cpython/traceback.py", "print_exc", false, false, funcTable, 10, null, null, 0, 1);
- c$11_print_last = Py.newCode(2, new String[] {"limit", "file"}, "/usr/share/jython/Lib-cpython/traceback.py", "print_last", false, false, funcTable, 11, null, null, 0, 1);
- c$12_print_stack = Py.newCode(3, new String[] {"f", "limit", "file"}, "/usr/share/jython/Lib-cpython/traceback.py", "print_stack", false, false, funcTable, 12, null, null, 0, 1);
- c$13_format_stack = Py.newCode(2, new String[] {"f", "limit"}, "/usr/share/jython/Lib-cpython/traceback.py", "format_stack", false, false, funcTable, 13, null, null, 0, 1);
- c$14_extract_stack = Py.newCode(2, new String[] {"f", "limit", "filename", "name", "lineno", "n", "list", "co", "line"}, "/usr/share/jython/Lib-cpython/traceback.py", "extract_stack", false, false, funcTable, 14, null, null, 0, 1);
- c$15_tb_lineno = Py.newCode(1, new String[] {"tb", "tab", "i", "c", "addr", "stopat", "line"}, "/usr/share/jython/Lib-cpython/traceback.py", "tb_lineno", false, false, funcTable, 15, null, null, 0, 1);
- c$16_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/traceback.py", "main", false, false, funcTable, 16, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$16_main == null) _PyInner.initConstants();
- return c$16_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner._print$1(frame);
- case 1:
- return _PyInner.print_list$2(frame);
- case 2:
- return _PyInner.format_list$3(frame);
- case 3:
- return _PyInner.print_tb$4(frame);
- case 4:
- return _PyInner.format_tb$5(frame);
- case 5:
- return _PyInner.extract_tb$6(frame);
- case 6:
- return _PyInner.print_exception$7(frame);
- case 7:
- return _PyInner.format_exception$8(frame);
- case 8:
- return _PyInner.format_exception_only$9(frame);
- case 9:
- return _PyInner._some_str$10(frame);
- case 10:
- return _PyInner.print_exc$11(frame);
- case 11:
- return _PyInner.print_last$12(frame);
- case 12:
- return _PyInner.print_stack$13(frame);
- case 13:
- return _PyInner.format_stack$14(frame);
- case 14:
- return _PyInner.extract_stack$15(frame);
- case 15:
- return _PyInner.tb_lineno$16(frame);
- case 16:
- return _PyInner.main$17(frame);
- default:
- return null;
- }
- }
-
- private static PyObject _print$1(PyFrame frame) {
- frame.getlocal(0).invoke("write", frame.getlocal(1)._add(frame.getlocal(2)));
- return Py.None;
- }
-
- private static PyObject print_list$2(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Print the list of tuples as returned by extract_tb() or
- extract_stack() as a formatted stack trace to the given file. */
- if (frame.getlocal(1).__not__().__nonzero__()) {
- frame.setlocal(1, frame.getglobal("sys").__getattr__("stderr"));
- }
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 4);
- frame.setlocal(3, t$0$PyObject__[0]);
- frame.setlocal(5, t$0$PyObject__[1]);
- frame.setlocal(4, t$0$PyObject__[2]);
- frame.setlocal(2, t$0$PyObject__[3]);
- frame.getglobal("_print").__call__(frame.getlocal(1), s$17._mod(new PyTuple(new PyObject[] {frame.getlocal(3), frame.getlocal(5), frame.getlocal(4)})));
- if (frame.getlocal(2).__nonzero__()) {
- frame.getglobal("_print").__call__(frame.getlocal(1), s$18._mod(frame.getlocal(2).invoke("strip")));
- }
- }
- return Py.None;
- }
-
- private static PyObject format_list$3(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Format a list of traceback entry tuples for printing.
-
- Given a list of tuples as returned by extract_tb() or
- extract_stack(), return a list of strings ready for printing.
- Each string in the resulting list corresponds to the item with the
- same index in the argument list. Each string ends in a newline;
- the strings may contain internal newlines as well, for those items
- whose source text line is not None.
- */
- frame.setlocal(5, new PyList(new PyObject[] {}));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(0);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject, 4);
- frame.setlocal(2, t$0$PyObject__[0]);
- frame.setlocal(6, t$0$PyObject__[1]);
- frame.setlocal(3, t$0$PyObject__[2]);
- frame.setlocal(1, t$0$PyObject__[3]);
- frame.setlocal(4, s$20._mod(new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(6), frame.getlocal(3)})));
- if (frame.getlocal(1).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(4)._add(s$21._mod(frame.getlocal(1).invoke("strip"))));
- }
- frame.getlocal(5).invoke("append", frame.getlocal(4));
- }
- return frame.getlocal(5);
- }
-
- private static PyObject print_tb$4(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Print up to 'limit' stack trace entries from the traceback 'tb'.
-
- If 'limit' is omitted or None, all entries are printed. If 'file'
- is omitted or None, the output goes to sys.stderr; otherwise
- 'file' should be an open file or file-like object with a write()
- method.
- */
- if (frame.getlocal(2).__not__().__nonzero__()) {
- frame.setlocal(2, frame.getglobal("sys").__getattr__("stderr"));
- }
- if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
- if (frame.getglobal("hasattr").__call__(frame.getglobal("sys"), s$23).__nonzero__()) {
- frame.setlocal(1, frame.getglobal("sys").__getattr__("tracebacklimit"));
- }
- }
- frame.setlocal(6, i$24);
- while (((t$0$PyObject = frame.getlocal(0)._isnot(frame.getglobal("None"))).__nonzero__() ? ((t$1$PyObject = frame.getlocal(1)._is(frame.getglobal("None"))).__nonzero__() ? t$1$PyObject : frame.getlocal(6)._lt(frame.getlocal(1))) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(7, frame.getlocal(0).__getattr__("tb_frame"));
- frame.setlocal(5, frame.getglobal("tb_lineno").__call__(frame.getlocal(0)));
- frame.setlocal(8, frame.getlocal(7).__getattr__("f_code"));
- frame.setlocal(3, frame.getlocal(8).__getattr__("co_filename"));
- frame.setlocal(4, frame.getlocal(8).__getattr__("co_name"));
- frame.getglobal("_print").__call__(frame.getlocal(2), s$17._mod(new PyTuple(new PyObject[] {frame.getlocal(3), frame.getlocal(5), frame.getlocal(4)})));
- frame.setlocal(9, frame.getglobal("linecache").__getattr__("getline").__call__(frame.getlocal(3), frame.getlocal(5)));
- if (frame.getlocal(9).__nonzero__()) {
- frame.getglobal("_print").__call__(frame.getlocal(2), s$25._add(frame.getlocal(9).invoke("strip")));
- }
- frame.setlocal(0, frame.getlocal(0).__getattr__("tb_next"));
- frame.setlocal(6, frame.getlocal(6)._add(i$26));
- }
- return Py.None;
- }
-
- private static PyObject format_tb$5(PyFrame frame) {
- /* A shorthand for 'format_list(extract_stack(f, limit)). */
- return frame.getglobal("format_list").__call__(frame.getglobal("extract_tb").__call__(frame.getlocal(0), frame.getlocal(1)));
- }
-
- private static PyObject extract_tb$6(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Return list of up to limit pre-processed entries from traceback.
-
- This is useful for alternate formatting of stack traces. If
- 'limit' is omitted or None, all entries are extracted. A
- pre-processed stack trace entry is a quadruple (filename, line
- number, function name, text) representing the information that is
- usually printed for a stack trace. The text is a string with
- leading and trailing whitespace stripped; if the source is not
- available it is None.
- */
- if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
- if (frame.getglobal("hasattr").__call__(frame.getglobal("sys"), s$23).__nonzero__()) {
- frame.setlocal(1, frame.getglobal("sys").__getattr__("tracebacklimit"));
- }
- }
- frame.setlocal(7, new PyList(new PyObject[] {}));
- frame.setlocal(5, i$24);
- while (((t$0$PyObject = frame.getlocal(0)._isnot(frame.getglobal("None"))).__nonzero__() ? ((t$1$PyObject = frame.getlocal(1)._is(frame.getglobal("None"))).__nonzero__() ? t$1$PyObject : frame.getlocal(5)._lt(frame.getlocal(1))) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(6, frame.getlocal(0).__getattr__("tb_frame"));
- frame.setlocal(4, frame.getglobal("tb_lineno").__call__(frame.getlocal(0)));
- frame.setlocal(8, frame.getlocal(6).__getattr__("f_code"));
- frame.setlocal(2, frame.getlocal(8).__getattr__("co_filename"));
- frame.setlocal(3, frame.getlocal(8).__getattr__("co_name"));
- frame.setlocal(9, frame.getglobal("linecache").__getattr__("getline").__call__(frame.getlocal(2), frame.getlocal(4)));
- if (frame.getlocal(9).__nonzero__()) {
- frame.setlocal(9, frame.getlocal(9).invoke("strip"));
- }
- else {
- frame.setlocal(9, frame.getglobal("None"));
- }
- frame.getlocal(7).invoke("append", new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(4), frame.getlocal(3), frame.getlocal(9)}));
- frame.setlocal(0, frame.getlocal(0).__getattr__("tb_next"));
- frame.setlocal(5, frame.getlocal(5)._add(i$26));
- }
- return frame.getlocal(7);
- }
-
- private static PyObject print_exception$7(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Print exception up to 'limit' stack trace entries from 'tb' to 'file'.
-
- This differs from print_tb() in the following ways: (1) if
- traceback is not None, it prints a header "Traceback (most recent
- call last):"; (2) it prints the exception type and value after the
- stack trace; (3) if type is SyntaxError and value has the
- appropriate format, it prints the line where the syntax error
- occurred with a caret on the next line indicating the approximate
- position of the error.
- */
- if (frame.getlocal(4).__not__().__nonzero__()) {
- frame.setlocal(4, frame.getglobal("sys").__getattr__("stderr"));
- }
- if (frame.getlocal(2).__nonzero__()) {
- frame.getglobal("_print").__call__(frame.getlocal(4), s$30);
- frame.getglobal("print_tb").__call__(frame.getlocal(2), frame.getlocal(3), frame.getlocal(4));
- }
- frame.setlocal(6, frame.getglobal("format_exception_only").__call__(frame.getlocal(0), frame.getlocal(1)));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(6).__getslice__(null, i$26.__neg__(), null);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(5, t$0$PyObject);
- frame.getglobal("_print").__call__(frame.getlocal(4), frame.getlocal(5), s$31);
- }
- frame.getglobal("_print").__call__(frame.getlocal(4), frame.getlocal(6).__getitem__(i$26.__neg__()), s$14);
- return Py.None;
- }
-
- private static PyObject format_exception$8(PyFrame frame) {
- /* Format a stack trace and the exception information.
-
- The arguments have the same meaning as the corresponding arguments
- to print_exception(). The return value is a list of strings, each
- ending in a newline and some containing internal newlines. When
- these lines are concatenated and printed, exactly the same text is
- printed as does print_exception().
- */
- if (frame.getlocal(2).__nonzero__()) {
- frame.setlocal(4, new PyList(new PyObject[] {s$33}));
- frame.setlocal(4, frame.getlocal(4)._add(frame.getglobal("format_tb").__call__(frame.getlocal(2), frame.getlocal(3))));
- }
- else {
- frame.setlocal(4, new PyList(new PyObject[] {}));
- }
- frame.setlocal(4, frame.getlocal(4)._add(frame.getglobal("format_exception_only").__call__(frame.getlocal(0), frame.getlocal(1))));
- return frame.getlocal(4);
- }
-
- private static PyObject format_exception_only$9(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject[] t$0$PyObject__, t$1$PyObject__;
- boolean t$0$boolean;
- PyObject t$0$PyObject, t$1$PyObject;
- PyException t$0$PyException;
-
- // Code
- /* Format the exception part of a traceback.
-
- The arguments are the exception type and value such as given by
- sys.last_type and sys.last_value. The return value is a list of
- strings, each ending in a newline. Normally, the list contains a
- single string; however, for SyntaxError exceptions, it contains
- several lines that (when printed) display detailed information
- about where the syntax error occurred. The message indicating
- which exception occurred is the always last string in the list.
- */
- frame.setlocal(10, new PyList(new PyObject[] {}));
- if (frame.getglobal("type").__call__(frame.getlocal(0))._eq(frame.getglobal("types").__getattr__("ClassType")).__nonzero__()) {
- frame.setlocal(2, frame.getlocal(0).__getattr__("__name__"));
- }
- else {
- frame.setlocal(2, frame.getlocal(0));
- }
- if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
- frame.getlocal(10).invoke("append", frame.getglobal("str").__call__(frame.getlocal(2))._add(s$15));
- }
- else {
- if (frame.getlocal(0)._is(frame.getglobal("SyntaxError")).__nonzero__()) {
- t$0$boolean = true;
- try {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(1), 2);
- frame.setlocal(3, t$0$PyObject__[0]);
- t$1$PyObject__ = org.python.core.Py.unpackSequence(t$0$PyObject__[1], 4);
- frame.setlocal(8, t$1$PyObject__[0]);
- frame.setlocal(5, t$1$PyObject__[1]);
- frame.setlocal(4, t$1$PyObject__[2]);
- frame.setlocal(6, t$1$PyObject__[3]);
- }
- catch (Throwable x$0) {
- t$0$boolean = false;
- t$0$PyException = Py.setException(x$0, frame);
- // pass
- }
- if (t$0$boolean) {
- if (frame.getlocal(8).__not__().__nonzero__()) {
- frame.setlocal(8, s$35);
- }
- frame.getlocal(10).invoke("append", s$36._mod(new PyTuple(new PyObject[] {frame.getlocal(8), frame.getlocal(5)})));
- if (frame.getlocal(6)._isnot(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(9, i$24);
- while (((t$0$PyObject = frame.getlocal(9)._lt(frame.getglobal("len").__call__(frame.getlocal(6)))).__nonzero__() ? frame.getlocal(6).__getitem__(frame.getlocal(9)).invoke("isspace") : t$0$PyObject).__nonzero__()) {
- frame.setlocal(9, frame.getlocal(9)._add(i$26));
- }
- frame.getlocal(10).invoke("append", s$21._mod(frame.getlocal(6).invoke("strip")));
- if (frame.getlocal(4)._isnot(frame.getglobal("None")).__nonzero__()) {
- frame.setlocal(7, s$25);
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(6).__getslice__(frame.getlocal(9), frame.getlocal(4)._sub(i$26), null);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(11, t$0$PyObject);
- if (frame.getlocal(11).invoke("isspace").__nonzero__()) {
- frame.setlocal(7, frame.getlocal(7)._add(frame.getlocal(11)));
- }
- else {
- frame.setlocal(7, frame.getlocal(7)._add(s$31));
- }
- }
- frame.getlocal(10).invoke("append", s$37._mod(frame.getlocal(7)));
- }
- frame.setlocal(1, frame.getlocal(3));
- }
- }
- }
- frame.setlocal(7, frame.getglobal("_some_str").__call__(frame.getlocal(1)));
- if (frame.getlocal(7).__nonzero__()) {
- frame.getlocal(10).invoke("append", s$38._mod(new PyTuple(new PyObject[] {frame.getglobal("str").__call__(frame.getlocal(2)), frame.getlocal(7)})));
- }
- else {
- frame.getlocal(10).invoke("append", s$39._mod(frame.getglobal("str").__call__(frame.getlocal(2))));
- }
- }
- return frame.getlocal(10);
- }
-
- private static PyObject _some_str$10(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- try {
- return frame.getglobal("str").__call__(frame.getlocal(0));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- return s$40._mod(frame.getglobal("type").__call__(frame.getlocal(0)).__getattr__("__name__"));
- }
- }
-
- private static PyObject print_exc$11(PyFrame frame) {
- // Temporary Variables
- PyObject[] t$0$PyObject__;
- PyObject t$0$PyObject;
-
- // Code
- /* Shorthand for 'print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback, limit, file)'.
- (In fact, it uses sys.exc_info() to retrieve the same information
- in a thread-safe way.) */
- if (frame.getlocal(1).__not__().__nonzero__()) {
- frame.setlocal(1, frame.getglobal("sys").__getattr__("stderr"));
- }
- try {
- t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("sys").__getattr__("exc_info").__call__(), 3);
- frame.setlocal(3, t$0$PyObject__[0]);
- frame.setlocal(4, t$0$PyObject__[1]);
- frame.setlocal(2, t$0$PyObject__[2]);
- frame.getglobal("print_exception").__call__(new PyObject[] {frame.getlocal(3), frame.getlocal(4), frame.getlocal(2), frame.getlocal(0), frame.getlocal(1)});
- }
- finally {
- t$0$PyObject = frame.getglobal("None");
- frame.setlocal(3, t$0$PyObject);
- frame.setlocal(4, t$0$PyObject);
- frame.setlocal(2, t$0$PyObject);
- }
- return Py.None;
- }
-
- private static PyObject print_last$12(PyFrame frame) {
- /* This is a shorthand for 'print_exception(sys.last_type,
- sys.last_value, sys.last_traceback, limit, file)'. */
- if (frame.getlocal(1).__not__().__nonzero__()) {
- frame.setlocal(1, frame.getglobal("sys").__getattr__("stderr"));
- }
- frame.getglobal("print_exception").__call__(new PyObject[] {frame.getglobal("sys").__getattr__("last_type"), frame.getglobal("sys").__getattr__("last_value"), frame.getglobal("sys").__getattr__("last_traceback"), frame.getlocal(0), frame.getlocal(1)});
- return Py.None;
- }
-
- private static PyObject print_stack$13(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- /* Print a stack trace from its invocation point.
-
- The optional 'f' argument can be used to specify an alternate
- stack frame at which to start. The optional 'limit' and 'file'
- arguments have the same meaning as for print_exception().
- */
- if (frame.getlocal(0)._is(frame.getglobal("None")).__nonzero__()) {
- try {
- throw Py.makeException(frame.getglobal("ZeroDivisionError"));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("ZeroDivisionError"))) {
- frame.setlocal(0, frame.getglobal("sys").__getattr__("exc_info").__call__().__getitem__(i$44).__getattr__("tb_frame").__getattr__("f_back"));
- }
- else throw t$0$PyException;
- }
- }
- frame.getglobal("print_list").__call__(frame.getglobal("extract_stack").__call__(frame.getlocal(0), frame.getlocal(1)), frame.getlocal(2));
- return Py.None;
- }
-
- private static PyObject format_stack$14(PyFrame frame) {
- // Temporary Variables
- PyException t$0$PyException;
-
- // Code
- /* Shorthand for 'format_list(extract_stack(f, limit))'. */
- if (frame.getlocal(0)._is(frame.getglobal("None")).__nonzero__()) {
- try {
- throw Py.makeException(frame.getglobal("ZeroDivisionError"));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("ZeroDivisionError"))) {
- frame.setlocal(0, frame.getglobal("sys").__getattr__("exc_info").__call__().__getitem__(i$44).__getattr__("tb_frame").__getattr__("f_back"));
- }
- else throw t$0$PyException;
- }
- }
- return frame.getglobal("format_list").__call__(frame.getglobal("extract_stack").__call__(frame.getlocal(0), frame.getlocal(1)));
- }
-
- private static PyObject extract_stack$15(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject, t$1$PyObject;
- PyException t$0$PyException;
-
- // Code
- /* Extract the raw traceback from the current stack frame.
-
- The return value has the same format as for extract_tb(). The
- optional 'f' and 'limit' arguments have the same meaning as for
- print_stack(). Each item in the list is a quadruple (filename,
- line number, function name, text), and the entries are in order
- from oldest to newest stack frame.
- */
- if (frame.getlocal(0)._is(frame.getglobal("None")).__nonzero__()) {
- try {
- throw Py.makeException(frame.getglobal("ZeroDivisionError"));
- }
- catch (Throwable x$0) {
- t$0$PyException = Py.setException(x$0, frame);
- if (Py.matchException(t$0$PyException, frame.getglobal("ZeroDivisionError"))) {
- frame.setlocal(0, frame.getglobal("sys").__getattr__("exc_info").__call__().__getitem__(i$44).__getattr__("tb_frame").__getattr__("f_back"));
- }
- else throw t$0$PyException;
- }
- }
- if (frame.getlocal(1)._is(frame.getglobal("None")).__nonzero__()) {
- if (frame.getglobal("hasattr").__call__(frame.getglobal("sys"), s$23).__nonzero__()) {
- frame.setlocal(1, frame.getglobal("sys").__getattr__("tracebacklimit"));
- }
- }
- frame.setlocal(6, new PyList(new PyObject[] {}));
- frame.setlocal(5, i$24);
- while (((t$0$PyObject = frame.getlocal(0)._isnot(frame.getglobal("None"))).__nonzero__() ? ((t$1$PyObject = frame.getlocal(1)._is(frame.getglobal("None"))).__nonzero__() ? t$1$PyObject : frame.getlocal(5)._lt(frame.getlocal(1))) : t$0$PyObject).__nonzero__()) {
- frame.setlocal(4, frame.getlocal(0).__getattr__("f_lineno"));
- frame.setlocal(7, frame.getlocal(0).__getattr__("f_code"));
- frame.setlocal(2, frame.getlocal(7).__getattr__("co_filename"));
- frame.setlocal(3, frame.getlocal(7).__getattr__("co_name"));
- frame.setlocal(8, frame.getglobal("linecache").__getattr__("getline").__call__(frame.getlocal(2), frame.getlocal(4)));
- if (frame.getlocal(8).__nonzero__()) {
- frame.setlocal(8, frame.getlocal(8).invoke("strip"));
- }
- else {
- frame.setlocal(8, frame.getglobal("None"));
- }
- frame.getlocal(6).invoke("append", new PyTuple(new PyObject[] {frame.getlocal(2), frame.getlocal(4), frame.getlocal(3), frame.getlocal(8)}));
- frame.setlocal(0, frame.getlocal(0).__getattr__("f_back"));
- frame.setlocal(5, frame.getlocal(5)._add(i$26));
- }
- frame.getlocal(6).invoke("reverse");
- return frame.getlocal(6);
- }
-
- private static PyObject tb_lineno$16(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- /* Calculate correct line number of traceback given in tb.
-
- Even works with -O on.
- */
- frame.setlocal(3, frame.getlocal(0).__getattr__("tb_frame").__getattr__("f_code"));
- if (frame.getglobal("hasattr").__call__(frame.getlocal(3), s$48).__not__().__nonzero__()) {
- return frame.getlocal(0).__getattr__("tb_lineno");
- }
- frame.setlocal(1, frame.getlocal(3).__getattr__("co_lnotab"));
- frame.setlocal(6, frame.getlocal(3).__getattr__("co_firstlineno"));
- frame.setlocal(5, frame.getlocal(0).__getattr__("tb_lasti"));
- frame.setlocal(4, i$24);
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("range").__call__(i$24, frame.getglobal("len").__call__(frame.getlocal(1)), i$44);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(2, t$0$PyObject);
- frame.setlocal(4, frame.getlocal(4)._add(frame.getglobal("ord").__call__(frame.getlocal(1).__getitem__(frame.getlocal(2)))));
- if (frame.getlocal(4)._gt(frame.getlocal(5)).__nonzero__()) {
- break;
- }
- frame.setlocal(6, frame.getlocal(6)._add(frame.getglobal("ord").__call__(frame.getlocal(1).__getitem__(frame.getlocal(2)._add(i$26)))));
- }
- return frame.getlocal(6);
- }
-
- private static PyObject main$17(PyFrame frame) {
- frame.setglobal("__file__", s$49);
-
- /* Extract, format and print information about Python stack traces. */
- frame.setlocal("linecache", org.python.core.imp.importOne("linecache", frame));
- frame.setlocal("sys", org.python.core.imp.importOne("sys", frame));
- frame.setlocal("types", org.python.core.imp.importOne("types", frame));
- frame.setlocal("__all__", new PyList(new PyObject[] {s$1, s$2, s$3, s$4, s$5, s$6, s$7, s$8, s$9, s$10, s$11, s$12, s$13}));
- frame.setlocal("_print", new PyFunction(frame.f_globals, new PyObject[] {s$14, s$15}, c$0__print));
- frame.setlocal("print_list", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$1_print_list));
- frame.setlocal("format_list", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_format_list));
- frame.setlocal("print_tb", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), frame.getname("None")}, c$3_print_tb));
- frame.setlocal("format_tb", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$4_format_tb));
- frame.setlocal("extract_tb", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$5_extract_tb));
- frame.setlocal("print_exception", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), frame.getname("None")}, c$6_print_exception));
- frame.setlocal("format_exception", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$7_format_exception));
- frame.setlocal("format_exception_only", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_format_exception_only));
- frame.setlocal("_some_str", new PyFunction(frame.f_globals, new PyObject[] {}, c$9__some_str));
- frame.setlocal("print_exc", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), frame.getname("None")}, c$10_print_exc));
- frame.setlocal("print_last", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), frame.getname("None")}, c$11_print_last));
- frame.setlocal("print_stack", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), frame.getname("None"), frame.getname("None")}, c$12_print_stack));
- frame.setlocal("format_stack", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), frame.getname("None")}, c$13_format_stack));
- frame.setlocal("extract_stack", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), frame.getname("None")}, c$14_extract_stack));
- frame.setlocal("tb_lineno", new PyFunction(frame.f_globals, new PyObject[] {}, c$15_tb_lineno));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("traceback"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "traceback";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(traceback._PyInner.class, newargs, traceback.jpy$packages, traceback.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class util extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject i$1;
- private static PyObject i$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject s$5;
- private static PyObject s$6;
- private static PyFunctionTable funcTable;
- private static PyCode c$0_lookup;
- private static PyCode c$1_getzip;
- private static PyCode c$2_closezips;
- private static PyCode c$3_findClass;
- private static PyCode c$4_reportPublicPlainClasses;
- private static PyCode c$5_openResource;
- private static PyCode c$6_listAllClasses;
- private static PyCode c$7_main;
- private static void initConstants() {
- s$0 = Py.newString(".");
- i$1 = Py.newInteger(0);
- i$2 = Py.newInteger(1);
- s$3 = Py.newString("java class");
- s$4 = Py.newString("__name__");
- s$5 = Py.newString(",");
- s$6 = Py.newString("/usr/share/jython/Tools/jythonc/util.py");
- funcTable = new _PyInner();
- c$0_lookup = Py.newCode(1, new String[] {"name", "top", "names"}, "/usr/share/jython/Tools/jythonc/util.py", "lookup", false, false, funcTable, 0, null, null, 0, 1);
- c$1_getzip = Py.newCode(1, new String[] {"filename", "zipfile"}, "/usr/share/jython/Tools/jythonc/util.py", "getzip", false, false, funcTable, 1, null, null, 0, 1);
- c$2_closezips = Py.newCode(0, new String[] {"zf"}, "/usr/share/jython/Tools/jythonc/util.py", "closezips", false, false, funcTable, 2, null, null, 0, 1);
- c$3_findClass = Py.newCode(1, new String[] {"c"}, "/usr/share/jython/Tools/jythonc/util.py", "findClass", false, false, funcTable, 3, null, null, 0, 1);
- c$4_reportPublicPlainClasses = Py.newCode(1, new String[] {"jpkg", "classes"}, "/usr/share/jython/Tools/jythonc/util.py", "reportPublicPlainClasses", false, false, funcTable, 4, null, null, 0, 1);
- c$5_openResource = Py.newCode(1, new String[] {"res"}, "/usr/share/jython/Tools/jythonc/util.py", "openResource", false, false, funcTable, 5, null, null, 0, 1);
- c$6_listAllClasses = Py.newCode(1, new String[] {"jpkg", "classes", "classes2", "pkg2"}, "/usr/share/jython/Tools/jythonc/util.py", "listAllClasses", false, false, funcTable, 6, null, null, 0, 1);
- c$7_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Tools/jythonc/util.py", "main", false, false, funcTable, 7, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$7_main == null) _PyInner.initConstants();
- return c$7_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.lookup$1(frame);
- case 1:
- return _PyInner.getzip$2(frame);
- case 2:
- return _PyInner.closezips$3(frame);
- case 3:
- return _PyInner.findClass$4(frame);
- case 4:
- return _PyInner.reportPublicPlainClasses$5(frame);
- case 5:
- return _PyInner.openResource$6(frame);
- case 6:
- return _PyInner.listAllClasses$7(frame);
- case 7:
- return _PyInner.main$8(frame);
- default:
- return null;
- }
- }
-
- private static PyObject lookup$1(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(2, frame.getlocal(0).invoke("split", s$0));
- frame.setlocal(1, frame.getglobal("__import__").__call__(frame.getlocal(2).__getitem__(i$1)));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(2).__getslice__(i$2, null, null);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(0, t$0$PyObject);
- frame.setlocal(1, frame.getglobal("getattr").__call__(frame.getlocal(1), frame.getlocal(0)));
- }
- return frame.getlocal(1);
- }
-
- private static PyObject getzip$2(PyFrame frame) {
- if (frame.getglobal("zipfiles").invoke("has_key", frame.getlocal(0)).__nonzero__()) {
- return frame.getglobal("zipfiles").__getitem__(frame.getlocal(0));
- }
- frame.setlocal(1, frame.getglobal("ZipFile").__call__(frame.getlocal(0)));
- frame.getglobal("zipfiles").__setitem__(frame.getlocal(0), frame.getlocal(1));
- return frame.getlocal(1);
- }
-
- private static PyObject closezips$3(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- t$0$int = 0;
- t$1$PyObject = frame.getglobal("zipfiles").invoke("values");
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(0, t$0$PyObject);
- frame.getlocal(0).invoke("close");
- }
- frame.getglobal("zipfiles").invoke("clear");
- return Py.None;
- }
-
- private static PyObject findClass$4(PyFrame frame) {
- return frame.getglobal("Py").__getattr__("findClassEx").__call__(frame.getlocal(0), s$3);
- }
-
- private static PyObject reportPublicPlainClasses$5(PyFrame frame) {
- frame.setlocal(1, frame.getglobal("sys").__getattr__("packageManager").__getattr__("doDir").__call__(frame.getlocal(0), i$1, i$2));
- frame.getlocal(1).invoke("remove", s$4);
- return frame.getglobal("string").__getattr__("join").__call__(frame.getlocal(1), s$5);
- }
-
- private static PyObject openResource$6(PyFrame frame) {
- // global _path_vfs
- if (frame.getglobal("_path_vfs").__not__().__nonzero__()) {
- frame.setglobal("_path_vfs", frame.getglobal("PathVFS").__call__(frame.getglobal("sys").__getattr__("registry")));
- }
- return frame.getglobal("_path_vfs").invoke("open", frame.getlocal(0));
- }
-
- private static PyObject listAllClasses$7(PyFrame frame) {
- // global _ypm
- frame.setlocal(1, frame.getglobal("sys").__getattr__("packageManager").__getattr__("doDir").__call__(frame.getlocal(0), i$1, i$2));
- frame.getlocal(1).invoke("remove", s$4);
- if (frame.getglobal("_ypm")._is(frame.getglobal("None")).__nonzero__()) {
- frame.setglobal("_ypm", frame.getglobal("YaPM").__call__(frame.getglobal("sys").__getattr__("registry")));
- }
- frame.setlocal(3, frame.getglobal("_ypm").invoke("lookupName", frame.getlocal(0).__getattr__("__name__")));
- frame.setlocal(2, frame.getglobal("_ypm").invoke("doDir", new PyObject[] {frame.getlocal(3), i$1, i$2}));
- frame.getlocal(2).invoke("remove", s$4);
- frame.getlocal(1).invoke("extend", frame.getlocal(2));
- return frame.getlocal(1);
- }
-
- private static PyObject main$8(PyFrame frame) {
- frame.setglobal("__file__", s$6);
-
- PyObject[] imp_accu;
- // Code
- frame.setlocal("lookup", new PyFunction(frame.f_globals, new PyObject[] {}, c$0_lookup));
- imp_accu = org.python.core.imp.importFrom("java.util.zip", new String[] {"ZipFile"}, frame);
- frame.setlocal("ZipFile", imp_accu[0]);
- imp_accu = null;
- frame.setlocal("zipfiles", new PyDictionary(new PyObject[] {}));
- frame.setlocal("getzip", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_getzip));
- frame.setlocal("closezips", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_closezips));
- frame.setlocal("sys", org.python.core.imp.importOne("sys", frame));
- frame.setlocal("string", org.python.core.imp.importOne("string", frame));
- imp_accu = org.python.core.imp.importFrom("org.python.core", new String[] {"Py"}, frame);
- frame.setlocal("Py", imp_accu[0]);
- imp_accu = null;
- imp_accu = org.python.core.imp.importFrom("yapm", new String[] {"YaPM"}, frame);
- frame.setlocal("YaPM", imp_accu[0]);
- imp_accu = null;
- imp_accu = org.python.core.imp.importFrom("PathVFS", new String[] {"PathVFS"}, frame);
- frame.setlocal("PathVFS", imp_accu[0]);
- imp_accu = null;
- frame.setlocal("findClass", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_findClass));
- frame.setlocal("reportPublicPlainClasses", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_reportPublicPlainClasses));
- frame.setlocal("_path_vfs", frame.getname("None"));
- frame.setlocal("openResource", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_openResource));
- frame.setlocal("_ypm", frame.getname("None"));
- frame.setlocal("listAllClasses", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_listAllClasses));
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("util"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "util";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(util._PyInner.class, newargs, util.jpy$packages, util.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}
+++ /dev/null
-import org.python.core.*;
-
-public class yapm extends java.lang.Object {
- static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
-
- public static class _PyInner extends PyFunctionTable implements PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyObject s$2;
- private static PyObject s$3;
- private static PyObject s$4;
- private static PyObject i$5;
- private static PyObject s$6;
- private static PyObject i$7;
- private static PyObject s$8;
- private static PyFunctionTable funcTable;
- private static PyCode c$0___init__;
- private static PyCode c$1_findClass;
- private static PyCode c$2_findAllPackages;
- private static PyCode c$3_filterByName;
- private static PyCode c$4_filterByAccess;
- private static PyCode c$5_doDir;
- private static PyCode c$6_packageExists;
- private static PyCode c$7_YaPM;
- private static PyCode c$8_main;
- private static void initConstants() {
- s$0 = Py.newString("python.packages.paths");
- s$1 = Py.newString("java.class.path");
- s$2 = Py.newString(",");
- s$3 = Py.newString("sun.boot.class.path");
- s$4 = Py.newString("python.packages.fakepath");
- i$5 = Py.newInteger(0);
- s$6 = Py.newString("$");
- i$7 = Py.newInteger(1);
- s$8 = Py.newString("/usr/share/jython/Tools/jythonc/yapm.py");
- funcTable = new _PyInner();
- c$0___init__ = Py.newCode(2, new String[] {"self", "registry"}, "/usr/share/jython/Tools/jythonc/yapm.py", "__init__", false, false, funcTable, 0, null, null, 0, 1);
- c$1_findClass = Py.newCode(3, new String[] {"self", "pkg", "name"}, "/usr/share/jython/Tools/jythonc/yapm.py", "findClass", false, false, funcTable, 1, null, null, 0, 1);
- c$2_findAllPackages = Py.newCode(2, new String[] {"self", "registry", "e", "p", "fakepath", "paths"}, "/usr/share/jython/Tools/jythonc/yapm.py", "findAllPackages", false, false, funcTable, 2, null, null, 0, 1);
- c$3_filterByName = Py.newCode(3, new String[] {"self", "name", "pkg"}, "/usr/share/jython/Tools/jythonc/yapm.py", "filterByName", false, false, funcTable, 3, null, null, 0, 1);
- c$4_filterByAccess = Py.newCode(3, new String[] {"self", "name", "acc"}, "/usr/share/jython/Tools/jythonc/yapm.py", "filterByAccess", false, false, funcTable, 4, null, null, 0, 1);
- c$5_doDir = Py.newCode(4, new String[] {"self", "jpkg", "instantiate", "exclpkgs", "basic", "ret"}, "/usr/share/jython/Tools/jythonc/yapm.py", "doDir", false, false, funcTable, 5, null, null, 0, 1);
- c$6_packageExists = Py.newCode(3, new String[] {"self", "pkg", "name"}, "/usr/share/jython/Tools/jythonc/yapm.py", "packageExists", false, false, funcTable, 6, null, null, 0, 1);
- c$7_YaPM = Py.newCode(0, new String[] {}, "/usr/share/jython/Tools/jythonc/yapm.py", "YaPM", false, false, funcTable, 7, null, null, 0, 0);
- c$8_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Tools/jythonc/yapm.py", "main", false, false, funcTable, 8, null, null, 0, 0);
- }
-
-
- public PyCode getMain() {
- if (c$8_main == null) _PyInner.initConstants();
- return c$8_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.__init__$1(frame);
- case 1:
- return _PyInner.findClass$2(frame);
- case 2:
- return _PyInner.findAllPackages$3(frame);
- case 3:
- return _PyInner.filterByName$4(frame);
- case 4:
- return _PyInner.filterByAccess$5(frame);
- case 5:
- return _PyInner.doDir$6(frame);
- case 6:
- return _PyInner.packageExists$7(frame);
- case 7:
- return _PyInner.YaPM$8(frame);
- case 8:
- return _PyInner.main$9(frame);
- default:
- return null;
- }
- }
-
- private static PyObject __init__$1(PyFrame frame) {
- frame.getlocal(0).invoke("findAllPackages", frame.getlocal(1));
- return Py.None;
- }
-
- private static PyObject findClass$2(PyFrame frame) {
- return frame.getglobal("None");
- }
-
- private static PyObject findAllPackages$3(PyFrame frame) {
- // Temporary Variables
- int t$0$int;
- PyObject t$0$PyObject, t$1$PyObject;
-
- // Code
- frame.setlocal(5, frame.getlocal(1).invoke("getProperty", s$0, s$1));
- frame.setlocal(5, frame.getlocal(5).invoke("split", s$2));
- if (s$3._in(frame.getlocal(5)).__nonzero__()) {
- frame.getlocal(5).invoke("remove", s$3);
- }
- frame.setlocal(4, frame.getlocal(1).invoke("getProperty", s$4, frame.getglobal("None")));
- t$0$int = 0;
- t$1$PyObject = frame.getlocal(5);
- while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
- frame.setlocal(3, t$0$PyObject);
- frame.setlocal(2, frame.getlocal(1).invoke("getProperty", frame.getlocal(3)));
- if (frame.getlocal(2)._ne(frame.getglobal("None")).__nonzero__()) {
- frame.getlocal(0).invoke("addClassPath", frame.getlocal(2));
- }
- }
- if (frame.getlocal(4)._ne(frame.getglobal("None")).__nonzero__()) {
- frame.getlocal(0).invoke("addClassPath", frame.getlocal(4));
- }
- return Py.None;
- }
-
- private static PyObject filterByName$4(PyFrame frame) {
- return i$5;
- }
-
- private static PyObject filterByAccess$5(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- return ((t$0$PyObject = frame.getlocal(1).invoke("find", s$6)._ne(i$7.__neg__())).__nonzero__() ? t$0$PyObject : frame.getlocal(2)._and(i$7)._eq(i$5)).__not__();
- }
-
- private static PyObject doDir$6(PyFrame frame) {
- frame.setlocal(4, frame.getlocal(0).invoke("basicDoDir", new PyObject[] {frame.getlocal(1), i$5, frame.getlocal(3)}));
- frame.setlocal(5, new PyList(new PyObject[] {}));
- frame.getlocal(0).invoke("super__doDir", new PyObject[] {frame.getlocal(0).__getattr__("searchPath"), frame.getlocal(5), frame.getlocal(1), i$5, frame.getlocal(3)});
- frame.getlocal(0).invoke("super__doDir", new PyObject[] {frame.getglobal("sys").__getattr__("path"), frame.getlocal(5), frame.getlocal(1), i$5, frame.getlocal(3)});
- return frame.getlocal(0).invoke("merge", frame.getlocal(4), frame.getlocal(5));
- }
-
- private static PyObject packageExists$7(PyFrame frame) {
- // Temporary Variables
- PyObject t$0$PyObject;
-
- // Code
- return (t$0$PyObject = frame.getlocal(0).invoke("super__packageExists", new PyObject[] {frame.getlocal(0).__getattr__("searchPath"), frame.getlocal(1), frame.getlocal(2)})).__nonzero__() ? t$0$PyObject : frame.getlocal(0).invoke("super__packageExists", new PyObject[] {frame.getglobal("sys").__getattr__("path"), frame.getlocal(1), frame.getlocal(2)});
- }
-
- private static PyObject YaPM$8(PyFrame frame) {
- frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$0___init__));
- frame.setlocal("findClass", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_findClass));
- frame.setlocal("findAllPackages", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_findAllPackages));
- frame.setlocal("filterByName", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_filterByName));
- frame.setlocal("filterByAccess", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_filterByAccess));
- frame.setlocal("doDir", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_doDir));
- frame.setlocal("packageExists", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_packageExists));
- return frame.getf_locals();
- }
-
- private static PyObject main$9(PyFrame frame) {
- frame.setglobal("__file__", s$8);
-
- PyObject[] imp_accu;
- // Code
- frame.setlocal("sys", org.python.core.imp.importOne("sys", frame));
- frame.setlocal("os", org.python.core.imp.importOne("os", frame));
- imp_accu = org.python.core.imp.importFrom("string", new String[] {"strip"}, frame);
- frame.setlocal("strip", imp_accu[0]);
- imp_accu = null;
- imp_accu = org.python.core.imp.importFrom("java", new String[] {"io"}, frame);
- frame.setlocal("io", imp_accu[0]);
- imp_accu = null;
- imp_accu = org.python.core.imp.importFrom("org.python.core", new String[] {"PathPackageManager"}, frame);
- frame.setlocal("PathPackageManager", imp_accu[0]);
- imp_accu = null;
- frame.setlocal("YaPM", Py.makeClass("YaPM", new PyObject[] {frame.getname("PathPackageManager")}, c$7_YaPM, null, YaPM.class));
- return Py.None;
- }
-
- }
- public static class YaPM extends org.python.core.PathPackageManager implements org.python.core.PyProxy, org.python.core.ClassDictInit {
- public void addJar(java.lang.String arg0, boolean arg1) {
- PyObject inst = Py.jgetattr(this, "addJar");
- inst._jcall(new Object[] {arg0, Py.newBoolean(arg1)});
- }
-
- public void addJarDir(java.lang.String arg0, boolean arg1) {
- PyObject inst = Py.jgetattr(this, "addJarDir");
- inst._jcall(new Object[] {arg0, Py.newBoolean(arg1)});
- }
-
- public org.python.core.PyList basicDoDir(org.python.core.PyJavaPackage arg0, boolean arg1, boolean arg2) {
- return super.basicDoDir(arg0, arg1, arg2);
- }
-
- public java.lang.Object clone() throws java.lang.CloneNotSupportedException {
- return super.clone();
- }
-
- public void comment(java.lang.String arg0) {
- super.comment(arg0);
- }
-
- public void debug(java.lang.String arg0) {
- super.debug(arg0);
- }
-
- public void deleteCacheFile(java.lang.String arg0) {
- super.deleteCacheFile(arg0);
- }
-
- public void super__doDir(org.python.core.PyList arg0, org.python.core.PyList arg1, org.python.core.PyJavaPackage arg2, boolean arg3, boolean arg4) {
- super.doDir(arg0, arg1, arg2, arg3, arg4);
- }
-
- public void doDir(org.python.core.PyList arg0, org.python.core.PyList arg1, org.python.core.PyJavaPackage arg2, boolean arg3, boolean arg4) {
- PyObject inst = Py.jfindattr(this, "doDir");
- if (inst != null) inst._jcall(new Object[] {arg0, arg1, arg2, Py.newBoolean(arg3), Py.newBoolean(arg4)});
- else super.doDir(arg0, arg1, arg2, arg3, arg4);
- }
-
- public org.python.core.PyList super__doDir(org.python.core.PyJavaPackage arg0, boolean arg1, boolean arg2) {
- return super.doDir(arg0, arg1, arg2);
- }
-
- public org.python.core.PyList doDir(org.python.core.PyJavaPackage arg0, boolean arg1, boolean arg2) {
- PyObject inst = Py.jfindattr(this, "doDir");
- if (inst != null) return (org.python.core.PyList)Py.tojava(inst._jcall(new Object[] {arg0, Py.newBoolean(arg1), Py.newBoolean(arg2)}), org.python.core.PyList.class);
- else return super.doDir(arg0, arg1, arg2);
- }
-
- public boolean super__filterByAccess(java.lang.String arg0, int arg1) {
- return super.filterByAccess(arg0, arg1);
- }
-
- public boolean filterByAccess(java.lang.String arg0, int arg1) {
- PyObject inst = Py.jfindattr(this, "filterByAccess");
- if (inst != null) return Py.py2boolean(inst._jcall(new Object[] {arg0, Py.newInteger(arg1)}));
- else return super.filterByAccess(arg0, arg1);
- }
-
- public boolean super__filterByName(java.lang.String arg0, boolean arg1) {
- return super.filterByName(arg0, arg1);
- }
-
- public boolean filterByName(java.lang.String arg0, boolean arg1) {
- PyObject inst = Py.jfindattr(this, "filterByName");
- if (inst != null) return Py.py2boolean(inst._jcall(new Object[] {arg0, Py.newBoolean(arg1)}));
- else return super.filterByName(arg0, arg1);
- }
-
- public void finalize() throws java.lang.Throwable {
- super.finalize();
- }
-
- public java.lang.Class super__findClass(java.lang.String arg0, java.lang.String arg1) {
- return super.findClass(arg0, arg1);
- }
-
- public java.lang.Class findClass(java.lang.String arg0, java.lang.String arg1) {
- PyObject inst = Py.jfindattr(this, "findClass");
- if (inst != null) return (java.lang.Class)Py.tojava(inst._jcall(new Object[] {arg0, arg1}), java.lang.Class.class);
- else return super.findClass(arg0, arg1);
- }
-
- public java.lang.Class findClass(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2) {
- PyObject inst = Py.jgetattr(this, "findClass");
- return (java.lang.Class)Py.tojava(inst._jcall(new Object[] {arg0, arg1, arg2}), java.lang.Class.class);
- }
-
- public java.io.DataInputStream inOpenCacheFile(java.lang.String arg0) throws java.io.IOException {
- return super.inOpenCacheFile(arg0);
- }
-
- public java.io.DataInputStream inOpenIndex() throws java.io.IOException {
- return super.inOpenIndex();
- }
-
- public void initCache() {
- super.initCache();
- }
-
- public org.python.core.PyList merge(org.python.core.PyList arg0, org.python.core.PyList arg1) {
- return super.merge(arg0, arg1);
- }
-
- public void message(java.lang.String arg0) {
- super.message(arg0);
- }
-
- public java.io.DataOutputStream outCreateCacheFile(org.python.core.CachedJarsPackageManager.JarXEntry arg0, boolean arg1) throws java.io.IOException {
- return super.outCreateCacheFile(arg0, arg1);
- }
-
- public java.io.DataOutputStream outOpenIndex() throws java.io.IOException {
- return super.outOpenIndex();
- }
-
- public boolean super__packageExists(java.lang.String arg0, java.lang.String arg1) {
- return super.packageExists(arg0, arg1);
- }
-
- public boolean packageExists(java.lang.String arg0, java.lang.String arg1) {
- PyObject inst = Py.jfindattr(this, "packageExists");
- if (inst != null) return Py.py2boolean(inst._jcall(new Object[] {arg0, arg1}));
- else return super.packageExists(arg0, arg1);
- }
-
- public boolean super__packageExists(org.python.core.PyList arg0, java.lang.String arg1, java.lang.String arg2) {
- return super.packageExists(arg0, arg1, arg2);
- }
-
- public boolean packageExists(org.python.core.PyList arg0, java.lang.String arg1, java.lang.String arg2) {
- PyObject inst = Py.jfindattr(this, "packageExists");
- if (inst != null) return Py.py2boolean(inst._jcall(new Object[] {arg0, arg1, arg2}));
- else return super.packageExists(arg0, arg1, arg2);
- }
-
- public boolean useCacheDir(java.io.File arg0) {
- return super.useCacheDir(arg0);
- }
-
- public void warning(java.lang.String arg0) {
- super.warning(arg0);
- }
-
- public YaPM() {
- super();
- __initProxy__(new Object[] {});
- }
-
- private PyInstance __proxy;
- public void _setPyInstance(PyInstance inst) {
- __proxy = inst;
- }
-
- public PyInstance _getPyInstance() {
- return __proxy;
- }
-
- private PySystemState __sysstate;
- public void _setPySystemState(PySystemState inst) {
- __sysstate = inst;
- }
-
- public PySystemState _getPySystemState() {
- return __sysstate;
- }
-
- public void __initProxy__(Object[] args) {
- Py.initProxy(this, "yapm", "YaPM", args, yapm.jpy$packages, yapm.jpy$proxyProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
- static public void classDictInit(PyObject dict) {
- dict.__setitem__("__supernames__", Py.java2py(new String[] {"deleteCacheFile", "finalize", "super__doDir", "comment", "super__filterByAccess", "initCache", "outCreateCacheFile", "merge", "super__filterByName", "useCacheDir", "message", "super__packageExists", "debug", "inOpenIndex", "warning", "super__findClass", "clone", "outOpenIndex", "basicDoDir", "inOpenCacheFile"}));
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("yapm"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "yapm";
- System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(yapm._PyInner.class, newargs, yapm.jpy$packages, yapm.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});
- }
-
-}