rapydscript-ns 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/.agignore +1 -0
  2. package/.gitattributes +4 -0
  3. package/.github/workflows/ci.yml +38 -0
  4. package/.github/workflows/web-repl-page-deploy.yml +42 -0
  5. package/=template.pyj +5 -0
  6. package/CHANGELOG.md +456 -0
  7. package/CONTRIBUTORS +13 -0
  8. package/HACKING.md +103 -0
  9. package/LICENSE +24 -0
  10. package/README.md +2512 -0
  11. package/TODO.md +327 -0
  12. package/add-toc-to-readme +2 -0
  13. package/bin/export +75 -0
  14. package/bin/rapydscript +70 -0
  15. package/bin/web-repl-export +102 -0
  16. package/build +3 -0
  17. package/package.json +46 -0
  18. package/publish.py +37 -0
  19. package/release/baselib-plain-pretty.js +4370 -0
  20. package/release/baselib-plain-ugly.js +3 -0
  21. package/release/compiler.js +18394 -0
  22. package/release/signatures.json +31 -0
  23. package/session.vim +4 -0
  24. package/setup.cfg +2 -0
  25. package/src/ast.pyj +1356 -0
  26. package/src/baselib-builtins.pyj +279 -0
  27. package/src/baselib-containers.pyj +723 -0
  28. package/src/baselib-errors.pyj +37 -0
  29. package/src/baselib-internal.pyj +421 -0
  30. package/src/baselib-itertools.pyj +97 -0
  31. package/src/baselib-str.pyj +798 -0
  32. package/src/compiler.pyj +36 -0
  33. package/src/errors.pyj +30 -0
  34. package/src/lib/aes.pyj +646 -0
  35. package/src/lib/collections.pyj +695 -0
  36. package/src/lib/elementmaker.pyj +83 -0
  37. package/src/lib/encodings.pyj +126 -0
  38. package/src/lib/functools.pyj +148 -0
  39. package/src/lib/gettext.pyj +569 -0
  40. package/src/lib/itertools.pyj +580 -0
  41. package/src/lib/math.pyj +193 -0
  42. package/src/lib/numpy.pyj +2101 -0
  43. package/src/lib/operator.pyj +11 -0
  44. package/src/lib/pythonize.pyj +20 -0
  45. package/src/lib/random.pyj +118 -0
  46. package/src/lib/re.pyj +470 -0
  47. package/src/lib/traceback.pyj +63 -0
  48. package/src/lib/uuid.pyj +77 -0
  49. package/src/monaco-language-service/analyzer.js +526 -0
  50. package/src/monaco-language-service/builtins.js +543 -0
  51. package/src/monaco-language-service/completions.js +498 -0
  52. package/src/monaco-language-service/diagnostics.js +643 -0
  53. package/src/monaco-language-service/dts.js +550 -0
  54. package/src/monaco-language-service/hover.js +121 -0
  55. package/src/monaco-language-service/index.js +386 -0
  56. package/src/monaco-language-service/scope.js +162 -0
  57. package/src/monaco-language-service/signature.js +144 -0
  58. package/src/output/__init__.pyj +0 -0
  59. package/src/output/classes.pyj +296 -0
  60. package/src/output/codegen.pyj +492 -0
  61. package/src/output/comments.pyj +45 -0
  62. package/src/output/exceptions.pyj +105 -0
  63. package/src/output/functions.pyj +491 -0
  64. package/src/output/literals.pyj +109 -0
  65. package/src/output/loops.pyj +444 -0
  66. package/src/output/modules.pyj +329 -0
  67. package/src/output/operators.pyj +429 -0
  68. package/src/output/statements.pyj +463 -0
  69. package/src/output/stream.pyj +309 -0
  70. package/src/output/treeshake.pyj +182 -0
  71. package/src/output/utils.pyj +72 -0
  72. package/src/parse.pyj +3106 -0
  73. package/src/string_interpolation.pyj +72 -0
  74. package/src/tokenizer.pyj +702 -0
  75. package/src/unicode_aliases.pyj +576 -0
  76. package/src/utils.pyj +192 -0
  77. package/test/_import_one.pyj +37 -0
  78. package/test/_import_two/__init__.pyj +11 -0
  79. package/test/_import_two/level2/__init__.pyj +0 -0
  80. package/test/_import_two/level2/deep.pyj +4 -0
  81. package/test/_import_two/other.pyj +6 -0
  82. package/test/_import_two/sub.pyj +13 -0
  83. package/test/aes_vectors.pyj +421 -0
  84. package/test/annotations.pyj +80 -0
  85. package/test/baselib.pyj +319 -0
  86. package/test/classes.pyj +452 -0
  87. package/test/collections.pyj +152 -0
  88. package/test/decorators.pyj +77 -0
  89. package/test/dict_spread.pyj +76 -0
  90. package/test/docstrings.pyj +39 -0
  91. package/test/elementmaker_test.pyj +45 -0
  92. package/test/ellipsis.pyj +49 -0
  93. package/test/functions.pyj +151 -0
  94. package/test/generators.pyj +41 -0
  95. package/test/generic.pyj +370 -0
  96. package/test/imports.pyj +72 -0
  97. package/test/internationalization.pyj +73 -0
  98. package/test/lint.pyj +164 -0
  99. package/test/loops.pyj +85 -0
  100. package/test/numpy.pyj +734 -0
  101. package/test/omit_function_metadata.pyj +20 -0
  102. package/test/regexp.pyj +55 -0
  103. package/test/repl.pyj +121 -0
  104. package/test/scoped_flags.pyj +76 -0
  105. package/test/starargs.pyj +506 -0
  106. package/test/starred_assign.pyj +104 -0
  107. package/test/str.pyj +198 -0
  108. package/test/subscript_tuple.pyj +53 -0
  109. package/test/unit/fixtures/fibonacci_expected.js +46 -0
  110. package/test/unit/index.js +2989 -0
  111. package/test/unit/language-service-builtins.js +815 -0
  112. package/test/unit/language-service-completions.js +1067 -0
  113. package/test/unit/language-service-dts.js +543 -0
  114. package/test/unit/language-service-hover.js +455 -0
  115. package/test/unit/language-service-scope.js +833 -0
  116. package/test/unit/language-service-signature.js +458 -0
  117. package/test/unit/language-service.js +705 -0
  118. package/test/unit/run-language-service.js +41 -0
  119. package/test/unit/web-repl.js +484 -0
  120. package/tools/build-language-service.js +190 -0
  121. package/tools/cli.js +547 -0
  122. package/tools/compile.js +219 -0
  123. package/tools/compiler.js +108 -0
  124. package/tools/completer.js +131 -0
  125. package/tools/embedded_compiler.js +251 -0
  126. package/tools/export.js +316 -0
  127. package/tools/gettext.js +185 -0
  128. package/tools/ini.js +65 -0
  129. package/tools/lint.js +705 -0
  130. package/tools/msgfmt.js +187 -0
  131. package/tools/repl.js +223 -0
  132. package/tools/self.js +162 -0
  133. package/tools/test.js +118 -0
  134. package/tools/utils.js +128 -0
  135. package/tools/web_repl.js +95 -0
  136. package/try +41 -0
  137. package/web-repl/env.js +74 -0
  138. package/web-repl/index.html +163 -0
  139. package/web-repl/language-service.js +4084 -0
  140. package/web-repl/main.js +254 -0
  141. package/web-repl/prism.css +139 -0
  142. package/web-repl/prism.js +113 -0
  143. package/web-repl/rapydscript.js +435 -0
  144. package/web-repl/sha1.js +25 -0
@@ -0,0 +1,4370 @@
1
+ var ρσ_len;
2
+ function ρσ_bool(val) {
3
+ return !!val;
4
+ };
5
+ if (!ρσ_bool.__argnames__) Object.defineProperties(ρσ_bool, {
6
+ __argnames__ : {value: ["val"]},
7
+ __module__ : {value: "__main__"}
8
+ });
9
+
10
+ function ρσ_print() {
11
+ var parts;
12
+ if (typeof console === "object") {
13
+ parts = [];
14
+ for (var i = 0; i < arguments.length; i++) {
15
+ parts.push(ρσ_str(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]));
16
+ }
17
+ console.log(parts.join(" "));
18
+ }
19
+ };
20
+ if (!ρσ_print.__module__) Object.defineProperties(ρσ_print, {
21
+ __module__ : {value: "__main__"}
22
+ });
23
+
24
+ function ρσ_int(val, base) {
25
+ var ans;
26
+ if (typeof val === "number") {
27
+ ans = val | 0;
28
+ } else {
29
+ ans = parseInt(val, base || 10);
30
+ }
31
+ if (isNaN(ans)) {
32
+ throw new ValueError("Invalid literal for int with base " + (base || 10) + ": " + val);
33
+ }
34
+ return ans;
35
+ };
36
+ if (!ρσ_int.__argnames__) Object.defineProperties(ρσ_int, {
37
+ __argnames__ : {value: ["val", "base"]},
38
+ __module__ : {value: "__main__"}
39
+ });
40
+
41
+ function ρσ_float(val) {
42
+ var ans;
43
+ if (typeof val === "number") {
44
+ ans = val;
45
+ } else {
46
+ ans = parseFloat(val);
47
+ }
48
+ if (isNaN(ans)) {
49
+ throw new ValueError("Could not convert string to float: " + arguments[0]);
50
+ }
51
+ return ans;
52
+ };
53
+ if (!ρσ_float.__argnames__) Object.defineProperties(ρσ_float, {
54
+ __argnames__ : {value: ["val"]},
55
+ __module__ : {value: "__main__"}
56
+ });
57
+
58
+ function ρσ_arraylike_creator() {
59
+ var names;
60
+ names = "Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" ");
61
+ if (typeof HTMLCollection === "function") {
62
+ names = names.concat("HTMLCollection NodeList NamedNodeMap TouchList".split(" "));
63
+ }
64
+ return (function() {
65
+ var ρσ_anonfunc = function (x) {
66
+ if (Array.isArray(x) || typeof x === "string" || names.indexOf(Object.prototype.toString.call(x).slice(8, -1)) > -1) {
67
+ return true;
68
+ }
69
+ return false;
70
+ };
71
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
72
+ __argnames__ : {value: ["x"]},
73
+ __module__ : {value: "__main__"}
74
+ });
75
+ return ρσ_anonfunc;
76
+ })();
77
+ };
78
+ if (!ρσ_arraylike_creator.__module__) Object.defineProperties(ρσ_arraylike_creator, {
79
+ __module__ : {value: "__main__"}
80
+ });
81
+
82
+ function options_object(f) {
83
+ return (function() {
84
+ var ρσ_anonfunc = function () {
85
+ if (typeof arguments[arguments.length - 1] === "object") {
86
+ arguments[ρσ_bound_index(arguments.length - 1, arguments)][ρσ_kwargs_symbol] = true;
87
+ }
88
+ return f.apply(this, arguments);
89
+ };
90
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
91
+ __module__ : {value: "__main__"}
92
+ });
93
+ return ρσ_anonfunc;
94
+ })();
95
+ };
96
+ if (!options_object.__argnames__) Object.defineProperties(options_object, {
97
+ __argnames__ : {value: ["f"]},
98
+ __module__ : {value: "__main__"}
99
+ });
100
+
101
+ function ρσ_id(x) {
102
+ return x.ρσ_object_id;
103
+ };
104
+ if (!ρσ_id.__argnames__) Object.defineProperties(ρσ_id, {
105
+ __argnames__ : {value: ["x"]},
106
+ __module__ : {value: "__main__"}
107
+ });
108
+
109
+ function ρσ_dir(item) {
110
+ var arr;
111
+ arr = ρσ_list_decorate([]);
112
+ for (var i in item) {
113
+ arr.push(i);
114
+ }
115
+ return arr;
116
+ };
117
+ if (!ρσ_dir.__argnames__) Object.defineProperties(ρσ_dir, {
118
+ __argnames__ : {value: ["item"]},
119
+ __module__ : {value: "__main__"}
120
+ });
121
+
122
+ function ρσ_ord(x) {
123
+ var ans, second;
124
+ ans = x.charCodeAt(0);
125
+ if (55296 <= ans && ans <= 56319) {
126
+ second = x.charCodeAt(1);
127
+ if (56320 <= second && second <= 57343) {
128
+ return (ans - 55296) * 1024 + second - 56320 + 65536;
129
+ }
130
+ throw new TypeError("string is missing the low surrogate char");
131
+ }
132
+ return ans;
133
+ };
134
+ if (!ρσ_ord.__argnames__) Object.defineProperties(ρσ_ord, {
135
+ __argnames__ : {value: ["x"]},
136
+ __module__ : {value: "__main__"}
137
+ });
138
+
139
+ function ρσ_chr(code) {
140
+ if (code <= 65535) {
141
+ return String.fromCharCode(code);
142
+ }
143
+ code -= 65536;
144
+ return String.fromCharCode(55296 + (code >> 10), 56320 + (code & 1023));
145
+ };
146
+ if (!ρσ_chr.__argnames__) Object.defineProperties(ρσ_chr, {
147
+ __argnames__ : {value: ["code"]},
148
+ __module__ : {value: "__main__"}
149
+ });
150
+
151
+ function ρσ_callable(x) {
152
+ return typeof x === "function";
153
+ };
154
+ if (!ρσ_callable.__argnames__) Object.defineProperties(ρσ_callable, {
155
+ __argnames__ : {value: ["x"]},
156
+ __module__ : {value: "__main__"}
157
+ });
158
+
159
+ function ρσ_bin(x) {
160
+ var ans;
161
+ if (typeof x !== "number" || x % 1 !== 0) {
162
+ throw new TypeError("integer required");
163
+ }
164
+ ans = x.toString(2);
165
+ if (ans[0] === "-") {
166
+ ans = "-" + "0b" + ans.slice(1);
167
+ } else {
168
+ ans = "0b" + ans;
169
+ }
170
+ return ans;
171
+ };
172
+ if (!ρσ_bin.__argnames__) Object.defineProperties(ρσ_bin, {
173
+ __argnames__ : {value: ["x"]},
174
+ __module__ : {value: "__main__"}
175
+ });
176
+
177
+ function ρσ_hex(x) {
178
+ var ans;
179
+ if (typeof x !== "number" || x % 1 !== 0) {
180
+ throw new TypeError("integer required");
181
+ }
182
+ ans = x.toString(16);
183
+ if (ans[0] === "-") {
184
+ ans = "-" + "0x" + ans.slice(1);
185
+ } else {
186
+ ans = "0x" + ans;
187
+ }
188
+ return ans;
189
+ };
190
+ if (!ρσ_hex.__argnames__) Object.defineProperties(ρσ_hex, {
191
+ __argnames__ : {value: ["x"]},
192
+ __module__ : {value: "__main__"}
193
+ });
194
+
195
+ function ρσ_enumerate(iterable) {
196
+ var ans, iterator;
197
+ ans = {"_i":-1};
198
+ ans[ρσ_iterator_symbol] = (function() {
199
+ var ρσ_anonfunc = function () {
200
+ return this;
201
+ };
202
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
203
+ __module__ : {value: "__main__"}
204
+ });
205
+ return ρσ_anonfunc;
206
+ })();
207
+ if (ρσ_arraylike(iterable)) {
208
+ ans["next"] = (function() {
209
+ var ρσ_anonfunc = function () {
210
+ this._i += 1;
211
+ if (this._i < iterable.length) {
212
+ return {'done':false, 'value':[this._i, iterable[this._i]]};
213
+ }
214
+ return {'done':true};
215
+ };
216
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
217
+ __module__ : {value: "__main__"}
218
+ });
219
+ return ρσ_anonfunc;
220
+ })();
221
+ return ans;
222
+ }
223
+ if (typeof iterable[ρσ_iterator_symbol] === "function") {
224
+ iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
225
+ ans["_iterator"] = iterator;
226
+ ans["next"] = (function() {
227
+ var ρσ_anonfunc = function () {
228
+ var r;
229
+ r = this._iterator.next();
230
+ if (r.done) {
231
+ return {'done':true};
232
+ }
233
+ this._i += 1;
234
+ return {'done':false, 'value':[this._i, r.value]};
235
+ };
236
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
237
+ __module__ : {value: "__main__"}
238
+ });
239
+ return ρσ_anonfunc;
240
+ })();
241
+ return ans;
242
+ }
243
+ return ρσ_enumerate(Object.keys(iterable));
244
+ };
245
+ if (!ρσ_enumerate.__argnames__) Object.defineProperties(ρσ_enumerate, {
246
+ __argnames__ : {value: ["iterable"]},
247
+ __module__ : {value: "__main__"}
248
+ });
249
+
250
+ function ρσ_reversed(iterable) {
251
+ var ans;
252
+ if (ρσ_arraylike(iterable)) {
253
+ ans = {"_i": iterable.length};
254
+ ans["next"] = (function() {
255
+ var ρσ_anonfunc = function () {
256
+ this._i -= 1;
257
+ if (this._i > -1) {
258
+ return {'done':false, 'value':iterable[this._i]};
259
+ }
260
+ return {'done':true};
261
+ };
262
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
263
+ __module__ : {value: "__main__"}
264
+ });
265
+ return ρσ_anonfunc;
266
+ })();
267
+ ans[ρσ_iterator_symbol] = (function() {
268
+ var ρσ_anonfunc = function () {
269
+ return this;
270
+ };
271
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
272
+ __module__ : {value: "__main__"}
273
+ });
274
+ return ρσ_anonfunc;
275
+ })();
276
+ return ans;
277
+ }
278
+ throw new TypeError("reversed() can only be called on arrays or strings");
279
+ };
280
+ if (!ρσ_reversed.__argnames__) Object.defineProperties(ρσ_reversed, {
281
+ __argnames__ : {value: ["iterable"]},
282
+ __module__ : {value: "__main__"}
283
+ });
284
+
285
+ function ρσ_iter(iterable) {
286
+ var ans;
287
+ if (typeof iterable[ρσ_iterator_symbol] === "function") {
288
+ return (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
289
+ }
290
+ if (ρσ_arraylike(iterable)) {
291
+ ans = {"_i":-1};
292
+ ans[ρσ_iterator_symbol] = (function() {
293
+ var ρσ_anonfunc = function () {
294
+ return this;
295
+ };
296
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
297
+ __module__ : {value: "__main__"}
298
+ });
299
+ return ρσ_anonfunc;
300
+ })();
301
+ ans["next"] = (function() {
302
+ var ρσ_anonfunc = function () {
303
+ this._i += 1;
304
+ if (this._i < iterable.length) {
305
+ return {'done':false, 'value':iterable[this._i]};
306
+ }
307
+ return {'done':true};
308
+ };
309
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
310
+ __module__ : {value: "__main__"}
311
+ });
312
+ return ρσ_anonfunc;
313
+ })();
314
+ return ans;
315
+ }
316
+ return ρσ_iter(Object.keys(iterable));
317
+ };
318
+ if (!ρσ_iter.__argnames__) Object.defineProperties(ρσ_iter, {
319
+ __argnames__ : {value: ["iterable"]},
320
+ __module__ : {value: "__main__"}
321
+ });
322
+
323
+ function ρσ_range_next(step, length) {
324
+ var ρσ_unpack;
325
+ this._i += step;
326
+ this._idx += 1;
327
+ if (this._idx >= length) {
328
+ ρσ_unpack = [this.__i, -1];
329
+ this._i = ρσ_unpack[0];
330
+ this._idx = ρσ_unpack[1];
331
+ return {'done':true};
332
+ }
333
+ return {'done':false, 'value':this._i};
334
+ };
335
+ if (!ρσ_range_next.__argnames__) Object.defineProperties(ρσ_range_next, {
336
+ __argnames__ : {value: ["step", "length"]},
337
+ __module__ : {value: "__main__"}
338
+ });
339
+
340
+ function ρσ_range(start, stop, step) {
341
+ var length, ans;
342
+ if (arguments.length <= 1) {
343
+ stop = start || 0;
344
+ start = 0;
345
+ }
346
+ step = arguments[2] || 1;
347
+ length = Math.max(Math.ceil((stop - start) / step), 0);
348
+ ans = {start:start, step:step, stop:stop};
349
+ ans[ρσ_iterator_symbol] = (function() {
350
+ var ρσ_anonfunc = function () {
351
+ var it;
352
+ it = {"_i": start - step, "_idx": -1};
353
+ it.next = ρσ_range_next.bind(it, step, length);
354
+ it[ρσ_iterator_symbol] = (function() {
355
+ var ρσ_anonfunc = function () {
356
+ return this;
357
+ };
358
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
359
+ __module__ : {value: "__main__"}
360
+ });
361
+ return ρσ_anonfunc;
362
+ })();
363
+ return it;
364
+ };
365
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
366
+ __module__ : {value: "__main__"}
367
+ });
368
+ return ρσ_anonfunc;
369
+ })();
370
+ ans.count = (function() {
371
+ var ρσ_anonfunc = function (val) {
372
+ if (!this._cached) {
373
+ this._cached = list(this);
374
+ }
375
+ return this._cached.count(val);
376
+ };
377
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
378
+ __argnames__ : {value: ["val"]},
379
+ __module__ : {value: "__main__"}
380
+ });
381
+ return ρσ_anonfunc;
382
+ })();
383
+ ans.index = (function() {
384
+ var ρσ_anonfunc = function (val) {
385
+ if (!this._cached) {
386
+ this._cached = list(this);
387
+ }
388
+ return this._cached.index(val);
389
+ };
390
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
391
+ __argnames__ : {value: ["val"]},
392
+ __module__ : {value: "__main__"}
393
+ });
394
+ return ρσ_anonfunc;
395
+ })();
396
+ ans.__len__ = (function() {
397
+ var ρσ_anonfunc = function () {
398
+ return length;
399
+ };
400
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
401
+ __module__ : {value: "__main__"}
402
+ });
403
+ return ρσ_anonfunc;
404
+ })();
405
+ ans.__repr__ = (function() {
406
+ var ρσ_anonfunc = function () {
407
+ return "range(" + ρσ_str.format("{}", start) + ", " + ρσ_str.format("{}", stop) + ", " + ρσ_str.format("{}", step) + ")";
408
+ };
409
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
410
+ __module__ : {value: "__main__"}
411
+ });
412
+ return ρσ_anonfunc;
413
+ })();
414
+ ans.__str__ = ans.toString = ans.__repr__;
415
+ if (typeof Proxy === "function") {
416
+ ans = new Proxy(ans, (function(){
417
+ var ρσ_d = {};
418
+ ρσ_d["get"] = (function() {
419
+ var ρσ_anonfunc = function (obj, prop) {
420
+ var iprop;
421
+ if (typeof prop === "string") {
422
+ iprop = parseInt(prop);
423
+ if (!isNaN(iprop)) {
424
+ prop = iprop;
425
+ }
426
+ }
427
+ if (typeof prop === "number") {
428
+ if (!obj._cached) {
429
+ obj._cached = list(obj);
430
+ }
431
+ return (ρσ_expr_temp = obj._cached)[(typeof prop === "number" && prop < 0) ? ρσ_expr_temp.length + prop : prop];
432
+ }
433
+ return obj[(typeof prop === "number" && prop < 0) ? obj.length + prop : prop];
434
+ };
435
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
436
+ __argnames__ : {value: ["obj", "prop"]},
437
+ __module__ : {value: "__main__"}
438
+ });
439
+ return ρσ_anonfunc;
440
+ })();
441
+ return ρσ_d;
442
+ }).call(this));
443
+ }
444
+ return ans;
445
+ };
446
+ if (!ρσ_range.__argnames__) Object.defineProperties(ρσ_range, {
447
+ __argnames__ : {value: ["start", "stop", "step"]},
448
+ __module__ : {value: "__main__"}
449
+ });
450
+
451
+ function ρσ_getattr(obj, name, defval) {
452
+ var ret;
453
+ try {
454
+ ret = obj[(typeof name === "number" && name < 0) ? obj.length + name : name];
455
+ } catch (ρσ_Exception) {
456
+ ρσ_last_exception = ρσ_Exception;
457
+ if (ρσ_Exception instanceof TypeError) {
458
+ if (defval === undefined) {
459
+ throw new AttributeError("The attribute " + name + " is not present");
460
+ }
461
+ return defval;
462
+ } else {
463
+ throw ρσ_Exception;
464
+ }
465
+ }
466
+ if (ret === undefined && !(name in obj)) {
467
+ if (defval === undefined) {
468
+ throw new AttributeError("The attribute " + name + " is not present");
469
+ }
470
+ ret = defval;
471
+ }
472
+ return ret;
473
+ };
474
+ if (!ρσ_getattr.__argnames__) Object.defineProperties(ρσ_getattr, {
475
+ __argnames__ : {value: ["obj", "name", "defval"]},
476
+ __module__ : {value: "__main__"}
477
+ });
478
+
479
+ function ρσ_setattr(obj, name, value) {
480
+ obj[(typeof name === "number" && name < 0) ? obj.length + name : name] = value;
481
+ };
482
+ if (!ρσ_setattr.__argnames__) Object.defineProperties(ρσ_setattr, {
483
+ __argnames__ : {value: ["obj", "name", "value"]},
484
+ __module__ : {value: "__main__"}
485
+ });
486
+
487
+ function ρσ_hasattr(obj, name) {
488
+ return name in obj;
489
+ };
490
+ if (!ρσ_hasattr.__argnames__) Object.defineProperties(ρσ_hasattr, {
491
+ __argnames__ : {value: ["obj", "name"]},
492
+ __module__ : {value: "__main__"}
493
+ });
494
+
495
+ ρσ_len = (function() {
496
+ var ρσ_anonfunc = function () {
497
+ function len(obj) {
498
+ if (ρσ_arraylike(obj)) {
499
+ return obj.length;
500
+ }
501
+ if (typeof obj.__len__ === "function") {
502
+ return obj.__len__();
503
+ }
504
+ if (obj instanceof Set || obj instanceof Map) {
505
+ return obj.size;
506
+ }
507
+ return Object.keys(obj).length;
508
+ };
509
+ if (!len.__argnames__) Object.defineProperties(len, {
510
+ __argnames__ : {value: ["obj"]},
511
+ __module__ : {value: "__main__"}
512
+ });
513
+
514
+ function len5(obj) {
515
+ if (ρσ_arraylike(obj)) {
516
+ return obj.length;
517
+ }
518
+ if (typeof obj.__len__ === "function") {
519
+ return obj.__len__();
520
+ }
521
+ return Object.keys(obj).length;
522
+ };
523
+ if (!len5.__argnames__) Object.defineProperties(len5, {
524
+ __argnames__ : {value: ["obj"]},
525
+ __module__ : {value: "__main__"}
526
+ });
527
+
528
+ return (typeof Set === "function" && typeof Map === "function") ? len : len5;
529
+ };
530
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
531
+ __module__ : {value: "__main__"}
532
+ });
533
+ return ρσ_anonfunc;
534
+ })()();
535
+ function ρσ_get_module(name) {
536
+ return ρσ_modules[(typeof name === "number" && name < 0) ? ρσ_modules.length + name : name];
537
+ };
538
+ if (!ρσ_get_module.__argnames__) Object.defineProperties(ρσ_get_module, {
539
+ __argnames__ : {value: ["name"]},
540
+ __module__ : {value: "__main__"}
541
+ });
542
+
543
+ function ρσ_pow(x, y, z) {
544
+ var ans;
545
+ ans = Math.pow(x, y);
546
+ if (z !== undefined) {
547
+ ans %= z;
548
+ }
549
+ return ans;
550
+ };
551
+ if (!ρσ_pow.__argnames__) Object.defineProperties(ρσ_pow, {
552
+ __argnames__ : {value: ["x", "y", "z"]},
553
+ __module__ : {value: "__main__"}
554
+ });
555
+
556
+ function ρσ_type(x) {
557
+ return x.constructor;
558
+ };
559
+ if (!ρσ_type.__argnames__) Object.defineProperties(ρσ_type, {
560
+ __argnames__ : {value: ["x"]},
561
+ __module__ : {value: "__main__"}
562
+ });
563
+
564
+ function ρσ_divmod(x, y) {
565
+ var d;
566
+ if (y === 0) {
567
+ throw new ZeroDivisionError("integer division or modulo by zero");
568
+ }
569
+ d = Math.floor(x / y);
570
+ return [d, x - d * y];
571
+ };
572
+ if (!ρσ_divmod.__argnames__) Object.defineProperties(ρσ_divmod, {
573
+ __argnames__ : {value: ["x", "y"]},
574
+ __module__ : {value: "__main__"}
575
+ });
576
+
577
+ function ρσ_max() {
578
+ var kwargs = arguments[arguments.length-1];
579
+ if (kwargs === null || typeof kwargs !== "object" || kwargs [ρσ_kwargs_symbol] !== true) kwargs = {};
580
+ var args = Array.prototype.slice.call(arguments, 0);
581
+ if (kwargs !== null && typeof kwargs === "object" && kwargs [ρσ_kwargs_symbol] === true) args.pop();
582
+ var args, x;
583
+ if (args.length === 0) {
584
+ if (kwargs.defval !== undefined) {
585
+ return kwargs.defval;
586
+ }
587
+ throw new TypeError("expected at least one argument");
588
+ }
589
+ if (args.length === 1) {
590
+ args = args[0];
591
+ }
592
+ if (kwargs.key) {
593
+ args = (function() {
594
+ var ρσ_Iter = ρσ_Iterable(args), ρσ_Result = [], x;
595
+ for (var ρσ_Index = 0; ρσ_Index < ρσ_Iter.length; ρσ_Index++) {
596
+ x = ρσ_Iter[ρσ_Index];
597
+ ρσ_Result.push(kwargs.key(x));
598
+ }
599
+ ρσ_Result = ρσ_list_constructor(ρσ_Result);
600
+ return ρσ_Result;
601
+ })();
602
+ }
603
+ if (!Array.isArray(args)) {
604
+ args = list(args);
605
+ }
606
+ if (args.length) {
607
+ return this.apply(null, args);
608
+ }
609
+ if (kwargs.defval !== undefined) {
610
+ return kwargs.defval;
611
+ }
612
+ throw new TypeError("expected at least one argument");
613
+ };
614
+ if (!ρσ_max.__handles_kwarg_interpolation__) Object.defineProperties(ρσ_max, {
615
+ __handles_kwarg_interpolation__ : {value: true},
616
+ __module__ : {value: "__main__"}
617
+ });
618
+
619
+ var abs = Math.abs, max = ρσ_max.bind(Math.max), min = ρσ_max.bind(Math.min), bool = ρσ_bool, type = ρσ_type;
620
+ var float = ρσ_float, int = ρσ_int, arraylike = ρσ_arraylike_creator(), ρσ_arraylike = arraylike;
621
+ var print = ρσ_print, id = ρσ_id, get_module = ρσ_get_module, pow = ρσ_pow, divmod = ρσ_divmod;
622
+ var dir = ρσ_dir, ord = ρσ_ord, chr = ρσ_chr, bin = ρσ_bin, hex = ρσ_hex, callable = ρσ_callable;
623
+ var enumerate = ρσ_enumerate, iter = ρσ_iter, reversed = ρσ_reversed, len = ρσ_len;
624
+ var range = ρσ_range, getattr = ρσ_getattr, setattr = ρσ_setattr, hasattr = ρσ_hasattr;function ρσ_equals(a, b) {
625
+ var ρσ_unpack, akeys, bkeys, key;
626
+ if (a === b) {
627
+ return true;
628
+ }
629
+ if (a && typeof a.__eq__ === "function") {
630
+ return a.__eq__(b);
631
+ }
632
+ if (b && typeof b.__eq__ === "function") {
633
+ return b.__eq__(a);
634
+ }
635
+ if (ρσ_arraylike(a) && ρσ_arraylike(b)) {
636
+ if ((a.length !== b.length && (typeof a.length !== "object" || ρσ_not_equals(a.length, b.length)))) {
637
+ return false;
638
+ }
639
+ for (var i=0; i < a.length; i++) {
640
+ if (!(((a[(typeof i === "number" && i < 0) ? a.length + i : i] === b[(typeof i === "number" && i < 0) ? b.length + i : i] || typeof a[(typeof i === "number" && i < 0) ? a.length + i : i] === "object" && ρσ_equals(a[(typeof i === "number" && i < 0) ? a.length + i : i], b[(typeof i === "number" && i < 0) ? b.length + i : i]))))) {
641
+ return false;
642
+ }
643
+ }
644
+ return true;
645
+ }
646
+ if (typeof a === "object" && typeof b === "object" && a !== null && b !== null && (a.constructor === Object && b.constructor === Object || Object.getPrototypeOf(a) === null && Object.getPrototypeOf(b) === null)) {
647
+ ρσ_unpack = [Object.keys(a), Object.keys(b)];
648
+ akeys = ρσ_unpack[0];
649
+ bkeys = ρσ_unpack[1];
650
+ if (akeys.length !== bkeys.length) {
651
+ return false;
652
+ }
653
+ for (var j=0; j < akeys.length; j++) {
654
+ key = akeys[(typeof j === "number" && j < 0) ? akeys.length + j : j];
655
+ if (!(((a[(typeof key === "number" && key < 0) ? a.length + key : key] === b[(typeof key === "number" && key < 0) ? b.length + key : key] || typeof a[(typeof key === "number" && key < 0) ? a.length + key : key] === "object" && ρσ_equals(a[(typeof key === "number" && key < 0) ? a.length + key : key], b[(typeof key === "number" && key < 0) ? b.length + key : key]))))) {
656
+ return false;
657
+ }
658
+ }
659
+ return true;
660
+ }
661
+ return false;
662
+ };
663
+ if (!ρσ_equals.__argnames__) Object.defineProperties(ρσ_equals, {
664
+ __argnames__ : {value: ["a", "b"]},
665
+ __module__ : {value: "__main__"}
666
+ });
667
+
668
+ function ρσ_not_equals(a, b) {
669
+ if (a === b) {
670
+ return false;
671
+ }
672
+ if (a && typeof a.__ne__ === "function") {
673
+ return a.__ne__(b);
674
+ }
675
+ if (b && typeof b.__ne__ === "function") {
676
+ return b.__ne__(a);
677
+ }
678
+ return !ρσ_equals(a, b);
679
+ };
680
+ if (!ρσ_not_equals.__argnames__) Object.defineProperties(ρσ_not_equals, {
681
+ __argnames__ : {value: ["a", "b"]},
682
+ __module__ : {value: "__main__"}
683
+ });
684
+
685
+ var equals = ρσ_equals;
686
+ function ρσ_list_extend(iterable) {
687
+ var start, iterator, result;
688
+ if (Array.isArray(iterable) || typeof iterable === "string") {
689
+ start = this.length;
690
+ this.length += iterable.length;
691
+ for (var i = 0; i < iterable.length; i++) {
692
+ (ρσ_expr_temp = this)[ρσ_bound_index(start + i, ρσ_expr_temp)] = iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i];
693
+ }
694
+ } else {
695
+ iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
696
+ result = iterator.next();
697
+ while (!result.done) {
698
+ this.push(result.value);
699
+ result = iterator.next();
700
+ }
701
+ }
702
+ };
703
+ if (!ρσ_list_extend.__argnames__) Object.defineProperties(ρσ_list_extend, {
704
+ __argnames__ : {value: ["iterable"]},
705
+ __module__ : {value: "__main__"}
706
+ });
707
+
708
+ function ρσ_list_index(val, start, stop) {
709
+ var idx;
710
+ start = start || 0;
711
+ if (start < 0) {
712
+ start = this.length + start;
713
+ }
714
+ if (start < 0) {
715
+ throw new ValueError(val + " is not in list");
716
+ }
717
+ if (stop === undefined) {
718
+ idx = this.indexOf(val, start);
719
+ if (idx === -1) {
720
+ throw new ValueError(val + " is not in list");
721
+ }
722
+ return idx;
723
+ }
724
+ if (stop < 0) {
725
+ stop = this.length + stop;
726
+ }
727
+ for (var i = start; i < stop; i++) {
728
+ if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === val || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], val))) {
729
+ return i;
730
+ }
731
+ }
732
+ throw new ValueError(val + " is not in list");
733
+ };
734
+ if (!ρσ_list_index.__argnames__) Object.defineProperties(ρσ_list_index, {
735
+ __argnames__ : {value: ["val", "start", "stop"]},
736
+ __module__ : {value: "__main__"}
737
+ });
738
+
739
+ function ρσ_list_pop(index) {
740
+ var ans;
741
+ if (this.length === 0) {
742
+ throw new IndexError("list is empty");
743
+ }
744
+ if (index === undefined) {
745
+ index = -1;
746
+ }
747
+ ans = this.splice(index, 1);
748
+ if (!ans.length) {
749
+ throw new IndexError("pop index out of range");
750
+ }
751
+ return ans[0];
752
+ };
753
+ if (!ρσ_list_pop.__argnames__) Object.defineProperties(ρσ_list_pop, {
754
+ __argnames__ : {value: ["index"]},
755
+ __module__ : {value: "__main__"}
756
+ });
757
+
758
+ function ρσ_list_remove(value) {
759
+ var idx;
760
+ idx = this.indexOf(value);
761
+ if (idx === -1) {
762
+ throw new ValueError(value + " not in list");
763
+ }
764
+ this.splice(idx, 1);
765
+ };
766
+ if (!ρσ_list_remove.__argnames__) Object.defineProperties(ρσ_list_remove, {
767
+ __argnames__ : {value: ["value"]},
768
+ __module__ : {value: "__main__"}
769
+ });
770
+
771
+ function ρσ_list_to_string() {
772
+ return "[" + this.join(", ") + "]";
773
+ };
774
+ if (!ρσ_list_to_string.__module__) Object.defineProperties(ρσ_list_to_string, {
775
+ __module__ : {value: "__main__"}
776
+ });
777
+
778
+ function ρσ_list_insert(index, val) {
779
+ if (index < 0) {
780
+ index += this.length;
781
+ }
782
+ index = min(this.length, max(index, 0));
783
+ if (index === 0) {
784
+ this.unshift(val);
785
+ return;
786
+ }
787
+ for (var i = this.length; i > index; i--) {
788
+ (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = (ρσ_expr_temp = this)[ρσ_bound_index(i - 1, ρσ_expr_temp)];
789
+ }
790
+ (ρσ_expr_temp = this)[(typeof index === "number" && index < 0) ? ρσ_expr_temp.length + index : index] = val;
791
+ };
792
+ if (!ρσ_list_insert.__argnames__) Object.defineProperties(ρσ_list_insert, {
793
+ __argnames__ : {value: ["index", "val"]},
794
+ __module__ : {value: "__main__"}
795
+ });
796
+
797
+ function ρσ_list_copy() {
798
+ return ρσ_list_constructor(this);
799
+ };
800
+ if (!ρσ_list_copy.__module__) Object.defineProperties(ρσ_list_copy, {
801
+ __module__ : {value: "__main__"}
802
+ });
803
+
804
+ function ρσ_list_clear() {
805
+ this.length = 0;
806
+ };
807
+ if (!ρσ_list_clear.__module__) Object.defineProperties(ρσ_list_clear, {
808
+ __module__ : {value: "__main__"}
809
+ });
810
+
811
+ function ρσ_list_as_array() {
812
+ return Array.prototype.slice.call(this);
813
+ };
814
+ if (!ρσ_list_as_array.__module__) Object.defineProperties(ρσ_list_as_array, {
815
+ __module__ : {value: "__main__"}
816
+ });
817
+
818
+ function ρσ_list_count(value) {
819
+ return this.reduce((function() {
820
+ var ρσ_anonfunc = function (n, val) {
821
+ return n + (val === value);
822
+ };
823
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
824
+ __argnames__ : {value: ["n", "val"]},
825
+ __module__ : {value: "__main__"}
826
+ });
827
+ return ρσ_anonfunc;
828
+ })(), 0);
829
+ };
830
+ if (!ρσ_list_count.__argnames__) Object.defineProperties(ρσ_list_count, {
831
+ __argnames__ : {value: ["value"]},
832
+ __module__ : {value: "__main__"}
833
+ });
834
+
835
+ function ρσ_list_sort_key(value) {
836
+ var t;
837
+ t = typeof value;
838
+ if (t === "string" || t === "number") {
839
+ return value;
840
+ }
841
+ return value.toString();
842
+ };
843
+ if (!ρσ_list_sort_key.__argnames__) Object.defineProperties(ρσ_list_sort_key, {
844
+ __argnames__ : {value: ["value"]},
845
+ __module__ : {value: "__main__"}
846
+ });
847
+
848
+ function ρσ_list_sort_cmp(a, b, ap, bp) {
849
+ if (a < b) {
850
+ return -1;
851
+ }
852
+ if (a > b) {
853
+ return 1;
854
+ }
855
+ return ap - bp;
856
+ };
857
+ if (!ρσ_list_sort_cmp.__argnames__) Object.defineProperties(ρσ_list_sort_cmp, {
858
+ __argnames__ : {value: ["a", "b", "ap", "bp"]},
859
+ __module__ : {value: "__main__"}
860
+ });
861
+
862
+ function ρσ_list_sort() {
863
+ var key = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_list_sort.__defaults__.key : arguments[0];
864
+ var reverse = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_list_sort.__defaults__.reverse : arguments[1];
865
+ var ρσ_kwargs_obj = arguments[arguments.length-1];
866
+ if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
867
+ if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "key")){
868
+ key = ρσ_kwargs_obj.key;
869
+ }
870
+ if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "reverse")){
871
+ reverse = ρσ_kwargs_obj.reverse;
872
+ }
873
+ var mult, keymap, posmap, k;
874
+ key = key || ρσ_list_sort_key;
875
+ mult = (reverse) ? -1 : 1;
876
+ keymap = dict();
877
+ posmap = dict();
878
+ for (var i=0; i < this.length; i++) {
879
+ k = (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
880
+ keymap.set(k, key(k));
881
+ posmap.set(k, i);
882
+ }
883
+ this.sort((function() {
884
+ var ρσ_anonfunc = function (a, b) {
885
+ return mult * ρσ_list_sort_cmp(keymap.get(a), keymap.get(b), posmap.get(a), posmap.get(b));
886
+ };
887
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
888
+ __argnames__ : {value: ["a", "b"]},
889
+ __module__ : {value: "__main__"}
890
+ });
891
+ return ρσ_anonfunc;
892
+ })());
893
+ };
894
+ if (!ρσ_list_sort.__defaults__) Object.defineProperties(ρσ_list_sort, {
895
+ __defaults__ : {value: {key:null, reverse:false}},
896
+ __handles_kwarg_interpolation__ : {value: true},
897
+ __argnames__ : {value: ["key", "reverse"]},
898
+ __module__ : {value: "__main__"}
899
+ });
900
+
901
+ function ρσ_list_concat() {
902
+ var ans;
903
+ ans = Array.prototype.concat.apply(this, arguments);
904
+ ρσ_list_decorate(ans);
905
+ return ans;
906
+ };
907
+ if (!ρσ_list_concat.__module__) Object.defineProperties(ρσ_list_concat, {
908
+ __module__ : {value: "__main__"}
909
+ });
910
+
911
+ function ρσ_list_slice() {
912
+ var ans;
913
+ ans = Array.prototype.slice.apply(this, arguments);
914
+ ρσ_list_decorate(ans);
915
+ return ans;
916
+ };
917
+ if (!ρσ_list_slice.__module__) Object.defineProperties(ρσ_list_slice, {
918
+ __module__ : {value: "__main__"}
919
+ });
920
+
921
+ function ρσ_list_iterator(value) {
922
+ var self;
923
+ self = this;
924
+ return (function(){
925
+ var ρσ_d = {};
926
+ ρσ_d["_i"] = -1;
927
+ ρσ_d["_list"] = self;
928
+ ρσ_d["next"] = (function() {
929
+ var ρσ_anonfunc = function () {
930
+ this._i += 1;
931
+ if (this._i >= this._list.length) {
932
+ return (function(){
933
+ var ρσ_d = {};
934
+ ρσ_d["done"] = true;
935
+ return ρσ_d;
936
+ }).call(this);
937
+ }
938
+ return (function(){
939
+ var ρσ_d = {};
940
+ ρσ_d["done"] = false;
941
+ ρσ_d["value"] = (ρσ_expr_temp = this._list)[ρσ_bound_index(this._i, ρσ_expr_temp)];
942
+ return ρσ_d;
943
+ }).call(this);
944
+ };
945
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
946
+ __module__ : {value: "__main__"}
947
+ });
948
+ return ρσ_anonfunc;
949
+ })();
950
+ return ρσ_d;
951
+ }).call(this);
952
+ };
953
+ if (!ρσ_list_iterator.__argnames__) Object.defineProperties(ρσ_list_iterator, {
954
+ __argnames__ : {value: ["value"]},
955
+ __module__ : {value: "__main__"}
956
+ });
957
+
958
+ function ρσ_list_len() {
959
+ return this.length;
960
+ };
961
+ if (!ρσ_list_len.__module__) Object.defineProperties(ρσ_list_len, {
962
+ __module__ : {value: "__main__"}
963
+ });
964
+
965
+ function ρσ_list_contains(val) {
966
+ for (var i = 0; i < this.length; i++) {
967
+ if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === val || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], val))) {
968
+ return true;
969
+ }
970
+ }
971
+ return false;
972
+ };
973
+ if (!ρσ_list_contains.__argnames__) Object.defineProperties(ρσ_list_contains, {
974
+ __argnames__ : {value: ["val"]},
975
+ __module__ : {value: "__main__"}
976
+ });
977
+
978
+ function ρσ_list_eq(other) {
979
+ if (!ρσ_arraylike(other)) {
980
+ return false;
981
+ }
982
+ if ((this.length !== other.length && (typeof this.length !== "object" || ρσ_not_equals(this.length, other.length)))) {
983
+ return false;
984
+ }
985
+ for (var i = 0; i < this.length; i++) {
986
+ if (!((((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === other[(typeof i === "number" && i < 0) ? other.length + i : i] || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], other[(typeof i === "number" && i < 0) ? other.length + i : i]))))) {
987
+ return false;
988
+ }
989
+ }
990
+ return true;
991
+ };
992
+ if (!ρσ_list_eq.__argnames__) Object.defineProperties(ρσ_list_eq, {
993
+ __argnames__ : {value: ["other"]},
994
+ __module__ : {value: "__main__"}
995
+ });
996
+
997
+ function ρσ_list_decorate(ans) {
998
+ ans.append = Array.prototype.push;
999
+ ans.toString = ρσ_list_to_string;
1000
+ ans.inspect = ρσ_list_to_string;
1001
+ ans.extend = ρσ_list_extend;
1002
+ ans.index = ρσ_list_index;
1003
+ ans.pypop = ρσ_list_pop;
1004
+ ans.remove = ρσ_list_remove;
1005
+ ans.insert = ρσ_list_insert;
1006
+ ans.copy = ρσ_list_copy;
1007
+ ans.clear = ρσ_list_clear;
1008
+ ans.count = ρσ_list_count;
1009
+ ans.concat = ρσ_list_concat;
1010
+ ans.pysort = ρσ_list_sort;
1011
+ ans.slice = ρσ_list_slice;
1012
+ ans.as_array = ρσ_list_as_array;
1013
+ ans.__len__ = ρσ_list_len;
1014
+ ans.__contains__ = ρσ_list_contains;
1015
+ ans.__eq__ = ρσ_list_eq;
1016
+ ans.constructor = ρσ_list_constructor;
1017
+ if (typeof ans[ρσ_iterator_symbol] !== "function") {
1018
+ ans[ρσ_iterator_symbol] = ρσ_list_iterator;
1019
+ }
1020
+ return ans;
1021
+ };
1022
+ if (!ρσ_list_decorate.__argnames__) Object.defineProperties(ρσ_list_decorate, {
1023
+ __argnames__ : {value: ["ans"]},
1024
+ __module__ : {value: "__main__"}
1025
+ });
1026
+
1027
+ function ρσ_list_constructor(iterable) {
1028
+ var ans, iterator, result;
1029
+ if (iterable === undefined) {
1030
+ ans = [];
1031
+ } else if (ρσ_arraylike(iterable)) {
1032
+ ans = new Array(iterable.length);
1033
+ for (var i = 0; i < iterable.length; i++) {
1034
+ ans[(typeof i === "number" && i < 0) ? ans.length + i : i] = iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i];
1035
+ }
1036
+ } else if (typeof iterable[ρσ_iterator_symbol] === "function") {
1037
+ iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
1038
+ ans = ρσ_list_decorate([]);
1039
+ result = iterator.next();
1040
+ while (!result.done) {
1041
+ ans.push(result.value);
1042
+ result = iterator.next();
1043
+ }
1044
+ } else if (typeof iterable === "number") {
1045
+ ans = new Array(iterable);
1046
+ } else {
1047
+ ans = Object.keys(iterable);
1048
+ }
1049
+ return ρσ_list_decorate(ans);
1050
+ };
1051
+ if (!ρσ_list_constructor.__argnames__) Object.defineProperties(ρσ_list_constructor, {
1052
+ __argnames__ : {value: ["iterable"]},
1053
+ __module__ : {value: "__main__"}
1054
+ });
1055
+
1056
+ ρσ_list_constructor.__name__ = "list";
1057
+ var list = ρσ_list_constructor, list_wrap = ρσ_list_decorate;
1058
+ function sorted() {
1059
+ var iterable = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
1060
+ var key = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? sorted.__defaults__.key : arguments[1];
1061
+ var reverse = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? sorted.__defaults__.reverse : arguments[2];
1062
+ var ρσ_kwargs_obj = arguments[arguments.length-1];
1063
+ if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
1064
+ if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "key")){
1065
+ key = ρσ_kwargs_obj.key;
1066
+ }
1067
+ if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "reverse")){
1068
+ reverse = ρσ_kwargs_obj.reverse;
1069
+ }
1070
+ var ans;
1071
+ ans = ρσ_list_constructor(iterable);
1072
+ ans.pysort(key, reverse);
1073
+ return ans;
1074
+ };
1075
+ if (!sorted.__defaults__) Object.defineProperties(sorted, {
1076
+ __defaults__ : {value: {key:null, reverse:false}},
1077
+ __handles_kwarg_interpolation__ : {value: true},
1078
+ __argnames__ : {value: ["iterable", "key", "reverse"]},
1079
+ __module__ : {value: "__main__"}
1080
+ });
1081
+
1082
+ var ρσ_global_object_id = 0, ρσ_set_implementation;
1083
+ function ρσ_set_keyfor(x) {
1084
+ var t, ans;
1085
+ t = typeof x;
1086
+ if (t === "string" || t === "number" || t === "boolean") {
1087
+ return "_" + t[0] + x;
1088
+ }
1089
+ if (x === null) {
1090
+ return "__!@#$0";
1091
+ }
1092
+ ans = x.ρσ_hash_key_prop;
1093
+ if (ans === undefined) {
1094
+ ans = "_!@#$" + (++ρσ_global_object_id);
1095
+ Object.defineProperty(x, "ρσ_hash_key_prop", (function(){
1096
+ var ρσ_d = {};
1097
+ ρσ_d["value"] = ans;
1098
+ return ρσ_d;
1099
+ }).call(this));
1100
+ }
1101
+ return ans;
1102
+ };
1103
+ if (!ρσ_set_keyfor.__argnames__) Object.defineProperties(ρσ_set_keyfor, {
1104
+ __argnames__ : {value: ["x"]},
1105
+ __module__ : {value: "__main__"}
1106
+ });
1107
+
1108
+ function ρσ_set_polyfill() {
1109
+ this._store = {};
1110
+ this.size = 0;
1111
+ };
1112
+ if (!ρσ_set_polyfill.__module__) Object.defineProperties(ρσ_set_polyfill, {
1113
+ __module__ : {value: "__main__"}
1114
+ });
1115
+
1116
+ ρσ_set_polyfill.prototype.add = (function() {
1117
+ var ρσ_anonfunc = function (x) {
1118
+ var key;
1119
+ key = ρσ_set_keyfor(x);
1120
+ if (!Object.prototype.hasOwnProperty.call(this._store, key)) {
1121
+ this.size += 1;
1122
+ (ρσ_expr_temp = this._store)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key] = x;
1123
+ }
1124
+ return this;
1125
+ };
1126
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1127
+ __argnames__ : {value: ["x"]},
1128
+ __module__ : {value: "__main__"}
1129
+ });
1130
+ return ρσ_anonfunc;
1131
+ })();
1132
+ ρσ_set_polyfill.prototype.clear = (function() {
1133
+ var ρσ_anonfunc = function (x) {
1134
+ this._store = {};
1135
+ this.size = 0;
1136
+ };
1137
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1138
+ __argnames__ : {value: ["x"]},
1139
+ __module__ : {value: "__main__"}
1140
+ });
1141
+ return ρσ_anonfunc;
1142
+ })();
1143
+ ρσ_set_polyfill.prototype.delete = (function() {
1144
+ var ρσ_anonfunc = function (x) {
1145
+ var key;
1146
+ key = ρσ_set_keyfor(x);
1147
+ if (Object.prototype.hasOwnProperty.call(this._store, key)) {
1148
+ this.size -= 1;
1149
+ delete this._store[key];
1150
+ return true;
1151
+ }
1152
+ return false;
1153
+ };
1154
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1155
+ __argnames__ : {value: ["x"]},
1156
+ __module__ : {value: "__main__"}
1157
+ });
1158
+ return ρσ_anonfunc;
1159
+ })();
1160
+ ρσ_set_polyfill.prototype.has = (function() {
1161
+ var ρσ_anonfunc = function (x) {
1162
+ return Object.prototype.hasOwnProperty.call(this._store, ρσ_set_keyfor(x));
1163
+ };
1164
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1165
+ __argnames__ : {value: ["x"]},
1166
+ __module__ : {value: "__main__"}
1167
+ });
1168
+ return ρσ_anonfunc;
1169
+ })();
1170
+ ρσ_set_polyfill.prototype.values = (function() {
1171
+ var ρσ_anonfunc = function (x) {
1172
+ var ans;
1173
+ ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store};
1174
+ ans[ρσ_iterator_symbol] = (function() {
1175
+ var ρσ_anonfunc = function () {
1176
+ return this;
1177
+ };
1178
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1179
+ __module__ : {value: "__main__"}
1180
+ });
1181
+ return ρσ_anonfunc;
1182
+ })();
1183
+ ans["next"] = (function() {
1184
+ var ρσ_anonfunc = function () {
1185
+ this._i += 1;
1186
+ if (this._i >= this._keys.length) {
1187
+ return {'done': true};
1188
+ }
1189
+ return {'done':false, 'value':this._s[this._keys[this._i]]};
1190
+ };
1191
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1192
+ __module__ : {value: "__main__"}
1193
+ });
1194
+ return ρσ_anonfunc;
1195
+ })();
1196
+ return ans;
1197
+ };
1198
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1199
+ __argnames__ : {value: ["x"]},
1200
+ __module__ : {value: "__main__"}
1201
+ });
1202
+ return ρσ_anonfunc;
1203
+ })();
1204
+ if (typeof Set !== "function" || typeof Set.prototype.delete !== "function") {
1205
+ ρσ_set_implementation = ρσ_set_polyfill;
1206
+ } else {
1207
+ ρσ_set_implementation = Set;
1208
+ }
1209
+ function ρσ_set(iterable) {
1210
+ var ans, s, iterator, result, keys;
1211
+ if (this instanceof ρσ_set) {
1212
+ this.jsset = new ρσ_set_implementation;
1213
+ ans = this;
1214
+ if (iterable === undefined) {
1215
+ return ans;
1216
+ }
1217
+ s = ans.jsset;
1218
+ if (ρσ_arraylike(iterable)) {
1219
+ for (var i = 0; i < iterable.length; i++) {
1220
+ s.add(iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i]);
1221
+ }
1222
+ } else if (typeof iterable[ρσ_iterator_symbol] === "function") {
1223
+ iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
1224
+ result = iterator.next();
1225
+ while (!result.done) {
1226
+ s.add(result.value);
1227
+ result = iterator.next();
1228
+ }
1229
+ } else {
1230
+ keys = Object.keys(iterable);
1231
+ for (var j=0; j < keys.length; j++) {
1232
+ s.add(keys[(typeof j === "number" && j < 0) ? keys.length + j : j]);
1233
+ }
1234
+ }
1235
+ return ans;
1236
+ } else {
1237
+ return new ρσ_set(iterable);
1238
+ }
1239
+ };
1240
+ if (!ρσ_set.__argnames__) Object.defineProperties(ρσ_set, {
1241
+ __argnames__ : {value: ["iterable"]},
1242
+ __module__ : {value: "__main__"}
1243
+ });
1244
+
1245
+ ρσ_set.prototype.__name__ = "set";
1246
+ Object.defineProperties(ρσ_set.prototype, (function(){
1247
+ var ρσ_d = {};
1248
+ ρσ_d["length"] = (function(){
1249
+ var ρσ_d = {};
1250
+ ρσ_d["get"] = (function() {
1251
+ var ρσ_anonfunc = function () {
1252
+ return this.jsset.size;
1253
+ };
1254
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1255
+ __module__ : {value: "__main__"}
1256
+ });
1257
+ return ρσ_anonfunc;
1258
+ })();
1259
+ return ρσ_d;
1260
+ }).call(this);
1261
+ ρσ_d["size"] = (function(){
1262
+ var ρσ_d = {};
1263
+ ρσ_d["get"] = (function() {
1264
+ var ρσ_anonfunc = function () {
1265
+ return this.jsset.size;
1266
+ };
1267
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1268
+ __module__ : {value: "__main__"}
1269
+ });
1270
+ return ρσ_anonfunc;
1271
+ })();
1272
+ return ρσ_d;
1273
+ }).call(this);
1274
+ return ρσ_d;
1275
+ }).call(this));
1276
+ ρσ_set.prototype.__len__ = (function() {
1277
+ var ρσ_anonfunc = function () {
1278
+ return this.jsset.size;
1279
+ };
1280
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1281
+ __module__ : {value: "__main__"}
1282
+ });
1283
+ return ρσ_anonfunc;
1284
+ })();
1285
+ ρσ_set.prototype.has = ρσ_set.prototype.__contains__ = (function() {
1286
+ var ρσ_anonfunc = function (x) {
1287
+ return this.jsset.has(x);
1288
+ };
1289
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1290
+ __argnames__ : {value: ["x"]},
1291
+ __module__ : {value: "__main__"}
1292
+ });
1293
+ return ρσ_anonfunc;
1294
+ })();
1295
+ ρσ_set.prototype.add = (function() {
1296
+ var ρσ_anonfunc = function (x) {
1297
+ this.jsset.add(x);
1298
+ };
1299
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1300
+ __argnames__ : {value: ["x"]},
1301
+ __module__ : {value: "__main__"}
1302
+ });
1303
+ return ρσ_anonfunc;
1304
+ })();
1305
+ ρσ_set.prototype.clear = (function() {
1306
+ var ρσ_anonfunc = function () {
1307
+ this.jsset.clear();
1308
+ };
1309
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1310
+ __module__ : {value: "__main__"}
1311
+ });
1312
+ return ρσ_anonfunc;
1313
+ })();
1314
+ ρσ_set.prototype.copy = (function() {
1315
+ var ρσ_anonfunc = function () {
1316
+ return ρσ_set(this);
1317
+ };
1318
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1319
+ __module__ : {value: "__main__"}
1320
+ });
1321
+ return ρσ_anonfunc;
1322
+ })();
1323
+ ρσ_set.prototype.discard = (function() {
1324
+ var ρσ_anonfunc = function (x) {
1325
+ this.jsset.delete(x);
1326
+ };
1327
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1328
+ __argnames__ : {value: ["x"]},
1329
+ __module__ : {value: "__main__"}
1330
+ });
1331
+ return ρσ_anonfunc;
1332
+ })();
1333
+ ρσ_set.prototype[ρσ_iterator_symbol] = (function() {
1334
+ var ρσ_anonfunc = function () {
1335
+ return this.jsset.values();
1336
+ };
1337
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1338
+ __module__ : {value: "__main__"}
1339
+ });
1340
+ return ρσ_anonfunc;
1341
+ })();
1342
+ ρσ_set.prototype.difference = (function() {
1343
+ var ρσ_anonfunc = function () {
1344
+ var ans, s, iterator, r, x, has;
1345
+ ans = new ρσ_set;
1346
+ s = ans.jsset;
1347
+ iterator = this.jsset.values();
1348
+ r = iterator.next();
1349
+ while (!r.done) {
1350
+ x = r.value;
1351
+ has = false;
1352
+ for (var i = 0; i < arguments.length; i++) {
1353
+ if (arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) {
1354
+ has = true;
1355
+ break;
1356
+ }
1357
+ }
1358
+ if (!has) {
1359
+ s.add(x);
1360
+ }
1361
+ r = iterator.next();
1362
+ }
1363
+ return ans;
1364
+ };
1365
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1366
+ __module__ : {value: "__main__"}
1367
+ });
1368
+ return ρσ_anonfunc;
1369
+ })();
1370
+ ρσ_set.prototype.difference_update = (function() {
1371
+ var ρσ_anonfunc = function () {
1372
+ var s, remove, iterator, r, x;
1373
+ s = this.jsset;
1374
+ remove = [];
1375
+ iterator = s.values();
1376
+ r = iterator.next();
1377
+ while (!r.done) {
1378
+ x = r.value;
1379
+ for (var i = 0; i < arguments.length; i++) {
1380
+ if (arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) {
1381
+ remove.push(x);
1382
+ break;
1383
+ }
1384
+ }
1385
+ r = iterator.next();
1386
+ }
1387
+ for (var j = 0; j < remove.length; j++) {
1388
+ s.delete(remove[(typeof j === "number" && j < 0) ? remove.length + j : j]);
1389
+ }
1390
+ };
1391
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1392
+ __module__ : {value: "__main__"}
1393
+ });
1394
+ return ρσ_anonfunc;
1395
+ })();
1396
+ ρσ_set.prototype.intersection = (function() {
1397
+ var ρσ_anonfunc = function () {
1398
+ var ans, s, iterator, r, x, has;
1399
+ ans = new ρσ_set;
1400
+ s = ans.jsset;
1401
+ iterator = this.jsset.values();
1402
+ r = iterator.next();
1403
+ while (!r.done) {
1404
+ x = r.value;
1405
+ has = true;
1406
+ for (var i = 0; i < arguments.length; i++) {
1407
+ if (!arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) {
1408
+ has = false;
1409
+ break;
1410
+ }
1411
+ }
1412
+ if (has) {
1413
+ s.add(x);
1414
+ }
1415
+ r = iterator.next();
1416
+ }
1417
+ return ans;
1418
+ };
1419
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1420
+ __module__ : {value: "__main__"}
1421
+ });
1422
+ return ρσ_anonfunc;
1423
+ })();
1424
+ ρσ_set.prototype.intersection_update = (function() {
1425
+ var ρσ_anonfunc = function () {
1426
+ var s, remove, iterator, r, x;
1427
+ s = this.jsset;
1428
+ remove = [];
1429
+ iterator = s.values();
1430
+ r = iterator.next();
1431
+ while (!r.done) {
1432
+ x = r.value;
1433
+ for (var i = 0; i < arguments.length; i++) {
1434
+ if (!arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i].has(x)) {
1435
+ remove.push(x);
1436
+ break;
1437
+ }
1438
+ }
1439
+ r = iterator.next();
1440
+ }
1441
+ for (var j = 0; j < remove.length; j++) {
1442
+ s.delete(remove[(typeof j === "number" && j < 0) ? remove.length + j : j]);
1443
+ }
1444
+ };
1445
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1446
+ __module__ : {value: "__main__"}
1447
+ });
1448
+ return ρσ_anonfunc;
1449
+ })();
1450
+ ρσ_set.prototype.isdisjoint = (function() {
1451
+ var ρσ_anonfunc = function (other) {
1452
+ var iterator, r, x;
1453
+ iterator = this.jsset.values();
1454
+ r = iterator.next();
1455
+ while (!r.done) {
1456
+ x = r.value;
1457
+ if (other.has(x)) {
1458
+ return false;
1459
+ }
1460
+ r = iterator.next();
1461
+ }
1462
+ return true;
1463
+ };
1464
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1465
+ __argnames__ : {value: ["other"]},
1466
+ __module__ : {value: "__main__"}
1467
+ });
1468
+ return ρσ_anonfunc;
1469
+ })();
1470
+ ρσ_set.prototype.issubset = (function() {
1471
+ var ρσ_anonfunc = function (other) {
1472
+ var iterator, r, x;
1473
+ iterator = this.jsset.values();
1474
+ r = iterator.next();
1475
+ while (!r.done) {
1476
+ x = r.value;
1477
+ if (!other.has(x)) {
1478
+ return false;
1479
+ }
1480
+ r = iterator.next();
1481
+ }
1482
+ return true;
1483
+ };
1484
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1485
+ __argnames__ : {value: ["other"]},
1486
+ __module__ : {value: "__main__"}
1487
+ });
1488
+ return ρσ_anonfunc;
1489
+ })();
1490
+ ρσ_set.prototype.issuperset = (function() {
1491
+ var ρσ_anonfunc = function (other) {
1492
+ var s, iterator, r, x;
1493
+ s = this.jsset;
1494
+ iterator = other.jsset.values();
1495
+ r = iterator.next();
1496
+ while (!r.done) {
1497
+ x = r.value;
1498
+ if (!s.has(x)) {
1499
+ return false;
1500
+ }
1501
+ r = iterator.next();
1502
+ }
1503
+ return true;
1504
+ };
1505
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1506
+ __argnames__ : {value: ["other"]},
1507
+ __module__ : {value: "__main__"}
1508
+ });
1509
+ return ρσ_anonfunc;
1510
+ })();
1511
+ ρσ_set.prototype.pop = (function() {
1512
+ var ρσ_anonfunc = function () {
1513
+ var iterator, r;
1514
+ iterator = this.jsset.values();
1515
+ r = iterator.next();
1516
+ if (r.done) {
1517
+ throw new KeyError("pop from an empty set");
1518
+ }
1519
+ this.jsset.delete(r.value);
1520
+ return r.value;
1521
+ };
1522
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1523
+ __module__ : {value: "__main__"}
1524
+ });
1525
+ return ρσ_anonfunc;
1526
+ })();
1527
+ ρσ_set.prototype.remove = (function() {
1528
+ var ρσ_anonfunc = function (x) {
1529
+ if (!this.jsset.delete(x)) {
1530
+ throw new KeyError(x.toString());
1531
+ }
1532
+ };
1533
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1534
+ __argnames__ : {value: ["x"]},
1535
+ __module__ : {value: "__main__"}
1536
+ });
1537
+ return ρσ_anonfunc;
1538
+ })();
1539
+ ρσ_set.prototype.symmetric_difference = (function() {
1540
+ var ρσ_anonfunc = function (other) {
1541
+ return this.union(other).difference(this.intersection(other));
1542
+ };
1543
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1544
+ __argnames__ : {value: ["other"]},
1545
+ __module__ : {value: "__main__"}
1546
+ });
1547
+ return ρσ_anonfunc;
1548
+ })();
1549
+ ρσ_set.prototype.symmetric_difference_update = (function() {
1550
+ var ρσ_anonfunc = function (other) {
1551
+ var common;
1552
+ common = this.intersection(other);
1553
+ this.update(other);
1554
+ this.difference_update(common);
1555
+ };
1556
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1557
+ __argnames__ : {value: ["other"]},
1558
+ __module__ : {value: "__main__"}
1559
+ });
1560
+ return ρσ_anonfunc;
1561
+ })();
1562
+ ρσ_set.prototype.union = (function() {
1563
+ var ρσ_anonfunc = function () {
1564
+ var ans;
1565
+ ans = ρσ_set(this);
1566
+ ans.update.apply(ans, arguments);
1567
+ return ans;
1568
+ };
1569
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1570
+ __module__ : {value: "__main__"}
1571
+ });
1572
+ return ρσ_anonfunc;
1573
+ })();
1574
+ ρσ_set.prototype.update = (function() {
1575
+ var ρσ_anonfunc = function () {
1576
+ var s, iterator, r;
1577
+ s = this.jsset;
1578
+ for (var i=0; i < arguments.length; i++) {
1579
+ iterator = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i][ρσ_iterator_symbol]();
1580
+ r = iterator.next();
1581
+ while (!r.done) {
1582
+ s.add(r.value);
1583
+ r = iterator.next();
1584
+ }
1585
+ }
1586
+ };
1587
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1588
+ __module__ : {value: "__main__"}
1589
+ });
1590
+ return ρσ_anonfunc;
1591
+ })();
1592
+ ρσ_set.prototype.toString = ρσ_set.prototype.__repr__ = ρσ_set.prototype.__str__ = ρσ_set.prototype.inspect = (function() {
1593
+ var ρσ_anonfunc = function () {
1594
+ return "{" + list(this).join(", ") + "}";
1595
+ };
1596
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1597
+ __module__ : {value: "__main__"}
1598
+ });
1599
+ return ρσ_anonfunc;
1600
+ })();
1601
+ ρσ_set.prototype.__eq__ = (function() {
1602
+ var ρσ_anonfunc = function (other) {
1603
+ var iterator, r;
1604
+ if (!other instanceof this.constructor) {
1605
+ return false;
1606
+ }
1607
+ if (other.size !== this.size) {
1608
+ return false;
1609
+ }
1610
+ if (other.size === 0) {
1611
+ return true;
1612
+ }
1613
+ iterator = other[ρσ_iterator_symbol]();
1614
+ r = iterator.next();
1615
+ while (!r.done) {
1616
+ if (!this.has(r.value)) {
1617
+ return false;
1618
+ }
1619
+ r = iterator.next();
1620
+ }
1621
+ return true;
1622
+ };
1623
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1624
+ __argnames__ : {value: ["other"]},
1625
+ __module__ : {value: "__main__"}
1626
+ });
1627
+ return ρσ_anonfunc;
1628
+ })();
1629
+ function ρσ_set_wrap(x) {
1630
+ var ans;
1631
+ ans = new ρσ_set;
1632
+ ans.jsset = x;
1633
+ return ans;
1634
+ };
1635
+ if (!ρσ_set_wrap.__argnames__) Object.defineProperties(ρσ_set_wrap, {
1636
+ __argnames__ : {value: ["x"]},
1637
+ __module__ : {value: "__main__"}
1638
+ });
1639
+
1640
+ var set = ρσ_set, set_wrap = ρσ_set_wrap;
1641
+ var ρσ_dict_implementation;
1642
+ function ρσ_dict_polyfill() {
1643
+ this._store = {};
1644
+ this.size = 0;
1645
+ };
1646
+ if (!ρσ_dict_polyfill.__module__) Object.defineProperties(ρσ_dict_polyfill, {
1647
+ __module__ : {value: "__main__"}
1648
+ });
1649
+
1650
+ ρσ_dict_polyfill.prototype.set = (function() {
1651
+ var ρσ_anonfunc = function (x, value) {
1652
+ var key;
1653
+ key = ρσ_set_keyfor(x);
1654
+ if (!Object.prototype.hasOwnProperty.call(this._store, key)) {
1655
+ this.size += 1;
1656
+ }
1657
+ (ρσ_expr_temp = this._store)[(typeof key === "number" && key < 0) ? ρσ_expr_temp.length + key : key] = [x, value];
1658
+ return this;
1659
+ };
1660
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1661
+ __argnames__ : {value: ["x", "value"]},
1662
+ __module__ : {value: "__main__"}
1663
+ });
1664
+ return ρσ_anonfunc;
1665
+ })();
1666
+ ρσ_dict_polyfill.prototype.clear = (function() {
1667
+ var ρσ_anonfunc = function (x) {
1668
+ this._store = {};
1669
+ this.size = 0;
1670
+ };
1671
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1672
+ __argnames__ : {value: ["x"]},
1673
+ __module__ : {value: "__main__"}
1674
+ });
1675
+ return ρσ_anonfunc;
1676
+ })();
1677
+ ρσ_dict_polyfill.prototype.delete = (function() {
1678
+ var ρσ_anonfunc = function (x) {
1679
+ var key;
1680
+ key = ρσ_set_keyfor(x);
1681
+ if (Object.prototype.hasOwnProperty.call(this._store, key)) {
1682
+ this.size -= 1;
1683
+ delete this._store[key];
1684
+ return true;
1685
+ }
1686
+ return false;
1687
+ };
1688
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1689
+ __argnames__ : {value: ["x"]},
1690
+ __module__ : {value: "__main__"}
1691
+ });
1692
+ return ρσ_anonfunc;
1693
+ })();
1694
+ ρσ_dict_polyfill.prototype.has = (function() {
1695
+ var ρσ_anonfunc = function (x) {
1696
+ return Object.prototype.hasOwnProperty.call(this._store, ρσ_set_keyfor(x));
1697
+ };
1698
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1699
+ __argnames__ : {value: ["x"]},
1700
+ __module__ : {value: "__main__"}
1701
+ });
1702
+ return ρσ_anonfunc;
1703
+ })();
1704
+ ρσ_dict_polyfill.prototype.get = (function() {
1705
+ var ρσ_anonfunc = function (x) {
1706
+ try {
1707
+ return (ρσ_expr_temp = this._store)[ρσ_bound_index(ρσ_set_keyfor(x), ρσ_expr_temp)][1];
1708
+ } catch (ρσ_Exception) {
1709
+ ρσ_last_exception = ρσ_Exception;
1710
+ if (ρσ_Exception instanceof TypeError) {
1711
+ return undefined;
1712
+ } else {
1713
+ throw ρσ_Exception;
1714
+ }
1715
+ }
1716
+ };
1717
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1718
+ __argnames__ : {value: ["x"]},
1719
+ __module__ : {value: "__main__"}
1720
+ });
1721
+ return ρσ_anonfunc;
1722
+ })();
1723
+ ρσ_dict_polyfill.prototype.values = (function() {
1724
+ var ρσ_anonfunc = function (x) {
1725
+ var ans;
1726
+ ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store};
1727
+ ans[ρσ_iterator_symbol] = (function() {
1728
+ var ρσ_anonfunc = function () {
1729
+ return this;
1730
+ };
1731
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1732
+ __module__ : {value: "__main__"}
1733
+ });
1734
+ return ρσ_anonfunc;
1735
+ })();
1736
+ ans["next"] = (function() {
1737
+ var ρσ_anonfunc = function () {
1738
+ this._i += 1;
1739
+ if (this._i >= this._keys.length) {
1740
+ return {'done': true};
1741
+ }
1742
+ return {'done':false, 'value':this._s[this._keys[this._i]][1]};
1743
+ };
1744
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1745
+ __module__ : {value: "__main__"}
1746
+ });
1747
+ return ρσ_anonfunc;
1748
+ })();
1749
+ return ans;
1750
+ };
1751
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1752
+ __argnames__ : {value: ["x"]},
1753
+ __module__ : {value: "__main__"}
1754
+ });
1755
+ return ρσ_anonfunc;
1756
+ })();
1757
+ ρσ_dict_polyfill.prototype.keys = (function() {
1758
+ var ρσ_anonfunc = function (x) {
1759
+ var ans;
1760
+ ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store};
1761
+ ans[ρσ_iterator_symbol] = (function() {
1762
+ var ρσ_anonfunc = function () {
1763
+ return this;
1764
+ };
1765
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1766
+ __module__ : {value: "__main__"}
1767
+ });
1768
+ return ρσ_anonfunc;
1769
+ })();
1770
+ ans["next"] = (function() {
1771
+ var ρσ_anonfunc = function () {
1772
+ this._i += 1;
1773
+ if (this._i >= this._keys.length) {
1774
+ return {'done': true};
1775
+ }
1776
+ return {'done':false, 'value':this._s[this._keys[this._i]][0]};
1777
+ };
1778
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1779
+ __module__ : {value: "__main__"}
1780
+ });
1781
+ return ρσ_anonfunc;
1782
+ })();
1783
+ return ans;
1784
+ };
1785
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1786
+ __argnames__ : {value: ["x"]},
1787
+ __module__ : {value: "__main__"}
1788
+ });
1789
+ return ρσ_anonfunc;
1790
+ })();
1791
+ ρσ_dict_polyfill.prototype.entries = (function() {
1792
+ var ρσ_anonfunc = function (x) {
1793
+ var ans;
1794
+ ans = {'_keys': Object.keys(this._store), '_i':-1, '_s':this._store};
1795
+ ans[ρσ_iterator_symbol] = (function() {
1796
+ var ρσ_anonfunc = function () {
1797
+ return this;
1798
+ };
1799
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1800
+ __module__ : {value: "__main__"}
1801
+ });
1802
+ return ρσ_anonfunc;
1803
+ })();
1804
+ ans["next"] = (function() {
1805
+ var ρσ_anonfunc = function () {
1806
+ this._i += 1;
1807
+ if (this._i >= this._keys.length) {
1808
+ return {'done': true};
1809
+ }
1810
+ return {'done':false, 'value':this._s[this._keys[this._i]]};
1811
+ };
1812
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1813
+ __module__ : {value: "__main__"}
1814
+ });
1815
+ return ρσ_anonfunc;
1816
+ })();
1817
+ return ans;
1818
+ };
1819
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1820
+ __argnames__ : {value: ["x"]},
1821
+ __module__ : {value: "__main__"}
1822
+ });
1823
+ return ρσ_anonfunc;
1824
+ })();
1825
+ if (typeof Map !== "function" || typeof Map.prototype.delete !== "function") {
1826
+ ρσ_dict_implementation = ρσ_dict_polyfill;
1827
+ } else {
1828
+ ρσ_dict_implementation = Map;
1829
+ }
1830
+ function ρσ_dict() {
1831
+ var iterable = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
1832
+ var kw = arguments[arguments.length-1];
1833
+ if (kw === null || typeof kw !== "object" || kw [ρσ_kwargs_symbol] !== true) kw = {};
1834
+ if (this instanceof ρσ_dict) {
1835
+ this.jsmap = new ρσ_dict_implementation;
1836
+ if (iterable !== undefined) {
1837
+ this.update(iterable);
1838
+ }
1839
+ this.update(kw);
1840
+ return this;
1841
+ } else {
1842
+ return ρσ_interpolate_kwargs_constructor.call(Object.create(ρσ_dict.prototype), false, ρσ_dict, [iterable].concat([ρσ_desugar_kwargs(kw)]));
1843
+ }
1844
+ };
1845
+ if (!ρσ_dict.__handles_kwarg_interpolation__) Object.defineProperties(ρσ_dict, {
1846
+ __handles_kwarg_interpolation__ : {value: true},
1847
+ __argnames__ : {value: ["iterable"]},
1848
+ __module__ : {value: "__main__"}
1849
+ });
1850
+
1851
+ ρσ_dict.prototype.__name__ = "dict";
1852
+ Object.defineProperties(ρσ_dict.prototype, (function(){
1853
+ var ρσ_d = {};
1854
+ ρσ_d["length"] = (function(){
1855
+ var ρσ_d = {};
1856
+ ρσ_d["get"] = (function() {
1857
+ var ρσ_anonfunc = function () {
1858
+ return this.jsmap.size;
1859
+ };
1860
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1861
+ __module__ : {value: "__main__"}
1862
+ });
1863
+ return ρσ_anonfunc;
1864
+ })();
1865
+ return ρσ_d;
1866
+ }).call(this);
1867
+ ρσ_d["size"] = (function(){
1868
+ var ρσ_d = {};
1869
+ ρσ_d["get"] = (function() {
1870
+ var ρσ_anonfunc = function () {
1871
+ return this.jsmap.size;
1872
+ };
1873
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1874
+ __module__ : {value: "__main__"}
1875
+ });
1876
+ return ρσ_anonfunc;
1877
+ })();
1878
+ return ρσ_d;
1879
+ }).call(this);
1880
+ return ρσ_d;
1881
+ }).call(this));
1882
+ ρσ_dict.prototype.__len__ = (function() {
1883
+ var ρσ_anonfunc = function () {
1884
+ return this.jsmap.size;
1885
+ };
1886
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1887
+ __module__ : {value: "__main__"}
1888
+ });
1889
+ return ρσ_anonfunc;
1890
+ })();
1891
+ ρσ_dict.prototype.has = ρσ_dict.prototype.__contains__ = (function() {
1892
+ var ρσ_anonfunc = function (x) {
1893
+ return this.jsmap.has(x);
1894
+ };
1895
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1896
+ __argnames__ : {value: ["x"]},
1897
+ __module__ : {value: "__main__"}
1898
+ });
1899
+ return ρσ_anonfunc;
1900
+ })();
1901
+ ρσ_dict.prototype.set = ρσ_dict.prototype.__setitem__ = (function() {
1902
+ var ρσ_anonfunc = function (key, value) {
1903
+ this.jsmap.set(key, value);
1904
+ };
1905
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1906
+ __argnames__ : {value: ["key", "value"]},
1907
+ __module__ : {value: "__main__"}
1908
+ });
1909
+ return ρσ_anonfunc;
1910
+ })();
1911
+ ρσ_dict.prototype.__delitem__ = (function() {
1912
+ var ρσ_anonfunc = function (key) {
1913
+ this.jsmap.delete(key);
1914
+ };
1915
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1916
+ __argnames__ : {value: ["key"]},
1917
+ __module__ : {value: "__main__"}
1918
+ });
1919
+ return ρσ_anonfunc;
1920
+ })();
1921
+ ρσ_dict.prototype.clear = (function() {
1922
+ var ρσ_anonfunc = function () {
1923
+ this.jsmap.clear();
1924
+ };
1925
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1926
+ __module__ : {value: "__main__"}
1927
+ });
1928
+ return ρσ_anonfunc;
1929
+ })();
1930
+ ρσ_dict.prototype.copy = (function() {
1931
+ var ρσ_anonfunc = function () {
1932
+ return ρσ_dict(this);
1933
+ };
1934
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1935
+ __module__ : {value: "__main__"}
1936
+ });
1937
+ return ρσ_anonfunc;
1938
+ })();
1939
+ ρσ_dict.prototype.keys = (function() {
1940
+ var ρσ_anonfunc = function () {
1941
+ return this.jsmap.keys();
1942
+ };
1943
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1944
+ __module__ : {value: "__main__"}
1945
+ });
1946
+ return ρσ_anonfunc;
1947
+ })();
1948
+ ρσ_dict.prototype.values = (function() {
1949
+ var ρσ_anonfunc = function () {
1950
+ return this.jsmap.values();
1951
+ };
1952
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1953
+ __module__ : {value: "__main__"}
1954
+ });
1955
+ return ρσ_anonfunc;
1956
+ })();
1957
+ ρσ_dict.prototype.items = ρσ_dict.prototype.entries = (function() {
1958
+ var ρσ_anonfunc = function () {
1959
+ return this.jsmap.entries();
1960
+ };
1961
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1962
+ __module__ : {value: "__main__"}
1963
+ });
1964
+ return ρσ_anonfunc;
1965
+ })();
1966
+ ρσ_dict.prototype[ρσ_iterator_symbol] = (function() {
1967
+ var ρσ_anonfunc = function () {
1968
+ return this.jsmap.keys();
1969
+ };
1970
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
1971
+ __module__ : {value: "__main__"}
1972
+ });
1973
+ return ρσ_anonfunc;
1974
+ })();
1975
+ ρσ_dict.prototype.__getitem__ = (function() {
1976
+ var ρσ_anonfunc = function (key) {
1977
+ var ans;
1978
+ ans = this.jsmap.get(key);
1979
+ if (ans === undefined && !this.jsmap.has(key)) {
1980
+ throw new KeyError(key + "");
1981
+ }
1982
+ return ans;
1983
+ };
1984
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
1985
+ __argnames__ : {value: ["key"]},
1986
+ __module__ : {value: "__main__"}
1987
+ });
1988
+ return ρσ_anonfunc;
1989
+ })();
1990
+ ρσ_dict.prototype.get = (function() {
1991
+ var ρσ_anonfunc = function (key, defval) {
1992
+ var ans;
1993
+ ans = this.jsmap.get(key);
1994
+ if (ans === undefined && !this.jsmap.has(key)) {
1995
+ return (defval === undefined) ? null : defval;
1996
+ }
1997
+ return ans;
1998
+ };
1999
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2000
+ __argnames__ : {value: ["key", "defval"]},
2001
+ __module__ : {value: "__main__"}
2002
+ });
2003
+ return ρσ_anonfunc;
2004
+ })();
2005
+ ρσ_dict.prototype.set_default = (function() {
2006
+ var ρσ_anonfunc = function (key, defval) {
2007
+ var j;
2008
+ j = this.jsmap;
2009
+ if (!j.has(key)) {
2010
+ j.set(key, defval);
2011
+ return defval;
2012
+ }
2013
+ return j.get(key);
2014
+ };
2015
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2016
+ __argnames__ : {value: ["key", "defval"]},
2017
+ __module__ : {value: "__main__"}
2018
+ });
2019
+ return ρσ_anonfunc;
2020
+ })();
2021
+ ρσ_dict.fromkeys = ρσ_dict.prototype.fromkeys = (function() {
2022
+ var ρσ_anonfunc = function () {
2023
+ var iterable = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
2024
+ var value = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_anonfunc.__defaults__.value : arguments[1];
2025
+ var ρσ_kwargs_obj = arguments[arguments.length-1];
2026
+ if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
2027
+ if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "value")){
2028
+ value = ρσ_kwargs_obj.value;
2029
+ }
2030
+ var ans, iterator, r;
2031
+ ans = ρσ_dict();
2032
+ iterator = iter(iterable);
2033
+ r = iterator.next();
2034
+ while (!r.done) {
2035
+ ans.set(r.value, value);
2036
+ r = iterator.next();
2037
+ }
2038
+ return ans;
2039
+ };
2040
+ if (!ρσ_anonfunc.__defaults__) Object.defineProperties(ρσ_anonfunc, {
2041
+ __defaults__ : {value: {value:null}},
2042
+ __handles_kwarg_interpolation__ : {value: true},
2043
+ __argnames__ : {value: ["iterable", "value"]},
2044
+ __module__ : {value: "__main__"}
2045
+ });
2046
+ return ρσ_anonfunc;
2047
+ })();
2048
+ ρσ_dict.prototype.pop = (function() {
2049
+ var ρσ_anonfunc = function (key, defval) {
2050
+ var ans;
2051
+ ans = this.jsmap.get(key);
2052
+ if (ans === undefined && !this.jsmap.has(key)) {
2053
+ if (defval === undefined) {
2054
+ throw new KeyError(key);
2055
+ }
2056
+ return defval;
2057
+ }
2058
+ this.jsmap.delete(key);
2059
+ return ans;
2060
+ };
2061
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2062
+ __argnames__ : {value: ["key", "defval"]},
2063
+ __module__ : {value: "__main__"}
2064
+ });
2065
+ return ρσ_anonfunc;
2066
+ })();
2067
+ ρσ_dict.prototype.popitem = (function() {
2068
+ var ρσ_anonfunc = function () {
2069
+ var last, e, r;
2070
+ last = null;
2071
+ e = this.jsmap.entries();
2072
+ while (true) {
2073
+ r = e.next();
2074
+ if (r.done) {
2075
+ if (last === null) {
2076
+ throw new KeyError("dict is empty");
2077
+ }
2078
+ this.jsmap.delete(last.value[0]);
2079
+ return last.value;
2080
+ }
2081
+ last = r;
2082
+ }
2083
+ };
2084
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
2085
+ __module__ : {value: "__main__"}
2086
+ });
2087
+ return ρσ_anonfunc;
2088
+ })();
2089
+ ρσ_dict.prototype.update = (function() {
2090
+ var ρσ_anonfunc = function () {
2091
+ var m, iterable, iterator, result, keys;
2092
+ if (arguments.length === 0) {
2093
+ return;
2094
+ }
2095
+ m = this.jsmap;
2096
+ iterable = arguments[0];
2097
+ if (Array.isArray(iterable)) {
2098
+ for (var i = 0; i < iterable.length; i++) {
2099
+ m.set(iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i][0], iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i][1]);
2100
+ }
2101
+ } else if (iterable instanceof ρσ_dict) {
2102
+ iterator = iterable.items();
2103
+ result = iterator.next();
2104
+ while (!result.done) {
2105
+ m.set(result.value[0], result.value[1]);
2106
+ result = iterator.next();
2107
+ }
2108
+ } else if (typeof Map === "function" && iterable instanceof Map) {
2109
+ iterator = iterable.entries();
2110
+ result = iterator.next();
2111
+ while (!result.done) {
2112
+ m.set(result.value[0], result.value[1]);
2113
+ result = iterator.next();
2114
+ }
2115
+ } else if (typeof iterable[ρσ_iterator_symbol] === "function") {
2116
+ iterator = iterable[ρσ_iterator_symbol]();
2117
+ result = iterator.next();
2118
+ while (!result.done) {
2119
+ m.set(result.value[0], result.value[1]);
2120
+ result = iterator.next();
2121
+ }
2122
+ } else {
2123
+ keys = Object.keys(iterable);
2124
+ for (var j=0; j < keys.length; j++) {
2125
+ if (keys[(typeof j === "number" && j < 0) ? keys.length + j : j] !== ρσ_iterator_symbol) {
2126
+ m.set(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], iterable[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], iterable)]);
2127
+ }
2128
+ }
2129
+ }
2130
+ if (arguments.length > 1) {
2131
+ ρσ_dict.prototype.update.call(this, arguments[1]);
2132
+ }
2133
+ };
2134
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
2135
+ __module__ : {value: "__main__"}
2136
+ });
2137
+ return ρσ_anonfunc;
2138
+ })();
2139
+ ρσ_dict.prototype.toString = ρσ_dict.prototype.inspect = ρσ_dict.prototype.__str__ = ρσ_dict.prototype.__repr__ = (function() {
2140
+ var ρσ_anonfunc = function () {
2141
+ var entries, iterator, r;
2142
+ entries = [];
2143
+ iterator = this.jsmap.entries();
2144
+ r = iterator.next();
2145
+ while (!r.done) {
2146
+ entries.push(ρσ_repr(r.value[0]) + ": " + ρσ_repr(r.value[1]));
2147
+ r = iterator.next();
2148
+ }
2149
+ return "{" + entries.join(", ") + "}";
2150
+ };
2151
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
2152
+ __module__ : {value: "__main__"}
2153
+ });
2154
+ return ρσ_anonfunc;
2155
+ })();
2156
+ ρσ_dict.prototype.__eq__ = (function() {
2157
+ var ρσ_anonfunc = function (other) {
2158
+ var iterator, r, x;
2159
+ if (!(other instanceof this.constructor)) {
2160
+ return false;
2161
+ }
2162
+ if (other.size !== this.size) {
2163
+ return false;
2164
+ }
2165
+ if (other.size === 0) {
2166
+ return true;
2167
+ }
2168
+ iterator = other.items();
2169
+ r = iterator.next();
2170
+ while (!r.done) {
2171
+ x = this.jsmap.get(r.value[0]);
2172
+ if (x === undefined && !this.jsmap.has(r.value[0]) || x !== r.value[1]) {
2173
+ return false;
2174
+ }
2175
+ r = iterator.next();
2176
+ }
2177
+ return true;
2178
+ };
2179
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2180
+ __argnames__ : {value: ["other"]},
2181
+ __module__ : {value: "__main__"}
2182
+ });
2183
+ return ρσ_anonfunc;
2184
+ })();
2185
+ ρσ_dict.prototype.as_object = (function() {
2186
+ var ρσ_anonfunc = function (other) {
2187
+ var ans, iterator, r;
2188
+ ans = {};
2189
+ iterator = this.jsmap.entries();
2190
+ r = iterator.next();
2191
+ while (!r.done) {
2192
+ ans[ρσ_bound_index(r.value[0], ans)] = r.value[1];
2193
+ r = iterator.next();
2194
+ }
2195
+ return ans;
2196
+ };
2197
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2198
+ __argnames__ : {value: ["other"]},
2199
+ __module__ : {value: "__main__"}
2200
+ });
2201
+ return ρσ_anonfunc;
2202
+ })();
2203
+ function ρσ_dict_wrap(x) {
2204
+ var ans;
2205
+ ans = new ρσ_dict;
2206
+ ans.jsmap = x;
2207
+ return ans;
2208
+ };
2209
+ if (!ρσ_dict_wrap.__argnames__) Object.defineProperties(ρσ_dict_wrap, {
2210
+ __argnames__ : {value: ["x"]},
2211
+ __module__ : {value: "__main__"}
2212
+ });
2213
+
2214
+ var dict = ρσ_dict, dict_wrap = ρσ_dict_wrap;// }}}
2215
+ var NameError;
2216
+ NameError = ReferenceError;
2217
+ function Exception() {
2218
+ if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
2219
+ Exception.prototype.__init__.apply(this, arguments);
2220
+ }
2221
+ ρσ_extends(Exception, Error);
2222
+ Exception.prototype.__init__ = function __init__(message) {
2223
+ var self = this;
2224
+ self.message = message;
2225
+ self.stack = (new Error).stack;
2226
+ self.name = self.constructor.name;
2227
+ };
2228
+ if (!Exception.prototype.__init__.__argnames__) Object.defineProperties(Exception.prototype.__init__, {
2229
+ __argnames__ : {value: ["message"]},
2230
+ __module__ : {value: "__main__"}
2231
+ });
2232
+ Exception.__argnames__ = Exception.prototype.__init__.__argnames__;
2233
+ Exception.__handles_kwarg_interpolation__ = Exception.prototype.__init__.__handles_kwarg_interpolation__;
2234
+ Exception.prototype.__repr__ = function __repr__() {
2235
+ var self = this;
2236
+ return self.name + ": " + self.message;
2237
+ };
2238
+ if (!Exception.prototype.__repr__.__module__) Object.defineProperties(Exception.prototype.__repr__, {
2239
+ __module__ : {value: "__main__"}
2240
+ });
2241
+ Exception.prototype.__str__ = function __str__ () {
2242
+ if(Error.prototype.__str__) return Error.prototype.__str__.call(this);
2243
+ return this.__repr__();
2244
+ };
2245
+ Object.defineProperty(Exception.prototype, "__bases__", {value: [Error]});
2246
+
2247
+ function AttributeError() {
2248
+ if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
2249
+ AttributeError.prototype.__init__.apply(this, arguments);
2250
+ }
2251
+ ρσ_extends(AttributeError, Exception);
2252
+ AttributeError.prototype.__init__ = function __init__ () {
2253
+ Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
2254
+ };
2255
+ AttributeError.prototype.__repr__ = function __repr__ () {
2256
+ if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
2257
+ return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
2258
+ };
2259
+ AttributeError.prototype.__str__ = function __str__ () {
2260
+ if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
2261
+ return this.__repr__();
2262
+ };
2263
+ Object.defineProperty(AttributeError.prototype, "__bases__", {value: [Exception]});
2264
+
2265
+
2266
+ function IndexError() {
2267
+ if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
2268
+ IndexError.prototype.__init__.apply(this, arguments);
2269
+ }
2270
+ ρσ_extends(IndexError, Exception);
2271
+ IndexError.prototype.__init__ = function __init__ () {
2272
+ Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
2273
+ };
2274
+ IndexError.prototype.__repr__ = function __repr__ () {
2275
+ if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
2276
+ return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
2277
+ };
2278
+ IndexError.prototype.__str__ = function __str__ () {
2279
+ if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
2280
+ return this.__repr__();
2281
+ };
2282
+ Object.defineProperty(IndexError.prototype, "__bases__", {value: [Exception]});
2283
+
2284
+
2285
+ function KeyError() {
2286
+ if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
2287
+ KeyError.prototype.__init__.apply(this, arguments);
2288
+ }
2289
+ ρσ_extends(KeyError, Exception);
2290
+ KeyError.prototype.__init__ = function __init__ () {
2291
+ Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
2292
+ };
2293
+ KeyError.prototype.__repr__ = function __repr__ () {
2294
+ if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
2295
+ return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
2296
+ };
2297
+ KeyError.prototype.__str__ = function __str__ () {
2298
+ if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
2299
+ return this.__repr__();
2300
+ };
2301
+ Object.defineProperty(KeyError.prototype, "__bases__", {value: [Exception]});
2302
+
2303
+
2304
+ function ValueError() {
2305
+ if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
2306
+ ValueError.prototype.__init__.apply(this, arguments);
2307
+ }
2308
+ ρσ_extends(ValueError, Exception);
2309
+ ValueError.prototype.__init__ = function __init__ () {
2310
+ Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
2311
+ };
2312
+ ValueError.prototype.__repr__ = function __repr__ () {
2313
+ if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
2314
+ return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
2315
+ };
2316
+ ValueError.prototype.__str__ = function __str__ () {
2317
+ if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
2318
+ return this.__repr__();
2319
+ };
2320
+ Object.defineProperty(ValueError.prototype, "__bases__", {value: [Exception]});
2321
+
2322
+
2323
+ function UnicodeDecodeError() {
2324
+ if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
2325
+ UnicodeDecodeError.prototype.__init__.apply(this, arguments);
2326
+ }
2327
+ ρσ_extends(UnicodeDecodeError, Exception);
2328
+ UnicodeDecodeError.prototype.__init__ = function __init__ () {
2329
+ Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
2330
+ };
2331
+ UnicodeDecodeError.prototype.__repr__ = function __repr__ () {
2332
+ if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
2333
+ return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
2334
+ };
2335
+ UnicodeDecodeError.prototype.__str__ = function __str__ () {
2336
+ if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
2337
+ return this.__repr__();
2338
+ };
2339
+ Object.defineProperty(UnicodeDecodeError.prototype, "__bases__", {value: [Exception]});
2340
+
2341
+
2342
+ function AssertionError() {
2343
+ if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
2344
+ AssertionError.prototype.__init__.apply(this, arguments);
2345
+ }
2346
+ ρσ_extends(AssertionError, Exception);
2347
+ AssertionError.prototype.__init__ = function __init__ () {
2348
+ Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
2349
+ };
2350
+ AssertionError.prototype.__repr__ = function __repr__ () {
2351
+ if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
2352
+ return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
2353
+ };
2354
+ AssertionError.prototype.__str__ = function __str__ () {
2355
+ if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
2356
+ return this.__repr__();
2357
+ };
2358
+ Object.defineProperty(AssertionError.prototype, "__bases__", {value: [Exception]});
2359
+
2360
+
2361
+ function ZeroDivisionError() {
2362
+ if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
2363
+ ZeroDivisionError.prototype.__init__.apply(this, arguments);
2364
+ }
2365
+ ρσ_extends(ZeroDivisionError, Exception);
2366
+ ZeroDivisionError.prototype.__init__ = function __init__ () {
2367
+ Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
2368
+ };
2369
+ ZeroDivisionError.prototype.__repr__ = function __repr__ () {
2370
+ if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
2371
+ return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
2372
+ };
2373
+ ZeroDivisionError.prototype.__str__ = function __str__ () {
2374
+ if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
2375
+ return this.__repr__();
2376
+ };
2377
+ Object.defineProperty(ZeroDivisionError.prototype, "__bases__", {value: [Exception]});
2378
+
2379
+ var ρσ_in, ρσ_desugar_kwargs, ρσ_exists;
2380
+ function ρσ_eslice(arr, step, start, end) {
2381
+ var is_string;
2382
+ if (typeof arr === "string" || arr instanceof String) {
2383
+ is_string = true;
2384
+ arr = arr.split("");
2385
+ }
2386
+ if (step < 0) {
2387
+ step = -step;
2388
+ arr = arr.slice().reverse();
2389
+ if (typeof start !== "undefined") {
2390
+ start = arr.length - start - 1;
2391
+ }
2392
+ if (typeof end !== "undefined") {
2393
+ end = arr.length - end - 1;
2394
+ }
2395
+ }
2396
+ if (typeof start === "undefined") {
2397
+ start = 0;
2398
+ }
2399
+ if (typeof end === "undefined") {
2400
+ end = arr.length;
2401
+ }
2402
+ arr = arr.slice(start, end).filter((function() {
2403
+ var ρσ_anonfunc = function (e, i) {
2404
+ return i % step === 0;
2405
+ };
2406
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2407
+ __argnames__ : {value: ["e", "i"]},
2408
+ __module__ : {value: "__main__"}
2409
+ });
2410
+ return ρσ_anonfunc;
2411
+ })());
2412
+ if (is_string) {
2413
+ arr = arr.join("");
2414
+ }
2415
+ return arr;
2416
+ };
2417
+ if (!ρσ_eslice.__argnames__) Object.defineProperties(ρσ_eslice, {
2418
+ __argnames__ : {value: ["arr", "step", "start", "end"]},
2419
+ __module__ : {value: "__main__"}
2420
+ });
2421
+
2422
+ function ρσ_delslice(arr, step, start, end) {
2423
+ var is_string, ρσ_unpack, indices;
2424
+ if (typeof arr === "string" || arr instanceof String) {
2425
+ is_string = true;
2426
+ arr = arr.split("");
2427
+ }
2428
+ if (step < 0) {
2429
+ if (typeof start === "undefined") {
2430
+ start = arr.length;
2431
+ }
2432
+ if (typeof end === "undefined") {
2433
+ end = 0;
2434
+ }
2435
+ ρσ_unpack = [end, start, -step];
2436
+ start = ρσ_unpack[0];
2437
+ end = ρσ_unpack[1];
2438
+ step = ρσ_unpack[2];
2439
+ }
2440
+ if (typeof start === "undefined") {
2441
+ start = 0;
2442
+ }
2443
+ if (typeof end === "undefined") {
2444
+ end = arr.length;
2445
+ }
2446
+ if (step === 1) {
2447
+ arr.splice(start, end - start);
2448
+ } else {
2449
+ if (end > start) {
2450
+ indices = [];
2451
+ for (var i = start; i < end; i += step) {
2452
+ indices.push(i);
2453
+ }
2454
+ for (var i = indices.length - 1; i >= 0; i--) {
2455
+ arr.splice(indices[(typeof i === "number" && i < 0) ? indices.length + i : i], 1);
2456
+ }
2457
+ }
2458
+ }
2459
+ if (is_string) {
2460
+ arr = arr.join("");
2461
+ }
2462
+ return arr;
2463
+ };
2464
+ if (!ρσ_delslice.__argnames__) Object.defineProperties(ρσ_delslice, {
2465
+ __argnames__ : {value: ["arr", "step", "start", "end"]},
2466
+ __module__ : {value: "__main__"}
2467
+ });
2468
+
2469
+ function ρσ_flatten(arr) {
2470
+ var ans, value;
2471
+ ans = ρσ_list_decorate([]);
2472
+ for (var i=0; i < arr.length; i++) {
2473
+ value = arr[(typeof i === "number" && i < 0) ? arr.length + i : i];
2474
+ if (Array.isArray(value)) {
2475
+ ans = ans.concat(ρσ_flatten(value));
2476
+ } else {
2477
+ ans.push(value);
2478
+ }
2479
+ }
2480
+ return ans;
2481
+ };
2482
+ if (!ρσ_flatten.__argnames__) Object.defineProperties(ρσ_flatten, {
2483
+ __argnames__ : {value: ["arr"]},
2484
+ __module__ : {value: "__main__"}
2485
+ });
2486
+
2487
+ function ρσ_unpack_asarray(num, iterable) {
2488
+ var ans, iterator, result;
2489
+ if (ρσ_arraylike(iterable)) {
2490
+ return iterable;
2491
+ }
2492
+ ans = [];
2493
+ if (typeof iterable[ρσ_iterator_symbol] === "function") {
2494
+ iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
2495
+ result = iterator.next();
2496
+ while (!result.done && ans.length < num) {
2497
+ ans.push(result.value);
2498
+ result = iterator.next();
2499
+ }
2500
+ }
2501
+ return ans;
2502
+ };
2503
+ if (!ρσ_unpack_asarray.__argnames__) Object.defineProperties(ρσ_unpack_asarray, {
2504
+ __argnames__ : {value: ["num", "iterable"]},
2505
+ __module__ : {value: "__main__"}
2506
+ });
2507
+
2508
+ function ρσ_extends(child, parent) {
2509
+ child.prototype = Object.create(parent.prototype);
2510
+ child.prototype.constructor = child;
2511
+ };
2512
+ if (!ρσ_extends.__argnames__) Object.defineProperties(ρσ_extends, {
2513
+ __argnames__ : {value: ["child", "parent"]},
2514
+ __module__ : {value: "__main__"}
2515
+ });
2516
+
2517
+ ρσ_in = (function() {
2518
+ var ρσ_anonfunc = function () {
2519
+ if (typeof Map === "function" && typeof Set === "function") {
2520
+ return (function() {
2521
+ var ρσ_anonfunc = function (val, arr) {
2522
+ if (typeof arr === "string") {
2523
+ return arr.indexOf(val) !== -1;
2524
+ }
2525
+ if (typeof arr.__contains__ === "function") {
2526
+ return arr.__contains__(val);
2527
+ }
2528
+ if (arr instanceof Map || arr instanceof Set) {
2529
+ return arr.has(val);
2530
+ }
2531
+ if (ρσ_arraylike(arr)) {
2532
+ return ρσ_list_contains.call(arr, val);
2533
+ }
2534
+ return Object.prototype.hasOwnProperty.call(arr, val);
2535
+ };
2536
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2537
+ __argnames__ : {value: ["val", "arr"]},
2538
+ __module__ : {value: "__main__"}
2539
+ });
2540
+ return ρσ_anonfunc;
2541
+ })();
2542
+ }
2543
+ return (function() {
2544
+ var ρσ_anonfunc = function (val, arr) {
2545
+ if (typeof arr === "string") {
2546
+ return arr.indexOf(val) !== -1;
2547
+ }
2548
+ if (typeof arr.__contains__ === "function") {
2549
+ return arr.__contains__(val);
2550
+ }
2551
+ if (ρσ_arraylike(arr)) {
2552
+ return ρσ_list_contains.call(arr, val);
2553
+ }
2554
+ return Object.prototype.hasOwnProperty.call(arr, val);
2555
+ };
2556
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2557
+ __argnames__ : {value: ["val", "arr"]},
2558
+ __module__ : {value: "__main__"}
2559
+ });
2560
+ return ρσ_anonfunc;
2561
+ })();
2562
+ };
2563
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
2564
+ __module__ : {value: "__main__"}
2565
+ });
2566
+ return ρσ_anonfunc;
2567
+ })()();
2568
+ function ρσ_Iterable(iterable) {
2569
+ var iterator, ans, result;
2570
+ if (ρσ_arraylike(iterable)) {
2571
+ return iterable;
2572
+ }
2573
+ if (typeof iterable[ρσ_iterator_symbol] === "function") {
2574
+ iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
2575
+ ans = ρσ_list_decorate([]);
2576
+ result = iterator.next();
2577
+ while (!result.done) {
2578
+ ans.push(result.value);
2579
+ result = iterator.next();
2580
+ }
2581
+ return ans;
2582
+ }
2583
+ return Object.keys(iterable);
2584
+ };
2585
+ if (!ρσ_Iterable.__argnames__) Object.defineProperties(ρσ_Iterable, {
2586
+ __argnames__ : {value: ["iterable"]},
2587
+ __module__ : {value: "__main__"}
2588
+ });
2589
+
2590
+ ρσ_desugar_kwargs = (function() {
2591
+ var ρσ_anonfunc = function () {
2592
+ if (typeof Object.assign === "function") {
2593
+ return (function() {
2594
+ var ρσ_anonfunc = function () {
2595
+ var ans;
2596
+ ans = Object.create(null);
2597
+ ans[ρσ_kwargs_symbol] = true;
2598
+ for (var i = 0; i < arguments.length; i++) {
2599
+ Object.assign(ans, arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]);
2600
+ }
2601
+ return ans;
2602
+ };
2603
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
2604
+ __module__ : {value: "__main__"}
2605
+ });
2606
+ return ρσ_anonfunc;
2607
+ })();
2608
+ }
2609
+ return (function() {
2610
+ var ρσ_anonfunc = function () {
2611
+ var ans, keys;
2612
+ ans = Object.create(null);
2613
+ ans[ρσ_kwargs_symbol] = true;
2614
+ for (var i = 0; i < arguments.length; i++) {
2615
+ keys = Object.keys(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]);
2616
+ for (var j = 0; j < keys.length; j++) {
2617
+ ans[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], ans)] = (ρσ_expr_temp = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i])[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], ρσ_expr_temp)];
2618
+ }
2619
+ }
2620
+ return ans;
2621
+ };
2622
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
2623
+ __module__ : {value: "__main__"}
2624
+ });
2625
+ return ρσ_anonfunc;
2626
+ })();
2627
+ };
2628
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
2629
+ __module__ : {value: "__main__"}
2630
+ });
2631
+ return ρσ_anonfunc;
2632
+ })()();
2633
+ function ρσ_interpolate_kwargs(f, supplied_args) {
2634
+ var has_prop, kwobj, args, prop;
2635
+ if (!f.__argnames__) {
2636
+ return f.apply(this, supplied_args);
2637
+ }
2638
+ has_prop = Object.prototype.hasOwnProperty;
2639
+ kwobj = supplied_args.pop();
2640
+ if (f.__handles_kwarg_interpolation__) {
2641
+ args = new Array(Math.max(supplied_args.length, f.__argnames__.length) + 1);
2642
+ args[args.length-1] = kwobj;
2643
+ for (var i = 0; i < args.length - 1; i++) {
2644
+ if (i < f.__argnames__.length) {
2645
+ prop = (ρσ_expr_temp = f.__argnames__)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
2646
+ if (has_prop.call(kwobj, prop)) {
2647
+ args[(typeof i === "number" && i < 0) ? args.length + i : i] = kwobj[(typeof prop === "number" && prop < 0) ? kwobj.length + prop : prop];
2648
+ delete kwobj[prop];
2649
+ } else if (i < supplied_args.length) {
2650
+ args[(typeof i === "number" && i < 0) ? args.length + i : i] = supplied_args[(typeof i === "number" && i < 0) ? supplied_args.length + i : i];
2651
+ }
2652
+ } else {
2653
+ args[(typeof i === "number" && i < 0) ? args.length + i : i] = supplied_args[(typeof i === "number" && i < 0) ? supplied_args.length + i : i];
2654
+ }
2655
+ }
2656
+ return f.apply(this, args);
2657
+ }
2658
+ for (var i = 0; i < f.__argnames__.length; i++) {
2659
+ prop = (ρσ_expr_temp = f.__argnames__)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
2660
+ if (has_prop.call(kwobj, prop)) {
2661
+ supplied_args[(typeof i === "number" && i < 0) ? supplied_args.length + i : i] = kwobj[(typeof prop === "number" && prop < 0) ? kwobj.length + prop : prop];
2662
+ }
2663
+ }
2664
+ return f.apply(this, supplied_args);
2665
+ };
2666
+ if (!ρσ_interpolate_kwargs.__argnames__) Object.defineProperties(ρσ_interpolate_kwargs, {
2667
+ __argnames__ : {value: ["f", "supplied_args"]},
2668
+ __module__ : {value: "__main__"}
2669
+ });
2670
+
2671
+ function ρσ_interpolate_kwargs_constructor(apply, f, supplied_args) {
2672
+ if (apply) {
2673
+ f.apply(this, supplied_args);
2674
+ } else {
2675
+ ρσ_interpolate_kwargs.call(this, f, supplied_args);
2676
+ }
2677
+ return this;
2678
+ };
2679
+ if (!ρσ_interpolate_kwargs_constructor.__argnames__) Object.defineProperties(ρσ_interpolate_kwargs_constructor, {
2680
+ __argnames__ : {value: ["apply", "f", "supplied_args"]},
2681
+ __module__ : {value: "__main__"}
2682
+ });
2683
+
2684
+ function ρσ_getitem(obj, key) {
2685
+ if (obj.__getitem__) {
2686
+ return obj.__getitem__(key);
2687
+ }
2688
+ if (typeof key === "number" && key < 0) {
2689
+ key += obj.length;
2690
+ }
2691
+ return obj[(typeof key === "number" && key < 0) ? obj.length + key : key];
2692
+ };
2693
+ if (!ρσ_getitem.__argnames__) Object.defineProperties(ρσ_getitem, {
2694
+ __argnames__ : {value: ["obj", "key"]},
2695
+ __module__ : {value: "__main__"}
2696
+ });
2697
+
2698
+ function ρσ_setitem(obj, key, val) {
2699
+ if (obj.__setitem__) {
2700
+ obj.__setitem__(key, val);
2701
+ } else {
2702
+ if (typeof key === "number" && key < 0) {
2703
+ key += obj.length;
2704
+ }
2705
+ obj[(typeof key === "number" && key < 0) ? obj.length + key : key] = val;
2706
+ }
2707
+ };
2708
+ if (!ρσ_setitem.__argnames__) Object.defineProperties(ρσ_setitem, {
2709
+ __argnames__ : {value: ["obj", "key", "val"]},
2710
+ __module__ : {value: "__main__"}
2711
+ });
2712
+
2713
+ function ρσ_delitem(obj, key) {
2714
+ if (obj.__delitem__) {
2715
+ obj.__delitem__(key);
2716
+ } else if (typeof obj.splice === "function") {
2717
+ obj.splice(key, 1);
2718
+ } else {
2719
+ if (typeof key === "number" && key < 0) {
2720
+ key += obj.length;
2721
+ }
2722
+ delete obj[key];
2723
+ }
2724
+ };
2725
+ if (!ρσ_delitem.__argnames__) Object.defineProperties(ρσ_delitem, {
2726
+ __argnames__ : {value: ["obj", "key"]},
2727
+ __module__ : {value: "__main__"}
2728
+ });
2729
+
2730
+ function ρσ_bound_index(idx, arr) {
2731
+ if (typeof idx === "number" && idx < 0) {
2732
+ idx += arr.length;
2733
+ }
2734
+ return idx;
2735
+ };
2736
+ if (!ρσ_bound_index.__argnames__) Object.defineProperties(ρσ_bound_index, {
2737
+ __argnames__ : {value: ["idx", "arr"]},
2738
+ __module__ : {value: "__main__"}
2739
+ });
2740
+
2741
+ function ρσ_splice(arr, val, start, end) {
2742
+ start = start || 0;
2743
+ if (start < 0) {
2744
+ start += arr.length;
2745
+ }
2746
+ if (end === undefined) {
2747
+ end = arr.length;
2748
+ }
2749
+ if (end < 0) {
2750
+ end += arr.length;
2751
+ }
2752
+ Array.prototype.splice.apply(arr, [start, end - start].concat(val));
2753
+ };
2754
+ if (!ρσ_splice.__argnames__) Object.defineProperties(ρσ_splice, {
2755
+ __argnames__ : {value: ["arr", "val", "start", "end"]},
2756
+ __module__ : {value: "__main__"}
2757
+ });
2758
+
2759
+ ρσ_exists = (function(){
2760
+ var ρσ_d = {};
2761
+ ρσ_d["n"] = (function() {
2762
+ var ρσ_anonfunc = function (expr) {
2763
+ return expr !== undefined && expr !== null;
2764
+ };
2765
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2766
+ __argnames__ : {value: ["expr"]},
2767
+ __module__ : {value: "__main__"}
2768
+ });
2769
+ return ρσ_anonfunc;
2770
+ })();
2771
+ ρσ_d["d"] = (function() {
2772
+ var ρσ_anonfunc = function (expr) {
2773
+ if (expr === undefined || expr === null) {
2774
+ return Object.create(null);
2775
+ }
2776
+ return expr;
2777
+ };
2778
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2779
+ __argnames__ : {value: ["expr"]},
2780
+ __module__ : {value: "__main__"}
2781
+ });
2782
+ return ρσ_anonfunc;
2783
+ })();
2784
+ ρσ_d["c"] = (function() {
2785
+ var ρσ_anonfunc = function (expr) {
2786
+ if (typeof expr === "function") {
2787
+ return expr;
2788
+ }
2789
+ return (function() {
2790
+ var ρσ_anonfunc = function () {
2791
+ return undefined;
2792
+ };
2793
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
2794
+ __module__ : {value: "__main__"}
2795
+ });
2796
+ return ρσ_anonfunc;
2797
+ })();
2798
+ };
2799
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2800
+ __argnames__ : {value: ["expr"]},
2801
+ __module__ : {value: "__main__"}
2802
+ });
2803
+ return ρσ_anonfunc;
2804
+ })();
2805
+ ρσ_d["g"] = (function() {
2806
+ var ρσ_anonfunc = function (expr) {
2807
+ if (expr === undefined || expr === null || typeof expr.__getitem__ !== "function") {
2808
+ return (function(){
2809
+ var ρσ_d = {};
2810
+ ρσ_d["__getitem__"] = (function() {
2811
+ var ρσ_anonfunc = function () {
2812
+ return undefined;
2813
+ };
2814
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
2815
+ __module__ : {value: "__main__"}
2816
+ });
2817
+ return ρσ_anonfunc;
2818
+ })();
2819
+ return ρσ_d;
2820
+ }).call(this);
2821
+ }
2822
+ };
2823
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2824
+ __argnames__ : {value: ["expr"]},
2825
+ __module__ : {value: "__main__"}
2826
+ });
2827
+ return ρσ_anonfunc;
2828
+ })();
2829
+ ρσ_d["e"] = (function() {
2830
+ var ρσ_anonfunc = function (expr, alt) {
2831
+ return (expr === undefined || expr === null) ? alt : expr;
2832
+ };
2833
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2834
+ __argnames__ : {value: ["expr", "alt"]},
2835
+ __module__ : {value: "__main__"}
2836
+ });
2837
+ return ρσ_anonfunc;
2838
+ })();
2839
+ return ρσ_d;
2840
+ }).call(this);
2841
+ function ρσ_mixin() {
2842
+ var seen, resolved_props, p, target, props, name;
2843
+ seen = Object.create(null);
2844
+ seen.__argnames__ = seen.__handles_kwarg_interpolation__ = seen.__init__ = seen.__annotations__ = seen.__doc__ = seen.__bind_methods__ = seen.__bases__ = seen.constructor = seen.__class__ = true;
2845
+ resolved_props = {};
2846
+ p = target = arguments[0].prototype;
2847
+ while (p && p !== Object.prototype) {
2848
+ props = Object.getOwnPropertyNames(p);
2849
+ for (var i = 0; i < props.length; i++) {
2850
+ seen[ρσ_bound_index(props[(typeof i === "number" && i < 0) ? props.length + i : i], seen)] = true;
2851
+ }
2852
+ p = Object.getPrototypeOf(p);
2853
+ }
2854
+ for (var c = 1; c < arguments.length; c++) {
2855
+ p = arguments[(typeof c === "number" && c < 0) ? arguments.length + c : c].prototype;
2856
+ while (p && p !== Object.prototype) {
2857
+ props = Object.getOwnPropertyNames(p);
2858
+ for (var i = 0; i < props.length; i++) {
2859
+ name = props[(typeof i === "number" && i < 0) ? props.length + i : i];
2860
+ if (seen[(typeof name === "number" && name < 0) ? seen.length + name : name]) {
2861
+ continue;
2862
+ }
2863
+ seen[(typeof name === "number" && name < 0) ? seen.length + name : name] = true;
2864
+ resolved_props[(typeof name === "number" && name < 0) ? resolved_props.length + name : name] = Object.getOwnPropertyDescriptor(p, name);
2865
+ }
2866
+ p = Object.getPrototypeOf(p);
2867
+ }
2868
+ }
2869
+ Object.defineProperties(target, resolved_props);
2870
+ };
2871
+ if (!ρσ_mixin.__module__) Object.defineProperties(ρσ_mixin, {
2872
+ __module__ : {value: "__main__"}
2873
+ });
2874
+
2875
+ function ρσ_instanceof() {
2876
+ var obj, bases, q, cls, p;
2877
+ obj = arguments[0];
2878
+ bases = "";
2879
+ if (obj && obj.constructor && obj.constructor.prototype) {
2880
+ bases = obj.constructor.prototype.__bases__ || "";
2881
+ }
2882
+ for (var i = 1; i < arguments.length; i++) {
2883
+ q = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i];
2884
+ if (obj instanceof q) {
2885
+ return true;
2886
+ }
2887
+ if ((q === Array || q === ρσ_list_constructor) && Array.isArray(obj)) {
2888
+ return true;
2889
+ }
2890
+ if (q === ρσ_str && (typeof obj === "string" || obj instanceof String)) {
2891
+ return true;
2892
+ }
2893
+ if (q === ρσ_int && typeof obj === "number" && Number.isInteger(obj)) {
2894
+ return true;
2895
+ }
2896
+ if (q === ρσ_float && typeof obj === "number" && !Number.isInteger(obj)) {
2897
+ return true;
2898
+ }
2899
+ if (bases.length > 1) {
2900
+ for (var c = 1; c < bases.length; c++) {
2901
+ cls = bases[(typeof c === "number" && c < 0) ? bases.length + c : c];
2902
+ while (cls) {
2903
+ if (q === cls) {
2904
+ return true;
2905
+ }
2906
+ p = Object.getPrototypeOf(cls.prototype);
2907
+ if (!p) {
2908
+ break;
2909
+ }
2910
+ cls = p.constructor;
2911
+ }
2912
+ }
2913
+ }
2914
+ }
2915
+ return false;
2916
+ };
2917
+ if (!ρσ_instanceof.__module__) Object.defineProperties(ρσ_instanceof, {
2918
+ __module__ : {value: "__main__"}
2919
+ });
2920
+ function sum(iterable, start) {
2921
+ var ans, iterator, r;
2922
+ if (Array.isArray(iterable)) {
2923
+ return iterable.reduce((function() {
2924
+ var ρσ_anonfunc = function (prev, cur) {
2925
+ return prev + cur;
2926
+ };
2927
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
2928
+ __argnames__ : {value: ["prev", "cur"]},
2929
+ __module__ : {value: "__main__"}
2930
+ });
2931
+ return ρσ_anonfunc;
2932
+ })(), start || 0);
2933
+ }
2934
+ ans = start || 0;
2935
+ iterator = iter(iterable);
2936
+ r = iterator.next();
2937
+ while (!r.done) {
2938
+ ans += r.value;
2939
+ r = iterator.next();
2940
+ }
2941
+ return ans;
2942
+ };
2943
+ if (!sum.__argnames__) Object.defineProperties(sum, {
2944
+ __argnames__ : {value: ["iterable", "start"]},
2945
+ __module__ : {value: "__main__"}
2946
+ });
2947
+
2948
+ function map() {
2949
+ var iterators, func, args, ans;
2950
+ iterators = new Array(arguments.length - 1);
2951
+ func = arguments[0];
2952
+ args = new Array(arguments.length - 1);
2953
+ for (var i = 1; i < arguments.length; i++) {
2954
+ iterators[ρσ_bound_index(i - 1, iterators)] = iter(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]);
2955
+ }
2956
+ ans = {'_func':func, '_iterators':iterators, '_args':args};
2957
+ ans[ρσ_iterator_symbol] = (function() {
2958
+ var ρσ_anonfunc = function () {
2959
+ return this;
2960
+ };
2961
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
2962
+ __module__ : {value: "__main__"}
2963
+ });
2964
+ return ρσ_anonfunc;
2965
+ })();
2966
+ ans["next"] = (function() {
2967
+ var ρσ_anonfunc = function () {
2968
+ var r;
2969
+ for (var i = 0; i < this._iterators.length; i++) {
2970
+ r = (ρσ_expr_temp = this._iterators)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i].next();
2971
+ if (r.done) {
2972
+ return {'done':true};
2973
+ }
2974
+ (ρσ_expr_temp = this._args)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = r.value;
2975
+ }
2976
+ return {'done':false, 'value':this._func.apply(undefined, this._args)};
2977
+ };
2978
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
2979
+ __module__ : {value: "__main__"}
2980
+ });
2981
+ return ρσ_anonfunc;
2982
+ })();
2983
+ return ans;
2984
+ };
2985
+ if (!map.__module__) Object.defineProperties(map, {
2986
+ __module__ : {value: "__main__"}
2987
+ });
2988
+
2989
+ function filter(func_or_none, iterable) {
2990
+ var func, ans;
2991
+ func = (func_or_none === null) ? ρσ_bool : func_or_none;
2992
+ ans = {'_func':func, '_iterator':ρσ_iter(iterable)};
2993
+ ans[ρσ_iterator_symbol] = (function() {
2994
+ var ρσ_anonfunc = function () {
2995
+ return this;
2996
+ };
2997
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
2998
+ __module__ : {value: "__main__"}
2999
+ });
3000
+ return ρσ_anonfunc;
3001
+ })();
3002
+ ans["next"] = (function() {
3003
+ var ρσ_anonfunc = function () {
3004
+ var r;
3005
+ r = this._iterator.next();
3006
+ while (!r.done) {
3007
+ if (this._func(r.value)) {
3008
+ return r;
3009
+ }
3010
+ r = this._iterator.next();
3011
+ }
3012
+ return {'done':true};
3013
+ };
3014
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3015
+ __module__ : {value: "__main__"}
3016
+ });
3017
+ return ρσ_anonfunc;
3018
+ })();
3019
+ return ans;
3020
+ };
3021
+ if (!filter.__argnames__) Object.defineProperties(filter, {
3022
+ __argnames__ : {value: ["func_or_none", "iterable"]},
3023
+ __module__ : {value: "__main__"}
3024
+ });
3025
+
3026
+ function zip() {
3027
+ var iterators, ans;
3028
+ iterators = new Array(arguments.length);
3029
+ for (var i = 0; i < arguments.length; i++) {
3030
+ iterators[(typeof i === "number" && i < 0) ? iterators.length + i : i] = iter(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]);
3031
+ }
3032
+ ans = {'_iterators':iterators};
3033
+ ans[ρσ_iterator_symbol] = (function() {
3034
+ var ρσ_anonfunc = function () {
3035
+ return this;
3036
+ };
3037
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3038
+ __module__ : {value: "__main__"}
3039
+ });
3040
+ return ρσ_anonfunc;
3041
+ })();
3042
+ ans["next"] = (function() {
3043
+ var ρσ_anonfunc = function () {
3044
+ var args, r;
3045
+ args = new Array(this._iterators.length);
3046
+ for (var i = 0; i < this._iterators.length; i++) {
3047
+ r = (ρσ_expr_temp = this._iterators)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i].next();
3048
+ if (r.done) {
3049
+ return {'done':true};
3050
+ }
3051
+ args[(typeof i === "number" && i < 0) ? args.length + i : i] = r.value;
3052
+ }
3053
+ return {'done':false, 'value':args};
3054
+ };
3055
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3056
+ __module__ : {value: "__main__"}
3057
+ });
3058
+ return ρσ_anonfunc;
3059
+ })();
3060
+ return ans;
3061
+ };
3062
+ if (!zip.__module__) Object.defineProperties(zip, {
3063
+ __module__ : {value: "__main__"}
3064
+ });
3065
+
3066
+ function any(iterable) {
3067
+ var i;
3068
+ var ρσ_Iter0 = ρσ_Iterable(iterable);
3069
+ for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
3070
+ i = ρσ_Iter0[ρσ_Index0];
3071
+ if (i) {
3072
+ return true;
3073
+ }
3074
+ }
3075
+ return false;
3076
+ };
3077
+ if (!any.__argnames__) Object.defineProperties(any, {
3078
+ __argnames__ : {value: ["iterable"]},
3079
+ __module__ : {value: "__main__"}
3080
+ });
3081
+
3082
+ function all(iterable) {
3083
+ var i;
3084
+ var ρσ_Iter1 = ρσ_Iterable(iterable);
3085
+ for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Index1++) {
3086
+ i = ρσ_Iter1[ρσ_Index1];
3087
+ if (!i) {
3088
+ return false;
3089
+ }
3090
+ }
3091
+ return true;
3092
+ };
3093
+ if (!all.__argnames__) Object.defineProperties(all, {
3094
+ __argnames__ : {value: ["iterable"]},
3095
+ __module__ : {value: "__main__"}
3096
+ });
3097
+ var decimal_sep, define_str_func, ρσ_unpack, ρσ_orig_split, ρσ_orig_replace;
3098
+ decimal_sep = 1.1.toLocaleString()[1];
3099
+ function ρσ_repr_js_builtin(x, as_array) {
3100
+ var ans, b, keys, key;
3101
+ ans = [];
3102
+ b = "{}";
3103
+ if (as_array) {
3104
+ b = "[]";
3105
+ for (var i = 0; i < x.length; i++) {
3106
+ ans.push(ρσ_repr(x[(typeof i === "number" && i < 0) ? x.length + i : i]));
3107
+ }
3108
+ } else {
3109
+ keys = Object.keys(x);
3110
+ for (var k = 0; k < keys.length; k++) {
3111
+ key = keys[(typeof k === "number" && k < 0) ? keys.length + k : k];
3112
+ ans.push(JSON.stringify(key) + ":" + ρσ_repr(x[(typeof key === "number" && key < 0) ? x.length + key : key]));
3113
+ }
3114
+ }
3115
+ return b[0] + ans.join(", ") + b[1];
3116
+ };
3117
+ if (!ρσ_repr_js_builtin.__argnames__) Object.defineProperties(ρσ_repr_js_builtin, {
3118
+ __argnames__ : {value: ["x", "as_array"]},
3119
+ __module__ : {value: "__main__"}
3120
+ });
3121
+
3122
+ function ρσ_html_element_to_string(elem) {
3123
+ var attrs, val, attr, ans;
3124
+ attrs = [];
3125
+ var ρσ_Iter0 = ρσ_Iterable(elem.attributes);
3126
+ for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
3127
+ attr = ρσ_Iter0[ρσ_Index0];
3128
+ if (attr.specified) {
3129
+ val = attr.value;
3130
+ if (val.length > 10) {
3131
+ val = val.slice(0, 15) + "...";
3132
+ }
3133
+ val = JSON.stringify(val);
3134
+ attrs.push("" + ρσ_str.format("{}", attr.name) + "=" + ρσ_str.format("{}", val) + "");
3135
+ }
3136
+ }
3137
+ attrs = (attrs.length) ? " " + attrs.join(" ") : "";
3138
+ ans = "<" + ρσ_str.format("{}", elem.tagName) + "" + ρσ_str.format("{}", attrs) + ">";
3139
+ return ans;
3140
+ };
3141
+ if (!ρσ_html_element_to_string.__argnames__) Object.defineProperties(ρσ_html_element_to_string, {
3142
+ __argnames__ : {value: ["elem"]},
3143
+ __module__ : {value: "__main__"}
3144
+ });
3145
+
3146
+ function ρσ_repr(x) {
3147
+ var ans, name;
3148
+ if (x === null) {
3149
+ return "None";
3150
+ }
3151
+ if (x === undefined) {
3152
+ return "undefined";
3153
+ }
3154
+ ans = x;
3155
+ if (typeof x.__repr__ === "function") {
3156
+ ans = x.__repr__();
3157
+ } else if (x === true || x === false) {
3158
+ ans = (x) ? "True" : "False";
3159
+ } else if (Array.isArray(x)) {
3160
+ ans = ρσ_repr_js_builtin(x, true);
3161
+ } else if (typeof x === "function") {
3162
+ ans = x.toString();
3163
+ } else if (typeof x === "object" && !x.toString) {
3164
+ ans = ρσ_repr_js_builtin(x);
3165
+ } else {
3166
+ name = Object.prototype.toString.call(x).slice(8, -1);
3167
+ if (ρσ_not_equals("Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".indexOf(name), -1)) {
3168
+ return name + "([" + x.map((function() {
3169
+ var ρσ_anonfunc = function (i) {
3170
+ return str.format("0x{:02x}", i);
3171
+ };
3172
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3173
+ __argnames__ : {value: ["i"]},
3174
+ __module__ : {value: "__main__"}
3175
+ });
3176
+ return ρσ_anonfunc;
3177
+ })()).join(", ") + "])";
3178
+ }
3179
+ if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) {
3180
+ ans = ρσ_html_element_to_string(x);
3181
+ } else {
3182
+ ans = (typeof x.toString === "function") ? x.toString() : x;
3183
+ }
3184
+ if (ans === "[object Object]") {
3185
+ return ρσ_repr_js_builtin(x);
3186
+ }
3187
+ try {
3188
+ ans = JSON.stringify(x);
3189
+ } catch (ρσ_Exception) {
3190
+ ρσ_last_exception = ρσ_Exception;
3191
+ {
3192
+ }
3193
+ }
3194
+ }
3195
+ return ans + "";
3196
+ };
3197
+ if (!ρσ_repr.__argnames__) Object.defineProperties(ρσ_repr, {
3198
+ __argnames__ : {value: ["x"]},
3199
+ __module__ : {value: "__main__"}
3200
+ });
3201
+
3202
+ function ρσ_str(x) {
3203
+ var ans, name;
3204
+ if (x === null) {
3205
+ return "None";
3206
+ }
3207
+ if (x === undefined) {
3208
+ return "undefined";
3209
+ }
3210
+ ans = x;
3211
+ if (typeof x.__str__ === "function") {
3212
+ ans = x.__str__();
3213
+ } else if (typeof x.__repr__ === "function") {
3214
+ ans = x.__repr__();
3215
+ } else if (x === true || x === false) {
3216
+ ans = (x) ? "True" : "False";
3217
+ } else if (Array.isArray(x)) {
3218
+ ans = ρσ_repr_js_builtin(x, true);
3219
+ } else if (typeof x.toString === "function") {
3220
+ name = Object.prototype.toString.call(x).slice(8, -1);
3221
+ if (ρσ_not_equals("Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".indexOf(name), -1)) {
3222
+ return name + "([" + x.map((function() {
3223
+ var ρσ_anonfunc = function (i) {
3224
+ return str.format("0x{:02x}", i);
3225
+ };
3226
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3227
+ __argnames__ : {value: ["i"]},
3228
+ __module__ : {value: "__main__"}
3229
+ });
3230
+ return ρσ_anonfunc;
3231
+ })()).join(", ") + "])";
3232
+ }
3233
+ if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) {
3234
+ ans = ρσ_html_element_to_string(x);
3235
+ } else {
3236
+ ans = x.toString();
3237
+ }
3238
+ if (ans === "[object Object]") {
3239
+ ans = ρσ_repr_js_builtin(x);
3240
+ }
3241
+ } else if (typeof x === "object" && !x.toString) {
3242
+ ans = ρσ_repr_js_builtin(x);
3243
+ }
3244
+ return ans + "";
3245
+ };
3246
+ if (!ρσ_str.__argnames__) Object.defineProperties(ρσ_str, {
3247
+ __argnames__ : {value: ["x"]},
3248
+ __module__ : {value: "__main__"}
3249
+ });
3250
+
3251
+ define_str_func = (function() {
3252
+ var ρσ_anonfunc = function (name, func) {
3253
+ var f;
3254
+ (ρσ_expr_temp = ρσ_str.prototype)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : name] = func;
3255
+ ρσ_str[(typeof name === "number" && name < 0) ? ρσ_str.length + name : name] = f = func.call.bind(func);
3256
+ if (func.__argnames__) {
3257
+ Object.defineProperty(f, "__argnames__", (function(){
3258
+ var ρσ_d = {};
3259
+ ρσ_d["value"] = ['string'].concat(func.__argnames__);
3260
+ return ρσ_d;
3261
+ }).call(this));
3262
+ }
3263
+ };
3264
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3265
+ __argnames__ : {value: ["name", "func"]},
3266
+ __module__ : {value: "__main__"}
3267
+ });
3268
+ return ρσ_anonfunc;
3269
+ })();
3270
+ ρσ_unpack = [String.prototype.split.call.bind(String.prototype.split), String.prototype.replace.call.bind(String.prototype.replace)];
3271
+ ρσ_orig_split = ρσ_unpack[0];
3272
+ ρσ_orig_replace = ρσ_unpack[1];
3273
+ define_str_func("format", (function() {
3274
+ var ρσ_anonfunc = function () {
3275
+ var template, args, kwargs, explicit, implicit, idx, split, ans, pos, in_brace, markup, ch;
3276
+ template = this;
3277
+ if (template === undefined) {
3278
+ throw new TypeError("Template is required");
3279
+ }
3280
+ args = Array.prototype.slice.call(arguments);
3281
+ kwargs = {};
3282
+ if (args[args.length-1] && args[args.length-1][ρσ_kwargs_symbol] !== undefined) {
3283
+ kwargs = args[args.length-1];
3284
+ args = args.slice(0, -1);
3285
+ }
3286
+ explicit = implicit = false;
3287
+ idx = 0;
3288
+ split = ρσ_orig_split;
3289
+ if (ρσ_str.format._template_resolve_pat === undefined) {
3290
+ ρσ_str.format._template_resolve_pat = /[.\[]/;
3291
+ }
3292
+ function resolve(arg, object) {
3293
+ var ρσ_unpack, first, key, rest, ans;
3294
+ if (!arg) {
3295
+ return object;
3296
+ }
3297
+ ρσ_unpack = [arg[0], arg.slice(1)];
3298
+ first = ρσ_unpack[0];
3299
+ arg = ρσ_unpack[1];
3300
+ key = split(arg, ρσ_str.format._template_resolve_pat, 1)[0];
3301
+ rest = arg.slice(key.length);
3302
+ ans = (first === "[") ? object[ρσ_bound_index(key.slice(0, -1), object)] : getattr(object, key);
3303
+ if (ans === undefined) {
3304
+ throw new KeyError((first === "[") ? key.slice(0, -1) : key);
3305
+ }
3306
+ return resolve(rest, ans);
3307
+ };
3308
+ if (!resolve.__argnames__) Object.defineProperties(resolve, {
3309
+ __argnames__ : {value: ["arg", "object"]},
3310
+ __module__ : {value: "__main__"}
3311
+ });
3312
+
3313
+ function resolve_format_spec(format_spec) {
3314
+ if (ρσ_str.format._template_resolve_fs_pat === undefined) {
3315
+ ρσ_str.format._template_resolve_fs_pat = /[{]([a-zA-Z0-9_]+)[}]/g;
3316
+ }
3317
+ return format_spec.replace(ρσ_str.format._template_resolve_fs_pat, (function() {
3318
+ var ρσ_anonfunc = function (match, key) {
3319
+ if (!Object.prototype.hasOwnProperty.call(kwargs, key)) {
3320
+ return "";
3321
+ }
3322
+ return "" + kwargs[(typeof key === "number" && key < 0) ? kwargs.length + key : key];
3323
+ };
3324
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3325
+ __argnames__ : {value: ["match", "key"]},
3326
+ __module__ : {value: "__main__"}
3327
+ });
3328
+ return ρσ_anonfunc;
3329
+ })());
3330
+ };
3331
+ if (!resolve_format_spec.__argnames__) Object.defineProperties(resolve_format_spec, {
3332
+ __argnames__ : {value: ["format_spec"]},
3333
+ __module__ : {value: "__main__"}
3334
+ });
3335
+
3336
+ function set_comma(ans, comma) {
3337
+ var sep;
3338
+ if (comma !== ",") {
3339
+ sep = 1234;
3340
+ sep = sep.toLocaleString(undefined, {useGrouping: true})[1];
3341
+ ans = str.replace(ans, sep, comma);
3342
+ }
3343
+ return ans;
3344
+ };
3345
+ if (!set_comma.__argnames__) Object.defineProperties(set_comma, {
3346
+ __argnames__ : {value: ["ans", "comma"]},
3347
+ __module__ : {value: "__main__"}
3348
+ });
3349
+
3350
+ function safe_comma(value, comma) {
3351
+ try {
3352
+ return set_comma(value.toLocaleString(undefined, {useGrouping: true}), comma);
3353
+ } catch (ρσ_Exception) {
3354
+ ρσ_last_exception = ρσ_Exception;
3355
+ {
3356
+ return value.toString(10);
3357
+ }
3358
+ }
3359
+ };
3360
+ if (!safe_comma.__argnames__) Object.defineProperties(safe_comma, {
3361
+ __argnames__ : {value: ["value", "comma"]},
3362
+ __module__ : {value: "__main__"}
3363
+ });
3364
+
3365
+ function safe_fixed(value, precision, comma) {
3366
+ if (!comma) {
3367
+ return value.toFixed(precision);
3368
+ }
3369
+ try {
3370
+ return set_comma(value.toLocaleString(undefined, {useGrouping: true, minimumFractionDigits: precision, maximumFractionDigits: precision}), comma);
3371
+ } catch (ρσ_Exception) {
3372
+ ρσ_last_exception = ρσ_Exception;
3373
+ {
3374
+ return value.toFixed(precision);
3375
+ }
3376
+ }
3377
+ };
3378
+ if (!safe_fixed.__argnames__) Object.defineProperties(safe_fixed, {
3379
+ __argnames__ : {value: ["value", "precision", "comma"]},
3380
+ __module__ : {value: "__main__"}
3381
+ });
3382
+
3383
+ function apply_formatting(value, format_spec) {
3384
+ var ρσ_unpack, fill, align, sign, fhash, zeropad, width, comma, precision, ftype, is_numeric, is_int, lftype, code, prec, exp, nval, is_positive, left, right;
3385
+ if (format_spec.indexOf("{") !== -1) {
3386
+ format_spec = resolve_format_spec(format_spec);
3387
+ }
3388
+ if (ρσ_str.format._template_format_pat === undefined) {
3389
+ ρσ_str.format._template_format_pat = /([^{}](?=[<>=^]))?([<>=^])?([-+\x20])?(\#)?(0)?(\d+)?([,_])?(?:\.(\d+))?([bcdeEfFgGnosxX%])?/;
3390
+ }
3391
+ try {
3392
+ ρσ_unpack = format_spec.match(ρσ_str.format._template_format_pat).slice(1);
3393
+ ρσ_unpack = ρσ_unpack_asarray(9, ρσ_unpack);
3394
+ fill = ρσ_unpack[0];
3395
+ align = ρσ_unpack[1];
3396
+ sign = ρσ_unpack[2];
3397
+ fhash = ρσ_unpack[3];
3398
+ zeropad = ρσ_unpack[4];
3399
+ width = ρσ_unpack[5];
3400
+ comma = ρσ_unpack[6];
3401
+ precision = ρσ_unpack[7];
3402
+ ftype = ρσ_unpack[8];
3403
+ } catch (ρσ_Exception) {
3404
+ ρσ_last_exception = ρσ_Exception;
3405
+ if (ρσ_Exception instanceof TypeError) {
3406
+ return value;
3407
+ } else {
3408
+ throw ρσ_Exception;
3409
+ }
3410
+ }
3411
+ if (zeropad) {
3412
+ fill = fill || "0";
3413
+ align = align || "=";
3414
+ } else {
3415
+ fill = fill || " ";
3416
+ align = align || ">";
3417
+ }
3418
+ is_numeric = Number(value) === value;
3419
+ is_int = is_numeric && value % 1 === 0;
3420
+ precision = parseInt(precision, 10);
3421
+ lftype = (ftype || "").toLowerCase();
3422
+ if (ftype === "n") {
3423
+ is_numeric = true;
3424
+ if (is_int) {
3425
+ if (comma) {
3426
+ throw new ValueError("Cannot specify ',' with 'n'");
3427
+ }
3428
+ value = parseInt(value, 10).toLocaleString();
3429
+ } else {
3430
+ value = parseFloat(value).toLocaleString();
3431
+ }
3432
+ } else if (['b', 'c', 'd', 'o', 'x'].indexOf(lftype) !== -1) {
3433
+ value = parseInt(value, 10);
3434
+ is_numeric = true;
3435
+ if (!isNaN(value)) {
3436
+ if (ftype === "b") {
3437
+ value = (value >>> 0).toString(2);
3438
+ if (fhash) {
3439
+ value = "0b" + value;
3440
+ }
3441
+ } else if (ftype === "c") {
3442
+ if (value > 65535) {
3443
+ code = value - 65536;
3444
+ value = String.fromCharCode(55296 + (code >> 10), 56320 + (code & 1023));
3445
+ } else {
3446
+ value = String.fromCharCode(value);
3447
+ }
3448
+ } else if (ftype === "d") {
3449
+ if (comma) {
3450
+ value = safe_comma(value, comma);
3451
+ } else {
3452
+ value = value.toString(10);
3453
+ }
3454
+ } else if (ftype === "o") {
3455
+ value = value.toString(8);
3456
+ if (fhash) {
3457
+ value = "0o" + value;
3458
+ }
3459
+ } else if (lftype === "x") {
3460
+ value = value.toString(16);
3461
+ value = (ftype === "x") ? value.toLowerCase() : value.toUpperCase();
3462
+ if (fhash) {
3463
+ value = "0x" + value;
3464
+ }
3465
+ }
3466
+ }
3467
+ } else if (['e','f','g','%'].indexOf(lftype) !== -1) {
3468
+ is_numeric = true;
3469
+ value = parseFloat(value);
3470
+ prec = (isNaN(precision)) ? 6 : precision;
3471
+ if (lftype === "e") {
3472
+ value = value.toExponential(prec);
3473
+ value = (ftype === "E") ? value.toUpperCase() : value.toLowerCase();
3474
+ } else if (lftype === "f") {
3475
+ value = safe_fixed(value, prec, comma);
3476
+ value = (ftype === "F") ? value.toUpperCase() : value.toLowerCase();
3477
+ } else if (lftype === "%") {
3478
+ value *= 100;
3479
+ value = safe_fixed(value, prec, comma) + "%";
3480
+ } else if (lftype === "g") {
3481
+ prec = max(1, prec);
3482
+ exp = parseInt(split(value.toExponential(prec - 1).toLowerCase(), "e")[1], 10);
3483
+ if (-4 <= exp && exp < prec) {
3484
+ value = safe_fixed(value, prec - 1 - exp, comma);
3485
+ } else {
3486
+ value = value.toExponential(prec - 1);
3487
+ }
3488
+ value = value.replace(/0+$/g, "");
3489
+ if (value[value.length-1] === decimal_sep) {
3490
+ value = value.slice(0, -1);
3491
+ }
3492
+ if (ftype === "G") {
3493
+ value = value.toUpperCase();
3494
+ }
3495
+ }
3496
+ } else {
3497
+ if (comma) {
3498
+ value = parseInt(value, 10);
3499
+ if (isNaN(value)) {
3500
+ throw new ValueError("Must use numbers with , or _");
3501
+ }
3502
+ value = safe_comma(value, comma);
3503
+ }
3504
+ value += "";
3505
+ if (!isNaN(precision)) {
3506
+ value = value.slice(0, precision);
3507
+ }
3508
+ }
3509
+ value += "";
3510
+ if (is_numeric && sign) {
3511
+ nval = Number(value);
3512
+ is_positive = !isNaN(nval) && nval >= 0;
3513
+ if (is_positive && (sign === " " || sign === "+")) {
3514
+ value = sign + value;
3515
+ }
3516
+ }
3517
+ function repeat(char, num) {
3518
+ return (new Array(num+1)).join(char);
3519
+ };
3520
+ if (!repeat.__argnames__) Object.defineProperties(repeat, {
3521
+ __argnames__ : {value: ["char", "num"]},
3522
+ __module__ : {value: "__main__"}
3523
+ });
3524
+
3525
+ if (is_numeric && width && width[0] === "0") {
3526
+ width = width.slice(1);
3527
+ ρσ_unpack = ["0", "="];
3528
+ fill = ρσ_unpack[0];
3529
+ align = ρσ_unpack[1];
3530
+ }
3531
+ width = parseInt(width || "-1", 10);
3532
+ if (isNaN(width)) {
3533
+ throw new ValueError("Invalid width specification: " + width);
3534
+ }
3535
+ if (fill && value.length < width) {
3536
+ if (align === "<") {
3537
+ value = value + repeat(fill, width - value.length);
3538
+ } else if (align === ">") {
3539
+ value = repeat(fill, width - value.length) + value;
3540
+ } else if (align === "^") {
3541
+ left = Math.floor((width - value.length) / 2);
3542
+ right = width - left - value.length;
3543
+ value = repeat(fill, left) + value + repeat(fill, right);
3544
+ } else if (align === "=") {
3545
+ if (ρσ_in(value[0], "+- ")) {
3546
+ value = value[0] + repeat(fill, width - value.length) + value.slice(1);
3547
+ } else {
3548
+ value = repeat(fill, width - value.length) + value;
3549
+ }
3550
+ } else {
3551
+ throw new ValueError("Unrecognized alignment: " + align);
3552
+ }
3553
+ }
3554
+ return value;
3555
+ };
3556
+ if (!apply_formatting.__argnames__) Object.defineProperties(apply_formatting, {
3557
+ __argnames__ : {value: ["value", "format_spec"]},
3558
+ __module__ : {value: "__main__"}
3559
+ });
3560
+
3561
+ function parse_markup(markup) {
3562
+ var key, transformer, format_spec, pos, state, ch;
3563
+ key = transformer = format_spec = "";
3564
+ pos = 0;
3565
+ state = 0;
3566
+ while (pos < markup.length) {
3567
+ ch = markup[(typeof pos === "number" && pos < 0) ? markup.length + pos : pos];
3568
+ if (state === 0) {
3569
+ if (ch === "!") {
3570
+ state = 1;
3571
+ } else if (ch === ":") {
3572
+ state = 2;
3573
+ } else {
3574
+ key += ch;
3575
+ }
3576
+ } else if (state === 1) {
3577
+ if (ch === ":") {
3578
+ state = 2;
3579
+ } else {
3580
+ transformer += ch;
3581
+ }
3582
+ } else {
3583
+ format_spec += ch;
3584
+ }
3585
+ pos += 1;
3586
+ }
3587
+ return [key, transformer, format_spec];
3588
+ };
3589
+ if (!parse_markup.__argnames__) Object.defineProperties(parse_markup, {
3590
+ __argnames__ : {value: ["markup"]},
3591
+ __module__ : {value: "__main__"}
3592
+ });
3593
+
3594
+ function render_markup(markup) {
3595
+ var ρσ_unpack, key, transformer, format_spec, ends_with_equal, lkey, nvalue, object, ans;
3596
+ ρσ_unpack = parse_markup(markup);
3597
+ ρσ_unpack = ρσ_unpack_asarray(3, ρσ_unpack);
3598
+ key = ρσ_unpack[0];
3599
+ transformer = ρσ_unpack[1];
3600
+ format_spec = ρσ_unpack[2];
3601
+ if (transformer && ['a', 'r', 's'].indexOf(transformer) === -1) {
3602
+ throw new ValueError("Unknown conversion specifier: " + transformer);
3603
+ }
3604
+ ends_with_equal = key.endsWith("=");
3605
+ if (ends_with_equal) {
3606
+ key = key.slice(0, -1);
3607
+ }
3608
+ lkey = key.length && split(key, /[.\[]/, 1)[0];
3609
+ if (lkey) {
3610
+ explicit = true;
3611
+ if (implicit) {
3612
+ throw new ValueError("cannot switch from automatic field numbering to manual field specification");
3613
+ }
3614
+ nvalue = parseInt(lkey);
3615
+ object = (isNaN(nvalue)) ? kwargs[(typeof lkey === "number" && lkey < 0) ? kwargs.length + lkey : lkey] : args[(typeof nvalue === "number" && nvalue < 0) ? args.length + nvalue : nvalue];
3616
+ if (object === undefined) {
3617
+ if (isNaN(nvalue)) {
3618
+ throw new KeyError(lkey);
3619
+ }
3620
+ throw new IndexError(lkey);
3621
+ }
3622
+ object = resolve(key.slice(lkey.length), object);
3623
+ } else {
3624
+ implicit = true;
3625
+ if (explicit) {
3626
+ throw new ValueError("cannot switch from manual field specification to automatic field numbering");
3627
+ }
3628
+ if (idx >= args.length) {
3629
+ throw new IndexError("Not enough arguments to match template: " + template);
3630
+ }
3631
+ object = args[(typeof idx === "number" && idx < 0) ? args.length + idx : idx];
3632
+ idx += 1;
3633
+ }
3634
+ if (typeof object === "function") {
3635
+ object = object();
3636
+ }
3637
+ ans = "" + object;
3638
+ if (format_spec) {
3639
+ ans = apply_formatting(ans, format_spec);
3640
+ }
3641
+ if (ends_with_equal) {
3642
+ ans = "" + ρσ_str.format("{}", key) + "=" + ρσ_str.format("{}", ans) + "";
3643
+ }
3644
+ return ans;
3645
+ };
3646
+ if (!render_markup.__argnames__) Object.defineProperties(render_markup, {
3647
+ __argnames__ : {value: ["markup"]},
3648
+ __module__ : {value: "__main__"}
3649
+ });
3650
+
3651
+ ans = "";
3652
+ pos = 0;
3653
+ in_brace = 0;
3654
+ markup = "";
3655
+ while (pos < template.length) {
3656
+ ch = template[(typeof pos === "number" && pos < 0) ? template.length + pos : pos];
3657
+ if (in_brace) {
3658
+ if (ch === "{") {
3659
+ in_brace += 1;
3660
+ markup += "{";
3661
+ } else if (ch === "}") {
3662
+ in_brace -= 1;
3663
+ if (in_brace > 0) {
3664
+ markup += "}";
3665
+ } else {
3666
+ ans += render_markup(markup);
3667
+ }
3668
+ } else {
3669
+ markup += ch;
3670
+ }
3671
+ } else {
3672
+ if (ch === "{") {
3673
+ if (template[ρσ_bound_index(pos + 1, template)] === "{") {
3674
+ pos += 1;
3675
+ ans += "{";
3676
+ } else {
3677
+ in_brace = 1;
3678
+ markup = "";
3679
+ }
3680
+ } else {
3681
+ ans += ch;
3682
+ if (ch === "}" && template[ρσ_bound_index(pos + 1, template)] === "}") {
3683
+ pos += 1;
3684
+ }
3685
+ }
3686
+ }
3687
+ pos += 1;
3688
+ }
3689
+ if (in_brace) {
3690
+ throw new ValueError("expected '}' before end of string");
3691
+ }
3692
+ return ans;
3693
+ };
3694
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3695
+ __module__ : {value: "__main__"}
3696
+ });
3697
+ return ρσ_anonfunc;
3698
+ })());
3699
+ define_str_func("capitalize", (function() {
3700
+ var ρσ_anonfunc = function () {
3701
+ var string;
3702
+ string = this;
3703
+ if (string) {
3704
+ string = string[0].toUpperCase() + string.slice(1).toLowerCase();
3705
+ }
3706
+ return string;
3707
+ };
3708
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3709
+ __module__ : {value: "__main__"}
3710
+ });
3711
+ return ρσ_anonfunc;
3712
+ })());
3713
+ define_str_func("center", (function() {
3714
+ var ρσ_anonfunc = function (width, fill) {
3715
+ var left, right;
3716
+ left = Math.floor((width - this.length) / 2);
3717
+ right = width - left - this.length;
3718
+ fill = fill || " ";
3719
+ return new Array(left+1).join(fill) + this + new Array(right+1).join(fill);
3720
+ };
3721
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3722
+ __argnames__ : {value: ["width", "fill"]},
3723
+ __module__ : {value: "__main__"}
3724
+ });
3725
+ return ρσ_anonfunc;
3726
+ })());
3727
+ define_str_func("count", (function() {
3728
+ var ρσ_anonfunc = function (needle, start, end) {
3729
+ var string, ρσ_unpack, pos, step, ans;
3730
+ string = this;
3731
+ start = start || 0;
3732
+ end = end || string.length;
3733
+ if (start < 0 || end < 0) {
3734
+ string = string.slice(start, end);
3735
+ ρσ_unpack = [0, string.length];
3736
+ start = ρσ_unpack[0];
3737
+ end = ρσ_unpack[1];
3738
+ }
3739
+ pos = start;
3740
+ step = needle.length;
3741
+ if (!step) {
3742
+ return 0;
3743
+ }
3744
+ ans = 0;
3745
+ while (pos !== -1) {
3746
+ pos = string.indexOf(needle, pos);
3747
+ if (pos !== -1) {
3748
+ ans += 1;
3749
+ pos += step;
3750
+ }
3751
+ }
3752
+ return ans;
3753
+ };
3754
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3755
+ __argnames__ : {value: ["needle", "start", "end"]},
3756
+ __module__ : {value: "__main__"}
3757
+ });
3758
+ return ρσ_anonfunc;
3759
+ })());
3760
+ define_str_func("endswith", (function() {
3761
+ var ρσ_anonfunc = function (suffixes, start, end) {
3762
+ var string, q;
3763
+ string = this;
3764
+ start = start || 0;
3765
+ if (typeof suffixes === "string") {
3766
+ suffixes = [suffixes];
3767
+ }
3768
+ if (end !== undefined) {
3769
+ string = string.slice(0, end);
3770
+ }
3771
+ for (var i = 0; i < suffixes.length; i++) {
3772
+ q = suffixes[(typeof i === "number" && i < 0) ? suffixes.length + i : i];
3773
+ if (string.indexOf(q, Math.max(start, string.length - q.length)) !== -1) {
3774
+ return true;
3775
+ }
3776
+ }
3777
+ return false;
3778
+ };
3779
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3780
+ __argnames__ : {value: ["suffixes", "start", "end"]},
3781
+ __module__ : {value: "__main__"}
3782
+ });
3783
+ return ρσ_anonfunc;
3784
+ })());
3785
+ define_str_func("startswith", (function() {
3786
+ var ρσ_anonfunc = function (prefixes, start, end) {
3787
+ var prefix;
3788
+ start = start || 0;
3789
+ if (typeof prefixes === "string") {
3790
+ prefixes = [prefixes];
3791
+ }
3792
+ for (var i = 0; i < prefixes.length; i++) {
3793
+ prefix = prefixes[(typeof i === "number" && i < 0) ? prefixes.length + i : i];
3794
+ end = (end === undefined) ? this.length : end;
3795
+ if (end - start >= prefix.length && prefix === this.slice(start, start + prefix.length)) {
3796
+ return true;
3797
+ }
3798
+ }
3799
+ return false;
3800
+ };
3801
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3802
+ __argnames__ : {value: ["prefixes", "start", "end"]},
3803
+ __module__ : {value: "__main__"}
3804
+ });
3805
+ return ρσ_anonfunc;
3806
+ })());
3807
+ define_str_func("find", (function() {
3808
+ var ρσ_anonfunc = function (needle, start, end) {
3809
+ var ans;
3810
+ while (start < 0) {
3811
+ start += this.length;
3812
+ }
3813
+ ans = this.indexOf(needle, start);
3814
+ if (end !== undefined && ans !== -1) {
3815
+ while (end < 0) {
3816
+ end += this.length;
3817
+ }
3818
+ if (ans >= end - needle.length) {
3819
+ return -1;
3820
+ }
3821
+ }
3822
+ return ans;
3823
+ };
3824
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3825
+ __argnames__ : {value: ["needle", "start", "end"]},
3826
+ __module__ : {value: "__main__"}
3827
+ });
3828
+ return ρσ_anonfunc;
3829
+ })());
3830
+ define_str_func("rfind", (function() {
3831
+ var ρσ_anonfunc = function (needle, start, end) {
3832
+ var ans;
3833
+ while (end < 0) {
3834
+ end += this.length;
3835
+ }
3836
+ ans = this.lastIndexOf(needle, end - 1);
3837
+ if (start !== undefined && ans !== -1) {
3838
+ while (start < 0) {
3839
+ start += this.length;
3840
+ }
3841
+ if (ans < start) {
3842
+ return -1;
3843
+ }
3844
+ }
3845
+ return ans;
3846
+ };
3847
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3848
+ __argnames__ : {value: ["needle", "start", "end"]},
3849
+ __module__ : {value: "__main__"}
3850
+ });
3851
+ return ρσ_anonfunc;
3852
+ })());
3853
+ define_str_func("index", (function() {
3854
+ var ρσ_anonfunc = function (needle, start, end) {
3855
+ var ans;
3856
+ ans = ρσ_str.prototype.find.apply(this, arguments);
3857
+ if (ans === -1) {
3858
+ throw new ValueError("substring not found");
3859
+ }
3860
+ return ans;
3861
+ };
3862
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3863
+ __argnames__ : {value: ["needle", "start", "end"]},
3864
+ __module__ : {value: "__main__"}
3865
+ });
3866
+ return ρσ_anonfunc;
3867
+ })());
3868
+ define_str_func("rindex", (function() {
3869
+ var ρσ_anonfunc = function (needle, start, end) {
3870
+ var ans;
3871
+ ans = ρσ_str.prototype.rfind.apply(this, arguments);
3872
+ if (ans === -1) {
3873
+ throw new ValueError("substring not found");
3874
+ }
3875
+ return ans;
3876
+ };
3877
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3878
+ __argnames__ : {value: ["needle", "start", "end"]},
3879
+ __module__ : {value: "__main__"}
3880
+ });
3881
+ return ρσ_anonfunc;
3882
+ })());
3883
+ define_str_func("islower", (function() {
3884
+ var ρσ_anonfunc = function () {
3885
+ return this.length > 0 && this.toLowerCase() === this.toString();
3886
+ };
3887
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3888
+ __module__ : {value: "__main__"}
3889
+ });
3890
+ return ρσ_anonfunc;
3891
+ })());
3892
+ define_str_func("isupper", (function() {
3893
+ var ρσ_anonfunc = function () {
3894
+ return this.length > 0 && this.toUpperCase() === this.toString();
3895
+ };
3896
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3897
+ __module__ : {value: "__main__"}
3898
+ });
3899
+ return ρσ_anonfunc;
3900
+ })());
3901
+ define_str_func("isspace", (function() {
3902
+ var ρσ_anonfunc = function () {
3903
+ return this.length > 0 && /^\s+$/.test(this);
3904
+ };
3905
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3906
+ __module__ : {value: "__main__"}
3907
+ });
3908
+ return ρσ_anonfunc;
3909
+ })());
3910
+ define_str_func("join", (function() {
3911
+ var ρσ_anonfunc = function (iterable) {
3912
+ var ans, r;
3913
+ if (Array.isArray(iterable)) {
3914
+ return iterable.join(this);
3915
+ }
3916
+ ans = "";
3917
+ r = iterable.next();
3918
+ while (!r.done) {
3919
+ if (ans) {
3920
+ ans += this;
3921
+ }
3922
+ ans += r.value;
3923
+ r = iterable.next();
3924
+ }
3925
+ return ans;
3926
+ };
3927
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3928
+ __argnames__ : {value: ["iterable"]},
3929
+ __module__ : {value: "__main__"}
3930
+ });
3931
+ return ρσ_anonfunc;
3932
+ })());
3933
+ define_str_func("ljust", (function() {
3934
+ var ρσ_anonfunc = function (width, fill) {
3935
+ var string;
3936
+ string = this;
3937
+ if (width > string.length) {
3938
+ fill = fill || " ";
3939
+ string += new Array(width - string.length + 1).join(fill);
3940
+ }
3941
+ return string;
3942
+ };
3943
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3944
+ __argnames__ : {value: ["width", "fill"]},
3945
+ __module__ : {value: "__main__"}
3946
+ });
3947
+ return ρσ_anonfunc;
3948
+ })());
3949
+ define_str_func("rjust", (function() {
3950
+ var ρσ_anonfunc = function (width, fill) {
3951
+ var string;
3952
+ string = this;
3953
+ if (width > string.length) {
3954
+ fill = fill || " ";
3955
+ string = new Array(width - string.length + 1).join(fill) + string;
3956
+ }
3957
+ return string;
3958
+ };
3959
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3960
+ __argnames__ : {value: ["width", "fill"]},
3961
+ __module__ : {value: "__main__"}
3962
+ });
3963
+ return ρσ_anonfunc;
3964
+ })());
3965
+ define_str_func("lower", (function() {
3966
+ var ρσ_anonfunc = function () {
3967
+ return this.toLowerCase();
3968
+ };
3969
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3970
+ __module__ : {value: "__main__"}
3971
+ });
3972
+ return ρσ_anonfunc;
3973
+ })());
3974
+ define_str_func("upper", (function() {
3975
+ var ρσ_anonfunc = function () {
3976
+ return this.toUpperCase();
3977
+ };
3978
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3979
+ __module__ : {value: "__main__"}
3980
+ });
3981
+ return ρσ_anonfunc;
3982
+ })());
3983
+ define_str_func("lstrip", (function() {
3984
+ var ρσ_anonfunc = function (chars) {
3985
+ var string, pos;
3986
+ string = this;
3987
+ pos = 0;
3988
+ chars = chars || ρσ_str.whitespace;
3989
+ while (chars.indexOf(string[(typeof pos === "number" && pos < 0) ? string.length + pos : pos]) !== -1) {
3990
+ pos += 1;
3991
+ }
3992
+ if (pos) {
3993
+ string = string.slice(pos);
3994
+ }
3995
+ return string;
3996
+ };
3997
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3998
+ __argnames__ : {value: ["chars"]},
3999
+ __module__ : {value: "__main__"}
4000
+ });
4001
+ return ρσ_anonfunc;
4002
+ })());
4003
+ define_str_func("rstrip", (function() {
4004
+ var ρσ_anonfunc = function (chars) {
4005
+ var string, pos;
4006
+ string = this;
4007
+ pos = string.length - 1;
4008
+ chars = chars || ρσ_str.whitespace;
4009
+ while (chars.indexOf(string[(typeof pos === "number" && pos < 0) ? string.length + pos : pos]) !== -1) {
4010
+ pos -= 1;
4011
+ }
4012
+ if (pos < string.length - 1) {
4013
+ string = string.slice(0, pos + 1);
4014
+ }
4015
+ return string;
4016
+ };
4017
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
4018
+ __argnames__ : {value: ["chars"]},
4019
+ __module__ : {value: "__main__"}
4020
+ });
4021
+ return ρσ_anonfunc;
4022
+ })());
4023
+ define_str_func("strip", (function() {
4024
+ var ρσ_anonfunc = function (chars) {
4025
+ return ρσ_str.prototype.lstrip.call(ρσ_str.prototype.rstrip.call(this, chars), chars);
4026
+ };
4027
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
4028
+ __argnames__ : {value: ["chars"]},
4029
+ __module__ : {value: "__main__"}
4030
+ });
4031
+ return ρσ_anonfunc;
4032
+ })());
4033
+ define_str_func("partition", (function() {
4034
+ var ρσ_anonfunc = function (sep) {
4035
+ var idx;
4036
+ idx = this.indexOf(sep);
4037
+ if (idx === -1) {
4038
+ return [this, "", ""];
4039
+ }
4040
+ return [this.slice(0, idx), sep, this.slice(idx + sep.length)];
4041
+ };
4042
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
4043
+ __argnames__ : {value: ["sep"]},
4044
+ __module__ : {value: "__main__"}
4045
+ });
4046
+ return ρσ_anonfunc;
4047
+ })());
4048
+ define_str_func("rpartition", (function() {
4049
+ var ρσ_anonfunc = function (sep) {
4050
+ var idx;
4051
+ idx = this.lastIndexOf(sep);
4052
+ if (idx === -1) {
4053
+ return ["", "", this];
4054
+ }
4055
+ return [this.slice(0, idx), sep, this.slice(idx + sep.length)];
4056
+ };
4057
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
4058
+ __argnames__ : {value: ["sep"]},
4059
+ __module__ : {value: "__main__"}
4060
+ });
4061
+ return ρσ_anonfunc;
4062
+ })());
4063
+ define_str_func("replace", (function() {
4064
+ var ρσ_anonfunc = function (old, repl, count) {
4065
+ var string, pos, idx;
4066
+ string = this;
4067
+ if (count === 1) {
4068
+ return ρσ_orig_replace(string, old, repl);
4069
+ }
4070
+ if (count < 1) {
4071
+ return string;
4072
+ }
4073
+ count = count || Number.MAX_VALUE;
4074
+ pos = 0;
4075
+ while (count > 0) {
4076
+ count -= 1;
4077
+ idx = string.indexOf(old, pos);
4078
+ if (idx === -1) {
4079
+ break;
4080
+ }
4081
+ pos = idx + repl.length;
4082
+ string = string.slice(0, idx) + repl + string.slice(idx + old.length);
4083
+ }
4084
+ return string;
4085
+ };
4086
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
4087
+ __argnames__ : {value: ["old", "repl", "count"]},
4088
+ __module__ : {value: "__main__"}
4089
+ });
4090
+ return ρσ_anonfunc;
4091
+ })());
4092
+ define_str_func("split", (function() {
4093
+ var ρσ_anonfunc = function (sep, maxsplit) {
4094
+ var split, ans, extra, parts;
4095
+ if (maxsplit === 0) {
4096
+ return ρσ_list_decorate([ this ]);
4097
+ }
4098
+ split = ρσ_orig_split;
4099
+ if (sep === undefined || sep === null) {
4100
+ if (maxsplit > 0) {
4101
+ ans = split(this, /(\s+)/);
4102
+ extra = "";
4103
+ parts = [];
4104
+ for (var i = 0; i < ans.length; i++) {
4105
+ if (parts.length >= maxsplit + 1) {
4106
+ extra += ans[(typeof i === "number" && i < 0) ? ans.length + i : i];
4107
+ } else if (i % 2 === 0) {
4108
+ parts.push(ans[(typeof i === "number" && i < 0) ? ans.length + i : i]);
4109
+ }
4110
+ }
4111
+ parts[parts.length-1] += extra;
4112
+ ans = parts;
4113
+ } else {
4114
+ ans = split(this, /\s+/);
4115
+ }
4116
+ } else {
4117
+ if (sep === "") {
4118
+ throw new ValueError("empty separator");
4119
+ }
4120
+ ans = split(this, sep);
4121
+ if (maxsplit > 0 && ans.length > maxsplit) {
4122
+ extra = ans.slice(maxsplit).join(sep);
4123
+ ans = ans.slice(0, maxsplit);
4124
+ ans.push(extra);
4125
+ }
4126
+ }
4127
+ return ρσ_list_decorate(ans);
4128
+ };
4129
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
4130
+ __argnames__ : {value: ["sep", "maxsplit"]},
4131
+ __module__ : {value: "__main__"}
4132
+ });
4133
+ return ρσ_anonfunc;
4134
+ })());
4135
+ define_str_func("rsplit", (function() {
4136
+ var ρσ_anonfunc = function (sep, maxsplit) {
4137
+ var split, ans, is_space, pos, current, spc, ch, end, idx;
4138
+ if (!maxsplit) {
4139
+ return ρσ_str.prototype.split.call(this, sep);
4140
+ }
4141
+ split = ρσ_orig_split;
4142
+ if (sep === undefined || sep === null) {
4143
+ if (maxsplit > 0) {
4144
+ ans = [];
4145
+ is_space = /\s/;
4146
+ pos = this.length - 1;
4147
+ current = "";
4148
+ while (pos > -1 && maxsplit > 0) {
4149
+ spc = false;
4150
+ ch = (ρσ_expr_temp = this)[(typeof pos === "number" && pos < 0) ? ρσ_expr_temp.length + pos : pos];
4151
+ while (pos > -1 && is_space.test(ch)) {
4152
+ spc = true;
4153
+ ch = this[--pos];
4154
+ }
4155
+ if (spc) {
4156
+ if (current) {
4157
+ ans.push(current);
4158
+ maxsplit -= 1;
4159
+ }
4160
+ current = ch;
4161
+ } else {
4162
+ current += ch;
4163
+ }
4164
+ pos -= 1;
4165
+ }
4166
+ ans.push(this.slice(0, pos + 1) + current);
4167
+ ans.reverse();
4168
+ } else {
4169
+ ans = split(this, /\s+/);
4170
+ }
4171
+ } else {
4172
+ if (sep === "") {
4173
+ throw new ValueError("empty separator");
4174
+ }
4175
+ ans = [];
4176
+ pos = end = this.length;
4177
+ while (pos > -1 && maxsplit > 0) {
4178
+ maxsplit -= 1;
4179
+ idx = this.lastIndexOf(sep, pos);
4180
+ if (idx === -1) {
4181
+ break;
4182
+ }
4183
+ ans.push(this.slice(idx + sep.length, end));
4184
+ pos = idx - 1;
4185
+ end = idx;
4186
+ }
4187
+ ans.push(this.slice(0, end));
4188
+ ans.reverse();
4189
+ }
4190
+ return ρσ_list_decorate(ans);
4191
+ };
4192
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
4193
+ __argnames__ : {value: ["sep", "maxsplit"]},
4194
+ __module__ : {value: "__main__"}
4195
+ });
4196
+ return ρσ_anonfunc;
4197
+ })());
4198
+ define_str_func("splitlines", (function() {
4199
+ var ρσ_anonfunc = function (keepends) {
4200
+ var split, parts, ans;
4201
+ split = ρσ_orig_split;
4202
+ if (keepends) {
4203
+ parts = split(this, /((?:\r?\n)|\r)/);
4204
+ ans = [];
4205
+ for (var i = 0; i < parts.length; i++) {
4206
+ if (i % 2 === 0) {
4207
+ ans.push(parts[(typeof i === "number" && i < 0) ? parts.length + i : i]);
4208
+ } else {
4209
+ ans[ans.length-1] += parts[(typeof i === "number" && i < 0) ? parts.length + i : i];
4210
+ }
4211
+ }
4212
+ } else {
4213
+ ans = split(this, /(?:\r?\n)|\r/);
4214
+ }
4215
+ return ρσ_list_decorate(ans);
4216
+ };
4217
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
4218
+ __argnames__ : {value: ["keepends"]},
4219
+ __module__ : {value: "__main__"}
4220
+ });
4221
+ return ρσ_anonfunc;
4222
+ })());
4223
+ define_str_func("swapcase", (function() {
4224
+ var ρσ_anonfunc = function () {
4225
+ var ans, a, b;
4226
+ ans = new Array(this.length);
4227
+ for (var i = 0; i < ans.length; i++) {
4228
+ a = (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
4229
+ b = a.toLowerCase();
4230
+ if (a === b) {
4231
+ b = a.toUpperCase();
4232
+ }
4233
+ ans[(typeof i === "number" && i < 0) ? ans.length + i : i] = b;
4234
+ }
4235
+ return ans.join("");
4236
+ };
4237
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
4238
+ __module__ : {value: "__main__"}
4239
+ });
4240
+ return ρσ_anonfunc;
4241
+ })());
4242
+ define_str_func("zfill", (function() {
4243
+ var ρσ_anonfunc = function (width) {
4244
+ var string;
4245
+ string = this;
4246
+ if (width > string.length) {
4247
+ string = new Array(width - string.length + 1).join("0") + string;
4248
+ }
4249
+ return string;
4250
+ };
4251
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
4252
+ __argnames__ : {value: ["width"]},
4253
+ __module__ : {value: "__main__"}
4254
+ });
4255
+ return ρσ_anonfunc;
4256
+ })());
4257
+ ρσ_str.uchrs = (function() {
4258
+ var ρσ_anonfunc = function (string, with_positions) {
4259
+ return (function(){
4260
+ var ρσ_d = {};
4261
+ ρσ_d["_string"] = string;
4262
+ ρσ_d["_pos"] = 0;
4263
+ ρσ_d[ρσ_iterator_symbol] = (function() {
4264
+ var ρσ_anonfunc = function () {
4265
+ return this;
4266
+ };
4267
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
4268
+ __module__ : {value: "__main__"}
4269
+ });
4270
+ return ρσ_anonfunc;
4271
+ })();
4272
+ ρσ_d["next"] = (function() {
4273
+ var ρσ_anonfunc = function () {
4274
+ var length, pos, value, ans, extra;
4275
+ length = this._string.length;
4276
+ if (this._pos >= length) {
4277
+ return (function(){
4278
+ var ρσ_d = {};
4279
+ ρσ_d["done"] = true;
4280
+ return ρσ_d;
4281
+ }).call(this);
4282
+ }
4283
+ pos = this._pos;
4284
+ value = this._string.charCodeAt(this._pos++);
4285
+ ans = "\ufffd";
4286
+ if (55296 <= value && value <= 56319) {
4287
+ if (this._pos < length) {
4288
+ extra = this._string.charCodeAt(this._pos++);
4289
+ if ((extra & 56320) === 56320) {
4290
+ ans = String.fromCharCode(value, extra);
4291
+ }
4292
+ }
4293
+ } else if ((value & 56320) !== 56320) {
4294
+ ans = String.fromCharCode(value);
4295
+ }
4296
+ if (with_positions) {
4297
+ return (function(){
4298
+ var ρσ_d = {};
4299
+ ρσ_d["done"] = false;
4300
+ ρσ_d["value"] = ρσ_list_decorate([ pos, ans ]);
4301
+ return ρσ_d;
4302
+ }).call(this);
4303
+ } else {
4304
+ return (function(){
4305
+ var ρσ_d = {};
4306
+ ρσ_d["done"] = false;
4307
+ ρσ_d["value"] = ans;
4308
+ return ρσ_d;
4309
+ }).call(this);
4310
+ }
4311
+ };
4312
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
4313
+ __module__ : {value: "__main__"}
4314
+ });
4315
+ return ρσ_anonfunc;
4316
+ })();
4317
+ return ρσ_d;
4318
+ }).call(this);
4319
+ };
4320
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
4321
+ __argnames__ : {value: ["string", "with_positions"]},
4322
+ __module__ : {value: "__main__"}
4323
+ });
4324
+ return ρσ_anonfunc;
4325
+ })();
4326
+ ρσ_str.uslice = (function() {
4327
+ var ρσ_anonfunc = function (string, start, end) {
4328
+ var items, iterator, r;
4329
+ items = [];
4330
+ iterator = ρσ_str.uchrs(string);
4331
+ r = iterator.next();
4332
+ while (!r.done) {
4333
+ items.push(r.value);
4334
+ r = iterator.next();
4335
+ }
4336
+ return items.slice(start || 0, (end === undefined) ? items.length : end).join("");
4337
+ };
4338
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
4339
+ __argnames__ : {value: ["string", "start", "end"]},
4340
+ __module__ : {value: "__main__"}
4341
+ });
4342
+ return ρσ_anonfunc;
4343
+ })();
4344
+ ρσ_str.ulen = (function() {
4345
+ var ρσ_anonfunc = function (string) {
4346
+ var iterator, r, ans;
4347
+ iterator = ρσ_str.uchrs(string);
4348
+ r = iterator.next();
4349
+ ans = 0;
4350
+ while (!r.done) {
4351
+ r = iterator.next();
4352
+ ans += 1;
4353
+ }
4354
+ return ans;
4355
+ };
4356
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
4357
+ __argnames__ : {value: ["string"]},
4358
+ __module__ : {value: "__main__"}
4359
+ });
4360
+ return ρσ_anonfunc;
4361
+ })();
4362
+ ρσ_str.ascii_lowercase = "abcdefghijklmnopqrstuvwxyz";
4363
+ ρσ_str.ascii_uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
4364
+ ρσ_str.ascii_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
4365
+ ρσ_str.digits = "0123456789";
4366
+ ρσ_str.punctuation = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
4367
+ ρσ_str.printable = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\u000b\f";
4368
+ ρσ_str.whitespace = " \t\n\r\u000b\f";
4369
+ define_str_func = undefined;
4370
+ var str = ρσ_str, repr = ρσ_repr;