(no commit message)
[sfa.git] / server / jpywork / repr.java
1 import org.python.core.*;
2
3 public class repr extends java.lang.Object {
4     static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
5     static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
6     static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
7     
8     public static class _PyInner extends PyFunctionTable implements PyRunnable {
9         private static PyObject s$0;
10         private static PyObject s$1;
11         private static PyObject s$2;
12         private static PyObject i$3;
13         private static PyObject i$4;
14         private static PyObject i$5;
15         private static PyObject i$6;
16         private static PyObject i$7;
17         private static PyObject i$8;
18         private static PyObject i$9;
19         private static PyObject s$10;
20         private static PyObject s$11;
21         private static PyObject s$12;
22         private static PyObject i$13;
23         private static PyObject i$14;
24         private static PyObject s$15;
25         private static PyObject s$16;
26         private static PyObject s$17;
27         private static PyObject s$18;
28         private static PyObject s$19;
29         private static PyObject i$20;
30         private static PyObject s$21;
31         private static PyObject s$22;
32         private static PyObject s$23;
33         private static PyObject s$24;
34         private static PyObject s$25;
35         private static PyObject s$26;
36         private static PyObject s$27;
37         private static PyObject s$28;
38         private static PyObject s$29;
39         private static PyObject s$30;
40         private static PyObject s$31;
41         private static PyObject s$32;
42         private static PyObject s$33;
43         private static PyObject s$34;
44         private static PyObject s$35;
45         private static PyObject s$36;
46         private static PyObject s$37;
47         private static PyFunctionTable funcTable;
48         private static PyCode c$0___init__;
49         private static PyCode c$1_repr;
50         private static PyCode c$2_repr1;
51         private static PyCode c$3_repr_tuple;
52         private static PyCode c$4_repr_list;
53         private static PyCode c$5_repr_dictionary;
54         private static PyCode c$6_repr_string;
55         private static PyCode c$7_repr_long_int;
56         private static PyCode c$8_repr_instance;
57         private static PyCode c$9_Repr;
58         private static PyCode c$10_main;
59         private static void initConstants() {
60             s$0 = Py.newString("Redo the `...` (representation) but with limits on most sizes.");
61             s$1 = Py.newString("Repr");
62             s$2 = Py.newString("repr");
63             i$3 = Py.newInteger(6);
64             i$4 = Py.newInteger(4);
65             i$5 = Py.newInteger(30);
66             i$6 = Py.newInteger(40);
67             i$7 = Py.newInteger(20);
68             i$8 = Py.newInteger(7);
69             i$9 = Py.newInteger(2);
70             s$10 = Py.newString(" ");
71             s$11 = Py.newString("_");
72             s$12 = Py.newString("repr_");
73             i$13 = Py.newInteger(0);
74             i$14 = Py.newInteger(3);
75             s$15 = Py.newString("...");
76             s$16 = Py.newString("()");
77             s$17 = Py.newString("(...)");
78             s$18 = Py.newString("");
79             s$19 = Py.newString(", ");
80             i$20 = Py.newInteger(1);
81             s$21 = Py.newString(", ...");
82             s$22 = Py.newString(",");
83             s$23 = Py.newString("(");
84             s$24 = Py.newString(")");
85             s$25 = Py.newString("[]");
86             s$26 = Py.newString("[...]");
87             s$27 = Py.newString("[");
88             s$28 = Py.newString("]");
89             s$29 = Py.newString("{}");
90             s$30 = Py.newString("{...}");
91             s$31 = Py.newString(": ");
92             s$32 = Py.newString("{");
93             s$33 = Py.newString("}");
94             s$34 = Py.newString("<");
95             s$35 = Py.newString(" instance at ");
96             s$36 = Py.newString(">");
97             s$37 = Py.newString("/usr/share/jython/Lib-cpython/repr.py");
98             funcTable = new _PyInner();
99             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);
100             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);
101             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);
102             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);
103             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);
104             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);
105             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);
106             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);
107             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);
108             c$9_Repr = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/repr.py", "Repr", false, false, funcTable, 9, null, null, 0, 0);
109             c$10_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/repr.py", "main", false, false, funcTable, 10, null, null, 0, 0);
110         }
111         
112         
113         public PyCode getMain() {
114             if (c$10_main == null) _PyInner.initConstants();
115             return c$10_main;
116         }
117         
118         public PyObject call_function(int index, PyFrame frame) {
119             switch (index){
120                 case 0:
121                 return _PyInner.__init__$1(frame);
122                 case 1:
123                 return _PyInner.repr$2(frame);
124                 case 2:
125                 return _PyInner.repr1$3(frame);
126                 case 3:
127                 return _PyInner.repr_tuple$4(frame);
128                 case 4:
129                 return _PyInner.repr_list$5(frame);
130                 case 5:
131                 return _PyInner.repr_dictionary$6(frame);
132                 case 6:
133                 return _PyInner.repr_string$7(frame);
134                 case 7:
135                 return _PyInner.repr_long_int$8(frame);
136                 case 8:
137                 return _PyInner.repr_instance$9(frame);
138                 case 9:
139                 return _PyInner.Repr$10(frame);
140                 case 10:
141                 return _PyInner.main$11(frame);
142                 default:
143                 return null;
144             }
145         }
146         
147         private static PyObject __init__$1(PyFrame frame) {
148             frame.getlocal(0).__setattr__("maxlevel", i$3);
149             frame.getlocal(0).__setattr__("maxtuple", i$3);
150             frame.getlocal(0).__setattr__("maxlist", i$3);
151             frame.getlocal(0).__setattr__("maxdict", i$4);
152             frame.getlocal(0).__setattr__("maxstring", i$5);
153             frame.getlocal(0).__setattr__("maxlong", i$6);
154             frame.getlocal(0).__setattr__("maxother", i$7);
155             return Py.None;
156         }
157         
158         private static PyObject repr$2(PyFrame frame) {
159             return frame.getlocal(0).invoke("repr1", frame.getlocal(1), frame.getlocal(0).__getattr__("maxlevel"));
160         }
161         
162         private static PyObject repr1$3(PyFrame frame) {
163             frame.setlocal(6, frame.getglobal("type").__call__(frame.getlocal(1)).__repr__().__getslice__(i$8, i$9.__neg__(), null));
164             if (s$10._in(frame.getlocal(6)).__nonzero__()) {
165                 frame.setlocal(4, frame.getlocal(6).invoke("split"));
166                 frame.setlocal(6, s$11.invoke("join", frame.getlocal(4)));
167             }
168             if (frame.getglobal("hasattr").__call__(frame.getlocal(0), s$12._add(frame.getlocal(6))).__nonzero__()) {
169                 return frame.getglobal("getattr").__call__(frame.getlocal(0), s$12._add(frame.getlocal(6))).__call__(frame.getlocal(1), frame.getlocal(2));
170             }
171             else {
172                 frame.setlocal(7, frame.getlocal(1).__repr__());
173                 if (frame.getglobal("len").__call__(frame.getlocal(7))._gt(frame.getlocal(0).__getattr__("maxother")).__nonzero__()) {
174                     frame.setlocal(5, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxother")._sub(i$14)._div(i$9)));
175                     frame.setlocal(3, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxother")._sub(i$14)._sub(frame.getlocal(5))));
176                     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)));
177                 }
178                 return frame.getlocal(7);
179             }
180         }
181         
182         private static PyObject repr_tuple$4(PyFrame frame) {
183             // Temporary Variables
184             int t$0$int;
185             PyObject t$0$PyObject, t$1$PyObject;
186             
187             // Code
188             frame.setlocal(3, frame.getglobal("len").__call__(frame.getlocal(1)));
189             if (frame.getlocal(3)._eq(i$13).__nonzero__()) {
190                 return s$16;
191             }
192             if (frame.getlocal(2)._le(i$13).__nonzero__()) {
193                 return s$17;
194             }
195             frame.setlocal(5, s$18);
196             t$0$int = 0;
197             t$1$PyObject = frame.getglobal("range").__call__(frame.getglobal("min").__call__(frame.getlocal(3), frame.getlocal(0).__getattr__("maxtuple")));
198             while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
199                 frame.setlocal(4, t$0$PyObject);
200                 if (frame.getlocal(5).__nonzero__()) {
201                     frame.setlocal(5, frame.getlocal(5)._add(s$19));
202                 }
203                 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))));
204             }
205             if (frame.getlocal(3)._gt(frame.getlocal(0).__getattr__("maxtuple")).__nonzero__()) {
206                 frame.setlocal(5, frame.getlocal(5)._add(s$21));
207             }
208             else if (frame.getlocal(3)._eq(i$20).__nonzero__()) {
209                 frame.setlocal(5, frame.getlocal(5)._add(s$22));
210             }
211             return s$23._add(frame.getlocal(5))._add(s$24);
212         }
213         
214         private static PyObject repr_list$5(PyFrame frame) {
215             // Temporary Variables
216             int t$0$int;
217             PyObject t$0$PyObject, t$1$PyObject;
218             
219             // Code
220             frame.setlocal(3, frame.getglobal("len").__call__(frame.getlocal(1)));
221             if (frame.getlocal(3)._eq(i$13).__nonzero__()) {
222                 return s$25;
223             }
224             if (frame.getlocal(2)._le(i$13).__nonzero__()) {
225                 return s$26;
226             }
227             frame.setlocal(5, s$18);
228             t$0$int = 0;
229             t$1$PyObject = frame.getglobal("range").__call__(frame.getglobal("min").__call__(frame.getlocal(3), frame.getlocal(0).__getattr__("maxlist")));
230             while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
231                 frame.setlocal(4, t$0$PyObject);
232                 if (frame.getlocal(5).__nonzero__()) {
233                     frame.setlocal(5, frame.getlocal(5)._add(s$19));
234                 }
235                 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))));
236             }
237             if (frame.getlocal(3)._gt(frame.getlocal(0).__getattr__("maxlist")).__nonzero__()) {
238                 frame.setlocal(5, frame.getlocal(5)._add(s$21));
239             }
240             return s$27._add(frame.getlocal(5))._add(s$28);
241         }
242         
243         private static PyObject repr_dictionary$6(PyFrame frame) {
244             // Temporary Variables
245             int t$0$int;
246             PyObject t$0$PyObject, t$1$PyObject;
247             
248             // Code
249             frame.setlocal(3, frame.getglobal("len").__call__(frame.getlocal(1)));
250             if (frame.getlocal(3)._eq(i$13).__nonzero__()) {
251                 return s$29;
252             }
253             if (frame.getlocal(2)._le(i$13).__nonzero__()) {
254                 return s$30;
255             }
256             frame.setlocal(7, s$18);
257             frame.setlocal(6, frame.getlocal(1).invoke("keys"));
258             frame.getlocal(6).invoke("sort");
259             t$0$int = 0;
260             t$1$PyObject = frame.getglobal("range").__call__(frame.getglobal("min").__call__(frame.getlocal(3), frame.getlocal(0).__getattr__("maxdict")));
261             while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
262                 frame.setlocal(4, t$0$PyObject);
263                 if (frame.getlocal(7).__nonzero__()) {
264                     frame.setlocal(7, frame.getlocal(7)._add(s$19));
265                 }
266                 frame.setlocal(5, frame.getlocal(6).__getitem__(frame.getlocal(4)));
267                 frame.setlocal(7, frame.getlocal(7)._add(frame.getlocal(0).invoke("repr1", frame.getlocal(5), frame.getlocal(2)._sub(i$20))));
268                 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))));
269             }
270             if (frame.getlocal(3)._gt(frame.getlocal(0).__getattr__("maxdict")).__nonzero__()) {
271                 frame.setlocal(7, frame.getlocal(7)._add(s$21));
272             }
273             return s$32._add(frame.getlocal(7))._add(s$33);
274         }
275         
276         private static PyObject repr_string$7(PyFrame frame) {
277             frame.setlocal(5, frame.getlocal(1).__getslice__(null, frame.getlocal(0).__getattr__("maxstring"), null).__repr__());
278             if (frame.getglobal("len").__call__(frame.getlocal(5))._gt(frame.getlocal(0).__getattr__("maxstring")).__nonzero__()) {
279                 frame.setlocal(4, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxstring")._sub(i$14)._div(i$9)));
280                 frame.setlocal(3, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxstring")._sub(i$14)._sub(frame.getlocal(4))));
281                 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__());
282                 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)));
283             }
284             return frame.getlocal(5);
285         }
286         
287         private static PyObject repr_long_int$8(PyFrame frame) {
288             frame.setlocal(5, frame.getlocal(1).__repr__());
289             if (frame.getglobal("len").__call__(frame.getlocal(5))._gt(frame.getlocal(0).__getattr__("maxlong")).__nonzero__()) {
290                 frame.setlocal(4, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxlong")._sub(i$14)._div(i$9)));
291                 frame.setlocal(3, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxlong")._sub(i$14)._sub(frame.getlocal(4))));
292                 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)));
293             }
294             return frame.getlocal(5);
295         }
296         
297         private static PyObject repr_instance$9(PyFrame frame) {
298             // Temporary Variables
299             PyException t$0$PyException;
300             
301             // Code
302             try {
303                 frame.setlocal(5, frame.getlocal(1).__repr__());
304             }
305             catch (Throwable x$0) {
306                 t$0$PyException = Py.setException(x$0, frame);
307                 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);
308             }
309             if (frame.getglobal("len").__call__(frame.getlocal(5))._gt(frame.getlocal(0).__getattr__("maxstring")).__nonzero__()) {
310                 frame.setlocal(4, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxstring")._sub(i$14)._div(i$9)));
311                 frame.setlocal(3, frame.getglobal("max").__call__(i$13, frame.getlocal(0).__getattr__("maxstring")._sub(i$14)._sub(frame.getlocal(4))));
312                 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)));
313             }
314             return frame.getlocal(5);
315         }
316         
317         private static PyObject Repr$10(PyFrame frame) {
318             frame.setlocal("__init__", new PyFunction(frame.f_globals, new PyObject[] {}, c$0___init__));
319             frame.setlocal("repr", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_repr));
320             frame.setlocal("repr1", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_repr1));
321             frame.setlocal("repr_tuple", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_repr_tuple));
322             frame.setlocal("repr_list", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_repr_list));
323             frame.setlocal("repr_dictionary", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_repr_dictionary));
324             frame.setlocal("repr_string", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_repr_string));
325             frame.setlocal("repr_long_int", new PyFunction(frame.f_globals, new PyObject[] {}, c$7_repr_long_int));
326             frame.setlocal("repr_instance", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_repr_instance));
327             return frame.getf_locals();
328         }
329         
330         private static PyObject main$11(PyFrame frame) {
331             frame.setglobal("__file__", s$37);
332             
333             /* Redo the `...` (representation) but with limits on most sizes. */
334             frame.setlocal("__all__", new PyList(new PyObject[] {s$1, s$2}));
335             frame.setlocal("Repr", Py.makeClass("Repr", new PyObject[] {}, c$9_Repr, null));
336             frame.setlocal("aRepr", frame.getname("Repr").__call__());
337             frame.setlocal("repr", frame.getname("aRepr").__getattr__("repr"));
338             return Py.None;
339         }
340         
341     }
342     public static void moduleDictInit(PyObject dict) {
343         dict.__setitem__("__name__", new PyString("repr"));
344         Py.runCode(new _PyInner().getMain(), dict, dict);
345     }
346     
347     public static void main(String[] args) throws java.lang.Exception {
348         String[] newargs = new String[args.length+1];
349         newargs[0] = "repr";
350         System.arraycopy(args, 0, newargs, 1, args.length);
351         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"});
352     }
353     
354 }