1 import org.python.core.*;
3 public class string 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};
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 s$3;
13 private static PyObject s$4;
14 private static PyObject s$5;
15 private static PyObject s$6;
16 private static PyObject s$7;
17 private static PyObject s$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 s$13;
23 private static PyObject s$14;
24 private static PyObject s$15;
25 private static PyObject s$16;
26 private static PyObject i$17;
27 private static PyObject s$18;
28 private static PyObject s$19;
29 private static PyObject s$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 i$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 i$34;
44 private static PyObject s$35;
45 private static PyObject s$36;
46 private static PyObject s$37;
47 private static PyObject s$38;
48 private static PyObject s$39;
49 private static PyObject s$40;
50 private static PyObject s$41;
51 private static PyObject i$42;
52 private static PyObject s$43;
53 private static PyObject s$44;
54 private static PyObject s$45;
55 private static PyObject s$46;
56 private static PyObject s$47;
57 private static PyObject s$48;
58 private static PyObject s$49;
59 private static PyFunctionTable funcTable;
60 private static PyCode c$0_lower;
61 private static PyCode c$1_upper;
62 private static PyCode c$2_swapcase;
63 private static PyCode c$3_strip;
64 private static PyCode c$4_lstrip;
65 private static PyCode c$5_rstrip;
66 private static PyCode c$6_split;
67 private static PyCode c$7_join;
68 private static PyCode c$8_index;
69 private static PyCode c$9_rindex;
70 private static PyCode c$10_count;
71 private static PyCode c$11_find;
72 private static PyCode c$12_rfind;
73 private static PyCode c$13_atof;
74 private static PyCode c$14_atoi;
75 private static PyCode c$15_atol;
76 private static PyCode c$16_ljust;
77 private static PyCode c$17_rjust;
78 private static PyCode c$18_center;
79 private static PyCode c$19_zfill;
80 private static PyCode c$20_expandtabs;
81 private static PyCode c$21_translate;
82 private static PyCode c$22_capitalize;
83 private static PyCode c$23_capwords;
84 private static PyCode c$24_maketrans;
85 private static PyCode c$25_replace;
86 private static PyCode c$26_main;
87 private static void initConstants() {
88 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");
89 s$1 = Py.newString(" \011\012\015\013\014");
90 s$2 = Py.newString("abcdefghijklmnopqrstuvwxyz");
91 s$3 = Py.newString("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
92 s$4 = Py.newString("0123456789");
93 s$5 = Py.newString("abcdef");
94 s$6 = Py.newString("ABCDEF");
95 s$7 = Py.newString("01234567");
96 s$8 = Py.newString("");
97 i$9 = Py.newInteger(256);
98 s$10 = Py.newString("lower(s) -> string\012\012 Return a copy of the string s converted to lowercase.\012\012 ");
99 s$11 = Py.newString("upper(s) -> string\012\012 Return a copy of the string s converted to uppercase.\012\012 ");
100 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 ");
101 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 ");
102 s$14 = Py.newString("lstrip(s) -> string\012\012 Return a copy of the string s with leading whitespace removed.\012\012 ");
103 s$15 = Py.newString("rstrip(s) -> string\012\012 Return a copy of the string s with trailing whitespace\012 removed.\012\012 ");
104 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 ");
105 i$17 = Py.newInteger(1);
106 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 ");
107 s$19 = Py.newString(" ");
108 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 ");
109 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 ");
110 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 ");
111 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 ");
112 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 ");
113 s$25 = Py.newString("atof(s) -> float\012\012 Return the floating point number represented by the string s.\012\012 ");
114 s$26 = Py.newString("argument 1: expected string, %s found");
115 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 ");
116 i$28 = Py.newInteger(0);
117 s$29 = Py.newString("function requires at least 1 argument: %d given");
118 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 ");
119 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 ");
120 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 ");
121 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 ");
122 i$34 = Py.newInteger(2);
123 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 ");
124 s$36 = Py.newString("-");
125 s$37 = Py.newString("+");
126 s$38 = Py.newString("0");
127 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 ");
128 s$40 = Py.newString("\011");
129 s$41 = Py.newString("\012");
130 i$42 = Py.newInteger(8);
131 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 ");
132 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 ");
133 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 ");
134 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 ");
135 s$47 = Py.newString("maketrans arguments must have same length");
136 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 ");
137 s$49 = Py.newString("/usr/share/jython/Lib/string.py");
138 funcTable = new _PyInner();
139 c$0_lower = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "lower", false, false, funcTable, 0, null, null, 0, 1);
140 c$1_upper = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "upper", false, false, funcTable, 1, null, null, 0, 1);
141 c$2_swapcase = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "swapcase", false, false, funcTable, 2, null, null, 0, 1);
142 c$3_strip = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "strip", false, false, funcTable, 3, null, null, 0, 1);
143 c$4_lstrip = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "lstrip", false, false, funcTable, 4, null, null, 0, 1);
144 c$5_rstrip = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "rstrip", false, false, funcTable, 5, null, null, 0, 1);
145 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);
146 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);
147 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);
148 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);
149 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);
150 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);
151 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);
152 c$13_atof = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "atof", false, false, funcTable, 13, null, null, 0, 1);
153 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);
154 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);
155 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);
156 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);
157 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);
158 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);
159 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);
160 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);
161 c$22_capitalize = Py.newCode(1, new String[] {"s"}, "/usr/share/jython/Lib/string.py", "capitalize", false, false, funcTable, 22, null, null, 0, 1);
162 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);
163 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);
164 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);
165 c$26_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib/string.py", "main", false, false, funcTable, 26, null, null, 0, 0);
169 public PyCode getMain() {
170 if (c$26_main == null) _PyInner.initConstants();
174 public PyObject call_function(int index, PyFrame frame) {
177 return _PyInner.lower$1(frame);
179 return _PyInner.upper$2(frame);
181 return _PyInner.swapcase$3(frame);
183 return _PyInner.strip$4(frame);
185 return _PyInner.lstrip$5(frame);
187 return _PyInner.rstrip$6(frame);
189 return _PyInner.split$7(frame);
191 return _PyInner.join$8(frame);
193 return _PyInner.index$9(frame);
195 return _PyInner.rindex$10(frame);
197 return _PyInner.count$11(frame);
199 return _PyInner.find$12(frame);
201 return _PyInner.rfind$13(frame);
203 return _PyInner.atof$14(frame);
205 return _PyInner.atoi$15(frame);
207 return _PyInner.atol$16(frame);
209 return _PyInner.ljust$17(frame);
211 return _PyInner.rjust$18(frame);
213 return _PyInner.center$19(frame);
215 return _PyInner.zfill$20(frame);
217 return _PyInner.expandtabs$21(frame);
219 return _PyInner.translate$22(frame);
221 return _PyInner.capitalize$23(frame);
223 return _PyInner.capwords$24(frame);
225 return _PyInner.maketrans$25(frame);
227 return _PyInner.replace$26(frame);
229 return _PyInner.main$27(frame);
235 private static PyObject lower$1(PyFrame frame) {
236 /* lower(s) -> string
238 Return a copy of the string s converted to lowercase.
241 return frame.getlocal(0).invoke("lower");
244 private static PyObject upper$2(PyFrame frame) {
245 /* upper(s) -> string
247 Return a copy of the string s converted to uppercase.
250 return frame.getlocal(0).invoke("upper");
253 private static PyObject swapcase$3(PyFrame frame) {
254 /* swapcase(s) -> string
256 Return a copy of the string s with upper case characters
257 converted to lowercase and vice versa.
260 return frame.getlocal(0).invoke("swapcase");
263 private static PyObject strip$4(PyFrame frame) {
264 /* strip(s) -> string
266 Return a copy of the string s with leading and trailing
270 return frame.getlocal(0).invoke("strip");
273 private static PyObject lstrip$5(PyFrame frame) {
274 /* lstrip(s) -> string
276 Return a copy of the string s with leading whitespace removed.
279 return frame.getlocal(0).invoke("lstrip");
282 private static PyObject rstrip$6(PyFrame frame) {
283 /* rstrip(s) -> string
285 Return a copy of the string s with trailing whitespace
289 return frame.getlocal(0).invoke("rstrip");
292 private static PyObject split$7(PyFrame frame) {
293 /* split(str [,sep [,maxsplit]]) -> list of strings
295 Return a list of the words in the string s, using sep as the
296 delimiter string. If maxsplit is nonzero, splits into at most
297 maxsplit words If sep is not specified, any whitespace string
298 is a separator. Maxsplit defaults to -1.
300 (split and splitfields are synonymous)
303 return frame.getlocal(0).invoke("split", frame.getlocal(1), frame.getlocal(2));
306 private static PyObject join$8(PyFrame frame) {
307 /* join(list [,sep]) -> string
309 Return a string composed of the words in list, with
310 intervening occurences of sep. The default separator is a
313 (joinfields and join are synonymous)
316 return frame.getlocal(1).invoke("join", frame.getlocal(0));
319 private static PyObject index$9(PyFrame frame) {
320 /* index(s, sub [,start [,end]]) -> int
322 Like find but raises ValueError when the substring is not found.
325 return frame.getglobal("_apply").__call__(frame.getlocal(0).__getattr__("index"), frame.getlocal(1));
328 private static PyObject rindex$10(PyFrame frame) {
329 /* rindex(s, sub [,start [,end]]) -> int
331 Like rfind but raises ValueError when the substring is not found.
334 return frame.getglobal("_apply").__call__(frame.getlocal(0).__getattr__("rindex"), frame.getlocal(1));
337 private static PyObject count$11(PyFrame frame) {
338 /* count(s, sub[, start[,end]]) -> int
340 Return the number of occurrences of substring sub in string
341 s[start:end]. Optional arguments start and end are
342 interpreted as in slice notation.
345 return frame.getglobal("_apply").__call__(frame.getlocal(0).__getattr__("count"), frame.getlocal(1));
348 private static PyObject find$12(PyFrame frame) {
349 /* find(s, sub [,start [,end]]) -> in
351 Return the lowest index in s where substring sub is found,
352 such that sub is contained within s[start,end]. Optional
353 arguments start and end are interpreted as in slice notation.
355 Return -1 on failure.
358 return frame.getglobal("_apply").__call__(frame.getlocal(0).__getattr__("find"), frame.getlocal(1));
361 private static PyObject rfind$13(PyFrame frame) {
362 /* rfind(s, sub [,start [,end]]) -> int
364 Return the highest index in s where substring sub is found,
365 such that sub is contained within s[start,end]. Optional
366 arguments start and end are interpreted as in slice notation.
368 Return -1 on failure.
371 return frame.getglobal("_apply").__call__(frame.getlocal(0).__getattr__("rfind"), frame.getlocal(1));
374 private static PyObject atof$14(PyFrame frame) {
377 Return the floating point number represented by the string s.
380 if (frame.getglobal("type").__call__(frame.getlocal(0))._eq(frame.getglobal("_StringType")).__nonzero__()) {
381 return frame.getglobal("_float").__call__(frame.getlocal(0));
384 throw Py.makeException(frame.getglobal("TypeError").__call__(s$26._mod(frame.getglobal("type").__call__(frame.getlocal(0)).__getattr__("__name__"))));
388 private static PyObject atoi$15(PyFrame frame) {
389 // Temporary Variables
390 PyException t$0$PyException;
393 /* atoi(s [,base]) -> int
395 Return the integer represented by the string s in the given
396 base, which defaults to 10. The string s must consist of one
397 or more digits, possibly preceded by a sign. If base is 0, it
398 is chosen from the leading characters of s, 0 for octal, 0x or
399 0X for hexadecimal. If base is 16, a preceding 0x or 0X is
404 frame.setlocal(1, frame.getlocal(0).__getitem__(i$28));
406 catch (Throwable x$0) {
407 t$0$PyException = Py.setException(x$0, frame);
408 if (Py.matchException(t$0$PyException, frame.getglobal("IndexError"))) {
409 throw Py.makeException(frame.getglobal("TypeError").__call__(s$29._mod(frame.getglobal("len").__call__(frame.getlocal(0)))));
411 else throw t$0$PyException;
413 if (frame.getglobal("type").__call__(frame.getlocal(1))._eq(frame.getglobal("_StringType")).__nonzero__()) {
414 return frame.getglobal("_apply").__call__(frame.getglobal("_int"), frame.getlocal(0));
417 throw Py.makeException(frame.getglobal("TypeError").__call__(s$26._mod(frame.getglobal("type").__call__(frame.getlocal(1)).__getattr__("__name__"))));
421 private static PyObject atol$16(PyFrame frame) {
422 // Temporary Variables
423 PyException t$0$PyException;
426 /* atol(s [,base]) -> long
428 Return the long integer represented by the string s in the
429 given base, which defaults to 10. The string s must consist
430 of one or more digits, possibly preceded by a sign. If base
431 is 0, it is chosen from the leading characters of s, 0 for
432 octal, 0x or 0X for hexadecimal. If base is 16, a preceding
433 0x or 0X is accepted. A trailing L or l is not accepted,
438 frame.setlocal(1, frame.getlocal(0).__getitem__(i$28));
440 catch (Throwable x$0) {
441 t$0$PyException = Py.setException(x$0, frame);
442 if (Py.matchException(t$0$PyException, frame.getglobal("IndexError"))) {
443 throw Py.makeException(frame.getglobal("TypeError").__call__(s$29._mod(frame.getglobal("len").__call__(frame.getlocal(0)))));
445 else throw t$0$PyException;
447 if (frame.getglobal("type").__call__(frame.getlocal(1))._eq(frame.getglobal("_StringType")).__nonzero__()) {
448 return frame.getglobal("_apply").__call__(frame.getglobal("_long"), frame.getlocal(0));
451 throw Py.makeException(frame.getglobal("TypeError").__call__(s$26._mod(frame.getglobal("type").__call__(frame.getlocal(1)).__getattr__("__name__"))));
455 private static PyObject ljust$17(PyFrame frame) {
456 /* ljust(s, width) -> string
458 Return a left-justified version of s, in a field of the
459 specified width, padded with spaces as needed. The string is
463 frame.setlocal(2, frame.getlocal(1)._sub(frame.getglobal("len").__call__(frame.getlocal(0))));
464 if (frame.getlocal(2)._le(i$28).__nonzero__()) {
465 return frame.getlocal(0);
467 return frame.getlocal(0)._add(s$19._mul(frame.getlocal(2)));
470 private static PyObject rjust$18(PyFrame frame) {
471 /* rjust(s, width) -> string
473 Return a right-justified version of s, in a field of the
474 specified width, padded with spaces as needed. The string is
478 frame.setlocal(2, frame.getlocal(1)._sub(frame.getglobal("len").__call__(frame.getlocal(0))));
479 if (frame.getlocal(2)._le(i$28).__nonzero__()) {
480 return frame.getlocal(0);
482 return s$19._mul(frame.getlocal(2))._add(frame.getlocal(0));
485 private static PyObject center$19(PyFrame frame) {
486 // Temporary Variables
487 PyObject t$0$PyObject;
490 /* center(s, width) -> string
492 Return a center version of s, in a field of the specified
493 width. padded with spaces as needed. The string is never
497 frame.setlocal(3, frame.getlocal(1)._sub(frame.getglobal("len").__call__(frame.getlocal(0))));
498 if (frame.getlocal(3)._le(i$28).__nonzero__()) {
499 return frame.getlocal(0);
501 frame.setlocal(2, frame.getlocal(3)._div(i$34));
502 if (((t$0$PyObject = frame.getlocal(3)._mod(i$34)).__nonzero__() ? frame.getlocal(1)._mod(i$34) : t$0$PyObject).__nonzero__()) {
503 frame.setlocal(2, frame.getlocal(2)._add(i$17));
505 return s$19._mul(frame.getlocal(2))._add(frame.getlocal(0))._add(s$19._mul(frame.getlocal(3)._sub(frame.getlocal(2))));
508 private static PyObject zfill$20(PyFrame frame) {
509 // Temporary Variables
510 PyObject[] t$0$PyObject__;
513 /* zfill(x, width) -> string
515 Pad a numeric string x with zeros on the left, to fill a field
516 of the specified width. The string x is never truncated.
519 if (frame.getglobal("type").__call__(frame.getlocal(0))._eq(frame.getglobal("type").__call__(s$8)).__nonzero__()) {
520 frame.setlocal(3, frame.getlocal(0));
523 frame.setlocal(3, frame.getlocal(0).__repr__());
525 frame.setlocal(4, frame.getglobal("len").__call__(frame.getlocal(3)));
526 if (frame.getlocal(4)._ge(frame.getlocal(1)).__nonzero__()) {
527 return frame.getlocal(3);
529 frame.setlocal(2, s$8);
530 if (frame.getlocal(3).__getitem__(i$28)._in(new PyTuple(new PyObject[] {s$36, s$37})).__nonzero__()) {
531 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);
532 frame.setlocal(2, t$0$PyObject__[0]);
533 frame.setlocal(3, t$0$PyObject__[1]);
535 return frame.getlocal(2)._add(s$38._mul(frame.getlocal(1)._sub(frame.getlocal(4))))._add(frame.getlocal(3));
538 private static PyObject expandtabs$21(PyFrame frame) {
539 // Temporary Variables
541 PyObject t$0$PyObject, t$1$PyObject;
544 /* expandtabs(s [,tabsize]) -> string
546 Return a copy of the string s with all tab characters replaced
547 by the appropriate number of spaces, depending on the current
548 column, and the tabsize (default 8).
552 frame.setlocal(3, t$0$PyObject);
553 frame.setlocal(2, t$0$PyObject);
555 t$1$PyObject = frame.getlocal(0);
556 while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
557 frame.setlocal(4, t$0$PyObject);
558 if (frame.getlocal(4)._eq(s$40).__nonzero__()) {
559 frame.setlocal(4, s$19._mul(frame.getlocal(1)._sub(frame.getglobal("len").__call__(frame.getlocal(2))._mod(frame.getlocal(1)))));
561 frame.setlocal(2, frame.getlocal(2)._add(frame.getlocal(4)));
562 if (frame.getlocal(4)._eq(s$41).__nonzero__()) {
563 frame.setlocal(3, frame.getlocal(3)._add(frame.getlocal(2)));
564 frame.setlocal(2, s$8);
567 return frame.getlocal(3)._add(frame.getlocal(2));
570 private static PyObject translate$22(PyFrame frame) {
571 /* translate(s,table [,deletechars]) -> string
573 Return a copy of the string s, where all characters occurring
574 in the optional argument deletechars are removed, and the
575 remaining characters have been mapped through the given
576 translation table, which must be a string of length 256.
579 return frame.getlocal(0).invoke("translate", frame.getlocal(1), frame.getlocal(2));
582 private static PyObject capitalize$23(PyFrame frame) {
583 /* capitalize(s) -> string
585 Return a copy of the string s with only its first character
589 return frame.getlocal(0).invoke("capitalize");
592 private static PyObject capwords$24(PyFrame frame) {
593 // Temporary Variables
594 PyObject t$0$PyObject;
597 /* capwords(s, [sep]) -> string
599 Split the argument into words using split, capitalize each
600 word using capitalize, and join the capitalized words using
601 join. Note that this replaces runs of whitespace characters by
605 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);
608 private static PyObject maketrans$25(PyFrame frame) {
609 // Temporary Variables
611 PyObject t$0$PyObject, t$1$PyObject;
614 /* maketrans(frm, to) -> string
616 Return a translation table (a string of 256 bytes long)
617 suitable for use in string.translate. The strings frm and to
618 must be of the same length.
621 if (frame.getglobal("len").__call__(frame.getlocal(0))._ne(frame.getglobal("len").__call__(frame.getlocal(1))).__nonzero__()) {
622 throw Py.makeException(frame.getglobal("ValueError"), s$47);
625 if (frame.getglobal("_idmapL").__not__().__nonzero__()) {
626 frame.setglobal("_idmapL", frame.getglobal("map").__call__(frame.getglobal("None"), frame.getglobal("_idmap")));
628 frame.setlocal(3, frame.getglobal("_idmapL").__getslice__(null, null, null));
629 frame.setlocal(0, frame.getglobal("map").__call__(frame.getglobal("ord"), frame.getlocal(0)));
631 t$1$PyObject = frame.getglobal("range").__call__(frame.getglobal("len").__call__(frame.getlocal(0)));
632 while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
633 frame.setlocal(2, t$0$PyObject);
634 frame.getlocal(3).__setitem__(frame.getlocal(0).__getitem__(frame.getlocal(2)), frame.getlocal(1).__getitem__(frame.getlocal(2)));
636 return frame.getglobal("joinfields").__call__(frame.getlocal(3), s$8);
639 private static PyObject replace$26(PyFrame frame) {
640 /* replace (str, old, new[, maxsplit]) -> string
642 Return a copy of string str with all occurrences of substring
643 old replaced by new. If the optional argument maxsplit is
644 given, only the first maxsplit occurrences are replaced.
647 return frame.getlocal(0).invoke("replace", new PyObject[] {frame.getlocal(1), frame.getlocal(2), frame.getlocal(3)});
650 private static PyObject main$27(PyFrame frame) {
651 frame.setglobal("__file__", s$49);
654 // Temporary Variables
656 PyException t$0$PyException;
657 PyObject t$0$PyObject, t$1$PyObject;
660 /* Common string manipulations.
662 Public module variables:
664 whitespace -- a string containing all characters considered whitespace
665 lowercase -- a string containing all characters considered lowercase letters
666 uppercase -- a string containing all characters considered uppercase letters
667 letters -- a string containing all characters considered letters
668 digits -- a string containing all characters considered decimal digits
669 hexdigits -- a string containing all characters considered hexadecimal digits
670 octdigits -- a string containing all characters considered octal digits
673 frame.setlocal("whitespace", s$1);
674 frame.setlocal("lowercase", s$2);
675 frame.setlocal("uppercase", s$3);
676 frame.setlocal("letters", frame.getname("lowercase")._add(frame.getname("uppercase")));
677 frame.setlocal("digits", s$4);
678 frame.setlocal("hexdigits", frame.getname("digits")._add(s$5)._add(s$6));
679 frame.setlocal("octdigits", s$7);
680 frame.setlocal("_idmap", s$8);
682 t$1$PyObject = frame.getname("range").__call__(i$9);
683 while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
684 frame.setlocal("i", t$0$PyObject);
685 frame.setlocal("_idmap", frame.getname("_idmap")._add(frame.getname("chr").__call__(frame.getname("i"))));
688 frame.setlocal("index_error", frame.getname("ValueError"));
689 frame.setlocal("atoi_error", frame.getname("ValueError"));
690 frame.setlocal("atof_error", frame.getname("ValueError"));
691 frame.setlocal("atol_error", frame.getname("ValueError"));
692 frame.setlocal("lower", new PyFunction(frame.f_globals, new PyObject[] {}, c$0_lower));
693 frame.setlocal("upper", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_upper));
694 frame.setlocal("swapcase", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_swapcase));
695 frame.setlocal("strip", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_strip));
696 frame.setlocal("lstrip", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_lstrip));
697 frame.setlocal("rstrip", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_rstrip));
698 frame.setlocal("split", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None"), i$17.__neg__()}, c$6_split));
699 frame.setlocal("splitfields", frame.getname("split"));
700 frame.setlocal("join", new PyFunction(frame.f_globals, new PyObject[] {s$19}, c$7_join));
701 frame.setlocal("joinfields", frame.getname("join"));
702 frame.setlocal("_apply", frame.getname("apply"));
703 frame.setlocal("index", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_index));
704 frame.setlocal("rindex", new PyFunction(frame.f_globals, new PyObject[] {}, c$9_rindex));
705 frame.setlocal("count", new PyFunction(frame.f_globals, new PyObject[] {}, c$10_count));
706 frame.setlocal("find", new PyFunction(frame.f_globals, new PyObject[] {}, c$11_find));
707 frame.setlocal("rfind", new PyFunction(frame.f_globals, new PyObject[] {}, c$12_rfind));
708 frame.setlocal("_float", frame.getname("float"));
709 frame.setlocal("_int", frame.getname("int"));
710 frame.setlocal("_long", frame.getname("long"));
711 frame.setlocal("_StringType", frame.getname("type").__call__(s$8));
712 frame.setlocal("atof", new PyFunction(frame.f_globals, new PyObject[] {}, c$13_atof));
713 frame.setlocal("atoi", new PyFunction(frame.f_globals, new PyObject[] {}, c$14_atoi));
714 frame.setlocal("atol", new PyFunction(frame.f_globals, new PyObject[] {}, c$15_atol));
715 frame.setlocal("ljust", new PyFunction(frame.f_globals, new PyObject[] {}, c$16_ljust));
716 frame.setlocal("rjust", new PyFunction(frame.f_globals, new PyObject[] {}, c$17_rjust));
717 frame.setlocal("center", new PyFunction(frame.f_globals, new PyObject[] {}, c$18_center));
718 frame.setlocal("zfill", new PyFunction(frame.f_globals, new PyObject[] {}, c$19_zfill));
719 frame.setlocal("expandtabs", new PyFunction(frame.f_globals, new PyObject[] {i$42}, c$20_expandtabs));
720 frame.setlocal("translate", new PyFunction(frame.f_globals, new PyObject[] {s$8}, c$21_translate));
721 frame.setlocal("capitalize", new PyFunction(frame.f_globals, new PyObject[] {}, c$22_capitalize));
722 frame.setlocal("capwords", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("None")}, c$23_capwords));
723 frame.setlocal("_idmapL", frame.getname("None"));
724 frame.setlocal("maketrans", new PyFunction(frame.f_globals, new PyObject[] {}, c$24_maketrans));
725 frame.setlocal("replace", new PyFunction(frame.f_globals, new PyObject[] {i$17.__neg__()}, c$25_replace));
727 imp_accu = org.python.core.imp.importFrom("strop", new String[] {"maketrans", "lowercase", "uppercase", "whitespace"}, frame);
728 frame.setlocal("maketrans", imp_accu[0]);
729 frame.setlocal("lowercase", imp_accu[1]);
730 frame.setlocal("uppercase", imp_accu[2]);
731 frame.setlocal("whitespace", imp_accu[3]);
733 frame.setlocal("letters", frame.getname("lowercase")._add(frame.getname("uppercase")));
735 catch (Throwable x$0) {
736 t$0$PyException = Py.setException(x$0, frame);
737 if (Py.matchException(t$0$PyException, frame.getname("ImportError"))) {
740 else throw t$0$PyException;
746 public static void moduleDictInit(PyObject dict) {
747 dict.__setitem__("__name__", new PyString("string"));
748 Py.runCode(new _PyInner().getMain(), dict, dict);
751 public static void main(String[] args) throws java.lang.Exception {
752 String[] newargs = new String[args.length+1];
753 newargs[0] = "string";
754 System.arraycopy(args, 0, newargs, 1, args.length);
755 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"});