(function() { /* https://mths.be/fromcodepoint v0.2.1 by @mathias */ 'use strict'; var $jscomp = $jscomp || {}; $jscomp.scope = {}; $jscomp.ASSUME_ES5 = !1; $jscomp.ASSUME_NO_NATIVE_MAP = !1; $jscomp.ASSUME_NO_NATIVE_SET = !1; $jscomp.SIMPLE_FROUND_POLYFILL = !1; $jscomp.defineProperty = $jscomp.ASSUME_ES5 || "function" == typeof Object.defineProperties ? Object.defineProperty : function(m, p, a) { m != Array.prototype && m != Object.prototype && (m[p] = a.value) } ; $jscomp.getGlobal = function(m) { return "undefined" != typeof window && window === m ? m : "undefined" != typeof global && null != global ? global : m } ; $jscomp.global = $jscomp.getGlobal(this); $jscomp.polyfill = function(m, p, a, b) { if (p) { a = $jscomp.global; m = m.split("."); for (b = 0; b < m.length - 1; b++) { var c = m[b]; c in a || (a[c] = {}); a = a[c] } m = m[m.length - 1]; b = a[m]; p = p(b); p != b && null != p && $jscomp.defineProperty(a, m, { configurable: !0, writable: !0, value: p }) } } ; $jscomp.polyfill("Array.prototype.includes", function(m) { return m ? m : function(m, a) { var b = this; b instanceof String && (b = String(b)); var c = b.length; a = a || 0; for (0 > a && (a = Math.max(a + c, 0)); a < c; a++) { var d = b[a]; if (d === m || Object.is(d, m)) return !0 } return !1 } }, "es7", "es3"); $jscomp.owns = function(m, p) { return Object.prototype.hasOwnProperty.call(m, p) } ; $jscomp.polyfill("Object.values", function(m) { return m ? m : function(m) { var a = [], b; for (b in m) $jscomp.owns(m, b) && a.push(m[b]); return a } }, "es8", "es3"); $jscomp.arrayIteratorImpl = function(m) { var p = 0; return function() { return p < m.length ? { done: !1, value: m[p++] } : { done: !0 } } } ; $jscomp.arrayIterator = function(m) { return { next: $jscomp.arrayIteratorImpl(m) } } ; $jscomp.SYMBOL_PREFIX = "jscomp_symbol_"; $jscomp.initSymbol = function() { $jscomp.initSymbol = function() {} ; $jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol) } ; $jscomp.SymbolClass = function(m, p) { this.$jscomp$symbol$id_ = m; $jscomp.defineProperty(this, "description", { configurable: !0, writable: !0, value: p }) } ; $jscomp.SymbolClass.prototype.toString = function() { return this.$jscomp$symbol$id_ } ; $jscomp.Symbol = function() { function m(a) { if (this instanceof m) throw new TypeError("Symbol is not a constructor"); return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX + (a || "") + "_" + p++,a) } var p = 0; return m }(); $jscomp.initSymbolIterator = function() { $jscomp.initSymbol(); var m = $jscomp.global.Symbol.iterator; m || (m = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("Symbol.iterator")); "function" != typeof Array.prototype[m] && $jscomp.defineProperty(Array.prototype, m, { configurable: !0, writable: !0, value: function() { return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this)) } }); $jscomp.initSymbolIterator = function() {} } ; $jscomp.initSymbolAsyncIterator = function() { $jscomp.initSymbol(); var m = $jscomp.global.Symbol.asyncIterator; m || (m = $jscomp.global.Symbol.asyncIterator = $jscomp.global.Symbol("Symbol.asyncIterator")); $jscomp.initSymbolAsyncIterator = function() {} } ; $jscomp.iteratorPrototype = function(m) { $jscomp.initSymbolIterator(); m = { next: m }; m[$jscomp.global.Symbol.iterator] = function() { return this } ; return m } ; $jscomp.iteratorFromArray = function(m, p) { $jscomp.initSymbolIterator(); m instanceof String && (m += ""); var a = 0 , b = { next: function() { if (a < m.length) { var c = a++; return { value: p(c, m[c]), done: !1 } } b.next = function() { return { done: !0, value: void 0 } } ; return b.next() } }; b[Symbol.iterator] = function() { return b } ; return b } ; $jscomp.polyfill("Array.prototype.values", function(m) { return m ? m : function() { return $jscomp.iteratorFromArray(this, function(m, a) { return a }) } }, "es8", "es3"); (function(m) { function p(b) { if (a[b]) return a[b].exports; var c = a[b] = { i: b, l: !1, exports: {} }; m[b].call(c.exports, c, c.exports, p); c.l = !0; return c.exports } var a = {}; p.m = m; p.c = a; p.d = function(a, c, d) { p.o(a, c) || Object.defineProperty(a, c, { enumerable: !0, get: d }) } ; p.r = function(a) { "undefined" !== typeof Symbol && Symbol.toStringTag && Object.defineProperty(a, Symbol.toStringTag, { value: "Module" }); Object.defineProperty(a, "__esModule", { value: !0 }) } ; p.t = function(a, c) { c & 1 && (a = p(a)); if (c & 8) return a; if (c & 4 && "object" === typeof a && a && a.__esModule) return a; var b = Object.create(null); p.r(b); Object.defineProperty(b, "default", { enumerable: !0, value: a }); if (c & 2 && "string" != typeof a) for (var e in a) p.d(b, e, function(c) { return a[c] } .bind(null, e)); return b } ; p.n = function(a) { var c = a && a.__esModule ? function() { return a["default"] } : function() { return a } ; p.d(c, "a", c); return c } ; p.o = function(a, c) { return Object.prototype.hasOwnProperty.call(a, c) } ; p.p = ""; return p(p.s = 1) } )([function(m, p) { p = function() { return this }(); try { p = p || (new Function("return this"))() } catch (a) { "object" === typeof window && (p = window) } m.exports = p } , function(m, p, a) { a(2); Sk.global.strftime = a(3); Sk.global.strptime = a(4); a(5); a(7); a(8); a(9); a(10); a(11); a(12); a(13); a(14); a(15); a(16); a(17); a(18); a(19); a(20); a(21); a(23); a(24); a(25); a(26); a(27); a(28); a(29); a(30); a(31); a(32); a(33); a(34); a(35); a(36); a(37); a(38); a(39); a(40); a(41); a(42); a(43); a(44); a(45); a(46); a(47); a(48); a(49); a(50); a(51); a(52); a(53); a(54); a(55); a(56); a(57); a(58); a(59); a(60); a(61); a(62); a(63) } , function(m, p, a) { (function(a) { var c = { build: { githash: "4b86a6f1f3cf684f7e5ca17042fc5d6bd302df60", date: "2020-10-10T16:16:41.699Z" } }; c.global = "undefined" !== typeof a ? a : "undefined" !== typeof self ? self : "undefined" !== typeof window ? window : {}; c.exportSymbol = function(a, b) { a = a.split("."); var d = c.global, e; for (e = 0; e < a.length - 1; e++) { var f = a[e]; d = d.hasOwnProperty(f) ? d[f] : d[f] = {} } "undefined" !== typeof b && (f = a[e], d[f] = b) } ; c.isArrayLike = function(a) { return a instanceof Array || a && a.length && "number" == typeof a.length ? !0 : !1 } ; c.js_beautify = function(a) { return a } ; c.exportSymbol("Sk", c); c.exportSymbol("Sk.global", c.global); c.exportSymbol("Sk.build", c.build); c.exportSymbol("Sk.exportSymbol", c.exportSymbol); c.exportSymbol("Sk.isArrayLike", c.isArrayLike); c.exportSymbol("Sk.js_beautify", c.js_beautify) } ).call(this, a(0)) } , function(m, p) { (function() { function a(n, l, z) { function u(a, f, k, n) { for (var l = "", z = null, y = !1, t = a.length, H = !1, m = 0; m < t; m++) { var C = a.charCodeAt(m); if (!0 === y) if (45 === C) z = ""; else if (95 === C) z = " "; else if (48 === C) z = "0"; else if (58 === C) H && g("[WARNING] detected use of unsupported %:: or %::: modifiers to strftime"), H = !0; else { switch (C) { case 37: l += "%"; break; case 65: l += k.days[f.getDay()]; break; case 66: l += k.months[f.getMonth()]; break; case 67: l += b(Math.floor(f.getFullYear() / 100), z); break; case 68: l += u(k.formats.D, f, k, n); break; case 70: l += u(k.formats.F, f, k, n); break; case 72: l += b(f.getHours(), z); break; case 73: l += b(d(f.getHours()), z); break; case 76: l += c(Math.floor(n % 1E3)); break; case 77: l += b(f.getMinutes(), z); break; case 80: l += 12 > f.getHours() ? k.am : k.pm; break; case 82: l += u(k.formats.R, f, k, n); break; case 83: l += b(f.getSeconds(), z); break; case 84: l += u(k.formats.T, f, k, n); break; case 85: l += b(e(f, "sunday"), z); break; case 87: l += b(e(f, "monday"), z); break; case 88: l += u(k.formats.X, f, k, n); break; case 89: l += f.getFullYear(); break; case 90: K && 0 === q ? l += "GMT" : (z = f.toString().match(/\(([\w\s]+)\)/), l += z && z[1] || ""); break; case 97: l += k.shortDays[f.getDay()]; break; case 98: l += k.shortMonths[f.getMonth()]; break; case 99: l += u(k.formats.c, f, k, n); break; case 100: l += b(f.getDate(), z); break; case 101: l += b(f.getDate(), null == z ? " " : z); break; case 104: l += k.shortMonths[f.getMonth()]; break; case 106: z = new Date(f.getFullYear(),0,1); z = Math.ceil((f.getTime() - z.getTime()) / 864E5); l += c(z); break; case 107: l += b(f.getHours(), null == z ? " " : z); break; case 108: l += b(d(f.getHours()), null == z ? " " : z); break; case 109: l += b(f.getMonth() + 1, z); break; case 110: l += "\n"; break; case 111: z = f.getDate(); l = k.ordinalSuffixes ? l + (String(z) + (k.ordinalSuffixes[z - 1] || h(z))) : l + (String(z) + h(z)); break; case 112: l += 12 > f.getHours() ? k.AM : k.PM; break; case 114: l += u(k.formats.r, f, k, n); break; case 115: l += Math.floor(n / 1E3); break; case 116: l += "\t"; break; case 117: z = f.getDay(); l += 0 === z ? 7 : z; break; case 118: l += u(k.formats.v, f, k, n); break; case 119: l += f.getDay(); break; case 120: l += u(k.formats.x, f, k, n); break; case 121: l += ("" + f.getFullYear()).slice(2); break; case 122: K && 0 === q ? l += H ? "+00:00" : "+0000" : (z = 0 !== q ? q / 6E4 : -f.getTimezoneOffset(), y = H ? ":" : "", C = Math.abs(z % 60), l += (0 > z ? "-" : "+") + b(Math.floor(Math.abs(z / 60))) + y + b(C)); break; default: y && (l += "%"), l += a[m] } z = null; y = !1 } else 37 === C ? y = !0 : l += a[m] } return l } var t = n || k, q = l || 0, K = z || !1, m = 0, F, L = function(a, c) { if (c) { var b = c.getTime(); if (K) { var d = 6E4 * (c.getTimezoneOffset() || 0); c = new Date(b + d + q); 6E4 * (c.getTimezoneOffset() || 0) !== d && (c = 6E4 * (c.getTimezoneOffset() || 0), c = new Date(b + c + q)) } } else b = Date.now(), b > m ? (m = b, F = new Date(m), b = m, K && (F = new Date(m + 6E4 * (F.getTimezoneOffset() || 0) + q))) : b = m, c = F; return u(a, c, t, b) }; L.localize = function(c) { return new a(c || t,q,K) } ; L.localizeByIdentifier = function(a) { var c = f[a]; return c ? L.localize(c) : (g('[WARNING] No locale found with identifier "' + a + '".'), L) } ; L.timezone = function(c) { var b = q , d = K , f = typeof c; if ("number" === f || "string" === f) d = !0, "string" === f ? (b = "-" === c[0] ? -1 : 1, f = parseInt(c.slice(1, 3), 10), c = parseInt(c.slice(3, 5), 10), b = b * (60 * f + c) * 6E4) : "number" === f && (b = 6E4 * c); return new a(t,b,d) } ; L.utc = function() { return new a(t,q,!0) } ; return L } function b(a, c) { if ("" === c || 9 < a) return a; null == c && (c = "0"); return c + a } function c(a) { return 99 < a ? a : 9 < a ? "0" + a : "00" + a } function d(a) { return 0 === a ? 12 : 12 < a ? a - 12 : a } function e(a, c) { c = c || "sunday"; var b = a.getDay(); "monday" === c && (0 === b ? b = 6 : b--); c = Date.UTC(a.getFullYear(), 0, 1); a = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate()); return Math.floor((Math.floor((a - c) / 864E5) + 7 - b) / 7) } function h(a) { var c = a % 10; a %= 100; if (11 <= a && 13 >= a || 0 === c || 4 <= c) return "th"; switch (c) { case 1: return "st"; case 2: return "nd"; case 3: return "rd" } } function g(a) { "undefined" !== typeof console && "function" == typeof console.warn && console.warn(a) } var f = { de_DE: { days: "Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag".split(" "), shortDays: "So Mo Di Mi Do Fr Sa".split(" "), months: "Januar Februar M\u00e4rz April Mai Juni Juli August September Oktober November Dezember".split(" "), shortMonths: "Jan Feb M\u00e4r Apr Mai Jun Jul Aug Sep Okt Nov Dez".split(" "), AM: "AM", PM: "PM", am: "am", pm: "pm", formats: { c: "%a %d %b %Y %X %Z", D: "%d.%m.%Y", F: "%Y-%m-%d", R: "%H:%M", r: "%I:%M:%S %p", T: "%H:%M:%S", v: "%e-%b-%Y", X: "%T", x: "%D" } }, en_CA: { days: "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "), shortDays: "Sun Mon Tue Wed Thu Fri Sat".split(" "), months: "January February March April May June July August September October November December".split(" "), shortMonths: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "), ordinalSuffixes: "st nd rd th th th th th th th th th th th th th th th th th st nd rd th th th th th th th st".split(" "), AM: "AM", PM: "PM", am: "am", pm: "pm", formats: { c: "%a %d %b %Y %X %Z", D: "%d/%m/%y", F: "%Y-%m-%d", R: "%H:%M", r: "%I:%M:%S %p", T: "%H:%M:%S", v: "%e-%b-%Y", X: "%r", x: "%D" } }, en_US: { days: "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "), shortDays: "Sun Mon Tue Wed Thu Fri Sat".split(" "), months: "January February March April May June July August September October November December".split(" "), shortMonths: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "), ordinalSuffixes: "st nd rd th th th th th th th th th th th th th th th th th st nd rd th th th th th th th st".split(" "), AM: "AM", PM: "PM", am: "am", pm: "pm", formats: { c: "%a %d %b %Y %X %Z", D: "%m/%d/%y", F: "%Y-%m-%d", R: "%H:%M", r: "%I:%M:%S %p", T: "%H:%M:%S", v: "%e-%b-%Y", X: "%r", x: "%D" } }, es_MX: { days: "domingo lunes martes mi\u00e9rcoles jueves viernes s\u00e1bado".split(" "), shortDays: "dom lun mar mi\u00e9 jue vie s\u00e1b".split(" "), months: "enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiembre;octubre;noviembre; diciembre".split(";"), shortMonths: "ene feb mar abr may jun jul ago sep oct nov dic".split(" "), AM: "AM", PM: "PM", am: "am", pm: "pm", formats: { c: "%a %d %b %Y %X %Z", D: "%d/%m/%Y", F: "%Y-%m-%d", R: "%H:%M", r: "%I:%M:%S %p", T: "%H:%M:%S", v: "%e-%b-%Y", X: "%T", x: "%D" } }, fr_FR: { days: "dimanche lundi mardi mercredi jeudi vendredi samedi".split(" "), shortDays: "dim. lun. mar. mer. jeu. ven. sam.".split(" "), months: "janvier f\u00e9vrier mars avril mai juin juillet ao\u00fbt septembre octobre novembre d\u00e9cembre".split(" "), shortMonths: "janv. f\u00e9vr. mars avril mai juin juil. ao\u00fbt sept. oct. nov. d\u00e9c.".split(" "), AM: "AM", PM: "PM", am: "am", pm: "pm", formats: { c: "%a %d %b %Y %X %Z", D: "%d/%m/%Y", F: "%Y-%m-%d", R: "%H:%M", r: "%I:%M:%S %p", T: "%H:%M:%S", v: "%e-%b-%Y", X: "%T", x: "%D" } }, it_IT: { days: "domenica luned\u00ec marted\u00ec mercoled\u00ec gioved\u00ec venerd\u00ec sabato".split(" "), shortDays: "dom lun mar mer gio ven sab".split(" "), months: "gennaio febbraio marzo aprile maggio giugno luglio agosto settembre ottobre novembre dicembre".split(" "), shortMonths: "pr mag giu lug ago set ott nov dic".split(" "), AM: "AM", PM: "PM", am: "am", pm: "pm", formats: { c: "%a %d %b %Y %X %Z", D: "%d/%m/%Y", F: "%Y-%m-%d", R: "%H:%M", r: "%I:%M:%S %p", T: "%H:%M:%S", v: "%e-%b-%Y", X: "%T", x: "%D" } }, nl_NL: { days: "zondag maandag dinsdag woensdag donderdag vrijdag zaterdag".split(" "), shortDays: "zo ma di wo do vr za".split(" "), months: "januari februari maart april mei juni juli augustus september oktober november december".split(" "), shortMonths: "jan feb mrt apr mei jun jul aug sep okt nov dec".split(" "), AM: "AM", PM: "PM", am: "am", pm: "pm", formats: { c: "%a %d %b %Y %X %Z", D: "%d-%m-%y", F: "%Y-%m-%d", R: "%H:%M", r: "%I:%M:%S %p", T: "%H:%M:%S", v: "%e-%b-%Y", X: "%T", x: "%D" } }, pt_BR: { days: "domingo segunda ter\u00e7a quarta quinta sexta s\u00e1bado".split(" "), shortDays: "Dom Seg Ter Qua Qui Sex S\u00e1b".split(" "), months: "janeiro fevereiro mar\u00e7o abril maio junho julho agosto setembro outubro novembro dezembro".split(" "), shortMonths: "Jan Fev Mar Abr Mai Jun Jul Ago Set Out Nov Dez".split(" "), AM: "AM", PM: "PM", am: "am", pm: "pm", formats: { c: "%a %d %b %Y %X %Z", D: "%d-%m-%Y", F: "%Y-%m-%d", R: "%H:%M", r: "%I:%M:%S %p", T: "%H:%M:%S", v: "%e-%b-%Y", X: "%T", x: "%D" } }, ru_RU: { days: "\u0412\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435 \u041f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a \u0412\u0442\u043e\u0440\u043d\u0438\u043a \u0421\u0440\u0435\u0434\u0430 \u0427\u0435\u0442\u0432\u0435\u0440\u0433 \u041f\u044f\u0442\u043d\u0438\u0446\u0430 \u0421\u0443\u0431\u0431\u043e\u0442\u0430".split(" "), shortDays: "\u0412\u0441 \u041f\u043d \u0412\u0442 \u0421\u0440 \u0427\u0442 \u041f\u0442 \u0421\u0431".split(" "), months: "\u042f\u043d\u0432\u0430\u0440\u044c \u0424\u0435\u0432\u0440\u0430\u043b\u044c \u041c\u0430\u0440\u0442 \u0410\u043f\u0440\u0435\u043b\u044c \u041c\u0430\u0439 \u0418\u044e\u043d\u044c \u0418\u044e\u043b\u044c \u0410\u0432\u0433\u0443\u0441\u0442 \u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c \u041e\u043a\u0442\u044f\u0431\u0440\u044c \u041d\u043e\u044f\u0431\u0440\u044c \u0414\u0435\u043a\u0430\u0431\u0440\u044c".split(" "), shortMonths: "\u044f\u043d\u0432 \u0444\u0435\u0432 \u043c\u0430\u0440 \u0430\u043f\u0440 \u043c\u0430\u0439 \u0438\u044e\u043d \u0438\u044e\u043b \u0430\u0432\u0433 \u0441\u0435\u043d \u043e\u043a\u0442 \u043d\u043e\u044f \u0434\u0435\u043a".split(" "), AM: "AM", PM: "PM", am: "am", pm: "pm", formats: { c: "%a %d %b %Y %X", D: "%d.%m.%y", F: "%Y-%m-%d", R: "%H:%M", r: "%I:%M:%S %p", T: "%H:%M:%S", v: "%e-%b-%Y", X: "%T", x: "%D" } }, tr_TR: { days: "Pazar Pazartesi Sal\u0131 \u00c7ar\u015famba Per\u015fembe Cuma Cumartesi".split(" "), shortDays: "Paz Pzt Sal \u00c7r\u015f Pr\u015f Cum Cts".split(" "), months: "Ocak \u015eubat Mart Nisan May\u0131s Haziran Temmuz A\u011fustos Eyl\u00fcl Ekim Kas\u0131m Aral\u0131k".split(" "), shortMonths: "Oca \u015eub Mar Nis May Haz Tem A\u011fu Eyl Eki Kas Ara".split(" "), AM: "\u00d6\u00d6", PM: "\u00d6S", am: "\u00d6\u00d6", pm: "\u00d6S", formats: { c: "%a %d %b %Y %X %Z", D: "%d-%m-%Y", F: "%Y-%m-%d", R: "%H:%M", r: "%I:%M:%S %p", T: "%H:%M:%S", v: "%e-%b-%Y", X: "%T", x: "%D" } }, zh_CN: { days: "\u661f\u671f\u65e5 \u661f\u671f\u4e00 \u661f\u671f\u4e8c \u661f\u671f\u4e09 \u661f\u671f\u56db \u661f\u671f\u4e94 \u661f\u671f\u516d".split(" "), shortDays: "\u65e5\u4e00\u4e8c\u4e09\u56db\u4e94\u516d".split(""), months: "\u4e00\u6708\u4efd \u4e8c\u6708\u4efd \u4e09\u6708\u4efd \u56db\u6708\u4efd \u4e94\u6708\u4efd \u516d\u6708\u4efd \u4e03\u6708\u4efd \u516b\u6708\u4efd \u4e5d\u6708\u4efd \u5341\u6708\u4efd \u5341\u4e00\u6708\u4efd \u5341\u4e8c\u6708\u4efd".split(" "), shortMonths: "\u4e00\u6708 \u4e8c\u6708 \u4e09\u6708 \u56db\u6708 \u4e94\u6708 \u516d\u6708 \u4e03\u6708 \u516b\u6708 \u4e5d\u6708 \u5341\u6708 \u5341\u4e00\u6708 \u5341\u4e8c\u6708".split(" "), AM: "\u4e0a\u5348", PM: "\u4e0b\u5348", am: "\u4e0a\u5348", pm: "\u4e0b\u5348", formats: { c: "%a %d %b %Y %X %Z", D: "%d/%m/%y", F: "%Y-%m-%d", R: "%H:%M", r: "%I:%M:%S %p", T: "%H:%M:%S", v: "%e-%b-%Y", X: "%r", x: "%D" } } } , k = f.en_US , n = new a(k,0,!1); if ("undefined" !== typeof m) var l = m.exports = n; else l = function() { return this || (0, eval)("this") }(), l.strftime = n; "function" !== typeof Date.now && (Date.now = function() { return +new Date } ) } )() } , function(m, p, a) { (function() { var a = function(c, b, e) { return a.parse(c, b, e) }; a.version = "0.0.1"; (m.exports = a).strptime = a; a.locale = { a: "Sun Mon Tue Wed Thu Fri Sat".split(" "), A: "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "), b: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "), B: "January February March April May June July August September October November December".split(" "), f: "Jan. Feb. Mar. Apr. May Jun. Jul. Aug. Sep. Oct. Nov. Dec.".split(" "), c: "%Y-%m-%d %H:%M:%S", P: ["am", "pm"], r: "%I:%M:%S %p", x: "%m/%d/%y", X: "%H:%M:%S", day: ["Yesterday", "Today", "Tomorrow"], bg: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "), Bg: "January February March April May June July August September October November December".split(" "), fg: "Jan. Feb. Mar. Apr. May Jun. Jul. Aug. Sep. Oct. Nov. Dec.".split(" "), Date_dBY_year_in_HM: "%#B %-d, %Y at %-H:%M", Date_dBY_year: "%#B %-d, %Y", Date_dBY: "%#B %-d, %Y", Date_AdBY: "%A, %#B %-d, %Y", Date_dBA: "%#B %-d, %A", Date_df_in_HM: "%#f, %-d at %-H:%M", Date_dfY: "%-d %#f %Y", Date_dB_in_HM: "%#B %-d at %-H:%M", Date_df: "%-d %#f" }; (function(a) { function c(a, b, d, e, g, h) { b = String(b); d = String(d); b = b.replace(/^[#_0\^\-!~]+/, ""); e = f[b]; if (!e) return a; var k = !1; -1 === d.indexOf("!") && 1 === b.length && (-1 < d.indexOf("~") || -1 < "bBf".indexOf(b) && /%[0\-_]?d[\s]+$/.test(h.substr(0, g))) && (k = !0); if (("I" === b || "l" === b) && !/%[pP]/.test(h)) throw Error("Undefined AM/PM"); switch (typeof e) { case "function": return e(); case "string": return e; case "object": return c.make.push([e.make, d, k]), "(" + e.reg + ")"; default: return a } } function b(a, c) { a = String(a); c = String(c); return -1 !== c.indexOf("#") ? a.substr(0, 1).toUpperCase() + a.substr(1) : -1 !== c.indexOf("^") ? a.substr(0, 1) + a.substr(1).toLowerCase() : a } var h = Array.prototype.indexOf || function(a) { for (var c = this.length, b = 0; b < c; ) { if (a == this[b]) return b; b++ } return -1 } , g = a.locale , f = { "%": "\\%", a: "\\S+", A: "\\S+", b: { reg: "\\S+", make: function(a, c, d, f) { c = h.call(f ? g.bg : g.b, b(c, d)); if (-1 === c) return !1; a.setUTCMonth(c); return !0 } }, h: { reg: "\\S+", make: function(a, c, d, f) { c = h.call(f ? g.bg : g.b, b(c, d)); if (-1 === c) return !1; a.setUTCMonth(c); return !0 } }, B: { reg: "\\S+", make: function(a, c, d, f) { c = h.call(f ? g.Bg : g.B, b(c, d)); if (-1 === c) return !1; a.setUTCMonth(c); return !0 } }, f: { reg: "\\S+", make: function(a, c, d, f) { c = h.call(f ? g.fg : g.f, b(c, d)); if (-1 === c) return !1; a.setUTCMonth(c); return !0 } }, g: { reg: "[\\d\\s]?\\d", make: function(a, c) { c = parseInt(c, 10); if (0 > c || 99 < c) return !1; c += 100 * parseInt((new Date).getUTCFullYear() / 100, 10); a.setUTCFullYear(c); return !0 } }, G: { reg: "\\d{4}", make: function(a, c) { c = parseInt(c, 10); a.setUTCFullYear(c); return !0 } }, d: { reg: "[\\d\\s]?\\d", make: function(a, c) { c = parseInt(c, 10); if (1 > c || 31 < c) return !1; a.setUTCDate(c); return !0 } }, e: { reg: "[\\d\\s]?\\d", make: function(a, c) { c = parseInt(c, 10); if (1 > c || 31 < c) return !1; a.setUTCDate(c); return !0 } }, H: { reg: "[\\d\\s]?\\d", make: function(a, c) { c = parseInt(c, 10); if (0 > c || 23 < c) return !1; a.setUTCHours(c); return !0 } }, I: { reg: "[\\d\\s]?\\d", make: function(a, c) { c = parseInt(c, 10); if (1 > c || 12 < c) return !1; a.setUTCHours(a.getUTCHours() + c); return !0 } }, m: { reg: "[\\d\\s]?\\d", make: function(a, c) { c = parseInt(c, 10); if (1 > c || 12 < c) return !1; a.setUTCMonth(c - 1); return !0 } }, M: { reg: "[\\d\\s]?\\d", make: function(a, c) { c = parseInt(c, 10); if (0 > c || 59 < c) return !1; a.setUTCMinutes(c); return !0 } }, n: "\\n", p: { reg: "\\S+", make: function(a, c) { c = h.call(g.P, c.toLowerCase()); if (-1 === c) return !1; 1 === c && a.setUTCHours(a.getUTCHours() + 12); return !0 } }, P: { reg: "\\S+", make: function(a, c) { c = h.call(g.P, c.toLowerCase()); if (-1 === c) return !1; 1 === c && a.setUTCHours(a.getUTCHours() + 12); return !0 } }, S: { reg: "[\\d\\s]?\\d", make: function(a, c) { c = parseInt(c, 10); if (0 > c || 60 < c) return !1; a.setUTCSeconds(c); return !0 } }, t: "\\t", u: "\\d", U: "[\\d\\s]?\\d", w: "\\d", W: "[\\d\\s]?\\d", y: { reg: "[\\d\\s]?\\d", make: function(a, c) { c = parseInt(c, 10); if (0 > c || 99 < c) return !1; c += 100 * parseInt((new Date).getUTCFullYear() / 100, 10); a.setUTCFullYear(c); return !0 } }, Y: { reg: "\\d{4}", make: function(a, c) { c = parseInt(c, 10); a.setUTCFullYear(c); return !0 } }, z: { reg: "[+\\-]\\d{4}", make: function(a, c) { c = c.match(/^([+\-])(\d{2})(\d{2})$/); if (!c) return !1; var b = 6E4 * (60 * parseInt(c[2], 10) + parseInt(c[3], 10)); "+" === c[1] && (b = -b); a.setTime(a.getTime() + b); return !0 } }, l: { reg: "[\\d\\s]?\\d", make: function(a, c) { c = parseInt(c, 10); if (1 > c || 12 < c) return !1; a.setUTCHours(a.getUTCHours() + c); return !0 } }, s: { reg: "\\d+", make: function(a, c) { c = parseInt(c, 10); a.setTime(1E3 * c); return !0 } }, c: g.c, r: g.r, R: "%H:%M", T: "%H:%M:%S", x: g.x, X: g.X, D: "%m/%d/%y", F: "%Y-%m-%d", Date_iso: "%Y-%m-%dT%H:%M:%S", Date_dBY_year_in_HM: g.Date_dBY_year_in_HM, Date_dBY_year: g.Date_dBY_year, Date_dBY: g.Date_dBY, Date_dBA: g.Date_dBA, Date_AdBY: g.Date_AdBY, Date_df_in_HM: g.Date_df_in_HM, Date_dfY: g.Date_dfY, Date_dB_in_HM: g.Date_dB_in_HM, Date_dmY__dot: "%d.%m.%Y", Date_df: g.Date_df, Date_FT: "%F %T", Date_dmY__minus: "%d-%m-%Y" }; a.parse = function(a, b, d) { a = String(a); b = String(b); for (var f = 5; /%(Date_[a-zA-Z0-9_]+|[cDFrRTxX])/g.test(b) && f; ) b = b.replace(/%(Date_[a-zA-Z0-9_]+|[cDFrRTxX])/, c), f--; c.make = []; b = b.replace(/%(([#\^!~]{0,2})[aAbBfh]|([0\-_]?)[degHImMSVWyl]|[GnpPtuUwYzZs%])/g, c); a = a.match(new RegExp(b)); if (!a || !c.make.length) return null; b = new Date(Date.UTC(0, 0)); f = 0; for (var e = c.make.length; f < e; f++) { var g = c.make[f]; if (!g[0](b, a[f + 1], g[1], g[2])) return null } d && b.setTime(b.getTime() + 6E4 * b.getTimezoneOffset()); return b } } )(a) } )() } , function(m, p, a) { (function(a, c) { (function(a, b) { function d(a) { delete y[a] } function e(a) { if (t) setTimeout(e, 0, a); else { var c = y[a]; if (c) { t = !0; try { var f = c.callback , g = c.args; switch (g.length) { case 0: f(); break; case 1: f(g[0]); break; case 2: f(g[0], g[1]); break; case 3: f(g[0], g[1], g[2]); break; default: f.apply(b, g) } } finally { d(a), t = !1 } } } } function f() { m = function(a) { c.nextTick(function() { e(a) }) } } function k() { if (a.postMessage && !a.importScripts) { var c = !0 , b = a.onmessage; a.onmessage = function() { c = !1 } ; a.postMessage("", "*"); a.onmessage = b; return c } } function n() { var c = "setImmediate$" + Math.random() + "$" , b = function(b) { b.source === a && "string" === typeof b.data && 0 === b.data.indexOf(c) && e(+b.data.slice(c.length)) }; a.addEventListener ? a.addEventListener("message", b, !1) : a.attachEvent("onmessage", b); m = function(b) { a.postMessage(c + b, "*") } } function l() { var a = new MessageChannel; a.port1.onmessage = function(a) { e(a.data) } ; m = function(c) { a.port2.postMessage(c) } } function q() { var a = H.documentElement; m = function(c) { var b = H.createElement("script"); b.onreadystatechange = function() { e(c); b.onreadystatechange = null; a.removeChild(b); b = null } ; a.appendChild(b) } } function u() { m = function(a) { setTimeout(e, 0, a) } } if (!a.setImmediate) { var z = 1, y = {}, t = !1, H = a.document, m, C = Object.getPrototypeOf && Object.getPrototypeOf(a); C = C && C.setTimeout ? C : a; "[object process]" === {}.toString.call(a.process) ? f() : k() ? n() : a.MessageChannel ? l() : H && "onreadystatechange"in H.createElement("script") ? q() : u(); C.setImmediate = function(a) { "function" !== typeof a && (a = new Function("" + a)); for (var c = Array(arguments.length - 1), b = 0; b < c.length; b++) c[b] = arguments[b + 1]; y[z] = { callback: a, args: c }; m(z); return z++ } ; C.clearImmediate = d } } )("undefined" === typeof self ? "undefined" === typeof a ? this : a : self) } ).call(this, a(0), a(6)) } , function(m, p) { function a() { throw Error("setTimeout has not been defined"); } function b() { throw Error("clearTimeout has not been defined"); } function c(c) { if (k === setTimeout) return setTimeout(c, 0); if ((k === a || !k) && setTimeout) return k = setTimeout, setTimeout(c, 0); try { return k(c, 0) } catch (t) { try { return k.call(null, c, 0) } catch (H) { return k.call(this, c, 0) } } } function d(a) { if (n === clearTimeout) return clearTimeout(a); if ((n === b || !n) && clearTimeout) return n = clearTimeout, clearTimeout(a); try { return n(a) } catch (t) { try { return n.call(null, a) } catch (H) { return n.call(this, a) } } } function e() { q && u && (q = !1, u.length ? l = u.concat(l) : z = -1, l.length && h()) } function h() { if (!q) { var a = c(e); q = !0; for (var b = l.length; b; ) { u = l; for (l = []; ++z < b; ) u && u[z].run(); z = -1; b = l.length } u = null; q = !1; d(a) } } function g(a, c) { this.fun = a; this.array = c } function f() {} m = m.exports = {}; try { var k = "function" === typeof setTimeout ? setTimeout : a } catch (y) { k = a } try { var n = "function" === typeof clearTimeout ? clearTimeout : b } catch (y) { n = b } var l = [], q = !1, u, z = -1; m.nextTick = function(a) { var b = Array(arguments.length - 1); if (1 < arguments.length) for (var d = 1; d < arguments.length; d++) b[d - 1] = arguments[d]; l.push(new g(a,b)); 1 !== l.length || q || c(h) } ; g.prototype.run = function() { this.fun.apply(null, this.array) } ; m.title = "browser"; m.browser = !0; m.env = {}; m.argv = []; m.version = ""; m.versions = {}; m.on = f; m.addListener = f; m.once = f; m.off = f; m.removeListener = f; m.removeAllListeners = f; m.emit = f; m.prependListener = f; m.prependOnceListener = f; m.listeners = function(a) { return [] } ; m.binding = function(a) { throw Error("process.binding is not supported"); } ; m.cwd = function() { return "/" } ; m.chdir = function(a) { throw Error("process.chdir is not supported"); } ; m.umask = function() { return 0 } } , function(m, p) { Sk.asserts = {}; Sk.asserts.assert = function(a, b) { return a } ; Sk.exportSymbol("Sk.asserts.assert", Sk.asserts.assert); Sk.asserts.fail = function(a) {} ; Sk.exportSymbol("Sk.asserts.fail", Sk.asserts.fail) } , function(m, p) { Sk.bool_check = function(a, b) { if (void 0 === a || null === a || "boolean" !== typeof a) throw Error("must specify " + b + " and it must be a boolean"); } ; Sk.python2 = { print_function: !1, division: !1, absolute_import: null, unicode_literals: !1, python3: !1, class_repr: !1, inherit_from_object: !1, super_args: !1, octal_number_literal: !1, bankers_rounding: !1, python_version: !1, dunder_round: !1, exceptions: !1, no_long_type: !1, ceil_floor_int: !1, silent_octal_literal: !0 }; Sk.python3 = { print_function: !0, division: !0, absolute_import: null, unicode_literals: !0, python3: !0, class_repr: !0, inherit_from_object: !0, super_args: !0, octal_number_literal: !0, bankers_rounding: !0, python_version: !0, dunder_round: !0, exceptions: !0, no_long_type: !0, ceil_floor_int: !0, silent_octal_literal: !1 }; Sk.configure = function(a) { Sk.output = a.output || Sk.output; Sk.asserts.assert("function" === typeof Sk.output); Sk.debugout = a.debugout || Sk.debugout; Sk.asserts.assert("function" === typeof Sk.debugout); Sk.uncaughtException = a.uncaughtException || Sk.uncaughtException; Sk.asserts.assert("function" === typeof Sk.uncaughtException); Sk.read = a.read || Sk.read; Sk.asserts.assert("function" === typeof Sk.read); Sk.nonreadopen = a.nonreadopen || !1; Sk.asserts.assert("boolean" === typeof Sk.nonreadopen); Sk.fileopen = a.fileopen || void 0; Sk.asserts.assert("function" === typeof Sk.fileopen || "undefined" === typeof Sk.fileopen); Sk.filewrite = a.filewrite || void 0; Sk.asserts.assert("function" === typeof Sk.filewrite || "undefined" === typeof Sk.filewrite); Sk.timeoutMsg = a.timeoutMsg || Sk.timeoutMsg; Sk.asserts.assert("function" === typeof Sk.timeoutMsg); Sk.exportSymbol("Sk.timeoutMsg", Sk.timeoutMsg); Sk.sysargv = a.sysargv || Sk.sysargv; Sk.asserts.assert(Sk.isArrayLike(Sk.sysargv)); Sk.__future__ = a.__future__ || Sk.python2; Sk.bool_check(Sk.__future__.print_function, "Sk.__future__.print_function"); Sk.bool_check(Sk.__future__.division, "Sk.__future__.division"); Sk.bool_check(Sk.__future__.unicode_literals, "Sk.__future__.unicode_literals"); Sk.bool_check(Sk.__future__.class_repr, "Sk.__future__.class_repr"); Sk.bool_check(Sk.__future__.inherit_from_object, "Sk.__future__.inherit_from_object"); Sk.bool_check(Sk.__future__.super_args, "Sk.__future__.super_args"); Sk.bool_check(Sk.__future__.octal_number_literal, "Sk.__future__.octal_number_literal"); Sk.bool_check(Sk.__future__.bankers_rounding, "Sk.__future__.bankers_rounding"); Sk.bool_check(Sk.__future__.python_version, "Sk.__future__.python_version"); Sk.bool_check(Sk.__future__.dunder_round, "Sk.__future__.dunder_round"); Sk.bool_check(Sk.__future__.exceptions, "Sk.__future__.exceptions"); Sk.bool_check(Sk.__future__.no_long_type, "Sk.__future__.no_long_type"); Sk.bool_check(Sk.__future__.ceil_floor_int, "Sk.__future__.ceil_floor_int"); Sk.bool_check(Sk.__future__.silent_octal_literal, "Sk.__future__.silent_octal_literal"); Sk.imageProxy = a.imageProxy || "http://localhost:8080/320x"; Sk.asserts.assert("string" === typeof Sk.imageProxy || "function" === typeof Sk.imageProxy); Sk.inputfun = a.inputfun || Sk.inputfun; Sk.asserts.assert("function" === typeof Sk.inputfun); Sk.inputfunTakesPrompt = a.inputfunTakesPrompt || !1; Sk.asserts.assert("boolean" === typeof Sk.inputfunTakesPrompt); Sk.retainGlobals = a.retainglobals || a.retainGlobals || !1; Sk.asserts.assert("boolean" === typeof Sk.retainGlobals); Sk.debugging = a.debugging || !1; Sk.asserts.assert("boolean" === typeof Sk.debugging); Sk.killableWhile = a.killableWhile || !1; Sk.asserts.assert("boolean" === typeof Sk.killableWhile); Sk.killableFor = a.killableFor || !1; Sk.asserts.assert("boolean" === typeof Sk.killableFor); Sk.signals = a.signals; Sk.signals = !0 === Sk.signals ? { listeners: [], addEventListener: function(a) { Sk.signals.listeners.push(a) }, removeEventListener: function(a) { a = Sk.signals.listeners.indexOf(a); 0 <= a && Sk.signals.listeners.splice(a, 1) }, signal: function(a, c) { for (var b = 0; b < Sk.signals.listeners.length; b++) Sk.signals.listeners[b].call(null, a, c) } } : null; Sk.asserts.assert("object" === typeof Sk.signals); Sk.breakpoints = a.breakpoints || function() { return !0 } ; Sk.asserts.assert("function" === typeof Sk.breakpoints); Sk.setTimeout = a.setTimeout; void 0 === Sk.setTimeout && (Sk.setTimeout = "function" === typeof setTimeout ? function(a, c) { setTimeout(a, c) } : function(a, c) { a() } ); Sk.asserts.assert("function" === typeof Sk.setTimeout); "execLimit"in a && (Sk.execLimit = a.execLimit); "yieldLimit"in a && (Sk.yieldLimit = a.yieldLimit); a.syspath && (Sk.syspath = a.syspath, Sk.asserts.assert(Sk.isArrayLike(Sk.syspath)), Sk.realsyspath = void 0, Sk.sysmodules = new Sk.builtin.dict([])); Sk.misceval.softspace_ = !1; Sk.switch_version("round$", Sk.__future__.dunder_round); Sk.switch_version("next$", Sk.__future__.python3); Sk.switch_version("haskey$", Sk.__future__.python3); Sk.switch_version("clear$", Sk.__future__.python3); Sk.switch_version("copy$", Sk.__future__.python3); Sk.builtin.lng.prototype.tp$name = Sk.__future__.no_long_type ? "int" : "long"; Sk.builtin.lng.prototype.ob$type = Sk.__future__.no_long_type ? Sk.builtin.int_ : Sk.builtin.lng; Sk.builtin.str.$next = Sk.__future__.python3 ? new Sk.builtin.str("__next__") : new Sk.builtin.str("next"); Sk.setupOperators(Sk.__future__.python3); Sk.setupDunderMethods(Sk.__future__.python3); Sk.__future__.python3 ? (Sk.builtin.dict.prototype.keys = new Sk.builtin.func(Sk.builtin.dict.prototype.py3$keys), Sk.builtin.dict.prototype.values = new Sk.builtin.func(Sk.builtin.dict.prototype.py3$values), Sk.builtin.dict.prototype.items = new Sk.builtin.func(Sk.builtin.dict.prototype.py3$items)) : (Sk.builtin.dict.prototype.keys = new Sk.builtin.func(Sk.builtin.dict.prototype.py2$keys), Sk.builtin.dict.prototype.values = new Sk.builtin.func(Sk.builtin.dict.prototype.py2$values), Sk.builtin.dict.prototype.items = new Sk.builtin.func(Sk.builtin.dict.prototype.py2$items)); Sk.setupObjects(Sk.__future__.python3) } ; Sk.exportSymbol("Sk.configure", Sk.configure); Sk.uncaughtException = function(a) { throw a; } ; Sk.uncaughtException = function(a) { throw a; } ; Sk.exportSymbol("Sk.uncaughtException", Sk.uncaughtException); Sk.timeoutMsg = function() { return "Program exceeded run time limit." } ; Sk.exportSymbol("Sk.timeoutMsg", Sk.timeoutMsg); Sk.execLimit = Number.POSITIVE_INFINITY; Sk.yieldLimit = Number.POSITIVE_INFINITY; Sk.output = function(a) {} ; Sk.read = function(a) { if (void 0 === Sk.builtinFiles) throw "skulpt-stdlib.js has not been loaded"; if (void 0 === Sk.builtinFiles.files[a]) throw "File not found: '" + a + "'"; return Sk.builtinFiles.files[a] } ; Sk.sysargv = []; Sk.getSysArgv = function() { return Sk.sysargv } ; Sk.exportSymbol("Sk.getSysArgv", Sk.getSysArgv); Sk.syspath = []; Sk.inBrowser = void 0 !== Sk.global.document; Sk.debugout = function(a) {} ; (function() { void 0 !== Sk.global.write ? Sk.output = Sk.global.write : void 0 !== Sk.global.console && void 0 !== Sk.global.console.log ? Sk.output = function(a) { Sk.global.console.log(a) } : void 0 !== Sk.global.print && (Sk.output = Sk.global.print); void 0 !== Sk.global.console && void 0 !== Sk.global.console.log ? Sk.debugout = function(a) { Sk.global.console.log(a) } : void 0 !== Sk.global.print && (Sk.debugout = Sk.global.print) } )(); Sk.inputfun = function(a) { return window.prompt(a) } ; Sk.setup_method_mappings = function() { return { round$: { classes: [Sk.builtin.float_, Sk.builtin.int_, Sk.builtin.nmber], 2: null, 3: "__round__" }, clear$: { classes: [Sk.builtin.list], 2: null, 3: "clear" }, copy$: { classes: [Sk.builtin.list], 2: null, 3: "copy" }, next$: { classes: [Sk.builtin.dict_iter_, Sk.builtin.list_iter_, Sk.builtin.set_iter_, Sk.builtin.str_iter_, Sk.builtin.tuple_iter_, Sk.builtin.generator, Sk.builtin.enumerate, Sk.builtin.filter_, Sk.builtin.zip_, Sk.builtin.map_, Sk.builtin.iterator], 2: "next", 3: "__next__" }, haskey$: { classes: [Sk.builtin.dict], 2: "has_key", 3: null } } } ; Sk.switch_version = function(a, b) { var c; var d = Sk.setup_method_mappings()[a]; if (b) { b = d[3]; var e = d[2] } else b = d[2], e = d[3]; var h = d.classes; var g = h.length; for (c = 0; c < g; c++) d = h[c], e && d.prototype.hasOwnProperty(e) && delete d.prototype[e], b && (d.prototype[b] = new Sk.builtin.func(d.prototype[a])) } ; Sk.exportSymbol("Sk.__future__", Sk.__future__); Sk.exportSymbol("Sk.inputfun", Sk.inputfun) } , function(m, p) { void 0 === Sk.builtin && (Sk.builtin = {}); Sk.dunderToSkulpt = { __eq__: "ob$eq", __ne__: "ob$ne", __lt__: "ob$lt", __le__: "ob$le", __gt__: "ob$gt", __ge__: "ob$ge", __hash__: "tp$hash", __abs__: "nb$abs", __neg__: "nb$negative", __pos__: "nb$positive", __int__: "nb$int_", __long__: "nb$lng", __float__: "nb$float_", __add__: "nb$add", __radd__: "nb$reflected_add", __sub__: "nb$subtract", __rsub__: "nb$reflected_subtract", __mul__: "nb$multiply", __rmul__: "nb$reflected_multiply", __div__: "nb$divide", __rdiv__: "nb$reflected_divide", __floordiv__: "nb$floor_divide", __rfloordiv__: "nb$reflected_floor_divide", __invert__: "nb$invert", __mod__: "nb$remainder", __rmod__: "nb$reflected_remainder", __divmod__: "nb$divmod", __rdivmod__: "nb$reflected_divmod", __pow__: "nb$power", __rpow__: "nb$reflected_power", __contains__: "sq$contains", __iter__: "tp$iter", __bool__: ["nb$bool", 1], __nonzero__: ["nb$nonzero", 1], __len__: ["sq$length", 1], __get__: ["tp$descr_get", 3], __set__: ["tp$descr_set", 3] }; Sk.setupDunderMethods = function(a) { a ? (Sk.dunderToSkulpt.__matmul__ = "tp$matmul", Sk.dunderToSkulpt.__rmatmul__ = "tp$reflected_matmul") : (Sk.dunderToSkulpt.__matmul__ && delete Sk.dunderToSkulpt.__matmul__, Sk.dunderToSkulpt.__rmatmul__ && delete Sk.dunderToSkulpt.__rmatmul__) } ; Sk.exportSymbol("Sk.setupDunderMethods", Sk.setupDunderMethods); Sk.builtin.type = function(a, b, c) { if (void 0 === b && void 0 === c) return a.ob$type; { if ("dict" !== c.tp$name) throw new Sk.builtin.TypeError("type() argument 3 must be dict, not " + Sk.abstr.typeName(c)); if (!Sk.builtin.checkString(a)) throw new Sk.builtin.TypeError("type() argument 1 must be str, not " + Sk.abstr.typeName(a)); if ("tuple" !== b.tp$name) throw new Sk.builtin.TypeError("type() argument 2 must be tuple, not " + Sk.abstr.typeName(b)); var d = function(a, c) { void 0 !== d.prototype.tp$base && (d.prototype.tp$base.sk$klass ? d.prototype.tp$base.call(this, a, c) : (a = a.slice(), a.unshift(d, this), Sk.abstr.superConstructor.apply(void 0, a))); this.$d = new Sk.builtin.dict([]) }; var e = Sk.ffi.remapToJs(a); var h = !1; d.tp$call = function(a, c) { var b = Sk.builtin.type.typeLookup(d, Sk.builtin.str.$new); a = a || []; c = c || []; if (void 0 === b || b === Sk.builtin.object.prototype.__new__) { var f = new d(a,c); b = void 0 } else { var e = a.slice(); e.unshift(d); f = Sk.misceval.applyOrSuspend(b, void 0, void 0, c, e) } return Sk.misceval.chain(f, function(d) { var e = Sk.builtin.type.typeLookup(d.ob$type, Sk.builtin.str.$init); f = d; if (void 0 !== e) return a.unshift(f), Sk.misceval.applyOrSuspend(e, void 0, void 0, c, a); if (void 0 === b && (0 !== a.length || 0 !== c.length) && !h) throw new Sk.builtin.TypeError("__init__() got unexpected argument(s)"); }, function(a) { if (a !== Sk.builtin.none.none$ && void 0 !== a) throw new Sk.builtin.TypeError("__init__() should return None, not " + Sk.abstr.typeName(a)); return f }) } ; 0 === b.v.length && Sk.__future__.inherit_from_object && (b.v.push(Sk.builtin.object), Sk.abstr.setUpInheritance(e, d, Sk.builtin.object)); var g, f, k = []; var n = b.tp$iter(); for (g = n.tp$iternext(); void 0 !== g; g = n.tp$iternext()) { for (void 0 === f && (f = g); g.sk$klass && g.prototype.tp$base; ) g = g.prototype.tp$base; !g.sk$klass && 0 > k.indexOf(g) && (k.push(g), h = !0) } if (1 < k.length) throw new Sk.builtin.TypeError("Multiple inheritance with more than one builtin type is unsupported"); void 0 !== f && (Sk.abstr.inherits(d, f), f.prototype instanceof Sk.builtin.object || f === Sk.builtin.object) && (d.prototype.tp$base = f); d.prototype.tp$name = e; d.prototype.ob$type = Sk.builtin.type.makeIntoTypeObj(e, d); void 0 === c.mp$lookup(Sk.builtin.str.$module) && c.mp$ass_subscript(Sk.builtin.str.$module, Sk.globals.__name__); n = c.tp$iter(); for (g = n.tp$iternext(); void 0 !== g; g = n.tp$iternext()) e = c.mp$subscript(g), void 0 === e && (e = null), d.prototype[g.v] = e, d[g.v] = e; d.__class__ = d; d.__name__ = a; d.sk$klass = !0; d.prototype.hp$type = !0; d.prototype.$r = function() { const a = Sk.abstr.lookupSpecial(this, Sk.builtin.str.$repr); return void 0 !== a && a !== Sk.builtin.object.prototype.__repr__ ? Sk.misceval.callsimArray(a, [this]) : void 0 !== d.prototype.tp$base && void 0 !== d.prototype.tp$base.prototype.$r ? d.prototype.tp$base.prototype.$r.call(this) : Sk.builtin.object.prototype.$r.call(this) } ; d.prototype.tp$setattr = function(a, c, b) { var d = Sk.builtin.object.prototype.GenericGetAttr.call(this, Sk.builtin.str.$setattr); return void 0 !== d ? (a = Sk.misceval.callsimOrSuspendArray(d, [a, c]), b ? a : Sk.misceval.retryOptionalSuspensionOrThrow(a)) : Sk.builtin.object.prototype.GenericSetAttr.call(this, a, c, b) } ; d.prototype.tp$str = function() { const a = Sk.abstr.lookupSpecial(this, Sk.builtin.str.$str); return void 0 !== a && a !== Sk.builtin.object.prototype.__str__ ? Sk.misceval.callsimArray(a, [this]) : void 0 !== d.prototype.tp$base && d.prototype.tp$base !== Sk.builtin.object && void 0 !== d.prototype.tp$base.prototype.tp$str ? d.prototype.tp$base.prototype.tp$str.call(this) : this.$r() } ; d.prototype.tp$length = function(a) { var c = Sk.misceval.chain(Sk.abstr.gattr(this, Sk.builtin.str.$len, a), function(a) { return Sk.misceval.applyOrSuspend(a, void 0, void 0, void 0, []) }); return a ? c : Sk.misceval.retryOptionalSuspensionOrThrow(c) } ; d.prototype.tp$call = function(a, c) { return Sk.misceval.chain(this.tp$getattr(Sk.builtin.str.$call, !0), function(b) { if (void 0 === b) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(this) + "' object is not callable"); return Sk.misceval.applyOrSuspend(b, void 0, void 0, c, a) }) } ; const q = c.mp$lookup(Sk.builtin.str.$next); void 0 !== q && (d.prototype.tp$iternext = function(a) { const c = this , b = Sk.misceval.tryCatch(()=>Sk.misceval.callsimOrSuspendArray(q, [c]), a=>{ if (!(a instanceof Sk.builtin.StopIteration)) throw a; } ); return a ? b : Sk.misceval.retryOptionalSuspensionOrThrow(b) } ); d.prototype.tp$getitem = function(a, c) { var b = this.tp$getattr(Sk.builtin.str.$getitem, c); if (void 0 !== b) return a = Sk.misceval.applyOrSuspend(b, void 0, void 0, void 0, [a]), c ? a : Sk.misceval.retryOptionalSuspensionOrThrow(a); throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(this) + "' object does not support indexing"); } ; d.prototype.tp$setitem = function(a, c, b) { var d = this.tp$getattr(Sk.builtin.str.$setitem, b); if (void 0 !== d) return a = Sk.misceval.applyOrSuspend(d, void 0, void 0, void 0, [a, c]), b ? a : Sk.misceval.retryOptionalSuspensionOrThrow(a); throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(this) + "' object does not support item assignment"); } ; b && (d.$d = new Sk.builtin.dict([]), d.$d.mp$ass_subscript(Sk.builtin.type.basesStr_, b), a = Sk.builtin.type.buildMRO(d), d.$d.mp$ass_subscript(Sk.builtin.type.mroStr_, a), d.tp$mro = a); d.tp$setattr = Sk.builtin.type.prototype.tp$setattr; for (var l in Sk.dunderToSkulpt) d.hasOwnProperty(l) && Sk.builtin.type.$allocateSlot(d, l); let u = Sk.builtin.type.typeLookup(d, Sk.builtin.str.$getattribute); void 0 !== u && u !== Sk.builtin.object.prototype.__getattribute__ ? d.prototype.tp$getattr = function(a, c) { let b = Sk.misceval.tryCatch(()=>Sk.misceval.callsimOrSuspendArray(u, [this, a]), function(a) { if (!(a instanceof Sk.builtin.AttributeError)) throw a; }); return c ? b : Sk.misceval.retryOptionalSuspensionOrThrow(b) } : d.prototype.tp$getattr || (d.prototype.tp$getattr = Sk.builtin.object.prototype.GenericGetAttr); return d } } ; Object.defineProperties(Sk.builtin.type.prototype, { call: { value: Function.prototype.call }, apply: { value: Function.prototype.apply }, ob$type: { value: Sk.builtin.type, writable: !0 }, tp$name: { value: "type", writable: !0 }, tp$base: { value: Sk.builtin.object, writable: !0 }, sk$type: { value: !0 } }); Sk.builtin.type.makeTypeObj = function(a, b) { Sk.builtin.type.makeIntoTypeObj(a, b); return b } ; Sk.builtin.type.makeIntoTypeObj = function(a, b) { Sk.asserts.assert(void 0 !== a); Sk.asserts.assert(void 0 !== b); Object.setPrototypeOf(b, Sk.builtin.type.prototype); return b } ; Sk.builtin.type.prototype.$r = function() { let a = this.prototype.__module__ , b = "" , c = "class"; a && Sk.builtin.checkString(a) ? b = a.v + "." : a = null; a || this.sk$klass || Sk.__future__.class_repr || (c = "type"); return new Sk.builtin.str("<" + c + " '" + b + this.prototype.tp$name + "'>") } ; Sk.builtin.type.prototype.tp$getattr = function(a, b) { if (this.$d) { var c = this.$d.mp$lookup(a); if (void 0 !== c) return c } a = Sk.builtin.type.typeLookup(this, a); if (void 0 !== a && null !== a && void 0 !== a.ob$type) var d = a.tp$descr_get; if (d) return d.call(a, Sk.builtin.none.none$, this, b); if (void 0 !== a) return a } ; Sk.builtin.type.prototype.tp$setattr = function(a, b) { if (void 0 === this.sk$klass) throw new Sk.builtin.TypeError("can't set attributes of built-in/extension type '" + this.prototype.tp$name + "'"); a = Sk.fixReserved(a.$jsstr()); this[a] = b; this.prototype[a] = b; a in Sk.dunderToSkulpt && Sk.builtin.type.$allocateSlot(this, a) } ; Sk.builtin.type.typeLookup = function(a, b) { var c = a.tp$mro, d, e = b.$mangled; if (c) for (d = 0; d < c.v.length; ++d) { a = c.v[d]; if (a.hasOwnProperty(e)) return a[e]; var h = a.$d.mp$lookup(b); if (void 0 !== h) return h; if (a.prototype && void 0 !== a.prototype[e]) return a.prototype[e] } else if (a.prototype) return a.prototype[e] } ; Sk.builtin.type.mroMerge_ = function(a) { for (var b, c, d, e, h, g, f = []; ; ) { for (c = 0; c < a.length && (b = a[c], 0 === b.length); ++c) ; if (c === a.length) return f; d = []; for (c = 0; c < a.length; ++c) if (b = a[c], 0 !== b.length) { g = b[0]; h = 0; a: for (; h < a.length; ++h) for (e = a[h], b = 1; b < e.length; ++b) if (e[b] === g) break a; h === a.length && d.push(g) } if (0 === d.length) throw new Sk.builtin.TypeError("Inconsistent precedences in type hierarchy"); d = d[0]; f.push(d); for (c = 0; c < a.length; ++c) b = a[c], 0 < b.length && b[0] === d && b.splice(0, 1) } } ; Sk.builtin.type.buildMRO_ = function(a) { var b = [[a]] , c = a.$d.mp$subscript(Sk.builtin.type.basesStr_); for (a = 0; a < c.v.length; ++a) b.push(Sk.builtin.type.buildMRO_(c.v[a])); var d = []; for (a = 0; a < c.v.length; ++a) d.push(c.v[a]); b.push(d); return Sk.builtin.type.mroMerge_(b) } ; Sk.builtin.type.buildMRO = function(a) { return new Sk.builtin.tuple(Sk.builtin.type.buildMRO_(a)) } ; Sk.builtin.type.prototype.__format__ = function(a, b) { Sk.builtin.pyCheckArgsLen("__format__", arguments.length, 1, 2); return new Sk.builtin.str(a) } ; Sk.builtin.type.pythonFunctions = ["__format__"]; Sk.builtin.type.$allocateSlot = function(a, b) { const c = a[b]; b = Sk.dunderToSkulpt[b]; if ("string" === typeof b) a.prototype[b] = function() { let a, b, h; a = arguments.length; b = Array(a + 1); b[0] = this; for (h = 0; h < a; h++) b[h + 1] = arguments[h]; return Sk.misceval.callsimArray(c, b) } ; else { let d = b[1]; b = b[0]; a.prototype[b] = function() { let a, b, g, f, k = !1; a = arguments.length; b = d <= a ? Array(a) : Array(a + 1); b[0] = this; f = 1; for (g = 0; g < a; g++) g === d - 1 ? k = arguments[g] : (b[f] = arguments[g], f += 1); return k ? Sk.misceval.callsimOrSuspendArray(c, b) : Sk.misceval.callsimArray(c, b) } } } } , function(m, p) { Sk.abstr = {}; Sk.abstr.typeName = function(a) { return void 0 !== a.tp$name ? a.tp$name : "" } ; Sk.abstr.binop_type_error = function(a, b, c) { a = Sk.abstr.typeName(a); b = Sk.abstr.typeName(b); throw new Sk.builtin.TypeError("unsupported operand type(s) for " + c + ": '" + a + "' and '" + b + "'"); } ; Sk.abstr.unop_type_error = function(a, b) { a = Sk.abstr.typeName(a); throw new Sk.builtin.TypeError("bad operand type for unary " + { UAdd: "+", USub: "-", Invert: "~" }[b] + ": '" + a + "'"); } ; Sk.abstr.boNameToSlotFuncLhs_ = function(a, b) { if (null !== a) switch (b) { case "Add": return a.nb$add ? a.nb$add : a.__add__; case "Sub": return a.nb$subtract ? a.nb$subtract : a.__sub__; case "Mult": return a.nb$multiply ? a.nb$multiply : a.__mul__; case "MatMult": if (Sk.__future__.python3) return a.tp$matmul ? a.tp$matmul : a.__matmul__; case "Div": return a.nb$divide ? a.nb$divide : a.__div__; case "FloorDiv": return a.nb$floor_divide ? a.nb$floor_divide : a.__floordiv__; case "Mod": return a.nb$remainder ? a.nb$remainder : a.__mod__; case "DivMod": return a.nb$divmod ? a.nb$divmod : a.__divmod__; case "Pow": return a.nb$power ? a.nb$power : a.__pow__; case "LShift": return a.nb$lshift ? a.nb$lshift : a.__lshift__; case "RShift": return a.nb$rshift ? a.nb$rshift : a.__rshift__; case "BitAnd": return a.nb$and ? a.nb$and : a.__and__; case "BitXor": return a.nb$xor ? a.nb$xor : a.__xor__; case "BitOr": return a.nb$or ? a.nb$or : a.__or__ } } ; Sk.abstr.boNameToSlotFuncRhs_ = function(a, b) { if (null !== a) switch (b) { case "Add": return a.nb$reflected_add ? a.nb$reflected_add : a.__radd__; case "Sub": return a.nb$reflected_subtract ? a.nb$reflected_subtract : a.__rsub__; case "Mult": return a.nb$reflected_multiply ? a.nb$reflected_multiply : a.__rmul__; case "MatMult": if (Sk.__future__.python3) return a.tp$reflected_matmul ? a.tp$reflected_matmul : a.__rmatmul__; case "Div": return a.nb$reflected_divide ? a.nb$reflected_divide : a.__rdiv__; case "FloorDiv": return a.nb$reflected_floor_divide ? a.nb$reflected_floor_divide : a.__rfloordiv__; case "Mod": return a.nb$reflected_remainder ? a.nb$reflected_remainder : a.__rmod__; case "DivMod": return a.nb$reflected_divmod ? a.nb$reflected_divmod : a.__rdivmod__; case "Pow": return a.nb$reflected_power ? a.nb$reflected_power : a.__rpow__; case "LShift": return a.nb$reflected_lshift ? a.nb$reflected_lshift : a.__rlshift__; case "RShift": return a.nb$reflected_rshift ? a.nb$reflected_rshift : a.__rrshift__; case "BitAnd": return a.nb$reflected_and ? a.nb$reflected_and : a.__rand__; case "BitXor": return a.nb$reflected_xor ? a.nb$reflected_xor : a.__rxor__; case "BitOr": return a.nb$reflected_or ? a.nb$reflected_or : a.__ror__ } } ; Sk.abstr.iboNameToSlotFunc_ = function(a, b) { switch (b) { case "Add": return a.nb$inplace_add ? a.nb$inplace_add : a.__iadd__; case "Sub": return a.nb$inplace_subtract ? a.nb$inplace_subtract : a.__isub__; case "Mult": return a.nb$inplace_multiply ? a.nb$inplace_multiply : a.__imul__; case "MatMult": if (Sk.__future__.python3) return a.tp$inplace_matmul ? a.tp$inplace_matmul : a.__imatmul__; case "Div": return a.nb$inplace_divide ? a.nb$inplace_divide : a.__idiv__; case "FloorDiv": return a.nb$inplace_floor_divide ? a.nb$inplace_floor_divide : a.__ifloordiv__; case "Mod": return a.nb$inplace_remainder; case "Pow": return a.nb$inplace_power; case "LShift": return a.nb$inplace_lshift ? a.nb$inplace_lshift : a.__ilshift__; case "RShift": return a.nb$inplace_rshift ? a.nb$inplace_rshift : a.__irshift__; case "BitAnd": return a.nb$inplace_and; case "BitOr": return a.nb$inplace_or; case "BitXor": return a.nb$inplace_xor ? a.nb$inplace_xor : a.__ixor__ } } ; Sk.abstr.uoNameToSlotFunc_ = function(a, b) { if (null !== a) switch (b) { case "USub": return a.nb$negative ? a.nb$negative : a.__neg__; case "UAdd": return a.nb$positive ? a.nb$positive : a.__pos__; case "Invert": return a.nb$invert ? a.nb$invert : a.__invert__ } } ; Sk.abstr.binary_op_ = function(a, b, c) { var d = a.constructor; d = b.constructor !== d && b instanceof d; if (d) { var e = Sk.abstr.boNameToSlotFuncRhs_(b, c); if (void 0 !== e && (e = e.call ? e.call(b, a) : Sk.misceval.callsimArray(e, [b, a]), void 0 !== e && e !== Sk.builtin.NotImplemented.NotImplemented$)) return e } e = Sk.abstr.boNameToSlotFuncLhs_(a, c); if (void 0 !== e && (e = e.call ? e.call(a, b) : Sk.misceval.callsimArray(e, [a, b]), void 0 !== e && e !== Sk.builtin.NotImplemented.NotImplemented$) || !d && (e = Sk.abstr.boNameToSlotFuncRhs_(b, c), void 0 !== e && (e = e.call ? e.call(b, a) : Sk.misceval.callsimArray(e, [b, a]), void 0 !== e && e !== Sk.builtin.NotImplemented.NotImplemented$))) return e; Sk.abstr.binop_type_error(a, b, c) } ; Sk.abstr.binary_iop_ = function(a, b, c) { var d = Sk.abstr.iboNameToSlotFunc_(a, c); return void 0 !== d && (d = d.call ? d.call(a, b) : Sk.misceval.callsimArray(d, [a, b]), void 0 !== d && d !== Sk.builtin.NotImplemented.NotImplemented$) ? d : Sk.abstr.binary_op_(a, b, c) } ; Sk.abstr.unary_op_ = function(a, b) { var c = Sk.abstr.uoNameToSlotFunc_(a, b); if (void 0 !== c && (c = c.call ? c.call(a) : Sk.misceval.callsimArray(c, [a]), void 0 !== c)) return c; Sk.abstr.unop_type_error(a, b) } ; Sk.abstr.numberBinOp = function(a, b, c) { return Sk.abstr.binary_op_(a, b, c) } ; Sk.exportSymbol("Sk.abstr.numberBinOp", Sk.abstr.numberBinOp); Sk.abstr.numberInplaceBinOp = function(a, b, c) { return Sk.abstr.binary_iop_(a, b, c) } ; Sk.exportSymbol("Sk.abstr.numberInplaceBinOp", Sk.abstr.numberInplaceBinOp); Sk.abstr.numberUnaryOp = function(a, b) { return "Not" === b ? Sk.misceval.isTrue(a) ? Sk.builtin.bool.false$ : Sk.builtin.bool.true$ : Sk.abstr.unary_op_(a, b) } ; Sk.exportSymbol("Sk.abstr.numberUnaryOp", Sk.abstr.numberUnaryOp); Sk.abstr.fixSeqIndex_ = function(a, b) { b = Sk.builtin.asnum$(b); 0 > b && a.sq$length && (b += a.sq$length()); return b } ; Sk.abstr.sequenceContains = function(a, b, c) { if (a.sq$contains) return a.sq$contains(b); var d = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$contains); if (null != d) return Sk.misceval.isTrue(Sk.misceval.callsimArray(d, [a, b])); if (!Sk.builtin.checkIterable(a)) throw c = Sk.abstr.typeName(a), new Sk.builtin.TypeError("argument of type '" + c + "' is not iterable"); a = Sk.misceval.iterFor(Sk.abstr.iter(a), function(a) { return Sk.misceval.richCompareBool(a, b, "Eq") ? new Sk.misceval.Break(!0) : !1 }, !1); return c ? a : Sk.misceval.retryOptionalSuspensionOrThrow(a) } ; Sk.abstr.sequenceConcat = function(a, b) { if (a.sq$concat) return a.sq$concat(b); a = Sk.abstr.typeName(a); throw new Sk.builtin.TypeError("'" + a + "' object can't be concatenated"); } ; Sk.abstr.sequenceGetIndexOf = function(a, b) { if (a.index) return Sk.misceval.callsimArray(a.index, [a, b]); if (Sk.builtin.checkIterable(a)) { var c = 0; var d = Sk.abstr.iter(a); for (a = d.tp$iternext(); void 0 !== a; a = d.tp$iternext()) { if (Sk.misceval.richCompareBool(b, a, "Eq")) return new Sk.builtin.int_(c); c += 1 } throw new Sk.builtin.ValueError("sequence.index(x): x not in sequence"); } b = Sk.abstr.typeName(a); throw new Sk.builtin.TypeError("argument of type '" + b + "' is not iterable"); } ; Sk.abstr.sequenceGetCountOf = function(a, b) { if (a.count) return Sk.misceval.callsimArray(a.count, [a, b]); if (Sk.builtin.checkIterable(a)) { var c = 0; var d = Sk.abstr.iter(a); for (a = d.tp$iternext(); void 0 !== a; a = d.tp$iternext()) Sk.misceval.richCompareBool(b, a, "Eq") && (c += 1); return new Sk.builtin.int_(c) } b = Sk.abstr.typeName(a); throw new Sk.builtin.TypeError("argument of type '" + b + "' is not iterable"); } ; Sk.abstr.sequenceGetItem = function(a, b, c) { if (a.mp$subscript) return a.mp$subscript(b); a = Sk.abstr.typeName(a); throw new Sk.builtin.TypeError("'" + a + "' object is unsubscriptable"); } ; Sk.abstr.sequenceSetItem = function(a, b, c, d) { if (a.mp$ass_subscript) return a.mp$ass_subscript(b, c); a = Sk.abstr.typeName(a); throw new Sk.builtin.TypeError("'" + a + "' object does not support item assignment"); } ; Sk.abstr.sequenceDelItem = function(a, b) { if (a.sq$del_item) b = Sk.abstr.fixSeqIndex_(a, b), a.sq$del_item(b); else throw a = Sk.abstr.typeName(a), new Sk.builtin.TypeError("'" + a + "' object does not support item deletion"); } ; Sk.abstr.sequenceRepeat = function(a, b, c) { c = Sk.builtin.asnum$(c); if (void 0 === Sk.misceval.asIndex(c)) throw a = Sk.abstr.typeName(c), new Sk.builtin.TypeError("can't multiply sequence by non-int of type '" + a + "'"); return a.call(b, c) } ; Sk.abstr.sequenceGetSlice = function(a, b, c) { if (a.sq$slice) return b = Sk.abstr.fixSeqIndex_(a, b), c = Sk.abstr.fixSeqIndex_(a, c), a.sq$slice(b, c); if (a.mp$subscript) return a.mp$subscript(new Sk.builtin.slice(b,c)); a = Sk.abstr.typeName(a); throw new Sk.builtin.TypeError("'" + a + "' object is unsliceable"); } ; Sk.abstr.sequenceDelSlice = function(a, b, c) { if (a.sq$del_slice) b = Sk.abstr.fixSeqIndex_(a, b), c = Sk.abstr.fixSeqIndex_(a, c), a.sq$del_slice(b, c); else throw a = Sk.abstr.typeName(a), new Sk.builtin.TypeError("'" + a + "' doesn't support slice deletion"); } ; Sk.abstr.sequenceSetSlice = function(a, b, c, d) { if (a.sq$ass_slice) b = Sk.abstr.fixSeqIndex_(a, b), c = Sk.abstr.fixSeqIndex_(a, c), a.sq$ass_slice(b, c, d); else if (a.mp$ass_subscript) a.mp$ass_subscript(new Sk.builtin.slice(b,c), d); else throw a = Sk.abstr.typeName(a), new Sk.builtin.TypeError("'" + a + "' object doesn't support slice assignment"); } ; Sk.abstr.sequenceUnpack = function(a, b, c, d) { if (!Sk.builtin.checkIterable(a)) throw new Sk.builtin.TypeError("cannot unpack non-iterable " + Sk.abstr.typeName(a) + " object"); const e = Sk.abstr.iter(a) , h = []; let g = 0, f; 0 < b && (f = Sk.misceval.iterFor(e, a=>{ h.push(a); if (++g === b) return new Sk.misceval.Break } )); return Sk.misceval.chain(f, ()=>{ if (h.length < b) throw new Sk.builtin.ValueError("not enough values to unpack (expected at least " + c + ", got " + h.length + ")"); if (!d) return Sk.misceval.chain(e.tp$iternext(!0), a=>{ if (void 0 !== a) throw new Sk.builtin.ValueError("too many values to unpack (expected " + b + ")"); return h } ); const a = []; return Sk.misceval.chain(Sk.misceval.iterFor(e, c=>{ a.push(c) } ), ()=>{ const d = a.length + b - c; if (0 > d) throw new Sk.builtin.ValueError("not enough values to unpack (expected at least " + c + ", got " + (c + d) + ")"); h.push(new Sk.builtin.list(a.slice(0, d))); h.push(...a.slice(d)); return h } ) } ) } ; Sk.abstr.mappingUnpackIntoKeywordArray = function(a, b, c) { return Sk.misceval.chain(b.tp$getattr(new Sk.builtin.str("items")), function(a) { if (!a) throw new Sk.builtin.TypeError("Object is not a mapping"); return Sk.misceval.callsimOrSuspend(a) }, function(b) { return Sk.misceval.iterFor(Sk.abstr.iter(b), function(b) { if (!b || !b.v) throw new Sk.builtin.TypeError("Object is not a mapping; items() does not return tuples"); if (!(b.v[0]instanceof Sk.builtin.str)) throw new Sk.builtin.TypeError((c.tp$name ? c.tp$name + ":" : "") + "keywords must be strings"); a.push(b.v[0].v, b.v[1]) }) }) } ; Sk.abstr.objectFormat = function(a, b) { var c = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$format); if (null == c) return Sk.misceval.callsimArray(Sk.builtin.object.prototype.__format__, [a, b]); a = Sk.misceval.callsimArray(c, [a, b]); if (!Sk.builtin.checkString(a)) throw new Sk.builtin.TypeError("__format__ must return a str, not " + Sk.abstr.typeName(a)); return a } ; Sk.abstr.objectAdd = function(a, b) { if (a.nb$add) return a.nb$add(b); a = Sk.abstr.typeName(a); b = Sk.abstr.typeName(b); throw new Sk.builtin.TypeError("unsupported operand type(s) for +: '" + a + "' and '" + b + "'"); } ; Sk.abstr.objectNegative = function(a) { if (a.nb$negative) return a.nb$negative(); throw new Sk.builtin.TypeError("bad operand type for unary -: '" + Sk.abstr.typeName(a) + "'"); } ; Sk.abstr.objectPositive = function(a) { if (a.nb$positive) return a.nb$positive(); throw new Sk.builtin.TypeError("bad operand type for unary +: '" + Sk.abstr.typeName(a) + "'"); } ; Sk.abstr.objectDelItem = function(a, b) { if (null !== a) { if (a.mp$del_subscript) { a.mp$del_subscript(b); return } if (a.sq$ass_item) { var c = Sk.misceval.asIndex(b); if (void 0 === c) throw a = Sk.abstr.typeName(b), new Sk.builtin.TypeError("sequence index must be integer, not '" + a + "'"); Sk.abstr.sequenceDelItem(a, c); return } } a = Sk.abstr.typeName(a); throw new Sk.builtin.TypeError("'" + a + "' object does not support item deletion"); } ; Sk.exportSymbol("Sk.abstr.objectDelItem", Sk.abstr.objectDelItem); Sk.abstr.objectGetItem = function(a, b, c) { if (null !== a) { if (a.tp$getitem) return a.tp$getitem(b, c); if (a.mp$subscript) return a.mp$subscript(b, c); if (Sk.misceval.isIndex(b) && a.sq$item) return Sk.abstr.sequenceGetItem(a, Sk.misceval.asIndex(b), c) } a = Sk.abstr.typeName(a); throw new Sk.builtin.TypeError("'" + a + "' does not support indexing"); } ; Sk.exportSymbol("Sk.abstr.objectGetItem", Sk.abstr.objectGetItem); Sk.abstr.objectSetItem = function(a, b, c, d) { if (null !== a) { if (a.tp$setitem) return a.tp$setitem(b, c, d); if (a.mp$ass_subscript) return a.mp$ass_subscript(b, c, d); if (Sk.misceval.isIndex(b) && a.sq$ass_item) return Sk.abstr.sequenceSetItem(a, Sk.misceval.asIndex(b), c, d) } a = Sk.abstr.typeName(a); throw new Sk.builtin.TypeError("'" + a + "' does not support item assignment"); } ; Sk.exportSymbol("Sk.abstr.objectSetItem", Sk.abstr.objectSetItem); Sk.abstr.gattr = function(a, b, c) { if (null === a || !a.tp$getattr) throw c = Sk.abstr.typeName(a), new Sk.builtin.AttributeError("'" + c + "' object has no attribute '" + b.$jsstr() + "'"); c = a.tp$getattr(b, c); let d; if (void 0 === c) throw d = a.sk$type ? "type object '" + a.prototype.tp$name + "'" : "'" + Sk.abstr.typeName(a) + "' object", new Sk.builtin.AttributeError(d + " has no attribute '" + b.$jsstr() + "'"); return c.$isSuspension ? Sk.misceval.chain(c, function(c) { if (void 0 === c) throw d = a.sk$type ? "type object '" + a.prototype.tp$name + "'" : "'" + Sk.abstr.typeName(a) + "' object", new Sk.builtin.AttributeError(d + " has no attribute '" + b.$jsstr() + "'"); return c }) : c } ; Sk.exportSymbol("Sk.abstr.gattr", Sk.abstr.gattr); Sk.abstr.sattr = function(a, b, c, d) { var e = Sk.abstr.typeName(a); if (null === a) throw new Sk.builtin.AttributeError("'" + e + "' object has no attribute '" + b.$jsstr() + "'"); if (void 0 !== a.tp$setattr) return a.tp$setattr(b, c, d); throw new Sk.builtin.AttributeError("'" + e + "' object has no attribute '" + b.$jsstr() + "'"); } ; Sk.exportSymbol("Sk.abstr.sattr", Sk.abstr.sattr); Sk.abstr.iternext = function(a, b) { return a.tp$iternext(b) } ; Sk.exportSymbol("Sk.abstr.iternext", Sk.abstr.iternext); Sk.abstr.iter = function(a) { var b = function(a) { this.idx = 0; this.myobj = a; this.getitem = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$getitem); this.tp$iternext = function() { try { var a = Sk.misceval.callsimArray(this.getitem, [this.myobj, Sk.ffi.remapToPy(this.idx)]) } catch (e) { if (e instanceof Sk.builtin.IndexError || e instanceof Sk.builtin.StopIteration) return; throw e; } this.idx++; return a } }; if (a.tp$iter) { if (b = a.tp$iter(), b.tp$iternext) return b } else if (Sk.abstr.lookupSpecial(a, Sk.builtin.str.$getitem)) return new b(a); throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(a) + "' object is not iterable"); } ; Sk.exportSymbol("Sk.abstr.iter", Sk.abstr.iter); Sk.abstr.lookupSpecial = function(a, b) { if (a.ob$type) a = a.ob$type; else return null; return Sk.builtin.type.typeLookup(a, b) } ; Sk.exportSymbol("Sk.abstr.lookupSpecial", Sk.abstr.lookupSpecial); Sk.abstr.markUnhashable = function(a) { a = a.prototype; a.__hash__ = Sk.builtin.none.none$; a.tp$hash = Sk.builtin.none.none$ } ; Sk.abstr.inherits = function(a, b) { function c() {} c.prototype = b.prototype; a.superClass_ = b.prototype; a.prototype = new c; a.prototype.constructor = a } ; Sk.abstr.setUpInheritance = function(a, b, c) { Sk.abstr.inherits(b, c); b.prototype.tp$base = c; b.prototype.tp$name = a; b.prototype.ob$type = Sk.builtin.type.makeIntoTypeObj(a, b) } ; Sk.abstr.superConstructor = function(a, b, c) { var d = Array.prototype.slice.call(arguments, 2); a.prototype.tp$base.apply(b, d) } } , function(m, p) { Sk.builtin.object = function() { return this instanceof Sk.builtin.object ? this : new Sk.builtin.object } ; Object.defineProperties(Sk.builtin.object.prototype, { ob$type: { value: Sk.builtin.object, writable: !0 }, tp$name: { value: "object", writable: !0 }, tp$base: { value: void 0, writable: !0 }, sk$object: { value: !0 } }); Object.setPrototypeOf(Sk.builtin.type.prototype, Sk.builtin.object.prototype); Object.setPrototypeOf(Sk.builtin.type, Sk.builtin.type.prototype); Object.setPrototypeOf(Sk.builtin.object, Sk.builtin.type.prototype); Sk.builtin.type.prototype.tp$base = Sk.builtin.object; Sk.builtin.object.prototype.__init__ = function() { return Sk.builtin.none.none$ } ; Sk.builtin.object.prototype.__init__.co_kwargs = 1; Sk.builtin._tryGetSubscript = function(a, b) { try { return a.mp$subscript(b) } catch (c) {} } ; Sk.exportSymbol("Sk.builtin._tryGetSubscript", Sk.builtin._tryGetSubscript); Sk.builtin.object.prototype.GenericGetAttr = function(a, b) { var c, d; var e = this.ob$type; Sk.asserts.assert(void 0 !== e, "object has no ob$type!"); if (d = this.$d || this.constructor.$d) { d.mp$lookup ? c = d.mp$lookup(a) : d.mp$subscript ? c = Sk.builtin._tryGetSubscript(d, a) : "object" === typeof d && (c = d[a.$mangled]); if (void 0 !== c) return c; if ("__dict__" == a.$jsstr() && d instanceof Sk.builtin.dict) return d } d = Sk.builtin.type.typeLookup(e, a); if (void 0 !== d && null !== d && (c = d.tp$descr_get)) return c.call(d, this, this.ob$type, b); if (void 0 !== d) return d; d = Sk.builtin.type.typeLookup(e, Sk.builtin.str.$getattr); if (void 0 !== d && null !== d) { var h = (c = d.tp$descr_get) ? c.call(d, this, this.ob$type) : d; c = Sk.misceval.tryCatch(function() { return Sk.misceval.callsimOrSuspendArray(h, [a]) }, function(a) { if (!(a instanceof Sk.builtin.AttributeError)) throw a; }); return b ? c : Sk.misceval.retryOptionalSuspensionOrThrow(c) } } ; Sk.exportSymbol("Sk.builtin.object.prototype.GenericGetAttr", Sk.builtin.object.prototype.GenericGetAttr); Sk.builtin.object.prototype.GenericPythonGetAttr = function(a, b) { a = Sk.builtin.object.prototype.GenericGetAttr.call(a, b, !0); if (void 0 === a) throw new Sk.builtin.AttributeError(b); return a } ; Sk.exportSymbol("Sk.builtin.object.prototype.GenericPythonGetAttr", Sk.builtin.object.prototype.GenericPythonGetAttr); Sk.builtin.object.prototype.GenericSetAttr = function(a, b, c) { var d = Sk.abstr.typeName(this) , e = a.$jsstr() , h = this.ob$type; Sk.asserts.assert(void 0 !== h, "object has no ob$type!"); var g = this.$d || this.constructor.$d; if ("__class__" == e) { if (void 0 === b.tp$mro || void 0 === b.sk$klass) throw new Sk.builtin.TypeError("attempted to assign non-class to __class__"); this.ob$type = b } else { e = Sk.builtin.type.typeLookup(h, a); if (void 0 !== e && null !== e && (h = e.tp$descr_set)) return h.call(e, this, b, c); if (g.mp$ass_subscript) { if (this instanceof Sk.builtin.object && !this.ob$type.sk$klass && void 0 === g.mp$lookup(a)) throw new Sk.builtin.AttributeError("'" + d + "' object has no attribute '" + a.$jsstr() + "'"); g.mp$ass_subscript(a, b) } else "object" === typeof g && (g[a.$mangled] = b) } } ; Sk.exportSymbol("Sk.builtin.object.prototype.GenericSetAttr", Sk.builtin.object.prototype.GenericSetAttr); Sk.builtin.object.prototype.GenericPythonSetAttr = function(a, b, c) { return Sk.builtin.object.prototype.GenericSetAttr.call(a, b, c, !0) } ; Sk.exportSymbol("Sk.builtin.object.prototype.GenericPythonSetAttr", Sk.builtin.object.prototype.GenericPythonSetAttr); Sk.builtin.object.prototype.HashNotImplemented = function() { throw new Sk.builtin.TypeError("unhashable type: '" + Sk.abstr.typeName(this) + "'"); } ; Sk.builtin.object.prototype.tp$getattr = Sk.builtin.object.prototype.GenericGetAttr; Sk.builtin.object.prototype.tp$setattr = Sk.builtin.object.prototype.GenericSetAttr; Sk.builtin.object.prototype.__getattribute__ = Sk.builtin.object.prototype.GenericPythonGetAttr; Sk.builtin.object.prototype.__setattr__ = Sk.builtin.object.prototype.GenericPythonSetAttr; Sk.builtin.object.prototype.tp$descr_set = void 0; Sk.builtin.object.prototype.__new__ = function(a) { Sk.builtin.pyCheckArgsLen("__new__", arguments.length, 1, 1, !1, !1); return new a([],[]) } ; Sk.builtin.object.prototype.__repr__ = function(a) { Sk.builtin.pyCheckArgsLen("__repr__", arguments.length, 0, 0, !1, !0); return a.$r() } ; Sk.builtin.object.prototype.__format__ = function(a, b) { Sk.builtin.pyCheckArgsLen("__format__", arguments.length, 2, 2); if (Sk.builtin.checkString(b)) { var c = Sk.ffi.remapToJs(b); if ("" !== c) throw new Sk.builtin.NotImplementedError("format spec is not yet implemented"); } else { if (Sk.__future__.exceptions) throw new Sk.builtin.TypeError("format() argument 2 must be str, not " + Sk.abstr.typeName(b)); throw new Sk.builtin.TypeError("format expects arg 2 to be string or unicode, not " + Sk.abstr.typeName(b)); } return new Sk.builtin.str(a) } ; Sk.builtin.object.prototype.__str__ = function(a) { Sk.builtin.pyCheckArgsLen("__str__", arguments.length, 0, 0, !1, !0); return a.$r() } ; Sk.builtin.object.prototype.__hash__ = function(a) { Sk.builtin.pyCheckArgsLen("__hash__", arguments.length, 0, 0, !1, !0); return a.tp$hash() } ; Sk.builtin.object.prototype.__eq__ = function(a, b) { Sk.builtin.pyCheckArgsLen("__eq__", arguments.length, 1, 1, !1, !0); return a.ob$eq(b) } ; Sk.builtin.object.prototype.__ne__ = function(a, b) { Sk.builtin.pyCheckArgsLen("__ne__", arguments.length, 1, 1, !1, !0); return a.ob$ne(b) } ; Sk.builtin.object.prototype.__lt__ = function(a, b) { Sk.builtin.pyCheckArgsLen("__lt__", arguments.length, 1, 1, !1, !0); return a.ob$lt(b) } ; Sk.builtin.object.prototype.__le__ = function(a, b) { Sk.builtin.pyCheckArgsLen("__le__", arguments.length, 1, 1, !1, !0); return a.ob$le(b) } ; Sk.builtin.object.prototype.__gt__ = function(a, b) { Sk.builtin.pyCheckArgsLen("__gt__", arguments.length, 1, 1, !1, !0); return a.ob$gt(b) } ; Sk.builtin.object.prototype.__ge__ = function(a, b) { Sk.builtin.pyCheckArgsLen("__ge__", arguments.length, 1, 1, !1, !0); return a.ob$ge(b) } ; Sk.builtin.object.prototype.$r = function() { const a = Sk.abstr.lookupSpecial(this, Sk.builtin.str.$module); let b = ""; a && Sk.builtin.checkString(a) && (b = a.v + "."); return new Sk.builtin.str("<" + b + Sk.abstr.typeName(this) + " object>") } ; Sk.builtin.object.prototype.tp$str = function() { return this.$r() } ; Sk.builtin.hashCount = 1; Sk.builtin.idCount = 1; Sk.builtin.object.prototype.tp$hash = function() { this.$savedHash_ || (this.$savedHash_ = new Sk.builtin.int_(Sk.builtin.hashCount++)); return this.$savedHash_ } ; Sk.builtin.object.prototype.ob$eq = function(a) { return this === a ? Sk.builtin.bool.true$ : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.object.prototype.ob$ne = function(a) { return this === a ? Sk.builtin.bool.false$ : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.object.prototype.ob$lt = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.object.prototype.ob$le = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.object.prototype.ob$gt = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.object.prototype.ob$ge = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.object.pythonFunctions = "__repr__ __str__ __hash__ __eq__ __ne__ __lt__ __le__ __gt__ __ge__ __getattribute__ __setattr__ __format__".split(" "); Sk.builtin.none = function() { return Sk.builtin.none.none$ } ; Sk.abstr.setUpInheritance("NoneType", Sk.builtin.none, Sk.builtin.object); Sk.builtin.none.prototype.$r = function() { return new Sk.builtin.str("None") } ; Sk.builtin.none.prototype.tp$hash = function() { return new Sk.builtin.int_(0) } ; Sk.builtin.none.none$ = Object.create(Sk.builtin.none.prototype, { v: { value: null, enumerable: !0 } }); Sk.builtin.NotImplemented = function() { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.abstr.setUpInheritance("NotImplementedType", Sk.builtin.NotImplemented, Sk.builtin.object); Sk.builtin.NotImplemented.prototype.$r = function() { return new Sk.builtin.str("NotImplemented") } ; Sk.builtin.NotImplemented.NotImplemented$ = Object.create(Sk.builtin.NotImplemented.prototype, { v: { value: null, enumerable: !0 } }); Sk.exportSymbol("Sk.builtin.none", Sk.builtin.none); Sk.exportSymbol("Sk.builtin.NotImplemented", Sk.builtin.NotImplemented) } , function(m, p) { Sk.builtin.pyCheckArgs = function(a, b, c, d, e, h) { b = b.length; void 0 === d && (d = Infinity); e && --b; h && --b; if (b < c || b > d) throw new Sk.builtin.TypeError((c === d ? a + "() takes exactly " + c + " arguments" : b < c ? a + "() takes at least " + c + " arguments" : a + "() takes at most " + d + " arguments") + (" (" + b + " given)")); } ; Sk.exportSymbol("Sk.builtin.pyCheckArgs", Sk.builtin.pyCheckArgs); Sk.builtin.pyCheckArgsLen = function(a, b, c, d, e, h) { void 0 === d && (d = Infinity); e && --b; h && --b; if (b < c || b > d) throw new Sk.builtin.TypeError((c === d ? a + "() takes exactly " + c + " arguments" : b < c ? a + "() takes at least " + c + " arguments" : a + "() takes at most " + d + " arguments") + (" (" + b + " given)")); } ; Sk.builtin.pyCheckType = function(a, b, c) { if (!c) throw new Sk.builtin.TypeError(a + " must be a " + b); } ; Sk.exportSymbol("Sk.builtin.pyCheckType", Sk.builtin.pyCheckType); Sk.builtin.checkSequence = function(a) { return null !== a && void 0 !== a.mp$subscript } ; Sk.exportSymbol("Sk.builtin.checkSequence", Sk.builtin.checkSequence); Sk.builtin.checkIterable = function(a) { var b = !1; if (null !== a) try { return (b = Sk.abstr.iter(a)) ? !0 : !1 } catch (c) { if (c instanceof Sk.builtin.TypeError) return !1; throw c; } return b } ; Sk.exportSymbol("Sk.builtin.checkIterable", Sk.builtin.checkIterable); Sk.builtin.checkCallable = function(a) { return "function" === typeof a || a instanceof Sk.builtin.func || a instanceof Sk.builtin.method || void 0 !== Sk.abstr.lookupSpecial(a, Sk.builtin.str.$call) ? !0 : !1 } ; Sk.builtin.checkNumber = function(a) { return null !== a && ("number" === typeof a || a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.float_ || a instanceof Sk.builtin.lng) } ; Sk.exportSymbol("Sk.builtin.checkNumber", Sk.builtin.checkNumber); Sk.builtin.checkComplex = function(a) { return Sk.builtin.complex._complex_check(a) } ; Sk.exportSymbol("Sk.builtin.checkComplex", Sk.builtin.checkComplex); Sk.builtin.checkInt = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || "number" === typeof a && Number.isInteger(a) } ; Sk.exportSymbol("Sk.builtin.checkInt", Sk.builtin.checkInt); Sk.builtin.checkFloat = function(a) { return null !== a && a instanceof Sk.builtin.float_ } ; Sk.exportSymbol("Sk.builtin.checkFloat", Sk.builtin.checkFloat); Sk.builtin.checkString = function(a) { return null !== a && a.__class__ == Sk.builtin.str } ; Sk.exportSymbol("Sk.builtin.checkString", Sk.builtin.checkString); Sk.builtin.checkBytes = function(a) { return a instanceof Sk.builtin.bytes } ; Sk.builtin.checkClass = function(a) { return null !== a && a.sk$type } ; Sk.exportSymbol("Sk.builtin.checkClass", Sk.builtin.checkClass); Sk.builtin.checkBool = function(a) { return a instanceof Sk.builtin.bool } ; Sk.exportSymbol("Sk.builtin.checkBool", Sk.builtin.checkBool); Sk.builtin.checkNone = function(a) { return a === Sk.builtin.none.none$ } ; Sk.exportSymbol("Sk.builtin.checkNone", Sk.builtin.checkNone); Sk.builtin.checkFunction = function(a) { return null !== a && void 0 !== a.tp$call } ; Sk.exportSymbol("Sk.builtin.checkFunction", Sk.builtin.checkFunction); Sk.builtin.func = function(a, b, c, d) { if (!(this instanceof Sk.builtin.func)) throw Error("builtin func should be called as a class with `new`"); var e; this.func_code = a; this.func_globals = b || null; if (void 0 !== d) for (e in d) c[e] = d[e]; this.$d = { __name__: a.co_name, __class__: Sk.builtin.func }; this.func_closure = c; this.tp$name = this.func_code && this.func_code.co_name && this.func_code.co_name.v || this.func_code.name || ""; this.$memoiseFlags(); if (this.memoised = a.co_fastcall) this.tp$call = a; return this } ; Sk.abstr.setUpInheritance("function", Sk.builtin.func, Sk.builtin.object); Sk.exportSymbol("Sk.builtin.func", Sk.builtin.func); Sk.builtin.func.prototype.tp$name = "function"; Sk.builtin.func.prototype.$memoiseFlags = function() { this.co_varnames = this.func_code.co_varnames; this.co_argcount = this.func_code.co_argcount; void 0 === this.co_argcount && this.co_varnames && (this.co_argcount = this.co_varnames.length); this.co_kwonlyargcount = this.func_code.co_kwonlyargcount || 0; this.co_varargs = this.func_code.co_varargs; this.co_kwargs = this.func_code.co_kwargs; this.$defaults = this.func_code.$defaults || []; this.$kwdefs = this.func_code.$kwdefs || [] } ; Sk.builtin.func.prototype.tp$descr_get = function(a, b) { Sk.asserts.assert(!(void 0 === a && void 0 === b)); return b && b.prototype && b.prototype.tp$name in Sk.builtin && Sk.builtin[b.prototype.tp$name] === b ? new Sk.builtin.method(this,a,b,!0) : new Sk.builtin.method(this,a,b) } ; Sk.builtin.func.pythonFunctions = ["__get__"]; Sk.builtin.func.prototype.__get__ = function(a, b, c) { Sk.builtin.pyCheckArgsLen("__get__", arguments.length, 1, 2, !1, !0); if (b === Sk.builtin.none.none$ && c === Sk.builtin.none.none$) throw new Sk.builtin.TypeError("__get__(None, None) is invalid"); return a.tp$descr_get(b, c) } ; Sk.builtin.func.prototype.tp$getname = function() { return this.func_code && this.func_code.co_name && this.func_code.co_name.v || this.func_code.name || "" } ; Sk.builtin.func.prototype.$resolveArgs = function(a, b) { var c = this.co_argcount; void 0 === c && (c = this.co_varnames ? this.co_varnames.length : a.length); var d = this.co_varnames || [] , e = this.co_kwonlyargcount || 0; let h = c + e; if (!(0 !== e || this.co_kwargs || b && 0 !== b.length || this.co_varargs)) { if (a.length == c) return a; if (0 === a.length && this.$defaults && this.$defaults.length === c) { for (d = 0; d != this.$defaults.length; d++) a[d] = this.$defaults[d]; return a } } let g; this.co_kwargs && (g = []); var f = a.length; let k = a.length <= c ? a : a.slice(0, c); if (this.co_varargs) a = a.length > k.length ? a.slice(k.length) : [], k[h] = new Sk.builtin.tuple(a); else if (f > c) throw new Sk.builtin.TypeError(this.tp$getname() + "() takes " + c + " positional argument" + (1 == c ? "" : "s") + " but " + f + (1 == f ? " was " : " were ") + " given"); if (b) { if (this.func_code.no_kw) throw new Sk.builtin.TypeError(this.tp$getname() + "() takes no keyword arguments"); for (a = 0; a < b.length; a += 2) { f = b[a]; var n = b[a + 1] , l = d.indexOf(f); if (0 <= l) { if (void 0 !== k[l]) throw new Sk.builtin.TypeError(this.tp$getname() + "() got multiple values for argument '" + f + "'"); k[l] = n } else if (g) g.push(new Sk.builtin.str(f), n); else throw new Sk.builtin.TypeError(this.tp$getname() + "() got an unexpected keyword argument '" + f + "'"); } } b = this.$defaults || []; a = 0; f = []; n = !1; for (l = c - b.length; a < l; a++) void 0 === k[a] && (f.push(d[a]), void 0 === d[a] && (n = !0)); if (0 != f.length && (this.co_argcount || this.co_varnames)) throw new Sk.builtin.TypeError(this.tp$getname() + "() missing " + f.length + " required argument" + (1 == f.length ? "" : "s") + (n ? "" : ": " + f.join(", "))); for (; a < c; a++) void 0 === k[a] && (k[a] = b[a - l]); if (0 < e) { e = []; b = this.$kwdefs; for (a = c; a < h; a++) void 0 === k[a] && (void 0 !== b[a - c] ? k[a] = b[a - c] : e.push(d[a])); if (0 !== e.length) throw new Sk.builtin.TypeError(this.tp$getname() + "() missing " + e.length + " required keyword argument" + (1 == e.length ? "" : "s") + ": " + e.join(", ")); } if (this.func_closure && d) for (c = k.length; c < d.length; c++) k.push(void 0); g && k.unshift(g); return k } ; Sk.builtin.func.prototype.tp$call = function(a, b) { this.memoised || (this.$memoiseFlags(), this.memoised = !0); if (void 0 === this.co_argcount && void 0 === this.co_varnames && !this.co_kwargs && !this.func_closure) { if (b && 0 !== b.length) throw new Sk.builtin.TypeError(this.tp$getname() + "() takes no keyword arguments"); return this.func_code.apply(this.func_globals, a) } a = this.$resolveArgs(a, b); this.func_closure && a.push(this.func_closure); return this.func_code.apply(this.func_globals, a) } ; Sk.builtin.func.prototype.$r = function() { var a = this.tp$getname(); return a in Sk.builtins && this === Sk.builtins[a] ? new Sk.builtin.str("") : new Sk.builtin.str("") } } , function(m, p) { Sk.builtin.range = function(a, b, c) { var d = [], e; Sk.builtin.pyCheckArgsLen("range", arguments.length, 1, 3); Sk.builtin.pyCheckType("start", "integer", Sk.misceval.isIndex(a)); a = Sk.misceval.asIndex(a); void 0 !== b && (Sk.builtin.pyCheckType("stop", "integer", Sk.misceval.isIndex(b)), b = Sk.misceval.asIndex(b)); void 0 !== c && (Sk.builtin.pyCheckType("step", "integer", Sk.misceval.isIndex(c)), c = Sk.misceval.asIndex(c)); void 0 === b && void 0 === c ? (b = a, a = 0, c = 1) : void 0 === c && (c = 1); if (0 === c) throw new Sk.builtin.ValueError("range() step argument must not be zero"); if ("number" === typeof a && "number" === typeof b && "number" === typeof c) if (0 < c) for (e = a; e < b; e += c) d.push(new Sk.builtin.int_(e)); else for (e = a; e > b; e += c) d.push(new Sk.builtin.int_(e)); else { e = new Sk.builtin.lng(a); var h = new Sk.builtin.lng(b) , g = new Sk.builtin.lng(c); if (g.nb$ispositive()) for (; Sk.misceval.isTrue(e.ob$lt(h)); ) d.push(e), e = e.nb$add(g); else for (; Sk.misceval.isTrue(e.ob$gt(h)); ) d.push(e), e = e.nb$add(g) } d = new Sk.builtin.list(d); return Sk.__future__.python3 ? new Sk.builtin.range_(a,b,c,d) : d } ; Sk.builtin.asnum$ = function(a) { return void 0 === a || null === a ? a : a === Sk.builtin.none.none$ ? null : a instanceof Sk.builtin.bool ? a.v ? 1 : 0 : "number" === typeof a ? a : "string" === typeof a ? a : a instanceof Sk.builtin.int_ ? a.v : a instanceof Sk.builtin.float_ ? a.v : a instanceof Sk.builtin.lng ? a.cantBeInt() ? a.str$(10, !0) : a.toInt$() : a.constructor === Sk.builtin.biginteger ? 0 < a.trueCompare(new Sk.builtin.biginteger(Sk.builtin.int_.threshold$)) || 0 > a.trueCompare(new Sk.builtin.biginteger(-Sk.builtin.int_.threshold$)) ? a.toString() : a.intValue() : a } ; Sk.exportSymbol("Sk.builtin.asnum$", Sk.builtin.asnum$); Sk.builtin.assk$ = function(a) { return 0 === a % 1 ? new Sk.builtin.int_(a) : new Sk.builtin.float_(a) } ; Sk.exportSymbol("Sk.builtin.assk$", Sk.builtin.assk$); Sk.builtin.asnum$nofloat = function(a) { if (void 0 === a || null === a) return a; if (a.constructor === Sk.builtin.none) return null; if (a.constructor === Sk.builtin.bool) return a.v ? 1 : 0; "number" === typeof a && (a = a.toString()); a.constructor === Sk.builtin.int_ && (a = a.v.toString()); a.constructor === Sk.builtin.float_ && (a = a.v.toString()); a.constructor === Sk.builtin.lng && (a = a.str$(10, !0)); a.constructor === Sk.builtin.biginteger && (a = a.toString()); if (0 > a.indexOf(".") && 0 > a.indexOf("e") && 0 > a.indexOf("E")) return a; var b = 0; if (0 <= a.indexOf("e")) { var c = a.substr(0, a.indexOf("e")); b = a.substr(a.indexOf("e") + 1) } else 0 <= a.indexOf("E") ? (c = a.substr(0, a.indexOf("e")), b = a.substr(a.indexOf("E") + 1)) : c = a; b = parseInt(b, 10); a = c.indexOf("."); if (0 > a) { if (0 <= b) { for (; 0 < b--; ) c += "0"; return c } return c.length > -b ? c.substr(0, c.length + b) : 0 } c = 0 === a ? c.substr(1) : a < c.length ? c.substr(0, a) + c.substr(a + 1) : c.substr(0, a); for (a += b; a > c.length; ) c += "0"; return c = 0 >= a ? 0 : c.substr(0, a) } ; Sk.exportSymbol("Sk.builtin.asnum$nofloat", Sk.builtin.asnum$nofloat); Sk.builtin.round = function(a, b) { Sk.builtin.pyCheckArgsLen("round", arguments.length, 1, 2); if (!Sk.builtin.checkNumber(a)) { if (!Sk.builtin.checkFunction(a)) throw new Sk.builtin.TypeError("a float is required"); if (!Sk.__future__.exceptions) throw new Sk.builtin.AttributeError(Sk.abstr.typeName(a) + " instance has no attribute '__float__'"); } if (void 0 !== b && !Sk.misceval.isIndex(b)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(b) + "' object cannot be interpreted as an index"); if (!Sk.__future__.dunder_round && a.round$) return a.round$(a, b); var c = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$round); if (null != c) return Sk.builtin.checkFunction(a) ? Sk.misceval.callsimArray(c, [a]) : Sk.misceval.callsimArray(c, [a, b]); throw new Sk.builtin.TypeError("a float is required"); } ; Sk.builtin.len = function(a) { Sk.builtin.pyCheckArgsLen("len", arguments.length, 1, 1); var b = function(a) { return new Sk.builtin.int_(a) }; var c = function(a) { if (Sk.builtin.checkInt(a)) return b(a); if (Sk.__future__.exceptions) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(a) + "' object cannot be interpreted as an integer"); throw new Sk.builtin.TypeError("__len__() should return an int"); }; if (a.sq$length) return Sk.misceval.chain(a.sq$length(!0), c); if (a.mp$length) return Sk.misceval.chain(a.mp$length(), b); if (a.tp$length) if (Sk.builtin.checkFunction(a)) { c = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$len); if (null != c) return Sk.misceval.callsimArray(c, [a]); if (!Sk.__future__.exceptions) throw new Sk.builtin.AttributeError(Sk.abstr.typeName(a) + " instance has no attribute '__len__'"); } else return Sk.misceval.chain(a.tp$length(!0), c); throw new Sk.builtin.TypeError("object of type '" + Sk.abstr.typeName(a) + "' has no len()"); } ; Sk.builtin.min = function(a, b, c) { const d = c.sq$length(); if (!d) throw new Sk.builtin.TypeError("min expected 1 argument, got 0"); if (1 < d && null !== a) throw new Sk.builtin.TypeError("Cannot specify a default for min() with multiple positional arguments"); if (1 == d && (c = c.v[0], !Sk.builtin.checkIterable(c))) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(c) + "' object is not iterable"); let e = Sk.abstr.iter(c); if (!Sk.builtin.checkNone(b) && !Sk.builtin.checkCallable(b)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(b) + "' object is not callable"); let h; return Sk.misceval.chain(e.tp$iternext(!0), a=>{ h = a; if (void 0 !== h) return Sk.builtin.checkNone(b) ? Sk.misceval.iterFor(e, a=>{ Sk.misceval.richCompareBool(a, h, "Lt") && (h = a) } ) : Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(b, [h]), a=>Sk.misceval.iterFor(e, c=>Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(b, [c]), b=>{ Sk.misceval.richCompareBool(b, a, "Lt") && (h = c, a = b) } ))) } , ()=>{ if (void 0 === h) { if (null === a) throw new Sk.builtin.ValueError("min() arg is an empty sequence"); h = a } return h } ) } ; Sk.builtin.min.co_argcount = 0; Sk.builtin.min.co_kwonlyargcount = 2; Sk.builtin.min.$kwdefs = [null, Sk.builtin.none.none$]; Sk.builtin.min.co_varnames = ["default", "key"]; Sk.builtin.min.co_varargs = 1; Sk.builtin.max = function(a, b, c) { const d = c.sq$length(); if (!d) throw new Sk.builtin.TypeError("max expected 1 argument, got 0"); if (1 < d && null !== a) throw new Sk.builtin.TypeError("Cannot specify a default for max() with multiple positional arguments"); if (1 == d && (c = c.v[0], !Sk.builtin.checkIterable(c))) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(c) + "' object is not iterable"); let e = Sk.abstr.iter(c); if (!Sk.builtin.checkNone(b) && !Sk.builtin.checkCallable(b)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(b) + "' object is not callable"); let h; return Sk.misceval.chain(e.tp$iternext(!0), a=>{ h = a; if (void 0 !== h) return Sk.builtin.checkNone(b) ? Sk.misceval.iterFor(e, a=>{ Sk.misceval.richCompareBool(a, h, "Gt") && (h = a) } ) : Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(b, [h]), a=>Sk.misceval.iterFor(e, c=>Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(b, [c]), b=>{ Sk.misceval.richCompareBool(b, a, "Gt") && (h = c, a = b) } ))) } , ()=>{ if (void 0 === h) { if (null === a) throw new Sk.builtin.ValueError("min() arg is an empty sequence"); h = a } return h } ) } ; Sk.builtin.max.co_argcount = 0; Sk.builtin.max.co_kwonlyargcount = 2; Sk.builtin.max.$kwdefs = [null, Sk.builtin.none.none$]; Sk.builtin.max.co_varnames = ["default", "key"]; Sk.builtin.max.co_varargs = 1; Sk.builtin.any = function(a) { Sk.builtin.pyCheckArgsLen("any", arguments.length, 1, 1); return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(a), function(a) { if (Sk.misceval.isTrue(a)) return new Sk.misceval.Break(Sk.builtin.bool.true$) }), a=>a || Sk.builtin.bool.false$) } ; Sk.builtin.all = function(a) { Sk.builtin.pyCheckArgsLen("all", arguments.length, 1, 1); return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(a), function(a) { if (!Sk.misceval.isTrue(a)) return new Sk.misceval.Break(Sk.builtin.bool.false$) }), a=>a || Sk.builtin.bool.true$) } ; Sk.builtin.sum = function(a, b) { function c() { return Sk.misceval.iterFor(h, a=>{ if (a.constructor === Sk.builtin.int_) g = g.nb$add(a); else { if (a.constructor === Sk.builtin.float_) return g = (new Sk.builtin.float_(g)).nb$add(a), new Sk.misceval.Break("float"); g = Sk.abstr.numberBinOp(g, a, "Add"); return new Sk.misceval.Break("slow") } } ) } function d() { return Sk.misceval.iterFor(h, a=>{ if (a.constructor === Sk.builtin.float_ || a.constructor === Sk.builtin.int_) g = g.nb$add(a); else return g = Sk.abstr.numberBinOp(g, a, "Add"), new Sk.misceval.Break("slow") } ) } function e() { return Sk.misceval.iterFor(h, a=>{ g = Sk.abstr.numberBinOp(g, a, "Add") } ) } Sk.builtin.pyCheckArgsLen("sum", arguments.length, 1, 2); const h = Sk.abstr.iter(a); if (void 0 === b) var g = new Sk.builtin.int_(0); else { if (Sk.builtin.checkString(b)) throw new Sk.builtin.TypeError("sum() can't sum strings [use ''.join(seq) instead]"); g = b } let f; f = void 0 === b || b.constructor === Sk.builtin.int_ ? c() : b.constructor === Sk.builtin.float_ ? "float" : "slow"; return Sk.misceval.chain(f, a=>"float" === a ? d() : a, a=>{ if ("slow" === a) return e() } , ()=>g) } ; Sk.builtin.zip = function() { var a, b; if (0 === arguments.length) return new Sk.builtin.list([]); var c = []; for (b = 0; b < arguments.length; b++) if (Sk.builtin.checkIterable(arguments[b])) c.push(Sk.abstr.iter(arguments[b])); else throw new Sk.builtin.TypeError("argument " + b + " must support iteration"); var d = []; for (a = !1; !a; ) { var e = []; for (b = 0; b < arguments.length; b++) { var h = c[b].tp$iternext(); if (void 0 === h) { a = !0; break } e.push(h) } a || d.push(new Sk.builtin.tuple(e)) } return new Sk.builtin.list(d) } ; Sk.builtin.abs = function(a) { Sk.builtin.pyCheckArgsLen("abs", arguments.length, 1, 1); if (a.nb$abs) return a.nb$abs(); throw new TypeError("bad operand type for abs(): '" + Sk.abstr.typeName(a) + "'"); } ; Sk.builtin.fabs = function(a) { return Sk.builtin.abs(a) } ; Sk.builtin.ord = function(a) { Sk.builtin.pyCheckArgsLen("ord", arguments.length, 1, 1); if (Sk.builtin.checkString(a)) { if (1 !== a.v.length && 1 !== a.sq$length()) throw new Sk.builtin.TypeError("ord() expected a character, but string of length " + a.v.length + " found"); return new Sk.builtin.int_(a.v.codePointAt(0)) } if (Sk.builtin.checkBytes(a)) { if (1 !== a.sq$length()) throw new Sk.builtin.TypeError("ord() expected a character, but string of length " + a.v.length + " found"); return new Sk.builtin.int_(a.v[0]) } throw new Sk.builtin.TypeError("ord() expected a string of length 1, but " + Sk.abstr.typeName(a) + " found"); } ; Sk.builtin.chr = function(a) { Sk.builtin.pyCheckArgsLen("chr", arguments.length, 1, 1); if (!Sk.builtin.checkInt(a)) throw new Sk.builtin.TypeError("an integer is required"); a = Sk.builtin.asnum$(a); if (Sk.__future__.python3) { if (0 > a || 1114112 <= a) throw new Sk.builtin.ValueError("chr() arg not in range(0x110000)"); } else if (0 > a || 256 <= a) throw new Sk.builtin.ValueError("chr() arg not in range(256)"); return new Sk.builtin.str(String.fromCodePoint(a)) } ; Sk.builtin.unichr = function(a) { Sk.builtin.pyCheckArgsLen("chr", arguments.length, 1, 1); if (!Sk.builtin.checkInt(a)) throw new Sk.builtin.TypeError("an integer is required"); a = Sk.builtin.asnum$(a); try { return new Sk.builtin.str(String.fromCodePoint(a)) } catch (b) { if (b instanceof RangeError) throw new Sk.builtin.ValueError(b.message); throw b; } } ; Sk.builtin.int2str_ = function(a, b, c) { if (a instanceof Sk.builtin.lng) { var d = ""; 2 === b || Sk.__future__.python3 || (d = "L"); b = a.str$(b, !1); return a.nb$isnegative() ? new Sk.builtin.str("-" + c + b + d) : new Sk.builtin.str(c + b + d) } a = Sk.misceval.asIndex(a); b = a.toString(b); return 0 > a ? new Sk.builtin.str("-" + c + b.slice(1)) : new Sk.builtin.str(c + b) } ; Sk.builtin.hex = function(a) { Sk.builtin.pyCheckArgsLen("hex", arguments.length, 1, 1); if (!Sk.misceval.isIndex(a)) throw new Sk.builtin.TypeError("hex() argument can't be converted to hex"); return Sk.builtin.int2str_(a, 16, "0x") } ; Sk.builtin.oct = function(a) { Sk.builtin.pyCheckArgsLen("oct", arguments.length, 1, 1); if (!Sk.misceval.isIndex(a)) throw new Sk.builtin.TypeError("oct() argument can't be converted to hex"); return Sk.__future__.octal_number_literal ? Sk.builtin.int2str_(a, 8, "0o") : Sk.builtin.int2str_(a, 8, "0") } ; Sk.builtin.bin = function(a) { Sk.builtin.pyCheckArgsLen("bin", arguments.length, 1, 1); if (!Sk.misceval.isIndex(a)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(a) + "' object can't be interpreted as an index"); return Sk.builtin.int2str_(a, 2, "0b") } ; Sk.builtin.dir = function(a) { var b, c; Sk.builtin.pyCheckArgsLen("dir", arguments.length, 1, 1); var d = function(a) { var c = null; if (-1 !== "__bases__ __mro__ __class__ __name__ GenericGetAttr GenericSetAttr GenericPythonGetAttr GenericPythonSetAttr pythonFunctions HashNotImplemented constructor __dict__".split(" ").indexOf(a)) return null; a = Sk.unfixReserved(a); -1 !== a.indexOf("$") ? c = Sk.builtin.dir.slotNameToRichName(a) : "_" !== a.charAt(a.length - 1) ? c = a : "_" === a.charAt(0) && (c = a); return c }; var e = []; var h = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$dir); if (null != h) { var g = Sk.misceval.callsimArray(h, [a]); if (!Sk.builtin.checkSequence(g)) throw new Sk.builtin.TypeError("__dir__ must return sequence."); g = Sk.ffi.remapToJs(g); for (b = 0; b < g.length; ++b) e.push(new Sk.builtin.str(g[b])) } else { for (b in a.constructor.prototype) (c = d(b)) && e.push(new Sk.builtin.str(c)); if (a.$d) if (a.$d.tp$iter) for (h = a.$d.tp$iter(), b = h.tp$iternext(); void 0 !== b; b = h.tp$iternext()) c = new Sk.builtin.str(b), (c = d(c.v)) && e.push(new Sk.builtin.str(c)); else for (c in a.$d) e.push(new Sk.builtin.str(c)); var f = a.tp$mro; !f && a.ob$type && (f = a.ob$type.tp$mro); if (f) for (b = 0; b < f.v.length; ++b) for (g in h = f.v[b], h) h.hasOwnProperty(g) && (c = d(g)) && e.push(new Sk.builtin.str(c)) } e.sort(function(a, c) { return (a.v > c.v) - (a.v < c.v) }); return new Sk.builtin.list(e.filter(function(a, c, b) { return a !== b[c + 1] })) } ; Sk.builtin.dir.slotNameToRichName = function(a) {} ; Sk.builtin.repr = function(a) { Sk.builtin.pyCheckArgsLen("repr", arguments.length, 1, 1); return Sk.misceval.objectRepr(a) } ; Sk.builtin.ascii = function(a) { return Sk.misceval.chain(Sk.misceval.objectRepr(a), a=>{ if (!(a instanceof Sk.builtin.str)) throw new Sk.builtin.TypeError("__repr__ returned non-string (type " + Sk.abstr.typeName(a) + ")"); let c, b; for (b = 0; b < a.v.length; b++) if (127 <= a.v.charCodeAt(b)) { c = a.v.substr(0, b); break } if (!c) return a; for (; b < a.v.length; b++) { var e = a.v.charAt(b) , h = a.v.charCodeAt(b); 127 < h && 255 >= h ? (e = h.toString(16), 2 > e.length && (e = "0" + e), c += "\\x" + e) : 127 < h && 55296 > h || 57344 <= h ? c += "\\u" + ("000" + h.toString(16)).slice(-4) : 55296 <= h ? (e = a.v.codePointAt(b), b++, e = e.toString(16), h = "0000000" + e.toString(16), c = 4 < e.length ? c + ("\\U" + h.slice(-8)) : c + ("\\u" + h.slice(-4))) : c += e } return new Sk.builtin.str(c) } ) } ; Sk.builtin.open = function(a, b, c) { Sk.builtin.pyCheckArgsLen("open", arguments.length, 1, 3); void 0 === b && (b = new Sk.builtin.str("r")); if (/\+/.test(b.v)) throw "todo; haven't implemented read/write mode"; if (("w" === b.v || "wb" === b.v || "a" === b.v || "ab" === b.v) && !Sk.nonreadopen) throw "todo; haven't implemented non-read opens"; return new Sk.builtin.file(a,b,c) } ; Sk.builtin.isinstance = function(a, b) { var c; Sk.builtin.pyCheckArgsLen("isinstance", arguments.length, 2, 2); if (!(Sk.builtin.checkClass(b) || b instanceof Sk.builtin.tuple)) throw new Sk.builtin.TypeError("isinstance() arg 2 must be a class, type, or tuple of classes and types"); if (b === Sk.builtin.none.prototype.ob$type) return a === Sk.builtin.none.none$ ? Sk.builtin.bool.true$ : Sk.builtin.bool.false$; if (a.ob$type === b) return Sk.builtin.bool.true$; if (b instanceof Sk.builtin.tuple) { for (c = 0; c < b.v.length; ++c) if (Sk.misceval.isTrue(Sk.builtin.isinstance(a, b.v[c]))) return Sk.builtin.bool.true$; return Sk.builtin.bool.false$ } if (a instanceof b) return Sk.builtin.bool.true$; var d = function(a, c) { if (a === c) return Sk.builtin.bool.true$; if (void 0 === a.$d) return Sk.builtin.bool.false$; var b = a.$d.mp$subscript(Sk.builtin.type.basesStr_); for (a = 0; a < b.v.length; ++a) if (Sk.misceval.isTrue(d(b.v[a], c))) return Sk.builtin.bool.true$; return Sk.builtin.bool.false$ }; return d(a.ob$type, b) } ; Sk.builtin.hash = function(a) { Sk.builtin.pyCheckArgsLen("hash", arguments.length, 1, 1); if (a instanceof Object) { if (Sk.builtin.checkNone(a.tp$hash)) throw new Sk.builtin.TypeError(new Sk.builtin.str("unhashable type: '" + Sk.abstr.typeName(a) + "'")); if (void 0 !== a.tp$hash) { if (a.$savedHash_) return a.$savedHash_; a.$savedHash_ = a.tp$hash(); return a.$savedHash_ } void 0 === a.__hash && (Sk.builtin.hashCount += 1, a.__hash = Sk.builtin.hashCount); return new Sk.builtin.int_(a.__hash) } if ("number" === typeof a || null === a || !0 === a || !1 === a) throw new Sk.builtin.TypeError("unsupported Javascript type"); return new Sk.builtin.str(typeof a + " " + String(a)) } ; Sk.builtin.getattr = function(a, b, c) { Sk.builtin.pyCheckArgsLen("getattr", arguments.length, 2, 3); if (!Sk.builtin.checkString(b)) throw new Sk.builtin.TypeError("attribute name must be string"); var d = a.tp$getattr(b); if (void 0 === d) { if (void 0 !== c) return c; throw new Sk.builtin.AttributeError("'" + Sk.abstr.typeName(a) + "' object has no attribute '" + b.$jsstr() + "'"); } return d } ; Sk.builtin.setattr = function(a, b, c) { Sk.builtin.pyCheckArgsLen("setattr", arguments.length, 3, 3); if (!Sk.builtin.checkString(b)) throw new Sk.builtin.TypeError("attribute name must be string"); if (a.tp$setattr) a.tp$setattr(b, c); else throw new Sk.builtin.AttributeError("object has no attribute " + b.$jsstr()); return Sk.builtin.none.none$ } ; Sk.builtin.raw_input = function(a) { var b = a ? a : ""; return Sk.misceval.chain(Sk.importModule("sys", !1, !0), function(a) { return Sk.inputfunTakesPrompt ? Sk.misceval.callsimOrSuspendArray(Sk.builtin.file.$readline, [a.$d.stdin, null, b]) : Sk.misceval.chain(void 0, function() { return Sk.misceval.callsimOrSuspendArray(a.$d.stdout.write, [a.$d.stdout, new Sk.builtin.str(b)]) }, function() { return Sk.misceval.callsimOrSuspendArray(a.$d.stdin.readline, [a.$d.stdin]) }) }) } ; Sk.builtin.input = Sk.builtin.raw_input; Sk.builtin.jseval = function(a) { a = Sk.global.eval(Sk.ffi.remapToJs(a)); return Sk.ffi.remapToPy(a) } ; Sk.builtin.jsmillis = function() { return (new Date).valueOf() } ; Sk.builtin.eval_ = function() { throw new Sk.builtin.NotImplementedError("eval is not yet implemented"); } ; Sk.builtin.map = function(a, b) { var c = [], d, e; Sk.builtin.pyCheckArgsLen("map", arguments.length, 2); if (2 < arguments.length) { var h = []; var g = Array.prototype.slice.apply(arguments).slice(1); for (e = 0; e < g.length; e++) { if (!Sk.builtin.checkIterable(g[e])) { var f = parseInt(e, 10) + 2; throw new Sk.builtin.TypeError("argument " + f + " to map() must support iteration"); } g[e] = Sk.abstr.iter(g[e]) } for (; ; ) { var k = []; for (e = d = 0; e < g.length; e++) f = g[e].tp$iternext(), void 0 === f ? (k.push(Sk.builtin.none.none$), d++) : k.push(f); if (d !== g.length) h.push(k); else break } b = new Sk.builtin.list(h) } if (!Sk.builtin.checkIterable(b)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(b) + "' object is not iterable"); return Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(b), function(b) { if (a === Sk.builtin.none.none$) b instanceof Array && (b = new Sk.builtin.tuple(b)), c.push(b); else return b instanceof Array || (b = [b]), Sk.misceval.chain(Sk.misceval.applyOrSuspend(a, void 0, void 0, void 0, b), function(a) { c.push(a) }) }), function() { return new Sk.builtin.list(c) }) } ; Sk.builtin.reduce = function(a, b, c) { var d; Sk.builtin.pyCheckArgsLen("reduce", arguments.length, 2, 3); if (!Sk.builtin.checkIterable(b)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(b) + "' object is not iterable"); var e = Sk.abstr.iter(b); if (void 0 === c && (c = e.tp$iternext(), void 0 === c)) throw new Sk.builtin.TypeError("reduce() of empty sequence with no initial value"); var h = c; for (d = e.tp$iternext(); void 0 !== d; d = e.tp$iternext()) h = Sk.misceval.callsimArray(a, [h, d]); return h } ; Sk.builtin.filter = function(a, b) { var c; Sk.builtin.pyCheckArgsLen("filter", arguments.length, 2, 2); if (!Sk.builtin.checkIterable(b)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(b) + "' object is not iterable"); var d = function() { return [] }; var e = function(a, c) { a.push(c); return a }; var h = function(a) { return new Sk.builtin.list(a) }; b.__class__ === Sk.builtin.str ? (d = function() { return new Sk.builtin.str("") } , e = function(a, c) { return a.sq$concat(c) } , h = function(a) { return a } ) : b.__class__ === Sk.builtin.tuple && (h = function(a) { return new Sk.builtin.tuple(a) } ); var g = d(); var f = Sk.abstr.iter(b); for (c = f.tp$iternext(); void 0 !== c; c = f.tp$iternext()) d = a === Sk.builtin.none.none$ ? new Sk.builtin.bool(c) : Sk.misceval.callsimArray(a, [c]), Sk.misceval.isTrue(d) && (g = e(g, c)); return h(g) } ; Sk.builtin.hasattr = function(a, b) { Sk.builtin.pyCheckArgsLen("hasattr", arguments.length, 2, 2); if (!Sk.builtin.checkString(b)) throw new Sk.builtin.TypeError("hasattr(): attribute name must be string"); if (a.tp$getattr) return a.tp$getattr(b) ? Sk.builtin.bool.true$ : Sk.builtin.bool.false$; throw new Sk.builtin.AttributeError("Object has no tp$getattr method"); } ; Sk.builtin.pow = function(a, b, c) { Sk.builtin.pyCheckArgsLen("pow", arguments.length, 2, 3); c === Sk.builtin.none.none$ && (c = void 0); if (Sk.builtin.checkComplex(a)) return a.nb$power(b, c); var d = Sk.builtin.asnum$(a); var e = Sk.builtin.asnum$(b); var h = Sk.builtin.asnum$(c); if (!Sk.builtin.checkNumber(a) || !Sk.builtin.checkNumber(b)) { if (void 0 === c) throw new Sk.builtin.TypeError("unsupported operand type(s) for pow(): '" + Sk.abstr.typeName(a) + "' and '" + Sk.abstr.typeName(b) + "'"); throw new Sk.builtin.TypeError("unsupported operand type(s) for pow(): '" + Sk.abstr.typeName(a) + "', '" + Sk.abstr.typeName(b) + "', '" + Sk.abstr.typeName(c) + "'"); } if (0 > d && b instanceof Sk.builtin.float_) throw new Sk.builtin.ValueError("negative number cannot be raised to a fractional power"); if (void 0 === c) { if (a instanceof Sk.builtin.float_ || b instanceof Sk.builtin.float_ || 0 > e) return new Sk.builtin.float_(Math.pow(d, e)); h = new Sk.builtin.int_(d); e = new Sk.builtin.int_(e); e = h.nb$power(e); return a instanceof Sk.builtin.lng || b instanceof Sk.builtin.lng ? new Sk.builtin.lng(e) : e } if (!Sk.builtin.checkInt(a) || !Sk.builtin.checkInt(b) || !Sk.builtin.checkInt(c)) throw new Sk.builtin.TypeError("pow() 3rd argument not allowed unless all arguments are integers"); if (0 > e) { if (Sk.__future__.exceptions) throw new Sk.builtin.ValueError("pow() 2nd argument cannot be negative when 3rd argument specified"); throw new Sk.builtin.TypeError("pow() 2nd argument cannot be negative when 3rd argument specified"); } if (0 === h) throw new Sk.builtin.ValueError("pow() 3rd argument cannot be 0"); return a instanceof Sk.builtin.lng || b instanceof Sk.builtin.lng || c instanceof Sk.builtin.lng || Infinity === Math.pow(d, e) ? (a = new Sk.builtin.lng(a), a.nb$power(b, c)) : (new Sk.builtin.int_(Math.pow(d, e))).nb$remainder(c) } ; Sk.builtin.quit = function(a) { a = (new Sk.builtin.str(a)).v; throw new Sk.builtin.SystemExit(a); } ; Sk.builtin.issubclass = function(a, b) { var c; Sk.builtin.pyCheckArgsLen("issubclass", arguments.length, 2, 2); if (!Sk.builtin.checkClass(a)) throw new Sk.builtin.TypeError("issubclass() arg 1 must be a class"); if (!(Sk.builtin.checkClass(b) || b instanceof Sk.builtin.tuple)) throw new Sk.builtin.TypeError("issubclass() arg 2 must be a class or tuple of classes"); var d = function(a, c) { if (a === c) return !0; if (void 0 !== a.$d && a.$d.mp$subscript) if (a.$d.sq$contains(Sk.builtin.type.basesStr_)) var b = a.$d.mp$subscript(Sk.builtin.type.basesStr_); else return !1; else return !1; for (a = 0; a < b.v.length; ++a) if (d(b.v[a], c)) return !0; return !1 }; if (Sk.builtin.checkClass(b)) return a === b ? !0 : d(a, b); if (b instanceof Sk.builtin.tuple) { for (c = 0; c < b.v.length; ++c) if (Sk.builtin.issubclass(a, b.v[c])) return !0; return !1 } } ; Sk.builtin.globals = function() { var a, b = new Sk.builtin.dict([]); for (a in Sk.globals) { var c = Sk.unfixReserved(a); b.mp$ass_subscript(new Sk.builtin.str(c), Sk.globals[a]) } return b } ; Sk.builtin.divmod = function(a, b) { return Sk.abstr.numberBinOp(a, b, "DivMod") } ; Sk.builtin.format = function(a, b) { Sk.builtin.pyCheckArgsLen("format", arguments.length, 1, 2); void 0 === b && (b = Sk.builtin.str.$emptystr); return Sk.abstr.objectFormat(a, b) } ; Sk.builtin.reversed = function(a) { Sk.builtin.pyCheckArgsLen("reversed", arguments.length, 1, 1); var b = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$reversed); if (null != b) return Sk.misceval.callsimArray(b, [a]); if (!Sk.builtin.checkSequence(a)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(a) + "' object is not a sequence"); return new function(a) { this.idx = a.sq$length() - 1; this.myobj = a; this.getitem = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$getitem); this.tp$iter = function() { return this } ; this.tp$iternext = function() { if (!(0 > this.idx)) { try { var a = Sk.misceval.callsimArray(this.getitem, [this.myobj, Sk.ffi.remapToPy(this.idx)]) } catch (e) { if (e instanceof Sk.builtin.IndexError) return; throw e; } this.idx--; return a } } } (a) } ; Sk.builtin.id = function(a) { Sk.builtin.pyCheckArgsLen("id", arguments.length, 1, 1); void 0 === a.__id && (Sk.builtin.idCount += 1, a.__id = Sk.builtin.idCount); return new Sk.builtin.int_(a.__id) } ; Sk.builtin.bytearray = function() { throw new Sk.builtin.NotImplementedError("bytearray is not yet implemented"); } ; Sk.builtin.callable = function(a) { Sk.builtin.pyCheckArgsLen("callable", arguments.length, 1, 1); return Sk.builtin.checkCallable(a) ? Sk.builtin.bool.true$ : Sk.builtin.bool.false$ } ; Sk.builtin.delattr = function(a, b) { Sk.builtin.pyCheckArgsLen("delattr", arguments.length, 2, 2); if (void 0 !== a.$d[b.v]) return Sk.misceval.tryCatch(function() { return Sk.builtin.setattr(a, b, void 0) }, function(c) { Sk.misceval.tryCatch(function() { return Sk.builtin.setattr(a.$d, b, void 0) }, function(c) { if (c instanceof Sk.builtin.AttributeError) throw new Sk.builtin.AttributeError(Sk.abstr.typeName(a) + " instance has no attribute '" + b.v + "'"); throw c; }) }); if ("type" !== a.$r().v.slice(1, 5)) { if (a.ob$type === Sk.builtin.type && void 0 !== a[b.v]) return a[b.v] = void 0, Sk.builtin.none.none$; throw new Sk.builtin.AttributeError(Sk.abstr.typeName(a) + " instance has no attribute '" + b.v + "'"); } throw new Sk.builtin.TypeError("can't set attributes of built-in/extension type '" + a.prototype.tp$name + "'"); } ; Sk.builtin.execfile = function() { throw new Sk.builtin.NotImplementedError("execfile is not yet implemented"); } ; Sk.builtin.help = function() { throw new Sk.builtin.NotImplementedError("help is not yet implemented"); } ; Sk.builtin.iter = function(a, b) { Sk.builtin.pyCheckArgsLen("iter", arguments.length, 1, 2); if (1 === arguments.length) { if (Sk.builtin.checkIterable(a)) return new Sk.builtin.iterator(a); throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(a) + "' object is not iterable"); } if (Sk.builtin.checkCallable(a)) return new Sk.builtin.iterator(a,b); throw new TypeError("iter(v, w): v must be callable"); } ; Sk.builtin.locals = function() { throw new Sk.builtin.NotImplementedError("locals is not yet implemented"); } ; Sk.builtin.memoryview = function() { throw new Sk.builtin.NotImplementedError("memoryview is not yet implemented"); } ; Sk.builtin.next_ = function(a, b) { Sk.builtin.pyCheckArgsLen("next", arguments.length, 1, 2); if (!a.tp$iternext) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(a) + "' object is not an iterator"); var c = a.tp$iternext(); if (void 0 === c) { if (b) return b; throw new Sk.builtin.StopIteration; } return c } ; Sk.builtin.reload = function() { throw new Sk.builtin.NotImplementedError("reload is not yet implemented"); } ; Sk.builtin.vars = function() { throw new Sk.builtin.NotImplementedError("vars is not yet implemented"); } ; Sk.builtin.xrange = Sk.builtin.range; Sk.builtin.apply_ = function() { throw new Sk.builtin.NotImplementedError("apply is not yet implemented"); } ; Sk.builtin.buffer = function() { throw new Sk.builtin.NotImplementedError("buffer is not yet implemented"); } ; Sk.builtin.coerce = function() { throw new Sk.builtin.NotImplementedError("coerce is not yet implemented"); } ; Sk.builtin.intern = function() { throw new Sk.builtin.NotImplementedError("intern is not yet implemented"); } } , function(m, p) { String.fromCodePoint || function() { var a = function() { try { var a = {} , c = Object.defineProperty; var b = c(a, "foo", a) && c } catch (f) {} return b }() , b = String.fromCharCode , c = Math.floor , d = function(a) { var d = [] , e = -1 , f = arguments.length; if (!f) return ""; for (var k = ""; ++e < f; ) { var n = Number(arguments[e]); if (!isFinite(n) || 0 > n || 1114111 < n || c(n) != n) throw RangeError("Invalid code point: " + n); if (65535 >= n) d.push(n); else { n -= 65536; var l = (n >> 10) + 55296; n = n % 1024 + 56320; d.push(l, n) } if (e + 1 == f || 16384 < d.length) k += b.apply(null, d), d.length = 0 } return k }; a ? a(String, "fromCodePoint", { value: d, configurable: !0, writable: !0 }) : String.fromCodePoint = d }() } , function(m, p) { Sk.builtin.BaseException = function(...a) { if (!(this instanceof Sk.builtin.BaseException)) { var b = Object.create(Sk.builtin.BaseException.prototype); b.constructor.apply(b, arguments); return b } this.traceback = []; "string" === typeof a[0] ? (this.args = new Sk.builtin.tuple([new Sk.builtin.str(a[0])]), 3 <= a.length && this.traceback.push({ lineno: a[2], filename: a[1] || "" })) : this.args = new Sk.builtin.tuple(a) } ; Sk.abstr.setUpInheritance("BaseException", Sk.builtin.BaseException, Sk.builtin.object); Sk.builtin.BaseException.prototype.$r = function() { let a = this.tp$name; a += "(" + this.args.v.map(a=>Sk.misceval.objectRepr(a).v).join(", ") + ")"; return new Sk.builtin.str(a) } ; Sk.builtin.BaseException.prototype.tp$str = function() { return 1 >= this.args.v.length ? new Sk.builtin.str(this.args.v[0]) : this.args.$r() } ; Sk.builtin.BaseException.prototype.toString = function() { let a = this.tp$name; a += ": " + this.tp$str().v; return a = 0 !== this.traceback.length ? a + (" on line " + this.traceback[0].lineno) : a + " at " } ; Sk.builtin.BaseException.prototype.args = { tp$descr_get: function(a, b) { return a.args } }; Sk.exportSymbol("Sk.builtin.BaseException", Sk.builtin.BaseException); Sk.builtin.Exception = function(a) { if (!(this instanceof Sk.builtin.Exception)) { var b = Object.create(Sk.builtin.Exception.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.BaseException.apply(this, arguments) } ; Sk.abstr.setUpInheritance("Exception", Sk.builtin.Exception, Sk.builtin.BaseException); Sk.exportSymbol("Sk.builtin.Exception", Sk.builtin.Exception); Sk.builtin.AssertionError = function(a) { if (!(this instanceof Sk.builtin.AssertionError)) { var b = Object.create(Sk.builtin.AssertionError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("AssertionError", Sk.builtin.AssertionError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.AssertionError", Sk.builtin.AssertionError); Sk.builtin.AttributeError = function(a) { if (!(this instanceof Sk.builtin.AttributeError)) { var b = Object.create(Sk.builtin.AttributeError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("AttributeError", Sk.builtin.AttributeError, Sk.builtin.Exception); Sk.builtin.ImportError = function(a) { if (!(this instanceof Sk.builtin.ImportError)) { var b = Object.create(Sk.builtin.ImportError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("ImportError", Sk.builtin.ImportError, Sk.builtin.Exception); Sk.builtin.IndentationError = function(a) { if (!(this instanceof Sk.builtin.IndentationError)) { var b = Object.create(Sk.builtin.IndentationError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("IndentationError", Sk.builtin.IndentationError, Sk.builtin.Exception); Sk.builtin.IndexError = function(a) { if (!(this instanceof Sk.builtin.IndexError)) { var b = Object.create(Sk.builtin.IndexError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("IndexError", Sk.builtin.IndexError, Sk.builtin.Exception); Sk.builtin.LookupError = function(a) { if (!(this instanceof Sk.builtin.LookupError)) { var b = Object.create(Sk.builtin.LookupError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("LookupError", Sk.builtin.LookupError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.LookupError", Sk.builtin.LookupError); Sk.builtin.KeyError = function(a) { if (!(this instanceof Sk.builtin.KeyError)) { var b = Object.create(Sk.builtin.KeyError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.LookupError.apply(this, arguments) } ; Sk.abstr.setUpInheritance("KeyError", Sk.builtin.KeyError, Sk.builtin.LookupError); Sk.builtin.NameError = function(a) { if (!(this instanceof Sk.builtin.NameError)) { var b = Object.create(Sk.builtin.NameError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("NameError", Sk.builtin.NameError, Sk.builtin.Exception); Sk.builtin.UnboundLocalError = function(a) { if (!(this instanceof Sk.builtin.UnboundLocalError)) { var b = Object.create(Sk.builtin.UnboundLocalError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("UnboundLocalError", Sk.builtin.UnboundLocalError, Sk.builtin.Exception); Sk.builtin.OverflowError = function(a) { if (!(this instanceof Sk.builtin.OverflowError)) { var b = Object.create(Sk.builtin.OverflowError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("OverflowError", Sk.builtin.OverflowError, Sk.builtin.Exception); Sk.builtin.SyntaxError = function(a) { if (!(this instanceof Sk.builtin.SyntaxError)) { var b = Object.create(Sk.builtin.SyntaxError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("SyntaxError", Sk.builtin.SyntaxError, Sk.builtin.Exception); Sk.builtin.RuntimeError = function(a) { if (!(this instanceof Sk.builtin.RuntimeError)) { var b = Object.create(Sk.builtin.RuntimeError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("RuntimeError", Sk.builtin.RuntimeError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.RuntimeError", Sk.builtin.RuntimeError); Sk.builtin.SuspensionError = function(a) { if (!(this instanceof Sk.builtin.SuspensionError)) { var b = Object.create(Sk.builtin.SuspensionError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("SuspensionError", Sk.builtin.SuspensionError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.SuspensionError", Sk.builtin.SuspensionError); Sk.builtin.SystemExit = function(a) { if (!(this instanceof Sk.builtin.SystemExit)) { var b = Object.create(Sk.builtin.SystemExit.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.BaseException.apply(this, arguments) } ; Sk.abstr.setUpInheritance("SystemExit", Sk.builtin.SystemExit, Sk.builtin.BaseException); Sk.exportSymbol("Sk.builtin.SystemExit", Sk.builtin.SystemExit); Sk.builtin.TypeError = function(a) { if (!(this instanceof Sk.builtin.TypeError)) { var b = Object.create(Sk.builtin.TypeError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("TypeError", Sk.builtin.TypeError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.TypeError", Sk.builtin.TypeError); Sk.builtin.ValueError = function(a) { if (!(this instanceof Sk.builtin.ValueError)) { var b = Object.create(Sk.builtin.ValueError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("ValueError", Sk.builtin.ValueError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.ValueError", Sk.builtin.ValueError); Sk.builtin.ZeroDivisionError = function(a) { if (!(this instanceof Sk.builtin.ZeroDivisionError)) { var b = Object.create(Sk.builtin.ZeroDivisionError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("ZeroDivisionError", Sk.builtin.ZeroDivisionError, Sk.builtin.Exception); Sk.builtin.TimeLimitError = function(a) { if (!(this instanceof Sk.builtin.TimeLimitError)) { var b = Object.create(Sk.builtin.TimeLimitError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("TimeLimitError", Sk.builtin.TimeLimitError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.TimeLimitError", Sk.builtin.TimeLimitError); Sk.builtin.IOError = function(a) { if (!(this instanceof Sk.builtin.IOError)) { var b = Object.create(Sk.builtin.IOError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("IOError", Sk.builtin.IOError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.IOError", Sk.builtin.IOError); Sk.builtin.NotImplementedError = function(a) { if (!(this instanceof Sk.builtin.NotImplementedError)) { var b = Object.create(Sk.builtin.NotImplementedError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("NotImplementedError", Sk.builtin.NotImplementedError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.NotImplementedError", Sk.builtin.NotImplementedError); Sk.builtin.NegativePowerError = function(a) { if (!(this instanceof Sk.builtin.NegativePowerError)) { var b = Object.create(Sk.builtin.NegativePowerError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("NegativePowerError", Sk.builtin.NegativePowerError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.NegativePowerError", Sk.builtin.NegativePowerError); Sk.builtin.ExternalError = function(a, b) { if (!(this instanceof Sk.builtin.ExternalError)) { var c = Object.create(Sk.builtin.ExternalError.prototype); c.constructor.apply(c, arguments); return c } b = Array.prototype.slice.call(arguments); this.nativeError = b[0]; b[0]instanceof Sk.builtin.str || (b[0] = "" + b[0]); Sk.builtin.Exception.apply(this, b) } ; Sk.abstr.setUpInheritance("ExternalError", Sk.builtin.ExternalError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.ExternalError", Sk.builtin.ExternalError); Sk.builtin.OperationError = function(a) { if (!(this instanceof Sk.builtin.OperationError)) { var b = Object.create(Sk.builtin.OperationError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("OperationError", Sk.builtin.OperationError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.OperationError", Sk.builtin.OperationError); Sk.builtin.SystemError = function(a) { if (!(this instanceof Sk.builtin.SystemError)) { var b = Object.create(Sk.builtin.SystemError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("SystemError", Sk.builtin.SystemError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.SystemError", Sk.builtin.SystemError); Sk.builtin.UnicodeDecodeError = function(a) { if (!(this instanceof Sk.builtin.UnicodeDecodeError)) { var b = Object.create(Sk.builtin.UnicodeDecodeError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("UnicodeDecodeError", Sk.builtin.UnicodeDecodeError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.UnicodeDecodeError", Sk.builtin.UnicodeDecodeError); Sk.builtin.UnicodeEncodeError = function(a) { if (!(this instanceof Sk.builtin.UnicodeEncodeError)) { var b = Object.create(Sk.builtin.UnicodeEncodeError.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("UnicodeEncodeError", Sk.builtin.UnicodeEncodeError, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.UnicodeEncodeError", Sk.builtin.UnicodeEncodeError); Sk.builtin.StopIteration = function(a) { if (!(this instanceof Sk.builtin.StopIteration)) { var b = Object.create(Sk.builtin.StopIteration.prototype); b.constructor.apply(b, arguments); return b } Sk.builtin.Exception.apply(this, arguments) } ; Sk.abstr.setUpInheritance("StopIteration", Sk.builtin.StopIteration, Sk.builtin.Exception); Sk.exportSymbol("Sk.builtin.StopIteration", Sk.builtin.StopIteration); Sk.builtin.getExcInfo = function(a) { return new Sk.builtin.tuple([a.ob$type || Sk.builtin.none.none$, a, Sk.builtin.none.none$]) } } , function(m, p) { Sk.builtin.method = function(a, b, c, d) { if (!(this instanceof Sk.builtin.method)) { Sk.builtin.pyCheckArgsLen("method", arguments.length, 3, 3); if (!Sk.builtin.checkCallable(a)) throw new Sk.builtin.TypeError("First argument must be callable"); if (void 0 === b.ob$type) throw new Sk.builtin.TypeError("Second argument must be object of known type"); return new Sk.builtin.method(a,b,c) } this.tp$name = a.tp$name; this.im_func = a; this.im_self = b || Sk.builtin.none.none$; this.im_class = c || Sk.builtin.none.none$; this.im_builtin = d; this.$d = { im_func: a, im_self: b, im_class: c } } ; Sk.exportSymbol("Sk.builtin.method", Sk.builtin.method); Sk.abstr.setUpInheritance("instancemethod", Sk.builtin.method, Sk.builtin.object); Sk.builtin.method.prototype.tp$name = "method"; Sk.builtin.method.prototype.ob$eq = function(a) { if (this.im_self == Sk.builtin.none.none$ && a.im_self != Sk.builtin.none.none$ || a.im_self == Sk.builtin.none.none$ && this.im_self != Sk.builtin.none.none$) return !1; try { return Sk.misceval.richCompareBool(this.im_self, a.im_self, "Eq", !1) && this.im_func == a.im_func } catch (b) { return !1 } } ; Sk.builtin.method.prototype.ob$ne = function(a) { return !this.ob$eq(a) } ; Sk.builtin.method.prototype.tp$hash = function() { var a = this.im_self == Sk.builtin.none.none$ ? 0 : Sk.builtin.asnum$(Sk.builtin.hash(this.im_self)); var b = Sk.builtin.asnum$(Sk.builtin.hash(this.im_func)); return new Sk.builtin.int_(a + b) } ; Sk.builtin.method.prototype.tp$call = function(a, b) { this.im_self !== Sk.builtin.none.none$ && a.unshift(this.im_self); if (this.im_self === Sk.builtin.none.none$) { var c = function(a) { return "unbound method " + this.tp$name + "() must be called with " + Sk.abstr.typeName(this.im_class) + " instance as first argument (got " + a + " instead)" } .bind(this); if (0 < a.length) { if (this.im_class != Sk.builtin.none.none$ && !Sk.builtin.issubclass(a[0].ob$type, this.im_class) && !this.im_builtin) throw new Sk.builtin.TypeError(c(Sk.abstr.typeName(a[0].ob$type) + " instance")); } else throw new Sk.builtin.TypeError(c("nothing")); } return this.im_func.tp$call(a, b) } ; Sk.builtin.method.prototype.tp$descr_get = function(a, b) { Sk.asserts.assert(void 0 !== a && void 0 !== b); return new Sk.builtin.method(this,a,b,this.im_builtin) } ; Sk.builtin.method.pythonFunctions = ["__get__"]; Sk.builtin.method.prototype.__get__ = function(a, b, c) { Sk.builtin.pyCheckArgsLen("__get__", arguments.length, 1, 2, !1, !0); if (b === Sk.builtin.none.none$ && c === Sk.builtin.none.none$) throw new Sk.builtin.TypeError("__get__(None, None) is invalid"); return c && c !== Sk.builtin.none.none$ ? Sk.builtin.issubclass(c, a.im_class) ? a.tp$descr_get(b, c) : a : a.tp$descr_get(b, Sk.builtin.none.none$) } ; Sk.builtin.method.prototype.$r = function() { return this.im_builtin ? new Sk.builtin.str("") : this.im_self === Sk.builtin.none.none$ ? new Sk.builtin.str("") : new Sk.builtin.str("") } } , function(m, p) { Sk.misceval = {}; Sk.misceval.Suspension = function(a, b, c) { this.$isSuspension = !0; void 0 !== a && void 0 !== b && (this.resume = function() { return a(b.resume()) } ); this.child = b; this.optional = void 0 !== b && b.optional; this.data = void 0 === c && void 0 !== b ? b.data : c } ; Sk.exportSymbol("Sk.misceval.Suspension", Sk.misceval.Suspension); Sk.misceval.retryOptionalSuspensionOrThrow = function(a, b) { for (; a instanceof Sk.misceval.Suspension; ) { if (!a.optional) throw new Sk.builtin.SuspensionError(b || "Cannot call a function that blocks or suspends here"); a = a.resume() } return a } ; Sk.exportSymbol("Sk.misceval.retryOptionalSuspensionOrThrow", Sk.misceval.retryOptionalSuspensionOrThrow); Sk.misceval.isIndex = function(a) { return Sk.builtin.checkInt(a) || Sk.abstr.lookupSpecial(a, Sk.builtin.str.$index) ? !0 : !1 } ; Sk.exportSymbol("Sk.misceval.isIndex", Sk.misceval.isIndex); Sk.misceval.asIndex = function(a) { var b; if (Sk.misceval.isIndex(a) && null !== a) { if (!0 === a) return 1; if (!1 === a) return 0; if ("number" === typeof a) return a; if (a.constructor === Sk.builtin.int_) return a.v; if (a.constructor === Sk.builtin.lng) return a.cantBeInt() ? a.str$(10, !0) : a.toInt$(); if (a.constructor === Sk.builtin.bool) return Sk.builtin.asnum$(a); if (b = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$index)) { a = Sk.misceval.callsimArray(b, [a]); if (!Sk.builtin.checkInt(a)) throw new Sk.builtin.TypeError("__index__ returned non-(int,long) (type " + Sk.abstr.typeName(a) + ")"); return Sk.builtin.asnum$(a) } Sk.asserts.fail("todo asIndex;") } } ; Sk.misceval.applySlice = function(a, b, c, d) { return a.sq$slice && Sk.misceval.isIndex(b) && Sk.misceval.isIndex(c) ? (b = Sk.misceval.asIndex(b), void 0 === b && (b = 0), c = Sk.misceval.asIndex(c), void 0 === c && (c = 1E100), Sk.abstr.sequenceGetSlice(a, b, c)) : Sk.abstr.objectGetItem(a, new Sk.builtin.slice(b,c,null), d) } ; Sk.exportSymbol("Sk.misceval.applySlice", Sk.misceval.applySlice); Sk.misceval.assignSlice = function(a, b, c, d, e) { if (a.sq$ass_slice && Sk.misceval.isIndex(b) && Sk.misceval.isIndex(c)) e = Sk.misceval.asIndex(b) || 0, c = Sk.misceval.asIndex(c) || 1E100, null === d ? Sk.abstr.sequenceDelSlice(a, e, c) : Sk.abstr.sequenceSetSlice(a, e, c, d); else return c = new Sk.builtin.slice(b,c), null === d ? Sk.abstr.objectDelItem(a, c) : Sk.abstr.objectSetItem(a, c, d, e) } ; Sk.exportSymbol("Sk.misceval.assignSlice", Sk.misceval.assignSlice); Sk.misceval.arrayFromArguments = function(a) { var b; if (1 != a.length) return a; var c = a[0]; c instanceof Sk.builtin.set ? c = c.tp$iter().$obj : c instanceof Sk.builtin.dict && (c = Sk.builtin.dict.prototype.keys.func_code(c)); if (c instanceof Sk.builtin.list || c instanceof Sk.builtin.tuple) return c.v; if (Sk.builtin.checkIterable(c)) { a = []; c = Sk.abstr.iter(c); for (b = c.tp$iternext(); void 0 !== b; b = c.tp$iternext()) a.push(b); return a } throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(c) + "' object is not iterable"); } ; Sk.exportSymbol("Sk.misceval.arrayFromArguments", Sk.misceval.arrayFromArguments); Sk.misceval.swappedOp_ = { Eq: "Eq", NotEq: "NotEq", Lt: "Gt", LtE: "GtE", Gt: "Lt", GtE: "LtE" }; Sk.misceval.opSymbols = { Eq: "==", NotEq: "!=", Lt: "<", LtE: "<=", Gt: ">", GtE: ">=", Is: "is", IsNot: "is not", In_: "in", NotIn: "not in" }; Sk.misceval.richCompareBool = function(a, b, c, d) { var e; Sk.asserts.assert(null !== a && void 0 !== a, "passed null or undefined parameter to Sk.misceval.richCompareBool"); Sk.asserts.assert(null !== b && void 0 !== b, "passed null or undefined parameter to Sk.misceval.richCompareBool"); var h = a.ob$type; var g = b.ob$type; if (!Sk.__future__.python3 && h !== g && ("GtE" === c || "Gt" === c || "LtE" === c || "Lt" === c)) { var f = [Sk.builtin.float_, Sk.builtin.int_, Sk.builtin.lng, Sk.builtin.bool] , k = [Sk.builtin.dict, Sk.builtin.enumerate, Sk.builtin.filter_, Sk.builtin.list, Sk.builtin.map_, Sk.builtin.str, Sk.builtin.tuple, Sk.builtin.zip_]; const d = f.indexOf(h) , e = k.indexOf(h); f = f.indexOf(g); k = k.indexOf(g); if (a === Sk.builtin.none.none$) switch (c) { case "Lt": return !0; case "LtE": return !0; case "Gt": return !1; case "GtE": return !1 } if (b === Sk.builtin.none.none$) switch (c) { case "Lt": return !1; case "LtE": return !1; case "Gt": return !0; case "GtE": return !0 } if (-1 !== d && -1 !== k) switch (c) { case "Lt": return !0; case "LtE": return !0; case "Gt": return !1; case "GtE": return !1 } if (-1 !== e && -1 !== f) switch (c) { case "Lt": return !1; case "LtE": return !1; case "Gt": return !0; case "GtE": return !0 } if (-1 !== e && -1 !== k) switch (c) { case "Lt": return e < k; case "LtE": return e <= k; case "Gt": return e > k; case "GtE": return e >= k } } if ("Is" === c) { if (h === g) { if (a === b) return !0; if (h === Sk.builtin.float_ || h === Sk.builtin.int_) return a.v === b.v; if (h === Sk.builtin.lng) return 0 === a.longCompare(b) } return !1 } if ("IsNot" === c) return h !== g ? !0 : h === Sk.builtin.float_ || h === Sk.builtin.int_ ? a.v !== b.v : h === Sk.builtin.lng ? 0 !== a.longCompare(b) : a !== b; if ("In" === c) return Sk.misceval.chain(Sk.abstr.sequenceContains(b, a, d), Sk.misceval.isTrue); if ("NotIn" === c) return Sk.misceval.chain(Sk.abstr.sequenceContains(b, a, d), function(a) { return !Sk.misceval.isTrue(a) }); g = { Eq: "ob$eq", NotEq: "ob$ne", Gt: "ob$gt", GtE: "ob$ge", Lt: "ob$lt", LtE: "ob$le" }; h = g[c]; if ((d = a.constructor.prototype.hasOwnProperty(h)) && (e = a[h](b)) !== Sk.builtin.NotImplemented.NotImplemented$) return Sk.misceval.isTrue(e); g = g[Sk.misceval.swappedOp_[c]]; if ((h = b.constructor.prototype.hasOwnProperty(g)) && (e = b[g](a)) !== Sk.builtin.NotImplemented.NotImplemented$) return Sk.misceval.isTrue(e); if (a.tp$richcompare && void 0 !== (e = a.tp$richcompare(b, c)) && e !== Sk.builtin.NotImplemented.NotImplemented$ || b.tp$richcompare && void 0 !== (e = b.tp$richcompare(a, Sk.misceval.swappedOp_[c])) && e !== Sk.builtin.NotImplemented.NotImplemented$) return Sk.misceval.isTrue(e); if ((g = Sk.abstr.lookupSpecial(a, Sk.misceval.op2method_[c])) && !d && (e = Sk.misceval.callsimArray(g, [a, b]), e != Sk.builtin.NotImplemented.NotImplemented$) || (d = Sk.abstr.lookupSpecial(b, Sk.misceval.op2method_[Sk.misceval.swappedOp_[c]])) && !h && (e = Sk.misceval.callsimArray(d, [b, a]), e != Sk.builtin.NotImplemented.NotImplemented$)) return Sk.misceval.isTrue(e); if (!Sk.__future__.python3) { if (d = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$cmp)) try { e = Sk.misceval.callsimArray(d, [a, b]); if (Sk.builtin.checkNumber(e)) { e = Sk.builtin.asnum$(e); if ("Eq" === c) return 0 === e; if ("NotEq" === c) return 0 !== e; if ("Lt" === c) return 0 > e; if ("Gt" === c) return 0 < e; if ("LtE" === c) return 0 >= e; if ("GtE" === c) return 0 <= e } if (e !== Sk.builtin.NotImplemented.NotImplemented$) throw new Sk.builtin.TypeError("comparison did not return an int"); } catch (n) { throw new Sk.builtin.TypeError("comparison did not return an int"); } if (d = Sk.abstr.lookupSpecial(b, Sk.builtin.str.$cmp)) try { e = Sk.misceval.callsimArray(d, [b, a]); if (Sk.builtin.checkNumber(e)) { e = Sk.builtin.asnum$(e); if ("Eq" === c) return 0 === e; if ("NotEq" === c) return 0 !== e; if ("Lt" === c) return 0 < e; if ("Gt" === c) return 0 > e; if ("LtE" === c) return 0 <= e; if ("GtE" === c) return 0 >= e } if (e !== Sk.builtin.NotImplemented.NotImplemented$) throw new Sk.builtin.TypeError("comparison did not return an int"); } catch (n) { throw new Sk.builtin.TypeError("comparison did not return an int"); } if (a === Sk.builtin.none.none$ && b === Sk.builtin.none.none$) { if ("Eq" === c) return a.v === b.v; if ("NotEq" === c) return a.v !== b.v; if ("Gt" === c) return a.v > b.v; if ("GtE" === c) return a.v >= b.v; if ("Lt" === c) return a.v < b.v; if ("LtE" === c) return a.v <= b.v } } if ("Eq" === c) return a === b; if ("NotEq" === c) return a !== b; a = Sk.abstr.typeName(a); b = Sk.abstr.typeName(b); throw new Sk.builtin.TypeError("'" + Sk.misceval.opSymbols[c] + "' not supported between instances of '" + a + "' and '" + b + "'"); } ; Sk.exportSymbol("Sk.misceval.richCompareBool", Sk.misceval.richCompareBool); Sk.misceval.objectRepr = function(a) { Sk.asserts.assert(void 0 !== a, "trying to repr undefined"); return null === a || a === Sk.builtin.none.none$ ? new Sk.builtin.str("None") : !0 === a ? new Sk.builtin.str("True") : !1 === a ? new Sk.builtin.str("False") : "number" === typeof a ? new Sk.builtin.str("" + a) : "string" === typeof a ? new Sk.builtin.str(a) : a.$r ? a.constructor === Sk.builtin.float_ ? Infinity === a.v ? new Sk.builtin.str("inf") : -Infinity === a.v ? new Sk.builtin.str("-inf") : a.$r() : a.$r() : a.tp$name ? new Sk.builtin.str("<" + a.tp$name + " object>") : new Sk.builtin.str("") } ; Sk.exportSymbol("Sk.misceval.objectRepr", Sk.misceval.objectRepr); Sk.misceval.opAllowsEquality = function(a) { switch (a) { case "LtE": case "Eq": case "GtE": return !0 } return !1 } ; Sk.exportSymbol("Sk.misceval.opAllowsEquality", Sk.misceval.opAllowsEquality); Sk.misceval.isTrue = function(a) { if (!0 === a) return !0; if (!1 === a || null === a || a.constructor === Sk.builtin.none || a.constructor === Sk.builtin.NotImplemented) return !1; if (a.constructor === Sk.builtin.bool) return a.v; if ("number" === typeof a) return 0 !== a; if (a instanceof Sk.builtin.lng) return a.nb$nonzero(); if (a.constructor === Sk.builtin.int_ || a.constructor === Sk.builtin.float_) return 0 !== a.v; if (Sk.__future__.python3) { if (a.nb$bool) { a = a.nb$bool(); if (!(a instanceof Sk.builtin.bool)) throw new Sk.builtin.TypeError("__bool__ should return bool, returned " + Sk.abstr.typeName(a)); return a.v } } else if (a.nb$nonzero) { a = a.nb$nonzero(); if (!Sk.builtin.checkInt(a)) throw new Sk.builtin.TypeError("__nonzero__ should return an int"); return 0 !== Sk.builtin.asnum$(a) } if (a.sq$length) { a = a.sq$length(); if (!Sk.builtin.checkInt(a)) throw new Sk.builtin.TypeError("__len__ should return an int"); return 0 !== Sk.builtin.asnum$(a) } return a.mp$length ? 0 !== Sk.builtin.asnum$(a.mp$length()) : a.sq$length ? 0 !== Sk.builtin.asnum$(a.sq$length()) : !0 } ; Sk.exportSymbol("Sk.misceval.isTrue", Sk.misceval.isTrue); Sk.misceval.softspace_ = !1; Sk.misceval.print_ = function(a) { Sk.misceval.softspace_ && ("\n" !== a && Sk.output(" "), Sk.misceval.softspace_ = !1); var b = new Sk.builtin.str(a); return Sk.misceval.chain(Sk.importModule("sys", !1, !0), function(a) { return Sk.misceval.apply(a.$d.stdout.write, void 0, void 0, void 0, [a.$d.stdout, b]) }, function() { var a; (a = 0 === b.v.length) || (a = b.v[b.v.length - 1], a = !("\n" === a || "\t" === a || "\r" === a)); if (a || " " === b.v[b.v.length - 1]) Sk.misceval.softspace_ = !0 }) } ; Sk.exportSymbol("Sk.misceval.print_", Sk.misceval.print_); Sk.misceval.loadname = function(a, b) { b = b[a]; if (void 0 !== b) return "function" === typeof b && void 0 === b.$d && void 0 === b.tp$name ? b() : b; b = Sk.builtins[a]; if (void 0 !== b) return b; throw new Sk.builtin.NameError("name '" + Sk.unfixReserved(a) + "' is not defined"); } ; Sk.exportSymbol("Sk.misceval.loadname", Sk.misceval.loadname); Sk.misceval.call = function(a, b, c, d, e) { e = Array.prototype.slice.call(arguments, 4); return Sk.misceval.apply(a, b, c, d, e) } ; Sk.exportSymbol("Sk.misceval.call", Sk.misceval.call); Sk.misceval.callAsync = function(a, b, c, d, e, h) { h = Array.prototype.slice.call(arguments, 5); return Sk.misceval.applyAsync(a, b, c, d, e, h) } ; Sk.exportSymbol("Sk.misceval.callAsync", Sk.misceval.callAsync); Sk.misceval.callOrSuspend = function(a, b, c, d, e) { e = Array.prototype.slice.call(arguments, 4); return Sk.misceval.applyOrSuspend(a, b, c, d, e) } ; Sk.exportSymbol("Sk.misceval.callOrSuspend", Sk.misceval.callOrSuspend); Sk.misceval.callsim = function(a, b) { b = Array.prototype.slice.call(arguments, 1); return Sk.misceval.apply(a, void 0, void 0, void 0, b) } ; Sk.exportSymbol("Sk.misceval.callsim", Sk.misceval.callsim); Sk.misceval.callsimArray = function(a, b, c) { return Sk.misceval.apply(a, void 0, void 0, c, b ? b : []) } ; Sk.exportSymbol("Sk.misceval.callsimArray", Sk.misceval.callsimArray); Sk.misceval.callsimAsync = function(a, b, c) { c = Array.prototype.slice.call(arguments, 2); return Sk.misceval.applyAsync(a, b, void 0, void 0, void 0, c) } ; Sk.exportSymbol("Sk.misceval.callsimAsync", Sk.misceval.callsimAsync); Sk.misceval.callsimOrSuspend = function(a, b) { b = Array.prototype.slice.call(arguments, 1); return Sk.misceval.applyOrSuspend(a, void 0, void 0, void 0, b) } ; Sk.exportSymbol("Sk.misceval.callsimOrSuspend", Sk.misceval.callsimOrSuspend); Sk.misceval.callsimOrSuspendArray = function(a, b, c) { b || (b = []); return a.tp$call ? a.tp$call(b, c) : Sk.misceval.applyOrSuspend(a, void 0, void 0, c, b) } ; Sk.exportSymbol("Sk.misceval.callsimOrSuspendArray", Sk.misceval.callsimOrSuspendArray); Sk.misceval.apply = function(a, b, c, d, e) { a = Sk.misceval.applyOrSuspend(a, b, c, d, e); return a instanceof Sk.misceval.Suspension ? Sk.misceval.retryOptionalSuspensionOrThrow(a) : a } ; Sk.exportSymbol("Sk.misceval.apply", Sk.misceval.apply); Sk.misceval.asyncToPromise = function(a, b) { return new Promise(function(c, d) { try { (function g(a) { try { for (var f = function() { try { g(a.resume()) } catch (u) { d(u) } }, h = function(c) { try { a.data.result = c, f() } catch (z) { d(z) } }, n = function(c) { try { a.data.error = c, f() } catch (z) { d(z) } }; a instanceof Sk.misceval.Suspension; ) { var l = b && (b[a.data.type] || b["*"]); if (l) { var q = l(a); if (q) { q.then(g, d); return } } if ("Sk.promise" == a.data.type) { a.data.promise.then(h, n); return } if ("Sk.yield" == a.data.type) { Sk.global.setImmediate(f); return } if ("Sk.delay" == a.data.type) { Sk.global.setImmediate(f); return } if (a.optional) a = a.resume(); else throw new Sk.builtin.SuspensionError("Unhandled non-optional suspension of type '" + a.data.type + "'"); } c(a) } catch (u) { d(u) } } )(a()) } catch (e) { d(e) } } ) } ; Sk.exportSymbol("Sk.misceval.asyncToPromise", Sk.misceval.asyncToPromise); Sk.misceval.applyAsync = function(a, b, c, d, e, h) { return Sk.misceval.asyncToPromise(function() { return Sk.misceval.applyOrSuspend(b, c, d, e, h) }, a) } ; Sk.exportSymbol("Sk.misceval.applyAsync", Sk.misceval.applyAsync); Sk.misceval.chain = function(a, b) { for (var c = 1, d = a, e, h; ; ) { if (c == arguments.length) return d; if (d && d.$isSuspension) break; d = arguments[c](d); c++ } h = Array(arguments.length - c); for (e = 0; e < arguments.length - c; e++) h[e] = arguments[c + e]; e = 0; return function k(a) { for (; e < h.length; ) { if (a instanceof Sk.misceval.Suspension) return new Sk.misceval.Suspension(k,a); a = h[e](a); e++ } return a }(d) } ; Sk.exportSymbol("Sk.misceval.chain", Sk.misceval.chain); Sk.misceval.tryCatch = function(a, b) { try { var c = a() } catch (d) { return b(d) } return c instanceof Sk.misceval.Suspension ? (a = new Sk.misceval.Suspension(void 0,c), a.resume = function() { return Sk.misceval.tryCatch(c.resume, b) } , a) : c } ; Sk.exportSymbol("Sk.misceval.tryCatch", Sk.misceval.tryCatch); Sk.misceval.iterFor = function(a, b, c) { var d = c , e = function(c) { d = c; return c instanceof Sk.misceval.Break ? c : a.tp$iternext(!0) }; return function f(a) { for (; void 0 !== a; ) { if (a instanceof Sk.misceval.Suspension) return new Sk.misceval.Suspension(f,a); if (a === Sk.misceval.Break || a instanceof Sk.misceval.Break) return a.brValue; a = Sk.misceval.chain(b(a, d), e) } return d }(a.tp$iternext(!0)) } ; Sk.exportSymbol("Sk.misceval.iterFor", Sk.misceval.iterFor); Sk.misceval.arrayFromIterable = function(a, b) { if (void 0 === a) return []; if (void 0 === (a.hp$type || void 0) && void 0 !== a.sk$asarray) return a.sk$asarray(); const c = []; a = Sk.misceval.chain(Sk.misceval.iterFor(Sk.abstr.iter(a), a=>{ c.push(a) } ), ()=>c); return b ? a : Sk.misceval.retryOptionalSuspensionOrThrow(a) } ; Sk.misceval.Break = function(a) { if (!(this instanceof Sk.misceval.Break)) return new Sk.misceval.Break(a); this.brValue = a } ; Sk.exportSymbol("Sk.misceval.Break", Sk.misceval.Break); Sk.misceval.applyOrSuspend = function(a, b, c, d, e) { var h; if (null === a || a === Sk.builtin.none.none$) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(a) + "' object is not callable"); "function" === typeof a && void 0 === a.tp$call && (a = new Sk.builtin.func(a)); var g = a.tp$call; if (void 0 !== g) { if (c) for (c = c.tp$iter(), h = c.tp$iternext(); void 0 !== h; h = c.tp$iternext()) e.push(h); if (b) for (c = Sk.abstr.iter(b), h = c.tp$iternext(); void 0 !== h; h = c.tp$iternext()) { if (!Sk.builtin.checkString(h)) throw new Sk.builtin.TypeError("Function keywords must be strings"); d.push(h.v); d.push(Sk.abstr.objectGetItem(b, h, !1)) } return g.call(a, e, d, b) } g = a.__call__; if (void 0 !== g) return e.unshift(a), Sk.misceval.apply(g, b, c, d, e); throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(a) + "' object is not callable"); } ; Sk.exportSymbol("Sk.misceval.applyOrSuspend", Sk.misceval.applyOrSuspend); Sk.misceval.promiseToSuspension = function(a) { var b = new Sk.misceval.Suspension; b.resume = function() { if (b.data.error) throw b.data.error; return b.data.result } ; b.data = { type: "Sk.promise", promise: a }; return b } ; Sk.exportSymbol("Sk.misceval.promiseToSuspension", Sk.misceval.promiseToSuspension); Sk.misceval.buildClass = function(a, b, c, d, e) { var h = Sk.builtin.type , g = {}; b(a, g, void 0 === e ? {} : e); a.__name__ && (g.__module__ = a.__name__); a = new Sk.builtin.str(c); d = new Sk.builtin.tuple(d); b = []; for (var f in g) g.hasOwnProperty(f) && (b.push(new Sk.builtin.str(f)), b.push(g[f])); b = new Sk.builtin.dict(b); return Sk.misceval.callsimArray(h, [a, d, b]) } ; Sk.exportSymbol("Sk.misceval.buildClass", Sk.misceval.buildClass) } , function(m, p) { Sk.builtin.seqtype = function() { throw new Sk.builtin.ExternalError("Cannot instantiate abstract Sk.builtin.seqtype class"); } ; Sk.abstr.setUpInheritance("SequenceType", Sk.builtin.seqtype, Sk.builtin.object); Sk.builtin.seqtype.sk$abstract = !0; Sk.builtin.seqtype.prototype.__len__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__len__", arguments.length, 0, 0, !1, !0); return new Sk.builtin.int_(a.sq$length()) } ); Sk.builtin.seqtype.prototype.__iter__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__iter__", arguments.length, 0, 0, !1, !0); return a.tp$iter() } ); Sk.builtin.seqtype.prototype.__contains__ = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("__contains__", arguments.length, 1, 1, !1, !0); return a.sq$contains(b) ? Sk.builtin.bool.true$ : Sk.builtin.bool.false$ } ); Sk.builtin.seqtype.prototype.__getitem__ = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("__getitem__", arguments.length, 1, 1, !1, !0); return a.mp$subscript(b) } ); Sk.builtin.seqtype.prototype.__add__ = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("__add__", arguments.length, 1, 1, !1, !0); return a.sq$concat(b) } ); Sk.builtin.seqtype.prototype.__mul__ = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("__mul__", arguments.length, 1, 1, !1, !0); if (!Sk.misceval.isIndex(b)) throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '" + Sk.abstr.typeName(b) + "'"); return a.sq$repeat(b) } ); Sk.builtin.seqtype.prototype.__rmul__ = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("__rmul__", arguments.length, 1, 1, !1, !0); return a.sq$repeat(b) } ) } , function(m, p) { Sk.builtin.list = function(a, b) { if (!(this instanceof Sk.builtin.list)) return Sk.builtin.pyCheckArgsLen("list", arguments.length, 0, 1), new Sk.builtin.list(a,!0); if (void 0 === a) this.v = []; else if (Array.isArray(a)) this.v = a; else return Sk.misceval.chain(Sk.misceval.arrayFromIterable(a, b), a=>{ this.v = a; return this } ) } ; Sk.abstr.setUpInheritance("list", Sk.builtin.list, Sk.builtin.seqtype); Sk.abstr.markUnhashable(Sk.builtin.list); Sk.builtin.list.prototype.__class__ = Sk.builtin.list; Sk.builtin.list.prototype.sk$asarray = function() { return this.v.slice(0) } ; Sk.builtin.list.prototype.list_concat_ = function(a) { if (!a.__class__ || a.__class__ != Sk.builtin.list) throw new Sk.builtin.TypeError("can only concatenate list to list"); return new Sk.builtin.list(this.v.concat(a.v),!1) } ; Sk.builtin.list.prototype.list_extend_ = function(a) { var b; if (a.sk$asarray) return this.v.push.apply(this.v, a.sk$asarray()), this; if (!Sk.builtin.checkIterable(a)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(a) + "' object is not iterable"); a = Sk.abstr.iter(a); for (b = a.tp$iternext(); void 0 !== b; b = a.tp$iternext()) this.v.push(b); return this } ; Sk.builtin.list.prototype.list_del_item_ = function(a) { a = Sk.builtin.asnum$(a); if (0 > a || a >= this.v.length) throw new Sk.builtin.IndexError("list assignment index out of range"); this.list_del_slice_(a, a + 1) } ; Sk.builtin.list.prototype.list_del_slice_ = function(a, b) { a = Sk.builtin.asnum$(a); b = Sk.builtin.asnum$(b); var c = []; c.unshift(b - a); c.unshift(a); this.v.splice.apply(this.v, c) } ; Sk.builtin.list.prototype.list_ass_item_ = function(a, b) { a = Sk.builtin.asnum$(a); if (0 > a || a >= this.v.length) throw new Sk.builtin.IndexError("list assignment index out of range"); this.v[a] = b } ; Sk.builtin.list.prototype.list_ass_slice_ = function(a, b, c) { a = Sk.builtin.asnum$(a); b = Sk.builtin.asnum$(b); if (Sk.builtin.checkIterable(c)) c = (new Sk.builtin.list(c,!1)).v.slice(0); else throw new Sk.builtin.TypeError("can only assign an iterable"); c.unshift(b - a); c.unshift(a); this.v.splice.apply(this.v, c) } ; Sk.builtin.list.prototype.$r = function() { var a, b = []; var c = Sk.abstr.iter(this); for (a = c.tp$iternext(); void 0 !== a; a = c.tp$iternext()) a === this ? b.push("[...]") : b.push(Sk.misceval.objectRepr(a).v); return new Sk.builtin.str("[" + b.join(", ") + "]") } ; Sk.builtin.list.prototype.tp$richcompare = function(a, b) { var c; if (this === a && Sk.misceval.opAllowsEquality(b)) return !0; if (!a.__class__ || a.__class__ != Sk.builtin.list) return "Eq" === b ? !1 : "NotEq" === b ? !0 : Sk.__future__.python3 ? Sk.builtin.NotImplemented.NotImplemented$ : !1; var d = this.v; a = a.v; var e = d.length; var h = a.length; for (c = 0; c < e && c < h; ++c) { var g = Sk.misceval.richCompareBool(d[c], a[c], "Eq"); if (!g) break } if (c >= e || c >= h) switch (b) { case "Lt": return e < h; case "LtE": return e <= h; case "Eq": return e === h; case "NotEq": return e !== h; case "Gt": return e > h; case "GtE": return e >= h; default: Sk.asserts.fail() } return "Eq" === b ? !1 : "NotEq" === b ? !0 : Sk.misceval.richCompareBool(d[c], a[c], b) } ; Sk.builtin.list.prototype.__iter__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__iter__", arguments.length, 0, 0, !0, !1); return new Sk.builtin.list_iter_(a) } ); Sk.builtin.list.prototype.tp$iter = function() { return new Sk.builtin.list_iter_(this) } ; Sk.builtin.list.prototype.sq$length = function() { return this.v.length } ; Sk.builtin.list.prototype.sq$concat = Sk.builtin.list.prototype.list_concat_; Sk.builtin.list.prototype.nb$add = Sk.builtin.list.prototype.list_concat_; Sk.builtin.list.prototype.nb$inplace_add = Sk.builtin.list.prototype.list_extend_; Sk.builtin.list.prototype.sq$repeat = function(a) { if (!Sk.misceval.isIndex(a)) throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '" + Sk.abstr.typeName(a) + "'"); var b = Sk.misceval.asIndex(a); if ("number" !== typeof b) throw new Sk.builtin.OverflowError("cannot fit '" + Sk.abstr.typeName(a) + "' into an index-sized integer"); var c = []; for (a = 0; a < b; ++a) c.push.apply(c, this.v); return new Sk.builtin.list(c,!1) } ; Sk.builtin.list.prototype.nb$multiply = Sk.builtin.list.prototype.sq$repeat; Sk.builtin.list.prototype.nb$inplace_multiply = function(a) { if (!Sk.misceval.isIndex(a)) throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '" + Sk.abstr.typeName(a) + "'"); var b = Sk.misceval.asIndex(a); if ("number" !== typeof b) throw new Sk.builtin.OverflowError("cannot fit '" + Sk.abstr.typeName(a) + "' into an index-sized integer"); for (a = 1; a < b; ++a) this.v.push.apply(this.v, this.v); return this } ; Sk.builtin.list.prototype.sq$ass_item = Sk.builtin.list.prototype.list_ass_item_; Sk.builtin.list.prototype.sq$del_item = Sk.builtin.list.prototype.list_del_item_; Sk.builtin.list.prototype.sq$ass_slice = Sk.builtin.list.prototype.list_ass_slice_; Sk.builtin.list.prototype.sq$del_slice = Sk.builtin.list.prototype.list_del_slice_; Sk.builtin.list.prototype.sq$contains = function(a) { var b, c = this.v; for (b = 0; b < c.length; b++) if (Sk.misceval.richCompareBool(c[b], a, "Eq")) return !0; return !1 } ; Sk.builtin.list.prototype.__contains__ = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("__contains__", arguments.length, 2, 2); return new Sk.builtin.bool(a.sq$contains(b)) } ); Sk.builtin.list.prototype.list_subscript_ = function(a) { if (Sk.misceval.isIndex(a)) { let b = Sk.misceval.asIndex(a); if ("number" !== typeof b) throw new Sk.builtin.IndexError("cannot fit '" + Sk.abstr.typeName(a) + "' into an index-sized integer"); if (void 0 !== b) { 0 > b && (b = this.v.length + b); if (0 > b || b >= this.v.length) throw new Sk.builtin.IndexError("list index out of range"); return this.v[b] } } else if (a instanceof Sk.builtin.slice) { const b = []; a.sssiter$(this.v.length, a=>{ b.push(this.v[a]) } ); return new Sk.builtin.list(b,!1) } throw new Sk.builtin.TypeError("list indices must be integers, not " + Sk.abstr.typeName(a)); } ; Sk.builtin.list.prototype.list_ass_subscript_ = function(a, b) { if (Sk.misceval.isIndex(a)) { var c = Sk.misceval.asIndex(a); if ("number" !== typeof c) throw new Sk.builtin.IndexError("cannot fit '" + Sk.abstr.typeName(a) + "' into an index-sized integer"); if (void 0 !== c) { 0 > c && (c = this.v.length + c); this.list_ass_item_(c, b); return } } else if (a instanceof Sk.builtin.slice) { c = a.slice_indices_(this.v.length); if (1 === c[2]) this.list_ass_slice_(c[0], c[1], b); else { const d = []; a.sssiter$(this.v.length, a=>{ d.push(a) } ); a = 0; if (d.length !== b.v.length) throw new Sk.builtin.ValueError("attempt to assign sequence of size " + b.v.length + " to extended slice of size " + d.length); for (c = 0; c < d.length; ++c) this.v.splice(d[c], 1, b.v[a]), a += 1 } return } throw new Sk.builtin.TypeError("list indices must be integers, not " + Sk.abstr.typeName(a)); } ; Sk.builtin.list.prototype.list_del_subscript_ = function(a) { if (Sk.misceval.isIndex(a)) { var b = Sk.misceval.asIndex(a); if (void 0 !== b) { 0 > b && (b = this.v.length + b); this.list_del_item_(b); return } } else if (a instanceof Sk.builtin.slice) { b = a.slice_indices_(this.v.length); if (1 === b[2]) this.list_del_slice_(b[0], b[1]); else { const c = this.v; let d = 0; const e = 0 < b[2] ? 1 : 0; a.sssiter$(c.length, a=>{ c.splice(a - d, 1); d += e } ) } return } throw new Sk.builtin.TypeError("list indices must be integers, not " + typeof a); } ; Sk.builtin.list.prototype.mp$subscript = Sk.builtin.list.prototype.list_subscript_; Sk.builtin.list.prototype.mp$ass_subscript = Sk.builtin.list.prototype.list_ass_subscript_; Sk.builtin.list.prototype.mp$del_subscript = Sk.builtin.list.prototype.list_del_subscript_; Sk.builtin.list.prototype.__getitem__ = new Sk.builtin.func(function(a, b) { return Sk.builtin.list.prototype.list_subscript_.call(a, b) } ); Sk.builtin.list.prototype.__setitem__ = new Sk.builtin.func(function(a, b, c) { return Sk.builtin.list.prototype.list_ass_subscript_.call(a, b, c) } ); Sk.builtin.list.prototype.__delitem__ = new Sk.builtin.func(function(a, b) { return Sk.builtin.list.prototype.list_del_subscript_.call(a, b) } ); Sk.builtin.list.prototype.list_sort_ = function(a, b, c, d) { var e, h = void 0 !== c && null !== c && c !== Sk.builtin.none.none$; var g = void 0 !== b && null !== b && b !== Sk.builtin.none.none$; if (void 0 === d) var f = !1; else { if (d === Sk.builtin.none.none$) throw new Sk.builtin.TypeError("an integer is required"); f = Sk.misceval.isTrue(d) } d = new Sk.builtin.timSort(a); a.v = []; var k = new Sk.builtin.int_(0); if (h) for (d.lt = g ? function(a, c) { a = Sk.misceval.callsimArray(b, [a[0], c[0]]); return Sk.misceval.richCompareBool(a, k, "Lt") } : function(a, c) { return Sk.misceval.richCompareBool(a[0], c[0], "Lt") } , e = 0; e < d.listlength; e++) { g = d.list.v[e]; var n = Sk.misceval.callsimArray(c, [g]); d.list.v[e] = [n, g] } else g && (d.lt = function(a, c) { a = Sk.misceval.callsimArray(b, [a, c]); return Sk.misceval.richCompareBool(a, k, "Lt") } ); f && d.list.list_reverse_(d.list); d.sort(); f && d.list.list_reverse_(d.list); if (h) for (c = 0; c < d.listlength; c++) g = d.list.v[c][1], d.list.v[c] = g; c = 0 < a.sq$length(); a.v = d.list.v; if (c) throw new Sk.builtin.OperationError("list modified during sort"); return Sk.builtin.none.none$ } ; Sk.builtin.list.prototype.list_sort_.co_varnames = ["__self__", "cmp", "key", "reverse"]; Sk.builtin.list.prototype.list_sort_.$defaults = [Sk.builtin.none.none$, Sk.builtin.none.none$, !1]; Sk.builtin.list.prototype.list_reverse_ = function(a) { Sk.builtin.pyCheckArgsLen("reverse", arguments.length, 1, 1); var b = a.v.length; var c = a.v; var d = []; for (--b; -1 < b; --b) d.push(c[b]); a.v = d; return Sk.builtin.none.none$ } ; Sk.builtin.list.prototype.append = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("append", arguments.length, 2, 2); a.v.push(b); return Sk.builtin.none.none$ } ); Sk.builtin.list.prototype.insert = new Sk.builtin.func(function(a, b, c) { Sk.builtin.pyCheckArgsLen("insert", arguments.length, 3, 3); if (!Sk.builtin.checkNumber(b)) throw new Sk.builtin.TypeError("an integer is required"); b = Sk.builtin.asnum$(b); 0 > b && (b += a.v.length); 0 > b ? b = 0 : b > a.v.length && (b = a.v.length); a.v.splice(b, 0, c); return Sk.builtin.none.none$ } ); Sk.builtin.list.prototype.extend = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("extend", arguments.length, 2, 2); a.list_extend_(b); return Sk.builtin.none.none$ } ); Sk.builtin.list.prototype.pop = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("pop", arguments.length, 1, 2); void 0 === b && (b = a.v.length - 1); if (!Sk.builtin.checkNumber(b)) throw new Sk.builtin.TypeError("an integer is required"); b = Sk.builtin.asnum$(b); 0 > b && (b += a.v.length); if (0 > b || b >= a.v.length) throw new Sk.builtin.IndexError("pop index out of range"); var c = a.v[b]; a.v.splice(b, 1); return c } ); Sk.builtin.list.prototype.remove = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("remove", arguments.length, 2, 2); var c = Sk.builtin.list.prototype.index.func_code(a, b); a.v.splice(Sk.builtin.asnum$(c), 1); return Sk.builtin.none.none$ } ); Sk.builtin.list.prototype.clear$ = function(a) { Sk.builtin.pyCheckArgsLen("clear", arguments.length, 1, 1); a.v = []; return Sk.builtin.none.none$ } ; Sk.builtin.list.prototype.copy$ = function(a) { Sk.builtin.pyCheckArgsLen("copy", arguments.length, 1, 1); return new Sk.builtin.list(a) } ; Sk.builtin.list.prototype.index = new Sk.builtin.func(function(a, b, c, d) { Sk.builtin.pyCheckArgsLen("index", arguments.length, 2, 4); if (void 0 !== c && !Sk.builtin.checkInt(c)) throw new Sk.builtin.TypeError("slice indices must be integers"); if (void 0 !== d && !Sk.builtin.checkInt(d)) throw new Sk.builtin.TypeError("slice indices must be integers"); var e = a.v.length; var h = a.v; c = void 0 === c ? 0 : c.v; 0 > c && (c = 0 <= c + e ? c + e : 0); d = void 0 === d ? e : d.v; 0 > d && (d = 0 <= d + e ? d + e : 0); for (e = c; e < d; ++e) if (Sk.misceval.richCompareBool(h[e], b, "Eq")) return new Sk.builtin.int_(e); throw new Sk.builtin.ValueError("list.index(x): x not in list"); } ); Sk.builtin.list.prototype.count = new Sk.builtin.func(function(a, b) { var c, d; Sk.builtin.pyCheckArgsLen("count", arguments.length, 2, 2); var e = a.v.length; var h = a.v; for (c = d = 0; c < e; ++c) Sk.misceval.richCompareBool(h[c], b, "Eq") && (d += 1); return new Sk.builtin.int_(d) } ); Sk.builtin.list.prototype.reverse = new Sk.builtin.func(Sk.builtin.list.prototype.list_reverse_); Sk.builtin.list.prototype.sort = new Sk.builtin.func(Sk.builtin.list.prototype.list_sort_); Sk.exportSymbol("Sk.builtin.list", Sk.builtin.list); Sk.builtin.list_iter_ = function(a) { if (!(this instanceof Sk.builtin.list_iter_)) return new Sk.builtin.list_iter_(a); this.$index = 0; this.lst = a.v; this.$done = !1; this.tp$iter = ()=>this; this.tp$iternext = function() { if (this.$done || this.$index >= this.lst.length) this.$done = !0; else return this.lst[this.$index++] } ; this.$r = function() { return new Sk.builtin.str("") } ; return this } ; Sk.abstr.setUpInheritance("listiterator", Sk.builtin.list_iter_, Sk.builtin.object); Sk.builtin.list_iter_.prototype.__class__ = Sk.builtin.list_iter_; Sk.builtin.list_iter_.prototype.__iter__ = new Sk.builtin.func(function(a) { return a } ); Sk.builtin.list_iter_.prototype.next$ = function(a) { a = a.tp$iternext(); if (void 0 === a) throw new Sk.builtin.StopIteration; return a } } , function(m, p) { function a(a, c) { return new Sk.builtin.func(function(b, d, e) { Sk.builtin.pyCheckArgsLen(c ? "center" : a ? "rjust" : "ljust", arguments.length, 2, 3); if (!Sk.builtin.checkInt(d)) throw new Sk.builtin.TypeError("integer argument expected, got " + Sk.abstr.typeName(d)); if (void 0 !== e && (!Sk.builtin.checkString(e) || 1 !== e.v.length && 1 !== e.sq$length())) throw new Sk.builtin.TypeError("must be char, not " + Sk.abstr.typeName(e)); e = void 0 === e ? " " : e.v; d = Sk.builtin.asnum$(d); let f = b.sq$length(); if (f >= d) return b; if (c) { var g = e.repeat(Math.floor((d - f) / 2)); g = g + b.v + g; (d - f) % 2 && (g += e); return new Sk.builtin.str(g) } g = e.repeat(d - f); return new Sk.builtin.str(a ? g + b.v : b.v + g) } ) } function b(a, c, b) { const d = a.sq$length(); if (void 0 === c || Sk.builtin.checkNone(c)) c = 0; else if (Sk.misceval.isIndex(c)) c = Sk.misceval.asIndex(c), c = 0 <= c ? c : d + c, 0 > c && (c = 0); else throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method"); if (void 0 === b || Sk.builtin.checkNone(b)) b = d; else if (Sk.misceval.isIndex(b)) b = Sk.misceval.asIndex(b), b = 0 <= b ? b : d + b, 0 > b ? b = 0 : b > d && (b = d); else throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method"); a.$hasAstralCodePoints() && (c = a.codepoints[c], b = a.codepoints[b], c = void 0 === c ? a.v.length : c, b = void 0 === b ? a.v.length : b); return { start: c, end: b } } function c(a) { return new Sk.builtin.func(function(c, d, f, e) { Sk.builtin.pyCheckArgsLen("find", arguments.length, 2, 4); if (!Sk.builtin.checkString(d)) throw new Sk.builtin.TypeError("expected a character buffer object"); ({start: f, end: e} = b(c, f, e)); const g = c.sq$length(); if (e < f) return new Sk.builtin.int_(-1); e -= d.v.length; let h = a ? c.v.lastIndexOf(d.v, e) : c.v.indexOf(d.v, f); h = h >= f && h <= e ? h : -1; if (c.$hasAstralCodePoints()) { var k = -1; for (let a = 0; a < g; a++) h == c.codepoints[a] && (k = a) } else k = h; return new Sk.builtin.int_(k) } ) } Sk.builtin.interned = Object.create(null); Sk.builtin.str = function(a, c, b) { void 0 === a && (a = ""); if (c) { Sk.builtin.pyCheckArgsLen("str", arguments.length, 0, Sk.__future__.python3 ? 3 : 1); if (!Sk.builtin.checkBytes(a)) throw new TypeError("decoding " + Sk.abstr.typeName(a) + " is not supported"); return Sk.builtin.bytes.$decode(a, c, b) } if (a instanceof Sk.builtin.str) return a; if (!(this instanceof Sk.builtin.str)) return new Sk.builtin.str(a); if (!0 === a) var f = "True"; else if (!1 === a) f = "False"; else if (null === a || a === Sk.builtin.none.none$) f = "None"; else if (a instanceof Sk.builtin.bool) f = a.v ? "True" : "False"; else if ("number" === typeof a) f = a.toString(), "Infinity" === f ? f = "inf" : "-Infinity" === f && (f = "-inf"); else if ("string" === typeof a) f = a; else { if (void 0 !== a.tp$str) { f = a.tp$str(); if (!(f instanceof Sk.builtin.str)) throw new Sk.builtin.ValueError("__str__ didn't return a str"); return f } return Sk.misceval.objectRepr(a) } const e = Sk.builtin.interned[f]; if (void 0 !== e) return e; this.__class__ = Sk.builtin.str; this.v = f; Sk.builtin.interned[f] = this; f = void 0 === d[f] ? f : f + "_$rw$"; this.$mangled = f; this.$savedKeyHash_ = void 0; return this } ; Sk.exportSymbol("Sk.builtin.str", Sk.builtin.str); Sk.abstr.setUpInheritance("str", Sk.builtin.str, Sk.builtin.seqtype); Sk.builtin.str.prototype.sk$builtinBase = Sk.builtin.str; Sk.builtin.str.prototype.$hasAstralCodePoints = function() { if (null === this.codepoints) return !1; if (void 0 !== this.codepoints) return !0; for (var a = 0; a < this.v.length; a++) { let c = this.v.charCodeAt(a); if (55296 <= c && 57344 > c) { this.codepoints = []; for (a = 0; a < this.v.length; a++) this.codepoints.push(a), c = this.v.charCodeAt(a), 55296 <= c && 56320 > c && a++; return !0 } } this.codepoints = null; return !1 } ; Sk.builtin.str.prototype.$jsstr = function() { return this.v } ; Sk.builtin.str.prototype.mp$subscript = function(a) { let c; if (Sk.misceval.isIndex(a)) { a = Sk.misceval.asIndex(a); c = this.sq$length(); 0 > a && (a = c + a); if (0 > a || a >= c) throw new Sk.builtin.IndexError("string index out of range"); return this.codepoints ? new Sk.builtin.str(this.v.substring(this.codepoints[a], this.codepoints[a + 1])) : new Sk.builtin.str(this.v.charAt(a)) } if (a instanceof Sk.builtin.slice) { let b = ""; c = this.sq$length(); this.codepoints ? a.sssiter$(c, a=>{ b += this.v.substring(this.codepoints[a], this.codepoints[a + 1]) } ) : a.sssiter$(c, a=>{ b += this.v.charAt(a) } ); return new Sk.builtin.str(b) } throw new Sk.builtin.TypeError("string indices must be integers, not " + Sk.abstr.typeName(a)); } ; Sk.builtin.str.prototype.sq$length = function() { return this.$hasAstralCodePoints() ? this.codepoints.length : this.v.length } ; Sk.builtin.str.prototype.sq$concat = function(a) { if (!a || !Sk.builtin.checkString(a)) throw a = Sk.abstr.typeName(a), new Sk.builtin.TypeError("cannot concatenate 'str' and '" + a + "' objects"); return new Sk.builtin.str(this.v + a.v) } ; Sk.builtin.str.prototype.nb$add = Sk.builtin.str.prototype.sq$concat; Sk.builtin.str.prototype.nb$inplace_add = Sk.builtin.str.prototype.sq$concat; Sk.builtin.str.prototype.sq$repeat = function(a) { var c; if (!Sk.misceval.isIndex(a)) throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '" + Sk.abstr.typeName(a) + "'"); a = Sk.misceval.asIndex(a); var b = ""; for (c = 0; c < a; ++c) b += this.v; return new Sk.builtin.str(b) } ; Sk.builtin.str.prototype.nb$multiply = Sk.builtin.str.prototype.sq$repeat; Sk.builtin.str.prototype.nb$inplace_multiply = Sk.builtin.str.prototype.sq$repeat; Sk.builtin.str.prototype.sq$item = function() { Sk.asserts.fail() } ; Sk.builtin.str.prototype.sq$slice = function(a, c) { a = Sk.builtin.asnum$(a); c = Sk.builtin.asnum$(c); 0 > a && (a = 0); return this.$hasAstralCodePoints() ? a >= this.codepoints.length ? Sk.builtin.str.$emptystr : new Sk.builtin.str(this.v.substring(this.codepoints[a], this.codepoints[c])) : new Sk.builtin.str(this.v.substring(a, c)) } ; Sk.builtin.str.prototype.sq$contains = function(a) { if (!(a instanceof Sk.builtin.str)) throw new Sk.builtin.TypeError("TypeError: 'In requires string as left operand"); return -1 != this.v.indexOf(a.v) } ; Sk.builtin.str.prototype.__contains__ = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("__contains__", arguments.length - 1, 1, 1); return new Sk.builtin.bool(-1 != a.v.indexOf(c.v)) } ); Sk.builtin.str.prototype.__iter__ = new Sk.builtin.func(function(a) { return new Sk.builtin.str_iter_(a) } ); Sk.builtin.str.prototype.tp$iter = function() { return new Sk.builtin.str_iter_(this) } ; Sk.builtin.str.prototype.tp$richcompare = function(a, c) { if (!(a instanceof Sk.builtin.str)) return Sk.builtin.NotImplemented.NotImplemented$; switch (c) { case "Lt": return this.v < a.v; case "LtE": return this.v <= a.v; case "Eq": return this.v === a.v; case "NotEq": return this.v !== a.v; case "Gt": return this.v > a.v; case "GtE": return this.v >= a.v; default: Sk.asserts.fail() } } ; Sk.builtin.str.prototype.$r = function() { var a, c = "'"; -1 !== this.v.indexOf("'") && -1 === this.v.indexOf('"') && (c = '"'); var b = this.v.length; var d = c; for (a = 0; a < b; ++a) { var k = this.v.charAt(a); var n = this.v.charCodeAt(a); k === c || "\\" === k ? d += "\\" + k : "\t" === k ? d += "\\t" : "\n" === k ? d += "\\n" : "\r" === k ? d += "\\r" : (255 < n && 55296 > n || 57344 <= n) && !Sk.__future__.python3 ? d += "\\u" + ("000" + n.toString(16)).slice(-4) : 55296 <= n && !Sk.__future__.python3 ? (k = this.v.codePointAt(a), a++, k = k.toString(16), n = "0000000" + k.toString(16), d = 4 < k.length ? d + ("\\U" + n.slice(-8)) : d + ("\\u" + n.slice(-4))) : 255 < n && !Sk.__future__.python3 ? d += "\\ufffd" : " " > k || 127 <= n && !Sk.__future__.python3 ? (k = k.charCodeAt(0).toString(16), 2 > k.length && (k = "0" + k), d += "\\x" + k) : d += k } return new Sk.builtin.str(d + c) } ; Sk.builtin.str.re_escape_ = function(a) { var c, b = [], d = /^[A-Za-z0-9]+$/; for (c = 0; c < a.length; ++c) { var e = a.charAt(c); d.test(e) ? b.push(e) : "\\000" === e ? b.push("\\000") : b.push("\\" + e) } return b.join("") } ; Sk.builtin.str.prototype.lower = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("lower", arguments.length, 1, 1); return new Sk.builtin.str(a.v.toLowerCase()) } ); Sk.builtin.str.prototype.upper = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("upper", arguments.length, 1, 1); return new Sk.builtin.str(a.v.toUpperCase()) } ); Sk.builtin.str.prototype.capitalize = new Sk.builtin.func(function(a) { var c; Sk.builtin.pyCheckArgsLen("capitalize", arguments.length, 1, 1); var b = a.v; if (0 === b.length) return new Sk.builtin.str(""); var d = b.charAt(0).toUpperCase(); for (c = 1; c < b.length; c++) d += b.charAt(c).toLowerCase(); return new Sk.builtin.str(d) } ); Sk.builtin.str.prototype.join = new Sk.builtin.func(function(a, c) { var b; Sk.builtin.pyCheckArgsLen("join", arguments.length, 2, 2); Sk.builtin.pyCheckType("seq", "iterable", Sk.builtin.checkIterable(c)); var d = []; var e = c.tp$iter(); for (b = e.tp$iternext(); void 0 !== b; b = e.tp$iternext()) { if (b.constructor !== Sk.builtin.str) throw new Sk.builtin.TypeError("TypeError: sequence item " + d.length + ": expected string, " + Sk.abstr.typeName(b) + " found"); d.push(b.v) } return new Sk.builtin.str(d.join(a.v)) } ); Sk.builtin.str.prototype.split = new Sk.builtin.func(function(a, c, b) { var d, e; Sk.builtin.pyCheckArgsLen("split", arguments.length, 1, 3); if (void 0 === c || c === Sk.builtin.none.none$) c = null; if (null !== c && !Sk.builtin.checkString(c)) throw new Sk.builtin.TypeError("expected a string"); if (null !== c && "" === c.v) throw new Sk.builtin.ValueError("empty separator"); if (void 0 !== b && !Sk.builtin.checkInt(b)) throw new Sk.builtin.TypeError("an integer is required"); b = Sk.builtin.asnum$(b); var g = /[\s\xa0]+/g; var h = a.v; if (null === c) h = h.replace(/^[\s\xa0]+/, ""); else { var q = c.v.replace(/([.*+?=|\\\/()\[\]\{\}^$])/g, "\\$1"); g = new RegExp(q,"g") } var u = []; for (q = d = 0; null != (e = g.exec(h)) && e.index !== g.lastIndex && !(u.push(new Sk.builtin.str(h.substring(d, e.index))), d = g.lastIndex, q += 1, b && q >= b); ) ; h = h.substring(d); (null !== c || 0 < h.length) && u.push(new Sk.builtin.str(h)); return new Sk.builtin.list(u) } ); Sk.builtin.str.prototype.strip = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("strip", arguments.length, 1, 2); if (void 0 !== c && !Sk.builtin.checkString(c)) throw new Sk.builtin.TypeError("strip arg must be None or str"); if (void 0 === c) var b = /^\s+|\s+$/g; else b = Sk.builtin.str.re_escape_(c.v), b = new RegExp("^[" + b + "]+|[" + b + "]+$","g"); return new Sk.builtin.str(a.v.replace(b, "")) } ); Sk.builtin.str.prototype.lstrip = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("lstrip", arguments.length, 1, 2); if (void 0 !== c && !Sk.builtin.checkString(c)) throw new Sk.builtin.TypeError("lstrip arg must be None or str"); if (void 0 === c) var b = /^\s+/g; else b = Sk.builtin.str.re_escape_(c.v), b = new RegExp("^[" + b + "]+","g"); return new Sk.builtin.str(a.v.replace(b, "")) } ); Sk.builtin.str.prototype.rstrip = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("rstrip", arguments.length, 1, 2); if (void 0 !== c && !Sk.builtin.checkString(c)) throw new Sk.builtin.TypeError("rstrip arg must be None or str"); if (void 0 === c) var b = /\s+$/g; else b = Sk.builtin.str.re_escape_(c.v), b = new RegExp("[" + b + "]+$","g"); return new Sk.builtin.str(a.v.replace(b, "")) } ); Sk.builtin.str.prototype.__format__ = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("__format__", arguments.length, 2, 2); if (Sk.builtin.checkString(c)) { var b = Sk.ffi.remapToJs(c); if ("" !== b && "s" !== b) throw new Sk.builtin.NotImplementedError("format spec is not yet implemented"); } else { if (Sk.__future__.exceptions) throw new Sk.builtin.TypeError("format() argument 2 must be str, not " + Sk.abstr.typeName(c)); throw new Sk.builtin.TypeError("format expects arg 2 to be string or unicode, not " + Sk.abstr.typeName(c)); } return new Sk.builtin.str(a) } ); Sk.builtin.str.prototype.partition = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("partition", arguments.length, 2, 2); Sk.builtin.pyCheckType("sep", "string", Sk.builtin.checkString(c)); var b = new Sk.builtin.str(c); var d = a.v.indexOf(b.v); return 0 > d ? new Sk.builtin.tuple([a, Sk.builtin.str.$emptystr, Sk.builtin.str.$emptystr]) : new Sk.builtin.tuple([new Sk.builtin.str(a.v.substring(0, d)), b, new Sk.builtin.str(a.v.substring(d + b.v.length))]) } ); Sk.builtin.str.prototype.rpartition = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("rpartition", arguments.length, 2, 2); Sk.builtin.pyCheckType("sep", "string", Sk.builtin.checkString(c)); var b = new Sk.builtin.str(c); var d = a.v.lastIndexOf(b.v); return 0 > d ? new Sk.builtin.tuple([Sk.builtin.str.$emptystr, Sk.builtin.str.$emptystr, a]) : new Sk.builtin.tuple([new Sk.builtin.str(a.v.substring(0, d)), b, new Sk.builtin.str(a.v.substring(d + b.v.length))]) } ); Sk.builtin.str.prototype.count = new Sk.builtin.func(function(a, c, b, d) { Sk.builtin.pyCheckArgsLen("count", arguments.length, 2, 4); if (!Sk.builtin.checkString(c)) throw new Sk.builtin.TypeError("expected a character buffer object"); if (void 0 !== b && !Sk.builtin.checkInt(b) && !Sk.builtin.checkNone(b)) throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method"); if (void 0 !== d && !Sk.builtin.checkInt(d) && !Sk.builtin.checkNone(d)) throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method"); var f = a.sq$length(); if (void 0 === b || b === Sk.builtin.none.none$) b = 0; else if (b = Sk.builtin.asnum$(b), b = 0 <= b ? b : f + b, b > f) return new Sk.builtin.int_(0); void 0 === d || d === Sk.builtin.none.none$ ? d = f : (d = Sk.builtin.asnum$(d), d = 0 <= d ? d : f + d); f = c.v.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); f = new RegExp(f,"g"); return (f = a.v.slice(a.codepoints ? a.codepoints[b] : b, a.codepoints ? a.codepoints[d] : d).match(f)) ? new Sk.builtin.int_(f.length) : new Sk.builtin.int_(0) } ); Sk.builtin.str.prototype.ljust = a(!1); Sk.builtin.str.prototype.rjust = a(!0); Sk.builtin.str.prototype.center = a(!1, !0); Sk.builtin.str.prototype.find = c(!1); Sk.builtin.str.prototype.index = new Sk.builtin.func(function(a, c, b, d) { Sk.builtin.pyCheckArgsLen("index", arguments.length, 2, 4); var f = Sk.misceval.callsimArray(a.find, [a, c, b, d]); if (-1 === Sk.builtin.asnum$(f)) throw new Sk.builtin.ValueError("substring not found"); return f } ); Sk.builtin.str.prototype.rfind = c(!0); Sk.builtin.str.prototype.rindex = new Sk.builtin.func(function(a, c, b, d) { Sk.builtin.pyCheckArgsLen("rindex", arguments.length, 2, 4); var f = Sk.misceval.callsimArray(a.rfind, [a, c, b, d]); if (-1 === Sk.builtin.asnum$(f)) throw new Sk.builtin.ValueError("substring not found"); return f } ); Sk.builtin.str.prototype.startswith = new Sk.builtin.func(function(a, c, d, f) { Sk.builtin.pyCheckArgsLen("startswith", arguments.length - 1, 1, 3); if (!(c instanceof Sk.builtin.str || c instanceof Sk.builtin.tuple)) throw new Sk.builtin.TypeError("startswith first arg must be str or a tuple of str, not " + Sk.abstr.typeName(c)); ({start: d, end: f} = b(a, d, f)); if (d > f) return Sk.builtin.bool.false$; let e = a.v.slice(d, f); if (c instanceof Sk.builtin.tuple) { for (let a = Sk.abstr.iter(c), b = a.tp$iternext(); void 0 !== b; b = a.tp$iternext()) { if (!(b instanceof Sk.builtin.str)) throw new Sk.builtin.TypeError("tuple for startswith must only contain str, not " + Sk.abstr.typeName(b)); if (0 === e.indexOf(b.v)) return Sk.builtin.bool.true$ } return Sk.builtin.bool.false$ } return new Sk.builtin.bool(0 === e.indexOf(c.v)) } ); Sk.builtin.str.prototype.endswith = new Sk.builtin.func(function(a, c, d, f) { Sk.builtin.pyCheckArgsLen("endswith", arguments.length - 1, 1, 3); if (!(c instanceof Sk.builtin.str || c instanceof Sk.builtin.tuple)) throw new Sk.builtin.TypeError("endswith first arg must be str or a tuple of str, not " + Sk.abstr.typeName(c)); ({start: d, end: f} = b(a, d, f)); if (d > f) return Sk.builtin.bool.false$; let e = a.v.slice(d, f); if (c instanceof Sk.builtin.tuple) { for (let a = Sk.abstr.iter(c), b = a.tp$iternext(); void 0 !== b; b = a.tp$iternext()) { if (!(b instanceof Sk.builtin.str)) throw new Sk.builtin.TypeError("tuple for endswith must only contain str, not " + Sk.abstr.typeName(b)); if (-1 !== e.indexOf(b.v, e.length - b.v.length)) return Sk.builtin.bool.true$ } return Sk.builtin.bool.false$ } return new Sk.builtin.bool(-1 !== e.indexOf(c.v, e.length - c.v.length)) } ); Sk.builtin.str.prototype.replace = new Sk.builtin.func(function(a, c, b, d) { Sk.builtin.pyCheckArgsLen("replace", arguments.length, 3, 4); Sk.builtin.pyCheckType("oldS", "string", Sk.builtin.checkString(c)); Sk.builtin.pyCheckType("newS", "string", Sk.builtin.checkString(b)); if (void 0 !== d && !Sk.builtin.checkInt(d)) throw new Sk.builtin.TypeError("integer argument expected, got " + Sk.abstr.typeName(d)); d = Sk.builtin.asnum$(d); var f = new RegExp(Sk.builtin.str.re_escape_(c.v),"g"); if (void 0 === d || 0 > d) return new Sk.builtin.str(a.v.replace(f, b.v)); var e = 0; return new Sk.builtin.str(a.v.replace(f, function(a) { e++; return e <= d ? b.v : a })) } ); Sk.builtin.str.prototype.zfill = new Sk.builtin.func(function(a, c) { var b = a.v , d = ""; Sk.builtin.pyCheckArgsLen("zfill", arguments.length, 2, 2); if (!Sk.builtin.checkInt(c)) throw new Sk.builtin.TypeError("integer argument expected, got " + Sk.abstr.typeName(c)); var e = c.v - b.length; var h = "+" === b[0] || "-" === b[0] ? 1 : 0; for (var l = 0; l < e; l++) d += "0"; b = b.substr(0, h) + d + b.substr(h); return new Sk.builtin.str(b) } ); Sk.builtin.str.prototype.isdigit = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("isdigit", arguments.length, 1, 1); return new Sk.builtin.bool(/^\d+$/.test(a.v)) } ); Sk.builtin.str.prototype.isspace = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("isspace", arguments.length, 1, 1); return new Sk.builtin.bool(/^\s+$/.test(a.v)) } ); Sk.builtin.str.prototype.expandtabs = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("expandtabs", arguments.length, 1, 2); if (void 0 !== c && !Sk.builtin.checkInt(c)) throw new Sk.builtin.TypeError("integer argument expected, got " + Sk.abstr.typeName(c)); c = void 0 === c ? 8 : Sk.builtin.asnum$(c); var b = Array(c + 1).join(" "); var d = a.v.replace(/([^\r\n\t]*)\t/g, function(a, d) { return d + b.slice(d.length % c) }); return new Sk.builtin.str(d) } ); Sk.builtin.str.prototype.swapcase = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("swapcase", arguments.length, 1, 1); var c = a.v.replace(/[a-z]/gi, function(a) { var c = a.toLowerCase(); return c === a ? a.toUpperCase() : c }); return new Sk.builtin.str(c) } ); Sk.builtin.str.prototype.splitlines = new Sk.builtin.func(function(a, c) { var b = a.v, d, e = a.v.length, h = [], l = 0; Sk.builtin.pyCheckArgsLen("splitlines", arguments.length, 1, 2); if (void 0 !== c && !Sk.builtin.checkBool(c)) throw new Sk.builtin.TypeError("boolean argument expected, got " + Sk.abstr.typeName(c)); c = void 0 === c ? !1 : c.v; for (d = 0; d < e; d++) { var q = b.charAt(d); if ("\n" === b.charAt(d + 1) && "\r" === q) q = d + 2, l = b.slice(l, q), c || (l = l.replace(/(\r|\n)/g, "")), h.push(new Sk.builtin.str(l)), l = q; else if ("\n" === q && "\r" !== b.charAt(d - 1) || "\r" === q) q = d + 1, l = b.slice(l, q), c || (l = l.replace(/(\r|\n)/g, "")), h.push(new Sk.builtin.str(l)), l = q } l < e && (l = b.slice(l, e), c || (l = l.replace(/(\r|\n)/g, "")), h.push(new Sk.builtin.str(l))); return new Sk.builtin.list(h) } ); Sk.builtin.str.prototype.title = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("title", arguments.length, 1, 1); var c = a.v.replace(/[a-z][a-z]*/gi, function(a) { return a[0].toUpperCase() + a.substr(1).toLowerCase() }); return new Sk.builtin.str(c) } ); Sk.builtin.str.prototype.isalpha = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("isalpha", arguments.length, 1, 1); return new Sk.builtin.bool(a.v.length && !/[^a-zA-Z]/.test(a.v)) } ); Sk.builtin.str.prototype.isalnum = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("isalnum", arguments.length, 1, 1); return new Sk.builtin.bool(a.v.length && !/[^a-zA-Z0-9]/.test(a.v)) } ); Sk.builtin.str.prototype.isnumeric = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("isnumeric", arguments.length, 1, 1); return new Sk.builtin.bool(a.v.length && !/[^0-9]/.test(a.v)) } ); Sk.builtin.str.prototype.islower = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("islower", arguments.length, 1, 1); return new Sk.builtin.bool(a.v.length && /[a-z]/.test(a.v) && !/[A-Z]/.test(a.v)) } ); Sk.builtin.str.prototype.isupper = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("isupper", arguments.length, 1, 1); return new Sk.builtin.bool(a.v.length && !/[a-z]/.test(a.v) && /[A-Z]/.test(a.v)) } ); Sk.builtin.str.prototype.istitle = new Sk.builtin.func(function(a) { var c = a.v, b = !1, d = !1, e; Sk.builtin.pyCheckArgsLen("istitle", arguments.length, 1, 1); for (e = 0; e < c.length; e++) { var n = c.charAt(e); if (!/[a-z]/.test(n) && /[A-Z]/.test(n)) { if (d) return new Sk.builtin.bool(!1); b = d = !0 } else if (/[a-z]/.test(n) && !/[A-Z]/.test(n)) { if (!d) return new Sk.builtin.bool(!1); b = !0 } else d = !1 } return new Sk.builtin.bool(b) } ); Sk.builtin.str.prototype.encode = new Sk.builtin.func(function(a, c, b) { Sk.builtin.pyCheckArgsLen("encode", arguments.length, 1, 3); c = c || Sk.builtin.str.$utf8; Sk.builtin.pyCheckType("encoding", "string", Sk.builtin.checkString(c)); c = c.v; void 0 !== b ? (Sk.builtin.pyCheckType("errors", "string", Sk.builtin.checkString(b)), b = b.v) : b = "strict"; const d = Sk.builtin.bytes.$strEncode(a, c, b); return Sk.__future__.python3 ? d : new Sk.builtin.str(d.$jsstr()) } ); Sk.builtin.str.$py2decode = new Sk.builtin.func(function(a, c, b) { Sk.builtin.pyCheckArgsLen("decode", arguments.length, 1, 3); const d = new Sk.builtin.bytes(a.$jsstr()); return Sk.builtin.bytes.$decode(d, c, b) } ); Sk.builtin.str.prototype.nb$remainder = function(a) { var c; const b = this.sk$builtinBase; a.constructor === Sk.builtin.tuple || void 0 !== a.mp$subscript && a.constructor !== b || (a = new Sk.builtin.tuple([a])); var d = 0; var e = this.$jsstr().replace(/%(\([a-zA-Z0-9]+\))?([#0 +\-]+)?(\*|[0-9]+)?(\.(\*|[0-9]+))?[hlL]?([diouxXeEfFgGcrsb%])/g, function(f, e, g, h, k, y, t) { var u, l, z, n, q; h = Sk.builtin.asnum$(h); k = Sk.builtin.asnum$(k); void 0 !== e && "" !== e || "%" == t || (u = d++); "" === k && (k = void 0); var m = l = z = n = q = !1; g && (-1 !== g.indexOf("-") ? n = !0 : -1 !== g.indexOf("0") && (q = !0), -1 !== g.indexOf("+") ? l = !0 : -1 !== g.indexOf(" ") && (z = !0), m = -1 !== g.indexOf("#")); k && (k = parseInt(k.substr(1), 10)); g = function(a, c) { var b; c = Sk.builtin.asnum$(c); var d = !1; if ("number" === typeof a) { 0 > a && (a = -a, d = !0); var f = a.toString(c) } else a instanceof Sk.builtin.float_ ? (f = a.str$(c, !1), 2 < f.length && ".0" === f.substr(-2) && (f = f.substr(0, f.length - 2)), d = a.nb$isnegative()) : a instanceof Sk.builtin.int_ ? (f = a.str$(c, !1), d = a.nb$isnegative()) : a instanceof Sk.builtin.lng && (f = a.str$(c, !1), d = a.nb$isnegative()); Sk.asserts.assert(void 0 !== f, "unhandled number format"); a = !1; if (k) for (b = f.length; b < k; ++b) f = "0" + f, a = !0; b = ""; d ? b = "-" : l ? b = "+" + b : z && (b = " " + b); m && (16 === c ? b += "0x" : 8 !== c || a || "0" === f || (b += "0")); return [b, f] } ; f = function(a) { var c = a[0]; a = a[1]; if (h) { h = parseInt(h, 10); var b = a.length + c.length; if (q) for (; b < h; ++b) a = "0" + a; else if (n) { for (; b < h; ++b) a += " "; Sk.__future__.python3 && (a += c, c = "") } else for (; b < h; ++b) c = " " + c } return c + a } ; if (a.constructor === Sk.builtin.tuple) e = a.v[u]; else if (void 0 !== a.mp$subscript && void 0 !== e) e = e.substring(1, e.length - 1), e = a.mp$subscript(new b(e)); else if (a.constructor === Sk.builtin.dict || a.constructor === Sk.builtin.list) e = a; else throw new Sk.builtin.AttributeError(a.tp$name + " instance has no attribute 'mp$subscript'"); if ("d" === t || "i" === t) { var p = g(e, 10); if (void 0 === p[1]) throw new Sk.builtin.TypeError("%" + t + " format: a number is required, not " + Sk.abstr.typeName(e)); t = p[1]; p[1] = -1 !== t.indexOf(".") ? parseInt(t, 10).toString() : t; return f(p) } if ("o" === t) return f(g(e, 8)); if ("x" === t) return f(g(e, 16)); if ("X" === t) return f(g(e, 16)).toUpperCase(); if ("f" === t || "F" === t || "e" === t || "E" === t || "g" === t || "G" === t) { p = Sk.builtin.asnum$(e); "string" === typeof p && (p = Number(p)); if (Infinity === p) return "inf"; if (-Infinity === p) return "-inf"; if (isNaN(p)) return "nan"; u = ["toExponential", "toFixed", "toPrecision"]["efg".indexOf(t.toLowerCase())]; if (void 0 === k || "" === k) if ("e" === t || "E" === t) k = 6; else if ("f" === t || "F" === t) k = Sk.__future__.python3 ? 6 : 7; u = p[u](k); Sk.builtin.checkFloat(e) && 0 === p && -Infinity === 1 / p && (u = "-" + u); Sk.__future__.python3 && (7 <= u.length && "0.0000" == u.slice(0, 6) && (c = parseFloat(u), u = c.toExponential()), "-" == u.charAt(u.length - 2) && (u = u.slice(0, u.length - 1) + "0" + u.charAt(u.length - 1))); -1 !== "EFG".indexOf(t) && (u = u.toUpperCase()); return f(["", u]) } if ("c" === t) { if ("number" === typeof e) return String.fromCharCode(e); if (e instanceof Sk.builtin.int_) return String.fromCharCode(e.v); if (e instanceof Sk.builtin.float_) return String.fromCharCode(e.v); if (e instanceof Sk.builtin.lng) return String.fromCharCode(e.str$(10, !1)[0]); if (e.constructor === Sk.builtin.str) return e.v.substr(0, 1); throw new Sk.builtin.TypeError("an integer is required"); } if ("r" === t) return t = Sk.builtin.repr(e), k ? t.v.substr(0, k) : t.v; if ("s" === t && b === Sk.builtin.str) { t = new Sk.builtin.str(e); t = t.$jsstr(); if (k) return t.substr(0, k); h && (t = f([" ", t])); return t } if ("b" === t || "s" === t) { if (b === Sk.builtin.str) throw new Sk.builtin.ValueError("unsupported format character 'b'"); if (!(e instanceof Sk.builtin.bytes) && void 0 === (p = Sk.abstr.lookupSpecial(e, Sk.builtin.str.$bytes))) throw new Sk.builtin.TypeError("%b requires a bytes-like object, or an object that implements __bytes__, not '" + Sk.abstr.typeName(e) + "'"); void 0 !== p && (e = new Sk.builtin.bytes(e)); t = e.$jsstr(); if (k) return t.substr(0, k); h && (t = f([" ", t])); return t } if ("%" === t) return "%" }); return new b(e) } ; Sk.builtin.str_iter_ = function(a) { if (!(this instanceof Sk.builtin.str_iter_)) return new Sk.builtin.str_iter_(a); this.$index = 0; this.$obj = a.v.slice(); this.tp$iter = ()=>this; a.$hasAstralCodePoints() ? (this.sq$length = a.codepoints.length, this.$codepoints = a.codepoints.slice(), this.tp$iternext = function() { if (!(this.$index >= this.sq$length)) { var a = new Sk.builtin.str(this.$obj.substring(this.$codepoints[this.$index], this.$codepoints[this.$index + 1])); this.$index++; return a } } ) : (this.sq$length = this.$obj.length, this.tp$iternext = function() { if (!(this.$index >= this.sq$length)) return new Sk.builtin.str(this.$obj.substr(this.$index++, 1)) } ); this.$r = function() { return new Sk.builtin.str("iterator") } ; return this } ; Sk.abstr.setUpInheritance("iterator", Sk.builtin.str_iter_, Sk.builtin.object); Sk.builtin.str_iter_.prototype.__class__ = Sk.builtin.str_iter_; Sk.builtin.str_iter_.prototype.__iter__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__iter__", arguments.length, 0, 0, !0, !1); return a } ); Sk.builtin.str_iter_.prototype.next$ = function(a) { a = a.tp$iternext(); if (void 0 === a) throw new Sk.builtin.StopIteration; return a } ; var d = { "abstract": !0, as: !0, "boolean": !0, "break": !0, "byte": !0, "case": !0, "catch": !0, "char": !0, "class": !0, "continue": !0, "const": !0, "debugger": !0, "default": !0, "delete": !0, "do": !0, "double": !0, "else": !0, "enum": !0, "export": !0, "extends": !0, "false": !0, "final": !0, "finally": !0, "float": !0, "for": !0, "function": !0, "goto": !0, "if": !0, "implements": !0, "import": !0, "in": !0, "instanceof": !0, "int": !0, "interface": !0, is: !0, "long": !0, namespace: !0, "native": !0, "new": !0, "null": !0, "package": !0, "private": !0, "protected": !0, "public": !0, "return": !0, "short": !0, "static": !0, "switch": !0, "synchronized": !0, "this": !0, "throw": !0, "throws": !0, "transient": !0, "true": !0, "try": !0, "typeof": !0, use: !0, "var": !0, "void": !0, "volatile": !0, "while": !0, "with": !0, __defineGetter__: !0, __defineSetter__: !0, apply: !0, arguments: !0, call: !0, caller: !0, eval: !0, hasOwnProperty: !0, isPrototypeOf: !0, __lookupGetter__: !0, __lookupSetter__: !0, __noSuchMethod__: !0, propertyIsEnumerable: !0, prototype: !0, toSource: !0, toLocaleString: !0, toString: !0, unwatch: !0, valueOf: !0, watch: !0, length: !0, name: !0 }; Sk.builtin.str.reservedWords_ = d } , function(m, p, a) { function b(a) { var c = a.replace(/\s+/g, "").toLowerCase(); c = n[c]; return void 0 === c ? a : c } function c(a) { if (Uint8Array.from) return Uint8Array.from(a); const c = new Uint8Array(a.length); for (let b = 0; b < a.length; b++) c[b] = a[b]; return c } function d(a, d, f) { a = a.$jsstr(); d = b(d); if ("strict" !== f && "ignore" !== f && "replace" !== f) throw new Sk.builtin.NotImplementedError("'" + f + "' error handling not implemented in Skulpt"); if ("ascii" === d) { d = []; for (e in a) { const c = a.charCodeAt(e); if (0 > c || 127 < c) { if ("strict" === f) throw f = h(c), new Sk.builtin.UnicodeEncodeError("'ascii' codec can't encode character '" + f + "' in position " + e + ": ordinal not in range(128)"); "replace" === f && d.push(63) } else d.push(c) } var e = c(d) } else if ("utf-8" === d) e = l.encode(a); else throw new Sk.builtin.LookupError("unknown encoding: " + d); return new Sk.builtin.bytes(e) } function e(a, c, b) { Sk.builtin.pyCheckArgsLen("bytes", arguments.length, 0, 3); let f; var e; if (1 < arguments.length) { if (!Sk.builtin.checkString(c)) throw new Sk.builtin.TypeError("bytes() argument 2 must be str not " + Sk.abstr.typeName(c)); if (void 0 !== b && !Sk.builtin.checkString(b)) throw new Sk.builtin.TypeError("bytes() argument 3 must be str not " + Sk.abstr.typeName(c)); if (!Sk.builtin.checkString(a)) throw new Sk.builtin.TypeError((void 0 !== c ? "encoding" : "errors") + " without a string argument"); } if (void 0 === a) return new Sk.builtin.bytes; if (Sk.builtin.checkString(a)) { if (void 0 === c) throw new Sk.builtin.TypeError("string argument without an encoding"); b = void 0 === b ? "strict" : b.$jsstr(); c = c.$jsstr(); return d(a, c, b) } if (Sk.builtin.checkInt(a)) { f = Sk.builtin.asnum$(a); if (0 > f) throw new Sk.builtin.ValueError("negative count"); if (f > Number.MAX_SAFE_INTEGER) throw new Sk.builtin.OverflowError("cannot fit 'int' into an index-sized integer"); return new Sk.builtin.bytes(f) } if (Sk.builtin.checkBytes(a)) return new Sk.builtin.bytes(a.v); if (null != (e = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$bytes))) return e = Sk.misceval.callsimOrSuspendArray(e, [a]), Sk.misceval.chain(e, a=>{ if (!Sk.builtin.checkBytes(a)) throw new Sk.builtin.TypeError("__bytes__ returned non-bytes (type " + Sk.abstr.typeName(a) + ")"); return a } ); if (Sk.builtin.checkIterable(a)) return f = [], e = Sk.misceval.iterFor(Sk.abstr.iter(a), a=>{ if (!Sk.misceval.isIndex(a)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(a) + "' object cannot be interpreted as an integer"); a = Sk.misceval.asIndex(a); if (0 > a || 255 < a) throw new Sk.builtin.ValueError("bytes must be in range(0, 256)"); f.push(a) } ), Sk.misceval.chain(e, ()=>new Sk.builtin.bytes(f)); e = ""; void 0 === a.sk$object && (e += ", if calling constructor with a javascript object use 'new'"); throw new Sk.builtin.TypeError("cannot convert '" + Sk.abstr.typeName(a) + "' object into bytes" + e); } function h(a) { var c = 265 >= a ? "\\x" : "\\u"; a = a.toString(16); 3 === a.length && (a = a.slice(1, 3)); return a = 1 === a.length ? c + "0" + a : c + a } function g(a) { return function(c) { return c instanceof Sk.builtin.bytes ? a(this.$jsstr(), c.$jsstr()) : Sk.builtin.NotImplemented.NotImplemented$ } } function f(a, c, b) { a = a.v.byteLength; if (void 0 === c || c === Sk.builtin.none.none$) c = 0; else if (Sk.misceval.isIndex(c)) c = Sk.misceval.asIndex(c), c = 0 <= c ? c : a + c, 0 > c && (c = 0); else throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method"); if (void 0 === b || Sk.builtin.checkNone(b)) b = a; else if (Sk.misceval.isIndex(b)) b = Sk.misceval.asIndex(b), b = 0 <= b ? b : a + b, 0 > b ? b = 0 : b > a && (b = a); else throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method"); return { start: c, end: b } } function k(a) { return 9 <= a && 13 >= a || 32 === a } a(22); const n = { utf: "utf-8", utf8: "utf-8", "utf-8": "utf-8", ascii: "ascii" } , l = new TextEncoder , q = new TextDecoder; Sk.builtin.bytes = function(a, b, d) { if (!(this instanceof Sk.builtin.bytes)) return e(...arguments); if (void 0 === a) this.v = new Uint8Array; else if (a instanceof Uint8Array) this.v = a; else if (Array.isArray(a)) Sk.asserts.assert(a.every(a=>0 <= a && 256 > a), "bad internal call to bytes with array"), this.v = c(a); else if ("string" === typeof a) { const b = []; for (let c in a) { var f = a.charCodeAt(c); if (255 < f) throw new Sk.builtin.UnicodeDecodeError("invalid string (possibly contains a unicode character)"); b.push(f) } this.v = c(b) } else if ("number" === typeof a) this.v = new Uint8Array(a); else return f = Sk.misceval.chain(e(...arguments), a=>{ this.v = a.v; return this } ), Sk.misceval.retryOptionalSuspensionOrThrow(f) } ; Sk.abstr.setUpInheritance("bytes", Sk.builtin.bytes, Sk.builtin.seqtype); Sk.builtin.bytes.prototype.__class__ = Sk.builtin.bytes; Sk.builtin.bytes.prototype.sk$builtinBase = Sk.builtin.bytes; Sk.builtin.bytes.$strEncode = d; Sk.builtin.bytes.prototype.$jsstr = function() { let a = ""; for (let c = 0; c < this.v.byteLength; c++) a += String.fromCharCode(this.v[c]); return a } ; Sk.builtin.bytes.prototype.tp$hash = function() { return Sk.builtin.hash(new Sk.builtin.str(this.$jsstr())) } ; Sk.builtin.bytes.prototype.$r = function() { let a, c = "'"; const b = -1 !== this.v.indexOf(34); let d = ""; for (let f = 0; f < this.v.byteLength; f++) if (a = this.v[f], 9 > a || 10 < a && 13 > a || 13 < a && 32 > a || 126 < a) d += h(a); else if (9 === a || 10 === a || 13 === a || 39 === a || 92 === a) switch (a) { case 9: d += "\\t"; break; case 10: d += "\\n"; break; case 13: d += "\\r"; break; case 39: b ? d += "\\'" : (d += "'", c = '"'); break; case 92: d += "\\\\" } else d += String.fromCharCode(a); return new Sk.builtin.str("b" + c + d + c) } ; Sk.builtin.bytes.prototype.mp$subscript = function(a) { if (Sk.misceval.isIndex(a)) { var c = Sk.misceval.asIndex(a); if (void 0 !== c) { 0 > c && (c = this.v.byteLength + c); if (0 > c || c >= this.v.byteLength) throw new Sk.builtin.IndexError("index out of range"); return new Sk.builtin.int_(this.v[c]) } } else if (a instanceof Sk.builtin.slice) { var b = []; a.sssiter$(this.v.byteLength, a=>{ b.push(this.v[a]) } ); return new Sk.builtin.bytes(b) } throw new Sk.builtin.TypeError("byte indices must be integers, not " + Sk.abstr.typeName(a)); } ; Sk.builtin.bytes.prototype.ob$eq = function(a) { if (this === a) return Sk.builtin.bool.true$; if (!(a instanceof Sk.builtin.bytes)) return Sk.builtin.NotImplemented.NotImplemented$; if (this.v.byteLength != a.v.byteLength) return Sk.builtin.bool.false$; for (let c = 0; c < this.v.byteLength; c++) if (this.v[c] != a.v[c]) return Sk.builtin.bool.false$; return Sk.builtin.bool.true$ } ; Sk.builtin.bytes.prototype.ob$ne = function(a) { a = this.ob$eq(a); return a === Sk.builtin.NotImplemented.NotImplemented$ ? a : Sk.misceval.isTrue(a) ? Sk.builtin.bool.false$ : Sk.builtin.bool.true$ } ; Sk.builtin.bytes.prototype.ob$lt = g((a,c)=>new Sk.builtin.bool(a < c)); Sk.builtin.bytes.prototype.ob$le = g((a,c)=>new Sk.builtin.bool(a <= c)); Sk.builtin.bytes.prototype.ob$gt = g((a,c)=>new Sk.builtin.bool(a > c)); Sk.builtin.bytes.prototype.ob$ge = g((a,c)=>new Sk.builtin.bool(a >= c)); Sk.builtin.bytes.prototype.sq$length = function() { return this.v.byteLength } ; Sk.builtin.bytes.prototype.sq$concat = function(a) { var c; if (!(a instanceof Sk.builtin.bytes)) throw new Sk.builtin.TypeError("can't concat " + Sk.abstr.typeName(a) + " to bytes"); var b = []; for (c = 0; c < this.v.byteLength; c++) b.push(this.v[c]); for (c = 0; c < a.v.byteLength; c++) b.push(a.v[c]); return new Sk.builtin.bytes(b) } ; Sk.builtin.bytes.prototype.nb$add = Sk.builtin.bytes.prototype.sq$concat; Sk.builtin.bytes.prototype.nb$inplace_add = Sk.builtin.bytes.prototype.sq$concat; Sk.builtin.bytes.prototype.sq$repeat = function(a) { var c, b; if (!(a instanceof Sk.builtin.int_)) throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '" + Sk.abstr.typeName(a) + "'"); var d = []; for (b = 0; b < a.v; b++) for (c = 0; c < this.v.byteLength; c++) d.push(this.v[c]); return new Sk.builtin.bytes(d) } ; Sk.builtin.bytes.prototype.nb$multiply = Sk.builtin.bytes.prototype.sq$repeat; Sk.builtin.bytes.prototype.nb$inplace_multiply = Sk.builtin.bytes.prototype.sq$repeat; Sk.builtin.bytes.prototype.sq$contains = function(a) { if (Sk.builtin.checkInt(a)) { a = Sk.builtin.asnum$(a); if (0 > a || 255 < a) throw new Sk.builtin.ValueError("byte must be in range(0, 256)"); return -1 !== this.v.indexOf(a) } if (!(a instanceof Sk.builtin.bytes)) throw new Sk.builtin.TypeError("a bytes-like object is required, not " + Sk.abstr.typeName(a)); if (0 === a.v.byteLength) return !0; if (1 === a.v.byteLength) return -1 !== this.v.indexOf(a.v[0]); for (var c = 0; c < this.v.byteLength; ) { c = this.v.indexOf(a.v[0], c); if (-1 === c) break; let b = !0; for (let d = 0; d < a.v.byteLength; d++) if (this.v[c + d] !== a.v[d]) { b = !1; break } if (b) return !0; c += 1 } return !1 } ; Sk.builtin.bytes.prototype.nb$remainder = Sk.builtin.str.prototype.nb$remainder; Sk.builtin.bytes.$decode = function(a, c, d) { var f; Sk.builtin.pyCheckArgsLen("decode", arguments.length - 1, 0, 2); if (void 0 === c) c = "utf-8"; else if (c instanceof Sk.builtin.str) c = c.v; else throw new Sk.builtin.TypeError("decode() argument 1 must be str, not " + Sk.abstr.typeName(c)); c = b(c); if (void 0 === d) d = "strict"; else if (d instanceof Sk.builtin.str) d = d.v; else throw new Sk.builtin.TypeError("decode() argument 2 must be str, not " + Sk.abstr.typeName(d)); if ("strict" !== d && "ignore" !== d && "replace" !== d) throw new Sk.builtin.NotImplementedError("'" + d + "' error handling not implemented in Skulpt"); if ("ascii" !== c && "utf-8" !== c) throw new Sk.builtin.LookupError("unknown encoding: " + c.v); if ("ascii" === c) { var e = ""; for (f = 0; f < a.v.byteLength; f++) { var g = a.v[f]; if (127 < g) { if ("strict" === d) throw g = g.toString(16), new Sk.builtin.UnicodeDecodeError("'ascii' codec can't decode byte 0x" + g + " in position " + f.toString() + ": ordinal not in range(128)"); "replace" === d && (e += String.fromCharCode(65533)) } else e += String.fromCharCode(g) } } else { g = q.decode(a.v); if ("replace" === d) return new Sk.builtin.str(g); e = ""; for (f in g) if (65533 === g[f].charCodeAt(0)) { if ("strict" === d) throw g = a.v[f], g = g.toString(16), new Sk.builtin.UnicodeDecodeError("'utf-8' codec can't decode byte 0x" + g + " in position " + f.toString() + ": invalid start byte"); } else e += g[f] } return new Sk.builtin.str(e) } ; Sk.builtin.bytes.prototype.decode = new Sk.builtin.func(Sk.builtin.bytes.$decode); Sk.builtin.bytes.prototype.fromhex = new Sk.builtin.func(function(a) { var c; Sk.builtin.pyCheckArgsLen("fromhex", arguments.length, 1, 1); if (!(a instanceof Sk.builtin.str)) throw new Sk.builtin.TypeError("fromhex() argument must be str, not " + Sk.abstr.typeName(a)); var b = []; var d = function(a) { return "0123456789abcdefABCDEF".includes(a) ? !0 : !1 }; var f = function(a) { a = a.charCodeAt(0); return 9 === a || 10 === a || 11 === a || 12 === a || 13 === a || 32 === a || 133 === a ? !0 : !1 }; for (c = 0; c < a.v.length; ) { var e = a.v.charAt(c); if (d(e)) if (c + 1 < a.v.length) if (d(a.v.charAt(c + 1))) e = a.v.slice(c, c + 2), e = parseInt(e, 16), b.push(e), c += 2; else throw new Sk.builtin.ValueError("non-hexadecimal number found in fromhex() arg at position " + (c + 1).toString()); else throw new Sk.builtin.ValueError("non-hexadecimal number found in fromhex() arg at position " + c.toString()); else if (f(e)) c++; else throw new Sk.builtin.ValueError("non-hexadecimal number found in fromhex() arg at position " + c.toString()); } return new Sk.builtin.bytes(b) } ); Sk.builtin.bytes.prototype.hex = new Sk.builtin.func(function(a) { var c; Sk.builtin.pyCheckArgsLen("hex", arguments.length - 1, 0, 0); var b = ""; for (c = 0; c < a.v.byteLength; c++) { var d = a.v[c]; d = d.toString(16); 1 === d.length && (d = "0" + d); b += d } return new Sk.builtin.str(b) } ); Sk.builtin.bytes.prototype.count = new Sk.builtin.func(function(a, c, b, d) { var e; Sk.builtin.pyCheckArgsLen("count", arguments.length - 1, 1, 3); ({start: b, end: d} = f(a, b, d)); var g = 0; if (c instanceof Sk.builtin.int_) for (e = b; e < d; e++) a.v[e] === c.v && g++; else if (c instanceof Sk.builtin.bytes) for (e = c.v.byteLength; b < d; ) { const f = a.find$left(c, b, d); if (-1 === f) break; g++; b = f + e } else throw new Sk.builtin.TypeError("argument should be integer or bytes-like object, not '" + Sk.abstr.typeName(c) + "'"); return new Sk.builtin.int_(g) } ); Sk.builtin.bytes.prototype.endswith = new Sk.builtin.func(function(a, c, b, d) { function e(c) { const f = c.v.byteLength; if (d - b >= f) { for (let b = d - f, e = 0; b < d; b++, e++) if (a.v[b] !== c.v[e]) return !1; return !0 } return !1 } Sk.builtin.pyCheckArgsLen("endswith", arguments.length - 1, 1, 3); if (!(c instanceof Sk.builtin.bytes || c instanceof Sk.builtin.tuple)) throw new Sk.builtin.TypeError("endswith first arg must be bytes or a tuple of bytes, not " + Sk.abstr.typeName(c)); ({start: b, end: d} = f(a, b, d)); if (d < b) return Sk.builtin.bool.false$; if (c instanceof Sk.builtin.tuple) { for (let a = Sk.abstr.iter(c), b = a.tp$iternext(); void 0 !== b; b = a.tp$iternext()) { if (!(b instanceof Sk.builtin.bytes)) throw new Sk.builtin.TypeError("a bytes-like object is required, not '" + Sk.abstr.typeName(b) + "'"); if (e(b)) return Sk.builtin.bool.true$ } return Sk.builtin.bool.false$ } return e(c) ? Sk.builtin.bool.true$ : Sk.builtin.bool.false$ } ); Sk.builtin.bytes.prototype.find$left = function(a, c, b) { let d = -1; ({start: c, end: b} = f(this, c, b)); if (a instanceof Sk.builtin.int_) for (var e = c; e < b; e++) { if (this.v[e] === a.v) { d = e; break } } else if (a instanceof Sk.builtin.bytes) for (e = a.v.byteLength; c < b - e + 1; c++) { let b = !0; for (let d = c, f = 0; f < e; d++, f++) if (this.v[d] !== a.v[f]) { b = !1; break } if (b) { d = c; break } } else throw new Sk.builtin.TypeError("argument should be integer or bytes-like object, not '" + Sk.abstr.typeName(a) + "'"); return d } ; Sk.builtin.bytes.prototype.find$right = function(a, c, b) { let d = -1; ({start: c, end: b} = f(this, c, b)); if (a instanceof Sk.builtin.int_) for (var e = b - 1; e >= c; e--) { if (this.v[e] === a.v) { d = e; break } } else if (a instanceof Sk.builtin.bytes) for (e = a.v.byteLength, b -= e; b >= c; b--) { let c = !0; for (let d = b, f = 0; f < e; d++, f++) if (this.v[d] !== a.v[f]) { c = !1; break } if (c) { d = b; break } } else throw new Sk.builtin.TypeError("argument should be integer or bytes-like object, not '" + Sk.abstr.typeName(a) + "'"); return d } ; Sk.builtin.bytes.prototype.find = new Sk.builtin.func(function(a, c, b, d) { Sk.builtin.pyCheckArgsLen("find", arguments.length - 1, 1, 3); return Sk.builtin.int_(a.find$left(c, b, d)) } ); Sk.builtin.bytes.prototype.index = new Sk.builtin.func(function(a, c, b, d) { Sk.builtin.pyCheckArgsLen("index", arguments.length - 1, 1, 3); var f = a.find$left(c, b, d); if (-1 === f) throw new Sk.builtin.ValueError("subsection not found"); return Sk.builtin.int_(f) } ); Sk.builtin.bytes.prototype.join = new Sk.builtin.func(function(a, c) { var b, d; Sk.builtin.pyCheckArgsLen("join", arguments.length - 1, 1, 1); if (!Sk.builtin.checkIterable(c)) throw Sk.builtin.TypeError("can only join an iterable"); var f = []; var e = []; for (b = 0; b < a.v.byteLength; b++) e.push(a.v[b]); b = 0; var g = Sk.abstr.iter(c); for (d = g.tp$iternext(); void 0 !== d; d = g.tp$iternext()) { if (!(d instanceof Sk.builtin.bytes)) throw new Sk.builtin.TypeError("sequence item " + b.toString() + ": expected a bytes-like object, " + Sk.abstr.typeName(d) + " found"); 0 < f.length && (f = f.concat(e)); for (b = 0; b < d.v.byteLength; b++) f.push(d.v[b]); b++ } return new Sk.builtin.bytes(f) } ); Sk.builtin.bytes.prototype.maketrans = new Sk.builtin.func(function() { throw new Sk.builtin.NotImplementedError("maketrans() bytes method not implemented in Skulpt"); } ); Sk.builtin.bytes.prototype.partition = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("partition", arguments.length - 1, 1, 1); if (!(c instanceof Sk.builtin.bytes)) throw new Sk.builtin.TypeError("a bytes-like object is required, not '" + Sk.abstr.typeName(c) + "'"); var b = a.find$left(c); if (-1 === b) { var d = a; var f = new Sk.builtin.bytes(0); b = new Sk.builtin.bytes(0) } else d = new Sk.builtin.bytes(a.v.subarray(0, b)), f = new Sk.builtin.bytes(a.v.subarray(b, b + c.v.byteLength)), b = new Sk.builtin.bytes(a.v.subarray(b + c.v.byteLength, a.v.byteLength)); return new Sk.builtin.tuple([d, f, b]) } ); Sk.builtin.bytes.prototype.replace = new Sk.builtin.func(function(a, c, b, d) { var f, e; Sk.builtin.pyCheckArgsLen("replace", arguments.length - 1, 2, 3); if (!(c instanceof Sk.builtin.bytes)) throw new Sk.builtin.TypeError("a bytes-like object is required, not '" + Sk.abstr.typeName(c) + "'"); if (!(b instanceof Sk.builtin.bytes)) throw new Sk.builtin.TypeError("a bytes-like object is required, not '" + Sk.abstr.typeName(b) + "'"); if (void 0 === d) d = -1; else if (d instanceof Sk.builtin.int_) d = d.v; else throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(d) + "' object cannot be interpreted as an integer"); var g = []; var h = []; for (f = 0; f < b.v.byteLength; f++) h.push(b.v[f]); var k = c.v.byteLength; for (e = f = 0; f < a.v.byteLength && (-1 === d || e < d); ) { const b = a.find$left(c, f, a.v.byteLength); if (-1 === b) break; for (; f < b; f++) g.push(a.v[f]); g = g.concat(h); f = b + k; e++ } for (k = f; k < a.v.byteLength; k++) g.push(a.v[k]); return new Sk.builtin.bytes(g) } ); Sk.builtin.bytes.prototype.rfind = new Sk.builtin.func(function(a, c, b, d) { Sk.builtin.pyCheckArgsLen("rfind", arguments.length - 1, 1, 3); return Sk.builtin.int_(a.find$right(c, b, d)) } ); Sk.builtin.bytes.prototype.rindex = new Sk.builtin.func(function(a, c, b, d) { Sk.builtin.pyCheckArgsLen("rindex", arguments.length - 1, 1, 3); var f = a.find$right(c, b, d); if (-1 === f) throw new Sk.builtin.ValueError("subsection not found"); return Sk.builtin.int_(f) } ); Sk.builtin.bytes.prototype.rpartition = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("rpartition", arguments.length - 1, 1, 1); if (!(c instanceof Sk.builtin.bytes)) throw new Sk.builtin.TypeError("a bytes-like object is required, not '" + Sk.abstr.typeName(c) + "'"); var b = a.find$right(c); if (-1 === b) { var d = new Sk.builtin.bytes(0); var f = new Sk.builtin.bytes(0); return new Sk.builtin.tuple([d, f, a]) } d = new Sk.builtin.bytes(a.v.subarray(0, b)); f = new Sk.builtin.bytes(a.v.subarray(b, b + c.v.byteLength)); b = new Sk.builtin.bytes(a.v.subarray(b + c.v.byteLength, a.v.byteLength)); return new Sk.builtin.tuple([d, f, b]) } ); Sk.builtin.bytes.prototype.startswith = new Sk.builtin.func(function(a, c, b, d) { function e(c) { const f = c.v.byteLength; if (b + f <= d) { for (let d = b, e = 0; e < f; d++, e++) if (a.v[d] !== c.v[e]) return !1; return !0 } return !1 } Sk.builtin.pyCheckArgsLen("startswith", arguments.length - 1, 1, 3); if (!(c instanceof Sk.builtin.bytes || c instanceof Sk.builtin.tuple)) throw new Sk.builtin.TypeError("startswith first arg must be bytes or a tuple of bytes, not " + Sk.abstr.typeName(c)); ({start: b, end: d} = f(a, b, d)); if (d < b) return Sk.builtin.bool.false$; if (c instanceof Sk.builtin.tuple) { for (let a = Sk.abstr.iter(c), b = a.tp$iternext(); void 0 !== b; b = a.tp$iternext()) { if (!(b instanceof Sk.builtin.bytes)) throw new Sk.builtin.TypeError("a bytes-like object is required, not '" + Sk.abstr.typeName(b) + "'"); if (e(b)) return Sk.builtin.bool.true$ } return Sk.builtin.bool.false$ } return e(c) ? Sk.builtin.bool.true$ : Sk.builtin.bool.false$ } ); Sk.builtin.bytes.prototype.translate = new Sk.builtin.func(function() { throw new Sk.builtin.NotImplementedError("translate() bytes method not implemented in Skulpt"); } ); Sk.builtin.bytes.prototype.center = new Sk.builtin.func(function(a, c, b) { Sk.builtin.pyCheckArgsLen("center", arguments.length - 1, 1, 2); if (void 0 === b) b = 32; else if (b instanceof Sk.builtin.bytes && 1 == b.v.byteLength) b = b.v[0]; else throw new Sk.builtin.TypeError("center() argument 2 must be a byte string of length 1, not " + Sk.abstr.typeName(b)); if (c instanceof Sk.builtin.int_) c = c.v; else throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(c) + "' object cannot be interpreted as an integer"); if (c <= a.v.byteLength) return a; var d = []; var f = c - a.v.byteLength; if (f % 2) { var e = f / 2 - .5; var g = f / 2 + .5 } else g = e = f / 2; for (f = 0; f < e; f++) d.push(b); for (f = 0; f < a.v.byteLength; f++) d.push(a.v[f]); for (f = 0; f < g; f++) d.push(b); return new Sk.builtin.bytes(d) } ); Sk.builtin.bytes.prototype.ljust = new Sk.builtin.func(function(a, c, b) { var d; Sk.builtin.pyCheckArgsLen("ljust", arguments.length - 1, 1, 2); if (void 0 === b) b = 32; else if (b instanceof Sk.builtin.bytes && 1 == b.v.byteLength) b = b.v[0]; else throw new Sk.builtin.TypeError("ljust() argument 2 must be a byte string of length 1, not " + Sk.abstr.typeName(b)); if (c instanceof Sk.builtin.int_) c = c.v; else throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(c) + "' object cannot be interpreted as an integer"); if (c <= a.v.byteLength) return a; var f = []; for (d = 0; d < a.v.byteLength; d++) f.push(a.v[d]); for (d = 0; d < c - a.v.byteLength; d++) f.push(b); return new Sk.builtin.bytes(f) } ); Sk.builtin.bytes.prototype.left$strip = function(a) { var c; if (void 0 === a || a === Sk.builtin.none.none$) var b = [9, 10, 11, 12, 13, 32, 133]; else if (a instanceof Sk.builtin.bytes) for (b = [], c = 0; c < a.v.byteLength; c++) b.push(a.v[c]); else throw new Sk.builtin.TypeError("a bytes-like object is required, not '" + Sk.abstr.typeName(a) + "'"); a = []; for (c = 0; c < this.v.byteLength; ) if (b.includes(this.v[c])) c++; else break; for (b = c; b < this.v.byteLength; b++) a.push(this.v[b]); return new Sk.builtin.bytes(a) } ; Sk.builtin.bytes.prototype.lstrip = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("lstrip", arguments.length - 1, 0, 1); return a.left$strip(c) } ); Sk.builtin.bytes.prototype.rjust = new Sk.builtin.func(function(a, c, b) { var d; Sk.builtin.pyCheckArgsLen("rjust", arguments.length - 1, 1, 2); if (void 0 === b) b = 32; else if (b instanceof Sk.builtin.bytes && 1 == b.v.byteLength) b = b.v[0]; else throw new Sk.builtin.TypeError("rjust() argument 2 must be a byte string of length 1, not " + Sk.abstr.typeName(b)); if (c instanceof Sk.builtin.int_) c = c.v; else throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(c) + "' object cannot be interpreted as an integer"); if (c <= a.v.byteLength) return a; var f = []; for (d = 0; d < c - a.v.byteLength; d++) f.push(b); for (d = 0; d < a.v.byteLength; d++) f.push(a.v[d]); return new Sk.builtin.bytes(f) } ); Sk.builtin.bytes.prototype.rsplit = new Sk.builtin.func(function(a, c, b) { Sk.builtin.pyCheckArgsLen("rsplit", arguments.length, 1, 3); if (void 0 === c || c === Sk.builtin.none.none$) c = null; if (null !== c && !(c instanceof Sk.builtin.bytes)) throw new Sk.builtin.TypeError("expected bytes"); if (null !== c && 0 == c.v.byteLength) throw new Sk.builtin.ValueError("empty separator"); if (void 0 !== b && !Sk.builtin.checkInt(b)) throw new Sk.builtin.TypeError("an integer is required"); b = void 0 === b ? -1 : Sk.builtin.asnum$(b); let d = [] , f = 0; if (c) { for (var e = a.v.byteLength; 0 <= e; ) { var g = a.find$right(c, 0, e); if (-1 === g) break; d.push(new Sk.builtin.bytes(a.v.subarray(g + c.v.byteLength, e))); e = g; f++; if (-1 < b && f >= b) break } d.push(new Sk.builtin.bytes(a.v.subarray(0, e))) } else { for (e = a.v.byteLength - 1; -1 === b || f < b; ) { for (; 0 <= e && k(a.v[e]); ) e--; if (0 > e) break; g = e + 1; for (e--; 0 <= e && !k(a.v[e]); ) e--; d.push(new Sk.builtin.bytes(a.v.subarray(e + 1, g))); f++ } if (0 <= e) { for (; 0 <= e && k(a.v[e]); ) e--; 0 <= e && d.push(new Sk.builtin.bytes(a.v.subarray(0, e + 1))) } } return new Sk.builtin.list(d.reverse()) } ); Sk.builtin.bytes.prototype.right$strip = function(a) { var c; if (void 0 === a || a === Sk.builtin.none.none$) var b = [9, 10, 11, 12, 13, 32, 133]; else if (a instanceof Sk.builtin.bytes) for (b = [], c = 0; c < a.v.byteLength; c++) b.push(a.v[c]); else throw new Sk.builtin.TypeError("a bytes-like object is required, not '" + Sk.abstr.typeName(a) + "'"); a = []; for (c = this.v.byteLength - 1; -1 < c; ) if (b.includes(this.v[c])) c--; else break; for (b = 0; b <= c; b++) a.push(this.v[b]); return new Sk.builtin.bytes(a) } ; Sk.builtin.bytes.prototype.rstrip = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("rstrip", arguments.length - 1, 0, 1); return a.right$strip(c) } ); Sk.builtin.bytes.prototype.split = new Sk.builtin.func(function(a, c, b) { Sk.builtin.pyCheckArgsLen("split", arguments.length, 1, 3); if (void 0 === c || c === Sk.builtin.none.none$) c = null; if (null !== c && !(c instanceof Sk.builtin.bytes)) throw new Sk.builtin.TypeError("expected bytes"); if (null !== c && 0 == c.v.byteLength) throw new Sk.builtin.ValueError("empty separator"); if (void 0 !== b && !Sk.builtin.checkInt(b)) throw new Sk.builtin.TypeError("an integer is required"); b = void 0 === b ? -1 : Sk.builtin.asnum$(b); let d = [] , f = 0 , e = 0; if (c) { for (; e < a.v.byteLength; ) { var g = a.find$left(c, e); if (-1 === g) break; d.push(new Sk.builtin.bytes(a.v.subarray(e, g))); e = g + c.v.byteLength; f++; if (-1 < b && f >= b) break } d.push(new Sk.builtin.bytes(a.v.subarray(e, a.v.byteLength))) } else { g = 0; let c = a.v.byteLength; for (; -1 === b || f < b; ) { for (; g < c && k(a.v[g]); ) g++; if (g == c) break; e = g; for (g++; g < c && !k(a.v[g]); ) g++; d.push(new Sk.builtin.bytes(a.v.subarray(e, g))); f++ } if (g < c) { for (; g < c && k(a.v[g]); ) g++; g < c && d.push(new Sk.builtin.bytes(a.v.subarray(g, c))) } } return new Sk.builtin.list(d) } ); Sk.builtin.bytes.prototype.strip = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("strip", arguments.length - 1, 0, 1); return a.left$strip(c).right$strip(c) } ); Sk.builtin.bytes.prototype.capitalize = new Sk.builtin.func(function(a) { var c; Sk.builtin.pyCheckArgsLen("capitalize", arguments.length - 1, 0, 0); if (0 === a.v.byteLength) return new Sk.builtin.bytes(0); var b = []; var d = 97 <= a.v[0] && 122 >= a.v[0] ? a.v[0] - 32 : a.v[0]; b.push(d); for (c = 1; c < a.v.byteLength; c++) d = a.v[c], 65 <= d && 90 >= d && (d += 32), b.push(d); return new Sk.builtin.bytes(b) } ); Sk.builtin.bytes.prototype.expandtabs = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("expandtabs", arguments.length, 1, 2); if (void 0 !== c && !Sk.builtin.checkInt(c)) throw new Sk.builtin.TypeError("integer argument exepected, got " + Sk.abstr.typeName(c)); c = void 0 === c ? 8 : Sk.builtin.asnum$(c); let b = [] , d = 0; for (let f = 0; f < a.v.byteLength; f++) if (9 === a.v[f]) { let a = c - d % c; b = b.concat(Array(a).fill(32)); d += a } else 10 === a.v[f] || 13 === a.v[f] ? (b.push(a.v[f]), d = 0) : (b.push(a.v[f]), d++); return new Sk.builtin.bytes(b) } ); Sk.builtin.bytes.prototype.isalnum = new Sk.builtin.func(function(a) { var c; Sk.builtin.pyCheckArgsLen("isalnum", arguments.length - 1, 0, 0); if (0 === a.v.byteLength) return Sk.builtin.bool.false$; for (c = 0; c < a.v.byteLength; c++) { var b = a.v[c]; if (!(48 <= b && 57 >= b || 65 <= b && 90 >= b || 97 <= b && 122 >= b)) return Sk.builtin.bool.false$ } return Sk.builtin.bool.true$ } ); Sk.builtin.bytes.prototype.isalpha = new Sk.builtin.func(function(a) { var c; Sk.builtin.pyCheckArgsLen("isalpha", arguments.length - 1, 0, 0); if (0 === a.v.byteLength) return Sk.builtin.bool.false$; for (c = 0; c < a.v.byteLength; c++) { var b = a.v[c]; if (!(65 <= b && 90 >= b || 97 <= b && 122 >= b)) return Sk.builtin.bool.false$ } return Sk.builtin.bool.true$ } ); Sk.builtin.bytes.prototype.isascii = new Sk.builtin.func(function(a) { var c; Sk.builtin.pyCheckArgsLen("isascii", arguments.length - 1, 0, 0); for (c = 0; c < a.v.byteLength; c++) { var b = a.v[c]; if (!(0 <= b && 128 > b)) return Sk.builtin.bool.false$ } return Sk.builtin.bool.true$ } ); Sk.builtin.bytes.prototype.isdigit = new Sk.builtin.func(function(a) { var c; Sk.builtin.pyCheckArgsLen("isdigit", arguments.length - 1, 0, 0); if (0 === a.v.byteLength) return Sk.builtin.bool.false$; for (c = 0; c < a.v.byteLength; c++) { var b = a.v[c]; if (!(48 <= b && 58 > b)) return Sk.builtin.bool.false$ } return Sk.builtin.bool.true$ } ); Sk.builtin.bytes.prototype.islower = new Sk.builtin.func(function(a) { var c, b; Sk.builtin.pyCheckArgsLen("islower", arguments.length - 1, 0, 0); for (c = 0; c < a.v.byteLength; c++) { var d = a.v[c]; if (65 <= d && 90 >= d) return Sk.builtin.bool.false$; !b && 97 <= d && 122 >= d && (b = !0) } return b ? Sk.builtin.bool.true$ : Sk.builtin.bool.false$ } ); Sk.builtin.bytes.prototype.isspace = new Sk.builtin.func(function(a) { var c; Sk.builtin.pyCheckArgsLen("isspace", arguments.length - 1, 0, 0); if (0 === a.v.byteLength) return Sk.builtin.bool.false$; for (c = 0; c < a.v.byteLength; c++) { var b = a.v[c]; if (32 !== b && 9 !== b && 10 !== b && 13 !== b && 11 !== b && 12 !== b) return Sk.builtin.bool.false$ } return Sk.builtin.bool.true$ } ); Sk.builtin.bytes.prototype.istitle = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("istitle", arguments.length - 1, 0, 0); if (0 === a.v.byteLength) return Sk.builtin.bool.false$; let c = !1 , b = !1; for (let d = 0; d < a.v.byteLength; d++) { const f = a.v[d]; if (65 <= f && 90 >= f) { if (c) return Sk.builtin.bool.false$; b = c = !0 } else if (97 <= f && 122 >= f) { if (!c) return Sk.builtin.bool.false$; b = !0 } else c = !1 } return b ? Sk.builtin.bool.true$ : Sk.builtin.bool.false$ } ); Sk.builtin.bytes.prototype.isupper = new Sk.builtin.func(function(a) { var c, b; Sk.builtin.pyCheckArgsLen("isupper", arguments.length - 1, 0, 0); for (c = 0; c < a.v.byteLength; c++) { var d = a.v[c]; !b && 65 <= d && 90 >= d && (b = !0); if (97 <= d && 122 >= d) return Sk.builtin.bool.false$ } return b ? Sk.builtin.bool.true$ : Sk.builtin.bool.false$ } ); Sk.builtin.bytes.prototype.lower = new Sk.builtin.func(function(a) { var c; Sk.builtin.pyCheckArgsLen("lower", arguments.length - 1, 0, 0); var b = []; for (c = 0; c < a.v.byteLength; c++) { var d = a.v[c]; 65 <= d && 90 >= d && (d += 32); b.push(d) } return new Sk.builtin.bytes(b) } ); Sk.builtin.bytes.prototype.splitlines = new Sk.builtin.func(function(a, c) { Sk.builtin.pyCheckArgsLen("splitlines", arguments.length, 1, 2); if (void 0 !== c && !Sk.builtin.checkBool(c)) throw new Sk.builtin.TypeError("boolean argument expected, got " + Sk.abstr.typeName(c)); c = void 0 === c ? !1 : c.v; let b = [] , d = 0; let f = 0; for (; f < a.v.byteLength; ) { var e = a.v[f]; if (13 === e) { let g = !1; f < a.v.byteLength - 1 && 10 === a.v[f + 1] && (g = !0); e = c ? g ? f + 2 : f + 1 : f; b.push(new Sk.builtin.bytes(a.v.subarray(d, e))); f = d = g ? f + 2 : f + 1 } else 10 === e ? (e = c ? f + 1 : f, b.push(new Sk.builtin.bytes(a.v.subarray(d, e))), f = d = f + 1) : f++ } d < a.v.byteLength && b.push(new Sk.builtin.bytes(a.v.subarray(d, a.v.byteLength))); return new Sk.builtin.list(b) } ); Sk.builtin.bytes.prototype.swapcase = new Sk.builtin.func(function(a) { var c; Sk.builtin.pyCheckArgsLen("swapcase", arguments.length - 1, 0, 0); var b = []; for (c = 0; c < a.v.byteLength; c++) { var d = a.v[c]; 65 <= d && 90 >= d ? d += 32 : 97 <= d && 122 >= d && (d -= 32); b.push(d) } return new Sk.builtin.bytes(b) } ); Sk.builtin.bytes.prototype.title = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("title", arguments.length - 1, 0, 0); if (0 === a.v.byteLength) return new Sk.builtin.bytes(0); let c = [] , b = !1; for (let d = 0; d < a.v.byteLength; d++) { const f = a.v[d]; 65 <= f && 90 >= f ? b ? c.push(f + 32) : (b = !0, c.push(f)) : 97 <= f && 122 >= f ? b ? c.push(f) : (b = !0, c.push(f - 32)) : (b = !1, c.push(f)) } return new Sk.builtin.bytes(c) } ); Sk.builtin.bytes.prototype.upper = new Sk.builtin.func(function(a) { var c; Sk.builtin.pyCheckArgsLen("upper", arguments.length - 1, 0, 0); var b = []; for (c = 0; c < a.v.byteLength; c++) { var d = a.v[c]; 97 <= d && 122 >= d && (d -= 32); b.push(d) } return new Sk.builtin.bytes(b) } ); Sk.builtin.bytes.prototype.zfill = new Sk.builtin.func(function(a, c) { var b; Sk.builtin.pyCheckArgsLen("zfill", arguments.length - 1, 1, 1); if (!(c instanceof Sk.builtin.int_)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(c) + "' object cannot be interpreted as an integer"); if (c.v <= a.v.byteLength) return a; var d = []; var f = c.v - a.v.byteLength; if (43 === a.v[0] || 45 === a.v[0]) { var e = a.v[0]; d.push(e); for (b = 0; b < f; b++) d.push(48); b = 1 } else { for (b = 0; b < f; b++) d.push(48); b = 0 } for (; b < a.v.byteLength; b++) e = a.v[b], d.push(e); return new Sk.builtin.bytes(d) } ); Sk.builtin.bytes.prototype.__iter__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__iter__", arguments.length, 0, 0, !0, !1); return new Sk.builtin.bytes_iter_(a) } ); Sk.builtin.bytes.prototype.tp$iter = function() { return new Sk.builtin.bytes_iter_(this) } ; Sk.builtin.bytes_iter_ = function(a) { if (!(this instanceof Sk.builtin.bytes_iter_)) return new Sk.builtin.bytes_iter_(a); this.$index = 0; this.sq$length = a.v.byteLength; this.tp$iter = ()=>this; this.tp$iternext = function() { if (!(this.$index >= this.sq$length)) return new Sk.builtin.int_(a.v[this.$index++]) } ; this.$r = function() { return new Sk.builtin.str("bytesiterator") } ; return this } ; Sk.abstr.setUpInheritance("bytesiterator", Sk.builtin.bytes_iter_, Sk.builtin.object); Sk.builtin.bytes_iter_.prototype.__class__ = Sk.builtin.bytes_iter_; Sk.builtin.bytes_iter_.prototype.__iter__ = new Sk.builtin.func(function(a) { return a } ); Sk.builtin.bytes_iter_.prototype.next$ = function(a) { a = a.tp$iternext(); if (void 0 === a) throw new Sk.builtin.StopIteration; return a } ; Sk.exportSymbol("Sk.builtin.bytes", Sk.builtin.bytes) } , function(m, p, a) { (function(a) { (function(a) { function c() {} function b() {} var h = String.fromCharCode , g = {}.toString , f = g.call(a.SharedArrayBuffer) , k = g() , n = a.Uint8Array , l = n || Array , q = n ? ArrayBuffer : l , m = q.isView || function(a) { return a && "length"in a } , z = g.call(q.prototype); q = b.prototype; var p = a.TextEncoder , t = new (n ? Uint16Array : l)(32); c.prototype.decode = function(a) { if (!m(a)) { var c = g.call(a); if (c !== z && c !== f && c !== k) throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'"); a = n ? new l(a) : a || [] } for (var b = c = "", d = 0, e = a.length | 0, q = e - 32 | 0, u, p, y = 0, H = 0, S, R = 0, V = -1; d < e; ) { for (u = d <= q ? 32 : e - d | 0; R < u; d = d + 1 | 0, R = R + 1 | 0) { p = a[d] & 255; switch (p >> 4) { case 15: S = a[d = d + 1 | 0] & 255; if (2 !== S >> 6 || 247 < p) { d = d - 1 | 0; break } y = (p & 7) << 6 | S & 63; H = 5; p = 256; case 14: S = a[d = d + 1 | 0] & 255, y <<= 6, y |= (p & 15) << 6 | S & 63, H = 2 === S >> 6 ? H + 4 | 0 : 24, p = p + 256 & 768; case 13: case 12: S = a[d = d + 1 | 0] & 255, y <<= 6, y |= (p & 31) << 6 | S & 63, H = H + 7 | 0, d < e && 2 === S >> 6 && y >> H && 1114112 > y ? (p = y, y = y - 65536 | 0, 0 <= y && (V = (y >> 10) + 55296 | 0, p = (y & 1023) + 56320 | 0, 31 > R ? (t[R] = V, R = R + 1 | 0, V = -1) : (S = V, V = p, p = S))) : (p >>= 8, d = d - p - 1 | 0, p = 65533), y = H = 0, u = d <= q ? 32 : e - d | 0; default: t[R] = p; continue; case 11: case 10: case 9: case 8: } t[R] = 65533 } b += h(t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15], t[16], t[17], t[18], t[19], t[20], t[21], t[22], t[23], t[24], t[25], t[26], t[27], t[28], t[29], t[30], t[31]); 32 > R && (b = b.slice(0, R - 32 | 0)); if (d < e) { if (t[0] = V, R = ~V >>> 31, V = -1, b.length < c.length) continue } else -1 !== V && (b += h(V)); c += b; b = "" } return c } ; q.encode = function(a) { a = void 0 === a ? "" : "" + a; var c = a.length | 0, b = new l((c << 1) + 8 | 0), d, f = 0, e = !n; for (d = 0; d < c; d = d + 1 | 0, f = f + 1 | 0) { var g = a.charCodeAt(d) | 0; if (127 >= g) b[f] = g; else { if (2047 >= g) b[f] = 192 | g >> 6; else { a: { if (55296 <= g) if (56319 >= g) { var h = a.charCodeAt(d = d + 1 | 0) | 0; if (56320 <= h && 57343 >= h) { g = (g << 10) + h - 56613888 | 0; if (65535 < g) { b[f] = 240 | g >> 18; b[f = f + 1 | 0] = 128 | g >> 12 & 63; b[f = f + 1 | 0] = 128 | g >> 6 & 63; b[f = f + 1 | 0] = 128 | g & 63; continue } break a } g = 65533 } else 57343 >= g && (g = 65533); !e && d << 1 < f && d << 1 < (f - 7 | 0) && (e = !0, h = new l(3 * c), h.set(b), b = h) } b[f] = 224 | g >> 12; b[f = f + 1 | 0] = 128 | g >> 6 & 63 } b[f = f + 1 | 0] = 128 | g & 63 } } return n ? b.subarray(0, f) : b.slice(0, f) } ; p || (a.TextDecoder = c, a.TextEncoder = b) } )("undefined" == typeof a ? "undefined" == typeof self ? this : self : a) } ).call(this, a(0)) } , function(m, p) { const a = /^(?:(.)?([<>=\^]))?([\+\-\s])?(#)?(0)?(\d+)?(,)?(?:\.(\d+))?([bcdeEfFgGnosxX%])?$/; Sk.formatting = {}; let b = function(a, c, b, d) { Sk.asserts.assert("string" === typeof c); if (a[6]) { var f = parseInt(a[6], 10); d = a[2] || (a[5] ? "=" : d ? ">" : "<"); let e = f - (c.length + (b ? b.length : 0)); if (0 >= e) return c; f = (a[1] || (a[5] ? "0" : " ")).repeat(e); switch (d) { case "=": if ("s" === a[9]) throw new Sk.builtin.ValueError("'=' alignment not allowed in string format specifier"); return b + f + c; case ">": return f + b + c; case "<": return b + c + f; case "^": return a = Math.floor(e / 2), f.substring(0, a) + b + c + f.substring(a) } } return b + c } , c = function(a, c) { return c ? "-" : "+" === a[3] ? "+" : " " === a[3] ? " " : "" } , d = function(a, d, f) { Sk.asserts.assert(d instanceof Sk.builtin.int_ || d instanceof Sk.builtin.lng); if (a[8]) throw new Sk.builtin.ValueError("Precision not allowed in integer format"); let e = d.str$(f, !1); d = d.nb$isnegative(); d = c(a, d); a[4] && (16 === f ? d += "0x" : 8 === f ? d += "0o" : 2 === f && (d += "0b")); "X" === a[9] && (e = e.toUpperCase()); "n" === a[9] ? e = (+e).toLocaleString() : a[7] && (f = e.toString().split("."), f[0] = f[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), e = f.join(".")); return b(a, e, d, !0) } , e = function(e, g, f) { if (!g) return e.str$(10, !0); g = g.match(a); if (!g) throw new Sk.builtin.ValueError("Invalid format specifier"); var k = g[9]; k || (k = f ? "g" : "d"); if (-1 == (f ? "fFeEgG%" : "bcdoxXnfFeEgG%").indexOf(k)) throw new Sk.builtin.ValueError("Unknown format code '" + g[9] + "' for object of type '" + Sk.abstr.typeName(e) + "'"); switch (k) { case "d": case "n": return d(g, e, 10); case "x": case "X": return d(g, e, 16); case "o": return d(g, e, 8); case "b": return d(g, e, 2); case "c": if (g[3]) throw new Sk.builtin.ValueError("Sign not allowed with integer format specifier 'c'"); if (g[4]) throw new Sk.builtin.ValueError("Alternate form not allowed with integer format specifier 'c'"); if (g[7]) throw new Sk.builtin.ValueError("Cannot specify ',' with 'c'"); if (g[8]) throw new Sk.builtin.ValueError("Cannot specify ',' with 'c'"); return b(g, String.fromCodePoint(Sk.builtin.asnum$(e)), "", !0); case "f": case "F": case "e": case "E": case "g": case "G": { if (g[4]) throw new Sk.builtin.ValueError("Alternate form (#) not allowed in float format specifier"); f = Sk.builtin.asnum$(e); "string" === typeof f && (f = Number(f)); if (Infinity === f) return b(g, "inf", "", !0); if (-Infinity === f) return b(g, "inf", "-", !0); if (isNaN(f)) return b(g, "nan", "", !0); e = !1; 0 > f && (f = -f, e = !0); let a = ["toExponential", "toFixed", "toPrecision"]["efg".indexOf(k.toLowerCase())] , d = g[8] ? parseInt(g[8], 10) : 6; f = f[a](d); -1 !== "EFG".indexOf(k) && (f = f.toUpperCase()); if ("g" === k.toLowerCase() || !g[9]) { if (k = f.match(/\.(\d*[1-9])?(0+)$/)) { let[,a,c] = k; f = f.slice(0, a ? -c.length : -(c.length + 1)) } -1 != f.indexOf(".") || g[9] || (f += ".0") } g[7] && (k = f.toString().split("."), k[0] = k[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), f = k.join(".")); return b(g, f, c(g, e), !0) } case "%": if (g[4]) throw new Sk.builtin.ValueError("Alternate form (#) not allowed with format specifier '%'"); e = Sk.builtin.asnum$(e); "string" === typeof e && (e = Number(e)); if (Infinity === e) return b(g, "inf%", "", !0); if (-Infinity === e) return b(g, "inf%", "-", !0); if (isNaN(e)) return b(g, "nan%", "", !0); k = !1; 0 > e && (e = -e, k = !0); f = g[8] ? parseInt(g[8], 10) : 6; e = (100 * e).toFixed(f) + "%"; return b(g, e, c(g, k), !0); default: throw new Sk.builtin.ValueError("Unknown format code '" + g[9] + "'"); } }; Sk.formatting.mkNumber__format__ = a=>new Sk.builtin.func(function(c, b) { Sk.builtin.pyCheckArgsLen("__format__", arguments.length, 2, 2); if (!Sk.builtin.checkString(b)) throw new Sk.builtin.TypeError("format() argument 2 must be str, not " + Sk.abstr.typeName(b)); return new Sk.builtin.str(e(c, b.$jsstr(), a)) } ); m = function(a) { var c = {}; Sk.builtin.pyCheckArgsLen("format", arguments.length, 0, Infinity, !0, !0); var b = new Sk.builtins.tuple(Array.prototype.slice.call(arguments, 1)); var d = new Sk.builtins.dict(a); if (void 0 === arguments[1]) return b.v; var e = 0; if (0 !== d.size) { let a, b, f; a = d.tp$iter(); for (b = a.tp$iternext(); void 0 !== b; b = a.tp$iternext()) f = d.mp$lookup(b), c[b.v] = f } for (var h in b.v) "0" !== h && (c[h - 1] = b.v[h]); b = b.v[0].v.replace(/{(((?:\d+)|(?:\w+))?((?:\.(\w+))|(?:\[((?:\d+)|(?:\w+))\])?))?(?:!([rs]))?(?::([^}]*))?}/g, function(a, b, d, f, g, h, k, l, n, m) { let q; if (void 0 !== h && "" !== h) a = c[d], q = a.constructor === Array ? a[h] : /^\d+$/.test(h) ? Sk.abstr.objectGetItem(a, new Sk.builtin.int_(parseInt(h, 10)), !1) : Sk.abstr.objectGetItem(a, new Sk.builtin.str(h), !1), e++; else if (void 0 !== g && "" !== g) q = Sk.abstr.gattr(c[d || e++], new Sk.builtin.str(g)); else if (void 0 !== d && "" !== d) q = c[d]; else if (void 0 === b || "" === b) q = c[e], e++; else if (b instanceof Sk.builtin.int_ || b instanceof Sk.builtin.float_ || b instanceof Sk.builtin.lng || /^\d+$/.test(b)) q = c[b], e++; if ("s" === k) q = new Sk.builtin.str(q); else if ("r" === k) q = Sk.builtin.repr(q); else if ("" !== k && void 0 !== k) throw new Sk.builtin.ValueError("Unknown conversion specifier " + k); return Sk.abstr.objectFormat(q, new Sk.builtin.str(l)).$jsstr() }); return new Sk.builtin.str(b) } ; m.co_kwargs = !0; Sk.builtin.str.prototype.format = new Sk.builtin.func(m); Sk.builtin.str.prototype.__format__ = new Sk.builtin.func(function(c, d) { Sk.builtin.pyCheckArgsLen("__format__", arguments.length, 2, 2); if (!Sk.builtin.checkString(d)) throw new Sk.builtin.TypeError("format() argument 2 must be str, not " + Sk.abstr.typeName(d)); let f = d.$jsstr().match(a); if (f[9] && "s" !== f[9]) throw new Sk.builtin.ValueError("Unknown format code '" + f[9] + "' for object of type 'str'"); if (f[3]) throw new Sk.builtin.ValueError("Sign not allowed in string format specifier"); if (f[4]) throw new Sk.builtin.ValueError("Alternate form (#) not allowed with string format specifier"); if (f[7]) throw new Sk.builtin.ValueError("Cannot specify ',' with 's'"); let e = c.v; f[8] && (e = e.substring(0, f[8])); return new Sk.builtin.str(b(f, e, "", !1)) } ) } , function(m, p) { Sk.builtin.tuple = function(a, b) { if (!(this instanceof Sk.builtin.tuple)) return Sk.builtin.pyCheckArgsLen("tuple", arguments.length, 0, 1), new Sk.builtin.tuple(a,!0); if (void 0 === a) this.v = []; else if (Array.isArray(a)) this.v = a; else return Sk.misceval.chain(Sk.misceval.arrayFromIterable(a, b), a=>{ this.v = a; return this } ) } ; Sk.abstr.setUpInheritance("tuple", Sk.builtin.tuple, Sk.builtin.seqtype); Sk.builtin.tuple.prototype.__class__ = Sk.builtin.tuple; Sk.builtin.tuple.prototype.sk$asarray = function() { return this.v.slice(0) } ; Sk.builtin.tuple.prototype.$r = function() { var a; if (0 === this.v.length) return new Sk.builtin.str("()"); var b = []; for (a = 0; a < this.v.length; ++a) b[a] = Sk.misceval.objectRepr(this.v[a]).v; a = b.join(", "); 1 === this.v.length && (a += ","); return new Sk.builtin.str("(" + a + ")") } ; Sk.builtin.tuple.prototype.mp$subscript = function(a) { let b; if (Sk.misceval.isIndex(a)) { b = Sk.misceval.asIndex(a); if ("number" !== typeof b) throw new Sk.builtin.IndexError("cannot fit '" + Sk.abstr.typeName(a) + "' into an index-sized integer"); if (void 0 !== b) { 0 > b && (b = this.v.length + b); if (0 > b || b >= this.v.length) throw new Sk.builtin.IndexError("tuple index out of range"); return this.v[b] } } else if (a instanceof Sk.builtin.slice) { const c = []; a.sssiter$(this.v.length, a=>{ c.push(this.v[a]) } ); return new Sk.builtin.tuple(c) } throw new Sk.builtin.TypeError("tuple indices must be integers, not " + Sk.abstr.typeName(a)); } ; Sk.builtin.tuple.prototype.tp$hash = function() { var a, b = 1000003, c = 3430008, d = this.v.length; for (a = 0; a < d; ++a) { var e = Sk.builtin.hash(this.v[a]).v; if (-1 === e) return new Sk.builtin.int_(-1); c = (c ^ e) * b; b += 82520 + d + d } c += 97531; -1 === c && (c = -2); return new Sk.builtin.int_(c | 0) } ; Sk.builtin.tuple.prototype.sq$repeat = function(a) { if (!Sk.misceval.isIndex(a)) throw new Sk.builtin.TypeError("can't multiply sequence by non-int of type '" + Sk.abstr.typeName(a) + "'"); var b = Sk.misceval.asIndex(a); if ("number" !== typeof b) throw new Sk.builtin.OverflowError("cannot fit '" + Sk.abstr.typeName(a) + "' into an index-sized integer"); var c = []; for (a = 0; a < b; ++a) c.push.apply(c, this.v); return new Sk.builtin.tuple(c) } ; Sk.builtin.tuple.prototype.nb$multiply = Sk.builtin.tuple.prototype.sq$repeat; Sk.builtin.tuple.prototype.nb$inplace_multiply = Sk.builtin.tuple.prototype.sq$repeat; Sk.builtin.tuple.prototype.__iter__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__iter__", arguments.length, 1, 1); return new Sk.builtin.tuple_iter_(a) } ); Sk.builtin.tuple.prototype.tp$iter = function() { return new Sk.builtin.tuple_iter_(this) } ; Sk.builtin.tuple.prototype.tp$richcompare = function(a, b) { var c; if (!a.__class__ || !Sk.misceval.isTrue(Sk.builtin.isinstance(a, Sk.builtin.tuple))) return "Eq" === b ? !1 : "NotEq" === b ? !0 : Sk.__future__.python3 ? Sk.builtin.NotImplemented.NotImplemented$ : !1; var d = this.v; a = a.v; var e = d.length; var h = a.length; for (c = 0; c < e && c < h; ++c) { var g = Sk.misceval.richCompareBool(d[c], a[c], "Eq"); if (!g) break } if (c >= e || c >= h) switch (b) { case "Lt": return e < h; case "LtE": return e <= h; case "Eq": return e === h; case "NotEq": return e !== h; case "Gt": return e > h; case "GtE": return e >= h; default: Sk.asserts.fail() } return "Eq" === b ? !1 : "NotEq" === b ? !0 : Sk.misceval.richCompareBool(d[c], a[c], b) } ; Sk.builtin.tuple.prototype.sq$concat = function(a) { if (a.__class__ != Sk.builtin.tuple) throw a = 'can only concatenate tuple (not "' + (Sk.abstr.typeName(a) + '") to tuple'), new Sk.builtin.TypeError(a); return new Sk.builtin.tuple(this.v.concat(a.v)) } ; Sk.builtin.tuple.prototype.sq$contains = function(a) { var b, c = this.v; for (b = 0; b < c.length; b++) if (Sk.misceval.richCompareBool(c[b], a, "Eq")) return !0; return !1 } ; Sk.builtin.tuple.prototype.nb$add = Sk.builtin.tuple.prototype.sq$concat; Sk.builtin.tuple.prototype.nb$inplace_add = Sk.builtin.tuple.prototype.sq$concat; Sk.builtin.tuple.prototype.sq$length = function() { return this.v.length } ; Sk.builtin.tuple.prototype.index = new Sk.builtin.func(function(a, b) { var c = a.v.length , d = a.v; for (a = 0; a < c; ++a) if (Sk.misceval.richCompareBool(d[a], b, "Eq")) return new Sk.builtin.int_(a); throw new Sk.builtin.ValueError("tuple.index(x): x not in tuple"); } ); Sk.builtin.tuple.prototype.count = new Sk.builtin.func(function(a, b) { var c = a.v.length , d = a.v , e = 0; for (a = 0; a < c; ++a) Sk.misceval.richCompareBool(d[a], b, "Eq") && (e += 1); return new Sk.builtin.int_(e) } ); Sk.exportSymbol("Sk.builtin.tuple", Sk.builtin.tuple); Sk.builtin.tuple_iter_ = function(a) { if (!(this instanceof Sk.builtin.tuple_iter_)) return new Sk.builtin.tuple_iter_(a); this.$index = 0; this.$obj = a.v.slice(); this.sq$length = this.$obj.length; this.tp$iter = ()=>this; this.tp$iternext = function() { if (!(this.$index >= this.sq$length)) return this.$obj[this.$index++] } ; this.$r = function() { return new Sk.builtin.str("tupleiterator") } ; return this } ; Sk.abstr.setUpInheritance("tupleiterator", Sk.builtin.tuple_iter_, Sk.builtin.object); Sk.builtin.tuple_iter_.prototype.__class__ = Sk.builtin.tuple_iter_; Sk.builtin.tuple_iter_.prototype.__iter__ = new Sk.builtin.func(function(a) { return a } ); Sk.builtin.tuple_iter_.prototype.next$ = function(a) { a = a.tp$iternext(); if (void 0 === a) throw new Sk.builtin.StopIteration; return a } } , function(m, p) { function a(a) { let c = a.$savedKeyHash_; return void 0 !== c ? c : a.ob$type === Sk.builtin.str ? (c = a.$jsstr().replace(b, "!$&"), a.$savedKeyHash_ = c) : "string" === typeof a ? a.replace(b, "!$&") : Sk.builtin.hash(a).v } Sk.builtin.dict = function(a) { var c, b; if (!(this instanceof Sk.builtin.dict)) return new Sk.builtin.dict(a); void 0 === a && (a = []); this.size = 0; this.entries = Object.create(null); this.buckets = {}; if (Array.isArray(a)) for (c = 0; c < a.length; c += 2) this.mp$ass_subscript(a[c], a[c + 1]); else if (a instanceof Sk.builtin.dict) { var h = Sk.abstr.iter(a); for (b = h.tp$iternext(); void 0 !== b; b = h.tp$iternext()) c = a.mp$subscript(b), void 0 === c && (c = null), this.mp$ass_subscript(b, c) } else if (Sk.builtin.checkIterable(a)) for (h = Sk.abstr.iter(a), c = h.tp$iternext(); void 0 !== c; c = h.tp$iternext()) if (c.mp$subscript) this.mp$ass_subscript(c.mp$subscript(0), c.mp$subscript(1)); else throw new Sk.builtin.TypeError("element " + this.size + " is not a sequence"); else throw new Sk.builtin.TypeError("object is not iterable"); this.__class__ = Sk.builtin.dict; this.tp$call = void 0; return this } ; Sk.builtin.dict.tp$call = function(a, b) { var c; Sk.builtin.pyCheckArgsLen("dict", a, 0, 1); a = new Sk.builtin.dict(a[0]); if (b) for (c = 0; c < b.length; c += 2) a.mp$ass_subscript(new Sk.builtin.str(b[c]), b[c + 1]); return a } ; Sk.abstr.setUpInheritance("dict", Sk.builtin.dict, Sk.builtin.object); Sk.abstr.markUnhashable(Sk.builtin.dict); var b = /^[0-9!#_]/; Sk.builtin.dict.prototype.sk$asarray = function() { return Object.values(this.entries).map(a=>a.lhs) } ; Sk.builtin.dict.prototype.get$bucket_item = function(a, b) { b = this.buckets[b]; let c, d; if (void 0 !== b) for (let e = 0; e < b.length; e++) if (d = b[e], void 0 !== d && (c = d.lhs, c === a || Sk.misceval.richCompareBool(a, c, "Eq"))) return d } ; Sk.builtin.dict.prototype.mp$lookup = function(c) { const b = a(c); c = "string" === typeof b ? this.entries[b] : this.get$bucket_item(c, b); if (void 0 !== c) return c.rhs } ; Sk.builtin.dict.prototype.mp$subscript = function(a) { Sk.builtin.pyCheckArgsLen("[]", arguments.length, 1, 2, !1, !1); var c = this.mp$lookup(a); if (void 0 !== c) return c; throw new Sk.builtin.KeyError(a); } ; Sk.builtin.dict.prototype.sq$contains = function(a) { return void 0 !== this.mp$lookup(a) } ; Sk.builtin.dict.prototype.mp$ass_subscript = function(c, b) { const d = a(c); let h; "string" === typeof d ? (h = this.entries[d], void 0 === h ? (this.entries[d] = { lhs: c, rhs: b }, this.size++) : h.rhs = b) : (h = this.get$bucket_item(c, d), void 0 === h ? (this.set$bucket_item(c, b, d), this.size++) : h.rhs = b) } ; Sk.builtin.dict.prototype.set$bucket_item = function(a, b, e) { let c = this.buckets[e]; a = { lhs: a, rhs: b }; void 0 === c ? (this.buckets[e] = [a], e = "#" + e + "_0") : (b = c.indexOf(void 0), -1 !== b ? (e = "#" + e + "_" + b, c[b] = a) : (e = "#" + e + "_" + c.length, c.push(a))); this.entries[e] = a } ; Sk.builtin.dict.prototype.pop$bucket_item = function(a, b) { const c = this.buckets[b]; let d, g; if (void 0 !== c) for (let f = 0; f < c.length; f++) if (g = c[f], void 0 !== g && (d = g.lhs, d === a || Sk.misceval.richCompareBool(a, d, "Eq"))) return delete this.entries["#" + b + "_" + f], c[f] = void 0, c.every(a=>void 0 === a) && delete this.buckets[b], g } ; Sk.builtin.dict.prototype.mp$del_subscript = function(c) { Sk.builtin.pyCheckArgsLen("del", arguments.length, 1, 1, !1, !1); const b = a(c); let e; "string" === typeof b ? (e = this.entries[b], delete this.entries[b]) : e = this.pop$bucket_item(c, b); if (void 0 !== e) this.size--; else throw new Sk.builtin.KeyError(c); } ; Sk.builtin.dict.prototype.$r = function() { var a, b = []; var e = Sk.abstr.iter(this); for (a = e.tp$iternext(); void 0 !== a; a = e.tp$iternext()) { var h = this.mp$subscript(a); void 0 === h && (h = null); h === this ? b.push(Sk.misceval.objectRepr(a).v + ": {...}") : b.push(Sk.misceval.objectRepr(a).v + ": " + Sk.misceval.objectRepr(h).v) } return new Sk.builtin.str("{" + b.join(", ") + "}") } ; Sk.builtin.dict.prototype.mp$length = function() { return this.size } ; Sk.builtin.dict.prototype.get = new Sk.builtin.func(function(a, b, e) { Sk.builtin.pyCheckArgsLen("get()", arguments.length, 1, 2, !1, !0); void 0 === e && (e = Sk.builtin.none.none$); var c = a.mp$lookup(b); void 0 === c && (c = e); return c } ); Sk.builtin.dict.prototype.pop = new Sk.builtin.func(function(c, b, e) { Sk.builtin.pyCheckArgsLen("pop()", arguments.length, 1, 2, !1, !0); const d = a(b); let g, f; "string" === typeof d ? (g = c.entries[d], void 0 !== g && (f = g.rhs, delete c.entries[d])) : (g = c.pop$bucket_item(b, d), void 0 !== g && (f = g.rhs)); if (void 0 !== f) return c.size--, f; if (void 0 !== e) return e; throw new Sk.builtin.KeyError(b); } ); Sk.builtin.dict.prototype.haskey$ = function(a, b) { Sk.builtin.pyCheckArgsLen("has_key()", arguments.length, 1, 1, !1, !0); return new Sk.builtin.bool(a.sq$contains(b)) } ; Sk.builtin.dictview = function(a, b) { this.dict = b; this.type = a; return this } ; Sk.abstr.setUpInheritance("dictview", Sk.builtin.dictview, Sk.builtin.object); Sk.builtin.dictview.prototype.__class__ = Sk.builtin.dictview; Sk.builtin.dictview.prototype.$r = function() { var a = "dict_" + this.type + "([", b, e = !0; var h = Sk.abstr.iter(this.dict); for (b = h.tp$iternext(); void 0 !== b; b = h.tp$iternext()) if (e = !1, "keys" === this.type) a += Sk.misceval.objectRepr(b).v + ", "; else { var g = this.dict.mp$subscript(b); void 0 === g && (g = null); "values" === this.type ? a += Sk.misceval.objectRepr(g).v + ", " : "items" === this.type && (a += "(" + Sk.misceval.objectRepr(b).v + ", " + Sk.misceval.objectRepr(g).v + "), ") } e || (a = a.slice(0, -2)); return new Sk.builtin.str(a + "])") } ; Sk.builtin.dictview.prototype.sq$length = function() { return this.dict.mp$length() } ; Sk.builtin.dictview.prototype.sq$contains = function(a) { var c; if ("keys" === this.type) return this.dict.sq$contains(a); if ("values" === this.type) { var b = Sk.abstr.iter(this.dict); for (c = b.tp$iternext(); void 0 !== c; c = b.tp$iternext()) { var h = this.dict.mp$subscript(c); void 0 === h && (h = null); if (Sk.misceval.isTrue(Sk.misceval.richCompareBool(h, a, "Eq"))) return !0 } return !1 } if ("items" === this.type) return a.mp$subscript && a.sq$length && 2 === a.sq$length() && (c = a.mp$subscript(new Sk.builtin.int_(0)), h = this.dict.mp$lookup(c), void 0 !== h && (b = new Sk.builtin.tuple([c, h]), Sk.misceval.isTrue(Sk.misceval.richCompareBool(b, a, "Eq")))) ? !0 : !1 } ; Sk.builtin.dictview.prototype.tp$iter = function() { var a; "keys" === this.type ? a = Sk.builtin.dict.prototype.py2$keys(this.dict).tp$iter() : "values" === this.type ? a = this.dict.py2$values(this.dict).tp$iter() : "items" === this.type && (a = this.dict.py2$items(this.dict).tp$iter()); a.$r = function() { return new Sk.builtin.str("") } ; return a } ; Sk.builtin.dictview.prototype.__iter__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__iter__", arguments.length, 0, 0, !1, !0); return a.tp$iter() } ); Sk.builtin.dict.prototype.py2$items = function(a) { Sk.builtin.pyCheckArgsLen("items", arguments.length, 0, 0, !1, !0); var c, b = []; var h = Sk.abstr.iter(a); for (c = h.tp$iternext(); void 0 !== c; c = h.tp$iternext()) { var g = a.mp$subscript(c); void 0 === g && (g = null); b.push(new Sk.builtin.tuple([c, g])) } return new Sk.builtin.list(b) } ; Sk.builtin.dict.prototype.py3$items = function(a) { Sk.builtin.pyCheckArgsLen("items", arguments.length, 0, 0, !1, !0); return new Sk.builtin.dictview("items",a) } ; Sk.builtin.dict.prototype.items = new Sk.builtin.func(Sk.builtin.dict.prototype.py2$items); Sk.builtin.dict.prototype.py2$keys = function(a) { Sk.builtin.pyCheckArgsLen("keys", arguments.length, 0, 0, !1, !0); var c, b = []; var h = Sk.abstr.iter(a); for (c = h.tp$iternext(); void 0 !== c; c = h.tp$iternext()) b.push(c); return new Sk.builtin.list(b) } ; Sk.builtin.dict.prototype.py3$keys = function(a) { Sk.builtin.pyCheckArgsLen("keys", arguments.length, 0, 0, !1, !0); return new Sk.builtin.dictview("keys",a) } ; Sk.builtin.dict.prototype.keys = new Sk.builtin.func(Sk.builtin.dict.prototype.py2$keys); Sk.builtin.dict.prototype.py2$values = function(a) { Sk.builtin.pyCheckArgsLen("values", arguments.length, 0, 0, !1, !0); var c, b = []; var h = Sk.abstr.iter(a); for (c = h.tp$iternext(); void 0 !== c; c = h.tp$iternext()) c = a.mp$subscript(c), void 0 === c && (c = null), b.push(c); return new Sk.builtin.list(b) } ; Sk.builtin.dict.prototype.py3$values = function(a) { Sk.builtin.pyCheckArgsLen("values", arguments.length, 0, 0, !1, !0); return new Sk.builtin.dictview("values",a) } ; Sk.builtin.dict.prototype.values = new Sk.builtin.func(Sk.builtin.dict.prototype.py2$values); Sk.builtin.dict.prototype.clear = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("clear()", arguments.length, 0, 0, !1, !0); a.entries = Object.create(null); a.buckets = {}; a.size = 0 } ); Sk.builtin.dict.prototype.setdefault = new Sk.builtin.func(function(a, b, e) { try { return a.mp$subscript(b) } catch (h) { return void 0 === e && (e = Sk.builtin.none.none$), a.mp$ass_subscript(b, e), e } } ); Sk.builtin.dict.prototype.dict_merge = function(a) { var c; if (a instanceof Sk.builtin.dict) { var b = a.tp$iter(); for (c = b.tp$iternext(); void 0 !== c; c = b.tp$iternext()) { var h = a.mp$subscript(c); if (void 0 === h) throw new Sk.builtin.AttributeError("cannot get item for key: " + c.v); this.mp$ass_subscript(c, h) } } else for (b = Sk.misceval.callsimArray(a.keys, [a]), b = Sk.abstr.iter(b), c = b.tp$iternext(); void 0 !== c; c = b.tp$iternext()) { h = a.tp$getitem(c); if (void 0 === h) throw new Sk.builtin.AttributeError("cannot get item for key: " + c.v); this.mp$ass_subscript(c, h) } } ; m = function(a, b, e) { if (void 0 !== e && ("dict" === e.tp$name || e.keys)) b.dict_merge(e); else if (void 0 !== e && Sk.builtin.checkIterable(e)) { var c, d = 0; e = Sk.abstr.iter(e); for (c = e.tp$iternext(); void 0 !== c; c = e.tp$iternext(), d++) { if (!Sk.builtin.checkIterable(c)) throw new Sk.builtin.TypeError("cannot convert dictionary update sequence element #" + d + " to a sequence"); if (2 === c.sq$length()) { var f = Sk.abstr.iter(c); c = f.tp$iternext(); f = f.tp$iternext(); b.mp$ass_subscript(c, f) } else throw new Sk.builtin.ValueError("dictionary update sequence element #" + d + " has length " + c.sq$length() + "; 2 is required"); } } else if (void 0 !== e) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(e) + "' object is not iterable"); a = new Sk.builtin.dict(a); b.dict_merge(a); return Sk.builtin.none.none$ } ; m.co_kwargs = !0; Sk.builtin.dict.prototype.update = new Sk.builtin.func(m); Sk.builtin.dict.prototype.__contains__ = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("__contains__", arguments.length, 2, 2); return new Sk.builtin.bool(a.sq$contains(b)) } ); Sk.builtin.dict.prototype.__cmp__ = new Sk.builtin.func(function(a, b, e) { return Sk.builtin.NotImplemented.NotImplemented$ } ); Sk.builtin.dict.prototype.__delitem__ = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("__delitem__", arguments.length, 1, 1, !1, !0); return Sk.builtin.dict.prototype.mp$del_subscript.call(a, b) } ); Sk.builtin.dict.prototype.__getitem__ = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("__getitem__", arguments.length, 1, 1, !1, !0); return Sk.builtin.dict.prototype.mp$subscript.call(a, b) } ); Sk.builtin.dict.prototype.__setitem__ = new Sk.builtin.func(function(a, b, e) { Sk.builtin.pyCheckArgsLen("__setitem__", arguments.length, 2, 2, !1, !0); return Sk.builtin.dict.prototype.mp$ass_subscript.call(a, b, e) } ); Sk.builtin.dict.prototype.__hash__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__hash__", arguments.length, 0, 0, !1, !0); return Sk.builtin.dict.prototype.tp$hash.call(a) } ); Sk.builtin.dict.prototype.__len__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__len__", arguments.length, 0, 0, !1, !0); return Sk.builtin.dict.prototype.mp$length.call(a) } ); Sk.builtin.dict.prototype.__getattribute__ = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("__getattribute__", arguments.length, 1, 1, !1, !0); if (!Sk.builtin.checkString(b)) throw new Sk.builtin.TypeError("__getattribute__ requires a string"); return Sk.builtin.dict.prototype.tp$getattr.call(a, b) } ); Sk.builtin.dict.prototype.__iter__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__iter__", arguments.length, 0, 0, !1, !0); return new Sk.builtin.dict_iter_(a) } ); Sk.builtin.dict.prototype.tp$iter = function() { return new Sk.builtin.dict_iter_(this) } ; Sk.builtin.dict.prototype.__repr__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__repr__", arguments.length, 0, 0, !1, !0); return Sk.builtin.dict.prototype.$r.call(a) } ); Sk.builtin.dict.prototype.ob$eq = function(a) { var c; if (this === a) return Sk.builtin.bool.true$; if (!(a instanceof Sk.builtin.dict)) return Sk.builtin.NotImplemented.NotImplemented$; if (this.size !== a.size) return Sk.builtin.bool.false$; var b = this.tp$iter(); for (c = b.tp$iternext(); void 0 !== c; c = b.tp$iternext()) { var h = this.mp$lookup(c); c = a.mp$lookup(c); if (void 0 === c || !Sk.misceval.richCompareBool(h, c, "Eq")) return Sk.builtin.bool.false$ } return Sk.builtin.bool.true$ } ; Sk.builtin.dict.prototype.ob$ne = function(a) { a = this.ob$eq(a); return a === Sk.builtin.NotImplemented.NotImplemented$ ? a : a.v ? Sk.builtin.bool.false$ : Sk.builtin.bool.true$ } ; Sk.builtin.dict.prototype.copy = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("copy", arguments.length, 0, 0, !1, !0); var c, b = new Sk.builtin.dict([]); var h = Sk.abstr.iter(a); for (c = h.tp$iternext(); void 0 !== c; c = h.tp$iternext()) { var g = a.mp$subscript(c); void 0 === g && (g = null); b.mp$ass_subscript(c, g) } return b } ); Sk.builtin.dict.$fromkeys = function(a, b, e) { if (a instanceof Sk.builtin.dict) { Sk.builtin.pyCheckArgsLen("fromkeys", arguments.length, 1, 2, !1, !0); var c = a; var d = b; var f = void 0 === e ? Sk.builtin.none.none$ : e } else Sk.builtin.pyCheckArgsLen("fromkeys", arguments.length, 1, 2, !1, !1), c = new Sk.builtin.dict([]), d = a, f = void 0 === b ? Sk.builtin.none.none$ : b; if (!Sk.builtin.checkIterable(d)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(d) + "' object is not iterable"); var k = Sk.abstr.iter(d); for (d = k.tp$iternext(); void 0 !== d; d = k.tp$iternext()) c.mp$ass_subscript(d, f); return c } ; Sk.builtin.dict.prototype.iteritems = new Sk.builtin.func(function(a) { throw new Sk.builtin.NotImplementedError("dict.iteritems is not yet implemented in Skulpt"); } ); Sk.builtin.dict.prototype.iterkeys = new Sk.builtin.func(function(a) { throw new Sk.builtin.NotImplementedError("dict.iterkeys is not yet implemented in Skulpt"); } ); Sk.builtin.dict.prototype.itervalues = new Sk.builtin.func(function(a) { throw new Sk.builtin.NotImplementedError("dict.itervalues is not yet implemented in Skulpt"); } ); Sk.builtin.dict.prototype.popitem = new Sk.builtin.func(function(a) { throw new Sk.builtin.NotImplementedError("dict.popitem is not yet implemented in Skulpt"); } ); Sk.builtin.dict.prototype.viewitems = new Sk.builtin.func(function(a) { throw new Sk.builtin.NotImplementedError("dict.viewitems is not yet implemented in Skulpt"); } ); Sk.builtin.dict.prototype.viewkeys = new Sk.builtin.func(function(a) { throw new Sk.builtin.NotImplementedError("dict.viewkeys is not yet implemented in Skulpt"); } ); Sk.builtin.dict.prototype.viewvalues = new Sk.builtin.func(function(a) { throw new Sk.builtin.NotImplementedError("dict.viewvalues is not yet implemented in Skulpt"); } ); Sk.exportSymbol("Sk.builtin.dict", Sk.builtin.dict); Sk.builtin.create_dict_iter_ = function(a) { const c = { $index: 0 }; c.$obj = a; c.$keys = a.sk$asarray(); c.tp$iter = function() { return c } ; c.tp$iternext = function() { if (!(this.$index >= this.$keys.length)) return this.$keys[this.$index++] } ; return c } ; Sk.builtin.dict_iter_ = function(a) { if (!(this instanceof Sk.builtin.dict_iter_)) return new Sk.builtin.dict_iter_(a); a = Sk.builtin.create_dict_iter_(a); a.$r = function() { return new Sk.builtin.str("") } ; return a } ; Sk.abstr.setUpInheritance("dictionary-keyiterator", Sk.builtin.dict_iter_, Sk.builtin.object); Sk.builtin.dict_iter_.prototype.__class__ = Sk.builtin.dict_iter_; Sk.builtin.dict_iter_.prototype.__iter__ = new Sk.builtin.func(function(a) { return a } ); Sk.builtin.dict_iter_.prototype.next$ = function(a) { a = a.tp$iternext(); if (void 0 === a) throw new Sk.builtin.StopIteration; return a } } , function(m, p) { Sk.builtin.numtype = function() { throw new Sk.builtin.ExternalError("Cannot instantiate abstract Sk.builtin.numtype class"); } ; Sk.abstr.setUpInheritance("NumericType", Sk.builtin.numtype, Sk.builtin.object); Sk.builtin.numtype.sk$abstract = !0; Sk.builtin.numtype.prototype.__abs__ = new Sk.builtin.func(function(a) { if (void 0 === a.nb$abs) throw new Sk.builtin.NotImplementedError("__abs__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__abs__", arguments.length, 0, 0, !1, !0); return a.nb$abs() } ); Sk.builtin.numtype.prototype.__neg__ = new Sk.builtin.func(function(a) { if (void 0 === a.nb$negative) throw new Sk.builtin.NotImplementedError("__neg__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__neg__", arguments.length, 0, 0, !1, !0); return a.nb$negative() } ); Sk.builtin.numtype.prototype.__pos__ = new Sk.builtin.func(function(a) { if (void 0 === a.nb$positive) throw new Sk.builtin.NotImplementedError("__pos__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__pos__", arguments.length, 0, 0, !1, !0); return a.nb$positive() } ); Sk.builtin.numtype.prototype.__int__ = new Sk.builtin.func(function(a) { if (void 0 === a.nb$int_) throw new Sk.builtin.NotImplementedError("__int__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__int__", arguments.length, 0, 0, !1, !0); return a.nb$int_() } ); Sk.builtin.numtype.prototype.__long__ = new Sk.builtin.func(function(a) { if (void 0 === a.nb$lng) throw new Sk.builtin.NotImplementedError("__long__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__long__", arguments.length, 0, 0, !1, !0); return a.nb$lng() } ); Sk.builtin.numtype.prototype.__float__ = new Sk.builtin.func(function(a) { if (void 0 === a.nb$float_) throw new Sk.builtin.NotImplementedError("__float__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__float__", arguments.length, 0, 0, !1, !0); return a.nb$float_() } ); Sk.builtin.numtype.prototype.__add__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$add) throw new Sk.builtin.NotImplementedError("__add__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__add__", arguments.length, 1, 1, !1, !0); return a.nb$add(b) } ); Sk.builtin.numtype.prototype.__radd__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$reflected_add) throw new Sk.builtin.NotImplementedError("__radd__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__radd__", arguments.length, 1, 1, !1, !0); return a.nb$reflected_add(b) } ); Sk.builtin.numtype.prototype.__sub__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$subtract) throw new Sk.builtin.NotImplementedError("__sub__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__sub__", arguments.length, 1, 1, !1, !0); return a.nb$subtract(b) } ); Sk.builtin.numtype.prototype.__rsub__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$reflected_subtract) throw new Sk.builtin.NotImplementedError("__rsub__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__rsub__", arguments.length, 1, 1, !1, !0); return a.nb$reflected_subtract(b) } ); Sk.builtin.numtype.prototype.__mul__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$multiply) throw new Sk.builtin.NotImplementedError("__mul__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__mul__", arguments.length, 1, 1, !1, !0); return a.nb$multiply(b) } ); Sk.builtin.numtype.prototype.__rmul__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$reflected_multiply) throw new Sk.builtin.NotImplementedError("__rmul__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__rmul__", arguments.length, 1, 1, !1, !0); return a.nb$reflected_multiply(b) } ); Sk.builtin.numtype.prototype.__div__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$divide) throw new Sk.builtin.NotImplementedError("__div__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__div__", arguments.length, 1, 1, !1, !0); return a.nb$divide(b) } ); Sk.builtin.numtype.prototype.__rdiv__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$reflected_divide) throw new Sk.builtin.NotImplementedError("__rdiv__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__rdiv__", arguments.length, 1, 1, !1, !0); return a.nb$reflected_divide(b) } ); Sk.builtin.numtype.prototype.__floordiv__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$floor_divide) throw new Sk.builtin.NotImplementedError("__floordiv__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__floordiv__", arguments.length, 1, 1, !1, !0); return a.nb$floor_divide(b) } ); Sk.builtin.numtype.prototype.__rfloordiv__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$reflected_floor_divide) throw new Sk.builtin.NotImplementedError("__rfloordiv__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__rfloordiv__", arguments.length, 1, 1, !1, !0); return a.nb$reflected_floor_divide(b) } ); Sk.builtin.numtype.prototype.__mod__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$remainder) throw new Sk.builtin.NotImplementedError("__mod__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__mod__", arguments.length, 1, 1, !1, !0); return a.nb$remainder(b) } ); Sk.builtin.numtype.prototype.__rmod__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$reflected_remainder) throw new Sk.builtin.NotImplementedError("__rmod__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__rmod__", arguments.length, 1, 1, !1, !0); return a.nb$reflected_remainder(b) } ); Sk.builtin.numtype.prototype.__divmod__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$divmod) throw new Sk.builtin.NotImplementedError("__divmod__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__divmod__", arguments.length, 1, 1, !1, !0); return a.nb$divmod(b) } ); Sk.builtin.numtype.prototype.__rdivmod__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$reflected_divmod) throw new Sk.builtin.NotImplementedError("__rdivmod__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__rdivmod__", arguments.length, 1, 1, !1, !0); return a.nb$reflected_divmod(b) } ); Sk.builtin.numtype.prototype.__pow__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$power) throw new Sk.builtin.NotImplementedError("__pow__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__pow__", arguments.length, 1, 1, !1, !0); return a.nb$power(b) } ); Sk.builtin.numtype.prototype.__rpow__ = new Sk.builtin.func(function(a, b) { if (void 0 === a.nb$reflected_power) throw new Sk.builtin.NotImplementedError("__rpow__ is not yet implemented"); Sk.builtin.pyCheckArgsLen("__rpow__", arguments.length, 1, 1, !1, !0); return a.nb$reflected_power(b) } ); Sk.builtin.numtype.prototype.__coerce__ = new Sk.builtin.func(function(a, b) { throw new Sk.builtin.NotImplementedError("__coerce__ is not yet implemented"); } ); Sk.builtin.numtype.prototype.nb$add = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$reflected_add = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$inplace_add = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$subtract = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$reflected_subtract = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$inplace_subtract = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$multiply = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$reflected_multiply = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$inplace_multiply = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$divide = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$reflected_divide = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$inplace_divide = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$floor_divide = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$reflected_floor_divide = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$inplace_floor_divide = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$remainder = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$reflected_remainder = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$inplace_remainder = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$divmod = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$reflected_divmod = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$power = function(a, b) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$reflected_power = function(a, b) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$inplace_power = function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$abs = function() { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$negative = function() { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$positive = function() { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$nonzero = function() { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$isnegative = function() { return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.numtype.prototype.nb$ispositive = function() { return Sk.builtin.NotImplemented.NotImplemented$ } } , function(m, p) { Sk.builtin.biginteger = function(a, b, c) { null != a && ("number" == typeof a ? this.fromNumber(a, b, c) : null == b && "string" != typeof a ? this.fromString(a, 256) : this.fromString(a, b)) } ; Sk.builtin.biginteger.canary = 0xdeadbeefcafe; Sk.builtin.biginteger.j_lm = 15715070 == (Sk.builtin.biginteger.canary & 16777215); Sk.builtin.biginteger.nbi = function() { return new Sk.builtin.biginteger(null) } ; Sk.builtin.biginteger.prototype.am1 = function(a, b, c, d, e, h) { for (var g; 0 <= --h; ) g = b * this[a++] + c[d] + e, e = Math.floor(g / 67108864), c[d++] = g & 67108863; return e } ; Sk.builtin.biginteger.prototype.am2 = function(a, b, c, d, e, h) { for (var g, f, k = b & 32767, n = b >> 15; 0 <= --h; ) f = this[a] & 32767, g = this[a++] >> 15, b = n * f + g * k, f = k * f + ((b & 32767) << 15) + c[d] + (e & 1073741823), e = (f >>> 30) + (b >>> 15) + n * g + (e >>> 30), c[d++] = f & 1073741823; return e } ; Sk.builtin.biginteger.prototype.am3 = function(a, b, c, d, e, h) { for (var g, f, k = b & 16383, n = b >> 14; 0 <= --h; ) f = this[a] & 16383, g = this[a++] >> 14, b = n * f + g * k, f = k * f + ((b & 16383) << 14) + c[d] + e, e = (f >> 28) + (b >> 14) + n * g, c[d++] = f & 268435455; return e } ; Sk.builtin.biginteger.prototype.am = Sk.builtin.biginteger.prototype.am3; Sk.builtin.biginteger.dbits = 28; Sk.builtin.biginteger.prototype.DB = Sk.builtin.biginteger.dbits; Sk.builtin.biginteger.prototype.DM = (1 << Sk.builtin.biginteger.dbits) - 1; Sk.builtin.biginteger.prototype.DV = 1 << Sk.builtin.biginteger.dbits; Sk.builtin.biginteger.BI_FP = 52; Sk.builtin.biginteger.prototype.FV = Math.pow(2, Sk.builtin.biginteger.BI_FP); Sk.builtin.biginteger.prototype.F1 = Sk.builtin.biginteger.BI_FP - Sk.builtin.biginteger.dbits; Sk.builtin.biginteger.prototype.F2 = 2 * Sk.builtin.biginteger.dbits - Sk.builtin.biginteger.BI_FP; Sk.builtin.biginteger.BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz"; Sk.builtin.biginteger.BI_RC = []; m = 48; for (p = 0; 9 >= p; ++p) Sk.builtin.biginteger.BI_RC[m++] = p; m = 97; for (p = 10; 36 > p; ++p) Sk.builtin.biginteger.BI_RC[m++] = p; m = 65; for (p = 10; 36 > p; ++p) Sk.builtin.biginteger.BI_RC[m++] = p; Sk.builtin.biginteger.int2char = function(a) { return Sk.builtin.biginteger.BI_RM.charAt(a) } ; Sk.builtin.biginteger.intAt = function(a, b) { a = Sk.builtin.biginteger.BI_RC[a.charCodeAt(b)]; return null == a ? -1 : a } ; Sk.builtin.biginteger.prototype.bnpCopyTo = function(a) { var b; for (b = this.t - 1; 0 <= b; --b) a[b] = this[b]; a.t = this.t; a.s = this.s } ; Sk.builtin.biginteger.prototype.bnpFromInt = function(a) { this.t = 1; this.s = 0 > a ? -1 : 0; 0 < a ? this[0] = a : -1 > a ? this[0] = a + this.DV : this.t = 0 } ; Sk.builtin.biginteger.nbv = function(a) { var b = new Sk.builtin.biginteger(null); b.bnpFromInt(a); return b } ; Sk.builtin.biginteger.prototype.bnpFromString = function(a, b) { var c; if (16 == b) var d = 4; else if (8 == b) d = 3; else if (256 == b) d = 8; else if (2 == b) d = 1; else if (32 == b) d = 5; else if (4 == b) d = 2; else { this.fromRadix(a, b); return } this.s = this.t = 0; var e = a.length; var h = !1; for (c = 0; 0 <= --e; ) b = 8 == d ? a[e] & 255 : Sk.builtin.biginteger.intAt(a, e), 0 > b ? "-" == a.charAt(e) && (h = !0) : (h = !1, 0 === c ? this[this.t++] = b : c + d > this.DB ? (this[this.t - 1] |= (b & (1 << this.DB - c) - 1) << c, this[this.t++] = b >> this.DB - c) : this[this.t - 1] |= b << c, c += d, c >= this.DB && (c -= this.DB)); 8 == d && 0 !== (a[0] & 128) && (this.s = -1, 0 < c && (this[this.t - 1] |= (1 << this.DB - c) - 1 << c)); this.clamp(); h && Sk.builtin.biginteger.ZERO.subTo(this, this) } ; Sk.builtin.biginteger.prototype.bnpClamp = function() { for (var a = this.s & this.DM; 0 < this.t && this[this.t - 1] == a; ) --this.t } ; Sk.builtin.biginteger.prototype.bnToString = function(a) { var b; if (0 > this.s) return "-" + this.negate().toString(a); if (16 == a) var c = 4; else if (8 == a) c = 3; else if (2 == a) c = 1; else if (32 == a) c = 5; else if (4 == a) c = 2; else return this.toRadix(a); var d = (1 << c) - 1; var e = !1; var h = ""; var g = this.t; a = this.DB - g * this.DB % c; if (0 < g--) for (a < this.DB && 0 < (b = this[g] >> a) && (e = !0, h = Sk.builtin.biginteger.int2char(b)); 0 <= g; ) a < c ? (b = (this[g] & (1 << a) - 1) << c - a, b |= this[--g] >> (a += this.DB - c)) : (b = this[g] >> (a -= c) & d, 0 >= a && (a += this.DB, --g)), 0 < b && (e = !0), e && (h += Sk.builtin.biginteger.int2char(b)); return e ? h : "0" } ; Sk.builtin.biginteger.prototype.bnNegate = function() { var a = Sk.builtin.biginteger.nbi(); Sk.builtin.biginteger.ZERO.subTo(this, a); return a } ; Sk.builtin.biginteger.prototype.bnAbs = function() { return 0 > this.s ? this.negate() : this } ; Sk.builtin.biginteger.prototype.bnCompareTo = function(a) { var b = this.s - a.s; if (0 !== b) return b; var c = this.t; b = c - a.t; if (0 !== b) return 0 > this.s ? -b : b; for (; 0 <= --c; ) if (0 !== (b = this[c] - a[c])) return b; return 0 } ; Sk.builtin.biginteger.nbits = function(a) { var b = 1, c; 0 !== (c = a >>> 16) && (a = c, b += 16); 0 !== (c = a >> 8) && (a = c, b += 8); 0 !== (c = a >> 4) && (a = c, b += 4); 0 !== (c = a >> 2) && (a = c, b += 2); 0 !== a >> 1 && (b += 1); return b } ; Sk.builtin.biginteger.prototype.bnBitLength = function() { return 0 >= this.t ? 0 : this.DB * (this.t - 1) + Sk.builtin.biginteger.nbits(this[this.t - 1] ^ this.s & this.DM) } ; Sk.builtin.biginteger.prototype.bnpDLShiftTo = function(a, b) { var c; for (c = this.t - 1; 0 <= c; --c) b[c + a] = this[c]; for (c = a - 1; 0 <= c; --c) b[c] = 0; b.t = this.t + a; b.s = this.s } ; Sk.builtin.biginteger.prototype.bnpDRShiftTo = function(a, b) { var c; for (c = a; c < this.t; ++c) b[c - a] = this[c]; b.t = Math.max(this.t - a, 0); b.s = this.s } ; Sk.builtin.biginteger.prototype.bnpLShiftTo = function(a, b) { var c = a % this.DB , d = this.DB - c , e = (1 << d) - 1; a = Math.floor(a / this.DB); var h = this.s << c & this.DM, g; for (g = this.t - 1; 0 <= g; --g) b[g + a + 1] = this[g] >> d | h, h = (this[g] & e) << c; for (g = a - 1; 0 <= g; --g) b[g] = 0; b[a] = h; b.t = this.t + a + 1; b.s = this.s; b.clamp() } ; Sk.builtin.biginteger.prototype.bnpRShiftTo = function(a, b) { b.s = this.s; var c = Math.floor(a / this.DB); if (c >= this.t) b.t = 0; else { var d = a % this.DB; var e = this.DB - d; var h = (1 << d) - 1; b[0] = this[c] >> d; for (a = c + 1; a < this.t; ++a) b[a - c - 1] |= (this[a] & h) << e, b[a - c] = this[a] >> d; 0 < d && (b[this.t - c - 1] |= (this.s & h) << e); b.t = this.t - c; b.clamp() } } ; Sk.builtin.biginteger.prototype.bnpSubTo = function(a, b) { for (var c = 0, d = 0, e = Math.min(a.t, this.t); c < e; ) d += this[c] - a[c], b[c++] = d & this.DM, d >>= this.DB; if (a.t < this.t) { for (d -= a.s; c < this.t; ) d += this[c], b[c++] = d & this.DM, d >>= this.DB; d += this.s } else { for (d += this.s; c < a.t; ) d -= a[c], b[c++] = d & this.DM, d >>= this.DB; d -= a.s } b.s = 0 > d ? -1 : 0; -1 > d ? b[c++] = this.DV + d : 0 < d && (b[c++] = d); b.t = c; b.clamp() } ; Sk.builtin.biginteger.prototype.bnpMultiplyTo = function(a, b) { var c = this.abs() , d = a.abs() , e = c.t; for (b.t = e + d.t; 0 <= --e; ) b[e] = 0; for (e = 0; e < d.t; ++e) b[e + c.t] = c.am(0, d[e], b, e, 0, c.t); b.s = 0; b.clamp(); this.s != a.s && Sk.builtin.biginteger.ZERO.subTo(b, b) } ; Sk.builtin.biginteger.prototype.bnpSquareTo = function(a) { for (var b, c = this.abs(), d = a.t = 2 * c.t; 0 <= --d; ) a[d] = 0; for (d = 0; d < c.t - 1; ++d) b = c.am(d, c[d], a, 2 * d, 0, 1), (a[d + c.t] += c.am(d + 1, 2 * c[d], a, 2 * d + 1, b, c.t - d - 1)) >= c.DV && (a[d + c.t] -= c.DV, a[d + c.t + 1] = 1); 0 < a.t && (a[a.t - 1] += c.am(d, c[d], a, 2 * d, 0, 1)); a.s = 0; a.clamp() } ; Sk.builtin.biginteger.prototype.bnpDivRemTo = function(a, b, c) { var d = a.abs(); if (!(0 >= d.t)) { var e = this.abs(); if (e.t < d.t) null != b && b.fromInt(0), null != c && this.copyTo(c); else { null == c && (c = Sk.builtin.biginteger.nbi()); var h = Sk.builtin.biginteger.nbi(); var g = this.s; var f = a.s; a = this.DB - Sk.builtin.biginteger.nbits(d[d.t - 1]); 0 < a ? (d.lShiftTo(a, h), e.lShiftTo(a, c)) : (d.copyTo(h), e.copyTo(c)); var k = h.t; d = h[k - 1]; if (0 !== d) { var n = d * (1 << this.F1) + (1 < k ? h[k - 2] >> this.F2 : 0); e = this.FV / n; var l = (1 << this.F1) / n; var q = 1 << this.F2; var m = c.t; var p = m - k; var y = null == b ? Sk.builtin.biginteger.nbi() : b; h.dlShiftTo(p, y); 0 <= c.compareTo(y) && (c[c.t++] = 1, c.subTo(y, c)); Sk.builtin.biginteger.ONE.dlShiftTo(k, y); for (y.subTo(h, h); h.t < k; ) h[h.t++] = 0; for (; 0 <= --p; ) if (n = c[--m] == d ? this.DM : Math.floor(c[m] * e + (c[m - 1] + q) * l), (c[m] += h.am(0, n, c, p, 0, k)) < n) for (h.dlShiftTo(p, y), c.subTo(y, c); c[m] < --n; ) c.subTo(y, c); null != b && (c.drShiftTo(k, b), g != f && Sk.builtin.biginteger.ZERO.subTo(b, b)); c.t = k; c.clamp(); 0 < a && c.rShiftTo(a, c); 0 > g && Sk.builtin.biginteger.ZERO.subTo(c, c) } } } } ; Sk.builtin.biginteger.prototype.bnMod = function(a) { var b = Sk.builtin.biginteger.nbi(); this.abs().divRemTo(a, null, b); 0 > this.s && 0 < b.compareTo(Sk.builtin.biginteger.ZERO) && a.subTo(b, b); return b } ; Sk.builtin.biginteger.Classic = function(a) { this.m = a } ; Sk.builtin.biginteger.prototype.cConvert = function(a) { return 0 > a.s || 0 <= a.compareTo(this.m) ? a.mod(this.m) : a } ; Sk.builtin.biginteger.prototype.cRevert = function(a) { return a } ; Sk.builtin.biginteger.prototype.cReduce = function(a) { a.divRemTo(this.m, null, a) } ; Sk.builtin.biginteger.prototype.cMulTo = function(a, b, c) { a.multiplyTo(b, c); this.reduce(c) } ; Sk.builtin.biginteger.prototype.cSqrTo = function(a, b) { a.squareTo(b); this.reduce(b) } ; Sk.builtin.biginteger.Classic.prototype.convert = Sk.builtin.biginteger.prototype.cConvert; Sk.builtin.biginteger.Classic.prototype.revert = Sk.builtin.biginteger.prototype.cRevert; Sk.builtin.biginteger.Classic.prototype.reduce = Sk.builtin.biginteger.prototype.cReduce; Sk.builtin.biginteger.Classic.prototype.mulTo = Sk.builtin.biginteger.prototype.cMulTo; Sk.builtin.biginteger.Classic.prototype.sqrTo = Sk.builtin.biginteger.prototype.cSqrTo; Sk.builtin.biginteger.prototype.bnpInvDigit = function() { if (1 > this.t) return 0; var a = this[0]; if (0 === (a & 1)) return 0; var b = a & 3; b = b * (2 - (a & 15) * b) & 15; b = b * (2 - (a & 255) * b) & 255; b = b * (2 - ((a & 65535) * b & 65535)) & 65535; b = b * (2 - a * b % this.DV) % this.DV; return 0 < b ? this.DV - b : -b } ; Sk.builtin.biginteger.Montgomery = function(a) { this.m = a; this.mp = a.invDigit(); this.mpl = this.mp & 32767; this.mph = this.mp >> 15; this.um = (1 << a.DB - 15) - 1; this.mt2 = 2 * a.t } ; Sk.builtin.biginteger.prototype.montConvert = function(a) { var b = Sk.builtin.biginteger.nbi(); a.abs().dlShiftTo(this.m.t, b); b.divRemTo(this.m, null, b); 0 > a.s && 0 < b.compareTo(Sk.builtin.biginteger.ZERO) && this.m.subTo(b, b); return b } ; Sk.builtin.biginteger.prototype.montRevert = function(a) { var b = Sk.builtin.biginteger.nbi(); a.copyTo(b); this.reduce(b); return b } ; Sk.builtin.biginteger.prototype.montReduce = function(a) { for (var b, c, d; a.t <= this.mt2; ) a[a.t++] = 0; for (d = 0; d < this.m.t; ++d) for (c = a[d] & 32767, b = c * this.mpl + ((c * this.mph + (a[d] >> 15) * this.mpl & this.um) << 15) & a.DM, c = d + this.m.t, a[c] += this.m.am(0, b, a, d, 0, this.m.t); a[c] >= a.DV; ) a[c] -= a.DV, a[++c]++; a.clamp(); a.drShiftTo(this.m.t, a); 0 <= a.compareTo(this.m) && a.subTo(this.m, a) } ; Sk.builtin.biginteger.prototype.montSqrTo = function(a, b) { a.squareTo(b); this.reduce(b) } ; Sk.builtin.biginteger.prototype.montMulTo = function(a, b, c) { a.multiplyTo(b, c); this.reduce(c) } ; Sk.builtin.biginteger.Montgomery.prototype.convert = Sk.builtin.biginteger.prototype.montConvert; Sk.builtin.biginteger.Montgomery.prototype.revert = Sk.builtin.biginteger.prototype.montRevert; Sk.builtin.biginteger.Montgomery.prototype.reduce = Sk.builtin.biginteger.prototype.montReduce; Sk.builtin.biginteger.Montgomery.prototype.mulTo = Sk.builtin.biginteger.prototype.montMulTo; Sk.builtin.biginteger.Montgomery.prototype.sqrTo = Sk.builtin.biginteger.prototype.montSqrTo; Sk.builtin.biginteger.prototype.bnpIsEven = function() { return 0 === (0 < this.t ? this[0] & 1 : this.s) } ; Sk.builtin.biginteger.prototype.bnpExp = function(a, b) { if (4294967295 < a || 1 > a) return Sk.builtin.biginteger.ONE; var c = Sk.builtin.biginteger.nbi(); var d = Sk.builtin.biginteger.nbi(); var e = b.convert(this); var h = Sk.builtin.biginteger.nbits(a) - 1; for (e.copyTo(c); 0 <= --h; ) if (b.sqrTo(c, d), 0 < (a & 1 << h)) b.mulTo(d, e, c); else { var g = c; c = d; d = g } return b.revert(c) } ; Sk.builtin.biginteger.prototype.bnModPowInt = function(a, b) { b = 256 > a || b.isEven() ? new Sk.builtin.biginteger.Classic(b) : new Sk.builtin.biginteger.Montgomery(b); return this.exp(a, b) } ; Sk.builtin.biginteger.prototype.copyTo = Sk.builtin.biginteger.prototype.bnpCopyTo; Sk.builtin.biginteger.prototype.fromInt = Sk.builtin.biginteger.prototype.bnpFromInt; Sk.builtin.biginteger.prototype.fromString = Sk.builtin.biginteger.prototype.bnpFromString; Sk.builtin.biginteger.prototype.clamp = Sk.builtin.biginteger.prototype.bnpClamp; Sk.builtin.biginteger.prototype.dlShiftTo = Sk.builtin.biginteger.prototype.bnpDLShiftTo; Sk.builtin.biginteger.prototype.drShiftTo = Sk.builtin.biginteger.prototype.bnpDRShiftTo; Sk.builtin.biginteger.prototype.lShiftTo = Sk.builtin.biginteger.prototype.bnpLShiftTo; Sk.builtin.biginteger.prototype.rShiftTo = Sk.builtin.biginteger.prototype.bnpRShiftTo; Sk.builtin.biginteger.prototype.subTo = Sk.builtin.biginteger.prototype.bnpSubTo; Sk.builtin.biginteger.prototype.multiplyTo = Sk.builtin.biginteger.prototype.bnpMultiplyTo; Sk.builtin.biginteger.prototype.squareTo = Sk.builtin.biginteger.prototype.bnpSquareTo; Sk.builtin.biginteger.prototype.divRemTo = Sk.builtin.biginteger.prototype.bnpDivRemTo; Sk.builtin.biginteger.prototype.invDigit = Sk.builtin.biginteger.prototype.bnpInvDigit; Sk.builtin.biginteger.prototype.isEven = Sk.builtin.biginteger.prototype.bnpIsEven; Sk.builtin.biginteger.prototype.exp = Sk.builtin.biginteger.prototype.bnpExp; Sk.builtin.biginteger.prototype.toString = Sk.builtin.biginteger.prototype.bnToString; Sk.builtin.biginteger.prototype.negate = Sk.builtin.biginteger.prototype.bnNegate; Sk.builtin.biginteger.prototype.abs = Sk.builtin.biginteger.prototype.bnAbs; Sk.builtin.biginteger.prototype.compareTo = Sk.builtin.biginteger.prototype.bnCompareTo; Sk.builtin.biginteger.prototype.bitLength = Sk.builtin.biginteger.prototype.bnBitLength; Sk.builtin.biginteger.prototype.mod = Sk.builtin.biginteger.prototype.bnMod; Sk.builtin.biginteger.prototype.modPowInt = Sk.builtin.biginteger.prototype.bnModPowInt; Sk.builtin.biginteger.ZERO = Sk.builtin.biginteger.nbv(0); Sk.builtin.biginteger.ONE = Sk.builtin.biginteger.nbv(1); Sk.builtin.biginteger.prototype.bnClone = function() { var a = Sk.builtin.biginteger.nbi(); this.copyTo(a); return a } ; Sk.builtin.biginteger.prototype.bnIntValue = function() { if (0 > this.s) { if (1 == this.t) return this[0] - this.DV; if (0 === this.t) return -1 } else { if (1 == this.t) return this[0]; if (0 === this.t) return 0 } return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0] } ; Sk.builtin.biginteger.prototype.bnByteValue = function() { return 0 === this.t ? this.s : this[0] << 24 >> 24 } ; Sk.builtin.biginteger.prototype.bnShortValue = function() { return 0 === this.t ? this.s : this[0] << 16 >> 16 } ; Sk.builtin.biginteger.prototype.bnpChunkSize = function(a) { return Math.floor(Math.LN2 * this.DB / Math.log(a)) } ; Sk.builtin.biginteger.prototype.bnSigNum = function() { return 0 > this.s ? -1 : 0 >= this.t || 1 == this.t && 0 >= this[0] ? 0 : 1 } ; Sk.builtin.biginteger.prototype.bnpToRadix = function(a) { null == a && (a = 10); if (0 === this.signum() || 2 > a || 36 < a) return "0"; var b = this.chunkSize(a); var c = Math.pow(a, b); b = Sk.builtin.biginteger.nbv(c); var d = Sk.builtin.biginteger.nbi(); var e = Sk.builtin.biginteger.nbi(); var h = ""; for (this.divRemTo(b, d, e); 0 < d.signum(); ) h = (c + e.intValue()).toString(a).substr(1) + h, d.divRemTo(b, d, e); return e.intValue().toString(a) + h } ; Sk.builtin.biginteger.prototype.bnpFromRadix = function(a, b) { var c, d, e; this.fromInt(0); null == b && (b = 10); var h = this.chunkSize(b); var g = Math.pow(b, h); var f = !1; for (c = e = d = 0; c < a.length; ++c) { var k = Sk.builtin.biginteger.intAt(a, c); if (0 > k) { if ("-" == a.charAt(c) && 0 === this.signum() && (f = !0), "." == a.charAt(c)) break } else e = b * e + k, ++d >= h && (this.dMultiply(g), this.dAddOffset(e, 0), e = d = 0) } 0 < d && (this.dMultiply(Math.pow(b, d)), this.dAddOffset(e, 0)); f && Sk.builtin.biginteger.ZERO.subTo(this, this) } ; Sk.builtin.biginteger.prototype.bnpFromNumber = function(a, b, c) { if ("number" == typeof b) if (2 > a) this.fromInt(1); else for (this.fromNumber(a, c), this.testBit(a - 1) || this.bitwiseTo(Sk.builtin.biginteger.ONE.shiftLeft(a - 1), Sk.builtin.biginteger.op_or, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(b); ) this.dAddOffset(2, 0), this.bitLength() > a && this.subTo(Sk.builtin.biginteger.ONE.shiftLeft(a - 1), this); this.fromString(a + "") } ; Sk.builtin.biginteger.prototype.bnToByteArray = function() { var a, b = this.t, c = []; c[0] = this.s; var d = this.DB - b * this.DB % 8; var e = 0; if (0 < b--) for (d < this.DB && (a = this[b] >> d) != (this.s & this.DM) >> d && (c[e++] = a | this.s << this.DB - d); 0 <= b; ) if (8 > d ? (a = (this[b] & (1 << d) - 1) << 8 - d, a |= this[--b] >> (d += this.DB - 8)) : (a = this[b] >> (d -= 8) & 255, 0 >= d && (d += this.DB, --b)), 0 !== (a & 128) && (a |= -256), 0 === e && (this.s & 128) != (a & 128) && ++e, 0 < e || a != this.s) c[e++] = a; return c } ; Sk.builtin.biginteger.prototype.bnEquals = function(a) { return 0 === this.compareTo(a) } ; Sk.builtin.biginteger.prototype.bnMin = function(a) { return 0 > this.compareTo(a) ? this : a } ; Sk.builtin.biginteger.prototype.bnMax = function(a) { return 0 < this.compareTo(a) ? this : a } ; Sk.builtin.biginteger.prototype.bnpBitwiseTo = function(a, b, c) { var d, e = Math.min(a.t, this.t); for (d = 0; d < e; ++d) c[d] = b(this[d], a[d]); if (a.t < this.t) { var h = a.s & this.DM; for (d = e; d < this.t; ++d) c[d] = b(this[d], h); c.t = this.t } else { h = this.s & this.DM; for (d = e; d < a.t; ++d) c[d] = b(h, a[d]); c.t = a.t } c.s = b(this.s, a.s); c.clamp() } ; Sk.builtin.biginteger.op_and = function(a, b) { return a & b } ; Sk.builtin.biginteger.prototype.bnAnd = function(a) { var b = Sk.builtin.biginteger.nbi(); this.bitwiseTo(a, Sk.builtin.biginteger.op_and, b); return b } ; Sk.builtin.biginteger.op_or = function(a, b) { return a | b } ; Sk.builtin.biginteger.prototype.bnOr = function(a) { var b = Sk.builtin.biginteger.nbi(); this.bitwiseTo(a, Sk.builtin.biginteger.op_or, b); return b } ; Sk.builtin.biginteger.op_xor = function(a, b) { return a ^ b } ; Sk.builtin.biginteger.prototype.bnXor = function(a) { var b = Sk.builtin.biginteger.nbi(); this.bitwiseTo(a, Sk.builtin.biginteger.op_xor, b); return b } ; Sk.builtin.biginteger.op_andnot = function(a, b) { return a & ~b } ; Sk.builtin.biginteger.prototype.bnAndNot = function(a) { var b = Sk.builtin.biginteger.nbi(); this.bitwiseTo(a, Sk.builtin.biginteger.op_andnot, b); return b } ; Sk.builtin.biginteger.prototype.bnNot = function() { var a, b = Sk.builtin.biginteger.nbi(); for (a = 0; a < this.t; ++a) b[a] = this.DM & ~this[a]; b.t = this.t; b.s = ~this.s; return b } ; Sk.builtin.biginteger.prototype.bnShiftLeft = function(a) { var b = Sk.builtin.biginteger.nbi(); 0 > a ? this.rShiftTo(-a, b) : this.lShiftTo(a, b); return b } ; Sk.builtin.biginteger.prototype.bnShiftRight = function(a) { var b = Sk.builtin.biginteger.nbi(); 0 > a ? this.lShiftTo(-a, b) : this.rShiftTo(a, b); return b } ; Sk.builtin.biginteger.lbit = function(a) { if (0 === a) return -1; var b = 0; 0 === (a & 65535) && (a >>= 16, b += 16); 0 === (a & 255) && (a >>= 8, b += 8); 0 === (a & 15) && (a >>= 4, b += 4); 0 === (a & 3) && (a >>= 2, b += 2); 0 === (a & 1) && ++b; return b } ; Sk.builtin.biginteger.prototype.bnGetLowestSetBit = function() { var a; for (a = 0; a < this.t; ++a) if (0 !== this[a]) return a * this.DB + Sk.builtin.biginteger.lbit(this[a]); return 0 > this.s ? this.t * this.DB : -1 } ; Sk.builtin.biginteger.cbit = function(a) { for (var b = 0; 0 !== a; ) a &= a - 1, ++b; return b } ; Sk.builtin.biginteger.prototype.bnBitCount = function() { var a, b = 0, c = this.s & this.DM; for (a = 0; a < this.t; ++a) b += Sk.builtin.biginteger.cbit(this[a] ^ c); return b } ; Sk.builtin.biginteger.prototype.bnTestBit = function(a) { var b = Math.floor(a / this.DB); return b >= this.t ? 0 !== this.s : 0 !== (this[b] & 1 << a % this.DB) } ; Sk.builtin.biginteger.prototype.bnpChangeBit = function(a, b) { a = Sk.builtin.biginteger.ONE.shiftLeft(a); this.bitwiseTo(a, b, a); return a } ; Sk.builtin.biginteger.prototype.bnSetBit = function(a) { return this.changeBit(a, Sk.builtin.biginteger.op_or) } ; Sk.builtin.biginteger.prototype.bnClearBit = function(a) { return this.changeBit(a, Sk.builtin.biginteger.op_andnot) } ; Sk.builtin.biginteger.prototype.bnFlipBit = function(a) { return this.changeBit(a, Sk.builtin.biginteger.op_xor) } ; Sk.builtin.biginteger.prototype.bnpAddTo = function(a, b) { for (var c = 0, d = 0, e = Math.min(a.t, this.t); c < e; ) d += this[c] + a[c], b[c++] = d & this.DM, d >>= this.DB; if (a.t < this.t) { for (d += a.s; c < this.t; ) d += this[c], b[c++] = d & this.DM, d >>= this.DB; d += this.s } else { for (d += this.s; c < a.t; ) d += a[c], b[c++] = d & this.DM, d >>= this.DB; d += a.s } b.s = 0 > d ? -1 : 0; 0 < d ? b[c++] = d : -1 > d && (b[c++] = this.DV + d); b.t = c; b.clamp() } ; Sk.builtin.biginteger.prototype.bnAdd = function(a) { var b = Sk.builtin.biginteger.nbi(); this.addTo(a, b); return b } ; Sk.builtin.biginteger.prototype.bnSubtract = function(a) { var b = Sk.builtin.biginteger.nbi(); this.subTo(a, b); return b } ; Sk.builtin.biginteger.prototype.bnMultiply = function(a) { var b = Sk.builtin.biginteger.nbi(); this.multiplyTo(a, b); return b } ; Sk.builtin.biginteger.prototype.bnDivide = function(a) { var b = Sk.builtin.biginteger.nbi(); this.divRemTo(a, b, null); return b } ; Sk.builtin.biginteger.prototype.bnRemainder = function(a) { var b = Sk.builtin.biginteger.nbi(); this.divRemTo(a, null, b); return b } ; Sk.builtin.biginteger.prototype.bnDivideAndRemainder = function(a) { var b = Sk.builtin.biginteger.nbi() , c = Sk.builtin.biginteger.nbi(); this.divRemTo(a, b, c); return [b, c] } ; Sk.builtin.biginteger.prototype.bnpDMultiply = function(a) { this[this.t] = this.am(0, a - 1, this, 0, 0, this.t); ++this.t; this.clamp() } ; Sk.builtin.biginteger.prototype.bnpDAddOffset = function(a, b) { if (0 !== a) { for (; this.t <= b; ) this[this.t++] = 0; for (this[b] += a; this[b] >= this.DV; ) this[b] -= this.DV, ++b >= this.t && (this[this.t++] = 0), ++this[b] } } ; Sk.builtin.biginteger.NullExp = function() {} ; Sk.builtin.biginteger.prototype.nNop = function(a) { return a } ; Sk.builtin.biginteger.prototype.nMulTo = function(a, b, c) { a.multiplyTo(b, c) } ; Sk.builtin.biginteger.prototype.nSqrTo = function(a, b) { a.squareTo(b) } ; Sk.builtin.biginteger.NullExp.prototype.convert = Sk.builtin.biginteger.prototype.nNop; Sk.builtin.biginteger.NullExp.prototype.revert = Sk.builtin.biginteger.prototype.nNop; Sk.builtin.biginteger.NullExp.prototype.mulTo = Sk.builtin.biginteger.prototype.nMulTo; Sk.builtin.biginteger.NullExp.prototype.sqrTo = Sk.builtin.biginteger.prototype.nSqrTo; Sk.builtin.biginteger.prototype.bnPow = function(a) { return this.exp(a, new Sk.builtin.biginteger.NullExp) } ; Sk.builtin.biginteger.prototype.bnpMultiplyLowerTo = function(a, b, c) { var d, e = Math.min(this.t + a.t, b); c.s = 0; for (c.t = e; 0 < e; ) c[--e] = 0; for (d = c.t - this.t; e < d; ++e) c[e + this.t] = this.am(0, a[e], c, e, 0, this.t); for (d = Math.min(a.t, b); e < d; ++e) this.am(0, a[e], c, e, 0, b - e); c.clamp() } ; Sk.builtin.biginteger.prototype.bnpMultiplyUpperTo = function(a, b, c) { --b; var d = c.t = this.t + a.t - b; for (c.s = 0; 0 <= --d; ) c[d] = 0; for (d = Math.max(b - this.t, 0); d < a.t; ++d) c[this.t + d - b] = this.am(b - d, a[d], c, 0, 0, this.t + d - b); c.clamp(); c.drShiftTo(1, c) } ; Sk.builtin.biginteger.Barrett = function(a) { this.r2 = Sk.builtin.biginteger.nbi(); this.q3 = Sk.builtin.biginteger.nbi(); Sk.builtin.biginteger.ONE.dlShiftTo(2 * a.t, this.r2); this.mu = this.r2.divide(a); this.m = a } ; Sk.builtin.biginteger.prototype.barrettConvert = function(a) { if (0 > a.s || a.t > 2 * this.m.t) return a.mod(this.m); if (0 > a.compareTo(this.m)) return a; var b = Sk.builtin.biginteger.nbi(); a.copyTo(b); this.reduce(b); return b } ; Sk.builtin.biginteger.prototype.barrettRevert = function(a) { return a } ; Sk.builtin.biginteger.prototype.barrettReduce = function(a) { a.drShiftTo(this.m.t - 1, this.r2); a.t > this.m.t + 1 && (a.t = this.m.t + 1, a.clamp()); this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3); for (this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); 0 > a.compareTo(this.r2); ) a.dAddOffset(1, this.m.t + 1); for (a.subTo(this.r2, a); 0 <= a.compareTo(this.m); ) a.subTo(this.m, a) } ; Sk.builtin.biginteger.prototype.barrettSqrTo = function(a, b) { a.squareTo(b); this.reduce(b) } ; Sk.builtin.biginteger.prototype.barrettMulTo = function(a, b, c) { a.multiplyTo(b, c); this.reduce(c) } ; Sk.builtin.biginteger.Barrett.prototype.convert = Sk.builtin.biginteger.prototype.barrettConvert; Sk.builtin.biginteger.Barrett.prototype.revert = Sk.builtin.biginteger.prototype.barrettRevert; Sk.builtin.biginteger.Barrett.prototype.reduce = Sk.builtin.biginteger.prototype.barrettReduce; Sk.builtin.biginteger.Barrett.prototype.mulTo = Sk.builtin.biginteger.prototype.barrettMulTo; Sk.builtin.biginteger.Barrett.prototype.sqrTo = Sk.builtin.biginteger.prototype.barrettSqrTo; Sk.builtin.biginteger.prototype.bnModPow = function(a, b) { var c = a.bitLength(); var d = Sk.builtin.biginteger.nbv(1); if (0 >= c) return d; var e = 18 > c ? 1 : 48 > c ? 3 : 144 > c ? 4 : 768 > c ? 5 : 6; var h = 8 > c ? new Sk.builtin.biginteger.Classic(b) : b.isEven() ? new Sk.builtin.biginteger.Barrett(b) : new Sk.builtin.biginteger.Montgomery(b); b = []; var g = 3; var f = e - 1; var k = (1 << e) - 1; b[1] = h.convert(this); if (1 < e) for (c = Sk.builtin.biginteger.nbi(), h.sqrTo(b[1], c); g <= k; ) b[g] = Sk.builtin.biginteger.nbi(), h.mulTo(c, b[g - 2], b[g]), g += 2; var n = a.t - 1; var l = !0; var q = Sk.builtin.biginteger.nbi(); for (c = Sk.builtin.biginteger.nbits(a[n]) - 1; 0 <= n; ) { if (c >= f) var m = a[n] >> c - f & k; else m = (a[n] & (1 << c + 1) - 1) << f - c, 0 < n && (m |= a[n - 1] >> this.DB + c - f); for (g = e; 0 === (m & 1); ) m >>= 1, --g; 0 > (c -= g) && (c += this.DB, --n); if (l) b[m].copyTo(d), l = !1; else { for (; 1 < g; ) h.sqrTo(d, q), h.sqrTo(q, d), g -= 2; 0 < g ? h.sqrTo(d, q) : (g = d, d = q, q = g); h.mulTo(q, b[m], d) } for (; 0 <= n && 0 === (a[n] & 1 << c); ) h.sqrTo(d, q), g = d, d = q, q = g, 0 > --c && (c = this.DB - 1, --n) } return h.revert(d) } ; Sk.builtin.biginteger.prototype.bnGCD = function(a) { var b = 0 > this.s ? this.negate() : this.clone(); a = 0 > a.s ? a.negate() : a.clone(); if (0 > b.compareTo(a)) { var c = b; b = a; a = c } c = b.getLowestSetBit(); var d = a.getLowestSetBit(); if (0 > d) return b; c < d && (d = c); 0 < d && (b.rShiftTo(d, b), a.rShiftTo(d, a)); for (; 0 < b.signum(); ) 0 < (c = b.getLowestSetBit()) && b.rShiftTo(c, b), 0 < (c = a.getLowestSetBit()) && a.rShiftTo(c, a), 0 <= b.compareTo(a) ? (b.subTo(a, b), b.rShiftTo(1, b)) : (a.subTo(b, a), a.rShiftTo(1, a)); 0 < d && a.lShiftTo(d, a); return a } ; Sk.builtin.biginteger.prototype.bnpModInt = function(a) { var b; if (0 >= a) return 0; var c = this.DV % a; var d = 0 > this.s ? a - 1 : 0; if (0 < this.t) if (0 === c) d = this[0] % a; else for (b = this.t - 1; 0 <= b; --b) d = (c * d + this[b]) % a; return d } ; Sk.builtin.biginteger.prototype.bnModInverse = function(a) { var b, c = a.isEven(); if (this.isEven() && c || 0 === a.signum()) return Sk.builtin.biginteger.ZERO; var d = a.clone(); var e = this.clone(); var h = Sk.builtin.biginteger.nbv(1); var g = Sk.builtin.biginteger.nbv(0); var f = Sk.builtin.biginteger.nbv(0); for (b = Sk.builtin.biginteger.nbv(1); 0 !== d.signum(); ) { for (; d.isEven(); ) d.rShiftTo(1, d), c ? (h.isEven() && g.isEven() || (h.addTo(this, h), g.subTo(a, g)), h.rShiftTo(1, h)) : g.isEven() || g.subTo(a, g), g.rShiftTo(1, g); for (; e.isEven(); ) e.rShiftTo(1, e), c ? (f.isEven() && b.isEven() || (f.addTo(this, f), b.subTo(a, b)), f.rShiftTo(1, f)) : b.isEven() || b.subTo(a, b), b.rShiftTo(1, b); 0 <= d.compareTo(e) ? (d.subTo(e, d), c && h.subTo(f, h), g.subTo(b, g)) : (e.subTo(d, e), c && f.subTo(h, f), b.subTo(g, b)) } if (0 !== e.compareTo(Sk.builtin.biginteger.ONE)) return Sk.builtin.biginteger.ZERO; if (0 <= b.compareTo(a)) return b.subtract(a); if (0 > b.signum()) b.addTo(a, b); else return b; return 0 > b.signum() ? b.add(a) : b } ; Sk.builtin.biginteger.lowprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509]; Sk.builtin.biginteger.lplim = 67108864 / Sk.builtin.biginteger.lowprimes[Sk.builtin.biginteger.lowprimes.length - 1]; Sk.builtin.biginteger.prototype.bnIsProbablePrime = function(a) { var b, c, d = this.abs(); if (1 == d.t && d[0] <= Sk.builtin.biginteger.lowprimes[Sk.builtin.biginteger.lowprimes.length - 1]) { for (c = 0; c < Sk.builtin.biginteger.lowprimes.length; ++c) if (d[0] == Sk.builtin.biginteger.lowprimes[c]) return !0; return !1 } if (d.isEven()) return !1; for (c = 1; c < Sk.builtin.biginteger.lowprimes.length; ) { var e = Sk.builtin.biginteger.lowprimes[c]; for (b = c + 1; b < Sk.builtin.biginteger.lowprimes.length && e < Sk.builtin.biginteger.lplim; ) e *= Sk.builtin.biginteger.lowprimes[b++]; for (e = d.modInt(e); c < b; ) if (0 === e % Sk.builtin.biginteger.lowprimes[c++]) return !1 } return d.millerRabin(a) } ; Sk.builtin.biginteger.prototype.bnpMillerRabin = function(a) { var b, c, d = this.subtract(Sk.builtin.biginteger.ONE), e = d.getLowestSetBit(); if (0 >= e) return !1; var h = d.shiftRight(e); a = a + 1 >> 1; a > Sk.builtin.biginteger.lowprimes.length && (a = Sk.builtin.biginteger.lowprimes.length); var g = Sk.builtin.biginteger.nbi(); for (c = 0; c < a; ++c) { g.fromInt(Sk.builtin.biginteger.lowprimes[c]); var f = g.modPow(h, this); if (0 !== f.compareTo(Sk.builtin.biginteger.ONE) && 0 !== f.compareTo(d)) { for (b = 1; b++ < e && 0 !== f.compareTo(d); ) if (f = f.modPowInt(2, this), 0 === f.compareTo(Sk.builtin.biginteger.ONE)) return !1; if (0 !== f.compareTo(d)) return !1 } } return !0 } ; Sk.builtin.biginteger.prototype.isnegative = function() { return 0 > this.s } ; Sk.builtin.biginteger.prototype.ispositive = function() { return 0 <= this.s } ; Sk.builtin.biginteger.prototype.trueCompare = function(a) { return 0 <= this.s && 0 > a.s ? 1 : 0 > this.s && 0 <= a.s ? -1 : this.compare(a) } ; Sk.builtin.biginteger.prototype.chunkSize = Sk.builtin.biginteger.prototype.bnpChunkSize; Sk.builtin.biginteger.prototype.toRadix = Sk.builtin.biginteger.prototype.bnpToRadix; Sk.builtin.biginteger.prototype.fromRadix = Sk.builtin.biginteger.prototype.bnpFromRadix; Sk.builtin.biginteger.prototype.fromNumber = Sk.builtin.biginteger.prototype.bnpFromNumber; Sk.builtin.biginteger.prototype.bitwiseTo = Sk.builtin.biginteger.prototype.bnpBitwiseTo; Sk.builtin.biginteger.prototype.changeBit = Sk.builtin.biginteger.prototype.bnpChangeBit; Sk.builtin.biginteger.prototype.addTo = Sk.builtin.biginteger.prototype.bnpAddTo; Sk.builtin.biginteger.prototype.dMultiply = Sk.builtin.biginteger.prototype.bnpDMultiply; Sk.builtin.biginteger.prototype.dAddOffset = Sk.builtin.biginteger.prototype.bnpDAddOffset; Sk.builtin.biginteger.prototype.multiplyLowerTo = Sk.builtin.biginteger.prototype.bnpMultiplyLowerTo; Sk.builtin.biginteger.prototype.multiplyUpperTo = Sk.builtin.biginteger.prototype.bnpMultiplyUpperTo; Sk.builtin.biginteger.prototype.modInt = Sk.builtin.biginteger.prototype.bnpModInt; Sk.builtin.biginteger.prototype.millerRabin = Sk.builtin.biginteger.prototype.bnpMillerRabin; Sk.builtin.biginteger.prototype.clone = Sk.builtin.biginteger.prototype.bnClone; Sk.builtin.biginteger.prototype.intValue = Sk.builtin.biginteger.prototype.bnIntValue; Sk.builtin.biginteger.prototype.byteValue = Sk.builtin.biginteger.prototype.bnByteValue; Sk.builtin.biginteger.prototype.shortValue = Sk.builtin.biginteger.prototype.bnShortValue; Sk.builtin.biginteger.prototype.signum = Sk.builtin.biginteger.prototype.bnSigNum; Sk.builtin.biginteger.prototype.toByteArray = Sk.builtin.biginteger.prototype.bnToByteArray; Sk.builtin.biginteger.prototype.equals = Sk.builtin.biginteger.prototype.bnEquals; Sk.builtin.biginteger.prototype.compare = Sk.builtin.biginteger.prototype.compareTo; Sk.builtin.biginteger.prototype.min = Sk.builtin.biginteger.prototype.bnMin; Sk.builtin.biginteger.prototype.max = Sk.builtin.biginteger.prototype.bnMax; Sk.builtin.biginteger.prototype.and = Sk.builtin.biginteger.prototype.bnAnd; Sk.builtin.biginteger.prototype.or = Sk.builtin.biginteger.prototype.bnOr; Sk.builtin.biginteger.prototype.xor = Sk.builtin.biginteger.prototype.bnXor; Sk.builtin.biginteger.prototype.andNot = Sk.builtin.biginteger.prototype.bnAndNot; Sk.builtin.biginteger.prototype.not = Sk.builtin.biginteger.prototype.bnNot; Sk.builtin.biginteger.prototype.shiftLeft = Sk.builtin.biginteger.prototype.bnShiftLeft; Sk.builtin.biginteger.prototype.shiftRight = Sk.builtin.biginteger.prototype.bnShiftRight; Sk.builtin.biginteger.prototype.getLowestSetBit = Sk.builtin.biginteger.prototype.bnGetLowestSetBit; Sk.builtin.biginteger.prototype.bitCount = Sk.builtin.biginteger.prototype.bnBitCount; Sk.builtin.biginteger.prototype.testBit = Sk.builtin.biginteger.prototype.bnTestBit; Sk.builtin.biginteger.prototype.setBit = Sk.builtin.biginteger.prototype.bnSetBit; Sk.builtin.biginteger.prototype.clearBit = Sk.builtin.biginteger.prototype.bnClearBit; Sk.builtin.biginteger.prototype.flipBit = Sk.builtin.biginteger.prototype.bnFlipBit; Sk.builtin.biginteger.prototype.add = Sk.builtin.biginteger.prototype.bnAdd; Sk.builtin.biginteger.prototype.subtract = Sk.builtin.biginteger.prototype.bnSubtract; Sk.builtin.biginteger.prototype.multiply = Sk.builtin.biginteger.prototype.bnMultiply; Sk.builtin.biginteger.prototype.divide = Sk.builtin.biginteger.prototype.bnDivide; Sk.builtin.biginteger.prototype.remainder = Sk.builtin.biginteger.prototype.bnRemainder; Sk.builtin.biginteger.prototype.divideAndRemainder = Sk.builtin.biginteger.prototype.bnDivideAndRemainder; Sk.builtin.biginteger.prototype.modPow = Sk.builtin.biginteger.prototype.bnModPow; Sk.builtin.biginteger.prototype.modInverse = Sk.builtin.biginteger.prototype.bnModInverse; Sk.builtin.biginteger.prototype.pow = Sk.builtin.biginteger.prototype.bnPow; Sk.builtin.biginteger.prototype.gcd = Sk.builtin.biginteger.prototype.bnGCD; Sk.builtin.biginteger.prototype.isProbablePrime = Sk.builtin.biginteger.prototype.bnIsProbablePrime } , function(m, p) { Sk.builtin.int_ = function(a, c) { if (!(this instanceof Sk.builtin.int_)) return new Sk.builtin.int_(a,c); if (this instanceof Sk.builtin.bool) return this; if (a instanceof Sk.builtin.int_ && void 0 === c) return this.v = a.v, this; if (c !== Sk.builtin.none.none$ && void 0 !== c && !Sk.builtin.checkInt(c)) { if (Sk.builtin.checkFloat(c)) throw new Sk.builtin.TypeError("integer argument expected, got " + Sk.abstr.typeName(c)); if (c.__index__) c = Sk.misceval.callsimArray(c.__index__, [c]); else if (c.__int__) c = Sk.misceval.callsimArray(c.__int__, [c]); else throw new Sk.builtin.AttributeError(Sk.abstr.typeName(c) + " instance has no attribute '__index__' or '__int__'"); } if (a instanceof Sk.builtin.str) { c = Sk.builtin.asnum$(c); c === Sk.builtin.none.none$ && (c = 10); var b = Sk.str2number(a.v, c, parseInt, function(a) { return -a }, "int"); if (b > Sk.builtin.int_.threshold$ || b < -Sk.builtin.int_.threshold$) return new Sk.builtin.lng(a,c); this.v = b; return this } if (void 0 !== c && c !== Sk.builtin.none.none$) throw new Sk.builtin.TypeError("int() can't convert non-string with explicit base"); if (void 0 === a || a === Sk.builtin.none) a = 0; if (void 0 !== a && a.tp$getattr && (b = a.tp$getattr(Sk.builtin.str.$int_))) { var e = Sk.misceval.callsimArray(b); var h = "__int__" } else void 0 !== a && a.__int__ ? (e = Sk.misceval.callsimArray(a.__int__, [a]), h = "__int__") : void 0 !== a && a.tp$getattr && (b = a.tp$getattr(Sk.builtin.str.$trunc)) ? (e = Sk.misceval.callsimArray(b), h = "__trunc__") : void 0 !== a && a.__trunc__ && (e = Sk.misceval.callsimArray(a.__trunc__, [a]), h = "__trunc__"); if (void 0 === e || Sk.builtin.checkInt(e)) void 0 !== e && (a = e); else throw new Sk.builtin.TypeError(h + " returned non-Integral (type " + Sk.abstr.typeName(e) + ")"); if (!Sk.builtin.checkNumber(a)) throw new Sk.builtin.TypeError("int() argument must be a string or a number, not '" + Sk.abstr.typeName(a) + "'"); a = Sk.builtin.asnum$(a); if (a > Sk.builtin.int_.threshold$ || a < -Sk.builtin.int_.threshold$) return new Sk.builtin.lng(a); -1 < a && 1 > a && (a = 0); this.v = parseInt(a, c); return this } ; Sk.builtin.int_.$shiftconsts = [.5, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 0x800000000000, 281474976710656, 562949953421312, 0x4000000000000, 0x8000000000000, 4503599627370496, 9007199254740992]; Sk.abstr.setUpInheritance("int", Sk.builtin.int_, Sk.builtin.numtype); Sk.builtin.int_.prototype.nb$int_ = function() { return this } ; Sk.builtin.int_.prototype.nb$float_ = function() { return new Sk.builtin.float_(this.v) } ; Sk.builtin.int_.prototype.nb$lng = function() { return new Sk.builtin.lng(this.v) } ; Sk.builtin.int_.prototype.__trunc__ = new Sk.builtin.func(function(a) { return a } ); Sk.builtin.int_.prototype.__index__ = new Sk.builtin.func(function(a) { return a } ); Sk.builtin.int_.prototype.__complex__ = new Sk.builtin.func(function(a) { return Sk.builtin.NotImplemented.NotImplemented$ } ); Sk.builtin.int_.prototype.__format__ = Sk.formatting.mkNumber__format__(!1); Sk.builtin.int_.prototype.tp$index = function() { return this.v } ; Sk.builtin.int_.prototype.tp$hash = function() { return new Sk.builtin.int_(this.v) } ; Sk.builtin.int_.threshold$ = Math.pow(2, 53) - 1; Sk.builtin.int_.prototype.clone = function() { return new Sk.builtin.int_(this.v) } ; Sk.builtin.int_.prototype.nb$add = function(a) { if (a instanceof Sk.builtin.int_) { var c = this.v + a.v; return c > Sk.builtin.int_.threshold$ || c < -Sk.builtin.int_.threshold$ ? (c = new Sk.builtin.lng(this.v), c.nb$add(a)) : new Sk.builtin.int_(c) } return a instanceof Sk.builtin.lng ? (c = new Sk.builtin.lng(this.v), c.nb$add(a)) : a instanceof Sk.builtin.float_ ? (c = new Sk.builtin.float_(this.v), c.nb$add(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$reflected_add = function(a) { return Sk.builtin.int_.prototype.nb$add.call(this, a) } ; Sk.builtin.int_.prototype.nb$subtract = function(a) { if (a instanceof Sk.builtin.int_) { var c = this.v - a.v; return c > Sk.builtin.int_.threshold$ || c < -Sk.builtin.int_.threshold$ ? (c = new Sk.builtin.lng(this.v), c.nb$subtract(a)) : new Sk.builtin.int_(c) } return a instanceof Sk.builtin.lng ? (c = new Sk.builtin.lng(this.v), c.nb$subtract(a)) : a instanceof Sk.builtin.float_ ? (c = new Sk.builtin.float_(this.v), c.nb$subtract(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$reflected_subtract = function(a) { var c = this.nb$negative(); return Sk.builtin.int_.prototype.nb$add.call(c, a) } ; Sk.builtin.int_.prototype.nb$multiply = function(a) { if (a instanceof Sk.builtin.int_) { var c = this.v * a.v; return c > Sk.builtin.int_.threshold$ || c < -Sk.builtin.int_.threshold$ ? (c = new Sk.builtin.lng(this.v), c.nb$multiply(a)) : new Sk.builtin.int_(c) } return a instanceof Sk.builtin.lng ? (c = new Sk.builtin.lng(this.v), c.nb$multiply(a)) : a instanceof Sk.builtin.float_ ? (c = new Sk.builtin.float_(this.v), c.nb$multiply(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$reflected_multiply = function(a) { return Sk.builtin.int_.prototype.nb$multiply.call(this, a) } ; Sk.builtin.int_.prototype.nb$divide = function(a) { if (Sk.__future__.division) { var c = new Sk.builtin.float_(this.v); return c.nb$divide(a) } return a instanceof Sk.builtin.int_ ? this.nb$floor_divide(a) : a instanceof Sk.builtin.lng ? (c = new Sk.builtin.lng(this.v), c.nb$divide(a)) : a instanceof Sk.builtin.float_ ? (c = new Sk.builtin.float_(this.v), c.nb$divide(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$reflected_divide = function(a) { return this.nb$reflected_floor_divide(a) } ; Sk.builtin.int_.prototype.nb$floor_divide = function(a) { if (a instanceof Sk.builtin.int_) { if (0 === a.v) throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero"); return new Sk.builtin.int_(Math.floor(this.v / a.v)) } if (a instanceof Sk.builtin.lng) { var c = new Sk.builtin.lng(this.v); return c.nb$floor_divide(a) } return a instanceof Sk.builtin.float_ ? (c = new Sk.builtin.float_(this.v), c.nb$floor_divide(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$reflected_floor_divide = function(a) { return a instanceof Sk.builtin.int_ ? a.nb$divide(this) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$remainder = function(a) { if (a instanceof Sk.builtin.int_) { var c = Sk.abstr.numberBinOp(this, a, "FloorDiv"); c = Sk.abstr.numberBinOp(c, a, "Mult"); c = Sk.abstr.numberBinOp(this, c, "Sub"); c = c.v; 0 > a.v && 0 === c ? c = -0 : 0 === c && -Infinity === Infinity / c && (c = 0); return new Sk.builtin.int_(c) } return a instanceof Sk.builtin.lng ? (c = new Sk.builtin.lng(this.v), c.nb$remainder(a)) : a instanceof Sk.builtin.float_ ? (c = new Sk.builtin.float_(this.v), c.nb$remainder(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$reflected_remainder = function(a) { return a instanceof Sk.builtin.int_ ? a.nb$remainder(this) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$divmod = function(a) { if (a instanceof Sk.builtin.int_) return new Sk.builtin.tuple([this.nb$floor_divide(a), this.nb$remainder(a)]); if (a instanceof Sk.builtin.lng) { var c = new Sk.builtin.lng(this.v); return c.nb$divmod(a) } return a instanceof Sk.builtin.float_ ? (c = new Sk.builtin.float_(this.v), c.nb$divmod(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$reflected_divmod = function(a) { return a instanceof Sk.builtin.int_ ? new Sk.builtin.tuple([a.nb$floor_divide(this), a.nb$remainder(this)]) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$power = function(a, c) { if (a instanceof Sk.builtin.int_ && (void 0 === c || c instanceof Sk.builtin.int_)) { var b = Math.pow(this.v, a.v); b > Sk.builtin.int_.threshold$ || b < -Sk.builtin.int_.threshold$ ? (b = new Sk.builtin.lng(this.v), b = b.nb$power(a, c)) : b = 0 > a.v ? new Sk.builtin.float_(b) : new Sk.builtin.int_(b); if (void 0 !== c) { if (0 > a.v) throw new Sk.builtin.TypeError("pow() 2nd argument cannot be negative when 3rd argument specified"); return b.nb$remainder(c) } return b } return a instanceof Sk.builtin.lng ? (b = new Sk.builtin.lng(this.v), b.nb$power(a)) : a instanceof Sk.builtin.float_ ? (c = new Sk.builtin.float_(this.v), c.nb$power(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$reflected_power = function(a, c) { return a instanceof Sk.builtin.int_ ? a.nb$power(this, c) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$abs = function() { return new Sk.builtin.int_(Math.abs(this.v)) } ; Sk.builtin.int_.prototype.nb$and = function(a) { if (a instanceof Sk.builtin.int_) { a = Sk.builtin.asnum$(a); var c = this.v & a; void 0 !== c && 0 > c && (c += 4294967296); if (void 0 !== c) return new Sk.builtin.int_(c) } return a instanceof Sk.builtin.lng ? (c = new Sk.builtin.lng(this.v), c.nb$and(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$reflected_and = Sk.builtin.int_.prototype.nb$and; Sk.builtin.int_.prototype.nb$or = function(a) { if (a instanceof Sk.builtin.int_) { a = Sk.builtin.asnum$(a); var c = this.v | a; void 0 !== c && 0 > c && (c += 4294967296); if (void 0 !== c) return new Sk.builtin.int_(c) } return a instanceof Sk.builtin.lng ? (c = new Sk.builtin.lng(this.v), c.nb$and(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$reflected_or = Sk.builtin.int_.prototype.nb$or; Sk.builtin.int_.prototype.nb$xor = function(a) { if (a instanceof Sk.builtin.int_) { a = Sk.builtin.asnum$(a); var c = this.v ^ a; void 0 !== c && 0 > c && (c += 4294967296); if (void 0 !== c) return new Sk.builtin.int_(c) } return a instanceof Sk.builtin.lng ? (c = new Sk.builtin.lng(this.v), c.nb$xor(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$reflected_xor = Sk.builtin.int_.prototype.nb$xor; Sk.builtin.int_.prototype.nb$lshift = function(a) { if (0 === this.v) return this; if (a instanceof Sk.builtin.int_) { var c = Sk.builtin.asnum$(a); if (void 0 !== c) { if (0 > c) throw new Sk.builtin.ValueError("negative shift count"); if (53 < c) return (new Sk.builtin.lng(this.v)).nb$lshift(new Sk.builtin.int_(c)); var b = 2 * this.v * Sk.builtin.int_.$shiftconsts[c]; if (b > Sk.builtin.int_.threshold$ || b < -Sk.builtin.int_.threshold$) return new Sk.builtin.lng(b) } if (void 0 !== b) return new Sk.builtin.int_(b) } return a instanceof Sk.builtin.lng ? (b = new Sk.builtin.lng(this.v), b.nb$lshift(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$reflected_lshift = function(a) { return a instanceof Sk.builtin.int_ ? a.nb$lshift(this) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$rshift = function(a) { if (a instanceof Sk.builtin.int_) { var c = Sk.builtin.asnum$(a); if (void 0 !== c) { if (0 > c) throw new Sk.builtin.ValueError("negative shift count"); var b = this.v >> c; 0 < this.v && 0 > b && (b &= Math.pow(2, 32 - c) - 1) } if (void 0 !== b) return new Sk.builtin.int_(b) } return a instanceof Sk.builtin.lng ? (b = new Sk.builtin.lng(this.v), b.nb$rshift(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$reflected_rshift = function(a) { return a instanceof Sk.builtin.int_ ? a.nb$rshift(this) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.nb$invert = function() { return new Sk.builtin.int_(~this.v) } ; Sk.builtin.int_.prototype.nb$inplace_add = Sk.builtin.int_.prototype.nb$add; Sk.builtin.int_.prototype.nb$inplace_subtract = Sk.builtin.int_.prototype.nb$subtract; Sk.builtin.int_.prototype.nb$inplace_multiply = Sk.builtin.int_.prototype.nb$multiply; Sk.builtin.int_.prototype.nb$inplace_divide = Sk.builtin.int_.prototype.nb$divide; Sk.builtin.int_.prototype.nb$inplace_remainder = Sk.builtin.int_.prototype.nb$remainder; Sk.builtin.int_.prototype.nb$inplace_floor_divide = Sk.builtin.int_.prototype.nb$floor_divide; Sk.builtin.int_.prototype.nb$inplace_power = Sk.builtin.int_.prototype.nb$power; Sk.builtin.int_.prototype.nb$inplace_and = Sk.builtin.int_.prototype.nb$and; Sk.builtin.int_.prototype.nb$inplace_or = Sk.builtin.int_.prototype.nb$or; Sk.builtin.int_.prototype.nb$inplace_xor = Sk.builtin.int_.prototype.nb$xor; Sk.builtin.int_.prototype.nb$inplace_lshift = Sk.builtin.int_.prototype.nb$lshift; Sk.builtin.int_.prototype.nb$inplace_rshift = Sk.builtin.int_.prototype.nb$rshift; Sk.builtin.int_.prototype.nb$negative = function() { return new Sk.builtin.int_(-this.v) } ; Sk.builtin.int_.prototype.nb$positive = function() { return this.clone() } ; Sk.builtin.int_.prototype.nb$nonzero = function() { return 0 !== this.v } ; Sk.builtin.int_.prototype.nb$isnegative = function() { return 0 > this.v } ; Sk.builtin.int_.prototype.nb$ispositive = function() { return 0 <= this.v } ; Sk.builtin.int_.prototype.numberCompare = function(a) { return a instanceof Sk.builtin.int_ ? this.v - a.v : a instanceof Sk.builtin.lng ? -a.longCompare(this) : a instanceof Sk.builtin.float_ ? -a.numberCompare(this) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.ob$eq = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 == this.numberCompare(a)) : a === Sk.builtin.none.none$ ? Sk.builtin.bool.false$ : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.ob$ne = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 != this.numberCompare(a)) : a === Sk.builtin.none.none$ ? Sk.builtin.bool.true$ : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.ob$lt = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 > this.numberCompare(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.ob$le = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 >= this.numberCompare(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.ob$gt = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 < this.numberCompare(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.ob$ge = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 <= this.numberCompare(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.int_.prototype.round$ = function(a, c) { Sk.builtin.pyCheckArgsLen("__round__", arguments.length, 1, 2); if (void 0 !== c && !Sk.misceval.isIndex(c)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(c) + "' object cannot be interpreted as an index"); var b = Sk.builtin.asnum$(a); var e = void 0 === c ? 0 : Sk.misceval.asIndex(c); if (Sk.__future__.bankers_rounding) { b *= Math.pow(10, e); var h = Math.round(b); e = (.5 === (0 < b ? b : -b) % 1 ? 0 === h % 2 ? h : h - 1 : h) / Math.pow(10, e) } else e = Math.pow(10, e), e = Math.round(b * e) / e; return new Sk.builtin.int_(e) } ; Sk.builtin.int_.prototype.conjugate = new Sk.builtin.func(function(a) { return new Sk.builtin.int_(a.v) } ); Sk.builtin.int_.prototype.$r = function() { return new Sk.builtin.str(this.str$(10, !0)) } ; Sk.builtin.int_.prototype.tp$str = function() { return new Sk.builtin.str(this.str$(10, !0)) } ; Sk.builtin.int_.prototype.str$ = function(a, c) { void 0 === c && (c = !0); c = c ? this.v : Math.abs(this.v); return void 0 === a || 10 === a ? c.toString() : c.toString(a) } ; const a = /_(?=[^_])/g; Sk.str2number = function(b, c, d, e, h) { var g = b, f = !1, k; b = b.replace(/^\s+|\s+$/g, ""); "-" === b.charAt(0) && (f = !0, b = b.substring(1)); "+" === b.charAt(0) && (b = b.substring(1)); if (null === c || void 0 === c) c = 10; if ((2 > c || 36 < c) && 0 !== c) throw new Sk.builtin.ValueError(h + "() base must be >= 2 and <= 36"); if ("0x" === b.substring(0, 2).toLowerCase()) if (16 === c || 0 === c) b = b.substring(2), c = 16; else { if (34 > c) throw new Sk.builtin.ValueError("invalid literal for " + h + "() with base " + c + ": '" + g + "'"); } else if ("0b" === b.substring(0, 2).toLowerCase()) if (2 === c || 0 === c) b = b.substring(2), c = 2; else { if (12 > c) throw new Sk.builtin.ValueError("invalid literal for " + h + "() with base " + c + ": '" + g + "'"); } else if ("0o" === b.substring(0, 2).toLowerCase()) if (8 === c || 0 === c) b = b.substring(2), c = 8; else { if (25 > c) throw new Sk.builtin.ValueError("invalid literal for " + h + "() with base " + c + ": '" + g + "'"); } else if ("0" === b.charAt(0)) { if ("0" === b) return 0; if (8 === c || 0 === c) c = 8 } 0 === c && (c = 10); if (-1 !== b.indexOf("_")) { if (-1 !== b.indexOf("__")) throw new Sk.builtin.ValueError("invalid literal for " + h + "() with base " + c + ": '" + g + "'"); b = 10 !== c ? b.replace(a, "") : b.charAt(0) + b.substring(1).replace(a, "") } if (0 === b.length) throw new Sk.builtin.ValueError("invalid literal for " + h + "() with base " + c + ": '" + g + "'"); for (k = 0; k < b.length; k += 1) { var n = b.charCodeAt(k); var l = c; 48 <= n && 57 >= n ? l = n - 48 : 65 <= n && 90 >= n ? l = n - 65 + 10 : 97 <= n && 122 >= n && (l = n - 97 + 10); if (l >= c) throw new Sk.builtin.ValueError("invalid literal for " + h + "() with base " + c + ": '" + g + "'"); } l = d(b, c); f && (l = e(l)); return l } ; Sk.exportSymbol("Sk.builtin.int_", Sk.builtin.int_) } , function(m, p) { Sk.builtin.bool = function(a) { Sk.builtin.pyCheckArgsLen("bool", arguments.length, 1); return Sk.misceval.isTrue(a) ? Sk.builtin.bool.true$ : Sk.builtin.bool.false$ } ; Sk.abstr.setUpInheritance("bool", Sk.builtin.bool, Sk.builtin.int_); Sk.builtin.bool.prototype.$r = function() { return this.v ? new Sk.builtin.str("True") : new Sk.builtin.str("False") } ; Sk.builtin.bool.prototype.tp$hash = function() { return new Sk.builtin.int_(this.v) } ; Sk.builtin.bool.prototype.__int__ = new Sk.builtin.func(function(a) { a = Sk.builtin.asnum$(a); return new Sk.builtin.int_(a) } ); Sk.builtin.bool.prototype.__float__ = new Sk.builtin.func(function(a) { return new Sk.builtin.float_(Sk.ffi.remapToJs(a)) } ); Sk.builtin.bool.prototype.__format__ = new Sk.builtin.func(function(a) { return a.$r() } ); Sk.builtin.bool.prototype.nb$and = function(a) { return a.ob$type === Sk.builtin.bool ? new Sk.builtin.bool(this.v & a.v) : Sk.builtin.int_.prototype.nb$and.call(this, a) } ; Sk.builtin.bool.prototype.nb$or = function(a) { return a.ob$type === Sk.builtin.bool ? new Sk.builtin.bool(this.v | a.v) : Sk.builtin.int_.prototype.nb$or.call(this, a) } ; Sk.builtin.bool.prototype.nb$xor = function(a) { return a.ob$type === Sk.builtin.bool ? new Sk.builtin.bool(this.v ^ a.v) : Sk.builtin.int_.prototype.nb$xor.call(this, a) } ; Sk.builtin.bool.prototype.ob$eq = function(a) { return Sk.builtin.int_.prototype.ob$eq.call(this, a) } ; Sk.builtin.bool.prototype.ob$ne = function(a) { return Sk.builtin.int_.prototype.ob$ne.call(this, a) } ; Sk.builtin.bool.prototype.ob$lt = function(a) { return Sk.builtin.int_.prototype.ob$lt.call(this, a) } ; Sk.builtin.bool.prototype.ob$le = function(a) { return Sk.builtin.int_.prototype.ob$le.call(this, a) } ; Sk.builtin.bool.prototype.ob$gt = function(a) { return Sk.builtin.int_.prototype.ob$gt.call(this, a) } ; Sk.builtin.bool.prototype.ob$ge = function(a) { return Sk.builtin.int_.prototype.ob$ge.call(this, a) } ; Sk.exportSymbol("Sk.builtin.bool", Sk.builtin.bool); Sk.builtin.bool.true$ = Object.create(Sk.builtin.bool.prototype, { v: { value: 1, enumerable: !0 } }); Sk.builtin.bool.false$ = Object.create(Sk.builtin.bool.prototype, { v: { value: 0, enumerable: !0 } }) } , function(m, p) { Sk.builtin.float_ = function(c) { if (!(this instanceof Sk.builtin.float_)) return new Sk.builtin.float_(c); if (void 0 === c) this.v = 0; else if ("number" === typeof c) this.v = c; else if (c.nb$float_) { c = c.nb$float_(); if (c.constructor !== Sk.builtin.float_) throw new Sk.builtin.TypeError("__float__ returned non-float (type " + Sk.abstr.typeName(c) + ")"); this.v = c.v } else if (Sk.builtin.checkString(c)) { { let d = c = c.$jsstr(); if (-1 !== c.indexOf("_")) { if (a.test(c)) throw new Sk.builtin.ValueError("could not convert string to float: '" + c + "'"); d = c.charAt(0) + c.substring(1).replace(b, "") } if (c.match(/^-inf$/i)) c = -Infinity; else if (c.match(/^[+]?inf$/i)) c = Infinity; else if (c.match(/^[-+]?nan$/i)) c = NaN; else { if (isNaN(d)) throw new Sk.builtin.ValueError("float: Argument: " + c + " is not number"); c = parseFloat(d) } c = new Sk.builtin.float_(c) } this.v = c.v } else if ("boolean" === typeof c) this.v = c ? 1 : 0; else if ("string" === typeof c) this.v = parseFloat(c); else throw new Sk.builtin.TypeError("float() argument must be a string or a number"); } ; Sk.abstr.setUpInheritance("float", Sk.builtin.float_, Sk.builtin.numtype); const a = /_[eE]|[eE]_|\._|_\.|[+-]_|__/ , b = /_(?=[^_])/g; Sk.builtin.float_.prototype.nb$int_ = function() { var a = this.v; a = 0 > a ? Math.ceil(a) : Math.floor(a); return new Sk.builtin.int_(a) } ; Sk.builtin.float_.prototype.nb$float_ = function() { return this } ; Sk.builtin.float_.prototype.nb$lng = function() { return new Sk.builtin.lng(this.v) } ; Sk.builtin.float_.PyFloat_Check = function(a) { return void 0 === a ? !1 : Sk.builtin.checkNumber(a) || Sk.builtin.checkFloat(a) || Sk.builtin.issubclass(a.ob$type, Sk.builtin.float_) ? !0 : !1 } ; Sk.builtin.float_.PyFloat_Check_Exact = function(a) { return Sk.builtin.checkFloat(a) } ; Sk.builtin.float_.PyFloat_AsDouble = function(a) { if (a && Sk.builtin.float_.PyFloat_Check(a)) return Sk.ffi.remapToJs(a); if (null == a) throw Error("bad argument for internal PyFloat_AsDouble function"); var c = Sk.builtin.type.typeLookup(a.ob$type, Sk.builtin.str.$float_); if (null == c) throw new Sk.builtin.TypeError("a float is required"); a = Sk.misceval.callsimArray(c, [a]); if (!Sk.builtin.float_.PyFloat_Check(a)) throw new Sk.builtin.TypeError("nb_float should return float object"); return Sk.ffi.remapToJs(a) } ; Sk.builtin.float_.prototype.tp$index = function() { return this.v } ; Sk.builtin.float_.prototype.tp$hash = function() { return this.nb$int_() } ; Sk.builtin.float_.prototype.clone = function() { return new Sk.builtin.float_(this.v) } ; Sk.builtin.float_.prototype.toFixed = function(a) { a = Sk.builtin.asnum$(a); return this.v.toFixed(a) } ; Sk.builtin.float_.prototype.nb$add = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.float_ ? new Sk.builtin.float_(this.v + a.v) : a instanceof Sk.builtin.lng ? new Sk.builtin.float_(this.v + parseFloat(a.str$(10, !0))) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.nb$reflected_add = function(a) { return Sk.builtin.float_.prototype.nb$add.call(this, a) } ; Sk.builtin.float_.prototype.nb$subtract = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.float_ ? new Sk.builtin.float_(this.v - a.v) : a instanceof Sk.builtin.lng ? new Sk.builtin.float_(this.v - parseFloat(a.str$(10, !0))) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.nb$reflected_subtract = function(a) { var c = this.nb$negative(); return Sk.builtin.float_.prototype.nb$add.call(c, a) } ; Sk.builtin.float_.prototype.nb$multiply = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.float_ ? new Sk.builtin.float_(this.v * a.v) : a instanceof Sk.builtin.lng ? new Sk.builtin.float_(this.v * parseFloat(a.str$(10, !0))) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.nb$reflected_multiply = function(a) { return Sk.builtin.float_.prototype.nb$multiply.call(this, a) } ; Sk.builtin.float_.prototype.nb$divide = function(a) { if (a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.float_) { if (0 === a.v) throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero"); return Infinity === this.v ? Infinity === a.v || -Infinity === a.v ? new Sk.builtin.float_(NaN) : a.nb$isnegative() ? new Sk.builtin.float_(-Infinity) : new Sk.builtin.float_(Infinity) : -Infinity === this.v ? Infinity === a.v || -Infinity === a.v ? new Sk.builtin.float_(NaN) : a.nb$isnegative() ? new Sk.builtin.float_(Infinity) : new Sk.builtin.float_(-Infinity) : new Sk.builtin.float_(this.v / a.v) } if (a instanceof Sk.builtin.lng) { if (0 === a.longCompare(Sk.builtin.biginteger.ZERO)) throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero"); return Infinity === this.v ? a.nb$isnegative() ? new Sk.builtin.float_(-Infinity) : new Sk.builtin.float_(Infinity) : -Infinity === this.v ? a.nb$isnegative() ? new Sk.builtin.float_(Infinity) : new Sk.builtin.float_(-Infinity) : new Sk.builtin.float_(this.v / parseFloat(a.str$(10, !0))) } return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.nb$reflected_divide = function(a) { if (a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng) a = new Sk.builtin.float_(a); return a instanceof Sk.builtin.float_ ? a.nb$divide(this) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.nb$floor_divide = function(a) { if (a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.float_) { if (Infinity === this.v || -Infinity === this.v) return new Sk.builtin.float_(NaN); if (0 === a.v) throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero"); return Infinity === a.v ? this.nb$isnegative() ? new Sk.builtin.float_(-1) : new Sk.builtin.float_(0) : -Infinity === a.v ? this.nb$isnegative() || !this.nb$nonzero() ? new Sk.builtin.float_(0) : new Sk.builtin.float_(-1) : new Sk.builtin.float_(Math.floor(this.v / a.v)) } if (a instanceof Sk.builtin.lng) { if (0 === a.longCompare(Sk.builtin.biginteger.ZERO)) throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero"); return Infinity === this.v || -Infinity === this.v ? new Sk.builtin.float_(NaN) : new Sk.builtin.float_(Math.floor(this.v / parseFloat(a.str$(10, !0)))) } return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.nb$reflected_floor_divide = function(a) { if (a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng) a = new Sk.builtin.float_(a); return a instanceof Sk.builtin.float_ ? a.nb$floor_divide(this) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.nb$remainder = function(a) { if (a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.float_) { if (0 === a.v) throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero"); if (0 === this.v) return new Sk.builtin.float_(0); if (Infinity === a.v) return Infinity === this.v || -Infinity === this.v ? new Sk.builtin.float_(NaN) : this.nb$ispositive() ? new Sk.builtin.float_(this.v) : new Sk.builtin.float_(Infinity); var c = this.v % a.v; 0 > this.v ? 0 < a.v && 0 > c && (c += a.v) : 0 > a.v && 0 !== c && (c += a.v); 0 > a.v && 0 === c ? c = -0 : 0 === c && -Infinity === Infinity / c && (c = 0); return new Sk.builtin.float_(c) } if (a instanceof Sk.builtin.lng) { if (0 === a.longCompare(Sk.builtin.biginteger.ZERO)) throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero"); if (0 === this.v) return new Sk.builtin.float_(0); var b = parseFloat(a.str$(10, !0)); c = this.v % b; 0 > c ? 0 < b && 0 !== c && (c += b) : 0 > b && 0 !== c && (c += b); a.nb$isnegative() && 0 === c ? c = -0 : 0 === c && -Infinity === Infinity / c && (c = 0); return new Sk.builtin.float_(c) } return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.nb$reflected_remainder = function(a) { if (a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng) a = new Sk.builtin.float_(a); return a instanceof Sk.builtin.float_ ? a.nb$remainder(this) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.nb$divmod = function(a) { if (a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng) a = new Sk.builtin.float_(a); return a instanceof Sk.builtin.float_ ? new Sk.builtin.tuple([this.nb$floor_divide(a), this.nb$remainder(a)]) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.nb$reflected_divmod = function(a) { if (a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng) a = new Sk.builtin.float_(a); return a instanceof Sk.builtin.float_ ? new Sk.builtin.tuple([a.nb$floor_divide(this), a.nb$remainder(this)]) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.nb$power = function(a, b) { if (a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.float_) { if (0 > this.v && 0 !== a.v % 1) throw new Sk.builtin.NegativePowerError("cannot raise a negative number to a fractional power"); if (0 === this.v && 0 > a.v) throw new Sk.builtin.NegativePowerError("cannot raise zero to a negative power"); b = new Sk.builtin.float_(Math.pow(this.v, a.v)); if (Infinity === Math.abs(b.v) && Infinity !== Math.abs(this.v) && Infinity !== Math.abs(a.v)) throw new Sk.builtin.OverflowError("Numerical result out of range"); return b } if (a instanceof Sk.builtin.lng) { if (0 === this.v && 0 > a.longCompare(Sk.builtin.biginteger.ZERO)) throw new Sk.builtin.NegativePowerError("cannot raise zero to a negative power"); return new Sk.builtin.float_(Math.pow(this.v, parseFloat(a.str$(10, !0)))) } return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.nb$reflected_power = function(a, b) { if (a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng) a = new Sk.builtin.float_(a); return a instanceof Sk.builtin.float_ ? a.nb$power(this, b) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.nb$abs = function() { return new Sk.builtin.float_(Math.abs(this.v)) } ; Sk.builtin.float_.prototype.nb$inplace_add = Sk.builtin.float_.prototype.nb$add; Sk.builtin.float_.prototype.nb$inplace_subtract = Sk.builtin.float_.prototype.nb$subtract; Sk.builtin.float_.prototype.nb$inplace_multiply = Sk.builtin.float_.prototype.nb$multiply; Sk.builtin.float_.prototype.nb$inplace_divide = Sk.builtin.float_.prototype.nb$divide; Sk.builtin.float_.prototype.nb$inplace_remainder = Sk.builtin.float_.prototype.nb$remainder; Sk.builtin.float_.prototype.nb$inplace_floor_divide = Sk.builtin.float_.prototype.nb$floor_divide; Sk.builtin.float_.prototype.nb$inplace_power = Sk.builtin.float_.prototype.nb$power; Sk.builtin.float_.prototype.nb$negative = function() { return new Sk.builtin.float_(-this.v) } ; Sk.builtin.float_.prototype.nb$positive = function() { return this.clone() } ; Sk.builtin.float_.prototype.nb$nonzero = function() { return 0 !== this.v } ; Sk.builtin.float_.prototype.nb$isnegative = function() { return 0 > this.v } ; Sk.builtin.float_.prototype.nb$ispositive = function() { return 0 <= this.v } ; Sk.builtin.float_.prototype.numberCompare = function(a) { if (a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.float_) return Infinity == this.v && Infinity == a.v || -Infinity == this.v && -Infinity == a.v ? 0 : this.v - a.v; if (a instanceof Sk.builtin.lng) { if (0 === this.v % 1) { var c = new Sk.builtin.lng(this.v); return a = c.longCompare(a) } a = this.nb$subtract(a); if (a instanceof Sk.builtin.float_) return a.v; if (a instanceof Sk.builtin.lng) return a.longCompare(Sk.builtin.biginteger.ZERO) } return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.ob$eq = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 == this.numberCompare(a)) : a === Sk.builtin.none.none$ ? Sk.builtin.bool.false$ : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.ob$ne = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 != this.numberCompare(a)) : a === Sk.builtin.none.none$ ? Sk.builtin.bool.true$ : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.ob$lt = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 > this.numberCompare(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.ob$le = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 >= this.numberCompare(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.ob$gt = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 < this.numberCompare(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.ob$ge = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 <= this.numberCompare(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.float_.prototype.round$ = function(a, b) { Sk.builtin.pyCheckArgsLen("__round__", arguments.length, 1, 2); if (void 0 !== b && !Sk.misceval.isIndex(b)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(b) + "' object cannot be interpreted as an index"); var c = Sk.builtin.asnum$(a); var d = void 0 === b ? 0 : Sk.misceval.asIndex(b); if (Sk.__future__.bankers_rounding) { c *= Math.pow(10, d); var g = Math.round(c); d = (.5 === (0 < c ? c : -c) % 1 ? 0 === g % 2 ? g : g - 1 : g) / Math.pow(10, d); return void 0 === b ? new Sk.builtin.int_(d) : new Sk.builtin.float_(d) } d = Math.pow(10, d); d = Math.round(c * d) / d; return new Sk.builtin.float_(d) } ; Sk.builtin.float_.prototype.__format__ = Sk.formatting.mkNumber__format__(!0); Sk.builtin.float_.prototype.conjugate = new Sk.builtin.func(function(a) { return new Sk.builtin.float_(a.v) } ); Sk.builtin.float_.prototype.$r = function() { return new Sk.builtin.str(this.str$(10, !0)) } ; Sk.builtin.float_.prototype.tp$str = function() { return new Sk.builtin.str(this.str$(10, !0)) } ; Sk.builtin.float_.prototype.str$ = function(a, b) { if (isNaN(this.v)) return "nan"; void 0 === b && (b = !0); if (Infinity == this.v) return "inf"; if (-Infinity == this.v && b) return "-inf"; if (-Infinity == this.v && !b) return "inf"; b = b ? this.v : Math.abs(this.v); if (void 0 === a || 10 === a) { var c = Sk.__future__.python3 ? b.toPrecision(16) : b.toPrecision(12); var d = c.indexOf("."); a = b.toString().slice(0, d); d = b.toString().slice(d); a.match(/^-?0$/) && d.slice(1).match(/^0{4,}/) && (c = 12 > c.length ? b.toExponential() : b.toExponential(11)); if (0 > c.indexOf("e") && 0 <= c.indexOf(".")) { for (; "0" == c.charAt(c.length - 1); ) c = c.substring(0, c.length - 1); "." == c.charAt(c.length - 1) && (c += "0") } c = c.replace(/\.0+e/, "e", "i"); c = c.replace(/(e[-+])([1-9])$/, "$10$2"); c = c.replace(/0+(e.*)/, "$1") } else c = b.toString(a); 0 === this.v && -Infinity === 1 / this.v && (c = "-" + c); 0 > c.indexOf(".") && 0 > c.indexOf("E") && 0 > c.indexOf("e") && (c += ".0"); return c } } , function(m, p) { var a = new Sk.builtin.ExternalError("Sk.builtin.nmber is deprecated."); Sk.builtin.nmber = function(a, c) { throw new Sk.builtin.ExternalError("Sk.builtin.nmber is deprecated. Please replace with Sk.builtin.int_, Sk.builtin.float_, or Sk.builtin.assk$."); } ; Sk.builtin.nmber.prototype.tp$index = function() { return this.v } ; Sk.builtin.nmber.prototype.tp$hash = function() { throw a; } ; Sk.builtin.nmber.fromInt$ = function(b) { throw a; } ; Sk.builtin.nmber.prototype.clone = function() { throw a; } ; Sk.builtin.nmber.prototype.toFixed = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$add = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$subtract = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$multiply = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$divide = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$floor_divide = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$remainder = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$divmod = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$power = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$and = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$or = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$xor = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$lshift = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$rshift = function(b) { throw a; } ; Sk.builtin.nmber.prototype.nb$inplace_add = Sk.builtin.nmber.prototype.nb$add; Sk.builtin.nmber.prototype.nb$inplace_subtract = Sk.builtin.nmber.prototype.nb$subtract; Sk.builtin.nmber.prototype.nb$inplace_multiply = Sk.builtin.nmber.prototype.nb$multiply; Sk.builtin.nmber.prototype.nb$inplace_divide = Sk.builtin.nmber.prototype.nb$divide; Sk.builtin.nmber.prototype.nb$inplace_remainder = Sk.builtin.nmber.prototype.nb$remainder; Sk.builtin.nmber.prototype.nb$inplace_floor_divide = Sk.builtin.nmber.prototype.nb$floor_divide; Sk.builtin.nmber.prototype.nb$inplace_power = Sk.builtin.nmber.prototype.nb$power; Sk.builtin.nmber.prototype.nb$inplace_and = Sk.builtin.nmber.prototype.nb$and; Sk.builtin.nmber.prototype.nb$inplace_or = Sk.builtin.nmber.prototype.nb$or; Sk.builtin.nmber.prototype.nb$inplace_xor = Sk.builtin.nmber.prototype.nb$xor; Sk.builtin.nmber.prototype.nb$inplace_lshift = Sk.builtin.nmber.prototype.nb$lshift; Sk.builtin.nmber.prototype.nb$inplace_rshift = Sk.builtin.nmber.prototype.nb$rshift; Sk.builtin.nmber.prototype.nb$negative = function() { throw a; } ; Sk.builtin.nmber.prototype.nb$positive = function() { throw a; } ; Sk.builtin.nmber.prototype.nb$nonzero = function() { throw a; } ; Sk.builtin.nmber.prototype.nb$isnegative = function() { throw a; } ; Sk.builtin.nmber.prototype.nb$ispositive = function() { throw a; } ; Sk.builtin.nmber.prototype.numberCompare = function(b) { throw a; } ; Sk.builtin.nmber.prototype.__eq__ = function(b, c) { throw a; } ; Sk.builtin.nmber.prototype.__ne__ = function(b, c) { throw a; } ; Sk.builtin.nmber.prototype.__lt__ = function(b, c) { throw a; } ; Sk.builtin.nmber.prototype.__le__ = function(b, c) { throw a; } ; Sk.builtin.nmber.prototype.__gt__ = function(b, c) { throw a; } ; Sk.builtin.nmber.prototype.__ge__ = function(b, c) { throw a; } ; Sk.builtin.nmber.prototype.round$ = function(b, c) { throw a; } ; Sk.builtin.nmber.prototype.$r = function() { throw a; } ; Sk.builtin.nmber.prototype.tp$str = function() { throw a; } ; Sk.builtin.nmber.prototype.str$ = function(b, c) { throw a; } ; Sk.exportSymbol("Sk.builtin.nmber", Sk.builtin.nmber) } , function(m, p) { Sk.builtin.lng = function(a, b) { b = Sk.builtin.asnum$(b); if (!(this instanceof Sk.builtin.lng)) return new Sk.builtin.lng(a,b); if (void 0 === a) return this.biginteger = new Sk.builtin.biginteger(0), this; if (a instanceof Sk.builtin.lng) return this.biginteger = a.biginteger.clone(), this; if (a instanceof Sk.builtin.biginteger) return this.biginteger = a, this; if (a instanceof String || "string" === typeof a) return Sk.longFromStr(a, b); if (a instanceof Sk.builtin.str) return Sk.longFromStr(a.v, b); if (void 0 !== a && !Sk.builtin.checkString(a) && !Sk.builtin.checkNumber(a)) if (!0 === a) a = 1; else if (!1 === a) a = 0; else throw new Sk.builtin.TypeError("long() argument must be a string or a number, not '" + Sk.abstr.typeName(a) + "'"); a = Sk.builtin.asnum$nofloat(a); this.biginteger = new Sk.builtin.biginteger(a); return this } ; Sk.abstr.setUpInheritance("long", Sk.builtin.lng, Sk.builtin.numtype); Sk.builtin.lng.prototype.tp$index = function() { return parseInt(this.str$(10, !0), 10) } ; Sk.builtin.lng.prototype.tp$hash = function() { return new Sk.builtin.int_(this.tp$index()) } ; Sk.builtin.lng.prototype.nb$int_ = function() { return this.cantBeInt() ? new Sk.builtin.lng(this) : new Sk.builtin.int_(this.toInt$()) } ; Sk.builtin.lng.prototype.round$ = function(a, b) { Sk.builtin.pyCheckArgsLen("__round__", arguments.length, 1, 2); if (void 0 !== b && !Sk.misceval.isIndex(b)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(b) + "' object cannot be interpreted as an index"); var c = Sk.builtin.asnum$(a); var d = void 0 === b ? 0 : Sk.misceval.asIndex(b); if (Sk.__future__.bankers_rounding) { c *= Math.pow(10, d); var e = Math.round(c); d = (.5 === (0 < c ? c : -c) % 1 ? 0 === e % 2 ? e : e - 1 : e) / Math.pow(10, d) } else d = Math.pow(10, d), d = Math.round(c * d) / d; return new Sk.builtin.lng(d) } ; Sk.builtin.lng.prototype.__index__ = new Sk.builtin.func(function(a) { return a.nb$int_(a) } ); Sk.builtin.lng.prototype.__format__ = Sk.formatting.mkNumber__format__(!1); Sk.builtin.lng.prototype.nb$lng_ = function() { return this } ; Sk.builtin.lng.prototype.nb$float_ = function() { let a = Sk.builtin.asnum$(this); a = parseFloat(a); if (!isFinite(a)) throw new Sk.builtin.OverflowError("int too large to convert to float"); return new Sk.builtin.float_(a) } ; Sk.builtin.lng.MAX_INT$ = new Sk.builtin.lng(Sk.builtin.int_.threshold$); Sk.builtin.lng.MIN_INT$ = new Sk.builtin.lng(-Sk.builtin.int_.threshold$); Sk.builtin.lng.prototype.cantBeInt = function() { return 0 < this.longCompare(Sk.builtin.lng.MAX_INT$) || 0 > this.longCompare(Sk.builtin.lng.MIN_INT$) } ; Sk.builtin.lng.fromInt$ = function(a) { return new Sk.builtin.lng(a) } ; Sk.longFromStr = function(a, b) { a = Sk.str2number(a, b, function(a, b) { return 10 === b ? new Sk.builtin.biginteger(a) : new Sk.builtin.biginteger(a,b) }, function(a) { return a.negate() }, "long"); return new Sk.builtin.lng(a) } ; Sk.exportSymbol("Sk.longFromStr", Sk.longFromStr); Sk.builtin.lng.prototype.toInt$ = function() { return parseInt(this.biginteger.toString(), 10) } ; Sk.builtin.lng.prototype.clone = function() { return new Sk.builtin.lng(this) } ; Sk.builtin.lng.prototype.conjugate = new Sk.builtin.func(function(a) { return a.clone() } ); Sk.builtin.lng.prototype.nb$add = function(a) { if (a instanceof Sk.builtin.float_) { var b = new Sk.builtin.float_(this.str$(10, !0)); return b.nb$add(a) } a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? new Sk.builtin.lng(this.biginteger.add(a.biginteger)) : a instanceof Sk.builtin.biginteger ? new Sk.builtin.lng(this.biginteger.add(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$reflected_add = function(a) { return Sk.builtin.lng.prototype.nb$add.call(this, a) } ; Sk.builtin.lng.prototype.nb$inplace_add = Sk.builtin.lng.prototype.nb$add; Sk.builtin.lng.prototype.nb$subtract = function(a) { if (a instanceof Sk.builtin.float_) { var b = new Sk.builtin.float_(this.str$(10, !0)); return b.nb$subtract(a) } a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? new Sk.builtin.lng(this.biginteger.subtract(a.biginteger)) : a instanceof Sk.builtin.biginteger ? new Sk.builtin.lng(this.biginteger.subtract(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$reflected_subtract = function(a) { var b = this.nb$negative(); return Sk.builtin.lng.prototype.nb$add.call(b, a) } ; Sk.builtin.lng.prototype.nb$inplace_subtract = Sk.builtin.lng.prototype.nb$subtract; Sk.builtin.lng.prototype.nb$multiply = function(a) { if (a instanceof Sk.builtin.float_) { var b = new Sk.builtin.float_(this.str$(10, !0)); return b.nb$multiply(a) } a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? new Sk.builtin.lng(this.biginteger.multiply(a.biginteger)) : a instanceof Sk.builtin.biginteger ? new Sk.builtin.lng(this.biginteger.multiply(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$reflected_multiply = function(a) { return Sk.builtin.lng.prototype.nb$multiply.call(this, a) } ; Sk.builtin.lng.prototype.nb$inplace_multiply = Sk.builtin.lng.prototype.nb$multiply; Sk.builtin.lng.prototype.nb$divide = function(a) { if (a instanceof Sk.builtin.float_) { var b = new Sk.builtin.float_(this.str$(10, !0)); return b.nb$divide(a) } a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); if (a instanceof Sk.builtin.lng) { b = this.nb$isnegative(); var c = a.nb$isnegative(); if (b && !c || c && !b) { a = this.biginteger.divideAndRemainder(a.biginteger); if (0 === a[1].trueCompare(Sk.builtin.biginteger.ZERO)) return new Sk.builtin.lng(a[0]); a = a[0].subtract(Sk.builtin.biginteger.ONE); return new Sk.builtin.lng(a) } return new Sk.builtin.lng(this.biginteger.divide(a.biginteger)) } return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$reflected_divide = function(a) { a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? a.nb$divide(this) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$floor_divide = function(a) { if (a instanceof Sk.builtin.float_) { var b = new Sk.builtin.float_(this.str$(10, !0)); return b.nb$floor_divide(a) } a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? a.nb$divide(this) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$divmod = function(a) { a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? new Sk.builtin.tuple([this.nb$floor_divide(a), this.nb$remainder(a)]) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$reflected_divmod = function(a) { a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? new Sk.builtin.tuple([a.nb$floor_divide(this), a.nb$remainder(this)]) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$inplace_divide = Sk.builtin.lng.prototype.nb$divide; Sk.builtin.lng.prototype.nb$floor_divide = Sk.builtin.lng.prototype.nb$divide; Sk.builtin.lng.prototype.nb$reflected_floor_divide = Sk.builtin.lng.prototype.nb$reflected_divide; Sk.builtin.lng.prototype.nb$inplace_floor_divide = Sk.builtin.lng.prototype.nb$floor_divide; Sk.builtin.lng.prototype.nb$remainder = function(a) { if (0 === this.biginteger.trueCompare(Sk.builtin.biginteger.ZERO)) return a instanceof Sk.builtin.float_ ? new Sk.builtin.float_(0) : new Sk.builtin.lng(0); if (a instanceof Sk.builtin.float_) { var b = new Sk.builtin.float_(this.str$(10, !0)); return b.nb$remainder(a) } a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? (b = new Sk.builtin.lng(this.biginteger.remainder(a.biginteger)), this.nb$isnegative() ? a.nb$ispositive() && b.nb$nonzero() && (b = b.nb$add(a).nb$remainder(a)) : a.nb$isnegative() && b.nb$nonzero() && (b = b.nb$add(a)), b) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$reflected_remainder = function(a) { a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? a.nb$remainder(this) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$inplace_remainder = Sk.builtin.lng.prototype.nb$remainder; Sk.builtin.lng.prototype.nb$divmod = function(a) { a === Sk.builtin.bool.true$ && (a = new Sk.builtin.lng(1)); a === Sk.builtin.bool.false$ && (a = new Sk.builtin.lng(0)); a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); if (a instanceof Sk.builtin.lng) return new Sk.builtin.tuple([this.nb$floor_divide(a), this.nb$remainder(a)]); if (a instanceof Sk.builtin.float_) { var b = new Sk.builtin.float_(this.str$(10, !0)); return b.nb$divmod(a) } return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$power = function(a, b) { if (void 0 !== b) return a = new Sk.builtin.biginteger(Sk.builtin.asnum$(a)), b = new Sk.builtin.biginteger(Sk.builtin.asnum$(b)), new Sk.builtin.lng(this.biginteger.modPowInt(a, b)); if (a instanceof Sk.builtin.float_ || a instanceof Sk.builtin.int_ && 0 > a.v) return b = new Sk.builtin.float_(this.str$(10, !0)), b.nb$power(a); a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? void 0 !== b ? (a = new Sk.builtin.biginteger(Sk.builtin.asnum$(a)), b = new Sk.builtin.biginteger(Sk.builtin.asnum$(b)), new Sk.builtin.lng(this.biginteger.modPowInt(a, b))) : a.nb$isnegative() ? (b = new Sk.builtin.float_(this.str$(10, !0)), b.nb$power(a)) : new Sk.builtin.lng(this.biginteger.pow(a.biginteger)) : a instanceof Sk.builtin.biginteger ? void 0 !== b ? (b = new Sk.builtin.biginteger(Sk.builtin.asnum$(b)), new Sk.builtin.lng(this.biginteger.modPowInt(a, b))) : a.isnegative() ? (b = new Sk.builtin.float_(this.str$(10, !0)), b.nb$power(a)) : new Sk.builtin.lng(this.biginteger.pow(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$reflected_power = function(a, b) { a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? a.nb$power(this, b) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$inplace_power = Sk.builtin.lng.prototype.nb$power; Sk.builtin.lng.prototype.nb$abs = function() { return new Sk.builtin.lng(this.biginteger.bnAbs()) } ; Sk.builtin.lng.prototype.nb$lshift = function(a) { a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); if (a instanceof Sk.builtin.lng) { if (0 > a.biginteger.signum()) throw new Sk.builtin.ValueError("negative shift count"); return new Sk.builtin.lng(this.biginteger.shiftLeft(a.biginteger)) } if (a instanceof Sk.builtin.biginteger) { if (0 > a.signum()) throw new Sk.builtin.ValueError("negative shift count"); return new Sk.builtin.lng(this.biginteger.shiftLeft(a)) } return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$reflected_lshift = function(a) { a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? a.nb$lshift(this) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$inplace_lshift = Sk.builtin.lng.prototype.nb$lshift; Sk.builtin.lng.prototype.nb$rshift = function(a) { a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); if (a instanceof Sk.builtin.lng) { if (0 > a.biginteger.signum()) throw new Sk.builtin.ValueError("negative shift count"); return new Sk.builtin.lng(this.biginteger.shiftRight(a.biginteger)) } if (a instanceof Sk.builtin.biginteger) { if (0 > a.signum()) throw new Sk.builtin.ValueError("negative shift count"); return new Sk.builtin.lng(this.biginteger.shiftRight(a)) } return Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$reflected_rshift = function(a) { a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? a.nb$rshift(this) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$inplace_rshift = Sk.builtin.lng.prototype.nb$rshift; Sk.builtin.lng.prototype.nb$and = function(a) { a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? new Sk.builtin.lng(this.biginteger.and(a.biginteger)) : a instanceof Sk.builtin.biginteger ? new Sk.builtin.lng(this.biginteger.and(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$reflected_and = Sk.builtin.lng.prototype.nb$and; Sk.builtin.lng.prototype.nb$inplace_and = Sk.builtin.lng.prototype.nb$and; Sk.builtin.lng.prototype.nb$or = function(a) { a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? new Sk.builtin.lng(this.biginteger.or(a.biginteger)) : a instanceof Sk.builtin.biginteger ? new Sk.builtin.lng(this.biginteger.or(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$reflected_or = Sk.builtin.lng.prototype.nb$or; Sk.builtin.lng.prototype.nb$inplace_or = Sk.builtin.lng.prototype.nb$or; Sk.builtin.lng.prototype.nb$xor = function(a) { a instanceof Sk.builtin.int_ && (a = new Sk.builtin.lng(a.v)); return a instanceof Sk.builtin.lng ? new Sk.builtin.lng(this.biginteger.xor(a.biginteger)) : a instanceof Sk.builtin.biginteger ? new Sk.builtin.lng(this.biginteger.xor(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.nb$reflected_xor = Sk.builtin.lng.prototype.nb$xor; Sk.builtin.lng.prototype.nb$inplace_xor = Sk.builtin.lng.prototype.nb$xor; Sk.builtin.lng.prototype.nb$negative = function() { return new Sk.builtin.lng(this.biginteger.negate()) } ; Sk.builtin.lng.prototype.nb$invert = function() { return new Sk.builtin.lng(this.biginteger.not()) } ; Sk.builtin.lng.prototype.nb$positive = function() { return this.clone() } ; Sk.builtin.lng.prototype.nb$nonzero = function() { return 0 !== this.biginteger.trueCompare(Sk.builtin.biginteger.ZERO) } ; Sk.builtin.lng.prototype.nb$isnegative = function() { return this.biginteger.isnegative() } ; Sk.builtin.lng.prototype.nb$ispositive = function() { return !this.biginteger.isnegative() } ; Sk.builtin.lng.prototype.longCompare = function(a) { "number" === typeof a && (a = new Sk.builtin.lng(a)); if (a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.float_ && 0 === a.v % 1) return a = new Sk.builtin.lng(a.v), this.longCompare(a); if (a instanceof Sk.builtin.float_) { var b = new Sk.builtin.float_(this); return b.numberCompare(a) } return a instanceof Sk.builtin.lng ? this.biginteger.subtract(a.biginteger) : a instanceof Sk.builtin.biginteger ? this.biginteger.subtract(a) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.ob$eq = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 == this.longCompare(a)) : a === Sk.builtin.none.none$ ? Sk.builtin.bool.false$ : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.ob$ne = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 != this.longCompare(a)) : a === Sk.builtin.none.none$ ? Sk.builtin.bool.true$ : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.ob$lt = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 > this.longCompare(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.ob$le = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 >= this.longCompare(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.ob$gt = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 < this.longCompare(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.ob$ge = function(a) { return a instanceof Sk.builtin.int_ || a instanceof Sk.builtin.lng || a instanceof Sk.builtin.float_ ? new Sk.builtin.bool(0 <= this.longCompare(a)) : Sk.builtin.NotImplemented.NotImplemented$ } ; Sk.builtin.lng.prototype.$r = function() { var a = Sk.__future__.python3 ? "" : "L"; return new Sk.builtin.str(this.str$(10, !0) + a) } ; Sk.builtin.lng.prototype.tp$str = function() { return new Sk.builtin.str(this.str$(10, !0)) } ; Sk.builtin.lng.prototype.str$ = function(a, b) { void 0 === b && (b = !0); b = b ? this.biginteger : this.biginteger.abs(); return void 0 === a || 10 === a ? b.toString() : b.toString(a) } } , function(m, p) { Math.hypot = Math.hypot || function() { for (var a = 0, b = arguments.length, e = 0; e < b; e++) { if (Infinity === arguments[e] || -Infinity === arguments[e]) return Infinity; a += arguments[e] * arguments[e] } return Math.sqrt(a) } ; Sk.builtin.complex = function(a, b) { Sk.builtin.pyCheckArgsLen("complex", arguments.length, 0, 2); var c, d = !1, g = !1; if (!(this instanceof Sk.builtin.complex)) return new Sk.builtin.complex(a,b); if ("number" === typeof a && "number" === typeof b) return this.real = a, this.imag = b, this; var f = null == a ? Sk.builtin.bool.false$ : a; if (f instanceof Sk.builtin.complex && null == b) return a; if (null != f && Sk.builtin.checkString(f)) { if (null != b) throw new Sk.builtin.TypeError("complex() can't take second arg if first is a string"); return Sk.builtin.complex.complex_subtype_from_string(f) } if (null != b && Sk.builtin.checkString(b)) throw new Sk.builtin.TypeError("complex() second arg can't be a string"); var k = Sk.builtin.complex.try_complex_special_method(f); if (null != k && k !== Sk.builtin.NotImplemented.NotImplemented$) { if (!Sk.builtin.checkComplex(k)) throw new Sk.builtin.TypeError("__complex__ should return a complex object"); f = k } k = Sk.builtin.asnum$(f); null != b && (c = Sk.builtin.asnum$(b)); var n = function(a) { if (Sk.builtin.checkNumber(a) || void 0 !== Sk.builtin.type.typeLookup(a.ob$type, Sk.builtin.str.$float_)) return !0 }; if (null == k || !n(f) && !Sk.builtin.checkComplex(f) || null != b && (null == c || !n(b) && !Sk.builtin.checkComplex(b))) throw new Sk.builtin.TypeError("complex() argument must be a string or number"); if (Sk.builtin.complex._complex_check(f)) c = f.real, f = f.imag, d = !0; else { k = Sk.builtin.float_.PyFloat_AsDouble(f); if (null == k) return null; c = k; f = 0 } if (null == b) k = 0; else if (Sk.builtin.complex._complex_check(b)) { k = b.real; var l = b.imag; g = !0 } else { k = Sk.builtin.float_.PyFloat_AsDouble(b); if (null == k) return null; l = 0 } !0 === g && (c -= l); !0 === d && (k += f); this.real = c; this.imag = k; return this } ; Sk.abstr.setUpInheritance("complex", Sk.builtin.complex, Sk.builtin.numtype); Sk.builtin.complex.prototype.__class__ = Sk.builtin.complex; Sk.builtin.complex.prototype.nb$int_ = function() { throw new Sk.builtin.TypeError("can't convert complex to int"); } ; Sk.builtin.complex.prototype.nb$float_ = function() { throw new Sk.builtin.TypeError("can't convert complex to float"); } ; Sk.builtin.complex.prototype.nb$lng = function() { throw new Sk.builtin.TypeError("can't convert complex to long"); } ; Sk.builtin.complex.prototype.__doc__ = new Sk.builtin.str("complex(real[, imag]) -> complex number\n\nCreate a complex number from a real part and an optional imaginary part.\nThis is equivalent to (real + imag*1j) where imag defaults to 0."); Sk.builtin.complex._isNegativeZero = function(a) { return 0 !== a ? !1 : -Infinity === 1 / a } ; Sk.builtin.complex.try_complex_special_method = function(a) { if (null == a) return null; var c = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$complex); return null != c ? a = Sk.misceval.callsimArray(c, [a]) : null } ; Sk.builtin.complex.check_number_or_complex = function(a) { if (!Sk.builtin.checkNumber(a) && "complex" !== a.tp$name) throw new Sk.builtin.TypeError("unsupported operand type(s) for +: 'complex' and '" + Sk.abstr.typeName(a) + "'"); Sk.builtin.checkNumber(a) && (a = new Sk.builtin.complex(a)); return a } ; const a = /_[eE]|[eE]_|\._|_\.|[+-]_|_j|j_/ , b = /_(?=[^_])/g; Sk.builtin.complex.complex_subtype_from_string = function(c) { var d = 0 , e = 0 , h = !1; if (Sk.builtin.checkString(c)) c = Sk.ffi.remapToJs(c); else if ("string" !== typeof c) throw new TypeError("provided unsupported string-alike argument"); if (-1 !== c.indexOf("\x00") || 0 === c.length || "" === c) throw new Sk.builtin.ValueError("complex() arg is a malformed string"); var g = 0; c = c.replace(/inf|infinity/gi, "Infinity"); for (c = c.replace(/nan/gi, "NaN"); " " === c[g]; ) g++; if ("(" === c[g]) for (h = !0, g++; " " === c[g]; ) g++; if (-1 !== c.indexOf("_")) { if (a.test(c)) throw new Sk.builtin.ValueError("could not convert string to complex: '" + c + "'"); c = c.charAt(0) + c.substring(1).replace(b, "") } var f = /^(?:[+-]?(?:(?:(?:\d*\.\d+)|(?:\d+\.?))(?:[eE][+-]?\d+)?|NaN|Infinity))/; var k = c.substr(g); var n = k.match(f); if (null !== n) if (g += n[0].length, "j" === c[g] || "J" === c[g]) e = parseFloat(n[0]), g++; else if ("+" === c[g] || "-" === c[g]) { d = parseFloat(n[0]); n = c.substr(g).match(f); null !== n ? (e = parseFloat(n[0]), g += n[0].length) : (e = "+" === c[g] ? 1 : -1, g++); if ("j" !== c[g] && "J" !== c[g]) throw new Sk.builtin.ValueError("complex() arg is malformed string"); g++ } else d = parseFloat(n[0]); else n = n = k.match(/^([+-]?[jJ])/), null !== n && (e = 1 === n[0].length ? 1 : "+" === n[0][0] ? 1 : -1, g += n[0].length); for (; " " === c[g]; ) g++; if (h) { if (")" !== c[g]) throw new Sk.builtin.ValueError("complex() arg is malformed string"); for (g++; " " === c[g]; ) g++ } if (c.length !== g) throw new Sk.builtin.ValueError("complex() arg is malformed string"); return new Sk.builtin.complex(d,e) } ; Sk.builtin.complex.prototype.tp$hash = function() { return new Sk.builtin.int_(1000003 * this.imag + this.real) } ; Sk.builtin.complex.prototype.nb$add = function(a) { a = Sk.builtin.complex.check_number_or_complex(a); return new Sk.builtin.complex(this.real + a.real,this.imag + a.imag) } ; Sk.builtin.complex.prototype.nb$reflected_add = Sk.builtin.complex.prototype.nb$add; Sk.builtin.complex._c_diff = function(a, b) { return new Sk.builtin.complex(a.real - b.real,a.imag - b.imag) } ; Sk.builtin.complex.prototype.nb$subtract = function(a) { var c = Sk.builtin.complex.check_number_or_complex(this); a = Sk.builtin.complex.check_number_or_complex(a); return Sk.builtin.complex._c_diff(c, a) } ; Sk.builtin.complex.prototype.nb$reflected_subtract = function(a) { return this.nb$negative().nb$add(a) } ; Sk.builtin.complex.prototype.nb$multiply = function(a) { a = Sk.builtin.complex.check_number_or_complex(a); return new Sk.builtin.complex(this.real * a.real - this.imag * a.imag,this.real * a.imag + this.imag * a.real) } ; Sk.builtin.complex.prototype.nb$reflected_multiply = Sk.builtin.complex.prototype.nb$multiply; Sk.builtin.complex.prototype.nb$divide = function(a) { a = Sk.builtin.complex.check_number_or_complex(a); var c = a.real; var b = a.imag; a = this.real; var h = this.imag; var g = Math.abs(c); var f = Math.abs(b); if (g >= f) { if (0 === g) throw new Sk.builtin.ZeroDivisionError("complex division by zero"); g = b / c; f = c + b * g; c = (a + h * g) / f; a = (h - a * g) / f } else f >= g ? (g = c / b, f = c * g + b, Sk.asserts.assert(0 !== b), c = (a * g + h) / f, a = (h * g - a) / f) : a = c = NaN; return new Sk.builtin.complex(c,a) } ; Sk.builtin.complex.prototype.nb$reflected_divide = function(a) { a = Sk.builtin.complex.check_number_or_complex(a); return a.nb$divide(this) } ; Sk.builtin.complex.prototype.nb$floor_divide = function(a) { throw new Sk.builtin.TypeError("can't take floor of complex number."); } ; Sk.builtin.complex.prototype.nb$remainder = function(a) { throw new Sk.builtin.TypeError("can't mod complex numbers."); } ; Sk.builtin.complex.prototype.nb$power = function(a, b) { if (null != b && !Sk.builtin.checkNone(b)) throw new Sk.builtin.ValueError("complex modulo"); b = Sk.builtin.complex.check_number_or_complex(a); a = b.real | 0; return 0 === b.imag && b.real === a ? Sk.builtin.complex.c_powi(this, a) : Sk.builtin.complex.c_pow(this, b) } ; Sk.builtin.complex.c_pow = function(a, b) { var c = b.real; b = b.imag; var d = a.real; var g = a.imag; if (0 === c && 0 === b) b = 1, a = 0; else if (0 === d && 0 === g) { if (0 !== b || 0 > c) throw new Sk.builtin.ZeroDivisionError("complex division by zero"); a = b = 0 } else { var f = Math.hypot(d, g); a = Math.pow(f, c); d = Math.atan2(g, d); c *= d; 0 !== b && (a /= Math.exp(d * b), c += b * Math.log(f)); b = a * Math.cos(c); a *= Math.sin(c) } return new Sk.builtin.complex(b,a) } ; Sk.builtin.complex.c_powi = function(a, b) { return 100 < b || -100 > b ? (b = new Sk.builtin.complex(b,0), Sk.builtin.complex.c_pow(a, b)) : 0 < b ? Sk.builtin.complex.c_powu(a, b) : (new Sk.builtin.complex(1,0)).nb$divide(Sk.builtin.complex.c_powu(a, -b)) } ; Sk.builtin.complex.c_powu = function(a, b) { var c, d = 1; for (c = new Sk.builtin.complex(1,0); 0 < d && b >= d; ) b & d && (c = c.nb$multiply(a)), d <<= 1, a = a.nb$multiply(a); return c } ; Sk.builtin.complex.prototype.nb$inplace_add = Sk.builtin.complex.prototype.nb$add; Sk.builtin.complex.prototype.nb$inplace_subtract = Sk.builtin.complex.prototype.nb$subtract; Sk.builtin.complex.prototype.nb$inplace_multiply = Sk.builtin.complex.prototype.nb$multiply; Sk.builtin.complex.prototype.nb$inplace_divide = Sk.builtin.complex.prototype.nb$divide; Sk.builtin.complex.prototype.nb$inplace_remainder = Sk.builtin.complex.prototype.nb$remainder; Sk.builtin.complex.prototype.nb$inplace_floor_divide = Sk.builtin.complex.prototype.nb$floor_divide; Sk.builtin.complex.prototype.nb$inplace_power = Sk.builtin.complex.prototype.nb$power; Sk.builtin.complex.prototype.nb$negative = function() { return new Sk.builtin.complex(-this.real,-this.imag) } ; Sk.builtin.complex.prototype.nb$positive = function() { return Sk.builtin.complex.check_number_or_complex(this) } ; Sk.builtin.complex._complex_check = function(a) { return void 0 === a ? !1 : a instanceof Sk.builtin.complex ? !0 : !1 } ; Sk.builtin.complex.prototype.tp$richcompare = function(a, b) { if ("Eq" !== b && "NotEq" !== b) { if (Sk.builtin.checkNumber(a) || Sk.builtin.complex._complex_check(a)) throw new Sk.builtin.TypeError("no ordering relation is defined for complex numbers"); return Sk.builtin.NotImplemented.NotImplemented$ } var c = Sk.builtin.complex.check_number_or_complex(this); var d = c.real; c = c.imag; if (Sk.builtin.checkInt(a)) { if (0 === c) return a = Sk.misceval.richCompareBool(new Sk.builtin.float_(d), a, b), b = new Sk.builtin.bool(a); a = !1 } else if (Sk.builtin.checkFloat(a)) a = d === Sk.builtin.float_.PyFloat_AsDouble(a) && 0 === c; else if (Sk.builtin.complex._complex_check(a)) { var g = a.imag; a = d === a.real && c === g } else return Sk.builtin.NotImplemented.NotImplemented$; "NotEq" === b && (a = !a); return b = new Sk.builtin.bool(a) } ; Sk.builtin.complex.prototype.__eq__ = function(a, b) { return Sk.builtin.complex.prototype.tp$richcompare.call(a, b, "Eq") } ; Sk.builtin.complex.prototype.__ne__ = function(a, b) { return Sk.builtin.complex.prototype.tp$richcompare.call(a, b, "NotEq") } ; Sk.builtin.complex.prototype.__lt__ = function(a, b) { throw new Sk.builtin.TypeError("unorderable types: " + Sk.abstr.typeName(a) + " < " + Sk.abstr.typeName(b)); } ; Sk.builtin.complex.prototype.__le__ = function(a, b) { throw new Sk.builtin.TypeError("unorderable types: " + Sk.abstr.typeName(a) + " <= " + Sk.abstr.typeName(b)); } ; Sk.builtin.complex.prototype.__gt__ = function(a, b) { throw new Sk.builtin.TypeError("unorderable types: " + Sk.abstr.typeName(a) + " > " + Sk.abstr.typeName(b)); } ; Sk.builtin.complex.prototype.__ge__ = function(a, b) { throw new Sk.builtin.TypeError("unorderable types: " + Sk.abstr.typeName(a) + " >= " + Sk.abstr.typeName(b)); } ; Sk.builtin.complex.prototype.__float__ = function(a) { throw new Sk.builtin.TypeError("can't convert complex to float"); } ; Sk.builtin.complex.prototype.__int__ = function(a) { throw new Sk.builtin.TypeError("can't convert complex to int"); } ; Sk.builtin.complex.prototype.$internalGenericGetAttr = Sk.builtin.object.prototype.GenericGetAttr; Sk.builtin.complex.prototype.tp$getattr = function(a) { return a === Sk.builtin.str.$real || a === Sk.builtin.str.$imag ? new Sk.builtin.float_(this[a.$jsstr()]) : this.$internalGenericGetAttr(a) } ; Sk.builtin.complex.prototype.tp$setattr = function(a, b) { if (a === Sk.builtin.str.$real || a === Sk.builtin.str.$imag) throw new Sk.builtin.AttributeError("readonly attribute"); return Sk.builtin.object.prototype.tp$setattr.call(this, a, b) } ; Sk.builtin.complex.complex_format = function(a, b, e) { if (null == a || !Sk.builtin.complex._complex_check(a)) throw Error("Invalid internal method call: Sk.complex.complex_format() called with invalid value type."); var c, d, f = c = ""; if (d = 0 === a.real) d = a.real, d = 1 == (d ? 0 > d ? -1 : 1 : 0 > 1 / d ? -1 : 1); d ? (d = "", b = Sk.builtin.complex.PyOS_double_to_string(a.imag, e, b, 0, null)) : (d = c = Sk.builtin.complex.PyOS_double_to_string(a.real, e, b, 0, null), b = Sk.builtin.complex.PyOS_double_to_string(a.imag, e, b, Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_SIGN, null), 0 === a.imag && -Infinity === 1 / a.imag && b && "-" !== b[0] && (b = "-" + b), c = "(", f = ")"); return new Sk.builtin.str("" + c + d + b + "j" + f) } ; Sk.builtin.complex.prototype.$r = function() { return Sk.builtin.complex.complex_format(this, null, "g") } ; Sk.builtin.complex.prototype.tp$str = function() { return Sk.builtin.complex.complex_format(this, null, "g") } ; Sk.builtin.complex.prototype.int$format = function(a, b) { if (null == b) return null; if (Sk.builtin.checkString(b)) return a = Sk.builtin.complex._PyComplex_FormatAdvanced(a, b); throw new Sk.builtin.TypeError("__format__ requires str or unicode"); } ; Sk.builtin.complex.prototype.int$format.co_name = new Sk.builtin.str("__format__"); Sk.builtin.complex.prototype.__format__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$format); Sk.builtin.complex._PyComplex_FormatAdvanced = function(a, b) { throw new Sk.builtin.NotImplementedError("__format__ is not implemented for complex type."); } ; Sk.builtin.complex._is_finite = function(a) { return !isNaN(a) && Infinity !== a && -Infinity !== a } ; Sk.builtin.complex._is_infinity = function(a) { return Infinity === a || -Infinity === a } ; Sk.builtin.complex.prototype.nb$abs = function() { var a = this.real; var b = this.imag; if (!Sk.builtin.complex._is_finite(a) || !Sk.builtin.complex._is_finite(b)) return Sk.builtin.complex._is_infinity(a) ? (a = Math.abs(a), new Sk.builtin.float_(a)) : Sk.builtin.complex._is_infinity(b) ? (a = Math.abs(b), new Sk.builtin.float_(a)) : new Sk.builtin.float_(NaN); a = Math.hypot(a, b); if (!Sk.builtin.complex._is_finite(a)) throw new Sk.builtin.OverflowError("absolute value too large"); return new Sk.builtin.float_(a) } ; Sk.builtin.complex.prototype.__abs__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__abs__", arguments.length, 0, 0, !1, !0); return a.nb$abs() } ); Sk.builtin.complex.prototype.int$bool = function(a) { return new Sk.builtin.bool(a.real || a.imag) } ; Sk.builtin.complex.prototype.int$bool.co_name = new Sk.builtin.str("__bool__"); Sk.builtin.complex.prototype.__bool__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$bool); Sk.builtin.complex.prototype.int$truediv = function(a, b) { Sk.builtin.pyCheckArgsLen("__truediv__", arguments.length, 1, 1, !0); return a.nb$divide.call(a, b) } ; Sk.builtin.complex.prototype.int$truediv.co_name = new Sk.builtin.str("__truediv__"); Sk.builtin.complex.prototype.__truediv__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$truediv); Sk.builtin.complex.prototype.int$hash = function(a) { Sk.builtin.pyCheckArgsLen("__hash__", arguments.length, 0, 0, !0); return a.tp$hash.call(a) } ; Sk.builtin.complex.prototype.int$hash.co_name = new Sk.builtin.str("__hash__"); Sk.builtin.complex.prototype.__hash__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$hash); Sk.builtin.complex.prototype.int$add = function(a, b) { Sk.builtin.pyCheckArgsLen("__add__", arguments.length, 1, 1, !0); return a.nb$add.call(a, b) } ; Sk.builtin.complex.prototype.int$add.co_name = new Sk.builtin.str("__add__"); Sk.builtin.complex.prototype.__add__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$add); Sk.builtin.complex.prototype.int$repr = function(a) { Sk.builtin.pyCheckArgsLen("__repr__", arguments.length, 0, 0, !0); return a.r$.call(a) } ; Sk.builtin.complex.prototype.int$repr.co_name = new Sk.builtin.str("__repr__"); Sk.builtin.complex.prototype.__repr__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$repr); Sk.builtin.complex.prototype.int$str = function(a) { Sk.builtin.pyCheckArgsLen("__str__", arguments.length, 0, 0, !0); return a.tp$str.call(a) } ; Sk.builtin.complex.prototype.int$str.co_name = new Sk.builtin.str("__str__"); Sk.builtin.complex.prototype.__str__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$str); Sk.builtin.complex.prototype.int$sub = function(a, b) { Sk.builtin.pyCheckArgsLen("__sub__", arguments.length, 1, 1, !0); return a.nb$subtract.call(a, b) } ; Sk.builtin.complex.prototype.int$sub.co_name = new Sk.builtin.str("__sub__"); Sk.builtin.complex.prototype.__sub__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$sub); Sk.builtin.complex.prototype.int$mul = function(a, b) { Sk.builtin.pyCheckArgsLen("__mul__", arguments.length, 1, 1, !0); return a.nb$multiply.call(a, b) } ; Sk.builtin.complex.prototype.int$mul.co_name = new Sk.builtin.str("__mul__"); Sk.builtin.complex.prototype.__mul__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$mul); Sk.builtin.complex.prototype.int$div = function(a, b) { Sk.builtin.pyCheckArgsLen("__div__", arguments.length, 1, 1, !0); return a.nb$divide.call(a, b) } ; Sk.builtin.complex.prototype.int$div.co_name = new Sk.builtin.str("__div__"); Sk.builtin.complex.prototype.__div__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$div); Sk.builtin.complex.prototype.int$floordiv = function(a, b) { Sk.builtin.pyCheckArgsLen("__floordiv__", arguments.length, 1, 1, !0); return a.nb$floor_divide.call(a, b) } ; Sk.builtin.complex.prototype.int$floordiv.co_name = new Sk.builtin.str("__floordiv__"); Sk.builtin.complex.prototype.__floordiv__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$floordiv); Sk.builtin.complex.prototype.int$mod = function(a, b) { Sk.builtin.pyCheckArgsLen("__mod__", arguments.length, 1, 1, !0); return a.nb$remainder.call(a, b) } ; Sk.builtin.complex.prototype.int$mod.co_name = new Sk.builtin.str("__mod__"); Sk.builtin.complex.prototype.__mod__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$mod); Sk.builtin.complex.prototype.int$pow = function(a, b, e) { Sk.builtin.pyCheckArgsLen("__pow__", arguments.length, 1, 2, !0); return a.nb$power.call(a, b, e) } ; Sk.builtin.complex.prototype.int$pow.co_name = new Sk.builtin.str("__pow__"); Sk.builtin.complex.prototype.__pow__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$pow); Sk.builtin.complex.prototype.int$neg = function(a) { Sk.builtin.pyCheckArgsLen("__neg__", arguments.length, 0, 0, !0); return a.nb$negative.call(a) } ; Sk.builtin.complex.prototype.__neg__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$neg); Sk.builtin.complex.prototype.int$pos = function(a) { Sk.builtin.pyCheckArgsLen("__pos__", arguments.length, 0, 0, !0); return a.nb$positive.call(a) } ; Sk.builtin.complex.prototype.int$pos.co_name = new Sk.builtin.str("__pos__"); Sk.builtin.complex.prototype.__pos__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$pos); Sk.builtin.complex.prototype.int$conjugate = function(a) { Sk.builtin.pyCheckArgsLen("conjugate", arguments.length, 0, 0, !0); return new Sk.builtin.complex(a.real,-a.imag) } ; Sk.builtin.complex.prototype.int$conjugate.co_name = new Sk.builtin.str("conjugate"); Sk.builtin.complex.prototype.conjugate = new Sk.builtin.func(Sk.builtin.complex.prototype.int$conjugate); Sk.builtin.complex.prototype.int$divmod = function(a, b) { Sk.builtin.pyCheckArgsLen("__divmod__", arguments.length, 1, 1, !0); var c = Sk.builtin.complex.check_number_or_complex(a); var d = Sk.builtin.complex.check_number_or_complex(b); var g = c.nb$divide.call(c, d); g.real = Math.floor(g.real); g.imag = 0; c = c.nb$subtract.call(c, d.nb$multiply.call(d, g)); return new Sk.builtin.tuple([g, c]) } ; Sk.builtin.complex.prototype.int$divmod.co_name = new Sk.builtin.str("__divmod__"); Sk.builtin.complex.prototype.__divmod__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$divmod); Sk.builtin.complex.prototype.int$getnewargs = function(a) { Sk.builtin.pyCheckArgsLen("__getnewargs__", arguments.length, 0, 0, !0); return new Sk.builtin.tuple([new Sk.builtin.float_(a.real), new Sk.builtin.float_(a.imag)]) } ; Sk.builtin.complex.prototype.int$getnewargs.co_name = new Sk.builtin.str("__getnewargs__"); Sk.builtin.complex.prototype.__getnewargs__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$getnewargs); Sk.builtin.complex.prototype.int$nonzero = function(a) { Sk.builtin.pyCheckArgsLen("__nonzero__", arguments.length, 0, 0, !0); return 0 !== a.real || 0 !== a.imag ? Sk.builtin.bool.true$ : Sk.builtin.bool.false$ } ; Sk.builtin.complex.prototype.int$nonzero.co_name = new Sk.builtin.str("__nonzero__"); Sk.builtin.complex.prototype.__nonzero__ = new Sk.builtin.func(Sk.builtin.complex.prototype.int$nonzero); Sk.builtin.complex.prototype.nb$bool = function() { return new Sk.builtin.bool(this.real || this.imag) } ; Sk.builtin.complex.prototype.nb$nonzero = function() { return new Sk.builtin.bool(this.real || this.imag) } ; Sk.exportSymbol("Sk.builtin.complex", Sk.builtin.complex); Sk.builtin.complex.PyOS_double_to_string = function(a, b, e, h, g) { g = !1; switch (b) { case "e": case "f": case "g": break; case "E": g = !0; b = "e"; break; case "F": g = !0; b = "f"; break; case "r": if (0 !== e) throw Error("Bad internall call"); e = 17; b = "g"; break; default: throw Error("Bad internall call"); } if (isNaN(a)) a = "nan"; else if (Infinity === a) a = "inf"; else if (-Infinity === a) a = "-inf"; else { h & Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_ADD_DOT_0 && (b = "g"); var c = "%" + (h & Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_ALT ? "#" : ""); null != e && (c = c + "." + e); c = new Sk.builtin.str(c + b); a = c.nb$remainder(new Sk.builtin.float_(a)); a = a.v } h & Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_SIGN && "-" !== a[0] && (a = "+" + a); g && (a = a.toUpperCase()); return a } ; Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_SIGN = 1; Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_ADD_DOT_0 = 2; Sk.builtin.complex.PyOS_double_to_string.Py_DTSF_ALT = 4; Sk.builtin.complex.PyOS_double_to_string.Py_DTST_FINITE = 0; Sk.builtin.complex.PyOS_double_to_string.Py_DTST_INFINITE = 1; Sk.builtin.complex.PyOS_double_to_string.Py_DTST_NAN = 2 } , function(m, p) { Sk.builtin.slice = function(a, b, c) { Sk.builtin.pyCheckArgsLen("slice", arguments.length, 1, 3, !1, !1); if (void 0 !== c && Sk.misceval.isIndex(c) && 0 === Sk.misceval.asIndex(c)) throw new Sk.builtin.ValueError("slice step cannot be zero"); if (!(this instanceof Sk.builtin.slice)) return new Sk.builtin.slice(a,b,c); void 0 === b && void 0 === c && (b = a, a = Sk.builtin.none.none$); void 0 === b && (b = Sk.builtin.none.none$); void 0 === c && (c = Sk.builtin.none.none$); this.start = a; this.stop = b; this.step = c; this.__class__ = Sk.builtin.slice; this.$d = new Sk.builtin.dict([Sk.builtin.slice$start, this.start, Sk.builtin.slice$stop, this.stop, Sk.builtin.slice$step, this.step]); return this } ; Sk.abstr.setUpInheritance("slice", Sk.builtin.slice, Sk.builtin.object); Sk.builtin.slice.prototype.$r = function() { var a = Sk.builtin.repr(this.start).v , b = Sk.builtin.repr(this.stop).v , c = Sk.builtin.repr(this.step).v; return new Sk.builtin.str("slice(" + a + ", " + b + ", " + c + ")") } ; Sk.builtin.slice.prototype.tp$richcompare = function(a, b) { if (!a.__class__ || a.__class__ != Sk.builtin.slice) return "Eq" === b ? !1 : "NotEq" === b ? !0 : Sk.__future__.python3 ? Sk.builtin.NotImplemented.NotImplemented$ : !1; var c = new Sk.builtin.tuple([this.start, this.stop, this.step]); a = new Sk.builtin.tuple([a.start, a.stop, a.step]); return c.tp$richcompare(a, b) } ; Sk.builtin.slice.prototype.slice_indices_ = function(a) { if (Sk.builtin.checkNone(this.start)) var b = null; else if (Sk.misceval.isIndex(this.start)) b = Sk.misceval.asIndex(this.start); else throw new Sk.builtin.TypeError("slice indices must be integers or None"); if (Sk.builtin.checkNone(this.stop)) var c = null; else if (Sk.misceval.isIndex(this.stop)) c = Sk.misceval.asIndex(this.stop); else throw new Sk.builtin.TypeError("slice indices must be integers or None"); if (Sk.builtin.checkNone(this.step)) var d = null; else if (Sk.misceval.isIndex(this.step)) d = Sk.misceval.asIndex(this.step); else throw new Sk.builtin.TypeError("slice indices must be integers or None"); null === d && (d = 1); 0 < d ? (null === b && (b = 0), null === c && (c = a), c > a && (c = a), 0 > b && (b = a + b, 0 > b && (b = 0)), 0 > c && (c = a + c)) : (null === b && (b = a - 1), b >= a && (b = a - 1), null === c ? c = -1 : 0 > c && (c = a + c, 0 > c && (c = -1)), 0 > b && (b = a + b)); return [b, c, d] } ; Sk.builtin.slice.prototype.indices = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("indices", arguments.length, 2, 2, !1, !1); b = Sk.builtin.asnum$(b); var c = a.slice_indices_(b); return new Sk.builtin.tuple([new Sk.builtin.int_(c[0]), new Sk.builtin.int_(c[1]), new Sk.builtin.int_(c[2])]) } ); Sk.builtin.slice.prototype.sssiter$ = function(a, b) { var c = this.slice_indices_(a) , d = c[0]; a = c[1]; c = c[2]; if (0 < c) for (; d < a; d += c) b(d); else for (; d > a; d += c) b(d) } ; Sk.builtin.slice$start = new Sk.builtin.str("start"); Sk.builtin.slice$stop = new Sk.builtin.str("stop"); Sk.builtin.slice$step = new Sk.builtin.str("step") } , function(m, p) { Sk.builtin.set = function(a) { var b; if (!(this instanceof Sk.builtin.set)) return Sk.builtin.pyCheckArgsLen("set", arguments.length, 0, 1), new Sk.builtin.set(a); this.set_reset_(); if (void 0 !== a) { var c = a; c.sk$asarray && (c = c.sk$asarray()); if ("[object Array]" === Object.prototype.toString.apply(c)) { var d = c.length; for (b = 0; b < d; b++) Sk.builtin.set.prototype.add.func_code(this, c[b]) } else if (Sk.builtin.checkIterable(c)) for (c = Sk.abstr.iter(c), b = c.tp$iternext(); void 0 !== b; b = c.tp$iternext()) Sk.builtin.set.prototype.add.func_code(this, b); else throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(a) + "' object is not iterable"); } return this } ; Sk.abstr.setUpInheritance("set", Sk.builtin.set, Sk.builtin.object); Sk.abstr.markUnhashable(Sk.builtin.set); Sk.builtin.set.prototype.__class__ = Sk.builtin.set; Sk.builtin.set.prototype.set_reset_ = function() { this.v = new Sk.builtin.dict([]) } ; Sk.builtin.set.prototype.$r = function() { var a, b = []; var c = Sk.abstr.iter(this); for (a = c.tp$iternext(); void 0 !== a; a = c.tp$iternext()) b.push(Sk.misceval.objectRepr(a).v); return Sk.__future__.python3 ? 0 === b.length ? new Sk.builtin.str("set()") : new Sk.builtin.str("{" + b.join(", ") + "}") : new Sk.builtin.str("set([" + b.join(", ") + "])") } ; Sk.builtin.set.prototype.sk$asarray = function() { return this.v.sk$asarray() } ; Sk.builtin.set.prototype.ob$eq = function(a) { return this === a ? Sk.builtin.bool.true$ : a instanceof Sk.builtin.set && Sk.builtin.set.prototype.sq$length.call(this) === Sk.builtin.set.prototype.sq$length.call(a) ? this.issubset.func_code(this, a) : Sk.builtin.bool.false$ } ; Sk.builtin.set.prototype.ob$ne = function(a) { return this === a ? Sk.builtin.bool.false$ : a instanceof Sk.builtin.set && Sk.builtin.set.prototype.sq$length.call(this) === Sk.builtin.set.prototype.sq$length.call(a) ? this.issubset.func_code(this, a).v ? Sk.builtin.bool.false$ : Sk.builtin.bool.true$ : Sk.builtin.bool.true$ } ; Sk.builtin.set.prototype.ob$lt = function(a) { return this === a || Sk.builtin.set.prototype.sq$length.call(this) >= Sk.builtin.set.prototype.sq$length.call(a) ? Sk.builtin.bool.false$ : this.issubset.func_code(this, a) } ; Sk.builtin.set.prototype.ob$le = function(a) { return this === a ? Sk.builtin.bool.true$ : Sk.builtin.set.prototype.sq$length.call(this) > Sk.builtin.set.prototype.sq$length.call(a) ? Sk.builtin.bool.false$ : this.issubset.func_code(this, a) } ; Sk.builtin.set.prototype.ob$gt = function(a) { return this === a || Sk.builtin.set.prototype.sq$length.call(this) <= Sk.builtin.set.prototype.sq$length.call(a) ? Sk.builtin.bool.false$ : this.issuperset.func_code(this, a) } ; Sk.builtin.set.prototype.ob$ge = function(a) { return this === a ? Sk.builtin.bool.true$ : Sk.builtin.set.prototype.sq$length.call(this) < Sk.builtin.set.prototype.sq$length.call(a) ? Sk.builtin.bool.false$ : this.issuperset.func_code(this, a) } ; Sk.builtin.set.prototype.nb$and = function(a) { if (Sk.__future__.python3 && !(a instanceof Sk.builtin.set)) throw new Sk.builtin.TypeError("unsupported operand type(s) for &: 'set' and '" + Sk.abstr.typeName(a) + "'"); return this.intersection.func_code(this, a) } ; Sk.builtin.set.prototype.nb$or = function(a) { if (Sk.__future__.python3 && !(a instanceof Sk.builtin.set)) throw new Sk.builtin.TypeError("unsupported operand type(s) for |: 'set' and '" + Sk.abstr.typeName(a) + "'"); return this.union.func_code(this, a) } ; Sk.builtin.set.prototype.nb$xor = function(a) { if (Sk.__future__.python3 && !(a instanceof Sk.builtin.set)) throw new Sk.builtin.TypeError("unsupported operand type(s) for ^: 'set' and '" + Sk.abstr.typeName(a) + "'"); return this.symmetric_difference.func_code(this, a) } ; Sk.builtin.set.prototype.nb$subtract = function(a) { if (Sk.__future__.python3 && !(a instanceof Sk.builtin.set)) throw new Sk.builtin.TypeError("unsupported operand type(s) for -: 'set' and '" + Sk.abstr.typeName(a) + "'"); return this.difference.func_code(this, a) } ; Sk.builtin.set.prototype.__iter__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__iter__", arguments.length, 0, 0, !1, !0); return new Sk.builtin.set_iter_(a) } ); Sk.builtin.set.prototype.tp$iter = function() { return new Sk.builtin.set_iter_(this) } ; Sk.builtin.set.prototype.sq$length = function() { return this.v.mp$length() } ; Sk.builtin.set.prototype.sq$contains = function(a) { return this.v.sq$contains(a) } ; Sk.builtin.set.prototype.isdisjoint = new Sk.builtin.func(function(a, b) { var c; Sk.builtin.pyCheckArgsLen("isdisjoint", arguments.length, 2, 2); if (!Sk.builtin.checkIterable(b)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(b) + "' object is not iterable"); var d = Sk.abstr.iter(a); for (c = d.tp$iternext(); void 0 !== c; c = d.tp$iternext()) if (c = Sk.abstr.sequenceContains(b, c)) return Sk.builtin.bool.false$; return Sk.builtin.bool.true$ } ); Sk.builtin.set.prototype.issubset = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("issubset", arguments.length, 2, 2); if (!Sk.builtin.checkIterable(b)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(b) + "' object is not iterable"); var c = a.sq$length(); var d = b.sq$length(); if (c > d) return Sk.builtin.bool.false$; c = Sk.abstr.iter(a); for (d = c.tp$iternext(); void 0 !== d; d = c.tp$iternext()) if (d = Sk.abstr.sequenceContains(b, d), !d) return Sk.builtin.bool.false$; return Sk.builtin.bool.true$ } ); Sk.builtin.set.prototype.issuperset = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("issuperset", arguments.length, 2, 2); return Sk.builtin.set.prototype.issubset.func_code(b, a) } ); Sk.builtin.set.prototype.union = new Sk.builtin.func(function(a) { var b; Sk.builtin.pyCheckArgsLen("union", arguments.length, 1); var c = Sk.builtin.set.prototype.copy.func_code(a); var d = [c]; for (b = 1; b < arguments.length; b++) d.push(arguments[b]); Sk.builtin.set.prototype.update.func_code.apply(null, d); return c } ); Sk.builtin.set.prototype.intersection = new Sk.builtin.func(function(a) { var b; Sk.builtin.pyCheckArgsLen("intersection", arguments.length, 1); var c = Sk.builtin.set.prototype.copy.func_code(a); var d = [c]; for (b = 1; b < arguments.length; b++) d.push(arguments[b]); Sk.builtin.set.prototype.intersection_update.func_code.apply(null, d); return c } ); Sk.builtin.set.prototype.difference = new Sk.builtin.func(function(a, b) { var c; Sk.builtin.pyCheckArgsLen("difference", arguments.length, 2); var d = Sk.builtin.set.prototype.copy.func_code(a); var e = [d]; for (c = 1; c < arguments.length; c++) e.push(arguments[c]); Sk.builtin.set.prototype.difference_update.func_code.apply(null, e); return d } ); Sk.builtin.set.prototype.symmetric_difference = new Sk.builtin.func(function(a, b) { var c; Sk.builtin.pyCheckArgsLen("symmetric_difference", arguments.length, 2, 2); var d = Sk.builtin.set.prototype.union.func_code(a, b); var e = Sk.abstr.iter(d); for (c = e.tp$iternext(); void 0 !== c; c = e.tp$iternext()) Sk.abstr.sequenceContains(a, c) && Sk.abstr.sequenceContains(b, c) && Sk.builtin.set.prototype.discard.func_code(d, c); return d } ); Sk.builtin.set.prototype.copy = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("copy", arguments.length, 1, 1); return new Sk.builtin.set(a) } ); Sk.builtin.set.prototype.update = new Sk.builtin.func(function(a, b) { var c, d; Sk.builtin.pyCheckArgsLen("update", arguments.length, 2); for (c = 1; c < arguments.length; c++) { var e = arguments[c]; if (!Sk.builtin.checkIterable(e)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(e) + "' object is not iterable"); e = Sk.abstr.iter(e); for (d = e.tp$iternext(); void 0 !== d; d = e.tp$iternext()) Sk.builtin.set.prototype.add.func_code(a, d) } return Sk.builtin.none.none$ } ); Sk.builtin.set.prototype.intersection_update = new Sk.builtin.func(function(a, b) { var c, d; Sk.builtin.pyCheckArgsLen("intersection_update", arguments.length, 2); for (c = 1; c < arguments.length; c++) if (!Sk.builtin.checkIterable(arguments[c])) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(arguments[c]) + "' object is not iterable"); var e = Sk.abstr.iter(a); for (d = e.tp$iternext(); void 0 !== d; d = e.tp$iternext()) for (c = 1; c < arguments.length; c++) if (!Sk.abstr.sequenceContains(arguments[c], d)) { Sk.builtin.set.prototype.discard.func_code(a, d); break } return Sk.builtin.none.none$ } ); Sk.builtin.set.prototype.difference_update = new Sk.builtin.func(function(a, b) { var c, d; Sk.builtin.pyCheckArgsLen("difference_update", arguments.length, 2); for (c = 1; c < arguments.length; c++) if (!Sk.builtin.checkIterable(arguments[c])) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(arguments[c]) + "' object is not iterable"); var e = Sk.abstr.iter(a); for (d = e.tp$iternext(); void 0 !== d; d = e.tp$iternext()) for (c = 1; c < arguments.length; c++) if (Sk.abstr.sequenceContains(arguments[c], d)) { Sk.builtin.set.prototype.discard.func_code(a, d); break } return Sk.builtin.none.none$ } ); Sk.builtin.set.prototype.symmetric_difference_update = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("symmetric_difference_update", arguments.length, 2, 2); var c = Sk.builtin.set.prototype.symmetric_difference.func_code(a, b); a.set_reset_(); Sk.builtin.set.prototype.update.func_code(a, c); return Sk.builtin.none.none$ } ); Sk.builtin.set.prototype.add = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("add", arguments.length, 2, 2); a.v.mp$ass_subscript(b, !0); return Sk.builtin.none.none$ } ); Sk.builtin.set.prototype.discard = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("discard", arguments.length, 2, 2); Sk.builtin.dict.prototype.pop.func_code(a.v, b, Sk.builtin.none.none$); return Sk.builtin.none.none$ } ); Sk.builtin.set.prototype.pop = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("pop", arguments.length, 1, 1); if (0 === a.sq$length()) throw new Sk.builtin.KeyError("pop from an empty set"); var b = Sk.abstr.iter(a).tp$iternext(); Sk.builtin.set.prototype.discard.func_code(a, b); return b } ); Sk.builtin.set.prototype.remove = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("remove", arguments.length, 2, 2); a.v.mp$del_subscript(b); return Sk.builtin.none.none$ } ); Sk.builtin.set.prototype.__contains__ = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("__contains__", arguments.length, 2, 2); return new Sk.builtin.bool(a.sq$contains(b)) } ); Sk.exportSymbol("Sk.builtin.set", Sk.builtin.set); Sk.builtin.set_iter_ = function(a) { if (!(this instanceof Sk.builtin.set_iter_)) return new Sk.builtin.set_iter_(a); var b = Sk.builtin.create_dict_iter_(a.v); b.$obj = a; b.$r = function() { return new Sk.builtin.str("") } ; return b } ; Sk.abstr.setUpInheritance("setiterator", Sk.builtin.set_iter_, Sk.builtin.object); Sk.builtin.set_iter_.prototype.__class__ = Sk.builtin.set_iter_; Sk.builtin.set_iter_.prototype.__iter__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__iter__", arguments.length, 0, 0, !0, !1); return a } ); Sk.builtin.set_iter_.prototype.next$ = function(a) { a = a.tp$iternext(); if (void 0 === a) throw new Sk.builtin.StopIteration; return a } } , function(m, p) { Sk.builtin.frozenset = function(a) { var b; if (!(this instanceof Sk.builtin.frozenset)) return Sk.builtin.pyCheckArgsLen("frozenset", arguments.length, 0, 1), new Sk.builtin.frozenset(a); this.frozenset_reset_(); if (void 0 !== a) { var c = a; c.sk$asarray && (c = c.sk$asarray()); if ("[object Array]" === Object.prototype.toString.apply(c)) { var d = c.length; for (b = 0; b < d; b++) this.v.mp$ass_subscript(c[b], !0) } else if (Sk.builtin.checkIterable(c)) for (c = Sk.abstr.iter(c), b = c.tp$iternext(); void 0 !== b; b = c.tp$iternext()) this.v.mp$ass_subscript(b, !0); else throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(a) + "' object is not iterable"); } return this } ; Sk.abstr.setUpInheritance("frozenset", Sk.builtin.frozenset, Sk.builtin.object); Sk.builtin.frozenset.prototype.__class__ = Sk.builtin.frozenset; Sk.builtin.frozenset.prototype.frozenset_reset_ = function() { this.v = new Sk.builtin.dict([]) } ; Sk.builtin.frozenset.prototype.$r = function() { var a, b = []; var c = Sk.abstr.iter(this); for (a = c.tp$iternext(); void 0 !== a; a = c.tp$iternext()) b.push(Sk.misceval.objectRepr(a).v); return Sk.__future__.python3 ? 0 === b.length ? new Sk.builtin.str("frozenset()") : new Sk.builtin.str("frozenset({" + b.join(", ") + "})") : new Sk.builtin.str("frozenset([" + b.join(", ") + "])") } ; Sk.builtin.frozenset.prototype.sk$asarray = function() { return this.v.sk$asarray() } ; Sk.builtin.frozenset.prototype.tp$hash = function() { let a = 1927868237; const b = this.sk$asarray(); a *= b.length + 1; for (let c = 0; c < b.length; c++) { const d = Sk.builtin.hash(b[c]).v; a ^= 3644798167 * (d ^ d << 16 ^ 89869747) } return this.$savedHash_ = a = new Sk.builtin.int_(69069 * a + 907133923) } ; Sk.builtin.frozenset.prototype.ob$eq = function(a) { return this === a ? Sk.builtin.bool.true$ : a instanceof Sk.builtin.frozenset && Sk.builtin.frozenset.prototype.sq$length.call(this) === Sk.builtin.frozenset.prototype.sq$length.call(a) ? this.issubset.func_code(this, a) : Sk.builtin.bool.false$ } ; Sk.builtin.frozenset.prototype.ob$ne = function(a) { return this === a ? Sk.builtin.bool.false$ : a instanceof Sk.builtin.frozenset && Sk.builtin.frozenset.prototype.sq$length.call(this) === Sk.builtin.frozenset.prototype.sq$length.call(a) ? this.issubset.func_code(this, a).v ? Sk.builtin.bool.false$ : Sk.builtin.bool.true$ : Sk.builtin.bool.true$ } ; Sk.builtin.frozenset.prototype.ob$lt = function(a) { return this === a || Sk.builtin.frozenset.prototype.sq$length.call(this) >= Sk.builtin.frozenset.prototype.sq$length.call(a) ? Sk.builtin.bool.false$ : this.issubset.func_code(this, a) } ; Sk.builtin.frozenset.prototype.ob$le = function(a) { return this === a ? Sk.builtin.bool.true$ : Sk.builtin.frozenset.prototype.sq$length.call(this) > Sk.builtin.frozenset.prototype.sq$length.call(a) ? Sk.builtin.bool.false$ : this.issubset.func_code(this, a) } ; Sk.builtin.frozenset.prototype.ob$gt = function(a) { return this === a || Sk.builtin.frozenset.prototype.sq$length.call(this) <= Sk.builtin.frozenset.prototype.sq$length.call(a) ? Sk.builtin.bool.false$ : this.issuperset.func_code(this, a) } ; Sk.builtin.frozenset.prototype.ob$ge = function(a) { return this === a ? Sk.builtin.bool.true$ : Sk.builtin.frozenset.prototype.sq$length.call(this) < Sk.builtin.frozenset.prototype.sq$length.call(a) ? Sk.builtin.bool.false$ : this.issuperset.func_code(this, a) } ; Sk.builtin.frozenset.prototype.nb$and = function(a) { if (Sk.__future__.python3 && !(a instanceof Sk.builtin.frozenset)) throw new Sk.builtin.TypeError("unsupported operand type(s) for &: 'frozenset' and '" + Sk.abstr.typeName(a) + "'"); return this.intersection.func_code(this, a) } ; Sk.builtin.frozenset.prototype.nb$or = function(a) { if (Sk.__future__.python3 && !(a instanceof Sk.builtin.frozenset)) throw new Sk.builtin.TypeError("unsupported operand type(s) for |: 'frozenset' and '" + Sk.abstr.typeName(a) + "'"); return this.union.func_code(this, a) } ; Sk.builtin.frozenset.prototype.nb$xor = function(a) { if (Sk.__future__.python3 && !(a instanceof Sk.builtin.frozenset)) throw new Sk.builtin.TypeError("unsupported operand type(s) for ^: 'frozenset' and '" + Sk.abstr.typeName(a) + "'"); return this.symmetric_difference.func_code(this, a) } ; Sk.builtin.frozenset.prototype.nb$subtract = function(a) { if (Sk.__future__.python3 && !(a instanceof Sk.builtin.frozenset)) throw new Sk.builtin.TypeError("unsupported operand type(s) for -: 'frozenset' and '" + Sk.abstr.typeName(a) + "'"); return this.difference.func_code(this, a) } ; Sk.builtin.frozenset.prototype.__iter__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__iter__", arguments.length, 0, 0, !1, !0); return new Sk.builtin.set_iter_(a) } ); Sk.builtin.frozenset.prototype.tp$iter = function() { return new Sk.builtin.set_iter_(this) } ; Sk.builtin.frozenset.prototype.sq$length = function() { return this.v.mp$length() } ; Sk.builtin.frozenset.prototype.sq$contains = function(a) { return this.v.sq$contains(a) } ; Sk.builtin.frozenset.prototype.isdisjoint = new Sk.builtin.func(function(a, b) { var c; Sk.builtin.pyCheckArgsLen("isdisjoint", arguments.length, 2, 2); if (!Sk.builtin.checkIterable(b)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(b) + "' object is not iterable"); var d = Sk.abstr.iter(a); for (c = d.tp$iternext(); void 0 !== c; c = d.tp$iternext()) if (c = Sk.abstr.sequenceContains(b, c)) return Sk.builtin.bool.false$; return Sk.builtin.bool.true$ } ); Sk.builtin.frozenset.prototype.issubset = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("issubset", arguments.length, 2, 2); if (!Sk.builtin.checkIterable(b)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(b) + "' object is not iterable"); var c = a.sq$length(); var d = b.sq$length(); if (c > d) return Sk.builtin.bool.false$; c = Sk.abstr.iter(a); for (d = c.tp$iternext(); void 0 !== d; d = c.tp$iternext()) if (d = Sk.abstr.sequenceContains(b, d), !d) return Sk.builtin.bool.false$; return Sk.builtin.bool.true$ } ); Sk.builtin.frozenset.prototype.issuperset = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("issuperset", arguments.length, 2, 2); return Sk.builtin.frozenset.prototype.issubset.func_code(b, a) } ); Sk.builtin.frozenset.prototype.union = new Sk.builtin.func(function(a) { var b; Sk.builtin.pyCheckArgsLen("union", arguments.length, 1); var c = Sk.builtin.frozenset.prototype.copy.func_code(a); var d = [c]; for (b = 1; b < arguments.length; b++) d.push(arguments[b]); var e; for (b = 0; b < d.length; b++) { var h = d[b]; if (!Sk.builtin.checkIterable(h)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(h) + "' object is not iterable"); h = Sk.abstr.iter(h); for (e = h.tp$iternext(); void 0 !== e; e = h.tp$iternext()) c.v.mp$ass_subscript(e, !0) } return c } ); Sk.builtin.frozenset.prototype.intersection = new Sk.builtin.func(function(a) { var b; Sk.builtin.pyCheckArgsLen("intersection", arguments.length, 1); var c = Sk.builtin.frozenset.prototype.copy.func_code(a); var d = [c]; for (b = 1; b < arguments.length; b++) d.push(arguments[b]); var e; for (b = 1; b < arguments.length; b++) if (!Sk.builtin.checkIterable(arguments[b])) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(arguments[b]) + "' object is not iterable"); d = Sk.abstr.iter(a); for (e = d.tp$iternext(); void 0 !== e; e = d.tp$iternext()) for (b = 1; b < arguments.length; b++) if (!Sk.abstr.sequenceContains(arguments[b], e)) { Sk.builtin.dict.prototype.pop.func_code(c.v, e, Sk.builtin.none.none$); break } return c } ); Sk.builtin.frozenset.prototype.difference = new Sk.builtin.func(function(a, b) { var c; Sk.builtin.pyCheckArgsLen("difference", arguments.length, 2); var d = Sk.builtin.frozenset.prototype.copy.func_code(a); var e = [d]; for (c = 1; c < arguments.length; c++) e.push(arguments[c]); var h; for (c = 1; c < arguments.length; c++) if (!Sk.builtin.checkIterable(arguments[c])) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(arguments[c]) + "' object is not iterable"); e = Sk.abstr.iter(a); for (h = e.tp$iternext(); void 0 !== h; h = e.tp$iternext()) for (c = 1; c < arguments.length; c++) if (Sk.abstr.sequenceContains(arguments[c], h)) { Sk.builtin.dict.prototype.pop.func_code(d.v, h, Sk.builtin.none.none$); break } return d } ); Sk.builtin.frozenset.prototype.symmetric_difference = new Sk.builtin.func(function(a, b) { var c; Sk.builtin.pyCheckArgsLen("symmetric_difference", arguments.length, 2, 2); var d = Sk.builtin.frozenset.prototype.union.func_code(a, b); var e = Sk.abstr.iter(d); for (c = e.tp$iternext(); void 0 !== c; c = e.tp$iternext()) Sk.abstr.sequenceContains(a, c) && Sk.abstr.sequenceContains(b, c) && Sk.builtin.dict.prototype.pop.func_code(d.v, c, Sk.builtin.none.none$); return d } ); Sk.builtin.frozenset.prototype.copy = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("copy", arguments.length, 1, 1); return new Sk.builtin.frozenset(a) } ); Sk.exportSymbol("Sk.builtin.frozenset", Sk.builtin.frozenset); Sk.builtin.frozenset.prototype.__contains__ = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("__contains__", arguments.length, 2, 2); return new Sk.builtin.bool(a.sq$contains(b)) } ) } , function(m, p) { m = function(a) { Sk.builtin.pyCheckArgsLen("print", arguments.length, 0, Infinity, !0, !1); var b = Array.prototype.slice.call(arguments, 1) , c = new Sk.builtin.dict(a); Sk.ffi.remapToJs(c); var d = { sep: " ", end: "\n", file: null }; var e = c.mp$lookup(new Sk.builtin.str("sep")); if (void 0 !== e) { var h = Sk.builtin.checkNone(e); if (Sk.builtin.checkString(e) || h) d.sep = h ? d.sep : Sk.ffi.remapToJs(e); else throw new Sk.builtin.TypeError("sep must be None or a string, not " + Sk.abstr.typeName(e)); } e = c.mp$lookup(new Sk.builtin.str("end")); if (void 0 !== e) if (h = Sk.builtin.checkNone(e), Sk.builtin.checkString(e) || h) d.end = h ? d.end : Sk.ffi.remapToJs(e); else throw new Sk.builtin.TypeError("end must be None or a string, not " + Sk.abstr.typeName(e)); e = c.mp$lookup(new Sk.builtin.str("file")); if (void 0 !== e) if ((h = Sk.builtin.checkNone(e)) || void 0 !== e.tp$getattr("write")) d.file = h ? d.file : e; else throw new Sk.builtin.AttributeError("'" + Sk.abstr.typeName(e) + "' object has no attribute 'write'"); var g = ""; for (c = 0; c < b.length; c++) g += (new Sk.builtin.str(b[c])).v, g += d.sep; 0 < b.length && 0 < d.sep.length && (g = g.substring(0, g.length - d.sep.length)); g += d.end; if (null !== d.file) Sk.misceval.callsimArray(d.file.write, [d.file, new Sk.builtin.str(g)]); else return Sk.misceval.chain(Sk.importModule("sys", !1, !0), function(a) { return Sk.misceval.callsimOrSuspendArray(a.$d.stdout.write, [a.$d.stdout, new Sk.builtin.str(g)]) }) } ; m.co_kwargs = !0; Sk.builtin.print = new Sk.builtin.func(m); Sk.builtin.print.__doc__ = new Sk.builtin.str("print(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n\nPrints the values to a stream, or to sys.stdout by default.\nOptional keyword arguments:\nfile: a file-like object (stream); defaults to the current sys.stdout.\nsep: string inserted between values, default a space.\nend: string appended after the last value, default a newline.\nflush: whether to forcibly flush the stream.") } , function(m, p) { Sk.builtin.module = function() {} ; Sk.exportSymbol("Sk.builtin.module", Sk.builtin.module); Sk.builtin.module.prototype.ob$type = Sk.builtin.type.makeIntoTypeObj("module", Sk.builtin.module); Sk.builtin.module.prototype.tp$getattr = Sk.builtin.object.prototype.GenericGetAttr; Sk.builtin.module.prototype.tp$setattr = Sk.builtin.object.prototype.GenericSetAttr; Sk.builtin.module.prototype.tp$name = "module"; Sk.builtin.module.prototype.$r = function() { let a = a=>{ a = this.tp$getattr(new Sk.builtin.str(a)); return Sk.builtin.repr(a || Sk.builtin.str.$emptystr).$jsstr() } ; return new Sk.builtin.str("") } } , function(m, p) { Sk.builtin.structseq_types = {}; Sk.builtin.make_structseq = function(a, b, c, d) { var e = a + "." + b , h = []; a = []; for (var g in c) h.push(g), a.push(c[g]); c = function(a) { Sk.builtin.pyCheckArgsLen(e, arguments.length, 1, 1); var b; if (!(this instanceof Sk.builtin.structseq_types[e])) { var c = Object.create(Sk.builtin.structseq_types[e].prototype); c.constructor.apply(c, arguments); return c } if (Array.isArray(a)) var d = a; else { d = []; c = Sk.abstr.iter(a); for (b = c.tp$iternext(); void 0 !== b; b = c.tp$iternext()) d.push(b); if (d.length != h.length) throw new Sk.builtin.TypeError(e + "() takes a " + h.length + "-sequence (" + d.length + "-sequence given)"); } Sk.builtin.tuple.call(this, d); this.__class__ = Sk.builtin.structseq_types[e] } ; Sk.builtin.structseq_types[e] = c; Sk.abstr.inherits(c, Sk.builtin.tuple); d && (c.prototype.__doc__ = d); c.prototype.tp$name = e; c.prototype.ob$type = Sk.builtin.type.makeIntoTypeObj(e, Sk.builtin.structseq_types[e]); c.prototype.ob$type.$d = new Sk.builtin.dict([]); c.prototype.ob$type.$d.mp$ass_subscript(Sk.builtin.type.basesStr_, new Sk.builtin.tuple([Sk.builtin.tuple])); c.prototype.__getitem__ = new Sk.builtin.func(function(a, b) { return Sk.builtin.tuple.prototype.mp$subscript.call(a, b) } ); c.prototype.__reduce__ = new Sk.builtin.func(function(a) { throw new Sk.builtin.Exception("__reduce__ is not implemented"); } ); c.prototype.$r = function() { var a; if (0 === this.v.length) return new Sk.builtin.str(e + "()"); var b = []; for (a = 0; a < this.v.length; ++a) b[a] = h[a] + "=" + Sk.misceval.objectRepr(this.v[a]).v; a = b.join(", "); 1 === this.v.length && (a += ","); return new Sk.builtin.str(e + "(" + a + ")") } ; c.prototype.tp$setattr = function(a, b) { throw new Sk.builtin.AttributeError("readonly property"); } ; c.prototype.tp$getattr = function(a) { var b = a.$jsstr(); b = h.indexOf(b); return 0 <= b ? this.v[b] : Sk.builtin.object.prototype.GenericGetAttr(a) } ; return c } ; Sk.exportSymbol("Sk.builtin.make_structseq", Sk.builtin.make_structseq) } , function(m, p) { Sk.builtin.generator = function(a, b, c, d, e) { var h; if (a) { if (!(this instanceof Sk.builtin.generator)) return new Sk.builtin.generator(a,b,c,d,e); this.func_code = a; this.func_globals = b || null; this.gi$running = !1; this.gi$resumeat = 0; this.gi$sentvalue = void 0; this.gi$locals = {}; this.gi$cells = {}; if (0 < c.length) for (b = 0; b < a.co_varnames.length; ++b) this.gi$locals[a.co_varnames[b]] = c[b]; if (void 0 !== e) for (h in e) d[h] = e[h]; this.func_closure = d; return this } } ; Sk.exportSymbol("Sk.builtin.generator", Sk.builtin.generator); Sk.abstr.setUpInheritance("generator", Sk.builtin.generator, Sk.builtin.object); Sk.builtin.generator.prototype.tp$iter = function() { return this } ; Sk.builtin.generator.prototype.tp$iternext = function(a, b) { var c = this; this.gi$running = !0; void 0 === b && (b = Sk.builtin.none.none$); this.gi$sentvalue = b; b = [this]; this.func_closure && b.push(this.func_closure); return function h(b) { if (b instanceof Sk.misceval.Suspension) { if (a) return new Sk.misceval.Suspension(h,b); b = Sk.misceval.retryOptionalSuspensionOrThrow(b) } c.gi$running = !1; Sk.asserts.assert(void 0 !== b); if (b !== Sk.builtin.none.none$) return c.gi$resumeat = b[0], b = b[1] }(this.func_code.apply(this.func_globals, b)) } ; Sk.builtin.generator.prototype.next$ = function(a) { return a.tp$iternext(!0) } ; Sk.builtin.generator.prototype.$r = function() { return new Sk.builtin.str("") } ; Sk.builtin.generator.prototype.send = new Sk.builtin.func(function(a, b) { return a.tp$iternext(!0, b) } ); Sk.builtin.makeGenerator = function(a, b) { var c, d = new Sk.builtin.generator(null,null,null); d.tp$iternext = a; for (c in b) b.hasOwnProperty(c) && (d[c] = b[c]); return d } ; Sk.exportSymbol("Sk.builtin.makeGenerator", Sk.builtin.makeGenerator) } , function(m, p) { Sk.builtin.file = function(a, b, c) { var d; if (!(this instanceof Sk.builtin.file)) return new Sk.builtin.file(a,b,c); this.mode = b; this.name = Sk.ffi.remapToJs(a); this.closed = !1; if ("/dev/stdout" === this.name) this.data$ = Sk.builtin.none.none$, this.fileno = 1; else if ("/dev/stdin" === this.name) this.fileno = 0; else if ("/dev/stderr" === this.name) this.fileno = 2; else { if (Sk.inBrowser) if (this.fileno = 10, c = document.getElementById(a.v), null == c) if ("w" == b.v || "a" == b.v) this.data$ = ""; else throw new Sk.builtin.IOError("[Errno 2] No such file or directory: '" + a.v + "'"); else "textarea" == c.nodeName.toLowerCase() ? this.data$ = c.value : this.data$ = c.textContent; else this.fileno = 11, this.data$ = Sk.read(a.v); this.lineList = this.data$.split("\n"); this.lineList = this.lineList.slice(0, -1); for (d in this.lineList) this.lineList[d] += "\n"; this.currentLine = 0 } this.pos$ = 0; this.__class__ = Sk.builtin.file; Sk.fileopen && 10 <= this.fileno && Sk.fileopen(this); return this } ; Sk.abstr.setUpInheritance("file", Sk.builtin.file, Sk.builtin.object); Sk.builtin.file.prototype.$r = function() { return new Sk.builtin.str("<" + (this.closed ? "closed" : "open") + "file '" + this.name + "', mode '" + Sk.ffi.remapToJs(this.mode) + "'>") } ; Sk.builtin.file.prototype.__enter__ = new Sk.builtin.func(function(a) { return a } ); Sk.builtin.file.prototype.__exit__ = new Sk.builtin.func(function(a) { return Sk.misceval.callsimArray(Sk.builtin.file.prototype.close, [a]) } ); Sk.builtin.file.prototype.tp$iter = function() { var a = { tp$iter: function() { return a }, $obj: this, $index: this.currentLine, $lines: this.lineList, tp$iternext: function() { if (!(a.$index >= a.$lines.length)) return new Sk.builtin.str(a.$lines[a.$index++]) } }; return a } ; Sk.builtin.file.prototype.close = new Sk.builtin.func(function(a) { a.closed = !0; return Sk.builtin.none.none$ } ); Sk.builtin.file.prototype.flush = new Sk.builtin.func(function(a) {} ); Sk.builtin.file.prototype.fileno = new Sk.builtin.func(function(a) { return this.fileno } ); Sk.builtin.file.prototype.isatty = new Sk.builtin.func(function(a) { return !1 } ); Sk.builtin.file.prototype.read = new Sk.builtin.func(function(a, b) { var c = a.data$.length; if (a.closed) throw new Sk.builtin.ValueError("I/O operation on closed file"); var d = void 0 === b ? c : Sk.ffi.remapToJs(b); d = new Sk.builtin.str(a.data$.substr(a.pos$, d)); a.pos$ = void 0 === b ? c : a.pos$ + Sk.ffi.remapToJs(b); a.pos$ >= c && (a.pos$ = c); return d } ); Sk.builtin.file.$readline = function(a, b, c) { if (0 === a.fileno) { a = Sk.ffi.remapToJs(c); a = Sk.inputfun(a ? a : ""); if (a instanceof Promise || a && "function" === typeof a.then) { var d = new Sk.misceval.Suspension; d.resume = function() { if (d.data.error) throw d.data.error; return new Sk.builtin.str(d.data.result) } ; d.data = { type: "Sk.promise", promise: a }; return d } return new Sk.builtin.str(a) } b = ""; a.currentLine < a.lineList.length && (b = a.lineList[a.currentLine], a.currentLine++); return new Sk.builtin.str(b) } ; Sk.builtin.file.prototype.readline = new Sk.builtin.func(function(a, b) { return Sk.builtin.file.$readline(a, b, void 0) } ); Sk.builtin.file.prototype.readlines = new Sk.builtin.func(function(a, b) { if (0 === a.fileno) return new Sk.builtin.NotImplementedError("readlines ins't implemented because the web doesn't support Ctrl+D"); var c = []; for (b = a.currentLine; b < a.lineList.length; b++) c.push(new Sk.builtin.str(a.lineList[b])); return new Sk.builtin.list(c) } ); Sk.builtin.file.prototype.seek = new Sk.builtin.func(function(a, b, c) { b = Sk.ffi.remapToJs(b); void 0 === c && (c = 0); 0 === c ? a.pos$ = b : 1 == c ? a.pos$ = a.data$.length + b : 2 == c && (a.pos$ = a.data$.length + b); return Sk.builtin.none.none$ } ); Sk.builtin.file.prototype.tell = new Sk.builtin.func(function(a) { return Sk.ffi.remapToPy(a.pos$) } ); Sk.builtin.file.prototype.truncate = new Sk.builtin.func(function(a, b) { Sk.asserts.fail() } ); Sk.builtin.file.prototype.write = new Sk.builtin.func(function(a, b) { var c = Sk.ffi.remapToJs(a.mode); if ("w" === c || "wb" === c || "a" === c || "ab" === c) if (Sk.filewrite) { if (a.closed) throw new Sk.builtin.ValueError("I/O operation on closed file"); 1 === a.fileno ? Sk.output(Sk.ffi.remapToJs(b)) : Sk.filewrite(a, b) } else 1 === a.fileno ? Sk.output(Sk.ffi.remapToJs(b)) : Sk.asserts.fail(); else throw new Sk.builtin.IOError("File not open for writing"); return Sk.builtin.none.none$ } ); Sk.exportSymbol("Sk.builtin.file", Sk.builtin.file) } , function(m, p) { Sk.ffi = Sk.ffi || {}; Sk.ffi.remapToPy = function(a) { var b; if (null === a || "undefined" === typeof a) return Sk.builtin.none.none$; if (a.ob$type) return a; if (a instanceof Sk.misceval.Suspension) return a; if ("[object Array]" === Object.prototype.toString.call(a)) { var c = []; for (b = 0; b < a.length; ++b) c.push(Sk.ffi.remapToPy(a[b])); return new Sk.builtin.list(c) } if ("object" === typeof a) { c = []; for (b in a) c.push(Sk.ffi.remapToPy(b)), c.push(Sk.ffi.remapToPy(a[b])); return new Sk.builtin.dict(c) } if ("string" === typeof a) return new Sk.builtin.str(a); if ("number" === typeof a) return Sk.builtin.assk$(a); if ("boolean" === typeof a) return new Sk.builtin.bool(a); if ("undefined" === typeof a) return Sk.builtin.none.none$; if ("function" === typeof a) return new Sk.builtin.func(a); Sk.asserts.fail("unhandled remap type " + typeof a) } ; Sk.exportSymbol("Sk.ffi.remapToPy", Sk.ffi.remapToPy); Sk.ffi.remapToJs = function(a) { var b; if (a instanceof Sk.builtin.dict) { var c = {}; var d = a.tp$iter(); for (b = d.tp$iternext(); void 0 !== b; b = d.tp$iternext()) { var e = a.mp$subscript(b); void 0 === e && (e = null); b = Sk.ffi.remapToJs(b); c[b] = Sk.ffi.remapToJs(e) } return c } if (a instanceof Sk.builtin.list || a instanceof Sk.builtin.tuple) { c = []; for (e = 0; e < a.v.length; ++e) c.push(Sk.ffi.remapToJs(a.v[e])); return c } if (a instanceof Sk.builtin.bool) return a.v ? !0 : !1; if (a instanceof Sk.builtin.int_) return Sk.builtin.asnum$(a); if (a instanceof Sk.builtin.float_) return Sk.builtin.asnum$(a); if (a instanceof Sk.builtin.lng) return Sk.builtin.asnum$(a); if ("number" === typeof a || "boolean" === typeof a || "string" === typeof a) return a; if (void 0 !== a) return a.v } ; Sk.exportSymbol("Sk.ffi.remapToJs", Sk.ffi.remapToJs); Sk.ffi.callback = function(a) { return void 0 === a ? a : function() { return Sk.misceval.apply(a, void 0, void 0, void 0, Array.prototype.slice.call(arguments, 0)) } } ; Sk.exportSymbol("Sk.ffi.callback", Sk.ffi.callback); Sk.ffi.stdwrap = function(a, b) { a = new a; a.v = b; return a } ; Sk.exportSymbol("Sk.ffi.stdwrap", Sk.ffi.stdwrap); Sk.ffi.basicwrap = function(a) { if (a instanceof Sk.builtin.int_) return Sk.builtin.asnum$(a); if (a instanceof Sk.builtin.float_) return Sk.builtin.asnum$(a); if (a instanceof Sk.builtin.lng) return Sk.builtin.asnum$(a); if ("number" === typeof a || "boolean" === typeof a) return a; if ("string" === typeof a) return new Sk.builtin.str(a); Sk.asserts.fail("unexpected type for basicwrap") } ; Sk.exportSymbol("Sk.ffi.basicwrap", Sk.ffi.basicwrap); Sk.ffi.unwrapo = function(a) { if (void 0 !== a) return a.v } ; Sk.exportSymbol("Sk.ffi.unwrapo", Sk.ffi.unwrapo); Sk.ffi.unwrapn = function(a) { return null === a ? null : a.v } ; Sk.exportSymbol("Sk.ffi.unwrapn", Sk.ffi.unwrapn) } , function(m, p) { Sk.builtin.iterator = function(a, b) { var c; if (a instanceof Sk.builtin.generator) return a; if (c = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$iter)) return Sk.misceval.callsimArray(c, [a]); this.sentinel = b; this.flag = !1; this.idx = 0; this.obj = a; void 0 === b ? (this.getitem = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$getitem), this.$r = function() { return new Sk.builtin.str("") } ) : (this.call = Sk.abstr.lookupSpecial(a, Sk.builtin.str.$call), this.$r = function() { return new Sk.builtin.str("") } ); return this } ; Sk.abstr.setUpInheritance("iterator", Sk.builtin.iterator, Sk.builtin.object); Sk.builtin.iterator.prototype.__class__ = Sk.builtin.iterator; Sk.builtin.iterator.prototype.__iter__ = new Sk.builtin.func(function(a) { return a.tp$iter() } ); Sk.builtin.iterator.prototype.tp$iter = function() { return this } ; Sk.builtin.iterator.prototype.tp$iternext = function(a) { var b = this; if (!0 !== this.flag) { if (this.getitem) { var c = Sk.misceval.tryCatch(function() { return Sk.misceval.callsimOrSuspendArray(b.getitem, [b.obj, Sk.ffi.remapToPy(b.idx++)]) }, function(a) { if (!(a instanceof Sk.builtin.StopIteration || a instanceof Sk.builtin.IndexError)) throw a; }); return a ? c : Sk.misceval.retryOptionalSuspensionOrThrow(c) } c = function(a) { if (Sk.misceval.richCompareBool(a, b.sentinel, "Eq")) b.flag = !0; else return a } ; c = this.call ? Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(this.call, [this.obj]), c) : Sk.misceval.chain(Sk.misceval.callsimOrSuspendArray(this.obj), c); return a ? c : Sk.misceval.retryOptionalSuspensionOrThrow(c) } } ; Sk.builtin.iterator.prototype.next$ = function(a) { a = a.tp$iternext(); if (!a) throw new Sk.builtin.StopIteration; return a } ; Sk.exportSymbol("Sk.builtin.iterator", Sk.builtin.iterator) } , function(m, p) { Sk.builtin.range_ = function(a, b, c, d) { if (!(this instanceof Sk.builtin.range_)) return new Sk.builtin.range_(a,b,c,d); this.v = d; this.$start = a; this.$stop = b; this.$step = c; this.$r = function() { var a = "range(" + this.$start + ", " + this.$stop; 1 != this.$step && (a += ", " + this.$step); return new Sk.builtin.str(a + ")") } ; return this } ; Sk.abstr.setUpInheritance("range", Sk.builtin.range_, Sk.builtin.object); Sk.builtin.range_.prototype.__class__ = Sk.builtin.range_; Sk.builtin.range_.prototype.mp$subscript = function(a) { var b = this.v.mp$subscript(a); if (b instanceof Sk.builtin.list) { if (Sk.builtin.checkNone(a.start)) var c = this.v.mp$subscript(new Sk.builtin.int_(0)).v; else try { c = this.v.mp$subscript(a.start).v } catch (e) { c = this.$start } try { var d = this.v.mp$subscript(a.stop).v } catch (e) { d = this.$stop } a = Sk.builtin.checkNone(a.step) ? 1 : Sk.misceval.asIndex(a.step); a *= this.$step; return new Sk.builtin.range_(c,d,a,b) } return b } ; Sk.builtin.range_.prototype.__getitem__ = new Sk.builtin.func(function(a, b) { return Sk.builtin.range_.prototype.mp$subscript.call(a, b) } ); Sk.builtin.range_.prototype.sq$contains = function(a) { return this.v.sq$contains(a) } ; Sk.builtin.range_.prototype.sq$length = function() { return this.v.sq$length() } ; Sk.builtin.range_.prototype.tp$richcompare = function(a, b) { a.__class__ == Sk.builtin.range_ && (a = a.v); return this.v.tp$richcompare(a, b) } ; Sk.builtin.range_.prototype.tp$iter = function() { var a = this.v.tp$iter(); a.$r = function() { return new Sk.builtin.str("") } ; return a } ; Sk.builtin.range_.prototype.__iter__ = new Sk.builtin.func(function(a) { Sk.builtin.pyCheckArgsLen("__iter__", arguments.length, 1, 1); return a.tp$iter() } ); Sk.builtin.range_.prototype.__contains__ = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("__contains__", arguments.length, 2, 2); return new Sk.builtin.bool(a.sq$contains(b)) } ); Sk.builtin.range_.prototype.index = new Sk.builtin.func(function(a, b, c, d) { Sk.builtin.pyCheckArgsLen("index", arguments.length, 2, 4); return Sk.misceval.callsimArray(a.v.index, [a.v, b, c, d]) } ); Sk.builtin.range_.prototype.count = new Sk.builtin.func(function(a, b) { Sk.builtin.pyCheckArgsLen("count", arguments.length, 2, 2); return Sk.misceval.callsimArray(a.v.count, [a.v, b]) } ) } , function(m, p) { Sk.builtin.enumerate = function(a, b) { if (!(this instanceof Sk.builtin.enumerate)) return new Sk.builtin.enumerate(a,b); Sk.builtin.pyCheckArgsLen("enumerate", arguments.length, 1, 2); if (!Sk.builtin.checkIterable(a)) throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(a) + "' object is not iterable"); if (void 0 !== b) if (Sk.misceval.isIndex(b)) b = Sk.misceval.asIndex(b); else throw new Sk.builtin.TypeError("'" + Sk.abstr.typeName(b) + "' object cannot be interpreted as an index"); else b = 0; var c = a.tp$iter(); this.tp$iter = function() { return this } ; this.$index = b; this.tp$iternext = function() { var a = c.tp$iternext(); if (void 0 !== a) { var b = new Sk.builtin.int_(this.$index++); return new Sk.builtin.tuple([b, a]) } } ; this.__class__ = Sk.builtin.enumerate; return this } ; Sk.abstr.setUpInheritance("enumerate", Sk.builtin.enumerate, Sk.builtin.object); Sk.builtin.enumerate.prototype.__iter__ = new Sk.builtin.func(function(a) { return a.tp$iter() } ); Sk.builtin.enumerate.prototype.next$ = function(a) { return a.tp$iternext() } ; Sk.builtin.enumerate.co_varnames = ["iterable", "start"]; Sk.builtin.enumerate.co_argcount = 2; Sk.builtin.enumerate.$defaults = [Sk.builtin.none.none$, 0]; Sk.builtin.enumerate.co_name = new Sk.builtin.str("enumerate"); Sk.builtin.enumerate.prototype.$r = function() { return new Sk.builtin.str("") } } , function(m, p) { Sk.builtin.filter_ = function(a, b) { var c, d; Sk.builtin.pyCheckArgsLen("filter_", arguments.length, 2, 2); if (!(this instanceof Sk.builtin.filter_)) return new Sk.builtin.filter_(a,b); var e = Sk.abstr.iter(b); var h = function(b) { c = a === Sk.builtin.none.none$ ? b : Sk.misceval.callsimArray(a, [b]); if (Sk.misceval.isTrue(c)) return c }; this.tp$iter = function() { return this } ; this.tp$iternext = function() { d = e.tp$iternext(); if (void 0 !== d) { for (c = h(d); void 0 === c; ) { d = e.tp$iternext(); if (void 0 === d) return; c = h(d) } return d } } ; this.__class__ = Sk.builtin.filter_; return this } ; Sk.abstr.setUpInheritance("filter", Sk.builtin.filter_, Sk.builtin.object); Sk.builtin.filter_.prototype.__iter__ = new Sk.builtin.func(function(a) { return a.tp$iter() } ); Sk.builtin.filter_.prototype.next$ = function(a) { return a.tp$iternext() } ; Sk.builtin.filter_.prototype.$r = function() { return new Sk.builtin.str("") } ; Sk.exportSymbol("Sk.builtin.filter_", Sk.builtin.filter_) } , function(m, p) { Sk.builtin.zip_ = function() { var a, b; if (!(this instanceof Sk.builtin.zip_)) return new Sk.builtin.zip_(...arguments); if (0 === arguments.length) return new Sk.builtin.zip_(new Sk.builtin.list([])); var c = []; for (a = 0; a < arguments.length; a++) try { c.push(Sk.abstr.iter(arguments[a])) } catch (d) { if (d instanceof Sk.builtin.TypeError) throw new Sk.builtin.TypeError("zip argument #" + (a + 1) + " must support iteration"); throw d; } this.tp$iter = function() { return this } ; this.tp$iternext = function() { var d = []; for (a = 0; a < c.length; a++) { b = c[a].tp$iternext(); if (void 0 === b) return; d.push(b) } return new Sk.builtin.tuple(d) } ; this.__class__ = Sk.builtin.zip_; return this } ; Sk.abstr.setUpInheritance("zip", Sk.builtin.zip_, Sk.builtin.object); Sk.builtin.zip_.prototype.__iter__ = new Sk.builtin.func(function(a) { return a.tp$iter() } ); Sk.builtin.zip_.prototype.next$ = function(a) { return a.tp$iternext() } ; Sk.builtin.zip_.prototype.$r = function() { return new Sk.builtin.str("") } ; Sk.exportSymbol("Sk.builtin.zip_", Sk.builtin.zip_) } , function(m, p) { Sk.builtin.map_ = function(a, b) { var c, d, e, h; Sk.builtin.pyCheckArgsLen("map_", arguments.length, 2); if (!(this instanceof Sk.builtin.map_)) { var g = Array.prototype.slice.apply(arguments).slice(1); return new Sk.builtin.map_(a,...g) } if (2 < arguments.length) { var f = Array.prototype.slice.apply(arguments).slice(1); for (d = 0; d < f.length; d++) f[d] = Sk.abstr.iter(f[d]); var k = function() { h = []; for (d = 0; d < f.length; d++) { c = f[d].tp$iternext(); if (void 0 === c) return; h.push(c) } return h } } else b = Sk.abstr.iter(b), k = function() { return b.tp$iternext() } ; this.tp$iternext = function() { e = k(); if (void 0 !== e) { if (a === Sk.builtin.none.none$) return e instanceof Array && (e = new Sk.builtin.tuple(e)), e; e instanceof Array || (e = [e]); return Sk.misceval.applyOrSuspend(a, void 0, void 0, void 0, e) } } ; this.tp$iter = function() { return this } ; this.__class__ = Sk.builtin.map_; return this } ; Sk.abstr.setUpInheritance("map", Sk.builtin.map_, Sk.builtin.object); Sk.builtin.map_.prototype.__iter__ = new Sk.builtin.func(function(a) { return a.tp$iter() } ); Sk.builtin.map_.prototype.next$ = function(a) { return a.tp$iternext() } ; Sk.builtin.map_.prototype.$r = function() { return new Sk.builtin.str("") } ; Sk.exportSymbol("Sk.builtin.map_", Sk.builtin.map_) } , function(m, p) { var a = { T_ENDMARKER: 0, T_NAME: 1, T_NUMBER: 2, T_STRING: 3, T_NEWLINE: 4, T_INDENT: 5, T_DEDENT: 6, T_LPAR: 7, T_RPAR: 8, T_LSQB: 9, T_RSQB: 10, T_COLON: 11, T_COMMA: 12, T_SEMI: 13, T_PLUS: 14, T_MINUS: 15, T_STAR: 16, T_SLASH: 17, T_VBAR: 18, T_AMPER: 19, T_LESS: 20, T_GREATER: 21, T_EQUAL: 22, T_DOT: 23, T_PERCENT: 24, T_LBRACE: 25, T_RBRACE: 26, T_EQEQUAL: 27, T_NOTEQUAL: 28, T_LESSEQUAL: 29, T_GREATEREQUAL: 30, T_TILDE: 31, T_CIRCUMFLEX: 32, T_LEFTSHIFT: 33, T_RIGHTSHIFT: 34, T_DOUBLESTAR: 35, T_PLUSEQUAL: 36, T_MINEQUAL: 37, T_STAREQUAL: 38, T_SLASHEQUAL: 39, T_PERCENTEQUAL: 40, T_AMPEREQUAL: 41, T_VBAREQUAL: 42, T_CIRCUMFLEXEQUAL: 43, T_LEFTSHIFTEQUAL: 44, T_RIGHTSHIFTEQUAL: 45, T_DOUBLESTAREQUAL: 46, T_DOUBLESLASH: 47, T_DOUBLESLASHEQUAL: 48, T_AT: 49, T_ATEQUAL: 50, T_RARROW: 51, T_ELLIPSIS: 52, T_OP: 53, T_AWAIT: 54, T_ASYNC: 55, T_ERRORTOKEN: 56, T_NT_OFFSET: 256, T_N_TOKENS: 60, T_COMMENT: 57, T_NL: 58, T_ENCODING: 59 }; m = { "!=": a.NOTEQUAL, "%": a.PERCENT, "%=": a.PERCENTEQUAL, "&": a.AMPER, "&=": a.AMPEREQUAL, "(": a.LPAR, ")": a.RPAR, "*": a.STAR, "**": a.DOUBLESTAR, "**=": a.DOUBLESTAREQUAL, "*=": a.STAREQUAL, "+": a.PLUS, "+=": a.PLUSEQUAL, ",": a.COMMA, "-": a.MINUS, "-=": a.MINEQUAL, "->": a.RARROW, ".": a.DOT, "...": a.ELLIPSIS, "/": a.SLASH, "//": a.DOUBLESLASH, "//=": a.DOUBLESLASHEQUAL, "/=": a.SLASHEQUAL, ":": a.COLON, ":=": a.COLONEQUAL, ";": a.SEMI, "<": a.LESS, "<<": a.LEFTSHIFT, "<<=": a.LEFTSHIFTEQUAL, "<=": a.LESSEQUAL, "=": a.EQUAL, "==": a.EQEQUAL, ">": a.GREATER, ">=": a.GREATEREQUAL, ">>": a.RIGHTSHIFT, ">>=": a.RIGHTSHIFTEQUAL, "@": a.AT, "@=": a.ATEQUAL, "[": a.LSQB, "]": a.RSQB, "^": a.CIRCUMFLEX, "^=": a.CIRCUMFLEXEQUAL, "{": a.LBRACE, "|": a.VBAR, "|=": a.VBAREQUAL, "}": a.RBRACE, "~": a.TILDE }; var b = {}; (function() { for (var c in a) b[a[c]] = c } )(); ["tok_name", "ISTERMINAL", "ISNONTERMINAL", "ISEOF"].concat(Object.keys(b).map(function(a) { return b[a] })); Sk.token = {}; Sk.token.tokens = a; Sk.token.tok_name = b; Sk.token.EXACT_TOKEN_TYPES = m; Sk.token.ISTERMINAL = function(b) { return b < a.T_NT_OFFSET } ; Sk.token.ISNONTERMINAL = function(b) { return b >= a.T_NT_OFFSET } ; Sk.token.ISEOF = function(b) { return b == a.T_ENDMARKER } ; Sk.exportSymbol("Sk.token", Sk.token); Sk.exportSymbol("Sk.token.tokens", Sk.token.tokens); Sk.exportSymbol("Sk.token.tok_name", Sk.token.tok_name); Sk.exportSymbol("Sk.token.EXACT_TOKEN_TYPES"); Sk.exportSymbol("Sk.token.ISTERMINAL", Sk.token.ISTERMINAL); Sk.exportSymbol("Sk.token.ISNONTERMINAL", Sk.token.ISNONTERMINAL); Sk.exportSymbol("Sk.token.ISEOF", Sk.token.ISEOF) } , function(m, p) { function a(a, b, c, d, f) { this.type = a; this.string = b; this.start = c; this.end = d; this.line = f } function b(a) { return "(" + Array.prototype.slice.call(arguments).join("|") + ")" } function c(a) { return b.apply(null, arguments) + "?" } function d(a, b) { for (var c = a.length; c--; ) if (a[c] === b) return !0; return !1 } function e() { return " FR RF Br BR Fr r B R b bR f rb rB F Rf U rF u RB br fR fr rf Rb".split(" ") } var h = Sk.token.tokens; const g = Sk.builtin.SyntaxError , f = Sk.builtin.SyntaxError; a.prototype.exact_type = function() { return this.type == h.T_OP && this.string in Sk.token.EXACT_TOKEN_TYPES ? Sk.token.EXACT_TOKEN_TYPES[this.string] : this.type } ; var k = /[\\^$.*+?()[\]{}|]/g , n = RegExp(k.source); const l = function() { var a = b("[A-Z]", "[a-z]", "[\\u{10B99}-\\u{10B9C}\\u{112A9}\\u{115DC}-\\u{115DD}\\u034F\\u115F-\\u1160\\u17B4-\\u17B5\\u2065\\u3164\\uFFA0\\uFFF0-\\uFFF8\\u{E0000}\\u{E0002}-\\u{E001F}\\u{E0080}-\\u{E00FF}\\u{E01F0}-\\u{E0FFF}\\u{112A9}\\u00D7]", "[\\u02B0-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0374\\u037A\\u0559\\u06E5-\\u06E6\\u07F4-\\u07F5\\u0971\\u1C78-\\u1C7D\\u1D2C-\\u1D6A\\u1DFD-\\u1DFF\\u2E2F\\u30FC\\uA67F\\uA69C-\\uA69D\\uA717-\\uA71F\\uA788\\uA7F8-\\uA7F9\\uAB5C-\\uAB5F\\uFF70\\uFF9E-\\uFF9F\\u{16F93}-\\u{16F9F}\\u02D0-\\u02D1\\u0640\\u07FA\\u0E46\\u0EC6\\u1843\\u1AA7\\u1C7B\\u3005\\u3031-\\u3035\\u309D-\\u309E\\u30FC-\\u30FE\\uA015\\uA60C\\uA9CF\\uA9E6\\uAA70\\uAADD\\uAAF3-\\uAAF4\\uFF70\\u{16B42}-\\u{16B43}\\u{16FE0}-\\u{16FE1}\\u02B0-\\u02B8\\u02C0-\\u02C1\\u02E0-\\u02E4\\u037A\\u1D2C-\\u1D6A\\u1D78\\u1D9B-\\u1DBF\\u2071\\u207F\\u2090-\\u209C\\u2C7C-\\u2C7D\\uA69C-\\uA69D\\uA770\\uA7F8-\\uA7F9\\uAB5C-\\uAB5F\\uFF9E-\\uFF9F\\u02B2\\u1D62\\u1DA4\\u1DA8\\u2071\\u2C7C\\u2E18-\\u2E19\\u2E2F]", "[\\u2135-\\u2138\\u{1EE00}-\\u{1EE03}\\u{1EE05}-\\u{1EE1F}\\u{1EE21}-\\u{1EE22}\\u{1EE24}\\u{1EE27}\\u{1EE29}-\\u{1EE32}\\u{1EE34}-\\u{1EE37}\\u{1EE39}\\u{1EE3B}\\u{1EE42}\\u{1EE47}\\u{1EE49}\\u{1EE4B}\\u{1EE4D}-\\u{1EE4F}\\u{1EE51}-\\u{1EE52}\\u{1EE54}\\u{1EE57}\\u{1EE59}\\u{1EE5B}\\u{1EE5D}\\u{1EE5F}\\u{1EE61}-\\u{1EE62}\\u{1EE64}\\u{1EE67}-\\u{1EE6A}\\u{1EE6C}-\\u{1EE72}\\u{1EE74}-\\u{1EE77}\\u{1EE79}-\\u{1EE7C}\\u{1EE7E}\\u{1EE80}-\\u{1EE89}\\u{1EE8B}-\\u{1EE9B}\\u{1EEA1}-\\u{1EEA3}\\u{1EEA5}-\\u{1EEA9}\\u{1EEAB}-\\u{1EEBB}\\u3006\\u3400-\\u4DB5\\u4E00-\\u9FEF\\uF900-\\uFA6D\\uFA70-\\uFAD9\\u{17000}-\\u{187F1}\\u{18800}-\\u{18AF2}\\u{1B170}-\\u{1B2FB}\\u{20000}-\\u{2A6D6}\\u{2A700}-\\u{2B734}\\u{2B740}-\\u{2B81D}\\u{2B820}-\\u{2CEA1}\\u{2CEB0}-\\u{2EBE0}\\u{2F800}-\\u{2FA1D}\\uAAC0\\uAAC2\\uFE20-\\uFE2F\\u{10D22}-\\u{10D23}\\u{1135D}\\u00AA\\u00BA\\u3400-\\u4DB5\\u4E00-\\u9FEF\\uFA0E-\\uFA0F\\uFA11\\uFA13-\\uFA14\\uFA1F\\uFA21\\uFA23-\\uFA24\\uFA27-\\uFA29\\u{20000}-\\u{2A6D6}\\u{2A700}-\\u{2B734}\\u{2B740}-\\u{2B81D}\\u{2B820}-\\u{2CEA1}\\u{2CEB0}-\\u{2EBE0}\\u115F-\\u1160\\u3164\\uFFA0\\u0673\\u17A3-\\u17A4\\u0E40-\\u0E44\\u0EC0-\\u0EC4\\u19B5-\\u19B7\\u19BA\\uAAB5-\\uAAB6\\uAAB9\\uAABB-\\uAABC]", "[\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u2170-\\u217F\\u2160-\\u216F]", "_", "[\\u1885-\\u1886\\u2118\\u212E\\u309B-\\u309C]") , c = b(a, "[\\u104A-\\u104B\\u102B-\\u102C\\u102D-\\u1030\\u1031\\u1032-\\u1036\\u1038\\u103B-\\u103C\\u103D-\\u103E\\u1056-\\u1057\\u1058-\\u1059\\u105E-\\u1060\\u1062\\u1067-\\u1068\\u1071-\\u1074\\u1082\\u1083-\\u1084\\u1085-\\u1086\\u109C\\u109D\\u1037\\u1039-\\u103A\\u1087-\\u108C\\u108D\\u108F\\u109A-\\u109B\\uA9E5\\uAA7B\\uAA7C\\uAA7D\\uA9E6\\uAA70\\u104A-\\u104B]", "[\\u0903\\u093B\\u093E-\\u0940\\u0949-\\u094C\\u094E-\\u094F\\u0982-\\u0983\\u09BE-\\u09C0\\u09C7-\\u09C8\\u09CB-\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB-\\u0ACC\\u0B02-\\u0B03\\u0B3E\\u0B40\\u0B47-\\u0B48\\u0B4B-\\u0B4C\\u0B57\\u0BBE-\\u0BBF\\u0BC1-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82-\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7-\\u0CC8\\u0CCA-\\u0CCB\\u0CD5-\\u0CD6\\u0D02-\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82-\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2-\\u0DF3\\u0F7F\\u102B-\\u102C\\u1031\\u1038\\u103B-\\u103C\\u1056-\\u1057\\u1062\\u1067-\\u1068\\u1083-\\u1084\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7-\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930-\\u1931\\u1933-\\u1938\\u1A19-\\u1A1A\\u1A55\\u1A57\\u1A61\\u1A63-\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B82\\u1BA1\\u1BA6-\\u1BA7\\u1BE7\\u1BEA-\\u1BEC\\u1BEE\\u1C24-\\u1C2B\\u1C34-\\u1C35\\u1CF2-\\u1CF3\\uA823-\\uA824\\uA827\\uA880-\\uA881\\uA8B4-\\uA8C3\\uA952\\uA983\\uA9B4-\\uA9B5\\uA9BA-\\uA9BB\\uA9BD-\\uA9BF\\uAA2F-\\uAA30\\uAA33-\\uAA34\\uAA4D\\uAAEB\\uAAEE-\\uAAEF\\uAAF5\\uABE3-\\uABE4\\uABE6-\\uABE7\\uABE9-\\uABEA\\u{11000}\\u{11002}\\u{11082}\\u{110B0}-\\u{110B2}\\u{110B7}-\\u{110B8}\\u{1112C}\\u{11145}-\\u{11146}\\u{11182}\\u{111B3}-\\u{111B5}\\u{111BF}\\u{1122C}-\\u{1122E}\\u{11232}-\\u{11233}\\u{112E0}-\\u{112E2}\\u{11302}-\\u{11303}\\u{1133E}-\\u{1133F}\\u{11341}-\\u{11344}\\u{11347}-\\u{11348}\\u{1134B}-\\u{1134C}\\u{11357}\\u{11362}-\\u{11363}\\u{11435}-\\u{11437}\\u{11440}-\\u{11441}\\u{11445}\\u{114B0}-\\u{114B2}\\u{114B9}\\u{114BB}-\\u{114BE}\\u{114C1}\\u{115AF}-\\u{115B1}\\u{115B8}-\\u{115BB}\\u{115BE}\\u{11630}-\\u{11632}\\u{1163B}-\\u{1163C}\\u{1163E}\\u{116AC}\\u{116AE}-\\u{116AF}\\u{11720}-\\u{11721}\\u{11726}\\u{1182C}-\\u{1182E}\\u{11838}\\u{11A39}\\u{11A57}-\\u{11A58}\\u{11A97}\\u{11C2F}\\u{11C3E}\\u{11CA9}\\u{11CB1}\\u{11CB4}\\u{11D8A}-\\u{11D8E}\\u{11D93}-\\u{11D94}\\u{11D96}\\u{11EF5}-\\u{11EF6}\\u{16F51}-\\u{16F7E}\\u0F3E-\\u0F3F\\u1087-\\u108C\\u108F\\u109A-\\u109B\\u1B44\\u1BAA\\u1CE1\\u1CF7\\u302E-\\u302F\\uA953\\uA9C0\\uAA7B\\uAA7D\\uABEC\\u{111C0}\\u{11235}\\u{1134D}\\u{116B6}\\u{1D16D}-\\u{1D172}\\u09BE\\u09D7\\u0B3E\\u0B57\\u0BBE\\u0BD7\\u0CC2\\u0CD5-\\u0CD6\\u0D3E\\u0D57\\u0DCF\\u0DDF\\u302E-\\u302F\\u{1133E}\\u{11357}\\u{114B0}\\u{114BD}\\u{115AF}\\u{1D165}\\u{1D16E}-\\u{1D172}]", "[\\u{1D7CE}-\\u{1D7FF}\\uFF10-\\uFF19]", "\\u2040", "[\\u00B7\\u0387\\u1369-\\u1371\\u19DA]"); if (!1 === RegExp().unicode) return new RegExp("^" + a + "+" + c + "*$","u"); a = b("[A-Z]", "[a-z]", "_"); c = b(a, "[0-9]"); return new RegExp("^" + a + "+" + c + "*$") }(); (function(a) { return b.apply(null, arguments) + "*" } )("\\\\\\r?\\n[ \\f\\t]*"); c("#[^\\r\\n]*"); m = b("[0-9](?:_?[0-9])*\\.(?:[0-9](?:_?[0-9])*)?", "\\.[0-9](?:_?[0-9])*") + c("[eE][-+]?[0-9](?:_?[0-9])*"); var q = b(m, "[0-9](?:_?[0-9])*[eE][-+]?[0-9](?:_?[0-9])*") , u = b("[0-9](?:_?[0-9])*[jJ]", q + "[jJ]"); m = b.apply(null, e()); p = b(m + "'''", m + '"""'); b(m + "'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*'", m + '"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*"'); var z = Object.keys(Sk.token.EXACT_TOKEN_TYPES).sort(); z = b.apply(this, z.reverse().map(function(a) { return a && n.test(a) ? a.replace(k, "\\$&") : a })); var y = b("\\r?\\n", z) , t = b(m + "'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*" + b("'", "\\\\\\r?\\n"), m + '"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*' + b('"', "\\\\\\r?\\n")) , H = b("\\\\\\r?\\n|$", "#[^\\r\\n]*", p) , K = {}; m = e(); for (let a of m) K[a + "'"] = "^[^'\\\\]*(?:\\\\.[^'\\\\]*)*'", K[a + '"'] = '^[^"\\\\]*(?:\\\\.[^"\\\\]*)*"', K[a + "'''"] = "^[^'\\\\]*(?:(?:\\\\.|'(?!''))[^'\\\\]*)*'''", K[a + '"""'] = '^[^"\\\\]*(?:(?:\\\\.|"(?!""))[^"\\\\]*)*"""'; let C = [] , F = []; for (let a of m) C.push(a + '"'), C.push(a + "'"), F.push(a + '"""'), F.push(a + "'''"); Sk._tokenize = function(c, e, k, n) { var m = Sk.__future__.python3 ? "" : "(?:L?)"; m = b("0[xX](?:_?[0-9a-fA-F])+" + m, "0[bB](?:_?[01])+" + m, Sk.__future__.silent_octal_literal ? "0([oO]?)(?:_?[0-7])+" + m : "0([oO])(?:_?[0-7])+" + m, "(?:0(?:_?0)*|[1-9](?:_?[0-9])*)" + m); m = b(u, q, m); m = "[ \\f\\t]*" + b(H, m, y, t, "\\w+"); m = new RegExp(m); var p = 0, z = 0, L = 0, E = "", W = 0, N = null, M = [0], I, Z = void 0, Y = void 0, J, U; void 0 !== k && ("utf-8-sig" == k && (k = "utf-8"), n(new a(h.T_ENCODING,k,[0, 0],[0, 0],""))); for (var A = k = ""; ; ) { try { k = A, A = e() } catch (w) { A = "" } p += 1; var G = 0 , T = A.length; if (E) { if (!A) throw new g("EOF in multi-line string",c,Y[0],Y[1]); Z.lastIndex = 0; var x = Z.exec(A); if (x) G = J = x[0].length, n(new a(h.T_STRING,E + A.substring(0, J),Y,[p, J],N + A)), E = "", W = 0, N = null; else { W && "\\\n" !== A.substring(A.length - 2) && "\\\r\n" !== A.substring(A.length - 3) ? (n(new a(h.T_ERRORTOKEN,E + A,Y,[p, A.length],N)), E = "", N = null) : (E += A, N += A); continue } } else if (0 != z || L) { if (!A) throw new g("EOF in multi-line statement",c,p,0); L = 0 } else { if (!A) break; for (I = 0; G < T; ) { if (" " == A[G]) I += 1; else if ("\t" == A[G]) I = 8 * Math.floor(I / 8 + 1); else if ("\f" == A[G]) I = 0; else break; G += 1 } if (G == T) break; if (d("#\r\n", A[G])) { if ("#" == A[G]) { I = A.substring(G); for (T = I.length; 0 < T && -1 !== "\r\n".indexOf(I.charAt(T - 1)); --T) ; T = I.substring(0, T); n(new a(h.T_COMMENT,T,[p, G],[p, G + T.length],A)); G += T.length } n(new a(h.T_NL,A.substring(G),[p, G],[p, A.length],A)); continue } I > M[M.length - 1] && (M.push(I), n(new a(h.T_INDENT,A.substring(G),[p, 0],[p, G],A))); for (; I < M[M.length - 1]; ) { if (!d(M, I)) throw new f("unindent does not match any outer indentation level",c,p,G); M = M.slice(0, -1); n(new a(h.T_DEDENT,"",[p, G],[p, G],A)) } } for (; G < T; ) { for (I = A.charAt(G); " " === I || "\f" === I || "\t" === I; ) G += 1, I = A.charAt(G); if (U = m.exec(A.substring(G))) { if (I = G, J = I + U[1].length, U = [p, I], x = [p, J], G = J, I != J) { J = A.substring(I, J); var O = A[I]; if (d("0123456789", O) || "." == O && "." != J && "..." != J) n(new a(h.T_NUMBER,J,U,x,A)); else if (d("\r\n", O)) 0 < z ? n(new a(h.T_NL,J,U,x,A)) : n(new a(h.T_NEWLINE,J,U,x,A)); else if ("#" == O) n(new a(h.T_COMMENT,J,U,x,A)); else if (d(F, J)) if (Z = RegExp(K[J]), x = Z.exec(A.substring(G))) G = x[0].length + G, J = A.substring(I, G), n(new a(h.T_STRING,J,U,[p, G],A)); else { Y = [p, I]; E = A.substring(I); N = A; break } else if (d(C, O) || d(C, J.substring(0, 2)) || d(C, J.substring(0, 3))) if ("\n" == J[J.length - 1]) { Y = [p, I]; Z = RegExp(K[O] || K[J[1]] || K[J[2]]); E = A.substring(I); W = 1; N = A; break } else n(new a(h.T_STRING,J,U,x,A)); else I = O.normalize("NFKC"), l.test(I) ? n(new a(h.T_NAME,J,U,x,A)) : "\\" == O ? L = 1 : (d("([{", O) ? z += 1 : d(")]}", O) && --z, n(new a(h.T_OP,J,U,x,A))) } } else n(new a(h.T_ERRORTOKEN,A[G],[p, G],[p, G + 1],A)), G += 1 } } k && !d("\r\n", k[k.length - 1]) && n(new a(h.T_NEWLINE,"",[p - 1, k.length],[p - 1, k.length + 1],"")); for (var r in M.slice(1)) n(new a(h.T_DEDENT,"",[p, 0],[p, 0],"")); n(new a(h.T_ENDMARKER,"",[p, 0],[p, 0],"")) } ; Sk.exportSymbol("Sk._tokenize", Sk._tokenize) } , function(m, p) { Sk.OpMap = { "(": Sk.token.tokens.T_LPAR, ")": Sk.token.tokens.T_RPAR, "[": Sk.token.tokens.T_LSQB, "]": Sk.token.tokens.T_RSQB, ":": Sk.token.tokens.T_COLON, ",": Sk.token.tokens.T_COMMA, ";": Sk.token.tokens.T_SEMI, "+": Sk.token.tokens.T_PLUS, "-": Sk.token.tokens.T_MINUS, "*": Sk.token.tokens.T_STAR, "/": Sk.token.tokens.T_SLASH, "|": Sk.token.tokens.T_VBAR, "&": Sk.token.tokens.T_AMPER, "<": Sk.token.tokens.T_LESS, ">": Sk.token.tokens.T_GREATER, "=": Sk.token.tokens.T_EQUAL, ".": Sk.token.tokens.T_DOT, "%": Sk.token.tokens.T_PERCENT, "`": Sk.token.tokens.T_BACKQUOTE, "{": Sk.token.tokens.T_LBRACE, "}": Sk.token.tokens.T_RBRACE, "@": Sk.token.tokens.T_AT, "@=": Sk.token.tokens.T_ATEQUAL, "==": Sk.token.tokens.T_EQEQUAL, "!=": Sk.token.tokens.T_NOTEQUAL, "<>": Sk.token.tokens.T_NOTEQUAL, "<=": Sk.token.tokens.T_LESSEQUAL, ">=": Sk.token.tokens.T_GREATEREQUAL, "~": Sk.token.tokens.T_TILDE, "^": Sk.token.tokens.T_CIRCUMFLEX, "<<": Sk.token.tokens.T_LEFTSHIFT, ">>": Sk.token.tokens.T_RIGHTSHIFT, "**": Sk.token.tokens.T_DOUBLESTAR, "+=": Sk.token.tokens.T_PLUSEQUAL, "-=": Sk.token.tokens.T_MINEQUAL, "*=": Sk.token.tokens.T_STAREQUAL, "/=": Sk.token.tokens.T_SLASHEQUAL, "%=": Sk.token.tokens.T_PERCENTEQUAL, "&=": Sk.token.tokens.T_AMPEREQUAL, "|=": Sk.token.tokens.T_VBAREQUAL, "^=": Sk.token.tokens.T_CIRCUMFLEXEQUAL, "<<=": Sk.token.tokens.T_LEFTSHIFTEQUAL, ">>=": Sk.token.tokens.T_RIGHTSHIFTEQUAL, "**=": Sk.token.tokens.T_DOUBLESTAREQUAL, "//": Sk.token.tokens.T_DOUBLESLASH, "//=": Sk.token.tokens.T_DOUBLESLASHEQUAL, "->": Sk.token.tokens.T_RARROW, "...": Sk.token.tokens.T_ELLIPSIS }; Sk.ParseTables = { sym: { and_expr: 257, and_test: 258, annassign: 259, arglist: 260, argument: 261, arith_expr: 262, assert_stmt: 263, async_funcdef: 264, async_stmt: 265, atom: 266, atom_expr: 267, augassign: 268, break_stmt: 269, classdef: 270, comp_for: 271, comp_if: 272, comp_iter: 273, comp_op: 274, comparison: 275, compound_stmt: 276, continue_stmt: 277, debugger_stmt: 278, decorated: 279, decorator: 280, decorators: 281, del_stmt: 282, dictorsetmaker: 283, dotted_as_name: 284, dotted_as_names: 285, dotted_name: 286, encoding_decl: 287, eval_input: 288, except_clause: 289, expr: 290, expr_stmt: 291, exprlist: 292, factor: 293, file_input: 294, flow_stmt: 295, for_stmt: 296, funcdef: 297, global_stmt: 298, if_stmt: 299, import_as_name: 300, import_as_names: 301, import_from: 302, import_name: 303, import_stmt: 304, lambdef: 305, lambdef_nocond: 306, nonlocal_stmt: 307, not_test: 308, or_test: 309, parameters: 310, pass_stmt: 311, power: 312, print_stmt: 313, raise_stmt: 314, return_stmt: 315, shift_expr: 316, simple_stmt: 317, single_input: 256, sliceop: 318, small_stmt: 319, star_expr: 320, stmt: 321, subscript: 322, subscriptlist: 323, suite: 324, term: 325, test: 326, test_nocond: 327, testlist: 328, testlist_comp: 329, testlist_star_expr: 330, tfpdef: 331, trailer: 332, try_stmt: 333, typedargslist: 334, varargslist: 335, vfpdef: 336, while_stmt: 337, with_item: 338, with_stmt: 339, xor_expr: 340, yield_arg: 341, yield_expr: 342, yield_stmt: 343 }, number2symbol: { 256: "single_input", 257: "and_expr", 258: "and_test", 259: "annassign", 260: "arglist", 261: "argument", 262: "arith_expr", 263: "assert_stmt", 264: "async_funcdef", 265: "async_stmt", 266: "atom", 267: "atom_expr", 268: "augassign", 269: "break_stmt", 270: "classdef", 271: "comp_for", 272: "comp_if", 273: "comp_iter", 274: "comp_op", 275: "comparison", 276: "compound_stmt", 277: "continue_stmt", 278: "debugger_stmt", 279: "decorated", 280: "decorator", 281: "decorators", 282: "del_stmt", 283: "dictorsetmaker", 284: "dotted_as_name", 285: "dotted_as_names", 286: "dotted_name", 287: "encoding_decl", 288: "eval_input", 289: "except_clause", 290: "expr", 291: "expr_stmt", 292: "exprlist", 293: "factor", 294: "file_input", 295: "flow_stmt", 296: "for_stmt", 297: "funcdef", 298: "global_stmt", 299: "if_stmt", 300: "import_as_name", 301: "import_as_names", 302: "import_from", 303: "import_name", 304: "import_stmt", 305: "lambdef", 306: "lambdef_nocond", 307: "nonlocal_stmt", 308: "not_test", 309: "or_test", 310: "parameters", 311: "pass_stmt", 312: "power", 313: "print_stmt", 314: "raise_stmt", 315: "return_stmt", 316: "shift_expr", 317: "simple_stmt", 318: "sliceop", 319: "small_stmt", 320: "star_expr", 321: "stmt", 322: "subscript", 323: "subscriptlist", 324: "suite", 325: "term", 326: "test", 327: "test_nocond", 328: "testlist", 329: "testlist_comp", 330: "testlist_star_expr", 331: "tfpdef", 332: "trailer", 333: "try_stmt", 334: "typedargslist", 335: "varargslist", 336: "vfpdef", 337: "while_stmt", 338: "with_item", 339: "with_stmt", 340: "xor_expr", 341: "yield_arg", 342: "yield_expr", 343: "yield_stmt" }, dfas: { 256: [[[[1, 1], [2, 1], [3, 2]], [[0, 1]], [[2, 1]]], { 2: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1, 12: 1, 13: 1, 14: 1, 15: 1, 16: 1, 17: 1, 18: 1, 19: 1, 20: 1, 21: 1, 22: 1, 23: 1, 24: 1, 25: 1, 26: 1, 27: 1, 28: 1, 29: 1, 30: 1, 31: 1, 32: 1, 33: 1, 34: 1, 35: 1, 36: 1, 37: 1, 38: 1, 39: 1, 40: 1, 41: 1, 42: 1, 43: 1 }], 257: [[[[44, 1]], [[45, 0], [0, 1]]], { 6: 1, 7: 1, 9: 1, 11: 1, 12: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 258: [[[[46, 1]], [[47, 0], [0, 1]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 259: [[[[48, 1]], [[49, 2]], [[50, 3], [0, 2]], [[49, 4]], [[0, 4]]], { 48: 1 }], 260: [[[[51, 1]], [[52, 2], [0, 1]], [[51, 1], [0, 2]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 15: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1, 53: 1 }], 261: [[[[49, 1], [15, 2], [53, 2]], [[50, 2], [54, 3], [0, 1]], [[49, 3]], [[0, 3]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 15: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1, 53: 1 }], 262: [[[[55, 1]], [[30, 0], [43, 0], [0, 1]]], { 6: 1, 7: 1, 9: 1, 11: 1, 12: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 263: [[[[24, 1]], [[49, 2]], [[52, 3], [0, 2]], [[49, 4]], [[0, 4]]], { 24: 1 }], 264: [[[[10, 1]], [[56, 2]], [[0, 2]]], { 10: 1 }], 265: [[[[10, 1]], [[57, 2], [56, 2], [58, 2]], [[0, 2]]], { 10: 1 }], 266: [[[[6, 1], [25, 1], [33, 1], [9, 1], [11, 1], [12, 2], [35, 3], [38, 4], [19, 1], [7, 5]], [[0, 1]], [[59, 1], [60, 6]], [[61, 1], [62, 7], [63, 7]], [[64, 1], [63, 8]], [[7, 5], [0, 5]], [[59, 1]], [[61, 1]], [[64, 1]]], { 6: 1, 7: 1, 9: 1, 11: 1, 12: 1, 19: 1, 25: 1, 33: 1, 35: 1, 38: 1 }], 267: [[[[29, 1], [65, 2]], [[65, 2]], [[66, 2], [0, 2]]], { 6: 1, 7: 1, 9: 1, 11: 1, 12: 1, 19: 1, 25: 1, 29: 1, 33: 1, 35: 1, 38: 1 }], 268: [[[[67, 1], [68, 1], [69, 1], [70, 1], [71, 1], [72, 1], [73, 1], [74, 1], [75, 1], [76, 1], [77, 1], [78, 1], [79, 1]], [[0, 1]]], { 67: 1, 68: 1, 69: 1, 70: 1, 71: 1, 72: 1, 73: 1, 74: 1, 75: 1, 76: 1, 77: 1, 78: 1, 79: 1 }], 269: [[[[39, 1]], [[0, 1]]], { 39: 1 }], 270: [[[[13, 1]], [[25, 2]], [[48, 3], [35, 4]], [[80, 5]], [[61, 6], [81, 7]], [[0, 5]], [[48, 3]], [[61, 6]]], { 13: 1 }], 271: [[[[10, 1], [34, 2]], [[34, 2]], [[82, 3]], [[83, 4]], [[84, 5]], [[85, 6], [0, 5]], [[0, 6]]], { 10: 1, 34: 1 }], 272: [[[[37, 1]], [[86, 2]], [[85, 3], [0, 2]], [[0, 3]]], { 37: 1 }], 273: [[[[87, 1], [54, 1]], [[0, 1]]], { 10: 1, 34: 1, 37: 1 }], 274: [[[[88, 1], [89, 1], [8, 2], [90, 1], [88, 1], [83, 1], [91, 1], [92, 3], [93, 1], [94, 1]], [[0, 1]], [[83, 1]], [[8, 1], [0, 3]]], { 8: 1, 83: 1, 88: 1, 89: 1, 90: 1, 91: 1, 92: 1, 93: 1, 94: 1 }], 275: [[[[95, 1]], [[96, 0], [0, 1]]], { 6: 1, 7: 1, 9: 1, 11: 1, 12: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 276: [[[[97, 1], [98, 1], [58, 1], [99, 1], [57, 1], [100, 1], [56, 1], [101, 1], [102, 1]], [[0, 1]]], { 4: 1, 10: 1, 13: 1, 20: 1, 21: 1, 34: 1, 37: 1, 41: 1, 42: 1 }], 277: [[[[40, 1]], [[0, 1]]], { 40: 1 }], 278: [[[[17, 1]], [[0, 1]]], { 17: 1 }], 279: [[[[103, 1]], [[56, 2], [104, 2], [99, 2]], [[0, 2]]], { 41: 1 }], 280: [[[[41, 1]], [[105, 2]], [[2, 4], [35, 3]], [[61, 5], [81, 6]], [[0, 4]], [[2, 4]], [[61, 5]]], { 41: 1 }], 281: [[[[106, 1]], [[106, 1], [0, 1]]], { 41: 1 }], 282: [[[[27, 1]], [[82, 2]], [[0, 2]]], { 27: 1 }], 283: [[[[49, 1], [107, 2], [53, 3]], [[48, 4], [54, 5], [52, 6], [0, 1]], [[54, 5], [52, 6], [0, 2]], [[95, 7]], [[49, 7]], [[0, 5]], [[49, 8], [107, 8], [0, 6]], [[54, 5], [52, 9], [0, 7]], [[52, 6], [0, 8]], [[49, 10], [53, 11], [0, 9]], [[48, 12]], [[95, 13]], [[49, 13]], [[52, 9], [0, 13]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 15: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1, 53: 1 }], 284: [[[[105, 1]], [[108, 2], [0, 1]], [[25, 3]], [[0, 3]]], { 25: 1 }], 285: [[[[109, 1]], [[52, 0], [0, 1]]], { 25: 1 }], 286: [[[[25, 1]], [[110, 0], [0, 1]]], { 25: 1 }], 287: [[[[25, 1]], [[0, 1]]], { 25: 1 }], 288: [[[[111, 1]], [[2, 1], [112, 2]], [[0, 2]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 289: [[[[113, 1]], [[49, 2], [0, 1]], [[108, 3], [52, 3], [0, 2]], [[49, 4]], [[0, 4]]], { 113: 1 }], 290: [[[[114, 1]], [[115, 0], [0, 1]]], { 6: 1, 7: 1, 9: 1, 11: 1, 12: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 291: [[[[116, 1]], [[117, 2], [50, 3], [118, 4], [0, 1]], [[111, 4], [62, 4]], [[116, 5], [62, 5]], [[0, 4]], [[50, 3], [0, 5]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 15: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 292: [[[[95, 1], [107, 1]], [[52, 2], [0, 1]], [[95, 1], [107, 1], [0, 2]]], { 6: 1, 7: 1, 9: 1, 11: 1, 12: 1, 15: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 293: [[[[119, 2], [30, 1], [22, 1], [43, 1]], [[120, 2]], [[0, 2]]], { 6: 1, 7: 1, 9: 1, 11: 1, 12: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 294: [[[[2, 0], [112, 1], [121, 0]], [[0, 1]]], { 2: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1, 12: 1, 13: 1, 14: 1, 15: 1, 16: 1, 17: 1, 18: 1, 19: 1, 20: 1, 21: 1, 22: 1, 23: 1, 24: 1, 25: 1, 26: 1, 27: 1, 28: 1, 29: 1, 30: 1, 31: 1, 32: 1, 33: 1, 34: 1, 35: 1, 36: 1, 37: 1, 38: 1, 39: 1, 40: 1, 41: 1, 42: 1, 43: 1, 112: 1 }], 295: [[[[122, 1], [123, 1], [124, 1], [125, 1], [126, 1]], [[0, 1]]], { 5: 1, 23: 1, 31: 1, 39: 1, 40: 1 }], 296: [[[[34, 1]], [[82, 2]], [[83, 3]], [[111, 4]], [[48, 5]], [[80, 6]], [[127, 7], [0, 6]], [[48, 8]], [[80, 9]], [[0, 9]]], { 34: 1 }], 297: [[[[4, 1]], [[25, 2]], [[128, 3]], [[48, 4], [129, 5]], [[80, 6]], [[49, 7]], [[0, 6]], [[48, 4]]], { 4: 1 }], 298: [[[[26, 1]], [[25, 2]], [[52, 1], [0, 2]]], { 26: 1 }], 299: [[[[37, 1]], [[49, 2]], [[48, 3]], [[80, 4]], [[127, 5], [130, 1], [0, 4]], [[48, 6]], [[80, 7]], [[0, 7]]], { 37: 1 }], 300: [[[[25, 1]], [[108, 2], [0, 1]], [[25, 3]], [[0, 3]]], { 25: 1 }], 301: [[[[131, 1]], [[52, 2], [0, 1]], [[131, 1], [0, 2]]], { 25: 1 }], 302: [[[[36, 1]], [[105, 2], [19, 3], [110, 3]], [[32, 4]], [[105, 2], [19, 3], [32, 4], [110, 3]], [[132, 5], [15, 5], [35, 6]], [[0, 5]], [[132, 7]], [[61, 5]]], { 36: 1 }], 303: [[[[32, 1]], [[133, 2]], [[0, 2]]], { 32: 1 }], 304: [[[[134, 1], [135, 1]], [[0, 1]]], { 32: 1, 36: 1 }], 305: [[[[14, 1]], [[48, 2], [136, 3]], [[49, 4]], [[48, 2]], [[0, 4]]], { 14: 1 }], 306: [[[[14, 1]], [[48, 2], [136, 3]], [[86, 4]], [[48, 2]], [[0, 4]]], { 14: 1 }], 307: [[[[18, 1]], [[25, 2]], [[52, 1], [0, 2]]], { 18: 1 }], 308: [[[[8, 1], [137, 2]], [[46, 2]], [[0, 2]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 309: [[[[138, 1]], [[139, 0], [0, 1]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 310: [[[[35, 1]], [[61, 2], [140, 3]], [[0, 2]], [[61, 2]]], { 35: 1 }], 311: [[[[28, 1]], [[0, 1]]], { 28: 1 }], 312: [[[[141, 1]], [[53, 2], [0, 1]], [[120, 3]], [[0, 3]]], { 6: 1, 7: 1, 9: 1, 11: 1, 12: 1, 19: 1, 25: 1, 29: 1, 33: 1, 35: 1, 38: 1 }], 313: [[[[16, 1]], [[49, 2], [142, 3], [0, 1]], [[52, 4], [0, 2]], [[49, 5]], [[49, 2], [0, 4]], [[52, 6], [0, 5]], [[49, 7]], [[52, 8], [0, 7]], [[49, 7], [0, 8]]], { 16: 1 }], 314: [[[[5, 1]], [[49, 2], [0, 1]], [[36, 3], [52, 3], [0, 2]], [[49, 4]], [[52, 5], [0, 4]], [[49, 6]], [[0, 6]]], { 5: 1 }], 315: [[[[23, 1]], [[111, 2], [0, 1]], [[0, 2]]], { 23: 1 }], 316: [[[[143, 1]], [[144, 0], [142, 0], [0, 1]]], { 6: 1, 7: 1, 9: 1, 11: 1, 12: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 317: [[[[145, 1]], [[2, 2], [146, 3]], [[0, 2]], [[145, 1], [2, 2]]], { 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 15: 1, 16: 1, 17: 1, 18: 1, 19: 1, 22: 1, 23: 1, 24: 1, 25: 1, 26: 1, 27: 1, 28: 1, 29: 1, 30: 1, 31: 1, 32: 1, 33: 1, 35: 1, 36: 1, 38: 1, 39: 1, 40: 1, 43: 1 }], 318: [[[[48, 1]], [[49, 2], [0, 1]], [[0, 2]]], { 48: 1 }], 319: [[[[147, 1], [148, 1], [149, 1], [150, 1], [151, 1], [152, 1], [153, 1], [154, 1], [155, 1], [156, 1]], [[0, 1]]], { 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 15: 1, 16: 1, 17: 1, 18: 1, 19: 1, 22: 1, 23: 1, 24: 1, 25: 1, 26: 1, 27: 1, 28: 1, 29: 1, 30: 1, 31: 1, 32: 1, 33: 1, 35: 1, 36: 1, 38: 1, 39: 1, 40: 1, 43: 1 }], 320: [[[[15, 1]], [[95, 2]], [[0, 2]]], { 15: 1 }], 321: [[[[1, 1], [3, 1]], [[0, 1]]], { 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1, 12: 1, 13: 1, 14: 1, 15: 1, 16: 1, 17: 1, 18: 1, 19: 1, 20: 1, 21: 1, 22: 1, 23: 1, 24: 1, 25: 1, 26: 1, 27: 1, 28: 1, 29: 1, 30: 1, 31: 1, 32: 1, 33: 1, 34: 1, 35: 1, 36: 1, 37: 1, 38: 1, 39: 1, 40: 1, 41: 1, 42: 1, 43: 1 }], 322: [[[[49, 1], [48, 2]], [[48, 2], [0, 1]], [[49, 3], [157, 4], [0, 2]], [[157, 4], [0, 3]], [[0, 4]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1, 48: 1 }], 323: [[[[158, 1]], [[52, 2], [0, 1]], [[158, 1], [0, 2]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1, 48: 1 }], 324: [[[[1, 1], [2, 2]], [[0, 1]], [[159, 3]], [[121, 4]], [[160, 1], [121, 4]]], { 2: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 15: 1, 16: 1, 17: 1, 18: 1, 19: 1, 22: 1, 23: 1, 24: 1, 25: 1, 26: 1, 27: 1, 28: 1, 29: 1, 30: 1, 31: 1, 32: 1, 33: 1, 35: 1, 36: 1, 38: 1, 39: 1, 40: 1, 43: 1 }], 325: [[[[120, 1]], [[161, 0], [15, 0], [162, 0], [41, 0], [163, 0], [0, 1]]], { 6: 1, 7: 1, 9: 1, 11: 1, 12: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 326: [[[[84, 1], [164, 2]], [[37, 3], [0, 1]], [[0, 2]], [[84, 4]], [[127, 5]], [[49, 2]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 327: [[[[165, 1], [84, 1]], [[0, 1]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 328: [[[[49, 1]], [[52, 2], [0, 1]], [[49, 1], [0, 2]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 329: [[[[49, 1], [107, 1]], [[54, 2], [52, 3], [0, 1]], [[0, 2]], [[49, 4], [107, 4], [0, 3]], [[52, 3], [0, 4]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 15: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 330: [[[[49, 1], [107, 1]], [[52, 2], [0, 1]], [[49, 1], [107, 1], [0, 2]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 15: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 331: [[[[25, 1]], [[48, 2], [0, 1]], [[49, 3]], [[0, 3]]], { 25: 1 }], 332: [[[[35, 1], [110, 2], [38, 3]], [[61, 4], [81, 5]], [[25, 4]], [[166, 6]], [[0, 4]], [[61, 4]], [[64, 4]]], { 35: 1, 38: 1, 110: 1 }], 333: [[[[20, 1]], [[48, 2]], [[80, 3]], [[167, 4], [168, 5]], [[48, 6]], [[48, 7]], [[80, 8]], [[80, 9]], [[167, 4], [127, 10], [168, 5], [0, 8]], [[0, 9]], [[48, 11]], [[80, 12]], [[168, 5], [0, 12]]], { 20: 1 }], 334: [[[[15, 1], [169, 2], [53, 3]], [[169, 4], [52, 5], [0, 1]], [[50, 6], [52, 7], [0, 2]], [[169, 8]], [[52, 5], [0, 4]], [[169, 9], [53, 3], [0, 5]], [[49, 10]], [[15, 11], [169, 2], [53, 3], [0, 7]], [[52, 12], [0, 8]], [[50, 13], [52, 5], [0, 9]], [[52, 7], [0, 10]], [[169, 14], [52, 15], [0, 11]], [[0, 12]], [[49, 4]], [[52, 15], [0, 14]], [[169, 16], [53, 3], [0, 15]], [[50, 17], [52, 15], [0, 16]], [[49, 14]]], { 15: 1, 25: 1, 53: 1 }], 335: [[[[15, 1], [53, 2], [170, 3]], [[170, 5], [52, 4], [0, 1]], [[170, 6]], [[50, 7], [52, 8], [0, 3]], [[53, 2], [170, 9], [0, 4]], [[52, 4], [0, 5]], [[52, 10], [0, 6]], [[49, 11]], [[15, 12], [53, 2], [170, 3], [0, 8]], [[50, 13], [52, 4], [0, 9]], [[0, 10]], [[52, 8], [0, 11]], [[52, 15], [170, 14], [0, 12]], [[49, 5]], [[52, 15], [0, 14]], [[53, 2], [170, 16], [0, 15]], [[50, 17], [52, 15], [0, 16]], [[49, 14]]], { 15: 1, 25: 1, 53: 1 }], 336: [[[[25, 1]], [[0, 1]]], { 25: 1 }], 337: [[[[21, 1]], [[49, 2]], [[48, 3]], [[80, 4]], [[127, 5], [0, 4]], [[48, 6]], [[80, 7]], [[0, 7]]], { 21: 1 }], 338: [[[[49, 1]], [[108, 2], [0, 1]], [[95, 3]], [[0, 3]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 339: [[[[42, 1]], [[171, 2]], [[48, 3], [52, 1]], [[80, 4]], [[0, 4]]], { 42: 1 }], 340: [[[[172, 1]], [[173, 0], [0, 1]]], { 6: 1, 7: 1, 9: 1, 11: 1, 12: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 38: 1, 43: 1 }], 341: [[[[111, 2], [36, 1]], [[49, 2]], [[0, 2]]], { 6: 1, 7: 1, 8: 1, 9: 1, 11: 1, 12: 1, 14: 1, 19: 1, 22: 1, 25: 1, 29: 1, 30: 1, 33: 1, 35: 1, 36: 1, 38: 1, 43: 1 }], 342: [[[[31, 1]], [[174, 2], [0, 1]], [[0, 2]]], { 31: 1 }], 343: [[[[62, 1]], [[0, 1]]], { 31: 1 }] }, states: [[[[1, 1], [2, 1], [3, 2]], [[0, 1]], [[2, 1]]], [[[44, 1]], [[45, 0], [0, 1]]], [[[46, 1]], [[47, 0], [0, 1]]], [[[48, 1]], [[49, 2]], [[50, 3], [0, 2]], [[49, 4]], [[0, 4]]], [[[51, 1]], [[52, 2], [0, 1]], [[51, 1], [0, 2]]], [[[49, 1], [15, 2], [53, 2]], [[50, 2], [54, 3], [0, 1]], [[49, 3]], [[0, 3]]], [[[55, 1]], [[30, 0], [43, 0], [0, 1]]], [[[24, 1]], [[49, 2]], [[52, 3], [0, 2]], [[49, 4]], [[0, 4]]], [[[10, 1]], [[56, 2]], [[0, 2]]], [[[10, 1]], [[57, 2], [56, 2], [58, 2]], [[0, 2]]], [[[6, 1], [25, 1], [33, 1], [9, 1], [11, 1], [12, 2], [35, 3], [38, 4], [19, 1], [7, 5]], [[0, 1]], [[59, 1], [60, 6]], [[61, 1], [62, 7], [63, 7]], [[64, 1], [63, 8]], [[7, 5], [0, 5]], [[59, 1]], [[61, 1]], [[64, 1]]], [[[29, 1], [65, 2]], [[65, 2]], [[66, 2], [0, 2]]], [[[67, 1], [68, 1], [69, 1], [70, 1], [71, 1], [72, 1], [73, 1], [74, 1], [75, 1], [76, 1], [77, 1], [78, 1], [79, 1]], [[0, 1]]], [[[39, 1]], [[0, 1]]], [[[13, 1]], [[25, 2]], [[48, 3], [35, 4]], [[80, 5]], [[61, 6], [81, 7]], [[0, 5]], [[48, 3]], [[61, 6]]], [[[10, 1], [34, 2]], [[34, 2]], [[82, 3]], [[83, 4]], [[84, 5]], [[85, 6], [0, 5]], [[0, 6]]], [[[37, 1]], [[86, 2]], [[85, 3], [0, 2]], [[0, 3]]], [[[87, 1], [54, 1]], [[0, 1]]], [[[88, 1], [89, 1], [8, 2], [90, 1], [88, 1], [83, 1], [91, 1], [92, 3], [93, 1], [94, 1]], [[0, 1]], [[83, 1]], [[8, 1], [0, 3]]], [[[95, 1]], [[96, 0], [0, 1]]], [[[97, 1], [98, 1], [58, 1], [99, 1], [57, 1], [100, 1], [56, 1], [101, 1], [102, 1]], [[0, 1]]], [[[40, 1]], [[0, 1]]], [[[17, 1]], [[0, 1]]], [[[103, 1]], [[56, 2], [104, 2], [99, 2]], [[0, 2]]], [[[41, 1]], [[105, 2]], [[2, 4], [35, 3]], [[61, 5], [81, 6]], [[0, 4]], [[2, 4]], [[61, 5]]], [[[106, 1]], [[106, 1], [0, 1]]], [[[27, 1]], [[82, 2]], [[0, 2]]], [[[49, 1], [107, 2], [53, 3]], [[48, 4], [54, 5], [52, 6], [0, 1]], [[54, 5], [52, 6], [0, 2]], [[95, 7]], [[49, 7]], [[0, 5]], [[49, 8], [107, 8], [0, 6]], [[54, 5], [52, 9], [0, 7]], [[52, 6], [0, 8]], [[49, 10], [53, 11], [0, 9]], [[48, 12]], [[95, 13]], [[49, 13]], [[52, 9], [0, 13]]], [[[105, 1]], [[108, 2], [0, 1]], [[25, 3]], [[0, 3]]], [[[109, 1]], [[52, 0], [0, 1]]], [[[25, 1]], [[110, 0], [0, 1]]], [[[25, 1]], [[0, 1]]], [[[111, 1]], [[2, 1], [112, 2]], [[0, 2]]], [[[113, 1]], [[49, 2], [0, 1]], [[108, 3], [52, 3], [0, 2]], [[49, 4]], [[0, 4]]], [[[114, 1]], [[115, 0], [0, 1]]], [[[116, 1]], [[117, 2], [50, 3], [118, 4], [0, 1]], [[111, 4], [62, 4]], [[116, 5], [62, 5]], [[0, 4]], [[50, 3], [0, 5]]], [[[95, 1], [107, 1]], [[52, 2], [0, 1]], [[95, 1], [107, 1], [0, 2]]], [[[119, 2], [30, 1], [22, 1], [43, 1]], [[120, 2]], [[0, 2]]], [[[2, 0], [112, 1], [121, 0]], [[0, 1]]], [[[122, 1], [123, 1], [124, 1], [125, 1], [126, 1]], [[0, 1]]], [[[34, 1]], [[82, 2]], [[83, 3]], [[111, 4]], [[48, 5]], [[80, 6]], [[127, 7], [0, 6]], [[48, 8]], [[80, 9]], [[0, 9]]], [[[4, 1]], [[25, 2]], [[128, 3]], [[48, 4], [129, 5]], [[80, 6]], [[49, 7]], [[0, 6]], [[48, 4]]], [[[26, 1]], [[25, 2]], [[52, 1], [0, 2]]], [[[37, 1]], [[49, 2]], [[48, 3]], [[80, 4]], [[127, 5], [130, 1], [0, 4]], [[48, 6]], [[80, 7]], [[0, 7]]], [[[25, 1]], [[108, 2], [0, 1]], [[25, 3]], [[0, 3]]], [[[131, 1]], [[52, 2], [0, 1]], [[131, 1], [0, 2]]], [[[36, 1]], [[105, 2], [19, 3], [110, 3]], [[32, 4]], [[105, 2], [19, 3], [32, 4], [110, 3]], [[132, 5], [15, 5], [35, 6]], [[0, 5]], [[132, 7]], [[61, 5]]], [[[32, 1]], [[133, 2]], [[0, 2]]], [[[134, 1], [135, 1]], [[0, 1]]], [[[14, 1]], [[48, 2], [136, 3]], [[49, 4]], [[48, 2]], [[0, 4]]], [[[14, 1]], [[48, 2], [136, 3]], [[86, 4]], [[48, 2]], [[0, 4]]], [[[18, 1]], [[25, 2]], [[52, 1], [0, 2]]], [[[8, 1], [137, 2]], [[46, 2]], [[0, 2]]], [[[138, 1]], [[139, 0], [0, 1]]], [[[35, 1]], [[61, 2], [140, 3]], [[0, 2]], [[61, 2]]], [[[28, 1]], [[0, 1]]], [[[141, 1]], [[53, 2], [0, 1]], [[120, 3]], [[0, 3]]], [[[16, 1]], [[49, 2], [142, 3], [0, 1]], [[52, 4], [0, 2]], [[49, 5]], [[49, 2], [0, 4]], [[52, 6], [0, 5]], [[49, 7]], [[52, 8], [0, 7]], [[49, 7], [0, 8]]], [[[5, 1]], [[49, 2], [0, 1]], [[36, 3], [52, 3], [0, 2]], [[49, 4]], [[52, 5], [0, 4]], [[49, 6]], [[0, 6]]], [[[23, 1]], [[111, 2], [0, 1]], [[0, 2]]], [[[143, 1]], [[144, 0], [142, 0], [0, 1]]], [[[145, 1]], [[2, 2], [146, 3]], [[0, 2]], [[145, 1], [2, 2]]], [[[48, 1]], [[49, 2], [0, 1]], [[0, 2]]], [[[147, 1], [148, 1], [149, 1], [150, 1], [151, 1], [152, 1], [153, 1], [154, 1], [155, 1], [156, 1]], [[0, 1]]], [[[15, 1]], [[95, 2]], [[0, 2]]], [[[1, 1], [3, 1]], [[0, 1]]], [[[49, 1], [48, 2]], [[48, 2], [0, 1]], [[49, 3], [157, 4], [0, 2]], [[157, 4], [0, 3]], [[0, 4]]], [[[158, 1]], [[52, 2], [0, 1]], [[158, 1], [0, 2]]], [[[1, 1], [2, 2]], [[0, 1]], [[159, 3]], [[121, 4]], [[160, 1], [121, 4]]], [[[120, 1]], [[161, 0], [15, 0], [162, 0], [41, 0], [163, 0], [0, 1]]], [[[84, 1], [164, 2]], [[37, 3], [0, 1]], [[0, 2]], [[84, 4]], [[127, 5]], [[49, 2]]], [[[165, 1], [84, 1]], [[0, 1]]], [[[49, 1]], [[52, 2], [0, 1]], [[49, 1], [0, 2]]], [[[49, 1], [107, 1]], [[54, 2], [52, 3], [0, 1]], [[0, 2]], [[49, 4], [107, 4], [0, 3]], [[52, 3], [0, 4]]], [[[49, 1], [107, 1]], [[52, 2], [0, 1]], [[49, 1], [107, 1], [0, 2]]], [[[25, 1]], [[48, 2], [0, 1]], [[49, 3]], [[0, 3]]], [[[35, 1], [110, 2], [38, 3]], [[61, 4], [81, 5]], [[25, 4]], [[166, 6]], [[0, 4]], [[61, 4]], [[64, 4]]], [[[20, 1]], [[48, 2]], [[80, 3]], [[167, 4], [168, 5]], [[48, 6]], [[48, 7]], [[80, 8]], [[80, 9]], [[167, 4], [127, 10], [168, 5], [0, 8]], [[0, 9]], [[48, 11]], [[80, 12]], [[168, 5], [0, 12]]], [[[15, 1], [169, 2], [53, 3]], [[169, 4], [52, 5], [0, 1]], [[50, 6], [52, 7], [0, 2]], [[169, 8]], [[52, 5], [0, 4]], [[169, 9], [53, 3], [0, 5]], [[49, 10]], [[15, 11], [169, 2], [53, 3], [0, 7]], [[52, 12], [0, 8]], [[50, 13], [52, 5], [0, 9]], [[52, 7], [0, 10]], [[169, 14], [52, 15], [0, 11]], [[0, 12]], [[49, 4]], [[52, 15], [0, 14]], [[169, 16], [53, 3], [0, 15]], [[50, 17], [52, 15], [0, 16]], [[49, 14]]], [[[15, 1], [53, 2], [170, 3]], [[170, 5], [52, 4], [0, 1]], [[170, 6]], [[50, 7], [52, 8], [0, 3]], [[53, 2], [170, 9], [0, 4]], [[52, 4], [0, 5]], [[52, 10], [0, 6]], [[49, 11]], [[15, 12], [53, 2], [170, 3], [0, 8]], [[50, 13], [52, 4], [0, 9]], [[0, 10]], [[52, 8], [0, 11]], [[52, 15], [170, 14], [0, 12]], [[49, 5]], [[52, 15], [0, 14]], [[53, 2], [170, 16], [0, 15]], [[50, 17], [52, 15], [0, 16]], [[49, 14]]], [[[25, 1]], [[0, 1]]], [[[21, 1]], [[49, 2]], [[48, 3]], [[80, 4]], [[127, 5], [0, 4]], [[48, 6]], [[80, 7]], [[0, 7]]], [[[49, 1]], [[108, 2], [0, 1]], [[95, 3]], [[0, 3]]], [[[42, 1]], [[171, 2]], [[48, 3], [52, 1]], [[80, 4]], [[0, 4]]], [[[172, 1]], [[173, 0], [0, 1]]], [[[111, 2], [36, 1]], [[49, 2]], [[0, 2]]], [[[31, 1]], [[174, 2], [0, 1]], [[0, 2]]], [[[62, 1]], [[0, 1]]]], labels: [[0, "EMPTY"], [317, null], [4, null], [276, null], [1, "def"], [1, "raise"], [1, "True"], [3, null], [1, "not"], [1, "null"], [55, null], [2, null], [25, null], [1, "class"], [1, "lambda"], [16, null], [1, "print"], [1, "debugger"], [1, "nonlocal"], [52, null], [1, "try"], [1, "while"], [31, null], [1, "return"], [1, "assert"], [1, null], [1, "global"], [1, "del"], [1, "pass"], [54, null], [15, null], [1, "yield"], [1, "import"], [1, "False"], [1, "for"], [7, null], [1, "from"], [1, "if"], [9, null], [1, "break"], [1, "continue"], [49, null], [1, "with"], [14, null], [316, null], [19, null], [308, null], [1, "and"], [11, null], [326, null], [22, null], [261, null], [12, null], [35, null], [271, null], [325, null], [297, null], [339, null], [296, null], [26, null], [283, null], [8, null], [342, null], [329, null], [10, null], [266, null], [332, null], [45, null], [38, null], [40, null], [50, null], [46, null], [41, null], [42, null], [36, null], [43, null], [48, null], [44, null], [37, null], [39, null], [324, null], [260, null], [292, null], [1, "in"], [309, null], [273, null], [327, null], [272, null], [28, null], [21, null], [27, null], [29, null], [1, "is"], [30, null], [20, null], [290, null], [274, null], [333, null], [299, null], [270, null], [337, null], [279, null], [265, null], [281, null], [264, null], [286, null], [280, null], [320, null], [1, "as"], [284, null], [23, null], [328, null], [0, null], [1, "except"], [340, null], [18, null], [330, null], [268, null], [259, null], [312, null], [293, null], [321, null], [269, null], [277, null], [314, null], [315, null], [343, null], [1, "else"], [310, null], [51, null], [1, "elif"], [300, null], [301, null], [285, null], [303, null], [302, null], [335, null], [275, null], [258, null], [1, "or"], [334, null], [267, null], [34, null], [262, null], [33, null], [319, null], [13, null], [295, null], [263, null], [291, null], [311, null], [307, null], [313, null], [282, null], [298, null], [304, null], [278, null], [318, null], [322, null], [5, null], [6, null], [47, null], [17, null], [24, null], [305, null], [306, null], [323, null], [289, null], [1, "finally"], [331, null], [336, null], [338, null], [257, null], [32, null], [341, null]], keywords: { False: 33, "null": 9, True: 6, and: 47, as: 108, assert: 24, "break": 39, "class": 13, "continue": 40, "debugger": 17, def: 4, del: 27, elif: 130, "else": 127, except: 113, "finally": 168, "for": 34, from: 36, global: 26, "if": 37, "import": 32, "in": 83, is: 92, lambda: 14, nonlocal: 18, not: 8, or: 139, pass: 28, print: 16, raise: 5, "return": 23, "try": 20, "while": 21, "with": 42, yield: 31 }, tokens: { 0: 112, 1: 25, 2: 11, 3: 7, 4: 2, 5: 159, 6: 160, 7: 35, 8: 61, 9: 38, 10: 64, 11: 48, 12: 52, 13: 146, 14: 43, 15: 30, 16: 15, 17: 162, 18: 115, 19: 45, 20: 94, 21: 89, 22: 50, 23: 110, 24: 163, 25: 12, 26: 59, 27: 90, 28: 88, 29: 91, 30: 93, 31: 22, 32: 173, 33: 144, 34: 142, 35: 53, 36: 74, 37: 78, 38: 68, 39: 79, 40: 69, 41: 72, 42: 73, 43: 75, 44: 77, 45: 67, 46: 71, 47: 161, 48: 76, 49: 41, 50: 70, 51: 129, 52: 19, 54: 29, 55: 10 }, start: 256 } } , function(m, p) { function a(a, b) { this.filename = a; this.grammar = b; this.p_flags = 0; return this } function b(b, d) { void 0 === d && (d = "file_input"); b = new a(b,Sk.ParseTables); "file_input" === d ? b.setup(Sk.ParseTables.sym.file_input) : Sk.asserts.fail("todo;"); return b } a.FUTURE_PRINT_FUNCTION = "print_function"; a.FUTURE_UNICODE_LITERALS = "unicode_literals"; a.FUTURE_DIVISION = "division"; a.FUTURE_ABSOLUTE_IMPORT = "absolute_import"; a.FUTURE_WITH_STATEMENT = "with_statement"; a.FUTURE_NESTED_SCOPES = "nested_scopes"; a.FUTURE_GENERATORS = "generators"; a.CO_FUTURE_PRINT_FUNCTION = 65536; a.CO_FUTURE_UNICODE_LITERALS = 131072; a.CO_FUTURE_DIVISON = 8192; a.CO_FUTURE_ABSOLUTE_IMPORT = 16384; a.CO_FUTURE_WITH_STATEMENT = 32768; a.prototype.setup = function(a) { a = a || this.grammar.start; this.stack = [{ dfa: this.grammar.dfas[a], state: 0, node: { type: a, value: null, context: null, children: [] } }]; this.used_names = {} } ; a.prototype.addtoken = function(a, b, e) { var c, d = this.classify(a, b, e); a: for (; ; ) { var f = this.stack[this.stack.length - 1]; var k = f.dfa[0]; var n = k[f.state]; for (c = 0; c < n.length; ++c) { var l = n[c][0]; var q = n[c][1]; var m = this.grammar.labels[l][0]; if (d === l) { Sk.asserts.assert(256 > m); this.shift(a, b, q, e); for (e = q; 1 === k[e].length && 0 === k[e][0][0] && k[e][0][1] === e; ) { this.pop(); if (0 === this.stack.length) return !0; f = this.stack[this.stack.length - 1]; e = f.state; k = f.dfa[0] } return !1 } if (256 <= m && (l = this.grammar.dfas[m], l = l[1], l.hasOwnProperty(d))) { this.push(m, this.grammar.dfas[m], q, e); continue a } } b: { k = [0, f.state]; for (f = n.length; f--; ) if (n[f][0] === k[0] && n[f][1] === k[1]) { n = !0; break b } n = !1 } if (n) { if (this.pop(), 0 === this.stack.length) throw new Sk.builtin.SyntaxError("too much input",this.filename); } else throw a = e[0][0], new Sk.builtin.SyntaxError("bad input",this.filename,a,e); } } ; a.prototype.classify = function(b, d, e) { if (b === Sk.token.tokens.T_NAME) { this.used_names[d] = !0; var c = this.grammar.keywords.hasOwnProperty(d) && this.grammar.keywords[d]; "print" === d && (this.p_flags & a.CO_FUTURE_PRINT_FUNCTION || !0 === Sk.__future__.print_function) && (c = !1); if (c) return c } c = this.grammar.tokens.hasOwnProperty(b) && this.grammar.tokens[b]; if (!c) { d = "#" + b; for (let a in Sk.token.tokens) if (Sk.token.tokens[a] == b) { d = a; break } throw new Sk.builtin.SyntaxError("bad token " + d,this.filename,e[0][0],e); } return c } ; a.prototype.shift = function(a, b, e, h) { var c = this.stack[this.stack.length - 1].dfa , d = this.stack[this.stack.length - 1].node; d.children.push({ type: a, value: b, lineno: h[0][0], col_offset: h[0][1], children: null }); this.stack[this.stack.length - 1] = { dfa: c, state: e, node: d } } ; a.prototype.push = function(a, b, e, h) { a = { type: a, value: null, lineno: h[0][0], col_offset: h[0][1], children: [] }; this.stack[this.stack.length - 1] = { dfa: this.stack[this.stack.length - 1].dfa, state: e, node: this.stack[this.stack.length - 1].node }; this.stack.push({ dfa: b, state: 0, node: a }) } ; a.prototype.pop = function() { var a = this.stack.pop().node; if (a) if (0 !== this.stack.length) { var b = this.stack[this.stack.length - 1].node; b.children.push(a) } else this.rootnode = a, this.rootnode.used_names = this.used_names } ; Sk.parse = function(a, d) { var c = Sk.token.tokens.T_COMMENT , h = Sk.token.tokens.T_NL , g = Sk.token.tokens.T_OP , f = Sk.token.tokens.T_ENDMARKER , k = Sk.token.tokens.T_ENCODING , n = !1 , l = b(a); Sk._tokenize(a, function(a) { var b = a.split("\n").reverse().map(function(a) { return a + "\n" }); return function() { if (0 === b.length) throw new Sk.builtin.Exception("EOF"); return b.pop() } }(d), "utf-8", function(a) { var b = null; a.type !== c && a.type !== h && a.type !== k && (a.type === g && (b = Sk.OpMap[a.string]), l.addtoken(b || a.type, a.string, [a.start, a.end, a.line]), a.type === f && (n = !0)) }); if (!n) throw new Sk.builtin.SyntaxError("incomplete input",this.filename); return { cst: l.rootnode, flags: l.p_flags } } ; Sk.parseTreeDump = function(a, b) { var c; b = b || ""; var d = "" + b; if (256 <= a.type) for (d += Sk.ParseTables.number2symbol[a.type] + "\n", c = 0; c < a.children.length; ++c) d += Sk.parseTreeDump(a.children[c], b + " "); else d += Sk.token.tok_name[a.type] + ": " + (new Sk.builtin.str(a.value)).$r().v + "\n"; return d } ; Sk.exportSymbol("Sk.Parser", a); Sk.exportSymbol("Sk.parse", Sk.parse); Sk.exportSymbol("Sk.parseTreeDump", Sk.parseTreeDump) } , function(m, p) { Sk.astnodes = {}; Sk.astnodes.Load = function() {} ; Sk.astnodes.Store = function() {} ; Sk.astnodes.Del = function() {} ; Sk.astnodes.AugLoad = function() {} ; Sk.astnodes.AugStore = function() {} ; Sk.astnodes.Param = function() {} ; Sk.astnodes.And = function() {} ; Sk.astnodes.Or = function() {} ; Sk.astnodes.Add = function() {} ; Sk.astnodes.Sub = function() {} ; Sk.astnodes.Mult = function() {} ; Sk.astnodes.MatMult = function() {} ; Sk.astnodes.Div = function() {} ; Sk.astnodes.Mod = function() {} ; Sk.astnodes.Pow = function() {} ; Sk.astnodes.LShift = function() {} ; Sk.astnodes.RShift = function() {} ; Sk.astnodes.BitOr = function() {} ; Sk.astnodes.BitXor = function() {} ; Sk.astnodes.BitAnd = function() {} ; Sk.astnodes.FloorDiv = function() {} ; Sk.astnodes.Invert = function() {} ; Sk.astnodes.Not = function() {} ; Sk.astnodes.UAdd = function() {} ; Sk.astnodes.USub = function() {} ; Sk.astnodes.Eq = function() {} ; Sk.astnodes.NotEq = function() {} ; Sk.astnodes.Lt = function() {} ; Sk.astnodes.LtE = function() {} ; Sk.astnodes.Gt = function() {} ; Sk.astnodes.GtE = function() {} ; Sk.astnodes.Is = function() {} ; Sk.astnodes.IsNot = function() {} ; Sk.astnodes.In = function() {} ; Sk.astnodes.NotIn = function() {} ; Sk.astnodes.Module = function(a, b) { this.body = a; this.docstring = b; return this } ; Sk.astnodes.Interactive = function(a) { this.body = a; return this } ; Sk.astnodes.Expression = function(a) { this.body = a; return this } ; Sk.astnodes.Suite = function(a) { this.body = a; return this } ; Sk.astnodes.FunctionDef = function(a, b, c, d, e, h, g, f) { Sk.asserts.assert(null !== g && void 0 !== g); Sk.asserts.assert(null !== f && void 0 !== f); this.name = a; this.args = b; this.body = c; this.decorator_list = d; this.returns = e; this.docstring = h; this.lineno = g; this.col_offset = f; return this } ; Sk.astnodes.AsyncFunctionDef = function(a, b, c, d, e, h, g, f) { Sk.asserts.assert(null !== g && void 0 !== g); Sk.asserts.assert(null !== f && void 0 !== f); this.name = a; this.args = b; this.body = c; this.decorator_list = d; this.returns = e; this.docstring = h; this.lineno = g; this.col_offset = f; return this } ; Sk.astnodes.ClassDef = function(a, b, c, d, e, h, g, f) { Sk.asserts.assert(null !== g && void 0 !== g); Sk.asserts.assert(null !== f && void 0 !== f); this.name = a; this.bases = b; this.keywords = c; this.body = d; this.decorator_list = e; this.docstring = h; this.lineno = g; this.col_offset = f; return this } ; Sk.astnodes.Return = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.value = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.Delete = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.targets = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.Assign = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.targets = a; this.value = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.AugAssign = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.target = a; this.op = b; this.value = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.AnnAssign = function(a, b, c, d, e, h) { Sk.asserts.assert(null !== e && void 0 !== e); Sk.asserts.assert(null !== h && void 0 !== h); this.target = a; this.annotation = b; this.value = c; this.simple = d; this.lineno = e; this.col_offset = h; return this } ; Sk.astnodes.For = function(a, b, c, d, e, h) { Sk.asserts.assert(null !== e && void 0 !== e); Sk.asserts.assert(null !== h && void 0 !== h); this.target = a; this.iter = b; this.body = c; this.orelse = d; this.lineno = e; this.col_offset = h; return this } ; Sk.astnodes.AsyncFor = function(a, b, c, d, e, h) { Sk.asserts.assert(null !== e && void 0 !== e); Sk.asserts.assert(null !== h && void 0 !== h); this.target = a; this.iter = b; this.body = c; this.orelse = d; this.lineno = e; this.col_offset = h; return this } ; Sk.astnodes.While = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.test = a; this.body = b; this.orelse = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.If = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.test = a; this.body = b; this.orelse = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.With = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.items = a; this.body = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.AsyncWith = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.items = a; this.body = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.Raise = function(a, b, c, d, e, h) { Sk.asserts.assert(null !== e && void 0 !== e); Sk.asserts.assert(null !== h && void 0 !== h); this.exc = a; this.cause = b; this.inst = c; this.tback = d; this.lineno = e; this.col_offset = h; return this } ; Sk.astnodes.Try = function(a, b, c, d, e, h) { Sk.asserts.assert(null !== e && void 0 !== e); Sk.asserts.assert(null !== h && void 0 !== h); this.body = a; this.handlers = b; this.orelse = c; this.finalbody = d; this.lineno = e; this.col_offset = h; return this } ; Sk.astnodes.Assert = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.test = a; this.msg = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.Import = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.names = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.ImportFrom = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.module = a; this.names = b; this.level = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.Global = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.names = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.Nonlocal = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.names = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.Expr = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.value = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.Pass = function(a, b) { Sk.asserts.assert(null !== a && void 0 !== a); Sk.asserts.assert(null !== b && void 0 !== b); this.lineno = a; this.col_offset = b; return this } ; Sk.astnodes.Break = function(a, b) { Sk.asserts.assert(null !== a && void 0 !== a); Sk.asserts.assert(null !== b && void 0 !== b); this.lineno = a; this.col_offset = b; return this } ; Sk.astnodes.Continue = function(a, b) { Sk.asserts.assert(null !== a && void 0 !== a); Sk.asserts.assert(null !== b && void 0 !== b); this.lineno = a; this.col_offset = b; return this } ; Sk.astnodes.Print = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.dest = a; this.values = b; this.nl = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.Debugger = function(a, b) { Sk.asserts.assert(null !== a && void 0 !== a); Sk.asserts.assert(null !== b && void 0 !== b); this.lineno = a; this.col_offset = b; return this } ; Sk.astnodes.BoolOp = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.op = a; this.values = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.BinOp = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.left = a; this.op = b; this.right = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.UnaryOp = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.op = a; this.operand = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.Lambda = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.args = a; this.body = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.IfExp = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.test = a; this.body = b; this.orelse = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.Dict = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.keys = a; this.values = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.Set = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.elts = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.ListComp = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.elt = a; this.generators = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.SetComp = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.elt = a; this.generators = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.DictComp = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.key = a; this.value = b; this.generators = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.GeneratorExp = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.elt = a; this.generators = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.Await = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.value = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.Yield = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.value = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.YieldFrom = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.value = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.Compare = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.left = a; this.ops = b; this.comparators = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.Call = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.func = a; this.args = b; this.keywords = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.Num = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.n = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.Str = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.s = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.FormattedValue = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.value = a; this.conversion = b; this.format_spec = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.JoinedStr = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.values = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.Bytes = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.s = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.NameConstant = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.value = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.Ellipsis = function(a, b) { Sk.asserts.assert(null !== a && void 0 !== a); Sk.asserts.assert(null !== b && void 0 !== b); this.lineno = a; this.col_offset = b; return this } ; Sk.astnodes.Constant = function(a, b, c) { Sk.asserts.assert(null !== b && void 0 !== b); Sk.asserts.assert(null !== c && void 0 !== c); this.value = a; this.lineno = b; this.col_offset = c; return this } ; Sk.astnodes.Attribute = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.value = a; this.attr = b; this.ctx = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.Subscript = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.value = a; this.slice = b; this.ctx = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.Starred = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.value = a; this.ctx = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.Name = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.id = a; this.ctx = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.List = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.elts = a; this.ctx = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.Tuple = function(a, b, c, d) { Sk.asserts.assert(null !== c && void 0 !== c); Sk.asserts.assert(null !== d && void 0 !== d); this.elts = a; this.ctx = b; this.lineno = c; this.col_offset = d; return this } ; Sk.astnodes.Slice = function(a, b, c) { this.lower = a; this.upper = b; this.step = c; return this } ; Sk.astnodes.ExtSlice = function(a) { this.dims = a; return this } ; Sk.astnodes.Index = function(a) { this.value = a; return this } ; Sk.astnodes.comprehension = function(a, b, c, d) { this.target = a; this.iter = b; this.ifs = c; this.is_async = d; return this } ; Sk.astnodes.ExceptHandler = function(a, b, c, d, e) { Sk.asserts.assert(null !== d && void 0 !== d); Sk.asserts.assert(null !== e && void 0 !== e); this.type = a; this.name = b; this.body = c; this.lineno = d; this.col_offset = e; return this } ; Sk.astnodes.arguments_ = function(a, b, c, d, e, h) { this.args = a; this.vararg = b; this.kwonlyargs = c; this.kw_defaults = d; this.kwarg = e; this.defaults = h; return this } ; Sk.astnodes.arg = function a(a, b) { this.arg = a; this.annotation = b; return this } ; Sk.astnodes.keyword = function(a, b) { this.arg = a; this.value = b; return this } ; Sk.astnodes.alias = function(a, b) { this.name = a; this.asname = b; return this } ; Sk.astnodes.withitem = function(a, b) { this.context_expr = a; this.optional_vars = b; return this } ; Sk.astnodes.Module.prototype._astname = "Module"; Sk.astnodes.Module.prototype._fields = ["body", function(a) { return a.body } , "docstring", function(a) { return a.docstring } ]; Sk.astnodes.Interactive.prototype._astname = "Interactive"; Sk.astnodes.Interactive.prototype._fields = ["body", function(a) { return a.body } ]; Sk.astnodes.Expression.prototype._astname = "Expression"; Sk.astnodes.Expression.prototype._fields = ["body", function(a) { return a.body } ]; Sk.astnodes.Suite.prototype._astname = "Suite"; Sk.astnodes.Suite.prototype._fields = ["body", function(a) { return a.body } ]; Sk.astnodes.FunctionDef.prototype._astname = "FunctionDef"; Sk.astnodes.FunctionDef.prototype._fields = ["name", function(a) { return a.name } , "args", function(a) { return a.args } , "body", function(a) { return a.body } , "decorator_list", function(a) { return a.decorator_list } , "returns", function(a) { return a.returns } , "docstring", function(a) { return a.docstring } ]; Sk.astnodes.AsyncFunctionDef.prototype._astname = "AsyncFunctionDef"; Sk.astnodes.AsyncFunctionDef.prototype._fields = ["name", function(a) { return a.name } , "args", function(a) { return a.args } , "body", function(a) { return a.body } , "decorator_list", function(a) { return a.decorator_list } , "returns", function(a) { return a.returns } , "docstring", function(a) { return a.docstring } ]; Sk.astnodes.ClassDef.prototype._astname = "ClassDef"; Sk.astnodes.ClassDef.prototype._fields = ["name", function(a) { return a.name } , "bases", function(a) { return a.bases } , "keywords", function(a) { return a.keywords } , "body", function(a) { return a.body } , "decorator_list", function(a) { return a.decorator_list } , "docstring", function(a) { return a.docstring } ]; Sk.astnodes.Return.prototype._astname = "Return"; Sk.astnodes.Return.prototype._fields = ["value", function(a) { return a.value } ]; Sk.astnodes.Delete.prototype._astname = "Delete"; Sk.astnodes.Delete.prototype._fields = ["targets", function(a) { return a.targets } ]; Sk.astnodes.Assign.prototype._astname = "Assign"; Sk.astnodes.Assign.prototype._fields = ["targets", function(a) { return a.targets } , "value", function(a) { return a.value } ]; Sk.astnodes.AugAssign.prototype._astname = "AugAssign"; Sk.astnodes.AugAssign.prototype._fields = ["target", function(a) { return a.target } , "op", function(a) { return a.op } , "value", function(a) { return a.value } ]; Sk.astnodes.AnnAssign.prototype._astname = "AnnAssign"; Sk.astnodes.AnnAssign.prototype._fields = ["target", function(a) { return a.target } , "annotation", function(a) { return a.annotation } , "value", function(a) { return a.value } , "simple", function(a) { return a.simple } ]; Sk.astnodes.For.prototype._astname = "For"; Sk.astnodes.For.prototype._fields = ["target", function(a) { return a.target } , "iter", function(a) { return a.iter } , "body", function(a) { return a.body } , "orelse", function(a) { return a.orelse } ]; Sk.astnodes.AsyncFor.prototype._astname = "AsyncFor"; Sk.astnodes.AsyncFor.prototype._fields = ["target", function(a) { return a.target } , "iter", function(a) { return a.iter } , "body", function(a) { return a.body } , "orelse", function(a) { return a.orelse } ]; Sk.astnodes.While.prototype._astname = "While"; Sk.astnodes.While.prototype._fields = ["test", function(a) { return a.test } , "body", function(a) { return a.body } , "orelse", function(a) { return a.orelse } ]; Sk.astnodes.If.prototype._astname = "If"; Sk.astnodes.If.prototype._fields = ["test", function(a) { return a.test } , "body", function(a) { return a.body } , "orelse", function(a) { return a.orelse } ]; Sk.astnodes.With.prototype._astname = "With"; Sk.astnodes.With.prototype._fields = ["items", function(a) { return a.items } , "body", function(a) { return a.body } ]; Sk.astnodes.AsyncWith.prototype._astname = "AsyncWith"; Sk.astnodes.AsyncWith.prototype._fields = ["items", function(a) { return a.items } , "body", function(a) { return a.body } ]; Sk.astnodes.Raise.prototype._astname = "Raise"; Sk.astnodes.Raise.prototype._fields = ["exc", function(a) { return a.exc } , "cause", function(a) { return a.cause } , "inst", function(a) { return a.inst } , "tback", function(a) { return a.tback } ]; Sk.astnodes.Try.prototype._astname = "Try"; Sk.astnodes.Try.prototype._fields = ["body", function(a) { return a.body } , "handlers", function(a) { return a.handlers } , "orelse", function(a) { return a.orelse } , "finalbody", function(a) { return a.finalbody } ]; Sk.astnodes.Assert.prototype._astname = "Assert"; Sk.astnodes.Assert.prototype._fields = ["test", function(a) { return a.test } , "msg", function(a) { return a.msg } ]; Sk.astnodes.Import.prototype._astname = "Import"; Sk.astnodes.Import.prototype._fields = ["names", function(a) { return a.names } ]; Sk.astnodes.ImportFrom.prototype._astname = "ImportFrom"; Sk.astnodes.ImportFrom.prototype._fields = ["module", function(a) { return a.module } , "names", function(a) { return a.names } , "level", function(a) { return a.level } ]; Sk.astnodes.Global.prototype._astname = "Global"; Sk.astnodes.Global.prototype._fields = ["names", function(a) { return a.names } ]; Sk.astnodes.Nonlocal.prototype._astname = "Nonlocal"; Sk.astnodes.Nonlocal.prototype._fields = ["names", function(a) { return a.names } ]; Sk.astnodes.Expr.prototype._astname = "Expr"; Sk.astnodes.Expr.prototype._fields = ["value", function(a) { return a.value } ]; Sk.astnodes.Pass.prototype._astname = "Pass"; Sk.astnodes.Pass.prototype._fields = []; Sk.astnodes.Break.prototype._astname = "Break"; Sk.astnodes.Break.prototype._fields = []; Sk.astnodes.Continue.prototype._astname = "Continue"; Sk.astnodes.Continue.prototype._fields = []; Sk.astnodes.Print.prototype._astname = "Print"; Sk.astnodes.Print.prototype._fields = ["dest", function(a) { return a.dest } , "values", function(a) { return a.values } , "nl", function(a) { return a.nl } ]; Sk.astnodes.Debugger.prototype._astname = "Debugger"; Sk.astnodes.Debugger.prototype._fields = []; Sk.astnodes.BoolOp.prototype._astname = "BoolOp"; Sk.astnodes.BoolOp.prototype._fields = ["op", function(a) { return a.op } , "values", function(a) { return a.values } ]; Sk.astnodes.BinOp.prototype._astname = "BinOp"; Sk.astnodes.BinOp.prototype._fields = ["left", function(a) { return a.left } , "op", function(a) { return a.op } , "right", function(a) { return a.right } ]; Sk.astnodes.UnaryOp.prototype._astname = "UnaryOp"; Sk.astnodes.UnaryOp.prototype._fields = ["op", function(a) { return a.op } , "operand", function(a) { return a.operand } ]; Sk.astnodes.Lambda.prototype._astname = "Lambda"; Sk.astnodes.Lambda.prototype._fields = ["args", function(a) { return a.args } , "body", function(a) { return a.body } ]; Sk.astnodes.IfExp.prototype._astname = "IfExp"; Sk.astnodes.IfExp.prototype._fields = ["test", function(a) { return a.test } , "body", function(a) { return a.body } , "orelse", function(a) { return a.orelse } ]; Sk.astnodes.Dict.prototype._astname = "Dict"; Sk.astnodes.Dict.prototype._fields = ["keys", function(a) { return a.keys } , "values", function(a) { return a.values } ]; Sk.astnodes.Set.prototype._astname = "Set"; Sk.astnodes.Set.prototype._fields = ["elts", function(a) { return a.elts } ]; Sk.astnodes.ListComp.prototype._astname = "ListComp"; Sk.astnodes.ListComp.prototype._fields = ["elt", function(a) { return a.elt } , "generators", function(a) { return a.generators } ]; Sk.astnodes.SetComp.prototype._astname = "SetComp"; Sk.astnodes.SetComp.prototype._fields = ["elt", function(a) { return a.elt } , "generators", function(a) { return a.generators } ]; Sk.astnodes.DictComp.prototype._astname = "DictComp"; Sk.astnodes.DictComp.prototype._fields = ["key", function(a) { return a.key } , "value", function(a) { return a.value } , "generators", function(a) { return a.generators } ]; Sk.astnodes.GeneratorExp.prototype._astname = "GeneratorExp"; Sk.astnodes.GeneratorExp.prototype._fields = ["elt", function(a) { return a.elt } , "generators", function(a) { return a.generators } ]; Sk.astnodes.Await.prototype._astname = "Await"; Sk.astnodes.Await.prototype._fields = ["value", function(a) { return a.value } ]; Sk.astnodes.Yield.prototype._astname = "Yield"; Sk.astnodes.Yield.prototype._fields = ["value", function(a) { return a.value } ]; Sk.astnodes.YieldFrom.prototype._astname = "YieldFrom"; Sk.astnodes.YieldFrom.prototype._fields = ["value", function(a) { return a.value } ]; Sk.astnodes.Compare.prototype._astname = "Compare"; Sk.astnodes.Compare.prototype._fields = ["left", function(a) { return a.left } , "ops", function(a) { return a.ops } , "comparators", function(a) { return a.comparators } ]; Sk.astnodes.Call.prototype._astname = "Call"; Sk.astnodes.Call.prototype._fields = ["func", function(a) { return a.func } , "args", function(a) { return a.args } , "keywords", function(a) { return a.keywords } ]; Sk.astnodes.Num.prototype._astname = "Num"; Sk.astnodes.Num.prototype._fields = ["n", function(a) { return a.n } ]; Sk.astnodes.Str.prototype._astname = "Str"; Sk.astnodes.Str.prototype._fields = ["s", function(a) { return a.s } ]; Sk.astnodes.FormattedValue.prototype._astname = "FormattedValue"; Sk.astnodes.FormattedValue.prototype._fields = ["value", function(a) { return a.value } , "conversion", function(a) { return a.conversion } , "format_spec", function(a) { return a.format_spec } ]; Sk.astnodes.JoinedStr.prototype._astname = "JoinedStr"; Sk.astnodes.JoinedStr.prototype._fields = ["values", function(a) { return a.values } ]; Sk.astnodes.Bytes.prototype._astname = "Bytes"; Sk.astnodes.Bytes.prototype._fields = ["s", function(a) { return a.s } ]; Sk.astnodes.NameConstant.prototype._astname = "NameConstant"; Sk.astnodes.NameConstant.prototype._fields = ["value", function(a) { return a.value } ]; Sk.astnodes.Ellipsis.prototype._astname = "Ellipsis"; Sk.astnodes.Ellipsis.prototype._fields = []; Sk.astnodes.Constant.prototype._astname = "Constant"; Sk.astnodes.Constant.prototype._fields = ["value", function(a) { return a.value } ]; Sk.astnodes.Attribute.prototype._astname = "Attribute"; Sk.astnodes.Attribute.prototype._fields = ["value", function(a) { return a.value } , "attr", function(a) { return a.attr } , "ctx", function(a) { return a.ctx } ]; Sk.astnodes.Subscript.prototype._astname = "Subscript"; Sk.astnodes.Subscript.prototype._fields = ["value", function(a) { return a.value } , "slice", function(a) { return a.slice } , "ctx", function(a) { return a.ctx } ]; Sk.astnodes.Starred.prototype._astname = "Starred"; Sk.astnodes.Starred.prototype._fields = ["value", function(a) { return a.value } , "ctx", function(a) { return a.ctx } ]; Sk.astnodes.Name.prototype._astname = "Name"; Sk.astnodes.Name.prototype._fields = ["id", function(a) { return a.id } , "ctx", function(a) { return a.ctx } ]; Sk.astnodes.List.prototype._astname = "List"; Sk.astnodes.List.prototype._fields = ["elts", function(a) { return a.elts } , "ctx", function(a) { return a.ctx } ]; Sk.astnodes.Tuple.prototype._astname = "Tuple"; Sk.astnodes.Tuple.prototype._fields = ["elts", function(a) { return a.elts } , "ctx", function(a) { return a.ctx } ]; Sk.astnodes.Load.prototype._astname = "Load"; Sk.astnodes.Load.prototype._isenum = !0; Sk.astnodes.Store.prototype._astname = "Store"; Sk.astnodes.Store.prototype._isenum = !0; Sk.astnodes.Del.prototype._astname = "Del"; Sk.astnodes.Del.prototype._isenum = !0; Sk.astnodes.AugLoad.prototype._astname = "AugLoad"; Sk.astnodes.AugLoad.prototype._isenum = !0; Sk.astnodes.AugStore.prototype._astname = "AugStore"; Sk.astnodes.AugStore.prototype._isenum = !0; Sk.astnodes.Param.prototype._astname = "Param"; Sk.astnodes.Param.prototype._isenum = !0; Sk.astnodes.Slice.prototype._astname = "Slice"; Sk.astnodes.Slice.prototype._fields = ["lower", function(a) { return a.lower } , "upper", function(a) { return a.upper } , "step", function(a) { return a.step } ]; Sk.astnodes.ExtSlice.prototype._astname = "ExtSlice"; Sk.astnodes.ExtSlice.prototype._fields = ["dims", function(a) { return a.dims } ]; Sk.astnodes.Index.prototype._astname = "Index"; Sk.astnodes.Index.prototype._fields = ["value", function(a) { return a.value } ]; Sk.astnodes.And.prototype._astname = "And"; Sk.astnodes.And.prototype._isenum = !0; Sk.astnodes.Or.prototype._astname = "Or"; Sk.astnodes.Or.prototype._isenum = !0; Sk.astnodes.Add.prototype._astname = "Add"; Sk.astnodes.Add.prototype._isenum = !0; Sk.astnodes.Sub.prototype._astname = "Sub"; Sk.astnodes.Sub.prototype._isenum = !0; Sk.astnodes.Mult.prototype._astname = "Mult"; Sk.astnodes.Mult.prototype._isenum = !0; Sk.astnodes.MatMult.prototype._astname = "MatMult"; Sk.astnodes.MatMult.prototype._isenum = !0; Sk.astnodes.Div.prototype._astname = "Div"; Sk.astnodes.Div.prototype._isenum = !0; Sk.astnodes.Mod.prototype._astname = "Mod"; Sk.astnodes.Mod.prototype._isenum = !0; Sk.astnodes.Pow.prototype._astname = "Pow"; Sk.astnodes.Pow.prototype._isenum = !0; Sk.astnodes.LShift.prototype._astname = "LShift"; Sk.astnodes.LShift.prototype._isenum = !0; Sk.astnodes.RShift.prototype._astname = "RShift"; Sk.astnodes.RShift.prototype._isenum = !0; Sk.astnodes.BitOr.prototype._astname = "BitOr"; Sk.astnodes.BitOr.prototype._isenum = !0; Sk.astnodes.BitXor.prototype._astname = "BitXor"; Sk.astnodes.BitXor.prototype._isenum = !0; Sk.astnodes.BitAnd.prototype._astname = "BitAnd"; Sk.astnodes.BitAnd.prototype._isenum = !0; Sk.astnodes.FloorDiv.prototype._astname = "FloorDiv"; Sk.astnodes.FloorDiv.prototype._isenum = !0; Sk.astnodes.Invert.prototype._astname = "Invert"; Sk.astnodes.Invert.prototype._isenum = !0; Sk.astnodes.Not.prototype._astname = "Not"; Sk.astnodes.Not.prototype._isenum = !0; Sk.astnodes.UAdd.prototype._astname = "UAdd"; Sk.astnodes.UAdd.prototype._isenum = !0; Sk.astnodes.USub.prototype._astname = "USub"; Sk.astnodes.USub.prototype._isenum = !0; Sk.astnodes.Eq.prototype._astname = "Eq"; Sk.astnodes.Eq.prototype._isenum = !0; Sk.astnodes.NotEq.prototype._astname = "NotEq"; Sk.astnodes.NotEq.prototype._isenum = !0; Sk.astnodes.Lt.prototype._astname = "Lt"; Sk.astnodes.Lt.prototype._isenum = !0; Sk.astnodes.LtE.prototype._astname = "LtE"; Sk.astnodes.LtE.prototype._isenum = !0; Sk.astnodes.Gt.prototype._astname = "Gt"; Sk.astnodes.Gt.prototype._isenum = !0; Sk.astnodes.GtE.prototype._astname = "GtE"; Sk.astnodes.GtE.prototype._isenum = !0; Sk.astnodes.Is.prototype._astname = "Is"; Sk.astnodes.Is.prototype._isenum = !0; Sk.astnodes.IsNot.prototype._astname = "IsNot"; Sk.astnodes.IsNot.prototype._isenum = !0; Sk.astnodes.In.prototype._astname = "In"; Sk.astnodes.In.prototype._isenum = !0; Sk.astnodes.NotIn.prototype._astname = "NotIn"; Sk.astnodes.NotIn.prototype._isenum = !0; Sk.astnodes.comprehension.prototype._astname = "comprehension"; Sk.astnodes.comprehension.prototype._fields = ["target", function(a) { return a.target } , "iter", function(a) { return a.iter } , "ifs", function(a) { return a.ifs } , "is_async", function(a) { return a.is_async } ]; Sk.astnodes.ExceptHandler.prototype._astname = "ExceptHandler"; Sk.astnodes.ExceptHandler.prototype._fields = ["type", function(a) { return a.type } , "name", function(a) { return a.name } , "body", function(a) { return a.body } ]; Sk.astnodes.arguments_.prototype._astname = "arguments"; Sk.astnodes.arguments_.prototype._fields = ["args", function(a) { return a.args } , "vararg", function(a) { return a.vararg } , "kwonlyargs", function(a) { return a.kwonlyargs } , "kw_defaults", function(a) { return a.kw_defaults } , "kwarg", function(a) { return a.kwarg } , "defaults", function(a) { return a.defaults } ]; Sk.astnodes.arg.prototype._astname = "arg"; Sk.astnodes.arg.prototype._fields = ["arg", function(a) { return a.arg } , "annotation", function(a) { return a.annotation } ]; Sk.astnodes.keyword.prototype._astname = "keyword"; Sk.astnodes.keyword.prototype._fields = ["arg", function(a) { return a.arg } , "value", function(a) { return a.value } ]; Sk.astnodes.alias.prototype._astname = "alias"; Sk.astnodes.alias.prototype._fields = ["name", function(a) { return a.name } , "asname", function(a) { return a.asname } ]; Sk.astnodes.withitem.prototype._astname = "withitem"; Sk.astnodes.withitem.prototype._fields = ["context_expr", function(a) { return a.context_expr } , "optional_vars", function(a) { return a.optional_vars } ]; Sk.exportSymbol("Sk.astnodes", Sk.astnodes) } , function(m, p) { function a(a, b, c) { this.c_encoding = a; this.c_filename = b; this.c_flags = c || 0 } function b(a) { Sk.asserts.assert(void 0 !== a, "node must be defined"); return null === a.children ? 0 : a.children.length } function c(a, b) { Sk.asserts.assert(void 0 !== a, "node must be defined"); Sk.asserts.assert(void 0 !== b, "index of child must be specified"); return a.children[b] } function d(a, b) { Sk.asserts.assert(a.type === b, "node wasn't expected type") } function e(a, b, c) { throw new Sk.builtin.SyntaxError(c,a.c_filename,b.lineno); } function h(a) { Sk.asserts.assert("string" === typeof a, "expecting string, got " + typeof a); return new Sk.builtin.str(a) } function g(a) { var d, f; switch (a.type) { case r.single_input: if (c(a, 0).type === w.T_NEWLINE) break; else return g(c(a, 0)); case r.file_input: for (d = f = 0; d < b(a); ++d) { var e = c(a, d); e.type === r.stmt && (f += g(e)) } return f; case r.stmt: return g(c(a, 0)); case r.compound_stmt: return 1; case r.simple_stmt: return Math.floor(b(a) / 2); case r.suite: if (1 === b(a)) return g(c(a, 0)); f = 0; for (d = 2; d < b(a) - 1; ++d) f += g(c(a, d)); return f; default: Sk.asserts.fail("Non-statement found") } return 0 } function f(a, b, c, d) { c instanceof Sk.builtin.str && (c = c.v); if ("None" === c) throw new Sk.builtin.SyntaxError("assignment to None",a.c_filename,d); if ("True" === c || "False" === c) throw new Sk.builtin.SyntaxError("assignment to True or False is forbidden",a.c_filename,d); } function k(a, b, c, d) { var e; Sk.asserts.assert(c !== Sk.astnodes.AugStore && c !== Sk.astnodes.AugLoad, "context not AugStore or AugLoad"); var g = e = null; switch (b.constructor) { case Sk.astnodes.Attribute: case Sk.astnodes.Name: c === Sk.astnodes.Store && f(a, d, b.attr, d.lineno); b.ctx = c; break; case Sk.astnodes.Starred: b.ctx = c; k(a, b.value, c, d); break; case Sk.astnodes.Subscript: b.ctx = c; break; case Sk.astnodes.List: b.ctx = c; e = b.elts; break; case Sk.astnodes.Tuple: if (0 === b.elts.length) throw new Sk.builtin.SyntaxError("can't assign to ()",a.c_filename,d.lineno); b.ctx = c; e = b.elts; break; case Sk.astnodes.Lambda: g = "lambda"; break; case Sk.astnodes.Call: g = "function call"; break; case Sk.astnodes.BoolOp: case Sk.astnodes.BinOp: case Sk.astnodes.UnaryOp: g = "operator"; break; case Sk.astnodes.GeneratorExp: g = "generator expression"; break; case Sk.astnodes.Yield: g = "yield expression"; break; case Sk.astnodes.ListComp: g = "list comprehension"; break; case Sk.astnodes.SetComp: g = "set comprehension"; break; case Sk.astnodes.DictComp: g = "dict comprehension"; break; case Sk.astnodes.Dict: case Sk.astnodes.Set: case Sk.astnodes.Num: case Sk.astnodes.Str: g = "literal"; break; case Sk.astnodes.NameConstant: g = "True, False or None"; break; case Sk.astnodes.Compare: g = "comparison"; break; case Sk.astnodes.Repr: g = "repr"; break; case Sk.astnodes.IfExp: g = "conditional expression"; break; default: Sk.asserts.fail("unhandled expression in assignment") } if (g) throw new Sk.builtin.SyntaxError("can't " + (c === Sk.astnodes.Store ? "assign to" : "delete") + " " + g,a.c_filename,d.lineno); if (e) for (b = 0; b < e.length; ++b) k(a, e[b], c, d) } function n(a) { if (void 0 === Q[a.type]) throw new Sk.builtin.SyntaxError("invalid syntax",a.type,a.lineno); return Q[a.type] } function l(a, b) { return a.value ? new Sk.builtin.str(a.value) : new Sk.builtin.str(a) } function q(a, f) { d(f, r.comp_op); if (1 === b(f)) switch (f = c(f, 0), f.type) { case w.T_LESS: return Sk.astnodes.Lt; case w.T_GREATER: return Sk.astnodes.Gt; case w.T_EQEQUAL: return Sk.astnodes.Eq; case w.T_LESSEQUAL: return Sk.astnodes.LtE; case w.T_GREATEREQUAL: return Sk.astnodes.GtE; case w.T_NOTEQUAL: return Sk.astnodes.NotEq; case w.T_NAME: if ("in" === f.value) return Sk.astnodes.In; if ("is" === f.value) return Sk.astnodes.Is } else if (2 === b(f) && c(f, 0).type === w.T_NAME) { if ("in" === c(f, 1).value) return Sk.astnodes.NotIn; if ("is" === c(f, 0).value) return Sk.astnodes.IsNot } Sk.asserts.fail("invalid comp_op") } function u(a, b) { a && (a.lineno = b.lineno, a.col_offset = b.col_offset, a.end_lineno = b.end_lineno, a.end_col_offset = b.end_col_offset); return a } function z(a, d) { var f, e = []; Sk.asserts.assert(d.type === r.testlist || d.type === r.testlist_star_expr || d.type === r.listmaker || d.type === r.testlist_comp || d.type === r.testlist_safe || d.type === r.testlist1, "node type must be listlike"); for (f = 0; f < b(d); f += 2) Sk.asserts.assert(c(d, f).type === r.test || c(d, f).type === r.old_test || c(d, f).type === r.star_expr), e[f / 2] = x(a, c(d, f)); return e } function y(a, f) { var e; d(f, r.suite); var k = []; var h = 0; if (c(f, 0).type === r.simple_stmt) { f = c(f, 0); var v = b(f) - 1; c(f, v - 1).type === w.T_SEMI && --v; for (e = 0; e < v; e += 2) k[h++] = O(a, c(f, e)) } else for (e = 2; e < b(f) - 1; ++e) { v = c(f, e); d(v, r.stmt); var l = g(v); if (1 === l) k[h++] = O(a, v); else for (v = c(v, 0), d(v, r.simple_stmt), l = 0; l < b(v); l += 2) { if (0 === b(c(v, l))) { Sk.asserts.assert(l + 1 === b(v)); break } k[h++] = O(a, c(v, l)) } } Sk.asserts.assert(h === g(f)); return k } function t(a, f, e) { var g; d(f, r.exprlist); var h = []; for (g = 0; g < b(f); g += 2) { var v = x(a, c(f, g)); h[g / 2] = v; e && k(a, v, e, c(f, g)) } return h } function H(a, d) { a: for (; ; ) switch (d.type) { case r.import_as_name: a = null; var f = h(c(d, 0).value); 3 === b(d) && (a = c(d, 2).value); return new Sk.astnodes.alias(f,null == a ? null : h(a)); case r.dotted_as_name: if (1 === b(d)) { d = c(d, 0); continue a } else return a = H(a, c(d, 0)), Sk.asserts.assert(!a.asname), a.asname = h(c(d, 2).value), a; case r.dotted_name: if (1 === b(d)) return new Sk.astnodes.alias(h(c(d, 0).value),null); a = ""; for (f = 0; f < b(d); f += 2) a += c(d, f).value + "."; return new Sk.astnodes.alias(h(a.substr(0, a.length - 1)),null); case w.T_STAR: return new Sk.astnodes.alias(h("*"),null); default: throw new Sk.builtin.SyntaxError("unexpected import name",a.c_filename,d.lineno); } } function K(a, b) { Sk.asserts.assert(b.type == r.testlist_comp || b.type == r.argument); return ca(a, b, 0) } function C(a, d) { if (c(d, 0).type === w.T_MINUS && 2 === b(d)) { var f = c(d, 1); if (f.type === r.factor && 1 === b(f) && (f = c(f, 0), f.type === r.power && 1 === b(f))) { var e = c(f, 0); if (e.type === r.atom && (f = c(e, 0), f.type === w.T_NUMBER)) return f.value = "-" + f.value, G(a, e) } } a = x(a, c(d, 1)); switch (c(d, 0).type) { case w.T_PLUS: return new Sk.astnodes.UnaryOp(Sk.astnodes.UAdd,a,d.lineno,d.col_offset); case w.T_MINUS: return new Sk.astnodes.UnaryOp(Sk.astnodes.USub,a,d.lineno,d.col_offset); case w.T_TILDE: return new Sk.astnodes.UnaryOp(Sk.astnodes.Invert,a,d.lineno,d.col_offset) } Sk.asserts.fail("unhandled factor") } function F(a, g, k, h) { var v, l, n; d(g, r.arglist); for (v = n = l = 0; v < b(g); v++) { var D = c(g, v); D.type == r.argument && (1 == b(D) ? l++ : c(D, 1).type == r.comp_for ? (l++, h || e(a, D, "invalid syntax"), 1 < b(g) && e(a, D, "Generator expression must be parenthesized")) : c(D, 0).type == w.T_STAR ? l++ : n++) } var B = []; var q = []; for (v = h = n = l = 0; v < b(g); v++) if (D = c(g, v), D.type == r.argument) { var P = c(D, 0); if (1 == b(D)) { n && (h ? e(a, P, "positional argument follows keyword argument unpacking") : e(a, P, "positional argument follows keyword argument")); var m = x(a, P); if (!m) return null; B[l++] = m } else if (P.type == w.T_STAR) { if (h) return e(a, P, "iterable argument unpacking follows keyword argument unpacking"), null; m = x(a, c(D, 1)); if (!m) return null; D = new Sk.astnodes.Starred(m,Sk.astnodes.Load,P.lineno,P.col_offset); B[l++] = D } else if (P.type == w.T_DOUBLESTAR) { v++; m = x(a, c(D, 1)); if (!m) return null; D = new Sk.astnodes.keyword(null,m); q[n++] = D; h++ } else if (c(D, 1).type == r.comp_for) { m = K(a, D); if (!m) return null; B[l++] = m } else { var p; m = x(a, P); if (!m) return null; if (m.constructor === Sk.astnodes.Lambda) return e(a, P, "lambda cannot contain assignment"), null; if (m.constructor !== Sk.astnodes.Name) return e(a, P, "keyword can't be an expression"), null; if (f(a, m.id, D, 1)) return null; var u = m.id; for (p = 0; p < n; p++) if ((m = q[p].arg) && m === u) return e(a, P, "keyword argument repeated"), null; m = x(a, c(D, 2)); if (!m) return null; D = new Sk.astnodes.keyword(u,m); q[n++] = D } } return new Sk.astnodes.Call(k,B,q,k.lineno,k.col_offset) } function L(a, f, e) { d(f, r.trailer); if (c(f, 0).type == w.T_LPAR) return 2 == b(f) ? new Sk.astnodes.Call(e,null,null,f.lineno,f.col_offset) : F(a, c(f, 1), e, !0); if (c(f, 0).type == w.T_DOT) { var g = l(c(f, 1)); return g ? new Sk.astnodes.Attribute(e,g,Sk.astnodes.Load,f.lineno,f.col_offset) : null } d(c(f, 0), w.T_LSQB); d(c(f, 2), w.T_RSQB); f = c(f, 1); if (1 == b(f)) return (g = A(a, c(f, 0))) ? new Sk.astnodes.Subscript(e,g,Sk.astnodes.Load,f.lineno,f.col_offset) : null; var k, h = 1, v = []; for (k = 0; k < b(f); k += 2) { g = A(a, c(f, k)); if (!g) return null; g.kind != da.Index_kind && (h = 0); v[k / 2] = g } if (!h) return new Sk.astnodes.Subscript(e,new Sk.astnodes.ExtSlice(v),Sk.astnodes.Load,f.lineno,f.col_offset); a = []; for (k = 0; k < v.length; ++k) g = v[k], Sk.asserts.assert(g.kind == da.Index_kind && g.v.Index.value), a[k] = g.v.Index.value; g = new Sk.astnodes.Tuple(a,Sk.astnodes.Load,f.lineno,f.col_offset); return new Sk.astnodes.Subscript(e,new Sk.astnodes.Index(g),Sk.astnodes.Load,f.lineno,f.col_offset) } function W(a, f) { d(f, r.flow_stmt); var g = c(f, 0); switch (g.type) { case r.break_stmt: return new Sk.astnodes.Break(f.lineno,f.col_offset,f.end_lineno,f.end_col_offset); case r.continue_stmt: return new Sk.astnodes.Continue(f.lineno,f.col_offset,f.end_lineno,f.end_col_offset); case r.yield_stmt: return (a = x(a, c(g, 0))) ? new Sk.astnodes.Expr(a,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset) : null; case r.return_stmt: if (1 == b(g)) return new Sk.astnodes.Return(null,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset); var k = M(a, c(g, 1)); return k ? new Sk.astnodes.Return(k,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset) : null; case r.raise_stmt: if (1 == b(g)) return new Sk.astnodes.Raise(null,null,null,null,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset); if (2 <= b(g)) { var h = null; k = x(a, c(g, 1)); var l = null , v = null; 4 == b(g) && "from" == c(g, 2).value ? (Sk.__future__.python3 || e(a, c(g, 2), "raise ... from ... is not available in Python 2"), h = x(a, c(g, 3))) : 4 <= b(g) && "," == c(g, 2).value && (Sk.__future__.python3 && e(a, f, "Old raise syntax is not available in Python 3"), l = x(a, c(g, 3)), 6 == b(g) && (v = x(a, c(g, 5)))); return new Sk.astnodes.Raise(k,h,l,v,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset) } default: return Sk.asserts.fail("unexpected flow_stmt: ", g.type), null } } function N(a, d) { var e = null; Sk.asserts.assert(d.type === r.tfpdef || d.type === r.vfpdef); var g = c(d, 0); f(a, g, g.value, g.lineno); g = h(g.value); 3 == b(d) && c(d, 1).type === w.T_COLON && (e = x(a, c(d, 2))); return new Sk.astnodes.arg(g,e,d.lineno,d.col_offset) } function E(a, d, g, k, l) { var n = g , v = 0; k || e(a, c(d, g), "named arguments must follow bare *"); for (Sk.asserts.assert(l); n < b(d); ) { var D = c(d, n); switch (D.type) { case r.vfpdef: case r.tfpdef: n + 1 < b(d) && c(d, n + 1).type == w.T_EQUAL ? (l[v] = x(a, c(d, n + 2)), n += 2) : l[v] = null; var B = 3 == b(D) ? x(a, c(D, 2)) : null; D = c(D, 0); f(a, D, D.value, D.lineno); g = h(D.value); k[v++] = new Sk.astnodes.arg(g,B,D.lineno,D.col_offset); n += 2; break; case w.T_DOUBLESTAR: return n; default: e(a, D, "unexpected node") } } return n } function X(a, d) { var f, e, g, k = [], h = [], l = [], n = [], v = null, q = null; if (d.type === r.parameters) { if (2 === b(d)) return new Sk.astnodes.arguments_([],null,[],[],null,[]); d = c(d, 1) } Sk.asserts.assert(d.type === r.varargslist || d.type === r.typedargslist); for (f = e = g = 0; g < b(d); ) { var B = c(d, g); switch (B.type) { case r.tfpdef: case r.vfpdef: if (g + 1 < b(d) && c(d, g + 1).type == w.T_EQUAL) { h[e++] = x(a, c(d, g + 2)); g += 2; var m = 1 } else if (m) throw new Sk.builtin.SyntaxError("non-default argument follows default argument",a.c_filename,d.lineno); k[f++] = N(a, B); g += 2; break; case w.T_STAR: if (g + 1 >= b(d) || g + 2 == b(d) && c(d, g + 1).type == w.T_COMMA) throw new Sk.builtin.SyntaxError("named arguments must follow bare *",a.c_filename,d.lineno); B = c(d, g + 1); B.type == w.T_COMMA ? (g += 2, g = E(a, d, g, l, n)) : (v = N(a, B), g += 3, g < b(d) && (c(d, g).type == r.tfpdef || c(d, g).type == r.vfpdef) && (g = E(a, d, g, l, n))); break; case w.T_DOUBLESTAR: B = c(d, g + 1); Sk.asserts.assert(B.type == r.tfpdef || B.type == r.vfpdef); q = N(a, B); g += 3; break; default: Sk.asserts.fail("unexpected node in varargslist"); return } } return new Sk.astnodes.arguments_(k,v,l,n,q,h) } function aa(a, g, k, h) { var n = h ? c(g, 1) : g , v = null , D = 1 , q = null; if (h && 5 > a.c_feature_version) return e(a, n, "Async functions are only supported in Python 3.5 and greater"), null; d(n, r.funcdef); var B = l(c(n, D)); if (f(a, B, c(n, D), 0)) return null; var m = X(a, c(n, D + 1)); if (!m) return null; if (c(n, D + 2).type == w.T_RARROW) { v = x(a, c(n, D + 3)); if (!v) return null; D += 2 } if (c(n, D + 3).type == w.T_TYPE_COMMENT) { q = w.T_NEW_TYPE_COMMENT(c(n, D + 3)); if (!q) return null; D += 1 } var P = y(a, c(n, D + 3)); if (!P) return null; if (1 < b(c(n, D + 3)) && (D = c(c(n, D + 3), 1), D.type == w.T_TYPE_COMMENT)) { if (null != q) return e(a, n, "Cannot have two type comments on def"), null; q = w.T_NEW_TYPE_COMMENT(D); if (!q) return null } return h ? new Sk.astnodes.AsyncFunctionDef(B,m,P,k,v,q,g.lineno,g.col_offset,void 0,void 0) : new Sk.astnodes.FunctionDef(B,m,P,k,v,q,n.lineno,n.col_offset,void 0,void 0) } function S(a, e, g) { d(e, r.classdef); if (4 == b(e)) { var k = y(a, c(e, 3)); var h = l(c(e, 1).value); f(a, c(e, 3), h, e.lineno); return new Sk.astnodes.ClassDef(h,[],[],k,g,null,e.lineno,e.col_offset) } if (c(e, 3).type === w.T_RPAR) return k = y(a, c(e, 5)), h = l(c(e, 1).value), f(a, c(e, 3), h, c(e, 3).lineno), new Sk.astnodes.ClassDef(h,[],[],k,g,null,e.lineno,e.col_offset); h = l(c(e, 1)); h = new Sk.astnodes.Name(h,Sk.astnodes.Load,e.lineno,e.col_offset); var n = F(a, c(e, 3), h, !1); k = y(a, c(e, 6)); h = l(c(e, 1).value); f(a, c(e, 1), h, c(e, 1).lineno); return new Sk.astnodes.ClassDef(h,n.args,n.keywords,k,g,null,e.lineno,e.col_offset) } function R(a, f) { function e(a, f) { for (a = 0; ; ) { d(f, r.comp_iter); if (c(f, 0).type === r.comp_for) return a; f = c(f, 0); d(f, r.comp_if); a++; if (2 === b(f)) return a; f = c(f, 2) } } var g; var k = function(a, f) { a = 0; a: for (; ; ) { a++; d(f, r.comp_for); if (5 === b(f)) f = c(f, 4); else return a; b: for (; ; ) { d(f, r.comp_iter); f = c(f, 0); if (f.type === r.comp_for) continue a; else if (f.type === r.comp_if) if (3 === b(f)) { f = c(f, 2); continue b } else return a; break } break } Sk.asserts.fail("logic error in countCompFors") }(a, f); var h = []; for (g = 0; g < k; ++g) { d(f, r.comp_for); var l = c(f, 1); var n = t(a, l, Sk.astnodes.Store); var v = x(a, c(f, 3)); var q = 1 === b(l) ? new Sk.astnodes.comprehension(n[0],v,[]) : new Sk.astnodes.comprehension(new Sk.astnodes.Tuple(n,Sk.astnodes.Store,f.lineno,f.col_offset),v,[]); if (5 === b(f)) { f = c(f, 4); var m = e(a, f); l = []; for (n = 0; n < m; ++n) d(f, r.comp_iter), f = c(f, 0), d(f, r.comp_if), v = x(a, c(f, 1)), l[n] = v, 3 === b(f) && (f = c(f, 2)); f.type === r.comp_iter && (f = c(f, 0)); q.ifs = l } h[g] = q } return h } function V(a, f) { var e = []; a: { var g = f; var k = 0; b: for (; ; ) { var h = 0; k++; d(g, r.comp_for); c(g, 0).type == w.T_ASYNC && (h = 1); if (b(g) == 5 + h) g = c(g, 4 + h); else break a; c: for (; ; ) { d(g, r.comp_iter); g = c(g, 0); if (g.type === r.comp_for) continue b; else if (g.type === r.comp_if) if (3 === b(g)) { g = c(g, 2); continue c } else break a; break } break } k = void 0 } for (g = 0; g < k; g++) { var l = 0; c(f, 0).type == w.T_ASYNC && (l = 1); var n = c(f, 1 + l); var v = t(a, n, Sk.astnodes.Store); if (!v) return null; h = x(a, c(f, 3 + l)); if (!h) return null; var q = v[0]; v = 1 == b(n) ? new Sk.astnodes.comprehension(q,h,null,l) : new Sk.astnodes.comprehension(new Sk.astnodes.Tuple(v,Sk.astnodes.Store,q.lineno,q.col_offset,n.end_lineno,n.end_col_offset),h,null,l); if (b(f) == 5 + l) { q = []; f = c(f, 4 + l); a: for (h = f, l = 0; ; ) { d(h, r.comp_iter); if (c(h, 0).type == r.comp_for) { n = l; break a } h = c(h, 0); d(h, r.comp_if); l++; if (2 == b(h)) { n = l; break a } h = c(h, 2) } if (-1 == n) return null; for (l = 0; l < n; l++) { d(f, r.comp_iter); f = c(f, 0); d(f, r.comp_if); h = x(a, c(f, 1)); if (!h) return null; q[l] = h; 3 == b(f) && (f = c(f, 2)) } f.type == r.comp_iter && (f = c(f, 0)); v.ifs = q } e[g] = v } return e } function ca(a, d, f) { Sk.asserts.assert(1 < b(d)); var g = c(d, 0); var k = x(a, g); if (k.constructor === Sk.astnodes.Starred) return e(a, g, "iterable unpacking cannot be used in comprehension"), null; a = V(a, c(d, 1)); return 0 == f ? new Sk.astnodes.GeneratorExp(k,a,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset) : 1 == f ? new Sk.astnodes.ListComp(k,a,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset) : 2 == f ? new Sk.astnodes.SetComp(k,a,d.lineno,d.col_offset,d.end_lineno,d.end_col_offset) : null } function ea(a, b) { d(b, r.augassign); b = c(b, 0); switch (b.value.charAt(0)) { case "+": return Sk.astnodes.Add; case "-": return Sk.astnodes.Sub; case "/": return "/" === b.value.charAt(1) ? Sk.astnodes.FloorDiv : Sk.astnodes.Div; case "%": return Sk.astnodes.Mod; case "<": return Sk.astnodes.LShift; case ">": return Sk.astnodes.RShift; case "&": return Sk.astnodes.BitAnd; case "^": return Sk.astnodes.BitXor; case "|": return Sk.astnodes.BitOr; case "*": return "*" === b.value.charAt(1) ? Sk.astnodes.Pow : Sk.astnodes.Mult; case "@": if (Sk.__future__.python3) return Sk.astnodes.MatMult; default: Sk.asserts.fail("invalid augassign") } } function M(a, d) { Sk.asserts.assert(0 < b(d)); d.type === r.testlist_comp ? 1 < b(d) && Sk.asserts.assert(c(d, 1).type !== r.comp_for) : Sk.asserts.assert(d.type === r.testlist || d.type === r.testlist_star_expr); return 1 === b(d) ? x(a, c(d, 0)) : new Sk.astnodes.Tuple(z(a, d),Sk.astnodes.Load,d.lineno,d.col_offset) } function I(a, e) { d(e, r.expr_stmt); if (1 === b(e)) return new Sk.astnodes.Expr(M(a, c(e, 0)),e.lineno,e.col_offset); if (c(e, 1).type === r.augassign) { var g = c(e, 0); var h = M(a, g); k(a, h, Sk.astnodes.Store, g); switch (h.constructor) { case Sk.astnodes.Name: var l = h.id; f(a, g, l, e.lineno); break; case Sk.astnodes.Attribute: case Sk.astnodes.Subscript: break; case Sk.astnodes.GeneratorExp: throw new Sk.builtin.SyntaxError("augmented assignment to generator expression not possible",a.c_filename,e.lineno); case Sk.astnodes.Yield: throw new Sk.builtin.SyntaxError("augmented assignment to yield expression not possible",a.c_filename,e.lineno); default: throw new Sk.builtin.SyntaxError("illegal expression for augmented assignment",a.c_filename,e.lineno); } g = c(e, 2); l = g.type === r.testlist ? M(a, g) : x(a, g); return new Sk.astnodes.AugAssign(h,ea(a, c(e, 1)),l,e.lineno,e.col_offset) } if (c(e, 1).type === r.annassign) { if (!Sk.__future__.python3) throw new Sk.builtin.SyntaxError("Annotated assignment is not supported in Python 2",a.c_filename,e.lineno); g = c(e, 0); var n = c(e, 1); var v = 1; for (h = g; 1 == b(h); ) h = c(h, 0); 0 < b(h) && c(h, 0).type == w.T_LPAR && (v = 0); h = M(a, g); switch (h.constructor) { case Sk.astnodes.Name: l = h.id; f(a, g, l, e.lineno); k(a, h, Sk.astnodes.Store, g); break; case Sk.astnodes.Attribute: l = h.attr; f(a, g, l, e.lineno); k(a, h, Sk.astnodes.Store, g); break; case Sk.astnodes.Subscript: k(a, h, Sk.astnodes.Store, g); break; case Sk.astnodes.List: throw new Sk.builtin.SyntaxError("only single target (not list) can be annotated",a.c_filename,e.lineno); case Sk.astnodes.Tuple: throw new Sk.builtin.SyntaxError("only single target (not tuple) can be annotated",a.c_filename,e.lineno); default: throw new Sk.builtin.SyntaxError("illegal target for annotation",a.c_filename,e.lineno); } h.constructor != Sk.astnodes.Name && (v = 0); g = c(n, 1); l = x(a, g); if (2 == b(n)) return new Sk.astnodes.AnnAssign(h,l,null,v,e.lineno,e.col_offset); g = c(n, 3); a = x(a, g); return new Sk.astnodes.AnnAssign(h,l,a,v,e.lineno,e.col_offset) } d(c(e, 1), w.T_EQUAL); v = []; for (h = 0; h < b(e) - 2; h += 2) { g = c(e, h); if (g.type === r.yield_expr) throw new Sk.builtin.SyntaxError("assignment to yield expression not possible",a.c_filename,e.lineno); g = M(a, g); k(a, g, Sk.astnodes.Store, c(e, h)); v[h / 2] = g } g = c(e, b(e) - 1); a = g.type === r.testlist_star_expr ? M(a, g) : x(a, g); return new Sk.astnodes.Assign(v,a,e.lineno,e.col_offset) } function Z(a, b, c, d, f) { Sk.asserts.assert(c >= b); Sk.asserts.assert("{" == a.charAt(b - 1)); Sk.asserts.assert("}" == a.charAt(c) || "!" == a.charAt(c) || ":" == a.charAt(c)); a = a.substring(b, c); /^\s*$/.test(a) && e(d, f, "f-string: empty expression not allowed"); try { let b = Sk.parse("", "(" + a + ")"); var g = Sk.astFromParse(b.cst, "", b.flags) } catch (ba) { throw ba.traceback && ba.traceback[0] && (g = ba.traceback[0], g.lineno = (g.lineno || 1) - 1 + f.lineno, g.filename = d.c_filename), ba; } Sk.asserts.assert(1 == g.body.length && g.body[0].constructor === Sk.astnodes.Expr); return g.body[0].value } function Y(a, b, c, d, f, g, k) { Sk.asserts.assert("{" == a.charAt(b)); b++; var h = b; let l = null, n = 0, D = 0, v, q, m = ()=>e(g, k, "f-string: expecting '}'"); for (Sk.asserts.assert(b <= c); b < c; b++) { let d = a.charAt(b); "\\" == d && e(g, k, "f-string expression part cannot include a backslash"); if (l) d == l && (3 == n ? b + 2 < c && a.charAt(b + 1) == d && a.charAt(b + 2) == d && (b += 2, l = n = 0) : n = l = 0); else if ("'" == d || '"' == d) b + 2 < c && a.charAt(b + 1) == d && a.charAt(b + 2) == d ? (n = 3, b += 2) : n = 1, l = d; else if ("[" == d || "{" == d || "(" == d) D++; else if (0 != D && ("]" == d || "}" == d || ")" == d)) D--; else if ("#" == d) e(g, k, "f-string expression part cannot include '#'"); else if (!(0 != D || "!" != d && ":" != d && "}" != d || "!" == d && b + 1 < c && "=" == a.charAt(b + 1))) break } l && e(g, k, "f-string: unterminated string"); D && e(g, k, "f-string: mismatched '(', '{', or '['"); h = Z(a, h, b, g, k); "!" == a.charAt(b) && (b++, b >= c && m(), q = a.charAt(b), b++, "s" != q && "r" != q && "a" != q && e(g, k, "f-string: invalid conversion character: expected 's', 'r', or 'a'")); b >= c && m(); ":" == a.charAt(b) && (b++, b >= c && m(), [v,b] = J(a, b, c, d, f + 1, g, k)); (b >= c || "}" != a.charAt(b)) && m(); b++; return [new Sk.astnodes.FormattedValue(h,q,v,k.lineno,k.col_offset), b] } function J(a, b, c, d, f, e, g) { let k = [] , h = a=>{ if (-1 !== a.indexOf("}")) { if (/(^|[^}])}(}})*($|[^}])/.test(a)) throw new SyntaxError("f-string: single '}' is not allowed",g.lineno,g.col_offset); a = a.replace(/}}/g, "}") } k.push(new Sk.astnodes.Str(new Sk.builtin.str(a),g.lineno,g.col_offset,e.end_lineno,g.end_col_offset)) } ; for (; b < c; ) { let l = a.indexOf("{", b); if (0 !== f) { let d = a.indexOf("}", b); -1 !== d && (-1 === l ? c = d : l > d && (l = -1, c = d)) } if (-1 === l) { h(a.substring(b, c)); b = c; break } else if (l + 1 < c && "{" === a.charAt(l + 1)) h(a.substring(b, l + 1)), b = l + 2; else { h(a.substring(b, l)); b = l; let[n,D] = Y(a, l, c, d, f, e, g); k.push(n); b = D } } return [new Sk.astnodes.JoinedStr(k,g.lineno,g.col_offset), b] } function U(a, b, c) { var d = b.charAt(b.length - 1); if (-1 !== b.indexOf("_")) { if (fa.test(b)) throw new Sk.builtin.SyntaxError("invalid syntax",a.c_filename,c); if (ha.test(b)) throw new Sk.builtin.SyntaxError("invalid decimal literal",a.c_filename,c); b = b.replace(ia, "") } if ("j" === d || "J" === d) return Sk.builtin.complex.complex_subtype_from_string(b); if ("l" === d || "L" === d) return Sk.longFromStr(b.substr(0, b.length - 1), 0); if (-1 !== b.indexOf(".")) return new Sk.builtin.float_(parseFloat(b)); c = b; a = !1; "-" === b.charAt(0) && (c = b.substr(1), a = !0); if ("0" !== c.charAt(0) || "x" !== c.charAt(1) && "X" !== c.charAt(1)) { if (-1 !== b.indexOf("e") || -1 !== b.indexOf("E")) return new Sk.builtin.float_(parseFloat(b)); if ("0" !== c.charAt(0) || "b" !== c.charAt(1) && "B" !== c.charAt(1)) if ("0" === c.charAt(0)) if ("0" === c) c = 0; else { c = c.substring(1); if ("o" === c.charAt(0) || "O" === c.charAt(0)) c = c.substring(1); c = parseInt(c, 8) } else c = parseInt(c, 10); else c = c.substring(2), c = parseInt(c, 2) } else c = c.substring(2), c = parseInt(c, 16); return c > Sk.builtin.int_.threshold$ && Math.floor(c) === c && -1 === b.indexOf("e") && -1 === b.indexOf("E") ? Sk.longFromStr(b, 0) : a ? new Sk.builtin.int_(-c) : new Sk.builtin.int_(c) } function A(a, f) { var e, g; d(f, r.subscript); var k = c(f, 0); var h = e = g = null; if (k.type === w.T_DOT) return new Sk.astnodes.Ellipsis; if (1 === b(f) && k.type === r.test) return new Sk.astnodes.Index(x(a, k)); k.type === r.test && (g = x(a, k)); k.type === w.T_COLON ? 1 < b(f) && (k = c(f, 1), k.type === r.test && (e = x(a, k))) : 2 < b(f) && (k = c(f, 2), k.type === r.test && (e = x(a, k))); k = c(f, b(f) - 1); k.type === r.sliceop && (1 === b(k) ? (k = c(k, 0), h = new Sk.astnodes.NameConstant(Sk.builtin.none.none$,Sk.astnodes.Load,k.lineno,k.col_offset)) : (k = c(k, 1), k.type === r.test && (h = x(a, k)))); return new Sk.astnodes.Slice(g,e,h) } function G(a, f) { var g = c(f, 0); switch (g.type) { case w.T_NAME: var k = g.value; if (4 <= k.length && 5 >= k.length) { if ("None" === k) return new Sk.astnodes.NameConstant(Sk.builtin.none.none$,f.lineno,f.col_offset); if ("True" === k) return new Sk.astnodes.NameConstant(Sk.builtin.bool.true$,f.lineno,f.col_offset); if ("False" === k) return new Sk.astnodes.NameConstant(Sk.builtin.bool.false$,f.lineno,f.col_offset) } a = l(k, a); return new Sk.astnodes.Name(a,Sk.astnodes.Load,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset); case w.T_STRING: g = []; for (var n = 0; n < b(f); ++n) { var q = c(f, n).value; var m = a; var v = c(f, n); var p = q; var B = p.charAt(0); for (var t = !1, y = q = !1; ; ) { if ("u" !== B && "U" !== B) if ("r" === B || "R" === B) t = !0; else if ("b" === B || "B" === B) y = !0; else if ("f" === B || "F" === B) q = !0; else break; p = p.substr(1); B = p.charAt(0) } Sk.asserts.assert("'" === B || '"' === B && p.charAt(p.length - 1) === B); p = p.substr(1, p.length - 2); 4 <= p.length && p.charAt(0) === B && p.charAt(1) === B && (Sk.asserts.assert(p.charAt(p.length - 1) === B && p.charAt(p.length - 2) === B), p = p.substr(2, p.length - 4)); if (t || -1 === p.indexOf("\\")) { if (y) for (B = 0; B < p.length; B++) 127 < p.charCodeAt(B) && e(m, v, "bytes can only contain ASCII literal characters"); m = [h(p), q, y] } else { t = p; var F = t.length , C = ""; for (p = 0; p < F; ++p) B = t.charAt(p), "\\" === B ? (++p, B = t.charAt(p), "n" === B ? C += "\n" : "\\" === B ? C += "\\" : "t" === B ? C += "\t" : "r" === B ? C += "\r" : "b" === B ? C += "\b" : "f" === B ? C += "\f" : "v" === B ? C += "\v" : "0" === B ? C += "\x00" : '"' === B ? C += '"' : "'" === B ? C += "'" : "\n" !== B && ("x" === B ? (p + 2 >= F && e(m, v, "Truncated \\xNN escape"), C += String.fromCharCode(parseInt(t.substr(p + 1, 2), 16)), p += 2) : y || "u" !== B ? y || "U" !== B ? C += "\\" + B : (p + 8 >= F && e(m, v, "Truncated \\UXXXXXXXX escape"), C += String.fromCodePoint(parseInt(t.substr(p + 1, 8), 16)), p += 8) : (p + 4 >= F && e(m, v, "Truncated \\uXXXX escape"), C += String.fromCharCode(parseInt(t.substr(p + 1, 4), 16)), p += 4))) : y && 127 < B.charCodeAt(0) ? e(m, v, "bytes can only contain ASCII literal characters") : C += B; m = C; m = [h(m), q, y] } q = m; m = q[0]; v = q[1]; q = q[2]; 0 != n && k !== q && e(a, f, "cannot mix bytes and nonbytes literals"); k = q; if (v) { if (!Sk.__future__.python3) throw new Sk.builtin.SyntaxError("invalid string (f-strings are not supported in Python 2)",a.c_filename,c(f, n).lineno); var A = m.$jsstr(); [A] = J(A, 0, A.length, !1, 0, a, c(f, n)); g.push.apply(g, A.values); A = null } else A ? A.s = A.s.sq$concat(m) : (A = new (k ? Sk.astnodes.Bytes : Sk.astnodes.Str)(m,f.lineno,f.col_offset,a.end_lineno,f.end_col_offset), g.push(A)) } f = 1 === g.length && g[0].constructor === Sk.astnodes.Str ? g[0] : new Sk.astnodes.JoinedStr(g,f.lineno,f.col_offset,a.end_lineno,f.end_col_offset); return f; case w.T_NUMBER: return new Sk.astnodes.Num(U(a, g.value, f.lineno),f.lineno,f.col_offset); case w.T_ELLIPSIS: return new Sk.astnodes.Ellipsis(f.lineno,f.col_offset,f.end_lineno,f.end_col_offset); case w.T_LPAR: return g = c(f, 1), g.type == w.T_RPAR ? new Sk.astnodes.Tuple([],Sk.astnodes.Load,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset) : g.type == r.yield_expr ? x(a, g) : 1 == b(g) ? M(a, g) : c(g, 1).type == r.comp_for ? u(K(a, g), f) : u(M(a, g), f); case w.T_LSQB: g = c(f, 1); if (g.type == w.T_RSQB) return new Sk.astnodes.List([],Sk.astnodes.Load,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset); d(g, r.testlist_comp); if (1 == b(g) || c(g, 1).type == w.T_COMMA) return (a = z(a, g)) ? new Sk.astnodes.List(a,Sk.astnodes.Load,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset) : null; k = g; Sk.asserts.assert(k.type == r.testlist_comp); a = ca(a, k, 1); return u(a, f); case w.T_LBRACE: g = c(f, 1); if (g.type == w.T_RBRACE) return new Sk.astnodes.Dict(null,null,f.lineno,f.col_offset,f.end_lineno,f.end_col_offset); k = c(g, 0).type == w.T_DOUBLESTAR; if (1 == b(g) || 1 < b(g) && c(g, 1).type == w.T_COMMA) { k = g; n = []; Sk.asserts.assert(k.type === r.dictorsetmaker); for (g = 0; g < b(k); g += 2) A = x(a, c(k, g)), n[g / 2] = A; a = new Sk.astnodes.Set(n,k.lineno,k.col_offset) } else if (1 < b(g) && c(g, 1).type == r.comp_for) k = g, Sk.asserts.assert(k.type === r.dictorsetmaker), Sk.asserts.assert(1 < b(k)), g = x(a, c(k, 0)), a = R(a, c(k, 1)), a = new Sk.astnodes.SetComp(g,a,k.lineno,k.col_offset); else if (b(g) > 3 - k && c(g, 3 - k).type == r.comp_for) { if (k) return e(a, f, "dict unpacking cannot be used in dict comprehension"), null; k = g; Sk.asserts.assert(3 < b(k)); d(c(k, 1), w.T_COLON); g = x(a, c(k, 0)); n = x(a, c(k, 2)); a = R(a, c(k, 3)); a = new Sk.astnodes.DictComp(g,n,a,k.lineno,k.col_offset) } else { k = g; n = []; A = []; for (q = g = 0; q < b(k); q++) m = a, v = k, y = q, c(v, y).type == w.T_DOUBLESTAR ? (Sk.asserts.assert(2 <= b(v) - y), q = x(m, c(v, y + 1)), m = { key: null, value: q, i: y + 2 }) : (Sk.asserts.assert(3 <= b(v) - y), (q = x(m, c(v, y))) ? (p = q, d(c(v, y + 1), w.T_COLON), m = (q = x(m, c(v, y + 2))) ? { key: p, value: q, i: y + 3 } : !1) : m = 0), q = m.i, n[g] = m.key, A[g] = m.value, g++; a = new Sk.astnodes.Dict(n,A,k.lineno,k.col_offset,k.end_lineno,k.end_col_offset) } return u(a, f); default: return Sk.asserts.fail("unhandled atom " + g.type), null } } function T(a, f) { var e, g = 0; d(f, r.atom_expr); var k = b(f); c(f, 0).type === w.T_AWAIT && (g = 1, Sk.asserts.assert(1 < k)); var h = G(a, c(f, g)); if (!h) return null; if (1 === k) return h; if (g && 2 === k) return new Sk.astnodes.Await(h,f.lineno,f.col_offset); for (e = g + 1; e < k; e++) { var l = c(f, e); if (l.type !== r.trailer) break; l = L(a, l, h); if (!l) return null; l.lineno = h.lineno; l.col_offset = h.col_offset; h = l } return g ? new Sk.astnodes.Await(h,f.line,f.col_offset) : h } function x(a, f) { a: for (; ; ) { switch (f.type) { case r.test: case r.test_nocond: if (c(f, 0).type === r.lambdef || c(f, 0).type === r.lambdef_nocond) { var e = c(f, 0); 3 === b(e) ? (f = new Sk.astnodes.arguments_([],null,null,[]), a = x(a, c(e, 2))) : (f = X(a, c(e, 1)), a = x(a, c(e, 3))); return new Sk.astnodes.Lambda(f,a,e.lineno,e.col_offset) } if (1 < b(f)) return Sk.asserts.assert(5 === b(f)), new Sk.astnodes.IfExp(x(a, c(f, 2)),x(a, c(f, 0)),x(a, c(f, 4)),f.lineno,f.col_offset); case r.or_test: case r.and_test: if (1 === b(f)) { f = c(f, 0); continue a } var g = []; for (e = 0; e < b(f); e += 2) g[e / 2] = x(a, c(f, e)); if ("and" === c(f, 1).value) return new Sk.astnodes.BoolOp(Sk.astnodes.And,g,f.lineno,f.col_offset); Sk.asserts.assert("or" === c(f, 1).value); return new Sk.astnodes.BoolOp(Sk.astnodes.Or,g,f.lineno,f.col_offset); case r.not_test: if (1 === b(f)) { f = c(f, 0); continue a } else return new Sk.astnodes.UnaryOp(Sk.astnodes.Not,x(a, c(f, 1)),f.lineno,f.col_offset); case r.comparison: if (1 === b(f)) { f = c(f, 0); continue a } else { var k = []; g = []; for (e = 1; e < b(f); e += 2) k[(e - 1) / 2] = q(a, c(f, e)), g[(e - 1) / 2] = x(a, c(f, e + 1)); return new Sk.astnodes.Compare(x(a, c(f, 0)),k,g,f.lineno,f.col_offset) } case r.star_expr: return d(f, r.star_expr), new Sk.astnodes.Starred(x(a, c(f, 1)),Sk.astnodes.Load,f.lineno,f.col_offset); case r.expr: case r.xor_expr: case r.and_expr: case r.shift_expr: case r.arith_expr: case r.term: if (1 === b(f)) { f = c(f, 0); continue a } var h = f , l = new Sk.astnodes.BinOp(x(a, c(h, 0)),n(c(h, 1)),x(a, c(h, 2)),h.lineno,h.col_offset) , m = (b(h) - 1) / 2; for (f = 1; f < m; ++f) e = c(h, 2 * f + 1), g = n(e), k = x(a, c(h, 2 * f + 2)), l = new Sk.astnodes.BinOp(l,g,k,e.lineno,e.col_offset); return l; case r.yield_expr: return g = !1, k = null, 1 < b(f) && (e = c(f, 1)), e && (k = c(e, b(e) - 1), 2 == b(e) ? (g = !0, k = x(a, k)) : k = M(a, k)), g ? new Sk.astnodes.YieldFrom(k,f.lineno,f.col_offset) : new Sk.astnodes.Yield(k,f.lineno,f.col_offset); case r.factor: if (1 === b(f)) { f = c(f, 0); continue a } return C(a, f); case r.power: return e = f, d(e, r.power), f = T(a, c(e, 0)), 1 !== b(e) && c(e, b(e) - 1).type === r.factor && (a = x(a, c(e, b(e) - 1)), f = new Sk.astnodes.BinOp(f,Sk.astnodes.Pow,a,e.lineno,e.col_offset)), f; default: Sk.asserts.fail("unhandled expr", "n.type: %d", f.type) } break } } function O(a, f) { f.type === r.stmt && (Sk.asserts.assert(1 === b(f)), f = c(f, 0)); f.type === r.simple_stmt && (Sk.asserts.assert(1 === g(f)), f = c(f, 0)); if (f.type === r.small_stmt) switch (f = c(f, 0), f.type) { case r.expr_stmt: return I(a, f); case r.del_stmt: var l = f; d(l, r.del_stmt); return new Sk.astnodes.Delete(t(a, c(l, 1), Sk.astnodes.Del),l.lineno,l.col_offset); case r.pass_stmt: return new Sk.astnodes.Pass(f.lineno,f.col_offset); case r.flow_stmt: return W(a, f); case r.import_stmt: var n = f, q; d(n, r.import_stmt); var m = n.lineno; f = n.col_offset; n = c(n, 0); if (n.type === r.import_name) { n = c(n, 1); d(n, r.dotted_as_names); var p = []; for (q = 0; q < b(n); q += 2) p[q / 2] = H(a, c(n, q)); a = new Sk.astnodes.Import(p,m,f) } else if (n.type === r.import_from) { var u = null; l = 0; for (p = 1; p < b(n); ++p) if (c(n, p).type === r.dotted_name) { u = H(a, c(n, p)); p++; break } else if (c(n, p).type === w.T_DOT) l++; else if (c(n, p).type === w.T_ELLIPSIS) l += 3; else break; ++p; switch (c(n, p).type) { case w.T_STAR: n = c(n, p); break; case w.T_LPAR: n = c(n, p + 1); b(n); break; case r.import_as_names: n = c(n, p); p = b(n); if (0 === p % 2) throw new Sk.builtin.SyntaxError("trailing comma not allowed without surrounding parentheses",a.c_filename,n.lineno); break; default: throw new Sk.builtin.SyntaxError("Unexpected node-type in from-import",a.c_filename,n.lineno); } p = []; if (n.type === w.T_STAR) p[0] = H(a, n); else for (q = 0; q < b(n); q += 2) p[q / 2] = H(a, c(n, q)); a = u ? u.name.v : ""; a = new Sk.astnodes.ImportFrom(h(a),p,l,m,f) } else throw new Sk.builtin.SyntaxError("unknown import statement",a.c_filename,n.lineno); return a; case r.global_stmt: a = f; f = []; d(a, r.global_stmt); for (l = 1; l < b(a); l += 2) f[(l - 1) / 2] = h(c(a, l).value); return new Sk.astnodes.Global(f,a.lineno,a.col_offset); case r.nonlocal_stmt: e(a, f, "Not implemented: nonlocal"); break; case r.assert_stmt: return l = f, d(l, r.assert_stmt), 2 === b(l) ? a = new Sk.astnodes.Assert(x(a, c(l, 1)),null,l.lineno,l.col_offset) : 4 === b(l) ? a = new Sk.astnodes.Assert(x(a, c(l, 1)),x(a, c(l, 3)),l.lineno,l.col_offset) : (Sk.asserts.fail("improper number of parts to assert stmt"), a = void 0), a; case r.print_stmt: l = f; Sk.__future__.print_function && e(a, l, "Missing parentheses in call to 'print'"); n = 1; m = null; d(l, r.print_stmt); 2 <= b(l) && c(l, 1).type === w.T_RIGHTSHIFT && (m = x(a, c(l, 2)), n = 4); f = []; for (u = 0; n < b(l); n += 2, ++u) f[u] = x(a, c(l, n)); a = c(l, b(l) - 1).type === w.T_COMMA ? !1 : !0; return new Sk.astnodes.Print(m,f,a,l.lineno,l.col_offset); case r.debugger_stmt: return new Sk.astnodes.Debugger(f.lineno,f.col_offset); default: Sk.asserts.fail("unhandled small_stmt") } else switch (l = c(f, 0), d(f, r.compound_stmt), l.type) { case r.if_stmt: d(l, r.if_stmt); if (4 === b(l)) a = new Sk.astnodes.If(x(a, c(l, 1)),y(a, c(l, 3)),[],l.lineno,l.col_offset); else if (f = c(l, 4).value.charAt(2), "s" === f) a = new Sk.astnodes.If(x(a, c(l, 1)),y(a, c(l, 3)),y(a, c(l, 6)),l.lineno,l.col_offset); else if ("i" === f) { m = b(l) - 4; n = !1; f = []; c(l, m + 1).type === w.T_NAME && "s" === c(l, m + 1).value.charAt(2) && (n = !0, m -= 3); m /= 4; n && (f = [new Sk.astnodes.If(x(a, c(l, b(l) - 6)),y(a, c(l, b(l) - 4)),y(a, c(l, b(l) - 1)),c(l, b(l) - 6).lineno,c(l, b(l) - 6).col_offset)], m--); for (u = 0; u < m; ++u) n = 5 + 4 * (m - u - 1), f = [new Sk.astnodes.If(x(a, c(l, n)),y(a, c(l, n + 2)),f,c(l, n).lineno,c(l, n).col_offset)]; a = new Sk.astnodes.If(x(a, c(l, 1)),y(a, c(l, 3)),f,l.lineno,l.col_offset) } else Sk.asserts.fail("unexpected token in 'if' statement"), a = void 0; return a; case r.while_stmt: return d(l, r.while_stmt), 4 === b(l) ? a = new Sk.astnodes.While(x(a, c(l, 1)),y(a, c(l, 3)),[],l.lineno,l.col_offset) : 7 === b(l) ? a = new Sk.astnodes.While(x(a, c(l, 1)),y(a, c(l, 3)),y(a, c(l, 6)),l.lineno,l.col_offset) : (Sk.asserts.fail("wrong number of tokens for 'while' stmt"), a = void 0), a; case r.for_stmt: return f = [], d(l, r.for_stmt), 9 === b(l) && (f = y(a, c(l, 8))), n = c(l, 1), m = t(a, n, Sk.astnodes.Store), m = 1 === b(n) ? m[0] : new Sk.astnodes.Tuple(m,Sk.astnodes.Store,l.lineno,l.col_offset), new Sk.astnodes.For(m,M(a, c(l, 3)),y(a, c(l, 5)),f,l.lineno,l.col_offset); case r.try_stmt: f = []; q = b(l); m = (q - 3) / 3; u = []; p = null; d(l, r.try_stmt); n = y(a, c(l, 2)); if (c(l, q - 3).type === w.T_NAME) "finally" === c(l, q - 3).value ? (9 <= q && c(l, q - 6).type === w.T_NAME && (u = y(a, c(l, q - 4)), m--), p = y(a, c(l, q - 1))) : u = y(a, c(l, q - 1)), m--; else if (c(l, q - 3).type !== r.except_clause) throw new Sk.builtin.SyntaxError("malformed 'try' statement",a.c_filename,l.lineno); if (0 < m) for (q = 0; q < m; q++) { var z = q; var v = a , C = c(l, 3 + 3 * q) , A = c(l, 5 + 3 * q); d(C, r.except_clause); d(A, r.suite); if (1 === b(C)) var B = new Sk.astnodes.ExceptHandler(null,null,y(v, A),C.lineno,C.col_offset); else 2 === b(C) ? B = new Sk.astnodes.ExceptHandler(x(v, c(C, 1)),null,y(v, A),C.lineno,C.col_offset) : 4 === b(C) ? (Sk.__future__.python3 && "," == c(C, 2).value && e(v, C, "Old-style 'except' clauses are not supported in Python 3"), x(v, c(C, 1)), B = x(v, c(C, 3)), k(v, B, Sk.astnodes.Store, c(C, 3)), B = new Sk.astnodes.ExceptHandler(x(v, c(C, 1)),B,y(v, A),C.lineno,C.col_offset)) : (Sk.asserts.fail("wrong number of children for except clause"), B = void 0); f[z] = B } Sk.asserts.assert(!!p || 0 != f.length); return new Sk.astnodes.Try(n,f,u,p,l.lineno,l.col_offset); case r.with_stmt: f = []; d(l, r.with_stmt); for (m = 1; m < b(l) - 2; m += 2) n = void 0, p = a, q = c(l, m), d(q, r.with_item), u = x(p, c(q, 0)), 3 == b(q) && (n = x(p, c(q, 2)), k(p, n, Sk.astnodes.Store, q)), n = new Sk.astnodes.withitem(u,n), f[(m - 1) / 2] = n; a = y(a, c(l, b(l) - 1)); a = new Sk.astnodes.With(f,a,l.lineno,l.col_offset); return a; case r.funcdef: return aa(a, l, [], !1); case r.classdef: return S(a, l, []); case r.decorated: m = null; d(l, r.decorated); n = c(l, 0); d(n, r.decorators); f = []; for (u = 0; u < b(n); ++u) { p = f; q = u; z = a; B = c(n, u); d(B, r.decorator); d(c(B, 0), w.T_AT); d(c(B, b(B) - 1), w.T_NEWLINE); var K, E = c(B, 1); d(E, r.dotted_name); v = E.lineno; C = E.col_offset; A = h(c(E, 0).value); var L = new Sk.astnodes.Name(A,Sk.astnodes.Load,v,C); for (K = 2; K < b(E); K += 2) A = h(c(E, K).value), L = new Sk.astnodes.Attribute(L,A,Sk.astnodes.Load,v,C); v = L; z = 3 === b(B) ? v : 5 === b(B) ? new Sk.astnodes.Call(v,[],[],null,null,B.lineno,B.col_offset) : F(z, c(B, 3), v); p[q] = z } Sk.asserts.assert(c(l, 1).type == r.funcdef || c(l, 1).type == r.async_funcdef || c(l, 1).type == r.classdef); c(l, 1).type == r.funcdef ? (m = c(l, 1), m = aa(a, m, f, !1)) : c(l, 1).type == r.classdef ? m = S(a, c(l, 1), f) : c(l, 1).type == r.async_funcdef && (m = c(l, 1), d(m, r.async_funcdef), d(c(m, 0), w.T_NAME), Sk.asserts.assert(("async" === c(m, 0)).value), d(c(m, 1), r.funcdef), m = aa(a, m, f, !0)); m && (m.lineno = l.lineno, m.col_offset = l.col_offset); return m; case r.async_stmt: e(a, l, "Not implemented: async"); break; default: Sk.asserts.assert("unhandled compound_stmt") } } var r = Sk.ParseTables.sym , w = Sk.token.tokens , da = { Slice_kind: 1, ExtSlice_kind: 2, Index_kind: 3 } , Q = {}; Q[w.T_VBAR] = Sk.astnodes.BitOr; Q[w.T_CIRCUMFLEX] = Sk.astnodes.BitXor; Q[w.T_AMPER] = Sk.astnodes.BitAnd; Q[w.T_LEFTSHIFT] = Sk.astnodes.LShift; Q[w.T_RIGHTSHIFT] = Sk.astnodes.RShift; Q[w.T_PLUS] = Sk.astnodes.Add; Q[w.T_MINUS] = Sk.astnodes.Sub; Q[w.T_STAR] = Sk.astnodes.Mult; Q[w.T_SLASH] = Sk.astnodes.Div; Q[w.T_DOUBLESLASH] = Sk.astnodes.FloorDiv; Q[w.T_PERCENT] = Sk.astnodes.Mod; Sk.setupOperators = function(a) { a ? Q[w.T_AT] = Sk.astnodes.MatMult : Q[w.T_AT] && delete Q[w.T_AT] } ; Sk.exportSymbol("Sk.setupOperators", Sk.setupOperators); const fa = /_[eE]|[eE]_|\._|j_/ , ha = /_\.|[+-]_|^0_\D|_j/ , ia = /_(?=[^_])/g; Sk.astFromParse = function(f, e, k) { var h, l = new a("utf-8",e,k), n = [], q = 0; switch (f.type) { case r.file_input: for (h = 0; h < b(f) - 1; ++h) { var m = c(f, h); if (f.type !== w.T_NEWLINE) if (d(m, r.stmt), k = g(m), 1 === k) n[q++] = O(l, m); else for (m = c(m, 0), d(m, r.simple_stmt), e = 0; e < k; ++e) n[q++] = O(l, c(m, 2 * e)) } return new Sk.astnodes.Module(n); case r.eval_input: Sk.asserts.fail("todo;"); case r.single_input: Sk.asserts.fail("todo;"); default: Sk.asserts.fail("todo;") } } ; Sk.astDump = function(a) { var b = function(a) { var b, c = ""; for (b = 0; b < a; ++b) c += " "; return c } , c = function(a, f) { var d; if (null === a) return f + "None"; if (a.prototype && void 0 !== a.prototype._astname && a.prototype._isenum) return f + a.prototype._astname + "()"; if (void 0 !== a._astname) { var e = b(a._astname.length + 1); var g = []; for (d = 0; d < a._fields.length; d += 2) { var k = a._fields[d]; var h = a._fields[d + 1](a); var l = b(k.length + 1); g.push([k, c(h, f + e + l)]) } h = []; for (d = 0; d < g.length; ++d) l = g[d], h.push(l[0] + "=" + l[1].replace(/^\s+/, "")); d = h.join(",\n" + f + e); return f + a._astname + "(" + d + ")" } if (Sk.isArrayLike(a)) { e = []; for (d = 0; d < a.length; ++d) g = a[d], e.push(c(g, f + " ")); a = e.join(",\n"); return f + "[" + a.replace(/^\s+/, "") + "]" } a = !0 === a ? "True" : !1 === a ? "False" : a instanceof Sk.builtin.lng ? a.tp$str().v : a instanceof Sk.builtin.str ? a.$r().v : "" + a; return f + a }; return c(a, "") } ; Sk.exportSymbol("Sk.astFromParse", Sk.astFromParse); Sk.exportSymbol("Sk.astDump", Sk.astDump) } , function(m, p) { function a(a, b, c) { this.__name = a; this.__flags = b; this.__scope = b >> 11 & 7; this.__namespaces = c || [] } function b(a, b, c, d, e) { this.symFlags = {}; this.name = b; this.varnames = []; this.children = []; this.blockType = c; this.returnsValue = this.varkeywords = this.varargs = this.generator = this.childHasFree = this.hasFree = this.isNested = !1; this.lineno = e; this.table = a; a.cur && (a.cur.nested || "function" === a.cur.blockType) && (this.isNested = !0); d.scopeId = h++; a.stss[d.scopeId] = this; this.symbols = {} } function c(a) { this.filename = a; this.top = this.cur = null; this.stack = []; this.curClass = this.global = null; this.tmpname = 0; this.stss = {} } function d(a, b) { var c; for (c = 0; c < b.length; c++) a(b[c]) } function e(a, b) { for (var c in b) a[c] = b[c] } Sk.exportSymbol("Sk.SYMTAB_CONSTS", { DEF_GLOBAL: 1, DEF_LOCAL: 2, DEF_PARAM: 4, USE: 8, DEF_STAR: 16, DEF_DOUBLESTAR: 32, DEF_INTUPLE: 64, DEF_FREE: 128, DEF_FREE_GLOBAL: 256, DEF_FREE_CLASS: 512, DEF_IMPORT: 1024, DEF_BOUND: 1030, SCOPE_OFF: 11, SCOPE_MASK: 7, LOCAL: 1, GLOBAL_EXPLICIT: 2, GLOBAL_IMPLICIT: 3, FREE: 4, CELL: 5, OPT_IMPORT_STAR: 1, OPT_EXEC: 2, OPT_BARE_EXEC: 4, OPT_TOPLEVEL: 8, GENERATOR: 2, GENERATOR_EXPRESSION: 2, ModuleBlock: "module", FunctionBlock: "function", ClassBlock: "class" }); a.prototype.get_name = function() { return this.__name } ; a.prototype.is_referenced = function() { return !!(this.__flags & 8) } ; a.prototype.is_parameter = function() { return !!(this.__flags & 4) } ; a.prototype.is_global = function() { return 3 === this.__scope || 2 == this.__scope } ; a.prototype.is_declared_global = function() { return 2 == this.__scope } ; a.prototype.is_local = function() { return !!(this.__flags & 1030) } ; a.prototype.is_free = function() { return 4 == this.__scope } ; a.prototype.is_imported = function() { return !!(this.__flags & 1024) } ; a.prototype.is_assigned = function() { return !!(this.__flags & 2) } ; a.prototype.is_namespace = function() { return this.__namespaces && 0 < this.__namespaces.length } ; a.prototype.get_namespaces = function() { return this.__namespaces } ; var h = 0; b.prototype.get_type = function() { return this.blockType } ; b.prototype.get_name = function() { return this.name } ; b.prototype.get_lineno = function() { return this.lineno } ; b.prototype.is_nested = function() { return this.isNested } ; b.prototype.has_children = function() { return 0 < this.children.length } ; b.prototype.get_identifiers = function() { return this._identsMatching(function() { return !0 }) } ; b.prototype.lookup = function(b) { if (this.symbols.hasOwnProperty(b)) b = this.symbols[b]; else { var c = this.symFlags[b]; var d = this.__check_children(b); b = this.symbols[b] = new a(b,c,d) } return b } ; b.prototype.__check_children = function(a) { var b, c = []; for (b = 0; b < this.children.length; ++b) { var d = this.children[b]; d.name === a && c.push(d) } return c } ; b.prototype._identsMatching = function(a) { var b, c = []; for (b in this.symFlags) this.symFlags.hasOwnProperty(b) && a(this.symFlags[b]) && c.push(b); c.sort(); return c } ; b.prototype.get_parameters = function() { Sk.asserts.assert("function" == this.get_type(), "get_parameters only valid for function scopes"); this._funcParams || (this._funcParams = this._identsMatching(function(a) { return a & 4 })); return this._funcParams } ; b.prototype.get_locals = function() { Sk.asserts.assert("function" == this.get_type(), "get_locals only valid for function scopes"); this._funcLocals || (this._funcLocals = this._identsMatching(function(a) { return a & 1030 })); return this._funcLocals } ; b.prototype.get_globals = function() { Sk.asserts.assert("function" == this.get_type(), "get_globals only valid for function scopes"); this._funcGlobals || (this._funcGlobals = this._identsMatching(function(a) { a = a >> 11 & 7; return 3 == a || 2 == a })); return this._funcGlobals } ; b.prototype.get_frees = function() { Sk.asserts.assert("function" == this.get_type(), "get_frees only valid for function scopes"); this._funcFrees || (this._funcFrees = this._identsMatching(function(a) { return 4 == (a >> 11 & 7) })); return this._funcFrees } ; b.prototype.get_methods = function() { var a; Sk.asserts.assert("class" == this.get_type(), "get_methods only valid for class scopes"); if (!this._classMethods) { var b = []; for (a = 0; a < this.children.length; ++a) b.push(this.children[a].name); b.sort(); this._classMethods = b } return this._classMethods } ; b.prototype.getScope = function(a) { a = this.symFlags[a]; return void 0 === a ? 0 : a >> 11 & 7 } ; c.prototype.getStsForAst = function(a) { Sk.asserts.assert(void 0 !== a.scopeId, "ast wasn't added to st?"); a = this.stss[a.scopeId]; Sk.asserts.assert(void 0 !== a, "unknown sym tab entry"); return a } ; c.prototype.SEQStmt = function(a) { var b, c; if (null !== a) { Sk.asserts.assert(Sk.isArrayLike(a), "SEQ: nodes isn't array? got " + a.toString()); var d = a.length; for (c = 0; c < d; ++c) (b = a[c]) && this.visitStmt(b) } } ; c.prototype.SEQExpr = function(a) { var b, c; if (null !== a) { Sk.asserts.assert(Sk.isArrayLike(a), "SEQ: nodes isn't array? got " + a.toString()); var d = a.length; for (c = 0; c < d; ++c) (b = a[c]) && this.visitExpr(b) } } ; c.prototype.enterBlock = function(a, c, d, e) { a = Sk.fixReserved(a); var f = null; this.cur && (f = this.cur, this.stack.push(this.cur)); this.cur = new b(this,a,c,d,e); "top" === a && (this.global = this.cur.symFlags); f && f.children.push(this.cur) } ; c.prototype.exitBlock = function() { this.cur = null; 0 < this.stack.length && (this.cur = this.stack.pop()) } ; c.prototype.visitParams = function(a, b) { var c; for (c = 0; c < a.length; ++c) if (b = a[c], b.constructor === Sk.astnodes.arg) this.addDef(b.arg, 4, b.lineno); else throw new Sk.builtin.SyntaxError("invalid expression in parameter list",this.filename); } ; c.prototype.visitArguments = function(a, b) { a.args && this.visitParams(a.args, !0); a.kwonlyargs && this.visitParams(a.kwonlyargs, !0); a.vararg && (this.addDef(a.vararg.arg, 4, b), this.cur.varargs = !0); a.kwarg && (this.addDef(a.kwarg.arg, 4, b), this.cur.varkeywords = !0) } ; c.prototype.newTmpname = function(a) { this.addDef(new Sk.builtin.str("_[" + ++this.tmpname + "]"), 2, a) } ; c.prototype.addDef = function(a, b, c) { var d = Sk.mangleName(this.curClass, a).v; d = Sk.fixReserved(d); var f = this.cur.symFlags[d]; if (void 0 !== f) { if (b & 4 && f & 4) throw new Sk.builtin.SyntaxError("duplicate argument '" + a.v + "' in function definition",this.filename,c); f |= b } else f = b; this.cur.symFlags[d] = f; b & 4 ? this.cur.varnames.push(d) : b & 1 && (f = b, a = this.global[d], void 0 !== a && (f |= a), this.global[d] = f) } ; c.prototype.visitSlice = function(a) { var b; switch (a.constructor) { case Sk.astnodes.Slice: a.lower && this.visitExpr(a.lower); a.upper && this.visitExpr(a.upper); a.step && this.visitExpr(a.step); break; case Sk.astnodes.ExtSlice: for (b = 0; b < a.dims.length; ++b) this.visitSlice(a.dims[b]); break; case Sk.astnodes.Index: this.visitExpr(a.value) } } ; c.prototype.visitStmt = function(a) { var b; Sk.asserts.assert(void 0 !== a, "visitStmt called with undefined"); switch (a.constructor) { case Sk.astnodes.FunctionDef: this.addDef(a.name, 2, a.lineno); a.args.defaults && this.SEQExpr(a.args.defaults); a.decorator_list && this.SEQExpr(a.decorator_list); this.enterBlock(a.name.v, "function", a, a.lineno); this.visitArguments(a.args, a.lineno); this.SEQStmt(a.body); this.exitBlock(); break; case Sk.astnodes.ClassDef: this.addDef(a.name, 2, a.lineno); this.SEQExpr(a.bases); a.decorator_list && this.SEQExpr(a.decorator_list); this.enterBlock(a.name.v, "class", a, a.lineno); this.curClass = a.name; this.SEQStmt(a.body); this.exitBlock(); break; case Sk.astnodes.Return: if (a.value && (this.visitExpr(a.value), this.cur.returnsValue = !0, this.cur.generator)) throw new Sk.builtin.SyntaxError("'return' with argument inside generator",this.filename); break; case Sk.astnodes.Delete: this.SEQExpr(a.targets); break; case Sk.astnodes.Assign: this.SEQExpr(a.targets); this.visitExpr(a.value); break; case Sk.astnodes.AnnAssign: if (a.target.constructor == Sk.astnodes.Name) { var c = a.target; var e = Sk.mangleName(this.curClass, c.id).v; e = Sk.fixReserved(e); c = this.cur.symFlags[e]; if (c & 2049 && this.global != this.cur.symFlags && a.simple) throw new Sk.builtin.SyntaxError("annotated name '" + e + "' can't be global",this.filename,a.lineno); a.simple ? this.addDef(new Sk.builtin.str(e), 4098, a.lineno) : a.value && this.addDef(new Sk.builtin.str(e), 2, a.lineno) } else this.visitExpr(a.target); this.visitExpr(a.annotation); a.value && this.visitExpr(a.value); break; case Sk.astnodes.AugAssign: this.visitExpr(a.target); this.visitExpr(a.value); break; case Sk.astnodes.Print: a.dest && this.visitExpr(a.dest); this.SEQExpr(a.values); break; case Sk.astnodes.For: this.visitExpr(a.target); this.visitExpr(a.iter); this.SEQStmt(a.body); a.orelse && this.SEQStmt(a.orelse); break; case Sk.astnodes.While: this.visitExpr(a.test); this.SEQStmt(a.body); a.orelse && this.SEQStmt(a.orelse); break; case Sk.astnodes.If: this.visitExpr(a.test); this.SEQStmt(a.body); a.orelse && this.SEQStmt(a.orelse); break; case Sk.astnodes.Raise: a.exc && (this.visitExpr(a.exc), a.inst && (this.visitExpr(a.inst), a.tback && this.visitExpr(a.tback)), a.cause && this.visitExpr(a.cause)); break; case Sk.astnodes.Assert: this.visitExpr(a.test); a.msg && this.visitExpr(a.msg); break; case Sk.astnodes.Import: case Sk.astnodes.ImportFrom: this.visitAlias(a.names, a.lineno); break; case Sk.astnodes.Global: var g = a.names.length; for (b = 0; b < g; ++b) { e = Sk.mangleName(this.curClass, a.names[b]).v; e = Sk.fixReserved(e); c = this.cur.symFlags[e]; if (c & 10) { if (c & 2) throw new Sk.builtin.SyntaxError("name '" + e + "' is assigned to before global declaration",this.filename,a.lineno); throw new Sk.builtin.SyntaxError("name '" + e + "' is used prior to global declaration",this.filename,a.lineno); } this.addDef(new Sk.builtin.str(e), 1, a.lineno) } break; case Sk.astnodes.Expr: this.visitExpr(a.value); break; case Sk.astnodes.Pass: case Sk.astnodes.Break: case Sk.astnodes.Continue: case Sk.astnodes.Debugger: break; case Sk.astnodes.With: d(this.visit_withitem.bind(this), a.items); d(this.visitStmt.bind(this), a.body); break; case Sk.astnodes.Try: this.SEQStmt(a.body); this.visitExcepthandlers(a.handlers); this.SEQStmt(a.orelse); this.SEQStmt(a.finalbody); break; default: Sk.asserts.fail("Unhandled type " + a.constructor.name + " in visitStmt") } } ; c.prototype.visit_withitem = function(a) { this.visitExpr(a.context_expr); a.optional_vars && this.visitExpr(a.optional_vars) } ; c.prototype.visitExpr = function(a) { Sk.asserts.assert(void 0 !== a, "visitExpr called with undefined"); switch (a.constructor) { case Sk.astnodes.BoolOp: this.SEQExpr(a.values); break; case Sk.astnodes.BinOp: this.visitExpr(a.left); this.visitExpr(a.right); break; case Sk.astnodes.UnaryOp: this.visitExpr(a.operand); break; case Sk.astnodes.Lambda: this.addDef(new Sk.builtin.str("lambda"), 2, a.lineno); a.args.defaults && this.SEQExpr(a.args.defaults); this.enterBlock("lambda", "function", a, a.lineno); this.visitArguments(a.args, a.lineno); this.visitExpr(a.body); this.exitBlock(); break; case Sk.astnodes.IfExp: this.visitExpr(a.test); this.visitExpr(a.body); this.visitExpr(a.orelse); break; case Sk.astnodes.Dict: this.SEQExpr(a.keys); this.SEQExpr(a.values); break; case Sk.astnodes.DictComp: case Sk.astnodes.SetComp: this.visitComprehension(a.generators, 0); break; case Sk.astnodes.ListComp: this.newTmpname(a.lineno); this.visitExpr(a.elt); this.visitComprehension(a.generators, 0); break; case Sk.astnodes.GeneratorExp: this.visitGenexp(a); break; case Sk.astnodes.Yield: a.value && this.visitExpr(a.value); this.cur.generator = !0; if (this.cur.returnsValue) throw new Sk.builtin.SyntaxError("'return' with argument inside generator",this.filename); break; case Sk.astnodes.Compare: this.visitExpr(a.left); this.SEQExpr(a.comparators); break; case Sk.astnodes.Call: this.visitExpr(a.func); if (a.args) for (let b of a.args) b.constructor === Sk.astnodes.Starred ? this.visitExpr(b.value) : this.visitExpr(b); if (a.keywords) for (let b of a.keywords) this.visitExpr(b.value); break; case Sk.astnodes.Num: case Sk.astnodes.Str: case Sk.astnodes.Bytes: break; case Sk.astnodes.JoinedStr: for (let b of a.values) this.visitExpr(b); break; case Sk.astnodes.FormattedValue: this.visitExpr(a.value); a.format_spec && this.visitExpr(a.format_spec); break; case Sk.astnodes.Attribute: this.visitExpr(a.value); break; case Sk.astnodes.Subscript: this.visitExpr(a.value); this.visitSlice(a.slice); break; case Sk.astnodes.Name: this.addDef(a.id, a.ctx === Sk.astnodes.Load ? 8 : 2, a.lineno); break; case Sk.astnodes.NameConstant: break; case Sk.astnodes.List: case Sk.astnodes.Tuple: case Sk.astnodes.Set: this.SEQExpr(a.elts); break; case Sk.astnodes.Starred: this.visitExpr(a.value); break; default: Sk.asserts.fail("Unhandled type " + a.constructor.name + " in visitExpr") } } ; c.prototype.visitComprehension = function(a, b) { var c, d = a.length; for (c = b; c < d; ++c) b = a[c], this.visitExpr(b.target), this.visitExpr(b.iter), this.SEQExpr(b.ifs) } ; c.prototype.visitAlias = function(a, b) { var c, d; for (d = 0; d < a.length; ++d) { var f = a[d]; var e = c = null === f.asname ? f.name.v : f.asname.v; f = c.indexOf("."); -1 !== f && (e = c.substr(0, f)); if ("*" !== c) this.addDef(new Sk.builtin.str(e), 1024, b); else if ("module" !== this.cur.blockType) throw new Sk.builtin.SyntaxError("import * only allowed at module level",this.filename); } } ; c.prototype.visitGenexp = function(a) { var b = a.generators[0]; this.visitExpr(b.iter); this.enterBlock("genexpr", "function", a, a.lineno); this.cur.generator = !0; this.addDef(new Sk.builtin.str(".0"), 4, a.lineno); this.visitExpr(b.target); this.SEQExpr(b.ifs); this.visitComprehension(a.generators, 1); this.visitExpr(a.elt); this.exitBlock() } ; c.prototype.visitExcepthandlers = function(a) { var b, c; for (b = 0; c = a[b]; ++b) c.type && this.visitExpr(c.type), c.name && this.visitExpr(c.name), this.SEQStmt(c.body) } ; c.prototype.analyzeBlock = function(a, b, c, d) { var f = {}; var g = {} , k = {} , h = {} , n = {}; "class" == a.blockType && (e(k, d), b && e(h, b)); for (p in a.symFlags) { var m = a.symFlags[p]; this.analyzeName(a, g, p, m, b, f, c, d) } "class" !== a.blockType && ("function" === a.blockType && e(h, f), b && e(h, b), e(k, d)); f = {}; var p = a.children.length; for (m = 0; m < p; ++m) if (d = a.children[m], this.analyzeChildBlock(d, h, n, k, f), d.hasFree || d.childHasFree) a.childHasFree = !0; e(n, f); "function" === a.blockType && this.analyzeCells(g, n); b = this.updateSymbols(a.symFlags, g, b, n, "class" === a.blockType); a.hasFree = a.hasFree || b; e(c, n) } ; c.prototype.analyzeChildBlock = function(a, b, c, d, h) { var f = {}; e(f, b); b = {}; e(b, c); c = {}; e(c, d); this.analyzeBlock(a, f, b, c); e(h, b) } ; c.prototype.analyzeCells = function(a, b) { var c; for (c in a) { var d = a[c]; 1 === d && void 0 !== b[c] && (a[c] = 5, delete b[c]) } } ; c.prototype.updateSymbols = function(a, b, c, d, e) { var f, g = !1; for (f in a) { var k = a[f]; var h = b[f]; k |= h << 11; a[f] = k } for (f in d) b = a[f], void 0 !== b ? e && b & 1031 && (b |= 512, a[f] = b) : void 0 !== c[f] && (a[f] = 8192, g = !0); return g } ; c.prototype.analyzeName = function(a, b, c, d, e, h, m, p) { if (d & 1) { if (d & 4) throw new Sk.builtin.SyntaxError("name '" + c + "' is local and global",this.filename,a.lineno); b[c] = 2; p[c] = null; e && void 0 !== e[c] && delete e[c] } else d & 1030 ? (b[c] = 1, h[c] = null, delete p[c]) : e && void 0 !== e[c] ? (b[c] = 4, a.hasFree = !0, m[c] = null) : (p && void 0 !== p[c] || !a.isNested || (a.hasFree = !0), b[c] = 3) } ; c.prototype.analyze = function() { this.analyzeBlock(this.top, null, {}, {}) } ; Sk.symboltable = function(a, b) { var d = new c(b); d.enterBlock("top", "module", a, 0); d.top = d.cur; for (b = 0; b < a.body.length; ++b) d.visitStmt(a.body[b]); d.exitBlock(); d.analyze(); return d } ; Sk.dumpSymtab = function(a) { var b = function(a) { return a ? "True" : "False" } , c = function(a) { var b, c = []; for (b = 0; b < a.length; ++b) c.push((new Sk.builtin.str(a[b])).$r().v); return "[" + c.join(", ") + "]" } , d = function(a, f) { var e, g; void 0 === f && (f = ""); var k = f + "Sym_type: " + a.get_type() + "\n"; k += f + "Sym_name: " + a.get_name() + "\n"; k += f + "Sym_lineno: " + a.get_lineno() + "\n"; k += f + "Sym_nested: " + b(a.is_nested()) + "\n"; k += f + "Sym_haschildren: " + b(a.has_children()) + "\n"; "class" === a.get_type() ? k += f + "Class_methods: " + c(a.get_methods()) + "\n" : "function" === a.get_type() && (k += f + "Func_params: " + c(a.get_parameters()) + "\n", k += f + "Func_locals: " + c(a.get_locals()) + "\n", k += f + "Func_globals: " + c(a.get_globals()) + "\n", k += f + "Func_frees: " + c(a.get_frees()) + "\n"); k += f + "-- Identifiers --\n"; var h = a.get_identifiers(); var l = h.length; for (g = 0; g < l; ++g) { var n = a.lookup(h[g]); k += f + "name: " + n.get_name() + "\n"; k += f + " is_referenced: " + b(n.is_referenced()) + "\n"; k += f + " is_imported: " + b(n.is_imported()) + "\n"; k += f + " is_parameter: " + b(n.is_parameter()) + "\n"; k += f + " is_global: " + b(n.is_global()) + "\n"; k += f + " is_declared_global: " + b(n.is_declared_global()) + "\n"; k += f + " is_local: " + b(n.is_local()) + "\n"; k += f + " is_free: " + b(n.is_free()) + "\n"; k += f + " is_assigned: " + b(n.is_assigned()) + "\n"; k += f + " is_namespace: " + b(n.is_namespace()) + "\n"; var m = n.get_namespaces(); var q = m.length; k += f + " namespaces: [\n"; var p = []; for (e = 0; e < q; ++e) n = m[e], p.push(d(n, f + " ")); k += p.join("\n"); k += f + " ]\n" } return k }; return d(a.top, "") } ; Sk.exportSymbol("Sk.symboltable", Sk.symboltable); Sk.exportSymbol("Sk.dumpSymtab", Sk.dumpSymtab) } , function(m, p) { function a(a, b, c, d, e) { this.filename = a; this.st = b; this.flags = c; this.canSuspend = d; this.interactive = !1; this.nestlevel = 0; this.u = null; this.stack = []; this.result = []; this.allUnits = []; this.source = e ? e.split("\n") : !1 } function b() { this.name = this.ste = null; this.doesSuspend = this.canSuspend = !1; this.private_ = null; this.lineno = this.firstlineno = 0; this.linenoSet = !1; this.localnames = []; this.localtemps = []; this.tempsToSave = []; this.blocknum = 0; this.blocks = []; this.curblock = 0; this.consts = {}; this.scopename = null; this.suffixCode = this.switchCode = this.varDeclsCode = this.prefixCode = ""; this.breakBlocks = []; this.continueBlocks = []; this.exceptBlocks = []; this.finallyBlocks = [] } function c(a) { return void 0 === g[a] ? a : a + "_$rw$" } function d(a, b) { var c = b.v; if (null === a || null === c || "_" !== c.charAt(0) || "_" !== c.charAt(1) || "_" === c.charAt(c.length - 1) && "_" === c.charAt(c.length - 2)) return b; var d = a.v; d.replace(/_/g, ""); if ("" === d) return b; d = a.v; d.replace(/^_*/, ""); return d = new Sk.builtin.str("_" + d + c) } function e(a) { let b = '"'; for (let c = 0; c < a.length; c++) { let d = a.charCodeAt(c); b = 10 == d ? b + "\\n" : 92 == d ? b + "\\\\" : 34 == d || 32 > d || 127 <= d && 256 > d ? b + ("\\x" + ("0" + d.toString(16)).substr(-2)) : 256 <= d ? b + ("\\u" + ("000" + d.toString(16)).substr(-4)) : b + a.charAt(c) } return b + '"' } var h; Sk.gensymcount = 0; b.prototype.activateScope = function() { var a = this; h = function() { var b, c = a.blocks[a.curblock]; if (null === c._next) for (b = 0; b < arguments.length; ++b) c.push(arguments[b]) } } ; a.prototype.getSourceLine = function(a) { Sk.asserts.assert(this.source); return this.source[a - 1] } ; a.prototype.annotateSource = function(a) { var b; if (this.source) { var c = a.lineno; var d = a.col_offset; h("\n//\n// line ", c, ":\n// ", this.getSourceLine(c), "\n// "); for (b = 0; b < d; ++b) h(" "); h("^\n//\n"); Sk.asserts.assert(void 0 !== a.lineno && void 0 !== a.col_offset); h("$currLineNo = ", c, ";\n$currColNo = ", d, ";\n\n") } } ; a.prototype.gensym = function(a) { return a = "$" + (a || "") + Sk.gensymcount++ } ; a.prototype.niceName = function(a) { return this.gensym(a.replace("<", "").replace(">", "").replace(" ", "_")) } ; var g = Sk.builtin.str.reservedWords_; a.prototype.makeConstant = function(a) { var b, c = ""; for (b = 0; b < arguments.length; ++b) c += arguments[b]; for (d in this.u.consts) if (this.u.consts.hasOwnProperty(d) && (b = this.u.consts[d], b == c)) return d; var d = this.u.scopename + "." + this.gensym("const"); this.u.consts[d] = c; return d } ; a.prototype._gr = function(a, b) { var c, d = this.gensym(a); this.u.localtemps.push(d); h("var ", d, "="); for (c = 1; c < arguments.length; ++c) h(arguments[c]); h(";"); return d } ; a.prototype.outputInterruptTest = function() { var a = ""; if (null !== Sk.execLimit || null !== Sk.yieldLimit && this.u.canSuspend) a += "var $dateNow = Date.now();", null !== Sk.execLimit && (a += "if ($dateNow - Sk.execStart > Sk.execLimit) {throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())}"), null !== Sk.yieldLimit && this.u.canSuspend && (a = a + "if ($dateNow - Sk.lastYield > Sk.yieldLimit) {" + ("var $susp = $saveSuspension({data: {type: 'Sk.yield'}, resume: function() {}}, '" + this.filename + "',$currLineNo,$currColNo);"), a += "$susp.$blk = $blk;$susp.optional = true;return $susp;}", this.u.doesSuspend = !0); return a } ; a.prototype._jumpfalse = function(a, b) { a = this._gr("jfalse", "(", a, "===false||!Sk.misceval.isTrue(", a, "))"); h("if(", a, "){/*test failed */$blk=", b, ";continue;}") } ; a.prototype._jumpundef = function(a, b) { h("if(", a, "===undefined){$blk=", b, ";continue;}") } ; a.prototype._jumpnotundef = function(a, b) { h("if(", a, "!==undefined){$blk=", b, ";continue;}") } ; a.prototype._jumptrue = function(a, b) { a = this._gr("jtrue", "(", a, "===true||Sk.misceval.isTrue(", a, "))"); h("if(", a, "){/*test passed */$blk=", b, ";continue;}") } ; a.prototype._jump = function(a) { null === this.u.blocks[this.u.curblock]._next && (h("$blk=", a, ";"), this.u.blocks[this.u.curblock]._next = a) } ; a.prototype._checkSuspension = function(a) { if (this.u.canSuspend) { var b = this.newBlock("function return or resume suspension"); this._jump(b); this.setBlock(b); a = a || { lineno: "$currLineNo", col_offset: "$currColNo" }; h("if ($ret && $ret.$isSuspension) { return $saveSuspension($ret,'" + this.filename + "'," + a.lineno + "," + a.col_offset + "); }"); this.u.doesSuspend = !0; this.u.tempsToSave = this.u.tempsToSave.concat(this.u.localtemps) } else h("if ($ret && $ret.$isSuspension) { $ret = Sk.misceval.retryOptionalSuspensionOrThrow($ret); }") } ; a.prototype.cunpackstarstoarray = function(a, b) { if (!a || 0 == a.length) return "[]"; let c = !1; for (let d of a) { if (b && c) throw new Sk.builtin.SyntaxError("Extended argument unpacking is not permitted in Python 2"); d.constructor === Sk.astnodes.Starred && (c = !0) } if (c) { b = this._gr("unpack", "[]"); for (let c of a) c.constructor !== Sk.astnodes.Starred ? h(b, ".push(", this.vexpr(c), ");") : (h("$ret = Sk.misceval.iterFor(Sk.abstr.iter(", this.vexpr(c.value), "), function(e) { ", b, ".push(e); });"), this._checkSuspension()); return b } return "[" + a.map(a=>this.vexpr(a)).join(",") + "]" } ; a.prototype.ctuplelistorset = function(a, b, c) { var d; Sk.asserts.assert("tuple" === c || "list" === c || "set" === c); var f = !1; for (d = 0; d < a.elts.length; d++) if (a.elts[d].constructor === Sk.astnodes.Starred) { f = !0; var e = d; break } if (a.ctx === Sk.astnodes.Store) { if (f) { if (!Sk.__future__.python3) throw new Sk.builtin.SyntaxError("assignment unpacking with stars is not supported in Python 2",this.filename,a.lineno); for (d = e + 1; d < a.elts.length; d++) if (a.elts[d].constructor === Sk.astnodes.Starred) throw new Sk.builtin.SyntaxError("multiple starred expressions in assignment",this.filename,a.lineno); } c = f ? e : a.elts.length; h("$ret = Sk.abstr.sequenceUnpack(" + b + "," + c + "," + (f ? a.elts.length - 1 : c) + ", " + f + ");"); this._checkSuspension(); b = this._gr("items", "$ret"); for (d = 0; d < a.elts.length; ++d) d === e ? this.vexpr(a.elts[d].value, b + "[" + d + "]") : this.vexpr(a.elts[d], b + "[" + d + "]") } else if (a.ctx === Sk.astnodes.Load || "set" === c) { if (f) { if (!Sk.__future__.python3) throw new Sk.builtin.SyntaxError("List packing with stars is not supported in Python 2"); return this._gr("load" + c, "new Sk.builtins['", c, "'](", this.cunpackstarstoarray(a.elts), ")") } if ("tuple" === c) { f = !0; b = []; for (d = 0; d < a.elts.length; ++d) e = this.vexpr(a.elts[d]), f && -1 == e.indexOf("$const") && (f = !1), b.push(e); if (f) return this.makeConstant("new Sk.builtin.tuple([" + b + "])"); for (d = 0; d < b.length; ++d) b[d] = this._gr("elem", b[d]); return this._gr("load" + c, "new Sk.builtins['", c, "']([", b, "])") } b = []; for (d = 0; d < a.elts.length; ++d) b.push(this._gr("elem", this.vexpr(a.elts[d]))); return this._gr("load" + c, "new Sk.builtins['", c, "']([", b, "])") } } ; a.prototype.cdict = function(a) { var b; var c = []; if (null !== a.keys) for (Sk.asserts.assert(a.values.length === a.keys.length), b = 0; b < a.values.length; ++b) { var d = this.vexpr(a.values[b]); c.push(this.vexpr(a.keys[b])); c.push(d) } return this._gr("loaddict", "new Sk.builtins['dict']([", c, "])") } ; a.prototype.clistcomp = function(a) { Sk.asserts.assert(a instanceof Sk.astnodes.ListComp); var b = this._gr("_compr", "new Sk.builtins['list']([])"); return this.ccompgen("list", b, a.generators, 0, a.elt, null, a) } ; a.prototype.cdictcomp = function(a) { Sk.asserts.assert(a instanceof Sk.astnodes.DictComp); var b = this._gr("_dcompr", "new Sk.builtins.dict([])"); return this.ccompgen("dict", b, a.generators, 0, a.value, a.key, a) } ; a.prototype.csetcomp = function(a) { Sk.asserts.assert(a instanceof Sk.astnodes.SetComp); var b = this._gr("_setcompr", "new Sk.builtins.set([])"); return this.ccompgen("set", b, a.generators, 0, a.elt, null, a) } ; a.prototype.ccompgen = function(a, b, c, d, e, g, m) { var f = this.newBlock(a + " comp start") , k = this.newBlock(a + " comp skip") , l = this.newBlock(a + " comp anchor") , n = c[d] , q = this.vexpr(n.iter); q = this._gr("iter", "Sk.abstr.iter(", q, ")"); var p; this._jump(f); this.setBlock(f); h("$ret = Sk.abstr.iternext(", q, ", true);"); this._checkSuspension(m); q = this._gr("next", "$ret"); this._jumpundef(q, l); this.vexpr(n.target, q); var u = n.ifs ? n.ifs.length : 0; for (p = 0; p < u; ++p) q = this.vexpr(n.ifs[p]), this._jumpfalse(q, f); ++d < c.length && this.ccompgen(a, b, c, d, e, g, m); d >= c.length && (c = this.vexpr(e), "dict" === a ? (a = this.vexpr(g), h(b, ".mp$ass_subscript(", a, ",", c, ");")) : "list" === a ? h(b, ".v.push(", c, ");") : "set" === a && h(b, ".v.mp$ass_subscript(", c, ", true);"), this._jump(k), this.setBlock(k)); this._jump(f); this.setBlock(l); return b } ; a.prototype.cyield = function(a) { if (this.u.ste.blockType !== Sk.SYMTAB_CONSTS.FunctionBlock) throw new Sk.builtin.SyntaxError("'yield' outside function",this.filename,a.lineno); var b = "Sk.builtin.none.none$"; a.value && (b = this.vexpr(a.value)); a = this.newBlock("after yield"); h("return [/*resume*/", a, ",/*ret*/", b, "];"); this.setBlock(a); return "$gen.gi$sentvalue" } ; a.prototype.ccompare = function(a) { var b; Sk.asserts.assert(a.ops.length === a.comparators.length); var c = this.vexpr(a.left); var d = a.ops.length; var f = this.newBlock("done"); var e = this._gr("compareres", "null"); for (b = 0; b < d; ++b) { var g = this.vexpr(a.comparators[b]); h("$ret = Sk.builtin.bool(Sk.misceval.richCompareBool(", c, ",", g, ",'", a.ops[b].prototype._astname, "', true));"); this._checkSuspension(a); h(e, "=$ret;"); this._jumpfalse("$ret", f); c = g } this._jump(f); this.setBlock(f); return e } ; a.prototype.ccall = function(a) { var b = this.vexpr(a.func); let c = this.cunpackstarstoarray(a.args, !Sk.__future__.python3); var d = "undefined"; if (a.keywords && 0 < a.keywords.length) { let c = !1; d = []; for (let b of a.keywords) { if (c && !Sk.__future__.python3) throw new SyntaxError("Advanced unpacking of function arguments is not supported in Python 2"); b.arg ? (d.push("'" + b.arg.v + "'"), d.push(this.vexpr(b.value))) : c = !0 } d = "[" + d.join(",") + "]"; if (c) { d = this._gr("keywordArgs", d); for (let c of a.keywords) c.arg || (h("$ret = Sk.abstr.mappingUnpackIntoKeywordArray(", d, ",", this.vexpr(c.value), ",", b, ");"), this._checkSuspension()) } } Sk.__future__.super_args && a.func.id && "super" === a.func.id.v && "[]" === c && (h('if (typeof self === "undefined" || self.toString().indexOf("Window") > 0) { throw new Sk.builtin.RuntimeError("super(): no arguments") };'), c = "[$gbl.__class__,self]"); h("$ret = (", b, ".tp$call)?", b, ".tp$call(", c, ",", d, ") : Sk.misceval.applyOrSuspend(", b, ",undefined,undefined,", d, ",", c, ");"); this._checkSuspension(a); return this._gr("call", "$ret") } ; a.prototype.cslice = function(a) { Sk.asserts.assert(a instanceof Sk.astnodes.Slice); if (Sk.__future__.python3) { var b = a.lower ? this.vexpr(a.lower) : "Sk.builtin.none.none$"; var c = a.upper ? this.vexpr(a.upper) : "Sk.builtin.none.none$" } else b = a.lower ? this.vexpr(a.lower) : a.step ? "Sk.builtin.none.none$" : "new Sk.builtin.int_(0)", c = a.upper ? this.vexpr(a.upper) : a.step ? "Sk.builtin.none.none$" : "new Sk.builtin.int_(2147483647)"; a = a.step ? this.vexpr(a.step) : "Sk.builtin.none.none$"; return this._gr("slice", "new Sk.builtins['slice'](", b, ",", c, ",", a, ")") } ; a.prototype.eslice = function(a) { var b; Sk.asserts.assert(a instanceof Array); var c = []; for (b = 0; b < a.length; b++) c.push(this.vslicesub(a[b])); return this._gr("extslice", "new Sk.builtins['tuple']([", c, "])") } ; a.prototype.vslicesub = function(a) { switch (a.constructor) { case Sk.astnodes.Index: var b = this.vexpr(a.value); break; case Sk.astnodes.Slice: b = this.cslice(a); break; case Sk.astnodes.Ellipsis: Sk.asserts.fail("todo compile.js Ellipsis;"); break; case Sk.astnodes.ExtSlice: b = this.eslice(a.dims); break; default: Sk.asserts.fail("invalid subscript kind") } return b } ; a.prototype.vslice = function(a, b, c, d) { a = this.vslicesub(a); return this.chandlesubscr(b, c, a, d) } ; a.prototype.chandlesubscr = function(a, b, c, d) { if (a === Sk.astnodes.Load || a === Sk.astnodes.AugLoad) return h("$ret = Sk.abstr.objectGetItem(", b, ",", c, ", true);"), this._checkSuspension(), this._gr("lsubscr", "$ret"); a === Sk.astnodes.Store || a === Sk.astnodes.AugStore ? (h("$ret = Sk.abstr.objectSetItem(", b, ",", c, ",", d, ", true);"), this._checkSuspension()) : a === Sk.astnodes.Del ? h("Sk.abstr.objectDelItem(", b, ",", c, ");") : Sk.asserts.fail("handlesubscr fail") } ; a.prototype.cboolop = function(a) { var b, c; Sk.asserts.assert(a instanceof Sk.astnodes.BoolOp); var d = a.op === Sk.astnodes.And ? this._jumpfalse : this._jumptrue; var f = this.newBlock("end of boolop"); var e = a.values; var g = e.length; for (b = 0; b < g; ++b) a = this.vexpr(e[b]), 0 === b && (c = this._gr("boolopsucc", a)), h(c, "=", a, ";"), d.call(this, a, f); this._jump(f); this.setBlock(f); return c } ; a.prototype.cjoinedstr = function(a) { let b; Sk.asserts.assert(a instanceof Sk.astnodes.JoinedStr); for (let c of a.values) a = this.vexpr(c), b ? h(b, "=", b, ".sq$concat(", a, ");") : b = this._gr("joinedstr", a); b || (b = "Sk.builtin.str.$emptystr"); return b } ; a.prototype.cformattedvalue = function(a) { let b = this.vexpr(a.value); switch (a.conversion) { case "s": b = this._gr("value", "new Sk.builtin.str(", b, ")"); break; case "a": b = this._gr("value", "Sk.builtin.ascii(", b, ")"); break; case "r": b = this._gr("value", "Sk.builtin.repr(", b, ")") } a = a.format_spec ? this.vexpr(a.format_spec) : "Sk.builtin.str.$emptystr"; return this._gr("formatted", "Sk.abstr.objectFormat(" + b + "," + a + ")") } ; a.prototype.vexpr = function(a, b, c, g) { var f; a.lineno > this.u.lineno && (this.u.lineno = a.lineno, this.u.linenoSet = !1); switch (a.constructor) { case Sk.astnodes.BoolOp: return this.cboolop(a); case Sk.astnodes.BinOp: return this._gr("binop", "Sk.abstr.numberBinOp(", this.vexpr(a.left), ",", this.vexpr(a.right), ",'", a.op.prototype._astname, "')"); case Sk.astnodes.UnaryOp: return this._gr("unaryop", "Sk.abstr.numberUnaryOp(", this.vexpr(a.operand), ",'", a.op.prototype._astname, "')"); case Sk.astnodes.Lambda: return this.clambda(a); case Sk.astnodes.IfExp: return this.cifexp(a); case Sk.astnodes.Dict: return this.cdict(a); case Sk.astnodes.ListComp: return this.clistcomp(a); case Sk.astnodes.DictComp: return this.cdictcomp(a); case Sk.astnodes.SetComp: return this.csetcomp(a); case Sk.astnodes.GeneratorExp: return this.cgenexp(a); case Sk.astnodes.Yield: return this.cyield(a); case Sk.astnodes.Compare: return this.ccompare(a); case Sk.astnodes.Call: return b = this.ccall(a), this.annotateSource(a), b; case Sk.astnodes.Num: if ("number" === typeof a.n) return a.n; if (a.n instanceof Sk.builtin.int_) return this.makeConstant("new Sk.builtin.int_(" + a.n.v + ")"); if (a.n instanceof Sk.builtin.float_) return a = 0 === a.n.v && -Infinity === 1 / a.n.v ? "-0" : a.n.v, this.makeConstant("new Sk.builtin.float_(" + a + ")"); if (a.n instanceof Sk.builtin.lng) return this.makeConstant("Sk.longFromStr('" + a.n.tp$str().v + "')"); if (a.n instanceof Sk.builtin.complex) return this.makeConstant("new Sk.builtin.complex(" + (0 === a.n.real && -Infinity === 1 / a.n.real ? "-0" : a.n.real) + ", " + (0 === a.n.imag && -Infinity === 1 / a.n.imag ? "-0" : a.n.imag) + ")"); Sk.asserts.fail("unhandled Num type"); case Sk.astnodes.Bytes: if (Sk.__future__.python3) { b = []; a = a.s.$jsstr(); for (c = 0; c < a.length; c++) b.push(a.charCodeAt(c)); return this.makeConstant("new Sk.builtin.bytes([", b.join(", "), "])") } case Sk.astnodes.Str: return this.makeConstant("new Sk.builtin.str(", e(a.s.$jsstr()), ")"); case Sk.astnodes.Attribute: a.ctx !== Sk.astnodes.AugLoad && a.ctx !== Sk.astnodes.AugStore && (f = this.vexpr(a.value)); g = a.attr.$r().v; g = g.substring(1, g.length - 1); g = d(this.u.private_, new Sk.builtin.str(g)).v; g = this.makeConstant("new Sk.builtin.str('" + g + "')"); switch (a.ctx) { case Sk.astnodes.AugLoad: return h("$ret = Sk.abstr.gattr(", c, ",", g, ", true);"), this._checkSuspension(a), this._gr("lattr", "$ret"); case Sk.astnodes.Load: return h("$ret = Sk.abstr.gattr(", f, ",", g, ", true);"), this._checkSuspension(a), this._gr("lattr", "$ret"); case Sk.astnodes.AugStore: h("$ret = undefined;"); h("if(", b, "!==undefined){"); h("$ret = Sk.abstr.sattr(", c, ",", g, ",", b, ", true);"); h("}"); this._checkSuspension(a); break; case Sk.astnodes.Store: h("$ret = Sk.abstr.sattr(", f, ",", g, ",", b, ", true);"); this._checkSuspension(a); break; case Sk.astnodes.Del: Sk.asserts.fail("todo Del;"); break; default: Sk.asserts.fail("invalid attribute expression") } break; case Sk.astnodes.Subscript: switch (a.ctx) { case Sk.astnodes.AugLoad: return h("$ret = Sk.abstr.objectGetItem(", c, ",", g, ", true);"), this._checkSuspension(a), this._gr("gitem", "$ret"); case Sk.astnodes.Load: case Sk.astnodes.Store: case Sk.astnodes.Del: return this.vslice(a.slice, a.ctx, this.vexpr(a.value), b); case Sk.astnodes.AugStore: h("$ret=undefined;"); h("if(", b, "!==undefined){"); h("$ret=Sk.abstr.objectSetItem(", c, ",", g, ",", b, ", true)"); h("}"); this._checkSuspension(a); break; default: Sk.asserts.fail("invalid subscript expression") } break; case Sk.astnodes.Name: return this.nameop(a.id, a.ctx, b); case Sk.astnodes.NameConstant: if (a.ctx === Sk.astnodes.Store || a.ctx === Sk.astnodes.AugStore || a.ctx === Sk.astnodes.Del) throw new Sk.builtin.SyntaxError("can not assign to a constant name"); switch (a.value) { case Sk.builtin.none.none$: return "Sk.builtin.none.none$"; case Sk.builtin.bool.true$: return "Sk.builtin.bool.true$"; case Sk.builtin.bool.false$: return "Sk.builtin.bool.false$"; default: Sk.asserts.fail("invalid named constant") } break; case Sk.astnodes.List: return this.ctuplelistorset(a, b, "list"); case Sk.astnodes.Tuple: return this.ctuplelistorset(a, b, "tuple"); case Sk.astnodes.Set: return this.ctuplelistorset(a, b, "set"); case Sk.astnodes.Starred: switch (a.ctx) { case Sk.astnodes.Store: throw new Sk.builtin.SyntaxError("starred assignment target must be in a list or tuple",this.filename,a.lineno); default: throw new Sk.builtin.SyntaxError("can't use starred expression here",this.filename,a.lineno); } case Sk.astnodes.JoinedStr: return this.cjoinedstr(a); case Sk.astnodes.FormattedValue: return this.cformattedvalue(a); default: Sk.asserts.fail("unhandled case " + a.constructor.name + " vexpr") } } ; a.prototype.vseqexpr = function(a, b) { var c; Sk.asserts.assert(void 0 === b || a.length === b.length); var d = []; for (c = 0; c < a.length; ++c) d.push(this.vexpr(a[c], void 0 === b ? void 0 : b[c])); return d } ; a.prototype.caugassign = function(a) { Sk.asserts.assert(a instanceof Sk.astnodes.AugAssign); var b = a.target; switch (b.constructor) { case Sk.astnodes.Attribute: var c = this.vexpr(b.value); b = new Sk.astnodes.Attribute(b.value,b.attr,Sk.astnodes.AugLoad,b.lineno,b.col_offset); var d = this.vexpr(b, void 0, c); var f = this.vexpr(a.value); a = this._gr("inplbinopattr", "Sk.abstr.numberInplaceBinOp(", d, ",", f, ",'", a.op.prototype._astname, "')"); b.ctx = Sk.astnodes.AugStore; return this.vexpr(b, a, c); case Sk.astnodes.Subscript: c = this.vexpr(b.value); var e = this.vslicesub(b.slice); b = new Sk.astnodes.Subscript(b.value,e,Sk.astnodes.AugLoad,b.lineno,b.col_offset); d = this.vexpr(b, void 0, c, e); f = this.vexpr(a.value); a = this._gr("inplbinopsubscr", "Sk.abstr.numberInplaceBinOp(", d, ",", f, ",'", a.op.prototype._astname, "')"); b.ctx = Sk.astnodes.AugStore; return this.vexpr(b, a, c, e); case Sk.astnodes.Name: return c = this.nameop(b.id, Sk.astnodes.Load), f = this.vexpr(a.value), a = this._gr("inplbinop", "Sk.abstr.numberInplaceBinOp(", c, ",", f, ",'", a.op.prototype._astname, "')"), this.nameop(b.id, Sk.astnodes.Store, a); default: Sk.asserts.fail("unhandled case in augassign") } } ; a.prototype.exprConstant = function(a) { switch (a.constructor) { case Sk.astnodes.Num: return Sk.misceval.isTrue(a.n) ? 1 : 0; case Sk.astnodes.Str: return Sk.misceval.isTrue(a.s) ? 1 : 0; default: return -1 } } ; a.prototype.newBlock = function(a) { var b = this.u.blocknum++; this.u.blocks[b] = []; this.u.blocks[b]._name = a || ""; this.u.blocks[b]._next = null; return b } ; a.prototype.setBlock = function(a) { Sk.asserts.assert(0 <= a && a < this.u.blocknum); this.u.curblock = a } ; a.prototype.pushBreakBlock = function(a) { Sk.asserts.assert(0 <= a && a < this.u.blocknum); this.u.breakBlocks.push(a) } ; a.prototype.popBreakBlock = function() { this.u.breakBlocks.pop() } ; a.prototype.pushContinueBlock = function(a) { Sk.asserts.assert(0 <= a && a < this.u.blocknum); this.u.continueBlocks.push(a) } ; a.prototype.popContinueBlock = function() { this.u.continueBlocks.pop() } ; a.prototype.pushExceptBlock = function(a) { Sk.asserts.assert(0 <= a && a < this.u.blocknum); this.u.exceptBlocks.push(a) } ; a.prototype.popExceptBlock = function() { this.u.exceptBlocks.pop() } ; a.prototype.pushFinallyBlock = function(a) { Sk.asserts.assert(0 <= a && a < this.u.blocknum); Sk.asserts.assert(this.u.breakBlocks.length === this.u.continueBlocks.length); this.u.finallyBlocks.push({ blk: a, breakDepth: this.u.breakBlocks.length }) } ; a.prototype.popFinallyBlock = function() { this.u.finallyBlocks.pop() } ; a.prototype.peekFinallyBlock = function() { return 0 < this.u.finallyBlocks.length ? this.u.finallyBlocks[this.u.finallyBlocks.length - 1] : void 0 } ; a.prototype.setupExcept = function(a) { h("$exc.push(", a, ");") } ; a.prototype.endExcept = function() { h("$exc.pop();") } ; a.prototype.outputLocals = function(a) { var b, c = {}; for (b = 0; a.argnames && b < a.argnames.length; ++b) c[a.argnames[b]] = !0; a.localnames.sort(); var d = []; for (b = 0; b < a.localnames.length; ++b) { var f = a.localnames[b]; void 0 === c[f] && (d.push(f), c[f] = !0) } return 0 < d.length ? "var " + d.join(",") + "; /* locals */" : "" } ; a.prototype.outputSuspensionHelpers = function(a) { var b, c = [], d = a.localnames.concat(a.tempsToSave), f = {}, e = a.ste.blockType === Sk.SYMTAB_CONSTS.FunctionBlock && a.ste.childHasFree, g = (0 < d.length ? "var " + d.join(",") + ";" : "") + "var $wakeFromSuspension = function() {var susp = " + a.scopename + ".$wakingSuspension; " + a.scopename + ".$wakingSuspension = undefined;$blk=susp.$blk; $loc=susp.$loc; $gbl=susp.$gbl; $exc=susp.$exc; $err=susp.$err; $postfinally=susp.$postfinally;$currLineNo=susp.$lineno; $currColNo=susp.$colno; Sk.lastYield=Date.now();" + (e ? "$cell=susp.$cell;" : ""); for (b = 0; b < d.length; b++) { var h = d[b]; void 0 === f[h] && (g += h + "=susp.$tmps." + h + ";", f[h] = !0) } g += "try { $ret=susp.child.resume(); } catch(err) { if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: $currLineNo, colno: $currColNo, filename: '" + this.filename + "'}); if($exc.length>0) { $err=err; $blk=$exc.pop(); } else { throw err; } }};"; g += "var $saveSuspension = function($child, $filename, $lineno, $colno) {var susp = new Sk.misceval.Suspension(); susp.child=$child;susp.resume=function(){" + a.scopename + ".$wakingSuspension=susp; return " + a.scopename + "(" + (a.ste.generator ? "$gen" : "") + "); };susp.data=susp.child.data;susp.$blk=$blk;susp.$loc=$loc;susp.$gbl=$gbl;susp.$exc=$exc;susp.$err=$err;susp.$postfinally=$postfinally;susp.$filename=$filename;susp.$lineno=$lineno;susp.$colno=$colno;susp.optional=susp.child.optional;" + (e ? "susp.$cell=$cell;" : ""); f = {}; for (b = 0; b < d.length; b++) h = d[b], void 0 === f[h] && (c.push('"' + h + '":' + h), f[h] = !0); return g += "susp.$tmps={" + c.join(",") + "};return susp;};" } ; a.prototype.outputAllUnits = function() { var a, b, c = ""; for (b = 0; b < this.allUnits.length; ++b) { var d = this.allUnits[b]; c += d.prefixCode; c += this.outputLocals(d); d.doesSuspend && (c += this.outputSuspensionHelpers(d)); c += d.varDeclsCode; c += d.switchCode; var e = d.blocks; var g = Object.create(null); for (a = 0; a < e.length; ++a) { var h = a; if (!(h in g)) for (; ; ) if (g[h] = !0, c += "case " + h + ": /* --- " + e[h]._name + " --- */", c += e[h].join(""), null !== e[h]._next) if (e[h]._next in g) { c += "/* jump */ continue;"; break } else c += "/* allowing case fallthrough */", h = e[h]._next; else { c += "throw new Sk.builtin.SystemError('internal error: unterminated block');"; break } } c += d.suffixCode } return c } ; a.prototype.cif = function(a) { var b; Sk.asserts.assert(a instanceof Sk.astnodes.If); var c = this.exprConstant(a.test); if (0 === c) a.orelse && 0 < a.orelse.length && this.vseqstmt(a.orelse); else if (1 === c) this.vseqstmt(a.body); else { var d = this.newBlock("end of if"); a.orelse && 0 < a.orelse.length && (b = this.newBlock("next branch of if")); c = this.vexpr(a.test); a.orelse && 0 < a.orelse.length ? (this._jumpfalse(c, b), this.vseqstmt(a.body), this._jump(d), this.setBlock(b), this.vseqstmt(a.orelse)) : (this._jumpfalse(c, d), this.vseqstmt(a.body)); this._jump(d); this.setBlock(d) } } ; a.prototype.cwhile = function(a) { if (0 === this.exprConstant(a.test)) a.orelse && this.vseqstmt(a.orelse); else { var b = this.newBlock("while test"); this._jump(b); this.setBlock(b); var c = this.newBlock("after while"); var d = 0 < a.orelse.length ? this.newBlock("while orelse") : null; var f = this.newBlock("while body"); this.annotateSource(a); this._jumpfalse(this.vexpr(a.test), d ? d : c); this._jump(f); this.pushBreakBlock(c); this.pushContinueBlock(b); this.setBlock(f); (Sk.debugging || Sk.killableWhile) && this.u.canSuspend && (f = this.newBlock("debug breakpoint for line " + a.lineno), h("if (Sk.breakpoints('" + this.filename + "'," + a.lineno + "," + a.col_offset + ")) {", "var $susp = $saveSuspension({data: {type: 'Sk.delay'}, resume: function() {}}, '" + this.filename + "'," + a.lineno + "," + a.col_offset + ");", "$susp.$blk = " + f + ";", "$susp.optional = true;", "return $susp;", "}"), this._jump(f), this.setBlock(f), this.u.doesSuspend = !0); this.vseqstmt(a.body); this._jump(b); this.popContinueBlock(); this.popBreakBlock(); 0 < a.orelse.length && (this.setBlock(d), this.vseqstmt(a.orelse), this._jump(c)); this.setBlock(c) } } ; a.prototype.cfor = function(a) { var b = this.newBlock("for start") , c = this.newBlock("for cleanup") , d = this.newBlock("for end"); this.pushBreakBlock(d); this.pushContinueBlock(b); var f = this.vexpr(a.iter); if (this.u.ste.generator) { var e = "$loc." + this.gensym("iter"); h(e, "=Sk.abstr.iter(", f, ");") } else e = this._gr("iter", "Sk.abstr.iter(", f, ")"), this.u.tempsToSave.push(e); this._jump(b); this.setBlock(b); h("$ret = Sk.abstr.iternext(", e, this.u.canSuspend ? ", true" : ", false", ");"); this._checkSuspension(a); e = this._gr("next", "$ret"); this._jumpundef(e, c); this.vexpr(a.target, e); (Sk.debugging || Sk.killableFor) && this.u.canSuspend && (e = this.newBlock("debug breakpoint for line " + a.lineno), h("if (Sk.breakpoints('" + this.filename + "'," + a.lineno + "," + a.col_offset + ")) {", "var $susp = $saveSuspension({data: {type: 'Sk.delay'}, resume: function() {}}, '" + this.filename + "'," + a.lineno + "," + a.col_offset + ");", "$susp.$blk = " + e + ";", "$susp.optional = true;", "return $susp;", "}"), this._jump(e), this.setBlock(e), this.u.doesSuspend = !0); this.vseqstmt(a.body); this._jump(b); this.setBlock(c); this.popContinueBlock(); this.popBreakBlock(); this.vseqstmt(a.orelse); this._jump(d); this.setBlock(d) } ; a.prototype.craise = function(a) { if (a.exc) { var b = this._gr("exc", this.vexpr(a.exc)) , c = this.newBlock("exception now instantiated") , d = this._gr("isclass", b + ".prototype instanceof Sk.builtin.BaseException"); this._jumpfalse(d, c); a.inst ? (d = this._gr("inst", this.vexpr(a.inst)), h("if(!(", d, " instanceof Sk.builtin.tuple)) {", d, "= new Sk.builtin.tuple([", d, "]);", "}"), h("$ret = Sk.misceval.callsimOrSuspendArray(", b, ",", d, ".v);")) : h("$ret = Sk.misceval.callsimOrSuspend(", b, ");"); this._checkSuspension(a); h(b, "=$ret;"); this._jump(c); this.setBlock(c); h("if (", b, " instanceof Sk.builtin.BaseException) {throw ", b, ";} else {throw new Sk.builtin.TypeError('exceptions must derive from BaseException');};") } else h("throw $err;") } ; a.prototype.outputFinallyCascade = function(a) { if (0 == this.u.finallyBlocks.length) h("if($postfinally!==undefined) { if ($postfinally.returning) { return $postfinally.returning; } else { $blk=$postfinally.gotoBlock; $postfinally=undefined; continue; } }"); else { var b = this.peekFinallyBlock(); h("if($postfinally!==undefined) {", "if ($postfinally.returning", b.breakDepth == a.breakDepth ? "|| $postfinally.isBreak" : "", ") {", "$blk=", b.blk, ";continue;", "} else {", "$blk=$postfinally.gotoBlock;$postfinally=undefined;continue;", "}", "}") } } ; a.prototype.ctry = function(a) { var b, c = a.handlers.length; if (a.finalbody) { var d = this.newBlock("finalbody"); var f = this.newBlock("finalexh"); var e = this._gr("finally_reraise", "undefined"); this.u.tempsToSave.push(e); this.pushFinallyBlock(d); var g = this.peekFinallyBlock(); this.setupExcept(f) } var m = []; for (b = 0; b < c; ++b) m.push(this.newBlock("except_" + b + "_")); var p = this.newBlock("unhandled"); var H = this.newBlock("orelse"); var K = this.newBlock("end"); 0 != m.length && this.setupExcept(m[0]); this.vseqstmt(a.body); 0 != m.length && this.endExcept(); this._jump(H); for (b = 0; b < c; ++b) { this.setBlock(m[b]); var C = a.handlers[b]; if (!C.type && b < c - 1) throw new Sk.builtin.SyntaxError("default 'except:' must be last",this.filename,C.lineno); if (C.type) { var F = this.vexpr(C.type); var L = b == c - 1 ? p : m[b + 1]; F = this._gr("instance", "Sk.misceval.isTrue(Sk.builtin.isinstance($err, ", F, "))"); this._jumpfalse(F, L) } C.name && this.vexpr(C.name, "$err"); this.vseqstmt(C.body); this._jump(K) } this.setBlock(p); h("throw $err;"); this.setBlock(H); this.vseqstmt(a.orelse); this._jump(K); this.setBlock(K); a.finalbody && (this.endExcept(), this._jump(d), this.setBlock(f), h(e, "=$err;"), this._jump(d), this.setBlock(d), this.popFinallyBlock(), this.vseqstmt(a.finalbody), h("if(", e, "!==undefined) { throw ", e, ";}"), this.outputFinallyCascade(g)) } ; a.prototype.cwith = function(a, b) { var c = this.newBlock("withexh") , d = this.newBlock("withtidyup") , f = this.newBlock("withcarryon"); var e = this._gr("mgr", this.vexpr(a.items[b].context_expr)); h("$ret = Sk.abstr.gattr(", e, ",Sk.builtin.str.$exit, true);"); this._checkSuspension(a); var g = this._gr("exit", "$ret"); this.u.tempsToSave.push(g); h("$ret = Sk.abstr.gattr(", e, ",Sk.builtin.str.$enter, true);"); this._checkSuspension(a); h("$ret = Sk.misceval.callsimOrSuspendArray($ret);"); this._checkSuspension(a); e = this._gr("value", "$ret"); this.pushFinallyBlock(d); var k = this.u.finallyBlocks[this.u.finallyBlocks.length - 1]; this.setupExcept(c); a.items[b].optional_vars && this.nameop(a.items[b].optional_vars.id, Sk.astnodes.Store, e); b + 1 < a.items.length ? this.cwith(a, b + 1) : this.vseqstmt(a.body); this.endExcept(); this._jump(d); this.setBlock(c); h("$ret = Sk.misceval.applyOrSuspend(", g, ",undefined,Sk.builtin.getExcInfo($err),undefined,[]);"); this._checkSuspension(a); this._jumptrue("$ret", f); h("throw $err;"); this.setBlock(d); this.popFinallyBlock(); h("$ret = Sk.misceval.callsimOrSuspendArray(", g, ",[Sk.builtin.none.none$,Sk.builtin.none.none$,Sk.builtin.none.none$]);"); this._checkSuspension(a); this.outputFinallyCascade(k); this._jump(f); this.setBlock(f) } ; a.prototype.cassert = function(a) { var b = this.vexpr(a.test) , c = this.newBlock("end"); this._jumptrue(b, c); h("throw new Sk.builtin.AssertionError(", a.msg ? this.vexpr(a.msg) : "", ");"); this.setBlock(c) } ; a.prototype.cimportas = function(a, b, c) { a = a.v; var d = a.indexOf(".") , e = c; if (-1 !== d) for (a = a.substr(d + 1); -1 !== d; ) d = a.indexOf("."), c = -1 !== d ? a.substr(0, d) : a, e = this._gr("lattr", "Sk.abstr.gattr(", e, ", new Sk.builtin.str('", c, "'))"), a = a.substr(d + 1); return this.nameop(b, Sk.astnodes.Store, e) } ; a.prototype.cimport = function(a) { var b, c = a.names.length; for (b = 0; b < c; ++b) { var d = a.names[b]; h("$ret = Sk.builtin.__import__(", d.name.$r().v, ",$gbl,$loc,[],", Sk.__future__.absolute_import ? 0 : -1, ");"); this._checkSuspension(a); var e = this._gr("module", "$ret"); if (d.asname) this.cimportas(d.name, d.asname, e); else { var f = d.name; d = f.v.indexOf("."); -1 !== d && (f = new Sk.builtin.str(f.v.substr(0, d))); this.nameop(f, Sk.astnodes.Store, e) } } } ; a.prototype.cfromimport = function(a) { var b, d = a.names.length; var e = []; var f = a.level; 0 != f || Sk.__future__.absolute_import || (f = -1); for (b = 0; b < d; ++b) e[b] = "'" + c(a.names[b].name.v) + "'"; h("$ret = Sk.builtin.__import__(", a.module.$r().v, ",$gbl,$loc,[", e, "],", f, ");"); this._checkSuspension(a); f = this._gr("module", "$ret"); for (b = 0; b < d; ++b) { e = a.names[b]; var g = "'" + e.name.v + "'"; if (0 === b && "*" === e.name.v) { Sk.asserts.assert(1 === d); h("Sk.importStar(", f, ",$loc, $gbl);"); break } var m = this._gr("item", "Sk.abstr.gattr(", f, ", new Sk.builtin.str(", g, "))"); g = e.name; e.asname && (g = e.asname); this.nameop(g, Sk.astnodes.Store, m) } } ; a.prototype.buildcodeobj = function(a, b, e, g, m, p) { var f = [] , k = [] , l = [] , n = [] , q = null , u = null; e && (k = this.vseqexpr(e)); g && g.defaults && (l = this.vseqexpr(g.defaults)); g && g.kw_defaults && (n = g.kw_defaults.map(a=>a ? this.vexpr(a) : "undefined")); g && g.vararg && (q = g.vararg); g && g.kwarg && (u = g.kwarg); if (!Sk.__future__.python3 && g && g.kwonlyargs && 0 != g.kwonlyargs.length) throw new Sk.builtin.SyntaxError("Keyword-only arguments are not supported in Python 2"); var F = this.enterScope(b, a, a.lineno, this.canSuspend); e = this.u.ste.generator; var L = this.u.ste.hasFree; var W = this.u.ste.childHasFree; var N = this.newBlock("codeobj entry"); this.u.prefixCode = "var " + F + "=(function " + this.niceName(b.v) + "$("; var E = []; if (e) { if (u) throw new Sk.builtin.SyntaxError(b.v + "(): keyword arguments in generators not supported",this.filename,a.lineno); if (q) throw new Sk.builtin.SyntaxError(b.v + "(): variable number of arguments in generators not supported",this.filename,a.lineno); E.push("$gen") } else { u && (E.push("$kwa"), this.u.tempsToSave.push("$kwa")); for (a = 0; g && a < g.args.length; ++a) E.push(this.nameop(g.args[a].arg, Sk.astnodes.Param)); for (a = 0; g && g.kwonlyargs && a < g.kwonlyargs.length; ++a) E.push(this.nameop(g.kwonlyargs[a].arg, Sk.astnodes.Param)); q && E.push(this.nameop(g.vararg.arg, Sk.astnodes.Param)) } let X = !e; L && (X || E.push("$free"), this.u.tempsToSave.push("$free")); this.u.prefixCode = X ? this.u.prefixCode + "$posargs,$kwargs" : this.u.prefixCode + E.join(","); this.u.prefixCode += "){"; e && (this.u.prefixCode += "\n// generator\n"); L && (this.u.prefixCode += "\n// has free\n"); W && (this.u.prefixCode += "\n// has cell\n"); X && (this.u.prefixCode += "\n// fast call\n"); var aa = "{}"; e && (N = "$gen.gi$resumeat", aa = "$gen.gi$locals"); a = ",$cell={}"; W && e && (a = ",$cell=$gen.gi$cells"); this.u.varDeclsCode += "var $blk=" + N + ",$exc=[],$loc=" + aa + a + ",$gbl=" + (X ? "this.func_globals" : "this") + (X && L ? ",$free=this.func_closure" : "") + ",$err=undefined,$ret=undefined,$postfinally=undefined,$currLineNo=undefined,$currColNo=undefined;"; null !== Sk.execLimit && (this.u.varDeclsCode += "if (typeof Sk.execStart === 'undefined') {Sk.execStart = Date.now()}"); null !== Sk.yieldLimit && this.u.canSuspend && (this.u.varDeclsCode += "if (typeof Sk.lastYield === 'undefined') {Sk.lastYield = Date.now()}"); this.u.varDeclsCode += "if (" + F + ".$wakingSuspension!==undefined) { $wakeFromSuspension(); } else {"; if (X) { this.u.varDeclsCode = u || q || g && g.kwonlyargs && 0 !== g.kwonlyargs.length ? this.u.varDeclsCode + "\nvar $args = this.$resolveArgs($posargs,$kwargs)\n" : this.u.varDeclsCode + ("var $args = ((!$kwargs || $kwargs.length===0) && $posargs.length===" + E.length + ") ? $posargs : this.$resolveArgs($posargs,$kwargs)"); for (a = 0; a < E.length; a++) this.u.varDeclsCode += "," + E[a] + "=$args[" + a + "]"; this.u.varDeclsCode += ";\n" } if (e && 0 < l.length) for (N = g.args.length - l.length, a = 0; a < l.length; ++a) E = this.nameop(g.args[a + N].arg, Sk.astnodes.Param), this.u.varDeclsCode += "if(" + E + "===undefined)" + E + "=" + F + ".$defaults[" + a + "];"; for (a = 0; g && a < g.args.length; ++a) E = g.args[a].arg, this.isCell(E) && (E = c(d(this.u.private_, E).v), this.u.varDeclsCode += "$cell." + E + "=" + E + ";"); for (a = 0; g && g.kwonlyargs && a < g.kwonlyargs.length; ++a) E = g.kwonlyargs[a].arg, this.isCell(E) && (E = c(d(this.u.private_, E).v), this.u.varDeclsCode += "$cell." + E + "=" + E + ";"); q && this.isCell(q.arg) && (a = c(d(this.u.private_, q.arg).v), this.u.varDeclsCode += "$cell." + a + "=" + a + ";"); u && (this.u.localnames.push(u.arg.v), this.u.varDeclsCode += u.arg.v + "=new Sk.builtins['dict']($kwa);", this.isCell(u.arg) && (a = c(d(this.u.private_, u.arg).v), this.u.varDeclsCode += "$cell." + a + "=" + a + ";")); this.u.varDeclsCode += "}"; Sk.__future__.python3 && p && (this.u.varDeclsCode += "$gbl.__class__=$gbl." + p.v + ";"); this.u.switchCode = "while(true){try{"; this.u.switchCode += this.outputInterruptTest(); this.u.switchCode += "switch($blk){"; this.u.suffixCode = "} }catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: $currLineNo, colno: $currColNo, filename: '" + this.filename + "'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} }});"; m.call(this, F); if (g) { for (let a of g.args) f.push(a.arg.v); for (let a of g.kwonlyargs || []) f.push(a.arg.v); this.u.argnames = f } this.exitScope(); 0 < l.length && h(F, ".$defaults=[", l.join(","), "];"); g && g.kwonlyargs && 0 < g.kwonlyargs.length && (h(F, ".co_argcount=", g.args.length, ";"), h(F, ".co_kwonlyargcount=", g.kwonlyargs.length, ";"), h(F, ".$kwdefs=[", n.join(","), "];")); 0 < f.length ? h(F, ".co_varnames=['", f.join("','"), "'];") : h(F, ".co_varnames=[];"); u && h(F, ".co_kwargs=1;"); q && h(F, ".co_varargs=1;"); e || h(F, ".co_fastcall=1;"); m = ""; L && (m = ",$cell", (p = this.u.ste.hasFree) && (m += ",$free")); if (e) return g && 0 < g.args.length ? this._gr("gener", "new Sk.builtins['function']((function(){var $origargs=Array.prototype.slice.call(arguments);Sk.builtin.pyCheckArgsLen(\"", b.v, '",arguments.length,', g.args.length - l.length, ",", g.args.length, ");return new Sk.builtins['generator'](", F, ",$gbl,$origargs", m, ");}))") : this._gr("gener", "new Sk.builtins['function']((function(){Sk.builtin.pyCheckArgsLen(\"", b.v, "\",arguments.length,0,0);return new Sk.builtins['generator'](", F, ",$gbl,[]", m, ");}))"); if (0 < k.length) { h("$ret = new Sk.builtins['function'](", F, ",$gbl", m, ");"); for (let a of k.reverse()) h("$ret = Sk.misceval.callsimOrSuspendArray(", a, ",[$ret]);"), this._checkSuspension(); return this._gr("funcobj", "$ret") } return this._gr("funcobj", "new Sk.builtins['function'](", F, ",$gbl", m, ")") } ; a.prototype.cfunction = function(a, b) { Sk.asserts.assert(a instanceof Sk.astnodes.FunctionDef); b = this.buildcodeobj(a, a.name, a.decorator_list, a.args, function(b) { this.vseqstmt(a.body); h("return Sk.builtin.none.none$;") }, b); this.nameop(a.name, Sk.astnodes.Store, b) } ; a.prototype.clambda = function(a) { Sk.asserts.assert(a instanceof Sk.astnodes.Lambda); return this.buildcodeobj(a, new Sk.builtin.str(""), null, a.args, function(b) { b = this.vexpr(a.body); h("return ", b, ";") }) } ; a.prototype.cifexp = function(a) { var b = this.newBlock("next of ifexp") , c = this.newBlock("end of ifexp") , d = this._gr("res", "null") , e = this.vexpr(a.test); this._jumpfalse(e, b); h(d, "=", this.vexpr(a.body), ";"); this._jump(c); this.setBlock(b); h(d, "=", this.vexpr(a.orelse), ";"); this._jump(c); this.setBlock(c); return d } ; a.prototype.cgenexpgen = function(a, b, c) { var d = this.newBlock("start for " + b) , e = this.newBlock("skip for " + b); this.newBlock("if cleanup for " + b); var f = this.newBlock("end for " + b) , g = a[b]; if (0 === b) var k = "$loc.$iter0"; else { var n = this.vexpr(g.iter); k = "$loc." + this.gensym("iter"); h(k, "=", "Sk.abstr.iter(", n, ");") } this._jump(d); this.setBlock(d); this.annotateSource(c); h("$ret = Sk.abstr.iternext(", k, this.u.canSuspend ? ", true" : ", false", ");"); this._checkSuspension(c); n = this._gr("next", "$ret"); this._jumpundef(n, f); this.vexpr(g.target, n); var m = g.ifs ? g.ifs.length : 0; for (k = 0; k < m; ++k) this.annotateSource(g.ifs[k]), n = this.vexpr(g.ifs[k]), this._jumpfalse(n, d); ++b < a.length && this.cgenexpgen(a, b, c); b >= a.length && (this.annotateSource(c), a = this.vexpr(c), h("return [", e, "/*resume*/,", a, "/*ret*/];"), this.setBlock(e)); this._jump(d); this.setBlock(f); 1 === b && h("return Sk.builtin.none.none$;") } ; a.prototype.cgenexp = function(a) { var b = this.buildcodeobj(a, new Sk.builtin.str(""), null, null, function(b) { this.cgenexpgen(a.generators, 0, a.elt) }); b = this._gr("gener", "Sk.misceval.callsimArray(", b, ");"); h(b, ".gi$locals.$iter0=Sk.abstr.iter(", this.vexpr(a.generators[0].iter), ");"); return b } ; a.prototype.cclass = function(a) { Sk.asserts.assert(a instanceof Sk.astnodes.ClassDef); var b = this.vseqexpr(a.decorator_list); var c = this.vseqexpr(a.bases); var d = this.enterScope(a.name, a, a.lineno); var e = this.newBlock("class entry"); this.u.prefixCode = "var " + d + "=(function $" + a.name.v + "$class_outer($globals,$locals,$cell){var $gbl=$globals,$loc=$locals;$free=$globals;"; this.u.switchCode += "(function $" + a.name.v + "$_closure($cell){"; this.u.switchCode += "var $blk=" + e + ",$exc=[],$ret=undefined,$postfinally=undefined,$currLineNo=undefined,$currColNo=undefined;"; null !== Sk.execLimit && (this.u.switchCode += "if (typeof Sk.execStart === 'undefined') {Sk.execStart = Date.now()}"); null !== Sk.yieldLimit && this.u.canSuspend && (this.u.switchCode += "if (typeof Sk.lastYield === 'undefined') {Sk.lastYield = Date.now()}"); this.u.switchCode += "while(true){try{"; this.u.switchCode += this.outputInterruptTest(); this.u.switchCode += "switch($blk){"; this.u.suffixCode = "}}catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: $currLineNo, colno: $currColNo, filename: '" + this.filename + "'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }}}"; this.u.suffixCode += "}).call(null, $cell);});"; this.u.private_ = a.name; this.cbody(a.body, a.name); h("return;"); this.exitScope(); h("$ret = Sk.misceval.buildClass($gbl,", d, ",", a.name.$r().v, ",[", c, "], $cell);"); for (let a of b) h("$ret = Sk.misceval.callsimOrSuspendArray(", a, ", [$ret]);"), this._checkSuspension(); this.nameop(a.name, Sk.astnodes.Store, "$ret") } ; a.prototype.ccontinue = function(a) { var b = this.peekFinallyBlock(); if (0 == this.u.continueBlocks.length) throw new Sk.builtin.SyntaxError("'continue' outside loop",this.filename,a.lineno); a = this.u.continueBlocks[this.u.continueBlocks.length - 1]; Sk.asserts.assert(this.u.breakBlocks.length === this.u.continueBlocks.length); b && b.breakDepth == this.u.continueBlocks.length ? h("$postfinally={isBreak:true,gotoBlock:", a, "};") : this._jump(a) } ; a.prototype.cbreak = function(a) { var b = this.peekFinallyBlock(); if (0 === this.u.breakBlocks.length) throw new Sk.builtin.SyntaxError("'break' outside loop",this.filename,a.lineno); a = this.u.breakBlocks[this.u.breakBlocks.length - 1]; b && b.breakDepth == this.u.breakBlocks.length ? h("$postfinally={isBreak:true,gotoBlock:", a, "};") : this._jump(a) } ; a.prototype.vstmt = function(a, b) { this.u.lineno = a.lineno; this.u.linenoSet = !1; this.u.localtemps = []; if (Sk.debugging && this.u.canSuspend) { var c = this.newBlock("debug breakpoint for line " + a.lineno); h("if (Sk.breakpoints('" + this.filename + "'," + a.lineno + "," + a.col_offset + ")) {", "var $susp = $saveSuspension({data: {type: 'Sk.debug'}, resume: function() {}}, '" + this.filename + "'," + a.lineno + "," + a.col_offset + ");", "$susp.$blk = " + c + ";", "$susp.optional = true;", "return $susp;", "}"); this._jump(c); this.setBlock(c); this.u.doesSuspend = !0 } this.annotateSource(a); switch (a.constructor) { case Sk.astnodes.FunctionDef: this.cfunction(a, b); break; case Sk.astnodes.ClassDef: this.cclass(a); break; case Sk.astnodes.Return: if (this.u.ste.blockType !== Sk.SYMTAB_CONSTS.FunctionBlock) throw new Sk.builtin.SyntaxError("'return' outside function",this.filename,a.lineno); c = a.value ? this.vexpr(a.value) : "Sk.builtin.none.none$"; 0 == this.u.finallyBlocks.length ? h("return ", c, ";") : (h("$postfinally={returning:", c, "};"), this._jump(this.peekFinallyBlock().blk)); break; case Sk.astnodes.Delete: this.vseqexpr(a.targets); break; case Sk.astnodes.Assign: var d = a.targets.length; c = this.vexpr(a.value); for (b = 0; b < d; ++b) this.vexpr(a.targets[b], c); break; case Sk.astnodes.AnnAssign: c = this.vexpr(a.value); this.vexpr(a.target, c); this.vexpr(a.annotation); break; case Sk.astnodes.AugAssign: return this.caugassign(a); case Sk.astnodes.Print: this.cprint(a); break; case Sk.astnodes.For: return this.cfor(a); case Sk.astnodes.While: return this.cwhile(a); case Sk.astnodes.If: return this.cif(a); case Sk.astnodes.Raise: return this.craise(a); case Sk.astnodes.Try: return this.ctry(a); case Sk.astnodes.With: return this.cwith(a, 0); case Sk.astnodes.Assert: return this.cassert(a); case Sk.astnodes.Import: return this.cimport(a); case Sk.astnodes.ImportFrom: return this.cfromimport(a); case Sk.astnodes.Global: break; case Sk.astnodes.Expr: this.vexpr(a.value); break; case Sk.astnodes.Pass: break; case Sk.astnodes.Break: this.cbreak(a); break; case Sk.astnodes.Continue: this.ccontinue(a); break; case Sk.astnodes.Debugger: h("debugger;"); break; default: Sk.asserts.fail("unhandled case in vstmt: " + JSON.stringify(a)) } } ; a.prototype.vseqstmt = function(a) { var b; for (b = 0; b < a.length; ++b) this.vstmt(a[b]) } ; a.prototype.isCell = function(a) { a = c(d(this.u.private_, a).v); return this.u.ste.getScope(a) === Sk.SYMTAB_CONSTS.CELL } ; a.prototype.nameop = function(a, b, e) { if ((b === Sk.astnodes.Store || b === Sk.astnodes.AugStore || b === Sk.astnodes.Del) && "__debug__" === a.v) throw new Sk.builtin.SyntaxError("can not assign to __debug__",this.filename,this.u.lineno); Sk.asserts.assert("None" !== a.v); if ("NotImplemented" === a.v) return "Sk.builtin.NotImplemented.NotImplemented$"; var f = d(this.u.private_, a).v; f = c(f); var g = 3; var k = this.u.ste.getScope(f); var n = null; switch (k) { case Sk.SYMTAB_CONSTS.FREE: n = "$free"; g = 2; break; case Sk.SYMTAB_CONSTS.CELL: n = "$cell"; g = 2; break; case Sk.SYMTAB_CONSTS.LOCAL: this.u.ste.blockType !== Sk.SYMTAB_CONSTS.FunctionBlock || this.u.ste.generator || (g = 0); break; case Sk.SYMTAB_CONSTS.GLOBAL_IMPLICIT: this.u.ste.blockType === Sk.SYMTAB_CONSTS.FunctionBlock && (g = 1); break; case Sk.SYMTAB_CONSTS.GLOBAL_EXPLICIT: g = 1 } Sk.asserts.assert(k || "_" === a.v.charAt(1)); a = f; this.u.ste.generator || this.u.ste.blockType !== Sk.SYMTAB_CONSTS.FunctionBlock ? f = "$loc." + f : (0 === g || 3 === g) && this.u.localnames.push(f); switch (g) { case 0: switch (b) { case Sk.astnodes.Load: case Sk.astnodes.Param: return h("if (", f, " === undefined) { throw new Sk.builtin.UnboundLocalError('local variable \\'", f, "\\' referenced before assignment'); }\n"), f; case Sk.astnodes.Store: h(f, "=", e, ";"); break; case Sk.astnodes.Del: h("delete ", f, ";"); break; default: Sk.asserts.fail("unhandled") } break; case 3: switch (b) { case Sk.astnodes.Load: return this._gr("loadname", f, "!==undefined?", f, ":Sk.misceval.loadname('", a, "',$gbl);"); case Sk.astnodes.Store: h(f, "=", e, ";"); break; case Sk.astnodes.Del: h("delete ", f, ";"); break; case Sk.astnodes.Param: return f; default: Sk.asserts.fail("unhandled") } break; case 1: switch (b) { case Sk.astnodes.Load: return this._gr("loadgbl", "Sk.misceval.loadname('", a, "',$gbl)"); case Sk.astnodes.Store: h("$gbl.", a, "=", e, ";"); break; case Sk.astnodes.Del: h("delete $gbl.", a); break; default: Sk.asserts.fail("unhandled case in name op_global") } break; case 2: switch (b) { case Sk.astnodes.Load: return n + "." + a; case Sk.astnodes.Store: h(n, ".", a, "=", e, ";"); break; case Sk.astnodes.Param: return a; default: Sk.asserts.fail("unhandled case in name op_deref") } break; default: Sk.asserts.fail("unhandled case") } } ; a.prototype.enterScope = function(a, c, d, e) { var f = new b; f.ste = this.st.getStsForAst(c); f.name = a; f.firstlineno = d; f.canSuspend = e || !1; this.u && this.u.private_ && (f.private_ = this.u.private_); this.stack.push(this.u); this.allUnits.push(f); a = this.gensym("scope"); f.scopename = a; this.u = f; this.u.activateScope(); this.nestlevel++; return a } ; a.prototype.exitScope = function() { var a = this.u; this.nestlevel--; (this.u = 0 <= this.stack.length - 1 ? this.stack.pop() : null) && this.u.activateScope(); if ("" !== a.name.v) { var b = a.name.$r().v; b = b.substring(1, b.length - 1); h(a.scopename, ".co_name=new Sk.builtins['str']('", b, "');") } for (var c in a.consts) a.consts.hasOwnProperty(c) && (a.suffixCode += c + " = " + a.consts[c] + ";") } ; a.prototype.cbody = function(a, b) { var c; for (c = 0; c < a.length; ++c) this.vstmt(a[c], b) } ; a.prototype.cprint = function(a) { var b; Sk.asserts.assert(a instanceof Sk.astnodes.Print); a.dest && this.vexpr(a.dest); var c = a.values.length; for (b = 0; b < c; ++b) h("$ret = Sk.misceval.print_(", "new Sk.builtins['str'](", this.vexpr(a.values[b]), ").v);"), this._checkSuspension(a); a.nl && (h("$ret = Sk.misceval.print_(", '"\\n");'), this._checkSuspension(a)) } ; a.prototype.cmod = function(a) { var b = this.enterScope(new Sk.builtin.str(""), a, 0, this.canSuspend) , c = this.newBlock("module entry"); this.u.prefixCode = "var " + b + "=(function($forcegbl){"; this.u.varDeclsCode = "var $gbl = $forcegbl || {}, $blk=" + c + ",$exc=[],$loc=$gbl,$cell={},$err=undefined;$loc.__file__=new Sk.builtins.str('" + this.filename + "');var $ret=undefined,$postfinally=undefined,$currLineNo=undefined,$currColNo=undefined;"; null !== Sk.execLimit && (this.u.varDeclsCode += "if (typeof Sk.execStart === 'undefined') {Sk.execStart = Date.now()}"); null !== Sk.yieldLimit && this.u.canSuspend && (this.u.varDeclsCode += "if (typeof Sk.lastYield === 'undefined') {Sk.lastYield = Date.now()}"); this.u.varDeclsCode += "if (" + b + ".$wakingSuspension!==undefined) { $wakeFromSuspension(); }if (Sk.retainGlobals) { if (Sk.globals) { $gbl = Sk.globals; Sk.globals = $gbl; $loc = $gbl; } if (Sk.globals) { $gbl = Sk.globals; Sk.globals = $gbl; $loc = $gbl; $loc.__file__=new Sk.builtins.str('" + this.filename + "');} else { Sk.globals = $gbl; }} else { Sk.globals = $gbl; }"; this.u.switchCode = "while(true){try{"; this.u.switchCode += this.outputInterruptTest(); this.u.switchCode += "switch($blk){"; this.u.suffixCode = "}"; this.u.suffixCode += "}catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: $currLineNo, colno: $currColNo, filename: '" + this.filename + "'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} } });"; switch (a.constructor) { case Sk.astnodes.Module: this.cbody(a.body); h("return $loc;"); break; default: Sk.asserts.fail("todo; unhandled case in compilerMod") } this.exitScope(); this.result.push(this.outputAllUnits()); return b } ; Sk.compile = function(b, c, d, e) { d = Sk.__future__; Sk.__future__ = Object.create(Sk.__future__); var f = Sk.parse(c, b) , g = Sk.astFromParse(f.cst, c, f.flags); f = f.flags; var h = Sk.symboltable(g, c); b = new a(c,h,f,e,b); c = b.cmod(g); Sk.__future__ = d; return { funcname: "$compiledmod", code: "$compiledmod = function() {" + b.result.join("") + "\nreturn " + c + ";}();" } } ; Sk.exportSymbol("Sk.compile", Sk.compile); Sk.resetCompiler = function() { Sk.gensymcount = 0 } ; Sk.exportSymbol("Sk.resetCompiler", Sk.resetCompiler); Sk.fixReserved = c; Sk.exportSymbol("Sk.fixReserved", Sk.fixReserved); Sk.unfixReserved = function(a) { return a.replace(/_\$rw\$$/, "") } ; Sk.exportSymbol("Sk.unfixReserved", Sk.unfixReserved); Sk.mangleName = d; Sk.exportSymbol("Sk.mangleName", Sk.mangleName) } , function(m, p) { Sk.sysmodules = new Sk.builtin.dict([]); Sk.realsyspath = void 0; Sk.importSearchPathForName = function(a, b, c) { var d = a.replace(/\./g, "/") , e = function(a, b) { return Sk.misceval.chain(Sk.misceval.tryCatch(function() { return Sk.read(a) }, function(a) {}), function(c) { if (void 0 !== c) return new Sk.misceval.Break({ filename: a, code: c, packagePath: b }) }) }; void 0 === c && (c = Sk.realsyspath); return Sk.misceval.iterFor(c.tp$iter(), function(a) { return Sk.misceval.chain(e(a.v + "/" + d + b, !1), function(c) { return c ? c : e(a.v + "/" + d + "/__init__" + b, a.v + "/" + d) }) }) } ; Sk.doOneTimeInitialization = function(a) { Sk.builtin.type.basesStr_ = new Sk.builtin.str("__bases__"); Sk.builtin.type.mroStr_ = new Sk.builtin.str("__mro__"); for (var b in Sk.builtin) if (a = Sk.builtin[b], a instanceof Sk.builtin.type && void 0 === a.sk$abstract) { for (var c = a.prototype.tp$base, d = []; void 0 !== c; c = c.prototype.tp$base) !c.sk$abstract && Sk.builtins[c.prototype.tp$name] && d.push(c); a.tp$mro = new Sk.builtin.tuple([a].concat(d)); a.hasOwnProperty("tp$base") || (a.tp$base = d[0]); a.$d = new Sk.builtin.dict([]); a.$d.mp$ass_subscript(Sk.builtin.type.basesStr_, a.tp$base ? new Sk.builtin.tuple([a.tp$base]) : new Sk.builtin.tuple([])); a.$d.mp$ass_subscript(Sk.builtin.type.mroStr_, a.tp$mro); a.$d.mp$ass_subscript(new Sk.builtin.str("__name__"), new Sk.builtin.str(a.prototype.tp$name)) } b = [Sk.builtin.object, Sk.builtin.type, Sk.builtin.func, Sk.builtin.method]; for (a = 0; a < b.length; a++) { d = b[a]; c = d.prototype; for (let a = 0; a < d.pythonFunctions.length; a++) { const b = d.pythonFunctions[a]; if (c[b]instanceof Sk.builtin.func) break; c[b].co_kwargs = null; c[b] = new Sk.builtin.func(c[b]) } } for (var e in Sk.internalPy.files) b = e.split(".")[0].split("/")[1], a = Sk.importBuiltinWithBody(b, !1, Sk.internalPy.files[e], !0), a = Sk.misceval.retryOptionalSuspensionOrThrow(a), Sk.asserts.assert(void 0 !== a.$d[b], "Should have imported name " + b), Sk.builtins[b] = a.$d[b], delete Sk.builtins[b].__module__, delete Sk.globals[b] } ; Sk.importSetUpPath = function(a) { var b; if (!Sk.realsyspath) { var c = [new Sk.builtin.str("src/builtin"), new Sk.builtin.str("src/lib"), new Sk.builtin.str(".")]; for (b = 0; b < Sk.syspath.length; ++b) c.push(new Sk.builtin.str(Sk.syspath[b])); Sk.realsyspath = new Sk.builtin.list(c); Sk.doOneTimeInitialization(a) } } ; Sk.importModuleInternal_ = function(a, b, c, d, e, h, g) { var f, k, m, l, p = null, u = void 0 !== e ? e.tp$getattr(Sk.builtin.str.$name) : void 0, z = void 0 !== u ? u.v + "." : "", y = void 0 !== e ? e.tp$getattr(Sk.builtin.str.$path) : void 0; Sk.importSetUpPath(g); if (e && !u) { if (h) return; throw new Sk.builtin.ValueError("Attempted to import relative to invalid package (no name)"); } void 0 === c && (c = z + a); var t = a.split("."); if (1 < t.length) { var H = t.slice(0, t.length - 1).join("."); p = Sk.importModuleInternal_(H, b, void 0, void 0, e, h, g) } var K = Sk.misceval.chain(p, function(n) { p = n; k = Sk.sysmodules.mp$lookup(c); return void 0 !== k ? p || k : Sk.misceval.chain(void 0, function() { var b = a; if (1 < t.length) { if (!p) return; m = Sk.sysmodules.mp$subscript(z + H); b = t[t.length - 1]; y = m.tp$getattr(Sk.builtin.str.$path) } l = new Sk.builtin.module; if ("string" === typeof d) { f = a + ".py"; var c = Sk.compile(d, f, "exec", g) } else c = Sk.misceval.chain(void 0, function() { if (Sk.onBeforeImport && "function" === typeof Sk.onBeforeImport) return Sk.onBeforeImport(a) }, function(c) { if (!1 === c) throw new Sk.builtin.ImportError("Importing " + a + " is not allowed"); if ("string" === typeof c) throw new Sk.builtin.ImportError(c); return Sk.importSearchPathForName(b, ".js", y) }, function(a) { return a ? { funcname: "$builtinmodule", code: a.code, filename: a.filename, packagePath: a.packagePath } : Sk.misceval.chain(Sk.importSearchPathForName(b, ".py", y), function(b) { if (a = b) return Sk.compile(a.code, a.filename, "exec", g) }, function(b) { if (b) return b.packagePath = a.packagePath, b }) }); return c }, function(a) { if (a) { Sk.sysmodules.mp$ass_subscript(c, l); var d = l.$js = a.code; null == f && (f = a.filename); null != Sk.dateSet && Sk.dateSet || (d = "Sk.execStart = Sk.lastYield = new Date();\n" + a.code, Sk.dateSet = !0); if (b) { var e = function(a) { var b, c = Sk.js_beautify(a).split("\n"); for (b = 1; b <= c.length; ++b) { var d = ("" + b).length; for (a = ""; 5 > d; ++d) a += " "; c[b - 1] = "/* " + a + b + " */ " + c[b - 1] } return c.join("\n") }; d = e(d); Sk.debugout(d) } d += "\n" + a.funcname + ";"; d = Sk.global.eval(d); l.$d = { __name__: new Sk.builtin.str(c), __doc__: Sk.builtin.none.none$, __package__: a.packagePath ? new Sk.builtin.str(c) : H ? new Sk.builtin.str(z + H) : u ? u : Sk.builtin.none.none$ }; a.packagePath && (l.$d.__path__ = new Sk.builtin.tuple([new Sk.builtin.str(a.packagePath)])); return d(l.$d) } }, function(b) { var c; if (void 0 === b) { if (h && !p) return; throw new Sk.builtin.ImportError("No module named " + a); } if (b !== l.$d) { for (c in l.$d) b[c] || (b[c] = l.$d[c]); l.$d = b } if (Sk.onAfterImport && "function" === typeof Sk.onAfterImport) try { Sk.onAfterImport(a) } catch (W) {} if (p) return m.tp$setattr(new Sk.builtin.str(t[t.length - 1]), l), p; e && e.tp$setattr(new Sk.builtin.str(a), l); return l }) }); return g ? K : Sk.misceval.retryOptionalSuspensionOrThrow(K) } ; Sk.importModule = function(a, b, c) { return Sk.importModuleInternal_(a, b, void 0, void 0, void 0, !1, c) } ; Sk.importMain = function(a, b, c) { Sk.dateSet = !1; Sk.filesLoaded = !1; Sk.sysmodules = new Sk.builtin.dict([]); Sk.realsyspath = void 0; Sk.resetCompiler(); return Sk.importModuleInternal_(a, b, "__main__", void 0, void 0, !1, c) } ; Sk.importMainWithBody = function(a, b, c, d) { Sk.dateSet = !1; Sk.filesLoaded = !1; Sk.sysmodules = new Sk.builtin.dict([]); Sk.realsyspath = void 0; Sk.resetCompiler(); return Sk.importModuleInternal_(a, b, "__main__", c, void 0, !1, d) } ; Sk.importBuiltinWithBody = function(a, b, c, d) { return Sk.importModuleInternal_(a, b, "__builtin__." + a, c, void 0, !1, d) } ; Sk.builtin.__import__ = function(a, b, c, d, e) { var h = Sk.globals, g; void 0 === e && (e = Sk.__future__.absolute_import ? 0 : -1); if (0 !== e && b.__package__ && b.__package__ !== Sk.builtin.none.none$) { if ((g = b.__package__.v) && 0 < e) { b = g.split("."); if (e - 1 >= b.length) throw new Sk.builtin.ValueError("Attempted relative import beyond toplevel package"); b.length -= e - 1; g = b.join(".") } var f = Sk.sysmodules.mp$lookup(g) } if (0 < e && void 0 === f) throw new Sk.builtin.ValueError("Attempted relative import in non-package"); a.split("."); return Sk.misceval.chain(void 0, function() { if (0 !== e && void 0 !== f) return "" === a ? f : Sk.importModuleInternal_(a, void 0, g + "." + a, void 0, f, -1 == e, !0) }, function(b) { return void 0 === b ? (g = f = void 0, Sk.importModuleInternal_(a, void 0, void 0, void 0, void 0, !1, !0)) : b }, function(b) { if (d && 0 !== d.length) { var c; var e = Sk.sysmodules.mp$subscript((g || "") + (g && a ? "." : "") + a); for (b = 0; b < d.length; b++) { var f = d[b]; "*" != f && void 0 === e.tp$getattr(new Sk.builtin.str(f)) && (c = Sk.misceval.chain(c, Sk.importModuleInternal_.bind(null, f, void 0, void 0, void 0, e, !0, !0))) } return Sk.misceval.chain(c, function() { Sk.asserts.assert(e); return e }) } return b }, function(a) { h !== Sk.globals && (Sk.globals = h); return a }) } ; Sk.importStar = function(a, b, c) { if (c = a.tp$getattr(new Sk.builtin.str("__all__"))) for (let d = Sk.abstr.iter(c), e = d.tp$iternext(); void 0 !== e; e = d.tp$iternext()) b[e.v] = Sk.abstr.gattr(a, e); else { c = Object.getOwnPropertyNames(a.$d); for (let d in c) "_" != c[d].charAt(0) && (b[c[d]] = a.$d[c[d]]) } } ; Sk.exportSymbol("Sk.importMain", Sk.importMain); Sk.exportSymbol("Sk.importMainWithBody", Sk.importMainWithBody); Sk.exportSymbol("Sk.importBuiltinWithBody", Sk.importBuiltinWithBody); Sk.exportSymbol("Sk.builtin.__import__", Sk.builtin.__import__); Sk.exportSymbol("Sk.importStar", Sk.importStar) } , function(m, p) { Sk.builtin.timSort = function(a, b) { this.list = new Sk.builtin.list(a.v); this.MIN_GALLOP = 7; this.listlength = b ? b : a.sq$length() } ; Sk.builtin.timSort.prototype.lt = function(a, b) { return Sk.misceval.richCompareBool(a, b, "Lt") } ; Sk.builtin.timSort.prototype.le = function(a, b) { return !this.lt(b, a) } ; Sk.builtin.timSort.prototype.setitem = function(a, b) { this.list.v[a] = b } ; Sk.builtin.timSort.prototype.binary_sort = function(a, b) { var c; for (c = a.base + b; c < a.base + a.len; c++) { var d = a.base; var e = c; for (b = a.getitem(e); d < e; ) { var h = d + (e - d >> 1); this.lt(b, a.getitem(h)) ? e = h : d = h + 1 } Sk.asserts.assert(d === e); for (h = c; h > d; h--) a.setitem(h, a.getitem(h - 1)); a.setitem(d, b) } } ; Sk.builtin.timSort.prototype.count_run = function(a) { var b; if (1 >= a.len) { var c = a.len; var d = !1 } else if (c = 2, this.lt(a.getitem(a.base + 1), a.getitem(a.base))) for (d = !0, b = a.base + 2; b < a.base + a.len; b++) if (this.lt(a.getitem(b), a.getitem(b - 1))) c++; else break; else for (d = !1, b = a.base + 2; b < a.base + a.len && !this.lt(a.getitem(b), a.getitem(b - 1)); b++) c++; return { run: new Sk.builtin.listSlice(a.list,a.base,c), descending: d } } ; Sk.builtin.timSort.prototype.sort = function() { var a, b = new Sk.builtin.listSlice(this.list,0,this.listlength); if (!(2 > b.len)) { this.merge_init(); for (a = this.merge_compute_minrun(b.len); 0 < b.len; ) { var c = this.count_run(b); c.descending && c.run.reverse(); if (c.run.len < a) { var d = c.run.len; c.run.len = a < b.len ? a : b.len; this.binary_sort(c.run, d) } b.advance(c.run.len); this.pending.push(c.run); this.merge_collapse() } Sk.asserts.assert(b.base == this.listlength); this.merge_force_collapse(); Sk.asserts.assert(1 == this.pending.length); Sk.asserts.assert(0 === this.pending[0].base); Sk.asserts.assert(this.pending[0].len == this.listlength) } } ; Sk.builtin.timSort.prototype.gallop = function(a, b, c, d) { var e; Sk.asserts.assert(0 <= c && c < b.len); var h = this; d = d ? function(a, b) { return h.le(a, b) } : function(a, b) { return h.lt(a, b) } ; var g = b.base + c; var f = 0; var k = 1; if (d(b.getitem(g), a)) { for (e = b.len - c; k < e; ) if (d(b.getitem(g + k), a)) { f = k; try { k = (k << 1) + 1 } catch (n) { k = e } } else break; k > e && (k = e); f += c; k += c } else { for (e = c + 1; k < e && !d(b.getitem(g - k), a); ) { f = k; try { k = (k << 1) + 1 } catch (n) { k = e } } k > e && (k = e); g = c - f; f = c - k; k = g } Sk.asserts.assert(-1 <= f < k <= b.len); for (f += 1; f < k; ) c = f + (k - f >> 1), d(b.getitem(b.base + c), a) ? f = c + 1 : k = c; Sk.asserts.assert(f == k); return k } ; Sk.builtin.timSort.prototype.merge_init = function() { this.min_gallop = this.MIN_GALLOP; this.pending = [] } ; Sk.builtin.timSort.prototype.merge_lo = function(a, b) { var c, d, e; Sk.asserts.assert(0 < a.len && 0 < b.len && a.base + a.len == b.base); var h = this.min_gallop; var g = a.base; a = a.copyitems(); try { if (this.setitem(g, b.popleft()), g++, 1 != a.len && 0 !== b.len) for (; ; ) { for (d = c = 0; ; ) if (this.lt(b.getitem(b.base), a.getitem(a.base))) { this.setitem(g, b.popleft()); g++; if (0 === b.len) return; d++; c = 0; if (d >= h) break } else { this.setitem(g, a.popleft()); g++; if (1 == a.len) return; c++; d = 0; if (c >= h) break } for (h += 1; ; ) { this.min_gallop = h -= 1 < h; c = this.gallop(b.getitem(b.base), a, 0, !0); for (e = a.base; e < a.base + c; e++) this.setitem(g, a.getitem(e)), g++; a.advance(c); if (1 >= a.len) return; this.setitem(g, b.popleft()); g++; if (0 === b.len) return; d = this.gallop(a.getitem(a.base), b, 0, !1); for (e = b.base; e < b.base + d; e++) this.setitem(g, b.getitem(e)), g++; b.advance(d); if (0 === b.len) return; this.setitem(g, a.popleft()); g++; if (1 == a.len) return; if (c < this.MIN_GALLOP && d < this.MIN_GALLOP) break; h++; this.min_gallop = h } } } finally { Sk.asserts.assert(0 <= a.len && 0 <= b.len); for (e = b.base; e < b.base + b.len; e++) this.setitem(g, b.getitem(e)), g++; for (e = a.base; e < a.base + a.len; e++) this.setitem(g, a.getitem(e)), g++ } } ; Sk.builtin.timSort.prototype.merge_hi = function(a, b) { var c, d, e; Sk.asserts.assert(0 < a.len && 0 < b.len && a.base + a.len == b.base); var h = this.min_gallop; var g = b.base + b.len; b = b.copyitems(); try { if (g--, this.setitem(g, a.popright()), 0 !== a.len && 1 != b.len) for (; ; ) { for (d = c = 0; ; ) { var f = a.getitem(a.base + a.len - 1); var k = b.getitem(b.base + b.len - 1); if (this.lt(k, f)) { g--; this.setitem(g, f); a.len--; if (0 === a.len) return; c++; d = 0; if (c >= h) break } else { g--; this.setitem(g, k); b.len--; if (1 == b.len) return; d++; c = 0; if (d >= h) break } } for (h += 1; ; ) { this.min_gallop = h -= 1 < h; k = b.getitem(b.base + b.len - 1); var m = this.gallop(k, a, a.len - 1, !0); c = a.len - m; for (e = a.base + a.len - 1; e > a.base + m - 1; e--) g--, this.setitem(g, a.getitem(e)); a.len -= c; if (0 === a.len) return; g--; this.setitem(g, b.popright()); if (1 == b.len) return; f = a.getitem(a.base + a.len - 1); m = this.gallop(f, b, b.len - 1, !1); d = b.len - m; for (e = b.base + b.len - 1; e > b.base + m - 1; e--) g--, this.setitem(g, b.getitem(e)); b.len -= d; if (1 >= b.len) return; g--; this.setitem(g, a.popright()); if (0 === a.len) return; if (c < this.MIN_GALLOP && d < this.MIN_GALLOP) break; h++; this.min_gallop = h } } } finally { Sk.asserts.assert(0 <= a.len && 0 <= b.len); for (e = a.base + a.len - 1; e > a.base - 1; e--) g--, this.setitem(g, a.getitem(e)); for (e = b.base + b.len - 1; e > b.base - 1; e--) g--, this.setitem(g, b.getitem(e)) } } ; Sk.builtin.timSort.prototype.merge_at = function(a) { 0 > a && (a = this.pending.length + a); var b = this.pending[a]; var c = this.pending[a + 1]; Sk.asserts.assert(0 < b.len && 0 < c.len); Sk.asserts.assert(b.base + b.len == c.base); this.pending[a] = new Sk.builtin.listSlice(this.list,b.base,b.len + c.len); this.pending.splice(a + 1, 1); a = this.gallop(c.getitem(c.base), b, 0, !0); b.advance(a); 0 !== b.len && (c.len = this.gallop(b.getitem(b.base + b.len - 1), c, c.len - 1, !1), 0 !== c.len && (b.len <= c.len ? this.merge_lo(b, c) : this.merge_hi(b, c))) } ; Sk.builtin.timSort.prototype.merge_collapse = function() { for (var a = this.pending; 1 < a.length; ) if (3 <= a.length && a[a.length - 3].len <= a[a.length - 2].len + a[a.length - 1].len) a[a.length - 3].len < a[a.length - 1].len ? this.merge_at(-3) : this.merge_at(-2); else if (a[a.length - 2].len <= a[a.length - 1].len) this.merge_at(-2); else break } ; Sk.builtin.timSort.prototype.merge_force_collapse = function() { for (var a = this.pending; 1 < a.length; ) 3 <= a.length && a[a.length - 3].len < a[a.length - 1].len ? this.merge_at(-3) : this.merge_at(-2) } ; Sk.builtin.timSort.prototype.merge_compute_minrun = function(a) { for (var b = 0; 64 <= a; ) b |= a & 1, a >>= 1; return a + b } ; Sk.builtin.listSlice = function(a, b, c) { this.list = a; this.base = b; this.len = c } ; Sk.builtin.listSlice.prototype.copyitems = function() { var a = this.base , b = this.base + this.len; Sk.asserts.assert(0 <= a <= b); return new Sk.builtin.listSlice(new Sk.builtin.list(this.list.v.slice(a, b)),0,this.len) } ; Sk.builtin.listSlice.prototype.advance = function(a) { this.base += a; this.len -= a; Sk.asserts.assert(this.base <= this.list.sq$length()) } ; Sk.builtin.listSlice.prototype.getitem = function(a) { return this.list.v[a] } ; Sk.builtin.listSlice.prototype.setitem = function(a, b) { this.list.v[a] = b } ; Sk.builtin.listSlice.prototype.popleft = function() { var a = this.list.v[this.base]; this.base++; this.len--; return a } ; Sk.builtin.listSlice.prototype.popright = function() { this.len--; return this.list.v[this.base + this.len] } ; Sk.builtin.listSlice.prototype.reverse = function() { for (var a, b, c = this.list, d = this.base, e = d + this.len - 1; d < e; ) a = c.v[e], b = c.v[d], c.v[d] = a, c.v[e] = b, d++, e-- } ; Sk.exportSymbol("Sk.builtin.listSlice", Sk.builtin.listSlice); Sk.exportSymbol("Sk.builtin.timSort", Sk.builtin.timSort) } , function(m, p) { Sk.builtin.sorted = function(a, b, c, d) { if (void 0 === d) d = !1; else { if (d instanceof Sk.builtin.float_) throw new Sk.builtin.TypeError("an integer is required, got float"); if (d instanceof Sk.builtin.int_ || d.prototype instanceof Sk.builtin.int_) d = Sk.misceval.isTrue(d); else throw new Sk.builtin.TypeError("an integer is required"); } if (void 0 !== c && c !== Sk.builtin.none.none$) { var e = b === Sk.builtin.none.none$ || void 0 === b ? function(a, b) { return Sk.misceval.richCompareBool(a[0], b[0], "Lt") ? new Sk.builtin.int_(-1) : new Sk.builtin.int_(0) } : function(a, c) { return Sk.misceval.callsimArray(b, [a[0], c[0]]) } ; var h = a.tp$iter(); var g = h.tp$iternext(); for (a = []; void 0 !== g; ) a.push([Sk.misceval.callsimArray(c, [g]), g]), g = h.tp$iternext(); a = new Sk.builtin.list(a) } else b !== Sk.builtin.none.none$ && void 0 !== b && (e = b), a = new Sk.builtin.list(a); void 0 !== e ? a.list_sort_(a, e) : a.list_sort_(a); d && a.list_reverse_(a); if (void 0 !== c && c !== Sk.builtin.none.none$) { h = a.tp$iter(); g = h.tp$iternext(); for (a = []; void 0 !== g; ) a.push(g[1]), g = h.tp$iternext(); a = new Sk.builtin.list(a) } return a } } , function(m, p) { Sk.builtin.type_is_subtype_base_chain = function(a, b) { do { if (a == b) return !0; a = a.tp$base } while (void 0 !== a); return b == Sk.builtin.object } ; Sk.builtin.PyType_IsSubtype = function(a, b) { var c = a.tp$mro; if (c) { Sk.asserts.assert(c instanceof Sk.builtin.tuple); for (a = 0; a < c.v.length; a++) if (c.v[a] == b) return !0; return !1 } return Sk.builtin.type_is_subtype_base_chain(a, b) } ; Sk.builtin.super_ = function(a, b) { Sk.builtin.pyCheckArgsLen("super", arguments.length, 1); if (!(this instanceof Sk.builtin.super_)) return new Sk.builtin.super_(a,b); Sk.misceval.callsimArray(Sk.builtin.super_.__init__, [this, a, b]); return this } ; Sk.builtin.super_.__init__ = new Sk.builtin.func(function(a, b, c) { a.obj = c; a.type = b; if (!b.tp$mro) throw new Sk.builtin.TypeError("must be type, not " + Sk.abstr.typeName(b)); a.obj_type = b.tp$mro.v[1]; if (!c) throw new Sk.builtin.NotImplementedError("unbound super not supported because skulpts implementation of type descriptors aren't brilliant yet, see this question for more information https://stackoverflow.com/a/30190341/117242"); if (!Sk.builtin.PyType_IsSubtype(a.obj.ob$type, a.type)) throw new Sk.builtin.TypeError("super(type, obj): obj must be an instance of subtype of type"); return Sk.builtin.none.none$ } ); Sk.abstr.setUpInheritance("super", Sk.builtin.super_, Sk.builtin.object); Sk.builtin.super_.prototype.tp$getattr = function(a, b) { var c, d, e = a.$jsstr(); var h = this.obj_type; Sk.asserts.assert(void 0 !== h, "object has no ob$type!"); if (d = this.obj.$d || this.obj.constructor.$d) if (d.mp$lookup ? c = d.mp$lookup(a) : d.mp$subscript ? c = Sk.builtin._tryGetSubscript(d, a) : "object" === typeof d && (c = d[e]), void 0 !== c) return c; c = Sk.builtin.type.typeLookup(h, a); if (void 0 !== c && null !== c && (a = c.tp$descr_get)) return a.call(c, this.obj, this.obj_type, b); if (void 0 !== c) return c } ; Sk.builtin.super_.prototype.$r = function(a) { return this.obj ? new Sk.builtin.str(", <" + Sk.abstr.typeName(this.obj) + " object>>") : new Sk.builtin.str(", NULL>") } ; Sk.builtin.super_.__doc__ = new Sk.builtin.str("super(type, obj) -> bound super object; requires isinstance(obj, type)\nsuper(type) -> unbound super object\nsuper(type, type2) -> bound super object; requires issubclass(type2, type)\nTypical use to call a cooperative superclass method:\nclass C(B):\n def meth(self, arg):\n super(C, self).meth(arg)") } , function(m, p) { Sk.builtins = { range: new Sk.builtin.func(Sk.builtin.range), round: new Sk.builtin.func(Sk.builtin.round), len: new Sk.builtin.func(Sk.builtin.len), min: new Sk.builtin.func(Sk.builtin.min), max: new Sk.builtin.func(Sk.builtin.max), sum: new Sk.builtin.func(Sk.builtin.sum), abs: new Sk.builtin.func(Sk.builtin.abs), fabs: new Sk.builtin.func(Sk.builtin.fabs), ord: new Sk.builtin.func(Sk.builtin.ord), chr: new Sk.builtin.func(Sk.builtin.chr), hex: new Sk.builtin.func(Sk.builtin.hex), oct: new Sk.builtin.func(Sk.builtin.oct), bin: new Sk.builtin.func(Sk.builtin.bin), dir: new Sk.builtin.func(Sk.builtin.dir), repr: new Sk.builtin.func(Sk.builtin.repr), open: new Sk.builtin.func(Sk.builtin.open), isinstance: new Sk.builtin.func(Sk.builtin.isinstance), hash: new Sk.builtin.func(Sk.builtin.hash), getattr: new Sk.builtin.func(Sk.builtin.getattr), hasattr: new Sk.builtin.func(Sk.builtin.hasattr), id: new Sk.builtin.func(Sk.builtin.id), reduce: new Sk.builtin.func(Sk.builtin.reduce), sorted: new Sk.builtin.func(Sk.builtin.sorted), any: new Sk.builtin.func(Sk.builtin.any), all: new Sk.builtin.func(Sk.builtin.all), BaseException: Sk.builtin.BaseException, AttributeError: Sk.builtin.AttributeError, ValueError: Sk.builtin.ValueError, Exception: Sk.builtin.Exception, ZeroDivisionError: Sk.builtin.ZeroDivisionError, AssertionError: Sk.builtin.AssertionError, ImportError: Sk.builtin.ImportError, IndentationError: Sk.builtin.IndentationError, IndexError: Sk.builtin.IndexError, KeyError: Sk.builtin.KeyError, TypeError: Sk.builtin.TypeError, LookupError: Sk.builtin.LookupError, UnicodeDecodeError: Sk.builtin.UnicodeDecodeError, UnicodeEncodeError: Sk.builtin.UnicodeEncodeError, NameError: Sk.builtin.NameError, IOError: Sk.builtin.IOError, NotImplementedError: Sk.builtin.NotImplementedError, StandardError: Sk.builtin.StandardError, SystemExit: Sk.builtin.SystemExit, OverflowError: Sk.builtin.OverflowError, OperationError: Sk.builtin.OperationError, NegativePowerError: Sk.builtin.NegativePowerError, RuntimeError: Sk.builtin.RuntimeError, StopIteration: Sk.builtin.StopIteration, SyntaxError: Sk.builtin.SyntaxError, float_$rw$: Sk.builtin.float_, int_$rw$: Sk.builtin.int_, bool: Sk.builtin.bool, complex: Sk.builtin.complex, enumerate: Sk.builtin.enumerate, dict: Sk.builtin.dict, file: Sk.builtin.file, "function": Sk.builtin.func, generator: Sk.builtin.generator, list: Sk.builtin.list, long_$rw$: Sk.builtin.lng, method: Sk.builtin.method, object: Sk.builtin.object, slice: Sk.builtin.slice, str: Sk.builtin.str, set: Sk.builtin.set, tuple: Sk.builtin.tuple, type: Sk.builtin.type, input: new Sk.builtin.func(Sk.builtin.input), raw_input: new Sk.builtin.func(Sk.builtin.raw_input), setattr: new Sk.builtin.func(Sk.builtin.setattr), jseval: Sk.builtin.jseval, jsmillis: Sk.builtin.jsmillis, quit: new Sk.builtin.func(Sk.builtin.quit), exit: new Sk.builtin.func(Sk.builtin.quit), print: Sk.builtin.print, divmod: new Sk.builtin.func(Sk.builtin.divmod), format: new Sk.builtin.func(Sk.builtin.format), globals: new Sk.builtin.func(Sk.builtin.globals), issubclass: new Sk.builtin.func(Sk.builtin.issubclass), iter: Sk.builtin.iter, bytearray: Sk.builtin.bytearray, callable: Sk.builtin.callable, delattr: Sk.builtin.delattr, eval_$rw$: Sk.builtin.eval_, execfile: Sk.builtin.execfile, frozenset: Sk.builtin.frozenset, help: Sk.builtin.help, locals: Sk.builtin.locals, memoryview: Sk.builtin.memoryview, next: Sk.builtin.next_, pow: Sk.builtin.pow, reload: Sk.builtin.reload, reversed: Sk.builtin.reversed, "super": Sk.builtin.super_, unichr: Sk.builtin.unichr, vars: Sk.builtin.vars, xrange: Sk.builtin.xrange, apply_$rw$: Sk.builtin.apply_, buffer: Sk.builtin.buffer, coerce: Sk.builtin.coerce, intern: Sk.builtin.intern }; Sk.setupObjects = function(a) { a ? (Sk.builtins.filter = Sk.builtin.filter_, Sk.builtins.map = Sk.builtin.map_, Sk.builtins.zip = Sk.builtin.zip_, Sk.builtins.bytes = Sk.builtin.bytes, Sk.builtins.range = new Sk.builtin.func(Sk.builtin.xrange), delete Sk.builtins.xrange, delete Sk.builtins.StandardError, delete Sk.builtins.unicode, delete Sk.builtins.basestring, delete Sk.builtin.str.prototype.decode, Sk.builtins.bytes = Sk.builtin.bytes, Sk.builtins.ascii = new Sk.builtin.func(Sk.builtin.ascii)) : (Sk.builtins.filter = new Sk.builtin.func(Sk.builtin.filter), Sk.builtins.map = new Sk.builtin.func(Sk.builtin.map), Sk.builtins.zip = new Sk.builtin.func(Sk.builtin.zip), Sk.builtins.range = new Sk.builtin.func(Sk.builtin.range), Sk.builtins.xrange = new Sk.builtin.func(Sk.builtin.xrange), Sk.builtins.StandardError = Sk.builtin.Exception, Sk.builtins.unicode = Sk.builtin.str, Sk.builtins.basestring = Sk.builtin.str, Sk.builtin.str.prototype.decode = Sk.builtin.str.$py2decode, delete Sk.builtins.bytes, delete Sk.builtins.ascii) } ; Sk.exportSymbol("Sk.setupObjects", Sk.setupObjects); Sk.exportSymbol("Sk.builtins", Sk.builtins) } , function(m, p) { Sk.builtin.str.$emptystr = new Sk.builtin.str(""); Sk.builtin.int_.co_varnames = ["number", "base"]; Sk.builtin.int_.$defaults = [0, Sk.builtin.none.none$]; Sk.builtin.lng.co_varnames = ["number", "base"]; Sk.builtin.lng.$defaults = [0, Sk.builtin.none.none$]; Sk.builtin.sorted.co_varnames = ["list", "cmp", "key", "reverse"]; Sk.builtin.sorted.$defaults = [Sk.builtin.none.none$, Sk.builtin.none.none$, Sk.builtin.bool.false$]; Sk.builtin.dict.$fromkeys.co_name = new Sk.builtin.str("fromkeys"); Sk.builtin.dict.prototype.fromkeys = new Sk.builtin.func(Sk.builtin.dict.$fromkeys); Sk.builtin.str.$empty = new Sk.builtin.str(""); Sk.builtin.str.$utf8 = new Sk.builtin.str("utf-8"); Sk.builtin.str.$ascii = new Sk.builtin.str("ascii"); Sk.builtin.str.$default_factory = new Sk.builtin.str("default_factory"); Sk.builtin.str.$imag = new Sk.builtin.str("imag"); Sk.builtin.str.$real = new Sk.builtin.str("real"); Sk.builtin.str.$abs = new Sk.builtin.str("__abs__"); Sk.builtin.str.$bytes = new Sk.builtin.str("__bytes__"); Sk.builtin.str.$call = new Sk.builtin.str("__call__"); Sk.builtin.str.$cmp = new Sk.builtin.str("__cmp__"); Sk.builtin.str.$complex = new Sk.builtin.str("__complex__"); Sk.builtin.str.$contains = new Sk.builtin.str("__contains__"); Sk.builtin.str.$copy = new Sk.builtin.str("__copy__"); Sk.builtin.str.$dict = new Sk.builtin.str("__dict__"); Sk.builtin.str.$dir = new Sk.builtin.str("__dir__"); Sk.builtin.str.$enter = new Sk.builtin.str("__enter__"); Sk.builtin.str.$eq = new Sk.builtin.str("__eq__"); Sk.builtin.str.$exit = new Sk.builtin.str("__exit__"); Sk.builtin.str.$index = new Sk.builtin.str("__index__"); Sk.builtin.str.$init = new Sk.builtin.str("__init__"); Sk.builtin.str.$int_ = new Sk.builtin.str("__int__"); Sk.builtin.str.$iter = new Sk.builtin.str("__iter__"); Sk.builtin.str.$float_ = new Sk.builtin.str("__float__"); Sk.builtin.str.$format = new Sk.builtin.str("__format__"); Sk.builtin.str.$ge = new Sk.builtin.str("__ge__"); Sk.builtin.str.$getattr = new Sk.builtin.str("__getattr__"); Sk.builtin.str.$getattribute = new Sk.builtin.str("__getattribute__"); Sk.builtin.str.$getitem = new Sk.builtin.str("__getitem__"); Sk.builtin.str.$gt = new Sk.builtin.str("__gt__"); Sk.builtin.str.$le = new Sk.builtin.str("__le__"); Sk.builtin.str.$len = new Sk.builtin.str("__len__"); Sk.builtin.str.$lt = new Sk.builtin.str("__lt__"); Sk.builtin.str.$module = new Sk.builtin.str("__module__"); Sk.builtin.str.$name = new Sk.builtin.str("__name__"); Sk.builtin.str.$ne = new Sk.builtin.str("__ne__"); Sk.builtin.str.$new = new Sk.builtin.str("__new__"); Sk.builtin.str.$next = new Sk.builtin.str("__next__"); Sk.builtin.str.$path = new Sk.builtin.str("__path__"); Sk.builtin.str.$repr = new Sk.builtin.str("__repr__"); Sk.builtin.str.$reversed = new Sk.builtin.str("__reversed__"); Sk.builtin.str.$round = new Sk.builtin.str("__round__"); Sk.builtin.str.$setattr = new Sk.builtin.str("__setattr__"); Sk.builtin.str.$setitem = new Sk.builtin.str("__setitem__"); Sk.builtin.str.$str = new Sk.builtin.str("__str__"); Sk.builtin.str.$trunc = new Sk.builtin.str("__trunc__"); Sk.builtin.str.$write = new Sk.builtin.str("write"); Sk.misceval.op2method_ = { Eq: Sk.builtin.str.$eq, NotEq: Sk.builtin.str.$ne, Gt: Sk.builtin.str.$gt, GtE: Sk.builtin.str.$ge, Lt: Sk.builtin.str.$lt, LtE: Sk.builtin.str.$le }; m = "int_ lng sorted range round len min max sum zip abs fabs ord chr hex oct bin dir repr open isinstance hash getattr hasattr id map filter reduce sorted any all input raw_input setattr quit quit divmod format globals issubclass".split(" "); for (p = 0; p < m.length; p++) Sk.builtin[m[p]].co_name = new Sk.builtin.str(m[p]) } , function(m, p) { Sk.internalPy = { files: { "src/classmethod.py": 'class classmethod(object):\n "Emulate PyClassMethod_Type() in Objects/funcobject.c"\n\n def __init__(self, f):\n self.f = f\n\n def __get__(self, obj, klass=None):\n if klass is None:\n klass = type(obj)\n def newfunc(*args):\n return self.f(klass, *args)\n return newfunc\n', "src/property.py": 'class property(object):\n "Emulate PyProperty_Type() in Objects/descrobject.c"\n\n def __init__(self, fget=None, fset=None, fdel=None, doc=None):\n self.fget = fget\n self.fset = fset\n self.fdel = fdel\n if doc is None and fget is not None:\n if hasattr(fget, \'__doc__\'):\n doc = fget.__doc__\n else:\n doc = None\n self.__doc__ = doc\n\n def __get__(self, obj, objtype=None):\n if obj is None:\n return self\n if self.fget is None:\n raise AttributeError("unreadable attribute")\n return self.fget(obj)\n\n def __set__(self, obj, value):\n if self.fset is None:\n raise AttributeError("can\'t set attribute")\n self.fset(obj, value)\n\n def __delete__(self, obj):\n if self.fdel is None:\n raise AttributeError("can\'t delete attribute")\n self.fdel(obj)\n\n def getter(self, fget):\n return type(self)(fget, self.fset, self.fdel, self.__doc__)\n\n def setter(self, fset):\n return type(self)(self.fget, fset, self.fdel, self.__doc__)\n\n def deleter(self, fdel):\n return type(self)(self.fget, self.fset, fdel, self.__doc__)\n', "src/staticmethod.py": 'class staticmethod(object):\n "Emulate PyStaticMethod_Type() in Objects/funcobject.c"\n\n def __init__(self, f):\n self.f = f\n\n def __get__(self, obj, objtype=None):\n return self.f\n' } } } ]); } ).call(this || window) //# sourceMappingURL=skulpt.min.js.map