€•­Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”Œdocutils.nodes”Œsection”“”)”}”(hhh]”(h Œtitle”“”)”}”(hŒSpecial facilities”h]”h ŒText”“”ŒSpecial facilities”…””}”(hhŒparent”hhhŒsource”NŒline”NubaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”uŒtagname”hhh hhhŒ[/home/jac/active/geatec/transcrypt/Transcrypt/transcrypt/docs/sphinx/special_facilities.rst”hKubh Œtarget”“”)”}”(hŒ.. _module_mechanism:”h]”h}”(h ]”h"]”h$]”h&]”h(]”Œrefid”Œmodule-mechanism”uh*h,hKhh hhhh+ubh )”}”(hhh]”(h)”}”(hŒTranscrypt's module mechanism”h]”hŒTranscrypt’s module mechanism”…””}”(hh?hh=hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhh:hhhh+hKubh Œ paragraph”“”)”}”(hŒ´Transcrypt's module mechanism looks a lot like Python's but there are a few differences. Firstly, in Transcrypt it is good practice to use url-based unique module identifiers, e.g.”h]”hŒ¸Transcrypt’s module mechanism looks a lot like Python’s but there are a few differences. Firstly, in Transcrypt it is good practice to use url-based unique module identifiers, e.g.”…””}”(hhOhhMhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK hh:hhubh Œ bullet_list”“”)”}”(hhh]”(h Œ list_item”“”)”}”(hŒ'*com.github..*”h]”hL)”}”(hhdh]”h Œemphasis”“”)”}”(hhdh]”hŒ%com.github..”…””}”(hhhhkubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihhfubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK hhbubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hh]hhhh+hNubha)”}”(hŒ"*org.python.pypi.*”h]”hL)”}”(hh†h]”hj)”}”(hh†h]”hŒ org.python.pypi.”…””}”(hhhh‹ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihhˆubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK hh„ubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hh]hhhh+hNubha)”}”(hŒ)*com..* ”h]”hL)”}”(hŒ(*com..*”h]”hj)”}”(hhªh]”hŒ&com..”…””}”(hhhh¬ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihh¨ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhh¤ubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hh]hhhh+hNubeh}”(h ]”h"]”h$]”h&]”h(]”Œbullet”Œ-”uh*h[hh+hK hh:hhubhL)”}”(hŒ‚To achieve optimal CPython compatibility, an exception is made for modules that are part of the CPython distribution, e.g. *math*.”h]”(hŒ{To achieve optimal CPython compatibility, an exception is made for modules that are part of the CPython distribution, e.g. ”…””}”(hŒ{To achieve optimal CPython compatibility, an exception is made for modules that are part of the CPython distribution, e.g. ”hhÍhhhNhNubhj)”}”(hŒ*math*”h]”hŒmath”…””}”(hhhhÖubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihhÍubhŒ.”…””}”(hŒ.”hhÍhhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhh:hhubhL)”}”(hX|Note that Transcrypt is meant be to used with JavaScript rather than Python libraries, since its focus isn't on the desktop but on the browser. Nevertheless a growing set of standard Python modules is part of the distribution, currently cmat, datetime, itertools, logging, math, random (partially), re (almost complete), time, turtle and warnings. Other modules are in the making.”h]”hX~Note that Transcrypt is meant be to used with JavaScript rather than Python libraries, since its focus isn’t on the desktop but on the browser. Nevertheless a growing set of standard Python modules is part of the distribution, currently cmat, datetime, itertools, logging, math, random (partially), re (almost complete), time, turtle and warnings. Other modules are in the making.”…””}”(hhñhhïhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhh:hhubhL)”}”(hŒ2Finding the code for a module proceeds as follows:”h]”hŒ2Finding the code for a module proceeds as follows:”…””}”(hhÿhhýhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhh:hhubhL)”}”(hŒhSuppose you import a module *all.the.kings.men*. Then the following paths will be searched respectively:”h]”(hŒSuppose you import a module ”…””}”(hŒSuppose you import a module ”hj hhhNhNubhj)”}”(hŒ*all.the.kings.men*”h]”hŒall.the.kings.men”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj ubhŒ9. Then the following paths will be searched respectively:”…””}”(hŒ9. Then the following paths will be searched respectively:”hj hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhh:hhubh Œ block_quote”“”)”}”(hhh]”(h\)”}”(hhh]”(ha)”}”(hŒ6*/all/the/kings/men.py*”h]”hL)”}”(hj7h]”hj)”}”(hj7h]”hŒ4/all/the/kings/men.py”…””}”(hhhj<ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj9ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhj5ubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hj2ubha)”}”(hŒ6*/all/the/kings/men.js*”h]”hL)”}”(hjWh]”hj)”}”(hjWh]”hŒ4/all/the/kings/men.js”…””}”(hhhj\ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjYubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhjUubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hj2ubha)”}”(hŒ?*/all/the/kings/men/__init__.py*”h]”hL)”}”(hjwh]”hj)”}”(hjwh]”hŒ=/all/the/kings/men/__init__.py”…””}”(hhhj|ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjyubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhjuubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hj2ubha)”}”(hŒ@*/all/the/kings/men/__init__.js* ”h]”hL)”}”(hŒ?*/all/the/kings/men/__init__.js*”h]”hj)”}”(hj›h]”hŒ=/all/the/kings/men/__init__.js”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj™ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhj•ubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hj2ubeh}”(h ]”h"]”h$]”h&]”h(]”hËŒ+”uh*h[hh+hKhj/ubh\)”}”(hhh]”(ha)”}”(hŒ4*transcrypt/Transcrypt/modules/all/the/kings/men.py*”h]”hL)”}”(hjÂh]”hj)”}”(hjÂh]”hŒ2transcrypt/Transcrypt/modules/all/the/kings/men.py”…””}”(hhhjÇubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjÄubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhjÀubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hj½ubha)”}”(hŒ4*transcrypt/Transcrypt/modules/all/the/kings/men.js*”h]”hL)”}”(hjâh]”hj)”}”(hjâh]”hŒ2transcrypt/Transcrypt/modules/all/the/kings/men.js”…””}”(hhhjçubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjäubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhjàubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hj½ubha)”}”(hŒ<*transcrypt/Transcrypt/modules/all/the/kings/men/__init__py*”h]”hL)”}”(hjh]”hj)”}”(hjh]”hŒ:transcrypt/Transcrypt/modules/all/the/kings/men/__init__py”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hj½ubha)”}”(hŒ=*transcrypt/Transcrypt/modules/all/the/kings/men/__init__js* ”h]”hL)”}”(hŒ<*transcrypt/Transcrypt/modules/all/the/kings/men/__init__js*”h]”hj)”}”(hj&h]”hŒ:transcrypt/Transcrypt/modules/all/the/kings/men/__init__js”…””}”(hhhj(ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj$ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK hj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hj½ubeh}”(h ]”h"]”h$]”h&]”h(]”hËhÌuh*h[hh+hKhj/ubh\)”}”(hhh]”(ha)”}”(hŒ5*/all/the/kings/men.py*”h]”hL)”}”(hjLh]”hj)”}”(hjLh]”hŒ3/all/the/kings/men.py”…””}”(hhhjQubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK"hjJubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hjGubha)”}”(hŒ5*/all/the/kings/men.js*”h]”hL)”}”(hjlh]”hj)”}”(hjlh]”hŒ3/all/the/kings/men.js”…””}”(hhhjqubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjnubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK#hjjubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hjGubha)”}”(hŒ>*/all/the/kings/men/__init__.py*”h]”hL)”}”(hjŒh]”hj)”}”(hjŒh]”hŒ</all/the/kings/men/__init__.py”…””}”(hhhj‘ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjŽubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK$hjŠubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hjGubha)”}”(hŒ?*/all/the/kings/men/__init__.js* ”h]”hL)”}”(hŒ>*/all/the/kings/men/__init__.js*”h]”hj)”}”(hj°h]”hŒ</all/the/kings/men/__init__.js”…””}”(hhhj²ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj®ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK%hjªubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hjGubeh}”(h ]”h"]”h$]”h&]”h(]”hËj¼uh*h[hh+hK"hj/ubh\)”}”(hhh]”(ha)”}”(hŒ5*/all/the/kings/men.py*”h]”hL)”}”(hjÖh]”hj)”}”(hjÖh]”hŒ3/all/the/kings/men.py”…””}”(hhhjÛubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjØubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK'hjÔubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hjÑubha)”}”(hŒ5*/all/the/kings/men.js*”h]”hL)”}”(hjöh]”hj)”}”(hjöh]”hŒ3/all/the/kings/men.js”…””}”(hhhjûubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjøubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK(hjôubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hjÑubha)”}”(hŒ>*/all/the/kings/men/__init__.py*”h]”hL)”}”(hjh]”hj)”}”(hjh]”hŒ</all/the/kings/men/__init__.py”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK)hjubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hjÑubha)”}”(hŒ?*/all/the/kings/men/__init__.js* ”h]”hL)”}”(hŒ>*/all/the/kings/men/__init__.js*”h]”hj)”}”(hj:h]”hŒ</all/the/kings/men/__init__.js”…””}”(hhhj<ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj8ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK*hj4ubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hjÑubeh}”(h ]”h"]”h$]”h&]”h(]”hËhÌuh*h[hh+hK'hj/ubh\)”}”(hhh]”ha)”}”(hŒ$*More CPython packages directories* ”h]”hL)”}”(hŒ#*More CPython packages directories*”h]”hj)”}”(hjdh]”hŒ!More CPython packages directories”…””}”(hhhjfubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjbubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK,hj^ubah}”(h ]”h"]”h$]”h&]”h(]”uh*h`hj[ubah}”(h ]”h"]”h$]”h&]”h(]”hËj¼uh*h[hh+hK,hj/ubeh}”(h ]”h"]”h$]”h&]”h(]”uh*j-hh:hhhNhNubhL)”}”(hX2As can be seen from the above list, modules local to your project take precedence over modules available in Transcrypt, which again take precedence over modules available globally in CPython. Note that even if modules are made available globally in CPython, importing them in Transcrypt gives special possibilities and restrictions. They are allowed to be written in native JavaScript, in which case they reside in the __javascript__ subdirectory of the module. They should not depend on C, C++ or features that are outside Python subset supported by Transcrypt.”h]”hX2As can be seen from the above list, modules local to your project take precedence over modules available in Transcrypt, which again take precedence over modules available globally in CPython. Note that even if modules are made available globally in CPython, importing them in Transcrypt gives special possibilities and restrictions. They are allowed to be written in native JavaScript, in which case they reside in the __javascript__ subdirectory of the module. They should not depend on C, C++ or features that are outside Python subset supported by Transcrypt.”…””}”(hjhj‹hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK.hh:hhubhL)”}”(hXœAlthough under these guidelines it's quite possible to write modules that are importable both by CPyton and Transcrypt, most Transcrypt modules will be come from the JavaScript, rather than from the Python ecosystem. If both a Python and a JavaScript incarnation of a module are present, the Python module is only recompiled if it's younger than the corresponding JavaScript module, unless the -b switch is used.”h]”hX Although under these guidelines it’s quite possible to write modules that are importable both by CPyton and Transcrypt, most Transcrypt modules will be come from the JavaScript, rather than from the Python ecosystem. If both a Python and a JavaScript incarnation of a module are present, the Python module is only recompiled if it’s younger than the corresponding JavaScript module, unless the -b switch is used.”…””}”(hj›hj™hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK0hh:hhubhL)”}”(hXbFurthermore, note that the *__init__.py* or *__init__.js* file of a module is executed if and only if that module is imported, not if it's just somewhere in the hierarchy of directories containing that module. Furthermore the global code of a module is executed only once, no matter how often that module is imported, as is equally the case with CPython.”h]”(hŒFurthermore, note that the ”…””}”(hŒFurthermore, note that the ”hj§hhhNhNubhj)”}”(hŒ *__init__.py*”h]”hŒ __init__.py”…””}”(hhhj°ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj§ubhŒ or ”…””}”(hŒ or ”hj§hhhNhNubhj)”}”(hŒ *__init__.js*”h]”hŒ __init__.js”…””}”(hhhjÃubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj§ubhX+ file of a module is executed if and only if that module is imported, not if it’s just somewhere in the hierarchy of directories containing that module. Furthermore the global code of a module is executed only once, no matter how often that module is imported, as is equally the case with CPython.”…””}”(hX) file of a module is executed if and only if that module is imported, not if it's just somewhere in the hierarchy of directories containing that module. Furthermore the global code of a module is executed only once, no matter how often that module is imported, as is equally the case with CPython.”hj§hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK2hh:hhubhL)”}”(hXlAnother deviation from CPython is that the inclusion of a module has to be decided upon compiletime. This means that imports cannot be runtime conditional, so e.g. cannot be under an *if*. For compiletime conditional imports you can use :ref:`\_\_pragma\_\_ ('ifdef') `. Also, since imports are resolved in one pass, cyclic imports are not supported.”h]”(hŒ·Another deviation from CPython is that the inclusion of a module has to be decided upon compiletime. This means that imports cannot be runtime conditional, so e.g. cannot be under an ”…””}”(hŒ·Another deviation from CPython is that the inclusion of a module has to be decided upon compiletime. This means that imports cannot be runtime conditional, so e.g. cannot be under an ”hjÜhhhNhNubhj)”}”(hŒ*if*”h]”hŒif”…””}”(hhhjåubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjÜubhŒ2. For compiletime conditional imports you can use ”…””}”(hŒ2. For compiletime conditional imports you can use ”hjÜhhhNhNubhŒ pending_xref”“”)”}”(hŒ.:ref:`\_\_pragma\_\_ ('ifdef') `”h]”h Œinline”“”)”}”(hjüh]”hŒ__pragma__ (‘ifdef’)”…””}”(hhhjubah}”(h ]”h"]”(Œxref”Œstd”Œstd-ref”eh$]”h&]”h(]”uh*jþhjúubah}”(h ]”h"]”h$]”h&]”h(]”Œrefdoc”Œspecial_facilities”Œ refdomain”j Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆŒ reftarget”Œ pragma_ifdef”uh*jøhh+hK4hjÜubhŒQ. Also, since imports are resolved in one pass, cyclic imports are not supported.”…””}”(hŒQ. Also, since imports are resolved in one pass, cyclic imports are not supported.”hjÜhhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK4hh:hhubhL)”}”(hŒÑAs a consequence of the above, modules may be distributed as Python *.py* files, but also as JavaScript-only *.js* files. The JavaScript files may be hand written or generated by any tool including Transcrypt.”h]”(hŒDAs a consequence of the above, modules may be distributed as Python ”…””}”(hŒDAs a consequence of the above, modules may be distributed as Python ”hj*hhhNhNubhj)”}”(hŒ*.py*”h]”hŒ.py”…””}”(hhhj3ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj*ubhŒ$ files, but also as JavaScript-only ”…””}”(hŒ$ files, but also as JavaScript-only ”hj*hhhNhNubhj)”}”(hŒ*.js*”h]”hŒ.js”…””}”(hhhjFubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj*ubhŒ_ files. The JavaScript files may be hand written or generated by any tool including Transcrypt.”…””}”(hŒ_ files. The JavaScript files may be hand written or generated by any tool including Transcrypt.”hj*hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK7hh:hhubeh}”(h ]”(Œtranscrypt-s-module-mechanism”h9eh"]”h$]”(Œtranscrypt's module mechanism”Œmodule_mechanism”eh&]”h(]”uh*h hh hhhh+hKŒexpect_referenced_by_name”}”jeh.sŒexpect_referenced_by_id”}”h9h.subh )”}”(hhh]”(h)”}”(hŒOUsing browser stubs to test non-GUI code that uses console.log and window.alert”h]”hŒOUsing browser stubs to test non-GUI code that uses console.log and window.alert”…””}”(hjqhjohhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjlhhhh+hK:ubhL)”}”(hX³To test the non-GUI part of your code in a desktop rather than a browser environment, use *from org.transcrypt.stubs.browser import \**. This will allow you to call the *window.alert* and *console.log* functions in your code when you run it from the command prompt, using the -r command line switch: *transcrypt -r *. This will invoke CPython, searching the appropriate module paths as compilation would have done.”h]”(hŒZTo test the non-GUI part of your code in a desktop rather than a browser environment, use ”…””}”(hŒZTo test the non-GUI part of your code in a desktop rather than a browser environment, use ”hj}hhhNhNubhj)”}”(hŒ-*from org.transcrypt.stubs.browser import \**”h]”hŒ+from org.transcrypt.stubs.browser import *”…””}”(hhhj†ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj}ubhŒ". This will allow you to call the ”…””}”(hŒ". This will allow you to call the ”hj}hhhNhNubhj)”}”(hŒ*window.alert*”h]”hŒ window.alert”…””}”(hhhj™ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj}ubhŒ and ”…””}”(hŒ and ”hj}hhhNhNubhj)”}”(hŒ *console.log*”h]”hŒ console.log”…””}”(hhhj¬ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj}ubhŒc functions in your code when you run it from the command prompt, using the -r command line switch: ”…””}”(hŒc functions in your code when you run it from the command prompt, using the -r command line switch: ”hj}hhhNhNubhj)”}”(hŒ%*transcrypt -r *”h]”hŒ#transcrypt -r ”…””}”(hhhj¿ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj}ubhŒb. This will invoke CPython, searching the appropriate module paths as compilation would have done.”…””}”(hŒb. This will invoke CPython, searching the appropriate module paths as compilation would have done.”hj}hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK;hjlhhubeh}”(h ]”ŒOusing-browser-stubs-to-test-non-gui-code-that-uses-console-log-and-window-alert”ah"]”h$]”ŒOusing browser stubs to test non-gui code that uses console.log and window.alert”ah&]”h(]”uh*h hh hhhh+hK:ubh )”}”(hhh]”(h)”}”(hŒ=Creating JavaScript objects with __new__ ()”h]”hŒ=Creating JavaScript objects with __new__ ()”…””}”(hjåhjãhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjàhhhh+hK>ubhL)”}”(hXÜWhile creating objects in Transcrypt mostly happens in the plain Python way, e.g. *canvas = Canvas ()*, objects from 3rd party JavaScript libraries often have to be created using *new*. In Transcrypt such objects are created by calling the *__new__* function, e.g. *canvas = __new__ (Canvas ()*, as can be seen in the :ref:`Pong example`. This mechanism is simple, follows Python's syntax rules and doesn't require updating of an encapsulation layer if a later version of the underlying JavaScript library features additional constructor functions. Therefore in most cases it is the preferred way to create objects who's initialization requires calling 3rd party JavaScript constructor functions.”h]”(hŒRWhile creating objects in Transcrypt mostly happens in the plain Python way, e.g. ”…””}”(hŒRWhile creating objects in Transcrypt mostly happens in the plain Python way, e.g. ”hjñhhhNhNubhj)”}”(hŒ *canvas = Canvas ()*”h]”hŒcanvas = Canvas ()”…””}”(hhhjúubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjñubhŒM, objects from 3rd party JavaScript libraries often have to be created using ”…””}”(hŒM, objects from 3rd party JavaScript libraries often have to be created using ”hjñhhhNhNubhj)”}”(hŒ*new*”h]”hŒnew”…””}”(hhhj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjñubhŒ9. In Transcrypt such objects are created by calling the ”…””}”(hŒ9. In Transcrypt such objects are created by calling the ”hjñhhhNhNubhj)”}”(hŒ *__new__*”h]”hŒ__new__”…””}”(hhhj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjñubhŒ function, e.g. ”…””}”(hŒ function, e.g. ”hjñhhhNhNubhj)”}”(hŒ)*canvas = __new__ (Canvas ()*”h]”hŒ'canvas = __new__ (Canvas ()”…””}”(hhhj3ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjñubhŒ, as can be seen in the ”…””}”(hŒ, as can be seen in the ”hjñhhhNhNubjù)”}”(hŒ:ref:`Pong example`”h]”jÿ)”}”(hjHh]”hŒ Pong example”…””}”(hhhjJubah}”(h ]”h"]”(j Œstd”Œstd-ref”eh$]”h&]”h(]”uh*jþhjFubah}”(h ]”h"]”h$]”h&]”h(]”Œrefdoc”jŒ refdomain”jTŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjŒ code_pong”uh*jøhh+hK@hjñubhXm. This mechanism is simple, follows Python’s syntax rules and doesn’t require updating of an encapsulation layer if a later version of the underlying JavaScript library features additional constructor functions. Therefore in most cases it is the preferred way to create objects who’s initialization requires calling 3rd party JavaScript constructor functions.”…””}”(hXg. This mechanism is simple, follows Python's syntax rules and doesn't require updating of an encapsulation layer if a later version of the underlying JavaScript library features additional constructor functions. Therefore in most cases it is the preferred way to create objects who's initialization requires calling 3rd party JavaScript constructor functions.”hjñhhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK@hjàhhubhL)”}”(hX3As an alternative, instantiation and construction can be encapsulated in one function call. Since this in fact creates an alternative API facade for the 3rd party JavaScript library, such an encapsulation should be kept separate from the original library, e.g. by putting it in a separate importable module. The JavaScript code for this encapsulation would e.g. be *.Canvas = function () {return new Canvas ();};*. After importing the facade module, canvas creation is straightforward: *canvas = Canvas ()*.”h]”(hXmAs an alternative, instantiation and construction can be encapsulated in one function call. Since this in fact creates an alternative API facade for the 3rd party JavaScript library, such an encapsulation should be kept separate from the original library, e.g. by putting it in a separate importable module. The JavaScript code for this encapsulation would e.g. be ”…””}”(hXmAs an alternative, instantiation and construction can be encapsulated in one function call. Since this in fact creates an alternative API facade for the 3rd party JavaScript library, such an encapsulation should be kept separate from the original library, e.g. by putting it in a separate importable module. The JavaScript code for this encapsulation would e.g. be ”hjqhhhNhNubhj)”}”(hŒ\*.Canvas = function () {return new Canvas ();};*”h]”hŒZ.Canvas = function () {return new Canvas ();};”…””}”(hhhjzubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjqubhŒI. After importing the facade module, canvas creation is straightforward: ”…””}”(hŒI. After importing the facade module, canvas creation is straightforward: ”hjqhhhNhNubhj)”}”(hŒ *canvas = Canvas ()*”h]”hŒcanvas = Canvas ()”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjqubhŒ.”…””}”(hhèhjqhhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKBhjàhhubhL)”}”(hXAs a third alternative, encapsulation can be done in Python rather than JavaScript: *def Canvas (): return __new__ (<3rd party module name>.Canvas ()*. Also in this case the creation syntax is simple: *canvas = Canvas ()*.”h]”(hŒTAs a third alternative, encapsulation can be done in Python rather than JavaScript: ”…””}”(hŒTAs a third alternative, encapsulation can be done in Python rather than JavaScript: ”hj¥hhhNhNubhj)”}”(hŒZ*def Canvas (): return __new__ (<3rd party module name>.Canvas ()*”h]”hŒXdef Canvas (): return __new__ (<3rd party module name>.Canvas ()”…””}”(hhhj®ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj¥ubhŒ3. Also in this case the creation syntax is simple: ”…””}”(hŒ3. Also in this case the creation syntax is simple: ”hj¥hhhNhNubhj)”}”(hŒ *canvas = Canvas ()*”h]”hŒcanvas = Canvas ()”…””}”(hhhjÁubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj¥ubhŒ.”…””}”(hhèhj¥hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKDhjàhhubeh}”(h ]”Œ5creating-javascript-objects-with-new-constructor-call”ah"]”h$]”Œ=creating javascript objects with __new__ ()”ah&]”h(]”uh*h hh hhhh+hK>ubh )”}”(hhh]”(h)”}”(hŒThe __pragma__ mechanism”h]”hŒThe __pragma__ mechanism”…””}”(hjæhjähhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjáhhhh+hKGubhL)”}”(hŒ~Pragma's are directives in the source code, that locally alter the behaviour of the compiler. Pragma's come in four varieties.”h]”hŒ‚Pragma’s are directives in the source code, that locally alter the behaviour of the compiler. Pragma’s come in four varieties.”…””}”(hjôhjòhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKIhjáhhubh )”}”(hhh]”(h)”}”(hŒThe function-like variety”h]”hŒThe function-like variety”…””}”(hjhjhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjhhhh+hKLubhL)”}”(hŒ*__pragma__ ()*”h]”hj)”}”(hjh]”hŒ__pragma__ ()”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKNhjhhubhL)”}”(hŒ‰is acceptable only to Transcrypt, CPython requires a stub with parameter *\*args*. Such a stub can either be defined locally or imported:”h]”(hŒIis acceptable only to Transcrypt, CPython requires a stub with parameter ”…””}”(hŒIis acceptable only to Transcrypt, CPython requires a stub with parameter ”hj(hhhNhNubhj)”}”(hŒ*\*args*”h]”hŒ*args”…””}”(hhhj1ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj(ubhŒ8. Such a stub can either be defined locally or imported:”…””}”(hŒ8. Such a stub can either be defined locally or imported:”hj(hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKPhjhhubhL)”}”(hŒ5*from org.transcrypt.stubs.browser import __pragma__*”h]”hj)”}”(hjLh]”hŒ3from org.transcrypt.stubs.browser import __pragma__”…””}”(hhhjNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjJubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKRhjhhubeh}”(h ]”Œthe-function-like-variety”ah"]”h$]”Œthe function-like variety”ah&]”h(]”uh*h hjáhhhh+hKLubh )”}”(hhh]”(h)”}”(hŒThe comment-like variety”h]”hŒThe comment-like variety”…””}”(hjnhjlhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjihhhh+hKUubhL)”}”(hŒ# __pragma__ ()”h]”hŒ# __pragma__ ()”…””}”(hj|hjzhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKWhjihhubhL)”}”(hŒIis acceptable both to Transcrypt and CPython. In CPython it does nothing.”h]”hŒIis acceptable both to Transcrypt and CPython. In CPython it does nothing.”…””}”(hjŠhjˆhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKYhjihhubhL)”}”(hŒ^N.B. Both varieties above have to be properly indented, matching indentation of their context.”h]”hŒ^N.B. Both varieties above have to be properly indented, matching indentation of their context.”…””}”(hj˜hj–hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK[hjihhubeh}”(h ]”Œthe-comment-like-variety”ah"]”h$]”Œthe comment-like variety”ah&]”h(]”uh*h hjáhhhh+hKUubh )”}”(hhh]”(h)”}”(hŒ"The single-line activation variety”h]”hŒ"The single-line activation variety”…””}”(hj±hj¯hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhj¬hhhh+hK^ubhL)”}”(hŒ& # __:”h]”hŒ& # __:”…””}”(hj¿hj½hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK`hj¬hhubhL)”}”(hŒ¨It will switch a facility on or off just for the line of code it's part of. Single line pragma's can only be used for pragma's which have a single parameter, it's name.”h]”hŒ°It will switch a facility on or off just for the line of code it’s part of. Single line pragma’s can only be used for pragma’s which have a single parameter, it’s name.”…””}”(hjÍhjËhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKbhj¬hhubhL)”}”(hŒFor example the following line:”h]”hŒFor example the following line:”…””}”(hjÛhjÙhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKehj¬hhubhL)”}”(hŒ'*vector2 = vector0 + vector1 # __:opov*”h]”hj)”}”(hjéh]”hŒ%vector2 = vector0 + vector1 # __:opov”…””}”(hhhjëubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjçubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKghj¬hhubhL)”}”(hŒ will be compiled identically to:”h]”hŒ will be compiled identically to:”…””}”(hjhjþhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKihj¬hhubhL)”}”(hŒI*__pragma__ ('opov'); vector2 = vector0 + vector1; __pragma__ ('noopov')*”h]”hj)”}”(hjh]”hŒO__pragma__ (‘opov’); vector2 = vector0 + vector1; __pragma__ (‘noopov’)”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKkhj¬hhubeh}”(h ]”Œ"the-single-line-activation-variety”ah"]”h$]”Œ"the single-line activation variety”ah&]”h(]”uh*h hjáhhhh+hK^ubh )”}”(hhh]”(h)”}”(hŒ$The single-line deactivation variety”h]”hŒ$The single-line deactivation variety”…””}”(hj0hj.hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhj+hhhh+hKnubhL)”}”(hŒ)*scalar2 = scalar0 + scalar1 # __:noopov*”h]”hj)”}”(hj>h]”hŒ'scalar2 = scalar0 + scalar1 # __:noopov”…””}”(hhhj@ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj<ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKphj+hhubhL)”}”(hŒ will be compiled identically to:”h]”hŒ will be compiled identically to:”…””}”(hjUhjShhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKrhj+hhubhL)”}”(hŒI*__pragma__ ('noopov'); scalar2 = scalar0 + scalar1; __pragma__ ('opov')*”h]”hj)”}”(hjch]”hŒO__pragma__ (‘noopov’); scalar2 = scalar0 + scalar1; __pragma__ (‘opov’)”…””}”(hhhjeubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjaubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKthj+hhubh-)”}”(hŒ.. _pragma_alias:”h]”h}”(h ]”h"]”h$]”h&]”h(]”h8Œ pragma-alias”uh*h,hKvhj+hhhh+ubeh}”(h ]”Œ$the-single-line-deactivation-variety”ah"]”h$]”Œ$the single-line deactivation variety”ah&]”h(]”uh*h hjáhhhh+hKnubeh}”(h ]”Œthe-pragma-mechanism”ah"]”h$]”Œthe __pragma__ mechanism”ah&]”h(]”uh*h hh hhhh+hKGubh )”}”(hhh]”(h)”}”(hŒNIdentifier aliasing: __pragma__ ('alias', ...) and __pragma__ ('noalias', ...)”h]”hŒVIdentifier aliasing: __pragma__ (‘alias’, …) and __pragma__ (‘noalias’, …)”…””}”(hj˜hj–hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhj“hhhh+hKyubhL)”}”(hŒ©Calling *__pragma__ ('alias', , )* at the start of a module will replace identifiers or parts thereof like in the following examples:”h]”(hŒCalling ”…””}”(hŒCalling ”hj¤hhhNhNubhj)”}”(hŒ>*__pragma__ ('alias', , )*”h]”hŒ@__pragma__ (‘alias’, , )”…””}”(hhhj­ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj¤ubhŒc at the start of a module will replace identifiers or parts thereof like in the following examples:”…””}”(hŒc at the start of a module will replace identifiers or parts thereof like in the following examples:”hj¤hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKzhj“hhubhL)”}”(hŒ Example 1:”h]”hŒ Example 1:”…””}”(hjÈhjÆhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK|hj“hhubh Œtable”“”)”}”(hhh]”h Œtgroup”“”)”}”(hhh]”(h Œcolspec”“”)”}”(hhh]”h}”(h ]”h"]”h$]”h&]”h(]”Œcolwidth”K*uh*jÞhjÛubjß)”}”(hhh]”h}”(h ]”h"]”h$]”h&]”h(]”Œcolwidth”Kuh*jÞhjÛubh Œtbody”“”)”}”(hhh]”(h Œrow”“”)”}”(hhh]”h Œentry”“”)”}”(hhh]”hL)”}”(hŒAUsed at the start of the module: *__pragma__ ('alias', 'S', '$')*”h]”(hŒ!Used at the start of the module: ”…””}”(hŒ!Used at the start of the module: ”hjubhj)”}”(hŒ *__pragma__ ('alias', 'S', '$')*”h]”hŒ*__pragma__ (‘alias’, ‘S’, ‘$’)”…””}”(hhhj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhjubah}”(h ]”h"]”h$]”h&]”h(]”Œmorecols”Kuh*jþhjûubah}”(h ]”h"]”h$]”h&]”h(]”uh*jùhjöubjú)”}”(hhh]”(jÿ)”}”(hhh]”hL)”}”(hŒOriginal in Python:”h]”hŒOriginal in Python:”…””}”(hj5hj3ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhj0ubah}”(h ]”h"]”h$]”h&]”h(]”uh*jþhj-ubjÿ)”}”(hhh]”hL)”}”(hŒAlias in JavaScript:”h]”hŒAlias in JavaScript:”…””}”(hjLhjJubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhjGubah}”(h ]”h"]”h$]”h&]”h(]”uh*jþhj-ubeh}”(h ]”h"]”h$]”h&]”h(]”uh*jùhjöubjú)”}”(hhh]”(jÿ)”}”(hhh]”hL)”}”(hŒ *S ('body')*”h]”hj)”}”(hjlh]”hŒS (‘body’)”…””}”(hhhjnubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKƒhjgubah}”(h ]”h"]”h$]”h&]”h(]”uh*jþhjdubjÿ)”}”(hhh]”hL)”}”(hŒ *$ ('body')*”h]”hj)”}”(hjŒh]”hŒ$ (‘body’)”…””}”(hhhjŽubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjŠubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKƒhj‡ubah}”(h ]”h"]”h$]”h&]”h(]”uh*jþhjdubeh}”(h ]”h"]”h$]”h&]”h(]”uh*jùhjöubjú)”}”(hhh]”(jÿ)”}”(hhh]”hL)”}”(hŒ *S__body*”h]”hj)”}”(hjµh]”hŒS__body”…””}”(hhhj·ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj³ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK…hj°ubah}”(h ]”h"]”h$]”h&]”h(]”uh*jþhj­ubjÿ)”}”(hhh]”hL)”}”(hŒ*$body*”h]”hj)”}”(hjÕh]”hŒ$body”…””}”(hhhj×ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjÓubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK…hjÐubah}”(h ]”h"]”h$]”h&]”h(]”uh*jþhj­ubeh}”(h ]”h"]”h$]”h&]”h(]”uh*jùhjöubjú)”}”(hhh]”(jÿ)”}”(hhh]”hL)”}”(hŒ(*S__She__S__Sells__S__Sea__S__Shells__S*”h]”hj)”}”(hjþh]”hŒ&S__She__S__Sells__S__Sea__S__Shells__S”…””}”(hhhj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjüubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK‡hjùubah}”(h ]”h"]”h$]”h&]”h(]”uh*jþhjöubjÿ)”}”(hhh]”hL)”}”(hŒ*$She$Sells$Sea$Shells$*”h]”hj)”}”(hj h]”hŒ$She$Sells$Sea$Shells$”…””}”(hhhj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK‡hj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*jþhjöubeh}”(h ]”h"]”h$]”h&]”h(]”uh*jùhjöubeh}”(h ]”h"]”h$]”h&]”h(]”uh*jôhjÛubeh}”(h ]”h"]”h$]”h&]”h(]”Œcols”Kuh*jÙhjÖubah}”(h ]”h"]”h$]”h&]”h(]”uh*jÔhj“hhhh+hNubhL)”}”(hŒLUsing the above alias, a piece of jQuery code will look like this in Python:”h]”hŒLUsing the above alias, a piece of jQuery code will look like this in Python:”…””}”(hjT hjR hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKŠhj“hhubh Œ container”“”)”}”(hhh]”(h Œcaption”“”)”}”(hŒ7Use of __pragma__ ('alias', 'S', '$') in jquery_demo.py”h]”hŒCUse of __pragma__ (‘alias’, ‘S’, ‘$’) in jquery_demo.py”…””}”(hji hjg ubah}”(h ]”h"]”h$]”h&]”h(]”uh*je hh+hKŒhjb ubh Œ literal_block”“”)”}”(hXK__pragma__ ('alias', 'S', '$') def start (): def changeColors (): for div in S__divs: S (div) .css ({ 'color': 'rgb({},{},{})'.format (* [int (256 * Math.random ()) for i in range (3)]), }) S__divs = S ('div') changeColors () window.setInterval (changeColors, 500) ”h]”hXK__pragma__ ('alias', 'S', '$') def start (): def changeColors (): for div in S__divs: S (div) .css ({ 'color': 'rgb({},{},{})'.format (* [int (256 * Math.random ()) for i in range (3)]), }) S__divs = S ('div') changeColors () window.setInterval (changeColors, 500) ”…””}”(hhhjw ubah}”(h ]”h"]”h$]”h&]”h(]”Œsource”ŒY/home/jac/active/geatec/transcrypt/Transcrypt/transcrypt/demos/jquery_demo/jquery_demo.py”Œ xml:space”Œpreserve”Œforce”‰Œhighlight_args”}”Œ linenostart”Ksuh*ju hh+hKŒhjb ubeh}”(h ]”Œid1”ah"]”Œliteral-block-wrapper”ah$]”h&]”h(]”Œ literal_block”ˆuh*j` hj“hhhhhNubhL)”}”(hŒ Example 2:”h]”hŒ Example 2:”…””}”(hj˜ hj– hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKhj“hhubjÕ)”}”(hhh]”jÚ)”}”(hhh]”(jß)”}”(hhh]”h}”(h ]”h"]”h$]”h&]”h(]”Œcolwidth”K)uh*jÞhj§ ubjß)”}”(hhh]”h}”(h ]”h"]”h$]”h&]”h(]”Œcolwidth”Kuh*jÞhj§ ubjõ)”}”(hhh]”(jú)”}”(hhh]”jÿ)”}”(hhh]”hL)”}”(hŒAUsed at the start of the module *__pragma__ ('alias', 'jq', '$')*”h]”(hŒ Used at the start of the module ”…””}”(hŒ Used at the start of the module ”hjÇ ubhj)”}”(hŒ!*__pragma__ ('alias', 'jq', '$')*”h]”hŒ+__pragma__ (‘alias’, ‘jq’, ‘$’)”…””}”(hhhjÐ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjÇ ubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK“hjÄ ubah}”(h ]”h"]”h$]”h&]”h(]”Œmorecols”Kuh*jþhjÁ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*jùhj¾ ubjú)”}”(hhh]”(jÿ)”}”(hhh]”hL)”}”(hŒ*jq__body = jq (body)*”h]”hj)”}”(hjù h]”hŒjq__body = jq (body)”…””}”(hhhjû ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj÷ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK•hjô ubah}”(h ]”h"]”h$]”h&]”h(]”uh*jþhjñ ubjÿ)”}”(hhh]”hL)”}”(hŒ*$body = $ ('body')*”h]”hj)”}”(hj h]”hŒ$body = $ (‘body’)”…””}”(hhhj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK•hj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*jþhjñ ubeh}”(h ]”h"]”h$]”h&]”h(]”uh*jùhj¾ ubeh}”(h ]”h"]”h$]”h&]”h(]”uh*jôhj§ ubeh}”(h ]”h"]”h$]”h&]”h(]”Œcols”Kuh*jÙhj¤ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*jÔhj“hhhh+hNubhL)”}”(hŒåNote that in the generated JavaScript only the modified identifiers will be present, not the original ones. So the JavaScript identifiers are only aliases for the Python ones, not for any identifier in the JavaScript code itself.”h]”hŒåNote that in the generated JavaScript only the modified identifiers will be present, not the original ones. So the JavaScript identifiers are only aliases for the Python ones, not for any identifier in the JavaScript code itself.”…””}”(hjO hjM hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK˜hj“hhubhL)”}”(hŒOA number of aliases are predefined in the source code of Transcrypt as follows:”h]”hŒOA number of aliases are predefined in the source code of Transcrypt as follows:”…””}”(hj] hj[ hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKšhj“hhubja )”}”(hhh]”(jf )”}”(hŒTranscrypt's predefined aliases”h]”hŒ!Transcrypt’s predefined aliases”…””}”(hjn hjl ubah}”(h ]”h"]”h$]”h&]”h(]”uh*je hh+hKœhji ubjv )”}”(hXH # Format: ('', '') ('js_and', 'and'), ('arguments', 'py_arguments'), ('js_arguments', 'arguments'), ('case', 'py_case'), ('clear', 'py_clear'), ('js_clear', 'clear'), ('js_conjugate', 'conjugate'), ('default', 'py_default'), ('del', 'py_del'), ('js_del', 'del'), ('false', 'py_false'), ('js_from', 'from'), ('get', 'py_get'), ('js_get', 'get'), ('js_global', 'global'), ('Infinity', 'py_Infinity'), ('js_Infinity', 'Infinity'), ('is', 'py_is'), ('js_is', 'is'), ('isNaN', 'py_isNaN'), ('js_isNaN', 'isNaN'), ('iter', 'py_iter'), ('js_iter', 'iter'), ('items', 'py_items'), ('js_items', 'items'), ('keys', 'py_keys'), ('js_keys', 'keys'), ('name', 'py_name'), ('js_name', 'name'), ('NaN', 'py_NaN'), ('js_NaN', 'NaN'), ('new', 'py_new'), ('next', 'py_next'), ('js_next', 'next'), ('js_not', 'not'), ('js_or', 'or'), ('pop', 'py_pop'), ('js_pop', 'pop'), ('popitem', 'py_popitem'), ('js_popitem', 'popitem'), ('replace', 'py_replace'), ('js_replace', 'replace'), ('selector', 'py_selector'), ('js_selector', 'selector'), ('sort', 'py_sort'), ('js_sort', 'sort'), ('split', 'py_split'), ('js_split', 'split'), ('switch', 'py_switch'), ('type', 'py_metatype'), ('js_type', 'type'), # Only for the type metaclass, the type operator is dealt with separately in visit_Call ('TypeError', 'py_TypeError'), ('js_TypeError', 'TypeError'), ('update', 'py_update'), ('js_update', 'update'), ('values', 'py_values'), ('js_values', 'values'), ('reversed', 'py_reversed'), ('js_reversed', 'reversed'), ('setdefault', 'py_setdefault'), ('js_setdefault', 'setdefault'), ('js_super', 'super'), ('true', 'py_true'), ('undefined', 'py_undefined'), ('js_undefined', 'undefined'), ”h]”hXH # Format: ('', '') ('js_and', 'and'), ('arguments', 'py_arguments'), ('js_arguments', 'arguments'), ('case', 'py_case'), ('clear', 'py_clear'), ('js_clear', 'clear'), ('js_conjugate', 'conjugate'), ('default', 'py_default'), ('del', 'py_del'), ('js_del', 'del'), ('false', 'py_false'), ('js_from', 'from'), ('get', 'py_get'), ('js_get', 'get'), ('js_global', 'global'), ('Infinity', 'py_Infinity'), ('js_Infinity', 'Infinity'), ('is', 'py_is'), ('js_is', 'is'), ('isNaN', 'py_isNaN'), ('js_isNaN', 'isNaN'), ('iter', 'py_iter'), ('js_iter', 'iter'), ('items', 'py_items'), ('js_items', 'items'), ('keys', 'py_keys'), ('js_keys', 'keys'), ('name', 'py_name'), ('js_name', 'name'), ('NaN', 'py_NaN'), ('js_NaN', 'NaN'), ('new', 'py_new'), ('next', 'py_next'), ('js_next', 'next'), ('js_not', 'not'), ('js_or', 'or'), ('pop', 'py_pop'), ('js_pop', 'pop'), ('popitem', 'py_popitem'), ('js_popitem', 'popitem'), ('replace', 'py_replace'), ('js_replace', 'replace'), ('selector', 'py_selector'), ('js_selector', 'selector'), ('sort', 'py_sort'), ('js_sort', 'sort'), ('split', 'py_split'), ('js_split', 'split'), ('switch', 'py_switch'), ('type', 'py_metatype'), ('js_type', 'type'), # Only for the type metaclass, the type operator is dealt with separately in visit_Call ('TypeError', 'py_TypeError'), ('js_TypeError', 'TypeError'), ('update', 'py_update'), ('js_update', 'update'), ('values', 'py_values'), ('js_values', 'values'), ('reversed', 'py_reversed'), ('js_reversed', 'reversed'), ('setdefault', 'py_setdefault'), ('js_setdefault', 'setdefault'), ('js_super', 'super'), ('true', 'py_true'), ('undefined', 'py_undefined'), ('js_undefined', 'undefined'), ”…””}”(hhhjz ubah}”(h ]”h"]”h$]”h&]”h(]”Œsource”Œ[/home/jac/active/geatec/transcrypt/Transcrypt/transcrypt/modules/org/transcrypt/compiler.py”j‡ jˆ j‰ ‰jŠ }”jŒ Ksuh*ju hh+hKœhji ubeh}”(h ]”Œid2”ah"]”j‘ ah$]”h&]”h(]”Œ literal_block”ˆuh*j` hj“hhhhhNubhL)”}”(hXÆThe predefined aliases are used to resolve name conflicts between Python and JavaScript. Calling e.g *.sort ()* from Python will invoke a *sort* method with Python semantics, which in the generated JavaScript is called *py_sort*. Calling *.js_sort * from Python will invoke a *sort* method with JavaScript semantics, which in the generated JavaScript is simply called *sort*, as 3rd party JavaScript libraries will expect.”h]”(hŒeThe predefined aliases are used to resolve name conflicts between Python and JavaScript. Calling e.g ”…””}”(hŒeThe predefined aliases are used to resolve name conflicts between Python and JavaScript. Calling e.g ”hj“ hhhNhNubhj)”}”(hŒ*.sort ()*”h]”hŒ.sort ()”…””}”(hhhjœ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj“ ubhŒ from Python will invoke a ”…””}”(hŒ from Python will invoke a ”hj“ hhhNhNubhj)”}”(hŒ*sort*”h]”hŒsort”…””}”(hhhj¯ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj“ ubhŒK method with Python semantics, which in the generated JavaScript is called ”…””}”(hŒK method with Python semantics, which in the generated JavaScript is called ”hj“ hhhNhNubhj)”}”(hŒ *py_sort*”h]”hŒpy_sort”…””}”(hhhj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj“ ubhŒ . Calling ”…””}”(hŒ . Calling ”hj“ hhhNhNubhj)”}”(hŒ*.js_sort *”h]”hŒ.js_sort ”…””}”(hhhjÕ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj“ ubhŒ from Python will invoke a ”…””}”(hj® hj“ ubhj)”}”(hŒ*sort*”h]”hŒsort”…””}”(hhhjç ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj“ ubhŒV method with JavaScript semantics, which in the generated JavaScript is simply called ”…””}”(hŒV method with JavaScript semantics, which in the generated JavaScript is simply called ”hj“ hhhNhNubhj)”}”(hŒ*sort*”h]”hŒsort”…””}”(hhhjú ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj“ ubhŒ0, as 3rd party JavaScript libraries will expect.”…””}”(hŒ0, as 3rd party JavaScript libraries will expect.”hj“ hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK¢hj“hhubhL)”}”(hŒÓCalling *__pragma__ ('noalias', )* will remove the alias. Calling *__pragma__ ('noalias')* without second parameter will remove all aliases. WARNING: This will also remove the predefined aliases.”h]”(hŒCalling ”…””}”(hŒCalling ”hj hhhNhNubhj)”}”(hŒ**__pragma__ ('noalias', )*”h]”hŒ,__pragma__ (‘noalias’, )”…””}”(hhhj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj ubhŒ will remove the alias. Calling ”…””}”(hŒ will remove the alias. Calling ”hj hhhNhNubhj)”}”(hŒ*__pragma__ ('noalias')*”h]”hŒ__pragma__ (‘noalias’)”…””}”(hhhj/ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj ubhŒi without second parameter will remove all aliases. WARNING: This will also remove the predefined aliases.”…””}”(hŒi without second parameter will remove all aliases. WARNING: This will also remove the predefined aliases.”hj hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK¤hj“hhubhL)”}”(hXžThe alias mechanism is vital to both the compactness and speed of code generated by Transcrypt and to its seamless integration with JavaScript. It allows Transcrypt to extend native JavaScript objects without causing name conflicts even when JavaScript gets expanded over the years, but also without any conversions or other overhead. That's why in Transcrypt this approach is favored over wrapping native objects.”h]”hX The alias mechanism is vital to both the compactness and speed of code generated by Transcrypt and to its seamless integration with JavaScript. It allows Transcrypt to extend native JavaScript objects without causing name conflicts even when JavaScript gets expanded over the years, but also without any conversions or other overhead. That’s why in Transcrypt this approach is favored over wrapping native objects.”…””}”(hjJ hjH hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK¦hj“hhubeh}”(h ]”(j‚Œ3identifier-aliasing-pragma-alias-and-pragma-noalias”eh"]”h$]”(ŒNidentifier aliasing: __pragma__ ('alias', ...) and __pragma__ ('noalias', ...)”Œ pragma_alias”eh&]”h(]”uh*h hh hhhh+hKyjh}”j\ jxsjj}”j‚jxsubh )”}”(hhh]”(h)”}”(hŒ^Generating __doc__ attributes from docstrings: __pragma__ ('docat') and __pragma__ ('nodocat')”h]”hŒfGenerating __doc__ attributes from docstrings: __pragma__ (‘docat’) and __pragma__ (‘nodocat’)”…””}”(hjf hjd hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhja hhhh+hK©ubhL)”}”(hXEven though docstrings may be present in your code, by default *__doc__* attributes are not generated, to keep the generated JavaScript code lean. You can switch on and off generation of *__doc__* attributes for modules, classes, methods and functions with *__pragma__ ('docat')* and *__pragma__ ('nodocat')* respectively. There's also a *-d* / *--docat* command line switch, which can be overruled per module by *__pragma__ ('nodocat')*. Advice: Though these pragma's are flexible, its advisable to use them only at the spot indicated in the :ref:`docstrings testlet `, to retain CPython compatibility. Note that *__pragma__ ('docat')* follows rather than precedes the module docstring, since CPython dictates the module docstring to be the first statement in a module.”h]”(hŒ?Even though docstrings may be present in your code, by default ”…””}”(hŒ?Even though docstrings may be present in your code, by default ”hjr hhhNhNubhj)”}”(hŒ *__doc__*”h]”hŒ__doc__”…””}”(hhhj{ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjr ubhŒs attributes are not generated, to keep the generated JavaScript code lean. You can switch on and off generation of ”…””}”(hŒs attributes are not generated, to keep the generated JavaScript code lean. You can switch on and off generation of ”hjr hhhNhNubhj)”}”(hŒ *__doc__*”h]”hŒ__doc__”…””}”(hhhjŽ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjr ubhŒ= attributes for modules, classes, methods and functions with ”…””}”(hŒ= attributes for modules, classes, methods and functions with ”hjr hhhNhNubhj)”}”(hŒ*__pragma__ ('docat')*”h]”hŒ__pragma__ (‘docat’)”…””}”(hhhj¡ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjr ubhŒ and ”…””}”(hŒ and ”hjr hhhNhNubhj)”}”(hŒ*__pragma__ ('nodocat')*”h]”hŒ__pragma__ (‘nodocat’)”…””}”(hhhj´ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjr ubhŒ respectively. There’s also a ”…””}”(hŒ respectively. There's also a ”hjr hhhNhNubhj)”}”(hŒ*-d*”h]”hŒ-d”…””}”(hhhjÇ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjr ubhŒ / ”…””}”(hŒ / ”hjr hhhNhNubhj)”}”(hŒ *--docat*”h]”hŒ–docat”…””}”(hhhjÚ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjr ubhŒ; command line switch, which can be overruled per module by ”…””}”(hŒ; command line switch, which can be overruled per module by ”hjr hhhNhNubhj)”}”(hŒ*__pragma__ ('nodocat')*”h]”hŒ__pragma__ (‘nodocat’)”…””}”(hhhjí ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjr ubhŒl. Advice: Though these pragma’s are flexible, its advisable to use them only at the spot indicated in the ”…””}”(hŒj. Advice: Though these pragma's are flexible, its advisable to use them only at the spot indicated in the ”hjr hhhNhNubjù)”}”(hŒ/:ref:`docstrings testlet `”h]”jÿ)”}”(hj h]”hŒdocstrings testlet”…””}”(hhhj ubah}”(h ]”h"]”(j Œstd”Œstd-ref”eh$]”h&]”h(]”uh*jþhj ubah}”(h ]”h"]”h$]”h&]”h(]”Œrefdoc”jŒ refdomain”j Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjŒautotest_docstrings”uh*jøhh+hKªhjr ubhŒ-, to retain CPython compatibility. Note that ”…””}”(hŒ-, to retain CPython compatibility. Note that ”hjr hhhNhNubhj)”}”(hŒ*__pragma__ ('docat')*”h]”hŒ__pragma__ (‘docat’)”…””}”(hhhj% ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjr ubhŒ† follows rather than precedes the module docstring, since CPython dictates the module docstring to be the first statement in a module.”…””}”(hŒ† follows rather than precedes the module docstring, since CPython dictates the module docstring to be the first statement in a module.”hjr hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKªhja hhubeh}”(h ]”ŒIgenerating-doc-attributes-from-docstrings-pragma-docat-and-pragma-nodocat”ah"]”h$]”Œ^generating __doc__ attributes from docstrings: __pragma__ ('docat') and __pragma__ ('nodocat')”ah&]”h(]”uh*h hh hhhh+hK©ubh )”}”(hhh]”(h)”}”(hŒkSkipping Transcrypt code fragments when running with CPython: __pragma__ ('ecom') and __pragma__ ('noecom')”h]”hŒsSkipping Transcrypt code fragments when running with CPython: __pragma__ (‘ecom’) and __pragma__ (‘noecom’)”…””}”(hjK hjI hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjF hhhh+hK­ubhL)”}”(hX2Executable comments are specially formatted comments, that are turned into executable statements by Transcrypt but, by nature, skipped by CPython. There are two types of executable comments: single-line and multi-line. Single-line executable comments start with #? at the current indentation level. Multi-line executable comments start with *'''?* or *"""?* and end with *?'''* or *?"""*, again at the current indentation level. There's also a *-ecom* command line switch, that can be annihilated locally by *__pragma__ ('noecom')* or its single line equivalent.”h]”(hXUExecutable comments are specially formatted comments, that are turned into executable statements by Transcrypt but, by nature, skipped by CPython. There are two types of executable comments: single-line and multi-line. Single-line executable comments start with #? at the current indentation level. Multi-line executable comments start with ”…””}”(hXUExecutable comments are specially formatted comments, that are turned into executable statements by Transcrypt but, by nature, skipped by CPython. There are two types of executable comments: single-line and multi-line. Single-line executable comments start with #? at the current indentation level. Multi-line executable comments start with ”hjW hhhNhNubhj)”}”(hŒ*'''?*”h]”hŒ ‘’’?”…””}”(hhhj` ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjW ubhŒ or ”…””}”(hŒ or ”hjW hhhNhNubhj)”}”(hŒ*"""?*”h]”hŒ “â€â€?”…””}”(hhhjs ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjW ubhŒ and end with ”…””}”(hŒ and end with ”hjW hhhNhNubhj)”}”(hŒ*?'''*”h]”hŒ ?’’’”…””}”(hhhj† ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjW ubhŒ or ”…””}”(hjr hjW ubhj)”}”(hŒ*?"""*”h]”hŒ ?â€â€â€”…””}”(hhhj˜ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjW ubhŒ;, again at the current indentation level. There’s also a ”…””}”(hŒ9, again at the current indentation level. There's also a ”hjW hhhNhNubhj)”}”(hŒ*-ecom*”h]”hŒ-ecom”…””}”(hhhj« ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjW ubhŒ9 command line switch, that can be annihilated locally by ”…””}”(hŒ9 command line switch, that can be annihilated locally by ”hjW hhhNhNubhj)”}”(hŒ*__pragma__ ('noecom')*”h]”hŒ__pragma__ (‘noecom’)”…””}”(hhhj¾ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjW ubhŒ or its single line equivalent.”…””}”(hŒ or its single line equivalent.”hjW hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK®hjF hhubhL)”}”(hŒÌIf you want the opposite, skipping code in Transcrypt but executing it with CPython, use the the :ref:`__pragma__ ('skip') ... __pragma__ ('noskip') ` pair or its single-line variety.”h]”(hŒbIf you want the opposite, skipping code in Transcrypt but executing it with CPython, use the the ”…””}”(hŒbIf you want the opposite, skipping code in Transcrypt but executing it with CPython, use the the ”hj× hhhNhNubjù)”}”(hŒI:ref:`__pragma__ ('skip') ... __pragma__ ('noskip') `”h]”jÿ)”}”(hjâ h]”hŒ5__pragma__ (‘skip’) … __pragma__ (‘noskip’)”…””}”(hhhjä ubah}”(h ]”h"]”(j Œstd”Œstd-ref”eh$]”h&]”h(]”uh*jþhjà ubah}”(h ]”h"]”h$]”h&]”h(]”Œrefdoc”jŒ refdomain”jî Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjŒskipping_fragments”uh*jøhh+hK²hj× ubhŒ! pair or its single-line variety.”…””}”(hŒ! pair or its single-line variety.”hj× hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK²hjF hhubhL)”}”(hŒDAn example of skipping code on either platform is the testlet below:”h]”hŒDAn example of skipping code on either platform is the testlet below:”…””}”(hj hj hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK´hjF hhubja )”}”(hhh]”(jf )”}”(hŒjThe use of executable comments and, for the opposite effect, __pragma__ ('skip') and __pragma__ ('noskip')”h]”hŒrThe use of executable comments and, for the opposite effect, __pragma__ (‘skip’) and __pragma__ (‘noskip’)”…””}”(hj hj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*je hh+hK¶hj ubjv )”}”(hXjfrom org.transcrypt.stubs.browser import __pragma__ def run (autoTester): # __pragma__ ('ecom') # =================================================================== # --- Executed only by Transcrypt --- '''? for i in range (10): autoTester.check (i) ?''' # --- Executed only by CPython --- # __pragma__ ('skip') for i in range (10): autoTester.check (i) # __pragma__ ('noskip') # --- Executed only by Transcrypt --- #?autoTester.check (100) # --- Executed only by CPython --- autoTester.check (100) #__: skip #__pragma__ ('noecom') # =================================================================== # --- Executed by none --- '''? for i in range (10, 20): autoTester.check (i) ?''' # --- Executed by none --- #?autoTester.check (200) __pragma__ ('ecom') # =================================================================== # --- Executed only by Transcrypt --- '''? for i in range (20, 30): autoTester.check (i) ?''' # --- Executed only by CPython --- # __pragma__ ('skip') for i in range (20, 30): autoTester.check (i) # __pragma__ ('noskip') # --- Executed only by Transcrypt --- #?autoTester.check (300) # --- Executed only by CPython --- autoTester.check (300) #__: skip __pragma__ ('noecom') # =================================================================== # --- Executed by none --- '''? for i in range (30, 40): autoTester.check (i) ?''' # --- Executed by none --- #?autoTester.check (400) ”h]”hXjfrom org.transcrypt.stubs.browser import __pragma__ def run (autoTester): # __pragma__ ('ecom') # =================================================================== # --- Executed only by Transcrypt --- '''? for i in range (10): autoTester.check (i) ?''' # --- Executed only by CPython --- # __pragma__ ('skip') for i in range (10): autoTester.check (i) # __pragma__ ('noskip') # --- Executed only by Transcrypt --- #?autoTester.check (100) # --- Executed only by CPython --- autoTester.check (100) #__: skip #__pragma__ ('noecom') # =================================================================== # --- Executed by none --- '''? for i in range (10, 20): autoTester.check (i) ?''' # --- Executed by none --- #?autoTester.check (200) __pragma__ ('ecom') # =================================================================== # --- Executed only by Transcrypt --- '''? for i in range (20, 30): autoTester.check (i) ?''' # --- Executed only by CPython --- # __pragma__ ('skip') for i in range (20, 30): autoTester.check (i) # __pragma__ ('noskip') # --- Executed only by Transcrypt --- #?autoTester.check (300) # --- Executed only by CPython --- autoTester.check (300) #__: skip __pragma__ ('noecom') # =================================================================== # --- Executed by none --- '''? for i in range (30, 40): autoTester.check (i) ?''' # --- Executed by none --- #?autoTester.check (400) ”…””}”(hhhj* ubah}”(h ]”h"]”h$]”h&]”h(]”Œsource”Œ/home/jac/active/geatec/transcrypt/Transcrypt/transcrypt/development/automated_tests/transcrypt/executable_comments/__init__.py”j‡ jˆ j‰ ‰jŠ }”jŒ Ksuh*ju hh+hK¶hj ubeh}”(h ]”Œid3”ah"]”j‘ ah$]”h&]”h(]”Œ literal_block”ˆuh*j` hjF hhhhhNubeh}”(h ]”ŒZskipping-transcrypt-code-fragments-when-running-with-cpython-pragma-ecom-and-pragma-noecom”ah"]”h$]”Œkskipping transcrypt code fragments when running with cpython: __pragma__ ('ecom') and __pragma__ ('noecom')”ah&]”h(]”uh*h hh hhhh+hK­ubh )”}”(hhh]”(h)”}”(hŒXSurpassing the speed of native JavaScript: __pragma__ ('fcall') and __pragma ('nofcall')”h]”hŒ`Surpassing the speed of native JavaScript: __pragma__ (‘fcall’) and __pragma (‘nofcall’)”…””}”(hjP hjN hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjK hhhh+hK»ubhL)”}”(hXXFast calls or fcalls are method calls where the method isn't an attribute of an object's prototype, but of the object itself, even if this method is inherited over multiple levels. This means that only for the first call the prototype chain is searched and the method is bound to the object. All subsequent calls invoke the bound method directly on the object. You can use the -f command line switch to generate fcall's pervasively, making your objects slightly larger since they will contain references to their methods. If you don't want that, just place the definition of the method(s) or class(es) you wish to optimize between *__pragma__ ('fcall')* and *__pragma__ ('nofcall')*. You can also do the opposite, using the -f switch and exempting some method(s) or class(es) by embedding them between *__pragma__ ('nofcall')* and *__pragma__ ('fcall')*.”h]”(hXFast calls or fcalls are method calls where the method isn’t an attribute of an object’s prototype, but of the object itself, even if this method is inherited over multiple levels. This means that only for the first call the prototype chain is searched and the method is bound to the object. All subsequent calls invoke the bound method directly on the object. You can use the -f command line switch to generate fcall’s pervasively, making your objects slightly larger since they will contain references to their methods. If you don’t want that, just place the definition of the method(s) or class(es) you wish to optimize between ”…””}”(hXyFast calls or fcalls are method calls where the method isn't an attribute of an object's prototype, but of the object itself, even if this method is inherited over multiple levels. This means that only for the first call the prototype chain is searched and the method is bound to the object. All subsequent calls invoke the bound method directly on the object. You can use the -f command line switch to generate fcall's pervasively, making your objects slightly larger since they will contain references to their methods. If you don't want that, just place the definition of the method(s) or class(es) you wish to optimize between ”•:hj\ hhhNhNubhj)”}”(hŒ*__pragma__ ('fcall')*”h]”hŒ__pragma__ (‘fcall’)”…””}”(hhhje ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj\ ubhŒ and ”…””}”(hŒ and ”hj\ hhhNhNubhj)”}”(hŒ*__pragma__ ('nofcall')*”h]”hŒ__pragma__ (‘nofcall’)”…””}”(hhhjx ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj\ ubhŒx. You can also do the opposite, using the -f switch and exempting some method(s) or class(es) by embedding them between ”…””}”(hŒx. You can also do the opposite, using the -f switch and exempting some method(s) or class(es) by embedding them between ”hj\ hhhNhNubhj)”}”(hŒ*__pragma__ ('nofcall')*”h]”hŒ__pragma__ (‘nofcall’)”…””}”(hhhj‹ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj\ ubhŒ and ”…””}”(hjw hj\ ubhj)”}”(hŒ*__pragma__ ('fcall')*”h]”hŒ__pragma__ (‘fcall’)”…””}”(hhhj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj\ ubhŒ.”…””}”(hhèhj\ hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK¼hjK hhubhL)”}”(hXøNote that these pragmas have to be applied on the function definition location rather than the call location. Placing *__pragma__ ('fcall')* or *__pragma__ ('nofcall')* at the beginning of a module will influence all methods defined in that module. The fcall mechanism is a form of memoization and one example of a transpiler being able to generate optimized code that surpasses common hand coding practice. The fcall mechanism influences neither the pure Python syntax nor the semantics of your program.”h]”(hŒvNote that these pragmas have to be applied on the function definition location rather than the call location. Placing ”…””}”(hŒvNote that these pragmas have to be applied on the function definition location rather than the call location. Placing ”hjµ hhhNhNubhj)”}”(hŒ*__pragma__ ('fcall')*”h]”hŒ__pragma__ (‘fcall’)”…””}”(hhhj¾ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjµ ubhŒ or ”…””}”(hŒ or ”hjµ hhhNhNubhj)”}”(hŒ*__pragma__ ('nofcall')*”h]”hŒ__pragma__ (‘nofcall’)”…””}”(hhhjÑ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjµ ubhXP at the beginning of a module will influence all methods defined in that module. The fcall mechanism is a form of memoization and one example of a transpiler being able to generate optimized code that surpasses common hand coding practice. The fcall mechanism influences neither the pure Python syntax nor the semantics of your program.”…””}”(hXP at the beginning of a module will influence all methods defined in that module. The fcall mechanism is a form of memoization and one example of a transpiler being able to generate optimized code that surpasses common hand coding practice. The fcall mechanism influences neither the pure Python syntax nor the semantics of your program.”hjµ hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK¾hjK hhubeh}”(h ]”ŒIsurpassing-the-speed-of-native-javascript-pragma-fcall-and-pragma-nofcall”ah"]”h$]”ŒXsurpassing the speed of native javascript: __pragma__ ('fcall') and __pragma ('nofcall')”ah&]”h(]”uh*h hh hhhh+hK»ubh )”}”(hhh]”(h)”}”(hŒMEnabling Pythons *send* syntax: __pragma__ ('gsend') and __pragma ('nogsend')”h]”(hŒEnabling Pythons ”…””}”(hŒEnabling Pythons ”hjõ hhhNhNubhj)”}”(hŒ*send*”h]”hŒsend”…””}”(hhhjþ ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjõ ubhŒ> syntax: __pragma__ (‘gsend’) and __pragma (‘nogsend’)”…””}”(hŒ6 syntax: __pragma__ ('gsend') and __pragma ('nogsend')”hjõ hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hhjò hhhh+hKÁubhL)”}”(hŒ¤These pragmas enable respectively disable use of Pythons *send* syntax for generators, which is disabled by default. An example of its use is in the following code:”h]”(hŒ9These pragmas enable respectively disable use of Pythons ”…””}”(hŒ9These pragmas enable respectively disable use of Pythons ”hjhhhNhNubhj)”}”(hŒ*send*”h]”hŒsend”…””}”(hhhj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjubhŒe syntax for generators, which is disabled by default. An example of its use is in the following code:”…””}”(hŒe syntax for generators, which is disabled by default. An example of its use is in the following code:”hjhhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKÃhjò hhubja )”}”(hhh]”(jf )”}”(hŒIUse of __pragma__ ('gsend') to enable Pythons *send* syntax fo generators”h]”(hŒ2Use of __pragma__ (‘gsend’) to enable Pythons ”…””}”(hŒ.Use of __pragma__ ('gsend') to enable Pythons ”hj<ubhj)”}”(hŒ*send*”h]”hŒsend”…””}”(hhhjEubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj<ubhŒ syntax fo generators”…””}”(hŒ syntax fo generators”hj<ubeh}”(h ]”h"]”h$]”h&]”h(]”uh*je hh+hKÅhj9ubjv )”}”(hX© __pragma__ ('gsend') def test0 (): r = 0 while True: r = r + (yield r) gen0 = test0() next (gen0) autoTester.check (gen0.send (1)) autoTester.check (gen0.send (2)) def test1 (): r = 0 while True: r = (yield r) + r gen1 = test1() next (gen1) autoTester.check (gen1.send (3)) autoTester.check (gen1.send (4)) ”h]”hX© __pragma__ ('gsend') def test0 (): r = 0 while True: r = r + (yield r) gen0 = test0() next (gen0) autoTester.check (gen0.send (1)) autoTester.check (gen0.send (2)) def test1 (): r = 0 while True: r = (yield r) + r gen1 = test1() next (gen1) autoTester.check (gen1.send (3)) autoTester.check (gen1.send (4)) ”…””}”(hhhj^ubah}”(h ]”h"]”h$]”h&]”h(]”Œsource”Œ„/home/jac/active/geatec/transcrypt/Transcrypt/transcrypt/development/automated_tests/transcrypt/iterators_and_generators/__init__.py”j‡ jˆ j‰ ‰jŠ }”jŒ Ksuh*ju hh+hKÅhj9ubeh}”(h ]”Œid4”ah"]”j‘ ah$]”h&]”h(]”Œ literal_block”ˆuh*j` hjò hhhhhNubeh}”(h ]”Œ), __pragma__ ('ifndef', ), __pragma__ ('else') and __pragma__ ('endif')”h]”hŒ–Conditional compilation: __pragma__ (‘ifdef’, ), __pragma__ (‘ifndef’, ), __pragma__ (‘else’) and __pragma__ (‘endif’)”…””}”(hj)hj'hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhj$hhhh+hKÒubhL)”}”(hŒ¦A piece of code in between *__pragma__ ('ifdef', )* and *__pragma__ ('endif')* will only be compiled if occurs in the global list of defined symbols.”h]”(hŒA piece of code in between ”…””}”(hŒA piece of code in between ”hj5hhhNhNubhj)”}”(hŒ *__pragma__ ('ifdef', )*”h]”hŒ"__pragma__ (‘ifdef’, )”…””}”(hhhj>ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj5ubhŒ and ”…””}”(hŒ and ”hj5hhhNhNubhj)”}”(hŒ*__pragma__ ('endif')*”h]”hŒ__pragma__ (‘endif’)”…””}”(hhhjQubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj5ubhŒP will only be compiled if occurs in the global list of defined symbols.”…””}”(hŒP will only be compiled if occurs in the global list of defined symbols.”hj5hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKÓhj$hhubhL)”}”(hŒÐThis pragma works mainly in combination with the *-s* / *--symbols * command line option. On top of that, some command line options automatically add symbols, without using the *-s* switch.”h]”(hŒ1This pragma works mainly in combination with the ”…””}”(hŒ1This pragma works mainly in combination with the ”hjjhhhNhNubhj)”}”(hŒ*-s*”h]”hŒ-s”…””}”(hhhjsubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjjubhŒ / ”…””}”(hŒ / ”hjjhhhNhNubhj)”}”(hŒ*--symbols *”h]”hŒ–symbols ”…””}”(hhhj†ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjjubhŒm command line option. On top of that, some command line options automatically add symbols, without using the ”…””}”(hŒm command line option. On top of that, some command line options automatically add symbols, without using the ”hjjhhhNhNubhj)”}”(hŒ*-s*”h]”hŒ-s”…””}”(hhhj™ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjjubhŒ switch.”…””}”(hŒ switch.”hjjhhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKÕhj$hhubhL)”}”(hŒTODO: Add example”h]”hŒTODO: Add example”…””}”(hj´hj²hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hK×hj$hhubhL)”}”(hŒìCode after *__pragma__ ('ifndef', )* is compiled if is NOT defined. To choose between two alternative source code blocks, precede the second block with *__pragma__ ('else')* and terminate it with *__pragma__ ('endif')*.”h]”(hŒ Code after ”…””}”(hŒ Code after ”hjÀhhhNhNubhj)”}”(hŒ!*__pragma__ ('ifndef', )*”h]”hŒ#__pragma__ (‘ifndef’, )”…””}”(hhhjÉubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjÀubhŒ} is compiled if is NOT defined. To choose between two alternative source code blocks, precede the second block with ”…””}”(hŒ} is compiled if is NOT defined. To choose between two alternative source code blocks, precede the second block with ”hjÀhhhNhNubhj)”}”(hŒ*__pragma__ ('else')*”h]”hŒ__pragma__ (‘else’)”…””}”(hhhjÜubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjÀubhŒ and terminate it with ”…””}”(hŒ and terminate it with ”hjÀhhhNhNubhj)”}”(hŒ*__pragma__ ('endif')*”h]”hŒ__pragma__ (‘endif’)”…””}”(hhhjïubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjÀubhŒ.”…””}”(hhèhjÀhhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKÙhj$hhubhL)”}”(hŒŒImportant: The conditional compilation pragma's also work when placed at the start of a line in precompiled or hand-written JavaScript code.”h]”hŒŽImportant: The conditional compilation pragma’s also work when placed at the start of a line in precompiled or hand-written JavaScript code.”…””}”(hj hjhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKÛhj$hhubh-)”}”(hŒ.. _pragma_js:”h]”h}”(h ]”h"]”h$]”h&]”h(]”h8Œ pragma-js”uh*h,hKÝhj$hhhh+ubeh}”(h ]”(Œ]conditional-compilation-pragma-ifdef-symbol-pragma-ifndef-symbol-pragma-else-and-pragma-endif”jeh"]”h$]”(Œ†conditional compilation: __pragma__ ('ifdef', ), __pragma__ ('ifndef', ), __pragma__ ('else') and __pragma__ ('endif')”Œ pragma_ifdef”eh&]”h(]”uh*h hh hhhh+hKÒjh}”j&jsjj}”jjsubh )”}”(hhh]”(h)”}”(hŒJInserting literal JavaScript: __pragma__ ('js', ...) and __include__ (...)”h]”hŒNInserting literal JavaScript: __pragma__ (‘js’, …) and __include__ (…)”…””}”(hj0hj.hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhj+hhhh+hKàubhL)”}”(hŒáDuring compilation the *__pragma__ ('js', code, )* is replaced by the JavaScript code given in the *code* parameter. This code is formatted using the Python *str.format* method, using **.”h]”(hŒDuring compilation the ”…””}”(hŒDuring compilation the ”hj<hhhNhNubhj)”}”(hŒ.*__pragma__ ('js', code, )*”h]”hŒ0__pragma__ (‘js’, code, )”…””}”(hhhjEubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj<ubhŒ1 is replaced by the JavaScript code given in the ”…””}”(hŒ1 is replaced by the JavaScript code given in the ”hj<hhhNhNubhj)”}”(hŒ*code*”h]”hŒcode”…””}”(hhhjXubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj<ubhŒ4 parameter. This code is formatted using the Python ”…””}”(hŒ4 parameter. This code is formatted using the Python ”hj<hhhNhNubhj)”}”(hŒ *str.format*”h]”hŒ str.format”…””}”(hhhjkubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj<ubhŒ method, using ”…””}”(hŒ method, using ”hj<hhhNhNubhj)”}”(hŒ**”h]”hŒ”…””}”(hhhj~ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj<ubhŒ.”…””}”(hhèhj<hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKáhj+hhubhL)”}”(hXíAn example of its use is to encapsulate a JavaScript library as a Python module, as is :ref:`shown for the fabric.js library `. In that case there's usually one format parameter, namely a call to *__include__ ()*. The module path is either relative to the directory holding the main module of your project, or to the root of the modules directory, and searched in that order. So modules local to your project prevail over generally available modules.”h]”(hŒWAn example of its use is to encapsulate a JavaScript library as a Python module, as is ”…””}”(hŒWAn example of its use is to encapsulate a JavaScript library as a Python module, as is ”hj–hhhNhNubjù)”}”(hŒ<:ref:`shown for the fabric.js library `”h]”jÿ)”}”(hj¡h]”hŒ shown for the fabric.js library”…””}”(hhhj£ubah}”(h ]”h"]”(j Œstd”Œstd-ref”eh$]”h&]”h(]”uh*jþhjŸubah}”(h ]”h"]”h$]”h&]”h(]”Œrefdoc”jŒ refdomain”j­Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjŒcode_encaps_fabric”uh*jøhh+hKãhj–ubhŒH. In that case there’s usually one format parameter, namely a call to ”…””}”(hŒF. In that case there's usually one format parameter, namely a call to ”hj–hhhNhNubhj)”}”(hŒ&*__include__ ()*”h]”hŒ$__include__ ()”…””}”(hhhjÄubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj–ubhŒî. The module path is either relative to the directory holding the main module of your project, or to the root of the modules directory, and searched in that order. So modules local to your project prevail over generally available modules.”…””}”(hŒî. The module path is either relative to the directory holding the main module of your project, or to the root of the modules directory, and searched in that order. So modules local to your project prevail over generally available modules.”hj–hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKãhj+hhubhL)”}”(hX8Note that since {} is used as placeholder in Python formatting, any normal { and } in your JavaScript in the code parameter have to be doubled. If you just want to include a literal piece of JavaScript without any replacements, you can avoid this doubling by using __pragma__ ('js', '{}', ).”h]”hX@Note that since {} is used as placeholder in Python formatting, any normal { and } in your JavaScript in the code parameter have to be doubled. If you just want to include a literal piece of JavaScript without any replacements, you can avoid this doubling by using __pragma__ (‘js’, ‘{}’, ).”…””}”(hjßhjÝhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKåhj+hhubeh}”(h ]”(Œ2inserting-literal-javascript-pragma-js-and-include”jeh"]”h$]”(ŒJinserting literal javascript: __pragma__ ('js', ...) and __include__ (...)”Œ pragma_js”eh&]”h(]”uh*h hh hhhh+hKàjh}”jñjsjj}”jjsubh )”}”(hhh]”(h)”}”(hŒ1__pragma__ ('jskeys') and __pragma__ ('nojskeys')”h]”hŒ9__pragma__ (‘jskeys’) and __pragma__ (‘nojskeys’)”…””}”(hjûhjùhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjöhhhh+hKèubhL)”}”(hXENormally in Python, dictionary keys without quotes are interpreted as identifiers and dictionary keys with quotes as string literals. This is more flexible than the JavaScript approach, where dictionary keys with or without quotes are always interpreted as string literals. However to better match the documentation and habits with some JavaScript libraries, such as plotly.js, dictionary keys without quotes can be optionally interpreted as string literals. While the -jk command line switch achieves this globally, the preferred way is to switch on and off this facility locally.”h]”hXENormally in Python, dictionary keys without quotes are interpreted as identifiers and dictionary keys with quotes as string literals. This is more flexible than the JavaScript approach, where dictionary keys with or without quotes are always interpreted as string literals. However to better match the documentation and habits with some JavaScript libraries, such as plotly.js, dictionary keys without quotes can be optionally interpreted as string literals. While the -jk command line switch achieves this globally, the preferred way is to switch on and off this facility locally.”…””}”(hj hjhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKéhjöhhubeh}”(h ]”Œ!pragma-jskeys-and-pragma-nojskeys”ah"]”h$]”Œ1__pragma__ ('jskeys') and __pragma__ ('nojskeys')”ah&]”h(]”uh*h hh hhhh+hKèubh )”}”(hhh]”(h)”}”(hŒGKeeping your code lean: __pragma__ ('jsmod') and __pragma__ ('nojsmod')”h]”hŒOKeeping your code lean: __pragma__ (‘jsmod’) and __pragma__ (‘nojsmod’)”…””}”(hj"hj hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjhhhh+hKìubhL)”}”(hŒÒWhen *__pragma__ ('jsmod')* is active, *%* has JavaScript rather than Python semantics. While the -jm command line switch achieves this globally, the preferred way is to switch on and off this facility locally.”h]”(hŒWhen ”…””}”(hŒWhen ”hj.hhhNhNubhj)”}”(hŒ*__pragma__ ('jsmod')*”h]”hŒ__pragma__ (‘jsmod’)”…””}”(hhhj7ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj.ubhŒ is active, ”…””}”(hŒ is active, ”hj.hhhNhNubhj)”}”(hŒ*%*”h]”hŒ%”…””}”(hhhjJubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj.ubhŒ¨ has JavaScript rather than Python semantics. While the -jm command line switch achieves this globally, the preferred way is to switch on and off this facility locally.”…””}”(hŒ¨ has JavaScript rather than Python semantics. While the -jm command line switch achieves this globally, the preferred way is to switch on and off this facility locally.”hj.hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKíhjhhubeh}”(h ]”Œ6keeping-your-code-lean-pragma-jsmod-and-pragma-nojsmod”ah"]”h$]”ŒGkeeping your code lean: __pragma__ ('jsmod') and __pragma__ ('nojsmod')”ah&]”h(]”uh*h hh hhhh+hKìubh )”}”(hhh]”(h)”}”(hŒ5__pragma__ ('keycheck') and __pragma__ ('nokeycheck')”h]”hŒ=__pragma__ (‘keycheck’) and __pragma__ (‘nokeycheck’)”…””}”(hjphjnhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjkhhhh+hKðubhL)”}”(hXWhen *__pragma__ ('keycheck')* is active, an attempt to retrieve an element from a dictionary via a non-existing key results in a KeyError being raised, unless it happens at the lefthand side of an augmented assignment. The run time support for this is expensive, as it requires passing the result of every such retrieval to a function that checks the definedness of the result. While the -kc command line switch switches key checking on globally, the preferred way is to switch on and off this facility locally to prevent code bloat.”h]”(hŒWhen ”…””}”(hŒWhen ”hj|hhhNhNubhj)”}”(hŒ*__pragma__ ('keycheck')*”h]”hŒ__pragma__ (‘keycheck’)”…””}”(hhhj…ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj|ubhXø is active, an attempt to retrieve an element from a dictionary via a non-existing key results in a KeyError being raised, unless it happens at the lefthand side of an augmented assignment. The run time support for this is expensive, as it requires passing the result of every such retrieval to a function that checks the definedness of the result. While the -kc command line switch switches key checking on globally, the preferred way is to switch on and off this facility locally to prevent code bloat.”…””}”(hXø is active, an attempt to retrieve an element from a dictionary via a non-existing key results in a KeyError being raised, unless it happens at the lefthand side of an augmented assignment. The run time support for this is expensive, as it requires passing the result of every such retrieval to a function that checks the definedness of the result. While the -kc command line switch switches key checking on globally, the preferred way is to switch on and off this facility locally to prevent code bloat.”hj|hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKñhjkhhubeh}”(h ]”Œ%pragma-keycheck-and-pragma-nokeycheck”ah"]”h$]”Œ5__pragma__ ('keycheck') and __pragma__ ('nokeycheck')”ah&]”h(]”uh*h hh hhhh+hKðubh )”}”(hhh]”(h)”}”(hŒIKeeping your code lean: __pragma__ ('kwargs') and __pragma__ ('nokwargs')”h]”hŒQKeeping your code lean: __pragma__ (‘kwargs’) and __pragma__ (‘nokwargs’)”…””}”(hj«hj©hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhj¦hhhh+hKôubhL)”}”(hXàWhile it's possible to compile with the -k command line switch, allowing keyword arguments in all flavors supported by Python 3.5 in all places, this disadvised, as it leads to bloated code. It is better to use the 'kwargs' and 'nokwargs' pragmas, to enable this feature only at definition (as opposed to calling) of functions that require it. You'll find an example of how to use these pragma's in the :ref:`arguments autotest `. You can use them on whole modules or any part thereof. Note that at due to the dynamic nature of Python, use of keyword arguments at call time cannot be predicted at definition time. When running with CPython from the command prompt using the browser stubs, these pragma's are ignored.”h]”(hX¡While it’s possible to compile with the -k command line switch, allowing keyword arguments in all flavors supported by Python 3.5 in all places, this disadvised, as it leads to bloated code. It is better to use the ‘kwargs’ and ‘nokwargs’ pragmas, to enable this feature only at definition (as opposed to calling) of functions that require it. You’ll find an example of how to use these pragma’s in the ”…””}”(hX“While it's possible to compile with the -k command line switch, allowing keyword arguments in all flavors supported by Python 3.5 in all places, this disadvised, as it leads to bloated code. It is better to use the 'kwargs' and 'nokwargs' pragmas, to enable this feature only at definition (as opposed to calling) of functions that require it. You'll find an example of how to use these pragma's in the ”hj·hhhNhNubjù)”}”(hŒ.:ref:`arguments autotest `”h]”jÿ)”}”(hjÂh]”hŒarguments autotest”…””}”(hhhjÄubah}”(h ]”h"]”(j Œstd”Œstd-ref”eh$]”h&]”h(]”uh*jþhjÀubah}”(h ]”h"]”h$]”h&]”h(]”Œrefdoc”jŒ refdomain”jÎŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjŒautotest_arguments”uh*jøhh+hKõhj·ubhX!. You can use them on whole modules or any part thereof. Note that at due to the dynamic nature of Python, use of keyword arguments at call time cannot be predicted at definition time. When running with CPython from the command prompt using the browser stubs, these pragma’s are ignored.”…””}”(hX. You can use them on whole modules or any part thereof. Note that at due to the dynamic nature of Python, use of keyword arguments at call time cannot be predicted at definition time. When running with CPython from the command prompt using the browser stubs, these pragma's are ignored.”hj·hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKõhj¦hhubeh}”(h ]”Œ8keeping-your-code-lean-pragma-kwargs-and-pragma-nokwargs”ah"]”h$]”ŒIkeeping your code lean: __pragma__ ('kwargs') and __pragma__ ('nokwargs')”ah&]”h(]”uh*h hh hhhh+hKôubh )”}”(hhh]”(h)”}”(hŒ3Preventing target annotation: __pragma__ ('noanno')”h]”hŒ7Preventing target annotation: __pragma__ (‘noanno’)”…””}”(hjøhjöhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjóhhhh+hKøubhL)”}”(hXœThe -a command line switch will comment target code compiled from Python with source file names and source line numbers. Since this interferes with literal inclusion of JavaScript code with multi-line comments, it can be switched off by including *__pragma__ ('noanno')* at the beginning of a module. An example of this can be seen in the :ref:`encapsulation code for the fabric.js library `.”h]”(hŒ÷The -a command line switch will comment target code compiled from Python with source file names and source line numbers. Since this interferes with literal inclusion of JavaScript code with multi-line comments, it can be switched off by including ”…””}”(hŒ÷The -a command line switch will comment target code compiled from Python with source file names and source line numbers. Since this interferes with literal inclusion of JavaScript code with multi-line comments, it can be switched off by including ”hjhhhNhNubhj)”}”(hŒ*__pragma__ ('noanno')*”h]”hŒ__pragma__ (‘noanno’)”…””}”(hhhj ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjubhŒE at the beginning of a module. An example of this can be seen in the ”…””}”(hŒE at the beginning of a module. An example of this can be seen in the ”hjhhhNhNubjù)”}”(hŒH:ref:`encapsulation code for the fabric.js library `”h]”jÿ)”}”(hj"h]”hŒ,encapsulation code for the fabric.js library”…””}”(hhhj$ubah}”(h ]”h"]”(j Œstd”Œstd-ref”eh$]”h&]”h(]”uh*jþhj ubah}”(h ]”h"]”h$]”h&]”h(]”Œrefdoc”jŒ refdomain”j.Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjŒcode_encaps_fabric”uh*jøhh+hKùhjubhŒ.”…””}”(hhèhjhhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKùhjóhhubeh}”(h ]”Œ*preventing-target-annotation-pragma-noanno”ah"]”h$]”Œ3preventing target annotation: __pragma__ ('noanno')”ah&]”h(]”uh*h hh hhhh+hKøubh )”}”(hhh]”(h)”}”(hŒCOperator overloading: __pragma__ ('opov') and __pragma__ ('noopov')”h]”hŒKOperator overloading: __pragma__ (‘opov’) and __pragma__ (‘noopov’)”…””}”(hjWhjUhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjRhhhh+hKüubhL)”}”(hŒwTranscrypt currently supports overloading of the following operators: \*, /, +, -, @, [], (), ==, !=, <, <=, >, and >=.”h]”hŒwTranscrypt currently supports overloading of the following operators: *, /, +, -, @, [], (), ==, !=, <, <=, >, and >=.”…””}”(hŒwTranscrypt currently supports overloading of the following operators: \*, /, +, -, @, [], (), ==, !=, <, <=, >, and >=.”hjchhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKýhjRhhubhL)”}”(hXÆThese operators have been chosen since they can enhance the readability of computations involving matrices and vectors, enable the use of callable objects (functors) or are used to compare tuples, lists and sets. Using the -o command line switch will activate operator overloading globally. *This is strongly disadvised*, since even 1 + 2 will result in two function calls in that case. It's better to use *__pragma__ ('opov')* to switch it on locally and *__pragma__ ('noopov')* to switch it off again, activating operator overloading only for lines of code involving extensive matrix / vector computations or functor calls (as opposed to definitions), in which case the overhead is negligeable in most cases.”h]”(hX#These operators have been chosen since they can enhance the readability of computations involving matrices and vectors, enable the use of callable objects (functors) or are used to compare tuples, lists and sets. Using the -o command line switch will activate operator overloading globally. ”…””}”(hX#These operators have been chosen since they can enhance the readability of computations involving matrices and vectors, enable the use of callable objects (functors) or are used to compare tuples, lists and sets. Using the -o command line switch will activate operator overloading globally. ”hjrhhhNhNubhj)”}”(hŒ*This is strongly disadvised*”h]”hŒThis is strongly disadvised”…””}”(hhhj{ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjrubhŒX, since even 1 + 2 will result in two function calls in that case. It’s better to use ”…””}”(hŒV, since even 1 + 2 will result in two function calls in that case. It's better to use ”hjrhhhNhNubhj)”}”(hŒ*__pragma__ ('opov')*”h]”hŒ__pragma__ (‘opov’)”…””}”(hhhjŽubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjrubhŒ to switch it on locally and ”…””}”(hŒ to switch it on locally and ”hjrhhhNhNubhj)”}”(hŒ*__pragma__ ('noopov')*”h]”hŒ__pragma__ (‘noopov’)”…””}”(hhhj¡ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjrubhŒç to switch it off again, activating operator overloading only for lines of code involving extensive matrix / vector computations or functor calls (as opposed to definitions), in which case the overhead is negligeable in most cases.”…””}”(hŒç to switch it off again, activating operator overloading only for lines of code involving extensive matrix / vector computations or functor calls (as opposed to definitions), in which case the overhead is negligeable in most cases.”hjrhhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hKÿhjRhhubhL)”}”(hX³Formula v4 = M \* (v1 + v2) + v3 is probably preferred over v4 = add (mul (M, add (v1, v2), v3)), which by the way closely resembles the JavaScript that will be generated for the expression that uses overloaded + and \* operators. In order to support operator overloading your matrix and vector classes have to support the appropriate selection of functions out of *__mul__*, *__rmul__*, *__div__*, *__rdiv__*, *__add__*, *__radd__*, *__sub__*, *__rsub__*, *__matmul__*, *__rmatmul__*, *__getitem__*, *__setitem__* and *__call__* as described in the CPython documentation. The comparison operators are supported by the functions *__eq__*, *__ne__*, *__lt__*, *__le__*, *__gt__* and *__ge__*.”h]”(hXmFormula v4 = M * (v1 + v2) + v3 is probably preferred over v4 = add (mul (M, add (v1, v2), v3)), which by the way closely resembles the JavaScript that will be generated for the expression that uses overloaded + and * operators. In order to support operator overloading your matrix and vector classes have to support the appropriate selection of functions out of ”…””}”(hXmFormula v4 = M \* (v1 + v2) + v3 is probably preferred over v4 = add (mul (M, add (v1, v2), v3)), which by the way closely resembles the JavaScript that will be generated for the expression that uses overloaded + and \* operators. In order to support operator overloading your matrix and vector classes have to support the appropriate selection of functions out of ”hjºhhhNhNubhj)”}”(hŒ *__mul__*”h]”hŒ__mul__”…””}”(hhhjÃubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºhhhNhNubhj)”}”(hŒ *__rmul__*”h]”hŒ__rmul__”…””}”(hhhjÖubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºubhj)”}”(hŒ *__div__*”h]”hŒ__div__”…””}”(hhhjéubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºubhj)”}”(hŒ *__rdiv__*”h]”hŒ__rdiv__”…””}”(hhhjüubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºubhj)”}”(hŒ *__add__*”h]”hŒ__add__”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºubhj)”}”(hŒ *__radd__*”h]”hŒ__radd__”…””}”(hhhj"ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºubhj)”}”(hŒ *__sub__*”h]”hŒ__sub__”…””}”(hhhj5ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºubhj)”}”(hŒ *__rsub__*”h]”hŒ__rsub__”…””}”(hhhjHubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºubhj)”}”(hŒ *__matmul__*”h]”hŒ __matmul__”…””}”(hhhj[ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºubhj)”}”(hŒ *__rmatmul__*”h]”hŒ __rmatmul__”…””}”(hhhjnubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºubhj)”}”(hŒ *__getitem__*”h]”hŒ __getitem__”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºubhj)”}”(hŒ *__setitem__*”h]”hŒ __setitem__”…””}”(hhhj”ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ and ”…””}”(hŒ and ”hjºhhhNhNubhj)”}”(hŒ *__call__*”h]”hŒ__call__”…””}”(hhhj§ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒd as described in the CPython documentation. The comparison operators are supported by the functions ”…””}”(hŒd as described in the CPython documentation. The comparison operators are supported by the functions ”hjºhhhNhNubhj)”}”(hŒ*__eq__*”h]”hŒ__eq__”…””}”(hhhjºubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºubhj)”}”(hŒ*__ne__*”h]”hŒ__ne__”…””}”(hhhjÍubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºubhj)”}”(hŒ*__lt__*”h]”hŒ__lt__”…””}”(hhhjàubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hŒ, ”hjºubhj)”}”(hŒ*__le__*”h]”hŒ__le__”…””}”(hhhjóubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ, ”…””}”(hjÕhjºubhj)”}”(hŒ*__gt__*”h]”hŒ__gt__”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ and ”…””}”(hj¦hjºubhj)”}”(hŒ*__ge__*”h]”hŒ__ge__”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjºubhŒ.”…””}”(hhèhjºhhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hMhjRhhubh-)”}”(hŒ.. _skipping_fragments:”h]”h}”(h ]”h"]”h$]”h&]”h(]”h8Œskipping-fragments”uh*h,hMhjRhhhh+ubeh}”(h ]”Œ2operator-overloading-pragma-opov-and-pragma-noopov”ah"]”h$]”ŒCoperator overloading: __pragma__ ('opov') and __pragma__ ('noopov')”ah&]”h(]”uh*h hh hhhh+hKüubh )”}”(hhh]”(h)”}”(hŒWSkipping fragments while generating code: __pragma__ ('skip') and __pragma__ ('noskip')”h]”hŒ_Skipping fragments while generating code: __pragma__ (‘skip’) and __pragma__ (‘noskip’)”…””}”(hjGhjEhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjBhhhh+hMubhL)”}”(hXÄOn some occasions it's handy to be able to skip code generation for fragments of Python source. The most important use case is when you perform a static check using the :ref:`-c or --check ` command line switch. If you use global JavaScript names without importing them from some encapsulation module, you'll have to tell the static checker that these names are not to be flagged as undefined. Insert a line containing dummy definitions of the unknown names for the static checker, surrounded by *__pragma__ ('skip') and __pragma__ ('noskip')*, to make code generator skip these definitions. The beginning of the source code of the Pong demo, shown below, demonstates how this is done.”h]”(hŒ«On some occasions it’s handy to be able to skip code generation for fragments of Python source. The most important use case is when you perform a static check using the ”…””}”(hŒ©On some occasions it's handy to be able to skip code generation for fragments of Python source. The most important use case is when you perform a static check using the ”hjShhhNhNubjù)”}”(hŒ,:ref:`-c or --check `”h]”jÿ)”}”(hj^h]”hŒ-c or –check”…””}”(hhhj`ubah}”(h ]”h"]”(j Œstd”Œstd-ref”eh$]”h&]”h(]”uh*jþhj\ubah}”(h ]”h"]”h$]”h&]”h(]”Œrefdoc”jŒ refdomain”jjŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjŒcommand_line_switches”uh*jøhh+hMhjSubhX4 command line switch. If you use global JavaScript names without importing them from some encapsulation module, you’ll have to tell the static checker that these names are not to be flagged as undefined. Insert a line containing dummy definitions of the unknown names for the static checker, surrounded by ”…””}”(hX2 command line switch. If you use global JavaScript names without importing them from some encapsulation module, you'll have to tell the static checker that these names are not to be flagged as undefined. Insert a line containing dummy definitions of the unknown names for the static checker, surrounded by ”hjShhhNhNubhj)”}”(hŒ/*__pragma__ ('skip') and __pragma__ ('noskip')*”h]”hŒ5__pragma__ (‘skip’) and __pragma__ (‘noskip’)”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjSubhŒŽ, to make code generator skip these definitions. The beginning of the source code of the Pong demo, shown below, demonstates how this is done.”…””}”(hŒŽ, to make code generator skip these definitions. The beginning of the source code of the Pong demo, shown below, demonstates how this is done.”hjShhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hMhjBhhubja )”}”(hhh]”(jf )”}”(hŒ\Preventing complaints of the static checker about unknown global JavaScript names in pong.py”h]”hŒ\Preventing complaints of the static checker about unknown global JavaScript names in pong.py”…””}”(hjŸhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*je hh+hM hjšubjv )”}”(hXx__pragma__ ('skip') document = window = Math = Date = 0 # Prevent complaints by optional static checker __pragma__ ('noskip') __pragma__ ('noalias', 'clear') from com.fabricjs import fabric orthoWidth = 1000 orthoHeight = 750 fieldHeight = 650 enter, esc, space = 13, 27, 32 window.onkeydown = lambda event: event.keyCode != space # Prevent scrolldown on spacebar press ”h]”hXx__pragma__ ('skip') document = window = Math = Date = 0 # Prevent complaints by optional static checker __pragma__ ('noskip') __pragma__ ('noalias', 'clear') from com.fabricjs import fabric orthoWidth = 1000 orthoHeight = 750 fieldHeight = 650 enter, esc, space = 13, 27, 32 window.onkeydown = lambda event: event.keyCode != space # Prevent scrolldown on spacebar press ”…””}”(hhhj«ubah}”(h ]”h"]”h$]”h&]”h(]”Œsource”ŒK/home/jac/active/geatec/transcrypt/Transcrypt/transcrypt/demos/pong/pong.py”j‡ jˆ j‰ ‰jŠ }”jŒ Ksuh*ju hh+hM hjšubeh}”(h ]”Œid5”ah"]”j‘ ah$]”h&]”h(]”Œ literal_block”ˆuh*j` hjBhhhhhNubeh}”(h ]”(ŒFskipping-fragments-while-generating-code-pragma-skip-and-pragma-noskip”j9eh"]”h$]”(ŒWskipping fragments while generating code: __pragma__ ('skip') and __pragma__ ('noskip')”Œskipping_fragments”eh&]”h(]”uh*h hh hhhh+hMjh}”jÊj/sjj}”j9j/subh )”}”(hhh]”(h)”}”(hŒTAutomatic conversion to truth value: __pragma__ ('tconv') and __pragma__ ('notconv')”h]”hŒ\Automatic conversion to truth value: __pragma__ (‘tconv’) and __pragma__ (‘notconv’)”…””}”(hjÔhjÒhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhjÏhhhh+hMubhL)”}”(hX¡When automatic conversion to truth value is activated, an empty array, dict or set has truth value False just as in CPyton, rather than True, as would be the case natively in JavaScript. This comes at the expense of a runtime typecheck and is by default avoided in Transcrypt for that reason. To switch on automatic conversion to truth values locally, *__pragma__ ('tconv')* and *__pragma__ ('notconv')* can be used. The alternative is to switch on automatic conversion globally using the -t command line switch. Use of this switch is disadvised if a lot of boolean expressions are computed in inner loops, since it would result in many extra typechecks. When designing performance sensitive libraries, it's advisable to use *__pragma__ ('notconv')* explicitly at the start of each performance-sensitive module. The result will be that even when an application developer chooses to use the -t switch, performance of won't suffer.”h]”(hX`When automatic conversion to truth value is activated, an empty array, dict or set has truth value False just as in CPyton, rather than True, as would be the case natively in JavaScript. This comes at the expense of a runtime typecheck and is by default avoided in Transcrypt for that reason. To switch on automatic conversion to truth values locally, ”…””}”(hX`When automatic conversion to truth value is activated, an empty array, dict or set has truth value False just as in CPyton, rather than True, as would be the case natively in JavaScript. This comes at the expense of a runtime typecheck and is by default avoided in Transcrypt for that reason. To switch on automatic conversion to truth values locally, ”hjàhhhNhNubhj)”}”(hŒ*__pragma__ ('tconv')*”h]”hŒ__pragma__ (‘tconv’)”…””}”(hhhjéubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjàubhŒ and ”…””}”(hŒ and ”hjàhhhNhNubhj)”}”(hŒ*__pragma__ ('notconv')*”h]”hŒ__pragma__ (‘notconv’)”…””}”(hhhjüubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjàubhXD can be used. The alternative is to switch on automatic conversion globally using the -t command line switch. Use of this switch is disadvised if a lot of boolean expressions are computed in inner loops, since it would result in many extra typechecks. When designing performance sensitive libraries, it’s advisable to use ”…””}”(hXB can be used. The alternative is to switch on automatic conversion globally using the -t command line switch. Use of this switch is disadvised if a lot of boolean expressions are computed in inner loops, since it would result in many extra typechecks. When designing performance sensitive libraries, it's advisable to use ”hjàhhhNhNubhj)”}”(hŒ*__pragma__ ('notconv')*”h]”hŒ__pragma__ (‘notconv’)”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjàubhŒ¶ explicitly at the start of each performance-sensitive module. The result will be that even when an application developer chooses to use the -t switch, performance of won’t suffer.”…””}”(hŒ´ explicitly at the start of each performance-sensitive module. The result will be that even when an application developer chooses to use the -t switch, performance of won't suffer.”hjàhhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hMhjÏhhubeh}”(h ]”ŒCautomatic-conversion-to-truth-value-pragma-tconv-and-pragma-notconv”ah"]”h$]”ŒTautomatic conversion to truth value: __pragma__ ('tconv') and __pragma__ ('notconv')”ah&]”h(]”uh*h hh hhhh+hMubh )”}”(hhh]”(h)”}”(hŒTAdding directories to the module search path: __pragma__ ('xpath', )”h]”hŒXAdding directories to the module search path: __pragma__ (‘xpath’, )”…””}”(hj5hj3hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhj0hhhh+hMubhL)”}”(hXIn addition to the :ref:`regular module mechanism ` you can use *# __pragma__ ('xpath', )* to add directories to the module search path. Note that resolving search paths happens compile time, so dynamic manipulation of the module search path doesn't apply. If you want to alter the search path in code that is used both by Transcrypt and CPython, you can additionally manipulate *sys.path* in a *try* clause or under an *if* with condition *__envir__.executor_name == __envir__.interpreter_name*.”h]”(hŒIn addition to the ”…””}”(hŒIn addition to the ”hjAhhhNhNubjù)”}”(hŒ2:ref:`regular module mechanism `”h]”jÿ)”}”(hjLh]”hŒregular module mechanism”…””}”(hhhjNubah}”(h ]”h"]”(j Œstd”Œstd-ref”eh$]”h&]”h(]”uh*jþhjJubah}”(h ]”h"]”h$]”h&]”h(]”Œrefdoc”jŒ refdomain”jXŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjŒmodule_mechanism”uh*jøhh+hMhjAubhŒ you can use ”…””}”(hŒ you can use ”hjAhhhNhNubhj)”}”(hŒ**# __pragma__ ('xpath', )*”h]”hŒ,# __pragma__ (‘xpath’, )”…””}”(hhhjoubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjAubhX# to add directories to the module search path. Note that resolving search paths happens compile time, so dynamic manipulation of the module search path doesn’t apply. If you want to alter the search path in code that is used both by Transcrypt and CPython, you can additionally manipulate ”…””}”(hX! to add directories to the module search path. Note that resolving search paths happens compile time, so dynamic manipulation of the module search path doesn't apply. If you want to alter the search path in code that is used both by Transcrypt and CPython, you can additionally manipulate ”hjAhhhNhNubhj)”}”(hŒ *sys.path*”h]”hŒsys.path”…””}”(hhhj‚ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjAubhŒ in a ”…””}”(hŒ in a ”hjAhhhNhNubhj)”}”(hŒ*try*”h]”hŒtry”…””}”(hhhj•ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjAubhŒ clause or under an ”…””}”(hŒ clause or under an ”hjAhhhNhNubhj)”}”(hŒ*if*”h]”hŒif”…””}”(hhhj¨ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjAubhŒ with condition ”…””}”(hŒ with condition ”hjAhhhNhNubhj)”}”(hŒ7*__envir__.executor_name == __envir__.interpreter_name*”h]”hŒ5__envir__.executor_name == __envir__.interpreter_name”…””}”(hhhj»ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjAubhŒ.”…””}”(hhèhjAhhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hMhj0hhubhL)”}”(hŒ[The *-xp / --xpath* :ref:`command line switch ` has the same effect.”h]”(hŒThe ”…””}”(hŒThe ”hjÓhhhNhNubhj)”}”(hŒ*-xp / --xpath*”h]”hŒ-xp / –xpath”…””}”(hhhjÜubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihjÓubhŒ ”…””}”(hŒ ”hjÓhhhNhNubjù)”}”(hŒ2:ref:`command line switch `”h]”jÿ)”}”(hjñh]”hŒcommand line switch”…””}”(hhhjóubah}”(h ]”h"]”(j Œstd”Œstd-ref”eh$]”h&]”h(]”uh*jþhjïubah}”(h ]”h"]”h$]”h&]”h(]”Œrefdoc”jŒ refdomain”jýŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjŒcommand_line_switches”uh*jøhh+hMhjÓubhŒ has the same effect.”…””}”(hŒ has the same effect.”hjÓhhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hMhj0hhubeh}”(h ]”ŒHadding-directories-to-the-module-search-path-pragma-xpath-directory-list”ah"]”h$]”ŒTadding directories to the module search path: __pragma__ ('xpath', )”ah&]”h(]”uh*h hh hhhh+hMubh )”}”(hhh]”(h)”}”(hŒ`Using an external transpiler: __pragma__ ('xtrans', , ..., cwd = )”h]”hŒdUsing an external transpiler: __pragma__ (‘xtrans’, , …, cwd = )”…””}”(hj'hj%hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhj"hhhh+hMubhL)”}”(hX›This pragma works the same as *__pragma__ ('js', ...)*, only now an external translator application can be specified, e.g. to translate JSX code. If the *cwd* parameter is present, it the external translator will use it as working directory. The code offered to this pragma is routed through this external translator by means of pipes. This pragma can use *__include__ (...)* just like *__pragma__ ('js', ...)*.”h]”(hŒThis pragma works the same as ”…””}”(hŒThis pragma works the same as ”hj3hhhNhNubhj)”}”(hŒ*__pragma__ ('js', ...)*”h]”hŒ__pragma__ (‘js’, …)”…””}”(hhhj<ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj3ubhŒc, only now an external translator application can be specified, e.g. to translate JSX code. If the ”…””}”(hŒc, only now an external translator application can be specified, e.g. to translate JSX code. If the ”hj3hhhNhNubhj)”}”(hŒ*cwd*”h]”hŒcwd”…””}”(hhhjOubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj3ubhŒÆ parameter is present, it the external translator will use it as working directory. The code offered to this pragma is routed through this external translator by means of pipes. This pragma can use ”…””}”(hŒÆ parameter is present, it the external translator will use it as working directory. The code offered to this pragma is routed through this external translator by means of pipes. This pragma can use ”hj3hhhNhNubhj)”}”(hŒ*__include__ (...)*”h]”hŒ__include__ (…)”…””}”(hhhjbubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj3ubhŒ just like ”…””}”(hŒ just like ”hj3hhhNhNubhj)”}”(hŒ*__pragma__ ('js', ...)*”h]”hŒ__pragma__ (‘js’, …)”…””}”(hhhjuubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj3ubhŒ.”…””}”(hhèhj3hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hMhj"hhubhL)”}”(hŒExample:”h]”hŒExample:”…””}”(hjhjhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hM!hj"hhubja )”}”(hhh]”(jf )”}”(hŒ-Test program using __pragma__ ('xtrans', ...)”h]”hŒ1Test program using __pragma__ (‘xtrans’, …)”…””}”(hj hjžubah}”(h ]”h"]”h$]”h&]”h(]”uh*je hh+hM#hj›ubjv )”}”(hXÐa = 1 __pragma__ ('xtrans', 'change_case.exe', '{}', '''/*
{self.props.students.map((s) => ( ))}
*/\f''', cwd = 'workdir', ) __pragma__ ('xtrans', 'change_case.exe -l', '{}', '''/*
{self.props.students.map((s) => ( ))}
*/\f''', cwd = 'workdir', ) b = 2 ”h]”hXÐa = 1 __pragma__ ('xtrans', 'change_case.exe', '{}', '''/*
{self.props.students.map((s) => ( ))}
*/\f''', cwd = 'workdir', ) __pragma__ ('xtrans', 'change_case.exe -l', '{}', '''/*
{self.props.students.map((s) => ( ))}
*/\f''', cwd = 'workdir', ) b = 2 ”…””}”(hhhj¬ubah}”(h ]”h"]”h$]”h&]”h(]”Œsource”Œ`/home/jac/active/geatec/transcrypt/Transcrypt/transcrypt/development/manual_tests/xtrans/test.py”j‡ jˆ j‰ ‰jŠ }”jŒ Ksuh*ju hh+hM#hj›ubeh}”(h ]”Œid6”ah"]”j‘ ah$]”h&]”h(]”Œ literal_block”ˆuh*j` hj"hhhhhNubja )”}”(hhh]”(jf )”}”(hŒgSimple external translator change_case.cpp, changing the case to upper or lower, depending on -l switch”h]”hŒgSimple external translator change_case.cpp, changing the case to upper or lower, depending on -l switch”…””}”(hjÊhjÈubah}”(h ]”h"]”h$]”h&]”h(]”uh*je hh+hM'hjÅubjv )”}”(hXD#include #include #include #include using namespace std; int main (int argc, char *argv []) { string buffer; getline (cin, buffer, '\f'); if (argc > 1 && string (argv [1]) == "-l") { transform (buffer.begin(), buffer.end(), buffer.begin(), ::tolower); } else { transform (buffer.begin(), buffer.end(), buffer.begin(), ::toupper); } cout << buffer; // Check if cwd parameter works correctly ofstream outputFile ("output.txt"); outputFile << buffer; outputFile.close (); } ”h]”hXD#include #include #include #include using namespace std; int main (int argc, char *argv []) { string buffer; getline (cin, buffer, '\f'); if (argc > 1 && string (argv [1]) == "-l") { transform (buffer.begin(), buffer.end(), buffer.begin(), ::tolower); } else { transform (buffer.begin(), buffer.end(), buffer.begin(), ::toupper); } cout << buffer; // Check if cwd parameter works correctly ofstream outputFile ("output.txt"); outputFile << buffer; outputFile.close (); } ”…””}”(hhhjÖubah}”(h ]”h"]”h$]”h&]”h(]”Œsource”Œh/home/jac/active/geatec/transcrypt/Transcrypt/transcrypt/development/manual_tests/xtrans/change_case.cpp”j‡ jˆ j‰ ‰jŠ }”jŒ Ksuh*ju hh+hM'hjÅubeh}”(h ]”Œid7”ah"]”j‘ ah$]”h&]”h(]”Œ literal_block”ˆuh*j` hj"hhhhhNubja )”}”(hhh]”(jf )”}”(hŒ%The resulting translated file test.js”h]”hŒ%The resulting translated file test.js”…””}”(hjôhjòubah}”(h ]”h"]”h$]”h&]”h(]”uh*je hh+hM+hjïubjv )”}”(hX#'use strict';import{AssertionError,AttributeError,BaseException,DeprecationWarning,Exception,IndexError,IterableError,KeyError,NotImplementedError,RuntimeWarning,StopIteration,UserWarning,ValueError,Warning,__JsIterator__,__PyIterator__,__Terminal__,__add__,__and__,__call__,__class__,__envir__,__eq__,__floordiv__,__ge__,__get__,__getcm__,__getitem__,__getslice__,__getsm__,__globals__,__gt__,__i__,__iadd__,__iand__,__idiv__,__ijsmod__,__ilshift__,__imatmul__,__imod__,__imul__,__in__,__init__,__ior__, __ipow__,__irshift__,__isub__,__ixor__,__jsUsePyNext__,__jsmod__,__k__,__kwargtrans__,__le__,__lshift__,__lt__,__matmul__,__merge__,__mod__,__mul__,__ne__,__neg__,__nest__,__or__,__pow__,__pragma__,__proxy__,__pyUseJsNext__,__rshift__,__setProperty__,__setitem__,__setslice__,__sort__,__specialattrib__,__sub__,__super__,__t__,__terminal__,__truediv__,__xor__,abs,all,any,assert,bool,bytearray,bytes,callable,chr,copy,deepcopy,delattr,dict,dir,divmod,enumerate,filter,float,getattr,hasattr,input,int,isinstance, issubclass,len,list,map,max,min,object,ord,print,property,py_TypeError,py_iter,py_metatype,py_next,py_reversed,py_typeof,range,repr,round,set,setattr,sorted,str,sum,tuple,zip}from"./org.transcrypt.__runtime__.js";var __name__="__main__";export var a=1;export var b=2; //# sourceMappingURL=test.map”h]”hX#'use strict';import{AssertionError,AttributeError,BaseException,DeprecationWarning,Exception,IndexError,IterableError,KeyError,NotImplementedError,RuntimeWarning,StopIteration,UserWarning,ValueError,Warning,__JsIterator__,__PyIterator__,__Terminal__,__add__,__and__,__call__,__class__,__envir__,__eq__,__floordiv__,__ge__,__get__,__getcm__,__getitem__,__getslice__,__getsm__,__globals__,__gt__,__i__,__iadd__,__iand__,__idiv__,__ijsmod__,__ilshift__,__imatmul__,__imod__,__imul__,__in__,__init__,__ior__, __ipow__,__irshift__,__isub__,__ixor__,__jsUsePyNext__,__jsmod__,__k__,__kwargtrans__,__le__,__lshift__,__lt__,__matmul__,__merge__,__mod__,__mul__,__ne__,__neg__,__nest__,__or__,__pow__,__pragma__,__proxy__,__pyUseJsNext__,__rshift__,__setProperty__,__setitem__,__setslice__,__sort__,__specialattrib__,__sub__,__super__,__t__,__terminal__,__truediv__,__xor__,abs,all,any,assert,bool,bytearray,bytes,callable,chr,copy,deepcopy,delattr,dict,dir,divmod,enumerate,filter,float,getattr,hasattr,input,int,isinstance, issubclass,len,list,map,max,min,object,ord,print,property,py_TypeError,py_iter,py_metatype,py_next,py_reversed,py_typeof,range,repr,round,set,setattr,sorted,str,sum,tuple,zip}from"./org.transcrypt.__runtime__.js";var __name__="__main__";export var a=1;export var b=2; //# sourceMappingURL=test.map”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”Œsource”Œi/home/jac/active/geatec/transcrypt/Transcrypt/transcrypt/development/manual_tests/xtrans/test_for_docs.js”j‡ jˆ j‰ ‰jŠ }”jŒ Ksuh*ju hh+hM+hjïubeh}”(h ]”Œid8”ah"]”j‘ ah$]”h&]”h(]”Œ literal_block”ˆuh*j` hj"hhhhhNubeh}”(h ]”ŒJusing-an-external-transpiler-pragma-xtrans-translator-cwd-workingdirectory”ah"]”h$]”Œ`using an external transpiler: __pragma__ ('xtrans', , ..., cwd = )”ah&]”h(]”uh*h hh hhhh+hMubh )”}”(hhh]”(h)”}”(hŒCreate bare JavaScript objects and iterate over their attributes from Python: __pragma__ ('jsiter') and __pragma__ ('nojsiter')”h]”hŒ‡Create bare JavaScript objects and iterate over their attributes from Python: __pragma__ (‘jsiter’) and __pragma__ (‘nojsiter’)”…””}”(hj&hj$hhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hhj!hhhh+hM0ubhL)”}”(hXäNormally a Python *{...}* literal is compiled to *dict ({...})* to include the special attributes and methods of a Python dict, including e.g. an iterator. When *__pragma__ ('jsiter')* is active, a *Python {...}* literal is compiled to a bare *{...}*, without special attributes or methods. To still be able to iterate over the attributes of such a bare JavaScript object from Python, when *__pragma__ ('jsiter')* is active, a Python *for ... in ...* is literally translated to a JavaScript *for (var ... in ...)*. The main use case for this pragma is conveniently looping through class attributes in the *__new__* method of a metaclass. As a more flexible, but less convenient alternative, *__pragma__ ('js', '{}', '''...''')* can be used.”h]”(hŒNormally a Python ”…””}”(hŒNormally a Python ”hj2hhhNhNubhj)”}”(hŒ*{...}*”h]”hŒ{…}”…””}”(hhhj;ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj2ubhŒ literal is compiled to ”…””}”(hŒ literal is compiled to ”hj2hhhNhNubhj)”}”(hŒ*dict ({...})*”h]”hŒ dict ({…})”…””}”(hhhjNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj2ubhŒb to include the special attributes and methods of a Python dict, including e.g. an iterator. When ”…””}”(hŒb to include the special attributes and methods of a Python dict, including e.g. an iterator. When ”hj2hhhNhNubhj)”}”(hŒ*__pragma__ ('jsiter')*”h]”hŒ__pragma__ (‘jsiter’)”…””}”(hhhjaubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj2ubhŒ is active, a ”…””}”(hŒ is active, a ”hj2hhhNhNubhj)”}”(hŒ*Python {...}*”h]”hŒ Python {…}”…””}”(hhhjtubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj2ubhŒ literal is compiled to a bare ”…””}”(hŒ literal is compiled to a bare ”hj2hhhNhNubhj)”}”(hŒ*{...}*”h]”hŒ{…}”…””}”(hhhj‡ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj2ubhŒŒ, without special attributes or methods. To still be able to iterate over the attributes of such a bare JavaScript object from Python, when ”…””}”(hŒŒ, without special attributes or methods. To still be able to iterate over the attributes of such a bare JavaScript object from Python, when ”hj2hhhNhNubhj)”}”(hŒ*__pragma__ ('jsiter')*”h]”hŒ__pragma__ (‘jsiter’)”…””}”(hhhjšubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj2ubhŒ is active, a Python ”…””}”(hŒ is active, a Python ”hj2hhhNhNubhj)”}”(hŒ*for ... in ...*”h]”hŒfor … in …”…””}”(hhhj­ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj2ubhŒ) is literally translated to a JavaScript ”…””}”(hŒ) is literally translated to a JavaScript ”hj2hhhNhNubhj)”}”(hŒ*for (var ... in ...)*”h]”hŒfor (var … in …)”…””}”(hhhjÀubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj2ubhŒ\. The main use case for this pragma is conveniently looping through class attributes in the ”…””}”(hŒ\. The main use case for this pragma is conveniently looping through class attributes in the ”hj2hhhNhNubhj)”}”(hŒ *__new__*”h]”hŒ__new__”…””}”(hhhjÓubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj2ubhŒM method of a metaclass. As a more flexible, but less convenient alternative, ”…””}”(hŒM method of a metaclass. As a more flexible, but less convenient alternative, ”hj2hhhNhNubhj)”}”(hŒ$*__pragma__ ('js', '{}', '''...''')*”h]”hŒ6__pragma__ (‘js’, ‘{}’, ‘’’…’’’)”…””}”(hhhjæubah}”(h ]”h"]”h$]”h&]”h(]”uh*hihj2ubhŒ can be used.”…””}”(hŒ can be used.”hj2hhhNhNubeh}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hM1hj!hhubhL)”}”(hŒ6An example of the use of this pragma is the following:”h]”hŒ6An example of the use of this pragma is the following:”…””}”(hjhjÿhhhNhNubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhh+hM3hj!hhubja )”}”(hhh]”(jf )”}”(hŒdUse of __pragma__ ('jsiter') and __pragma ('nojsiter') to manipulate class attributes in a metaclass”h]”hŒlUse of __pragma__ (‘jsiter’) and __pragma (‘nojsiter’) to manipulate class attributes in a metaclass”…””}”(hjhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*je hh+hM5hj ubjv )”}”(hX‡ class UppercaserMeta (type): def __new__ (meta, name, bases, attribs): __pragma__ ('jsiter') # Translate for ... in directly to JavaScript for ... in ... and translate {} to bare {} rather than to dict {} # Using bare {} as attribs parameter to __new__ avoids dict attributes masking regular attributes # For more flexibility use __pragma__ ('js', '{}', '''...''') upperAttribs = {} for attribKey in attribs: # Translates to 'for (var attribKey in attribs)' by virtue of __pragma__ ('jsiter'), to iterate over the attributes of a bare JavaScript {} upperAttribs [attribKey if attribKey.startswith ('__') else attribKey.upper ()] = attribs [attribKey] __pragma__ ('nojsiter') return type.__new__ (meta, name, bases, upperAttribs) ”h]”hX‡ class UppercaserMeta (type): def __new__ (meta, name, bases, attribs): __pragma__ ('jsiter') # Translate for ... in directly to JavaScript for ... in ... and translate {} to bare {} rather than to dict {} # Using bare {} as attribs parameter to __new__ avoids dict attributes masking regular attributes # For more flexibility use __pragma__ ('js', '{}', '''...''') upperAttribs = {} for attribKey in attribs: # Translates to 'for (var attribKey in attribs)' by virtue of __pragma__ ('jsiter'), to iterate over the attributes of a bare JavaScript {} upperAttribs [attribKey if attribKey.startswith ('__') else attribKey.upper ()] = attribs [attribKey] __pragma__ ('nojsiter') return type.__new__ (meta, name, bases, upperAttribs) ”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”Œsource”Œw/home/jac/active/geatec/transcrypt/Transcrypt/transcrypt/development/automated_tests/transcrypt/metaclasses/__init__.py”•—j‡ jˆ j‰ ‰jŠ }”jŒ Ksuh*ju hh+hM5hj ubeh}”(h ]”Œid9”ah"]”j‘ ah$]”h&]”h(]”Œ literal_block”ˆuh*j` hj!hhhhhNubeh}”(h ]”Œncreate-bare-javascript-objects-and-iterate-over-their-attributes-from-python-pragma-jsiter-and-pragma-nojsiter”ah"]”h$]”Œcreate bare javascript objects and iterate over their attributes from python: __pragma__ ('jsiter') and __pragma__ ('nojsiter')”ah&]”h(]”uh*h hh hhhh+hM0ubeh}”(h ]”Œspecial-facilities”ah"]”h$]”Œspecial facilities”ah&]”h(]”uh*h hhhhhh+hKubah}”(h ]”h"]”h$]”h&]”h(]”Œsource”h+uh*hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”jþŒfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jiŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”h+Œ _destination”NŒ _config_files”]”Œpep_references”NŒ pep_base_url”Œ https://www.python.org/dev/peps/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œhttps://tools.ietf.org/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œfile_insertion_enabled”ˆŒ raw_enabled”KŒsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”(h9]”h.aj‚]”jxaj]”jaj]”jaj9]”j/auŒnameids”}”(jDjAjeh9jdjajÝjÚjÞjÛjjjfjcj©j¦j(j%jˆj…j\ j‚j[ jX jC j@ jH jE jï jì j|jyj!jj&jj%j"jñjjðjíjjjhjej£j jðjíjOjLj?j<jÊj9jÉjÆj-j*jjjjj<j9uŒ nametypes”}”(jDNjeˆjdNjÝNjÞNjNjfNj©Nj(NjˆNj\ ˆj[ NjC NjH Njï Nj|Nj!Nj&ˆj%NjñˆjðNjNjhNj£NjðNjONj?NjʈjÉNj-NjNjNj<Nuh }”(jAh h9h:jah:jÚjljÛjàjjájcjj¦jij%j¬j…j+j‚j“jX j“j@ ja jE jF jì jK jyjò jjjj$j"j$jj+jíj+jjöjejj jkjíj¦jLjój<jRj9jBjÆjBj*jÏjj0jj"j9j!j jb j ji j= j jqj9j¾jšj¿j›jéjÅjjïj1j uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”jwK s…”R”Œparse_messages”]”Œtransform_messages”]”(h Œsystem_message”“”)”}”(hhh]”hL)”}”(hhh]”hŒ6Hyperlink target "module-mechanism" is not referenced.”…””}”(hhhjÒubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhjÏubah}”(h ]”h"]”h$]”h&]”h(]”Œlevel”KŒtype”ŒINFO”Œsource”h+Œline”Kuh*jÍubjÎ)”}”(hhh]”hL)”}”(hhh]”hŒ2Hyperlink target "pragma-alias" is not referenced.”…””}”(hhhjíubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhjêubah}”(h ]”h"]”h$]”h&]”h(]”Œlevel”KŒtype”jçŒsource”h+Œline”Kvuh*jÍubjÎ)”}”(hhh]”hL)”}”(hhh]”hŒ2Hyperlink target "pragma-ifdef" is not referenced.”…””}”(hhhjubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhjubah}”(h ]”h"]”h$]”h&]”h(]”Œlevel”KŒtype”jçŒsource”h+Œline”KÏuh*jÍubjÎ)”}”(hhh]”hL)”}”(hhh]”hŒ/Hyperlink target "pragma-js" is not referenced.”…””}”(hhhj!ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhjubah}”(h ]”h"]”h$]”h&]”h(]”Œlevel”KŒtype”jçŒsource”h+Œline”KÝuh*jÍubjÎ)”}”(hhh]”hL)”}”(hhh]”hŒ8Hyperlink target "skipping-fragments" is not referenced.”…””}”(hhhj;ubah}”(h ]”h"]”h$]”h&]”h(]”uh*hKhj8ubah}”(h ]”h"]”h$]”h&]”h(]”Œlevel”KŒtype”jçŒsource”h+Œline”Muh*jÍubeŒ transformer”NŒ decoration”Nhhub.