UNPKG

sku-pg

Version:

Skulpt is a Javascript implementation of Python 2.x. Python that runs in your browser!

2 lines 476 kB
pgSk.builtinFiles={"files": {"src/lib/py_compile.py": "raise NotImplementedError(\"py_compile is not yet implemented in pgSkulpt\")\n", "src/lib/symbol.py": "raise NotImplementedError(\"symbol is not yet implemented in pgSkulpt\")\n", "src/lib/traceback.py": "raise NotImplementedError(\"traceback is not yet implemented in pgSkulpt\")\n", "src/lib/runpy.py": "raise NotImplementedError(\"runpy is not yet implemented in pgSkulpt\")\n", "src/lib/rlcompleter.py": "raise NotImplementedError(\"rlcompleter is not yet implemented in pgSkulpt\")\n", "src/lib/Bastion.py": "raise NotImplementedError(\"Bastion is not yet implemented in pgSkulpt\")\n", "src/lib/this.py": "raise NotImplementedError(\"this is not yet implemented in pgSkulpt\")\n", "src/lib/platform.py": "raise NotImplementedError(\"platform is not yet implemented in pgSkulpt\")\n", "src/lib/logging/__init__.py": "raise NotImplementedError(\"logging is not yet implemented in pgSkulpt\")\n", "src/lib/socket.py": "raise NotImplementedError(\"socket is not yet implemented in pgSkulpt\")\n", "src/lib/fileinput.py": "raise NotImplementedError(\"fileinput is not yet implemented in pgSkulpt\")\n", "src/lib/shutil.py": "raise NotImplementedError(\"shutil is not yet implemented in pgSkulpt\")\n", "src/lib/uuid.py": "raise NotImplementedError(\"uuid is not yet implemented in pgSkulpt\")\n", "src/lib/threading.py": "raise NotImplementedError(\"threading is not yet implemented in pgSkulpt\")\n", "src/lib/functools.py": "raise NotImplementedError(\"functools is not yet implemented in pgSkulpt\")\n", "src/lib/xml/etree/__init__.py": "raise NotImplementedError(\"etree is not yet implemented in pgSkulpt\")\n", "src/lib/_LWPCookieJar.py": "raise NotImplementedError(\"_LWPCookieJar is not yet implemented in pgSkulpt\")\n", "src/lib/nturl2path.py": "raise NotImplementedError(\"nturl2path is not yet implemented in pgSkulpt\")\n", "src/lib/pdb.py": "raise NotImplementedError(\"pdb is not yet implemented in pgSkulpt\")\n", "src/lib/cookielib.py": "raise NotImplementedError(\"cookielib is not yet implemented in pgSkulpt\")\n", "src/lib/pyclbr.py": "raise NotImplementedError(\"pyclbr is not yet implemented in pgSkulpt\")\n", "src/lib/test/__init__.py": "__author__ = 'bmiller'\n\ndef testEqual(actual, expected):\n    if type(expected) == type(1):\n        if actual == expected:\n            print('Pass')\n            return True\n    elif type(expected) == type(1.11):\n        if abs(actual-expected) < 0.00001:\n            print('Pass')\n            return True\n    else:\n        if actual == expected:\n            print('Pass')\n            return True\n    print('Test Failed: expected ' + str(expected) + ' but got ' + str(actual))\n    return False\n\ndef testNotEqual(actual, expected):\n    pass\n\n", "src/lib/doctest.py": "raise NotImplementedError(\"doctest is not yet implemented in pgSkulpt\")\n", "src/lib/repr.py": "raise NotImplementedError(\"repr is not yet implemented in pgSkulpt\")\n", "src/lib/test/decimaltestdata/__init__.py": "raise NotImplementedError(\"decimaltestdata is not yet implemented in pgSkulpt\")\n", "src/lib/sha.py": "raise NotImplementedError(\"sha is not yet implemented in pgSkulpt\")\n", "src/lib/lib-dynload/__init__.py": "raise NotImplementedError(\"lib-dynload is not yet implemented in pgSkulpt\")\n", "src/lib/asynchat.py": "raise NotImplementedError(\"asynchat is not yet implemented in pgSkulpt\")\n", "src/lib/decimal.py": "raise NotImplementedError(\"decimal is not yet implemented in pgSkulpt\")\n", "src/lib/xml/dom/__init__.py": "raise NotImplementedError(\"dom is not yet implemented in pgSkulpt\")\n", "src/lib/gettext.py": "raise NotImplementedError(\"gettext is not yet implemented in pgSkulpt\")\n", "src/lib/UserString.py": "raise NotImplementedError(\"UserString is not yet implemented in pgSkulpt\")\n", "src/lib/pythonds/basic/queue.py": "# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n#queue.py\n\nclass Queue:\n    def __init__(self):\n        self.items = []\n\n    def isEmpty(self):\n        return self.items == []\n\n    def enqueue(self, item):\n        self.items.insert(0,item)\n\n    def dequeue(self):\n        return self.items.pop()\n\n    def size(self):\n        return len(self.items)\n", "src/lib/pkgutil.py": "raise NotImplementedError(\"pkgutil is not yet implemented in pgSkulpt\")\n", "src/lib/gzip.py": "raise NotImplementedError(\"gzip is not yet implemented in pgSkulpt\")\n", "src/lib/numbers.py": "raise NotImplementedError(\"numbers is not yet implemented in pgSkulpt\")\n", "src/lib/asyncore.py": "raise NotImplementedError(\"asyncore is not yet implemented in pgSkulpt\")\n", "src/lib/macpath.py": "raise NotImplementedError(\"macpath is not yet implemented in pgSkulpt\")\n", "src/lib/textwrap.py": "raise NotImplementedError(\"textwrap is not yet implemented in pgSkulpt\")\n", "src/lib/imputil.py": "raise NotImplementedError(\"imputil is not yet implemented in pgSkulpt\")\n", "src/lib/bdb.py": "raise NotImplementedError(\"bdb is not yet implemented in pgSkulpt\")\n", "src/lib/multiprocessing/__init__.py": "raise NotImplementedError(\"multiprocessing is not yet implemented in pgSkulpt\")\n", "src/lib/imghdr.py": "raise NotImplementedError(\"imghdr is not yet implemented in pgSkulpt\")\n", "src/lib/colorsys.py": "raise NotImplementedError(\"colorsys is not yet implemented in pgSkulpt\")\n", "src/lib/SimpleXMLRPCServer.py": "raise NotImplementedError(\"SimpleXMLRPCServer is not yet implemented in pgSkulpt\")\n", "src/lib/robotparser.py": "raise NotImplementedError(\"robotparser is not yet implemented in pgSkulpt\")\n", "src/lib/ast.py": "raise NotImplementedError(\"ast is not yet implemented in pgSkulpt\")\n", "src/lib/fractions.py": "raise NotImplementedError(\"fractions is not yet implemented in pgSkulpt\")\n", "src/lib/posixpath.py": "raise NotImplementedError(\"posixpath is not yet implemented in pgSkulpt\")\n", "src/lib/optparse.py": "raise NotImplementedError(\"optparse is not yet implemented in pgSkulpt\")\n", "src/lib/shlex.py": "raise NotImplementedError(\"shlex is not yet implemented in pgSkulpt\")\n", "src/lib/sre_compile.py": "raise NotImplementedError(\"sre_compile is not yet implemented in pgSkulpt\")\n", "src/lib/popen2.py": "raise NotImplementedError(\"popen2 is not yet implemented in pgSkulpt\")\n", "src/lib/contextlib.py": "raise NotImplementedError(\"contextlib is not yet implemented in pgSkulpt\")\n", "src/lib/hmac.py": "raise NotImplementedError(\"hmac is not yet implemented in pgSkulpt\")\n", "src/lib/poplib.py": "raise NotImplementedError(\"poplib is not yet implemented in pgSkulpt\")\n", "src/lib/unittest/gui.py": "import document\nfrom unittest import TestCase\n\nclass TestCaseGui(TestCase):\n     def __init__(self):\n          TestCase.__init__(self)\n          self.divid = document.currentDiv()\n          self.mydiv = document.getElementById(self.divid)\n          res = document.getElementById(self.divid+'_unit_results')\n          if res:\n              self.resdiv = res\n              res.innerHTML = ''\n          else:\n              self.resdiv = document.createElement('div')\n              self.resdiv.setAttribute('id',self.divid+'_unit_results')\n              self.resdiv.setAttribute('class','unittest-results')\n              self.mydiv.appendChild(self.resdiv)\n\n\n     def main(self):\n         t = document.createElement('table')\n         self.resTable = t\n         self.resdiv.appendChild(self.resTable)\n\n         headers = ['Result','Actual Value','Expected Value','Notes']\n         row = document.createElement('tr')\n         for item in headers:\n             head = document.createElement('th')\n             head.setAttribute('class','ac-feedback')\n             head.innerHTML = item\n             head.setCSS('text-align','center')\n             row.appendChild(head)\n         self.resTable.appendChild(row)\n\n         for func in self.tlist:\n             try:\n                 self.setUp()\n                 func()\n                 self.tearDown()\n             except Exception as e:\n                 self.appendResult('Error', None, None, e)\n                 self.numFailed += 1\n                 self.showSummary()\n\n     def appendResult(self,res,actual,expected,param):\n         trimActual = False\n         if len(str(actual)) > 15:\n             trimActual = True\n             actualType = type(actual)\n         trimExpected = False\n         if len(str(expected)) > 15:\n             trimExpected = True\n             expectedType = type(expected)\n         row = document.createElement('tr')\n         err = False\n         if res == 'Error':\n             err = True\n             msg = 'Error: %s' % param\n             errorData = document.createElement('td')\n             errorData.setAttribute('class','ac-feedback')\n             errorData.innerHTML = 'ERROR'\n             errorData.setCSS('background-color','#de8e96')\n             errorData.setCSS('text-align','center')\n             row.appendChild(errorData)\n         elif res:\n             passed = document.createElement('td')\n             passed.setAttribute('class','ac-feedback')\n             passed.innerHTML = 'Pass'\n             passed.setCSS('background-color','#83d382')\n             passed.setCSS('text-align','center')\n             row.appendChild(passed)\n             self.numPassed += 1\n         else:\n             fail = document.createElement('td')\n             fail.setAttribute('class','ac-feedback')\n             fail.innerHTML = 'Fail'\n             fail.setCSS('background-color','#de8e96')\n             fail.setCSS('text-align','center')\n             row.appendChild(fail)\n             self.numFailed += 1\n\n\n         act = document.createElement('td')\n         act.setAttribute('class','ac-feedback')\n         if trimActual:\n             actHTML = str(actual)[:5] + \"...\" + str(actual)[-5:]\n             if actualType == str:\n                 actHTML = repr(actHTML)\n             act.innerHTML = actHTML\n         else:\n             act.innerHTML = repr(actual)\n         act.setCSS('text-align','center')\n         row.appendChild(act)\n\n         expect = document.createElement('td')\n         expect.setAttribute('class','ac-feedback')\n\n         if trimExpected:\n             expectedHTML = str(expected)[:5] + \"...\" + str(expected)[-5:]\n             if expectedType == str:\n                 expectedHTML = repr(expectedHTML)\n             expect.innerHTML = expectedHTML\n         else:\n             expect.innerHTML = repr(expected)\n         expect.setCSS('text-align','center')\n         row.appendChild(expect)\n         inp = document.createElement('td')\n         inp.setAttribute('class','ac-feedback')\n\n         if err:\n             inp.innerHTML = msg\n         else:\n             inp.innerHTML = param\n         inp.setCSS('text-align','center')\n         row.appendChild(inp)\n         self.resTable.appendChild(row)\n\n\n     def showSummary(self):\n         pct = self.numPassed / (self.numPassed+self.numFailed) * 100\n         pTag = document.createElement('p')\n         pTag.innerHTML = \"You passed: \" + str(pct) + \"% of the tests\"\n         self.resdiv.appendChild(pTag)\n", "src/lib/os.py": "raise NotImplementedError(\"os is not yet implemented in pgSkulpt\")\n", "src/lib/pythonds/basic/__init__.py": "\n#__all__ = [\"stack\"]\n\n\n#from .stack import Stack\n#from .queue import Queue\n\n\n\n", "src/lib/audiodev.py": "raise NotImplementedError(\"audiodev is not yet implemented in pgSkulpt\")\n", "src/lib/locale.py": "raise NotImplementedError(\"locale is not yet implemented in pgSkulpt\")\n", "src/lib/getopt.py": "raise NotImplementedError(\"getopt is not yet implemented in pgSkulpt\")\n", "src/lib/htmllib.py": "raise NotImplementedError(\"htmllib is not yet implemented in pgSkulpt\")\n", "src/lib/stringprep.py": "raise NotImplementedError(\"stringprep is not yet implemented in pgSkulpt\")\n", "src/lib/sre_parse.py": "raise NotImplementedError(\"sre_parse is not yet implemented in pgSkulpt\")\n", "src/lib/dumbdbm.py": "raise NotImplementedError(\"dumbdbm is not yet implemented in pgSkulpt\")\n", "src/lib/idlelib/Icons/__init__.py": "raise NotImplementedError(\"Icons is not yet implemented in pgSkulpt\")\n", "src/lib/copy_reg.py": "raise NotImplementedError(\"copy_reg is not yet implemented in pgSkulpt\")\n", "src/lib/sre.py": "raise NotImplementedError(\"sre is not yet implemented in pgSkulpt\")\n", "src/lib/htmlentitydefs.py": "raise NotImplementedError(\"htmlentitydefs is not yet implemented in pgSkulpt\")\n", "src/lib/_MozillaCookieJar.py": "raise NotImplementedError(\"_MozillaCookieJar is not yet implemented in pgSkulpt\")\n", "src/lib/cgitb.py": "raise NotImplementedError(\"cgitb is not yet implemented in pgSkulpt\")\n", "src/lib/statvfs.py": "raise NotImplementedError(\"statvfs is not yet implemented in pgSkulpt\")\n", "src/lib/chunk.py": "raise NotImplementedError(\"chunk is not yet implemented in pgSkulpt\")\n", "src/lib/ctypes/macholib/__init__.py": "raise NotImplementedError(\"macholib is not yet implemented in pgSkulpt\")\n", "src/lib/linecache.py": "raise NotImplementedError(\"linecache is not yet implemented in pgSkulpt\")\n", "src/lib/token.py": "raise NotImplementedError(\"token is not yet implemented in pgSkulpt\")\n", "src/lib/math.js": "var $builtinmodule = function (name) {\n    var mod = {};\n    mod.pi = new pgSk.builtin.float_(Math.PI);\n    mod.e = new pgSk.builtin.float_(Math.E);\n\n    mod.fabs = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"fabs\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        return new pgSk.builtin.float_(Math.abs(pgSk.builtin.asnum$(x)));\n    });\n\n    mod.asin = new pgSk.builtin.func(function (rad) {\n        pgSk.builtin.pyCheckArgs(\"asin\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"rad\", \"number\", pgSk.builtin.checkNumber(rad));\n\n        return new pgSk.builtin.float_(Math.asin(pgSk.builtin.asnum$(rad)));\n    });\n\n    mod.acos = new pgSk.builtin.func(function (rad) {\n        pgSk.builtin.pyCheckArgs(\"acos\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"rad\", \"number\", pgSk.builtin.checkNumber(rad));\n\n        return new pgSk.builtin.float_(Math.acos(pgSk.builtin.asnum$(rad)));\n    });\n\n    mod.atan = new pgSk.builtin.func(function (rad) {\n        pgSk.builtin.pyCheckArgs(\"atan\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"rad\", \"number\", pgSk.builtin.checkNumber(rad));\n\n        return new pgSk.builtin.float_(Math.atan(pgSk.builtin.asnum$(rad)));\n    });\n\n    mod.atan2 = new pgSk.builtin.func(function (y, x) {\n        pgSk.builtin.pyCheckArgs(\"atan2\", arguments, 2, 2);\n        pgSk.builtin.pyCheckType(\"y\", \"number\", pgSk.builtin.checkNumber(y));\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        return new pgSk.builtin.float_(Math.atan2(pgSk.builtin.asnum$(y), pgSk.builtin.asnum$(x)));\n    });\n\n    mod.sin = new pgSk.builtin.func(function (rad) {\n        pgSk.builtin.pyCheckArgs(\"sin\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"rad\", \"number\", pgSk.builtin.checkNumber(rad));\n\n        return new pgSk.builtin.float_(Math.sin(pgSk.builtin.asnum$(rad)));\n    });\n\n    mod.cos = new pgSk.builtin.func(function (rad) {\n        pgSk.builtin.pyCheckArgs(\"cos\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"rad\", \"number\", pgSk.builtin.checkNumber(rad));\n\n        return new pgSk.builtin.float_(Math.cos(pgSk.builtin.asnum$(rad)));\n    });\n\n    mod.tan = new pgSk.builtin.func(function (rad) {\n        pgSk.builtin.pyCheckArgs(\"tan\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"rad\", \"number\", pgSk.builtin.checkNumber(rad));\n\n        return new pgSk.builtin.float_(Math.tan(pgSk.builtin.asnum$(rad)));\n    });\n\n    mod.asinh = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"asinh\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        x = pgSk.builtin.asnum$(x);\n\n        var L = x + Math.sqrt(x * x + 1);\n\n        return new pgSk.builtin.float_(Math.log(L));\n    });\n\n    mod.acosh = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"acosh\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        x = pgSk.builtin.asnum$(x);\n\n        var L = x + Math.sqrt(x * x - 1);\n\n        return new pgSk.builtin.float_(Math.log(L));\n    });\n\n    mod.atanh = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"atanh\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        x = pgSk.builtin.asnum$(x);\n\n        var L = (1 + x) / (1 - x);\n\n        return new pgSk.builtin.float_(Math.log(L) / 2);\n    });\n\n    mod.sinh = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"sinh\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        x = pgSk.builtin.asnum$(x);\n\n        var e = Math.E;\n        var p = Math.pow(e, x);\n        var n = 1 / p;\n        var result = (p - n) / 2;\n\n        return new pgSk.builtin.float_(result);\n    });\n\n    mod.cosh = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"cosh\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        x = pgSk.builtin.asnum$(x);\n\n        var e = Math.E;\n        var p = Math.pow(e, x);\n        var n = 1 / p;\n        var result = (p + n) / 2;\n\n        return new pgSk.builtin.float_(result);\n    });\n\n    mod.tanh = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"tanh\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        x = pgSk.builtin.asnum$(x);\n\n        var e = Math.E;\n        var p = Math.pow(e, x);\n        var n = 1 / p;\n        var result = ((p - n) / 2) / ((p + n) / 2);\n\n        return new pgSk.builtin.float_(result);\n    });\n\n    mod.ceil = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"ceil\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        return new pgSk.builtin.float_(Math.ceil(pgSk.builtin.asnum$(x)));\n    });\n\n    // returns y with the sign of x\n    mod.copysign = new pgSk.builtin.func(function (x, y) {\n        pgSk.builtin.pyCheckArgs(\"ceil\", arguments, 2, 2);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n        pgSk.builtin.pyCheckType(\"y\", \"number\", pgSk.builtin.checkNumber(y));\n\n        var _x = pgSk.ffi.remapToJs(x);\n        var _y = pgSk.ffi.remapToJs(y);\n        var res;\n\n        var isNeg_x = _x < 0;\n        var isNeg_y = _x < 0;\n\n        // special case for floats with negative zero\n        if(pgSk.builtin.checkFloat(x)) {\n            if(_x === 0) {\n                isNeg_x = 1/_x === -Infinity ? true : false;\n            }\n        }\n\n        if(pgSk.builtin.checkFloat(y)) {\n            if(_y === 0) {\n                isNeg_y = 1/_y === -Infinity ? true : false;\n            }\n        }\n\n        // if both signs are equal, just return _y\n        if((isNeg_x && isNeg_y) || (!isNeg_x && !isNeg_y)) {\n            res = _y;\n        } else if((isNeg_x && !isNeg_y) || (!isNeg_x && isNeg_y)) {\n            // if different, invert sign\n            if(y === 0) {\n                // special case for zero\n                res = isNeg_x ? -0.0 : 0.0;\n            } else {\n                res = _y * -1;\n            }\n        }\n\n        return new pgSk.builtin.float_(res);\n    });\n\n    mod.floor = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"floor\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        return new pgSk.builtin.float_(Math.floor(pgSk.builtin.asnum$(x)));\n    });\n\n    mod.sqrt = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"sqrt\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        return new pgSk.builtin.float_(Math.sqrt(pgSk.builtin.asnum$(x)));\n    });\n\n    mod.trunc = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"trunc\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        return new pgSk.builtin.int_(pgSk.builtin.asnum$(x) | 0);\n    });\n\n    mod.log = new pgSk.builtin.func(function (x, base) {\n        pgSk.builtin.pyCheckArgs(\"log\", arguments, 1, 2);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        if (base === undefined) {\n            return new pgSk.builtin.float_(Math.log(pgSk.builtin.asnum$(x)));\n        } else {\n            pgSk.builtin.pyCheckType(\"base\", \"number\", pgSk.builtin.checkNumber(base));\n            var ret = Math.log(pgSk.builtin.asnum$(x)) / Math.log(pgSk.builtin.asnum$(base));\n            return new pgSk.builtin.float_(ret);\n        }\n    });\n\n    mod.log10 = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"log10\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        var ret = Math.log(pgSk.builtin.asnum$(x)) / Math.log(10);\n        return new pgSk.builtin.float_(ret);\n    });\n\n    /* Return True if x is infinite, and False otherwise. */\n    mod.isinf = new pgSk.builtin.func(function(x) {\n        pgSk.builtin.pyCheckArgs(\"isinf\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        var _x = pgSk.builtin.asnum$(x);\n        if(isFinite(_x) && !isNaN(_x)) {\n            return pgSk.builtin.bool.false$;\n        } else {\n            return pgSk.builtin.bool.true$\n        }\n    });\n\n    /* Return True if x is a NaN (not a number), and False otherwise. */\n    mod.isnan = new pgSk.builtin.func(function(x) {\n        pgSk.builtin.pyCheckArgs(\"isnan\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"float\", pgSk.builtin.checkFloat(x));\n\n        var _x = pgSk.builtin.asnum$(x);\n        if(isNaN(_x)) {\n            return pgSk.builtin.bool.true$;\n        } else {\n            return pgSk.builtin.bool.false$;\n        }\n    });\n\n    mod.exp = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"exp\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        return new pgSk.builtin.float_(Math.exp(pgSk.builtin.asnum$(x)));\n    });\n\n    mod.pow = new pgSk.builtin.func(function (x, y) {\n        pgSk.builtin.pyCheckArgs(\"pow\", arguments, 2, 2);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n        pgSk.builtin.pyCheckType(\"y\", \"number\", pgSk.builtin.checkNumber(y));\n\n        return new pgSk.builtin.float_(Math.pow(pgSk.builtin.asnum$(x), pgSk.builtin.asnum$(y)));\n    });\n\n    mod.radians = new pgSk.builtin.func(function (deg) {\n        pgSk.builtin.pyCheckArgs(\"radians\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"deg\", \"number\", pgSk.builtin.checkNumber(deg));\n\n        var ret = Math.PI / 180.0 * pgSk.builtin.asnum$(deg);\n        return new pgSk.builtin.float_(ret);\n    });\n\n    mod.degrees = new pgSk.builtin.func(function (rad) {\n        pgSk.builtin.pyCheckArgs(\"degrees\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"rad\", \"number\", pgSk.builtin.checkNumber(rad));\n\n        var ret = 180.0 / Math.PI * pgSk.builtin.asnum$(rad);\n        return new pgSk.builtin.float_(ret);\n    });\n\n    mod.hypot = new pgSk.builtin.func(function (x, y) {\n        pgSk.builtin.pyCheckArgs(\"hypot\", arguments, 2, 2);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n        pgSk.builtin.pyCheckType(\"y\", \"number\", pgSk.builtin.checkNumber(y));\n\n        x = pgSk.builtin.asnum$(x);\n        y = pgSk.builtin.asnum$(y);\n        return new pgSk.builtin.float_(Math.sqrt((x * x) + (y * y)));\n    });\n\n    mod.factorial = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"factorial\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"number\", pgSk.builtin.checkNumber(x));\n\n        x = Math.floor(pgSk.builtin.asnum$(x));\n        var r = 1;\n        for (var i = 2; i <= x; i++) {\n            r *= i;\n        }\n        return new pgSk.builtin.int_(r);\n    });\n\n    return mod;\n}", "src/lib/BaseHTTPServer.py": "raise NotImplementedError(\"BaseHTTPServer is not yet implemented in pgSkulpt\")\n", "src/lib/cmd.py": "raise NotImplementedError(\"cmd is not yet implemented in pgSkulpt\")\n", "src/lib/filecmp.py": "raise NotImplementedError(\"filecmp is not yet implemented in pgSkulpt\")\n", "src/lib/lib2to3/fixes/__init__.py": "raise NotImplementedError(\"fixes is not yet implemented in pgSkulpt\")\n", "src/builtin/sys.js": "var $builtinmodule = function (name) {\n    var i;\n    var sys = {};\n\n    var args = [];\n    var argv = pgSk.getSysArgv();\n    for (i = 0; i < argv.length; ++i) {\n        args.push(new pgSk.builtin.str(argv[i]));\n    }\n    sys.argv = new pgSk.builtins[\"list\"](args);\n\n    sys.copyright = pgSk.builtin[\"str\"](\"Copyright 2009-2010 Scott Graham.\\nAll Rights Reserved.\\n\");\n\n    sys.maxint = new pgSk.builtin.int_(Math.pow(2,53)-1);\n\n    /*  The largest positive integer supported by the platform\u2019s Py_ssize_t type,\n     *  and thus the maximum size lists, strings, dicts, and many other containers can have.\n     *\n     *  In skulpt this is the same as maxint, due to the underlying implementation in javascript\n     */\n    sys.maxsize = new pgSk.builtin.int_(Math.pow(2,53)-1);\n\n    sys.modules = pgSk.sysmodules;\n\n    sys.path = pgSk.realsyspath;\n\n    sys.getExecutionLimit = new pgSk.builtin.func(function () {\n        if (pgSk.execLimit === null) {\n            return pgSk.builtin.none.none$;\n        }\n        return new pgSk.builtin.int_(pgSk.execLimit);\n    });\n\n    sys.setExecutionLimit = new pgSk.builtin.func(function (t) {\n        if (pgSk.execLimit === null) {\n            throw new pgSk.builtin.NotImplementedError(\"Execution limiting is not enabled\");\n        }\n        if (t !== undefined) {\n            pgSk.execLimit = pgSk.builtin.asnum$(t);\n        }\n    });\n\n    sys.resetTimeout = new pgSk.builtin.func(function () {\n        pgSk.execStart = new Date();\n    });\n\n    sys.getYieldLimit = new pgSk.builtin.func(function () {\n        if (pgSk.yieldLimit === null) {\n            return pgSk.builtin.none.none$;\n        }\n        return new pgSk.builtin.int_(pgSk.yieldLimit);\n    });\n\n    sys.setYieldLimit = new pgSk.builtin.func(function (t) {\n        if (pgSk.yieldLimit === null) {\n            throw new pgSk.builtin.NotImplementedError(\"Yielding is not enabled\");\n        }\n        if (t !== undefined) {\n            pgSk.yieldLimit = pgSk.builtin.asnum$(t);\n        }\n    });\n\n    sys.debug = new pgSk.builtin.func(function () {\n        return pgSk.builtin.none.none$;\n    });\n\n    sys.__stdout__ = new pgSk.builtin.file(new pgSk.builtin.str(\"/dev/stdout\"), new pgSk.builtin.str(\"w\"));\n    sys.__stdin__ = new pgSk.builtin.file(new pgSk.builtin.str(\"/dev/stdin\"), new pgSk.builtin.str(\"r\"));\n\n    sys.stdout = sys.__stdout__;\n    sys.stdin = sys.__stdin__;\n\n    return sys;\n};\n", "src/lib/dummy_threading.py": "raise NotImplementedError(\"dummy_threading is not yet implemented in pgSkulpt\")\n", "src/lib/markupbase.py": "raise NotImplementedError(\"markupbase is not yet implemented in pgSkulpt\")\n", "src/lib/shelve.py": "raise NotImplementedError(\"shelve is not yet implemented in pgSkulpt\")\n", "src/lib/xmllib.py": "raise NotImplementedError(\"xmllib is not yet implemented in pgSkulpt\")\n", "src/lib/string.js": "/*\n *  __author__: Isaac Dontje Lindell (i@isaacdontjelindell.com)\n *\n *  Implementation of the Python string module.\n */\n\n\nvar $builtinmodule = function (name) {\n    var mod = {};\n\n    mod.ascii_lowercase = pgSk.builtin.str('abcdefghijklmnopqrstuvwxyz');\n    mod.ascii_uppercase = pgSk.builtin.str('ABCDEFGHIJKLMNOPQRSTUVWXYZ');\n    mod.ascii_letters = pgSk.builtin.str(mod.ascii_lowercase.v + mod.ascii_uppercase.v);\n\n    mod.lowercase = pgSk.builtin.str('abcdefghijklmnopqrstuvwxyz');\n    mod.uppercase = pgSk.builtin.str('ABCDEFGHIJKLMNOPQRSTUVWXYZ');\n    mod.letters = pgSk.builtin.str(mod.lowercase.v + mod.uppercase.v);\n\n    mod.digits = pgSk.builtin.str('0123456789', pgSk.builtin.str);\n    mod.hexdigits = pgSk.builtin.str('0123456789abcdefABCDEF');\n    mod.octdigits = pgSk.builtin.str('01234567');\n\n    mod.punctuation = pgSk.builtin.str('!\"#$%&\\'()*+,-./:;<=>?@[\\\\]^_`{|}~');\n    mod.whitespace = pgSk.builtin.str('\\t\\n\\x0b\\x0c\\r ');\n\n    /* Note: The docs for string.printable say that it's the concatenation of string.digits,\n     * string.letters, string.punctuation, and string.whitespace. The CPython interpreter\n     * outputs the whitespace characters in one order when string.whitespace is used, and a\n     * slightly different order when string.printable is used. I've elected to follow the\n     * behavior of CPython here rather than the spec. */\n    mod.printable = pgSk.builtin.str(mod.digits.v + mod.letters.v + mod.punctuation.v + \" \\t\\n\\r\\x0b\\x0c\");\n\n\n    mod.split = new pgSk.builtin.func(function (s, sep, maxsplit) {\n        return pgSk.misceval.callsim(pgSk.builtin.str.prototype['split'], s, sep, maxsplit);\n    });\n\n    /* Return a copy of word with only its first character capitalized. */\n    mod.capitalize = new pgSk.builtin.func(function (word) {\n        return pgSk.misceval.callsim(pgSk.builtin.str.prototype['capitalize'], word);\n    });\n\n    /* Concatenate a list or tuple of words with intervening occurrences\n     * of sep. The default value for sep is a single space character. */\n    mod.join = new pgSk.builtin.func(function (words, sep) {\n        if (sep === undefined) {\n            sep = pgSk.builtin.str(' ');\n        }\n        return pgSk.misceval.callsim(pgSk.builtin.str.prototype['join'], sep, words);\n    });\n\n\n    /* Split the argument into words using split(), capitalize each word\n     * using capitalize(), and join the capitalized words using join().\n     * Note that this replaces runs of whitespace characters by a single\n     * space, and removes leading and trailing whitespace. */\n    mod.capwords = new pgSk.builtin.func(function (s, sep) {\n        pgSk.builtin.pyCheckArgs('capwords', arguments, 1, 2);\n        if (!pgSk.builtin.checkString(s)) {\n            throw new pgSk.builtin.TypeError(\"s must be a string\");\n        }\n        if (sep === undefined) {\n            sep = pgSk.builtin.str(' ');\n        }\n        if (!pgSk.builtin.checkString(sep)) {\n            throw new pgSk.builtin.TypeError(\"sep must be a string\");\n        }\n\n        var words = pgSk.misceval.callsim(mod.split, s, sep);\n        var capWords = [];\n        for (var i = 0; i < words.v.length; i++) {\n            var word = pgSk.builtin.list.prototype['list_subscript_'].call(words, i);\n            var cap = pgSk.misceval.callsim(mod.capitalize, word);\n            capWords.push(cap);\n        }\n\n        return pgSk.misceval.callsim(mod.join, new pgSk.builtin.list(capWords), sep);\n    });\n\n\n    return mod;\n};\n", "src/lib/ConfigParser.py": "raise NotImplementedError(\"ConfigParser is not yet implemented in pgSkulpt\")\n", "src/lib/pickle.py": "raise NotImplementedError(\"pickle is not yet implemented in pgSkulpt\")\n", "src/lib/processing.js": "/*\n  pgSkulpt Processing\n\n  Testing/debugging:\n\n  ProcessingJS from pgSkulpt:\n  pgSk.misceval.callsim(pgSk.globals.processing.$d.PShapeSVG, \n      new pgSk.builtin.str(\"string\"), \n      new pgSk.builtin.str(\"bot1.svg\"))\n\n  ProcessingJS direct:\n  p = Processing.instances[0]\n  p.PShapeSVG(\"string\", \"bot1.svg\")\n*/\n\nvar $builtinmodule = function (name) {\n    var imageClass;\n    var colorClass;\n    var screenClass;\n    var environmentClass;\n    var keyboardClass;\n    var mouseClass;\n    var vectorClass\n\n    var mod = {};\n    var imList = [];\n    var looping = true;\n    var instance = null;\n\n    // We need this to store a reference to the actual processing object which is not created\n    // until the run function is called.  Even then the processing object is passed by the\n    // processing-js sytem as a parameter to the sketchProc function.  Why not set it to None here\n    //\n\n    // See:  http://processingjs.org/reference/\n\n    mod.processing = null;\n    mod.p = null;\n\n    mod.X = new pgSk.builtin.int_(0);\n    mod.Y = new pgSk.builtin.int_(1);\n    mod.Z = new pgSk.builtin.int_(2);\n\n    mod.R = new pgSk.builtin.int_( 3);\n    mod.G = new pgSk.builtin.int_( 4);\n    mod.B = new pgSk.builtin.int_( 5);\n    mod.A = new pgSk.builtin.int_( 6);\n    \n    mod.U = new pgSk.builtin.int_( 7);\n    mod.V = new pgSk.builtin.int_( 8);\n    \n    mod.NX = new pgSk.builtin.int_( 9);\n    mod.NY = new pgSk.builtin.int_( 10);\n    mod.NZ = new pgSk.builtin.int_( 11);\n    \n    mod.EDGE = new pgSk.builtin.int_( 12);\n    \n    // Stroke\n    mod.SR = new pgSk.builtin.int_( 13);\n    mod.SG = new pgSk.builtin.int_( 14);\n    mod.SB = new pgSk.builtin.int_( 15);\n    mod.SA = new pgSk.builtin.int_( 16);\n    \n    mod.SW = new pgSk.builtin.int_( 17);\n    \n    // Transformations (2D and 3D)\n    mod.TX = new pgSk.builtin.int_( 18);\n    mod.TY = new pgSk.builtin.int_( 19);\n    mod.TZ = new pgSk.builtin.int_( 20);\n    \n    mod.VX = new pgSk.builtin.int_( 21);\n    mod.VY = new pgSk.builtin.int_( 22);\n    mod.VZ = new pgSk.builtin.int_( 23);\n    mod.VW = new pgSk.builtin.int_( 24);\n    \n    // Material properties\n    mod.AR = new pgSk.builtin.int_( 25);\n    mod.AG = new pgSk.builtin.int_( 26);\n    mod.AB = new pgSk.builtin.int_( 27);\n    \n    mod.DR = new pgSk.builtin.int_( 3);\n    mod.DG = new pgSk.builtin.int_( 4);\n    mod.DB = new pgSk.builtin.int_( 5);\n    mod.DA = new pgSk.builtin.int_( 6);\n    \n    mod.SPR = new pgSk.builtin.int_( 28);\n    mod.SPG = new pgSk.builtin.int_( 29);\n    mod.SPB = new pgSk.builtin.int_( 30);\n    \n    mod.SHINE = new pgSk.builtin.int_( 31);\n    \n    mod.ER = new pgSk.builtin.int_( 32);\n    mod.EG = new pgSk.builtin.int_( 33);\n    mod.EB = new pgSk.builtin.int_( 34);\n    \n    mod.BEEN_LIT = new pgSk.builtin.int_( 35);\n    \n    mod.VERTEX_FIELD_COUNT = new pgSk.builtin.int_( 36);\n    \n    // Shape drawing modes\n    mod.CENTER = new pgSk.builtin.int_(3);\n    mod.RADIUS = new pgSk.builtin.int_(2);\n    mod.CORNERS = new pgSk.builtin.int_(1);\n    mod.CORNER = new pgSk.builtin.int_(0);\n    mod.DIAMETER = new pgSk.builtin.int_(3);\n    \n    // Text vertical alignment modes\n    // Default vertical alignment for text placement\n    mod.BASELINE = new pgSk.builtin.int_( 0);\n    // Align text to the top\n    mod.TOP = new pgSk.builtin.int_(      101);\n    // Align text from the bottom, using the baseline\n    mod.BOTTOM = new pgSk.builtin.int_(   102);\n    \n    // UV Texture coordinate modes\n    mod.NORMAL = new pgSk.builtin.int_(     1);\n    mod.NORMALIZED = new pgSk.builtin.int_( 1);\n    mod.IMAGE = new pgSk.builtin.int_(      2);\n    \n    // Text placement modes\n    mod.MODEL = new pgSk.builtin.int_( 4);\n    mod.SHAPE = new pgSk.builtin.int_( 5);\n    \n    // Lighting modes\n    mod.AMBIENT = new pgSk.builtin.int_(     0);\n    mod.DIRECTIONAL = new pgSk.builtin.int_( 1);\n    //POINT:     2, Shared with Shape constant\n    mod.SPOT = new pgSk.builtin.int_(        3);\n\n    // Color modes\n    mod.RGB = new pgSk.builtin.int_(1);\n    mod.ARGB = new pgSk.builtin.int_(2);\n    mod.HSB = new pgSk.builtin.int_(3);\n    mod.ALPHA = new pgSk.builtin.int_(4);\n    mod.CMYK = new pgSk.builtin.int_(5);\n    \n    // Image file types\n    mod.TIFF = new pgSk.builtin.int_(0);\n    mod.TARGA = new pgSk.builtin.int_(1);\n    mod.JPEG = new pgSk.builtin.int_(2);\n    mod.GIF = new pgSk.builtin.int_(3);\n\n    // Stroke modes\n    mod.MITER = new pgSk.builtin.str(\"miter\");\n    mod.BEVEL = new pgSk.builtin.str(\"bevel\");\n    mod.ROUND = new pgSk.builtin.str(\"round\");\n    mod.SQUARE = new pgSk.builtin.str(\"butt\");\n    mod.PROJECT = new pgSk.builtin.str(\"square\");\n\n    // Renderer modes\n    mod.P2D = new pgSk.builtin.int_(1);\n    mod.JAVA2D = new pgSk.builtin.int_(1);\n    mod.WEBGL = new pgSk.builtin.int_(2);\n    mod.P3D = new pgSk.builtin.int_(2);\n    mod.OPENGL = new pgSk.builtin.int_(2);\n    mod.PDF = new pgSk.builtin.int_(0);\n    mod.DXF  = new pgSk.builtin.int_(0);\n\n    // Platform IDs\n    mod.OTHER = new pgSk.builtin.int_(   0);\n    mod.WINDOWS = new pgSk.builtin.int_( 1);\n    mod.MAXOSX = new pgSk.builtin.int_(  2);\n    mod.LINUX = new pgSk.builtin.int_(   3);\n    \n    mod.EPSILON = new pgSk.builtin.float_( 0.0001);\n\n    mod.MAX_FLOAT = new pgSk.builtin.float_(  3.4028235e+38);\n    mod.MIN_FLOAT = new pgSk.builtin.float_( -3.4028235e+38);\n    mod.MAX_INT = new pgSk.builtin.int_(    2147483647);\n    mod.MIN_INT = new pgSk.builtin.int_(   -2147483648);\n    \n    // Constants\n    mod.HALF_PI = new pgSk.builtin.float_(Math.PI / 2.0);\n    mod.THIRD_PI = new pgSk.builtin.float_(Math.PI / 3.0);\n    mod.PI = new pgSk.builtin.float_(Math.PI);\n    mod.TWO_PI = new pgSk.builtin.float_(Math.PI * 2.0);\n    mod.TAU = new pgSk.builtin.float_(Math.PI * 2.0);\n    mod.QUARTER_PI = new pgSk.builtin.float_(Math.PI / 4.0);\n\n    mod.DEG_TO_RAD = new pgSk.builtin.float_( Math.PI / 180);\n    mod.RAD_TO_DEG = new pgSk.builtin.float_( 180 / Math.PI);\n\n    mod.WHITESPACE = pgSk.builtin.str(\" \\t\\n\\r\\f\\u00A0\");\n    // Shape modes\n    mod.POINT = new pgSk.builtin.int_(2);\n    mod.POINTS = new pgSk.builtin.int_(2);\n    mod.LINE = new pgSk.builtin.int_(4);\n    mod.LINES = new pgSk.builtin.int_(4);\n    mod.TRIANGLE = new pgSk.builtin.int_(8);\n    mod.TRIANGLES = new pgSk.builtin.int_(9);\n    mod.TRIANGLE_FAN = new pgSk.builtin.int_(11);\n    mod.TRIANGLE_STRIP = new pgSk.builtin.int_(10);\n    mod.QUAD = new pgSk.builtin.int_(16);\n    mod.QUADS = new pgSk.builtin.int_(16);\n    mod.QUAD_STRIP = new pgSk.builtin.int_(17);\n    mod.POLYGON = new pgSk.builtin.int_(20);\n\n    mod.PATH = new pgSk.builtin.int_(21);\n    mod.RECT = new pgSk.builtin.int_(30);\n    mod.ELLIPSE = new pgSk.builtin.int_(31);\n    mod.ARC = new pgSk.builtin.int_(32);\n    mod.SPHERE = new pgSk.builtin.int_(40);\n    mod.BOX = new pgSk.builtin.int_(41);\n\n    mod.GROUP = new pgSk.builtin.int_(          0);\n    mod.PRIMITIVE = new pgSk.builtin.int_(      1);\n    //PATH:         21, // shared with Shape PATH\n    mod.GEOMETRY = new pgSk.builtin.int_(       3);\n    \n    // Shape Vertex\n    mod.VERTEX = new pgSk.builtin.int_(        0);\n    mod.BEZIER_VERTEX = new pgSk.builtin.int_( 1);\n    mod.CURVE_VERTEX = new pgSk.builtin.int_(  2);\n    mod.BREAK = new pgSk.builtin.int_(         3);\n    mod.CLOSESHAPE = new pgSk.builtin.int_(    4);\n    \n    // Blend modes\n    mod.REPLACE    = new pgSk.builtin.int_(0);\n    mod.BLEND      = new pgSk.builtin.int_(1 << 0);\n    mod.ADD        = new pgSk.builtin.int_(1 << 1);\n    mod.SUBTRACT   = new pgSk.builtin.int_(1 << 2);\n    mod.LIGHTEST   = new pgSk.builtin.int_(1 << 3);\n    mod.DARKEST    = new pgSk.builtin.int_(1 << 4);\n    mod.DIFFERENCE = new pgSk.builtin.int_(1 << 5);\n    mod.EXCLUSION  = new pgSk.builtin.int_(1 << 6);\n    mod.MULTIPLY   = new pgSk.builtin.int_(1 << 7);\n    mod.SCREEN     = new pgSk.builtin.int_(1 << 8);\n    mod.OVERLAY    = new pgSk.builtin.int_(1 << 9);\n    mod.HARD_LIGHT = new pgSk.builtin.int_(1 << 10);\n    mod.SOFT_LIGHT = new pgSk.builtin.int_(1 << 11);\n    mod.DODGE      = new pgSk.builtin.int_(1 << 12);\n    mod.BURN       = new pgSk.builtin.int_(1 << 13);\n\n    // Color component bit masks\n    mod.ALPHA_MASK = new pgSk.builtin.int_( 0xff000000);\n    mod.RED_MASK = new pgSk.builtin.int_(   0x00ff0000);\n    mod.GREEN_MASK = new pgSk.builtin.int_( 0x0000ff00);\n    mod.BLUE_MASK = new pgSk.builtin.int_(  0x000000ff);\n    \n    // Projection matrices\n    mod.CUSTOM = new pgSk.builtin.int_(       0);\n    mod.ORTHOGRAPHIC = new pgSk.builtin.int_( 2);\n    mod.PERSPECTIVE = new pgSk.builtin.int_(  3);\n    \n    // Cursors\n    mod.ARROW = new pgSk.builtin.str(\"default\");\n    mod.CROSS = new pgSk.builtin.str(\"crosshair\");\n    mod.HAND = new pgSk.builtin.str(\"pointer\");\n    mod.MOVE = new pgSk.builtin.str(\"move\");\n    mod.TEXT = new pgSk.builtin.str(\"text\");\n    mod.WAIT = new pgSk.builtin.str(\"wait\");\n    mod.NOCURSOR = pgSk.builtin.assk$(\"url('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), auto\", pgSk.builtin.nmber.str);\n\n    // Hints\n    mod.DISABLE_OPENGL_2X_SMOOTH = new pgSk.builtin.int_(1);\n    mod.ENABLE_OPENGL_2X_SMOOTH = new pgSk.builtin.int_(-1);\n    mod.ENABLE_OPENGL_4X_SMOOTH = new pgSk.builtin.int_(2);\n    mod.ENABLE_NATIVE_FONTS = new pgSk.builtin.int_(3);\n    mod.DISABLE_DEPTH_TEST = new pgSk.builtin.int_(4);\n    mod.ENABLE_DEPTH_TEST = new pgSk.builtin.int_(-4);\n    mod.ENABLE_DEPTH_SORT = new pgSk.builtin.int_(5);\n    mod.DISABLE_DEPTH_SORT = new pgSk.builtin.int_(-5);\n    mod.DISABLE_OPENGL_ERROR_REPORT = new pgSk.builtin.int_(6);\n    mod.ENABLE_OPENGL_ERROR_REPORT = new pgSk.builtin.int_(-6);\n    mod.ENABLE_ACCURATE_TEXTURES = new pgSk.builtin.int_(7);\n    mod.DISABLE_ACCURATE_TEXTURES = new pgSk.builtin.int_(-7);\n    mod.HINT_COUNT = new pgSk.builtin.int_(10);\n\n    // Shape closing modes\n    mod.OPEN =  new pgSk.builtin.int_(1);\n    mod.CLOSE = new pgSk.builtin.int_(2);\n\n    // Filter/convert types\n    mod.BLUR = new pgSk.builtin.int_(11);\n    mod.GRAY = new pgSk.builtin.int_(12);\n    mod.INVERT = new pgSk.builtin.int_(13);\n    mod.OPAQUE = new pgSk.builtin.int_(14);\n    mod.POSTERIZE = new pgSk.builtin.int_(15);\n    mod.THRESHOLD = new pgSk.builtin.int_(16);\n    mod.ERODE = new pgSk.builtin.int_(17);\n    mod.DILATE = new pgSk.builtin.int_(18);\n\n    // Both key and keyCode will be equal to these values\n    mod.BACKSPACE = new pgSk.builtin.int_( 8);\n    mod.TAB = new pgSk.builtin.int_(9);\n    mod.ENTER = new pgSk.builtin.int_(10);\n    mod.RETURN = new pgSk.builtin.int_(13);\n    mod.ESC = new pgSk.builtin.int_(27);\n    mod.DELETE = new pgSk.builtin.int_(127);\n    mod.CODED = new pgSk.builtin.int_(0xffff);\n\n    // p.key will be CODED and p.keyCode will be this value\n    mod.SHIFT = new pgSk.builtin.int_(16);\n    mod.CONTROL = new pgSk.builtin.int_(17);\n    mod.ALT = new pgSk.builtin.int_(18);\n    mod.CAPSLK = new pgSk.builtin.int_(20);\n    mod.PGUP = new pgSk.builtin.int_(33);\n    mod.PGDN = new pgSk.builtin.int_(34);\n    mod.END = new pgSk.builtin.int_(35);\n    mod.HOME = new pgSk.builtin.int_(36);\n    mod.LEFT = new pgSk.builtin.int_(37);\n    mod.UP = new pgSk.builtin.int_(38);\n    mod.RIGHT = new pgSk.builtin.int_(39);\n    mod.DOWN = new pgSk.builtin.int_(40);\n    mod.F1 = new pgSk.builtin.int_(112);\n    mod.F2 = new pgSk.builtin.int_(113);\n    mod.F3 = new pgSk.builtin.int_(114);\n    mod.F4 = new pgSk.builtin.int_(115);\n    mod.F5 = new pgSk.builtin.int_(116);\n    mod.F6 = new pgSk.builtin.int_(117);\n    mod.F7 = new pgSk.builtin.int_(118);\n    mod.F8 = new pgSk.builtin.int_(119);\n    mod.F9 = new pgSk.builtin.int_(120);\n    mod.F10 = new pgSk.builtin.int_(121);\n    mod.F11 = new pgSk.builtin.int_(122);\n    mod.F12 = new pgSk.builtin.int_(123);\n    mod.NUMLK = new pgSk.builtin.int_(144);\n    mod.META = new pgSk.builtin.int_(157);\n    mod.INSERT = new pgSk.builtin.int_(155);\n\n    // PJS defined constants\n    mod.SINCOS_LENGTH = new pgSk.builtin.int_(720);\n    mod.PRECISIONB = new pgSk.builtin.int_(15);\n    mod.PRECISIONF = new pgSk.builtin.int_(1 << 15);\n    mod.PREC_MAXVAL = new pgSk.builtin.int_((1 << 15) - 1);\n    mod.PREC_ALPHA_SHIFT = new pgSk.builtin.int_(24 - 15);\n    mod.PREC_RED_SHIFT = new pgSk.builtin.int_(16 - 15);\n    mod.NORMAL_MODE_AUTO = new pgSk.builtin.int_(0);\n    mod.NORMAL_MODE_SHAPE = new pgSk.builtin.int_(1);\n    mod.NORMAL_MODE_VERTEX = new pgSk.builtin.int_(2);\n    mod.MAX_LIGHTS = new pgSk.builtin.int_(8);\n\n    // 2D - Primitives\n    mod.line = new pgSk.builtin.func(function (x1, y1, x2, y2) {\n        mod.processing.line(x1.v, y1.v, x2.v, y2.v);\n    });\n\n    mod.ellipse = new pgSk.builtin.func(function (x, y, r1, r2) {\n        mod.processing.ellipse(x.v, y.v, r1.v, r2.v);\n\n    });\n\n    mod.text = new pgSk.builtin.func(function (theText, x, y) {\n        mod.processing.text(theText.v, x.v, y.v);\n    });\n\n    mod.point = new pgSk.builtin.func(function (x1, y1) {\n        mod.processing.point(x1.v, y1.v);\n    });\n\n    mod.arc = new pgSk.builtin.func(function (x, y, width, height, start, stop) {\n        mod.processing.arc(x.v, y.v, width.v, height.v, start.v, stop.v);\n    });\n\n    mod.quad = new pgSk.builtin.func(function (x1, y1, x2, y2, x3, y3, x4, y4) {\n        mod.processing.quad(x1.v, y1.v, x2.v, y2.v, x3.v, y3.v, x4.v, y4.v);\n    });\n\n    mod.rect = new pgSk.builtin.func(function (x, y, width, height, radius) {\n        var rad;\n        if (typeof(radius) === \"undefined\") {\n            mod.processing.rect(x.v, y.v, width.v, height.v);\n        } else {\n            mod.processing.rect(x.v, y.v, width.v, height.v, radius.v);\n        }\n    });\n\n    mod.triangle = new pgSk.builtin.func(function (x1, y1, x2, y2, x3, y3) {\n        mod.processing.triangle(x1.v, y1.v, x2.v, y2.v, x3.v, y3.v);\n    });\n\n    mod.bezier = new pgSk.builtin.func(function (x1, y1, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {\n        if (typeof(a7) === \"undefined\") {\n\t    // bezier(x1, y1, cx1, cy1, cx2, cy2,  x2,  y2);\n            mod.processing.bezier(x1.v, y1.v, a1.v, a2.v, a3.v, a4.v, a5.v, a6.v);\n\t} else {\n\t    // bezier(x1, y1,  z1, cx1, cy1, cz1, cx2, cy2, cz2, x2, y2, z2);\n            mod.processing.bezier(x1.v, y1.v, a1.v, a2.v, a3.v, a4.v, a5.v, a6.v, a7.v, a8.v, a9.v, a10.v);\n\t}\n    });\n\n    mod.alpha = new pgSk.builtin.func(function (r, g, b) {\n        // r will be either:\n        //      a number in which case the fill will be grayscale\n        //      a color object\n        // g, and b may be undefined.  If they hold values it will\n        // be assumed that we have an r,g,b color tuple\n        if (typeof(g) === \"undefined\") {\n            return new pgSk.builtin.float_(mod.processing.alpha(r.v));\n        } else if (typeof(b) === \"undefined\") {\n            return new pgSk.builtin.float_(mod.processing.alpha(r.v, g.v));\n        } else {\n            return new pgSk.builtin.float_(mod.processing.alpha(r.v, g.v, b.v));\n\t}\n    });\n\n    mod.ambient = new pgSk.builtin.func(function (r, g, b) {\n\t// ambient(gray)\n\t// ambient(red, green blue)\n        // r will be either:\n        //      a number in which case the fill will be grayscale\n        //      a color object\n        // g, and b may be undefined.  If they hold values it will\n        // be assumed that we have an r,g,b color tuple\n        if (typeof(g) === \"undefined\") {\n            mod.processing.ambient(r.v);\n        } else if (typeof(b) === \"undefined\") {\n            mod.processing.ambient(r.v, g.v);\n        } else {\n            mod.processing.ambient(r.v, g.v, b.v);\n\t}\n    });\n\n    mod.ambientLight = new pgSk.builtin.func(function (v1, v2, v3, x, y, z) {\n\t// ambientLight(v1,v2,v3)\n\t// ambientLight(v1,v2,v3,x,y,z)\n        if (typeof(x) === \"undefined\") {\n            mod.processing.ambientLight(v1.v, v2.v, v3.v);\n        } else if (typeof(y) === \"undefined\") {\n            mod.processing.ambientLight(v1.v, v2.v, v3.v, x.v);\n        } else if (typeof(z) === \"undefined\") {\n            mod.processing.ambientLight(v1.v, v2.v, v3.v, x.v, y.v);\n        } else {\n            mod.processing.ambientLight(v1.v, v2.v, v3.v, x.v, y.v, z.v);\n\t}\n    });\n\n    mod.beginCamera = new pgSk.builtin.func(function () {\n\tmod.processing.beginCamera();\n    });\n\n    mod.beginShape = new pgSk.builtin.func(function (mode) {\n        if (typeof(mode) === \"undefined\") {\n            mode = mod.POLYGON;\n        }\n        mod.processing.beginShape(mode.v);\n    });\n\n    mod.bezierDetail = new pgSk.builtin.func(function (resolution) {\n\t// Sets the resolution at which Beziers display. The default\n\t// value is 20. This function is only useful when using the\n\t// P3D or OPENGL renderer as the default (JAVA2D) renderer\n\t// does not use this information.\n        if (typeof(resolution) !== \"undefined\") {\n            resolution = resolution.v;\n        } else {\n            resolution = 20;\n\t}\n        mod.processing.bezierDetail(resolution);\n    });\n\n    mod.bezierPoint = new pgSk.builtin.func(function (a,b,c,d,t) {\n        mod.processing.bezierPoint(a.v,b.v,c.v,d.v,t.v);\n    });\n\n    mod.bezierTangent = new pgSk.builtin.func(function (a,b,c,d,t) {\n\tmod.processing.bezierTangent(a.v,b.v,c.v,d.v,t.v);\n    });\n\n    mod.bezierVertex = new pgSk.builtin.func(function (v1, v2, v3, v4, v5, v6,\n\t\t\t\t\t\t    v7, v8, v9) {\n\t// bezierVertex(cx1, cy1, cx2, cy2,   x,   y)\n\t// bezierVertex(cx1, cy1, cz1, cx2, cy2, cz2, x, y, z)\n        if (typeof(v7) === \"undefined\") {\n\t    mod.processing.bezierVertex(v1.v, v2.v, v3.v, v4.v, v5.v, v6.v);\n\t} else if (typeof(v8) === \"undefined\") {\n\t    mod.processing.bezierVertex(v1.v, v2.v, v3.v, v4.v, v5.v, v6.v,\n\t\t\t\t\tv7.v);\n\t} else if (typeof(v9) === \"undefined\") {\n\t    mod.processing.bezierVertex(v1.v, v2.v, v3.v, v4.v, v5.v, v6.v,\n\t\t\t\t\tv7.v, v8.v);\n\t} else {\n\t    mod.processing.bezierVertex(v1.v, v2.v, v3.v, v4.v, v5.v, v6.v,\n\t\t\t\t\tv7.v, v8.v, v9.v);\n\t}\n    });\n\n    mod.blend = new pgSk.builtin.func(function (v1, v2, v3, v4, v5,\n\t\t\t\t\t      v6, v7, v8, v9, v10) {\n\tif (other instanceof pgSk.builtin.int_ || other instanceof pgSk.builtin.float_) {\n\t    // blend(x,     y,width,height,dx,    dy,dwidth,dheight,MODE)\n\t    mod.processing.blend(v1.v, v2.v, v3.v, v4.v, v5.v,\n\t\t\t\t v6.v, v7.v, v8.v, v9.v);\n\t} else {\n\t    // blend(srcImg,x,y,    width, height,dx,dy,    dwidth, dheight,MODE)\n\t    mod.processing.blend(v1.v, v2.v, v3.v, v4.v, v5.v,\n\t\t\t\t v6.v, v7.v, v8.v, v9.v, v10.v);\n\t}\n    });\n\n    mod.blendColor = new pgSk.builtin.func(function (c1, c2, mode) {\n\t// blendColor(c1,c2,MODE)\n        var c = pgSk.misceval.callsim(mod.color,\n\t\t\t\t    new pgSk.builtin.int_(0),\n\t\t\t\t    new pgSk.builtin.int_(0),\n\t\t\t\t    new pgSk.builtin.int_(0));\n\tc.v = mod.processing.blendColor(c1.v, c2.v, mode.v);\n\treturn c;\n    });\n\n    mod.brightness = new pgSk.builtin.func(function (r, g, b) {\n        if (typeof(g) === \"undefined\") {\n\t    return new pgSk.builtin.float_(mod.processing.brightness(r.v));\n        } else if (typeof(b) === \"undefined\") {\n\t    return new pgSk.builtin.float_(mod.processing.brightness(r.v, g.v));\n        } else {\n\t    return new pgSk.builtin.float_(mod.processing.brightness(r.v, g.v, b.v));\n\t}\n    });\n\n    mod.camera = new pgSk.builtin.func(function (eyeX, eyeY, eyeZ,\n\t\t\t\t\t       centerX, centerY, centerZ,\n\t\t\t\t\t       upX, upY, upZ) {\n\t// camera()\n\t// camera(eyeX, eyeY, eyeZ,centerX, centerY, centerZ,upX, upY, upZ)\n        if (typeof(eyeX) === \"undefined\") {\n\t    mod.processing.camera();\n\t} else {\n\t    mod.processing.camera(eyeX.v, eyeY.v, eyeZ.v,\n\t\t\t\t  centerX.v, centerY.v, centerZ.v,\n\t\t\t\t  upX.v, upY.v, upZ.v);\n\t}\n    });\n\n    mod.constrain = new pgSk.builtin.func(function (value, min, max) {\n\treturn new pgSk.builtin.float_(mod.processing.constrain(value.v, min.v, max.v));\n    });\n\n    mod.copy = new pgSk.builtin.func(function (v1, v2, v3, v4, v5,\n\t\t\t\t\t      v6, v7, v8, v9) {\n\tif (other instanceof pgSk.builtin.int_ || other instanceof pgSk.builtin.float_) {\n\t    // copy(x,     y,width,height,dx,    dy,dwidth,dheight)\n\t    mod.processing.copy(v1.v, v2.v, v3.v, v4.v, v5.v,\n\t\t\t\tv6.v, v7.v, v8.v);\n\t} else {\n\t    // copy(srcImg,x,y,    width, height,dx,dy,    dwidth, dheight)\n\t    mod.processing.copy(v1.v, v2.v, v3.v, v4.v, v5.v,\n\t\t\t\tv6.v, v7.v, v8.v, v9.v);\n\t}\n    });\n\n    mod.createFont = new pgSk.builtin.func(function (name, size, smooth, charset) {\n\t// createFont(name, size)\n\t// createFont(name, size, smooth)\n\t// createFont(name, size, smooth, charset)\n\tvar font = pgSk.misceval.callsim(mod.PFont);\n        if (typeof(smooth) === \"undefined\") {\n\t    font.v = mod.processing.createFont(name.v, size.v);\n\t} else if (typeof(charset) === \"undefined\") {\n\t    font.v = mod.processing.createFont(name.v, size.v, smooth.v);\n\t} else {\n\t    font.v = mod.processing.createFont(name.v, size.v, smooth.v, charset.v);\n\t}\n\treturn font;\n    });\n\n    mod.createGraphics = new pgSk.builtin.func(function (width, height, renderer, filename) {\n\t// createGraphics(width, height, renderer)\n\t// createGraphics(width, height, renderer, filename)\n\tvar graphics = pgSk.misceval.callsim(mod.PGraphics);\n        if (typeof(filename) === \"undefined\") {\n\t    graphics.v = mod.processing.createGraphics(width.v, height.v, renderer.v);\n\t} else {\n\t    graphics.v = mod.processing.createGraphics(width.v, height.v, renderer.v, filename.v);\n\t}\n\treturn graphics;\n    });\n\n    mod.createImage = new pgSk.builtin.func(function (width, height, format) {\n\tvar image = pgSk.misceval.callsim(mod.PImage);\n\timage.v = mod.processing.createImage(width.v, height.v, format.v);\n\treturn image;\n    });\n\n    mod.cursor = new pgSk.builtin.func(function (v, x, y) {\n\t// cursor()\n\t// cursor(MODE)\n\t// cursor(image,x,y)\n        if (typeof(v) === \"undefined\") {\n\t    mod.processing.cursor();\n\t} else if (typeof(x) === \"undefined\") {\n\t    mod.processing.cursor(v.v);\n\t} else if (typeof(y) === \"undefined\") {\n\t    mod.processing.cursor(v.v, x.v);\n\t} else {\n\t    mod.processing.cursor(v.v, x.v, y.v);\n\t}\n    });\n\n    mod.curve = new pgSk.builtin.func(function (v1, v2, v3, v4,\n\t\t\t\t\t      v5, v6, v7, v8,\n\t\t\t\t\t      v9, v10, v11, v12) {\n\t// curve(x1, y1, x2, y2, x3, y3, x4, y4);\n\t// curve(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4);\n        if (typeof(v9) === \"undefined\") {\n\t    mod.processing.curve(v1.v, v2.v, v3.v, v4.v,\n\t\t\t\t v5.v, v6.v, v7.v, v8.v);\n\t} else if (typeof(v10) === \"undefined\") {\n\t    mod.processing.curve(v1.v, v2.v, v3.v, v4.v,\n\t\t\t\t v5.v, v6.v, v7.v, v8.v,\n\t\t\t\t v9.v);\n\t} else if (typeof(v11) === \"undefined\") {\n\t    mod.processing.curve(v1.v, v2.v, v3.v, v4.v,\n\t\t\t\t v5.v, v6.v, v7.v, v8.v,\n\t\t\t\t v9.v, v10.v);\n\t} else if (typeof(v12) === \"undefined\") {\n\t    mod.processing.curve(v1.v, v2.v, v3.v, v4.v,\n\t\t\t\t v5.v, v6.v, v7.v, v8.v,\n\t\t\t\t v9.v, v10.v, v11.v);\n\t} else {\n\t    mod.processing.curve(v1.v, v2.v, v3.v, v4.v,\n\t\t\t\t v5.v, v6.v, v7.v, v8.v,\n\t\t\t\t v9.v, v10.v, v11.v, v12.v);\n\t}\n    });\n\n    mod.curveDetail = new pgSk.builtin.func(function (detail) {\n\t// curveDetail(detail)\n\tmod.processing.curveDetail(detail.v);\n    });\n\n    mod.curvePoint = new pgSk.builtin.func(function (a,b,c,d,t) {\n\t// curvePoint(a,b,c,d,t)\n\tmod.processing.curvePoint(a.v,b.v,c.v,d.v,t.v);\n    });\n\n    mod.curveTangent = new pgSk.builtin.func(function (a,b,c,d,t) {\n\t// curveTangent(a,b,c,d,t)\n\tmod.processing.curveTangent(a.v,b.v,c.v,d.v,t.v);\n    });\n\n    mod.curveTightness = new pgSk.builtin.func(function (squishy) {\n\t// curveTightness(squishy)\n\tmod.processing.curveTightness(squishy.v);\n    });\n\n    mod.curveVertex = new pgSk.builtin.func(function (x, y, z) {\n\t// curveVertex(x, y) \n\t// curveVertex(x, y, z)\n        if (typeof(z) === \"undefined\") {\n\t    mod.processing.curveVertex(x.v, y.v);\n\t} else {\n\t    mod.processing.curveVertex(x.v, y.v, z.v);\n\t}\n    });\n\n    mod.day = new pgSk.builtin.func(function () {\n\treturn new pgSk.builtin.int_(mod.processing.day());\n    });\n\n    mod.degrees = new pgSk.builtin.func(function (angle) {\n\t// degrees(angle)\n\treturn new pgSk.builtin.float_(mod.processing.degrees(angle.v));\n    });\n\n    mod.directionalLight = new pgSk.builtin.func(function (v1,v2,v3,nx,ny,nz) {\n\t// directionalLight(v1,v2,v3,nx,ny,nz)\n\tmod.processing.directionalLight(v1.v,v2.v,v3.v,nx.v,ny.v,nz.v);\n    });\n\n    mod.dist = new pgSk.builtin.func(function (x1, y1, z1, x2, y2, z2) {\n\t// dist(x1, y1, x2, y2)\n\t// dist(x1, y1, z1, x2, y2, z2)\n        if (typeof(y2) === \"undefined\") {\n\t    return new pgSk.builtin.float_(mod.processing.dist(x1.v, y1.v, z1.v, x2.v));\n\t} else if (typeof(z2) === \"undefined\") {\n\t    return new pgSk.builtin.float_(mod.processing.dist(x1.v, y1.v, z1.v, x2.v, y2.v));\n\t} else {\n\t    return new pgSk.builtin.float_(mod.processing.dist(x1.v, y1.v, z1.v, x2.v, y2.v, z2.v));\n\t}\n    });\n\n    mod.emissive = new pgSk.builtin.func(function (v1, v2, v3) {\n\t// emissive(gray)\n\t// emissive(color)\n\t// emissive(v1,v2,v3)\n        if (typeof(v2) === \"undefined\") {\n\t    mod.processing.emissive(v1.v);\n\t} else if (typeof(v3) === \"undefined\") {\n\t    mod.processing.emissive(v1.v, v2.v);\n\t} else {\n\t    mod.processing.emissive(v1.v, v2.v, v3.v);\n\t}\n    });\n\n    mod.endCamera = new pgSk.builtin.func(function () {\n\t// endCamera()\n\tmod.processing.endCamera();\n    });\n\n    mod.endShape = new pgSk.builtin.func(function (mode) {\n\t// endShape()\n\t// endShape(MODE)\n        if (typeof(mode) === \"undefined\") {\n\t    mod.processing.endShape();\n\t} else {\n\t    mod.processing.endShape(mode.v);\n\t}\n    });\n\n    mod.filter = new pgSk.builtin.func(function (mode, srcImg) {\n\t// filter(MODE)\n\t// filter(MODE, srcImg)\n        if (typeof(srcImg) === \"undefined\") {\n\t    mod.processing.filter(mode.v);\n\t} else {\n\t    mod.processing.filter(mode.v, srcImg.v);\n\t}\n    });\n\n    mod.frustum = new pgSk.builtin.func(function (left, right, bottom, top, near, far) {\n\t// frustum(left, right, bottom,top, near, far)\n\tmod.processing.frustum(left, right, bottom, top, near, far);\n    });\n\n    mod.hint = new pgSk.builtin.func(function (item) {\n\t// hint(item)\n\tmod.processing.hint(item);\n    });\n\n    mod.hour = new pgSk.builtin.func(function () {\n\treturn new pgSk.builtin.int_(mod.processing.hour());\n    });\n\n    mod.hue = new pgSk.builtin.func(function (color) {\n\t// hue(color)\n\treturn new pgSk.builtin.float_(mod.processing.hue(color.v));\n    });\n\n    mod.imageMode = new pgSk.builtin.func(function (mode) {\n\tmod.processing.imageMode(mode.v);\n    });\n\n    mod.lerp = new pgSk.builtin.func(function (value1, value2, amt) {\n\t// lerp(value1, value2, amt)\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.lerp(value1.v, value2.v, amt.v));\n    });\n\n    mod.lerpColor = new pgSk.builtin.func(function (c1, c2, amt) {\n\t// lerpColor(c1, c2, amt)\n\t// returns color\n        var c = pgSk.misceval.callsim(mod.color,\n\t\t\t\t    new pgSk.builtin.int_(0),\n\t\t\t\t    new pgSk.builtin.int_(0),\n\t\t\t\t    new pgSk.builtin.int_(0));\n\tc.v = mod.processing.lerpColor(c1.v, c2.v, amt.v);\n\treturn c;\n    });\n\n    mod.lightFalloff = new pgSk.builtin.func(function (constant, linear, quadratic) {\n\t// lightFalloff(constant,linear,quadratic)\n\tmod.processing.lightFalloff(constant.v, linear.v, quadratic.v);\n    });\n\n    mod.lights = new pgSk.builtin.func(function () {\n\tmod.processing.lights();\n    });\n\n    mod.lightSpecular = new pgSk.builtin.func(function (v1, v2, v3) {\n\t// lightSpecular(v1,v2,v3)\n\tmod.processing.lightSpecular(v1.v, v2.v, v3.v);\n    });\n\n    mod.loadBytes = new pgSk.builtin.func(function (filename) {\n\t// loadBytes(filename)\n\t// returns byte[]\n\treturn new pgSk.builtin.list(mod.processing.loadBytes(filename.v));\n    });\n\n    mod.loadFont = new pgSk.builtin.func(function (fontname) {\n\t// loadFont(fontname)\n\t// returns font\n\tvar font = pgSk.misceval.callsim(mod.PFont);\n\tfont.v = mod.processing.loadFont(fontname.v);\n\treturn font;\n    });\n\n    mod.loadShape = new pgSk.builtin.func(function (filename) {\n\t// loadShape(filename)\n\t// returns shape\n\tvar shape = pgSk.misceval.callsim(mod.PShapeSVG, \n\t\t\t\t\tnew pgSk.builtin.str(\"string\"),\n\t\t\t\t\tfilename);\n\treturn shape;\n    });\n\n    mod.loadStrings = new pgSk.builtin.func(function (filename) {\n\t// loadStrings(filename)\n\t// returns string []\n\treturn new pgSk.builtin.list(mod.processing.loadStrings(filename.v));\n    });\n\n    mod.mag = new pgSk.builtin.func(function (a, b, c) {\n\t// mag(a,b)\n\t// mag(a,b,c)\n\t// returns magnitude as float\n        if (typeof(c) === \"undefined\") {\n\t    return new pgSk.builtin.float_(mod.processing.mag(a.v, b.v));\n        } else {\n\t    return new pgSk.builtin.float_(mod.processing.mag(a.v, b.v, c.v));\n\t}\n    });\n\n    mod.map = new pgSk.builtin.func(function (value,low1,high1,low2,high2) {\n\t// map(value,low1,high1,low2,high2)\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.map(value.v,low1.v,high1.v,\n\t\t\t\t\t\t   low2.v,high2.v));\n    });\n\n    mod.millis = new pgSk.builtin.func(function () {\n\treturn new pgSk.builtin.int_(mod.processing.millis());\n    });\n\n    mod.minute = new pgSk.builtin.func(function () {\n\treturn new pgSk.builtin.int_(mod.processing.minute());\n    });\n\n    mod.modelX = new pgSk.builtin.func(function (x, y, z) {\n\t// modelX(x,y,z)\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.modelX(x.v, y.v, z.v));\n    });\n\n    mod.modelY = new pgSk.builtin.func(function (x, y, z) {\n\t// modelY(x,y,z)\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.modelY(x.v, y.v, z.v));\n    });\n\n    mod.modelZ = new pgSk.builtin.func(function (x, y, z) {\n\t// modelZ(x,y,z)\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.modelZ(x.v, y.v, z.v));\n    });\n\n    mod.month = new pgSk.builtin.func(function () {\n\treturn new pgSk.builtin.int_(mod.processing.month());\n    });\n\n    mod.noCursor = new pgSk.builtin.func(function () {\n\tmod.processing.noCursor();\n    });\n\n    mod.noise = new pgSk.builtin.func(function (x, y, z) {\n\t// noise(x)\n\t// noise(x, y)\n\t// noise(x, y, z)\n\t// returns float\n        if (typeof(y) === \"undefined\") {\n\t    return new pgSk.builtin.float_(mod.processing.noise(x.v));\n        } else if (typeof(z) === \"undefined\") {\n\t    return new pgSk.builtin.float_(mod.processing.noise(x.v, y.v));\n        } else {\n\t    return new pgSk.builtin.float_(mod.processing.noise(x.v, y.v, z.v));\n\t}\n    });\n\n    mod.noiseDetail = new pgSk.builtin.func(function (octaves, falloff) {\n\t// noiseDetail(octaves);\n\t// noiseDetail(octaves,falloff);\n\tmod.processing.noiseDetail(octaves.v, falloff.v);\n    });\n\n    mod.noiseSeed = new pgSk.builtin.func(function (value) {\n\t// noiseSeed(value); int\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.noiseSeed(value.v));\n    });\n\n    mod.noLights = new pgSk.builtin.func(function () {\n\tmod.processing.noLights();\n    });\n\n    mod.norm = new pgSk.builtin.func(function (value, low, high) {\n\t// norm(value, low, high)\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.norm(value.v, low.v, high.v));\n    });\n\n    mod.normal = new pgSk.builtin.func(function (nx, ny, nz) {\n\t// normal(nx,ny,nz)\n\t// returns None\n\tmod.processing.normal(nx.v, ny.v, nz.v);\n    });\n\n    mod.noTint = new pgSk.builtin.func(function () {\n\tmod.processing.noTint();\n    });\n\n    mod.ortho = new pgSk.builtin.func(function (left, right, bottom, top, near, far) {\n\t// ortho(left, right, bottom,top, near,far)\n\t// returns None\n\tmod.processing.ortho(left.v, right.v, bottom.v, top.v, near.v, far.v);\n    });\n\n    mod.perspective = new pgSk.builtin.func(function (fov, aspect, zNear, zFar) {\n\t// perspective()\n\t// perspective(fov, aspect, zNear, zFar)\n\t// returns None\n        if (typeof(fov) === \"undefined\") {\n\t    mod.processing.perspective();\n        } else if (typeof(aspect) === \"undefined\") {\n\t    mod.processing.perspective(fov.v);\n        } else if (typeof(zNear) === \"undefined\") {\n\t    mod.processing.perspective(fov.v, aspect.v);\n        } else if (typeof(zFar) === \"undefined\") {\n\t    mod.processing.perspective(fov.v, aspect.v, zNear.v);\n        } else {\n\t    mod.processing.perspective(fov.v, aspect.v, zNear.v, zFar.v);\n\t}\n    });\n\n    mod.pointLight = new pgSk.builtin.func(function (v1,v2,v3,nx,ny,nz) {\n\t// pointLight(v1,v2,v3,nx,ny,nz)\n\t// returns None\n\tmod.processing.pointLight(v1.v,v2.v,v3.v,nx.v,ny.v,nz.v);\n    });\n\n    mod.printCamera = new pgSk.builtin.func(function () {\n\t// printCamera()\n\t// returns None\n\tmod.processing.printCamera();\n    });\n\n    mod.println = new pgSk.builtin.func(function (data) {\n\t// println(data)\n\tmod.processing.println(data.v);\n    });\n\n    mod.printProjection = new pgSk.builtin.func(function () {\n\t// printProjection()\n\t// returns None\n\tmod.processing.printProjection();\n    });\n\n    mod.radians = new pgSk.builtin.func(function (angle) {\n\t// radians(angle)\n\t// returns int or float\n\treturn new pgSk.builtin.float_(mod.processing.radians(angle.v));\n    });\n\n    mod.randomSeed = new pgSk.builtin.func(function (value) {\n\t// noiseSeed(value);\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.randomSeed(value.v));\n    });\n\n    mod.random = new pgSk.builtin.func(function (v1, v2) {\n\t// random();\n\t// random(high);\n\t// random(low, high);\n\t// returns float\n        if (typeof(v1) === \"undefined\") {\n\t    return new pgSk.builtin.float_(mod.processing.random());\n        } else if (typeof(v2) === \"undefined\") {\n\t    return new pgSk.builtin.float_(mod.processing.random(v1.v));\n        } else {\n\t    return new pgSk.builtin.float_(mod.processing.random(v1.v, v2.v));\n\t}\n    });\n\n    mod.requestImage = new pgSk.builtin.func(function (filename, extension) {\n\t// requestImage(filename)\n\t// requestImage(filename, extension)\n\tvar image = pgSk.misceval.callsim(mod.PImage);\n        if (typeof(extension) === \"undefined\") {\n\t    image.v = mod.processing.requestImage(filename.v);\n        } else {\n\t    image.v = mod.processing.requestImage(filename.v, extension.v);\n\t}\n\treturn image;\n    });\n\n    mod.saturation = new pgSk.builtin.func(function (color) {\n\t// saturation(color)\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.saturation(color.v));\n    });\n\n    mod.save = new pgSk.builtin.func(function (filename) {\n\t// save(filename)\n\t// returns None\n\tmod.processing.save(filename.v);\n    });\n\n    mod.saveFrame = new pgSk.builtin.func(function (filename) {\n\t// saveFrame()\n\t// saveFrame(filename-####.ext)\n\t// returns None\n        if (typeof(filename) === \"undefined\") {\n\t    mod.processing.saveFrame();\n        } else {\n\t    mod.processing.saveFrame(filename.v);\n\t}\n    });\n\n    mod.saveStrings = new pgSk.builtin.func(function (filename, strings) {\n\t// saveStrings(filename,strings)\n\tmod.processing.saveStrings(filename.v, strings.v);\n    });\n\n    mod.screenX = new pgSk.builtin.func(function (x, y, z) {\n\t// screenX(x,y,z)\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.screenX(x.v, y.v, z.v));\n    });\n\n    mod.screenY = new pgSk.builtin.func(function (x, y, z) {\n\t// screenY(x,y,z)\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.screenY(x.v, y.v, z.v));\n    });\n\n    mod.screenZ = new pgSk.builtin.func(function (x, y, z) {\n\t// screenZ(x,y,z)\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.screenZ(x.v, y.v, z.v));\n    });\n\n    mod.second = new pgSk.builtin.func(function () {\n\treturn new pgSk.builtin.int_(mod.processing.second());\n    });\n\n    mod.shape = new pgSk.builtin.func(function (sh, x, y, width, height) {\n\t// shape(sh)\n\t// shape(sh,x,y)\n\t// shape(sh,x,y,width,height)\n\t// returns?\n        if (typeof(x) === \"undefined\") {\n\t    mod.processing.shape(sh.v);\n        } else if (typeof(y) === \"undefined\") {\n\t    mod.processing.shape(sh.v,x.v);\n        } else if (typeof(width) === \"undefined\") {\n\t    mod.processing.shape(sh.v,x.v,y.v);\n        } else if (typeof(height) === \"undefined\") {\n\t    mod.processing.shape(sh.v,x.v,y.v,width.v);\n        } else {\n\t    mod.processing.shape(sh.v,x.v,y.v,width.v,height.v);\n\t}\n    });\n\n    mod.shapeMode = new pgSk.builtin.func(function (mode) {\n\t// shapeMode(MODE)\n\tmod.processing.shapeMode(mode.v);\n    });\n\n    mod.shininess = new pgSk.builtin.func(function (shine) {\n\t// shininess(shine)\n\t// returns None\n\tmod.processing.shininess(shine.v);\n    });\n\n    mod.specular = new pgSk.builtin.func(function (v1,v2,v3) {\n\t// specular(gray)\n\t// specular(color)\n\t// specular(v1,v2,v3)\n        if (typeof(v2) === \"undefined\") {\n\t    mod.processing.specular(v1.v);\n        } else if (typeof(v3) === \"undefined\") {\n\t    mod.processing.specular(v1.v,v2.v);\n        } else {\n\t    mod.processing.specular(v1.v,v2.v,v3.v);\n\t}\n    });\n\n    mod.spotLight = new pgSk.builtin.func(function (v1,v2,v3,nx,ny,nz,angle,concentration) {\n\t// spotLight(v1,v2,v3,nx,ny,nz,angle,concentration)\n\t// returns None\n\tmod.processing.spotLight(v1.v,v2.v,v3.v,nx.v,ny.v,nz.v,angle.v,concentration.v);\n    });\n\n    mod.sq = new pgSk.builtin.func(function (value) {\n\t// sq(value)\n\t// returns squared number\n\treturn new pgSk.builtin.float_(mod.processing.sq(value));\n    });\n\n    mod.status = new pgSk.builtin.func(function (text) {\n\t// status(text)\n\tmod.processing.status(text.v);\n    });\n\n    mod.textAlign = new pgSk.builtin.func(function (align, yalign) {\n\t// textAlign(ALIGN)\n\t// textAlign(ALIGN, YALIGN)\n\t// returns None\n        if (typeof(yalign) === \"undefined\") {\n\t    mod.processing.textAlign(align.v);\n        } else {\n\t    mod.processing.textAlign(align.v, yalign.v);\n\t}\n    });\n\n    mod.textAscent = new pgSk.builtin.func(function () {\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.textAscent());\n    });\n\n    mod.textDescent = new pgSk.builtin.func(function () {\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.textDescent());\n    });\n\n    mod.textFont = new pgSk.builtin.func(function (font, size) {\n\t// textFont(font)\n\t// textFont(font, size)\n        if (typeof(size) === \"undefined\") {\n\t    mod.processing.textFont(font.v);\n        } else {\n\t    mod.processing.textFont(font.v, size.v);\n\t}\n    });\n\n    mod.textLeading = new pgSk.builtin.func(function (dist) {\n\t// textLeading(dist)\n\t// returns None\n\tmod.processing.textLeading(dist.v);\n    });\n\n    mod.textMode = new pgSk.builtin.func(function (mode) {\n\t// textMode(MODE)\n\t// returns None\n\tmod.processing.textMode(mode.v);\n    });\n\n    mod.textSize = new pgSk.builtin.func(function (size) {\n\t// textSize(size)\n\t// returns None\n\tmod.processing.textSize(size.v);\n    });\n\n    mod.texture = new pgSk.builtin.func(function (img) {\n\t// texture(img)\n\t// returns None\n\tmod.processing.texture(img.v);\n    });\n\n    mod.textureMode = new pgSk.builtin.func(function (mode) {\n\t// textureMode(MODE)\n\t// returns None\n\tmod.processing.textureMode(mode.v);\n    });\n\n    mod.textWidth = new pgSk.builtin.func(function (data) {\n\t// textWidth(data)\n\t// returns float\n\treturn new pgSk.builtin.float_(mod.processing.textWidth(data.v));\n    });\n\n    mod.tint = new pgSk.builtin.func(function (v1, v2, v3, v4) {\n\t// tint(gray)\n\t// tint(gray, alpha)\n\t// tint(value1, value2, value3)\n\t// tint(value1, value2, value3, alpha)\n\t// tint(color)\n\t// tint(color, alpha)\n\t// tint(hex)\n\t// tint(hex, alpha)\n        if (typeof(v2) === \"undefined\") {\n\t    mod.processing.tint(v1.v);\n        } else if (typeof(v3) === \"undefined\") {\n\t    mod.processing.tint(v1.v, v2.v);\n        } else if (typeof(v4) === \"undefined\") {\n\t    mod.processing.tint(v1.v, v2.v, v3.v);\n        } else {\n\t    mod.processing.tint(v1.v, v2.v, v3.v, v4.v);\n\t}\n    });\n\n    mod.updatePixels = new pgSk.builtin.func(function () {\n\t// updatePixels()\n\tmod.processing.updatePixels();\n    });\n\n    mod.vertex = new pgSk.builtin.func(function (x, y, z, u, v) {\n\t// vertex(x, y); \n\t// vertex(x, y, z); \n\t// vertex(x, y, u, v); \n\t// vertex(x, y, z, u, v);\n        if (typeof(z) === \"undefined\") {\n\t    mod.processing.vertex(x.v, y.v);\n        } else if (typeof(u) === \"undefined\") {\n\t    mod.processing.vertex(x.v, y.v, z.v);\n        } else if (typeof(v) === \"undefined\") {\n\t    mod.processing.vertex(x.v, y.v, z.v, u.v);\n        } else {\n\t    mod.processing.vertex(x.v, y.v, z.v, u.v, v.v);\n\t}\n    });\n\n    mod.year = new pgSk.builtin.func(function () {\n\treturn new pgSk.builtin.int_(mod.processing.year());\n    });\n\n    // 3D Primitives\n\n    mod.box = new pgSk.builtin.func(function(size) {\n        mod.processing.box(size.v);\n    });\n\n    mod.sphere = new pgSk.builtin.func(function(radius) {\n        mod.processing.sphere(radius.v);\n    });\n\n    mod.sphereDetail = new pgSk.builtin.func(function(res,vres) {\n        if (typeof(vres) === \"undefined\") {\n            mod.processing.sphereDetail(res.v);\n        }\n        else {\n            mod.processing.sphereDetail(res.v, vres.v);\n        }\n    });\n\n    // Color\n    mod.background = new pgSk.builtin.func(function (r, g, b) {\n\n        if (typeof(g) !== \"undefined\") {\n            g = g.v;\n        }\n        if (typeof(b) !== \"undefined\") {\n            b = b.v;\n        }\n\n        mod.processing.background(r.v, g, b);\n\n    });\n\n    mod.fill = new pgSk.builtin.func(function (r, g, b, alpha) {\n        // r will be either:\n        //      a number in which case the fill will be grayscale\n        //      a color object\n        // g, and b may be undefined.  If they hold values it will\n        // be assumed that we have an r,g,b color tuple\n        // alpha may also be undefined - if defined, it is the opacity of the fill\n        if (typeof(g) !== \"undefined\") {\n            g = g.v;\n        }\n        if (typeof(b) !== \"undefined\") {\n            b = b.v;\n        }\n        if (typeof(alpha) !== \"undefined\") {\n            alpha = alpha.v;\n        }\n\n        mod.processing.fill(r.v, g, b, alpha);\n\n    });\n\n\n    mod.stroke = new pgSk.builtin.func(function (r, g, b, alpha) {\n\n        if (typeof(g) !== \"undefined\") {\n            g = g.v;\n        }\n        if (typeof(b) !== \"undefined\") {\n            b = b.v;\n        }\n        if (typeof(alpha) !== \"undefined\") {\n            alpha = alpha.v;\n        }\n\n        mod.processing.stroke(r.v, g, b, alpha);\n\n    });\n\n    mod.noStroke = new pgSk.builtin.func(function () {\n        mod.processing.noStroke();\n    });\n\n\n    mod.colorMode = new pgSk.builtin.func(function (mode, maxV, maxG, maxB, maxAlpha) {\n        // mode is one of RGB or HSB\n        // maxV is either the max value for all color elements\n        // or the range for Red/Hue (depending on mode) if maxG and maxB are defined\n        if (typeof(maxV) === \"undefined\") {\n            maxV = 255;\n        }\n        else {\n            maxV = maxV.v;\n        }\n        if (typeof(maxG) !== \"undefined\") {\n            maxG = maxG.v;\n        }\n        if (typeof(maxB) !== \"undefined\") {\n            maxB = maxB.v;\n        }\n        if (typeof(maxAlpha) !== \"undefined\") {\n            maxAlpha = maxAlpha.v;\n        }\n\n        mod.processing.colorMode(mode.v, maxV, maxG, maxB, maxAlpha);\n    });\n\n    mod.noFill = new pgSk.builtin.func(function () {\n        mod.processing.noFill();\n    });\n\n\n    // Environment\n\n    mod.loop = new pgSk.builtin.func(function () {\n        if (mod.processing === null) {\n            throw new pgSk.builtin.Exception(\"loop() should be called after run()\");\n        }\n        looping = true;\n        mod.processing.loop();\n    });\n\n    mod.noLoop = new pgSk.builtin.func(function () {\n        if (mod.processing === null) {\n            throw new pgSk.builtin.Exception(\"noLoop() should be called after run()\");\n        }\n        looping = false;\n        mod.processing.noLoop();\n    });\n\n    // NOTE: difference with ProcessingJS\n    // frameRate is only a function, not a variable: \n    // use environment.frameRate for value\n    mod.frameRate = new pgSk.builtin.func(function (fr) {\n        mod.processing.frameRate(fr.v);\n    });\n\n    // NOTE: difference with ProcessingJS\n    // Use mouse.pressed rather than mousePressed\n\n    // NOTE: difference with ProcessingJS\n    // Use environment.keyPressed rather than keyPressed\n\n    // NOTE: difference with ProcessingJS\n    // Use environment.frameCount \n\n    // NOTE: difference with ProcessingJS\n    // Use environment.frameCount\n    \n    // NOTE: difference with ProcessingJS\n    // Use environment.online\n\n    // NOTE: difference with ProcessingJS\n    // Use environment.focused\n\n    mod.width = new pgSk.builtin.int_(100);\n    mod.height = new pgSk.builtin.int_(100);\n\n    mod.size = new pgSk.builtin.func(function (w, h, mode) {\n        if (typeof(mode) === \"undefined\") {\n            mode = mod.P2D;\n        }\n        mod.processing.size(w.v, h.v, mode.v);\n\tmod.width = new pgSk.builtin.int_(mod.processing.width);\n\tmod.height = new pgSk.builtin.int_(mod.processing.height);\n    });\n\n    mod.exitp = new pgSk.builtin.func(function (h, w) {\n        mod.processing.exit();\n    });\n\n    // NOTE: difference with ProcessingJS\n    // Use mouseX() or mouse.x rather than mouseX\n    mod.mouseX = new pgSk.builtin.func(function () {\n        return new pgSk.builtin.int_(mod.processing.mouseX);\n    });\n\n    // NOTE: difference with ProcessingJS\n    // Use mouseY() or mouse.y rather than mouseY\n    mod.mouseY = new pgSk.builtin.func(function () {\n        return new pgSk.builtin.int_(mod.processing.mouseY);\n    });\n\n    // NOTE: difference with ProcessingJS\n    // Use pmouseX() or mouse.px rather than pmouseX\n    mod.pmouseX = new pgSk.builtin.func(function () {\n        return new pgSk.builtin.int_(mod.processing.pmouseX);\n    });\n\n    // NOTE: difference with ProcessingJS\n    // Use pmouseY() or mouse.py rather than pmouseY\n    mod.pmouseY = new pgSk.builtin.func(function () {\n        return new pgSk.builtin.int_(mod.processing.pmouseY);\n    });\n\n    // Attributes\n    mod.rectMode = new pgSk.builtin.func(function (mode) {\n        mod.processing.rectMode(mode.v);\n    });\n\n    mod.strokeWeight = new pgSk.builtin.func(function (wt) {\n        mod.processing.strokeWeight(wt.v);\n\n    });\n\n    mod.smooth = new pgSk.builtin.func(function () {\n        mod.processing.smooth();\n    });\n\n    mod.noSmooth = new pgSk.builtin.func(function () {\n        mod.processing.noSmooth();\n    });\n\n    mod.ellipseMode = new pgSk.builtin.func(function (mode) {\n        mod.processing.ellipseMode(mode.v);\n    });\n\n    mod.strokeCap = new pgSk.builtin.func(function (mode) {\n        mod.processing.strokeCap(mode.v);\n    });\n\n    mod.strokeJoin = new pgSk.builtin.func(function (mode) {\n        mod.processing.strokeJoin(mode.v);\n    });\n\n\n    // Transforms\n    mod.rotate = new pgSk.builtin.func(function (rads) {\n        // rotation in radians\n        mod.processing.rotate(rads.v);\n    });\n\n    mod.rotateX = new pgSk.builtin.func(function(rads) {\n        mod.processing.rotateX(rads.v);\n    });\n\n    mod.rotateY = new pgSk.builtin.func(function(rads) {\n        mod.processing.rotateY(rads.v);\n    });\n\n    mod.rotateZ = new pgSk.builtin.func(function(rads) {\n        mod.processing.rotateZ(rads.v);\n    });\n\n    mod.scale = new pgSk.builtin.func(function (sx, sy, sz) {\n        if (typeof(sy) === \"undefined\") {\n            sy = 1.0;\n        } else {\n            sy = sy.v;\n        }\n        if (typeof(sz) === \"undefined\") {\n            sz = 1.0;\n        } else {\n            sz = sz.v;\n        }\n        mod.processing.scale(sx.v, sy, sz);\n    });\n\n    mod.translate = new pgSk.builtin.func(function (sx, sy, sz) {\n        if (typeof(sy) === \"undefined\") {\n            sy = 1.0;\n        } else {\n            sy = sy.v;\n        }\n        if (typeof(sz) === \"undefined\") {\n            sz = 1.0;\n        } else {\n            sz = sz.v;\n        }\n        mod.processing.translate(sx.v, sy, sz);\n    });\n\n    mod.popMatrix = new pgSk.builtin.func(function() {\n        mod.processing.popMatrix();\n    });\n\n    mod.pushMatrix = new pgSk.builtin.func(function() {\n        mod.processing.pushMatrix();\n    });\n\n    mod.applyMatrix = new pgSk.builtin.func(function() {\n        var args = Array.prototype.slice.call(arguments, 0, 16),\n            i;\n\n        for (i = 0; i < args.length; i++) {\n            args[i] = typeof(args[i]) === \"undefined\" ? 0.0 : args[i].v;\n        }\n\n        mod.processing.applyMatrix.apply(mod.processing, args);\n    });\n\n    mod.resetMatrix = new pgSk.builtin.func(function() {\n        mod.processing.resetMatrix();\n    });\n\n    mod.printMatrix = new pgSk.builtin.func(function() {\n        return pgSk.ffi.remapToPy(mod.processing.printMatrix());\n    });\n\n    //  //////////////////////////////////////////////////////////////////////\n    //  Run\n    // \n    //  Create the processing context and setup of calls to setup, draw etc.\n    //\n    //\n    //  //////////////////////////////////////////////////////////////////////    \n    mod.run = new pgSk.builtin.func(function () {\n        function sketchProc (processing) {\n            mod.processing = processing;\n\n            // processing.setup = function() {\n            //     if pgSk.globals[\"setup\"]\n            //         pgSk.misceval.callsim(pgSk.globals[\"setup\"])\n            // }\n\n\n            // FIXME if no pgSk.globals[\"draw\"], then no need for this\n            processing.draw = function () {\n                // if there are pending image loads then just use the natural looping calls to \n                // retry until all the images are loaded.  If noLoop was called in setup then make\n                // sure to revert to that after all the images in hand.\n                var wait = false;\n                for (var i in imList) {\n                    if (imList[i].width === 0) {\n                        wait = true;\n                    }\n                }\n                if (wait === true) {\n                    if (looping === true) {\n                        return;\n                    }\n                    else {\n                        processing.loop();\n                        return;\n                    }\n\n                } else {\n                    if (looping === false) {\n                        processing.noLoop();\n                    }\n                }\n\n                mod.frameCount = processing.frameCount;\n                if (pgSk.globals[\"draw\"]) {\n                \ttry {\n                   \t    pgSk.misceval.callsim(pgSk.globals[\"draw\"]);\n                    }\n                    catch(e) {\n                        pgSk.uncaughtException(e);\n                    }\n\t\t\t\t}\n            };\n\n            var callBacks = [\"setup\", \"mouseMoved\", \"mouseClicked\", \"mouseDragged\", \"mouseMoved\", \"mouseOut\",\n                \"mouseOver\", \"mousePressed\", \"mouseReleased\", \"keyPressed\", \"keyReleased\", \"keyTyped\"\n            ];\n            for (var cb in callBacks) {\n                if (pgSk.globals[callBacks[cb]]) {\n                    processing[callBacks[cb]] = new Function(\"try {pgSk.misceval.callsim(pgSk.globals['\" + callBacks[cb] + \"']);} catch(e) {pgSk.uncaughtException(e);}\");\n                }\n            }\n        }\n\n        var canvas = document.getElementById(pgSk.canvas);\n        if (canvas.tagName !== \"CANVAS\") {\n            var mydiv = canvas;\n            canvas = document.createElement('canvas');\n            while (mydiv.firstChild) {\n                mydiv.removeChild(mydiv.firstChild);\n            }\n            mydiv.appendChild(canvas);\n        }\n        window.$(canvas).show();\n        window.Processing.logger = { log : function(message) {\n            pgSk.misceval.print_(message);\n        }};\n        // if a Processing instance already exists it's likely still running, stop it by exiting\n        instance = window.Processing.getInstanceById(pgSk.canvas);\n        if (instance) {\n            instance.exit();\n        }\n        mod.p = new window.Processing(canvas, sketchProc);\n\n\n    });\n\n    mouseClass = function ($gbl, $loc) {\n\n        $loc.__getattr__ = new pgSk.builtin.func(function (self, key) {\n\t    key = pgSk.ffi.remapToJs(key);\n            if (key === \"x\") {\n                return pgSk.builtin.assk$(mod.processing.mouseX);\n            }\n            else if (key === \"y\") {\n                return pgSk.builtin.assk$(mod.processing.mouseY);\n            }\n            else if (key === \"px\") {\n                return pgSk.builtin.assk$(mod.processing.pmouseX);\n            }\n            else if (key === \"py\") {\n                return pgSk.builtin.assk$(mod.processing.pmouseY);\n            }\n            else if (key === \"pressed\") {\n                    return new pgSk.builtin.bool(mod.processing.__mousePressed);\n            }\n            else if (key === \"button\") {\n                return pgSk.builtin.assk$(mod.processing.mouseButton);\n            }\n        });\n\n    };\n\n\n    mod.Mouse = pgSk.misceval.buildClass(mod, mouseClass, \"Mouse\", []);\n\n    mod.mouse = pgSk.misceval.callsim(mod.Mouse);\n\n    keyboardClass = function ($gbl, $loc) {\n\n        $loc.__getattr__ = new pgSk.builtin.func(function (self, key) {\n\t    key = pgSk.ffi.remapToJs(key);\n            if (key === \"key\") {\n                return new pgSk.builtin.str(mod.processing.key.toString());\n            }\n            else if (key === \"keyCode\") {\n                return pgSk.builtin.assk$(mod.processing.keyCode);\n            }\n            else if (key === \"keyPressed\") {\n                return new pgSk.builtin.str(mod.processing.keyPressed);\n            } // todo bool\n        });\n\n    };\n\n    mod.Keyboard = pgSk.misceval.buildClass(mod, keyboardClass, \"Keyboard\", []);\n\n    mod.keyboard = pgSk.misceval.callsim(mod.Keyboard);\n\n\n    environmentClass = function ($gbl, $loc) {\n\n        $loc.__getattr__ = new pgSk.builtin.func(function (self, key) {\n\t    key = pgSk.ffi.remapToJs(key);\n            if (key === \"frameCount\") {\n                return pgSk.builtin.assk$(mod.processing.frameCount);\n            }\n            else if (key === \"frameRate\") {\n                return pgSk.builtin.assk$(mod.processing.frameRate);\n            }\n            else if (key === \"height\") {\n                return pgSk.builtin.assk$(mod.processing.height);\n            }\n            else if (key === \"width\") {\n                return pgSk.builtin.assk$(mod.processing.width);\n            }\n            else if (key === \"online\") {\n                return new pgSk.builtin.bool(mod.processing.online);\n            }\n            else if (key === \"focused\") {\n                return new pgSk.builtin.bool(mod.processing.focused);\n            }\n        });\n\n    };\n\n    mod.Environment = pgSk.misceval.buildClass(mod, environmentClass, \"Environment\", []);\n\n    mod.environment = pgSk.misceval.callsim(mod.Environment);\n\n    screenClass = function ($gbl, $loc) {\n\n        $loc.__init__ = new pgSk.builtin.func(function (self) {\n            self.pixels = null;\n        });\n\n        $loc.__getattr__ = new pgSk.builtin.func(function (self, key) {\n\t    key = pgSk.ffi.remapToJs(key);\n            if (key === \"height\") {\n                return pgSk.builtin.assk$(mod.processing.height);\n            }\n            else if (key === \"width\") {\n                return pgSk.builtin.assk$(mod.processing.width);\n            }\n            else if (key === \"pixels\") {\n                if (self.pixels == null) {\n                    self.pixels = new pgSk.builtin.list(mod.processing.pixels.toArray());\n                }\n            }\n            return self.pixels;\n        });\n\n    };\n\n    mod.Screen = pgSk.misceval.buildClass(mod, screenClass, \"Screen\", []);\n\n    mod.screen = pgSk.misceval.callsim(mod.Screen);\n\n    mod.loadPixels = new pgSk.builtin.func(function () {\n        mod.processing.loadPixels();\n    });\n\n\n    colorClass = function ($gbl, $loc) {\n        /* images are loaded async.. so its best to preload them */\n        $loc.__init__ = new pgSk.builtin.func(function (self, val1, val2, val3, alpha) {\n            if (typeof(val2) !== \"undefined\") {\n                val2 = val2.v;\n            }\n            if (typeof(val3) !== \"undefined\") {\n                val3 = val3.v;\n            }\n            if (typeof(alpha) !== \"undefined\") {\n                alpha = alpha.v;\n            }\n            self.v = mod.processing.color(val1.v, val2, val3, alpha);\n        });\n\n    };\n\n    mod.color = pgSk.misceval.buildClass(mod, colorClass, \"color\", []);\n\n    mod.red = new pgSk.builtin.func(function (clr) {\n        return new pgSk.builtin.int_(mod.processing.red(clr.v));\n    });\n\n    mod.green = new pgSk.builtin.func(function (clr) {\n        return new pgSk.builtin.int_(mod.processing.green(clr.v));\n    });\n\n    mod.blue = new pgSk.builtin.func(function (clr) {\n        return new pgSk.builtin.int_(mod.processing.blue(clr.v));\n    });\n\n    // Image class and functions\n    //\n    imageClass = function ($gbl, $loc) {\n        /* images are loaded async.. so its best to preload them */\n        $loc.__init__ = new pgSk.builtin.func(function (self, arg1, arg2, arg3) {\n\t    // PImage()\n\t    // PImage(img)\n\t    // PImage(width,height)\n\t    // PImage(width,height,format)\n\t    if (typeof(arg1) === \"undefined\") {\n\t\tself.v = new mod.processing.PImage();\n\t    } else if (typeof(arg2) === \"undefined\") {\n\t\tself.v = new mod.processing.PImage(arg1.v);\n\t    } else if (typeof(arg3) === \"undefined\") {\n\t\tself.v = new mod.processing.PImage(arg1.v, arg2.v);\n\t    } else {\n\t\tself.v = new mod.processing.PImage(arg1.v, arg2.v, arg3.v);\n\t    }\n        });\n\n        $loc.__getattr__ = new pgSk.builtin.func(function (self, key) {\n\t    key = pgSk.ffi.remapToJs(key);\n            if (key === \"width\") {\n                return pgSk.builtin.assk$(self.v.width);\n            }\n            if (key === \"height\") {\n                return pgSk.builtin.assk$(self.v.height);\n            }\n        });\n\n    };\n\n    mod.loadImage = new pgSk.builtin.func(function (imfile) {\n        var i = mod.processing.loadImage(imfile.v);\n        imList.push(i);\n\tvar image = pgSk.misceval.callsim(mod.PImage);\n\timage.v = i;\n        return image;\n    });\n\n    mod.image = new pgSk.builtin.func(function (im, x, y, w, h) {\n\t// image(img, x, y)\n\t// image(img, x, y, width, height)\n\tif (typeof(w) === \"undefined\") {\n            mod.processing.image(im.v, x.v, y.v);\n\t} else {\n            mod.processing.image(im.v, x.v, y.v, w.v, h.v);\n        }\n    });\n\n    mod.get = new pgSk.builtin.func(function (x, y) {\n        var clr = mod.processing.get(x.v, y.v);\n        return pgSk.misceval.callsim(mod.color,\n            new pgSk.builtin.int_(mod.processing.red(clr)),\n            new pgSk.builtin.int_(mod.processing.green(clr)),\n            new pgSk.builtin.int_(mod.processing.blue(clr)));\n    });\n\n    mod.set = new pgSk.builtin.func(function (x, y, color) {\n        mod.processing.set(x.v, y.v, color.v);\n    });\n\n    // --- classes\n\n    vectorClass = function ($gbl, $loc) {\n        $loc.__init__ = new pgSk.builtin.func(function (self, x, y, z) {\n\t    // PVector()\n\t    // PVector(x,y)\n\t    // PVector(x,y,z)\n            if (typeof(x) === \"undefined\") {\n\t\tself.v = new mod.processing.PVector();\n            } else if (typeof(z) === \"undefined\") {\n\t\tself.v = new mod.processing.PVector(x.v, y.v);\n            } else {\n\t\tself.v = new mod.processing.PVector(x.v, y.v, z.v);\n\t    }\n        });\n\n        $loc.__getattr__ = new pgSk.builtin.func(function (self, key) {\n\t    key = pgSk.ffi.remapToJs(key);\n            if (key === \"x\") {\n                return pgSk.builtin.assk$(self.v.x);\n            } else if (key === \"y\") {\n                return pgSk.builtin.assk$(self.v.y);\n            } else if (key === \"z\") {\n                return pgSk.builtin.assk$(self.v.z);\n\t    }\n\t});\n\t    \n        $loc.get = new pgSk.builtin.func(function (self) {\n\t    // get() Gets a copy of the vector\n            var new_vec = pgSk.misceval.callsim(mod.PVector);\n\t    new_vec.v = self.v.get();\n\t    return new_vec;\n\t});\n\t\n\t$loc.set = new pgSk.builtin.func(function (self, x, y, x) {\n\t    // set() Sets the x, y, z component of the vector\n\t    if (typeof(z) === \"undefined\") {\n\t\tself.v.set(x.v, y.v);\n\t    } else {\n\t\tself.v.set(x.v, y.v, z.v);\n\t    }\n\t});\n\n\t$loc.mag = new pgSk.builtin.func(function (self) {\n\t    // mag() Calculates the magnitude (length) of the vector\n\t    // and returns the result as a float\n\t    return pgSk.builtin.assk$(self.v.mag());\n\t});\n\n\t$loc.add = new pgSk.builtin.func(function (self, vec) {\n\t    // add()\tAdds one vector to another\n            var new_vec = pgSk.misceval.callsim(mod.PVector);\n\t    new_vec.v = self.v.add(vec.v);\n\t    return new_vec;\n\t});\n\n\t$loc.sub = new pgSk.builtin.func(function (self, vec) {\n\t    // sub()\tSubtracts one vector from another\n            var new_vec = pgSk.misceval.callsim(mod.PVector);\n\t    new_vec.v = self.v.sub(vec.v);\n\t    return new_vec;\n\t});\n\n\t$loc.mult = new pgSk.builtin.func(function (self, vec) {\n\t    // mult()\tMultiplies the vector by a scalar\n            var new_vec = pgSk.misceval.callsim(mod.PVector);\n\t    new_vec.v = self.v.mult(vec.v);\n\t    return new_vec;\n\t});\n\n\t$loc.div = new pgSk.builtin.func(function (self, vec) {\n\t    // div()\tDivides the vector by a scalar\n            var new_vec = pgSk.misceval.callsim(mod.PVector);\n\t    new_vec.v = self.v.dic(vec.v);\n\t    return new_vec;\n\t});\n\n\t$loc.dist = new pgSk.builtin.func(function (self, vec) {\n\t    // dist()\tCalculate the Euclidean distance between two points\n\t    return pgSk.builtin.assk$(self.v.dist(vec.v));\n\t});\n\n\t$loc.dot = new pgSk.builtin.func(function (self, v1, v2, v3) {\n\t    // dot()\tCalculates the dot product\n\t    // returns float\n\t    // vec.dot(x,y,z)\n\t    // vec.dot(v)\t    \n\t    if (typeof(v2) === 'undefined') {\n\t\treturn pgSk.builtin.assk$(self.v.dot(v1.v));\n\t    } else {\n\t\treturn pgSk.builtin.assk$(self.v.dot(v1.v, v2.v, v3.v));\n\t    }\n\t});\n\n\t$loc.cross = new pgSk.builtin.func(function (self, vec) {\n\t    // cross()\tCalculates the cross product\n            var new_vec = pgSk.misceval.callsim(mod.PVector);\n\t    new_vec.v = self.v.cross(vec.v);\n\t    return new_vec;\n\t});\n\n\t$loc.normalize = new pgSk.builtin.func(function (self) {\n\t    // normalize()\tNormalizes the vector\n\t    self.v.normalize();\n\t});\n\n\t$loc.limit = new pgSk.builtin.func(function (self, value) {\n\t    // limit()\tLimits the magnitude of the vector\n\t    self.v.limit(value.v);\n\t});\n\n\t$loc.angleBetween = new pgSk.builtin.func(function (self, vec) {\n\t    // angleBetween()\tCalculates the angle between two vectors\n\t    return pgSk.builtin.assk$(self.v.angleBetween(vec.v));\n\t});\n\n\t$loc.array = new pgSk.builtin.func(function (self) {\n\t    // array()\t\n\t    return new pgSk.builtin.list(self.v.array());\n\t});\n    };\n\n    fontClass = function ($gbl, $loc) {\n        $loc.__init__ = new pgSk.builtin.func(function (self, input) {\n\t    // PFont()\n\t    // PFont(input)\n            if (typeof(input) === \"undefined\") {\n\t\tself.v = new mod.processing.PFont();\n            } else {\n\t\tself.v = new mod.processing.PVector(input.v);\n\t    }\n        });\n\n        $loc.list = new pgSk.builtin.func(function (self) {\n\t    // font.list()\n\t    return new pgSk.builtin.list(self.v.list());\n\t});\n    };\n\n    graphicsClass = function ($gbl, $loc) {\n        $loc.__init__ = new pgSk.builtin.func(function (self, x, y, z) {\n\t    // PGraphics()\n\t    // PGraphics(width,height)\n\t    // PGraphics(width,height,applet)\n            if (typeof(x) === \"undefined\") {\n\t\tself.v = new mod.processing.PVector();\n            } else if (typeof(z) === \"undefined\") {\n\t\tself.v = new mod.processing.PVector(x.v, y.v);\n            } else {\n\t\tself.v = new mod.processing.PVector(x.v, y.v, z.v);\n\t    }\n        });\n\n        $loc.beginDraw = new pgSk.builtin.func(function (self) {\n\t    self.v.beginDraw();\n\t});\n\n        $loc.endDraw = new pgSk.builtin.func(function (self) {\n\t    self.v.endDraw();\n\t});\n    };\n    \n    shapeClass = function ($gbl, $loc) {\n        $loc.__init__ = new pgSk.builtin.func(function (self, arg1, arg2, arg3) {\n\t    if (typeof(arg1) === \"undefined\") {\n\t\t// special version for pgSkulpt\n\t\tself.v = null;\n\t\t// Will fill in manually in getChild()\n\t    } else if (typeof(arg2) === \"undefined\") {\n\t\tself.v = new mod.processing.PShapeSVG(arg1.v);\n\t    } else if (typeof(arg3) === \"undefined\") {\n\t\tself.v = new mod.processing.PShapeSVG(arg1.v, arg2.v);\n\t    } else {\n\t\tself.v = new mod.processing.PShapeSVG(arg1.v, arg2.v, arg3.v);\n\t    }\n        });\n\n        $loc.__getattr__ = new pgSk.builtin.func(function (self, key) {\n\t    key = pgSk.ffi.remapToJs(key);\n            if (key === \"width\") {\n                return pgSk.builtin.assk$(self.v.width);\n            } else if (key === \"height\") {\n                return pgSk.builtin.assk$(self.v.height);\n\t    }\n\t});\n\n        $loc.isVisible = new pgSk.builtin.func(function (self) {\n\t    // isVisible() Returns a boolean value \"true\" if the image is set to be visible, \"false\" if not\n\t    return new pgSk.builtin.bool(self.v.isVisible());\n\t});\n\n        $loc.setVisible = new pgSk.builtin.func(function (self, value) {\n\t    // setVisible() Sets the shape to be visible or invisible\n\t    self.v.setVisible(value.v);\n\t});\n\n        $loc.disableStyle = new pgSk.builtin.func(function (self) {\n\t    // disableStyle() Disables the shape's style data and uses Processing styles\n\t    self.v.disableStyle();\n\t});\n\n        $loc.enableStyle = new pgSk.builtin.func(function (self) {\n\t    // enableStyle() Enables the shape's style data and ignores the Processing styles\n\t    self.v.enableStyle();\n\t});\n\n        $loc.getChild = new pgSk.builtin.func(function (self, shape) {\n\t    // getChild() Returns a child element of a shape as a PShapeSVG object\n\t    var child = self.v.getChild(shape.v);\n\t    if (child != null) {\n\t\t// special method for pgSkulpt:\n\t\tvar new_shape = pgSk.misceval.callsim(mod.PShapeSVG);\n\t\t// Now fill in value:\n\t\tnew_shape.v = child;\n\t\treturn new_shape;\n\t    } else {\n\t\treturn null;\n\t    }\n\t});\n\n        $loc.translate = new pgSk.builtin.func(function (self, x, y, z) {\n\t    // translate() Displaces the shape\n\t    // sh.translate(x,y)\n\t    // sh.translate(x,y,z)\n            if (typeof(z) === \"undefined\") {\n\t\tself.v.translate(x.v, y.v);\n\t    } else {\n\t\tself.v.translate(x.v, y.v, z.v);\n\t    }\n\t});\n\n        $loc.rotate = new pgSk.builtin.func(function (self, angle) {\n\t    // rotate() Rotates the shape\n\t    self.v.rotate(angle.v);\n\t});\n\n        $loc.rotateX = new pgSk.builtin.func(function (self, angle) {\n\t    // rotateX() Rotates the shape around the x-axis\n\t    self.v.rotateX(angle.v);\n\t});\n\n        $loc.rotateY = new pgSk.builtin.func(function (self) {\n\t    // rotateY() Rotates the shape around the y-axis\n\t    self.v.rotateY(angle.v);\n\t});\n\n        $loc.rotateZ = new pgSk.builtin.func(function (self) {\n\t    // rotateZ() Rotates the shape around the z-axis\n\t    self.v.rotateZ(angle.v);\n\t});\n\n        $loc.scale = new pgSk.builtin.func(function (self, x, y, z) {\n\t    // scale() Increases and decreases the size of a shape\n\t    // sh.scale(size)\n\t    // sh.scale(x,y)\n\t    // sh.scale(x,y,z)\n            if (typeof(y) === \"undefined\") {\n\t\tself.v.scale(x.v);\n\t    } else if (typeof(z) === \"undefined\") {\n\t\tself.v.scale(x.v, y.v);\n\t    } else {\n\t\tself.v.scale(x.v, y.v, z.v);\n\t    }\n\t});\n    };\n\n    mod.PFont = pgSk.misceval.buildClass(mod, fontClass, \"PFont\", []);\n    mod.PGraphics = pgSk.misceval.buildClass(mod, graphicsClass, \"PGraphics\", []);\n    mod.PShapeSVG = pgSk.misceval.buildClass(mod, shapeClass, \"PShapeSVG\", []);\n    mod.PVector = pgSk.misceval.buildClass(mod, vectorClass, \"PVector\", []);\n    mod.PImage = pgSk.misceval.buildClass(mod, imageClass, \"PImage\", []);\n\n    return mod;\n};\n", "src/lib/code.py": "raise NotImplementedError(\"code is not yet implemented in pgSkulpt\")\n", "src/lib/UserDict.py": "raise NotImplementedError(\"UserDict is not yet implemented in pgSkulpt\")\n", "src/lib/codecs.py": "raise NotImplementedError(\"codecs is not yet implemented in pgSkulpt\")\n", "src/lib/tty.py": "raise NotImplementedError(\"tty is not yet implemented in pgSkulpt\")\n", "src/lib/pythonds/graphs/adjGraph.py": "#\n#  adjGraph\n#\n#  Created by Brad Miller on 2005-02-24.\n#  Copyright (c) 2005 Brad Miller, David Ranum, Luther College. All rights reserved.\n#\n\nimport sys\nimport os\nimport unittest\n\nclass Graph:\n    def __init__(self):\n        self.vertices = {}\n        self.numVertices = 0\n        \n    def addVertex(self,key):\n        self.numVertices = self.numVertices + 1\n        newVertex = Vertex(key)\n        self.vertices[key] = newVertex\n        return newVertex\n    \n    def getVertex(self,n):\n        if n in self.vertices:\n            return self.vertices[n]\n        else:\n            return None\n\n    def __contains__(self,n):\n        return n in self.vertices\n    \n    def addEdge(self,f,t,cost=0):\n            if f not in self.vertices:\n                nv = self.addVertex(f)\n            if t not in self.vertices:\n                nv = self.addVertex(t)\n            self.vertices[f].addNeighbor(self.vertices[t],cost)\n    \n    def getVertices(self):\n        return list(self.vertices.keys())\n        \n    def __iter__(self):\n        return iter(self.vertices.values())\n                \nclass Vertex:\n    def __init__(self,num):\n        self.id = num\n        self.connectedTo = {}\n        self.color = 'white'\n        self.dist = sys.maxsize\n        self.pred = None\n        self.disc = 0\n        self.fin = 0\n\n    # def __lt__(self,o):\n    #     return self.id < o.id\n    \n    def addNeighbor(self,nbr,weight=0):\n        self.connectedTo[nbr] = weight\n        \n    def setColor(self,color):\n        self.color = color\n        \n    def setDistance(self,d):\n        self.dist = d\n\n    def setPred(self,p):\n        self.pred = p\n\n    def setDiscovery(self,dtime):\n        self.disc = dtime\n        \n    def setFinish(self,ftime):\n        self.fin = ftime\n        \n    def getFinish(self):\n        return self.fin\n        \n    def getDiscovery(self):\n        return self.disc\n        \n    def getPred(self):\n        return self.pred\n        \n    def getDistance(self):\n        return self.dist\n        \n    def getColor(self):\n        return self.color\n    \n    def getConnections(self):\n        return self.connectedTo.keys()\n        \n    def getWeight(self,nbr):\n        return self.connectedTo[nbr]\n                \n    def __str__(self):\n        return str(self.id) + \":color \" + self.color + \":disc \" + str(self.disc) + \":fin \" + str(self.fin) + \":dist \" + str(self.dist) + \":pred \\n\\t[\" + str(self.pred)+ \"]\\n\"\n    \n    def getId(self):\n        return self.id\n\nclass adjGraphTests(unittest.TestCase):\n    def setUp(self):\n        self.tGraph = Graph()\n        \n    def testMakeGraph(self):\n        gFile = open(\"test.dat\")\n        for line in gFile:\n            fVertex, tVertex = line.split('|')\n            fVertex = int(fVertex)\n            tVertex = int(tVertex)\n            self.tGraph.addEdge(fVertex,tVertex)\n        for i in self.tGraph:\n            adj = i.getAdj()\n            for k in adj:\n                print(i, k)\n\n        \nif __name__ == '__main__':\n    unittest.main()\n              \n", "src/lib/macurl2path.py": "raise NotImplementedError(\"macurl2path is not yet implemented in pgSkulpt\")\n", "src/lib/new.py": "raise NotImplementedError(\"new is not yet implemented in pgSkulpt\")\n", "src/lib/whichdb.py": "raise NotImplementedError(\"whichdb is not yet implemented in pgSkulpt\")\n", "src/lib/_abcoll.py": "raise NotImplementedError(\"_abcoll is not yet implemented in pgSkulpt\")\n", "src/lib/hotshot/__init__.py": "raise NotImplementedError(\"hotshot is not yet implemented in pgSkulpt\")\n", "src/lib/MimeWriter.py": "raise NotImplementedError(\"MimeWriter is not yet implemented in pgSkulpt\")\n", "src/lib/sre_constants.py": "raise NotImplementedError(\"sre_constants is not yet implemented in pgSkulpt\")\n", "src/lib/atexit.py": "raise NotImplementedError(\"atexit is not yet implemented in pgSkulpt\")\n", "src/lib/compileall.py": "raise NotImplementedError(\"compileall is not yet implemented in pgSkulpt\")\n", "src/lib/symtable.py": "raise NotImplementedError(\"symtable is not yet implemented in pgSkulpt\")\n", "src/lib/warnings.py": "raise NotImplementedError(\"warnings is not yet implemented in pgSkulpt\")\n", "src/lib/operator.js": "/*\n *  __author__: Isaac Dontje Lindell (i@isaacdontjelindell.com)\n *\n *  Implementation of the Python operator module.\n */\n\nvar $builtinmodule = function (name) {\n    var mod = {};\n\n    mod.lt = new pgSk.builtin.func(function (a, b) {\n        return pgSk.builtin.bool(pgSk.misceval.richCompareBool(a, b, 'Lt'));\n    });\n    mod.__lt__ = mod.lt;\n\n    mod.le = new pgSk.builtin.func(function (a, b) {\n        return pgSk.builtin.bool(pgSk.misceval.richCompareBool(a, b, 'LtE'));\n    });\n    mod.__le__ = mod.le;\n\n    mod.eq = new pgSk.builtin.func(function (a, b) {\n        return pgSk.builtin.bool(pgSk.misceval.richCompareBool(a, b, 'Eq'));\n    });\n    mod.__eq__ = mod.eq;\n\n    mod.ne = new pgSk.builtin.func(function (a, b) {\n        return pgSk.builtin.bool(pgSk.misceval.richCompareBool(a, b, 'NotEq'));\n    });\n    mod.__ne__ = mod.ne;\n\n    mod.ge = new pgSk.builtin.func(function (a, b) {\n        return pgSk.builtin.bool(pgSk.misceval.richCompareBool(a, b, 'GtE'));\n    });\n    mod.__ge__ = mod.ge;\n\n    mod.gt = new pgSk.builtin.func(function (a, b) {\n        return pgSk.builtin.bool(pgSk.misceval.richCompareBool(a, b, 'Gt'));\n    });\n    mod.__gt__ = mod.gt;\n\n    mod.not_ = new pgSk.builtin.func(function (obj) {\n        throw new pgSk.builtin.NotImplementedError(\"operator.not_() is not yet implemented in pgSkulpt\");\n    });\n\n    mod.truth = new pgSk.builtin.func(function (obj) {\n        return pgSk.builtin.bool(obj);\n    });\n\n    mod.is_ = new pgSk.builtin.func(function (a, b) {\n        return pgSk.builtin.bool(pgSk.misceval.richCompareBool(a, b, 'Is'));\n    });\n\n    mod.is_not = new pgSk.builtin.func(function (a, b) {\n        return pgSk.builtin.bool(pgSk.misceval.richCompareBool(a, b, 'IsNot'));\n    });\n\n    mod.abs = new pgSk.builtin.func(function (obj) {\n        return pgSk.misceval.callsim(pgSk.builtin.abs, obj);\n    });\n    mod.__abs__ = mod.abs;\n\n    // The documentation says that operator.add() is defined for a and b numbers, but\n    // CPython (2.6) allows a and b to be other types (e.g. str)\n    mod.add = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.objectAdd(a, b);\n    });\n    mod.__add__ = mod.add;\n\n    mod.and_ = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.binary_op_(a, b, \"BitAnd\");\n    });\n    mod.__and__ = mod.and_;\n\n    mod.div = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.binary_op_(a, b, \"Div\");\n    });\n    mod.__div__ = mod.div;\n\n    mod.floordiv = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.binary_op_(a, b, \"FloorDiv\");\n    });\n    mod.__floordiv__ = mod.floordiv;\n\n    mod.index = new pgSk.builtin.func(function (a) {\n        return new pgSk.builtin.int_(pgSk.misceval.asIndex(a));\n    });\n    mod.__index__ = mod.index;\n\n    // Note: pgSk.abstr.numberUnaryOp(obj, 'Invert') looks for the function nb$invert() on obj.\n    // However, it doesn't look like that function has been implemented for any existing object types.\n    // I've gone ahead and created this function for completeness' sake, but expect any use of it to\n    // result in an error.\n    mod.inv = new pgSk.builtin.func(function (obj) {\n        return pgSk.abstr.numberUnaryOp(obj, 'Invert');\n    });\n    mod.__inv__ = mod.inv;\n    mod.invert = mod.inv;\n    mod.__invert__ = mod.inv;\n\n    mod.lshift = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.binary_op_(a, b, \"LShift\");\n    });\n    mod.__lshift__ = mod.lshift;\n\n    mod.mod = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.binary_op_(a, b, \"Mod\");\n    });\n    mod.__mod__ = mod.mod;\n\n    mod.divmod = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.binary_op_(a, b, \"DivMod\");\n    });\n    mod.__divmod__ = mod.divmod;\n\n    mod.mul = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.binary_op_(a, b, \"Mult\");\n    });\n    mod.__mul__ = mod.mul;\n\n    mod.neg = new pgSk.builtin.func(function (obj) {\n        return pgSk.abstr.objectNegative(obj);\n    });\n    mod.__neg__ = mod.neg;\n\n    mod.or_ = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.binary_op_(a, b, \"BitOr\");\n    });\n    mod.__or__ = mod.or_;\n\n    mod.pos = new pgSk.builtin.func(function (obj) {\n        return pgSk.abstr.objectPositive(obj);\n    });\n    mod.__pos__ = mod.pos;\n\n    mod.pow = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.binary_op_(a, b, \"Pow\");\n    });\n    mod.__pow__ = mod.pow;\n\n    mod.rshift = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.binary_op_(a, b, \"RShift\");\n    });\n    mod.__rshift__ = mod.rshift;\n\n    mod.sub = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.binary_op_(a, b, \"Sub\");\n    });\n    mod.__sub__ = mod.sub;\n\n    mod.truediv = mod.div;\n    mod.__truediv__ = mod.div;\n\n    mod.xor = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.binary_op_(a, b, \"BitXor\");\n    });\n    mod.__xor__ = mod.xor;\n\n    mod.concat = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.sequenceConcat(a, b);\n    });\n    mod.__concat__ = mod.concat;\n\n    mod.contains = new pgSk.builtin.func(function (a, b) {\n        return pgSk.builtin.bool(pgSk.abstr.sequenceContains(a, b));\n    });\n    mod.__contains__ = mod.contains;\n\n    mod.countOf = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.sequenceGetCountOf(a, b);\n    });\n\n    mod.delitem = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.sequenceDelItem(a, b);\n    });\n    mod.__delitem__ = mod.delitem;\n\n    mod.getitem = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.sequenceGetItem(a, b);\n    });\n    mod.__getitem__ = mod.getitem;\n\n    mod.indexOf = new pgSk.builtin.func(function (a, b) {\n        return pgSk.abstr.sequenceGetIndexOf(a, b);\n    });\n\n    mod.setitem = new pgSk.builtin.func(function (a, b, c) {\n        return pgSk.abstr.sequenceSetItem(a, b, c);\n    });\n    mod.__setitem__ = mod.setitem;\n\n    return mod;\n};\n", "src/lib/timeit.py": "raise NotImplementedError(\"timeit is not yet implemented in pgSkulpt\")\n", "src/lib/pythonds/basic/deque.py": "# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n#deque.py\n\n\nclass Deque:\n    def __init__(self):\n        self.items = []\n\n    def isEmpty(self):\n        return self.items == []\n\n    def addFront(self, item):\n        self.items.append(item)\n\n    def addRear(self, item):\n        self.items.insert(0,item)\n\n    def removeFront(self):\n        return self.items.pop()\n\n    def removeRear(self):\n        return self.items.pop(0)\n\n    def size(self):\n        return len(self.items)\n", "src/lib/sgmllib.py": "raise NotImplementedError(\"sgmllib is not yet implemented in pgSkulpt\")\n", "src/lib/pprint.py": "raise NotImplementedError(\"pprint is not yet implemented in pgSkulpt\")\n", "src/lib/mutex.py": "raise NotImplementedError(\"mutex is not yet implemented in pgSkulpt\")\n", "src/lib/xml/sax/__init__.py": "raise NotImplementedError(\"sax is not yet implemented in pgSkulpt\")\n", "src/lib/mimetypes.py": "raise NotImplementedError(\"mimetypes is not yet implemented in pgSkulpt\")\n", "src/lib/aifc.py": "raise NotImplementedError(\"aifc is not yet implemented in pgSkulpt\")\n", "src/lib/webgl/matrix4.js": "// more from 'tdl'\nvar $builtinmodule = function(name)\n{\n    var mod = {};\n\n    var temp0v3_ = new Float32Array(3);\n    var temp1v3_ = new Float32Array(3);\n    var temp2v3_ = new Float32Array(3);\n\n    var temp0v4_ = new Float32Array(4);\n    var temp1v4_ = new Float32Array(4);\n    var temp2v4_ = new Float32Array(4);\n\n    var temp0m4_ = new Float32Array(16);\n    var temp1m4_ = new Float32Array(16);\n    var temp2m4_ = new Float32Array(16);\n\n    var normalize = function(dst, a) {\n        var n = 0.0;\n        var aLength = a.length;\n        for (var i = 0; i < aLength; ++i)\n            n += a[i] * a[i];\n        n = Math.sqrt(n);\n        if (n > 0.00001) {\n            for (var i = 0; i < aLength; ++i)\n                dst[i] = a[i] / n;\n        } else {\n            for (var i = 0; i < aLength; ++i)\n                dst[i] = 0;\n        }\n        return dst;\n    };\n\n    var cross = function(dst, a, b) {\n        dst[0] = a[1] * b[2] - a[2] * b[1];\n        dst[1] = a[2] * b[0] - a[0] * b[2];\n        dst[2] = a[0] * b[1] - a[1] * b[0];\n        return dst;\n    };\n\n    var subVector = function(dst, a, b) {\n        var aLength = a.length;\n        for (var i = 0; i < aLength; ++i)\n            dst[i] = a[i] - b[i];\n        return dst;\n    };\n\n    var dot = function(a, b) {\n        return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n    };\n\n    mod.lookAt = new pgSk.builtin.func(function(view, eye, target, up)\n            {\n                var t0 = temp0v3_;\n                var t1 = temp1v3_;\n                var t2 = temp2v3_;\n\n                var vz = normalize(t0, subVector(t0, eye.v, target.v));\n                var vx = normalize(t1, cross(t1, up.v, vz));\n                var vy = cross(t2, vz, vx);\n\n                var dst = view.v;\n                dst[ 0] = vx[0];\n                dst[ 1] = vy[0];\n                dst[ 2] = vz[0];\n                dst[ 3] = 0;\n                dst[ 4] = vx[1];\n                dst[ 5] = vy[1];\n                dst[ 6] = vz[1];\n                dst[ 7] = 0;\n                dst[ 8] = vx[2];\n                dst[ 9] = vy[2];\n                dst[10] = vz[2];\n                dst[11] = 0;\n                dst[12] = -dot(vx, eye.v);\n                dst[13] = -dot(vy, eye.v);\n                dst[14] = -dot(vz, eye.v);\n                dst[15] = 1;\n\n                return view;\n            });\n\n    mod.perspective = new pgSk.builtin.func(function(proj, angle, aspect, near, far)\n            {\n                var f = Math.tan(Math.PI * 0.5 - 0.5 * (angle * Math.PI / 180));\n                var rangeInv = 1.0 / (near - far);\n\n                var dst = proj.v;\n\n                dst[0]  = f / aspect;\n                dst[1]  = 0;\n                dst[2]  = 0;\n                dst[3]  = 0;\n\n                dst[4]  = 0;\n                dst[5]  = f;\n                dst[6]  = 0;\n                dst[7]  = 0;\n\n                dst[8]  = 0;\n                dst[9]  = 0;\n                dst[10] = (near + far) * rangeInv;\n                dst[11] = -1;\n\n                dst[12] = 0;\n                dst[13] = 0;\n                dst[14] = near * far * rangeInv * 2;\n                dst[15] = 0;\n\n                return proj;\n            });\n\n    // builds, not appending\n    mod.rotationY = new pgSk.builtin.func(function(target, angle)\n            {\n                var dst = target.v;\n                var c = Math.cos(angle * Math.PI / 180);\n                var s = Math.sin(angle * Math.PI / 180);\n\n                dst[ 0] = c;\n                dst[ 1] = 0;\n                dst[ 2] = -s;\n                dst[ 3] = 0;\n                dst[ 4] = 0;\n                dst[ 5] = 1;\n                dst[ 6] = 0;\n                dst[ 7] = 0;\n                dst[ 8] = s;\n                dst[ 9] = 0;\n                dst[10] = c;\n                dst[11] = 0;\n                dst[12] = 0;\n                dst[13] = 0;\n                dst[14] = 0;\n                dst[15] = 1;\n\n                return target;\n            });\n\n    mod.identity = new pgSk.builtin.func(function(target)\n            {\n                var dst = target.v;\n                dst[ 0] = 1;\n                dst[ 1] = 0;\n                dst[ 2] = 0;\n                dst[ 3] = 0;\n                dst[ 4] = 0;\n                dst[ 5] = 1;\n                dst[ 6] = 0;\n                dst[ 7] = 0;\n                dst[ 8] = 0;\n                dst[ 9] = 0;\n                dst[10] = 1;\n                dst[11] = 0;\n                dst[12] = 0;\n                dst[13] = 0;\n                dst[14] = 0;\n                dst[15] = 1;\n                return target;\n            });\n\n    // row major\n    mod.mul = new pgSk.builtin.func(function(target, x, y)\n            {\n                var dst = target.v;\n                var a = x.v;\n                var b = y.v;\n                var a00 = a[0];\n                var a01 = a[1];\n                var a02 = a[2];\n                var a03 = a[3];\n                var a10 = a[ 4 + 0];\n                var a11 = a[ 4 + 1];\n                var a12 = a[ 4 + 2];\n                var a13 = a[ 4 + 3];\n                var a20 = a[ 8 + 0];\n                var a21 = a[ 8 + 1];\n                var a22 = a[ 8 + 2];\n                var a23 = a[ 8 + 3];\n                var a30 = a[12 + 0];\n                var a31 = a[12 + 1];\n                var a32 = a[12 + 2];\n                var a33 = a[12 + 3];\n                var b00 = b[0];\n                var b01 = b[1];\n                var b02 = b[2];\n                var b03 = b[3];\n                var b10 = b[ 4 + 0];\n                var b11 = b[ 4 + 1];\n                var b12 = b[ 4 + 2];\n                var b13 = b[ 4 + 3];\n                var b20 = b[ 8 + 0];\n                var b21 = b[ 8 + 1];\n                var b22 = b[ 8 + 2];\n                var b23 = b[ 8 + 3];\n                var b30 = b[12 + 0];\n                var b31 = b[12 + 1];\n                var b32 = b[12 + 2];\n                var b33 = b[12 + 3];\n                dst[ 0] = a00 * b00 + a01 * b10 + a02 * b20 + a03 * b30;\n                dst[ 1] = a00 * b01 + a01 * b11 + a02 * b21 + a03 * b31;\n                dst[ 2] = a00 * b02 + a01 * b12 + a02 * b22 + a03 * b32;\n                dst[ 3] = a00 * b03 + a01 * b13 + a02 * b23 + a03 * b33;\n                dst[ 4] = a10 * b00 + a11 * b10 + a12 * b20 + a13 * b30;\n                dst[ 5] = a10 * b01 + a11 * b11 + a12 * b21 + a13 * b31;\n                dst[ 6] = a10 * b02 + a11 * b12 + a12 * b22 + a13 * b32;\n                dst[ 7] = a10 * b03 + a11 * b13 + a12 * b23 + a13 * b33;\n                dst[ 8] = a20 * b00 + a21 * b10 + a22 * b20 + a23 * b30;\n                dst[ 9] = a20 * b01 + a21 * b11 + a22 * b21 + a23 * b31;\n                dst[10] = a20 * b02 + a21 * b12 + a22 * b22 + a23 * b32;\n                dst[11] = a20 * b03 + a21 * b13 + a22 * b23 + a23 * b33;\n                dst[12] = a30 * b00 + a31 * b10 + a32 * b20 + a33 * b30;\n                dst[13] = a30 * b01 + a31 * b11 + a32 * b21 + a33 * b31;\n                dst[14] = a30 * b02 + a31 * b12 + a32 * b22 + a33 * b32;\n                dst[15] = a30 * b03 + a31 * b13 + a32 * b23 + a33 * b33;\n                return target;\n            });\n\n    mod.invert = new pgSk.builtin.func(function(target, mat)\n            {\n                var dst = target.v;\n                var m = mat.v;\n                var m00 = m[0 * 4 + 0];\n                var m01 = m[0 * 4 + 1];\n                var m02 = m[0 * 4 + 2];\n                var m03 = m[0 * 4 + 3];\n                var m10 = m[1 * 4 + 0];\n                var m11 = m[1 * 4 + 1];\n                var m12 = m[1 * 4 + 2];\n                var m13 = m[1 * 4 + 3];\n                var m20 = m[2 * 4 + 0];\n                var m21 = m[2 * 4 + 1];\n                var m22 = m[2 * 4 + 2];\n                var m23 = m[2 * 4 + 3];\n                var m30 = m[3 * 4 + 0];\n                var m31 = m[3 * 4 + 1];\n                var m32 = m[3 * 4 + 2];\n                var m33 = m[3 * 4 + 3];\n                var tmp_0  = m22 * m33;\n                var tmp_1  = m32 * m23;\n                var tmp_2  = m12 * m33;\n                var tmp_3  = m32 * m13;\n                var tmp_4  = m12 * m23;\n                var tmp_5  = m22 * m13;\n                var tmp_6  = m02 * m33;\n                var tmp_7  = m32 * m03;\n                var tmp_8  = m02 * m23;\n                var tmp_9  = m22 * m03;\n                var tmp_10 = m02 * m13;\n                var tmp_11 = m12 * m03;\n                var tmp_12 = m20 * m31;\n                var tmp_13 = m30 * m21;\n                var tmp_14 = m10 * m31;\n                var tmp_15 = m30 * m11;\n                var tmp_16 = m10 * m21;\n                var tmp_17 = m20 * m11;\n                var tmp_18 = m00 * m31;\n                var tmp_19 = m30 * m01;\n                var tmp_20 = m00 * m21;\n                var tmp_21 = m20 * m01;\n                var tmp_22 = m00 * m11;\n                var tmp_23 = m10 * m01;\n\n                var t0 = (tmp_0 * m11 + tmp_3 * m21 + tmp_4 * m31) -\n                    (tmp_1 * m11 + tmp_2 * m21 + tmp_5 * m31);\n                var t1 = (tmp_1 * m01 + tmp_6 * m21 + tmp_9 * m31) -\n                    (tmp_0 * m01 + tmp_7 * m21 + tmp_8 * m31);\n                var t2 = (tmp_2 * m01 + tmp_7 * m11 + tmp_10 * m31) -\n                    (tmp_3 * m01 + tmp_6 * m11 + tmp_11 * m31);\n                var t3 = (tmp_5 * m01 + tmp_8 * m11 + tmp_11 * m21) -\n                    (tmp_4 * m01 + tmp_9 * m11 + tmp_10 * m21);\n\n                var d = 1.0 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n                dst[ 0] = d * t0;\n                dst[ 1] = d * t1;\n                dst[ 2] = d * t2;\n                dst[ 3] = d * t3;\n                dst[ 4] = d * ((tmp_1 * m10 + tmp_2 * m20 + tmp_5 * m30) -\n                        (tmp_0 * m10 + tmp_3 * m20 + tmp_4 * m30));\n                dst[ 5] = d * ((tmp_0 * m00 + tmp_7 * m20 + tmp_8 * m30) -\n                        (tmp_1 * m00 + tmp_6 * m20 + tmp_9 * m30));\n                dst[ 6] = d * ((tmp_3 * m00 + tmp_6 * m10 + tmp_11 * m30) -\n                        (tmp_2 * m00 + tmp_7 * m10 + tmp_10 * m30));\n                dst[ 7] = d * ((tmp_4 * m00 + tmp_9 * m10 + tmp_10 * m20) -\n                        (tmp_5 * m00 + tmp_8 * m10 + tmp_11 * m20));\n                dst[ 8] = d * ((tmp_12 * m13 + tmp_15 * m23 + tmp_16 * m33) -\n                        (tmp_13 * m13 + tmp_14 * m23 + tmp_17 * m33));\n                dst[ 9] = d * ((tmp_13 * m03 + tmp_18 * m23 + tmp_21 * m33) -\n                        (tmp_12 * m03 + tmp_19 * m23 + tmp_20 * m33));\n                dst[10] = d * ((tmp_14 * m03 + tmp_19 * m13 + tmp_22 * m33) -\n                        (tmp_15 * m03 + tmp_18 * m13 + tmp_23 * m33));\n                dst[11] = d * ((tmp_17 * m03 + tmp_20 * m13 + tmp_23 * m23) -\n                        (tmp_16 * m03 + tmp_21 * m13 + tmp_22 * m23));\n                dst[12] = d * ((tmp_14 * m22 + tmp_17 * m32 + tmp_13 * m12) -\n                        (tmp_16 * m32 + tmp_12 * m12 + tmp_15 * m22));\n                dst[13] = d * ((tmp_20 * m32 + tmp_12 * m02 + tmp_19 * m22) -\n                        (tmp_18 * m22 + tmp_21 * m32 + tmp_13 * m02));\n                dst[14] = d * ((tmp_18 * m12 + tmp_23 * m32 + tmp_15 * m02) -\n                        (tmp_22 * m32 + tmp_14 * m02 + tmp_19 * m12));\n                dst[15] = d * ((tmp_22 * m22 + tmp_16 * m02 + tmp_21 * m12) -\n                        (tmp_20 * m12 + tmp_23 * m22 + tmp_17 * m02));\n                return target;\n            });\n\n    mod.transpose = new pgSk.builtin.func(function(target, mat)\n            {\n                var dst = target.v;\n                var m = mat.v;\n                for (var j = 0; j < 4; ++j) {\n                    for (var i = 0; i < 4; ++i)\n                    dst[j * 4 + i] = m[i * 4 + j];\n                }\n                return dst;\n            });\n\n    return mod;\n};\n", "src/lib/idlelib/__init__.py": "raise NotImplementedError(\"idlelib is not yet implemented in pgSkulpt\")\n", "src/lib/formatter.py": "raise NotImplementedError(\"formatter is not yet implemented in pgSkulpt\")\n", "src/lib/tabnanny.py": "raise NotImplementedError(\"tabnanny is not yet implemented in pgSkulpt\")\n", "src/lib/pythonds/graphs/priorityQueue.py": "# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \nimport unittest\n\n# this implementation of binary heap takes key value pairs,\n# we will assume that the keys are all comparable\n\nclass PriorityQueue:\n    def __init__(self):\n        self.heapArray = [(0,0)]\n        self.currentSize = 0\n\n    def buildHeap(self,alist):\n        self.currentSize = len(alist)\n        self.heapArray = [(0,0)]\n        for i in alist:\n            self.heapArray.append(i)\n        i = len(alist) // 2            \n        while (i > 0):\n            self.percDown(i)\n            i = i - 1\n                        \n    def percDown(self,i):\n        while (i * 2) <= self.currentSize:\n            mc = self.minChild(i)\n            if self.heapArray[i][0] > self.heapArray[mc][0]:\n                tmp = self.heapArray[i]\n                self.heapArray[i] = self.heapArray[mc]\n                self.heapArray[mc] = tmp\n            i = mc\n                \n    def minChild(self,i):\n        if i*2 > self.currentSize:\n            return -1\n        else:\n            if i*2 + 1 > self.currentSize:\n                return i*2\n            else:\n                if self.heapArray[i*2][0] < self.heapArray[i*2+1][0]:\n                    return i*2\n                else:\n                    return i*2+1\n\n    def percUp(self,i):\n        while i // 2 > 0:\n            if self.heapArray[i][0] < self.heapArray[i//2][0]:\n               tmp = self.heapArray[i//2]\n               self.heapArray[i//2] = self.heapArray[i]\n               self.heapArray[i] = tmp\n            i = i//2\n \n    def add(self,k):\n        self.heapArray.append(k)\n        self.currentSize = self.currentSize + 1\n        self.percUp(self.currentSize)\n\n    def delMin(self):\n        retval = self.heapArray[1][1]\n        self.heapArray[1] = self.heapArray[self.currentSize]\n        self.currentSize = self.currentSize - 1\n        self.heapArray.pop()\n        self.percDown(1)\n        return retval\n        \n    def isEmpty(self):\n        if self.currentSize == 0:\n            return True\n        else:\n            return False\n\n    def decreaseKey(self,val,amt):\n        # this is a little wierd, but we need to find the heap thing to decrease by\n        # looking at its value\n        done = False\n        i = 1\n        myKey = 0\n        while not done and i <= self.currentSize:\n            if self.heapArray[i][1] == val:\n                done = True\n                myKey = i\n            else:\n                i = i + 1\n        if myKey > 0:\n            self.heapArray[myKey] = (amt,self.heapArray[myKey][1])\n            self.percUp(myKey)\n            \n    def __contains__(self,vtx):\n        for pair in self.heapArray:\n            if pair[1] == vtx:\n                return True\n        return False\n        \nclass TestBinHeap(unittest.TestCase):\n    def setUp(self):\n        self.theHeap = PriorityQueue()\n        self.theHeap.add((2,'x'))\n        self.theHeap.add((3,'y'))\n        self.theHeap.add((5,'z'))\n        self.theHeap.add((6,'a'))\n        self.theHeap.add((4,'d'))\n\n\n    def testInsert(self):\n        assert self.theHeap.currentSize == 5\n\n    def testDelmin(self):\n        assert self.theHeap.delMin() == 'x'\n        assert self.theHeap.delMin() == 'y'\n    \n    def testDecKey(self):\n        self.theHeap.decreaseKey('d',1)\n        assert self.theHeap.delMin() == 'd'\n        \nif __name__ == '__main__':\n    unittest.main()\n", "src/lib/base64.py": "raise NotImplementedError(\"base64 is not yet implemented in pgSkulpt\")\n", "src/lib/site.py": "raise NotImplementedError(\"site is not yet implemented in pgSkulpt\")\n", "src/lib/abc.py": "raise NotImplementedError(\"abc is not yet implemented in pgSkulpt\")\n", "src/lib/email/mime/__init__.py": "raise NotImplementedError(\"mime is not yet implemented in pgSkulpt\")\n", "src/builtin/this.py": "s = \"\"\"Gur Mra bs Clguba, ol Gvz Crgref\n\nOrnhgvshy vf orggre guna htyl.\nRkcyvpvg vf orggre guna vzcyvpvg.\nFvzcyr vf orggre guna pbzcyrk.\nPbzcyrk vf orggre guna pbzcyvpngrq.\nSyng vf orggre guna arfgrq.\nFcnefr vf orggre guna qrafr.\nErnqnovyvgl pbhagf.\nFcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.\nNygubhtu cenpgvpnyvgl orngf chevgl.\nReebef fubhyq arire cnff fvyragyl.\nHayrff rkcyvpvgyl fvyraprq.\nVa gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff.\nGurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg.\nNygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu.\nAbj vf orggre guna arire.\nNygubhtu arire vf bsgra orggre guna *evtug* abj.\nVs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn.\nVs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn.\nAnzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!\"\"\"\n\nd = {}\nfor c in (65, 97):\n    for i in range(26):\n        d[chr(i+c)] = chr((i+13) % 26 + c)\n\nprint \"\".join([d.get(c, c) for c in s])\n", "src/lib/inspect.py": "raise NotImplementedError(\"inspect is not yet implemented in pgSkulpt\")\n", "src/lib/multiprocessing/dummy/__init__.py": "raise NotImplementedError(\"dummy is not yet implemented in pgSkulpt\")\n", "src/lib/xml/__init__.py": "raise NotImplementedError(\"xml is not yet implemented in pgSkulpt\")\n", "src/lib/pythonds/trees/binheap.py": "# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n\n# this heap takes key value pairs, we will assume that the keys are integers\nclass BinHeap:\n    def __init__(self):\n        self.heapList = [0]\n        self.currentSize = 0\n\n\n    def buildHeap(self,alist):\n        i = len(alist) // 2\n        self.currentSize = len(alist)\n        self.heapList = [0] + alist[:]\n        print(len(self.heapList), i)\n        while (i > 0):\n            print(self.heapList, i)\n            self.percDown(i)\n            i = i - 1\n        print(self.heapList,i)\n                        \n    def percDown(self,i):\n        while (i * 2) <= self.currentSize:\n            mc = self.minChild(i)\n            if self.heapList[i] > self.heapList[mc]:\n                tmp = self.heapList[i]\n                self.heapList[i] = self.heapList[mc]\n                self.heapList[mc] = tmp\n            i = mc\n                \n    def minChild(self,i):\n        if i * 2 + 1 > self.currentSize:\n            return i * 2\n        else:\n            if self.heapList[i * 2] < self.heapList[i * 2 + 1]:\n                return i * 2\n            else:\n                return i * 2 + 1\n\n    def percUp(self,i):\n        while i // 2 > 0:\n            if self.heapList[i] < self.heapList[i//2]:\n               tmp = self.heapList[i // 2]\n               self.heapList[i // 2] = self.heapList[i]\n               self.heapList[i] = tmp\n            i = i // 2\n \n    def insert(self,k):\n        self.heapList.append(k)\n        self.currentSize = self.currentSize + 1\n        self.percUp(self.currentSize)\n\n    def delMin(self):\n        retval = self.heapList[1]\n        self.heapList[1] = self.heapList[self.currentSize]\n        self.currentSize = self.currentSize - 1\n        self.heapList.pop()\n        self.percDown(1)\n        return retval\n        \n    def isEmpty(self):\n        if currentSize == 0:\n            return True\n        else:\n            return False\n", "src/lib/distutils/__init__.py": "raise NotImplementedError(\"distutils is not yet implemented in pgSkulpt\")\n", "src/lib/urllib/__init__.js": "var $builtinmodule = function (name) {\n    var urllib = {};\n\n    return urllib;\n};\n", "src/lib/pty.py": "raise NotImplementedError(\"pty is not yet implemented in pgSkulpt\")\n", "src/lib/urllib2.py": "raise NotImplementedError(\"urllib2 is not yet implemented in pgSkulpt\")\n", "src/lib/Queue.py": "raise NotImplementedError(\"Queue is not yet implemented in pgSkulpt\")\n", "src/lib/time.js": "/*\n implementation of the Python time package.\n\n notes:\n - struct_time is a structseq but structseq does not implement methods: 'n_fields', 'n_sequence_fields', 'n_unnamed_fields' yet\n\n ['__doc__', '__file__', '__name__', '__package__', 'accept2dyear', 'altzone', 'asctime', 'clock', 'ctime', 'daylight', 'gmtime', 'localtime', 'mktime', 'sleep', 'strftime', 'strptime', 'struct_time', 'time', 'timezone', 'tzname', 'tzset']\n */\n\nvar $builtinmodule = function (name) {\n    var mod = {};\n\n    mod.__file__ = \"/src/lib/time/__init__.js\";\n\n    mod.__package__ = pgSk.builtin.none.none$;\n\n    var struct_time_fields = {\n        \"tm_year\": \"year, for example, 1993\",\n        \"tm_mon\": \"month of year, range [1, 12]\",\n        \"tm_mday\": \"day of month, range [1, 31]\",\n        \"tm_hour\": \"hours, range [0, 23]\",\n        \"tm_min\": \"minutes, range [0, 59]\",\n        \"tm_sec\": \"seconds, range [0, 61]\",\n        \"tm_wday\": \"day of week, range [0, 6], Monday is 0\",\n        \"tm_yday\": \"day of year, range [1, 366]\",\n        \"tm_isdst\": \"1 if summer time is in effect, 0 if not, and -1 if unknown\"\n    };\n\n    var struct_time_f = pgSk.builtin.make_structseq('time', 'struct_time', struct_time_fields);\n\n    mod.struct_time = struct_time_f;\n\n    function check_struct_time(t) {\n        if (!(t instanceof struct_time_f)) {\n            throw new pgSk.builtin.TypeError(\"Required argument 'struct_time' must be of type: 'struct_time'\");\n        }\n        var i;\n        var len = t.v.length;\n        var obj = t.v;\n        for (i = 0; i < len; ++i) {\n            if (!pgSk.builtin.checkInt(obj[i])) {\n                throw new pgSk.builtin.TypeError(\"struct_time may only contain integers\");\n            }\n        }\n        return true;\n    }\n\n    mod.time = new pgSk.builtin.func(function () {\n        pgSk.builtin.pyCheckArgs(\"time\", arguments, 0, 0);\n        var res = Date.now();\n        if (this.performance && this.performance.now)\n        {\n            res = res + performance.now() % 1;\n        }\n        return pgSk.builtin.assk$(res / 1000, undefined);\n    });\n\n    // This is an experimental implementation of time.sleep(), using suspensions\n    mod.sleep = new pgSk.builtin.func(function(delay) {\n        pgSk.builtin.pyCheckArgs(\"sleep\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"delay\", \"float\", pgSk.builtin.checkNumber(delay));\n\n        return new pgSk.misceval.promiseToSuspension(new Promise(function(resolve) {\n            pgSk.setTimeout(function() {\n                resolve(pgSk.builtin.none.none$);\n            }, pgSk.ffi.remapToJs(delay)*1000);\n        }));\n    });\n\n    function padLeft(str, l, c) {\n        var _str = str.toString();\n        return Array(l - _str.length + 1).join(c || \" \") + _str;\n    }\n\n    function isLeapYear(year) {\n        if((year & 3) != 0) return false;\n        return ((year % 100) != 0 || (year % 400) == 0);\n    }\n\n    function getDayOfYear(date,utc) {\n        utc = utc || false;\n        var dayCount = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];\n        var mn = utc ? date.getUTCMonth() : date.getMonth();\n        var dn = utc ? date.getUTCDate() : date.getDate();\n        var dayOfYear = dayCount[mn] + dn;\n        if(mn > 1 && isLeapYear(utc ? date.getUTCFullYear() : date.getFullYear())) dayOfYear++;\n        return dayOfYear;\n    }\n\n    function stdTimezoneOffset() {\n        var jan = new Date(2002, 0, 1);\n        var jul = new Date(2002, 6, 1);\n        return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());\n    }\n\n    function altTimezoneOffset() {\n        var jan = new Date(2002, 0, 1);\n        var jul = new Date(2002, 6, 1);\n        return Math.min(jan.getTimezoneOffset(), jul.getTimezoneOffset());\n    }\n\n    function dst(date) {\n        return date.getTimezoneOffset() < stdTimezoneOffset();\n    }\n\n    function timeZoneName(date) {\n        var i = /\\((.*)\\)/.exec(date.toString());\n        return i ? i[1] : \"UTC\";\n    }\n\n    function timeZoneNames() {\n        var jan = new Date(2002, 0, 1);\n        var jul = new Date(2002, 6, 1);\n        if (dst(jan)) {\n            return [pgSk.builtin.str(timeZoneName(jul)), pgSk.builtin.str(timeZoneName(jan))];\n        } else {\n            return [pgSk.builtin.str(timeZoneName(jan)), pgSk.builtin.str(timeZoneName(jul))];\n        }\n    }\n\n    function date_to_struct_time(date, utc) {\n        utc = utc || false;\n        // y, m, d, hh, mm, ss, weekday, jday, dst\n        return new struct_time_f(\n            [\n                pgSk.builtin.assk$(utc ? date.getUTCFullYear() : date.getFullYear()),\n                pgSk.builtin.assk$((utc ? date.getUTCMonth() : date.getMonth()) + 1), // want January == 1\n                pgSk.builtin.assk$(utc ? date.getUTCDate() : date.getDate()),\n                pgSk.builtin.assk$(utc ? date.getUTCHours() : date.getHours()),\n                pgSk.builtin.assk$(utc ? date.getUTCMinutes() : date.getMinutes()),\n                pgSk.builtin.assk$(utc ? date.getUTCSeconds() : date.getSeconds()),\n                pgSk.builtin.assk$(((utc ? date.getUTCDay() : date.getDay()) + 6) % 7), // Want Monday == 0\n                pgSk.builtin.assk$(getDayOfYear(date, utc)), // Want January, 1 == 1\n                pgSk.builtin.assk$(utc ? 0 : (dst(date) ? 1 : 0)) // 1 for DST /0 for non-DST /-1 for unknown\n            ]\n        );\n    }\n\n    function localtime_f(secs) {\n        pgSk.builtin.pyCheckArgs(\"localtime\", arguments, 0, 1);\n        var d = new Date();\n        if (secs) {\n            pgSk.builtin.pyCheckType(\"secs\", \"number\", pgSk.builtin.checkNumber(secs));\n            var seconds = pgSk.builtin.asnum$(secs);\n            d.setTime(seconds * 1000);\n        }\n        return date_to_struct_time(d);\n    }\n\n    mod.localtime = new pgSk.builtin.func(localtime_f);\n\n    mod.gmtime = new pgSk.builtin.func(function(secs) {\n        pgSk.builtin.pyCheckArgs(\"localtime\", arguments, 0, 1);\n        var d = new Date();\n        if (secs) {\n            pgSk.builtin.pyCheckType(\"secs\", \"number\", pgSk.builtin.checkNumber(secs));\n            var seconds = pgSk.builtin.asnum$(secs);\n            d.setTime(seconds * 1000);\n        }\n        return date_to_struct_time(d, true);\n    });\n\n    var monthnames = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\n    var daynames = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\n    function asctime_f(time) {\n        if (!time || pgSk.builtin.checkNone(time))\n        {\n            time = localtime_f();\n        } else if (!(time instanceof struct_time_f)) {\n            time = new struct_time_f(time);\n        }\n        if (time instanceof pgSk.builtin.tuple && time.v.length == 9)\n        {\n            // todo: test validity??\n            var parts = [];\n            parts.push(daynames[pgSk.builtin.asnum$(time.v[6])]);\n            parts.push(monthnames[pgSk.builtin.asnum$(time.v[1])-1]);\n            parts.push(padLeft(pgSk.builtin.asnum$(time.v[2]).toString(), 2, '0'));\n            parts.push(\n                padLeft(pgSk.builtin.asnum$(time.v[3]).toString(), 2, '0') + \":\" +\n                padLeft(pgSk.builtin.asnum$(time.v[4]).toString(), 2, '0') + \":\" +\n                padLeft(pgSk.builtin.asnum$(time.v[5]).toString(), 2, '0')\n            );\n            parts.push(padLeft(pgSk.builtin.asnum$(time.v[0]).toString(), 4, '0'));\n\n            return pgSk.builtin.str(parts.join(\" \"));\n        }\n    }\n\n    mod.asctime = new pgSk.builtin.func(asctime_f);\n\n    mod.ctime = new pgSk.builtin.func(function(secs) {\n        return asctime_f(localtime_f(secs));\n    });\n\n    function mktime_f(time) {\n        if (time instanceof pgSk.builtin.tuple && time.v.length == 9)\n        {\n            var d = new Date(pgSk.builtin.asnum$(time.v[0]),\n                             pgSk.builtin.asnum$(time.v[1])-1,\n                             pgSk.builtin.asnum$(time.v[2]),\n                             pgSk.builtin.asnum$(time.v[3]),\n                             pgSk.builtin.asnum$(time.v[4]),\n                             pgSk.builtin.asnum$(time.v[5]));\n            return pgSk.builtin.assk$(d.getTime() / 1000, undefined);\n        } else {\n            throw new pgSk.builtin.TypeError(\"mktime() requires a struct_time or 9-tuple\");\n        }\n    }\n\n    mod.mktime = new pgSk.builtin.func(mktime_f);\n\n    /*\n    The offset of the local (non-DST) timezone, in seconds west of UTC (negative in most of Western Europe,\n    positive in the US, zero in the UK).\n    */\n    mod.timezone = new pgSk.builtin.int_(stdTimezoneOffset() * 60);\n\n    /*\n    The offset of the local DST timezone, in seconds west of UTC, if one is defined. This is negative if the\n    local DST timezone is east of UTC (as in Western Europe, including the UK). Only use this if daylight is nonzero.\n    */\n    mod.altzone = new pgSk.builtin.int_(altTimezoneOffset() * 60);\n\n    /*\n    Nonzero if a DST timezone is defined.\n    */\n    mod.daylight = new pgSk.builtin.int_(dst(new Date()) ? 1 : 0);\n\n    /*\n    A tuple of two strings: the first is the name of the local non-DST timezone, the second is the name of the local\n    DST timezone. If no DST timezone is defined, the second string should not be used.\n    */\n    mod.tzname = pgSk.builtin.tuple(timeZoneNames());\n\n    mod.accept2dyear = pgSk.builtin.assk$(1, pgSk.builtin.nmber.int$);\n\n    mod.clock = new pgSk.builtin.func(function() {\n        var res = 0.0;\n        if (this.performance && this.performance.now)\n        {\n            res = performance.now() / 1000;\n        } else {\n            res = new Date().getTime() / 1000;\n        }\n        return new pgSk.builtin.float_(res);\n    });\n\n    function strftime_f(format, t) {\n        var jsFormat;\n\n        pgSk.builtin.pyCheckArgs(\"strftime\", arguments, 1, 2);\n        if (!pgSk.builtin.checkString(format)) {\n            throw new pgSk.builtin.TypeError(\"format must be a string\");\n        }\n        if (!t)\n        {\n            t = localtime_f();\n        } else if (!(t instanceof struct_time_f)) {\n            t = new struct_time_f(t);\n        }\n\n        check_struct_time(t);\n\n        jsFormat = pgSk.ffi.remapToJs(format);\n\n        return pgSk.ffi.remapToPy(strftime(jsFormat, new Date(mktime_f(t).v*1000)));\n    }\n\n    mod.strftime = new pgSk.builtin.func(strftime_f);\n\n    function tzset_f()\n    {\n        throw new pgSk.builtin.NotImplementedError(\"time.tzset() is not yet implemented\");\n        pgSk.builtin.pyCheckArgs(\"tzset\", arguments, 0, 0);\n    }\n\n    mod.tzset = new pgSk.builtin.func(tzset_f);\n\n    function strptime_f(s, format)\n    {\n        pgSk.builtin.pyCheckArgs(\"strptime\", arguments, 1, 2);\n        pgSk.builtin.pyCheckType(\"string\", \"string\", pgSk.builtin.checkString(s));\n        if (format !== undefined) {\n            pgSk.builtin.pyCheckType(\"format\", \"string\", pgSk.builtin.checkString(format));\n        } else {\n            format = new pgSk.builtin.str(\"%a %b %d %H:%M:%S %Y\");\n        }\n\n        return date_to_struct_time(strptime(pgSk.ffi.remapToJs(s), pgSk.ffi.remapToJs(format), true));\n    }\n\n    mod.strptime = new pgSk.builtin.func(strptime_f);\n\n    return mod;\n};\n", "src/lib/pythonds/basic/stack.py": "# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n#stack.py\n\nclass Stack:\n    def __init__(self):\n        self.items = []\n\n    def isEmpty(self):\n        return self.items == []\n\n    def push(self, item):\n        self.items.append(item)\n\n    def pop(self):\n        return self.items.pop()\n\n    def peek(self):\n        return self.items[len(self.items)-1]\n\n    def size(self):\n        return len(self.items)\n\n", "src/lib/sndhdr.py": "raise NotImplementedError(\"sndhdr is not yet implemented in pgSkulpt\")\n", "src/lib/codeop.py": "raise NotImplementedError(\"codeop is not yet implemented in pgSkulpt\")\n", "src/lib/getpass.py": "raise NotImplementedError(\"getpass is not yet implemented in pgSkulpt\")\n", "src/lib/anydbm.py": "raise NotImplementedError(\"anydbm is not yet implemented in pgSkulpt\")\n", "src/lib/urlparse.py": "raise NotImplementedError(\"urlparse is not yet implemented in pgSkulpt\")\n", "src/lib/CGIHTTPServer.py": "raise NotImplementedError(\"CGIHTTPServer is not yet implemented in pgSkulpt\")\n", "src/lib/fnmatch.py": "raise NotImplementedError(\"fnmatch is not yet implemented in pgSkulpt\")\n", "src/lib/HTMLParser.py": "raise NotImplementedError(\"HTMLParser is not yet implemented in pgSkulpt\")\n", "src/lib/calendar.py": "raise NotImplementedError(\"calendar is not yet implemented in pgSkulpt\")\n", "src/lib/compiler/__init__.py": "raise NotImplementedError(\"compiler is not yet implemented in pgSkulpt\")\n", "src/lib/pydoc.py": "raise NotImplementedError(\"pydoc is not yet implemented in pgSkulpt\")\n", "src/lib/multifile.py": "raise NotImplementedError(\"multifile is not yet implemented in pgSkulpt\")\n", "src/lib/pythonds/trees/balance.py": "#!/bin/env python3.1\n# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005, 2010\n# \n\nfrom .bst import BinarySearchTree, TreeNode\n\nclass AVLTree(BinarySearchTree):\n    '''\n    Author:  Brad Miller\n    Date:  1/15/2005\n    Description:  Imlement a binary search tree with the following interface\n                  functions:  \n                  __contains__(y) <==> y in x\n                  __getitem__(y) <==> x[y]\n                  __init__()\n                  __len__() <==> len(x)\n                  __setitem__(k,v) <==> x[k] = v\n                  clear()\n                  get(k)\n                  has_key(k)\n                  items() \n                  keys() \n                  values()\n                  put(k,v)\n    '''\n\n\n    def _put(self,key,val,currentNode):\n        if key < currentNode.key:\n            if currentNode.hasLeftChild():\n                self._put(key,val,currentNode.leftChild)\n            else:\n                currentNode.leftChild = TreeNode(key,val,parent=currentNode)\n                self.updateBalance(currentNode.leftChild)\n        else:\n            if currentNode.hasRightChild():\n                self._put(key,val,currentNode.rightChild)\n            else:\n                currentNode.rightChild = TreeNode(key,val,parent=currentNode)\n                self.updateBalance(currentNode.rightChild)                \n\n    def updateBalance(self,node):\n        if node.balanceFactor > 1 or node.balanceFactor < -1:\n            self.rebalance(node)\n            return\n        if node.parent != None:\n            if node.isLeftChild():\n                node.parent.balanceFactor += 1\n            elif node.isRightChild():\n                node.parent.balanceFactor -= 1\n\n            if node.parent.balanceFactor != 0:\n                self.updateBalance(node.parent)\n\n    def rebalance(self,node):\n        if node.balanceFactor < 0:\n            if node.rightChild.balanceFactor > 0:\n                # Do an LR Rotation\n                self.rotateRight(node.rightChild)\n                self.rotateLeft(node)\n            else:\n                # single left\n                self.rotateLeft(node)\n        elif node.balanceFactor > 0:\n            if node.leftChild.balanceFactor < 0:\n                # Do an RL Rotation\n                self.rotateLeft(node.leftChild)\n                self.rotateRight(node)\n            else:\n                # single right\n                self.rotateRight(node)\n\n    def rotateLeft(self,rotRoot):\n        newRoot = rotRoot.rightChild\n        rotRoot.rightChild = newRoot.leftChild\n        if newRoot.leftChild != None:\n            newRoot.leftChild.parent = rotRoot\n        newRoot.parent = rotRoot.parent\n        if rotRoot.isRoot():\n            self.root = newRoot\n        else:\n            if rotRoot.isLeftChild():\n                rotRoot.parent.leftChild = newRoot\n            else:\n                rotRoot.parent.rightChild = newRoot\n        newRoot.leftChild = rotRoot\n        rotRoot.parent = newRoot\n        rotRoot.balanceFactor = rotRoot.balanceFactor + 1 - min(newRoot.balanceFactor, 0)\n        newRoot.balanceFactor = newRoot.balanceFactor + 1 + max(rotRoot.balanceFactor, 0)\n\n\n    def rotateRight(self,rotRoot):\n        newRoot = rotRoot.leftChild\n        rotRoot.leftChild = newRoot.rightChild\n        if newRoot.rightChild != None:\n            newRoot.rightChild.parent = rotRoot\n        newRoot.parent = rotRoot.parent\n        if rotRoot.isRoot():\n            self.root = newRoot\n        else:\n            if rotRoot.isRightChild():\n                rotRoot.parent.rightChild = newRoot\n            else:\n                rotRoot.parent.leftChild = newRoot\n        newRoot.rightChild = rotRoot\n        rotRoot.parent = newRoot\n        rotRoot.balanceFactor = rotRoot.balanceFactor - 1 - max(newRoot.balanceFactor, 0)\n        newRoot.balanceFactor = newRoot.balanceFactor - 1 + min(rotRoot.balanceFactor, 0)\n        \n", "src/lib/lib2to3/pgen2/__init__.py": "raise NotImplementedError(\"pgen2 is not yet implemented in pgSkulpt\")\n", "src/lib/dbhash.py": "raise NotImplementedError(\"dbhash is not yet implemented in pgSkulpt\")\n", "src/lib/ihooks.py": "raise NotImplementedError(\"ihooks is not yet implemented in pgSkulpt\")\n", "src/lib/lib2to3/tests/__init__.py": "raise NotImplementedError(\"tests is not yet implemented in pgSkulpt\")\n", "src/lib/genericpath.py": "raise NotImplementedError(\"genericpath is not yet implemented in pgSkulpt\")\n", "src/lib/unittest/__init__.py": "__author__ = 'bmiller'\n'''\nThis is the start of something that behaves like\nthe unittest module from cpython.\n\n'''\n\nclass TestCase:\n    def __init__(self):\n        self.numPassed = 0\n        self.numFailed = 0\n        self.assertPassed = 0\n        self.assertFailed = 0\n        self.verbosity = 1\n        self.tlist = []\n        testNames = {}\n        for name in dir(self):\n            if name[:4] == 'test' and name not in testNames:\n                self.tlist.append(getattr(self,name))\n                testNames[name]=True\n\n    def setUp(self):\n        pass\n\n    def tearDown(self):\n        pass\n    \n    def cleanName(self,funcName):\n    # work around skulpts lack of an __name__\n        funcName = str(funcName)\n        funcName = funcName[13:]\n        funcName = funcName[:funcName.find('<')-3]\n        return funcName\n\n    def main(self):\n\n        for func in self.tlist:\n            if self.verbosity > 1:\n                print('Running %s' % self.cleanName(func))\n            try:\n                self.setUp()\n                self.assertPassed = 0\n                self.assertFailed = 0\n                func()\n                self.tearDown()\n                if self.assertFailed == 0:\n                    self.numPassed += 1\n                else:\n                    self.numFailed += 1\n                    print('Tests failed in %s ' % self.cleanName(func))\n            except Exception as e:\n                self.assertFailed += 1\n                self.numFailed += 1\n                print('Test threw exception in %s (%s)' % (self.cleanName(func), e))\n        self.showSummary()\n\n    def assertEqual(self, actual, expected, feedback=\"\"):\n        res = actual==expected\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to equal %s\" % (str(actual),str(expected))\n        self.appendResult(res, actual ,expected, feedback)\n\n    def assertNotEqual(self, actual, expected, feedback=\"\"):\n        res = actual != expected\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to not equal %s\" % (str(actual),str(expected))\n        self.appendResult(res, actual, expected, feedback)\n\n    def assertTrue(self,x, feedback=\"\"):\n        res = bool(x) is True\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to be True\" % (str(x))\n        self.appendResult(res, x, True, feedback)\n\n    def assertFalse(self,x, feedback=\"\"):\n        res = not bool(x)\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to be False\" % (str(x))\n        self.appendResult(res, x, False, feedback)\n\n    def assertIs(self,a,b, feedback=\"\"):\n        res = a is b\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to be the same object as %s\" % (str(a),str(b))\n        self.appendResult(res, a, b, feedback)\n\n    def assertIsNot(self,a,b, feedback=\"\"):\n        res = a is not b\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to not be the same object as %s\" % (str(a),str(b))\n        self.appendResult(res, a, b, feedback)\n\n    def assertIsNone(self,x, feedback=\"\"):\n        res = x is None\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to be None\" % (str(x))\n        self.appendResult(res, x, None, feedback)\n\n    def assertIsNotNone(self,x, feedback=\"\"):\n        res = x is not None\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to not be None\" % (str(x))\n        self.appendResult(res, x, None, feedback)\n\n    def assertIn(self, a, b, feedback=\"\"):\n        res = a in b\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to be in %s\" % (str(a),str(b))\n        self.appendResult(res, a, b, feedback)\n\n    def assertNotIn(self, a, b, feedback=\"\"):\n        res = a not in b\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to not be in %s\" % (str(a),str(b))\n        self.appendResult(res, a, b, feedback)\n\n    def assertIsInstance(self,a,b, feedback=\"\"):\n        res = isinstance(a,b)\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to be an instance of %s\" % (str(a), str(b))\n        self.appendResult(res, a, b, feedback)\n\n    def assertNotIsInstance(self,a,b, feedback=\"\"):\n        res = not isinstance(a,b)\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to not be an instance of %s\" % (str(a),str(b))\n        self.appendResult(res, a, b, feedback)\n\n    def assertAlmostEqual(self, a, b, places=7, feedback=\"\", delta=None):\n\n        if delta is not None:\n            res = abs(a-b) <= delta\n        else:\n            if places is None:\n                places = 7\n            res = round(a-b, places) == 0\n        \n        if not res and feedback == \"\":\n            feedback = \"Expected %s to equal %s\" % (str(a),str(b))\n        self.appendResult(res, a, b, feedback)\n\n    def assertNotAlmostEqual(self, a, b, places=7, feedback=\"\", delta=None):\n\n        if delta is not None:\n            res = not (a == b) and abs(a - b) > delta\n        else:\n            if places is None:\n                places = 7\n            res = round(a-b, places) != 0\n\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to not equal %s\" % (str(a),str(b))\n        self.appendResult(res, a, b, feedback)\n\n\n    def assertGreater(self,a,b, feedback=\"\"):\n        res = a > b\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to be greater than %s\" % (str(a),str(b))\n        self.appendResult(res, a, b, feedback)\n\n    def assertGreaterEqual(self,a,b, feedback=\"\"):\n        res = a >= b\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to be >= %s\" % (str(a),str(b))\n        self.appendResult(res, a, b, feedback)\n\n    def assertLess(self, a, b, feedback=\"\"):\n        res = a < b\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to be less than %s\" % (str(a),str(b))\n        self.appendResult(res, a, b, feedback)\n\n    def assertLessEqual(self,a,b, feedback=\"\"):\n        res = a <= b\n        if not res and feedback == \"\":\n            feedback = \"Expected %s to be <= %s\" % (str(a),str(b))\n        self.appendResult(res, a, b, feedback)\n\n    def appendResult(self,res,actual,expected,feedback):\n        if res:\n            msg = 'Pass'\n            self.assertPassed += 1\n        else:\n            msg = 'Fail: ' +  feedback\n            print(msg)\n            self.assertFailed += 1\n\n    def assertRaises(self, exception, callable=None, *args, **kwds):\n        # with is currently not supported hence we just try and catch\n        if callable is None:\n            raise NotImplementedError(\"assertRaises does currently not support assert contexts\")\n        if kwds:\n            raise NotImplementedError(\"assertRaises does currently not support **kwds\")\n\n        res = False\n        actualerror = str(exception())\n        try:\n            callable(*args)\n        except exception as ex:\n            res = True\n        except Exception as inst:\n            actualerror = str(inst)\n            print(\"ACT = \", actualerror, str(exception()))\n        else:\n            actualerror = \"No Error\"\n\n        self.appendResult(res, str(exception()), actualerror, \"\")\n\n    def fail(self, msg=None):\n        if msg is None:\n            msg = 'Fail'\n        else:\n            msg = 'Fail: ' + msg\n        print(msg)\n        self.assertFailed += 1\n\n    def showSummary(self):\n        pct = self.numPassed / (self.numPassed+self.numFailed) * 100\n        print(\"Ran %d tests, passed: %d failed: %d\\n\" % (self.numPassed+self.numFailed,\n                                               self.numPassed, self.numFailed))\n\n\n\ndef main(verbosity=1):\n    glob = globals() # globals() still needs work\n    for name in glob:\n        if issubclass(glob[name],TestCase):\n            try:\n                tc = glob[name]()\n                tc.verbosity = verbosity\n                tc.main()\n            except:\n                print(\"Uncaught Error in: \", name)\n", "src/lib/webgl/__init__.js": "var $builtinmodule = function(name)\n{\n  var mod = {};\n\n  var makeFailHTML = function(msg) {\n    return '' +\n      '<table style=\"background-color: #8CE; width: 100%; height: 100%;\"><tr>' +\n      '<td align=\"center\">' +\n      '<div style=\"display: table-cell; vertical-align: middle;\">' +\n      '<div style=\"\">' + msg + '</div>' +\n      '</div>' +\n      '</td></tr></table>';\n  };\n\n  var GET_A_WEBGL_BROWSER = '' +\n    'This page requires a browser that supports WebGL.<br/>' +\n    '<a href=\"http://get.webgl.org\">Click here to upgrade your browser.</a>';\n\n  var NEED_HARDWARE = '' +\n    \"It doesn't appear your computer can support WebGL.<br/>\" +\n    '<a href=\"http://get.webgl.org\">Click here for more information.</a>';\n  \n  var create3DContext = function(canvas) {\n    var names = [\"webgl\", \"experimental-webgl\", \"webkit-3d\", \"moz-webgl\"];\n    var gl = null;\n    for (var ii = 0; ii < names.length; ++ii) {\n      try {\n        gl = canvas.getContext(names[ii]);\n      }\n      catch(e) {\n      }\n      if (gl) {\n          break;\n      }\n    }\n    if (gl) {\n      // Disallow selection by default. This keeps the cursor from changing to an\n      // I-beam when the user clicks and drags. It's easier on the eyes.\n      function returnFalse() {\n        return false;\n      }\n\n      canvas.onselectstart = returnFalse;\n      canvas.onmousedown = returnFalse;\n    }\n    return gl;\n  };\n\n  var setupWebGL = function(canvasContainerId, opt_canvas) {\n    var container = document.getElementById(canvasContainerId);\n    var context;\n    if (!opt_canvas) {\n      opt_canvas = container.getElementsByTagName(\"canvas\")[0];\n    }\n    if (!opt_canvas) {\n        // this browser doesn't support the canvas tag at all. Not even 2d.\n      container.innerHTML = makeFailHTML(GET_A_WEBGL_BROWSER);\n      return;\n    }\n\n    var gl = create3DContext(opt_canvas);\n    if (!gl) {\n      // TODO(gman): fix to official way to detect that it's the user's machine, not the browser.\n      var browserStrings = navigator.userAgent.match(/(\\w+\\/.*? )/g);\n      var browsers = {};\n      try {\n        for (var b = 0; b < browserStrings.length; ++b) {\n          var parts = browserStrings[b].match(/(\\w+)/g);\n          var bb = [];\n          for (var ii = 1; ii < parts.length; ++ii) {\n            bb.push(parseInt(parts[ii]));\n          }\n          browsers[parts[0]] = bb;\n        }\n      }\n      catch (e) {\n      }\n      if (browsers.Chrome &&\n           (browsers.Chrome[0] > 7 ||\n                 (browsers.Chrome[0] == 7 && browsers.Chrome[1] > 0) ||\n                 (browsers.Chrome[0] == 7 && browsers.Chrome[1] == 0 && browsers.Chrome[2] >= 521))) {\n        container.innerHTML = makeFailHTML(NEED_HARDWARE);\n      }\n      else {\n        container.innerHTML = makeFailHTML(GET_A_WEBGL_BROWSER);\n      }\n    }\n    return gl;\n  };\n\n  /**\n   * The Context encapsulates the underlying WebGL native JavaScript API.\n   */\n  mod.Context = pgSk.misceval.buildClass(mod, function($gbl, $loc) {\n    $loc.__init__ = new pgSk.builtin.func(\n      function(self, canvasid) {\n        var canvas = document.getElementById(canvasid.v);\n        var gl = setupWebGL(canvasid.v, canvas)\n        if (!gl) {\n          throw new Error(\"Your browser does not appear to support WebGL.\");\n        }\n\n        self.gl = gl;\n\n        // Copy symbolic constants and functions from native WebGL, encapsulating where necessary.       \n        for (var k in gl.__proto__) {\n          if (typeof gl.__proto__[k] === 'number') {\n            pgSk.abstr.objectSetItem(self['$d'], new pgSk.builtin.str(k), gl.__proto__[k]);\n          }\n          else if (typeof gl.__proto__[k] === \"function\") {\n            switch(k) {\n              case 'bufferData': {\n              }\n              break;\n              case 'clearColor': {\n              }\n              break;\n              case 'drawArrays': {\n              }\n              break;\n              case 'getAttribLocation': {\n              }\n              break;\n              case 'getUniformLocation': {\n              }\n              break;\n              case 'shaderSource': {\n              }\n              break;\n              case 'uniformMatrix4fv': {\n              }\n              break;\n              case 'vertexAttribPointer': {\n              }\n              break;\n              case 'viewport': {\n              }\n              break;\n              default: {\n                (function(key) {\n                  pgSk.abstr.objectSetItem(self['$d'], new pgSk.builtin.str(k), new pgSk.builtin.func(function() {\n                    var f = gl.__proto__[key];\n                    return f.apply(gl, arguments);\n                  }));\n                 }(k));\n              }\n            }\n          }\n        }\n\n        gl.clearColor(100.0/255.0, 149.0/255.0, 237.0/255.0, 1.0);\n        gl.clear(gl.COLOR_BUFFER_BIT);\n      }\n    );\n\n    $loc.tp$getattr = pgSk.builtin.object.prototype.GenericGetAttr;\n\n    $loc.bufferData = new pgSk.builtin.func(\n      function(self, target, data, usage) {\n        self.gl.bufferData(target, data.v, usage);\n      }\n    );\n\n    $loc.clearColor = new pgSk.builtin.func(\n      function(self, red, green, blue, alpha) {\n        self.gl.clearColor(pgSk.builtin.asnum$(red), pgSk.builtin.asnum$(green), pgSk.builtin.asnum$(blue), pgSk.builtin.asnum$(alpha));\n      }\n    );\n\n    $loc.getAttribLocation = new pgSk.builtin.func(\n      function(self, program, name) {\n        return self.gl.getAttribLocation(program, name.v);\n      }\n    );\n\n    $loc.getUniformLocation = new pgSk.builtin.func(\n      function(self, program, name) {\n        return self.gl.getUniformLocation(program, name.v);\n      }\n    );\n\n    $loc.shaderSource = new pgSk.builtin.func(\n      function(self, shader, src) {\n        self.gl.shaderSource(shader, src.v);\n      }\n    );\n\n    $loc.drawArrays = new pgSk.builtin.func(\n      function(self, mode, first, count) {\n        self.gl.drawArrays(pgSk.builtin.asnum$(mode), pgSk.builtin.asnum$(first), pgSk.builtin.asnum$(count));\n      }\n    );\n\n    $loc.vertexAttribPointer = new pgSk.builtin.func(\n      function(self, index, size, type, normalized, stride, dunno) {\n        self.gl.vertexAttribPointer(index, pgSk.builtin.asnum$(size), pgSk.builtin.asnum$(type), normalized, pgSk.builtin.asnum$(stride), pgSk.builtin.asnum$(dunno));\n      }\n    );\n\n    $loc.viewport = new pgSk.builtin.func(\n      function(self, x, y, width, height) {\n        self.gl.viewport(pgSk.builtin.asnum$(x), pgSk.builtin.asnum$(y), pgSk.builtin.asnum$(width), pgSk.builtin.asnum$(height));\n      }\n    );\n\n    $loc.uniformMatrix4fv = new pgSk.builtin.func(\n      function(self, location, transpose, values) {\n//        console.log(\"location  \" + (typeof location));\n//        console.log(\"transpose \" + (typeof transpose));\n//        console.log(\"values.v  \" + (typeof values.v));\n        self.gl.uniformMatrix4fv(pgSk.builtin.asnum$(location), transpose, values.v);\n      }\n    );\n\n    $loc.setDrawFunc = new pgSk.builtin.func(function(self, func) {\n      var startTime = (new Date()).getTime();\n      var intervalId = setInterval(\n        function() {\n          pgSk.misceval.callsim(func, self, (new Date()).getTime() - startTime);\n        }, 1000.0 / 60.0); // 60 fps\n    });\n\n  }, 'Context', []);\n\n  mod.Float32Array = pgSk.misceval.buildClass(mod, function($gbl, $loc) {\n    $loc.__init__ = new pgSk.builtin.func(function(self, data) {\n      if (typeof data === \"number\") {\n        self.v = new Float32Array(data);\n      }\n      else {\n        self.v = new Float32Array(pgSk.ffi.remapToJs(data));\n      }\n    });\n\n    $loc.__repr__ = new pgSk.builtin.func(function(self) {\n      var copy = [];\n      for (var i = 0; i < self.v.length; ++i) {\n        copy.push(self.v[i]);\n      }\n      return new pgSk.builtin.str(\"[\" + copy.join(', ') + \"]\");\n     });\n  }, 'Float32Array', []);\n\n  /**\n   * A 4x4 (mutable) matrix suitable for OpenGL.\n   *\n   * Mutability is chosen for performance.\n   * The inderlying implementation is Float32Array.\n   * The indexing of the elements is\n   * 0 4  8 12\n   * 1 5  9 13\n   * 2 6 10 14\n   * 3 7 11 15\n   */\n  mod.Matrix4x4 = pgSk.misceval.buildClass(mod, function($gbl, $loc) {\n    $loc.__init__ = new pgSk.builtin.func(function(self, data) {\n      self.v = new Float32Array(pgSk.ffi.remapToJs(data));\n    });\n\n    $loc.identity = new pgSk.builtin.func(\n      function(self) {\n\n        var m = self.v;\n\n        m[0]  = 1;\n        m[1]  = 0;\n        m[2]  = 0;\n        m[3]  = 0;\n\n        m[4]  = 0;\n        m[5]  = 1;\n        m[6]  = 0;\n        m[7]  = 0;\n\n        m[8]  = 0;\n        m[9]  = 0;\n        m[10] = 1;\n        m[11] = 0;\n\n        m[12] = 0;\n        m[13] = 0;\n        m[14] = 0;\n        m[15] = 1;\n      }\n    );\n\n    $loc.perspective = new pgSk.builtin.func(\n      function(self, fov, aspect, near, far) {\n        \n        var t = Math.tan(Math.PI * 0.5 - 0.5 * (pgSk.builtin.asnum$(fov) * Math.PI / 180));\n        var a = pgSk.builtin.asnum$(aspect)\n        var n = pgSk.builtin.asnum$(near)\n        var f = pgSk.builtin.asnum$(far)\n        var k = 1.0 / (n - f);\n\n        var m = self.v;\n\n        m[0]  = t / a;\n        m[1]  = 0;\n        m[2]  = 0;\n        m[3]  = 0;\n\n        m[4]  = 0;\n        m[5]  = t;\n        m[6]  = 0;\n        m[7]  = 0;\n\n        m[8]  = 0;\n        m[9]  = 0;\n        m[10] = (n + f) * k;\n        m[11] = -1;\n\n        m[12] = 0;\n        m[13] = 0;\n        m[14] = n * f * k * 2;\n        m[15] = 0;\n      }\n    );\n\n    $loc.translate = new pgSk.builtin.func(\n      function(self, translation) {\n\n        var m = self.v;\n        var t = pgSk.ffi.remapToJs(translation);\n\n        m[0]  = 1;\n        m[1]  = 0;\n        m[2]  = 0;\n        m[3]  = 0;\n\n        m[4]  = 0;\n        m[5]  = 1;\n        m[6]  = 0;\n        m[7]  = 0;\n\n        m[8]  = 0;\n        m[9]  = 0;\n        m[10] = 1;\n        m[11] = 0;\n\n        m[12] = t[0];\n        m[13] = t[1];\n        m[14] = t[2];\n        m[15] = 1;\n      }\n    );\n\n    $loc.__repr__ = new pgSk.builtin.func(function(self) {\n      var copy = [];\n      for (var i = 0; i < self.v.length; ++i) {\n        copy.push(self.v[i]);\n      }\n      return new pgSk.builtin.str(\"[\" + copy.join(', ') + \"]\");\n     });\n  }, 'Matrix4x4', []);\n\n  return mod;\n};", "src/lib/fpformat.py": "raise NotImplementedError(\"fpformat is not yet implemented in pgSkulpt\")\n", "src/lib/xml/parsers/__init__.py": "raise NotImplementedError(\"parsers is not yet implemented in pgSkulpt\")\n", "src/lib/modulefinder.py": "raise NotImplementedError(\"modulefinder is not yet implemented in pgSkulpt\")\n", "src/lib/config/__init__.py": "raise NotImplementedError(\"config is not yet implemented in pgSkulpt\")\n", "src/lib/trace.py": "raise NotImplementedError(\"trace is not yet implemented in pgSkulpt\")\n", "src/lib/__phello__.foo.py": "raise NotImplementedError(\"__phello__.foo is not yet implemented in pgSkulpt\")\n", "src/lib/urllib/request/__init__.js": "var $builtinmodule = function (name) {\n    var request = {};\n\n\n    //~ Classes .................................................................\n\n    // Response class\n    //\n    // Response objects are returned by the request, get, post, etc.\n    // methods, allowing the user to access the response text, status\n    // code, and other information.\n\n    // ------------------------------------------------------------\n    var response = function ($gbl, $loc) {\n\n        // ------------------------------------------------------------\n        $loc.__init__ = new pgSk.builtin.func(function (self, xhr) {\n            self.data$ = xhr.responseText;\n            self.lineList = self.data$.split(\"\\n\");\n            self.lineList = self.lineList.slice(0, -1);\n            for (var i = 0; i < self.lineList.length; i++) {\n                self.lineList[i] = self.lineList[i] + '\\n';\n            }\n            self.currentLine = 0;\n            self.pos$ = 0;\n        });\n\n\n        // ------------------------------------------------------------\n        $loc.__str__ = new pgSk.builtin.func(function (self) {\n            return pgSk.ffi.remapToPy('<Response>');\n        });\n\n\n        // ------------------------------------------------------------\n        $loc.__iter__ = new pgSk.builtin.func(function (self) {\n            var allLines = self.lineList;\n\n            return pgSk.builtin.makeGenerator(function () {\n                if (this.$index >= this.$lines.length) {\n                    return undefined;\n                }\n                return new pgSk.builtin.str(this.$lines[this.$index++]);\n            }, {\n                $obj  : self,\n                $index: 0,\n                $lines: allLines\n            });\n        });\n\n\n        // ------------------------------------------------------------\n        $loc.read = new pgSk.builtin.func(function (self, size) {\n            if (self.closed) {\n                throw new pgSk.builtin.ValueError(\"I/O operation on closed file\");\n            }\n            var len = self.data$.length;\n            if (size === undefined) {\n                size = len;\n            }\n            var ret = new pgSk.builtin.str(self.data$.substr(self.pos$, size));\n            self.pos$ += size;\n            if (self.pos$ >= len) {\n                self.pos$ = len;\n            }\n            return ret;\n        });\n\n\n        // ------------------------------------------------------------\n        $loc.readline = new pgSk.builtin.func(function (self, size) {\n            var line = \"\";\n            if (self.currentLine < self.lineList.length) {\n                line = self.lineList[self.currentLine];\n                self.currentLine++;\n            }\n            return new pgSk.builtin.str(line);\n        });\n\n\n        // ------------------------------------------------------------\n        $loc.readlines = new pgSk.builtin.func(function (self, sizehint) {\n            var arr = [];\n            for (var i = self.currentLine; i < self.lineList.length; i++) {\n                arr.push(new pgSk.builtin.str(self.lineList[i]));\n            }\n            return new pgSk.builtin.list(arr);\n        });\n\n    };\n\n    request.Response =\n        pgSk.misceval.buildClass(request, response, 'Response', []);\n\n\n    //~ Module functions ........................................................\n\n    // ------------------------------------------------------------\n    /**\n     * Constructs and sends a Request. Returns Response object.\n     *\n     * http://docs.python-requests.org/en/latest/api/#requests.request\n     *\n     * For now, this implementation doesn't actually construct a Request\n     * object; it just makes the request through jQuery.ajax and then\n     * constructs a Response.\n     */\n    request.urlopen = new pgSk.builtin.func(function (url, data, timeout) {\n        var prom = new Promise(function(resolve, reject) {\n            var xmlhttp = new XMLHttpRequest();\n\n            xmlhttp.addEventListener(\"loadend\", function (e) {\n                resolve(pgSk.misceval.callsim(request.Response, xmlhttp));\n            });\n\n            if (!data) {\n                xmlhttp.open(\"GET\", url.v);\n                xmlhttp.send(null);\n            } else {\n                xmlhttp.open(\"POST\", url.v);\n                xmlhttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n                xmlhttp.setRequestHeader(\"Content-length\", data.v.length);\n                xmlhttp.send(data.v);\n            }\n        });\n\n        var susp = new pgSk.misceval.Suspension();\n\n        susp.resume = function() {\n            return resolution;\n        };\n\n        susp.data = {\n            type: \"pgSk.promise\",\n            promise: prom.then(function(value) {\n                resolution = value;\n                return value;\n            }, function(err) {\n                resolution = \"\";\n                return err;\n            })\n        };\n\n        return susp;\n    });\n\n\n    return request;\n};\n", "src/lib/wave.py": "raise NotImplementedError(\"wave is not yet implemented in pgSkulpt\")\n", "src/lib/mailcap.py": "raise NotImplementedError(\"mailcap is not yet implemented in pgSkulpt\")\n", "src/lib/datetime.py": "\"\"\"Concrete date/time and related types -- prototype implemented in Python.\n\nSee http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage\n\nSee also http://dir.yahoo.com/Reference/calendars/\n\nFor a primer on DST, including many current DST rules, see\nhttp://webexhibits.org/daylightsaving/\n\nFor more about DST than you ever wanted to know, see\nftp://elsie.nci.nih.gov/pub/\n\nSources for time zone and DST data: http://www.twinsun.com/tz/tz-link.htm\n\nThis was originally copied from the sandbox of the CPython CVS repository.\nThanks to Tim Peters for suggesting using it.\n\nThis was then copied from PyPy v5.1.0 into pgSkulpt by Meredydd Luff, removing\n'from __future__ import division' (and replacing division operators accordingly)\nand pickle support (which requires 'struct', which pgSkulpt does not currently\n[as of 31/8/2016] have)\n\"\"\"\n\nimport time as _time\nimport math as _math\n\n_SENTINEL = object()\n\ndef _cmp(x, y):\n    return 0 if x == y else 1 if x > y else -1\n\ndef _round(x):\n    return int(_math.floor(x + 0.5) if x >= 0.0 else _math.ceil(x - 0.5))\n\nMINYEAR = 1\nMAXYEAR = 9999\n_MINYEARFMT = 1900\n\n_MAX_DELTA_DAYS = 999999999\n\n# Utility functions, adapted from Python's Demo/classes/Dates.py, which\n# also assumes the current Gregorian calendar indefinitely extended in\n# both directions.  Difference:  Dates.py calls January 1 of year 0 day\n# number 1.  The code here calls January 1 of year 1 day number 1.  This is\n# to match the definition of the \"proleptic Gregorian\" calendar in Dershowitz\n# and Reingold's \"Calendrical Calculations\", where it's the base calendar\n# for all computations.  See the book for algorithms for converting between\n# proleptic Gregorian ordinals and many other calendar systems.\n\n_DAYS_IN_MONTH = [-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n\n_DAYS_BEFORE_MONTH = [-1]\ndbm = 0\nfor dim in _DAYS_IN_MONTH[1:]:\n    _DAYS_BEFORE_MONTH.append(dbm)\n    dbm += dim\ndel dbm, dim\n\ndef _is_leap(year):\n    \"year -> 1 if leap year, else 0.\"\n    return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)\n\ndef _days_before_year(year):\n    \"year -> number of days before January 1st of year.\"\n    y = year - 1\n    return y*365 + y//4 - y//100 + y//400\n\ndef _days_in_month(year, month):\n    \"year, month -> number of days in that month in that year.\"\n    assert 1 <= month <= 12, month\n    if month == 2 and _is_leap(year):\n        return 29\n    return _DAYS_IN_MONTH[month]\n\ndef _days_before_month(year, month):\n    \"year, month -> number of days in year preceding first day of month.\"\n    assert 1 <= month <= 12, 'month must be in 1..12'\n    return _DAYS_BEFORE_MONTH[month] + (month > 2 and _is_leap(year))\n\ndef _ymd2ord(year, month, day):\n    \"year, month, day -> ordinal, considering 01-Jan-0001 as day 1.\"\n    assert 1 <= month <= 12, 'month must be in 1..12'\n    dim = _days_in_month(year, month)\n    assert 1 <= day <= dim, ('day must be in 1..%d' % dim)\n    return (_days_before_year(year) +\n            _days_before_month(year, month) +\n            day)\n\n_DI400Y = _days_before_year(401)    # number of days in 400 years\n_DI100Y = _days_before_year(101)    #    \"    \"   \"   \" 100   \"\n_DI4Y   = _days_before_year(5)      #    \"    \"   \"   \"   4   \"\n\n# A 4-year cycle has an extra leap day over what we'd get from pasting\n# together 4 single years.\nassert _DI4Y == 4 * 365 + 1\n\n# Similarly, a 400-year cycle has an extra leap day over what we'd get from\n# pasting together 4 100-year cycles.\nassert _DI400Y == 4 * _DI100Y + 1\n\n# OTOH, a 100-year cycle has one fewer leap day than we'd get from\n# pasting together 25 4-year cycles.\nassert _DI100Y == 25 * _DI4Y - 1\n\n_US_PER_US = 1\n_US_PER_MS = 1000\n_US_PER_SECOND = 1000000\n_US_PER_MINUTE = 60000000\n_SECONDS_PER_DAY = 24 * 3600\n_US_PER_HOUR = 3600000000\n_US_PER_DAY = 86400000000\n_US_PER_WEEK = 604800000000\n\ndef _ord2ymd(n):\n    \"ordinal -> (year, month, day), considering 01-Jan-0001 as day 1.\"\n\n    # n is a 1-based index, starting at 1-Jan-1.  The pattern of leap years\n    # repeats exactly every 400 years.  The basic strategy is to find the\n    # closest 400-year boundary at or before n, then work with the offset\n    # from that boundary to n.  Life is much clearer if we subtract 1 from\n    # n first -- then the values of n at 400-year boundaries are exactly\n    # those divisible by _DI400Y:\n    #\n    #     D  M   Y            n              n-1\n    #     -- --- ----        ----------     ----------------\n    #     31 Dec -400        -_DI400Y       -_DI400Y -1\n    #      1 Jan -399         -_DI400Y +1   -_DI400Y      400-year boundary\n    #     ...\n    #     30 Dec  000        -1             -2\n    #     31 Dec  000         0             -1\n    #      1 Jan  001         1              0            400-year boundary\n    #      2 Jan  001         2              1\n    #      3 Jan  001         3              2\n    #     ...\n    #     31 Dec  400         _DI400Y        _DI400Y -1\n    #      1 Jan  401         _DI400Y +1     _DI400Y      400-year boundary\n    n -= 1\n    n400, n = divmod(n, _DI400Y)\n    year = n400 * 400 + 1   # ..., -399, 1, 401, ...\n\n    # Now n is the (non-negative) offset, in days, from January 1 of year, to\n    # the desired date.  Now compute how many 100-year cycles precede n.\n    # Note that it's possible for n100 to equal 4!  In that case 4 full\n    # 100-year cycles precede the desired day, which implies the desired\n    # day is December 31 at the end of a 400-year cycle.\n    n100, n = divmod(n, _DI100Y)\n\n    # Now compute how many 4-year cycles precede it.\n    n4, n = divmod(n, _DI4Y)\n\n    # And now how many single years.  Again n1 can be 4, and again meaning\n    # that the desired day is December 31 at the end of the 4-year cycle.\n    n1, n = divmod(n, 365)\n\n    year += n100 * 100 + n4 * 4 + n1\n    if n1 == 4 or n100 == 4:\n        assert n == 0\n        return year-1, 12, 31\n\n    # Now the year is correct, and n is the offset from January 1.  We find\n    # the month via an estimate that's either exact or one too large.\n    leapyear = n1 == 3 and (n4 != 24 or n100 == 3)\n    assert leapyear == _is_leap(year)\n    month = (n + 50) >> 5\n    preceding = _DAYS_BEFORE_MONTH[month] + (month > 2 and leapyear)\n    if preceding > n:  # estimate is too large\n        month -= 1\n        preceding -= _DAYS_IN_MONTH[month] + (month == 2 and leapyear)\n    n -= preceding\n    assert 0 <= n < _days_in_month(year, month)\n\n    # Now the year and month are correct, and n is the offset from the\n    # start of that month:  we're done!\n    return year, month, n+1\n\n# Month and day names.  For localized versions, see the calendar module.\n_MONTHNAMES = [None, \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\",\n                     \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n_DAYNAMES = [None, \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"]\n\n\ndef _build_struct_time(y, m, d, hh, mm, ss, dstflag):\n    wday = (_ymd2ord(y, m, d) + 6) % 7\n    dnum = _days_before_month(y, m) + d\n    return _time.struct_time((y, m, d, hh, mm, ss, wday, dnum, dstflag))\n\ndef _format_time(hh, mm, ss, us):\n    # pgSkip trailing microseconds when us==0.\n    result = \"%02d:%02d:%02d\" % (hh, mm, ss)\n    if us:\n        result += \".%06d\" % us\n    return result\n\n# Correctly substitute for %z and %Z escapes in strftime formats.\ndef _wrap_strftime(object, format, timetuple):\n    year = timetuple[0]\n    if year < _MINYEARFMT:\n        raise ValueError(\"year=%d is before %d; the datetime strftime() \"\n                         \"methods require year >= %d\" %\n                         (year, _MINYEARFMT, _MINYEARFMT))\n    # Don't call utcoffset() or tzname() unless actually needed.\n    freplace = None  # the string to use for %f\n    zreplace = None  # the string to use for %z\n    Zreplace = None  # the string to use for %Z\n\n    # Scan format for %z and %Z escapes, replacing as needed.\n    newformat = []\n    push = newformat.append\n    i, n = 0, len(format)\n    while i < n:\n        ch = format[i]\n        i += 1\n        if ch == '%':\n            if i < n:\n                ch = format[i]\n                i += 1\n                if ch == 'f':\n                    if freplace is None:\n                        freplace = '%06d' % getattr(object,\n                                                    'microsecond', 0)\n                    newformat.append(freplace)\n                elif ch == 'z':\n                    if zreplace is None:\n                        zreplace = \"\"\n                        if hasattr(object, \"_utcoffset\"):\n                            offset = object._utcoffset()\n                            if offset is not None:\n                                sign = '+'\n                                if offset < 0:\n                                    offset = -offset\n                                    sign = '-'\n                                h, m = divmod(offset, 60)\n                                zreplace = '%c%02d%02d' % (sign, h, m)\n                    assert '%' not in zreplace\n                    newformat.append(zreplace)\n                elif ch == 'Z':\n                    if Zreplace is None:\n                        Zreplace = \"\"\n                        if hasattr(object, \"tzname\"):\n                            s = object.tzname()\n                            if s is not None:\n                                # strftime is going to have at this: escape %\n                                Zreplace = s.replace('%', '%%')\n                    newformat.append(Zreplace)\n                else:\n                    push('%')\n                    push(ch)\n            else:\n                push('%')\n        else:\n            push(ch)\n    newformat = \"\".join(newformat)\n    return _time.strftime(newformat, timetuple)\n\n# Just raise TypeError if the arg isn't None or a string.\ndef _check_tzname(name):\n    if name is not None and not isinstance(name, str):\n        raise TypeError(\"tzinfo.tzname() must return None or string, \"\n                        \"not '%s'\" % type(name))\n\n# name is the offset-producing method, \"utcoffset\" or \"dst\".\n# offset is what it returned.\n# If offset isn't None or timedelta, raises TypeError.\n# If offset is None, returns None.\n# Else offset is checked for being in range, and a whole # of minutes.\n# If it is, its integer value is returned.  Else ValueError is raised.\ndef _check_utc_offset(name, offset):\n    assert name in (\"utcoffset\", \"dst\")\n    if offset is None:\n        return\n    if not isinstance(offset, timedelta):\n        raise TypeError(\"tzinfo.%s() must return None \"\n                        \"or timedelta, not '%s'\" % (name, type(offset)))\n    days = offset.days\n    if days < -1 or days > 0:\n        offset = 1440  # trigger out-of-range\n    else:\n        seconds = days * 86400 + offset.seconds\n        minutes, seconds = divmod(seconds, 60)\n        if seconds or offset.microseconds:\n            raise ValueError(\"tzinfo.%s() must return a whole number \"\n                             \"of minutes\" % name)\n        offset = minutes\n    if not -1440 < offset < 1440:\n        raise ValueError(\"%s()=%d, must be in -1439..1439\" % (name, offset))\n    return offset\n\ndef _check_int_field(value):\n    if isinstance(value, int):\n        return int(value)\n    if not isinstance(value, float):\n        try:\n            value = value.__int__()\n        except AttributeError:\n            pass\n        else:\n            if isinstance(value, int):\n                return int(value)\n            elif isinstance(value, long):\n                return int(long(value))\n            raise TypeError('__int__ method should return an integer')\n        raise TypeError('an integer is required')\n    raise TypeError('integer argument expected, got float')\n\ndef _check_date_fields(year, month, day):\n    year = _check_int_field(year)\n    month = _check_int_field(month)\n    day = _check_int_field(day)\n    if not MINYEAR <= year <= MAXYEAR:\n        raise ValueError('year must be in %d..%d' % (MINYEAR, MAXYEAR), year)\n    if not 1 <= month <= 12:\n        raise ValueError('month must be in 1..12', month)\n    dim = _days_in_month(year, month)\n    if not 1 <= day <= dim:\n        raise ValueError('day must be in 1..%d' % dim, day)\n    return year, month, day\n\ndef _check_time_fields(hour, minute, second, microsecond):\n    hour = _check_int_field(hour)\n    minute = _check_int_field(minute)\n    second = _check_int_field(second)\n    microsecond = _check_int_field(microsecond)\n    if not 0 <= hour <= 23:\n        raise ValueError('hour must be in 0..23', hour)\n    if not 0 <= minute <= 59:\n        raise ValueError('minute must be in 0..59', minute)\n    if not 0 <= second <= 59:\n        raise ValueError('second must be in 0..59', second)\n    if not 0 <= microsecond <= 999999:\n        raise ValueError('microsecond must be in 0..999999', microsecond)\n    return hour, minute, second, microsecond\n\ndef _check_tzinfo_arg(tz):\n    if tz is not None and not isinstance(tz, tzinfo):\n        raise TypeError(\"tzinfo argument must be None or of a tzinfo subclass\")\n\n\n# Notes on comparison:  In general, datetime module comparison operators raise\n# TypeError when they don't know how to do a comparison themself.  If they\n# returned NotImplemented instead, comparison could (silently) fall back to\n# the default compare-objects-by-comparing-their-memory-addresses strategy,\n# and that's not helpful.  There are two exceptions:\n#\n# 1. For date and datetime, if the other object has a \"timetuple\" attr,\n#    NotImplemented is returned.  This is a hook to allow other kinds of\n#    datetime-like objects a chance to intercept the comparison.\n#\n# 2. Else __eq__ and __ne__ return False and True, respectively.  This is\n#    so opertaions like\n#\n#        x == y\n#        x != y\n#        x in sequence\n#        x not in sequence\n#        dict[x] = y\n#\n#    don't raise annoying TypeErrors just because a datetime object\n#    is part of a heterogeneous collection.  If there's no known way to\n#    compare X to a datetime, saying they're not equal is reasonable.\n\ndef _cmperror(x, y):\n    raise TypeError(\"can't compare '%s' to '%s'\" % (\n                    type(x).__name__, type(y).__name__))\n\ndef _normalize_pair(hi, lo, factor):\n    if not 0 <= lo <= factor-1:\n        inc, lo = divmod(lo, factor)\n        hi += inc\n    return hi, lo\n\ndef _normalize_datetime(y, m, d, hh, mm, ss, us, ignore_overflow=False):\n    # Normalize all the inputs, and store the normalized values.\n    ss, us = _normalize_pair(ss, us, 1000000)\n    mm, ss = _normalize_pair(mm, ss, 60)\n    hh, mm = _normalize_pair(hh, mm, 60)\n    d, hh = _normalize_pair(d, hh, 24)\n    y, m, d = _normalize_date(y, m, d, ignore_overflow)\n    return y, m, d, hh, mm, ss, us\n\ndef _normalize_date(year, month, day, ignore_overflow=False):\n    # That was easy.  Now it gets muddy:  the proper range for day\n    # can't be determined without knowing the correct month and year,\n    # but if day is, e.g., plus or minus a million, the current month\n    # and year values make no sense (and may also be out of bounds\n    # themselves).\n    # Saying 12 months == 1 year should be non-controversial.\n    if not 1 <= month <= 12:\n        year, month = _normalize_pair(year, month-1, 12)\n        month += 1\n        assert 1 <= month <= 12\n\n    # Now only day can be out of bounds (year may also be out of bounds\n    # for a datetime object, but we don't care about that here).\n    # If day is out of bounds, what to do is arguable, but at least the\n    # method here is principled and explainable.\n    dim = _days_in_month(year, month)\n    if not 1 <= day <= dim:\n        # Move day-1 days from the first of the month.  First try to\n        # get off cheap if we're only one day out of range (adjustments\n        # for timezone alone can't be worse than that).\n        if day == 0:    # move back a day\n            month -= 1\n            if month > 0:\n                day = _days_in_month(year, month)\n            else:\n                year, month, day = year-1, 12, 31\n        elif day == dim + 1:    # move forward a day\n            month += 1\n            day = 1\n            if month > 12:\n                month = 1\n                year += 1\n        else:\n            ordinal = _ymd2ord(year, month, 1) + (day - 1)\n            year, month, day = _ord2ymd(ordinal)\n\n    if not ignore_overflow and not MINYEAR <= year <= MAXYEAR:\n        raise OverflowError(\"date value out of range\")\n    return year, month, day\n\ndef _accum(tag, sofar, num, factor, leftover):\n    if isinstance(num, (int, long)):\n        prod = num * factor\n        rsum = sofar + prod\n        return rsum, leftover\n    if isinstance(num, float):\n        fracpart, intpart = _math.modf(num)\n        prod = int(intpart) * factor\n        rsum = sofar + prod\n        if fracpart == 0.0:\n            return rsum, leftover\n        assert isinstance(factor, (int, long))\n        fracpart, intpart = _math.modf(factor * fracpart)\n        rsum += int(intpart)\n        return rsum, leftover + fracpart\n    raise TypeError(\"unsupported type for timedelta %s component: %s\" %\n                    (tag, type(num)))\n\nclass timedelta(object):\n    \"\"\"Represent the difference between two datetime objects.\n\n    Supported operators:\n\n    - add, subtract timedelta\n    - unary plus, minus, abs\n    - compare to timedelta\n    - multiply, divide by int/long\n\n    In addition, datetime supports subtraction of two datetime objects\n    returning a timedelta, and addition or subtraction of a datetime\n    and a timedelta giving a datetime.\n\n    Representation: (days, seconds, microseconds).  Why?  Because I\n    felt like it.\n    \"\"\"\n    __slots__ = '_days', '_seconds', '_microseconds', '_hashcode'\n\n    def __new__(cls, days=_SENTINEL, seconds=_SENTINEL, microseconds=_SENTINEL,\n                milliseconds=_SENTINEL, minutes=_SENTINEL, hours=_SENTINEL, weeks=_SENTINEL):\n        x = 0\n        leftover = 0.0\n        if microseconds is not _SENTINEL:\n            x, leftover = _accum(\"microseconds\", x, microseconds, _US_PER_US, leftover)\n        if milliseconds is not _SENTINEL:\n            x, leftover = _accum(\"milliseconds\", x, milliseconds, _US_PER_MS, leftover)\n        if seconds is not _SENTINEL:\n            x, leftover = _accum(\"seconds\", x, seconds, _US_PER_SECOND, leftover)\n        if minutes is not _SENTINEL:\n            x, leftover = _accum(\"minutes\", x, minutes, _US_PER_MINUTE, leftover)\n        if hours is not _SENTINEL:\n            x, leftover = _accum(\"hours\", x, hours, _US_PER_HOUR, leftover)\n        if days is not _SENTINEL:\n            x, leftover = _accum(\"days\", x, days, _US_PER_DAY, leftover)\n        if weeks is not _SENTINEL:\n            x, leftover = _accum(\"weeks\", x, weeks, _US_PER_WEEK, leftover)\n        if leftover != 0.0:\n            x += _round(leftover)\n        return cls._from_microseconds(x)\n\n    @classmethod\n    def _from_microseconds(cls, us):\n        s, us = divmod(us, _US_PER_SECOND)\n        d, s = divmod(s, _SECONDS_PER_DAY)\n        return cls._create(d, s, us, False)\n\n    @classmethod\n    def _create(cls, d, s, us, normalize):\n        if normalize:\n            s, us = _normalize_pair(s, us, 1000000)\n            d, s = _normalize_pair(d, s, 24*3600)\n\n        if not -_MAX_DELTA_DAYS <= d <= _MAX_DELTA_DAYS:\n            raise OverflowError(\"days=%d; must have magnitude <= %d\" % (d, _MAX_DELTA_DAYS))\n\n        self = object.__new__(cls)\n        self._days = d\n        self._seconds = s\n        self._microseconds = us\n        self._hashcode = -1\n        return self\n\n    def _to_microseconds(self):\n        return ((self._days * _SECONDS_PER_DAY + self._seconds) * _US_PER_SECOND +\n                self._microseconds)\n\n    def __repr__(self):\n        module = \"datetime.\" if self.__class__ is timedelta else \"\"\n        if self._microseconds:\n            return \"%s(%d, %d, %d)\" % (module + self.__class__.__name__,\n                                       self._days,\n                                       self._seconds,\n                                       self._microseconds)\n        if self._seconds:\n            return \"%s(%d, %d)\" % (module + self.__class__.__name__,\n                                   self._days,\n                                   self._seconds)\n        return \"%s(%d)\" % (module + self.__class__.__name__, self._days)\n\n    def __str__(self):\n        mm, ss = divmod(self._seconds, 60)\n        hh, mm = divmod(mm, 60)\n        s = \"%d:%02d:%02d\" % (hh, mm, ss)\n        if self._days:\n            def plural(n):\n                return n, abs(n) != 1 and \"s\" or \"\"\n            s = (\"%d day%s, \" % plural(self._days)) + s\n        if self._microseconds:\n            s = s + \".%06d\" % self._microseconds\n        return s\n\n    def total_seconds(self):\n        \"\"\"Total seconds in the duration.\"\"\"\n        return self._to_microseconds() / 10.0**6\n\n    # Read-only field accessors\n    @property\n    def days(self):\n        \"\"\"days\"\"\"\n        return self._days\n\n    @property\n    def seconds(self):\n        \"\"\"seconds\"\"\"\n        return self._seconds\n\n    @property\n    def microseconds(self):\n        \"\"\"microseconds\"\"\"\n        return self._microseconds\n\n    def __add__(self, other):\n        if isinstance(other, timedelta):\n            # for CPython compatibility, we cannot use\n            # our __class__ here, but need a real timedelta\n            return timedelta._create(self._days + other._days,\n                                     self._seconds + other._seconds,\n                                     self._microseconds + other._microseconds,\n                                     True)\n        return NotImplemented\n\n    def __sub__(self, other):\n        if isinstance(other, timedelta):\n            # for CPython compatibility, we cannot use\n            # our __class__ here, but need a real timedelta\n            return timedelta._create(self._days - other._days,\n                                     self._seconds - other._seconds,\n                                     self._microseconds - other._microseconds,\n                                     True)\n        return NotImplemented\n\n    def __neg__(self):\n        # for CPython compatibility, we cannot use\n        # our __class__ here, but need a real timedelta\n        return timedelta._create(-self._days,\n                                 -self._seconds,\n                                 -self._microseconds,\n                                 True)\n\n    def __pos__(self):\n        # for CPython compatibility, we cannot use\n        # our __class__ here, but need a real timedelta\n        return timedelta._create(self._days,\n                                 self._seconds,\n                                 self._microseconds,\n                                 False)\n\n    def __abs__(self):\n        if self._days < 0:\n            return -self\n        else:\n            return self\n\n    def __mul__(self, other):\n        if not isinstance(other, (int, long)):\n            return NotImplemented\n        usec = self._to_microseconds()\n        return timedelta._from_microseconds(usec * other)\n\n    __rmul__ = __mul__\n\n    def __div__(self, other):\n        if not isinstance(other, (int, long)):\n            return NotImplemented\n        usec = self._to_microseconds()\n        return timedelta._from_microseconds(usec // other)\n\n    __floordiv__ = __div__\n\n    # Comparisons of timedelta objects with other.\n\n    def __eq__(self, other):\n        if isinstance(other, timedelta):\n            return self._cmp(other) == 0\n        else:\n            return False\n\n    def __ne__(self, other):\n        if isinstance(other, timedelta):\n            return self._cmp(other) != 0\n        else:\n            return True\n\n    def __le__(self, other):\n        if isinstance(other, timedelta):\n            return self._cmp(other) <= 0\n        else:\n            _cmperror(self, other)\n\n    def __lt__(self, other):\n        if isinstance(other, timedelta):\n            return self._cmp(other) < 0\n        else:\n            _cmperror(self, other)\n\n    def __ge__(self, other):\n        if isinstance(other, timedelta):\n            return self._cmp(other) >= 0\n        else:\n            _cmperror(self, other)\n\n    def __gt__(self, other):\n        if isinstance(other, timedelta):\n            return self._cmp(other) > 0\n        else:\n            _cmperror(self, other)\n\n    def _cmp(self, other):\n        assert isinstance(other, timedelta)\n        return _cmp(self._getstate(), other._getstate())\n\n    def __hash__(self):\n        if self._hashcode == -1:\n            self._hashcode = hash(self._getstate())\n        return self._hashcode\n\n    def __nonzero__(self):\n        return (self._days != 0 or\n                self._seconds != 0 or\n                self._microseconds != 0)\n\ntimedelta.min = timedelta(-_MAX_DELTA_DAYS)\ntimedelta.max = timedelta(_MAX_DELTA_DAYS, 24*3600-1, 1000000-1)\ntimedelta.resolution = timedelta(microseconds=1)\n\nclass date(object):\n    \"\"\"Concrete date type.\n\n    Constructors:\n\n    __new__()\n    fromtimestamp()\n    today()\n    fromordinal()\n\n    Operators:\n\n    __repr__, __str__\n    __cmp__, __hash__\n    __add__, __radd__, __sub__ (add/radd only with timedelta arg)\n\n    Methods:\n\n    timetuple()\n    toordinal()\n    weekday()\n    isoweekday(), isocalendar(), isoformat()\n    ctime()\n    strftime()\n\n    Properties (readonly):\n    year, month, day\n    \"\"\"\n    __slots__ = '_year', '_month', '_day', '_hashcode'\n\n    def __new__(cls, year, month=None, day=None):\n        \"\"\"Constructor.\n\n        Arguments:\n\n        year, month, day (required, base 1)\n        \"\"\"\n        year, month, day = _check_date_fields(year, month, day)\n        self = object.__new__(cls)\n        self._year = year\n        self._month = month\n        self._day = day\n        self._hashcode = -1\n        return self\n\n    # Additional constructors\n\n    @classmethod\n    def fromtimestamp(cls, t):\n        \"Construct a date from a POSIX timestamp (like time.time()).\"\n        y, m, d, hh, mm, ss, weekday, jday, dst = _time.localtime(t)\n        return cls(y, m, d)\n\n    @classmethod\n    def today(cls):\n        \"Construct a date from time.time().\"\n        t = _time.time()\n        return cls.fromtimestamp(t)\n\n    @classmethod\n    def fromordinal(cls, n):\n        \"\"\"Contruct a date from a proleptic Gregorian ordinal.\n\n        January 1 of year 1 is day 1.  Only the year, month and day are\n        non-zero in the result.\n        \"\"\"\n        y, m, d = _ord2ymd(n)\n        return cls(y, m, d)\n\n    # Conversions to string\n\n    def __repr__(self):\n        \"\"\"Convert to formal string, for repr().\n\n        >>> dt = datetime(2010, 1, 1)\n        >>> repr(dt)\n        'datetime.datetime(2010, 1, 1, 0, 0)'\n\n        >>> dt = datetime(2010, 1, 1, tzinfo=timezone.utc)\n        >>> repr(dt)\n        'datetime.datetime(2010, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)'\n        \"\"\"\n        module = \"datetime.\" if self.__class__ is date else \"\"\n        return \"%s(%d, %d, %d)\" % (module + self.__class__.__name__,\n                                   self._year,\n                                   self._month,\n                                   self._day)\n\n    # XXX These shouldn't depend on time.localtime(), because that\n    # clips the usable dates to [1970 .. 2038).  At least ctime() is\n    # easily done without using strftime() -- that's better too because\n    # strftime(\"%c\", ...) is locale specific.\n\n    def ctime(self):\n        \"Return ctime() style string.\"\n        weekday = self.toordinal() % 7 or 7\n        return \"%s %s %2d 00:00:00 %04d\" % (\n            _DAYNAMES[weekday],\n            _MONTHNAMES[self._month],\n            self._day, self._year)\n\n    def strftime(self, format):\n        \"Format using strftime().\"\n        return _wrap_strftime(self, format, self.timetuple())\n\n    def __format__(self, fmt):\n        if not isinstance(fmt, (str, unicode)):\n            raise ValueError(\"__format__ expects str or unicode, not %s\" %\n                             fmt.__class__.__name__)\n        if len(fmt) != 0:\n            return self.strftime(fmt)\n        return str(self)\n\n    def isoformat(self):\n        \"\"\"Return the date formatted according to ISO.\n\n        This is 'YYYY-MM-DD'.\n\n        References:\n        - http://www.w3.org/TR/NOTE-datetime\n        - http://www.cl.cam.ac.uk/~mgk25/iso-time.html\n        \"\"\"\n        return \"%04d-%02d-%02d\" % (self._year, self._month, self._day)\n\n    __str__ = isoformat\n\n    # Read-only field accessors\n    @property\n    def year(self):\n        \"\"\"year (1-9999)\"\"\"\n        return self._year\n\n    @property\n    def month(self):\n        \"\"\"month (1-12)\"\"\"\n        return self._month\n\n    @property\n    def day(self):\n        \"\"\"day (1-31)\"\"\"\n        return self._day\n\n    # Standard conversions, __cmp__, __hash__ (and helpers)\n\n    def timetuple(self):\n        \"Return local time tuple compatible with time.localtime().\"\n        return _build_struct_time(self._year, self._month, self._day,\n                                  0, 0, 0, -1)\n\n    def toordinal(self):\n        \"\"\"Return proleptic Gregorian ordinal for the year, month and day.\n\n        January 1 of year 1 is day 1.  Only the year, month and day values\n        contribute to the result.\n        \"\"\"\n        return _ymd2ord(self._year, self._month, self._day)\n\n    def replace(self, year=None, month=None, day=None):\n        \"\"\"Return a new date with new values for the specified fields.\"\"\"\n        if year is None:\n            year = self._year\n        if month is None:\n            month = self._month\n        if day is None:\n            day = self._day\n        return date(year, month, day)\n\n    # Comparisons of date objects with other.\n\n    def __eq__(self, other):\n        if isinstance(other, date):\n            return self._cmp(other) == 0\n        elif hasattr(other, \"timetuple\"):\n            return NotImplemented\n        else:\n            return False\n\n    def __ne__(self, other):\n        if isinstance(other, date):\n            return self._cmp(other) != 0\n        elif hasattr(other, \"timetuple\"):\n            return NotImplemented\n        else:\n            return True\n\n    def __le__(self, other):\n        if isinstance(other, date):\n            return self._cmp(other) <= 0\n        elif hasattr(other, \"timetuple\"):\n            return NotImplemented\n        else:\n            _cmperror(self, other)\n\n    def __lt__(self, other):\n        if isinstance(other, date):\n            return self._cmp(other) < 0\n        elif hasattr(other, \"timetuple\"):\n            return NotImplemented\n        else:\n            _cmperror(self, other)\n\n    def __ge__(self, other):\n        if isinstance(other, date):\n            return self._cmp(other) >= 0\n        elif hasattr(other, \"timetuple\"):\n            return NotImplemented\n        else:\n            _cmperror(self, other)\n\n    def __gt__(self, other):\n        if isinstance(other, date):\n            return self._cmp(other) > 0\n        elif hasattr(other, \"timetuple\"):\n            return NotImplemented\n        else:\n            _cmperror(self, other)\n\n    def _cmp(self, other):\n        assert isinstance(other, date)\n        y, m, d = self._year, self._month, self._day\n        y2, m2, d2 = other._year, other._month, other._day\n        return _cmp((y, m, d), (y2, m2, d2))\n\n    def __hash__(self):\n        \"Hash.\"\n        if self._hashcode == -1:\n            self._hashcode = hash(self._getstate())\n        return self._hashcode\n\n    # Computations\n\n    def _add_timedelta(self, other, factor):\n        y, m, d = _normalize_date(\n            self._year,\n            self._month,\n            self._day + other.days * factor)\n        return date(y, m, d)\n\n    def __add__(self, other):\n        \"Add a date to a timedelta.\"\n        if isinstance(other, timedelta):\n            return self._add_timedelta(other, 1)\n        return NotImplemented\n\n    __radd__ = __add__\n\n    def __sub__(self, other):\n        \"\"\"Subtract two dates, or a date and a timedelta.\"\"\"\n        if isinstance(other, date):\n            days1 = self.toordinal()\n            days2 = other.toordinal()\n            return timedelta._create(days1 - days2, 0, 0, False)\n        if isinstance(other, timedelta):\n            return self._add_timedelta(other, -1)\n        return NotImplemented\n\n    def weekday(self):\n        \"Return day of the week, where Monday == 0 ... Sunday == 6.\"\n        return (self.toordinal() + 6) % 7\n\n    # Day-of-the-week and week-of-the-year, according to ISO\n\n    def isoweekday(self):\n        \"Return day of the week, where Monday == 1 ... Sunday == 7.\"\n        # 1-Jan-0001 is a Monday\n        return self.toordinal() % 7 or 7\n\n    def isocalendar(self):\n        \"\"\"Return a 3-tuple containing ISO year, week number, and weekday.\n\n        The first ISO week of the year is the (Mon-Sun) week\n        containing the year's first Thursday; everything else derives\n        from that.\n\n        The first week is 1; Monday is 1 ... Sunday is 7.\n\n        ISO calendar algorithm taken from\n        http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm\n        \"\"\"\n        year = self._year\n        week1monday = _isoweek1monday(year)\n        today = _ymd2ord(self._year, self._month, self._day)\n        # Internally, week and day have origin 0\n        week, day = divmod(today - week1monday, 7)\n        if week < 0:\n            year -= 1\n            week1monday = _isoweek1monday(year)\n            week, day = divmod(today - week1monday, 7)\n        elif week >= 52:\n            if today >= _isoweek1monday(year+1):\n                year += 1\n                week = 0\n        return year, week+1, day+1\n\n_date_class = date  # so functions w/ args named \"date\" can get at the class\n\ndate.min = date(1, 1, 1)\ndate.max = date(9999, 12, 31)\ndate.resolution = timedelta(days=1)\n\nclass tzinfo(object):\n    \"\"\"Abstract base class for time zone info classes.\n\n    Subclasses must override the name(), utcoffset() and dst() methods.\n    \"\"\"\n    __slots__ = ()\n\n    def tzname(self, dt):\n        \"datetime -> string name of time zone.\"\n        raise NotImplementedError(\"tzinfo subclass must override tzname()\")\n\n    def utcoffset(self, dt):\n        \"datetime -> minutes east of UTC (negative for west of UTC)\"\n        raise NotImplementedError(\"tzinfo subclass must override utcoffset()\")\n\n    def dst(self, dt):\n        \"\"\"datetime -> DST offset in minutes east of UTC.\n\n        Return 0 if DST not in effect.  utcoffset() must include the DST\n        offset.\n        \"\"\"\n        raise NotImplementedError(\"tzinfo subclass must override dst()\")\n\n    def fromutc(self, dt):\n        \"datetime in UTC -> datetime in local time.\"\n\n        if not isinstance(dt, datetime):\n            raise TypeError(\"fromutc() requires a datetime argument\")\n        if dt.tzinfo is not self:\n            raise ValueError(\"dt.tzinfo is not self\")\n\n        dtoff = dt.utcoffset()\n        if dtoff is None:\n            raise ValueError(\"fromutc() requires a non-None utcoffset() \"\n                             \"result\")\n\n        # See the long comment block at the end of this file for an\n        # explanation of this algorithm.\n        dtdst = dt.dst()\n        if dtdst is None:\n            raise ValueError(\"fromutc() requires a non-None dst() result\")\n        delta = dtoff - dtdst\n        if delta:\n            dt = dt + delta\n            dtdst = dt.dst()\n            if dtdst is None:\n                raise ValueError(\"fromutc(): dt.dst gave inconsistent \"\n                                 \"results; cannot convert\")\n        if dtdst:\n            return dt + dtdst\n        else:\n            return dt\n\n_tzinfo_class = tzinfo\n\nclass time(object):\n    \"\"\"Time with time zone.\n\n    Constructors:\n\n    __new__()\n\n    Operators:\n\n    __repr__, __str__\n    __cmp__, __hash__\n\n    Methods:\n\n    strftime()\n    isoformat()\n    utcoffset()\n    tzname()\n    dst()\n\n    Properties (readonly):\n    hour, minute, second, microsecond, tzinfo\n    \"\"\"\n    __slots__ = '_hour', '_minute', '_second', '_microsecond', '_tzinfo', '_hashcode'\n\n    def __new__(cls, hour=0, minute=0, second=0, microsecond=0, tzinfo=None):\n        \"\"\"Constructor.\n\n        Arguments:\n\n        hour, minute (required)\n        second, microsecond (default to zero)\n        tzinfo (default to None)\n        \"\"\"\n        hour, minute, second, microsecond = _check_time_fields(\n            hour, minute, second, microsecond)\n        _check_tzinfo_arg(tzinfo)\n        self = object.__new__(cls)\n        self._hour = hour\n        self._minute = minute\n        self._second = second\n        self._microsecond = microsecond\n        self._tzinfo = tzinfo\n        self._hashcode = -1\n        return self\n\n    # Read-only field accessors\n    @property\n    def hour(self):\n        \"\"\"hour (0-23)\"\"\"\n        return self._hour\n\n    @property\n    def minute(self):\n        \"\"\"minute (0-59)\"\"\"\n        return self._minute\n\n    @property\n    def second(self):\n        \"\"\"second (0-59)\"\"\"\n        return self._second\n\n    @property\n    def microsecond(self):\n        \"\"\"microsecond (0-999999)\"\"\"\n        return self._microsecond\n\n    @property\n    def tzinfo(self):\n        \"\"\"timezone info object\"\"\"\n        return self._tzinfo\n\n    # Standard conversions, __hash__ (and helpers)\n\n    # Comparisons of time objects with other.\n\n    def __eq__(self, other):\n        if isinstance(other, time):\n            return self._cmp(other) == 0\n        else:\n            return False\n\n    def __ne__(self, other):\n        if isinstance(other, time):\n            return self._cmp(other) != 0\n        else:\n            return True\n\n    def __le__(self, other):\n        if isinstance(other, time):\n            return self._cmp(other) <= 0\n        else:\n            _cmperror(self, other)\n\n    def __lt__(self, other):\n        if isinstance(other, time):\n            return self._cmp(other) < 0\n        else:\n            _cmperror(self, other)\n\n    def __ge__(self, other):\n        if isinstance(other, time):\n            return self._cmp(other) >= 0\n        else:\n            _cmperror(self, other)\n\n    def __gt__(self, other):\n        if isinstance(other, time):\n            return self._cmp(other) > 0\n        else:\n            _cmperror(self, other)\n\n    def _cmp(self, other):\n        assert isinstance(other, time)\n        mytz = self._tzinfo\n        ottz = other._tzinfo\n        myoff = otoff = None\n\n        if mytz is ottz:\n            base_compare = True\n        else:\n            myoff = self._utcoffset()\n            otoff = other._utcoffset()\n            base_compare = myoff == otoff\n\n        if base_compare:\n            return _cmp((self._hour, self._minute, self._second,\n                         self._microsecond),\n                        (other._hour, other._minute, other._second,\n                         other._microsecond))\n        if myoff is None or otoff is None:\n            raise TypeError(\"can't compare offset-naive and offset-aware times\")\n        myhhmm = self._hour * 60 + self._minute - myoff\n        othhmm = other._hour * 60 + other._minute - otoff\n        return _cmp((myhhmm, self._second, self._microsecond),\n                    (othhmm, other._second, other._microsecond))\n\n    def __hash__(self):\n        \"\"\"Hash.\"\"\"\n        if self._hashcode == -1:\n            tzoff = self._utcoffset()\n            if not tzoff:  # zero or None\n                self._hashcode = hash(self._getstate()[0])\n            else:\n                h, m = divmod(self.hour * 60 + self.minute - tzoff, 60)\n                if 0 <= h < 24:\n                    self._hashcode = hash(time(h, m, self.second, self.microsecond))\n                else:\n                    self._hashcode = hash((h, m, self.second, self.microsecond))\n        return self._hashcode\n\n    # Conversion to string\n\n    def _tzstr(self, sep=\":\"):\n        \"\"\"Return formatted timezone offset (+xx:xx) or None.\"\"\"\n        off = self._utcoffset()\n        if off is not None:\n            if off < 0:\n                sign = \"-\"\n                off = -off\n            else:\n                sign = \"+\"\n            hh, mm = divmod(off, 60)\n            assert 0 <= hh < 24\n            off = \"%s%02d%s%02d\" % (sign, hh, sep, mm)\n        return off\n\n    def __repr__(self):\n        \"\"\"Convert to formal string, for repr().\"\"\"\n        if self._microsecond != 0:\n            s = \", %d, %d\" % (self._second, self._microsecond)\n        elif self._second != 0:\n            s = \", %d\" % self._second\n        else:\n            s = \"\"\n        module = \"datetime.\" if self.__class__ is time else \"\"\n        s= \"%s(%d, %d%s)\" % (module + self.__class__.__name__,\n                             self._hour, self._minute, s)\n        if self._tzinfo is not None:\n            assert s[-1:] == \")\"\n            s = s[:-1] + \", tzinfo=%r\" % self._tzinfo + \")\"\n        return s\n\n    def isoformat(self):\n        \"\"\"Return the time formatted according to ISO.\n\n        This is 'HH:MM:SS.mmmmmm+zz:zz', or 'HH:MM:SS+zz:zz' if\n        self.microsecond == 0.\n        \"\"\"\n        s = _format_time(self._hour, self._minute, self._second,\n                         self._microsecond)\n        tz = self._tzstr()\n        if tz:\n            s += tz\n        return s\n\n    __str__ = isoformat\n\n    def strftime(self, format):\n        \"\"\"Format using strftime().  The date part of the timestamp passed\n        to underlying strftime should not be used.\n        \"\"\"\n        # The year must be >= _MINYEARFMT else Python's strftime implementation\n        # can raise a bogus exception.\n        timetuple = (1900, 1, 1,\n                     self._hour, self._minute, self._second,\n                     0, 1, -1)\n        return _wrap_strftime(self, format, timetuple)\n\n    def __format__(self, fmt):\n        if not isinstance(fmt, (str, unicode)):\n            raise ValueError(\"__format__ expects str or unicode, not %s\" %\n                             fmt.__class__.__name__)\n        if len(fmt) != 0:\n            return self.strftime(fmt)\n        return str(self)\n\n    # Timezone functions\n\n    def utcoffset(self):\n        \"\"\"Return the timezone offset in minutes east of UTC (negative west of\n        UTC).\"\"\"\n        if self._tzinfo is None:\n            return None\n        offset = self._tzinfo.utcoffset(None)\n        offset = _check_utc_offset(\"utcoffset\", offset)\n        if offset is not None:\n            offset = timedelta._create(0, offset * 60, 0, True)\n        return offset\n\n    # Return an integer (or None) instead of a timedelta (or None).\n    def _utcoffset(self):\n        if self._tzinfo is None:\n            return None\n        offset = self._tzinfo.utcoffset(None)\n        offset = _check_utc_offset(\"utcoffset\", offset)\n        return offset\n\n    def tzname(self):\n        \"\"\"Return the timezone name.\n\n        Note that the name is 100% informational -- there's no requirement that\n        it mean anything in particular. For example, \"GMT\", \"UTC\", \"-500\",\n        \"-5:00\", \"EDT\", \"US/Eastern\", \"America/New York\" are all valid replies.\n        \"\"\"\n        if self._tzinfo is None:\n            return None\n        name = self._tzinfo.tzname(None)\n        _check_tzname(name)\n        return name\n\n    def dst(self):\n        \"\"\"Return 0 if DST is not in effect, or the DST offset (in minutes\n        eastward) if DST is in effect.\n\n        This is purely informational; the DST offset has already been added to\n        the UTC offset returned by utcoffset() if applicable, so there's no\n        need to consult dst() unless you're interested in displaying the DST\n        info.\n        \"\"\"\n        if self._tzinfo is None:\n            return None\n        offset = self._tzinfo.dst(None)\n        offset = _check_utc_offset(\"dst\", offset)\n        if offset is not None:\n            offset = timedelta._create(0, offset * 60, 0, True)\n        return offset\n\n    # Return an integer (or None) instead of a timedelta (or None).\n    def _dst(self):\n        if self._tzinfo is None:\n            return None\n        offset = self._tzinfo.dst(None)\n        offset = _check_utc_offset(\"dst\", offset)\n        return offset\n\n    def replace(self, hour=None, minute=None, second=None, microsecond=None,\n                tzinfo=True):\n        \"\"\"Return a new time with new values for the specified fields.\"\"\"\n        if hour is None:\n            hour = self.hour\n        if minute is None:\n            minute = self.minute\n        if second is None:\n            second = self.second\n        if microsecond is None:\n            microsecond = self.microsecond\n        if tzinfo is True:\n            tzinfo = self.tzinfo\n        return time(hour, minute, second, microsecond, tzinfo)\n\n    def __nonzero__(self):\n        if self.second or self.microsecond:\n            return True\n        offset = self._utcoffset() or 0\n        return self.hour * 60 + self.minute != offset\n\n_time_class = time  # so functions w/ args named \"time\" can get at the class\n\ntime.min = time(0, 0, 0)\ntime.max = time(23, 59, 59, 999999)\ntime.resolution = timedelta(microseconds=1)\n\nclass datetime(date):\n    \"\"\"datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])\n\n    The year, month and day arguments are required. tzinfo may be None, or an\n    instance of a tzinfo subclass. The remaining arguments may be ints or longs.\n    \"\"\"\n    __slots__ = date.__slots__ + time.__slots__\n\n    def __new__(cls, year, month=None, day=None, hour=0, minute=0, second=0,\n                microsecond=0, tzinfo=None):\n        year, month, day = _check_date_fields(year, month, day)\n        hour, minute, second, microsecond = _check_time_fields(\n            hour, minute, second, microsecond)\n        _check_tzinfo_arg(tzinfo)\n        self = object.__new__(cls)\n        self._year = year\n        self._month = month\n        self._day = day\n        self._hour = hour\n        self._minute = minute\n        self._second = second\n        self._microsecond = microsecond\n        self._tzinfo = tzinfo\n        self._hashcode = -1\n        return self\n\n    # Read-only field accessors\n    @property\n    def hour(self):\n        \"\"\"hour (0-23)\"\"\"\n        return self._hour\n\n    @property\n    def minute(self):\n        \"\"\"minute (0-59)\"\"\"\n        return self._minute\n\n    @property\n    def second(self):\n        \"\"\"second (0-59)\"\"\"\n        return self._second\n\n    @property\n    def microsecond(self):\n        \"\"\"microsecond (0-999999)\"\"\"\n        return self._microsecond\n\n    @property\n    def tzinfo(self):\n        \"\"\"timezone info object\"\"\"\n        return self._tzinfo\n\n    @classmethod\n    def fromtimestamp(cls, timestamp, tz=None):\n        \"\"\"Construct a datetime from a POSIX timestamp (like time.time()).\n\n        A timezone info object may be passed in as well.\n        \"\"\"\n        _check_tzinfo_arg(tz)\n        converter = _time.localtime if tz is None else _time.gmtime\n        self = cls._from_timestamp(converter, timestamp, tz)\n        if tz is not None:\n            self = tz.fromutc(self)\n        return self\n\n    @classmethod\n    def utcfromtimestamp(cls, t):\n        \"Construct a UTC datetime from a POSIX timestamp (like time.time()).\"\n        return cls._from_timestamp(_time.gmtime, t, None)\n\n    @classmethod\n    def _from_timestamp(cls, converter, timestamp, tzinfo):\n        t_full = timestamp\n        timestamp = int(_math.floor(timestamp))\n        frac = t_full - timestamp\n        us = _round(frac * 1e6)\n\n        # If timestamp is less than one microsecond smaller than a\n        # full second, us can be rounded up to 1000000.  In this case,\n        # roll over to seconds, otherwise, ValueError is raised\n        # by the constructor.\n        if us == 1000000:\n            timestamp += 1\n            us = 0\n        y, m, d, hh, mm, ss, weekday, jday, dst = converter(timestamp)\n        ss = min(ss, 59)    # clamp out leap seconds if the platform has them\n        return cls(y, m, d, hh, mm, ss, us, tzinfo)\n\n    @classmethod\n    def now(cls, tz=None):\n        \"Construct a datetime from time.time() and optional time zone info.\"\n        t = _time.time()\n        return cls.fromtimestamp(t, tz)\n\n    @classmethod\n    def utcnow(cls):\n        \"Construct a UTC datetime from time.time().\"\n        t = _time.time()\n        return cls.utcfromtimestamp(t)\n\n    @classmethod\n    def combine(cls, date, time):\n        \"Construct a datetime from a given date and a given time.\"\n        if not isinstance(date, _date_class):\n            raise TypeError(\"date argument must be a date instance\")\n        if not isinstance(time, _time_class):\n            raise TypeError(\"time argument must be a time instance\")\n        return cls(date.year, date.month, date.day,\n                   time.hour, time.minute, time.second, time.microsecond,\n                   time.tzinfo)\n\n    def timetuple(self):\n        \"Return local time tuple compatible with time.localtime().\"\n        dst = self._dst()\n        if dst is None:\n            dst = -1\n        elif dst:\n            dst = 1\n        return _build_struct_time(self.year, self.month, self.day,\n                                  self.hour, self.minute, self.second,\n                                  dst)\n\n    def utctimetuple(self):\n        \"Return UTC time tuple compatible with time.gmtime().\"\n        y, m, d = self.year, self.month, self.day\n        hh, mm, ss = self.hour, self.minute, self.second\n        offset = self._utcoffset()\n        if offset:  # neither None nor 0\n            mm -= offset\n            y, m, d, hh, mm, ss, _ = _normalize_datetime(\n                y, m, d, hh, mm, ss, 0, ignore_overflow=True)\n        return _build_struct_time(y, m, d, hh, mm, ss, 0)\n\n    def date(self):\n        \"Return the date part.\"\n        return date(self._year, self._month, self._day)\n\n    def time(self):\n        \"Return the time part, with tzinfo None.\"\n        return time(self.hour, self.minute, self.second, self.microsecond)\n\n    def timetz(self):\n        \"Return the time part, with same tzinfo.\"\n        return time(self.hour, self.minute, self.second, self.microsecond,\n                    self._tzinfo)\n\n    def replace(self, year=None, month=None, day=None, hour=None,\n                minute=None, second=None, microsecond=None, tzinfo=True):\n        \"\"\"Return a new datetime with new values for the specified fields.\"\"\"\n        if year is None:\n            year = self.year\n        if month is None:\n            month = self.month\n        if day is None:\n            day = self.day\n        if hour is None:\n            hour = self.hour\n        if minute is None:\n            minute = self.minute\n        if second is None:\n            second = self.second\n        if microsecond is None:\n            microsecond = self.microsecond\n        if tzinfo is True:\n            tzinfo = self.tzinfo\n        return datetime(year, month, day, hour, minute, second, microsecond,\n                        tzinfo)\n\n    def astimezone(self, tz):\n        if not isinstance(tz, tzinfo):\n            raise TypeError(\"tz argument must be an instance of tzinfo\")\n\n        mytz = self.tzinfo\n        if mytz is None:\n            raise ValueError(\"astimezone() requires an aware datetime\")\n\n        if tz is mytz:\n            return self\n\n        # Convert self to UTC, and attach the new time zone object.\n        myoffset = self.utcoffset()\n        if myoffset is None:\n            raise ValueError(\"astimezone() requires an aware datetime\")\n        utc = (self - myoffset).replace(tzinfo=tz)\n\n        # Convert from UTC to tz's local time.\n        return tz.fromutc(utc)\n\n    # Ways to produce a string.\n\n    def ctime(self):\n        \"Return ctime() style string.\"\n        weekday = self.toordinal() % 7 or 7\n        return \"%s %s %2d %02d:%02d:%02d %04d\" % (\n            _DAYNAMES[weekday],\n            _MONTHNAMES[self._month],\n            self._day,\n            self._hour, self._minute, self._second,\n            self._year)\n\n    def isoformat(self, sep='T'):\n        \"\"\"Return the time formatted according to ISO.\n\n        This is 'YYYY-MM-DD HH:MM:SS.mmmmmm', or 'YYYY-MM-DD HH:MM:SS' if\n        self.microsecond == 0.\n\n        If self.tzinfo is not None, the UTC offset is also attached, giving\n        'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM' or 'YYYY-MM-DD HH:MM:SS+HH:MM'.\n\n        Optional argument sep specifies the separator between date and\n        time, default 'T'.\n        \"\"\"\n        s = (\"%04d-%02d-%02d%c\" % (self._year, self._month, self._day, sep) +\n             _format_time(self._hour, self._minute, self._second,\n                          self._microsecond))\n        off = self._utcoffset()\n        if off is not None:\n            if off < 0:\n                sign = \"-\"\n                off = -off\n            else:\n                sign = \"+\"\n            hh, mm = divmod(off, 60)\n            s += \"%s%02d:%02d\" % (sign, hh, mm)\n        return s\n\n    def __repr__(self):\n        \"\"\"Convert to formal string, for repr().\"\"\"\n        L = [self._year, self._month, self._day,  # These are never zero\n             self._hour, self._minute, self._second, self._microsecond]\n        if L[-1] == 0:\n            del L[-1]\n        if L[-1] == 0:\n            del L[-1]\n        s = \", \".join(map(str, L))\n        module = \"datetime.\" if self.__class__ is datetime else \"\"\n        s = \"%s(%s)\" % (module + self.__class__.__name__, s)\n        if self._tzinfo is not None:\n            assert s[-1:] == \")\"\n            s = s[:-1] + \", tzinfo=%r\" % self._tzinfo + \")\"\n        return s\n\n    def __str__(self):\n        \"Convert to string, for str().\"\n        return self.isoformat(sep=' ')\n\n    @classmethod\n    def strptime(cls, date_string, format):\n        'string, format -> new datetime parsed from a string (like time.strptime()).'\n        from _strptime import _strptime\n        # _strptime._strptime returns a two-element tuple.  The first\n        # element is a time.struct_time object.  The second is the\n        # microseconds (which are not defined for time.struct_time).\n        struct, micros = _strptime(date_string, format)\n        return cls(*(struct[0:6] + (micros,)))\n\n    def utcoffset(self):\n        \"\"\"Return the timezone offset in minutes east of UTC (negative west of\n        UTC).\"\"\"\n        if self._tzinfo is None:\n            return None\n        offset = self._tzinfo.utcoffset(self)\n        offset = _check_utc_offset(\"utcoffset\", offset)\n        if offset is not None:\n            offset = timedelta._create(0, offset * 60, 0, True)\n        return offset\n\n    # Return an integer (or None) instead of a timedelta (or None).\n    def _utcoffset(self):\n        if self._tzinfo is None:\n            return None\n        offset = self._tzinfo.utcoffset(self)\n        offset = _check_utc_offset(\"utcoffset\", offset)\n        return offset\n\n    def tzname(self):\n        \"\"\"Return the timezone name.\n\n        Note that the name is 100% informational -- there's no requirement that\n        it mean anything in particular. For example, \"GMT\", \"UTC\", \"-500\",\n        \"-5:00\", \"EDT\", \"US/Eastern\", \"America/New York\" are all valid replies.\n        \"\"\"\n        if self._tzinfo is None:\n            return None\n        name = self._tzinfo.tzname(self)\n        _check_tzname(name)\n        return name\n\n    def dst(self):\n        \"\"\"Return 0 if DST is not in effect, or the DST offset (in minutes\n        eastward) if DST is in effect.\n\n        This is purely informational; the DST offset has already been added to\n        the UTC offset returned by utcoffset() if applicable, so there's no\n        need to consult dst() unless you're interested in displaying the DST\n        info.\n        \"\"\"\n        if self._tzinfo is None:\n            return None\n        offset = self._tzinfo.dst(self)\n        offset = _check_utc_offset(\"dst\", offset)\n        if offset is not None:\n            offset = timedelta._create(0, offset * 60, 0, True)\n        return offset\n\n    # Return an integer (or None) instead of a timedelta (or None).\n    def _dst(self):\n        if self._tzinfo is None:\n            return None\n        offset = self._tzinfo.dst(self)\n        offset = _check_utc_offset(\"dst\", offset)\n        return offset\n\n    # Comparisons of datetime objects with other.\n\n    def __eq__(self, other):\n        if isinstance(other, datetime):\n            return self._cmp(other) == 0\n        elif hasattr(other, \"timetuple\") and not isinstance(other, date):\n            return NotImplemented\n        else:\n            return False\n\n    def __ne__(self, other):\n        if isinstance(other, datetime):\n            return self._cmp(other) != 0\n        elif hasattr(other, \"timetuple\") and not isinstance(other, date):\n            return NotImplemented\n        else:\n            return True\n\n    def __le__(self, other):\n        if isinstance(other, datetime):\n            return self._cmp(other) <= 0\n        elif hasattr(other, \"timetuple\") and not isinstance(other, date):\n            return NotImplemented\n        else:\n            _cmperror(self, other)\n\n    def __lt__(self, other):\n        if isinstance(other, datetime):\n            return self._cmp(other) < 0\n        elif hasattr(other, \"timetuple\") and not isinstance(other, date):\n            return NotImplemented\n        else:\n            _cmperror(self, other)\n\n    def __ge__(self, other):\n        if isinstance(other, datetime):\n            return self._cmp(other) >= 0\n        elif hasattr(other, \"timetuple\") and not isinstance(other, date):\n            return NotImplemented\n        else:\n            _cmperror(self, other)\n\n    def __gt__(self, other):\n        if isinstance(other, datetime):\n            return self._cmp(other) > 0\n        elif hasattr(other, \"timetuple\") and not isinstance(other, date):\n            return NotImplemented\n        else:\n            _cmperror(self, other)\n\n    def _cmp(self, other):\n        assert isinstance(other, datetime)\n        mytz = self._tzinfo\n        ottz = other._tzinfo\n        myoff = otoff = None\n\n        if mytz is ottz:\n            base_compare = True\n        else:\n            if mytz is not None:\n                myoff = self._utcoffset()\n            if ottz is not None:\n                otoff = other._utcoffset()\n            base_compare = myoff == otoff\n\n        if base_compare:\n            return _cmp((self._year, self._month, self._day,\n                         self._hour, self._minute, self._second,\n                         self._microsecond),\n                        (other._year, other._month, other._day,\n                         other._hour, other._minute, other._second,\n                         other._microsecond))\n        if myoff is None or otoff is None:\n            raise TypeError(\"can't compare offset-naive and offset-aware datetimes\")\n        # XXX What follows could be done more efficiently...\n        diff = self - other     # this will take offsets into account\n        if diff.days < 0:\n            return -1\n        return diff and 1 or 0\n\n    def _add_timedelta(self, other, factor):\n        y, m, d, hh, mm, ss, us = _normalize_datetime(\n            self._year,\n            self._month,\n            self._day + other.days * factor,\n            self._hour,\n            self._minute,\n            self._second + other.seconds * factor,\n            self._microsecond + other.microseconds * factor)\n        return datetime(y, m, d, hh, mm, ss, us, tzinfo=self._tzinfo)\n\n    def __add__(self, other):\n        \"Add a datetime and a timedelta.\"\n        if not isinstance(other, timedelta):\n            return NotImplemented\n        return self._add_timedelta(other, 1)\n\n    __radd__ = __add__\n\n    def __sub__(self, other):\n        \"Subtract two datetimes, or a datetime and a timedelta.\"\n        if not isinstance(other, datetime):\n            if isinstance(other, timedelta):\n                return self._add_timedelta(other, -1)\n            return NotImplemented\n\n        delta_d = self.toordinal() - other.toordinal()\n        delta_s = (self._hour - other._hour) * 3600 + \\\n                  (self._minute - other._minute) * 60 + \\\n                  (self._second - other._second)\n        delta_us = self._microsecond - other._microsecond\n        base = timedelta._create(delta_d, delta_s, delta_us, True)\n        if self._tzinfo is other._tzinfo:\n            return base\n        myoff = self._utcoffset()\n        otoff = other._utcoffset()\n        if myoff == otoff:\n            return base\n        if myoff is None or otoff is None:\n            raise TypeError(\"can't subtract offset-naive and offset-aware datetimes\")\n        return base + timedelta(minutes = otoff-myoff)\n\n    def __hash__(self):\n        if self._hashcode == -1:\n            tzoff = self._utcoffset()\n            if tzoff is None:\n                self._hashcode = hash(self._getstate()[0])\n            else:\n                days = _ymd2ord(self.year, self.month, self.day)\n                seconds = self.hour * 3600 + (self.minute - tzoff) * 60 + self.second\n                self._hashcode = hash(timedelta(days, seconds, self.microsecond))\n        return self._hashcode\n\n\n\ndatetime.min = datetime(1, 1, 1)\ndatetime.max = datetime(9999, 12, 31, 23, 59, 59, 999999)\ndatetime.resolution = timedelta(microseconds=1)\n\n\ndef _isoweek1monday(year):\n    # Helper to calculate the day number of the Monday starting week 1\n    # XXX This could be done more efficiently\n    THURSDAY = 3\n    firstday = _ymd2ord(year, 1, 1)\n    firstweekday = (firstday + 6) % 7  # See weekday() above\n    week1monday = firstday - firstweekday\n    if firstweekday > THURSDAY:\n        week1monday += 7\n    return week1monday\n\n\"\"\"\nSome time zone algebra.  For a datetime x, let\n    x.n = x stripped of its timezone -- its naive time.\n    x.o = x.utcoffset(), and assuming that doesn't raise an exception or\n          return None\n    x.d = x.dst(), and assuming that doesn't raise an exception or\n          return None\n    x.s = x's standard offset, x.o - x.d\n\nNow some derived rules, where k is a duration (timedelta).\n\n1. x.o = x.s + x.d\n   This follows from the definition of x.s.\n\n2. If x and y have the same tzinfo member, x.s = y.s.\n   This is actually a requirement, an assumption we need to make about\n   sane tzinfo classes.\n\n3. The naive UTC time corresponding to x is x.n - x.o.\n   This is again a requirement for a sane tzinfo class.\n\n4. (x+k).s = x.s\n   This follows from #2, and that datimetimetz+timedelta preserves tzinfo.\n\n5. (x+k).n = x.n + k\n   Again follows from how arithmetic is defined.\n\nNow we can explain tz.fromutc(x).  Let's assume it's an interesting case\n(meaning that the various tzinfo methods exist, and don't blow up or return\nNone when called).\n\nThe function wants to return a datetime y with timezone tz, equivalent to x.\nx is already in UTC.\n\nBy #3, we want\n\n    y.n - y.o = x.n                             [1]\n\nThe algorithm starts by attaching tz to x.n, and calling that y.  So\nx.n = y.n at the start.  Then it wants to add a duration k to y, so that [1]\nbecomes true; in effect, we want to solve [2] for k:\n\n   (y+k).n - (y+k).o = x.n                      [2]\n\nBy #1, this is the same as\n\n   (y+k).n - ((y+k).s + (y+k).d) = x.n          [3]\n\nBy #5, (y+k).n = y.n + k, which equals x.n + k because x.n=y.n at the start.\nSubstituting that into [3],\n\n   x.n + k - (y+k).s - (y+k).d = x.n; the x.n terms cancel, leaving\n   k - (y+k).s - (y+k).d = 0; rearranging,\n   k = (y+k).s - (y+k).d; by #4, (y+k).s == y.s, so\n   k = y.s - (y+k).d\n\nOn the RHS, (y+k).d can't be computed directly, but y.s can be, and we\napproximate k by ignoring the (y+k).d term at first.  Note that k can't be\nvery large, since all offset-returning methods return a duration of magnitude\nless than 24 hours.  For that reason, if y is firmly in std time, (y+k).d must\nbe 0, so ignoring it has no consequence then.\n\nIn any case, the new value is\n\n    z = y + y.s                                 [4]\n\nIt's helpful to step back at look at [4] from a higher level:  it's simply\nmapping from UTC to tz's standard time.\n\nAt this point, if\n\n    z.n - z.o = x.n                             [5]\n\nwe have an equivalent time, and are almost done.  The insecurity here is\nat the start of daylight time.  Picture US Eastern for concreteness.  The wall\ntime jumps from 1:59 to 3:00, and wall hours of the form 2:MM don't make good\nsense then.  The docs ask that an Eastern tzinfo class consider such a time to\nbe EDT (because it's \"after 2\"), which is a redundant spelling of 1:MM EST\non the day DST starts.  We want to return the 1:MM EST spelling because that's\nthe only spelling that makes sense on the local wall clock.\n\nIn fact, if [5] holds at this point, we do have the standard-time spelling,\nbut that takes a bit of proof.  We first prove a stronger result.  What's the\ndifference between the LHS and RHS of [5]?  Let\n\n    diff = x.n - (z.n - z.o)                    [6]\n\nNow\n    z.n =                       by [4]\n    (y + y.s).n =               by #5\n    y.n + y.s =                 since y.n = x.n\n    x.n + y.s =                 since z and y are have the same tzinfo member,\n                                    y.s = z.s by #2\n    x.n + z.s\n\nPlugging that back into [6] gives\n\n    diff =\n    x.n - ((x.n + z.s) - z.o) =     expanding\n    x.n - x.n - z.s + z.o =         cancelling\n    - z.s + z.o =                   by #2\n    z.d\n\nSo diff = z.d.\n\nIf [5] is true now, diff = 0, so z.d = 0 too, and we have the standard-time\nspelling we wanted in the endcase described above.  We're done.  Contrarily,\nif z.d = 0, then we have a UTC equivalent, and are also done.\n\nIf [5] is not true now, diff = z.d != 0, and z.d is the offset we need to\nadd to z (in effect, z is in tz's standard time, and we need to shift the\nlocal clock into tz's daylight time).\n\nLet\n\n    z' = z + z.d = z + diff                     [7]\n\nand we can again ask whether\n\n    z'.n - z'.o = x.n                           [8]\n\nIf so, we're done.  If not, the tzinfo class is insane, according to the\nassumptions we've made.  This also requires a bit of proof.  As before, let's\ncompute the difference between the LHS and RHS of [8] (and skipping some of\nthe justifications for the kinds of substitutions we've done several times\nalready):\n\n    diff' = x.n - (z'.n - z'.o) =           replacing z'.n via [7]\n            x.n  - (z.n + diff - z'.o) =    replacing diff via [6]\n            x.n - (z.n + x.n - (z.n - z.o) - z'.o) =\n            x.n - z.n - x.n + z.n - z.o + z'.o =    cancel x.n\n            - z.n + z.n - z.o + z'.o =              cancel z.n\n            - z.o + z'.o =                      #1 twice\n            -z.s - z.d + z'.s + z'.d =          z and z' have same tzinfo\n            z'.d - z.d\n\nSo z' is UTC-equivalent to x iff z'.d = z.d at this point.  If they are equal,\nwe've found the UTC-equivalent so are done.  In fact, we stop with [7] and\nreturn z', not bothering to compute z'.d.\n\nHow could z.d and z'd differ?  z' = z + z.d [7], so merely moving z' by\na dst() offset, and starting *from* a time already in DST (we know z.d != 0),\nwould have to change the result dst() returns:  we start in DST, and moving\na little further into it takes us out of DST.\n\nThere isn't a sane case where this can happen.  The closest it gets is at\nthe end of DST, where there's an hour in UTC with no spelling in a hybrid\ntzinfo class.  In US Eastern, that's 5:MM UTC = 0:MM EST = 1:MM EDT.  During\nthat hour, on an Eastern clock 1:MM is taken as being in standard time (6:MM\nUTC) because the docs insist on that, but 0:MM is taken as being in daylight\ntime (4:MM UTC).  There is no local time mapping to 5:MM UTC.  The local\nclock jumps from 1:59 back to 1:00 again, and repeats the 1:MM hour in\nstandard time.  Since that's what the local clock *does*, we want to map both\nUTC hours 5:MM and 6:MM to 1:MM Eastern.  The result is ambiguous\nin local time, but so it goes -- it's the way the local clock works.\n\nWhen x = 5:MM UTC is the input to this algorithm, x.o=0, y.o=-5 and y.d=0,\nso z=0:MM.  z.d=60 (minutes) then, so [5] doesn't hold and we keep going.\nz' = z + z.d = 1:MM then, and z'.d=0, and z'.d - z.d = -60 != 0 so [8]\n(correctly) concludes that z' is not UTC-equivalent to x.\n\nBecause we know z.d said z was in daylight time (else [5] would have held and\nwe would have stopped then), and we know z.d != z'.d (else [8] would have held\nand we have stopped then), and there are only 2 possible values dst() can\nreturn in Eastern, it follows that z'.d must be 0 (which it is in the example,\nbut the reasoning doesn't depend on the example -- it depends on there being\ntwo possible dst() outcomes, one zero and the other non-zero).  Therefore\nz' must be in standard time, and is the spelling we want in this case.\n\nNote again that z' is not UTC-equivalent as far as the hybrid tzinfo class is\nconcerned (because it takes z' as being in standard time rather than the\ndaylight time we intend here), but returning it gives the real-life \"local\nclock repeats an hour\" behavior when mapping the \"unspellable\" UTC hour into\ntz.\n\nWhen the input is 6:MM, z=1:MM and z.d=0, and we stop at once, again with\nthe 1:MM standard time spelling we want.\n\nSo how can this break?  One of the assumptions must be violated.  Two\npossibilities:\n\n1) [2] effectively says that y.s is invariant across all y belong to a given\n   time zone.  This isn't true if, for political reasons or continental drift,\n   a region decides to change its base offset from UTC.\n\n2) There may be versions of \"double daylight\" time where the tail end of\n   the analysis gives up a step too early.  I haven't thought about that\n   enough to say.\n\nIn any case, it's clear that the default fromutc() is strong enough to handle\n\"almost all\" time zones:  so long as the standard offset is invariant, it\ndoesn't matter if daylight time transition points change from year to year, or\nif daylight time is skipped in some years; it doesn't matter how large or\nsmall dst() may get within its bounds; and it doesn't even matter if some\nperverse time zone returns a negative dst()).  So a breaking case must be\npretty bizarre, and a tzinfo subclass can override fromutc() if it is.\n\"\"\"\n", "src/lib/nntplib.py": "raise NotImplementedError(\"nntplib is not yet implemented in pgSkulpt\")\n", "src/lib/ssl.py": "raise NotImplementedError(\"ssl is not yet implemented in pgSkulpt\")\n", "src/lib/opcode.py": "raise NotImplementedError(\"opcode is not yet implemented in pgSkulpt\")\n", "src/lib/mailbox.py": "raise NotImplementedError(\"mailbox is not yet implemented in pgSkulpt\")\n", "src/lib/xmlrpclib.py": "raise NotImplementedError(\"xmlrpclib is not yet implemented in pgSkulpt\")\n", "src/lib/UserList.py": "raise NotImplementedError(\"UserList is not yet implemented in pgSkulpt\")\n", "src/lib/webgl/math.js": "var $builtinmodule = function(name)\n{\n    var mod = {};\n\n    // todo; should probably put this in a math package\n    mod.Mat44 = pgSk.misceval.buildClass(mod, function($gbl, $loc)\n            {\n                $loc.__init__ = new pgSk.builtin.func(function(self)\n                    {\n                        pgSk.misceval.callsim($loc.loadIdentity, self);\n                        self.stack = [];\n                    });\n\n                $loc.push = new pgSk.builtin.func(function(self)\n                    {\n                        self.stack.push(self.elements.slice(0));\n                    });\n\n                $loc.pop = new pgSk.builtin.func(function(self)\n                    {\n                        self.elements = self.stack.pop();\n                    });\n\n                $loc.loadIdentity = new pgSk.builtin.func(function(self)\n                    {\n                        self.elements = [1.0, 0.0, 0.0, 0.0,\n                                         0.0, 1.0, 0.0, 0.0,\n                                         0.0, 0.0, 1.0, 0.0,\n                                         0.0, 0.0, 0.0, 1.0];\n                    });\n\n                $loc.transform3 = new pgSk.builtin.func(function(self, v)\n                    {\n                        var e = self.elements;\n                        return pgSk.misceval.callsim(mod.Vec3,\n                            e[0] * v.x + e[4] * v.y + e[8] * v.z,\n                            e[1] * v.x + e[5] * v.y + e[9] * v.z,\n                            e[2] * v.x + e[6] * v.y + e[10] * v.z);\n                    });\n\n                $loc.scale = new pgSk.builtin.func(function(self, sx, sy, sz)\n                        {\n                            self.elements[0*4+0] *= sx;\n                            self.elements[0*4+1] *= sx;\n                            self.elements[0*4+2] *= sx;\n                            self.elements[0*4+3] *= sx;\n\n                            self.elements[1*4+0] *= sy;\n                            self.elements[1*4+1] *= sy;\n                            self.elements[1*4+2] *= sy;\n                            self.elements[1*4+3] *= sy;\n\n                            self.elements[2*4+0] *= sz;\n                            self.elements[2*4+1] *= sz;\n                            self.elements[2*4+2] *= sz;\n                            self.elements[2*4+3] *= sz;\n\n                            return self;\n                        });\n\n                $loc.translate = new pgSk.builtin.func(function(self, tx, ty, tz)\n                        {\n                            self.elements[3*4+0] += self.elements[0*4+0] * tx + self.elements[1*4+0] * ty + self.elements[2*4+0] * tz;\n                            self.elements[3*4+1] += self.elements[0*4+1] * tx + self.elements[1*4+1] * ty + self.elements[2*4+1] * tz;\n                            self.elements[3*4+2] += self.elements[0*4+2] * tx + self.elements[1*4+2] * ty + self.elements[2*4+2] * tz;\n                            self.elements[3*4+3] += self.elements[0*4+3] * tx + self.elements[1*4+3] * ty + self.elements[2*4+3] * tz;\n                            return self;\n                        });\n\n                $loc.rotate = new pgSk.builtin.func(function(self, angle, x, y, z)\n                        {\n                            var mag = Math.sqrt(x*x + y*y + z*z);\n                            var sinAngle = Math.sin(angle * Math.PI / 180.0);\n                            var cosAngle = Math.cos(angle * Math.PI / 180.0);\n\n                            if (mag > 0)\n                            {\n                                var xx, yy, zz, xy, yz, zx, xs, ys, zs;\n                                var oneMinusCos;\n                                var rotMat;\n\n                                x /= mag;\n                                y /= mag;\n                                z /= mag;\n\n                                xx = x * x;\n                                yy = y * y;\n                                zz = z * z;\n                                xy = x * y;\n                                yz = y * z;\n                                zx = z * x;\n                                xs = x * sinAngle;\n                                ys = y * sinAngle;\n                                zs = z * sinAngle;\n                                oneMinusCos = 1.0 - cosAngle;\n\n                                rotMat = pgSk.misceval.callsim(mod.Mat44);\n\n                                rotMat.elements[0*4+0] = (oneMinusCos * xx) + cosAngle;\n                                rotMat.elements[0*4+1] = (oneMinusCos * xy) - zs;\n                                rotMat.elements[0*4+2] = (oneMinusCos * zx) + ys;\n                                rotMat.elements[0*4+3] = 0.0;\n\n                                rotMat.elements[1*4+0] = (oneMinusCos * xy) + zs;\n                                rotMat.elements[1*4+1] = (oneMinusCos * yy) + cosAngle;\n                                rotMat.elements[1*4+2] = (oneMinusCos * yz) - xs;\n                                rotMat.elements[1*4+3] = 0.0;\n\n                                rotMat.elements[2*4+0] = (oneMinusCos * zx) - ys;\n                                rotMat.elements[2*4+1] = (oneMinusCos * yz) + xs;\n                                rotMat.elements[2*4+2] = (oneMinusCos * zz) + cosAngle;\n                                rotMat.elements[2*4+3] = 0.0;\n\n                                rotMat.elements[3*4+0] = 0.0;\n                                rotMat.elements[3*4+1] = 0.0;\n                                rotMat.elements[3*4+2] = 0.0;\n                                rotMat.elements[3*4+3] = 1.0;\n\n                                rotMat = rotMat.multiply(self);\n                                self.elements = rotMat.elements;\n                            }\n                            return self;\n                        });\n\n                $loc.multiply = new pgSk.builtin.func(function(self, right)\n                        {\n                            var tmp = pgSk.misceval.callsim(mod.Mat44);\n\n                            for (var i = 0; i < 4; i++)\n                            {\n                                tmp.elements[i*4+0] =\n                                (self.elements[i*4+0] * right.elements[0*4+0]) +\n                                (self.elements[i*4+1] * right.elements[1*4+0]) +\n                                (self.elements[i*4+2] * right.elements[2*4+0]) +\n                                (self.elements[i*4+3] * right.elements[3*4+0]) ;\n\n                                tmp.elements[i*4+1] =\n                                (self.elements[i*4+0] * right.elements[0*4+1]) +\n                                (self.elements[i*4+1] * right.elements[1*4+1]) +\n                                (self.elements[i*4+2] * right.elements[2*4+1]) +\n                                (self.elements[i*4+3] * right.elements[3*4+1]) ;\n\n                                tmp.elements[i*4+2] =\n                                (self.elements[i*4+0] * right.elements[0*4+2]) +\n                                (self.elements[i*4+1] * right.elements[1*4+2]) +\n                                (self.elements[i*4+2] * right.elements[2*4+2]) +\n                                (self.elements[i*4+3] * right.elements[3*4+2]) ;\n\n                                tmp.elements[i*4+3] =\n                                (self.elements[i*4+0] * right.elements[0*4+3]) +\n                                (self.elements[i*4+1] * right.elements[1*4+3]) +\n                                (self.elements[i*4+2] * right.elements[2*4+3]) +\n                                (self.elements[i*4+3] * right.elements[3*4+3]) ;\n                            }\n\n                            self.elements = tmp.elements;\n                            return self;\n                        });\n\n                /* Following gluLookAt implementation is adapted from\n                 * the Mesa 3D Graphics library. http://www.mesa3d.org\n                 */\n                // todo; rewrite this with proper vec/mat ops\n                $loc.lookAt = new pgSk.builtin.func(function(self, eyeX, eyeY, eyeZ,\n                                                                 centerX, centerY, centerZ,\n                                                                 upX, upY, upZ)\n                        {\n                            /* Z vector */\n                            var z = [\n                                eyeX - centerX,\n                                eyeY - centerY,\n                                eyeZ - centerZ\n                            ];\n                            var mag = Math.sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);\n                            if (mag)\n                            {\n                                z[0] /= mag;\n                                z[1] /= mag;\n                                z[2] /= mag;\n                            }\n\n                            /* Y vector */\n                            var y = [ upX, upY, upZ ];\n\n                            /* X vector = Y cross Z */\n                            var x = [];\n                            x[0] = y[1] * z[2] - y[2] * z[1];\n                            x[1] = -y[0] * z[2] + y[2] * z[0];\n                            x[2] = y[0] * z[1] - y[1] * z[0];\n\n                            /* Recompute Y = Z cross X */\n                            y[0] = z[1] * x[2] - z[2] * x[1];\n                            y[1] = -z[0] * x[2] + z[2] * x[0];\n                            y[2] = z[0] * x[1] - z[1] * x[0];\n\n                            /* mpichler, 19950515 */\n                            /* cross product gives area of parallelogram, which is < 1.0 for\n                            * non-perpendicular unit-length vectors; so normalize x, y here\n                            */\n\n                            mag = Math.sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);\n                            if (mag) {\n                                x[0] /= mag;\n                                x[1] /= mag;\n                                x[2] /= mag;\n                            }\n\n                            mag = Math.sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);\n                            if (mag) {\n                                y[0] /= mag;\n                                y[1] /= mag;\n                                y[2] /= mag;\n                            }\n\n                            var lookAt = pgSk.misceval.callsim(mod.Mat44);\n                            lookAt.elements[0 * 4 + 0] = x[0];\n                            lookAt.elements[1 * 4 + 0] = x[1];\n                            lookAt.elements[2 * 4 + 0] = x[2];\n                            lookAt.elements[3 * 4 + 0] = 0.;\n                            lookAt.elements[0 * 4 + 1] = y[0];\n                            lookAt.elements[1 * 4 + 1] = y[1];\n                            lookAt.elements[2 * 4 + 1] = y[2];\n                            lookAt.elements[3 * 4 + 1] = 0.;\n                            lookAt.elements[0 * 4 + 2] = z[0];\n                            lookAt.elements[1 * 4 + 2] = z[1];\n                            lookAt.elements[2 * 4 + 2] = z[2];\n                            lookAt.elements[3 * 4 + 2] = 0.;\n                            lookAt.elements[0 * 4 + 3] = 0.;\n                            lookAt.elements[1 * 4 + 3] = 0.;\n                            lookAt.elements[2 * 4 + 3] = 0.;\n                            lookAt.elements[3 * 4 + 3] = 1.;\n\n                            // log(lookAt.elements);\n\n                            lookAt = lookAt.multiply(self);\n                            self.elements = lookAt.elements;\n                            self.translate(-eyeX, -eyeY, -eyeZ);\n\n                            // log(this.elements);\n\n                            return self;\n                        });\n            },\n            'Mat44', []);\n\n    // todo; should probably put this in a math package\n    mod.Mat33 = pgSk.misceval.buildClass(mod, function($gbl, $loc)\n            {\n                $loc.__init__ = new pgSk.builtin.func(function(self)\n                    {\n                        pgSk.misceval.callsim($loc.loadIdentity, self);\n                    });\n\n                $loc.loadIdentity = new pgSk.builtin.func(function(self)\n                    {\n                        self.elements = [1.0, 0.0, 0.0,\n                                         0.0, 1.0, 0.0,\n                                         0.0, 0.0, 1.0];\n                    });\n            },\n            'Mat33', []);\n\n    mod.Vec3 = pgSk.misceval.buildClass(mod, function($gbl, $loc)\n            {\n                $loc.__init__ = new pgSk.builtin.func(function(self, x, y, z)\n                    {\n                        self.x = x;\n                        self.y = y;\n                        self.z = z;\n                    });\n                $loc.__sub__ = new pgSk.builtin.func(function(self, other)\n                    {\n                        return pgSk.misceval.callsim(mod.Vec3, self.x - other.x, self.y - other.y, self.z - other.z);\n                    });\n            },\n            'Vec3', []);\n    \n    mod.cross = new pgSk.builtin.func(function(v1, v2)\n            {\n                goog.asserts.assert(v1 instanceof mod.Vec3 && v2 instanceof mod.Vec3);\n                return pgSk.misceval.callsim(mod.Vec3,\n                    v1.y * v2.z - v1.z * v2.y,\n                    v1.z * v2.x - v1.x * v2.z,\n                    v1.x * v2.y - v1.y * v2.x);\n            });\n\n    return mod;\n};\n", "src/lib/toaiff.py": "raise NotImplementedError(\"toaiff is not yet implemented in pgSkulpt\")\n", "src/lib/__future__.py": "raise NotImplementedError(\"__future__ is not yet implemented in pgSkulpt\")\n", "src/lib/zipfile.py": "raise NotImplementedError(\"zipfile is not yet implemented in pgSkulpt\")\n", "src/lib/email/__init__.py": "raise NotImplementedError(\"email is not yet implemented in pgSkulpt\")\n", "src/lib/pythonds/__init__.py": "", "src/lib/dummy_thread.py": "raise NotImplementedError(\"dummy_thread is not yet implemented in pgSkulpt\")\n", "src/lib/Cookie.py": "raise NotImplementedError(\"Cookie is not yet implemented in pgSkulpt\")\n", "src/lib/ntpath.py": "raise NotImplementedError(\"ntpath is not yet implemented in pgSkulpt\")\n", "src/lib/platform.js": "var $builtinmodule = function(name){\n    var mod = {};\n    var inBrowser = (typeof window != \"undefined\") && (typeof window.navigator != \"undefined\");\n\n    mod.python_implementation = new pgSk.builtin.func(function() {\n        pgSk.builtin.pyCheckArgs(\"python_implementation\", arguments, 0, 0);\n        return new pgSk.builtin.str(\"pgSkulpt\");\n    });\n\n    mod.node = new pgSk.builtin.func(function() {\n        pgSk.builtin.pyCheckArgs(\"node\", arguments, 0, 0);\n        return new pgSk.builtin.str(\"\");\n    });\n\n    mod.version = new pgSk.builtin.func(function() {\n        pgSk.builtin.pyCheckArgs(\"version\", arguments, 0, 0);\n        return new pgSk.builtin.str(\"\");\n    });\n\n    mod.python_version = new pgSk.builtin.func(function() {\n        var vers;\n        pgSk.builtin.pyCheckArgs(\"python_version\", arguments, 0, 0);\n        if (pgSk.python3) {\n            vers = \"3.2.0\";\n        }\n        else {\n            vers = \"2.7.0\";\n        }\n        return new pgSk.builtin.str(vers);\n    });\n\n    mod.system = new pgSk.builtin.func(function() {\n        var sys;\n        pgSk.builtin.pyCheckArgs(\"system\", arguments, 0, 0);\n        if (inBrowser) {\n            sys = window.navigator.appCodeName;\n        }\n        else {\n            sys = \"\";\n        }\n        return new pgSk.builtin.str(sys);\n    });\n\n    mod.machine = new pgSk.builtin.func(function() {\n        var plat;\n        pgSk.builtin.pyCheckArgs(\"machine\", arguments, 0, 0);\n        if (inBrowser) {\n            plat = window.navigator.platform;\n        }\n        else {\n            plat = \"\";\n        }\n        return new pgSk.builtin.str(plat);\n    });\n\n    mod.release = new pgSk.builtin.func(function() {\n        var appVers;\n        pgSk.builtin.pyCheckArgs(\"release\", arguments, 0, 0);\n        if (inBrowser) {\n            appVers = window.navigator.appVersion;\n        }\n        else {\n            appVers = \"\";\n        }\n        return new pgSk.builtin.str(appVers);\n    });\n\n    mod.architecture = new pgSk.builtin.func(function() {\n        pgSk.builtin.pyCheckArgs(\"architecture\", arguments, 0, 0);\n        return new pgSk.builtin.tuple([new pgSk.builtin.str(\"64bit\"),\n                                     new pgSk.builtin.str(\"\")]);\n    });\n\n    mod.processor = new pgSk.builtin.func(function() {\n        pgSk.builtin.pyCheckArgs(\"processor\", arguments, 0, 0);\n        return new pgSk.builtin.str(\"\");\n    });\n\n    return mod;\n};\n", "src/lib/pstats.py": "raise NotImplementedError(\"pstats is not yet implemented in pgSkulpt\")\n", "src/lib/test/test_support.py": "\"\"\"Supporting definitions for the Python regression tests.\"\"\"\n\nif __name__ != 'test.test_support':\n    raise ImportError('test_support must be imported from the test package')\n\nimport unittest\n\n\n# def run_unittest(*classes):\n#     \"\"\"Run tests from unittest.TestCase-derived classes.\"\"\"\n#     valid_types = (unittest.TestSuite, unittest.TestCase)\n#     suite = unittest.TestSuite()\n#     for cls in classes:\n#         if isinstance(cls, str):\n#             if cls in sys.modules:\n#                 suite.addTest(unittest.findTestCases(sys.modules[cls]))\n#             else:\n#                 raise ValueError(\"str arguments must be keys in sys.modules\")\n#         elif isinstance(cls, valid_types):\n#             suite.addTest(cls)\n#         else:\n#             suite.addTest(unittest.makeSuite(cls))\n#     _run_suite(suite)\n\ndef run_unittest(*classes):\n    \"\"\"Run tests from unittest.TestCase-derived classes.\"\"\"\n    for cls in classes:\n        print cls\n        if issubclass(cls, unittest.TestCase):\n            cls().main()\n        else:\n            print \"Don't know what to do with \", cls\n", "src/lib/io.py": "raise NotImplementedError(\"io is not yet implemented in pgSkulpt\")\n", "src/lib/webgl/models.js": "// most of this file is from/based on 'tdl'\n\nvar $builtinmodule = function(name)\n{\n    var mod = {};\n\n    var Buffer = function(array, opt_target) {\n        var target = opt_target || gl.ARRAY_BUFFER;\n        var buf = gl.createBuffer();\n        this.target = target;\n        this.buf = buf;\n        this.set(array);\n        this.numComponents_ = array.numComponents;\n        this.numElements_ = array.numElements;\n        this.totalComponents_ = this.numComponents_ * this.numElements_;\n        if (array.buffer instanceof Float32Array) {\n            this.type_ = gl.FLOAT;\n        } else if (array.buffer instanceof Uint8Array) {\n            this.type_ = gl.UNSIGNED_BYTE;\n        } else if (array.buffer instanceof Int8Array) {\n            this.type_ = gl._BYTE;\n        } else if (array.buffer instanceof Uint16Array) {\n            this.type_ = gl.UNSIGNED_SHORT;\n        } else if (array.buffer instanceof Int16Array) {\n            this.type_ = gl.SHORT;\n        } else {\n            throw(\"unhandled type:\" + (typeof array.buffer));\n        }\n    };\n\n    Buffer.prototype.set = function(array) {\n        gl.bindBuffer(this.target, this.buf);\n        gl.bufferData(this.target, array.buffer, gl.STATIC_DRAW);\n    }\n\n    Buffer.prototype.type = function() {\n        return this.type_;\n    };\n\n    Buffer.prototype.numComponents = function() {\n        return this.numComponents_;\n    };\n\n    Buffer.prototype.numElements = function() {\n        return this.numElements_;\n    };\n\n    Buffer.prototype.totalComponents = function() {\n        return this.totalComponents_;\n    };\n\n    Buffer.prototype.buffer = function() {\n        return this.buf;\n    };\n\n    Buffer.prototype.stride = function() {\n        return 0;\n    };\n\n    Buffer.prototype.offset = function() {\n        return 0;\n    };\n\n\n\n    mod.Model = pgSk.misceval.buildClass(mod, function($gbl, $loc)\n            {\n                $loc.__init__ = new pgSk.builtin.func(function(self, shader, arrays, textures)\n                    {\n                        self.buffers = {};\n                        var setBuffer = function(name, array)\n                        {\n                            var target = (name == 'indices') ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;\n                            b = self.buffers[name];\n                            if (!b)\n                                b = new Buffer(array, target);\n                            else\n                                b.set(array);\n                            self.buffers[name] = b;\n                        };\n                        for (name in arrays)\n                            setBuffer(name, arrays[name]);\n\n                        var textureUnits = {};\n                        var unit = 0;\n                        for (var texture in textures)\n                        {\n                            textureUnits[texture] = unit++;\n                        }\n\n                        self.mode = gl.TRIANGLES;\n                        self.textures = textures.v;\n                        self.textureUnits = textureUnits;\n                        self.shader = shader;\n                    });\n\n                /**\n                * Sets up the shared parts of drawing this model. Uses the\n                * program, binds the buffers, sets the textures.\n                *\n                * @param {!Object.<string, *>} uniforms An object of names to\n                *     values to set on this models uniforms.\n                */\n                $loc.drawPrep = new pgSk.builtin.func(function(self, uniforms)\n                    {\n                        var shader = self.shader;\n                        var buffers = self.buffers;\n                        var textures = self.textures;\n\n                        uniforms = pgSk.ffi.remapToJs(uniforms);\n\n                        pgSk.misceval.callsim(shader.use, shader);\n\n                        for (var buffer in buffers) {\n                            var b = buffers[buffer];\n                            if (buffer == 'indices') {\n                                gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, b.buffer());\n                            } else {\n                                var attrib = shader.attrib[buffer];\n                                if (attrib) {\n                                    attrib(b);\n                                }\n                            }\n                        }\n\n                        for (var texture in textures) {\n                            var unit = self.textureUnits[texture];\n                            shader.setUniform$impl(shader, textuer, unit);\n                            textures[texture].bindToUnit(unit);\n                        }\n\n                        for (var uniform in uniforms) {\n                            shader.setUniform$impl(shader, uniform, uniforms[uniform]);\n                        }\n                    });\n\n                /**\n                * Draws this model.\n                *\n                * After calling tdl.models.Model.drawPrep you can call this\n                * function multiple times to draw this model.\n                *\n                * @param {!Object.<string, *>} uniforms An object of names to\n                *     values to set on this models uniforms.\n                */\n                $loc.draw = new pgSk.builtin.func(function(self, uniforms, opt_textures)\n                    {\n                        var shader = self.shader;\n                        uniforms = pgSk.ffi.remapToJs(uniforms);\n                        for (uniform in uniforms) {\n                            shader.setUniform$impl(shader, uniform, uniforms[uniform]);\n                        }\n\n                        if (opt_textures) {\n                            for (var texture in opt_textures) {\n                                var unit = self.textureUnits[texture];\n                                shader.setUniform$impl(shader, texture, unit);\n                                opt_textures[texture].bindToUnit(unit);\n                            }\n                        }\n\n                        var buffers = self.buffers;\n                        gl.drawElements(self.mode, buffers.indices.totalComponents(), gl.UNSIGNED_SHORT, 0);\n                    });\n            },\n            'Model', []);\n\n    return mod;\n};\n", "src/lib/dircache.py": "raise NotImplementedError(\"dircache is not yet implemented in pgSkulpt\")\n", "src/lib/email/test/data/__init__.py": "raise NotImplementedError(\"data is not yet implemented in pgSkulpt\")\n", "src/lib/sets.py": "raise NotImplementedError(\"sets is not yet implemented in pgSkulpt\")\n", "src/lib/SimpleHTTPServer.py": "raise NotImplementedError(\"SimpleHTTPServer is not yet implemented in pgSkulpt\")\n", "src/lib/image.js": "var ImageMod; // the single identifier needed in the global scope\nvar $builtinmodule;\n\nif (!ImageMod) {\n    ImageMod = {};\n    ImageMod.canvasLib = [];\n}\n\n$builtinmodule = function (name) {\n    var screen;\n    var pixel;\n    var eImage;\n    var mod = {};\n    var updateCanvasAndSuspend;\n    var initializeImage;\n    var checkPixelRange;\n    var remapImageIdToURL;\n\n    var image = function ($gbl, $loc) {\n        initializeImage = function (self) {\n            self.width = self.image.width;\n            self.height = self.image.height;\n            self.delay = 0;\n            self.updateCount = 0;\n            self.updateInterval = 1;\n            self.lastx = 0;\n            self.lasty = 0;\n            self.canvas = document.createElement(\"canvas\");\n            self.canvas.height = self.height;\n            self.canvas.width = self.width;\n            self.ctx = self.canvas.getContext(\"2d\");\n            self.ctx.drawImage(self.image, 0, 0);\n            self.imagedata = self.ctx.getImageData(0, 0, self.width, self.height);\n        };\n\n\n        $loc.__init__ = new pgSk.builtin.func(function (self, imageId) {\n            var susp;\n            pgSk.builtin.pyCheckArgs(\"__init__\", arguments, 2, 2);\n            try {\n                self.image = document.getElementById(pgSk.ffi.remapToJs(imageId));\n                initializeImage(self);\n            } catch (e) {\n                self.image = null;\n            }\n            if (self.image == null) {\n                susp = new pgSk.misceval.Suspension();\n                susp.resume = function () {\n                    // Should the post image get stuff go here??\n                    if (susp.data[\"error\"]) {\n                        throw new pgSk.builtin.IOError(susp.data[\"error\"].message);\n                    }\n                };\n                susp.data = {\n                    type: \"pgSk.promise\",\n                    promise: new Promise(function (resolve, reject) {\n                            var newImg = new Image();\n                            newImg.crossOrigin = \"\";\n                            newImg.onerror = function () {\n                                reject(Error(\"Failed to load URL: \" + newImg.src));\n                            };\n                            newImg.onload = function () {\n                                self.image = this;\n                                initializeImage(self);\n                                resolve();\n                            };\n                            // look for mapping from imagename to url and possible an image proxy server\n                            newImg.src = remapImageIdToURL(imageId);\n                        }\n                    )\n                };\n                return susp;\n            }\n\n        });\n\n        remapImageIdToURL = function (imageId) {\n            // if imageId starts with http -- OK\n            // if imageId is in pgSk.imageMap -- look it up\n            // if imageId is the name of an image file prepend http://host/app/book/_static/\n            // if image proxy server is configured construct url for proxy\n            // return the final URL\n            var url;\n            var ret;\n            ret = pgSk.ffi.remapToJs(imageId);\n            url = document.createElement(\"a\");\n            url.href = ret;\n            if (window.location.host !== url.host) {\n                ret = pgSk.imageProxy + \"/\" + ret;\n            }\n            return ret;\n        };\n\n        checkPixelRange = function (self, x, y) {\n            if (x < 0 || y < 0 || x >= self.width || y >= self.height) {\n                throw new pgSk.builtin.ValueError(\"Pixel index out of range.\");\n            }\n        };\n\n        $loc.setDelay = new pgSk.builtin.func(function (self, delay, interval) {\n            var i;\n            pgSk.builtin.pyCheckArgs(\"setDelay\", arguments, 2, 3);\n            self.delay = pgSk.ffi.remapToJs(delay);\n            i = pgSk.builtin.asnum$(interval);\n            if (!i) {\n                self.updateInterval = 1;\n            } else {\n                self.updateInterval = i;\n            }\n        });\n\n\n        //get a one-dimensional array of pixel objects - Zhu\n        $loc.getPixels = new pgSk.builtin.func(function (self) {\n            var arr = [];//initial array\n            var i;\n            pgSk.builtin.pyCheckArgs(\"getPixels\", arguments, 1, 1);\n\n            for (i = 0; i < self.image.height * self.image.width; i++) {\n\n                arr[i] = pgSk.misceval.callsim(self.getPixel, self,\n                    i % self.image.width, Math.floor(i / self.image.width));\n            }\n            return new pgSk.builtin.tuple(arr);\n        });\n\n        $loc.getPixel = new pgSk.builtin.func(function (self, x, y) {\n            var red;\n            var blue;\n            var green;\n            var index;\n            pgSk.builtin.pyCheckArgs(\"getPixel\", arguments, 3, 3);\n            x = pgSk.builtin.asnum$(x);\n            y = pgSk.builtin.asnum$(y);\n            checkPixelRange(self, x, y);\n            index = (y * 4) * self.width + (x * 4);\n            red = self.imagedata.data[index];\n            green = self.imagedata.data[index + 1];\n            blue = self.imagedata.data[index + 2];\n            return pgSk.misceval.callsim(mod.Pixel, red, green, blue, x, y);\n        });\n\n        updateCanvasAndSuspend = function (self, x, y) {\n            var susp = new pgSk.misceval.Suspension();\n            susp.resume = function () {\n                return pgSk.builtin.none.none$;\n            };\n            susp.data = {\n                type: \"pgSk.promise\",\n                promise: new Promise(function (resolve, reject) {\n                    self.updateCount++;\n                    if ((self.updateCount % self.updateInterval) === 0) {\n                        if (self.lastx + self.updateInterval >= self.width) {\n                            self.lastCtx.putImageData(self.imagedata, self.lastUlx, self.lastUly,\n                                0, self.lasty, self.width, 2);\n                        } else if (self.lasty + self.updateInterval >= self.height) {\n                            self.lastCtx.putImageData(self.imagedata, self.lastUlx, self.lastUly,\n                                self.lastx, 0, 2, self.height);\n                        } else {\n                            self.lastCtx.putImageData(self.imagedata, self.lastUlx, self.lastUly,\n                                Math.min(x, self.lastx),\n                                Math.min(y, self.lasty),\n                                Math.max(Math.abs(x - self.lastx), 1),\n                                Math.max(Math.abs(y - self.lasty), 1));\n                        }\n                        self.lastx = x;\n                        self.lasty = y;\n                        if (self.delay > 0) {\n                            window.setTimeout(resolve, self.delay);\n                        } else {\n                            resolve();\n                        }\n                    } else {\n                        resolve();\n                    }\n                })\n            };\n            return susp;\n        };\n\n        $loc.setPixel = new pgSk.builtin.func(function (self, x, y, pix) {\n            var index;\n            pgSk.builtin.pyCheckArgs(\"setPixel\", arguments, 4, 4);\n            x = pgSk.builtin.asnum$(x);\n            y = pgSk.builtin.asnum$(y);\n            checkPixelRange(self, x, y);\n            index = (y * 4) * self.width + (x * 4);\n            self.imagedata.data[index] = pgSk.builtin.asnum$(pgSk.misceval.callsim(pix.getRed, pix));\n            self.imagedata.data[index + 1] = pgSk.builtin.asnum$(pgSk.misceval.callsim(pix.getGreen, pix));\n            self.imagedata.data[index + 2] = pgSk.builtin.asnum$(pgSk.misceval.callsim(pix.getBlue, pix));\n            self.imagedata.data[index + 3] = 255;\n            return updateCanvasAndSuspend(self, x, y);\n        });\n\n        // update the image with the pixel at the given count - Zhu\n        $loc.setPixelAt = new pgSk.builtin.func(function (self, count, pixel) {\n            var x;\n            var y;\n            var index;\n            pgSk.builtin.pyCheckArgs(\"setPixelAt\", arguments, 3, 3);\n            count = pgSk.builtin.asnum$(count);\n            x = count % self.image.width;\n            y = Math.floor(count / self.image.width);\n            checkPixelRange(self, x, y);\n            index = (y * 4) * self.width + (x * 4);\n            self.imagedata.data[index] = pgSk.builtin.asnum$(pgSk.misceval.callsim(pixel.getRed, pixel));\n            self.imagedata.data[index + 1] = pgSk.builtin.asnum$(pgSk.misceval.callsim(pixel.getGreen, pixel));\n            self.imagedata.data[index + 2] = pgSk.builtin.asnum$(pgSk.misceval.callsim(pixel.getBlue, pixel));\n            self.imagedata.data[index + 3] = 255;\n            return updateCanvasAndSuspend(self, x, y);\n        });\n\n        // new updatePixel that uses the saved x and y location in the pixel - Barb Ericson\n        $loc.updatePixel = new pgSk.builtin.func(function (self, pixel) {\n            var x;\n            var y;\n            var index;\n            pgSk.builtin.pyCheckArgs(\"updatePixel\", arguments, 2, 2);\n            x = pgSk.builtin.asnum$(pgSk.misceval.callsim(pixel.getX, pixel));\n            y = pgSk.builtin.asnum$(pgSk.misceval.callsim(pixel.getY, pixel));\n            checkPixelRange(self, x, y);\n            index = (y * 4) * self.width + (x * 4);\n            self.imagedata.data[index] = pgSk.builtin.asnum$(pgSk.misceval.callsim(pixel.getRed, pixel));\n            self.imagedata.data[index + 1] = pgSk.builtin.asnum$(pgSk.misceval.callsim(pixel.getGreen, pixel));\n            self.imagedata.data[index + 2] = pgSk.builtin.asnum$(pgSk.misceval.callsim(pixel.getBlue, pixel));\n            self.imagedata.data[index + 3] = 255;\n            return updateCanvasAndSuspend(self, x, y);\n        });\n\n        $loc.getHeight = new pgSk.builtin.func(function (self) {\n            pgSk.builtin.pyCheckArgs(\"getHeight\", arguments, 1, 1);\n            return new pgSk.builtin.int_(self.image.height);\n        });\n\n        $loc.getWidth = new pgSk.builtin.func(function (self, titlestring) {\n            pgSk.builtin.pyCheckArgs(\"getWidth\", arguments, 1, 1);\n            return new pgSk.builtin.int_(self.image.width);\n        });\n\n        $loc.draw = new pgSk.builtin.func(function (self, win, ulx, uly) {\n            var susp;\n            pgSk.builtin.pyCheckArgs(\"draw\", arguments, 2, 4);\n            susp = new pgSk.misceval.Suspension();\n            susp.resume = function () {\n                return pgSk.builtin.none.none$;\n            };\n            susp.data = {\n                type: \"pgSk.promise\",\n                promise: new Promise(function (resolve, reject) {\n                    var can;\n                    var ctx;\n                    win = pgSk.builtin.asnum$(win);\n                    ulx = pgSk.builtin.asnum$(ulx);\n                    uly = pgSk.builtin.asnum$(uly);\n                    can = pgSk.misceval.callsim(win.getWin, win);\n                    ctx = can.getContext(\"2d\");\n                    if (!ulx) {\n                        ulx = 0;\n                        uly = 0;\n                    }\n                    self.lastUlx = ulx;\n                    self.lastUly = uly;\n                    self.lastCtx = ctx;  // save a reference to the context of the window the image was last drawn in\n                    //ctx.putImageData(self.imagedata,0,0,0,0,self.imagedata.width,self.imagedata.height);\n                    ctx.putImageData(self.imagedata, ulx, uly);\n\n                    if (self.delay > 0) {\n                        window.setTimeout(resolve, self.delay);\n                    } else {\n                        window.setTimeout(resolve, 200);\n                    }\n                })\n            };\n            return susp;\n\n        });\n\n        // toList\n\n    };\n\n    mod.Image = pgSk.misceval.buildClass(mod, image, \"Image\", []);\n\n    eImage = function ($gbl, $loc) {\n        $loc.__init__ = new pgSk.builtin.func(function (self, width, height) {\n            pgSk.builtin.pyCheckArgs(\"__init__\", arguments, 3, 3);\n            self.width = pgSk.builtin.asnum$(width);\n            self.height = pgSk.builtin.asnum$(height);\n            self.canvas = document.createElement(\"canvas\");\n            self.ctx = self.canvas.getContext(\"2d\");\n            self.canvas.height = self.height;\n            self.canvas.width = self.width;\n            self.imagedata = self.ctx.getImageData(0, 0, self.width, self.height);\n        });\n\n    };\n\n    mod.EmptyImage = pgSk.misceval.buildClass(mod, eImage, \"EmptyImage\", [mod.Image]);\n\n    // create a ListImage object\n\n\n    pixel = function ($gbl, $loc) {\n        $loc.__init__ = new pgSk.builtin.func(function (self, r, g, b, x, y) {\n            pgSk.builtin.pyCheckArgs(\"__init__\", arguments, 4, 6);\n            self.red = pgSk.builtin.asnum$(r);\n            self.green = pgSk.builtin.asnum$(g);\n            self.blue = pgSk.builtin.asnum$(b);\n            self.x = pgSk.builtin.asnum$(x);\n            self.y = pgSk.builtin.asnum$(y);\n        });\n\n        $loc.getRed = new pgSk.builtin.func(function (self) {\n            pgSk.builtin.pyCheckArgs(\"getRed\", arguments, 1, 1);\n            return pgSk.builtin.assk$(self.red);\n        });\n\n        $loc.getGreen = new pgSk.builtin.func(function (self) {\n            pgSk.builtin.pyCheckArgs(\"getGreen\", arguments, 1, 1);\n            return pgSk.builtin.assk$(self.green);\n        });\n\n        $loc.getBlue = new pgSk.builtin.func(function (self) {\n            pgSk.builtin.pyCheckArgs(\"getBlue\", arguments, 1, 1);\n            return pgSk.builtin.assk$(self.blue);\n        });\n\n        $loc.getX = new pgSk.builtin.func(function (self) {\n            pgSk.builtin.pyCheckArgs(\"getX\", arguments, 1, 1);\n            return pgSk.builtin.assk$(self.x);\n        });\n\n        $loc.getY = new pgSk.builtin.func(function (self) {\n            pgSk.builtin.pyCheckArgs(\"getY\", arguments, 1, 1);\n            return pgSk.builtin.assk$(self.y);\n        });\n\n        $loc.setRed = new pgSk.builtin.func(function (self, r) {\n            pgSk.builtin.pyCheckArgs(\"setRed\", arguments, 2, 2);\n            self.red = pgSk.builtin.asnum$(r);\n        });\n\n        $loc.setGreen = new pgSk.builtin.func(function (self, g) {\n            pgSk.builtin.pyCheckArgs(\"setGreen\", arguments, 2, 2);\n            self.green = pgSk.builtin.asnum$(g);\n        });\n\n        $loc.setBlue = new pgSk.builtin.func(function (self, b) {\n            pgSk.builtin.pyCheckArgs(\"setBlue\", arguments, 2, 2);\n            self.blue = pgSk.builtin.asnum$(b);\n        });\n\n        $loc.setX = new pgSk.builtin.func(function (self, x) {\n            pgSk.builtin.pyCheckArgs(\"setX\", arguments, 2, 2);\n            self.x = pgSk.builtin.asnum$(x);\n        });\n\n        $loc.setY = new pgSk.builtin.func(function (self, y) {\n            pgSk.builtin.pyCheckArgs(\"setY\", arguments, 2, 2);\n            self.y = pgSk.builtin.asnum$(y);\n        });\n\n        $loc.__getitem__ = new pgSk.builtin.func(function (self, k) {\n            k = pgSk.builtin.asnum$(k);\n            if (k === 0) {\n                return self.red;\n            } else if (k == 1) {\n                return self.green;\n            } else if (k == 2) {\n                return self.blue;\n            }\n        });\n\n        $loc.__str__ = new pgSk.builtin.func(function (self) {\n            return \"[\" + self.red + \",\" + self.green + \",\" + self.blue + \"]\";\n        });\n\n        //getColorTuple\n        $loc.getColorTuple = new pgSk.builtin.func(function (self, x, y) {\n\n        });\n\n        //setRange -- change from 0..255 to 0.0 .. 1.0\n        $loc.setRange = new pgSk.builtin.func(function (self, mx) {\n            self.max = pgSk.builtin.asnum$(mx);\n        });\n\n    };\n    mod.Pixel = pgSk.misceval.buildClass(mod, pixel, \"Pixel\", []);\n\n\n    screen = function ($gbl, $loc) {\n        $loc.__init__ = new pgSk.builtin.func(function (self, width, height) {\n            var currentCanvas;\n            var tmpCan, tmpDiv;\n            pgSk.builtin.pyCheckArgs(\"__init__\", arguments, 1, 3);\n            currentCanvas = ImageMod.canvasLib[pgSk.canvas];\n            if (currentCanvas === undefined) {\n                tmpCan = document.createElement(\"canvas\");\n                tmpDiv = document.getElementById(pgSk.canvas);\n                self.theScreen = tmpCan;\n                tmpDiv.appendChild(tmpCan);\n                ImageMod.canvasLib[pgSk.canvas] = tmpCan;\n                ImageMod.canvasLib[pgSk.canvas] = self.theScreen;\n            } else {\n                self.theScreen = currentCanvas;\n                self.theScreen.height = self.theScreen.height;\n            }\n            if (width !== undefined) {\n                self.theScreen.height = height.v;\n                self.theScreen.width = width.v;\n            } else {\n                if (pgSk.availableHeight) {\n                    self.theScreen.height = pgSk.availableHeight;\n                }\n                if (pgSk.availableWidth) {\n                    self.theScreen.width = pgSk.availableWidth;\n                }\n            }\n\n            self.theScreen.style.display = \"block\";\n        });\n\n        $loc.getWin = new pgSk.builtin.func(function (self) {\n            return self.theScreen;\n        });\n\n        // exitonclick\n        $loc.exitonclick = new pgSk.builtin.func(function (self) {\n            var canvas_id = self.theScreen.id;\n            self.theScreen.onclick = function () {\n                document.getElementById(canvas_id).style.display = \"none\";\n                document.getElementById(canvas_id).onclick = null;\n                delete ImageMod.canvasLib[canvas_id];\n            };\n\n        });\n        //getMouse\n    };\n\n    mod.ImageWin = pgSk.misceval.buildClass(mod, screen, \"ImageWin\", []);\n\n    return mod;\n};\n", "src/lib/wsgiref/__init__.py": "raise NotImplementedError(\"wsgiref is not yet implemented in pgSkulpt\")\n", "src/lib/httplib.py": "raise NotImplementedError(\"httplib is not yet implemented in pgSkulpt\")\n", "src/lib/lib2to3/__init__.py": "raise NotImplementedError(\"lib2to3 is not yet implemented in pgSkulpt\")\n", "src/lib/json/tests/__init__.py": "raise NotImplementedError(\"tests is not yet implemented in pgSkulpt\")\n", "src/lib/quopri.py": "raise NotImplementedError(\"quopri is not yet implemented in pgSkulpt\")\n", "src/lib/ftplib.py": "raise NotImplementedError(\"ftplib is not yet implemented in pgSkulpt\")\n", "src/lib/ctypes/__init__.py": "raise NotImplementedError(\"ctypes is not yet implemented in pgSkulpt\")\n", "src/lib/subprocess.py": "raise NotImplementedError(\"subprocess is not yet implemented in pgSkulpt\")\n", "src/lib/bsddb/__init__.py": "raise NotImplementedError(\"bsddb is not yet implemented in pgSkulpt\")\n", "src/lib/tempfile.py": "raise NotImplementedError(\"tempfile is not yet implemented in pgSkulpt\")\n", "src/lib/cProfile.py": "raise NotImplementedError(\"cProfile is not yet implemented in pgSkulpt\")\n", "src/lib/stringold.py": "raise NotImplementedError(\"stringold is not yet implemented in pgSkulpt\")\n", "src/lib/random.js": "/*\n I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace\n so it's better encapsulated. Now you can have multiple random number generators\n and they won't stomp all over eachother's state.\n\n If you want to use this as a substitute for Math.random(), use the random()\n method like so:\n\n var m = new MersenneTwister();\n var randomNumber = m.random();\n\n You can also call the other genrand_{foo}() methods on the instance.\n\n If you want to use a specific seed in order to get a repeatable random\n sequence, pass an integer into the constructor:\n\n var m = new MersenneTwister(123);\n\n and that will always produce the same random sequence.\n\n Sean McCullough (banksean@gmail.com)\n */\n\n/* \n A C-program for MT19937, with initialization improved 2002/1/26.\n Coded by Takuji Nishimura and Makoto Matsumoto.\n\n Before using, initialize the state by using init_genrand(seed)\n or init_by_array(init_key, key_length).\n\n Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions\n are met:\n\n 1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n 3. The names of its contributors may not be used to endorse or promote\n products derived from this software without specific prior written\n permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n Any feedback is very welcome.\n http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\n email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)\n */\n\nvar MersenneTwister = function (seed) {\n    if (seed == undefined) {\n        seed = new Date().getTime();\n    }\n    /* Period parameters */\n    this.N = 624;\n    this.M = 397;\n    this.MATRIX_A = 0x9908b0df;\n    /* constant vector a */\n    this.UPPER_MASK = 0x80000000;\n    /* most significant w-r bits */\n    this.LOWER_MASK = 0x7fffffff;\n    /* least significant r bits */\n\n    this.mt = new Array(this.N);\n    /* the array for the state vector */\n    this.mti = this.N + 1;\n    /* mti==N+1 means mt[N] is not initialized */\n\n    this.init_genrand(seed);\n}\n\n/* initializes mt[N] with a seed */\nMersenneTwister.prototype.init_genrand = function (s) {\n    this.mt[0] = s >>> 0;\n    for (this.mti = 1; this.mti < this.N; this.mti++) {\n        var s = this.mt[this.mti - 1] ^ (this.mt[this.mti - 1] >>> 30);\n        this.mt[this.mti] = (((((s & 0xffff0000) >>> 16) * 1812433253) << 16) + (s & 0x0000ffff) * 1812433253)\n            + this.mti;\n        /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */\n        /* In the previous versions, MSBs of the seed affect   */\n        /* only MSBs of the array mt[].                        */\n        /* 2002/01/09 modified by Makoto Matsumoto             */\n        this.mt[this.mti] >>>= 0;\n        /* for >32 bit machines */\n    }\n}\n\n/* initialize by an array with array-length */\n/* init_key is the array for initializing keys */\n/* key_length is its length */\n/* slight change for C++, 2004/2/26 */\nMersenneTwister.prototype.init_by_array = function (init_key, key_length) {\n    var i, j, k;\n    this.init_genrand(19650218);\n    i = 1;\n    j = 0;\n    k = (this.N > key_length ? this.N : key_length);\n    for (; k; k--) {\n        var s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30)\n        this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1664525) << 16) + ((s & 0x0000ffff) * 1664525)))\n            + init_key[j] + j;\n        /* non linear */\n        this.mt[i] >>>= 0;\n        /* for WORDSIZE > 32 machines */\n        i++;\n        j++;\n        if (i >= this.N) {\n            this.mt[0] = this.mt[this.N - 1];\n            i = 1;\n        }\n        if (j >= key_length) {\n            j = 0;\n        }\n    }\n    for (k = this.N - 1; k; k--) {\n        var s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);\n        this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1566083941) << 16) + (s & 0x0000ffff) * 1566083941))\n            - i;\n        /* non linear */\n        this.mt[i] >>>= 0;\n        /* for WORDSIZE > 32 machines */\n        i++;\n        if (i >= this.N) {\n            this.mt[0] = this.mt[this.N - 1];\n            i = 1;\n        }\n    }\n\n    this.mt[0] = 0x80000000;\n    /* MSB is 1; assuring non-zero initial array */\n}\n\n/* generates a random number on [0,0xffffffff]-interval */\nMersenneTwister.prototype.genrand_int32 = function () {\n    var y;\n    var mag01 = new Array(0x0, this.MATRIX_A);\n    /* mag01[x] = x * MATRIX_A  for x=0,1 */\n\n    if (this.mti >= this.N) { /* generate N words at one time */\n        var kk;\n\n        if (this.mti == this.N + 1)   /* if init_genrand() has not been called, */\n        {\n            this.init_genrand(5489);\n        }\n        /* a default initial seed is used */\n\n        for (kk = 0; kk < this.N - this.M; kk++) {\n            y = (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK);\n            this.mt[kk] = this.mt[kk + this.M] ^ (y >>> 1) ^ mag01[y & 0x1];\n        }\n        for (; kk < this.N - 1; kk++) {\n            y = (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK);\n            this.mt[kk] = this.mt[kk + (this.M - this.N)] ^ (y >>> 1) ^ mag01[y & 0x1];\n        }\n        y = (this.mt[this.N - 1] & this.UPPER_MASK) | (this.mt[0] & this.LOWER_MASK);\n        this.mt[this.N - 1] = this.mt[this.M - 1] ^ (y >>> 1) ^ mag01[y & 0x1];\n\n        this.mti = 0;\n    }\n\n    y = this.mt[this.mti++];\n\n    /* Tempering */\n    y ^= (y >>> 11);\n    y ^= (y << 7) & 0x9d2c5680;\n    y ^= (y << 15) & 0xefc60000;\n    y ^= (y >>> 18);\n\n    return y >>> 0;\n}\n\n/* generates a random number on [0,0x7fffffff]-interval */\nMersenneTwister.prototype.genrand_int31 = function () {\n    return (this.genrand_int32() >>> 1);\n}\n\n/* generates a random number on [0,1]-real-interval */\nMersenneTwister.prototype.genrand_real1 = function () {\n    return this.genrand_int32() * (1.0 / 4294967295.0);\n    /* divided by 2^32-1 */\n}\n\n/* generates a random number on [0,1)-real-interval */\nMersenneTwister.prototype.random = function () {\n    return this.genrand_int32() * (1.0 / 4294967296.0);\n    /* divided by 2^32 */\n}\n\n/* generates a random number on (0,1)-real-interval */\nMersenneTwister.prototype.genrand_real3 = function () {\n    return (this.genrand_int32() + 0.5) * (1.0 / 4294967296.0);\n    /* divided by 2^32 */\n}\n\n/* generates a random number on [0,1) with 53-bit resolution*/\nMersenneTwister.prototype.genrand_res53 = function () {\n    var a = this.genrand_int32() >>> 5, b = this.genrand_int32() >>> 6;\n    return(a * 67108864.0 + b) * (1.0 / 9007199254740992.0);\n}\n\n/* These real versions are due to Isaku Wada, 2002/01/09 added */\n\n\nvar $builtinmodule = function (name) {\n\n    var mod = {};\n\n    var myGenerator = new MersenneTwister();\n    var nextNormalSample = undefined;\n\n    mod.seed = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"seed\", arguments, 0, 1);\n        x = pgSk.builtin.asnum$(x);\n\n        if (arguments.length > 0) {\n            myGenerator = new MersenneTwister(x);\n        }\n        else {\n            myGenerator = new MersenneTwister();\n        }\n\n        return pgSk.builtin.none.none$;\n    });\n\n    mod.random = new pgSk.builtin.func(function () {\n        pgSk.builtin.pyCheckArgs(\"random\", arguments, 0, 0);\n\n        return new pgSk.builtin.float_(myGenerator.genrand_res53());\n    });\n\n    var toInt = function (num) {\n        return num | 0;\n    };\n\n    var randrange = function (start, stop, step) {\n        // Ported from CPython 2.7\n        var width, n, ret;\n\n        if (!pgSk.builtin.checkInt(start)) {\n            throw new pgSk.builtin.ValueError(\"non-integer first argument for randrange()\");\n        }\n        ;\n\n        if (stop === undefined) {\n            // Random in [0, start)\n            ret = toInt(myGenerator.genrand_res53() * start);\n            return new pgSk.builtin.int_(ret);\n        }\n        ;\n\n        if (!pgSk.builtin.checkInt(stop)) {\n            throw new pgSk.builtin.ValueError(\"non-integer stop for randrange()\");\n        }\n        ;\n\n        if (step === undefined) {\n            step = 1;\n        }\n        ;\n\n        width = stop - start;\n\n        if ((step == 1) && (width > 0)) {\n            // Random in [start, stop), must use toInt on product for correct results with negative ranges\n            ret = start + toInt(myGenerator.genrand_res53() * width);\n            return new pgSk.builtin.int_(ret);\n        }\n        ;\n\n        if (step == 1) {\n            throw new pgSk.builtin.ValueError(\"empty range for randrange() (\" + start + \", \" + stop + \", \" + width + \")\");\n        }\n        ;\n\n        if (!pgSk.builtin.checkInt(step)) {\n            throw new pgSk.builtin.ValueError(\"non-integer step for randrange()\");\n        }\n        ;\n\n        if (step > 0) {\n            n = toInt((width + step - 1) / step);\n        } else if (step < 0) {\n            n = toInt((width + step + 1) / step);\n        } else {\n            throw new pgSk.builtin.ValueError(\"zero step for randrange()\");\n        }\n        ;\n\n        if (n <= 0) {\n            throw new pgSk.builtin.ValueError(\"empty range for randrange()\");\n        }\n        ;\n\n        // Random in range(start, stop, step)\n        ret = start + (step * toInt(myGenerator.genrand_res53() * n));\n        return new pgSk.builtin.int_(ret);\n    };\n\n    mod.randint = new pgSk.builtin.func(function (a, b) {\n        pgSk.builtin.pyCheckArgs(\"randint\", arguments, 2, 2);\n\n        a = pgSk.builtin.asnum$(a);\n        b = pgSk.builtin.asnum$(b);\n        return randrange(a, b + 1);\n    });\n\n    mod.randrange = new pgSk.builtin.func(function (start, stop, step) {\n        pgSk.builtin.pyCheckArgs(\"randrange\", arguments, 1, 3);\n\n        start = pgSk.builtin.asnum$(start);\n        stop = pgSk.builtin.asnum$(stop);\n        step = pgSk.builtin.asnum$(step);\n        return randrange(start, stop, step);\n    });\n  \n    mod.uniform = new pgSk.builtin.func(function (a, b) {\n        pgSk.builtin.pyCheckArgs(\"uniform\", arguments, 2, 2);\n\n        a = pgSk.builtin.asnum$(a);\n        b = pgSk.builtin.asnum$(b);\n        var rnd = myGenerator.genrand_res53();\n        c = a + rnd * (b - a)\n        return new pgSk.builtin.float_(c);\n    });\n\n    mod.triangular = new pgSk.builtin.func(function (low, high, mode) {\n        pgSk.builtin.pyCheckArgs(\"triangular\", arguments, 2, 3);\n        pgSk.builtin.pyCheckType(\"low\", \"number\", pgSk.builtin.checkNumber(low));\n        pgSk.builtin.pyCheckType(\"high\", \"number\", pgSk.builtin.checkNumber(high));\n\n        var rnd, sample, swap;\n\n        low = pgSk.builtin.asnum$(low);\n        high = pgSk.builtin.asnum$(high);\n        if (low > high) {\n            swap = low;\n            low = high;\n            high = swap;\n        }\n        if ((mode === undefined) || (mode instanceof pgSk.builtin.none)) {\n            mode = (high - low)/2.0;\n        } else {\n            pgSk.builtin.pyCheckType(\"mode\", \"number\", pgSk.builtin.checkNumber(mode));\n            mode = pgSk.builtin.asnum$(mode);\n        }\n\n        // https://en.wikipedia.org/wiki/Triangular_distribution\n        rnd = myGenerator.genrand_res53();\n        if (rnd < (mode - low)/(high - low)) {\n            sample = low + Math.sqrt(rnd * (high - low) * (mode - low));\n        } else {\n            sample = high - Math.sqrt((1 - rnd) * (high - low) * (high - mode));\n        }\n\n        return new pgSk.builtin.float_(sample);\n    });\n\n    var normalSample = function(mu, sigma) {\n        var r1, r2, u, v, s;\n\n        // Box-Muller transform\n        // (https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform)\n        // generates two independent samples from a Gaussian\n        // distribution. Return one of them and store the another one\n        // and return it next time.\n\n        if (nextNormalSample !== undefined) {\n            s = nextNormalSample;\n            nextNormalSample = undefined;\n        } else {\n            r1 = myGenerator.genrand_res53();\n            r2 = myGenerator.genrand_res53();\n            u = Math.sqrt(-2*Math.log(r1));\n            v = 2*Math.PI*r2;\n            s = u * Math.cos(v);\n            nextNormalSample = u * Math.sin(v);\n        }\n\n        return mu + sigma*s;\n    };\n    \n    mod.gauss = new pgSk.builtin.func(function (mu, sigma) {\n        pgSk.builtin.pyCheckArgs(\"gauss\", arguments, 2, 2);\n        pgSk.builtin.pyCheckType(\"mu\", \"number\", pgSk.builtin.checkNumber(mu));\n        pgSk.builtin.pyCheckType(\"sigma\", \"number\", pgSk.builtin.checkNumber(sigma));\n\n        mu = pgSk.builtin.asnum$(mu);\n        sigma = pgSk.builtin.asnum$(sigma);\n\n        return new pgSk.builtin.float_(normalSample(mu, sigma));\n    });\n\n    // CPython uses a different (slower but thread-safe) algorithm for\n    // normalvariate. We use the same algorithm for normalvariate and\n    // gauss.\n    mod.normalvariate = mod.gauss;\n\n    mod.lognormvariate = new pgSk.builtin.func(function (mu, sigma) {\n        pgSk.builtin.pyCheckArgs(\"lognormvariate\", arguments, 2, 2);\n        pgSk.builtin.pyCheckType(\"mu\", \"number\", pgSk.builtin.checkNumber(mu));\n        pgSk.builtin.pyCheckType(\"sigma\", \"number\", pgSk.builtin.checkNumber(sigma));\n\n        mu = pgSk.builtin.asnum$(mu);\n        sigma = pgSk.builtin.asnum$(sigma);\n\n        return new pgSk.builtin.float_(Math.exp(normalSample(mu, sigma)));\n    });\n\n    mod.expovariate = new pgSk.builtin.func(function (lambd) {\n        pgSk.builtin.pyCheckArgs(\"expovariate\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"lambd\", \"number\", pgSk.builtin.checkNumber(lambd));\n\n        lambd = pgSk.builtin.asnum$(lambd);\n\n        var rnd = myGenerator.genrand_res53();\n        return new pgSk.builtin.float_(-Math.log(rnd)/lambd);\n    });\n\n    mod.choice = new pgSk.builtin.func(function (seq) {\n        pgSk.builtin.pyCheckArgs(\"choice\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"seq\", \"sequence\", pgSk.builtin.checkSequence(seq));\n\n        if (seq.sq$length !== undefined) {\n            var r = toInt(myGenerator.genrand_res53() * seq.sq$length());\n            return seq.mp$subscript(r);\n        } else {\n            throw new pgSk.builtin.TypeError(\"object has no length\");\n        }\n    });\n\n    mod.shuffle = new pgSk.builtin.func(function (x) {\n        pgSk.builtin.pyCheckArgs(\"shuffle\", arguments, 1, 1);\n        pgSk.builtin.pyCheckType(\"x\", \"sequence\", pgSk.builtin.checkSequence(x));\n\n        if (x.sq$length !== undefined) {\n            if (x.mp$ass_subscript !== undefined) {\n                for (var i = x.sq$length() - 1; i > 0; i -= 1) {\n                    var r = toInt(myGenerator.genrand_res53() * (i + 1));\n                    var tmp = x.mp$subscript(r);\n                    x.mp$ass_subscript(r, x.mp$subscript(i));\n                    x.mp$ass_subscript(i, tmp);\n                }\n                ;\n            } else {\n                throw new pgSk.builtin.TypeError(\"object is immutable\");\n            }\n            ;\n        } else {\n            throw new pgSk.builtin.TypeError(\"object has no length\");\n        }\n        ;\n\n        return pgSk.builtin.none.none$;\n    });\n\n    mod.sample = new pgSk.builtin.func(function (population, k) {\n        var i, j, iter, elem, reservoir;\n\n        pgSk.builtin.pyCheckArgs(\"sample\", arguments, 2, 2);\n        pgSk.builtin.pyCheckType(\"population\", \"iterable\", pgSk.builtin.checkIterable(population));\n        pgSk.builtin.pyCheckType(\"k\", \"integer\", pgSk.builtin.checkInt(k));\n        k = pgSk.builtin.asnum$(k);\n        \n        // \"Algorithm R\" in\n        // https://en.wikipedia.org/wiki/Reservoir_sampling\n        //\n        // This algorithm guarantees that each element has\n        // equal probability of being included in the\n        // resulting list. See the Wikipedia page for a proof.\n        //\n        // This requires no extra space but the runtime is\n        // proportional to len(population). CPython implements a fast\n        // path for the case when k is much smaller than\n        // len(population). A similar optimization could be\n        // implemented here.\n        reservoir = [];\n        iter = pgSk.abstr.iter(population);\n        for (i = 0, elem = iter.tp$iternext();\n             elem !== undefined;\n             i++, elem = iter.tp$iternext()) {\n            j = Math.floor(myGenerator.genrand_res53() * (i + 1));\n            if (i < k) {\n                // Fill the reservoir\n                if (j < i) {\n                    // Shuffle the existing elements to ensure that\n                    // subslices are valid random samples\n                    reservoir[i] = reservoir[j];\n                }\n                reservoir[j] = elem;\n            } else {\n                // Replace elements with a probability that decreases\n                // the further we get\n                if (j < k) {\n                    reservoir[j] = elem;\n                }\n            }\n        }\n        \n        if (i < k) {\n            throw new pgSk.builtin.ValueError(\"sample larger than population\");\n        }\n\n        return pgSk.builtin.list(reservoir);\n    });\n\n    return mod;\n}\n", "src/lib/plistlib.py": "raise NotImplementedError(\"plistlib is not yet implemented in pgSkulpt\")\n", "src/lib/tarfile.py": "raise NotImplementedError(\"tarfile is not yet implemented in pgSkulpt\")\n", "src/lib/pydoc_topics.py": "raise NotImplementedError(\"pydoc_topics is not yet implemented in pgSkulpt\")\n", "src/lib/keyword.py": "\n__all__ = [\"iskeyword\", \"kwlist\"]\n\nkwlist = [\n#--start keywords--\n        'and',\n        'as',\n        'assert',\n        'break',\n        'class',\n        'continue',\n        'def',\n        'del',\n        'elif',\n        'else',\n        'except',\n        'exec',\n        'finally',\n        'for',\n        'from',\n        'global',\n        'if',\n        'import',\n        'in',\n        'is',\n        'lambda',\n        'not',\n        'or',\n        'pass',\n        'print',\n        'raise',\n        'return',\n        'try',\n        'while',\n        'with',\n        'yield',\n#--end keywords--\n        ]\n\ndef iskeyword(wd):\n    return wd in kwlist\n\n", "src/lib/webbrowser.py": "raise NotImplementedError(\"webbrowser is not yet implemented in pgSkulpt\")\n", "src/lib/mimetools.py": "raise NotImplementedError(\"mimetools is not yet implemented in pgSkulpt\")\n", "src/lib/pythonds/trees/bst.py": "#!/bin/env python3.1\n# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005, 2010\n# \n\nclass BinarySearchTree:\n    '''\n    Author:  Brad Miller\n    Date:  1/15/2005\n    Description:  Imlement a binary search tree with the following interface\n                  functions:  \n                  __contains__(y) <==> y in x\n                  __getitem__(y) <==> x[y]\n                  __init__()\n                  __len__() <==> len(x)\n                  __setitem__(k,v) <==> x[k] = v\n                  clear()\n                  get(k)\n                  items() \n                  keys() \n                  values()\n                  put(k,v)\n                  in\n                  del <==> \n    '''\n\n    def __init__(self):\n        self.root = None\n        self.size = 0\n    \n    def put(self,key,val):\n        if self.root:\n            self._put(key,val,self.root)\n        else:\n            self.root = TreeNode(key,val)\n        self.size = self.size + 1\n\n    def _put(self,key,val,currentNode):\n        if key < currentNode.key:\n            if currentNode.hasLeftChild():\n                self._put(key,val,currentNode.leftChild)\n            else:\n                currentNode.leftChild = TreeNode(key,val,parent=currentNode)\n        else:\n            if currentNode.hasRightChild():\n                self._put(key,val,currentNode.rightChild)\n            else:\n                currentNode.rightChild = TreeNode(key,val,parent=currentNode)\n            \n    def __setitem__(self,k,v):\n        self.put(k,v)\n\n    def get(self,key):\n        if self.root:\n            res = self._get(key,self.root)\n            if res:\n                return res.payload\n            else:\n                return None\n        else:\n            return None\n        \n    def _get(self,key,currentNode):\n        if not currentNode:\n            return None\n        elif currentNode.key == key:\n            return currentNode\n        elif key < currentNode.key:\n            return self._get(key,currentNode.leftChild)\n        else:\n            return self._get(key,currentNode.rightChild)\n            \n        \n    def __getitem__(self,key):\n        res = self.get(key)\n        if res:\n            return res\n        else:\n            raise KeyError('Error, key not in tree')\n            \n\n    def __contains__(self,key):\n        if self._get(key,self.root):\n            return True\n        else:\n            return False\n        \n    def length(self):\n        return self.size\n\n    def __len__(self):\n        return self.size\n\n    def __iter__(self):\n        return self.root.__iter__()\n    \n    def delete(self,key):\n        if self.size > 1:\n            nodeToRemove = self._get(key,self.root)\n            if nodeToRemove:\n                self.remove(nodeToRemove)\n                self.size = self.size-1\n            else:\n                raise KeyError('Error, key not in tree')\n        elif self.size == 1 and self.root.key == key:\n            self.root = None\n            self.size = self.size - 1\n        else:\n            raise KeyError('Error, key not in tree')\n\n    def __delitem__(self,key):\n        self.delete(key)\n    \n    def remove(self,currentNode):\n        if currentNode.isLeaf(): #leaf\n            if currentNode == currentNode.parent.leftChild:\n                currentNode.parent.leftChild = None\n            else:\n                currentNode.parent.rightChild = None\n        elif currentNode.hasBothChildren(): #interior\n            succ = currentNode.findSuccessor()\n            succ.spliceOut()\n            currentNode.key = succ.key\n            currentNode.payload = succ.payload\n        else: # this node has one child\n            if currentNode.hasLeftChild():\n                if currentNode.isLeftChild():\n                    currentNode.leftChild.parent = currentNode.parent\n                    currentNode.parent.leftChild = currentNode.leftChild\n                elif currentNode.isRightChild():\n                    currentNode.leftChild.parent = currentNode.parent\n                    currentNode.parent.rightChild = currentNode.leftChild\n                else:\n                    currentNode.replaceNodeData(currentNode.leftChild.key,\n                                       currentNode.leftChild.payload,\n                                       currentNode.leftChild.leftChild,\n                                       currentNode.leftChild.rightChild)\n            else:\n                if currentNode.isLeftChild():\n                    currentNode.rightChild.parent = currentNode.parent\n                    currentNode.parent.leftChild = currentNode.rightChild\n                elif currentNode.isRightChild():\n                    currentNode.rightChild.parent = currentNode.parent\n                    currentNode.parent.rightChild = currentNode.rightChild\n                else:\n                    currentNode.replaceNodeData(currentNode.rightChild.key,\n                                       currentNode.rightChild.payload,\n                                       currentNode.rightChild.leftChild,\n                                       currentNode.rightChild.rightChild)\n\n    def inorder(self):\n        self._inorder(self.root)\n\n    def _inorder(self,tree):\n        if tree != None:\n            self._inorder(tree.leftChild)\n            print(tree.key)\n            self._inorder(tree.rightChild)\n\n    def postorder(self):\n        self._postorder(self.root)\n\n    def _postorder(self, tree):\n        if tree:\n            self._postorder(tree.rightChild)\n            self._postorder(tree.leftChild)\n            print(tree.key)            \n\n    def preorder(self):\n        self._preorder(self,self.root)\n\n    def _preorder(self,tree):\n        if tree:\n            print(tree.key)            \n            self._preorder(tree.leftChild)\n            self._preorder(tree.rightChild)\n\n                \nclass TreeNode:\n    def __init__(self,key,val,left=None,right=None,parent=None):\n        self.key = key\n        self.payload = val\n        self.leftChild = left\n        self.rightChild = right\n        self.parent = parent\n        self.balanceFactor = 0\n        \n    def hasLeftChild(self):\n        return self.leftChild\n\n    def hasRightChild(self):\n        return self.rightChild\n    \n    def isLeftChild(self):\n        return self.parent and self.parent.leftChild == self\n\n    def isRightChild(self):\n        return self.parent and self.parent.rightChild == self\n\n    def isRoot(self):\n        return not self.parent\n\n    def isLeaf(self):\n        return not (self.rightChild or self.leftChild)\n\n    def hasAnyChildren(self):\n        return self.rightChild or self.leftChild\n\n    def hasBothChildren(self):\n        return self.rightChild and self.leftChild\n    \n    def replaceNodeData(self,key,value,lc,rc):\n        self.key = key\n        self.payload = value\n        self.leftChild = lc\n        self.rightChild = rc\n        if self.hasLeftChild():\n            self.leftChild.parent = self\n        if self.hasRightChild():\n            self.rightChild.parent = self\n        \n    def findSuccessor(self):\n        succ = None\n        if self.hasRightChild():\n            succ = self.rightChild.findMin()\n        else:\n            if self.parent:\n                if self.isLeftChild():\n                    succ = self.parent\n                else:\n                    self.parent.rightChild = None\n                    succ = self.parent.findSuccessor()\n                    self.parent.rightChild = self\n        return succ\n\n\n    def spliceOut(self):\n        if self.isLeaf():\n            if self.isLeftChild():\n                self.parent.leftChild = None\n            else:\n                self.parent.rightChild = None\n        elif self.hasAnyChildren():\n            if self.hasLeftChild():\n                if self.isLeftChild():\n                    self.parent.leftChild = self.leftChild\n                else:\n                    self.parent.rightChild = self.leftChild\n                self.leftChild.parent = self.parent\n            else:\n                if self.isLeftChild():\n                    self.parent.leftChild = self.rightChild\n                else:\n                    self.parent.rightChild = self.rightChild\n                self.rightChild.parent = self.parent\n\n    def findMin(self):\n        current = self\n        while current.hasLeftChild():\n            current = current.leftChild\n        return current\n\n    def __iter__(self):\n        \"\"\"The standard inorder traversal of a binary tree.\"\"\"\n        if self:\n            if self.hasLeftChild():\n                for elem in self.leftChild:\n                    yield elem\n            yield self.key\n            if self.hasRightChild():\n                for elem in self.rightChild:\n                    yield elem\n\n            \n", "src/lib/document.js": "var $builtinmodule = function (name) {\n    var elementClass;\n    var mod = {};\n\n    mod.getElementById = new pgSk.builtin.func(function (id) {\n        var result = document.getElementById(id.v);\n        if (result) {\n            return pgSk.misceval.callsim(mod.Element, result);\n        }\n        return pgSk.builtin.none.none$;\n    });\n\n    mod.createElement = new pgSk.builtin.func(function (eName) {\n        var r = document.createElement(eName.v);\n        if (r) {\n            return pgSk.misceval.callsim(mod.Element, r);\n        }\n    });\n\n\n    mod.getElementsByTagName = new pgSk.builtin.func(function (tag) {\n        var r = document.getElementsByTagName(tag.v)\n        var reslist = [];\n        for (var i = r.length - 1; i >= 0; i--) {\n            reslist.push(pgSk.misceval.callsim(mod.Element, r[i]))\n        }\n        return new pgSk.builtin.list(reslist)\n    });\n\n    mod.getElementsByClassName = new pgSk.builtin.func(function (cname) {\n        var r = document.getElementsByClassName(cname.v);\n        var reslist = [];\n        for (var i = 0; i < r.length; i++) {\n            reslist.push(pgSk.misceval.callsim(mod.Element, r[i]));\n        }\n        ;\n        return new pgSk.builtin.list(reslist);\n    });\n\n    mod.getElementsByName = new pgSk.builtin.func(function (cname) {\n        var r = document.getElementsByName(cname.v);\n        var reslist = [];\n        for (var i = 0; i < r.length; i++) {\n            reslist.push(pgSk.misceval.callsim(mod.Element, r[i]));\n        }\n        ;\n        return new pgSk.builtin.list(reslist);\n    });\n\n    mod.currentDiv = new pgSk.builtin.func(function () {\n        if (pgSk.divid !== undefined) {\n            return new pgSk.builtin.str(pgSk.divid)\n        }\n        else {\n            throw new pgSk.builtin.AttributeError(\"There is no value set for divid\");\n        }\n    })\n\n    elementClass = function ($gbl, $loc) {\n        /*\n         Notes:  self['$d'] is the dictionary used by the GenericGetAttr mechanism for an object.\n         for various reasons  if you create a class in Javascript and have self.xxxx instance\n         variables, you cannot say instance.xxx and get the value of the instance variable unless\n         it is stored in the self['$d'] object.  This seems like a duplication of storage to me\n         but that is how it works right now  (5/2013)\n\n         Writing your own __getattr__ is also an option but this gets very tricky when an attr is\n         a method...\n         */\n        $loc.__init__ = new pgSk.builtin.func(function (self, elem) {\n            self.v = elem\n            self.innerHTML = elem.innerHTML\n            self.innerText = elem.innerText\n            if (elem.value !== undefined) {\n                self.value = elem.value\n                pgSk.abstr.objectSetItem(self['$d'], new pgSk.builtin.str('value'), new pgSk.builtin.str(self.value))\n            }\n\n            if (elem.checked !== undefined) {\n                self.checked = elem.checked\n                pgSk.abstr.objectSetItem(self['$d'], new pgSk.builtin.str('checked'), new pgSk.builtin.str(self.checked))\n            }\n\n            pgSk.abstr.objectSetItem(self['$d'], new pgSk.builtin.str('innerHTML'), new pgSk.builtin.str(self.innerHTML))\n            pgSk.abstr.objectSetItem(self['$d'], new pgSk.builtin.str('innerText'), new pgSk.builtin.str(self.innerText))\n\n        })\n\n        $loc.tp$getattr = pgSk.builtin.object.prototype.GenericGetAttr;\n\n        $loc.__setattr__ = new pgSk.builtin.func(function (self, key, value) {\n            key = pgSk.ffi.remapToJs(key);\n            if (key === 'innerHTML') {\n                self.innerHTML = value\n                self.v.innerHTML = value.v\n                pgSk.abstr.objectSetItem(self['$d'], new pgSk.builtin.str('innerHTML'), value)\n            }\n            if (key === 'innerText') {\n                self.innerText = value\n                self.v.innerText = value.v\n                pgSk.abstr.objectSetItem(self['$d'], new pgSk.builtin.str('innerText'), value)\n            }\n        });\n\n\n        $loc.appendChild = new pgSk.builtin.func(function (self, ch) {\n            self.v.appendChild(ch.v);\n        });\n\n        $loc.removeChild = new pgSk.builtin.func(function (self, node) {\n            self.v.removeChild(node.v)\n        })\n\n        // getCSS\n\n        $loc.getCSS = new pgSk.builtin.func(function (self, key) {\n            return new pgSk.builtin.str(self.v.style[key.v]);\n        });\n\n\n        $loc.setCSS = new pgSk.builtin.func(function (self, attr, value) {\n            self.v.style[attr.v] = value.v\n\n        })\n\n        $loc.getAttribute = new pgSk.builtin.func(function (self, key) {\n            var res = self.v.getAttribute(key.v)\n            if (res) {\n                return new pgSk.builtin.str(res)\n            } else {\n                return pgSk.builtin.none.none$;\n            }\n        });\n\n        $loc.setAttribute = new pgSk.builtin.func(function (self, attr, value) {\n            self.v.setAttribute(attr.v, value.v)\n        });\n\n        $loc.getProperty = new pgSk.builtin.func(function (self, key) {\n            var res = self.v[key.v]\n            if (res) {\n                return new pgSk.builtin.str(res)\n            } else {\n                return pgSk.builtin.none.none$;\n            }\n        });\n\n        $loc.__str__ = new pgSk.builtin.func(function (self) {\n            console.log(self.v.tagName);\n            return new pgSk.builtin.str(self.v.tagName)\n        })\n\n        $loc.__repr__ = new pgSk.builtin.func(function (self) {\n            return new pgSk.builtin.str('[DOM Element]')\n        })\n\n\n    };\n\n    mod.Element = pgSk.misceval.buildClass(mod, elementClass, 'Element', []);\n\n    return mod;\n\n}\n", "src/lib/hashlib.py": "raise NotImplementedError(\"hashlib is not yet implemented in pgSkulpt\")\n", "src/lib/_threading_local.py": "raise NotImplementedError(\"_threading_local is not yet implemented in pgSkulpt\")\n", "src/lib/profile.py": "raise NotImplementedError(\"profile is not yet implemented in pgSkulpt\")\n", "src/lib/copy.py": "\"\"\"\nThis file was modified from CPython.\nCopyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n2011, 2012, 2013, 2014, 2015 Python Software Foundation; All Rights Reserved\n\"\"\"\nimport types\nclass Error(Exception):\n    pass\nerror = Error \nclass _EmptyClass:\n    pass\n\ndef copy(x):\n    cls = type(x)\n    if callable(x):\n        return x\n    copier = getattr(cls, \"__copy__\", None)\n    if copier:\n        return copier(x)\n    if cls in (type(None), int, float, bool, long, str, tuple, type):\n        return x\n    if (cls == list) or (cls == dict) or (cls == set) or (cls == slice):\n        return cls(x)\n    try:\n        getstate = getattr(x, \"__getstate__\", None)\n        setstate = getattr(x, \"__setstate__\", None)\n        initargs = getattr(x, \"__getinitargs__\", None)\n    except:\n        reductor = False\n    if getstate or setstate or initargs:\n        raise NotImplementedError(\"pgSkulpt does not yet support copying with user-defined __getstate__, __setstate__ or __getinitargs__()\")\n    reductor = getattr(x, \"__reduce_ex__\", None)\n    if reductor:\n        rv = reductor(4)\n    else:\n        reductor = getattr(x, \"__reduce__\", None)\n        if reductor:\n            rv = reductor()\n        elif str(cls)[1:6] == \"class\":\n            copier = _copy_inst\n            return copier(x)\n        else:\n            raise Error(\"un(shallow)copyable object of type %s\" % cls)\n    if isinstance(rv, str):\n        return x\n    return _reconstruct(x, rv, 0)\n\ndef _copy_inst(x):\n    if hasattr(x, '__copy__'):\n        return x.__copy__()\n    if hasattr(x, '__getinitargs__'):\n        args = x.__getinitargs__()\n        y = x.__class__(*args)\n    else:\n        y = _EmptyClass()\n        y.__class__ = x.__class__\n    if hasattr(x, '__getstate__'):\n        state = x.__getstate__()\n    else:\n        state = x.__dict__\n    if hasattr(y, '__setstate__'):\n        y.__setstate__(state)\n    else:\n        y.__dict__.update(state)\n    return y\n\nd = _deepcopy_dispatch = {}\n\ndef deepcopy(x, memo=None, _nil=[]):\n    \"\"\"Deep copy operation on arbitrary Python objects.\n    See the module's __doc__ string for more info.\n    \"\"\"\n    if memo is None:\n        memo = {}\n    idx = id(x)\n    y = memo.get(idx, _nil)\n    if y is not _nil:\n        return y\n    cls = type(x)\n    try:\n        getstate = getattr(x, \"__getstate__\", None)\n        setstate = getattr(x, \"__setstate__\", None)\n        initargs = getattr(x, \"__getinitargs__\", None)\n    except:\n        reductor = False\n    if getstate or setstate or initargs:\n        raise NotImplementedError(\"pgSkulpt does not yet support copying with user-defined __getstate__, __setstate__ or __getinitargs__()\")\n    copier = _deepcopy_dispatch.get(cls)\n    if copier:\n        y = copier(x, memo)\n    elif str(cls)[1:6] == \"class\":\n        copier = _deepcopy_dispatch[\"InstanceType\"]\n        y = copier(x, memo)\n    else:\n        try:\n            issc = issubclass(cls, type)\n        except TypeError: # cls is not a class (old Boost; see SF #502085)\n            issc = 0\n        if issc:\n            y = _deepcopy_atomic(x, memo)\n        else:\n            copier = getattr(x, \"__deepcopy__\", None)\n            if copier:\n                y = copier(memo)\n            else:\n                reductor = getattr(x, \"__reduce_ex__\", None)\n                if reductor:\n                    rv = reductor(2)\n                else:\n                    reductor = getattr(x, \"__reduce__\", None)\n                    if reductor:\n                        rv = reductor()\n                    else:\n                        raise Error(\n                            \"un(deep)copyable object of type %s\" % cls)\n                y = _reconstruct(x, rv, 1, memo)\n    memo[idx] = y\n    _keep_alive(x, memo) # Make sure x lives at least as long as d\n    return y\n\ndef _deepcopy_atomic(x, memo):\n    return x\nd[type(None)] = _deepcopy_atomic\n# d[type(Ellipsis)] = _deepcopy_atomic\nd[type(NotImplemented)] = _deepcopy_atomic\nd[int] = _deepcopy_atomic\nd[float] = _deepcopy_atomic\nd[bool] = _deepcopy_atomic\nd[complex] = _deepcopy_atomic\n# d[bytes] = _deepcopy_atomic\nd[str] = _deepcopy_atomic\n# try:\n# d[types.CodeType] = _deepcopy_atomic\n# except AttributeError:\n#   pass\nd[type] = _deepcopy_atomic\n# d[types.BuiltinFunctionType] = _deepcopy_atomic\nd[types.FunctionType] = _deepcopy_atomic\n# d[weakref.ref] = _deepcopy_atomic\n\ndef _deepcopy_list(x, memo):\n    y = []\n    memo[id(x)] = y\n    for a in x:\n        y.append(deepcopy(a, memo))\n    return y\nd[list] = _deepcopy_list\n\ndef _deepcopy_set(x, memo):\n    result = set([])  # make empty set\n    memo[id(x)] = result  # register this set in the memo for loop checking\n    for a in x:   # go through elements of set\n        result.add(deepcopy(a, memo))  # add the copied elements into the new set\n    return result # return the new set\nd[set] = _deepcopy_set\n\ndef _deepcopy_tuple(x, memo):\n    y = [deepcopy(a, memo) for a in x]\n    # We're not going to put the tuple in the memo, but it's still important we\n    # check for it, in case the tuple contains recursive mutable structures.\n    try:\n        return memo[id(x)]\n    except KeyError:\n        pass\n    for k, j in zip(x, y):\n        if k is not j:\n            y = tuple(y)\n            break\n    else:\n        y = x\n    return y\nd[tuple] = _deepcopy_tuple\n\ndef _deepcopy_dict(x, memo):\n    y = {}\n    memo[id(x)] = y\n    for key, value in x.items():\n        y[deepcopy(key, memo)] = deepcopy(value, memo)\n    return y\nd[dict] = _deepcopy_dict\n\ndef _deepcopy_method(x, memo): # Copy instance methods\n    y = type(x)(x.im_func, deepcopy(x.im_self, memo), x.im_class);\n    return y\nd[types.MethodType] = _deepcopy_method\n\ndef _deepcopy_inst(x, memo):\n    if hasattr(x, '__deepcopy__'):\n         return x.__deepcopy__(memo)\n    if hasattr(x, '__getinitargs__'):\n        args = x.__getinitargs__()\n        args = deepcopy(args, memo)\n        y = x.__class__(*args)\n    else:\n        y = _EmptyClass()\n        y.__class__ = x.__class__\n    memo[id(x)] = y\n    if hasattr(x, '__getstate__'):\n        state = x.__getstate__()\n    else:\n        state = x.__dict__\n    state = deepcopy(state, memo)\n    if hasattr(y, '__setstate__'):\n        y.__setstate__(state)\n    else:\n        y.__dict__.update(state)\n        return y\nd[\"InstanceType\"] = _deepcopy_inst\n\ndef _keep_alive(x, memo):\n    \"\"\"Keeps a reference to the object x in the memo.\n    Because we remember objects by their id, we have\n    to assure that possibly temporary objects are kept\n    alive by referencing them.\n    We store a reference at the id of the memo, which should\n    normally not be used unless someone tries to deepcopy\n    the memo itself...\n    \"\"\"\n    try:\n        memo[id(memo)].append(x)\n    except KeyError:\n        # aha, this is the first one :-)\n        memo[id(memo)]=[x]\n\ndef _reconstruct(x, info, deep, memo=None):\n    if isinstance(info, str):\n        return x\n    assert isinstance(info, tuple)\n    if memo is None:\n        memo = {}\n    n = len(info)\n    assert n in (2, 3, 4, 5)\n    callable, args = info[:2]\n    if n > 2:\n        state = info[2]\n    else:\n        state = None\n    if n > 3:\n        listiter = info[3]\n    else:\n        listiter = None\n    if n > 4:\n        dictiter = info[4]\n    else:\n        dictiter = None\n    if deep:\n        args = deepcopy(args, memo)\n    y = callable(*args)\n    memo[id(x)] = y\n\n    if state is not None:\n        if deep:\n            state = deepcopy(state, memo)\n        if hasattr(y, '__setstate__'):\n            y.__setstate__(state)\n        else:\n            if isinstance(state, tuple) and len(state) == 2:\n                state, slotstate = state\n            else:\n                slotstate = None\n            if state is not None:\n                y.__dict__.update(state)\n            if slotstate is not None:\n                for key, value in slotstate.items():\n                    setattr(y, key, value)\n\n    if listiter is not None:\n        for item in listiter:\n            if deep:\n                item = deepcopy(item, memo)\n            y.append(item)\n    if dictiter is not None:\n        for key, value in dictiter:\n            if deep:\n                key = deepcopy(key, memo)\n                value = deepcopy(value, memo)\n            y[key] = value\n    return y\n\ndel d\n\ndel types\n\n# Helper for instance creation without calling __init__\nclass _EmptyClass:\n    pass", "src/lib/binhex.py": "raise NotImplementedError(\"binhex is not yet implemented in pgSkulpt\")\n", "src/lib/csv.py": "raise NotImplementedError(\"csv is not yet implemented in pgSkulpt\")\n", "src/lib/cgi.py": "raise NotImplementedError(\"cgi is not yet implemented in pgSkulpt\")\n", "src/lib/posixfile.py": "raise NotImplementedError(\"posixfile is not yet implemented in pgSkulpt\")\n", "src/lib/netrc.py": "raise NotImplementedError(\"netrc is not yet implemented in pgSkulpt\")\n", "src/lib/commands.py": "raise NotImplementedError(\"commands is not yet implemented in pgSkulpt\")\n", "src/lib/sunaudio.py": "raise NotImplementedError(\"sunaudio is not yet implemented in pgSkulpt\")\n", "src/lib/md5.py": "raise NotImplementedError(\"md5 is not yet implemented in pgSkulpt\")\n", "src/lib/struct.py": "raise NotImplementedError(\"struct is not yet implemented in pgSkulpt\")\n", "src/lib/sunau.py": "raise NotImplementedError(\"sunau is not yet implemented in pgSkulpt\")\n", "src/lib/turtle.js": "var $builtinmodule = function (name) {\n\"use strict\";\n\nfunction getConfiguredTarget() {\n    var selector, target;\n\n    selector = (pgSk.TurtleGraphics && pgSk.TurtleGraphics.target) || \"turtle\",\n    target   = typeof selector === \"string\" ?\n        document.getElementById(selector) :\n        selector;\n    // ensure that the canvas container is empty\n    while (target.firstChild) {\n        target.removeChild(target.firstChild);\n    }\n    return target;\n}\n\nfunction generateTurtleModule(_target) {\n    var _module              = {},\n        _durationSinceRedraw = 0,\n        _focus               = true,\n        OPTIMAL_FRAME_RATE   = 1000/30,\n        SHAPES               = {},\n        TURTLE_COUNT         = 0,\n        Types                = {},\n        _frameRequest,\n        _frameRequestTimeout,\n        _screenInstance,\n        _config,\n        _anonymousTurtle,\n        _mouseHandler;\n\n    // Ensure that the turtle DOM target has a tabindex\n    // so that it can accept keyboard focus and events\n    if (!_target.hasAttribute(\"tabindex\")) {\n        _target.setAttribute(\"tabindex\", 0);\n    }\n\n    Types.FLOAT = function(value) {\n        return pgSk.builtin.float_(value);\n    };\n    Types.COLOR = function(value) {\n        if (typeof value === \"string\") {\n            return new pgSk.builtin.str(value);\n        }\n        else {\n            for(var i = 0; i < 3; i++) {\n                value[i] = pgSk.builtin.assk$(value[i]);\n            }\n            if (value.length === 4) {\n                value[3] = pgSk.builtin.float_(value[3]);\n            }\n            return new pgSk.builtin.tuple(value);\n        }\n    };\n    Types.TURTLE_LIST = function(value) {\n        var skValues = [];\n        for (var i = 0; i < value.length; i++) {\n            skValues.push(value[i].skInstance);\n        }\n        return new pgSk.builtin.tuple(skValues);\n    };\n\n    SHAPES.arrow    = [[-10,0],[10,0],[0,10]];\n    SHAPES.square   = [[ 10,-10],[10,10],[-10,10],[-10, -10]];\n    SHAPES.triangle = [[10,-5.77],[0,11.55],[-10,-5.77]];\n    SHAPES.classic  = [[0,0],[-5,-9],[0,-7],[5,-9]];\n    SHAPES.turtle   = [\n        [0,16],[-2,14],[-1,10],[-4,7],[-7,9],[-9,8],[-6,5],[-7,1],[-5,-3],[-8,-6],\n        [-6,-8],[-4,-5],[0,-7],[4,-5],[6,-8],[8,-6],[5,-3],[7,1],[6,5],[9,8],[7,9],\n        [4,7],[1,10],[2,14]\n    ];\n\n    SHAPES.circle = [\n        [10,0],[9.51,3.09],[8.09,5.88],[5.88,8.09],[3.09,9.51],[0,10],[-3.09,9.51],\n        [-5.88,8.09],[-8.09,5.88],[-9.51,3.09],[-10,0],[-9.51,-3.09],[-8.09,-5.88],\n        [-5.88,-8.09],[-3.09,-9.51],[-0,-10],[3.09,-9.51],[5.88,-8.09],[8.09,-5.88],\n        [9.51,-3.09]\n    ];\n\n    _config = (function() {\n        var defaultSetup = {\n                target     : \"turtle\", // DOM element or id of parent container\n                width      : 400, // if set to 0 it will use the target width\n                height     : 400, // if set to 0 it will use the target height\n                animate    : true, // enabled/disable all animated rendering\n                bufferSize : 0, // default turtle buffer size\n                allowUndo  : true, // enable ability to use the undo buffer\n            },\n            key;\n\n        if (!pgSk.TurtleGraphics) {\n            pgSk.TurtleGraphics = {};\n        }\n\n        for(key in defaultSetup) {\n            if (!pgSk.TurtleGraphics.hasOwnProperty(key)) {\n                pgSk.TurtleGraphics[key] = defaultSetup[key];\n            }\n        }\n\n        return pgSk.TurtleGraphics;\n    })();\n\n    // InstantPromise is a workaround to allow usage of the clean promise-style\n    // then/catch syntax but to instantly call resolve the then/catch chain so we\n    // can avoid creating Suspensions in unnecessary cases.  This is desirable\n    // because Suspensions have a fairly large negative impact on overall\n    // performance.  These 'instant promises' come into play when a tracer()\n    // call is made with a value other than 1.  When tracer is 0 or greater than 1\n    // , we can bypass the creation of a Suspension and proceed to the next line of\n    // code immediately if the current line is not going to incur involve a screen\n    // update. We determine if a real promise or InstantPromise is necessary by\n    // checking FrameManager.willRenderNext()\n    function InstantPromise() {\n        this.lastResult = undefined;\n        this.lastError  = undefined;\n    }\n\n    InstantPromise.prototype.then = function(cb) {\n        if (this.lastError) {\n            return this;\n        }\n\n        try {\n         this.lastResult = cb(this.lastResult);\n        } catch(e) {\n            this.lastResult = undefined;\n            this.lastError  = e;\n        }\n\n        return this.lastResult instanceof Promise ? this.lastResult : this;\n    };\n\n    InstantPromise.prototype.catch = function(cb) {\n        if (this.lastError) {\n            try {\n                this.lastResult = cb(this.lastError);\n                this.lastError  = undefined;\n            } catch(e) {\n                this.lastResult = undefined;\n                this.lastError = e;\n            }\n        }\n\n        return this.lastResult instanceof Promise ? this.lastResult : this;\n    };\n\n    function FrameManager() {\n        this.reset();\n    }\n\n    var _frameManager;\n    function getFrameManager() {\n        if (!_frameManager) {\n            _frameManager = new FrameManager();\n        }\n        return _frameManager;\n    }\n\n    (function(proto) {\n        var browserFrame;\n        (function(frame) {\n            if (frame) {\n                browserFrame = function(method) {\n                    return (_frameRequest = frame(method));\n                };\n            }\n        })(window.requestAnimationFrame || window.mozRequestAnimationFrame);\n\n        function animationFrame(delay) {\n            if (!_config.animate) {\n                return function(method) {\n                    method();\n                };\n            }\n\n            if (!delay && browserFrame) {\n                return browserFrame;\n            }\n\n            return function(method) {\n                _frameRequestTimeout = window.setTimeout(\n                    method,\n                    delay || OPTIMAL_FRAME_RATE\n                );\n                 return _frameRequestTimeout;\n            };\n        }\n\n        proto.willRenderNext = function() {\n            return !!(this._buffer && this._frameCount+1 === this.frameBuffer());\n        };\n\n        proto.turtles = function() {\n            return this._turtles;\n        };\n\n        proto.addTurtle = function(turtle) {\n            this._turtles.push(turtle);\n        };\n\n        proto.reset = function() {\n            if (this._turtles) {\n                for(var i = this._turtles.length; --i >= 0;) {\n                    this._turtles[i].reset();\n                }\n            }\n            this._turtles        = [];\n            this._frames         = [];\n            this._frameCount     = 0;\n            this._buffer         = 1;\n            this._rate           = 0;\n            this._animationFrame = animationFrame();\n        };\n\n        proto.addFrame = function(method, countAsFrame) {\n            var instant = false;\n\n            if (countAsFrame) {\n                this._frameCount += 1;\n            }\n\n            this.frames().push(method);\n\n            instant = (\n                !_config.animate ||\n                (this._buffer && this._frameCount === this.frameBuffer())\n            );\n\n            return instant ? this.update() : new InstantPromise();\n        };\n\n        proto.frames = function() {\n            return this._frames;\n        };\n\n        proto.frameBuffer = function(buffer) {\n            if (typeof buffer === \"number\") {\n                this._buffer = buffer | 0;\n                if (buffer && buffer <= this._frameCount) {\n                    return this.update();\n                }\n            }\n            return this._buffer;\n        };\n\n        proto.refreshInterval = function(rate) {\n            if (typeof rate === \"number\") {\n                this._rate = rate | 0;\n                this._animationFrame = animationFrame(rate);\n            }\n            return this._rate;\n        };\n\n        proto.update = function() {\n            return (this._frames && this._frames.length) ?\n                this.requestAnimationFrame() :\n                new InstantPromise();\n        };\n\n        proto.requestAnimationFrame = function() {\n            var frames         = this._frames,\n                animationFrame = this._animationFrame,\n                turtles        = this._turtles,\n                sprites        = getScreen().spriteLayer(),\n                turtle, i;\n\n            this._frames     = [];\n            this._frameCount = 0;\n\n            return new Promise(function(resolve) {\n                animationFrame(function paint() {\n                    for (i = 0; i < frames.length; i++) {\n                        if (frames[i]) {\n                            frames[i]();\n                        }\n                    }\n                    clearLayer(sprites);\n                    for (i = 0; i < turtles.length; i++) {\n                        turtle = turtles[i];\n                        if (turtle.getState().shown) {\n                            drawTurtle(turtle.getState(), sprites);\n                        }\n                    }\n                    resolve();\n                });\n            });\n        };\n    })(FrameManager.prototype);\n\n    function MouseHandler() {\n        var self = this;\n\n        this._target   = getTarget();\n        this._managers = {};\n        this._handlers = {\n            mousedown : function(e) {\n                self.onEvent(\"mousedown\", e);\n            },\n            mouseup : function(e) {\n                self.onEvent(\"mouseup\", e);\n            },\n            mousemove : function(e) {\n                self.onEvent(\"mousemove\", e);\n            }\n        };\n        for (var key in this._handlers) {\n            this._target.addEventListener(key, this._handlers[key]);\n        }\n    }\n\n    (function(proto) {\n        proto.onEvent = function(type, e) {\n            var managers     = this._managers[type],\n                moveManagers = this._managers[\"mousemove\"],\n                computed     = false,\n                x, y, localX, localY, i;\n\n            function computeCoordinates() {\n                if (computed) return;\n                var world = getScreen();\n                var rect  = world.spriteLayer().canvas.getBoundingClientRect();\n                x         = e.clientX - rect.left | 0;\n                y         = e.clientY - rect.top  | 0;\n                localX    = x * world.xScale + world.llx;\n                localY    = y * world.yScale + world.ury;\n                computed = true;\n            }\n\n            if ((type === \"mousedown\" || type === \"mouseup\") && moveManagers && moveManagers.length) {\n                computeCoordinates();\n                for (i = moveManagers.length; --i >= 0;) {\n                    if (moveManagers[i].test(x, y, localX, localY)) {\n                        moveManagers[i].canMove(type === \"mousedown\");\n                    }\n                }\n            }\n\n            if (managers && managers.length) {\n                computeCoordinates();\n                for (i = managers.length; --i >= 0;) {\n                    if (type === \"mousemove\") {\n                        if (managers[i].canMove()) {\n                            managers[i].trigger([localX, localY]);\n                        }\n                        continue;\n                    }\n\n                    if (managers[i].test(x, y, localX, localY)) {\n                        managers[i].trigger([localX, localY]);\n                    }\n                }\n            }\n        };\n\n        proto.reset = function() {\n            this._managers = {};\n        };\n\n        proto.addManager = function(type, manager) {\n            if (!this._managers[type]) {\n                this._managers[type] = [];\n            }\n\n            this._managers[type].push(manager);\n        };\n\n    })(MouseHandler.prototype);\n\n    function EventManager(type, target) {\n        this._type     = type;\n        this._target   = target;\n        this._handlers = undefined;\n        getMouseHandler().addManager(type, this);\n    }\n\n    (function(proto) {\n        proto.reset = function() {\n            this._handlers = undefined;\n        };\n\n        proto.canMove = function(value) {\n            if (!this._target || !this._target.hitTest) return false;\n\n            if (value !== undefined) {\n                this._target.hitTest.hit = value;\n            }\n\n            return this._target.hitTest.hit;\n        };\n\n        proto.test = function(x, y, localX, localY) {\n            return this._target && this._target.hitTest ?\n                this._target.hitTest(x, y, localX, localY) :\n                !!this._target;\n        };\n\n        proto.trigger = function(args) {\n            var handlers = this._handlers,\n                i;\n\n            if (handlers && handlers.length) {\n                for (i = 0; i < handlers.length; i++) {\n                    handlers[i].apply({}, args);\n                }\n            }\n        };\n\n        proto.addHandler = function(handler, add) {\n            var handlers = this._handlers;\n\n            if (!add && handlers && handlers.length) {\n                // remove all existing handlers\n                while (handlers.shift()) {/* noop */}\n            }\n\n            if (typeof handler !== \"function\") {\n                if (handlers && !handlers.length) {\n                    this.reset();\n                }\n                return;\n            }\n\n            if (!handlers) {\n                handlers = this._handlers = [];\n            }\n\n            handlers.push(handler);\n        };\n    })(EventManager.prototype);\n\n    function Turtle() {\n        getFrameManager().addTurtle(this);\n        this._screen = getScreen();\n        this._managers = {};\n        this.reset();\n    }\n\n    Turtle.RADIANS = 2 * Math.PI;\n\n    (function(proto) {\n        proto.hitTest = function(mouseX, mouseY, localX, localY) {\n            var context = getScreen().hitTestLayer();\n            clearLayer(context);\n            drawTurtle(this.getState(), context);\n            var pixel = context.getImageData(mouseX,mouseY,1,1).data;\n            // check alpha first since it is most likely to have a value\n            return pixel[3] ||pixel[0] || pixel[1] || pixel[2];\n        };\n\n        proto.addUpdate = function(method, countAsFrame, stateChanges) {\n            var self  = this,\n                state = this.getState(),\n                args  = Array.prototype.slice.call(arguments, stateChanges ? 2 : 3);\n\n            return getFrameManager().addFrame(function() {\n                if (method) {\n                    method.apply(state, args);\n                }\n                if (stateChanges) {\n                    for(var key in stateChanges) {\n                        state[key] = stateChanges[key];\n                    }\n                }\n            }, countAsFrame);\n        };\n\n        proto.getState = function() {\n            var self = this;\n\n            if (!this._state) {\n                this._state = {\n                    x       : this._x,\n                    y       : this._y,\n                    angle   : this._angle,\n                    radians : this._radians,\n                    shape   : this._shape,\n                    color   : this._color,\n                    fill    : this._fill,\n                    filling : this._filling,\n                    size    : this._size,\n                    speed   : this._computed_speed,\n                    down    : this._down,\n                    shown   : this._shown,\n                    context : function() {\n                        return self.getPaper();\n                    }\n                };\n            }\n            return this._state;\n        };\n\n        proto.translate = function(startX, startY, dx, dy, beginPath, isCircle) {\n            var self = this;\n            return translate(this, startX, startY, dx, dy, beginPath, isCircle)\n                .then(function(coords) {\n                    self._x = coords[0];\n                    self._y = coords[1];\n                });\n        };\n\n        proto.rotate = function(startAngle, delta, isCircle) {\n            var self = this;\n            return rotate(this, startAngle, delta, isCircle)\n                .then(function(heading) {\n                    self._angle   = heading.angle;\n                    self._radians = heading.radians;\n                });\n        };\n\n        proto.queueMoveBy = function(startX, startY, theta, distance) {\n            var dx = Math.cos(theta) * distance,\n                dy = Math.sin(theta) * distance;\n\n            return this.translate(startX, startY, dx, dy, true);\n        };\n\n        proto.queueTurnTo = function(startAngle, endAngle) {\n            endAngle = endAngle % this._fullCircle;\n            if (endAngle < 0) {\n                endAngle += this._fullCircle;\n            }\n            return this.rotate(startAngle, endAngle - startAngle);\n        };\n\n        proto.getManager = function(type) {\n            if (!this._managers[type]) {\n                this._managers[type] = new EventManager(type, this);\n            }\n            return this._managers[type];\n        };\n\n        proto.getPaper = function() {\n            return this._paper || (this._paper = createLayer(2));\n        };\n\n        proto.reset = function() {\n            this._x          = 0;\n            this._y          = 0;\n            this._radians    = 0;\n            this._angle      = 0;\n            this._shown      = true;\n            this._down       = true;\n            this._color      = \"black\";\n            this._fill       = \"black\";\n            this._shape      = \"classic\";\n            this._size       = 1;\n            this._filling    = false;\n            this._undoBuffer = [];\n            this._speed      = 3;\n            this._computed_speed = 5;\n            this._state      = undefined;\n\n            for(var key in this._managers) {\n                this._managers[key].reset();\n            }\n\n            this._isRadians  = false;\n            this._fullCircle = 360;\n            this._bufferSize = typeof _config.bufferSize === \"number\" ?\n                _config.bufferSize :\n                0;\n\n            removeLayer(this._paper);\n            this._paper = undefined;\n        };\n\n        proto.$degrees = function(fullCircle) {\n            fullCircle = (typeof fullCircle === \"number\") ?\n                Math.abs(fullCircle) :\n                360;\n\n            this._isRadians  = false;\n            if (!fullCircle || !this._fullCircle) {\n                this._angle = this._radians = 0;\n            }\n            else {\n                this._angle = this._angle / this._fullCircle * fullCircle;\n            }\n            this._fullCircle = fullCircle;\n            return this.addUpdate(\n                undefined,\n                false,\n                {angle:this._angle, radians: this._radians}\n            );\n        };\n        proto.$degrees.minArgs     = 0;\n        proto.$degrees.keywordArgs = [\"fullcircle\"];\n        proto.$degrees.returnType  = Types.FLOAT;\n\n        proto.$radians = function() {\n            if (!this._isRadians) {\n                this._isRadians     = true;\n                this._angle = this._radians;\n                this._fullCircle = Turtle.RADIANS;\n            }\n\n            return this._angle;\n        };\n        proto.$radians.returnType = Types.FLOAT;\n\n        proto.$position = proto.$pos = function() {\n            return [this.$xcor(), this.$ycor()];\n        };\n        proto.$position.returnType = function(value) {\n            return new pgSk.builtin.tuple([\n                    pgSk.builtin.float_(value[0]),\n                    pgSk.builtin.float_(value[1])\n            ]);\n        };\n\n        proto.$towards = function(x,y) {\n            var coords  = getCoordinates(x,y),\n                radians = Math.PI + Math.atan2(this._y - coords.y, this._x - coords.x),\n                angle   = radians * (this._fullCircle / Turtle.RADIANS);\n\n            return angle;\n        };\n        proto.$towards.minArgs    = 1;\n        proto.$towards.returnType = Types.FLOAT;\n\n        proto.$distance = function(x,y) {\n            var coords = getCoordinates(x,y),\n                dx     = coords.x - this._x,\n                dy     = coords.y - this._y;\n\n            return Math.sqrt(dx * dx + dy * dy);\n        };\n        proto.$distance.minArgs    = 1;\n        proto.$distance.returnType = Types.FLOAT;\n\n        proto.$heading = function() {\n            return Math.abs(this._angle) < 1e-13 ? 0 : this._angle;\n        };\n        proto.$heading.returnType = Types.FLOAT;\n\n        proto.$xcor = function() {\n            return Math.abs(this._x) < 1e-13 ? 0 : this._x;\n        };\n        proto.$xcor.returnType = Types.FLOAT;\n\n        proto.$ycor = function() {\n            return Math.abs(this._y) < 1e-13 ? 0 : this._y;\n        };\n        proto.$ycor.returnType = Types.FLOAT;\n\n        proto.$forward = proto.$fd = function(distance) {\n            pushUndo(this);\n            return this.queueMoveBy(this._x, this._y, this._radians, distance);\n        };\n\n        proto.$undo = function() {\n            popUndo(this);\n        };\n\n        proto.$undobufferentries = function() {\n            return this._undoBuffer.length;\n        };\n\n        proto.$setundobuffer = function(size) {\n            this._bufferSize = typeof size === \"number\" ?\n                Math.min(Math.abs(size), 1000) :\n                0;\n        };\n\n        proto.$backward = proto.$back = proto.$bk = function(distance) {\n            pushUndo(this);\n            return this.queueMoveBy(this._x, this._y, this._radians, -distance);\n        };\n\n        proto.$goto_$rw$ = proto.$setpos = proto.$setposition = function(x,y) {\n            var coords = getCoordinates(x,y);\n\n            pushUndo(this);\n\n            return this.translate(\n                this._x, this._y,\n                coords.x - this._x, coords.y - this._y,\n                true\n            );\n        };\n        proto.$goto_$rw$.minArgs = 1;\n\n        proto.$setx = function(x) {\n            return this.translate(this._x, this._y, x - this._x, 0, true);\n        };\n\n        proto.$sety = function(y) {\n            return this.translate(this._x, this._y, 0, y - this._y, true);\n        };\n\n        proto.$home = function() {\n            var self  = this,\n                angle = this._angle;\n\n            pushUndo(this);\n            return self.translate(this._x, this._y, -this._x, -this._y, true)\n                .then(function(position) {\n                    return self.queueTurnTo(angle, 0);\n                })\n                .then(function(heading) {\n                    return undefined;\n                });\n        };\n\n        proto.$right = proto.$rt = function(angle) {\n            pushUndo(this);\n            return this.rotate(this._angle, -angle);\n        };\n\n        proto.$left = proto.$lt = function(angle) {\n            pushUndo(this);\n            return this.rotate(this._angle, angle);\n        };\n\n        proto.$setheading = proto.$seth = function(angle) {\n            pushUndo(this);\n            return this.queueTurnTo(this._angle, angle);\n        };\n\n        function circleRotate(turtle, angle, radians) {\n            return function() {\n                return turtle.addUpdate(\n                    undefined,\n                    false,{angle:angle, radians:radians}\n                );\n            };\n        }\n\n        function circleSegment(turtle, x, y, dx, dy, beginPath) {\n            return function() {\n                return turtle.translate(x, y, dx, dy, beginPath, true);\n            };\n        }\n\n        proto.$circle = function(radius, extent, steps) {\n            var self      = this,\n                x         = this._x,\n                y         = this._y,\n                angle     = this._angle,\n                heading   = {},\n                states    = [],\n                scale     = 1/getScreen().lineScale,\n                beginPath = true,\n                endAngle, frac, w, w2, l, i, dx, dy, promise;\n\n            pushUndo(this);\n\n            if (extent === undefined) {\n                extent = self._fullCircle;\n            }\n\n            if (steps === undefined) {\n                frac  = Math.abs(extent)/self._fullCircle;\n                steps = 1 + ((Math.min(11+Math.abs(radius*scale)/6, 59)*frac) | 0);\n            }\n            w  = extent / steps;\n            w2 = 0.5 * w;\n            l  = 2 * radius * Math.sin(w*Math.PI/self._fullCircle);\n\n            if (radius < 0) {\n                l = -l;\n                w = -w;\n                w2 = -w2;\n                endAngle = angle - extent;\n            }\n            else {\n                endAngle = angle + extent;\n            }\n\n            promise = getFrameManager().willRenderNext() ? Promise.resolve() : new InstantPromise();\n\n            angle += w2;\n\n            for(i = 0; i < steps; i++) {\n                calculateHeading(self, angle + w * i, heading);\n                dx = Math.cos(heading.radians) * l;\n                dy = Math.sin(heading.radians) * l;\n                promise = promise\n                    .then(circleRotate(self, heading.angle, heading.radians))\n                    .then(circleSegment(self, x, y, dx, dy, beginPath));\n                x += dx;\n                y += dy;\n                beginPath = false;\n            }\n\n            promise = promise.then(function() {\n                calculateHeading(self, endAngle, heading);\n                self._angle   = heading.angle;\n                self._radians = heading.radians;\n                return self.addUpdate(undefined, true, heading);\n            });\n\n            return promise;\n        };\n        proto.$circle.keywordArgs = [\"extent\", \"steps\"];\n        proto.$circle.minArgs     = 1;\n\n        proto.$penup = proto.$up = proto.$pu = function() {\n            this._down = false;\n            return this.addUpdate(undefined, false, {down:false});\n        };\n\n        proto.$pendown = proto.$down = proto.$pd = function() {\n            this._down = true;\n            return this.addUpdate(undefined, false, {down:true});\n        };\n\n        proto.$isdown = function() {\n            return this._down;\n        };\n\n        proto.$speed = function(speed) {\n            if (arguments.length) {\n                this._speed          = Math.max(0, Math.min(1000, speed));\n                this._computed_speed = Math.max(0, speed * 2 - 1);\n                return this.addUpdate(undefined, false, {speed:this._computed_speed});\n            }\n\n            return this._speed;\n        };\n        proto.$speed.minArgs = 0;\n        proto.$speed.keywordArgs = [\"speed\"];\n\n        proto.$pencolor = function(r,g,b,a) {\n            var color;\n\n            if (arguments.length) {\n                this._color = createColor(r,g,b,a);\n                return this.addUpdate(undefined, this._shown, {color : this._color});\n            }\n\n            return hexToRGB(this._color);\n        };\n        proto.$pencolor.minArgs = 0;\n        proto.$pencolor.returnType = Types.COLOR;\n\n        proto.$fillcolor = function(r,g,b,a) {\n            var color;\n\n            if (arguments.length) {\n                this._fill = createColor(r,g,b,a);\n                return this.addUpdate(undefined, this._shown, {fill : this._fill});\n            }\n\n            return hexToRGB(this._fill);\n        };\n        proto.$fillcolor.minArgs = 0;\n        proto.$fillcolor.returnType = Types.COLOR;\n\n        proto.$color = function(color, fill, b, a) {\n            if (arguments.length) {\n                if (arguments.length === 1 || arguments.length >= 3) {\n                    this._color = createColor(color, fill, b, a);\n                    this._fill  = this._color;\n                }\n                else {\n                    this._color = createColor(color);\n                    this._fill  = createColor(fill);\n                }\n                return this.addUpdate(undefined, this._shown, {\n                    color : this._color,\n                    fill  : this._fill\n                });\n            }\n            return [this.$pencolor(), this.$fillcolor()];\n        };\n        proto.$color.minArgs = 0;\n        proto.$color.returnType = function(value) {\n            return new pgSk.builtin.tuple([\n                Types.COLOR(value[0]),\n                Types.COLOR(value[1])\n            ]);\n        };\n\n        proto.$fill = function(flag) {\n            var self = this;\n\n            if (flag !== undefined) {\n                flag = !!flag;\n                if (flag === this._filling) return;\n                this._filling = flag;\n                if (flag) {\n                    pushUndo(this);\n                    return this.addUpdate(undefined, false, {\n                        filling      : true,\n                        fillBuffer : [{x : this._x, y : this._y}]\n                    });\n                }\n                else {\n                    pushUndo(this);\n                    return this.addUpdate(\n                        function() {\n                            this.fillBuffer.push(this);\n                            drawFill.call(this);\n                        },\n                        true,\n                        {\n                            filling      : false,\n                            fillBuffer : undefined\n                        }\n                    );\n                }\n            }\n\n            return this._filling;\n        };\n        proto.$fill.minArgs = 0;\n\n        proto.$begin_fill = function() {\n            return this.$fill(true);\n        };\n\n        proto.$end_fill = function() {\n            return this.$fill(false);\n        };\n\n        proto.$stamp = function() {\n            pushUndo(this);\n            return this.addUpdate(function() {\n                drawTurtle(this, this.context());\n            }, true);\n        };\n\n        proto.$dot = function(size, color, g, b, a) {\n            pushUndo(this);\n            size = pgSk.builtin.asnum$(size);\n            size = (typeof size === \"number\") ?\n                Math.max(1, Math.abs(size) | 0) :\n                Math.max(this._size + 4, this._size * 2);\n\n            color = (color !== undefined) ?\n                createColor(color, g, b, a) :\n                this._color;\n\n            return this.addUpdate(drawDot, true, undefined, size, color);\n        };\n\n        proto.$write = function(message,move,align,font) {\n            var self = this,\n                promise, face, size, type, width;\n\n            pushUndo(this);\n\n            message = String(message);\n\n            if (font && font.constructor === Array) {\n                face = typeof font[0] === \"string\" ? font[0] : \"Arial\";\n                size = String(font[1] || \"12pt\");\n                type = typeof font[2] === \"string\" ? font[2] : \"normal\";\n                if (/^\\d+$/.test(size)) {\n                    size += \"pt\";\n                }\n\n                font = [type, size, face].join(\" \");\n            }\n\n            if (!align) {\n                align = \"left\";\n            }\n\n            promise = this.addUpdate(\n                drawText, true, undefined, message, align, font\n            );\n\n            if (move && (align === \"left\" || align === \"center\")) {\n                width = measureText(message, font);\n                if (align === \"center\") {\n                    width = width/2;\n                }\n                promise = promise.then(function() {\n                    var state = self.getState();\n                    return self.translate(state.x, state.y, width, 0, true);\n                });\n            }\n\n            return promise;\n        };\n        proto.$write.keywordArgs = [\"move\",\"align\",\"font\"];\n        proto.$write.minArgs     = 1;\n\n        proto.$pensize = proto.$width = function(size) {\n            if (arguments.length) {\n                this._size = size;\n                return this.addUpdate(undefined, this._shown, {size : size});\n            }\n\n            return this._size;\n        };\n        proto.$pensize.minArgs = proto.$width.minArgs = 0;\n        proto.$pensize.keywordArgs = proto.$width.keywordArgs = [\"width\"];\n\n        proto.$showturtle = proto.$st = function() {\n            this._shown = true;\n            return this.addUpdate(undefined, true, {shown : true});\n        };\n\n        proto.$hideturtle = proto.$ht = function() {\n            this._shown = false;\n            return this.addUpdate(undefined, true, {shown : false});\n        };\n\n        proto.$isvisible = function() {\n            return this._shown;\n        };\n\n        proto.$shape = function(shape) {\n            if (shape && SHAPES[shape]) {\n                this._shape = shape;\n                return this.addUpdate(undefined, this._shown, {shape : shape});\n            }\n\n            return this._shape;\n        };\n        proto.$shape.minArgs     = 0;\n        proto.$shape.keywordArgs = [\"name\"];\n\n        proto.$window_width = function() {\n            return this._screen.$window_width();\n        };\n        \n        proto.$window_height = function() {\n            return this._screen.$window_height();\n        };\n        \n        proto.$tracer = function(n, delay) {\n            return this._screen.$tracer(n, delay);\n        };\n        proto.$tracer.minArgs     = 0;\n        proto.$tracer.keywordArgs = [\"n\", \"delay\"];\n        \n        proto.$update = function() {\n            return this._screen.$update();\n        };\n        \n        proto.$delay = function(delay) {\n            return this._screen.$delay(delay);\n        };\n        proto.$delay.minArgs     = 0;\n        proto.$delay.keywordArgs = [\"delay\"];\n\n        proto.$reset = function() {\n            this.reset();\n            return this.$clear();\n        };\n\n        proto.$mainloop = proto.$done = function() {\n            return this._screen.$mainloop();\n        };\n\n        proto.$clear = function() {\n            return this.addUpdate(function() {\n                clearLayer(this.context());\n            }, true);\n        };\n        proto.$dot.minArgs = 0;\n\n        proto.$onclick = function(method,btn,add) {\n            this.getManager(\"mousedown\").addHandler(method, add);\n        };\n        proto.$onclick.minArgs = 1;\n        proto.$onclick.keywordArgs = [\"btn\",\"add\"];\n\n        proto.$onrelease = function(method,btn,add) {\n            this.getManager(\"mouseup\").addHandler(method, add);\n        };\n        proto.$onrelease.minArgs = 1;\n        proto.$onrelease.keywordArgs = [\"btn\",\"add\"];\n\n        proto.$ondrag = function(method,btn,add) {\n            this.getManager(\"mousemove\").addHandler(method, add);\n        };\n        proto.$ondrag.minArgs = 1;\n        proto.$ondrag.keywordArgs = [\"btn\",\"add\"];\n\n        proto.$getscreen = function() {\n            return _module.Screen();\n        };\n        proto.$getscreen.ispgSk = true;\n\n        proto.$clone = function() {\n\n            var newTurtleInstance = pgSk.misceval.callsimOrSuspend(_module.Turtle);\n\n            // All the properties that are in getState()\n            newTurtleInstance.instance._x = this._x;\n            newTurtleInstance.instance._y = this._y;\n            newTurtleInstance.instance._angle = this._angle;\n            newTurtleInstance.instance._radians = this._radians;\n            newTurtleInstance.instance._shape = this._shape;\n            newTurtleInstance.instance._color = this._color;\n            newTurtleInstance.instance._fill = this._fill;\n            newTurtleInstance.instance._filling = this._filling;\n            newTurtleInstance.instance._size = this._size;\n            newTurtleInstance.instance._computed_speed = this._computed_speed;\n            newTurtleInstance.instance._down = this._down;\n            newTurtleInstance.instance._shown = this._shown;\n\n            // Other properties to copy\n            newTurtleInstance.instance._isRadians = this._isRadians;\n            newTurtleInstance.instance._fullCircle = this._fullCircle;\n            newTurtleInstance.instance._bufferSize = this._bufferSize;\n            newTurtleInstance.instance._undoBuffer = this._undoBuffer;\n\n\n            newTurtleInstance._clonedFrom = this;\n\n            return newTurtleInstance;\n        };\n        proto.$clone.returnType = function(value) {\n            // When I return the instance here, I'm not sure if it ends up with the right \"Turtle\" python type.\n            return value\n        };\n\n        proto.$getturtle = proto.$getpen = function() {\n            return this.skInstance;\n        };\n        proto.$getturtle.ispgSk = true;\n    })(Turtle.prototype);\n\n    function Screen() {\n        var w,h;\n        this._frames    = 1;\n        this._delay     = undefined;\n        this._bgcolor   = \"none\";\n        this._mode      = \"standard\";\n        this._managers  = {};\n        this._keyLogger = {};\n        if (_config.height && _config.width) {\n            w = _config.width/2;\n            h = _config.height/2;\n        } else {\n            w = _config.defaultSetup.width/2;\n            h = _config.defaultSetup.height/2;\n        }\n        this.setUpWorld(-w,-h,w,h);\n    }\n\n    (function(proto) {\n        proto.spriteLayer = function() {\n            return this._sprites || (this._sprites = createLayer(3));\n        };\n\n        proto.bgLayer = function() {\n            return this._background || (this._background = createLayer(1));\n        };\n\n        proto.hitTestLayer = function() {\n            return this._hitTest || (this._hitTest = createLayer(0,true));\n        };\n\n        proto.getManager = function(type) {\n            if (!this._managers[type]) {\n                this._managers[type] = new EventManager(type, this);\n            }\n            return this._managers[type];\n        };\n\n        proto.reset = function() {\n            var key;\n\n            this._keyListeners = undefined;\n\n            for (key in this._keyLogger) {\n                window.clearInterval(this._keyLogger[key]);\n                window.clearTimeout(this._keyLogger[key]);\n                delete this._keyLogger[key];\n            }\n\n            if (this._keyDownListener) {\n                getTarget().removeEventListener(\"keydown\", this._keyDownListener);\n                this._keyDownListener = undefined;\n            }\n\n            if (this._keyUpListener) {\n                getTarget().removeEventListener(\"keyup\", this._keyUpListener);\n                this._keyUpListener = undefined;\n            }\n\n            if (this._timer) {\n                window.clearTimeout(this._timer);\n                this._timer = undefined;\n            }\n\n            for(key in this._managers) {\n                this._managers[key].reset();\n            }\n\n            this._mode = \"standard\";\n            removeLayer(this._sprites);\n            this._sprites = undefined;\n            removeLayer(this._background);\n            this._background = undefined;\n        };\n\n        proto.setUpWorld = function(llx, lly, urx, ury) {\n            var world = this;\n\n            world.llx       = llx;\n            world.lly       = lly;\n            world.urx       = urx;\n            world.ury       = ury;\n            world.xScale    = (urx - llx) / getWidth();\n            world.yScale    = -1 * (ury - lly) / getHeight();\n            world.lineScale = Math.min(Math.abs(world.xScale), Math.abs(world.yScale));\n        };\n\n        proto.$setup = function(width, height, startX, startY) {\n            if (isNaN(parseFloat(width))) {\n                width = getWidth();\n            }\n            if (isNaN(parseFloat(height))) {\n                height = getHeight();\n            }\n\n            if (width <= 1) {\n                width = getWidth() * width;\n            }\n            if (height <= 1) {\n                height = getHeight() * height;\n            }\n\n            this._width  = width;\n            this._height = height;\n\n            this._xOffset = (startX !== undefined && !isNaN(parseInt(startX))) ?\n                parseInt(startX) :\n                0;\n\n            this._yOffset = (startY !== undefined && !isNaN(parseInt(startY))) ?\n                parseInt(startY) :\n                0;\n\n            if (this._mode === \"world\") {\n                return this._setworldcoordinates(this.llx, this.lly, this.urx, this.ury);\n            }\n\n            return this._setworldcoordinates(-width/2, -height/2, width/2, height/2);\n        };\n        proto.$setup.minArgs     = 0;\n        proto.$setup.keywordArgs = [\"width\", \"height\", \"startx\", \"starty\"];\n\n        proto.$register_shape = proto.$addshape = function(name, points) {\n            SHAPES[name] = points;\n        };\n\n        proto.$getshapes = function() {\n            return Object.keys(SHAPES);\n        };\n\n        proto.$tracer = function(frames, delay) {\n            if (frames !== undefined || delay !== undefined) {\n                if (typeof delay === \"number\") {\n                    this._delay = delay;\n                    getFrameManager().refreshInterval(delay);\n                }\n                if (typeof frames === \"number\") {\n                    this._frames = frames;\n                    return getFrameManager().frameBuffer(frames);\n                }\n\n                return;\n            }\n\n            return this._frames;\n        };\n        proto.$tracer.minArgs = 0;\n\n        proto.$delay = function(delay) {\n            if (delay !== undefined) {\n                return this.$tracer(undefined, delay);\n            }\n\n            return this._delay === undefined ? OPTIMAL_FRAME_RATE : this._delay;\n        };\n\n        proto._setworldcoordinates = function(llx, lly, urx, ury) {\n            var world     = this,\n                turtles = getFrameManager().turtles();\n\n            this.setUpWorld(llx, lly, urx, ury);\n\n            if (this._sprites) {\n                applyWorld(this, this._sprites);\n            }\n\n            if (this._background) {\n                applyWorld(this, this._background);\n            }\n\n            return this.$clear();\n        };\n\n        proto.$setworldcoordinates = function(llx, lly, urx, ury) {\n            this._mode = \"world\";\n            return this._setworldcoordinates(llx, lly, urx, ury);\n        };\n\n        proto.$clear = proto.$clearscreen = function() {\n            this.reset();\n            return this.$reset();\n        };\n\n        proto.$update = function() {\n            return getFrameManager().update();\n        };\n\n        proto.$reset = proto.$resetscreen = function() {\n            var self = this,\n                turtles = getFrameManager().turtles();\n\n            return getFrameManager().addFrame(function() {\n                applyWorld(self, self._sprites);\n                applyWorld(self, self._background);\n                for(var i = 0; i < turtles.length; i++) {\n                    turtles[i].reset();\n                    applyWorld(self, turtles[i]._paper);\n                }\n            }, true);\n        };\n\n        proto.$window_width = function() {\n            return getWidth();\n        };\n\n        proto.$window_height = function() {\n            return getHeight();\n        };\n        proto.$delay.minArgs = 0;\n\n        proto.$turtles = function() {\n            return getFrameManager().turtles();\n        };\n        proto.$turtles.returnType = Types.TURTLE_LIST;\n\n        proto.$bgcolor = function(color, g, b, a) {\n            if (arguments.length) {\n                this._bgcolor = createColor(color, g, b, a);\n                clearLayer(this.bgLayer(), this._bgcolor);\n                return;\n            }\n\n            return hexToRGB(this._bgcolor);\n        };\n        proto.$bgcolor.minArgs = 0;\n        proto.$bgcolor.returnType = Types.COLOR;\n\n        // no-op - just defined for consistency with python version\n        proto.$mainloop = proto.$done = function() {\n            return undefined;\n        };\n\n        proto.$bye = function() {\n            return pgSk.TurtleGraphics.reset();\n        };\n\n        proto.$exitonclick = function() {\n            this._exitOnClick = true;\n            return this.getManager(\"mousedown\").addHandler(function() {\n                resetTurtle();\n            }, false);\n        };\n\n        proto.$onclick = function(method,btn,add) {\n            if (this._exitOnClick) return;\n            this.getManager(\"mousedown\").addHandler(method, add);\n        };\n        proto.$onclick.minArgs = 1;\n        proto.$onclick.keywordArgs = [\"btn\",\"add\"];\n\n        var KEY_MAP = {\n            \"8\"  : /^back(space)?$/i,\n            \"9\"  : /^tab$/i,\n            \"13\" : /^(enter|return)$/i,\n            \"16\" : /^shift$/i,\n            \"17\" : /^(ctrl|control)$/i,\n            \"18\" : /^alt$/i,\n            \"27\" : /^esc(ape)?$/i,\n            \"32\" : /^space$/i,\n            \"33\" : /^page[\\s\\-]?up$/i,\n            \"34\" : /^page[\\s\\-]?down$/i,\n            \"35\" : /^end$/i,\n            \"36\" : /^home$/i,\n            \"37\" : /^left([\\s\\-]?arrow)?$/i,\n            \"38\" : /^up([\\s\\-]?arrow)?$/i,\n            \"39\" : /^right([\\s\\-]?arrow)?$/i,\n            \"40\" : /^down([\\s\\-]?arrow)?$/i,\n            \"45\" : /^insert$/i,\n            \"46\" : /^del(ete)?$/i\n        };\n\n        proto._createKeyRepeater = function(key, code) {\n            var self = this;\n            // set a timeout for 333ms and if key has not yet been\n            // released, fire another event and continue firing\n            // at a rate of ~20 times per second until key is released\n            self._keyLogger[code] = window.setTimeout(function() {\n                // trigger the first repeat after the longer delay\n                self._keyListeners[key]();\n                // set up the repeat interval with the quick delay\n                self._keyLogger[code] = window.setInterval(function() {\n                    self._keyListeners[key]();\n                }, 50);\n            }, 333);\n        };\n\n        proto._createKeyDownListener = function() {\n            var self = this;\n\n            if (this._keyDownListener) return;\n\n            this._keyDownListener = function(e) {\n                if (!focusTurtle()) return;\n\n                var code    = e.charCode || e.keyCode,\n                    pressed = String.fromCharCode(code).toLowerCase(),\n                    key, inKeyMap;\n\n                if (self._keyLogger[code]) return;\n\n                for (key in self._keyListeners) {\n                    inKeyMap = (key.length > 1 && KEY_MAP[code] && KEY_MAP[code].test(key));\n                    if (key === pressed || inKeyMap) {\n                        // trigger the intial keydown handler\n                        self._keyListeners[key]();\n                        self._createKeyRepeater(key, code);\n                        e.preventDefault();\n                        break;\n                    }\n                }\n            };\n\n            getTarget().addEventListener(\"keydown\", this._keyDownListener);\n        };\n\n        proto._createKeyUpListener = function() {\n            var self = this;\n\n            if (this._keyUpListener) return;\n\n            this._keyUpListener = function(e) {\n                var interval = self._keyLogger[e.charCode || e.keyCode];\n                if (interval !== undefined) {\n                    e.preventDefault();\n                    window.clearInterval(interval);\n                    window.clearTimeout(interval);\n                    delete(self._keyLogger[e.charCode || e.keyCode]);\n                }\n            };\n            \n            getTarget().addEventListener(\"keyup\", this._keyUpListener);\n        };\n\n        proto.$listen = function() {\n            this._createKeyUpListener();\n            this._createKeyDownListener();\n        };\n\n        proto.$onkey = function(method, keyValue) {\n            if (typeof keyValue === \"function\") {\n                var temp = method;\n                method   = keyValue;\n                keyValue = temp;\n            }\n\n            keyValue = String(keyValue).toLowerCase();\n\n            if (method && typeof method === \"function\") {\n                if (!this._keyListeners) this._keyListeners = {};\n                this._keyListeners[keyValue] = method;\n            }\n            else {\n                delete this._keyListeners[keyValue];\n            }\n        };\n\n        proto.$onscreenclick = function(method,btn,add) {\n            this.getManager(\"mousedown\").addHandler(method, add);\n        };\n        proto.$onscreenclick.minArgs = 1;\n        proto.$onscreenclick.keywordArgs = [\"btn\",\"add\"];\n\n        proto.$ontimer = function(method, interval) {\n            if (this._timer) {\n                window.clearTimeout(this._timer);\n                this._timer = undefined;\n            }\n\n            if (method && typeof interval === \"number\") {\n                this._timer = window.setTimeout(method, Math.max(0, interval|0));\n            }\n        };\n        proto.$ontimer.minArgs = 0;\n\n    })(Screen.prototype);\n\n    function ensureAnonymous() {\n        if (!_anonymousTurtle) {\n            _anonymousTurtle = pgSk.misceval.callsim(_module.Turtle);\n        }\n\n        return _anonymousTurtle.instance;\n    }\n\n    function getTarget() {\n        return _target;\n    }\n\n    function getScreen() {\n        if (!_screenInstance) {\n            _screenInstance = new Screen();\n        }\n        return _screenInstance;\n    }\n\n    function getMouseHandler() {\n        if (!_mouseHandler) {\n            _mouseHandler = new MouseHandler();\n        }\n        return _mouseHandler;\n    }\n\n    function getWidth() {\n        return (\n            (_screenInstance && _screenInstance._width) ||\n            _config.width ||\n            getTarget().clientWidth\n        ) | 0;\n    }\n\n    function getHeight() {\n        return (\n            (_screenInstance && _screenInstance._height) ||\n            _config.height ||\n            getTarget().clientHeight\n        ) | 0;\n    }\n\n    function createLayer(zIndex, isHidden) {\n        var canvas = document.createElement(\"canvas\"),\n            width  = getWidth(),\n            height = getHeight(),\n            offset = getTarget().firstChild ? (-height) + \"px\" : \"0\",\n            context;\n\n        canvas.width          = width;\n        canvas.height         = height;\n        canvas.style.position = \"relative\";\n        canvas.style.display  = \"block\";\n        canvas.style.setProperty(\"margin-top\",offset);\n        canvas.style.setProperty(\"z-index\", zIndex);\n        if (isHidden) {\n            canvas.style.display = \"none\";\n        }\n\n        getTarget().appendChild(canvas);\n\n        context = canvas.getContext(\"2d\");\n        context.lineCap = \"round\";\n        context.lineJoin = \"round\";\n\n        applyWorld(getScreen(), context);\n\n        return context;\n    }\n\n    function cancelAnimationFrame() {\n        if (_frameRequest) {\n            (window.cancelAnimationFrame || window.mozCancelAnimationFrame)(_frameRequest);\n            _frameRequest = undefined;\n        }\n        if (_frameRequestTimeout) {\n            window.clearTimeout(_frameRequestTimeout);\n            _frameRequestTimeout = undefined;\n        }\n    }\n\n    function applyWorld(world, context) {\n        var llx    = world.llx,\n            lly    = world.lly,\n            urx    = world.urx,\n            ury    = world.ury,\n            xScale = world.xScale,\n            yScale = world.yScale;\n\n        if (!context) return;\n\n        clearLayer(context);\n\n        context.restore();\n        context.save();\n        context.scale(1 / xScale, 1 / yScale);\n        if (lly === 0) {\n            context.translate(-llx, lly - (ury - lly));\n        } else if (lly > 0) {\n            context.translate(-llx, -lly * 2);\n        } else {\n            context.translate(-llx, -ury);\n        }\n    }\n\n    function pushUndo(turtle) {\n        var properties, undoState, i;\n\n        if (!_config.allowUndo || !turtle._bufferSize) {\n            return;\n        }\n\n        if (!turtle._undoBuffer) {\n            turtle._undoBuffer = [];\n        }\n\n        while(turtle._undoBuffer.length > turtle._bufferSize) {\n            turtle._undoBuffer.shift();\n        }\n\n        undoState  = {};\n        properties = \"x y angle radians color fill down filling shown shape size\".split(\" \");\n        for(i = 0; i < properties.length; i++) {\n            undoState[properties[i]] = turtle[\"_\" + properties[i]];\n        }\n\n        turtle._undoBuffer.push(undoState);\n\n        return turtle.addUpdate(function() {\n            undoState.fillBuffer = this.fillBuffer ? this.fillBuffer.slice() : undefined;\n            if (turtle._paper && turtle._paper.canvas) {\n                undoState.image = turtle._paper.canvas.toDataURL();\n            }\n        }, false);\n    }\n\n    var undoImage = new Image();\n    function popUndo(turtle) {\n        var undoState;\n\n        if (!turtle._bufferSize || !turtle._undoBuffer) {\n            return;\n        }\n\n        undoState = turtle._undoBuffer.pop();\n\n        if (!undoState) {\n            return;\n        }\n\n        for(var key in undoState) {\n            if (key === \"image\" || key === \"fillBuffer\") continue;\n            turtle[\"_\" + key] = undoState[key];\n        }\n\n        return turtle.addUpdate(function() {\n            var img;\n            if (undoState.image) {\n                undoImage.src = undoState.image;\n                img = undoImage;\n            }\n\n            clearLayer(this.context(), false, undoImage);\n            delete undoState.image;\n        }, true, undoState);\n    }\n\n    function removeLayer(layer) {\n        if (layer && layer.canvas && layer.canvas.parentNode) {\n            layer.canvas.parentNode.removeChild(layer.canvas);\n        }\n    }\n\n    function clearLayer(context, color, image) {\n        if (!context) return;\n\n        context.save();\n        context.setTransform(1,0,0,1,0,0);\n        if (color) {\n            context.fillStyle = color;\n            context.fillRect(0, 0, context.canvas.width, context.canvas.height);\n        }\n        else {\n            context.clearRect(0, 0, context.canvas.width, context.canvas.height);\n        }\n\n        if (image) {\n            context.drawImage(image, 0, 0);\n        }\n\n        context.restore();\n    }\n\n    function drawTurtle(state, context) {\n        var shape  = SHAPES[state.shape],\n            world  = getScreen(),\n            width  = getWidth(),\n            height = getHeight(),\n            xScale = world.xScale,\n            yScale = world.yScale,\n            x, y, bearing;\n\n        if (!context) return;\n\n        x       = Math.cos(state.radians) / xScale;\n        y       = Math.sin(state.radians) / yScale;\n        bearing = Math.atan2(y, x) - Math.PI/2;\n\n        context.save();\n        context.translate(state.x, state.y);\n        context.scale(xScale,yScale);\n        context.rotate(bearing);\n        context.beginPath();\n        context.lineWidth   = 1;\n        context.strokeStyle = state.color;\n        context.fillStyle   = state.fill;\n        context.moveTo(shape[0][0], shape[0][1]);\n        for(var i = 1; i < shape.length; i++) {\n            context.lineTo(shape[i][0], shape[i][1]);\n        }\n        context.closePath();\n        context.fill();\n        context.stroke();\n        context.restore();\n    }\n\n    function drawDot(size, color) {\n        var context = this.context(),\n            screen  = getScreen(),\n            xScale  = screen.xScale,\n            yScale  = screen.yScale;\n\n        if (!context) return;\n        context.beginPath();\n        context.moveTo(this.x, this.y);\n        size = size * Math.min(Math.abs(xScale),Math.abs(yScale));\n        context.arc(this.x, this.y, size, 0, Turtle.RADIANS);\n        context.closePath();\n        context.fillStyle = color || this.color;\n        context.fill();\n    }\n\n    var textMeasuringContext = document.createElement(\"canvas\").getContext(\"2d\");\n    function measureText(message, font) {\n        if (font) {\n            textMeasuringContext.font = font;\n        }\n        return textMeasuringContext.measureText(message).width;\n    }\n\n    function drawText(message, align, font) {\n        var context = this.context();\n\n        if (!context) return;\n\n        context.save();\n        if (font) {\n            context.font = font;\n        }\n        if (align && align.match(/^(left|right|center)$/)) {\n            context.textAlign = align;\n        }\n\n        context.scale(1,-1);\n        context.fillStyle = this.fill;\n        context.fillText(message, this.x, -this.y);\n        context.restore();\n    }\n\n    function drawLine(loc, beginPath, endPath) {\n        // TODO: make steps in path use square ends of lines\n        // and open and close path at the right times.\n        // See if we can minimize calls to stroke\n        var context = this.context();\n\n        if (!context) return;\n\n        if (beginPath) {\n            context.beginPath();\n            context.moveTo(this.x, this.y);\n        }\n\n        context.lineWidth   = this.size * getScreen().lineScale;\n        context.strokeStyle = this.color;\n        context.lineTo(loc.x, loc.y);\n        context.stroke();\n    }\n\n    function drawFill() {\n        var context = this.context(),\n            path  = this.fillBuffer,\n            i;\n\n        if (!context || !path || !path.length) return;\n\n        context.save();\n        context.beginPath();\n        context.moveTo(path[0].x,path[0].y);\n        for(i = 1; i < path.length; i++) {\n            context.lineTo(path[i].x, path[i].y);\n        }\n        context.closePath();\n        context.fillStyle = this.fill;\n        context.fill();\n        for(i = 1; i < path.length; i++) {\n            if (!path[i].stroke) {\n                continue;\n            }\n\n            context.beginPath();\n            context.moveTo(path[i-1].x, path[i-1].y);\n            context.lineWidth   = path[i].size * getScreen().lineScale;\n            context.strokeStyle = path[i].color;\n            context.lineTo(path[i].x, path[i].y);\n            context.stroke();\n        }\n        context.restore();\n    }\n\n    function partialTranslate(turtle, x, y, beginPath, countAsFrame) {\n        return function() {\n            return turtle.addUpdate(\n                function(loc) {\n                    if (this.down) {\n                        drawLine.call(this, loc, beginPath);\n                    }\n                },\n                countAsFrame,\n                {x : x, y : y},\n                beginPath\n            );\n        };\n    }\n\n    function translate(turtle, startX, startY, dx, dy, beginPath, isCircle) {\n        // speed is in pixels per ms\n        var speed   = turtle._computed_speed,\n            screen  = getScreen(),\n            xScale  = Math.abs(screen.xScale),\n            yScale  = Math.abs(screen.yScale),\n            x       = startX,\n            y       = startY,\n            pixels  = Math.sqrt(dx * dx * xScale + dy * dy * yScale),\n            // TODO: allow fractional frame updates?\n            frames  = speed ? Math.round(Math.max(1, pixels / speed)) : 1,\n            xStep   = dx / frames,\n            yStep   = dy / frames,\n            promise = getFrameManager().willRenderNext() ?\n                Promise.resolve() :\n                new InstantPromise(),\n            countAsFrame = (!speed && isCircle) ? false : true,\n            i;\n\n        turtle.addUpdate(function() {\n            if (this.filling) {\n                this.fillBuffer.push({\n                    x        : this.x,\n                    y      : this.y,\n                    stroke : this.down,\n                    color  : this.color,\n                    size   : this.size\n                });\n            }\n        }, false);\n\n        for(i = 0; i < frames; i++) {\n            x = startX + xStep * (i+1);\n            y = startY + yStep * (i+1);\n            promise = promise.then(\n                partialTranslate(turtle, x, y, beginPath, countAsFrame)\n            );\n            beginPath = false;\n        }\n\n        return promise.then(function() {\n            return [startX + dx, startY + dy];\n        });\n    }\n\n    function partialRotate(turtle, angle, radians, countAsFrame) {\n        return function() {\n            return turtle.addUpdate(undefined, countAsFrame, {angle:angle, radians:radians});\n        };\n    }\n\n    function rotate(turtle, startAngle, delta, isCircle) {\n        var speed        = turtle._computed_speed,\n            degrees    = delta / turtle._fullCircle * 360,\n            frames     = speed ? Math.round(Math.max(1, Math.abs(degrees) / speed)) : 1,\n            dAngle     = delta / frames,\n            heading    = {},\n            countAsFrame = (!speed && isCircle) ? false : true,\n            promise    = getFrameManager().willRenderNext() ?\n                Promise.resolve() :\n                new InstantPromise(),\n            i;\n\n        // TODO: request how many frames are remaining and only queue up\n        // a single rotation per screen update\n\n        for(i = 0; i < frames; i++) {\n            calculateHeading(turtle, startAngle + dAngle * (i+1), heading);\n            promise = promise.then(\n                partialRotate(turtle, heading.angle, heading.radians, countAsFrame)\n            );\n        }\n\n        return promise.then(function() {\n            return calculateHeading(turtle, startAngle + delta);\n        });\n    }\n\n    function getCoordinates(x, y) {\n        if (y === undefined) {\n            y = (x && (x.y || x._y || x[1])) || 0;\n            x = (x && (x.x || x._x || x[0])) || 0;\n        }\n        return {x:x, y:y};\n    }\n\n    // Modified solution of Tim Down's version from stackoverflow\n    // http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb\n    function hexToRGB(hex) {\n        var rgbForm, hexForm, result;\n\n        if (rgbForm = /^rgba?\\((\\d+),(\\d+),(\\d+)(?:,([.\\d]+))?\\)$/.exec(hex)) {\n            result = [\n                parseInt(rgbForm[1]),\n                parseInt(rgbForm[2]),\n                parseInt(rgbForm[3])\n            ];\n            if (rgbForm[4]) {\n                result.push(parseFloat(rgbForm[4]));\n            }\n        }\n        else if (/^#?[a-f\\d]{3}|[a-f\\d]{6}$/i.exec(hex)) {\n            if (hex.length === 4) {\n                // Expand shorthand form (e.g. \"03F\") to full form (e.g. \"0033FF\")\n                hex = hex.replace(/^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i, function(m, r, g, b) {\n                        return r + r + g + g + b + b;\n                });\n            }\n\n            hexForm = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n            result = [\n                parseInt(hexForm[1], 16),\n                parseInt(hexForm[2], 16),\n                parseInt(hexForm[3], 16)\n            ];\n        }\n        else {\n            result = hex;\n        }\n\n        return result;\n    }\n\n    function createColor(color, g, b, a) {\n        var i;\n\n        if (g !== undefined) {\n            color = [color, g, b, a];\n        }\n\n        if (color.constructor === Array && color.length) {\n            for(i = 0; i < 3; i++) {\n                color[i] = (typeof color[i] === \"number\") ?\n                    Math.max(0, Math.min(255, parseInt(color[i]))) :\n                    0;\n            }\n            if (typeof color[i] === \"number\") {\n                color[3] = Math.max(0, Math.min(1, color[i]));\n                color = \"rgba(\" + color.join(\",\") + \")\";\n            }\n            else {\n                color = \"rgb(\" + color.slice(0,3).join(\",\") + \")\";\n            }\n        }\n        else if (typeof color === \"string\" && !color.match(/\\s*url\\s*\\(/i)) {\n            color = color.replace(/\\s+/g, \"\");\n        }\n        else {\n            return \"black\";\n        }\n\n        return color;\n    }\n\n    function calculateHeading(turtle, value, heading) {\n        var angle   = turtle._angle   || 0,\n            radians = turtle._radians || 0;\n\n        heading || (heading = {});\n\n        if (typeof value === \"number\") {\n            if (turtle._isRadians) {\n                angle = radians = value % Turtle.RADIANS;\n            }\n            else if (turtle._fullCircle) {\n                angle   = (value % turtle._fullCircle);\n                radians = angle / turtle._fullCircle * Turtle.RADIANS;\n            }\n            else {\n                angle = radians = 0;\n            }\n\n            if (angle < 0) {\n                angle   += turtle._fullCircle;\n                radians += Turtle.RADIANS;\n            }\n        }\n\n        heading.angle   = angle;\n        heading.radians = radians;\n\n        return heading;\n    }\n\n    function pythonToJavascriptFunction(pyValue, scope) {\n        return function() {\n            var argsJs = Array.prototype.slice.call(arguments),\n                argsPy = argsJs.map(\n                    function(argJs) {return pgSk.ffi.remapToPy(argJs);}\n                );\n\n            if (typeof(scope) !== \"undefined\") {\n                argsPy.unshift(scope);\n            }\n            return pgSk.misceval.applyAsync(\n                undefined, pyValue, undefined, undefined, undefined, argsPy\n            ).catch(pgSk.uncaughtException);\n        };\n    }\n\n    function addModuleMethod(klass, module, method, scopeGenerator) {\n        var publicMethodName = method.replace(/^\\$/, \"\"),\n            displayName      = publicMethodName.replace(/_\\$[a-z]+\\$$/i, \"\"),\n            maxArgs          = klass.prototype[method].length,\n            minArgs          = klass.prototype[method].minArgs,\n            keywordArgs      = klass.prototype[method].keywordArgs,\n            returnType       = klass.prototype[method].returnType,\n            ispgSk             = klass.prototype[method].ispgSk,\n            wrapperFn;\n\n        if (minArgs === undefined) {\n            minArgs = maxArgs;\n        }\n\n        wrapperFn = function() {\n            var args     = Array.prototype.slice.call(arguments, 0),\n                instance = scopeGenerator ? scopeGenerator() : args.shift().instance,\n                i, result, susp, resolution, lengthError;\n\n            if (args.length < minArgs || args.length > maxArgs) {\n                lengthError = minArgs === maxArgs ?\n                    \"exactly \" + maxArgs :\n                    \"between \" + minArgs + \" and \" + maxArgs;\n\n                throw new pgSk.builtin.TypeError(displayName + \"() takes \" + lengthError + \" positional argument(s) (\" + args.length + \" given)\");\n            }\n\n            for (i = args.length; --i >= 0;) {\n                if (args[i] !== undefined) {\n                    if (args[i] instanceof pgSk.builtin.func) {\n                        args[i] = pythonToJavascriptFunction(args[i]);\n                    }\n                    else if (args[i] instanceof pgSk.builtin.method) {\n                        args[i] = pythonToJavascriptFunction(args[i].im_func, args[i].im_self);\n                    }\n                    else if (args[i] && args[i].$d instanceof pgSk.builtin.dict && args[i].instance) {\n                        args[i] = args[i].instance;\n                    }\n                    else {\n                        args[i] = pgSk.ffi.remapToJs(args[i]);\n                    }\n                }\n            }\n\n            try {\n                result = instance[method].apply(instance, args);\n            } catch(e) {\n                if (window && window.console) {\n                    window.console.log(\"wrapped method failed\");\n                    window.console.log(e.stack);\n                }\n                throw e;\n            }\n\n            if (result instanceof InstantPromise) {\n                result = result.lastResult;\n            }\n\n            if (result instanceof Promise) {\n                result = result.catch(function(e) {\n                    if (window && window.console) {\n                        window.console.log(\"promise failed\");\n                        window.console.log(e.stack);\n                    }\n                    throw e;\n                });\n\n                susp = new pgSk.misceval.Suspension();\n\n                susp.resume = function() {\n                    return (resolution === undefined) ?\n                        pgSk.builtin.none.none$ :\n                        pgSk.ffi.remapToPy(resolution);\n                };\n\n                susp.data = {\n                    type: \"pgSk.promise\",\n                    promise: result.then(function(value) {\n                        resolution = value;\n                        return value;\n                    })\n                };\n\n                return susp;\n            }\n            else {\n                if (result === undefined) return pgSk.builtin.none.none$;\n                if (ispgSk) return result;\n                if (typeof returnType === \"function\") {\n                    return returnType(result);\n                }\n\n                return pgSk.ffi.remapToPy(result);\n            }\n        };\n\n        if (keywordArgs) {\n            wrapperFn.co_varnames = keywordArgs.slice();\n            // make room for required arguments\n            for(var i = 0; i < minArgs; i++) {\n                wrapperFn.co_varnames.unshift(\"\");\n            }\n            if (!scopeGenerator) {\n                // make room for the \"self\" argument\n                wrapperFn.co_varnames.unshift(\"\");\n            }\n        }\n\n        module[publicMethodName] = new pgSk.builtin.func(wrapperFn);\n    }\n\n    function TurtleWrapper($gbl, $loc) {\n        $loc.__init__ = new pgSk.builtin.func(function (self) {\n            self.instance = new Turtle();\n            self.instance.skInstance = self;\n        });\n\n        for(var key in Turtle.prototype) {\n            if (/^\\$[a-z_]+/.test(key)) {\n                addModuleMethod(Turtle, $loc, key);\n            }\n        }\n    }\n\n    function ScreenWrapper($gbl, $loc) {\n        $loc.__init__ = new pgSk.builtin.func(function (self) {\n            self.instance = getScreen();\n        });\n\n        for(var key in Screen.prototype) {\n            if (/^\\$[a-z_]+/.test(key)) {\n                addModuleMethod(Screen, $loc, key);\n            }\n        }\n    }\n\n    for(var key in Turtle.prototype) {\n        if (/^\\$[a-z_]+/.test(key)) {\n            addModuleMethod(Turtle, _module, key, ensureAnonymous);\n        }\n    }\n\n    // add Screen method aliases to the main turtle module\n    // to allow things like:\n    //   import turtle\n    //   turtle.mainloop()\n    addModuleMethod(Screen, _module, \"$mainloop\", getScreen);\n    addModuleMethod(Screen, _module, \"$done\", getScreen);\n    addModuleMethod(Screen, _module, \"$bye\", getScreen);\n    addModuleMethod(Screen, _module, \"$tracer\", getScreen);\n    addModuleMethod(Screen, _module, \"$update\", getScreen);\n    addModuleMethod(Screen, _module, \"$delay\", getScreen);\n    addModuleMethod(Screen, _module, \"$window_width\", getScreen);\n    addModuleMethod(Screen, _module, \"$window_height\", getScreen);\n\n    _module.Turtle = pgSk.misceval.buildClass(_module, TurtleWrapper, \"Turtle\", []);\n    _module.Screen = pgSk.misceval.buildClass(_module, ScreenWrapper, \"Screen\", []);\n\n    // Calling focus(false) will block turtle key/mouse events\n    // until focus(true) is called again or until the turtle DOM target\n    // is clicked/tabbed into.\n    function focusTurtle(value) {\n        if (value !== undefined) {\n            _focus = !!value;\n            if (_focus) {\n                getTarget().focus();\n            }\n            else {\n                getTarget().blur();\n            }\n        }\n\n        return _focus;\n    }\n\n    function resetTurtle() {\n        cancelAnimationFrame();\n        getScreen().reset();\n        getFrameManager().reset();\n\n        while (_target.firstChild) {\n            _target.removeChild(_target.firstChild);\n        }\n\n        if (_mouseHandler) {\n            _mouseHandler.reset();\n        }\n\n        _durationSinceRedraw = 0;\n        _screenInstance      = undefined;\n        _anonymousTurtle     = undefined;\n        _mouseHandler        = undefined;\n        TURTLE_COUNT         = 0;\n    }\n\n    function stopTurtle() {\n        cancelAnimationFrame();\n\n        if (_mouseHandler) {\n            _mouseHandler.reset();\n        }\n\n        _durationSinceRedraw = 0;\n        _screenInstance      = undefined;\n        _anonymousTurtle     = undefined;\n        _mouseHandler        = undefined;\n        TURTLE_COUNT         = 0;\n    }\n\n    return {\n        skModule : _module,\n        reset    : resetTurtle,\n        stop     : stopTurtle,\n        focus    : focusTurtle,\n        Turtle   : Turtle,\n        Screen   : Screen\n    };\n}\n\n// See if the TurtleGraphics module has already been loaded\n// for the currently configured DOM target element.\nvar currentTarget = getConfiguredTarget();\n\nif (!currentTarget.turtleInstance) {\n    currentTarget.turtleInstance = generateTurtleModule(currentTarget);\n}\nelse {\n    currentTarget.turtleInstance.reset();\n}\n\npgSk.TurtleGraphics.module = currentTarget.turtleInstance.skModule;\npgSk.TurtleGraphics.reset  = currentTarget.turtleInstance.reset;\npgSk.TurtleGraphics.stop   = currentTarget.turtleInstance.stop;\npgSk.TurtleGraphics.focus  = currentTarget.turtleInstance.focus;\npgSk.TurtleGraphics.raw = {\n    Turtle : currentTarget.turtleInstance.Turtle,\n    Screen : currentTarget.turtleInstance.Screen\n};\n\nreturn currentTarget.turtleInstance.skModule;\n\n};\n", "src/lib/rexec.py": "raise NotImplementedError(\"rexec is not yet implemented in pgSkulpt\")\n", "src/lib/glob.py": "raise NotImplementedError(\"glob is not yet implemented in pgSkulpt\")\n", "src/lib/pipes.py": "raise NotImplementedError(\"pipes is not yet implemented in pgSkulpt\")\n", "src/lib/smtpd.py": "raise NotImplementedError(\"smtpd is not yet implemented in pgSkulpt\")\n", "src/lib/os2emxpath.py": "raise NotImplementedError(\"os2emxpath is not yet implemented in pgSkulpt\")\n", "src/lib/collections.js": "var $builtinmodule = function (name) {\n\n    var mod = {};\n\n    // defaultdict object\n\n    mod.defaultdict = function defaultdict(default_, args) {\n        if (!(this instanceof mod.defaultdict)) {\n            return new mod.defaultdict(default_, args);\n        }\n\n        pgSk.abstr.superConstructor(mod.defaultdict, this, args);\n\n        if (default_ === undefined) {\n            this.default_factory = pgSk.builtin.none.none$;\n        }\n        else {\n            if (!pgSk.builtin.checkCallable(default_) && !(default_ instanceof pgSk.builtin.none)) {\n                throw new pgSk.builtin.TypeError(\"first argument must be callable\");\n            }\n            this.default_factory = default_;\n        }\n\n        if (this['$d']) {\n            this['$d']['default_factory'] = this.default_factory;\n        }\n        else {\n            this['$d'] = {'default_factory': this.default_factory};\n        }\n\n        return this;\n    };\n\n    pgSk.abstr.setUpInheritance(\"defaultdict\", mod.defaultdict, pgSk.builtin.dict);\n\n    mod.defaultdict.prototype['$r'] = function () {\n        var def_str = pgSk.misceval.objectRepr(this.default_factory).v;\n        var dict_str = pgSk.builtin.dict.prototype['$r'].call(this).v;\n        return new pgSk.builtin.str(\"defaultdict(\" + def_str + \", \" + dict_str + \")\");\n    };\n\n    mod.defaultdict.prototype['__missing__'] = function (key) {\n        pgSk.builtin.pyCheckArgs('__missing__', arguments, 0, 1);\n        if (key) {\n            throw new pgSk.builtin.KeyError(pgSk.misceval.objectRepr(key));\n        }\n        else {\n            return pgSk.misceval.callsim(this.default_factory);\n        }\n    };\n\n    mod.defaultdict.prototype.mp$subscript = function (key) {\n        try {\n            return pgSk.builtin.dict.prototype.mp$subscript.call(this, key);\n        }\n        catch (e) {\n            if (this.default_factory instanceof pgSk.builtin.none) {\n                return this.__missing__(key);\n            }\n            else {\n                ret = this.__missing__();\n                this.mp$ass_subscript(key, ret);\n                return ret;\n            }\n        }\n    };\n\n    // Counter object\n\n    mod.Counter = function Counter(iter_or_map) {\n        if (!(this instanceof mod.Counter)) {\n            return new mod.Counter(iter_or_map);\n        }\n\n\n        if (iter_or_map instanceof pgSk.builtin.dict || iter_or_map === undefined) {\n            pgSk.abstr.superConstructor(mod.Counter, this, iter_or_map);\n\n        }\n        else {\n            if (!(pgSk.builtin.checkIterable(iter_or_map))) {\n                throw new pgSk.builtin.TypeError(\"'\" + pgSk.abstr.typeName(iter_or_map) + \"' object is not iterable\");\n            }\n\n            pgSk.abstr.superConstructor(mod.Counter, this);\n            var one = new pgSk.builtin.int_(1);\n\n            for (var iter = iter_or_map.tp$iter(), k = iter.tp$iternext();\n                 k !== undefined;\n                 k = iter.tp$iternext()) {\n                var count = this.mp$subscript(k);\n                count = count.nb$add(one);\n                this.mp$ass_subscript(k, count);\n            }\n        }\n\n        return this;\n    };\n\n    pgSk.abstr.setUpInheritance(\"Counter\", mod.Counter, pgSk.builtin.dict);\n\n    mod.Counter.prototype['$r'] = function () {\n        var dict_str = this.size > 0 ? pgSk.builtin.dict.prototype['$r'].call(this).v : '';\n        return new pgSk.builtin.str('Counter(' + dict_str + ')');\n    };\n\n    mod.Counter.prototype.mp$subscript = function (key) {\n        try {\n            return pgSk.builtin.dict.prototype.mp$subscript.call(this, key);\n        }\n        catch (e) {\n            return new pgSk.builtin.int_(0);\n        }\n    };\n\n    mod.Counter.prototype['elements'] = new pgSk.builtin.func(function (self) {\n        pgSk.builtin.pyCheckArgs('elements', arguments, 1, 1);\n        var all_elements = [];\n        for (var iter = self.tp$iter(), k = iter.tp$iternext();\n             k !== undefined;\n             k = iter.tp$iternext()) {\n            for (var i = 0; i < self.mp$subscript(k).v; i++) {\n                all_elements.push(k);\n            }\n        }\n\n        var ret =\n        {\n            tp$iter: function () {\n                return ret;\n            },\n            $obj: this,\n            $index: 0,\n            $elem: all_elements,\n            tp$iternext: function () {\n                if (ret.$index >= ret.$elem.length) {\n                    return undefined;\n                }\n                return ret.$elem[ret.$index++];\n            }\n        };\n\n        return ret;\n\n    });\n\n    mod.Counter.prototype['most_common'] = new pgSk.builtin.func(function (self, n) {\n        pgSk.builtin.pyCheckArgs('most_common', arguments, 1, 2);\n        var length = self.mp$length();\n\n        if (n === undefined) {\n            n = length;\n        }\n        else {\n            if (!pgSk.builtin.checkInt(n)) {\n                if (n instanceof pgSk.builtin.float_) {\n                    throw new pgSk.builtin.TypeError(\"integer argument expected, got float\");\n                }\n                else {\n                    throw new pgSk.builtin.TypeError(\"an integer is required\");\n                }\n            }\n\n            n = pgSk.builtin.asnum$(n);\n            n = n <= length ? n : length;\n            n = n >= 0 ? n : 0;\n        }\n\n        var most_common_elem = [];\n        for (var iter = self.tp$iter(), k = iter.tp$iternext();\n             k !== undefined;\n             k = iter.tp$iternext()) {\n            most_common_elem.push([k, self.mp$subscript(k)]);\n        }\n\n        var sort_func = function (a, b) {\n            if (a[1].v < b[1].v) {\n                return 1;\n            } else if (a[1].v > b[1].v) {\n                return -1;\n            } else {\n                return 0;\n            }\n        };\n        most_common_elem = most_common_elem.sort(sort_func);\n\n        var ret = [];\n        for (var i = 0; i < n; i++) {\n            ret.push(new pgSk.builtin.tuple(most_common_elem.shift()));\n        }\n\n        return new pgSk.builtin.list(ret);\n    });\n\n    mod.Counter.prototype['update'] = new pgSk.builtin.func(function (self, other) {\n        pgSk.builtin.pyCheckArgs('update', arguments, 1, 2);\n\n        if (other instanceof pgSk.builtin.dict) {\n            for (var iter = other.tp$iter(), k = iter.tp$iternext();\n                 k !== undefined;\n                 k = iter.tp$iternext()) {\n                var count = self.mp$subscript(k);\n                self.mp$ass_subscript(k, count.nb$add(other.mp$subscript(k)));\n            }\n        }\n        else if (other !== undefined) {\n            if (!pgSk.builtin.checkIterable(other)) {\n                throw new pgSk.builtin.TypeError(\"'\" + pgSk.abstr.typeName(other) + \"' object is not iterable\");\n            }\n\n            var one = new pgSk.builtin.int_(1);\n            for (var iter = other.tp$iter(), k = iter.tp$iternext();\n                 k !== undefined;\n                 k = iter.tp$iternext()) {\n                var count = self.mp$subscript(k);\n                self.mp$ass_subscript(k, count.nb$add(one));\n            }\n        }\n    });\n\n    mod.Counter.prototype['subtract'] = new pgSk.builtin.func(function (self, other) {\n        pgSk.builtin.pyCheckArgs('subtract', arguments, 1, 2);\n\n        if (other instanceof pgSk.builtin.dict) {\n            for (var iter = other.tp$iter(), k = iter.tp$iternext();\n                 k !== undefined;\n                 k = iter.tp$iternext()) {\n                var count = self.mp$subscript(k);\n                self.mp$ass_subscript(k, count.nb$subtract(other.mp$subscript(k)));\n            }\n        }\n        else if (other !== undefined) {\n            if (!pgSk.builtin.checkIterable(other)) {\n                throw new pgSk.builtin.TypeError(\"'\" + pgSk.abstr.typeName(other) + \"' object is not iterable\");\n            }\n\n            var one = new pgSk.builtin.int_(1);\n            for (var iter = other.tp$iter(), k = iter.tp$iternext();\n                 k !== undefined;\n                 k = iter.tp$iternext()) {\n                var count = self.mp$subscript(k);\n                self.mp$ass_subscript(k, count.nb$subtract(one));\n            }\n        }\n    });\n\n\n    // OrderedDict\n    mod.OrderedDict = function OrderedDict(items)\n    {\n        if (!(this instanceof mod.OrderedDict))\n        {\n            return new mod.OrderedDict(items);\n        }\n\n        this.orderedkeys = [];\n\n        pgSk.abstr.superConstructor(mod.OrderedDict, this, items);\n\n        return this;\n    }\n\n    pgSk.abstr.setUpInheritance(\"OrderedDict\", mod.OrderedDict, pgSk.builtin.dict);\n\n    mod.OrderedDict.prototype['$r'] = function()\n    {\n        var v;\n        var iter, k;\n        var ret = [];\n        var pairstr;\n        for (iter = this.tp$iter(), k = iter.tp$iternext();\n             k !== undefined;\n             k = iter.tp$iternext()) {\n            v = this.mp$subscript(k);\n            if (v === undefined) {\n                //print(k, \"had undefined v\");\n                v = null;\n            }\n            ret.push(\"(\" + pgSk.misceval.objectRepr(k).v + \", \" + pgSk.misceval.objectRepr(v).v + \")\");\n        }\n        pairstr = ret.join(\", \");\n        if (ret.length > 0)\n        {\n            pairstr = \"[\" + pairstr + \"]\";\n        }\n        return new pgSk.builtin.str(\"OrderedDict(\" + pairstr + \")\");\n    }\n\n    mod.OrderedDict.prototype.mp$ass_subscript = function(key, w)\n    {\n        var idx = this.orderedkeys.indexOf(key);\n        if (idx == -1)\n        {\n            this.orderedkeys.push(key);\n        }\n\n        return pgSk.builtin.dict.prototype.mp$ass_subscript.call(this, key, w);\n    }\n\n    mod.OrderedDict.prototype.mp$del_subscript = function(key)\n    {\n        var idx = this.orderedkeys.indexOf(key);\n        if (idx != -1)\n        {\n            this.orderedkeys.splice(idx, 1);\n        }\n\n        return pgSk.builtin.dict.prototype.mp$del_subscript.call(this, key);\n    }\n\n    mod.OrderedDict.prototype.__iter__ = new pgSk.builtin.func(function (self) {\n        pgSk.builtin.pyCheckArgs(\"__iter__\", arguments, 0, 0, false, true);\n\n        return mod.OrderedDict.prototype.tp$iter.call(self);\n    });\n\n    mod.OrderedDict.prototype.tp$iter = function()\n    {\n        var ret;\n        ret =\n        {\n            tp$iter    : function () {\n                return ret;\n            },\n            $obj       : this,\n            $index     : 0,\n            $keys      : this.orderedkeys.slice(0),\n            tp$iternext: function () {\n                // todo; StopIteration\n                if (ret.$index >= ret.$keys.length) {\n                    return undefined;\n                }\n                return ret.$keys[ret.$index++];\n            }\n        };\n        return ret;\n    }\n\n    mod.OrderedDict.prototype.ob$eq = function (other) {\n        var l;\n        var otherl;\n        var iter;\n        var k;\n        var v;\n\n        if (!(other instanceof mod.OrderedDict))\n        {\n            return pgSk.builtin.dict.prototype.ob$eq.call(this, other);\n        }\n\n        l = this.mp$length();\n        otherl = other.mp$length();\n\n        if (l !== otherl) {\n            return pgSk.builtin.bool.false$;\n        }\n\n        for (iter = this.tp$iter(), otheriter = other.tp$iter(),\n             k = iter.tp$iternext(), otherk = otheriter.tp$iternext();\n             k !== undefined;\n             k = iter.tp$iternext(), otherk = otheriter.tp$iternext()) \n        {\n            if (!pgSk.misceval.isTrue(pgSk.misceval.richCompareBool(k, otherk, \"Eq\")))\n            {\n                return pgSk.builtin.bool.false$;\n            }\n            v = this.mp$subscript(k);\n            otherv = other.mp$subscript(otherk);\n\n            if (!pgSk.misceval.isTrue(pgSk.misceval.richCompareBool(v, otherv, \"Eq\"))) {\n                return pgSk.builtin.bool.false$;\n            }\n        }\n\n        return pgSk.builtin.bool.true$;\n    };\n\n    mod.OrderedDict.prototype.ob$ne = function (other) {\n        var l;\n        var otherl;\n        var iter;\n        var k;\n        var v;\n\n        if (!(other instanceof mod.OrderedDict))\n        {\n            return pgSk.builtin.dict.prototype.ob$ne.call(this, other);\n        }\n\n        l = this.size;\n        otherl = other.size;\n\n        if (l !== otherl) {\n            return pgSk.builtin.bool.true$;\n        }\n\n        for (iter = this.tp$iter(), otheriter = other.tp$iter(),\n             k = iter.tp$iternext(), otherk = otheriter.tp$iternext();\n             k !== undefined;\n             k = iter.tp$iternext(), otherk = otheriter.tp$iternext()) \n        {\n            if (!pgSk.misceval.isTrue(pgSk.misceval.richCompareBool(k, otherk, \"Eq\")))\n            {\n                return pgSk.builtin.bool.true$;\n            }\n            v = this.mp$subscript(k);\n            otherv = other.mp$subscript(otherk);\n\n            if (!pgSk.misceval.isTrue(pgSk.misceval.richCompareBool(v, otherv, \"Eq\"))) {\n                return pgSk.builtin.bool.true$;\n            }\n        }\n\n        return pgSk.builtin.bool.false$;\n    };\n\n    mod.OrderedDict.prototype[\"pop\"] = new pgSk.builtin.func(function (self, key, d) {\n        var s;\n        var idx;\n\n        pgSk.builtin.pyCheckArgs('pop', arguments, 2, 3);\n\n        idx = self.orderedkeys.indexOf(key);\n        if (idx != -1)\n        {\n            self.orderedkeys.splice(idx, 1);\n        }\n\n        return pgSk.misceval.callsim(pgSk.builtin.dict.prototype[\"pop\"], self, key, d);\n    });\n\n    mod.OrderedDict.prototype[\"popitem\"] = new pgSk.builtin.func(function (self, last) {\n        var key, val;\n        var s;\n\n        pgSk.builtin.pyCheckArgs('popitem', arguments, 1, 2);\n\n        // Empty dictionary\n        if (self.orderedkeys.length == 0)\n        {\n            s = new pgSk.builtin.str('dictionary is empty');\n            throw new pgSk.builtin.KeyError(s.v);\n        }\n\n        key = self.orderedkeys[0];\n        if (last === undefined || pgSk.misceval.isTrue(last))\n        {\n            key = self.orderedkeys[self.orderedkeys.length - 1];\n        }\n\n        val = pgSk.misceval.callsim(self[\"pop\"], self, key);\n        return pgSk.builtin.tuple([key, val]);\n    });\n\n    // deque\n    mod.deque = function deque(iterable, maxlen) {\n        throw new pgSk.builtin.NotImplementedError(\"deque is not implemented\")\n    };\n\n    // namedtuple\n    mod.namedtuples = {};\n    var keywds = pgSk.importModule(\"keyword\", false, false);\n    // should cover most things.  Does not:\n    // * keyword args\n    // _make\n    // _replace\n    // _asdict\n    // _fields\n\n\n    var hasDupes = function(a) {\n        var counts = [];\n        for(var i = 0; i <= a.length; i++) {\n            if(counts[a[i]] === undefined) {\n                counts[a[i]] = 1;\n            } else {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    var pgSkinherits = function(childCtor, parentCtor) {\n      /** @constructor */\n      function tempCtor() {};\n      tempCtor.prototype = parentCtor.prototype;\n      childCtor.superClass_ = parentCtor.prototype;\n      childCtor.prototype = new tempCtor();\n      /** @override */\n      childCtor.prototype.constructor = childCtor;\n    };\n\n    mod.namedtuple = function (name, fields) {\n        if (pgSk.ffi.remapToJs(pgSk.misceval.callsim(keywds.$d['iskeyword'],name ))) {\n            throw new pgSk.builtin.ValueError(\"Type names and field names cannot be a keyword: \" + name.v);\n        }\n        var nm = pgSk.ffi.remapToJs(name);\n        startsw = new RegExp(/^[0-9].*/);\n        startsw2 = new RegExp(/^[0-9_].*/);\n        alnum = new RegExp(/^\\w*$/);\n        if (startsw.test(nm) || (! alnum.test(nm))) {\n            throw new pgSk.builtin.ValueError(\" Bad type name \" + nm);\n        }\n        // fields could be a string or a tuple or list of strings\n        var flds = pgSk.ffi.remapToJs(fields);\n\n        if (typeof(flds) === 'string') {\n            flds = flds.split(/\\s+/);\n        }\n        // import the keyword module here and use iskeyword\n        for (i = 0; i < flds.length; i++) {\n            if (pgSk.ffi.remapToJs(pgSk.misceval.callsim(keywds.$d['iskeyword'],pgSk.ffi.remapToPy(flds[i]))) ||\n                  startsw2.test(flds[i]) || (! alnum.test(flds[i]))\n            ) {\n                throw new pgSk.builtin.ValueError(\"Type names and field names cannot be a keyword: \" + flds[i]);\n            }\n        }\n        if (hasDupes(flds)) {\n            throw new pgSk.builtin.ValueError(\"Field names must be unique.\");\n        }\n\n        var cons = function nametuple_constructor() {\n            var o;\n            if (arguments.length !== flds.length ) {\n                throw new pgSk.builtin.TypeError(\"Number of arguments must match\");\n            }\n            if (!(this instanceof mod.namedtuples[nm])) {\n                o = Object.create(mod.namedtuples[nm].prototype);\n                o.constructor.apply(o, arguments);\n                return o;\n            }\n            this.__class__ = mod.namedtuples[nm];\n            this.v = Array.prototype.slice.call(arguments);\n        };\n        mod.namedtuples[nm] = cons;\n\n        pgSkinherits(cons, pgSk.builtin.tuple);\n        cons.prototype.tp$name = nm;\n        cons.prototype.ob$type = pgSk.builtin.type.makeIntoTypeObj(nm, mod.namedtuples[nm]);\n        cons.prototype[\"$r\"] = function () {\n            var ret;\n            var i;\n            var bits;\n            if (this.v.length === 0) {\n                return new pgSk.builtin.str(nm + \"()\");\n            }\n            bits = [];\n            for (i = 0; i < this.v.length; ++i) {\n                bits[i] = flds[i] + \"=\" + pgSk.misceval.objectRepr(this.v[i]).v;\n            }\n            ret = bits.join(\", \");\n            if (this.v.length === 1) {\n                ret += \",\";\n            }\n            return new pgSk.builtin.str(nm + \"(\" + ret + \")\");\n        };\n\n        cons.prototype.tp$getattr = function (name) {\n            var i = flds.indexOf(name);\n            if (i >= 0) {\n                return this.v[i];\n            }\n            return undefined;\n        };\n\n        cons.prototype.tp$setattr = function (name, value) {\n            throw new pgSk.builtin.AttributeError(\"can't set attribute\");\n        };\n\n        return cons;\n    };\n\n    return mod;\n};\n", "src/lib/lib-tk/__init__.py": "raise NotImplementedError(\"lib-tk is not yet implemented in pgSkulpt\")\n", "src/lib/json/__init__.py": "raise NotImplementedError(\"json is not yet implemented in pgSkulpt\")\n", "src/lib/difflib.py": "raise NotImplementedError(\"difflib is not yet implemented in pgSkulpt\")\n", "src/lib/dis.py": "raise NotImplementedError(\"dis is not yet implemented in pgSkulpt\")\n", "src/lib/sched.py": "raise NotImplementedError(\"sched is not yet implemented in pgSkulpt\")\n", "src/lib/rfc822.py": "raise NotImplementedError(\"rfc822 is not yet implemented in pgSkulpt\")\n", "src/lib/distutils/command/__init__.py": "raise NotImplementedError(\"command is not yet implemented in pgSkulpt\")\n", "src/lib/stat.py": "raise NotImplementedError(\"stat is not yet implemented in pgSkulpt\")\n", "src/lib/StringIO.py": "r\"\"\"File-like objects that read from or write to a string buffer.\n\nThis implements (nearly) all stdio methods.\n\nf = StringIO()      # ready for writing\nf = StringIO(buf)   # ready for reading\nf.close()           # explicitly release resources held\nflag = f.isatty()   # always false\npos = f.tell()      # get current position\nf.seek(pos)         # set current position\nf.seek(pos, mode)   # mode 0: absolute; 1: relative; 2: relative to EOF\nbuf = f.read()      # read until EOF\nbuf = f.read(n)     # read up to n bytes\nbuf = f.readline()  # read until end of line ('\\n') or EOF\nlist = f.readlines()# list of f.readline() results until EOF\nf.truncate([size])  # truncate file at to at most size (default: current pos)\nf.write(buf)        # write at current position\nf.writelines(list)  # for line in list: f.write(line)\nf.getvalue()        # return whole file's contents as a string\n\nNotes:\n- Using a real file is often faster (but less convenient).\n- There's also a much faster implementation in C, called cStringIO, but\n  it's not subclassable.\n- fileno() is left unimplemented so that code which uses it triggers\n  an exception early.\n- Seeking far beyond EOF and then writing will insert real null\n  bytes that occupy space in the buffer.\n- There's a simple test set (see end of this file).\n\"\"\"\n\n__all__ = [\"StringIO\"]\n\ndef _complain_ifclosed(closed):\n    if closed:\n        raise ValueError, \"I/O operation on closed file\"\n\nclass StringIO:\n    \"\"\"class StringIO([buffer])\n\n    When a StringIO object is created, it can be initialized to an existing\n    string by passing the string to the constructor. If no string is given,\n    the StringIO will start empty.\n\n    The StringIO object can accept either Unicode or 8-bit strings, but\n    mixing the two may take some care. If both are used, 8-bit strings that\n    cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause\n    a UnicodeError to be raised when getvalue() is called.\n    \"\"\"\n    def __init__(self, buf = ''):\n        # Force self.buf to be a string or unicode\n        if not isinstance(buf, str):\n            buf = str(buf)\n        self.buf = buf\n        self.len = len(buf)\n        self.buflist = []\n        self.pos = 0\n        self.closed = False\n        self.softspace = 0\n\n    def __iter__(self):\n        return self\n\n    def next(self):\n        \"\"\"A file object is its own iterator, for example iter(f) returns f\n        (unless f is closed). When a file is used as an iterator, typically\n        in a for loop (for example, for line in f: print line), the next()\n        method is called repeatedly. This method returns the next input line,\n        or raises StopIteration when EOF is hit.\n        \"\"\"\n        _complain_ifclosed(self.closed)\n        r = self.readline()\n        if not r:\n            raise StopIteration\n        return r\n\n    def close(self):\n        \"\"\"Free the memory buffer.\n        \"\"\"\n        if not self.closed:\n            self.closed = True\n            self.buf = None\n            self.pos = None\n\n    def isatty(self):\n        \"\"\"Returns False because StringIO objects are not connected to a\n        tty-like device.\n        \"\"\"\n        _complain_ifclosed(self.closed)\n        return False\n\n    def seek(self, pos, mode = 0):\n        \"\"\"Set the file's current position.\n\n        The mode argument is optional and defaults to 0 (absolute file\n        positioning); other values are 1 (seek relative to the current\n        position) and 2 (seek relative to the file's end).\n\n        There is no return value.\n        \"\"\"\n        _complain_ifclosed(self.closed)\n        if self.buflist:\n            self.buf += ''.join(self.buflist)\n            self.buflist = []\n        if mode == 1:\n            pos += self.pos\n        elif mode == 2:\n            pos += self.len\n        self.pos = max(0, pos)\n\n    def tell(self):\n        \"\"\"Return the file's current position.\"\"\"\n        _complain_ifclosed(self.closed)\n        return self.pos\n\n    def read(self, n = -1):\n        \"\"\"Read at most size bytes from the file\n        (less if the read hits EOF before obtaining size bytes).\n\n        If the size argument is negative or omitted, read all data until EOF\n        is reached. The bytes are returned as a string object. An empty\n        string is returned when EOF is encountered immediately.\n        \"\"\"\n        _complain_ifclosed(self.closed)\n        if self.buflist:\n            self.buf += ''.join(self.buflist)\n            self.buflist = []\n        if n is None or n < 0:\n            newpos = self.len\n        else:\n            newpos = min(self.pos+n, self.len)\n        r = self.buf[self.pos:newpos]\n        self.pos = newpos\n        return r\n\n    def readline(self, length=None):\n        r\"\"\"Read one entire line from the file.\n\n        A trailing newline character is kept in the string (but may be absent\n        when a file ends with an incomplete line). If the size argument is\n        present and non-negative, it is a maximum byte count (including the\n        trailing newline) and an incomplete line may be returned.\n\n        An empty string is returned only when EOF is encountered immediately.\n\n        Note: Unlike stdio's fgets(), the returned string contains null\n        characters ('\\0') if they occurred in the input.\n        \"\"\"\n        _complain_ifclosed(self.closed)\n        if self.buflist:\n            self.buf += ''.join(self.buflist)\n            self.buflist = []\n        i = self.buf.find('\\n', self.pos)\n        if i < 0:\n            newpos = self.len\n        else:\n            newpos = i+1\n        if length is not None and length >= 0:\n            if self.pos + length < newpos:\n                newpos = self.pos + length\n        r = self.buf[self.pos:newpos]\n        self.pos = newpos\n        return r\n\n    def readlines(self, sizehint = 0):\n        \"\"\"Read until EOF using readline() and return a list containing the\n        lines thus read.\n\n        If the optional sizehint argument is present, instead of reading up\n        to EOF, whole lines totalling approximately sizehint bytes (or more\n        to accommodate a final whole line).\n        \"\"\"\n        total = 0\n        lines = []\n        line = self.readline()\n        while line:\n            lines.append(line)\n            total += len(line)\n            if 0 < sizehint <= total:\n                break\n            line = self.readline()\n        return lines\n\n    def truncate(self, size=None):\n        \"\"\"Truncate the file's size.\n\n        If the optional size argument is present, the file is truncated to\n        (at most) that size. The size defaults to the current position.\n        The current file position is not changed unless the position\n        is beyond the new file size.\n\n        If the specified size exceeds the file's current size, the\n        file remains unchanged.\n        \"\"\"\n        _complain_ifclosed(self.closed)\n        if size is None:\n            size = self.pos\n        elif size < 0:\n            raise IOError(22, \"Negative size not allowed\")\n        elif size < self.pos:\n            self.pos = size\n        self.buf = self.getvalue()[:size]\n        self.len = size\n\n    def write(self, s):\n        \"\"\"Write a string to the file.\n\n        There is no return value.\n        \"\"\"\n        _complain_ifclosed(self.closed)\n        if not s: return\n        # Force s to be a string or unicode\n        if not isinstance(s, str):\n            s = str(s)\n        spos = self.pos\n        slen = self.len\n        if spos == slen:\n            self.buflist.append(s)\n            self.len = self.pos = spos + len(s)\n            return\n        if spos > slen:\n            self.buflist.append('\\0'*(spos - slen))\n            slen = spos\n        newpos = spos + len(s)\n        if spos < slen:\n            if self.buflist:\n                self.buf += ''.join(self.buflist)\n            self.buflist = [self.buf[:spos], s, self.buf[newpos:]]\n            self.buf = ''\n            if newpos > slen:\n                slen = newpos\n        else:\n            self.buflist.append(s)\n            slen = newpos\n        self.len = slen\n        self.pos = newpos\n\n    def writelines(self, iterable):\n        \"\"\"Write a sequence of strings to the file. The sequence can be any\n        iterable object producing strings, typically a list of strings. There\n        is no return value.\n\n        (The name is intended to match readlines(); writelines() does not add\n        line separators.)\n        \"\"\"\n        write = self.write\n        for line in iterable:\n            write(line)\n\n    def flush(self):\n        \"\"\"Flush the internal buffer\n        \"\"\"\n        _complain_ifclosed(self.closed)\n\n    def getvalue(self):\n        \"\"\"\n        Retrieve the entire contents of the \"file\" at any time before\n        the StringIO object's close() method is called.\n\n        The StringIO object can accept either Unicode or 8-bit strings,\n        but mixing the two may take some care. If both are used, 8-bit\n        strings that cannot be interpreted as 7-bit ASCII (that use the\n        8th bit) will cause a UnicodeError to be raised when getvalue()\n        is called.\n        \"\"\"\n        _complain_ifclosed(self.closed)\n        if self.buflist:\n            self.buf += ''.join(self.buflist)\n            self.buflist = []\n        return self.buf\n", "src/lib/sqlite3/__init__.py": "raise NotImplementedError(\"sqlite3 is not yet implemented in pgSkulpt\")\n", "src/lib/xdrlib.py": "raise NotImplementedError(\"xdrlib is not yet implemented in pgSkulpt\")\n", "src/lib/uu.py": "raise NotImplementedError(\"uu is not yet implemented in pgSkulpt\")\n", "src/lib/imaplib.py": "raise NotImplementedError(\"imaplib is not yet implemented in pgSkulpt\")\n", "src/lib/smtplib.py": "raise NotImplementedError(\"smtplib is not yet implemented in pgSkulpt\")\n", "src/lib/string.py": "raise NotImplementedError(\"string is not yet implemented in pgSkulpt\")\n", "src/lib/distutils/tests/__init__.py": "raise NotImplementedError(\"tests is not yet implemented in pgSkulpt\")\n", "src/lib/telnetlib.py": "raise NotImplementedError(\"telnetlib is not yet implemented in pgSkulpt\")\n", "src/lib/curses/__init__.py": "raise NotImplementedError(\"curses is not yet implemented in pgSkulpt\")\n", "src/lib/bisect.py": "raise NotImplementedError(\"bisect is not yet implemented in pgSkulpt\")\n", "src/lib/_strptime.py": "raise NotImplementedError(\"_strptime is not yet implemented in pgSkulpt\")\n", "src/lib/pythonds/trees/__init__.py": "\n# from .binaryTree import BinaryTree\n# from .balance import AVLTree\n# from .bst import BinarySearchTree\n# from .binheap import BinHeap\n\n\n", "src/lib/pythonds/trees/binaryTree.py": "# Bradley N. Miller, David L. Ranum\n# Introduction to Data Structures and Algorithms in Python\n# Copyright 2005\n# \n\nclass BinaryTree:\n    \"\"\"\n    A recursive implementation of Binary Tree\n    Using links and Nodes approach.\n    \"\"\"    \n    def __init__(self,rootObj):\n        self.key = rootObj\n        self.leftChild = None\n        self.rightChild = None\n\n    def insertLeft(self,newNode):\n        if self.leftChild == None:\n            self.leftChild = BinaryTree(newNode)\n        else:\n            t = BinaryTree(newNode)\n            t.left = self.leftChild\n            self.leftChild = t\n    \n    def insertRight(self,newNode):\n        if self.rightChild == None:\n            self.rightChild = BinaryTree(newNode)\n        else:\n            t = BinaryTree(newNode)\n            t.right = self.rightChild\n            self.rightChild = t\n\n    def isLeaf(self):\n        return ((not self.leftChild) and (not self.rightChild))\n\n    def getRightChild(self):\n        return self.rightChild\n\n    def getLeftChild(self):\n        return self.leftChild\n\n    def setRootVal(self,obj):\n        self.key = obj\n\n    def getRootVal(self,):\n        return self.key\n\n    def inorder(self):\n        if self.leftChild:\n            self.leftChild.inorder()\n        print(self.key)\n        if self.rightChild:\n            self.rightChild.inorder()\n\n    def postorder(self):\n        if self.leftChild:\n            self.leftChild.postorder()\n        if self.rightChild:\n            self.rightChild.postorder()\n        print(self.key)\n\n\n    def preorder(self):\n        print(self.key)\n        if self.leftChild:\n            self.leftChild.preorder()\n        if self.rightChild:\n            self.rightChild.preorder()\n\n    def printexp(self):\n        if self.leftChild:\n            print('(')\n            self.leftChild.printexp()\n        print(self.key)\n        if self.rightChild:\n            self.rightChild.printexp()\n            print(')')\n\n    def postordereval(self):\n        opers = {'+':operator.add, '-':operator.sub, '*':operator.mul, '/':operator.truediv}\n        res1 = None\n        res2 = None\n        if self.leftChild:\n            res1 = self.leftChild.postordereval()  #// \\label{peleft}\n        if self.rightChild:\n            res2 = self.rightChild.postordereval() #// \\label{peright}\n        if res1 and res2:\n            return opers[self.key](res1,res2) #// \\label{peeval}\n        else:\n            return self.key\n\ndef inorder(tree):\n    if tree != None:\n        inorder(tree.getLeftChild())\n        print(tree.getRootVal())\n        inorder(tree.getRightChild())\n\ndef printexp(tree):\n    if tree.leftChild:\n        print('(')\n        printexp(tree.getLeftChild())\n    print(tree.getRootVal())\n    if tree.rightChild:\n        printexp(tree.getRightChild())\n        print(')') \n\ndef printexp(tree):\n    sVal = \"\"\n    if tree:\n        sVal = '(' + printexp(tree.getLeftChild())\n        sVal = sVal + str(tree.getRootVal())\n        sVal = sVal + printexp(tree.getRightChild()) + ')'\n    return sVal\n\ndef postordereval(tree):\n    opers = {'+':operator.add, '-':operator.sub, '*':operator.mul, '/':operator.truediv}\n    res1 = None\n    res2 = None\n    if tree:\n        res1 = postordereval(tree.getLeftChild())  #// \\label{peleft}\n        res2 = postordereval(tree.getRightChild()) #// \\label{peright}\n        if res1 and res2:\n            return opers[tree.getRootVal()](res1,res2) #// \\label{peeval}\n        else:\n            return tree.getRootVal()\n\ndef height(tree):\n    if tree == None:\n        return -1\n    else:\n        return 1 + max(height(tree.leftChild),height(tree.rightChild))\n\n# t = BinaryTree(7)\n# t.insertLeft(3)\n# t.insertRight(9)\n# inorder(t)\n# import operator\n# x = BinaryTree('*')\n# x.insertLeft('+')\n# l = x.getLeftChild()\n# l.insertLeft(4)\n# l.insertRight(5)\n# x.insertRight(7)\n# print(printexp(x))\n# print(postordereval(x))\n# print(height(x))\n", "src/lib/webgl/primitives.js": "// most of this file is from 'tdl'\n\nvar $builtinmodule = function(name)\n{\n    var mod = {};\n\n\n\n    /**\n     * AttribBuffer manages a TypedArray as an array of vectors.\n     *\n     * @param {number} numComponents Number of components per\n     *     vector.\n     * @param {number|!Array.<number>} numElements Number of vectors or the data.\n     * @param {string} opt_type The type of the TypedArray to\n     *     create. Default = 'Float32Array'.\n     * @param {!Array.<number>} opt_data The data for the array.\n     */\n    var AttribBuffer = function(\n            numComponents, numElements, opt_type) {\n        opt_type = opt_type || 'Float32Array';\n        var type = window[opt_type];\n        if (numElements.length) {\n            this.buffer = new type(numElements);\n            numElements = this.buffer.length / numComponents;\n            this.cursor = numElements;\n        } else {\n            this.buffer = new type(numComponents * numElements);\n            this.cursor = 0;\n        }\n        this.numComponents = numComponents;\n        this.numElements = numElements;\n        this.type = opt_type;\n    };\n\n    AttribBuffer.prototype.stride = function() {\n        return 0;\n    };\n\n    AttribBuffer.prototype.offset = function() {\n        return 0;\n    };\n\n    AttribBuffer.prototype.getElement = function(index) {\n        var offset = index * this.numComponents;\n        var value = [];\n        for (var ii = 0; ii < this.numComponents; ++ii) {\n            value.push(this.buffer[offset + ii]);\n        }\n        return value;\n    };\n\n    AttribBuffer.prototype.setElement = function(index, value) {\n        var offset = index * this.numComponents;\n        for (var ii = 0; ii < this.numComponents; ++ii) {\n            this.buffer[offset + ii] = value[ii];\n        }\n    };\n\n    AttribBuffer.prototype.clone = function() {\n        var copy = new AttribBuffer(\n                this.numComponents, this.numElements, this.type);\n        copy.pushArray(this);\n        return copy;\n    }\n\n    AttribBuffer.prototype.push = function(value) {\n        this.setElement(this.cursor++, value);\n    };\n\n    AttribBuffer.prototype.pushArray = function(array) {\n        //  this.buffer.set(array, this.cursor * this.numComponents);\n        //  this.cursor += array.numElements;\n        for (var ii = 0; ii < array.numElements; ++ii) {\n            this.push(array.getElement(ii));\n        }\n    };\n\n    AttribBuffer.prototype.pushArrayWithOffset =\n    function(array, offset) {\n        for (var ii = 0; ii < array.numElements; ++ii) {\n            var elem = array.getElement(ii);\n            for (var jj = 0; jj < offset.length; ++jj) {\n                elem[jj] += offset[jj];\n            }\n            this.push(elem);\n        }\n    };\n\n    /**\n    * Computes the extents\n    * @param {!AttribBuffer} positions The positions\n    * @return {!{min: !tdl.math.Vector3, max:!tdl.math.Vector3}}\n    *     The min and max extents.\n    */\n    AttribBuffer.prototype.computeExtents = function() {\n        var numElements = this.numElements;\n        var numComponents = this.numComponents;\n        var minExtent = this.getElement(0);\n        var maxExtent = this.getElement(0);\n        for (var ii = 1; ii < numElements; ++ii) {\n            var element = this.getElement(ii);\n            for (var jj = 0; jj < numComponents; ++jj) {\n                minExtent[jj] = Math.min(minExtent[jj], element[jj]);\n                maxExtent[jj] = Math.max(maxExtent[jj], element[jj]);\n            }\n        }\n        return {min: minExtent, max: maxExtent};\n    };\n\n\n    /**\n     * Creates the vertices and indices for a cube. The\n     * cube will be created around the origin. (-size / 2, size / 2)\n     *\n     * @param {number} size Width, height and depth of the cube.\n     * @return {!Object.<string, !tdl.primitives.AttribBuffer>} The\n     *         created plane vertices.\n     */\n    mod.createCube = new pgSk.builtin.func(function(size)\n            {\n                var CUBE_FACE_INDICES_ = [\n                    [3, 7, 5, 1],\n                    [0, 4, 6, 2],\n                    [6, 7, 3, 2],\n                    [0, 1, 5, 4],\n                    [5, 7, 6, 4],\n                    [2, 3, 1, 0]\n                ];\n\n                var k = size / 2;\n\n                var cornerVertices = [\n                        [-k, -k, -k],\n                        [+k, -k, -k],\n                        [-k, +k, -k],\n                        [+k, +k, -k],\n                        [-k, -k, +k],\n                        [+k, -k, +k],\n                        [-k, +k, +k],\n                        [+k, +k, +k]\n                    ];\n\n                var faceNormals = [\n                        [+1, +0, +0],\n                        [-1, +0, +0],\n                        [+0, +1, +0],\n                        [+0, -1, +0],\n                        [+0, +0, +1],\n                        [+0, +0, -1]\n                    ];\n\n                var uvCoords = [\n                        [0, 0],\n                        [1, 0],\n                        [1, 1],\n                        [0, 1]\n                    ];\n\n                var numVertices = 6 * 4;\n                var positions = new AttribBuffer(3, numVertices);\n                var normals = new AttribBuffer(3, numVertices);\n                var texCoords = new AttribBuffer(2, numVertices);\n                var indices = new AttribBuffer(3, 6 * 2, 'Uint16Array');\n\n                for (var f = 0; f < 6; ++f) {\n                    var faceIndices = CUBE_FACE_INDICES_[f];\n                    for (var v = 0; v < 4; ++v) {\n                        var position = cornerVertices[faceIndices[v]];\n                        var normal = faceNormals[f];\n                        var uv = uvCoords[v];\n\n                        // Each face needs all four vertices because the normals and texture\n                        // coordinates are not all the same.\n                        positions.push(position);\n                        normals.push(normal);\n                        texCoords.push(uv);\n\n                    }\n                    // Two triangles make a square face.\n                    var offset = 4 * f;\n                    indices.push([offset + 0, offset + 1, offset + 2]);\n                    indices.push([offset + 0, offset + 2, offset + 3]);\n                }\n\n                return {\n                        position: positions,\n                        normal: normals,\n                        texCoord: texCoords,\n                        indices: indices\n                };\n            });\n\n    return mod;\n};\n", "src/lib/weakref.py": "raise NotImplementedError(\"weakref is not yet implemented in pgSkulpt\")\n", "src/lib/user.py": "raise NotImplementedError(\"user is not yet implemented in pgSkulpt\")\n", "src/lib/pickletools.py": "raise NotImplementedError(\"pickletools is not yet implemented in pgSkulpt\")\n", "src/lib/mhlib.py": "raise NotImplementedError(\"mhlib is not yet implemented in pgSkulpt\")\n", "src/lib/re.js": "var $builtinmodule = function (name) {\n    var mod = {};\n\n    var validGroups, convert, getFlags, _split, _findall, matchobj, _search, _match, regexobj;\n\n    // Constants (mostly unsupported)\n    mod.I = 2;\n    mod.IGNORECASE = 2;\n    // mod.L = 4;\n    // mod.LOCALE = 4;\n    mod.M = 8;\n    mod.MULTILINE = 8;\n    // mod.S = 16;\n    // mod.DOTALL = 16;\n    // mod.U = 32;\n    // mod.UNICODE = 32;\n    // mod.X = 64;\n    // mod.VERBOSE = 64;\n\n    validGroups = [\"(?:\", \"(?=\", \"(?!\"];\n\n    convert = function (pattern) {\n        var newpattern;\n        var match;\n        var i;\n\n        // Look for disallowed constructs\n        match = pattern.match(/\\(\\?./g);\n        if (match) {\n            for (i = 0; i < match.length; i++) {\n                if (validGroups.indexOf(match[i]) == -1) {\n                    throw new pgSk.builtin.ValueError(\"Disallowed group in pattern: '\"\n                        + match[i] + \"'\");\n                }\n            }\n        }\n\n        newpattern = pattern.replace(\"/\\\\/g\", \"\\\\\\\\\");\n        newpattern = pattern.replace(/([^\\\\]){,(?![^\\[]*\\])/g, \"$1{0,\");\n\n        return newpattern;\n    };\n\n    getFlags = function (flags) {\n        var jsflags = \"g\";\n        if ((flags & mod.IGNORECASE) == mod.IGNORECASE) {\n            jsflags += \"i\";\n        }\n        if ((flags & mod.MULTILINE) == mod.MULTILINE) {\n            jsflags += \"m\";\n        }\n        return jsflags;\n    };\n\n    _split = function (pattern, string, maxsplit, flags) {\n        var pat, str, captured, jsflags, regex;\n        var result, match, index, splits;\n\n        pgSk.builtin.pyCheckArgs(\"split\", arguments, 2, 4);\n        if (!pgSk.builtin.checkString(pattern)) {\n            throw new pgSk.builtin.TypeError(\"pattern must be a string\");\n        }\n        if (!pgSk.builtin.checkString(string)) {\n            throw new pgSk.builtin.TypeError(\"string must be a string\");\n        }\n        if (maxsplit === undefined) {\n            maxsplit = 0;\n        }\n        if (!pgSk.builtin.checkNumber(maxsplit)) {\n            throw new pgSk.builtin.TypeError(\"maxsplit must be a number\");\n        }\n        if (flags === undefined) {\n            flags = 0;\n        }\n        if (!pgSk.builtin.checkNumber(flags)) {\n            throw new pgSk.builtin.TypeError(\"flags must be a number\");\n        }\n\n        maxsplit = pgSk.builtin.asnum$(maxsplit);\n        pat = pgSk.ffi.unwrapo(pattern);\n        str = pgSk.ffi.unwrapo(string);\n\n        // Convert pat from Python to Javascript regex syntax\n        pat = convert(pat);\n        //print(\"Pat: \" + pat);\n        //print(\"Str: \" + str);\n\n        captured = !(pat.match(/^\\(.*\\)$/) === null);\n        //print(\"Captured: \", captured);\n\n        jsflags = getFlags(flags);\n        //print(\"Flags: \", jsflags);\n\n        regex = new RegExp(pat, jsflags);\n\n        result = [];\n        match;\n        index = 0;\n        splits = 0;\n        while ((match = regex.exec(str)) != null) {\n            //print(\"Matched '\" + match[0] + \"' at position \" + match.index +\n            //      \"; next search at \" + regex.lastIndex);\n            if (match.index === regex.lastIndex) {\n                // empty match\n                break;\n            }\n            result.push(new pgSk.builtin.str(str.substring(index, match.index)));\n            if (captured) {\n                // Add matching pattern, too\n                result.push(new pgSk.builtin.str(match[0]));\n            }\n            index = regex.lastIndex;\n            splits += 1;\n            if (maxsplit && (splits >= maxsplit)) {\n                break;\n            }\n        }\n        result.push(new pgSk.builtin.str(str.substring(index)));\n\n        return new pgSk.builtin.list(result);\n    };\n\n    _split.co_varnames = [\"pattern\", \"string\", \"maxsplit\", \"flags\"];\n    _split.co_numargs = 4;\n    _split.$defaults = [ new pgSk.builtin.int_(0), new pgSk.builtin.int_(0) ];\n\n    mod.split = new pgSk.builtin.func(_split);\n\n    _findall = function (pattern, string, flags) {\n        var pat, str, jsflags, regex, result, match;\n\n        pgSk.builtin.pyCheckArgs(\"findall\", arguments, 2, 3);\n        if (!pgSk.builtin.checkString(pattern)) {\n            throw new pgSk.builtin.TypeError(\"pattern must be a string\");\n        }\n        if (!pgSk.builtin.checkString(string)) {\n            throw new pgSk.builtin.TypeError(\"string must be a string\");\n        }\n        if (flags === undefined) {\n            flags = 0;\n        }\n        if (!pgSk.builtin.checkNumber(flags)) {\n            throw new pgSk.builtin.TypeError(\"flags must be a number\");\n        }\n\n        pat = pgSk.ffi.unwrapo(pattern);\n        str = pgSk.ffi.unwrapo(string);\n\n        // Convert pat from Python to Javascript regex syntax\n        pat = convert(pat);\n        //print(\"Pat: \" + pat);\n        //print(\"Str: \" + str);\n\n        jsflags = getFlags(flags);\n        //print(\"Flags: \", jsflags);\n\n        regex = new RegExp(pat, jsflags);\n\n        if (pat.match(/\\$/)) {\n            var newline_at_end = new RegExp(/\\n$/);\n            if (str.match(newline_at_end)) {\n                str = str.slice(0, -1);\n            }\n        }\n\n        result = [];\n        match;\n        while ((match = regex.exec(str)) != null) {\n            //print(\"Matched '\" + match[0] + \"' at position \" + match.index +\n            //      \"; next search at \" + regex.lastIndex);\n            // print(\"match: \" + JSON.stringify(match));\n            if (match.length < 2) {\n                result.push(new pgSk.builtin.str(match[0]));\n            } else if (match.length == 2) {\n                result.push(new pgSk.builtin.str(match[1]));\n            } else {\n                var groups = [];\n                for (var i = 1; i < match.length; i++) {\n                    groups.push(new pgSk.builtin.str(match[i]));\n                }\n                result.push(new pgSk.builtin.tuple(groups));\n            }\n            if (match.index === regex.lastIndex) {\n                regex.lastIndex += 1;\n            }\n        }\n\n        return new pgSk.builtin.list(result);\n    };\n\n    _findall.co_varnames = [\"pattern\", \"string\", \"flags\"];\n    _findall.co_numargs = 3;\n    _findall.$defaults = [ new pgSk.builtin.int_(0) ];\n\n    mod.findall = new pgSk.builtin.func(_findall);\n\n\n    matchobj = function ($gbl, $loc) {\n        $loc.__init__ = new pgSk.builtin.func(function (self, thematch, pattern, string) {\n            self.thematch = thematch;\n            self.re = pattern;\n            self.string = string;\n        });\n\n        $loc.groups = new pgSk.builtin.func(function (self) {\n            var _groups = self.thematch.v.slice(1);\n\n            return new pgSk.builtin.tuple(_groups)\n        });\n\n        $loc.group = new pgSk.builtin.func(function (self, grpnum) {\n            if (grpnum === undefined) {\n                grpnum = 0;\n            }\n            else {\n                grpnum = pgSk.builtin.asnum$(grpnum);\n            }\n            if (grpnum >= self.thematch.v.length) {\n                throw new pgSk.builtin.IndexError(\"Index out of range: \" + grpnum);\n            }\n            return self.thematch.v[grpnum];\n        });\n\n    };\n\n    mod.MatchObject = pgSk.misceval.buildClass(mod, matchobj, \"MatchObject\", []);\n\n    // Internal function to return a Python list of strings\n    // From a JS regular expression string\n    mod._findre = function (res, string) {\n        res = res.replace(/([^\\\\]){,(?![^\\[]*\\])/g, \"$1{0,\");\n\n        var matches, sitem, retval;\n        var re = eval(res);\n        var patt = new RegExp(\"\\n$\");\n        var str = pgSk.ffi.remapToJs(string);\n\n        if (str.match(patt)) {\n            matches = str.slice(0, -1).match(re);\n        }\n        else {\n            matches = str.match(re);\n        }\n        retval = new pgSk.builtin.list();\n        if (matches == null) {\n            return retval;\n        }\n        for (var i = 0; i < matches.length; ++i) {\n            sitem = new pgSk.builtin.str(matches[i]);\n            retval.v.push(sitem);\n        }\n        return retval;\n    };\n\n\n    // Internal search, shared between search function and RegexObject.search method\n    _search = function (pattern, string, flags) {\n        var mob, res;\n\n        pgSk.builtin.pyCheckArgs(\"search\", arguments, 2, 3);\n        if (!pgSk.builtin.checkString(pattern)) {\n            throw new pgSk.builtin.TypeError(\"pattern must be a string\");\n        }\n        if (!pgSk.builtin.checkString(string)) {\n            throw new pgSk.builtin.TypeError(\"string must be a string\");\n        }\n        if (flags === undefined) {\n            flags = 0;\n        }\n        if (!pgSk.builtin.checkNumber(flags)) {\n            throw new pgSk.builtin.TypeError(\"flags must be a number\");\n        }\n        res = \"/\" + pattern.v.replace(/\\//g, \"\\\\/\") + \"/\";\n        lst = mod._findre(res, string);\n        if (lst.v.length < 1) {\n            return pgSk.builtin.none.none$;\n        }\n        mob = pgSk.misceval.callsim(mod.MatchObject, lst, pattern, string);\n        return mob;\n    };\n\n    _search.co_varnames = [\"pattern\", \"string\", \"flags\"];\n    _search.co_numargs = 3;\n    _search.$defaults = [ new pgSk.builtin.int_(0) ];\n\n    mod.search = new pgSk.builtin.func(_search);\n\n    _match = function (pattern, string, flags) {\n        var mob, res;\n        pgSk.builtin.pyCheckArgs(\"match\", arguments, 2, 3);\n        if (!pgSk.builtin.checkString(pattern)) {\n            throw new pgSk.builtin.TypeError(\"pattern must be a string\");\n        }\n        if (!pgSk.builtin.checkString(string)) {\n            throw new pgSk.builtin.TypeError(\"string must be a string\");\n        }\n        if (flags === undefined) {\n            flags = 0;\n        }\n        if (!pgSk.builtin.checkNumber(flags)) {\n            throw new pgSk.builtin.TypeError(\"flags must be a number\");\n        }\n        pat = pgSk.ffi.remapToJs(pattern);\n        res = \"/^\" + pat.replace(/\\//g, \"\\\\/\") + \"/\";\n        lst = mod._findre(res, string);\n        if (pgSk.ffi.remapToJs(lst).length < 1) {\n            return pgSk.builtin.none.none$;\n        }\n        mob = pgSk.misceval.callsim(mod.MatchObject, lst, pattern, string);\n        return mob;\n    };\n\n    _match.co_varnames = [\"pattern\", \"string\", \"flags\"];\n    _match.co_numargs = 3;\n    _match.$defaults = [ new pgSk.builtin.int_(0) ];\n\n    mod.match = new pgSk.builtin.func(_match);\n\n    regexobj = function ($gbl, $loc) {\n        var _slice, _re_search, _re_match, _re_split, _re_findall, _repr;\n\n        $loc.__init__ = new pgSk.builtin.func(function (self, pattern, flags) {\n            self.re = pattern;\n            if (flags === undefined) {\n                self.flags = 0;\n            }\n            else {\n                self.flags = flags;\n            }\n        });\n\n        _repr = new pgSk.builtin.func( function (self) {\n            var ret = \"re.compile('\" + pgSk.ffi.remapToPy(self.re) + \"')\";\n            return pgSk.ffi.remapToPy(ret.substring(0,212));\n        });\n\n        $loc.__str__ = _repr;\n\n        $loc.__repr__ = _repr;\n\n        // Given a string, start, and end position, return sliced string\n        _slice = function(string, pos, endpos) {\n            // Per docs, ^ should match index after newlines.\n            // this matches the first\n            var str = pgSk.ffi.remapToJs(string);\n            var start = pos == undefined ? 0 : pgSk.ffi.remapToJs(pos);\n            var end = endpos == undefined ? str.length : pgSk.ffi.remapToJs(endpos);\n\n            if (start == \"^\") {\n                start = str.indexOf('\\n') + 1;\n            }\n            if (end == pgSk.builtin.none.none$) {\n                end = str.length;\n            }\n            return pgSk.ffi.remapToPy(str.substring(start, end));\n\n        };\n\n        _re_search = function (self, string, pos, endpos) {\n            pgSk.builtin.pyCheckArgs(\"search\", arguments, 2, 4);\n\n            var str = _slice(string, pos, endpos);\n\n            return _search(self.re, str, self.flags);\n        };\n\n        _re_search.co_varnames = [\"self\", \"string\", \"pos\", \"endpos\"];\n        _re_search.co_numargs = 4;\n        _re_search.$defaults = [ new pgSk.builtin.int_(0), pgSk.builtin.none.none$ ];\n\n        $loc.search = new pgSk.builtin.func(_re_search);\n\n        _re_match = function (self, string, pos, endpos) {\n            pgSk.builtin.pyCheckArgs(\"match\", arguments, 2, 4);\n\n            var str = _slice(string, pos, endpos);\n            // var str = string;\n\n            return _match(self.re, str, self.flags);\n        };\n\n        _re_match.co_varnames = [\"self\", \"string\", \"pos\", \"endpos\"];\n        _re_match.co_numargs = 4;\n        _re_match.$defaults = [ new pgSk.builtin.int_(0), pgSk.builtin.none.none$ ];\n\n        $loc.match = new pgSk.builtin.func(_re_match);\n\n        _re_split = function (self, string, maxsplit) {\n            pgSk.builtin.pyCheckArgs(\"split\", arguments, 2, 3);\n\n            if (maxsplit === undefined) {\n                maxsplit = 0;\n            }\n            if (!pgSk.builtin.checkInt(maxsplit)) {\n                throw new pgSk.builtin.TypeError(\"maxsplit must be an integer\");\n            }\n\n            return _split(self.re, string, maxsplit, self.flags);\n        };\n\n        _re_split.co_varnames = [\"self\", \"string\", \"maxsplit\"];\n        _re_split.co_numargs = 3;\n        _re_split.$defaults = [ new pgSk.builtin.int_(0) ];\n\n        $loc.split = new pgSk.builtin.func(_re_split);\n\n        _re_findall = function (self, string, pos, endpos) {\n            pgSk.builtin.pyCheckArgs(\"findall\", arguments, 2, 4);\n\n            var str = _slice(string, pos, endpos);\n\n            return _findall(self.re, str, self.flags);\n        };\n\n        _re_findall.co_varnames = [\"self\", \"string\", \"pos\", \"endpos\"];\n        _re_findall.co_numargs = 4;\n        _re_findall.$defaults = [ new pgSk.builtin.int_(0), pgSk.builtin.none.none$ ];\n\n        $loc.findall = new pgSk.builtin.func(_re_findall);\n\n    };\n\n    mod.RegexObject = pgSk.misceval.buildClass(mod, regexobj, \"RegexObject\", []);\n    mod.compile = new pgSk.builtin.func(function (pattern, flags) {\n        var rob;\n        pgSk.builtin.pyCheckArgs(\"compile\", arguments, 1, 2);\n        if (!pgSk.builtin.checkString(pattern)) {\n            throw new pgSk.builtin.TypeError(\"pattern must be a string\");\n        }\n        if (flags === undefined) {\n            flags = 0;\n        }\n        if (!pgSk.builtin.checkNumber(flags)) {\n            throw new pgSk.builtin.TypeError(\"flags must be a number\");\n        }\n        rob = pgSk.misceval.callsim(mod.RegexObject, pattern, flags);\n        return rob;\n    });\n\n    // No need to purge since we don't cache\n    mod.purge = new pgSk.builtin.func(function () {});\n\n    return mod;\n};", "src/lib/SocketServer.py": "raise NotImplementedError(\"SocketServer is not yet implemented in pgSkulpt\")\n", "src/lib/types.py": "\"\"\"\nThis file was modified from CPython.\nCopyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,\n2011, 2012, 2013, 2014, 2015 Python Software Foundation; All Rights Reserved\n\"\"\"\n\"\"\"Define names for all type symbols known in the standard interpreter.\nTypes that are part of optional modules (e.g. array) are not listed.\n\"\"\"\nimport sys\n\n# Iterators in Python aren't a matter of type but of protocol.  A large\n# and changing number of builtin types implement *some* flavor of\n# iterator.  Don't check the type!  Use hasattr to check for both\n# \"__iter__\" and \"next\" attributes instead.\n\nNoneType = type(None)\nTypeType = type\nObjectType = object\nIntType = int\nLongType = long\nFloatType = float\nBooleanType = bool\ntry:\n    ComplexType = complex\nexcept NameError:\n    pass\nStringType = str\n\n# StringTypes is already outdated.  Instead of writing \"type(x) in\n# types.StringTypes\", you should use \"isinstance(x, basestring)\".  But\n# we keep around for compatibility with Python 2.2.\ntry:\n    UnicodeType = unicode\n    StringTypes = (StringType, UnicodeType)\nexcept NameError:\n    StringTypes = (StringType,)\n\nBufferType = buffer\n\nTupleType = tuple\nListType = list\nDictType = DictionaryType = dict\n\ndef _f(): pass\nFunctionType = type(_f)\nLambdaType = type(lambda: None)         # Same as FunctionType\nCodeType = type(_f.func_code)\n\ndef _g():\n    yield 1\nGeneratorType = type(_g())\n\nclass _C:\n    def _m(self): pass\nClassType = type(_C)\nUnboundMethodType = type(_C._m)         # Same as MethodType\n_x = _C()\nInstanceType = type(_x)\nMethodType = type(_x._m)\nBuiltinFunctionType = type(len)\nBuiltinMethodType = type([].append)     # Same as BuiltinFunctionType\n\nModuleType = type(sys)\nFileType = file\nXRangeType = xrange\n\n# try:\n#     raise TypeError\n# except TypeError:\n#     tb = sys.exc_info()[2]\n#     TracebackType = type(tb)\n#     FrameType = type(tb.tb_frame)\n#     del tb\n\nSliceType = slice\n# EllipsisType = type(Ellipsis)\n\n# DictProxyType = type(TypeType.__dict__)\nNotImplementedType = type(NotImplemented)\n\n# For Jython, the following two types are identical\n# GetSetDescriptorType = type(FunctionType.func_code)\n# MemberDescriptorType = type(FunctionType.func_globals)\n\ndel sys, _f, _g, _C, _x                           # Not for export\n__all__ = list(n for n in globals() if n[:1] != '_')\n", "src/lib/DocXMLRPCServer.py": "raise NotImplementedError(\"DocXMLRPCServer is not yet implemented in pgSkulpt\")\n", "src/lib/heapq.py": "raise NotImplementedError(\"heapq is not yet implemented in pgSkulpt\")\n", "src/lib/encodings/__init__.py": "raise NotImplementedError(\"encodings is not yet implemented in pgSkulpt\")\n", "src/lib/mimify.py": "raise NotImplementedError(\"mimify is not yet implemented in pgSkulpt\")\n", "src/lib/tokenize.py": "raise NotImplementedError(\"tokenize is not yet implemented in pgSkulpt\")\n", "src/lib/pythonds/graphs/__init__.py": "\n\nfrom .adjGraph import Graph\nfrom .adjGraph import Vertex\nfrom .priorityQueue import PriorityQueue\n"}}