rapydscript-ns 0.8.4 → 0.9.1

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 (141) hide show
  1. package/.agignore +1 -1
  2. package/.github/workflows/ci.yml +38 -38
  3. package/=template.pyj +5 -5
  4. package/CHANGELOG.md +26 -0
  5. package/HACKING.md +103 -103
  6. package/LICENSE +24 -24
  7. package/README.md +716 -169
  8. package/TODO.md +7 -2
  9. package/add-toc-to-readme +2 -2
  10. package/bin/export +75 -75
  11. package/bin/rapydscript +70 -70
  12. package/bin/web-repl-export +102 -102
  13. package/build +2 -2
  14. package/language-service/index.js +36 -27
  15. package/package.json +1 -1
  16. package/publish.py +37 -37
  17. package/release/baselib-plain-pretty.js +2358 -168
  18. package/release/baselib-plain-ugly.js +73 -3
  19. package/release/compiler.js +6283 -3093
  20. package/release/signatures.json +31 -30
  21. package/session.vim +4 -4
  22. package/setup.cfg +2 -2
  23. package/src/ast.pyj +1 -0
  24. package/src/baselib-builtins.pyj +340 -2
  25. package/src/baselib-bytes.pyj +664 -0
  26. package/src/baselib-errors.pyj +1 -1
  27. package/src/baselib-internal.pyj +267 -60
  28. package/src/baselib-itertools.pyj +110 -97
  29. package/src/baselib-str.pyj +22 -4
  30. package/src/compiler.pyj +36 -36
  31. package/src/errors.pyj +30 -30
  32. package/src/lib/abc.pyj +317 -0
  33. package/src/lib/aes.pyj +646 -646
  34. package/src/lib/contextlib.pyj +379 -0
  35. package/src/lib/copy.pyj +120 -120
  36. package/src/lib/dataclasses.pyj +532 -0
  37. package/src/lib/datetime.pyj +712 -0
  38. package/src/lib/elementmaker.pyj +83 -83
  39. package/src/lib/encodings.pyj +126 -126
  40. package/src/lib/enum.pyj +125 -0
  41. package/src/lib/gettext.pyj +569 -569
  42. package/src/lib/io.pyj +500 -0
  43. package/src/lib/itertools.pyj +580 -580
  44. package/src/lib/json.pyj +227 -0
  45. package/src/lib/math.pyj +193 -193
  46. package/src/lib/operator.pyj +11 -11
  47. package/src/lib/pythonize.pyj +20 -20
  48. package/src/lib/random.pyj +118 -118
  49. package/src/lib/re.pyj +504 -470
  50. package/src/lib/react.pyj +74 -74
  51. package/src/lib/traceback.pyj +63 -63
  52. package/src/lib/typing.pyj +577 -0
  53. package/src/lib/uuid.pyj +77 -77
  54. package/src/monaco-language-service/builtins.js +14 -4
  55. package/src/monaco-language-service/diagnostics.js +19 -20
  56. package/src/monaco-language-service/dts.js +550 -550
  57. package/src/output/classes.pyj +62 -26
  58. package/src/output/comments.pyj +45 -45
  59. package/src/output/exceptions.pyj +201 -201
  60. package/src/output/functions.pyj +78 -5
  61. package/src/output/jsx.pyj +164 -164
  62. package/src/output/loops.pyj +5 -2
  63. package/src/output/operators.pyj +100 -34
  64. package/src/output/treeshake.pyj +182 -182
  65. package/src/output/utils.pyj +72 -72
  66. package/src/parse.pyj +80 -16
  67. package/src/string_interpolation.pyj +72 -72
  68. package/src/tokenizer.pyj +10 -5
  69. package/src/unicode_aliases.pyj +576 -576
  70. package/src/utils.pyj +192 -192
  71. package/test/_import_one.pyj +37 -37
  72. package/test/_import_two/__init__.pyj +11 -11
  73. package/test/_import_two/level2/deep.pyj +4 -4
  74. package/test/_import_two/other.pyj +6 -6
  75. package/test/_import_two/sub.pyj +13 -13
  76. package/test/abc.pyj +291 -0
  77. package/test/aes_vectors.pyj +421 -421
  78. package/test/annotations.pyj +80 -80
  79. package/test/arithmetic_nostrict.pyj +88 -0
  80. package/test/arithmetic_types.pyj +169 -0
  81. package/test/baselib.pyj +91 -0
  82. package/test/bytes.pyj +467 -0
  83. package/test/classes.pyj +1 -0
  84. package/test/comparison_ops.pyj +173 -0
  85. package/test/contextlib.pyj +362 -0
  86. package/test/dataclasses.pyj +253 -0
  87. package/test/datetime.pyj +500 -0
  88. package/test/debugger_stmt.pyj +41 -0
  89. package/test/decorators.pyj +77 -77
  90. package/test/docstrings.pyj +39 -39
  91. package/test/elementmaker_test.pyj +45 -45
  92. package/test/enum.pyj +134 -0
  93. package/test/eval_exec.pyj +56 -0
  94. package/test/format.pyj +148 -0
  95. package/test/functions.pyj +151 -151
  96. package/test/generators.pyj +41 -41
  97. package/test/generic.pyj +370 -370
  98. package/test/imports.pyj +72 -72
  99. package/test/internationalization.pyj +73 -73
  100. package/test/io.pyj +316 -0
  101. package/test/json.pyj +196 -0
  102. package/test/lint.pyj +164 -164
  103. package/test/loops.pyj +85 -85
  104. package/test/numpy.pyj +734 -734
  105. package/test/object.pyj +64 -0
  106. package/test/omit_function_metadata.pyj +20 -20
  107. package/test/python_compat.pyj +17 -15
  108. package/test/python_features.pyj +70 -15
  109. package/test/regexp.pyj +83 -55
  110. package/test/repl.pyj +121 -121
  111. package/test/scoped_flags.pyj +76 -76
  112. package/test/tuples.pyj +96 -0
  113. package/test/typing.pyj +469 -0
  114. package/test/unit/index.js +116 -7
  115. package/test/unit/language-service-dts.js +543 -543
  116. package/test/unit/language-service-hover.js +455 -455
  117. package/test/unit/language-service.js +84 -0
  118. package/test/unit/web-repl.js +1337 -1
  119. package/test/vars_locals_globals.pyj +94 -0
  120. package/tools/cli.js +558 -547
  121. package/tools/compile.js +224 -219
  122. package/tools/completer.js +131 -131
  123. package/tools/embedded_compiler.js +262 -251
  124. package/tools/gettext.js +185 -185
  125. package/tools/ini.js +65 -65
  126. package/tools/lint.js +16 -19
  127. package/tools/msgfmt.js +187 -187
  128. package/tools/repl.js +223 -223
  129. package/tools/test.js +118 -118
  130. package/tools/utils.js +128 -128
  131. package/tools/web_repl.js +95 -95
  132. package/try +41 -41
  133. package/web-repl/env.js +196 -196
  134. package/web-repl/index.html +163 -163
  135. package/web-repl/main.js +252 -252
  136. package/web-repl/prism.css +139 -139
  137. package/web-repl/prism.js +113 -113
  138. package/web-repl/rapydscript.js +224 -224
  139. package/web-repl/sha1.js +25 -25
  140. package/PYTHON_DIFFERENCES_REPORT.md +0 -291
  141. package/PYTHON_FEATURE_COVERAGE.md +0 -200
@@ -941,21 +941,1663 @@ if (!ρσ_slice.prototype.__eq__.__argnames__) Object.defineProperties(ρσ_slic
941
941
  if (!ρσ_slice.prototype.__hash__.__module__) Object.defineProperties(ρσ_slice.prototype.__hash__, {
942
942
  __module__ : {value: "__main__"}
943
943
  });
944
+ ρσ_slice.prototype.__format__ = function __format__ () {
945
+ if (!arguments[0]) return this.__str__();
946
+ throw new TypeError("unsupported format specification");
947
+ };
944
948
  Object.defineProperty(ρσ_slice.prototype, "__bases__", {value: []});
945
949
  ρσ_slice.__name__ = "ρσ_slice";
946
950
  ρσ_slice.__qualname__ = "ρσ_slice";
947
951
  ρσ_slice.__module__ = "__main__";
948
952
  Object.defineProperty(ρσ_slice.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
949
953
 
950
- var abs = Math.abs, max = ρσ_max.bind(Math.max), min = ρσ_max.bind(Math.min), bool = ρσ_bool, type = ρσ_type;
951
- var float = ρσ_float, int = ρσ_int, arraylike = ρσ_arraylike_creator(), ρσ_arraylike = arraylike;
952
- var id = ρσ_id, get_module = ρσ_get_module, pow = ρσ_pow, divmod = ρσ_divmod, __import__ = ρσ__import__;
953
- var dir = ρσ_dir, ord = ρσ_ord, chr = ρσ_chr, bin = ρσ_bin, hex = ρσ_hex, callable = ρσ_callable, round = ρσ_round;
954
- var enumerate = ρσ_enumerate, iter = ρσ_iter, reversed = ρσ_reversed, len = ρσ_len;
955
- var range = ρσ_range, getattr = ρσ_getattr, setattr = ρσ_setattr, hasattr = ρσ_hasattr, issubclass = ρσ_issubclass, hash = ρσ_hash, next = ρσ_next;
956
- var ρσ_Ellipsis = Object.freeze({toString: function(){return "Ellipsis";}, __repr__: function(){return "Ellipsis";}});
957
- var Ellipsis = ρσ_Ellipsis;
958
- var slice = ρσ_slice;function ρσ_equals(a, b) {
954
+ function ρσ_object() {
955
+ if (!(this instanceof ρσ_object)) return new ρσ_object(...arguments);
956
+ if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
957
+ ρσ_object.prototype.__init__.apply(this, arguments);
958
+ }
959
+ ρσ_object.prototype.__init__ = function __init__() {
960
+ var self = this;
961
+ };
962
+ if (!ρσ_object.prototype.__init__.__module__) Object.defineProperties(ρσ_object.prototype.__init__, {
963
+ __module__ : {value: "__main__"}
964
+ });
965
+ ρσ_object.__argnames__ = ρσ_object.prototype.__init__.__argnames__;
966
+ ρσ_object.__handles_kwarg_interpolation__ = ρσ_object.prototype.__init__.__handles_kwarg_interpolation__;
967
+ ρσ_object.prototype.__repr__ = function __repr__() {
968
+ var self = this;
969
+ if (this.ρσ_object_id === undefined) this.ρσ_object_id = ++ρσ_hash_id_counter;
970
+ return ρσ_list_add(ρσ_list_add("<object object at 0x", this.ρσ_object_id.toString(16)), ">");
971
+ };
972
+ if (!ρσ_object.prototype.__repr__.__module__) Object.defineProperties(ρσ_object.prototype.__repr__, {
973
+ __module__ : {value: "__main__"}
974
+ });
975
+ ρσ_object.prototype.__str__ = function __str__() {
976
+ var self = this;
977
+ return self.__repr__();
978
+ };
979
+ if (!ρσ_object.prototype.__str__.__module__) Object.defineProperties(ρσ_object.prototype.__str__, {
980
+ __module__ : {value: "__main__"}
981
+ });
982
+ ρσ_object.prototype.__eq__ = function __eq__(other) {
983
+ var self = this;
984
+ return self === other;
985
+ };
986
+ if (!ρσ_object.prototype.__eq__.__argnames__) Object.defineProperties(ρσ_object.prototype.__eq__, {
987
+ __argnames__ : {value: ["other"]},
988
+ __module__ : {value: "__main__"}
989
+ });
990
+ ρσ_object.prototype.__hash__ = function __hash__() {
991
+ var self = this;
992
+ if (this.ρσ_object_id === undefined) this.ρσ_object_id = ++ρσ_hash_id_counter;
993
+ return self.ρσ_object_id;
994
+ };
995
+ if (!ρσ_object.prototype.__hash__.__module__) Object.defineProperties(ρσ_object.prototype.__hash__, {
996
+ __module__ : {value: "__main__"}
997
+ });
998
+ ρσ_object.prototype.__format__ = function __format__ () {
999
+ if (!arguments[0]) return this.__str__();
1000
+ throw new TypeError("unsupported format specification");
1001
+ };
1002
+ Object.defineProperty(ρσ_object.prototype, "__bases__", {value: []});
1003
+ ρσ_object.__name__ = "ρσ_object";
1004
+ ρσ_object.__qualname__ = "ρσ_object";
1005
+ ρσ_object.__module__ = "__main__";
1006
+ Object.defineProperty(ρσ_object.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
1007
+
1008
+ ρσ_object.__name__ = "object";
1009
+ function ρσ_exec(code, globals, locals) {
1010
+ if (globals === undefined) {
1011
+ eval(code);
1012
+ return null;
1013
+ }
1014
+
1015
+ function _ρσ_to_obj(d) {
1016
+ if (d == null) return {};
1017
+ if (typeof ρσ_dict === "function" && d instanceof ρσ_dict) {
1018
+ var _r = {}; d.jsmap.forEach(function(v, k) { _r[k] = v; }); return _r;
1019
+ }
1020
+ return Object.assign({}, d);
1021
+ }
1022
+ var _ctx = _ρσ_to_obj(globals);
1023
+ if (locals !== undefined) Object.assign(_ctx, _ρσ_to_obj(locals));
1024
+ var _rσ_refs = code.match(/ρσ_\w+/g) || [];
1025
+ _rσ_refs.forEach(function(name) {
1026
+ if (!Object.prototype.hasOwnProperty.call(_ctx, name)) {
1027
+ try { var _v = eval(name); if (_v !== undefined) _ctx[name] = _v; } catch(e) {}
1028
+ }
1029
+ });
1030
+ var _keys = Object.keys(_ctx);
1031
+ var _vals = _keys.map(function(k) { return _ctx[k]; });
1032
+ Function.apply(null, _keys.concat([code])).apply(null, _vals);
1033
+ ;
1034
+ return null;
1035
+ };
1036
+ if (!ρσ_exec.__argnames__) Object.defineProperties(ρσ_exec, {
1037
+ __argnames__ : {value: ["code", "globals", "locals"]},
1038
+ __module__ : {value: "__main__"}
1039
+ });
1040
+
1041
+ ρσ_exec.__name__ = "exec";
1042
+ function ρσ_eval(expr, globals, locals) {
1043
+
1044
+ function _ρσ_to_obj(d) {
1045
+ if (d == null) return {};
1046
+ if (typeof ρσ_dict === "function" && d instanceof ρσ_dict) {
1047
+ var _r = {}; d.jsmap.forEach(function(v, k) { _r[k] = v; }); return _r;
1048
+ }
1049
+ return Object.assign({}, d);
1050
+ }
1051
+ var _ctx = (globals !== undefined) ? _ρσ_to_obj(globals) : {};
1052
+ if (locals !== undefined) Object.assign(_ctx, _ρσ_to_obj(locals));
1053
+ var _rσ_refs = expr.match(/ρσ_\w+/g) || [];
1054
+ _rσ_refs.forEach(function(name) {
1055
+ if (!Object.prototype.hasOwnProperty.call(_ctx, name)) {
1056
+ try { var _v = eval(name); if (_v !== undefined) _ctx[name] = _v; } catch(e) {}
1057
+ }
1058
+ });
1059
+ var _keys = Object.keys(_ctx);
1060
+ var _vals = _keys.map(function(k) { return _ctx[k]; });
1061
+ return Function.apply(null, _keys.concat(['return (' + expr + ')'])).apply(null, _vals);
1062
+ ;
1063
+ };
1064
+ if (!ρσ_eval.__argnames__) Object.defineProperties(ρσ_eval, {
1065
+ __argnames__ : {value: ["expr", "globals", "locals"]},
1066
+ __module__ : {value: "__main__"}
1067
+ });
1068
+
1069
+ ρσ_eval.__name__ = "eval";
1070
+ function ρσ_vars(obj) {
1071
+
1072
+ var _d;
1073
+ if (typeof ρσ_dict === "function") {
1074
+ _d = new ρσ_dict();
1075
+ if (obj !== undefined && obj !== null) {
1076
+ Object.keys(obj).forEach(function(k) {
1077
+ if (k.charCodeAt(0) !== 0x03c1) { _d.jsmap.set(k, obj[k]); }
1078
+ });
1079
+ }
1080
+ } else {
1081
+ _d = Object.create(null);
1082
+ if (obj !== undefined && obj !== null) {
1083
+ Object.keys(obj).forEach(function(k) {
1084
+ if (k.charCodeAt(0) !== 0x03c1) { _d[k] = obj[k]; }
1085
+ });
1086
+ }
1087
+ }
1088
+ ;
1089
+ return _d;
1090
+ };
1091
+ if (!ρσ_vars.__argnames__) Object.defineProperties(ρσ_vars, {
1092
+ __argnames__ : {value: ["obj"]},
1093
+ __module__ : {value: "__main__"}
1094
+ });
1095
+
1096
+ ρσ_vars.__name__ = "vars";
1097
+ function ρσ_locals() {
1098
+
1099
+ var _d;
1100
+ if (typeof ρσ_dict === "function") { _d = new ρσ_dict(); } else { _d = Object.create(null); }
1101
+ ;
1102
+ return _d;
1103
+ };
1104
+ if (!ρσ_locals.__module__) Object.defineProperties(ρσ_locals, {
1105
+ __module__ : {value: "__main__"}
1106
+ });
1107
+
1108
+ ρσ_locals.__name__ = "locals";
1109
+ function ρσ_globals() {
1110
+
1111
+ var _g = (typeof globalThis !== "undefined") ? globalThis : (typeof window !== "undefined" ? window : (typeof global !== "undefined" ? global : {}));
1112
+ var _d;
1113
+ if (typeof ρσ_dict === "function") {
1114
+ _d = new ρσ_dict();
1115
+ Object.getOwnPropertyNames(_g).forEach(function(k) { _d.jsmap.set(k, _g[k]); });
1116
+ } else {
1117
+ _d = Object.create(null);
1118
+ Object.getOwnPropertyNames(_g).forEach(function(k) { _d[k] = _g[k]; });
1119
+ }
1120
+ ;
1121
+ return _d;
1122
+ };
1123
+ if (!ρσ_globals.__module__) Object.defineProperties(ρσ_globals, {
1124
+ __module__ : {value: "__main__"}
1125
+ });
1126
+
1127
+ ρσ_globals.__name__ = "globals";
1128
+ function ρσ_abs(x) {
1129
+ if (x !== null && typeof x.__abs__ === "function") {
1130
+ return x.__abs__();
1131
+ }
1132
+ return Math.abs(x);
1133
+ };
1134
+ if (!ρσ_abs.__argnames__) Object.defineProperties(ρσ_abs, {
1135
+ __argnames__ : {value: ["x"]},
1136
+ __module__ : {value: "__main__"}
1137
+ });
1138
+
1139
+ ρσ_abs.__name__ = "abs";
1140
+ function ρσ_complex() {
1141
+ if (!(this instanceof ρσ_complex)) return new ρσ_complex(...arguments);
1142
+ if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
1143
+ ρσ_complex.prototype.__init__.apply(this, arguments);
1144
+ }
1145
+ ρσ_complex.prototype.__init__ = function __init__(real, imag) {
1146
+ var self = this;
1147
+ var nargs, x, s, m_mixed, m_imag, m_real, ims;
1148
+ nargs = arguments.length;
1149
+ if (nargs === 0) {
1150
+ self.real = 0;
1151
+ self.imag = 0;
1152
+ } else if (nargs >= 2) {
1153
+ if (typeof real !== "number" && typeof real !== "boolean") {
1154
+ throw new TypeError(ρσ_list_add(ρσ_list_add("complex() first argument must be a number, not '", typeof real), "'"));
1155
+ }
1156
+ if (typeof imag !== "number" && typeof imag !== "boolean") {
1157
+ throw new TypeError(ρσ_list_add(ρσ_list_add("complex() second argument must be a number, not '", typeof imag), "'"));
1158
+ }
1159
+ self.real = +real;
1160
+ self.imag = +imag;
1161
+ } else {
1162
+ x = real;
1163
+ if (x instanceof ρσ_complex) {
1164
+ self.real = x.real;
1165
+ self.imag = x.imag;
1166
+ } else if (typeof x === "number" || typeof x === "boolean") {
1167
+ self.real = +x;
1168
+ self.imag = 0;
1169
+ } else if (typeof x === "string" || x instanceof String) {
1170
+ s = new String(x).trim();
1171
+ m_mixed = /^([+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)([+-](?:(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)?)[jJ]$/.exec(s);
1172
+ m_imag = /^([+-]?(?:(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)?)[jJ]$/.exec(s);
1173
+ m_real = /^([+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)$/.exec(s);
1174
+ if (m_mixed) {
1175
+ self.real = parseFloat(m_mixed[1]);
1176
+ ims = m_mixed[2];
1177
+ if (ims === "+") {
1178
+ self.imag = 1;
1179
+ } else if (ims === "-") {
1180
+ self.imag = -1;
1181
+ } else {
1182
+ self.imag = parseFloat(ims);
1183
+ }
1184
+ } else if (m_imag) {
1185
+ self.real = 0;
1186
+ ims = m_imag[1];
1187
+ if (!ims || ims === "+") {
1188
+ self.imag = 1;
1189
+ } else if (ims === "-") {
1190
+ self.imag = -1;
1191
+ } else {
1192
+ self.imag = parseFloat(ims);
1193
+ }
1194
+ } else if (m_real) {
1195
+ self.real = parseFloat(m_real[1]);
1196
+ self.imag = 0;
1197
+ } else {
1198
+ throw new ValueError("complex() arg is a malformed string");
1199
+ }
1200
+ } else {
1201
+ throw new TypeError("complex() argument must be a string or a number");
1202
+ }
1203
+ }
1204
+ };
1205
+ if (!ρσ_complex.prototype.__init__.__argnames__) Object.defineProperties(ρσ_complex.prototype.__init__, {
1206
+ __argnames__ : {value: ["real", "imag"]},
1207
+ __module__ : {value: "__main__"}
1208
+ });
1209
+ ρσ_complex.__argnames__ = ρσ_complex.prototype.__init__.__argnames__;
1210
+ ρσ_complex.__handles_kwarg_interpolation__ = ρσ_complex.prototype.__init__.__handles_kwarg_interpolation__;
1211
+ ρσ_complex.prototype.__add__ = function __add__(other) {
1212
+ var self = this;
1213
+ if (other instanceof ρσ_complex) {
1214
+ return new ρσ_complex(ρσ_list_add(self.real, other.real), ρσ_list_add(self.imag, other.imag));
1215
+ }
1216
+ if (typeof other === "number" || typeof other === "boolean") {
1217
+ return new ρσ_complex(ρσ_list_add(self.real, other), self.imag);
1218
+ }
1219
+ throw new TypeError(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for +: 'complex' and '", typeof other), "'"));
1220
+ };
1221
+ if (!ρσ_complex.prototype.__add__.__argnames__) Object.defineProperties(ρσ_complex.prototype.__add__, {
1222
+ __argnames__ : {value: ["other"]},
1223
+ __module__ : {value: "__main__"}
1224
+ });
1225
+ ρσ_complex.prototype.__radd__ = function __radd__(other) {
1226
+ var self = this;
1227
+ if (typeof other === "number" || typeof other === "boolean") {
1228
+ return new ρσ_complex(ρσ_list_add(other, self.real), self.imag);
1229
+ }
1230
+ if (other instanceof ρσ_complex) {
1231
+ return new ρσ_complex(ρσ_list_add(other.real, self.real), ρσ_list_add(other.imag, self.imag));
1232
+ }
1233
+ throw new TypeError(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for +: '", typeof other), "' and 'complex'"));
1234
+ };
1235
+ if (!ρσ_complex.prototype.__radd__.__argnames__) Object.defineProperties(ρσ_complex.prototype.__radd__, {
1236
+ __argnames__ : {value: ["other"]},
1237
+ __module__ : {value: "__main__"}
1238
+ });
1239
+ ρσ_complex.prototype.__sub__ = function __sub__(other) {
1240
+ var self = this;
1241
+ if (other instanceof ρσ_complex) {
1242
+ return new ρσ_complex(self.real - other.real, self.imag - other.imag);
1243
+ }
1244
+ if (typeof other === "number" || typeof other === "boolean") {
1245
+ return new ρσ_complex(self.real - other, self.imag);
1246
+ }
1247
+ throw new TypeError(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for -: 'complex' and '", typeof other), "'"));
1248
+ };
1249
+ if (!ρσ_complex.prototype.__sub__.__argnames__) Object.defineProperties(ρσ_complex.prototype.__sub__, {
1250
+ __argnames__ : {value: ["other"]},
1251
+ __module__ : {value: "__main__"}
1252
+ });
1253
+ ρσ_complex.prototype.__rsub__ = function __rsub__(other) {
1254
+ var self = this;
1255
+ if (typeof other === "number" || typeof other === "boolean") {
1256
+ return new ρσ_complex(other - self.real, -self.imag);
1257
+ }
1258
+ if (other instanceof ρσ_complex) {
1259
+ return new ρσ_complex(other.real - self.real, other.imag - self.imag);
1260
+ }
1261
+ throw new TypeError(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for -: '", typeof other), "' and 'complex'"));
1262
+ };
1263
+ if (!ρσ_complex.prototype.__rsub__.__argnames__) Object.defineProperties(ρσ_complex.prototype.__rsub__, {
1264
+ __argnames__ : {value: ["other"]},
1265
+ __module__ : {value: "__main__"}
1266
+ });
1267
+ ρσ_complex.prototype.__mul__ = function __mul__(other) {
1268
+ var self = this;
1269
+ if (other instanceof ρσ_complex) {
1270
+ return new ρσ_complex(self.real * other.real - self.imag * other.imag, ρσ_list_add(self.real * other.imag, self.imag * other.real));
1271
+ }
1272
+ if (typeof other === "number" || typeof other === "boolean") {
1273
+ return new ρσ_complex(self.real * other, self.imag * other);
1274
+ }
1275
+ throw new TypeError(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for *: 'complex' and '", typeof other), "'"));
1276
+ };
1277
+ if (!ρσ_complex.prototype.__mul__.__argnames__) Object.defineProperties(ρσ_complex.prototype.__mul__, {
1278
+ __argnames__ : {value: ["other"]},
1279
+ __module__ : {value: "__main__"}
1280
+ });
1281
+ ρσ_complex.prototype.__rmul__ = function __rmul__(other) {
1282
+ var self = this;
1283
+ if (typeof other === "number" || typeof other === "boolean") {
1284
+ return new ρσ_complex(other * self.real, other * self.imag);
1285
+ }
1286
+ if (other instanceof ρσ_complex) {
1287
+ return new ρσ_complex(other.real * self.real - other.imag * self.imag, ρσ_list_add(other.real * self.imag, other.imag * self.real));
1288
+ }
1289
+ throw new TypeError(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for *: '", typeof other), "' and 'complex'"));
1290
+ };
1291
+ if (!ρσ_complex.prototype.__rmul__.__argnames__) Object.defineProperties(ρσ_complex.prototype.__rmul__, {
1292
+ __argnames__ : {value: ["other"]},
1293
+ __module__ : {value: "__main__"}
1294
+ });
1295
+ ρσ_complex.prototype.__truediv__ = function __truediv__(other) {
1296
+ var self = this;
1297
+ var denom;
1298
+ if (other instanceof ρσ_complex) {
1299
+ denom = ρσ_list_add(other.real * other.real, other.imag * other.imag);
1300
+ if (denom === 0) {
1301
+ throw new ZeroDivisionError("complex division by zero");
1302
+ }
1303
+ return new ρσ_complex((ρσ_list_add(self.real * other.real, self.imag * other.imag)) / denom, (self.imag * other.real - self.real * other.imag) / denom);
1304
+ }
1305
+ if (typeof other === "number" || typeof other === "boolean") {
1306
+ if (other === 0) {
1307
+ throw new ZeroDivisionError("complex division by zero");
1308
+ }
1309
+ return new ρσ_complex(self.real / other, self.imag / other);
1310
+ }
1311
+ throw new TypeError(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for /: 'complex' and '", typeof other), "'"));
1312
+ };
1313
+ if (!ρσ_complex.prototype.__truediv__.__argnames__) Object.defineProperties(ρσ_complex.prototype.__truediv__, {
1314
+ __argnames__ : {value: ["other"]},
1315
+ __module__ : {value: "__main__"}
1316
+ });
1317
+ ρσ_complex.prototype.__rtruediv__ = function __rtruediv__(other) {
1318
+ var self = this;
1319
+ var denom;
1320
+ denom = ρσ_list_add(self.real * self.real, self.imag * self.imag);
1321
+ if (denom === 0) {
1322
+ throw new ZeroDivisionError("complex division by zero");
1323
+ }
1324
+ if (typeof other === "number" || typeof other === "boolean") {
1325
+ return new ρσ_complex(other * self.real / denom, -other * self.imag / denom);
1326
+ }
1327
+ if (other instanceof ρσ_complex) {
1328
+ return new ρσ_complex((ρσ_list_add(other.real * self.real, other.imag * self.imag)) / denom, (other.imag * self.real - other.real * self.imag) / denom);
1329
+ }
1330
+ throw new TypeError(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for /: '", typeof other), "' and 'complex'"));
1331
+ };
1332
+ if (!ρσ_complex.prototype.__rtruediv__.__argnames__) Object.defineProperties(ρσ_complex.prototype.__rtruediv__, {
1333
+ __argnames__ : {value: ["other"]},
1334
+ __module__ : {value: "__main__"}
1335
+ });
1336
+ ρσ_complex.prototype.__pow__ = function __pow__(other) {
1337
+ var self = this;
1338
+ var r, theta, rn, log_r, c, d, re_prod, im_prod, exp_re;
1339
+ if (typeof other === "number" || typeof other === "boolean") {
1340
+ r = Math.sqrt(ρσ_list_add(self.real * self.real, self.imag * self.imag));
1341
+ if (r === 0) {
1342
+ return new ρσ_complex(0, 0);
1343
+ }
1344
+ theta = Math.atan2(self.imag, self.real);
1345
+ rn = Math.pow(r, other);
1346
+ return new ρσ_complex(rn * Math.cos(other * theta), rn * Math.sin(other * theta));
1347
+ }
1348
+ if (other instanceof ρσ_complex) {
1349
+ r = Math.sqrt(ρσ_list_add(self.real * self.real, self.imag * self.imag));
1350
+ if (r === 0) {
1351
+ return new ρσ_complex(0, 0);
1352
+ }
1353
+ theta = Math.atan2(self.imag, self.real);
1354
+ log_r = Math.log(r);
1355
+ c = other.real;
1356
+ d = other.imag;
1357
+ re_prod = c * log_r - d * theta;
1358
+ im_prod = ρσ_list_add(d * log_r, c * theta);
1359
+ exp_re = Math.exp(re_prod);
1360
+ return new ρσ_complex(exp_re * Math.cos(im_prod), exp_re * Math.sin(im_prod));
1361
+ }
1362
+ throw new TypeError(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for **: 'complex' and '", typeof other), "'"));
1363
+ };
1364
+ if (!ρσ_complex.prototype.__pow__.__argnames__) Object.defineProperties(ρσ_complex.prototype.__pow__, {
1365
+ __argnames__ : {value: ["other"]},
1366
+ __module__ : {value: "__main__"}
1367
+ });
1368
+ ρσ_complex.prototype.__rpow__ = function __rpow__(other) {
1369
+ var self = this;
1370
+ var base;
1371
+ if (typeof other === "number" || typeof other === "boolean") {
1372
+ base = new ρσ_complex(other, 0);
1373
+ return base.__pow__(self);
1374
+ }
1375
+ if (other instanceof ρσ_complex) {
1376
+ return other.__pow__(self);
1377
+ }
1378
+ throw new TypeError(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for **: '", typeof other), "' and 'complex'"));
1379
+ };
1380
+ if (!ρσ_complex.prototype.__rpow__.__argnames__) Object.defineProperties(ρσ_complex.prototype.__rpow__, {
1381
+ __argnames__ : {value: ["other"]},
1382
+ __module__ : {value: "__main__"}
1383
+ });
1384
+ ρσ_complex.prototype.__neg__ = function __neg__() {
1385
+ var self = this;
1386
+ return new ρσ_complex(-self.real, -self.imag);
1387
+ };
1388
+ if (!ρσ_complex.prototype.__neg__.__module__) Object.defineProperties(ρσ_complex.prototype.__neg__, {
1389
+ __module__ : {value: "__main__"}
1390
+ });
1391
+ ρσ_complex.prototype.__pos__ = function __pos__() {
1392
+ var self = this;
1393
+ return new ρσ_complex(self.real, self.imag);
1394
+ };
1395
+ if (!ρσ_complex.prototype.__pos__.__module__) Object.defineProperties(ρσ_complex.prototype.__pos__, {
1396
+ __module__ : {value: "__main__"}
1397
+ });
1398
+ ρσ_complex.prototype.__abs__ = function __abs__() {
1399
+ var self = this;
1400
+ return Math.sqrt(ρσ_list_add(self.real * self.real, self.imag * self.imag));
1401
+ };
1402
+ if (!ρσ_complex.prototype.__abs__.__module__) Object.defineProperties(ρσ_complex.prototype.__abs__, {
1403
+ __module__ : {value: "__main__"}
1404
+ });
1405
+ ρσ_complex.prototype.__bool__ = function __bool__() {
1406
+ var self = this;
1407
+ return self.real !== 0 || self.imag !== 0;
1408
+ };
1409
+ if (!ρσ_complex.prototype.__bool__.__module__) Object.defineProperties(ρσ_complex.prototype.__bool__, {
1410
+ __module__ : {value: "__main__"}
1411
+ });
1412
+ ρσ_complex.prototype.__eq__ = function __eq__(other) {
1413
+ var self = this;
1414
+ if (other instanceof ρσ_complex) {
1415
+ return self.real === other.real && self.imag === other.imag;
1416
+ }
1417
+ if (typeof other === "number" || typeof other === "boolean") {
1418
+ return self.imag === 0 && self.real === other;
1419
+ }
1420
+ return false;
1421
+ };
1422
+ if (!ρσ_complex.prototype.__eq__.__argnames__) Object.defineProperties(ρσ_complex.prototype.__eq__, {
1423
+ __argnames__ : {value: ["other"]},
1424
+ __module__ : {value: "__main__"}
1425
+ });
1426
+ ρσ_complex.prototype.__hash__ = function __hash__() {
1427
+ var self = this;
1428
+ if (self.imag === 0) {
1429
+ return self.real | 0;
1430
+ }
1431
+ return (self.real * 1000003 ^ self.imag) | 0;
1432
+ };
1433
+ if (!ρσ_complex.prototype.__hash__.__module__) Object.defineProperties(ρσ_complex.prototype.__hash__, {
1434
+ __module__ : {value: "__main__"}
1435
+ });
1436
+ ρσ_complex.prototype.conjugate = function conjugate() {
1437
+ var self = this;
1438
+ return new ρσ_complex(self.real, -self.imag);
1439
+ };
1440
+ if (!ρσ_complex.prototype.conjugate.__module__) Object.defineProperties(ρσ_complex.prototype.conjugate, {
1441
+ __module__ : {value: "__main__"}
1442
+ });
1443
+ ρσ_complex.prototype.__repr__ = function __repr__() {
1444
+ var self = this;
1445
+ var r, i, r_str, i_str;
1446
+ r = self.real;
1447
+ i = self.imag;
1448
+ if (r === 0 && i === 0) {
1449
+ return "0j";
1450
+ }
1451
+ r_str = new String(r);
1452
+ i_str = new String(i);
1453
+ if (r === 0) {
1454
+ return ρσ_list_add(i_str, "j");
1455
+ }
1456
+ if (i >= 0 || isNaN(i)) {
1457
+ return ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("(", r_str), "+"), i_str), "j)");
1458
+ }
1459
+ return ρσ_list_add(ρσ_list_add(ρσ_list_add("(", r_str), i_str), "j)");
1460
+ };
1461
+ if (!ρσ_complex.prototype.__repr__.__module__) Object.defineProperties(ρσ_complex.prototype.__repr__, {
1462
+ __module__ : {value: "__main__"}
1463
+ });
1464
+ ρσ_complex.prototype.__str__ = function __str__() {
1465
+ var self = this;
1466
+ return self.__repr__();
1467
+ };
1468
+ if (!ρσ_complex.prototype.__str__.__module__) Object.defineProperties(ρσ_complex.prototype.__str__, {
1469
+ __module__ : {value: "__main__"}
1470
+ });
1471
+ ρσ_complex.prototype.__format__ = function __format__ () {
1472
+ if (!arguments[0]) return this.__str__();
1473
+ throw new TypeError("unsupported format specification");
1474
+ };
1475
+ Object.defineProperty(ρσ_complex.prototype, "__bases__", {value: []});
1476
+ ρσ_complex.__name__ = "ρσ_complex";
1477
+ ρσ_complex.__qualname__ = "ρσ_complex";
1478
+ ρσ_complex.__module__ = "__main__";
1479
+ Object.defineProperty(ρσ_complex.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
1480
+
1481
+ ρσ_complex.__name__ = "complex";
1482
+ var abs = ρσ_abs, max = ρσ_max.bind(Math.max), min = ρσ_max.bind(Math.min), bool = ρσ_bool, type = ρσ_type;
1483
+ var float = ρσ_float, int = ρσ_int, complex = ρσ_complex, arraylike = ρσ_arraylike_creator(), ρσ_arraylike = arraylike;
1484
+ var id = ρσ_id, get_module = ρσ_get_module, pow = ρσ_pow, divmod = ρσ_divmod, __import__ = ρσ__import__;
1485
+ var dir = ρσ_dir, ord = ρσ_ord, chr = ρσ_chr, bin = ρσ_bin, hex = ρσ_hex, callable = ρσ_callable, round = ρσ_round;
1486
+ var enumerate = ρσ_enumerate, iter = ρσ_iter, reversed = ρσ_reversed, len = ρσ_len;
1487
+ var range = ρσ_range, getattr = ρσ_getattr, setattr = ρσ_setattr, hasattr = ρσ_hasattr, issubclass = ρσ_issubclass, hash = ρσ_hash, next = ρσ_next;
1488
+ var exec = ρσ_exec;
1489
+ var vars = ρσ_vars, locals = ρσ_locals, globals = ρσ_globals;
1490
+ var ρσ_Ellipsis = Object.freeze({toString: function(){return "Ellipsis";}, __repr__: function(){return "Ellipsis";}});
1491
+ var Ellipsis = ρσ_Ellipsis;
1492
+ var slice = ρσ_slice;
1493
+ var object = ρσ_object;
1494
+ Number.prototype.is_integer = function() { return isFinite(+this) && (+this) % 1 === 0; };
1495
+ Number.prototype.bit_length = function() { var n = Math.abs(Math.trunc(+this)); if (n === 0) return 0; return Math.floor(Math.log2(n)) + 1; };function ρσ_bytes_utf8_encode(s) {
1496
+ var out, c, i, c2, cp;
1497
+ if (typeof TextEncoder !== "undefined") {
1498
+ return Array.from(new TextEncoder().encode(s));
1499
+ }
1500
+ out = ρσ_list_decorate([]);
1501
+ for (var i = 0; i < s.length; i++) {
1502
+ c = s.charCodeAt(i);
1503
+ if (c < 128) {
1504
+ out.push(c);
1505
+ } else if (c < 2048) {
1506
+ out.push(192 | c >> 6);
1507
+ out.push(128 | c & 63);
1508
+ } else if (c >= 55296 && c <= 56319) {
1509
+ i = ρσ_list_iadd(i, 1);
1510
+ c2 = s.charCodeAt(i);
1511
+ cp = ρσ_list_add(ρσ_list_add(65536, (c - 55296 << 10)), (c2 - 56320));
1512
+ out.push(240 | cp >> 18);
1513
+ out.push(128 | cp >> 12 & 63);
1514
+ out.push(128 | cp >> 6 & 63);
1515
+ out.push(128 | cp & 63);
1516
+ } else {
1517
+ out.push(224 | c >> 12);
1518
+ out.push(128 | c >> 6 & 63);
1519
+ out.push(128 | c & 63);
1520
+ }
1521
+ }
1522
+ return out;
1523
+ };
1524
+ if (!ρσ_bytes_utf8_encode.__argnames__) Object.defineProperties(ρσ_bytes_utf8_encode, {
1525
+ __argnames__ : {value: ["s"]},
1526
+ __module__ : {value: "__main__"}
1527
+ });
1528
+
1529
+ function ρσ_bytes_utf8_decode(data) {
1530
+ var out, i, b, cp;
1531
+ if (typeof TextDecoder !== "undefined") {
1532
+ return new TextDecoder("utf-8").decode(new Uint8Array(data));
1533
+ }
1534
+ out = ρσ_list_decorate([]);
1535
+ i = 0;
1536
+ while (i < data.length) {
1537
+ b = data[(typeof i === "number" && i < 0) ? data.length + i : i];
1538
+ if (b < 128) {
1539
+ out.push(String.fromCharCode(b));
1540
+ i = ρσ_list_iadd(i, 1);
1541
+ } else if (b < 224) {
1542
+ cp = (b & 31) << 6 | data[ρσ_bound_index(ρσ_list_add(i, 1), data)] & 63;
1543
+ out.push(String.fromCharCode(cp));
1544
+ i = ρσ_list_iadd(i, 2);
1545
+ } else if (b < 240) {
1546
+ cp = (b & 15) << 12 | (data[ρσ_bound_index(ρσ_list_add(i, 1), data)] & 63) << 6 | data[ρσ_bound_index(ρσ_list_add(i, 2), data)] & 63;
1547
+ out.push(String.fromCharCode(cp));
1548
+ i = ρσ_list_iadd(i, 3);
1549
+ } else {
1550
+ cp = (b & 7) << 18 | (data[ρσ_bound_index(ρσ_list_add(i, 1), data)] & 63) << 12 | (data[ρσ_bound_index(ρσ_list_add(i, 2), data)] & 63) << 6 | data[ρσ_bound_index(ρσ_list_add(i, 3), data)] & 63;
1551
+ cp -= 65536;
1552
+ out.push(String.fromCharCode(ρσ_list_add(55296, (cp >> 10))));
1553
+ out.push(String.fromCharCode(ρσ_list_add(56320, (cp & 1023))));
1554
+ i = ρσ_list_iadd(i, 4);
1555
+ }
1556
+ }
1557
+ return out.join("");
1558
+ };
1559
+ if (!ρσ_bytes_utf8_decode.__argnames__) Object.defineProperties(ρσ_bytes_utf8_decode, {
1560
+ __argnames__ : {value: ["data"]},
1561
+ __module__ : {value: "__main__"}
1562
+ });
1563
+
1564
+ function ρσ_bytes_latin1_encode(s) {
1565
+ var out, c;
1566
+ out = ρσ_list_decorate([]);
1567
+ for (var i = 0; i < s.length; i++) {
1568
+ c = s.charCodeAt(i);
1569
+ if (c > 255) {
1570
+ throw UnicodeEncodeError("latin-1", s, i, ρσ_list_add(i, 1), "ordinal not in range(256)");
1571
+ }
1572
+ out.push(c);
1573
+ }
1574
+ return out;
1575
+ };
1576
+ if (!ρσ_bytes_latin1_encode.__argnames__) Object.defineProperties(ρσ_bytes_latin1_encode, {
1577
+ __argnames__ : {value: ["s"]},
1578
+ __module__ : {value: "__main__"}
1579
+ });
1580
+
1581
+ function ρσ_bytes_latin1_decode(data) {
1582
+ var chars;
1583
+ chars = ρσ_list_decorate([]);
1584
+ for (var i = 0; i < data.length; i++) {
1585
+ chars.push(String.fromCharCode(data[(typeof i === "number" && i < 0) ? data.length + i : i]));
1586
+ }
1587
+ return chars.join("");
1588
+ };
1589
+ if (!ρσ_bytes_latin1_decode.__argnames__) Object.defineProperties(ρσ_bytes_latin1_decode, {
1590
+ __argnames__ : {value: ["data"]},
1591
+ __module__ : {value: "__main__"}
1592
+ });
1593
+
1594
+ function ρσ_bytes_from_source(source, encoding, errors) {
1595
+ var data, n, enc, b, x, iterator, result;
1596
+ data = ρσ_list_decorate([]);
1597
+ if (arguments.length === 0 || source === null || source === undefined) {
1598
+ } else if (typeof source === "number") {
1599
+ n = source | 0;
1600
+ if (n < 0) {
1601
+ throw new ValueError("negative count");
1602
+ }
1603
+ for (var i = 0; i < n; i++) {
1604
+ data.push(0);
1605
+ }
1606
+ } else if (typeof source === "string") {
1607
+ enc = (encoding || "utf-8").toLowerCase().replace(/-|_/g, "");
1608
+ if (enc === "utf8") {
1609
+ data = ρσ_bytes_utf8_encode(source);
1610
+ } else if (enc === "latin1" || enc === "iso88591" || enc === "ascii") {
1611
+ data = ρσ_bytes_latin1_encode(source);
1612
+ } else {
1613
+ throw LookupError(ρσ_list_add("unknown encoding: ", (encoding || "utf-8")));
1614
+ }
1615
+ } else if (source instanceof ρσ_bytes || source instanceof ρσ_bytearray) {
1616
+ data = source._data.slice();
1617
+ } else if (source instanceof Uint8Array || source instanceof Int8Array) {
1618
+ for (var i = 0; i < source.length; i++) {
1619
+ data.push(source[(typeof i === "number" && i < 0) ? source.length + i : i] & 255);
1620
+ }
1621
+ } else if (ρσ_arraylike(source) || Array.isArray(source)) {
1622
+ var ρσ_Iter0 = ρσ_Iterable(source);
1623
+ for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
1624
+ x = ρσ_Iter0[ρσ_Index0];
1625
+ b = x | 0;
1626
+ if (b < 0 || b > 255) {
1627
+ throw new ValueError("bytes must be in range(0, 256)");
1628
+ }
1629
+ data.push(b);
1630
+ }
1631
+ } else if (typeof source[ρσ_iterator_symbol] === "function") {
1632
+ iterator = source[ρσ_iterator_symbol]();
1633
+ result = iterator.next();
1634
+ while (!result.done) {
1635
+ b = result.value | 0;
1636
+ if (b < 0 || b > 255) {
1637
+ throw new ValueError("bytes must be in range(0, 256)");
1638
+ }
1639
+ data.push(b);
1640
+ result = iterator.next();
1641
+ }
1642
+ } else {
1643
+ throw new TypeError(ρσ_list_add(ρσ_list_add("cannot convert '", typeof source), "' object to bytes-like object"));
1644
+ }
1645
+ return data;
1646
+ };
1647
+ if (!ρσ_bytes_from_source.__argnames__) Object.defineProperties(ρσ_bytes_from_source, {
1648
+ __argnames__ : {value: ["source", "encoding", "errors"]},
1649
+ __module__ : {value: "__main__"}
1650
+ });
1651
+
1652
+ function ρσ_bytes_sync(obj) {
1653
+ var data, old_len, new_len;
1654
+ data = obj._data;
1655
+ old_len = obj.length | 0;
1656
+ new_len = data.length;
1657
+ for (var i = new_len; i < old_len; i++) {
1658
+ delete obj[i];
1659
+ }
1660
+ for (var i = 0; i < new_len; i++) {
1661
+ obj[(typeof i === "number" && i < 0) ? obj.length + i : i] = data[(typeof i === "number" && i < 0) ? data.length + i : i];
1662
+ }
1663
+ obj.length = new_len;
1664
+ };
1665
+ if (!ρσ_bytes_sync.__argnames__) Object.defineProperties(ρσ_bytes_sync, {
1666
+ __argnames__ : {value: ["obj"]},
1667
+ __module__ : {value: "__main__"}
1668
+ });
1669
+
1670
+ function ρσ_bytes_find(haystack, needle, start) {
1671
+ var hl, nl, ok;
1672
+ hl = haystack.length;
1673
+ nl = needle.length;
1674
+ if (nl === 0) {
1675
+ return start;
1676
+ }
1677
+ for (var i = start; i <= hl - nl; i++) {
1678
+ ok = true;
1679
+ for (var j = 0; j < nl; j++) {
1680
+ if (haystack[ρσ_bound_index(ρσ_list_add(i, j), haystack)] !== needle[(typeof j === "number" && j < 0) ? needle.length + j : j]) {
1681
+ ok = false;
1682
+ break;
1683
+ }
1684
+ }
1685
+ if (ok) {
1686
+ return i;
1687
+ }
1688
+ }
1689
+ return -1;
1690
+ };
1691
+ if (!ρσ_bytes_find.__argnames__) Object.defineProperties(ρσ_bytes_find, {
1692
+ __argnames__ : {value: ["haystack", "needle", "start"]},
1693
+ __module__ : {value: "__main__"}
1694
+ });
1695
+
1696
+ function ρσ_bytes() {
1697
+ if (!(this instanceof ρσ_bytes)) return new ρσ_bytes(...arguments);
1698
+ if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
1699
+ ρσ_bytes.prototype.__init__.apply(this, arguments);
1700
+ }
1701
+ ρσ_bytes.prototype.__init__ = function __init__(source, encoding, errors) {
1702
+ var self = this;
1703
+ self._data = ρσ_bytes_from_source.apply(null, arguments);
1704
+ ρσ_bytes_sync(self);
1705
+ };
1706
+ if (!ρσ_bytes.prototype.__init__.__argnames__) Object.defineProperties(ρσ_bytes.prototype.__init__, {
1707
+ __argnames__ : {value: ["source", "encoding", "errors"]},
1708
+ __module__ : {value: "__main__"}
1709
+ });
1710
+ ρσ_bytes.__argnames__ = ρσ_bytes.prototype.__init__.__argnames__;
1711
+ ρσ_bytes.__handles_kwarg_interpolation__ = ρσ_bytes.prototype.__init__.__handles_kwarg_interpolation__;
1712
+ ρσ_bytes.prototype.__len__ = function __len__() {
1713
+ var self = this;
1714
+ return self._data.length;
1715
+ };
1716
+ if (!ρσ_bytes.prototype.__len__.__module__) Object.defineProperties(ρσ_bytes.prototype.__len__, {
1717
+ __module__ : {value: "__main__"}
1718
+ });
1719
+ ρσ_bytes.prototype.__getitem__ = function __getitem__(key) {
1720
+ var self = this;
1721
+ var indices, start, stop, step, result, n;
1722
+ if (key instanceof ρσ_slice) {
1723
+ indices = key.indices(self._data.length);
1724
+ start = indices[0];
1725
+ stop = indices[1];
1726
+ step = indices[2];
1727
+ result = ρσ_list_decorate([]);
1728
+ if (step > 0) {
1729
+ for (var i = start; i < stop; i += step) {
1730
+ result.push((ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i]);
1731
+ }
1732
+ } else {
1733
+ for (var i = start; i > stop; i += step) {
1734
+ result.push((ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i]);
1735
+ }
1736
+ }
1737
+ return new ρσ_bytes(result);
1738
+ }
1739
+ n = key | 0;
1740
+ if (n < 0) {
1741
+ n = ρσ_list_iadd(n, self._data.length);
1742
+ }
1743
+ if (n < 0 || n >= self._data.length) {
1744
+ throw new IndexError("index out of range");
1745
+ }
1746
+ return (ρσ_expr_temp = self._data)[(typeof n === "number" && n < 0) ? ρσ_expr_temp.length + n : n];
1747
+ };
1748
+ if (!ρσ_bytes.prototype.__getitem__.__argnames__) Object.defineProperties(ρσ_bytes.prototype.__getitem__, {
1749
+ __argnames__ : {value: ["key"]},
1750
+ __module__ : {value: "__main__"}
1751
+ });
1752
+ ρσ_bytes.prototype.__contains__ = function __contains__(item) {
1753
+ var self = this;
1754
+ var b;
1755
+ if (item instanceof ρσ_bytes || item instanceof ρσ_bytearray) {
1756
+ return ρσ_bytes_find(self._data, item._data, 0) >= 0;
1757
+ }
1758
+ b = item | 0;
1759
+ for (var i = 0; i < this._data.length; i++) {
1760
+ if ((ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === b) {
1761
+ return true;
1762
+ }
1763
+ }
1764
+ return false;
1765
+ };
1766
+ if (!ρσ_bytes.prototype.__contains__.__argnames__) Object.defineProperties(ρσ_bytes.prototype.__contains__, {
1767
+ __argnames__ : {value: ["item"]},
1768
+ __module__ : {value: "__main__"}
1769
+ });
1770
+ ρσ_bytes.prototype.__add__ = function __add__(other) {
1771
+ var self = this;
1772
+ if (!((other instanceof ρσ_bytes || other instanceof ρσ_bytearray))) {
1773
+ throw new TypeError("can't concat bytes-like objects of different types");
1774
+ }
1775
+ return new ρσ_bytes(self._data.concat(other._data));
1776
+ };
1777
+ if (!ρσ_bytes.prototype.__add__.__argnames__) Object.defineProperties(ρσ_bytes.prototype.__add__, {
1778
+ __argnames__ : {value: ["other"]},
1779
+ __module__ : {value: "__main__"}
1780
+ });
1781
+ ρσ_bytes.prototype.__mul__ = function __mul__(n) {
1782
+ var self = this;
1783
+ var result;
1784
+ result = ρσ_list_decorate([]);
1785
+ for (var k = 0; k < n; k++) {
1786
+ for (var j = 0; j < this._data.length; j++) {
1787
+ result.push((ρσ_expr_temp = self._data)[(typeof j === "number" && j < 0) ? ρσ_expr_temp.length + j : j]);
1788
+ }
1789
+ }
1790
+ return new ρσ_bytes(result);
1791
+ };
1792
+ if (!ρσ_bytes.prototype.__mul__.__argnames__) Object.defineProperties(ρσ_bytes.prototype.__mul__, {
1793
+ __argnames__ : {value: ["n"]},
1794
+ __module__ : {value: "__main__"}
1795
+ });
1796
+ ρσ_bytes.prototype.__rmul__ = function __rmul__(n) {
1797
+ var self = this;
1798
+ return self.__mul__(n);
1799
+ };
1800
+ if (!ρσ_bytes.prototype.__rmul__.__argnames__) Object.defineProperties(ρσ_bytes.prototype.__rmul__, {
1801
+ __argnames__ : {value: ["n"]},
1802
+ __module__ : {value: "__main__"}
1803
+ });
1804
+ ρσ_bytes.prototype.__eq__ = function __eq__(other) {
1805
+ var self = this;
1806
+ if (!((other instanceof ρσ_bytes || other instanceof ρσ_bytearray))) {
1807
+ return false;
1808
+ }
1809
+ if (self._data.length !== other._data.length) {
1810
+ return false;
1811
+ }
1812
+ for (var i = 0; i < this._data.length; i++) {
1813
+ if ((ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] !== (ρσ_expr_temp = other._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i]) {
1814
+ return false;
1815
+ }
1816
+ }
1817
+ return true;
1818
+ };
1819
+ if (!ρσ_bytes.prototype.__eq__.__argnames__) Object.defineProperties(ρσ_bytes.prototype.__eq__, {
1820
+ __argnames__ : {value: ["other"]},
1821
+ __module__ : {value: "__main__"}
1822
+ });
1823
+ ρσ_bytes.prototype.__iter__ = function __iter__() {
1824
+ var self = this;
1825
+ return iter(self._data);
1826
+ };
1827
+ if (!ρσ_bytes.prototype.__iter__.__module__) Object.defineProperties(ρσ_bytes.prototype.__iter__, {
1828
+ __module__ : {value: "__main__"}
1829
+ });
1830
+ ρσ_bytes.prototype[ρσ_iterator_symbol] = ρσ_bytes.prototype.__iter__;
1831
+ ρσ_bytes.prototype.__bool__ = function __bool__() {
1832
+ var self = this;
1833
+ return self._data.length > 0;
1834
+ };
1835
+ if (!ρσ_bytes.prototype.__bool__.__module__) Object.defineProperties(ρσ_bytes.prototype.__bool__, {
1836
+ __module__ : {value: "__main__"}
1837
+ });
1838
+ ρσ_bytes.prototype.__repr__ = function __repr__() {
1839
+ var self = this;
1840
+ var parts, b, h;
1841
+ parts = ρσ_list_decorate([ "b'" ]);
1842
+ for (var i = 0; i < this._data.length; i++) {
1843
+ b = (ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
1844
+ if (b === 9) {
1845
+ parts.push("\\t");
1846
+ } else if (b === 10) {
1847
+ parts.push("\\n");
1848
+ } else if (b === 13) {
1849
+ parts.push("\\r");
1850
+ } else if (b === 39) {
1851
+ parts.push("\\'");
1852
+ } else if (b === 92) {
1853
+ parts.push("\\\\");
1854
+ } else if (b >= 32 && b < 127) {
1855
+ parts.push(String.fromCharCode(b));
1856
+ } else {
1857
+ h = b.toString(16);
1858
+ parts.push(ρσ_list_add(ρσ_list_add("\\x", ((h.length < 2) ? "0" : "")), h));
1859
+ }
1860
+ }
1861
+ parts.push("'");
1862
+ return parts.join("");
1863
+ };
1864
+ if (!ρσ_bytes.prototype.__repr__.__module__) Object.defineProperties(ρσ_bytes.prototype.__repr__, {
1865
+ __module__ : {value: "__main__"}
1866
+ });
1867
+ ρσ_bytes.prototype.__str__ = function __str__() {
1868
+ var self = this;
1869
+ return self.__repr__();
1870
+ };
1871
+ if (!ρσ_bytes.prototype.__str__.__module__) Object.defineProperties(ρσ_bytes.prototype.__str__, {
1872
+ __module__ : {value: "__main__"}
1873
+ });
1874
+ ρσ_bytes.prototype.__hash__ = function __hash__() {
1875
+ var self = this;
1876
+ var h;
1877
+ h = 5381;
1878
+ for (var i = 0; i < this._data.length; i++) {
1879
+ h = ρσ_list_add((h << 5), h) ^ (ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
1880
+ h = h | 0;
1881
+ }
1882
+ return h;
1883
+ };
1884
+ if (!ρσ_bytes.prototype.__hash__.__module__) Object.defineProperties(ρσ_bytes.prototype.__hash__, {
1885
+ __module__ : {value: "__main__"}
1886
+ });
1887
+ ρσ_bytes.prototype.hex = function hex(sep, bytes_per_sep) {
1888
+ var self = this;
1889
+ var parts, h, n, grouped, i;
1890
+ parts = ρσ_list_decorate([]);
1891
+ for (var i = 0; i < this._data.length; i++) {
1892
+ h = (ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i].toString(16);
1893
+ parts.push(ρσ_list_add(((h.length < 2) ? "0" : ""), h));
1894
+ }
1895
+ if (sep !== undefined && sep !== null && parts.length > 0) {
1896
+ n = (bytes_per_sep === undefined || bytes_per_sep === null) ? 1 : bytes_per_sep | 0;
1897
+ if (n < 0) {
1898
+ n = -n;
1899
+ grouped = ρσ_list_decorate([]);
1900
+ i = parts.length;
1901
+ while (i > 0) {
1902
+ grouped.unshift(parts.slice(max(0, i - n), i).join(""));
1903
+ i -= n;
1904
+ }
1905
+ return grouped.join(sep);
1906
+ } else {
1907
+ grouped = ρσ_list_decorate([]);
1908
+ for (var i = 0; i < parts.length; i += n) {
1909
+ grouped.push(parts.slice(i, ρσ_list_add(i, n)).join(""));
1910
+ }
1911
+ return grouped.join(sep);
1912
+ }
1913
+ }
1914
+ return parts.join("");
1915
+ };
1916
+ if (!ρσ_bytes.prototype.hex.__argnames__) Object.defineProperties(ρσ_bytes.prototype.hex, {
1917
+ __argnames__ : {value: ["sep", "bytes_per_sep"]},
1918
+ __module__ : {value: "__main__"}
1919
+ });
1920
+ ρσ_bytes.prototype.decode = function decode(encoding, errors) {
1921
+ var self = this;
1922
+ var enc;
1923
+ enc = (encoding || "utf-8").toLowerCase().replace(/-|_/g, "");
1924
+ if (enc === "utf8") {
1925
+ return ρσ_bytes_utf8_decode(self._data);
1926
+ } else if (enc === "latin1" || enc === "iso88591" || enc === "ascii") {
1927
+ return ρσ_bytes_latin1_decode(self._data);
1928
+ } else {
1929
+ throw LookupError(ρσ_list_add("unknown encoding: ", (encoding || "utf-8")));
1930
+ }
1931
+ };
1932
+ if (!ρσ_bytes.prototype.decode.__argnames__) Object.defineProperties(ρσ_bytes.prototype.decode, {
1933
+ __argnames__ : {value: ["encoding", "errors"]},
1934
+ __module__ : {value: "__main__"}
1935
+ });
1936
+ ρσ_bytes.fromhex = function fromhex(s) {
1937
+ var data, val;
1938
+ s = s.replace(/ /g, "");
1939
+ if (s.length % 2 !== 0) {
1940
+ throw new ValueError("non-hexadecimal number found in fromhex() arg");
1941
+ }
1942
+ data = ρσ_list_decorate([]);
1943
+ for (var i = 0; i < s.length; i += 2) {
1944
+ val = parseInt(s.slice(i, ρσ_list_add(i, 2)), 16);
1945
+ if (isNaN(val)) {
1946
+ throw new ValueError(ρσ_list_add("non-hexadecimal number found in fromhex() arg at position ", str(i)));
1947
+ }
1948
+ data.push(val);
1949
+ }
1950
+ return new ρσ_bytes(data);
1951
+ };
1952
+ if (!ρσ_bytes.fromhex.__argnames__) Object.defineProperties(ρσ_bytes.fromhex, {
1953
+ __argnames__ : {value: ["s"]},
1954
+ __module__ : {value: "__main__"}
1955
+ });
1956
+ ρσ_bytes.prototype.count = function count(sub, start, end) {
1957
+ var self = this;
1958
+ var needle, s, e, n, pos, found;
1959
+ needle = (typeof sub === "number") ? ρσ_list_decorate([ sub | 0 ]) : sub._data;
1960
+ s = (start === undefined) ? 0 : start | 0;
1961
+ e = (end === undefined) ? self._data.length : end | 0;
1962
+ n = 0;
1963
+ pos = s;
1964
+ while (pos <= e - needle.length) {
1965
+ found = ρσ_bytes_find(self._data, needle, pos);
1966
+ if (found < 0 || ρσ_list_add(found, needle.length) > e) {
1967
+ break;
1968
+ }
1969
+ n = ρσ_list_iadd(n, 1);
1970
+ pos = ρσ_list_add(found, max(1, needle.length));
1971
+ }
1972
+ return n;
1973
+ };
1974
+ if (!ρσ_bytes.prototype.count.__argnames__) Object.defineProperties(ρσ_bytes.prototype.count, {
1975
+ __argnames__ : {value: ["sub", "start", "end"]},
1976
+ __module__ : {value: "__main__"}
1977
+ });
1978
+ ρσ_bytes.prototype.find = function find(sub, start, end) {
1979
+ var self = this;
1980
+ var needle, s, e, pos;
1981
+ needle = (typeof sub === "number") ? ρσ_list_decorate([ sub | 0 ]) : sub._data;
1982
+ s = (start === undefined) ? 0 : start | 0;
1983
+ e = (end === undefined) ? self._data.length : end | 0;
1984
+ pos = ρσ_bytes_find(self._data, needle, s);
1985
+ if (pos >= 0 && ρσ_list_add(pos, needle.length) <= e) {
1986
+ return pos;
1987
+ }
1988
+ return -1;
1989
+ };
1990
+ if (!ρσ_bytes.prototype.find.__argnames__) Object.defineProperties(ρσ_bytes.prototype.find, {
1991
+ __argnames__ : {value: ["sub", "start", "end"]},
1992
+ __module__ : {value: "__main__"}
1993
+ });
1994
+ ρσ_bytes.prototype.index = function index(sub, start, end) {
1995
+ var self = this;
1996
+ var pos;
1997
+ pos = self.find(sub, start, end);
1998
+ if (pos < 0) {
1999
+ throw new ValueError("subsequence not found");
2000
+ }
2001
+ return pos;
2002
+ };
2003
+ if (!ρσ_bytes.prototype.index.__argnames__) Object.defineProperties(ρσ_bytes.prototype.index, {
2004
+ __argnames__ : {value: ["sub", "start", "end"]},
2005
+ __module__ : {value: "__main__"}
2006
+ });
2007
+ ρσ_bytes.prototype.rfind = function rfind(sub, start, end) {
2008
+ var self = this;
2009
+ var needle, s, e, last, pos, found;
2010
+ needle = (typeof sub === "number") ? ρσ_list_decorate([ sub | 0 ]) : sub._data;
2011
+ s = (start === undefined) ? 0 : start | 0;
2012
+ e = (end === undefined) ? self._data.length : end | 0;
2013
+ last = -1;
2014
+ pos = s;
2015
+ while (pos <= e - needle.length) {
2016
+ found = ρσ_bytes_find(self._data, needle, pos);
2017
+ if (found < 0 || ρσ_list_add(found, needle.length) > e) {
2018
+ break;
2019
+ }
2020
+ last = found;
2021
+ pos = ρσ_list_add(found, max(1, needle.length));
2022
+ }
2023
+ return last;
2024
+ };
2025
+ if (!ρσ_bytes.prototype.rfind.__argnames__) Object.defineProperties(ρσ_bytes.prototype.rfind, {
2026
+ __argnames__ : {value: ["sub", "start", "end"]},
2027
+ __module__ : {value: "__main__"}
2028
+ });
2029
+ ρσ_bytes.prototype.rindex = function rindex(sub, start, end) {
2030
+ var self = this;
2031
+ var pos;
2032
+ pos = self.rfind(sub, start, end);
2033
+ if (pos < 0) {
2034
+ throw new ValueError("subsequence not found");
2035
+ }
2036
+ return pos;
2037
+ };
2038
+ if (!ρσ_bytes.prototype.rindex.__argnames__) Object.defineProperties(ρσ_bytes.prototype.rindex, {
2039
+ __argnames__ : {value: ["sub", "start", "end"]},
2040
+ __module__ : {value: "__main__"}
2041
+ });
2042
+ ρσ_bytes.prototype.startswith = function startswith(prefix, start, end) {
2043
+ var self = this;
2044
+ var s, e, pdata;
2045
+ s = (start === undefined) ? 0 : start | 0;
2046
+ e = (end === undefined) ? self._data.length : end | 0;
2047
+ pdata = (typeof prefix === "number") ? ρσ_list_decorate([ prefix | 0 ]) : prefix._data;
2048
+ if (pdata.length > e - s) {
2049
+ return false;
2050
+ }
2051
+ for (var i = 0; i < pdata.length; i++) {
2052
+ if ((ρσ_expr_temp = self._data)[ρσ_bound_index(ρσ_list_add(s, i), ρσ_expr_temp)] !== pdata[(typeof i === "number" && i < 0) ? pdata.length + i : i]) {
2053
+ return false;
2054
+ }
2055
+ }
2056
+ return true;
2057
+ };
2058
+ if (!ρσ_bytes.prototype.startswith.__argnames__) Object.defineProperties(ρσ_bytes.prototype.startswith, {
2059
+ __argnames__ : {value: ["prefix", "start", "end"]},
2060
+ __module__ : {value: "__main__"}
2061
+ });
2062
+ ρσ_bytes.prototype.endswith = function endswith(suffix, start, end) {
2063
+ var self = this;
2064
+ var s, e, sdata, offset;
2065
+ s = (start === undefined) ? 0 : start | 0;
2066
+ e = (end === undefined) ? self._data.length : end | 0;
2067
+ sdata = (typeof suffix === "number") ? ρσ_list_decorate([ suffix | 0 ]) : suffix._data;
2068
+ if (sdata.length > e - s) {
2069
+ return false;
2070
+ }
2071
+ offset = e - sdata.length;
2072
+ for (var i = 0; i < sdata.length; i++) {
2073
+ if ((ρσ_expr_temp = self._data)[ρσ_bound_index(ρσ_list_add(offset, i), ρσ_expr_temp)] !== sdata[(typeof i === "number" && i < 0) ? sdata.length + i : i]) {
2074
+ return false;
2075
+ }
2076
+ }
2077
+ return true;
2078
+ };
2079
+ if (!ρσ_bytes.prototype.endswith.__argnames__) Object.defineProperties(ρσ_bytes.prototype.endswith, {
2080
+ __argnames__ : {value: ["suffix", "start", "end"]},
2081
+ __module__ : {value: "__main__"}
2082
+ });
2083
+ ρσ_bytes.prototype.join = function join(iterable) {
2084
+ var self = this;
2085
+ var parts, item, result;
2086
+ parts = ρσ_list_decorate([]);
2087
+ var ρσ_Iter1 = ρσ_Iterable(iterable);
2088
+ for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Index1++) {
2089
+ item = ρσ_Iter1[ρσ_Index1];
2090
+ if (!((item instanceof ρσ_bytes || item instanceof ρσ_bytearray))) {
2091
+ throw new TypeError("sequence item must be a bytes-like object");
2092
+ }
2093
+ parts.push(item._data);
2094
+ }
2095
+ result = ρσ_list_decorate([]);
2096
+ for (var i = 0; i < parts.length; i++) {
2097
+ if (i > 0) {
2098
+ for (var j = 0; j < this._data.length; j++) {
2099
+ result.push((ρσ_expr_temp = self._data)[(typeof j === "number" && j < 0) ? ρσ_expr_temp.length + j : j]);
2100
+ }
2101
+ }
2102
+ for (var j = 0; j < parts[i].length; j++) {
2103
+ result.push((ρσ_expr_temp = parts[(typeof i === "number" && i < 0) ? parts.length + i : i])[(typeof j === "number" && j < 0) ? ρσ_expr_temp.length + j : j]);
2104
+ }
2105
+ }
2106
+ return new ρσ_bytes(result);
2107
+ };
2108
+ if (!ρσ_bytes.prototype.join.__argnames__) Object.defineProperties(ρσ_bytes.prototype.join, {
2109
+ __argnames__ : {value: ["iterable"]},
2110
+ __module__ : {value: "__main__"}
2111
+ });
2112
+ ρσ_bytes.prototype.split = function split(sep, maxsplit) {
2113
+ var self = this;
2114
+ var result, i, n, j, needle, pos, splits, found;
2115
+ if (maxsplit === undefined) {
2116
+ maxsplit = -1;
2117
+ }
2118
+ if (sep === null || sep === undefined || typeof sep === "string") {
2119
+ result = ρσ_list_decorate([]);
2120
+ i = 0;
2121
+ n = self._data.length;
2122
+ while (i < n) {
2123
+ while (i < n && (ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] <= 32) {
2124
+ i = ρσ_list_iadd(i, 1);
2125
+ }
2126
+ if (i >= n) {
2127
+ break;
2128
+ }
2129
+ j = i;
2130
+ while (j < n && (ρσ_expr_temp = self._data)[(typeof j === "number" && j < 0) ? ρσ_expr_temp.length + j : j] > 32) {
2131
+ j = ρσ_list_iadd(j, 1);
2132
+ }
2133
+ result.push(new ρσ_bytes(self._data.slice(i, j)));
2134
+ i = j;
2135
+ if (maxsplit >= 0 && result.length >= maxsplit) {
2136
+ while (i < n && (ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] <= 32) {
2137
+ i = ρσ_list_iadd(i, 1);
2138
+ }
2139
+ if (i < n) {
2140
+ result.push(new ρσ_bytes(self._data.slice(i)));
2141
+ }
2142
+ break;
2143
+ }
2144
+ }
2145
+ return result;
2146
+ }
2147
+ needle = sep._data;
2148
+ result = ρσ_list_decorate([]);
2149
+ pos = 0;
2150
+ splits = 0;
2151
+ while (true) {
2152
+ found = ρσ_bytes_find(self._data, needle, pos);
2153
+ if (found < 0 || maxsplit >= 0 && splits >= maxsplit) {
2154
+ result.push(new ρσ_bytes(self._data.slice(pos)));
2155
+ break;
2156
+ }
2157
+ result.push(new ρσ_bytes(self._data.slice(pos, found)));
2158
+ pos = ρσ_list_add(found, needle.length);
2159
+ splits = ρσ_list_iadd(splits, 1);
2160
+ }
2161
+ return result;
2162
+ };
2163
+ if (!ρσ_bytes.prototype.split.__argnames__) Object.defineProperties(ρσ_bytes.prototype.split, {
2164
+ __argnames__ : {value: ["sep", "maxsplit"]},
2165
+ __module__ : {value: "__main__"}
2166
+ });
2167
+ ρσ_bytes.prototype.replace = function replace(old, replacement, count) {
2168
+ var self = this;
2169
+ var odata, ndata, result, pos, n, limit, found;
2170
+ odata = old._data;
2171
+ ndata = replacement._data;
2172
+ result = ρσ_list_decorate([]);
2173
+ pos = 0;
2174
+ n = 0;
2175
+ limit = (count !== undefined && count !== null) ? count : -1;
2176
+ while (pos <= self._data.length) {
2177
+ found = ρσ_bytes_find(self._data, odata, pos);
2178
+ if (found < 0 || limit >= 0 && n >= limit) {
2179
+ for (var i = pos; i < this._data.length; i++) {
2180
+ result.push((ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i]);
2181
+ }
2182
+ break;
2183
+ }
2184
+ for (var i = pos; i < found; i++) {
2185
+ result.push((ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i]);
2186
+ }
2187
+ for (var i = 0; i < ndata.length; i++) {
2188
+ result.push(ndata[(typeof i === "number" && i < 0) ? ndata.length + i : i]);
2189
+ }
2190
+ pos = ρσ_list_add(found, odata.length);
2191
+ n = ρσ_list_iadd(n, 1);
2192
+ if (odata.length === 0) {
2193
+ if (pos < self._data.length) {
2194
+ result.push((ρσ_expr_temp = self._data)[(typeof pos === "number" && pos < 0) ? ρσ_expr_temp.length + pos : pos]);
2195
+ pos = ρσ_list_iadd(pos, 1);
2196
+ } else {
2197
+ break;
2198
+ }
2199
+ }
2200
+ }
2201
+ return new ρσ_bytes(result);
2202
+ };
2203
+ if (!ρσ_bytes.prototype.replace.__argnames__) Object.defineProperties(ρσ_bytes.prototype.replace, {
2204
+ __argnames__ : {value: ["old", "replacement", "count"]},
2205
+ __module__ : {value: "__main__"}
2206
+ });
2207
+ ρσ_bytes.prototype.strip = function strip(chars) {
2208
+ var self = this;
2209
+ return self.lstrip(chars).rstrip(chars);
2210
+ };
2211
+ if (!ρσ_bytes.prototype.strip.__argnames__) Object.defineProperties(ρσ_bytes.prototype.strip, {
2212
+ __argnames__ : {value: ["chars"]},
2213
+ __module__ : {value: "__main__"}
2214
+ });
2215
+ ρσ_bytes.prototype.lstrip = function lstrip(chars) {
2216
+ var self = this;
2217
+ var is_ws, cdata, i, b;
2218
+ is_ws = chars === null || chars === undefined;
2219
+ cdata = (is_ws) ? ρσ_list_decorate([]) : chars._data;
2220
+ i = 0;
2221
+ while (i < self._data.length) {
2222
+ b = (ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
2223
+ if (is_ws) {
2224
+ if (b > 32) {
2225
+ break;
2226
+ }
2227
+ } else {
2228
+ if (cdata.indexOf(b) < 0) {
2229
+ break;
2230
+ }
2231
+ }
2232
+ i = ρσ_list_iadd(i, 1);
2233
+ }
2234
+ return new ρσ_bytes(self._data.slice(i));
2235
+ };
2236
+ if (!ρσ_bytes.prototype.lstrip.__argnames__) Object.defineProperties(ρσ_bytes.prototype.lstrip, {
2237
+ __argnames__ : {value: ["chars"]},
2238
+ __module__ : {value: "__main__"}
2239
+ });
2240
+ ρσ_bytes.prototype.rstrip = function rstrip(chars) {
2241
+ var self = this;
2242
+ var is_ws, cdata, i, b;
2243
+ is_ws = chars === null || chars === undefined;
2244
+ cdata = (is_ws) ? ρσ_list_decorate([]) : chars._data;
2245
+ i = self._data.length - 1;
2246
+ while (i >= 0) {
2247
+ b = (ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
2248
+ if (is_ws) {
2249
+ if (b > 32) {
2250
+ break;
2251
+ }
2252
+ } else {
2253
+ if (cdata.indexOf(b) < 0) {
2254
+ break;
2255
+ }
2256
+ }
2257
+ i -= 1;
2258
+ }
2259
+ return new ρσ_bytes(self._data.slice(0, ρσ_list_add(i, 1)));
2260
+ };
2261
+ if (!ρσ_bytes.prototype.rstrip.__argnames__) Object.defineProperties(ρσ_bytes.prototype.rstrip, {
2262
+ __argnames__ : {value: ["chars"]},
2263
+ __module__ : {value: "__main__"}
2264
+ });
2265
+ ρσ_bytes.prototype.upper = function upper() {
2266
+ var self = this;
2267
+ var data, b;
2268
+ data = self._data.slice();
2269
+ for (var i = 0; i < data.length; i++) {
2270
+ b = data[(typeof i === "number" && i < 0) ? data.length + i : i];
2271
+ if (b >= 97 && b <= 122) {
2272
+ data[(typeof i === "number" && i < 0) ? data.length + i : i] = b - 32;
2273
+ }
2274
+ }
2275
+ return new ρσ_bytes(data);
2276
+ };
2277
+ if (!ρσ_bytes.prototype.upper.__module__) Object.defineProperties(ρσ_bytes.prototype.upper, {
2278
+ __module__ : {value: "__main__"}
2279
+ });
2280
+ ρσ_bytes.prototype.lower = function lower() {
2281
+ var self = this;
2282
+ var data, b;
2283
+ data = self._data.slice();
2284
+ for (var i = 0; i < data.length; i++) {
2285
+ b = data[(typeof i === "number" && i < 0) ? data.length + i : i];
2286
+ if (b >= 65 && b <= 90) {
2287
+ data[(typeof i === "number" && i < 0) ? data.length + i : i] = ρσ_list_add(b, 32);
2288
+ }
2289
+ }
2290
+ return new ρσ_bytes(data);
2291
+ };
2292
+ if (!ρσ_bytes.prototype.lower.__module__) Object.defineProperties(ρσ_bytes.prototype.lower, {
2293
+ __module__ : {value: "__main__"}
2294
+ });
2295
+ ρσ_bytes.prototype.copy = function copy() {
2296
+ var self = this;
2297
+ return new ρσ_bytes(self._data.slice());
2298
+ };
2299
+ if (!ρσ_bytes.prototype.copy.__module__) Object.defineProperties(ρσ_bytes.prototype.copy, {
2300
+ __module__ : {value: "__main__"}
2301
+ });
2302
+ ρσ_bytes.prototype.slice = function slice(start, end) {
2303
+ var self = this;
2304
+ return new ρσ_bytes(self._data.slice(start, end));
2305
+ };
2306
+ if (!ρσ_bytes.prototype.slice.__argnames__) Object.defineProperties(ρσ_bytes.prototype.slice, {
2307
+ __argnames__ : {value: ["start", "end"]},
2308
+ __module__ : {value: "__main__"}
2309
+ });
2310
+ ρσ_bytes.prototype.filter = function filter(fn) {
2311
+ var self = this;
2312
+ return new ρσ_bytes(self._data.filter(fn));
2313
+ };
2314
+ if (!ρσ_bytes.prototype.filter.__argnames__) Object.defineProperties(ρσ_bytes.prototype.filter, {
2315
+ __argnames__ : {value: ["fn"]},
2316
+ __module__ : {value: "__main__"}
2317
+ });
2318
+ ρσ_bytes.prototype.__format__ = function __format__ () {
2319
+ if (!arguments[0]) return this.__str__();
2320
+ throw new TypeError("unsupported format specification");
2321
+ };
2322
+ Object.defineProperty(ρσ_bytes.prototype, "__bases__", {value: []});
2323
+ ρσ_bytes.__name__ = "ρσ_bytes";
2324
+ ρσ_bytes.__qualname__ = "ρσ_bytes";
2325
+ ρσ_bytes.__module__ = "__main__";
2326
+ Object.defineProperty(ρσ_bytes.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
2327
+
2328
+
2329
+ ρσ_bytes.__name__ = "bytes";
2330
+ function ρσ_bytearray() {
2331
+ if (!(this instanceof ρσ_bytearray)) return new ρσ_bytearray(...arguments);
2332
+ if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
2333
+ ρσ_bytearray.prototype.__init__.apply(this, arguments);
2334
+ }
2335
+ ρσ_extends(ρσ_bytearray, ρσ_bytes);
2336
+ ρσ_bytearray.prototype.__init__ = function __init__(source, encoding, errors) {
2337
+ var self = this;
2338
+ self._data = ρσ_bytes_from_source.apply(null, arguments);
2339
+ ρσ_bytes_sync(self);
2340
+ };
2341
+ if (!ρσ_bytearray.prototype.__init__.__argnames__) Object.defineProperties(ρσ_bytearray.prototype.__init__, {
2342
+ __argnames__ : {value: ["source", "encoding", "errors"]},
2343
+ __module__ : {value: "__main__"}
2344
+ });
2345
+ ρσ_bytearray.__argnames__ = ρσ_bytearray.prototype.__init__.__argnames__;
2346
+ ρσ_bytearray.__handles_kwarg_interpolation__ = ρσ_bytearray.prototype.__init__.__handles_kwarg_interpolation__;
2347
+ ρσ_bytearray.prototype.__setitem__ = function __setitem__(key, val) {
2348
+ var self = this;
2349
+ var indices, start, stop, step, src, positions, n, b;
2350
+ if (key instanceof ρσ_slice) {
2351
+ indices = key.indices(self._data.length);
2352
+ start = indices[0];
2353
+ stop = indices[1];
2354
+ step = indices[2];
2355
+ if (val instanceof ρσ_bytes || val instanceof ρσ_bytearray) {
2356
+ src = val._data;
2357
+ } else {
2358
+ src = ρσ_bytes_from_source(val);
2359
+ }
2360
+ if (step === 1) {
2361
+ self._data.splice.apply(self._data, ρσ_list_decorate([ start, stop - start ]).concat(src));
2362
+ } else {
2363
+ positions = ρσ_list_decorate([]);
2364
+ if (step > 0) {
2365
+ for (var i = start; i < stop; i += step) {
2366
+ positions.push(i);
2367
+ }
2368
+ } else {
2369
+ for (var i = start; i > stop; i += step) {
2370
+ positions.push(i);
2371
+ }
2372
+ }
2373
+ if (src.length !== positions.length) {
2374
+ throw new ValueError(ρσ_list_add(ρσ_list_add(ρσ_list_add("attempt to assign bytes of size ", str(src.length)), " to extended slice of size "), str(positions.length)));
2375
+ }
2376
+ for (var i = 0; i < positions.length; i++) {
2377
+ (ρσ_expr_temp = self._data)[ρσ_bound_index(positions[(typeof i === "number" && i < 0) ? positions.length + i : i], ρσ_expr_temp)] = src[(typeof i === "number" && i < 0) ? src.length + i : i];
2378
+ }
2379
+ }
2380
+ ρσ_bytes_sync(self);
2381
+ } else {
2382
+ n = key | 0;
2383
+ if (n < 0) {
2384
+ n = ρσ_list_iadd(n, self._data.length);
2385
+ }
2386
+ if (n < 0 || n >= self._data.length) {
2387
+ throw new IndexError("index out of range");
2388
+ }
2389
+ b = val | 0;
2390
+ if (b < 0 || b > 255) {
2391
+ throw new ValueError("byte must be in range(0, 256)");
2392
+ }
2393
+ (ρσ_expr_temp = self._data)[(typeof n === "number" && n < 0) ? ρσ_expr_temp.length + n : n] = b;
2394
+ self[(typeof n === "number" && n < 0) ? self.length + n : n] = b;
2395
+ }
2396
+ };
2397
+ if (!ρσ_bytearray.prototype.__setitem__.__argnames__) Object.defineProperties(ρσ_bytearray.prototype.__setitem__, {
2398
+ __argnames__ : {value: ["key", "val"]},
2399
+ __module__ : {value: "__main__"}
2400
+ });
2401
+ ρσ_bytearray.prototype.__add__ = function __add__(other) {
2402
+ var self = this;
2403
+ if (!((other instanceof ρσ_bytes || other instanceof ρσ_bytearray))) {
2404
+ throw new TypeError("can't concat bytes-like objects of different types");
2405
+ }
2406
+ return new ρσ_bytearray(self._data.concat(other._data));
2407
+ };
2408
+ if (!ρσ_bytearray.prototype.__add__.__argnames__) Object.defineProperties(ρσ_bytearray.prototype.__add__, {
2409
+ __argnames__ : {value: ["other"]},
2410
+ __module__ : {value: "__main__"}
2411
+ });
2412
+ ρσ_bytearray.prototype.__iadd__ = function __iadd__(other) {
2413
+ var self = this;
2414
+ if (!((other instanceof ρσ_bytes || other instanceof ρσ_bytearray))) {
2415
+ throw new TypeError("can't concat bytes-like objects of different types");
2416
+ }
2417
+ for (var i = 0; i < other._data.length; i++) {
2418
+ self._data.push((ρσ_expr_temp = other._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i]);
2419
+ }
2420
+ ρσ_bytes_sync(self);
2421
+ return self;
2422
+ };
2423
+ if (!ρσ_bytearray.prototype.__iadd__.__argnames__) Object.defineProperties(ρσ_bytearray.prototype.__iadd__, {
2424
+ __argnames__ : {value: ["other"]},
2425
+ __module__ : {value: "__main__"}
2426
+ });
2427
+ ρσ_bytearray.prototype.__mul__ = function __mul__(n) {
2428
+ var self = this;
2429
+ var result;
2430
+ result = ρσ_list_decorate([]);
2431
+ for (var k = 0; k < n; k++) {
2432
+ for (var j = 0; j < this._data.length; j++) {
2433
+ result.push((ρσ_expr_temp = self._data)[(typeof j === "number" && j < 0) ? ρσ_expr_temp.length + j : j]);
2434
+ }
2435
+ }
2436
+ return new ρσ_bytearray(result);
2437
+ };
2438
+ if (!ρσ_bytearray.prototype.__mul__.__argnames__) Object.defineProperties(ρσ_bytearray.prototype.__mul__, {
2439
+ __argnames__ : {value: ["n"]},
2440
+ __module__ : {value: "__main__"}
2441
+ });
2442
+ ρσ_bytearray.prototype.__repr__ = function __repr__() {
2443
+ var self = this;
2444
+ var b;
2445
+ b = ρσ_bytes.prototype.__repr__.call(self);
2446
+ return ρσ_list_add(ρσ_list_add("bytearray(", b), ")");
2447
+ };
2448
+ if (!ρσ_bytearray.prototype.__repr__.__module__) Object.defineProperties(ρσ_bytearray.prototype.__repr__, {
2449
+ __module__ : {value: "__main__"}
2450
+ });
2451
+ ρσ_bytearray.prototype.append = function append(item) {
2452
+ var self = this;
2453
+ var b, idx;
2454
+ b = item | 0;
2455
+ if (b < 0 || b > 255) {
2456
+ throw new ValueError("byte must be in range(0, 256)");
2457
+ }
2458
+ idx = self._data.length;
2459
+ self._data.push(b);
2460
+ self[(typeof idx === "number" && idx < 0) ? self.length + idx : idx] = b;
2461
+ self.length = self._data.length;
2462
+ };
2463
+ if (!ρσ_bytearray.prototype.append.__argnames__) Object.defineProperties(ρσ_bytearray.prototype.append, {
2464
+ __argnames__ : {value: ["item"]},
2465
+ __module__ : {value: "__main__"}
2466
+ });
2467
+ ρσ_bytearray.prototype.extend = function extend(iterable) {
2468
+ var self = this;
2469
+ var b, x;
2470
+ if (iterable instanceof ρσ_bytes || iterable instanceof ρσ_bytearray) {
2471
+ for (var i = 0; i < iterable._data.length; i++) {
2472
+ self._data.push((ρσ_expr_temp = iterable._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i]);
2473
+ }
2474
+ } else {
2475
+ var ρσ_Iter2 = ρσ_Iterable(iterable);
2476
+ for (var ρσ_Index2 = 0; ρσ_Index2 < ρσ_Iter2.length; ρσ_Index2++) {
2477
+ x = ρσ_Iter2[ρσ_Index2];
2478
+ b = x | 0;
2479
+ if (b < 0 || b > 255) {
2480
+ throw new ValueError("byte must be in range(0, 256)");
2481
+ }
2482
+ self._data.push(b);
2483
+ }
2484
+ }
2485
+ ρσ_bytes_sync(self);
2486
+ };
2487
+ if (!ρσ_bytearray.prototype.extend.__argnames__) Object.defineProperties(ρσ_bytearray.prototype.extend, {
2488
+ __argnames__ : {value: ["iterable"]},
2489
+ __module__ : {value: "__main__"}
2490
+ });
2491
+ ρσ_bytearray.prototype.insert = function insert(idx, item) {
2492
+ var self = this;
2493
+ var n, b;
2494
+ n = idx | 0;
2495
+ if (n < 0) {
2496
+ n = max(0, ρσ_list_add(self._data.length, n));
2497
+ }
2498
+ b = item | 0;
2499
+ if (b < 0 || b > 255) {
2500
+ throw new ValueError("byte must be in range(0, 256)");
2501
+ }
2502
+ self._data.splice(n, 0, b);
2503
+ ρσ_bytes_sync(self);
2504
+ };
2505
+ if (!ρσ_bytearray.prototype.insert.__argnames__) Object.defineProperties(ρσ_bytearray.prototype.insert, {
2506
+ __argnames__ : {value: ["idx", "item"]},
2507
+ __module__ : {value: "__main__"}
2508
+ });
2509
+ ρσ_bytearray.prototype.pop = function pop(idx) {
2510
+ var self = this;
2511
+ var n, val;
2512
+ n = (idx === undefined) ? self._data.length - 1 : idx | 0;
2513
+ if (n < 0) {
2514
+ n = ρσ_list_iadd(n, self._data.length);
2515
+ }
2516
+ if (n < 0 || n >= self._data.length) {
2517
+ throw new IndexError("pop index out of range");
2518
+ }
2519
+ val = self._data.splice(n, 1)[0];
2520
+ ρσ_bytes_sync(self);
2521
+ return val;
2522
+ };
2523
+ if (!ρσ_bytearray.prototype.pop.__argnames__) Object.defineProperties(ρσ_bytearray.prototype.pop, {
2524
+ __argnames__ : {value: ["idx"]},
2525
+ __module__ : {value: "__main__"}
2526
+ });
2527
+ ρσ_bytearray.prototype.remove = function remove(item) {
2528
+ var self = this;
2529
+ var b;
2530
+ b = item | 0;
2531
+ for (var i = 0; i < this._data.length; i++) {
2532
+ if ((ρσ_expr_temp = self._data)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === b) {
2533
+ self._data.splice(i, 1);
2534
+ ρσ_bytes_sync(self);
2535
+ return;
2536
+ }
2537
+ }
2538
+ throw new ValueError(ρσ_list_add(str(item), " is not in bytearray"));
2539
+ };
2540
+ if (!ρσ_bytearray.prototype.remove.__argnames__) Object.defineProperties(ρσ_bytearray.prototype.remove, {
2541
+ __argnames__ : {value: ["item"]},
2542
+ __module__ : {value: "__main__"}
2543
+ });
2544
+ ρσ_bytearray.prototype.reverse = function reverse() {
2545
+ var self = this;
2546
+ self._data.reverse();
2547
+ ρσ_bytes_sync(self);
2548
+ };
2549
+ if (!ρσ_bytearray.prototype.reverse.__module__) Object.defineProperties(ρσ_bytearray.prototype.reverse, {
2550
+ __module__ : {value: "__main__"}
2551
+ });
2552
+ ρσ_bytearray.prototype.clear = function clear() {
2553
+ var self = this;
2554
+ self._data.length = 0;
2555
+ ρσ_bytes_sync(self);
2556
+ };
2557
+ if (!ρσ_bytearray.prototype.clear.__module__) Object.defineProperties(ρσ_bytearray.prototype.clear, {
2558
+ __module__ : {value: "__main__"}
2559
+ });
2560
+ ρσ_bytearray.prototype.copy = function copy() {
2561
+ var self = this;
2562
+ return new ρσ_bytearray(self._data.slice());
2563
+ };
2564
+ if (!ρσ_bytearray.prototype.copy.__module__) Object.defineProperties(ρσ_bytearray.prototype.copy, {
2565
+ __module__ : {value: "__main__"}
2566
+ });
2567
+ ρσ_bytearray.prototype.slice = function slice(start, end) {
2568
+ var self = this;
2569
+ return new ρσ_bytearray(self._data.slice(start, end));
2570
+ };
2571
+ if (!ρσ_bytearray.prototype.slice.__argnames__) Object.defineProperties(ρσ_bytearray.prototype.slice, {
2572
+ __argnames__ : {value: ["start", "end"]},
2573
+ __module__ : {value: "__main__"}
2574
+ });
2575
+ ρσ_bytearray.prototype.filter = function filter(fn) {
2576
+ var self = this;
2577
+ return new ρσ_bytearray(self._data.filter(fn));
2578
+ };
2579
+ if (!ρσ_bytearray.prototype.filter.__argnames__) Object.defineProperties(ρσ_bytearray.prototype.filter, {
2580
+ __argnames__ : {value: ["fn"]},
2581
+ __module__ : {value: "__main__"}
2582
+ });
2583
+ ρσ_bytearray.prototype.__str__ = function __str__ () {
2584
+ if(ρσ_bytes.prototype.__str__) return ρσ_bytes.prototype.__str__.call(this);
2585
+ return this.__repr__();
2586
+ };
2587
+ ρσ_bytearray.prototype.__format__ = function __format__ () {
2588
+ if(ρσ_bytes.prototype.__format__) return ρσ_bytes.prototype.__format__.call(this, arguments[0]);
2589
+ if (!arguments[0]) return this.__str__();
2590
+ throw new TypeError("unsupported format specification");
2591
+ };
2592
+ Object.defineProperty(ρσ_bytearray.prototype, "__bases__", {value: [ρσ_bytes]});
2593
+ ρσ_bytearray.__name__ = "ρσ_bytearray";
2594
+ ρσ_bytearray.__qualname__ = "ρσ_bytearray";
2595
+ ρσ_bytearray.__module__ = "__main__";
2596
+ Object.defineProperty(ρσ_bytearray.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
2597
+ if (typeof ρσ_bytes.__init_subclass__ === "function") ρσ_bytes.__init_subclass__.call(ρσ_bytearray);
2598
+
2599
+ ρσ_bytearray.__name__ = "bytearray";
2600
+ var bytes = ρσ_bytes, bytearray = ρσ_bytearray;function ρσ_equals(a, b) {
959
2601
  var ρσ_unpack, akeys, bkeys, key;
960
2602
  if (a === b) {
961
2603
  return true;
@@ -2986,8 +4628,7 @@ var ρσ_json_parse = function(text, reviver) {
2986
4628
  }
2987
4629
  return JSON.parse(text, dict_reviver);
2988
4630
  };;// }}}
2989
- let NameError;
2990
- NameError = ReferenceError;
4631
+ var NameError = ReferenceError;
2991
4632
  function Exception() {
2992
4633
  if (!(this instanceof Exception)) return new Exception(...arguments);
2993
4634
  if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
@@ -3017,6 +4658,11 @@ Exception.prototype.__str__ = function __str__ () {
3017
4658
  if(Error.prototype.__str__) return Error.prototype.__str__.call(this);
3018
4659
  return this.__repr__();
3019
4660
  };
4661
+ Exception.prototype.__format__ = function __format__ () {
4662
+ if(Error.prototype.__format__) return Error.prototype.__format__.call(this, arguments[0]);
4663
+ if (!arguments[0]) return this.__str__();
4664
+ throw new TypeError("unsupported format specification");
4665
+ };
3020
4666
  Object.defineProperty(Exception.prototype, "__bases__", {value: [Error]});
3021
4667
  Exception.__name__ = "Exception";
3022
4668
  Exception.__qualname__ = "Exception";
@@ -3041,13 +4687,18 @@ AttributeError.prototype.__str__ = function __str__ () {
3041
4687
  if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
3042
4688
  return this.__repr__();
3043
4689
  };
4690
+ AttributeError.prototype.__format__ = function __format__ () {
4691
+ if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
4692
+ if (!arguments[0]) return this.__str__();
4693
+ throw new TypeError("unsupported format specification");
4694
+ };
3044
4695
  Object.defineProperty(AttributeError.prototype, "__bases__", {value: [Exception]});
3045
4696
  AttributeError.__name__ = "AttributeError";
3046
4697
  AttributeError.__qualname__ = "AttributeError";
3047
4698
  AttributeError.__module__ = "__main__";
3048
4699
  Object.defineProperty(AttributeError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
3049
- if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(AttributeError);
3050
4700
 
4701
+ if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(AttributeError);
3051
4702
 
3052
4703
  function IndexError() {
3053
4704
  if (!(this instanceof IndexError)) return new IndexError(...arguments);
@@ -3066,13 +4717,18 @@ IndexError.prototype.__str__ = function __str__ () {
3066
4717
  if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
3067
4718
  return this.__repr__();
3068
4719
  };
4720
+ IndexError.prototype.__format__ = function __format__ () {
4721
+ if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
4722
+ if (!arguments[0]) return this.__str__();
4723
+ throw new TypeError("unsupported format specification");
4724
+ };
3069
4725
  Object.defineProperty(IndexError.prototype, "__bases__", {value: [Exception]});
3070
4726
  IndexError.__name__ = "IndexError";
3071
4727
  IndexError.__qualname__ = "IndexError";
3072
4728
  IndexError.__module__ = "__main__";
3073
4729
  Object.defineProperty(IndexError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
3074
- if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(IndexError);
3075
4730
 
4731
+ if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(IndexError);
3076
4732
 
3077
4733
  function KeyError() {
3078
4734
  if (!(this instanceof KeyError)) return new KeyError(...arguments);
@@ -3091,13 +4747,18 @@ KeyError.prototype.__str__ = function __str__ () {
3091
4747
  if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
3092
4748
  return this.__repr__();
3093
4749
  };
4750
+ KeyError.prototype.__format__ = function __format__ () {
4751
+ if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
4752
+ if (!arguments[0]) return this.__str__();
4753
+ throw new TypeError("unsupported format specification");
4754
+ };
3094
4755
  Object.defineProperty(KeyError.prototype, "__bases__", {value: [Exception]});
3095
4756
  KeyError.__name__ = "KeyError";
3096
4757
  KeyError.__qualname__ = "KeyError";
3097
4758
  KeyError.__module__ = "__main__";
3098
4759
  Object.defineProperty(KeyError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
3099
- if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(KeyError);
3100
4760
 
4761
+ if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(KeyError);
3101
4762
 
3102
4763
  function ValueError() {
3103
4764
  if (!(this instanceof ValueError)) return new ValueError(...arguments);
@@ -3116,13 +4777,18 @@ ValueError.prototype.__str__ = function __str__ () {
3116
4777
  if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
3117
4778
  return this.__repr__();
3118
4779
  };
4780
+ ValueError.prototype.__format__ = function __format__ () {
4781
+ if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
4782
+ if (!arguments[0]) return this.__str__();
4783
+ throw new TypeError("unsupported format specification");
4784
+ };
3119
4785
  Object.defineProperty(ValueError.prototype, "__bases__", {value: [Exception]});
3120
4786
  ValueError.__name__ = "ValueError";
3121
4787
  ValueError.__qualname__ = "ValueError";
3122
4788
  ValueError.__module__ = "__main__";
3123
4789
  Object.defineProperty(ValueError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
3124
- if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(ValueError);
3125
4790
 
4791
+ if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(ValueError);
3126
4792
 
3127
4793
  function UnicodeDecodeError() {
3128
4794
  if (!(this instanceof UnicodeDecodeError)) return new UnicodeDecodeError(...arguments);
@@ -3141,13 +4807,18 @@ UnicodeDecodeError.prototype.__str__ = function __str__ () {
3141
4807
  if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
3142
4808
  return this.__repr__();
3143
4809
  };
4810
+ UnicodeDecodeError.prototype.__format__ = function __format__ () {
4811
+ if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
4812
+ if (!arguments[0]) return this.__str__();
4813
+ throw new TypeError("unsupported format specification");
4814
+ };
3144
4815
  Object.defineProperty(UnicodeDecodeError.prototype, "__bases__", {value: [Exception]});
3145
4816
  UnicodeDecodeError.__name__ = "UnicodeDecodeError";
3146
4817
  UnicodeDecodeError.__qualname__ = "UnicodeDecodeError";
3147
4818
  UnicodeDecodeError.__module__ = "__main__";
3148
4819
  Object.defineProperty(UnicodeDecodeError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
3149
- if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(UnicodeDecodeError);
3150
4820
 
4821
+ if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(UnicodeDecodeError);
3151
4822
 
3152
4823
  function AssertionError() {
3153
4824
  if (!(this instanceof AssertionError)) return new AssertionError(...arguments);
@@ -3166,13 +4837,18 @@ AssertionError.prototype.__str__ = function __str__ () {
3166
4837
  if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
3167
4838
  return this.__repr__();
3168
4839
  };
4840
+ AssertionError.prototype.__format__ = function __format__ () {
4841
+ if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
4842
+ if (!arguments[0]) return this.__str__();
4843
+ throw new TypeError("unsupported format specification");
4844
+ };
3169
4845
  Object.defineProperty(AssertionError.prototype, "__bases__", {value: [Exception]});
3170
4846
  AssertionError.__name__ = "AssertionError";
3171
4847
  AssertionError.__qualname__ = "AssertionError";
3172
4848
  AssertionError.__module__ = "__main__";
3173
4849
  Object.defineProperty(AssertionError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
3174
- if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(AssertionError);
3175
4850
 
4851
+ if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(AssertionError);
3176
4852
 
3177
4853
  function ZeroDivisionError() {
3178
4854
  if (!(this instanceof ZeroDivisionError)) return new ZeroDivisionError(...arguments);
@@ -3191,13 +4867,18 @@ ZeroDivisionError.prototype.__str__ = function __str__ () {
3191
4867
  if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
3192
4868
  return this.__repr__();
3193
4869
  };
4870
+ ZeroDivisionError.prototype.__format__ = function __format__ () {
4871
+ if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
4872
+ if (!arguments[0]) return this.__str__();
4873
+ throw new TypeError("unsupported format specification");
4874
+ };
3194
4875
  Object.defineProperty(ZeroDivisionError.prototype, "__bases__", {value: [Exception]});
3195
4876
  ZeroDivisionError.__name__ = "ZeroDivisionError";
3196
4877
  ZeroDivisionError.__qualname__ = "ZeroDivisionError";
3197
4878
  ZeroDivisionError.__module__ = "__main__";
3198
4879
  Object.defineProperty(ZeroDivisionError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
3199
- if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(ZeroDivisionError);
3200
4880
 
4881
+ if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(ZeroDivisionError);
3201
4882
 
3202
4883
  function StopIteration() {
3203
4884
  if (!(this instanceof StopIteration)) return new StopIteration(...arguments);
@@ -3216,13 +4897,18 @@ StopIteration.prototype.__str__ = function __str__ () {
3216
4897
  if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
3217
4898
  return this.__repr__();
3218
4899
  };
4900
+ StopIteration.prototype.__format__ = function __format__ () {
4901
+ if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
4902
+ if (!arguments[0]) return this.__str__();
4903
+ throw new TypeError("unsupported format specification");
4904
+ };
3219
4905
  Object.defineProperty(StopIteration.prototype, "__bases__", {value: [Exception]});
3220
4906
  StopIteration.__name__ = "StopIteration";
3221
4907
  StopIteration.__qualname__ = "StopIteration";
3222
4908
  StopIteration.__module__ = "__main__";
3223
4909
  Object.defineProperty(StopIteration.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
3224
- if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(StopIteration);
3225
4910
 
4911
+ if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(StopIteration);
3226
4912
 
3227
4913
  function ImportError() {
3228
4914
  if (!(this instanceof ImportError)) return new ImportError(...arguments);
@@ -3241,13 +4927,18 @@ ImportError.prototype.__str__ = function __str__ () {
3241
4927
  if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
3242
4928
  return this.__repr__();
3243
4929
  };
4930
+ ImportError.prototype.__format__ = function __format__ () {
4931
+ if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
4932
+ if (!arguments[0]) return this.__str__();
4933
+ throw new TypeError("unsupported format specification");
4934
+ };
3244
4935
  Object.defineProperty(ImportError.prototype, "__bases__", {value: [Exception]});
3245
4936
  ImportError.__name__ = "ImportError";
3246
4937
  ImportError.__qualname__ = "ImportError";
3247
4938
  ImportError.__module__ = "__main__";
3248
4939
  Object.defineProperty(ImportError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
3249
- if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(ImportError);
3250
4940
 
4941
+ if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(ImportError);
3251
4942
 
3252
4943
  function ModuleNotFoundError() {
3253
4944
  if (!(this instanceof ModuleNotFoundError)) return new ModuleNotFoundError(...arguments);
@@ -3266,13 +4957,18 @@ ModuleNotFoundError.prototype.__str__ = function __str__ () {
3266
4957
  if(ImportError.prototype.__str__) return ImportError.prototype.__str__.call(this);
3267
4958
  return this.__repr__();
3268
4959
  };
4960
+ ModuleNotFoundError.prototype.__format__ = function __format__ () {
4961
+ if(ImportError.prototype.__format__) return ImportError.prototype.__format__.call(this, arguments[0]);
4962
+ if (!arguments[0]) return this.__str__();
4963
+ throw new TypeError("unsupported format specification");
4964
+ };
3269
4965
  Object.defineProperty(ModuleNotFoundError.prototype, "__bases__", {value: [ImportError]});
3270
4966
  ModuleNotFoundError.__name__ = "ModuleNotFoundError";
3271
4967
  ModuleNotFoundError.__qualname__ = "ModuleNotFoundError";
3272
4968
  ModuleNotFoundError.__module__ = "__main__";
3273
4969
  Object.defineProperty(ModuleNotFoundError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
3274
- if (typeof ImportError.__init_subclass__ === "function") ImportError.__init_subclass__.call(ModuleNotFoundError);
3275
4970
 
4971
+ if (typeof ImportError.__init_subclass__ === "function") ImportError.__init_subclass__.call(ModuleNotFoundError);
3276
4972
 
3277
4973
  function _is_exc_class(obj) {
3278
4974
  return typeof obj === "function" && (obj === Error || obj.prototype && ρσ_instanceof(obj.prototype, Error));
@@ -3435,13 +5131,18 @@ ExceptionGroup.prototype.__str__ = function __str__ () {
3435
5131
  if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
3436
5132
  return this.__repr__();
3437
5133
  };
5134
+ ExceptionGroup.prototype.__format__ = function __format__ () {
5135
+ if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
5136
+ if (!arguments[0]) return this.__str__();
5137
+ throw new TypeError("unsupported format specification");
5138
+ };
3438
5139
  Object.defineProperty(ExceptionGroup.prototype, "__bases__", {value: [Exception]});
3439
5140
  ExceptionGroup.__name__ = "ExceptionGroup";
3440
5141
  ExceptionGroup.__qualname__ = "ExceptionGroup";
3441
5142
  ExceptionGroup.__module__ = "__main__";
3442
5143
  Object.defineProperty(ExceptionGroup.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
3443
5144
  if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(ExceptionGroup);
3444
- let ρσ_in, ρσ_desugar_kwargs, ρσ_exists, ρσ_JS_Proxy, ρσ_proxy_target_symbol, ρσ_attr_proxy_handler;
5145
+ let ρσ_exists, ρσ_attr_proxy_handler;
3445
5146
  function ρσ_eslice(arr, step, start, end) {
3446
5147
  var is_string;
3447
5148
  if (typeof arr === "string" || arr instanceof String) {
@@ -3623,57 +5324,26 @@ if (!ρσ_new.__argnames__) Object.defineProperties(ρσ_new, {
3623
5324
  __module__ : {value: "__main__"}
3624
5325
  });
3625
5326
 
3626
- ρσ_in = (function() {
3627
- var ρσ_anonfunc = function () {
3628
- if (typeof Map === "function" && typeof Set === "function") {
3629
- return (function() {
3630
- var ρσ_anonfunc = function (val, arr) {
3631
- if (typeof arr === "string") {
3632
- return arr.indexOf(val) !== -1;
3633
- }
3634
- if (typeof arr.__contains__ === "function") {
3635
- return arr.__contains__(val);
3636
- }
3637
- if (arr instanceof Map || arr instanceof Set) {
3638
- return arr.has(val);
3639
- }
3640
- if (ρσ_arraylike(arr)) {
3641
- return ρσ_list_contains.call(arr, val);
3642
- }
3643
- return Object.prototype.hasOwnProperty.call(arr, val);
3644
- };
3645
- if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3646
- __argnames__ : {value: ["val", "arr"]},
3647
- __module__ : {value: "__main__"}
3648
- });
3649
- return ρσ_anonfunc;
3650
- })();
3651
- }
3652
- return (function() {
3653
- var ρσ_anonfunc = function (val, arr) {
3654
- if (typeof arr === "string") {
3655
- return arr.indexOf(val) !== -1;
3656
- }
3657
- if (typeof arr.__contains__ === "function") {
3658
- return arr.__contains__(val);
3659
- }
3660
- if (ρσ_arraylike(arr)) {
3661
- return ρσ_list_contains.call(arr, val);
3662
- }
3663
- return Object.prototype.hasOwnProperty.call(arr, val);
3664
- };
3665
- if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
3666
- __argnames__ : {value: ["val", "arr"]},
3667
- __module__ : {value: "__main__"}
3668
- });
3669
- return ρσ_anonfunc;
3670
- })();
3671
- };
3672
- if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3673
- __module__ : {value: "__main__"}
3674
- });
3675
- return ρσ_anonfunc;
3676
- })()();
5327
+ function ρσ_in(val, arr) {
5328
+ if (typeof arr === "string") {
5329
+ return arr.indexOf(val) !== -1;
5330
+ }
5331
+ if (typeof arr.__contains__ === "function") {
5332
+ return arr.__contains__(val);
5333
+ }
5334
+ if (typeof Map === "function" && (arr instanceof Map || arr instanceof Set)) {
5335
+ return arr.has(val);
5336
+ }
5337
+ if (ρσ_arraylike(arr)) {
5338
+ return ρσ_list_contains.call(arr, val);
5339
+ }
5340
+ return Object.prototype.hasOwnProperty.call(arr, val);
5341
+ };
5342
+ if (!ρσ_in.__argnames__) Object.defineProperties(ρσ_in, {
5343
+ __argnames__ : {value: ["val", "arr"]},
5344
+ __module__ : {value: "__main__"}
5345
+ });
5346
+
3677
5347
  function ρσ_Iterable(iterable) {
3678
5348
  var iterator, ans, result;
3679
5349
  if (ρσ_arraylike(iterable)) {
@@ -3696,59 +5366,29 @@ if (!ρσ_Iterable.__argnames__) Object.defineProperties(ρσ_Iterable, {
3696
5366
  __module__ : {value: "__main__"}
3697
5367
  });
3698
5368
 
3699
- ρσ_desugar_kwargs = (function() {
3700
- var ρσ_anonfunc = function () {
3701
- if (typeof Object.assign === "function") {
3702
- return (function() {
3703
- var ρσ_anonfunc = function () {
3704
- var ans, arg;
3705
- ans = Object.create(null);
3706
- ans[ρσ_kwargs_symbol] = true;
3707
- for (var i = 0; i < arguments.length; i++) {
3708
- arg = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i];
3709
- if (arg && arg.jsmap && typeof arg.jsmap.forEach === "function") {
3710
- arg.jsmap.forEach(function(v, k) { ans[k] = v; });
3711
- } else {
3712
- Object.assign(ans, arg);
3713
- }
3714
- }
3715
- return ans;
3716
- };
3717
- if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3718
- __module__ : {value: "__main__"}
3719
- });
3720
- return ρσ_anonfunc;
3721
- })();
5369
+ function ρσ_desugar_kwargs() {
5370
+ var ans, arg, keys;
5371
+ ans = Object.create(null);
5372
+ ans[ρσ_kwargs_symbol] = true;
5373
+ for (var i = 0; i < arguments.length; i++) {
5374
+ arg = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i];
5375
+ if (arg && arg.jsmap && typeof arg.jsmap.forEach === "function") {
5376
+ arg.jsmap.forEach(function(v, k) { ans[k] = v; });
5377
+ } else if (typeof Object.assign === "function") {
5378
+ Object.assign(ans, arg);
5379
+ } else {
5380
+ keys = Object.keys(arg);
5381
+ for (var j = 0; j < keys.length; j++) {
5382
+ ans[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], ans)] = arg[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], arg)];
5383
+ }
3722
5384
  }
3723
- return (function() {
3724
- var ρσ_anonfunc = function () {
3725
- var ans, arg, keys;
3726
- ans = Object.create(null);
3727
- ans[ρσ_kwargs_symbol] = true;
3728
- for (var i = 0; i < arguments.length; i++) {
3729
- arg = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i];
3730
- if (arg && arg.jsmap && typeof arg.jsmap.forEach === "function") {
3731
- arg.jsmap.forEach(function(v, k) { ans[k] = v; });
3732
- } else {
3733
- keys = Object.keys(arg);
3734
- for (var j = 0; j < keys.length; j++) {
3735
- ans[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], ans)] = arg[ρσ_bound_index(keys[(typeof j === "number" && j < 0) ? keys.length + j : j], arg)];
3736
- }
3737
- }
3738
- }
3739
- return ans;
3740
- };
3741
- if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3742
- __module__ : {value: "__main__"}
3743
- });
3744
- return ρσ_anonfunc;
3745
- })();
3746
- };
3747
- if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
3748
- __module__ : {value: "__main__"}
3749
- });
3750
- return ρσ_anonfunc;
3751
- })()();
5385
+ }
5386
+ return ans;
5387
+ };
5388
+ if (!ρσ_desugar_kwargs.__module__) Object.defineProperties(ρσ_desugar_kwargs, {
5389
+ __module__ : {value: "__main__"}
5390
+ });
5391
+
3752
5392
  function ρσ_interpolate_kwargs(f, supplied_args) {
3753
5393
  var has_prop, kwobj, args, prop;
3754
5394
  if (!f.__argnames__) {
@@ -3968,6 +5608,7 @@ if (!ρσ_splice.__argnames__) Object.defineProperties(ρσ_splice, {
3968
5608
  })();
3969
5609
  return ρσ_d;
3970
5610
  }).call(this);
5611
+ (typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : global)["ρσ_exists"] = ρσ_exists;
3971
5612
  function ρσ_mixin() {
3972
5613
  var seen, resolved_props, p, target, props, name;
3973
5614
  seen = Object.create(null);
@@ -4002,14 +5643,54 @@ if (!ρσ_mixin.__module__) Object.defineProperties(ρσ_mixin, {
4002
5643
  __module__ : {value: "__main__"}
4003
5644
  });
4004
5645
 
5646
+ function ρσ_arith_type_name(v) {
5647
+ var t;
5648
+ if (v === null || v === undefined) {
5649
+ return "NoneType";
5650
+ }
5651
+ t = typeof v;
5652
+ if (t === "boolean") {
5653
+ return "bool";
5654
+ }
5655
+ if (t === "number") {
5656
+ return (Number.isInteger(v)) ? "int" : "float";
5657
+ }
5658
+ if (t === "string" || v instanceof String) {
5659
+ return "str";
5660
+ }
5661
+ if (Array.isArray(v)) {
5662
+ return "list";
5663
+ }
5664
+ if (v.constructor && v.constructor.__name__) {
5665
+ return v.constructor.__name__;
5666
+ }
5667
+ return t;
5668
+ };
5669
+ if (!ρσ_arith_type_name.__argnames__) Object.defineProperties(ρσ_arith_type_name, {
5670
+ __argnames__ : {value: ["v"]},
5671
+ __module__ : {value: "__main__"}
5672
+ });
5673
+
4005
5674
  function ρσ_op_add(a, b) {
5675
+ var ta, tb;
4006
5676
  if (a !== null && typeof a.__add__ === "function") {
4007
5677
  return a.__add__(b);
4008
5678
  }
4009
5679
  if (b !== null && typeof b.__radd__ === "function") {
4010
5680
  return b.__radd__(a);
4011
5681
  }
4012
- return ρσ_list_add(a, b);
5682
+ if (Array.isArray(a) && Array.isArray(b)) {
5683
+ return ρσ_list_constructor(a.concat(b));
5684
+ }
5685
+ ta = typeof a;
5686
+ tb = typeof b;
5687
+ if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5688
+ return a + b;
5689
+ }
5690
+ if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
5691
+ return a + b;
5692
+ }
5693
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for +: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
4013
5694
  };
4014
5695
  if (!ρσ_op_add.__argnames__) Object.defineProperties(ρσ_op_add, {
4015
5696
  __argnames__ : {value: ["a", "b"]},
@@ -4017,13 +5698,19 @@ if (!ρσ_op_add.__argnames__) Object.defineProperties(ρσ_op_add, {
4017
5698
  });
4018
5699
 
4019
5700
  function ρσ_op_sub(a, b) {
5701
+ var ta, tb;
4020
5702
  if (a !== null && typeof a.__sub__ === "function") {
4021
5703
  return a.__sub__(b);
4022
5704
  }
4023
5705
  if (b !== null && typeof b.__rsub__ === "function") {
4024
5706
  return b.__rsub__(a);
4025
5707
  }
4026
- return a - b;
5708
+ ta = typeof a;
5709
+ tb = typeof b;
5710
+ if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5711
+ return a - b;
5712
+ }
5713
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for -: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
4027
5714
  };
4028
5715
  if (!ρσ_op_sub.__argnames__) Object.defineProperties(ρσ_op_sub, {
4029
5716
  __argnames__ : {value: ["a", "b"]},
@@ -4031,34 +5718,39 @@ if (!ρσ_op_sub.__argnames__) Object.defineProperties(ρσ_op_sub, {
4031
5718
  });
4032
5719
 
4033
5720
  function ρσ_op_mul(a, b) {
4034
- var result;
5721
+ var ta, tb, result;
4035
5722
  if (a !== null && typeof a.__mul__ === "function") {
4036
5723
  return a.__mul__(b);
4037
5724
  }
4038
5725
  if (b !== null && typeof b.__rmul__ === "function") {
4039
5726
  return b.__rmul__(a);
4040
5727
  }
4041
- if ((typeof a === "string" || a instanceof String) && typeof b === "number") {
5728
+ ta = typeof a;
5729
+ tb = typeof b;
5730
+ if ((ta === "string" || a instanceof String) && (tb === "number" || tb === "boolean")) {
4042
5731
  return a.repeat(b);
4043
5732
  }
4044
- if ((typeof b === "string" || b instanceof String) && typeof a === "number") {
5733
+ if ((tb === "string" || b instanceof String) && (ta === "number" || ta === "boolean")) {
4045
5734
  return b.repeat(a);
4046
5735
  }
4047
- if (Array.isArray(a) && typeof b === "number") {
5736
+ if (Array.isArray(a) && (tb === "number" || tb === "boolean")) {
4048
5737
  result = [];
4049
5738
  for (var ρσ_mi = 0; ρσ_mi < b; ρσ_mi++) {
4050
5739
  result = result.concat(a);
4051
5740
  }
4052
5741
  return ρσ_list_constructor(result);
4053
5742
  }
4054
- if (Array.isArray(b) && typeof a === "number") {
5743
+ if (Array.isArray(b) && (ta === "number" || ta === "boolean")) {
4055
5744
  result = [];
4056
5745
  for (var ρσ_mi = 0; ρσ_mi < a; ρσ_mi++) {
4057
5746
  result = result.concat(b);
4058
5747
  }
4059
5748
  return ρσ_list_constructor(result);
4060
5749
  }
4061
- return a * b;
5750
+ if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5751
+ return a * b;
5752
+ }
5753
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for *: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
4062
5754
  };
4063
5755
  if (!ρσ_op_mul.__argnames__) Object.defineProperties(ρσ_op_mul, {
4064
5756
  __argnames__ : {value: ["a", "b"]},
@@ -4066,13 +5758,19 @@ if (!ρσ_op_mul.__argnames__) Object.defineProperties(ρσ_op_mul, {
4066
5758
  });
4067
5759
 
4068
5760
  function ρσ_op_truediv(a, b) {
5761
+ var ta, tb;
4069
5762
  if (a !== null && typeof a.__truediv__ === "function") {
4070
5763
  return a.__truediv__(b);
4071
5764
  }
4072
5765
  if (b !== null && typeof b.__rtruediv__ === "function") {
4073
5766
  return b.__rtruediv__(a);
4074
5767
  }
4075
- return a / b;
5768
+ ta = typeof a;
5769
+ tb = typeof b;
5770
+ if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5771
+ return a / b;
5772
+ }
5773
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for /: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
4076
5774
  };
4077
5775
  if (!ρσ_op_truediv.__argnames__) Object.defineProperties(ρσ_op_truediv, {
4078
5776
  __argnames__ : {value: ["a", "b"]},
@@ -4080,13 +5778,19 @@ if (!ρσ_op_truediv.__argnames__) Object.defineProperties(ρσ_op_truediv, {
4080
5778
  });
4081
5779
 
4082
5780
  function ρσ_op_floordiv(a, b) {
5781
+ var ta, tb;
4083
5782
  if (a !== null && typeof a.__floordiv__ === "function") {
4084
5783
  return a.__floordiv__(b);
4085
5784
  }
4086
5785
  if (b !== null && typeof b.__rfloordiv__ === "function") {
4087
5786
  return b.__rfloordiv__(a);
4088
5787
  }
4089
- return Math.floor(a / b);
5788
+ ta = typeof a;
5789
+ tb = typeof b;
5790
+ if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5791
+ return Math.floor(a / b);
5792
+ }
5793
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for //: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
4090
5794
  };
4091
5795
  if (!ρσ_op_floordiv.__argnames__) Object.defineProperties(ρσ_op_floordiv, {
4092
5796
  __argnames__ : {value: ["a", "b"]},
@@ -4094,13 +5798,19 @@ if (!ρσ_op_floordiv.__argnames__) Object.defineProperties(ρσ_op_floordiv, {
4094
5798
  });
4095
5799
 
4096
5800
  function ρσ_op_mod(a, b) {
5801
+ var ta, tb;
4097
5802
  if (a !== null && typeof a.__mod__ === "function") {
4098
5803
  return a.__mod__(b);
4099
5804
  }
4100
5805
  if (b !== null && typeof b.__rmod__ === "function") {
4101
5806
  return b.__rmod__(a);
4102
5807
  }
4103
- return a % b;
5808
+ ta = typeof a;
5809
+ tb = typeof b;
5810
+ if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5811
+ return a % b;
5812
+ }
5813
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for %: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
4104
5814
  };
4105
5815
  if (!ρσ_op_mod.__argnames__) Object.defineProperties(ρσ_op_mod, {
4106
5816
  __argnames__ : {value: ["a", "b"]},
@@ -4108,13 +5818,19 @@ if (!ρσ_op_mod.__argnames__) Object.defineProperties(ρσ_op_mod, {
4108
5818
  });
4109
5819
 
4110
5820
  function ρσ_op_pow(a, b) {
5821
+ var ta, tb;
4111
5822
  if (a !== null && typeof a.__pow__ === "function") {
4112
5823
  return a.__pow__(b);
4113
5824
  }
4114
5825
  if (b !== null && typeof b.__rpow__ === "function") {
4115
5826
  return b.__rpow__(a);
4116
5827
  }
4117
- return Math.pow(a, b);
5828
+ ta = typeof a;
5829
+ tb = typeof b;
5830
+ if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5831
+ return Math.pow(a, b);
5832
+ }
5833
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for **: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
4118
5834
  };
4119
5835
  if (!ρσ_op_pow.__argnames__) Object.defineProperties(ρσ_op_pow, {
4120
5836
  __argnames__ : {value: ["a", "b"]},
@@ -4153,40 +5869,166 @@ function ρσ_op_xor(a, b) {
4153
5869
  if (a !== null && typeof a.__xor__ === "function") {
4154
5870
  return a.__xor__(b);
4155
5871
  }
4156
- if (b !== null && typeof b.__rxor__ === "function") {
4157
- return b.__rxor__(a);
5872
+ if (b !== null && typeof b.__rxor__ === "function") {
5873
+ return b.__rxor__(a);
5874
+ }
5875
+ return a ^ b;
5876
+ };
5877
+ if (!ρσ_op_xor.__argnames__) Object.defineProperties(ρσ_op_xor, {
5878
+ __argnames__ : {value: ["a", "b"]},
5879
+ __module__ : {value: "__main__"}
5880
+ });
5881
+
5882
+ function ρσ_op_lshift(a, b) {
5883
+ if (a !== null && typeof a.__lshift__ === "function") {
5884
+ return a.__lshift__(b);
5885
+ }
5886
+ if (b !== null && typeof b.__rlshift__ === "function") {
5887
+ return b.__rlshift__(a);
5888
+ }
5889
+ return a << b;
5890
+ };
5891
+ if (!ρσ_op_lshift.__argnames__) Object.defineProperties(ρσ_op_lshift, {
5892
+ __argnames__ : {value: ["a", "b"]},
5893
+ __module__ : {value: "__main__"}
5894
+ });
5895
+
5896
+ function ρσ_op_rshift(a, b) {
5897
+ if (a !== null && typeof a.__rshift__ === "function") {
5898
+ return a.__rshift__(b);
5899
+ }
5900
+ if (b !== null && typeof b.__rrshift__ === "function") {
5901
+ return b.__rrshift__(a);
5902
+ }
5903
+ return a >> b;
5904
+ };
5905
+ if (!ρσ_op_rshift.__argnames__) Object.defineProperties(ρσ_op_rshift, {
5906
+ __argnames__ : {value: ["a", "b"]},
5907
+ __module__ : {value: "__main__"}
5908
+ });
5909
+
5910
+ function ρσ_op_lt(a, b) {
5911
+ var n, ea, eb, ta, tb;
5912
+ if (a !== null && typeof a.__lt__ === "function") {
5913
+ return a.__lt__(b);
5914
+ }
5915
+ if (b !== null && typeof b.__gt__ === "function") {
5916
+ return b.__gt__(a);
5917
+ }
5918
+ if (Array.isArray(a) && Array.isArray(b)) {
5919
+ n = Math.min(a.length, b.length);
5920
+ for (var ρσ_ci = 0; ρσ_ci < n; ρσ_ci++) {
5921
+ ea = a[ρσ_ci];
5922
+ eb = b[ρσ_ci];
5923
+ if (ρσ_op_lt(ea, eb)) {
5924
+ return true;
5925
+ }
5926
+ if (ρσ_op_lt(eb, ea)) {
5927
+ return false;
5928
+ }
5929
+ }
5930
+ return a.length < b.length;
5931
+ }
5932
+ ta = typeof a;
5933
+ tb = typeof b;
5934
+ if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5935
+ return a < b;
5936
+ }
5937
+ if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
5938
+ return a < b;
5939
+ }
5940
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("'<' not supported between instances of '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
5941
+ };
5942
+ if (!ρσ_op_lt.__argnames__) Object.defineProperties(ρσ_op_lt, {
5943
+ __argnames__ : {value: ["a", "b"]},
5944
+ __module__ : {value: "__main__"}
5945
+ });
5946
+
5947
+ function ρσ_op_le(a, b) {
5948
+ var n, ea, eb, ta, tb;
5949
+ if (a !== null && typeof a.__le__ === "function") {
5950
+ return a.__le__(b);
5951
+ }
5952
+ if (b !== null && typeof b.__ge__ === "function") {
5953
+ return b.__ge__(a);
5954
+ }
5955
+ if (Array.isArray(a) && Array.isArray(b)) {
5956
+ n = Math.min(a.length, b.length);
5957
+ for (var ρσ_ci = 0; ρσ_ci < n; ρσ_ci++) {
5958
+ ea = a[ρσ_ci];
5959
+ eb = b[ρσ_ci];
5960
+ if (ρσ_op_lt(ea, eb)) {
5961
+ return true;
5962
+ }
5963
+ if (ρσ_op_lt(eb, ea)) {
5964
+ return false;
5965
+ }
5966
+ }
5967
+ return a.length <= b.length;
5968
+ }
5969
+ ta = typeof a;
5970
+ tb = typeof b;
5971
+ if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5972
+ return a <= b;
5973
+ }
5974
+ if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
5975
+ return a <= b;
4158
5976
  }
4159
- return a ^ b;
5977
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("'<=' not supported between instances of '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
4160
5978
  };
4161
- if (!ρσ_op_xor.__argnames__) Object.defineProperties(ρσ_op_xor, {
5979
+ if (!ρσ_op_le.__argnames__) Object.defineProperties(ρσ_op_le, {
4162
5980
  __argnames__ : {value: ["a", "b"]},
4163
5981
  __module__ : {value: "__main__"}
4164
5982
  });
4165
5983
 
4166
- function ρσ_op_lshift(a, b) {
4167
- if (a !== null && typeof a.__lshift__ === "function") {
4168
- return a.__lshift__(b);
5984
+ function ρσ_op_gt(a, b) {
5985
+ var ta, tb;
5986
+ if (a !== null && typeof a.__gt__ === "function") {
5987
+ return a.__gt__(b);
4169
5988
  }
4170
- if (b !== null && typeof b.__rlshift__ === "function") {
4171
- return b.__rlshift__(a);
5989
+ if (b !== null && typeof b.__lt__ === "function") {
5990
+ return b.__lt__(a);
4172
5991
  }
4173
- return a << b;
5992
+ if (Array.isArray(a) && Array.isArray(b)) {
5993
+ return ρσ_op_lt(b, a);
5994
+ }
5995
+ ta = typeof a;
5996
+ tb = typeof b;
5997
+ if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5998
+ return a > b;
5999
+ }
6000
+ if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
6001
+ return a > b;
6002
+ }
6003
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("'>' not supported between instances of '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
4174
6004
  };
4175
- if (!ρσ_op_lshift.__argnames__) Object.defineProperties(ρσ_op_lshift, {
6005
+ if (!ρσ_op_gt.__argnames__) Object.defineProperties(ρσ_op_gt, {
4176
6006
  __argnames__ : {value: ["a", "b"]},
4177
6007
  __module__ : {value: "__main__"}
4178
6008
  });
4179
6009
 
4180
- function ρσ_op_rshift(a, b) {
4181
- if (a !== null && typeof a.__rshift__ === "function") {
4182
- return a.__rshift__(b);
6010
+ function ρσ_op_ge(a, b) {
6011
+ var ta, tb;
6012
+ if (a !== null && typeof a.__ge__ === "function") {
6013
+ return a.__ge__(b);
4183
6014
  }
4184
- if (b !== null && typeof b.__rrshift__ === "function") {
4185
- return b.__rrshift__(a);
6015
+ if (b !== null && typeof b.__le__ === "function") {
6016
+ return b.__le__(a);
4186
6017
  }
4187
- return a >> b;
6018
+ if (Array.isArray(a) && Array.isArray(b)) {
6019
+ return ρσ_op_le(b, a);
6020
+ }
6021
+ ta = typeof a;
6022
+ tb = typeof b;
6023
+ if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
6024
+ return a >= b;
6025
+ }
6026
+ if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
6027
+ return a >= b;
6028
+ }
6029
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("'>=' not supported between instances of '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
4188
6030
  };
4189
- if (!ρσ_op_rshift.__argnames__) Object.defineProperties(ρσ_op_rshift, {
6031
+ if (!ρσ_op_ge.__argnames__) Object.defineProperties(ρσ_op_ge, {
4190
6032
  __argnames__ : {value: ["a", "b"]},
4191
6033
  __module__ : {value: "__main__"}
4192
6034
  });
@@ -4195,6 +6037,12 @@ function ρσ_list_add(a, b) {
4195
6037
  if (Array.isArray(a) && Array.isArray(b)) {
4196
6038
  return ρσ_list_constructor(a.concat(b));
4197
6039
  }
6040
+ if (a !== null && a !== undefined && typeof a.__add__ === "function") {
6041
+ return a.__add__(b);
6042
+ }
6043
+ if (b !== null && b !== undefined && typeof b.__radd__ === "function") {
6044
+ return b.__radd__(a);
6045
+ }
4198
6046
  return a + b;
4199
6047
  };
4200
6048
  if (!ρσ_list_add.__argnames__) Object.defineProperties(ρσ_list_add, {
@@ -4207,6 +6055,12 @@ function ρσ_list_iadd(a, b) {
4207
6055
  Array.prototype.push.apply(a, b);
4208
6056
  return a;
4209
6057
  }
6058
+ if (a !== null && a !== undefined && typeof a.__iadd__ === "function") {
6059
+ return a.__iadd__(b);
6060
+ }
6061
+ if (a !== null && a !== undefined && typeof a.__add__ === "function") {
6062
+ return a.__add__(b);
6063
+ }
4210
6064
  return a + b;
4211
6065
  };
4212
6066
  if (!ρσ_list_iadd.__argnames__) Object.defineProperties(ρσ_list_iadd, {
@@ -4379,6 +6233,299 @@ if (!ρσ_op_irshift.__argnames__) Object.defineProperties(ρσ_op_irshift, {
4379
6233
  __module__ : {value: "__main__"}
4380
6234
  });
4381
6235
 
6236
+ function ρσ_op_add_ns(a, b) {
6237
+ if (a !== null && typeof a.__add__ === "function") {
6238
+ return a.__add__(b);
6239
+ }
6240
+ if (b !== null && typeof b.__radd__ === "function") {
6241
+ return b.__radd__(a);
6242
+ }
6243
+ if (Array.isArray(a) && Array.isArray(b)) {
6244
+ return ρσ_list_constructor(a.concat(b));
6245
+ }
6246
+ return a + b;
6247
+ };
6248
+ if (!ρσ_op_add_ns.__argnames__) Object.defineProperties(ρσ_op_add_ns, {
6249
+ __argnames__ : {value: ["a", "b"]},
6250
+ __module__ : {value: "__main__"}
6251
+ });
6252
+
6253
+ function ρσ_op_sub_ns(a, b) {
6254
+ if (a !== null && typeof a.__sub__ === "function") {
6255
+ return a.__sub__(b);
6256
+ }
6257
+ if (b !== null && typeof b.__rsub__ === "function") {
6258
+ return b.__rsub__(a);
6259
+ }
6260
+ return a - b;
6261
+ };
6262
+ if (!ρσ_op_sub_ns.__argnames__) Object.defineProperties(ρσ_op_sub_ns, {
6263
+ __argnames__ : {value: ["a", "b"]},
6264
+ __module__ : {value: "__main__"}
6265
+ });
6266
+
6267
+ function ρσ_op_mul_ns(a, b) {
6268
+ var ta, tb, result;
6269
+ if (a !== null && typeof a.__mul__ === "function") {
6270
+ return a.__mul__(b);
6271
+ }
6272
+ if (b !== null && typeof b.__rmul__ === "function") {
6273
+ return b.__rmul__(a);
6274
+ }
6275
+ ta = typeof a;
6276
+ tb = typeof b;
6277
+ if ((ta === "string" || a instanceof String) && (tb === "number" || tb === "boolean")) {
6278
+ return a.repeat(b);
6279
+ }
6280
+ if ((tb === "string" || b instanceof String) && (ta === "number" || ta === "boolean")) {
6281
+ return b.repeat(a);
6282
+ }
6283
+ if (Array.isArray(a) && (tb === "number" || tb === "boolean")) {
6284
+ result = [];
6285
+ for (var ρσ_mi = 0; ρσ_mi < b; ρσ_mi++) {
6286
+ result = result.concat(a);
6287
+ }
6288
+ return ρσ_list_constructor(result);
6289
+ }
6290
+ if (Array.isArray(b) && (ta === "number" || ta === "boolean")) {
6291
+ result = [];
6292
+ for (var ρσ_mi = 0; ρσ_mi < a; ρσ_mi++) {
6293
+ result = result.concat(b);
6294
+ }
6295
+ return ρσ_list_constructor(result);
6296
+ }
6297
+ return a * b;
6298
+ };
6299
+ if (!ρσ_op_mul_ns.__argnames__) Object.defineProperties(ρσ_op_mul_ns, {
6300
+ __argnames__ : {value: ["a", "b"]},
6301
+ __module__ : {value: "__main__"}
6302
+ });
6303
+
6304
+ function ρσ_op_truediv_ns(a, b) {
6305
+ if (a !== null && typeof a.__truediv__ === "function") {
6306
+ return a.__truediv__(b);
6307
+ }
6308
+ if (b !== null && typeof b.__rtruediv__ === "function") {
6309
+ return b.__rtruediv__(a);
6310
+ }
6311
+ return a / b;
6312
+ };
6313
+ if (!ρσ_op_truediv_ns.__argnames__) Object.defineProperties(ρσ_op_truediv_ns, {
6314
+ __argnames__ : {value: ["a", "b"]},
6315
+ __module__ : {value: "__main__"}
6316
+ });
6317
+
6318
+ function ρσ_op_floordiv_ns(a, b) {
6319
+ if (a !== null && typeof a.__floordiv__ === "function") {
6320
+ return a.__floordiv__(b);
6321
+ }
6322
+ if (b !== null && typeof b.__rfloordiv__ === "function") {
6323
+ return b.__rfloordiv__(a);
6324
+ }
6325
+ return Math.floor(a / b);
6326
+ };
6327
+ if (!ρσ_op_floordiv_ns.__argnames__) Object.defineProperties(ρσ_op_floordiv_ns, {
6328
+ __argnames__ : {value: ["a", "b"]},
6329
+ __module__ : {value: "__main__"}
6330
+ });
6331
+
6332
+ function ρσ_op_mod_ns(a, b) {
6333
+ if (a !== null && typeof a.__mod__ === "function") {
6334
+ return a.__mod__(b);
6335
+ }
6336
+ if (b !== null && typeof b.__rmod__ === "function") {
6337
+ return b.__rmod__(a);
6338
+ }
6339
+ return a % b;
6340
+ };
6341
+ if (!ρσ_op_mod_ns.__argnames__) Object.defineProperties(ρσ_op_mod_ns, {
6342
+ __argnames__ : {value: ["a", "b"]},
6343
+ __module__ : {value: "__main__"}
6344
+ });
6345
+
6346
+ function ρσ_op_pow_ns(a, b) {
6347
+ if (a !== null && typeof a.__pow__ === "function") {
6348
+ return a.__pow__(b);
6349
+ }
6350
+ if (b !== null && typeof b.__rpow__ === "function") {
6351
+ return b.__rpow__(a);
6352
+ }
6353
+ return Math.pow(a, b);
6354
+ };
6355
+ if (!ρσ_op_pow_ns.__argnames__) Object.defineProperties(ρσ_op_pow_ns, {
6356
+ __argnames__ : {value: ["a", "b"]},
6357
+ __module__ : {value: "__main__"}
6358
+ });
6359
+
6360
+ function ρσ_op_lt_ns(a, b) {
6361
+ var n, ea, eb;
6362
+ if (a !== null && typeof a.__lt__ === "function") {
6363
+ return a.__lt__(b);
6364
+ }
6365
+ if (b !== null && typeof b.__gt__ === "function") {
6366
+ return b.__gt__(a);
6367
+ }
6368
+ if (Array.isArray(a) && Array.isArray(b)) {
6369
+ n = Math.min(a.length, b.length);
6370
+ for (var ρσ_ci = 0; ρσ_ci < n; ρσ_ci++) {
6371
+ ea = a[ρσ_ci];
6372
+ eb = b[ρσ_ci];
6373
+ if (ρσ_op_lt_ns(ea, eb)) {
6374
+ return true;
6375
+ }
6376
+ if (ρσ_op_lt_ns(eb, ea)) {
6377
+ return false;
6378
+ }
6379
+ }
6380
+ return a.length < b.length;
6381
+ }
6382
+ return a < b;
6383
+ };
6384
+ if (!ρσ_op_lt_ns.__argnames__) Object.defineProperties(ρσ_op_lt_ns, {
6385
+ __argnames__ : {value: ["a", "b"]},
6386
+ __module__ : {value: "__main__"}
6387
+ });
6388
+
6389
+ function ρσ_op_le_ns(a, b) {
6390
+ var n, ea, eb;
6391
+ if (a !== null && typeof a.__le__ === "function") {
6392
+ return a.__le__(b);
6393
+ }
6394
+ if (b !== null && typeof b.__ge__ === "function") {
6395
+ return b.__ge__(a);
6396
+ }
6397
+ if (Array.isArray(a) && Array.isArray(b)) {
6398
+ n = Math.min(a.length, b.length);
6399
+ for (var ρσ_ci = 0; ρσ_ci < n; ρσ_ci++) {
6400
+ ea = a[ρσ_ci];
6401
+ eb = b[ρσ_ci];
6402
+ if (ρσ_op_lt_ns(ea, eb)) {
6403
+ return true;
6404
+ }
6405
+ if (ρσ_op_lt_ns(eb, ea)) {
6406
+ return false;
6407
+ }
6408
+ }
6409
+ return a.length <= b.length;
6410
+ }
6411
+ return a <= b;
6412
+ };
6413
+ if (!ρσ_op_le_ns.__argnames__) Object.defineProperties(ρσ_op_le_ns, {
6414
+ __argnames__ : {value: ["a", "b"]},
6415
+ __module__ : {value: "__main__"}
6416
+ });
6417
+
6418
+ function ρσ_op_gt_ns(a, b) {
6419
+ if (a !== null && typeof a.__gt__ === "function") {
6420
+ return a.__gt__(b);
6421
+ }
6422
+ if (b !== null && typeof b.__lt__ === "function") {
6423
+ return b.__lt__(a);
6424
+ }
6425
+ if (Array.isArray(a) && Array.isArray(b)) {
6426
+ return ρσ_op_lt_ns(b, a);
6427
+ }
6428
+ return a > b;
6429
+ };
6430
+ if (!ρσ_op_gt_ns.__argnames__) Object.defineProperties(ρσ_op_gt_ns, {
6431
+ __argnames__ : {value: ["a", "b"]},
6432
+ __module__ : {value: "__main__"}
6433
+ });
6434
+
6435
+ function ρσ_op_ge_ns(a, b) {
6436
+ if (a !== null && typeof a.__ge__ === "function") {
6437
+ return a.__ge__(b);
6438
+ }
6439
+ if (b !== null && typeof b.__le__ === "function") {
6440
+ return b.__le__(a);
6441
+ }
6442
+ if (Array.isArray(a) && Array.isArray(b)) {
6443
+ return ρσ_op_le_ns(b, a);
6444
+ }
6445
+ return a >= b;
6446
+ };
6447
+ if (!ρσ_op_ge_ns.__argnames__) Object.defineProperties(ρσ_op_ge_ns, {
6448
+ __argnames__ : {value: ["a", "b"]},
6449
+ __module__ : {value: "__main__"}
6450
+ });
6451
+
6452
+ function ρσ_op_iadd_ns(a, b) {
6453
+ if (a !== null && typeof a.__iadd__ === "function") {
6454
+ return a.__iadd__(b);
6455
+ }
6456
+ return ρσ_op_add_ns(a, b);
6457
+ };
6458
+ if (!ρσ_op_iadd_ns.__argnames__) Object.defineProperties(ρσ_op_iadd_ns, {
6459
+ __argnames__ : {value: ["a", "b"]},
6460
+ __module__ : {value: "__main__"}
6461
+ });
6462
+
6463
+ function ρσ_op_isub_ns(a, b) {
6464
+ if (a !== null && typeof a.__isub__ === "function") {
6465
+ return a.__isub__(b);
6466
+ }
6467
+ return ρσ_op_sub_ns(a, b);
6468
+ };
6469
+ if (!ρσ_op_isub_ns.__argnames__) Object.defineProperties(ρσ_op_isub_ns, {
6470
+ __argnames__ : {value: ["a", "b"]},
6471
+ __module__ : {value: "__main__"}
6472
+ });
6473
+
6474
+ function ρσ_op_imul_ns(a, b) {
6475
+ if (a !== null && typeof a.__imul__ === "function") {
6476
+ return a.__imul__(b);
6477
+ }
6478
+ return ρσ_op_mul_ns(a, b);
6479
+ };
6480
+ if (!ρσ_op_imul_ns.__argnames__) Object.defineProperties(ρσ_op_imul_ns, {
6481
+ __argnames__ : {value: ["a", "b"]},
6482
+ __module__ : {value: "__main__"}
6483
+ });
6484
+
6485
+ function ρσ_op_itruediv_ns(a, b) {
6486
+ if (a !== null && typeof a.__itruediv__ === "function") {
6487
+ return a.__itruediv__(b);
6488
+ }
6489
+ return ρσ_op_truediv_ns(a, b);
6490
+ };
6491
+ if (!ρσ_op_itruediv_ns.__argnames__) Object.defineProperties(ρσ_op_itruediv_ns, {
6492
+ __argnames__ : {value: ["a", "b"]},
6493
+ __module__ : {value: "__main__"}
6494
+ });
6495
+
6496
+ function ρσ_op_ifloordiv_ns(a, b) {
6497
+ if (a !== null && typeof a.__ifloordiv__ === "function") {
6498
+ return a.__ifloordiv__(b);
6499
+ }
6500
+ return ρσ_op_floordiv_ns(a, b);
6501
+ };
6502
+ if (!ρσ_op_ifloordiv_ns.__argnames__) Object.defineProperties(ρσ_op_ifloordiv_ns, {
6503
+ __argnames__ : {value: ["a", "b"]},
6504
+ __module__ : {value: "__main__"}
6505
+ });
6506
+
6507
+ function ρσ_op_imod_ns(a, b) {
6508
+ if (a !== null && typeof a.__imod__ === "function") {
6509
+ return a.__imod__(b);
6510
+ }
6511
+ return ρσ_op_mod_ns(a, b);
6512
+ };
6513
+ if (!ρσ_op_imod_ns.__argnames__) Object.defineProperties(ρσ_op_imod_ns, {
6514
+ __argnames__ : {value: ["a", "b"]},
6515
+ __module__ : {value: "__main__"}
6516
+ });
6517
+
6518
+ function ρσ_op_ipow_ns(a, b) {
6519
+ if (a !== null && typeof a.__ipow__ === "function") {
6520
+ return a.__ipow__(b);
6521
+ }
6522
+ return ρσ_op_pow_ns(a, b);
6523
+ };
6524
+ if (!ρσ_op_ipow_ns.__argnames__) Object.defineProperties(ρσ_op_ipow_ns, {
6525
+ __argnames__ : {value: ["a", "b"]},
6526
+ __module__ : {value: "__main__"}
6527
+ });
6528
+
4382
6529
  function ρσ_instanceof() {
4383
6530
  var obj, bases, q, cls, p;
4384
6531
  obj = arguments[0];
@@ -4425,8 +6572,8 @@ if (!ρσ_instanceof.__module__) Object.defineProperties(ρσ_instanceof, {
4425
6572
  __module__ : {value: "__main__"}
4426
6573
  });
4427
6574
 
4428
- ρσ_JS_Proxy = typeof Proxy === "function" ? Proxy : null;
4429
- ρσ_proxy_target_symbol = typeof Symbol === "function" ? Symbol("ρσ_proxy_target") : "__ρσ_proxy_target__";
6575
+ var ρσ_JS_Proxy = typeof Proxy === "function" ? Proxy : null;
6576
+ var ρσ_proxy_target_symbol = typeof Symbol === "function" ? Symbol("ρσ_proxy_target") : "__ρσ_proxy_target__";
4430
6577
  ρσ_attr_proxy_handler = (function(){
4431
6578
  var ρσ_d = {};
4432
6579
  ρσ_d["get"] = (function() {
@@ -4495,6 +6642,7 @@ if (!ρσ_instanceof.__module__) Object.defineProperties(ρσ_instanceof, {
4495
6642
  })();
4496
6643
  return ρσ_d;
4497
6644
  }).call(this);
6645
+ (typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : global)["ρσ_attr_proxy_handler"] = ρσ_attr_proxy_handler;
4498
6646
  function ρσ_object_setattr(obj, name, value) {
4499
6647
  var target;
4500
6648
  target = obj[ρσ_proxy_target_symbol];
@@ -4640,12 +6788,18 @@ if (!filter.__argnames__) Object.defineProperties(filter, {
4640
6788
  });
4641
6789
 
4642
6790
  function zip() {
4643
- var iterators, ans;
4644
- iterators = new Array(arguments.length);
4645
- for (var i = 0; i < arguments.length; i++) {
6791
+ var n, strict, iterators, ans;
6792
+ n = arguments.length;
6793
+ strict = false;
6794
+ if (n > 0 && typeof arguments[n - 1] === "object" && arguments[n - 1] !== null && arguments[ρσ_bound_index(n - 1, arguments)][ρσ_kwargs_symbol] === true) {
6795
+ strict = arguments[ρσ_bound_index(n - 1, arguments)]["strict"] || false;
6796
+ n -= 1;
6797
+ }
6798
+ iterators = new Array(n);
6799
+ for (var i = 0; i < n; i++) {
4646
6800
  iterators[(typeof i === "number" && i < 0) ? iterators.length + i : i] = iter(arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i]);
4647
6801
  }
4648
- ans = {'_iterators':iterators};
6802
+ ans = {'_iterators':iterators, '_strict':strict};
4649
6803
  ans[ρσ_iterator_symbol] = (function() {
4650
6804
  var ρσ_anonfunc = function () {
4651
6805
  return this;
@@ -4658,10 +6812,23 @@ function zip() {
4658
6812
  ans["next"] = (function() {
4659
6813
  var ρσ_anonfunc = function () {
4660
6814
  var args, r;
6815
+ if (!this._iterators.length) {
6816
+ return {'done':true};
6817
+ }
4661
6818
  args = new Array(this._iterators.length);
4662
6819
  for (var i = 0; i < this._iterators.length; i++) {
4663
6820
  r = (ρσ_expr_temp = this._iterators)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i].next();
4664
6821
  if (r.done) {
6822
+ if (this._strict) {
6823
+ for (var j = i + 1; j < this._iterators.length; j++) {
6824
+ if (!(ρσ_expr_temp = this._iterators)[(typeof j === "number" && j < 0) ? ρσ_expr_temp.length + j : j].next().done) {
6825
+ throw new ValueError("zip() has arguments with different lengths");
6826
+ }
6827
+ }
6828
+ if (i > 0) {
6829
+ throw new ValueError("zip() has arguments with different lengths");
6830
+ }
6831
+ }
4665
6832
  return {'done':true};
4666
6833
  }
4667
6834
  args[(typeof i === "number" && i < 0) ? args.length + i : i] = r.value;
@@ -4728,7 +6895,7 @@ if (!all.__argnames__) Object.defineProperties(all, {
4728
6895
  __argnames__ : {value: ["iterable"]},
4729
6896
  __module__ : {value: "__main__"}
4730
6897
  });
4731
- let decimal_sep, define_str_func, ρσ_unpack, ρσ_orig_split, ρσ_orig_replace;
6898
+ let decimal_sep, define_str_func, ρσ_orig_split, ρσ_orig_replace;
4732
6899
  decimal_sep = 1.1.toLocaleString()[1];
4733
6900
  function ρσ_repr_js_builtin(x, as_array) {
4734
6901
  var ans, b, keys, key;
@@ -4901,9 +7068,8 @@ define_str_func = (function() {
4901
7068
  });
4902
7069
  return ρσ_anonfunc;
4903
7070
  })();
4904
- ρσ_unpack = [String.prototype.split.call.bind(String.prototype.split), String.prototype.replace.call.bind(String.prototype.replace)];
4905
- ρσ_orig_split = ρσ_unpack[0];
4906
- ρσ_orig_replace = ρσ_unpack[1];
7071
+ ρσ_orig_split = String.prototype.split.call.bind(String.prototype.split);
7072
+ ρσ_orig_replace = String.prototype.replace.call.bind(String.prototype.replace);
4907
7073
  define_str_func("format", (function() {
4908
7074
  var ρσ_anonfunc = function () {
4909
7075
  var template, args, kwargs, explicit, implicit, idx, split, ans, pos, in_brace, markup, ch;
@@ -5268,9 +7434,20 @@ define_str_func("format", (function() {
5268
7434
  if (typeof object === "function") {
5269
7435
  object = object();
5270
7436
  }
5271
- ans = ρσ_list_add("", object);
5272
- if (format_spec) {
5273
- ans = apply_formatting(ans, format_spec);
7437
+ if (transformer === "r") {
7438
+ object = ρσ_repr(object);
7439
+ } else if (transformer === "s") {
7440
+ object = ρσ_str(object);
7441
+ } else if (transformer === "a") {
7442
+ object = ρσ_repr(object);
7443
+ }
7444
+ if (!transformer && object !== null && object !== undefined && typeof object.__format__ === "function") {
7445
+ ans = object.__format__(format_spec || "");
7446
+ } else {
7447
+ ans = ρσ_list_add("", object);
7448
+ if (format_spec) {
7449
+ ans = apply_formatting(ans, format_spec);
7450
+ }
5274
7451
  }
5275
7452
  if (ends_with_equal) {
5276
7453
  ans = ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("", ρσ_str.format("{}", key)), "="), ρσ_str.format("{}", ans)), "");
@@ -5861,6 +8038,19 @@ define_str_func("split", (function() {
5861
8038
  });
5862
8039
  return ρσ_anonfunc;
5863
8040
  })());
8041
+ String.prototype.split = (function() {
8042
+ var ρσ_anonfunc = function (sep, limit) {
8043
+ if (sep === undefined) {
8044
+ return ρσ_str.prototype.split.call(this);
8045
+ }
8046
+ return ρσ_orig_split(this, sep, limit);
8047
+ };
8048
+ if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
8049
+ __argnames__ : {value: ["sep", "limit"]},
8050
+ __module__ : {value: "__main__"}
8051
+ });
8052
+ return ρσ_anonfunc;
8053
+ })();
5864
8054
  define_str_func("rsplit", (function() {
5865
8055
  var ρσ_anonfunc = function (sep, maxsplit) {
5866
8056
  var split, ans, is_space, pos, current, spc, ch, end, idx;