@tedbrain/vlink 0.0.0-dpv2.ted-runner.vlink-linux-x64.0.2.16.r5 → 0.0.0-dpv2.ted-runner.python-linux-x64.3.9.0-dpv2.1.r5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (660) hide show
  1. package/bin/python3 +0 -0
  2. package/lib/libX11.so.6 +0 -0
  3. package/lib/libXau.so.6 +0 -0
  4. package/lib/libXdmcp.so.6 +0 -0
  5. package/lib/libcrypt.so.1 +0 -0
  6. package/lib/libcrypto.so.1.1 +0 -0
  7. package/lib/libffi.so.7 +0 -0
  8. package/lib/libfreebl3.so +0 -0
  9. package/lib/liblzma.so.5 +0 -0
  10. package/lib/libncursesw.so.6 +0 -0
  11. package/lib/libnsl.so.1 +0 -0
  12. package/lib/libpanelw.so.6 +0 -0
  13. package/lib/libpython3.9.so.1.0 +0 -0
  14. package/lib/libreadline.so.8 +0 -0
  15. package/lib/libsqlite3.so.0 +0 -0
  16. package/lib/libssl.so.1.1 +0 -0
  17. package/lib/libtcl8.6.so +0 -0
  18. package/lib/libtinfow.so.6 +0 -0
  19. package/lib/libtk8.6.so +0 -0
  20. package/lib/libxcb.so.1 +0 -0
  21. package/lib/libz.so.1 +0 -0
  22. package/lib/python3.9/LICENSE.txt +279 -0
  23. package/lib/python3.9/__future__.py +147 -0
  24. package/lib/python3.9/__phello__.foo.py +1 -0
  25. package/lib/python3.9/_aix_support.py +89 -0
  26. package/lib/python3.9/_bootlocale.py +46 -0
  27. package/lib/python3.9/_bootsubprocess.py +97 -0
  28. package/lib/python3.9/_collections_abc.py +1031 -0
  29. package/lib/python3.9/_compat_pickle.py +251 -0
  30. package/lib/python3.9/_compression.py +152 -0
  31. package/lib/python3.9/_markupbase.py +395 -0
  32. package/lib/python3.9/_osx_support.py +515 -0
  33. package/lib/python3.9/_py_abc.py +147 -0
  34. package/lib/python3.9/_pydecimal.py +6410 -0
  35. package/lib/python3.9/_pyio.py +2692 -0
  36. package/lib/python3.9/_sitebuiltins.py +103 -0
  37. package/lib/python3.9/_strptime.py +579 -0
  38. package/lib/python3.9/_sysconfigdata__linux_x86_64-linux-gnu.py +969 -0
  39. package/lib/python3.9/_sysconfigdata__linux_x86_64-linux-gnu.py.orig +969 -0
  40. package/lib/python3.9/_sysconfigdata_x86_64_conda_cos6_linux_gnu.py +969 -0
  41. package/lib/python3.9/_threading_local.py +242 -0
  42. package/lib/python3.9/_weakrefset.py +202 -0
  43. package/lib/python3.9/abc.py +129 -0
  44. package/lib/python3.9/aifc.py +947 -0
  45. package/lib/python3.9/antigravity.py +17 -0
  46. package/lib/python3.9/argparse.py +2575 -0
  47. package/lib/python3.9/ast.py +1530 -0
  48. package/lib/python3.9/asynchat.py +307 -0
  49. package/lib/python3.9/asyncio/__init__.py +47 -0
  50. package/lib/python3.9/asyncio/__main__.py +125 -0
  51. package/lib/python3.9/asyncio/base_events.py +1915 -0
  52. package/lib/python3.9/asyncio/base_futures.py +61 -0
  53. package/lib/python3.9/asyncio/base_subprocess.py +285 -0
  54. package/lib/python3.9/asyncio/base_tasks.py +85 -0
  55. package/lib/python3.9/asyncio/constants.py +27 -0
  56. package/lib/python3.9/asyncio/coroutines.py +269 -0
  57. package/lib/python3.9/asyncio/events.py +795 -0
  58. package/lib/python3.9/asyncio/exceptions.py +57 -0
  59. package/lib/python3.9/asyncio/format_helpers.py +76 -0
  60. package/lib/python3.9/asyncio/futures.py +423 -0
  61. package/lib/python3.9/asyncio/locks.py +451 -0
  62. package/lib/python3.9/asyncio/log.py +7 -0
  63. package/lib/python3.9/asyncio/proactor_events.py +868 -0
  64. package/lib/python3.9/asyncio/protocols.py +220 -0
  65. package/lib/python3.9/asyncio/queues.py +252 -0
  66. package/lib/python3.9/asyncio/runners.py +74 -0
  67. package/lib/python3.9/asyncio/selector_events.py +1099 -0
  68. package/lib/python3.9/asyncio/sslproto.py +733 -0
  69. package/lib/python3.9/asyncio/staggered.py +149 -0
  70. package/lib/python3.9/asyncio/streams.py +741 -0
  71. package/lib/python3.9/asyncio/subprocess.py +241 -0
  72. package/lib/python3.9/asyncio/tasks.py +980 -0
  73. package/lib/python3.9/asyncio/threads.py +25 -0
  74. package/lib/python3.9/asyncio/transports.py +329 -0
  75. package/lib/python3.9/asyncio/trsock.py +206 -0
  76. package/lib/python3.9/asyncio/unix_events.py +1466 -0
  77. package/lib/python3.9/asyncio/windows_events.py +908 -0
  78. package/lib/python3.9/asyncio/windows_utils.py +173 -0
  79. package/lib/python3.9/asyncore.py +642 -0
  80. package/lib/python3.9/base64.py +579 -0
  81. package/lib/python3.9/bdb.py +864 -0
  82. package/lib/python3.9/binhex.py +502 -0
  83. package/lib/python3.9/bisect.py +80 -0
  84. package/lib/python3.9/bz2.py +350 -0
  85. package/lib/python3.9/cProfile.py +180 -0
  86. package/lib/python3.9/calendar.py +770 -0
  87. package/lib/python3.9/cgi.py +996 -0
  88. package/lib/python3.9/cgitb.py +321 -0
  89. package/lib/python3.9/chunk.py +169 -0
  90. package/lib/python3.9/cmd.py +401 -0
  91. package/lib/python3.9/code.py +315 -0
  92. package/lib/python3.9/codecs.py +1126 -0
  93. package/lib/python3.9/codeop.py +178 -0
  94. package/lib/python3.9/collections/__init__.py +1508 -0
  95. package/lib/python3.9/collections/abc.py +2 -0
  96. package/lib/python3.9/colorsys.py +164 -0
  97. package/lib/python3.9/compileall.py +461 -0
  98. package/lib/python3.9/concurrent/__init__.py +1 -0
  99. package/lib/python3.9/concurrent/futures/__init__.py +53 -0
  100. package/lib/python3.9/concurrent/futures/_base.py +635 -0
  101. package/lib/python3.9/concurrent/futures/process.py +751 -0
  102. package/lib/python3.9/concurrent/futures/thread.py +230 -0
  103. package/lib/python3.9/config-3.9-x86_64-linux-gnu/Makefile +2015 -0
  104. package/lib/python3.9/config-3.9-x86_64-linux-gnu/Setup +372 -0
  105. package/lib/python3.9/config-3.9-x86_64-linux-gnu/Setup.local +1 -0
  106. package/lib/python3.9/config-3.9-x86_64-linux-gnu/config.c +116 -0
  107. package/lib/python3.9/config-3.9-x86_64-linux-gnu/config.c.in +67 -0
  108. package/lib/python3.9/config-3.9-x86_64-linux-gnu/install-sh +518 -0
  109. package/lib/python3.9/config-3.9-x86_64-linux-gnu/makesetup +309 -0
  110. package/lib/python3.9/config-3.9-x86_64-linux-gnu/python-config.py +74 -0
  111. package/lib/python3.9/config-3.9-x86_64-linux-gnu/python.o +0 -0
  112. package/lib/python3.9/configparser.py +1363 -0
  113. package/lib/python3.9/contextlib.py +676 -0
  114. package/lib/python3.9/contextvars.py +4 -0
  115. package/lib/python3.9/copy.py +303 -0
  116. package/lib/python3.9/copyreg.py +209 -0
  117. package/lib/python3.9/crypt.py +120 -0
  118. package/lib/python3.9/csv.py +448 -0
  119. package/lib/python3.9/ctypes/__init__.py +571 -0
  120. package/lib/python3.9/ctypes/_aix.py +331 -0
  121. package/lib/python3.9/ctypes/_endian.py +61 -0
  122. package/lib/python3.9/ctypes/macholib/README.ctypes +7 -0
  123. package/lib/python3.9/ctypes/macholib/__init__.py +9 -0
  124. package/lib/python3.9/ctypes/macholib/dyld.py +182 -0
  125. package/lib/python3.9/ctypes/macholib/dylib.py +63 -0
  126. package/lib/python3.9/ctypes/macholib/fetch_macholib +2 -0
  127. package/lib/python3.9/ctypes/macholib/fetch_macholib.bat +1 -0
  128. package/lib/python3.9/ctypes/macholib/framework.py +65 -0
  129. package/lib/python3.9/ctypes/util.py +379 -0
  130. package/lib/python3.9/ctypes/wintypes.py +202 -0
  131. package/lib/python3.9/curses/__init__.py +101 -0
  132. package/lib/python3.9/curses/ascii.py +99 -0
  133. package/lib/python3.9/curses/has_key.py +192 -0
  134. package/lib/python3.9/curses/panel.py +6 -0
  135. package/lib/python3.9/curses/textpad.py +201 -0
  136. package/lib/python3.9/dataclasses.py +1284 -0
  137. package/lib/python3.9/datetime.py +2555 -0
  138. package/lib/python3.9/dbm/__init__.py +189 -0
  139. package/lib/python3.9/dbm/dumb.py +316 -0
  140. package/lib/python3.9/dbm/gnu.py +3 -0
  141. package/lib/python3.9/dbm/ndbm.py +3 -0
  142. package/lib/python3.9/decimal.py +11 -0
  143. package/lib/python3.9/difflib.py +2096 -0
  144. package/lib/python3.9/dis.py +553 -0
  145. package/lib/python3.9/distutils/README +11 -0
  146. package/lib/python3.9/distutils/__init__.py +13 -0
  147. package/lib/python3.9/distutils/_msvccompiler.py +546 -0
  148. package/lib/python3.9/distutils/archive_util.py +256 -0
  149. package/lib/python3.9/distutils/bcppcompiler.py +393 -0
  150. package/lib/python3.9/distutils/ccompiler.py +1116 -0
  151. package/lib/python3.9/distutils/cmd.py +403 -0
  152. package/lib/python3.9/distutils/command/__init__.py +31 -0
  153. package/lib/python3.9/distutils/command/bdist.py +143 -0
  154. package/lib/python3.9/distutils/command/bdist_dumb.py +123 -0
  155. package/lib/python3.9/distutils/command/bdist_msi.py +749 -0
  156. package/lib/python3.9/distutils/command/bdist_rpm.py +579 -0
  157. package/lib/python3.9/distutils/command/bdist_wininst.py +377 -0
  158. package/lib/python3.9/distutils/command/build.py +157 -0
  159. package/lib/python3.9/distutils/command/build_clib.py +209 -0
  160. package/lib/python3.9/distutils/command/build_ext.py +754 -0
  161. package/lib/python3.9/distutils/command/build_py.py +416 -0
  162. package/lib/python3.9/distutils/command/build_scripts.py +160 -0
  163. package/lib/python3.9/distutils/command/check.py +148 -0
  164. package/lib/python3.9/distutils/command/clean.py +76 -0
  165. package/lib/python3.9/distutils/command/command_template +33 -0
  166. package/lib/python3.9/distutils/command/config.py +344 -0
  167. package/lib/python3.9/distutils/command/install.py +657 -0
  168. package/lib/python3.9/distutils/command/install_data.py +79 -0
  169. package/lib/python3.9/distutils/command/install_egg_info.py +77 -0
  170. package/lib/python3.9/distutils/command/install_headers.py +47 -0
  171. package/lib/python3.9/distutils/command/install_lib.py +217 -0
  172. package/lib/python3.9/distutils/command/install_scripts.py +60 -0
  173. package/lib/python3.9/distutils/command/register.py +304 -0
  174. package/lib/python3.9/distutils/command/sdist.py +494 -0
  175. package/lib/python3.9/distutils/command/upload.py +214 -0
  176. package/lib/python3.9/distutils/config.py +130 -0
  177. package/lib/python3.9/distutils/core.py +234 -0
  178. package/lib/python3.9/distutils/cygwinccompiler.py +410 -0
  179. package/lib/python3.9/distutils/debug.py +5 -0
  180. package/lib/python3.9/distutils/dep_util.py +92 -0
  181. package/lib/python3.9/distutils/dir_util.py +210 -0
  182. package/lib/python3.9/distutils/dist.py +1256 -0
  183. package/lib/python3.9/distutils/errors.py +97 -0
  184. package/lib/python3.9/distutils/extension.py +240 -0
  185. package/lib/python3.9/distutils/fancy_getopt.py +457 -0
  186. package/lib/python3.9/distutils/file_util.py +238 -0
  187. package/lib/python3.9/distutils/filelist.py +327 -0
  188. package/lib/python3.9/distutils/log.py +77 -0
  189. package/lib/python3.9/distutils/msvc9compiler.py +788 -0
  190. package/lib/python3.9/distutils/msvccompiler.py +643 -0
  191. package/lib/python3.9/distutils/spawn.py +125 -0
  192. package/lib/python3.9/distutils/sysconfig.py +560 -0
  193. package/lib/python3.9/distutils/text_file.py +286 -0
  194. package/lib/python3.9/distutils/unixccompiler.py +330 -0
  195. package/lib/python3.9/distutils/util.py +559 -0
  196. package/lib/python3.9/distutils/version.py +347 -0
  197. package/lib/python3.9/distutils/versionpredicate.py +166 -0
  198. package/lib/python3.9/doctest.py +2793 -0
  199. package/lib/python3.9/email/__init__.py +62 -0
  200. package/lib/python3.9/email/_encoded_words.py +233 -0
  201. package/lib/python3.9/email/_header_value_parser.py +3003 -0
  202. package/lib/python3.9/email/_parseaddr.py +549 -0
  203. package/lib/python3.9/email/_policybase.py +374 -0
  204. package/lib/python3.9/email/architecture.rst +216 -0
  205. package/lib/python3.9/email/base64mime.py +119 -0
  206. package/lib/python3.9/email/charset.py +404 -0
  207. package/lib/python3.9/email/contentmanager.py +250 -0
  208. package/lib/python3.9/email/encoders.py +69 -0
  209. package/lib/python3.9/email/errors.py +110 -0
  210. package/lib/python3.9/email/feedparser.py +536 -0
  211. package/lib/python3.9/email/generator.py +508 -0
  212. package/lib/python3.9/email/header.py +578 -0
  213. package/lib/python3.9/email/headerregistry.py +601 -0
  214. package/lib/python3.9/email/iterators.py +71 -0
  215. package/lib/python3.9/email/message.py +1173 -0
  216. package/lib/python3.9/email/mime/__init__.py +0 -0
  217. package/lib/python3.9/email/mime/application.py +37 -0
  218. package/lib/python3.9/email/mime/audio.py +74 -0
  219. package/lib/python3.9/email/mime/base.py +30 -0
  220. package/lib/python3.9/email/mime/image.py +47 -0
  221. package/lib/python3.9/email/mime/message.py +34 -0
  222. package/lib/python3.9/email/mime/multipart.py +48 -0
  223. package/lib/python3.9/email/mime/nonmultipart.py +22 -0
  224. package/lib/python3.9/email/mime/text.py +42 -0
  225. package/lib/python3.9/email/parser.py +131 -0
  226. package/lib/python3.9/email/policy.py +224 -0
  227. package/lib/python3.9/email/quoprimime.py +299 -0
  228. package/lib/python3.9/email/utils.py +368 -0
  229. package/lib/python3.9/encodings/__init__.py +169 -0
  230. package/lib/python3.9/encodings/aliases.py +551 -0
  231. package/lib/python3.9/encodings/ascii.py +50 -0
  232. package/lib/python3.9/encodings/base64_codec.py +55 -0
  233. package/lib/python3.9/encodings/big5.py +39 -0
  234. package/lib/python3.9/encodings/big5hkscs.py +39 -0
  235. package/lib/python3.9/encodings/bz2_codec.py +78 -0
  236. package/lib/python3.9/encodings/charmap.py +69 -0
  237. package/lib/python3.9/encodings/cp037.py +307 -0
  238. package/lib/python3.9/encodings/cp1006.py +307 -0
  239. package/lib/python3.9/encodings/cp1026.py +307 -0
  240. package/lib/python3.9/encodings/cp1125.py +698 -0
  241. package/lib/python3.9/encodings/cp1140.py +307 -0
  242. package/lib/python3.9/encodings/cp1250.py +307 -0
  243. package/lib/python3.9/encodings/cp1251.py +307 -0
  244. package/lib/python3.9/encodings/cp1252.py +307 -0
  245. package/lib/python3.9/encodings/cp1253.py +307 -0
  246. package/lib/python3.9/encodings/cp1254.py +307 -0
  247. package/lib/python3.9/encodings/cp1255.py +307 -0
  248. package/lib/python3.9/encodings/cp1256.py +307 -0
  249. package/lib/python3.9/encodings/cp1257.py +307 -0
  250. package/lib/python3.9/encodings/cp1258.py +307 -0
  251. package/lib/python3.9/encodings/cp273.py +307 -0
  252. package/lib/python3.9/encodings/cp424.py +307 -0
  253. package/lib/python3.9/encodings/cp437.py +698 -0
  254. package/lib/python3.9/encodings/cp500.py +307 -0
  255. package/lib/python3.9/encodings/cp720.py +309 -0
  256. package/lib/python3.9/encodings/cp737.py +698 -0
  257. package/lib/python3.9/encodings/cp775.py +697 -0
  258. package/lib/python3.9/encodings/cp850.py +698 -0
  259. package/lib/python3.9/encodings/cp852.py +698 -0
  260. package/lib/python3.9/encodings/cp855.py +698 -0
  261. package/lib/python3.9/encodings/cp856.py +307 -0
  262. package/lib/python3.9/encodings/cp857.py +694 -0
  263. package/lib/python3.9/encodings/cp858.py +698 -0
  264. package/lib/python3.9/encodings/cp860.py +698 -0
  265. package/lib/python3.9/encodings/cp861.py +698 -0
  266. package/lib/python3.9/encodings/cp862.py +698 -0
  267. package/lib/python3.9/encodings/cp863.py +698 -0
  268. package/lib/python3.9/encodings/cp864.py +690 -0
  269. package/lib/python3.9/encodings/cp865.py +698 -0
  270. package/lib/python3.9/encodings/cp866.py +698 -0
  271. package/lib/python3.9/encodings/cp869.py +689 -0
  272. package/lib/python3.9/encodings/cp874.py +307 -0
  273. package/lib/python3.9/encodings/cp875.py +307 -0
  274. package/lib/python3.9/encodings/cp932.py +39 -0
  275. package/lib/python3.9/encodings/cp949.py +39 -0
  276. package/lib/python3.9/encodings/cp950.py +39 -0
  277. package/lib/python3.9/encodings/euc_jis_2004.py +39 -0
  278. package/lib/python3.9/encodings/euc_jisx0213.py +39 -0
  279. package/lib/python3.9/encodings/euc_jp.py +39 -0
  280. package/lib/python3.9/encodings/euc_kr.py +39 -0
  281. package/lib/python3.9/encodings/gb18030.py +39 -0
  282. package/lib/python3.9/encodings/gb2312.py +39 -0
  283. package/lib/python3.9/encodings/gbk.py +39 -0
  284. package/lib/python3.9/encodings/hex_codec.py +55 -0
  285. package/lib/python3.9/encodings/hp_roman8.py +314 -0
  286. package/lib/python3.9/encodings/hz.py +39 -0
  287. package/lib/python3.9/encodings/idna.py +309 -0
  288. package/lib/python3.9/encodings/iso2022_jp.py +39 -0
  289. package/lib/python3.9/encodings/iso2022_jp_1.py +39 -0
  290. package/lib/python3.9/encodings/iso2022_jp_2.py +39 -0
  291. package/lib/python3.9/encodings/iso2022_jp_2004.py +39 -0
  292. package/lib/python3.9/encodings/iso2022_jp_3.py +39 -0
  293. package/lib/python3.9/encodings/iso2022_jp_ext.py +39 -0
  294. package/lib/python3.9/encodings/iso2022_kr.py +39 -0
  295. package/lib/python3.9/encodings/iso8859_1.py +307 -0
  296. package/lib/python3.9/encodings/iso8859_10.py +307 -0
  297. package/lib/python3.9/encodings/iso8859_11.py +307 -0
  298. package/lib/python3.9/encodings/iso8859_13.py +307 -0
  299. package/lib/python3.9/encodings/iso8859_14.py +307 -0
  300. package/lib/python3.9/encodings/iso8859_15.py +307 -0
  301. package/lib/python3.9/encodings/iso8859_16.py +307 -0
  302. package/lib/python3.9/encodings/iso8859_2.py +307 -0
  303. package/lib/python3.9/encodings/iso8859_3.py +307 -0
  304. package/lib/python3.9/encodings/iso8859_4.py +307 -0
  305. package/lib/python3.9/encodings/iso8859_5.py +307 -0
  306. package/lib/python3.9/encodings/iso8859_6.py +307 -0
  307. package/lib/python3.9/encodings/iso8859_7.py +307 -0
  308. package/lib/python3.9/encodings/iso8859_8.py +307 -0
  309. package/lib/python3.9/encodings/iso8859_9.py +307 -0
  310. package/lib/python3.9/encodings/johab.py +39 -0
  311. package/lib/python3.9/encodings/koi8_r.py +307 -0
  312. package/lib/python3.9/encodings/koi8_t.py +308 -0
  313. package/lib/python3.9/encodings/koi8_u.py +307 -0
  314. package/lib/python3.9/encodings/kz1048.py +307 -0
  315. package/lib/python3.9/encodings/latin_1.py +50 -0
  316. package/lib/python3.9/encodings/mac_arabic.py +698 -0
  317. package/lib/python3.9/encodings/mac_croatian.py +307 -0
  318. package/lib/python3.9/encodings/mac_cyrillic.py +307 -0
  319. package/lib/python3.9/encodings/mac_farsi.py +307 -0
  320. package/lib/python3.9/encodings/mac_greek.py +307 -0
  321. package/lib/python3.9/encodings/mac_iceland.py +307 -0
  322. package/lib/python3.9/encodings/mac_latin2.py +312 -0
  323. package/lib/python3.9/encodings/mac_roman.py +307 -0
  324. package/lib/python3.9/encodings/mac_romanian.py +307 -0
  325. package/lib/python3.9/encodings/mac_turkish.py +307 -0
  326. package/lib/python3.9/encodings/mbcs.py +47 -0
  327. package/lib/python3.9/encodings/oem.py +41 -0
  328. package/lib/python3.9/encodings/palmos.py +308 -0
  329. package/lib/python3.9/encodings/ptcp154.py +312 -0
  330. package/lib/python3.9/encodings/punycode.py +237 -0
  331. package/lib/python3.9/encodings/quopri_codec.py +56 -0
  332. package/lib/python3.9/encodings/raw_unicode_escape.py +45 -0
  333. package/lib/python3.9/encodings/rot_13.py +113 -0
  334. package/lib/python3.9/encodings/shift_jis.py +39 -0
  335. package/lib/python3.9/encodings/shift_jis_2004.py +39 -0
  336. package/lib/python3.9/encodings/shift_jisx0213.py +39 -0
  337. package/lib/python3.9/encodings/tis_620.py +307 -0
  338. package/lib/python3.9/encodings/undefined.py +49 -0
  339. package/lib/python3.9/encodings/unicode_escape.py +45 -0
  340. package/lib/python3.9/encodings/utf_16.py +155 -0
  341. package/lib/python3.9/encodings/utf_16_be.py +42 -0
  342. package/lib/python3.9/encodings/utf_16_le.py +42 -0
  343. package/lib/python3.9/encodings/utf_32.py +150 -0
  344. package/lib/python3.9/encodings/utf_32_be.py +37 -0
  345. package/lib/python3.9/encodings/utf_32_le.py +37 -0
  346. package/lib/python3.9/encodings/utf_7.py +38 -0
  347. package/lib/python3.9/encodings/utf_8.py +42 -0
  348. package/lib/python3.9/encodings/utf_8_sig.py +130 -0
  349. package/lib/python3.9/encodings/uu_codec.py +103 -0
  350. package/lib/python3.9/encodings/zlib_codec.py +77 -0
  351. package/lib/python3.9/enum.py +913 -0
  352. package/lib/python3.9/filecmp.py +309 -0
  353. package/lib/python3.9/fileinput.py +432 -0
  354. package/lib/python3.9/fnmatch.py +183 -0
  355. package/lib/python3.9/formatter.py +452 -0
  356. package/lib/python3.9/fractions.py +641 -0
  357. package/lib/python3.9/ftplib.py +974 -0
  358. package/lib/python3.9/functools.py +980 -0
  359. package/lib/python3.9/genericpath.py +155 -0
  360. package/lib/python3.9/getopt.py +215 -0
  361. package/lib/python3.9/getpass.py +185 -0
  362. package/lib/python3.9/gettext.py +788 -0
  363. package/lib/python3.9/glob.py +173 -0
  364. package/lib/python3.9/graphlib.py +245 -0
  365. package/lib/python3.9/gzip.py +609 -0
  366. package/lib/python3.9/hashlib.py +262 -0
  367. package/lib/python3.9/heapq.py +601 -0
  368. package/lib/python3.9/hmac.py +203 -0
  369. package/lib/python3.9/html/__init__.py +132 -0
  370. package/lib/python3.9/html/entities.py +2509 -0
  371. package/lib/python3.9/html/parser.py +462 -0
  372. package/lib/python3.9/http/__init__.py +149 -0
  373. package/lib/python3.9/http/client.py +1495 -0
  374. package/lib/python3.9/http/cookiejar.py +2113 -0
  375. package/lib/python3.9/http/cookies.py +612 -0
  376. package/lib/python3.9/http/server.py +1299 -0
  377. package/lib/python3.9/imaplib.py +1650 -0
  378. package/lib/python3.9/imghdr.py +168 -0
  379. package/lib/python3.9/imp.py +345 -0
  380. package/lib/python3.9/importlib/__init__.py +176 -0
  381. package/lib/python3.9/importlib/_bootstrap.py +1189 -0
  382. package/lib/python3.9/importlib/_bootstrap_external.py +1637 -0
  383. package/lib/python3.9/importlib/_common.py +62 -0
  384. package/lib/python3.9/importlib/abc.py +474 -0
  385. package/lib/python3.9/importlib/machinery.py +21 -0
  386. package/lib/python3.9/importlib/metadata.py +586 -0
  387. package/lib/python3.9/importlib/resources.py +215 -0
  388. package/lib/python3.9/importlib/util.py +300 -0
  389. package/lib/python3.9/inspect.py +3180 -0
  390. package/lib/python3.9/io.py +99 -0
  391. package/lib/python3.9/ipaddress.py +2280 -0
  392. package/lib/python3.9/json/__init__.py +359 -0
  393. package/lib/python3.9/json/decoder.py +356 -0
  394. package/lib/python3.9/json/encoder.py +442 -0
  395. package/lib/python3.9/json/scanner.py +73 -0
  396. package/lib/python3.9/json/tool.py +78 -0
  397. package/lib/python3.9/keyword.py +62 -0
  398. package/lib/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so +0 -0
  399. package/lib/python3.9/lib-dynload/_bisect.cpython-39-x86_64-linux-gnu.so +0 -0
  400. package/lib/python3.9/lib-dynload/_blake2.cpython-39-x86_64-linux-gnu.so +0 -0
  401. package/lib/python3.9/lib-dynload/_bz2.cpython-39-x86_64-linux-gnu.so +0 -0
  402. package/lib/python3.9/lib-dynload/_codecs_cn.cpython-39-x86_64-linux-gnu.so +0 -0
  403. package/lib/python3.9/lib-dynload/_codecs_hk.cpython-39-x86_64-linux-gnu.so +0 -0
  404. package/lib/python3.9/lib-dynload/_codecs_iso2022.cpython-39-x86_64-linux-gnu.so +0 -0
  405. package/lib/python3.9/lib-dynload/_codecs_jp.cpython-39-x86_64-linux-gnu.so +0 -0
  406. package/lib/python3.9/lib-dynload/_codecs_kr.cpython-39-x86_64-linux-gnu.so +0 -0
  407. package/lib/python3.9/lib-dynload/_codecs_tw.cpython-39-x86_64-linux-gnu.so +0 -0
  408. package/lib/python3.9/lib-dynload/_contextvars.cpython-39-x86_64-linux-gnu.so +0 -0
  409. package/lib/python3.9/lib-dynload/_crypt.cpython-39-x86_64-linux-gnu.so +0 -0
  410. package/lib/python3.9/lib-dynload/_csv.cpython-39-x86_64-linux-gnu.so +0 -0
  411. package/lib/python3.9/lib-dynload/_ctypes.cpython-39-x86_64-linux-gnu.so +0 -0
  412. package/lib/python3.9/lib-dynload/_ctypes_test.cpython-39-x86_64-linux-gnu.so +0 -0
  413. package/lib/python3.9/lib-dynload/_curses.cpython-39-x86_64-linux-gnu.so +0 -0
  414. package/lib/python3.9/lib-dynload/_curses_panel.cpython-39-x86_64-linux-gnu.so +0 -0
  415. package/lib/python3.9/lib-dynload/_datetime.cpython-39-x86_64-linux-gnu.so +0 -0
  416. package/lib/python3.9/lib-dynload/_decimal.cpython-39-x86_64-linux-gnu.so +0 -0
  417. package/lib/python3.9/lib-dynload/_elementtree.cpython-39-x86_64-linux-gnu.so +0 -0
  418. package/lib/python3.9/lib-dynload/_hashlib.cpython-39-x86_64-linux-gnu.so +0 -0
  419. package/lib/python3.9/lib-dynload/_heapq.cpython-39-x86_64-linux-gnu.so +0 -0
  420. package/lib/python3.9/lib-dynload/_json.cpython-39-x86_64-linux-gnu.so +0 -0
  421. package/lib/python3.9/lib-dynload/_lsprof.cpython-39-x86_64-linux-gnu.so +0 -0
  422. package/lib/python3.9/lib-dynload/_lzma.cpython-39-x86_64-linux-gnu.so +0 -0
  423. package/lib/python3.9/lib-dynload/_md5.cpython-39-x86_64-linux-gnu.so +0 -0
  424. package/lib/python3.9/lib-dynload/_multibytecodec.cpython-39-x86_64-linux-gnu.so +0 -0
  425. package/lib/python3.9/lib-dynload/_multiprocessing.cpython-39-x86_64-linux-gnu.so +0 -0
  426. package/lib/python3.9/lib-dynload/_opcode.cpython-39-x86_64-linux-gnu.so +0 -0
  427. package/lib/python3.9/lib-dynload/_pickle.cpython-39-x86_64-linux-gnu.so +0 -0
  428. package/lib/python3.9/lib-dynload/_posixshmem.cpython-39-x86_64-linux-gnu.so +0 -0
  429. package/lib/python3.9/lib-dynload/_posixsubprocess.cpython-39-x86_64-linux-gnu.so +0 -0
  430. package/lib/python3.9/lib-dynload/_queue.cpython-39-x86_64-linux-gnu.so +0 -0
  431. package/lib/python3.9/lib-dynload/_random.cpython-39-x86_64-linux-gnu.so +0 -0
  432. package/lib/python3.9/lib-dynload/_sha1.cpython-39-x86_64-linux-gnu.so +0 -0
  433. package/lib/python3.9/lib-dynload/_sha256.cpython-39-x86_64-linux-gnu.so +0 -0
  434. package/lib/python3.9/lib-dynload/_sha3.cpython-39-x86_64-linux-gnu.so +0 -0
  435. package/lib/python3.9/lib-dynload/_sha512.cpython-39-x86_64-linux-gnu.so +0 -0
  436. package/lib/python3.9/lib-dynload/_socket.cpython-39-x86_64-linux-gnu.so +0 -0
  437. package/lib/python3.9/lib-dynload/_sqlite3.cpython-39-x86_64-linux-gnu.so +0 -0
  438. package/lib/python3.9/lib-dynload/_ssl.cpython-39-x86_64-linux-gnu.so +0 -0
  439. package/lib/python3.9/lib-dynload/_statistics.cpython-39-x86_64-linux-gnu.so +0 -0
  440. package/lib/python3.9/lib-dynload/_struct.cpython-39-x86_64-linux-gnu.so +0 -0
  441. package/lib/python3.9/lib-dynload/_testbuffer.cpython-39-x86_64-linux-gnu.so +0 -0
  442. package/lib/python3.9/lib-dynload/_testcapi.cpython-39-x86_64-linux-gnu.so +0 -0
  443. package/lib/python3.9/lib-dynload/_testimportmultiple.cpython-39-x86_64-linux-gnu.so +0 -0
  444. package/lib/python3.9/lib-dynload/_testinternalcapi.cpython-39-x86_64-linux-gnu.so +0 -0
  445. package/lib/python3.9/lib-dynload/_testmultiphase.cpython-39-x86_64-linux-gnu.so +0 -0
  446. package/lib/python3.9/lib-dynload/_tkinter.cpython-39-x86_64-linux-gnu.so +0 -0
  447. package/lib/python3.9/lib-dynload/_xxsubinterpreters.cpython-39-x86_64-linux-gnu.so +0 -0
  448. package/lib/python3.9/lib-dynload/_xxtestfuzz.cpython-39-x86_64-linux-gnu.so +0 -0
  449. package/lib/python3.9/lib-dynload/_zoneinfo.cpython-39-x86_64-linux-gnu.so +0 -0
  450. package/lib/python3.9/lib-dynload/array.cpython-39-x86_64-linux-gnu.so +0 -0
  451. package/lib/python3.9/lib-dynload/audioop.cpython-39-x86_64-linux-gnu.so +0 -0
  452. package/lib/python3.9/lib-dynload/binascii.cpython-39-x86_64-linux-gnu.so +0 -0
  453. package/lib/python3.9/lib-dynload/cmath.cpython-39-x86_64-linux-gnu.so +0 -0
  454. package/lib/python3.9/lib-dynload/fcntl.cpython-39-x86_64-linux-gnu.so +0 -0
  455. package/lib/python3.9/lib-dynload/grp.cpython-39-x86_64-linux-gnu.so +0 -0
  456. package/lib/python3.9/lib-dynload/math.cpython-39-x86_64-linux-gnu.so +0 -0
  457. package/lib/python3.9/lib-dynload/mmap.cpython-39-x86_64-linux-gnu.so +0 -0
  458. package/lib/python3.9/lib-dynload/nis.cpython-39-x86_64-linux-gnu.so +0 -0
  459. package/lib/python3.9/lib-dynload/ossaudiodev.cpython-39-x86_64-linux-gnu.so +0 -0
  460. package/lib/python3.9/lib-dynload/parser.cpython-39-x86_64-linux-gnu.so +0 -0
  461. package/lib/python3.9/lib-dynload/pyexpat.cpython-39-x86_64-linux-gnu.so +0 -0
  462. package/lib/python3.9/lib-dynload/readline.cpython-39-x86_64-linux-gnu.so +0 -0
  463. package/lib/python3.9/lib-dynload/resource.cpython-39-x86_64-linux-gnu.so +0 -0
  464. package/lib/python3.9/lib-dynload/select.cpython-39-x86_64-linux-gnu.so +0 -0
  465. package/lib/python3.9/lib-dynload/spwd.cpython-39-x86_64-linux-gnu.so +0 -0
  466. package/lib/python3.9/lib-dynload/syslog.cpython-39-x86_64-linux-gnu.so +0 -0
  467. package/lib/python3.9/lib-dynload/termios.cpython-39-x86_64-linux-gnu.so +0 -0
  468. package/lib/python3.9/lib-dynload/unicodedata.cpython-39-x86_64-linux-gnu.so +0 -0
  469. package/lib/python3.9/lib-dynload/xxlimited.cpython-39-x86_64-linux-gnu.so +0 -0
  470. package/lib/python3.9/lib-dynload/zlib.cpython-39-x86_64-linux-gnu.so +0 -0
  471. package/lib/python3.9/linecache.py +177 -0
  472. package/lib/python3.9/locale.py +1755 -0
  473. package/lib/python3.9/logging/__init__.py +2208 -0
  474. package/lib/python3.9/logging/config.py +945 -0
  475. package/lib/python3.9/logging/handlers.py +1543 -0
  476. package/lib/python3.9/lzma.py +347 -0
  477. package/lib/python3.9/mailbox.py +2151 -0
  478. package/lib/python3.9/mailcap.py +276 -0
  479. package/lib/python3.9/mimetypes.py +614 -0
  480. package/lib/python3.9/modulefinder.py +685 -0
  481. package/lib/python3.9/multiprocessing/__init__.py +37 -0
  482. package/lib/python3.9/multiprocessing/connection.py +978 -0
  483. package/lib/python3.9/multiprocessing/context.py +362 -0
  484. package/lib/python3.9/multiprocessing/dummy/__init__.py +126 -0
  485. package/lib/python3.9/multiprocessing/dummy/connection.py +75 -0
  486. package/lib/python3.9/multiprocessing/forkserver.py +348 -0
  487. package/lib/python3.9/multiprocessing/heap.py +337 -0
  488. package/lib/python3.9/multiprocessing/managers.py +1369 -0
  489. package/lib/python3.9/multiprocessing/pool.py +954 -0
  490. package/lib/python3.9/multiprocessing/popen_fork.py +83 -0
  491. package/lib/python3.9/multiprocessing/popen_forkserver.py +74 -0
  492. package/lib/python3.9/multiprocessing/popen_spawn_posix.py +72 -0
  493. package/lib/python3.9/multiprocessing/popen_spawn_win32.py +131 -0
  494. package/lib/python3.9/multiprocessing/process.py +432 -0
  495. package/lib/python3.9/multiprocessing/queues.py +380 -0
  496. package/lib/python3.9/multiprocessing/reduction.py +281 -0
  497. package/lib/python3.9/multiprocessing/resource_sharer.py +154 -0
  498. package/lib/python3.9/multiprocessing/resource_tracker.py +231 -0
  499. package/lib/python3.9/multiprocessing/shared_memory.py +532 -0
  500. package/lib/python3.9/multiprocessing/sharedctypes.py +240 -0
  501. package/lib/python3.9/multiprocessing/spawn.py +297 -0
  502. package/lib/python3.9/multiprocessing/synchronize.py +394 -0
  503. package/lib/python3.9/multiprocessing/util.py +489 -0
  504. package/lib/python3.9/netrc.py +139 -0
  505. package/lib/python3.9/nntplib.py +1090 -0
  506. package/lib/python3.9/ntpath.py +794 -0
  507. package/lib/python3.9/nturl2path.py +73 -0
  508. package/lib/python3.9/numbers.py +389 -0
  509. package/lib/python3.9/opcode.py +217 -0
  510. package/lib/python3.9/operator.py +460 -0
  511. package/lib/python3.9/optparse.py +1681 -0
  512. package/lib/python3.9/os.py +1116 -0
  513. package/lib/python3.9/pathlib.py +1576 -0
  514. package/lib/python3.9/pdb.py +1731 -0
  515. package/lib/python3.9/pickle.py +1817 -0
  516. package/lib/python3.9/pickletools.py +2890 -0
  517. package/lib/python3.9/pipes.py +247 -0
  518. package/lib/python3.9/pkgutil.py +707 -0
  519. package/lib/python3.9/platform.py +1259 -0
  520. package/lib/python3.9/plistlib.py +881 -0
  521. package/lib/python3.9/poplib.py +483 -0
  522. package/lib/python3.9/posixpath.py +525 -0
  523. package/lib/python3.9/pprint.py +638 -0
  524. package/lib/python3.9/profile.py +600 -0
  525. package/lib/python3.9/pstats.py +779 -0
  526. package/lib/python3.9/pty.py +172 -0
  527. package/lib/python3.9/py_compile.py +215 -0
  528. package/lib/python3.9/pyclbr.py +404 -0
  529. package/lib/python3.9/pydoc.py +2855 -0
  530. package/lib/python3.9/pydoc_data/__init__.py +0 -0
  531. package/lib/python3.9/pydoc_data/_pydoc.css +6 -0
  532. package/lib/python3.9/pydoc_data/topics.py +13968 -0
  533. package/lib/python3.9/queue.py +326 -0
  534. package/lib/python3.9/quopri.py +242 -0
  535. package/lib/python3.9/random.py +887 -0
  536. package/lib/python3.9/re.py +384 -0
  537. package/lib/python3.9/reprlib.py +161 -0
  538. package/lib/python3.9/rlcompleter.py +205 -0
  539. package/lib/python3.9/runpy.py +300 -0
  540. package/lib/python3.9/sched.py +167 -0
  541. package/lib/python3.9/secrets.py +72 -0
  542. package/lib/python3.9/selectors.py +619 -0
  543. package/lib/python3.9/shelve.py +243 -0
  544. package/lib/python3.9/shlex.py +350 -0
  545. package/lib/python3.9/shutil.py +1443 -0
  546. package/lib/python3.9/signal.py +85 -0
  547. package/lib/python3.9/site.py +643 -0
  548. package/lib/python3.9/smtpd.py +967 -0
  549. package/lib/python3.9/smtplib.py +1123 -0
  550. package/lib/python3.9/sndhdr.py +257 -0
  551. package/lib/python3.9/socket.py +958 -0
  552. package/lib/python3.9/socketserver.py +817 -0
  553. package/lib/python3.9/sqlite3/__init__.py +23 -0
  554. package/lib/python3.9/sqlite3/dbapi2.py +89 -0
  555. package/lib/python3.9/sqlite3/dump.py +70 -0
  556. package/lib/python3.9/sre_compile.py +784 -0
  557. package/lib/python3.9/sre_constants.py +259 -0
  558. package/lib/python3.9/sre_parse.py +1064 -0
  559. package/lib/python3.9/ssl.py +1489 -0
  560. package/lib/python3.9/stat.py +195 -0
  561. package/lib/python3.9/statistics.py +1120 -0
  562. package/lib/python3.9/string.py +280 -0
  563. package/lib/python3.9/stringprep.py +272 -0
  564. package/lib/python3.9/struct.py +15 -0
  565. package/lib/python3.9/subprocess.py +2074 -0
  566. package/lib/python3.9/sunau.py +526 -0
  567. package/lib/python3.9/symbol.py +122 -0
  568. package/lib/python3.9/symtable.py +243 -0
  569. package/lib/python3.9/sysconfig.py +720 -0
  570. package/lib/python3.9/tabnanny.py +333 -0
  571. package/lib/python3.9/tarfile.py +2576 -0
  572. package/lib/python3.9/telnetlib.py +677 -0
  573. package/lib/python3.9/tempfile.py +832 -0
  574. package/lib/python3.9/textwrap.py +486 -0
  575. package/lib/python3.9/this.py +28 -0
  576. package/lib/python3.9/threading.py +1502 -0
  577. package/lib/python3.9/timeit.py +375 -0
  578. package/lib/python3.9/token.py +136 -0
  579. package/lib/python3.9/tokenize.py +682 -0
  580. package/lib/python3.9/trace.py +740 -0
  581. package/lib/python3.9/traceback.py +623 -0
  582. package/lib/python3.9/tracemalloc.py +560 -0
  583. package/lib/python3.9/tty.py +36 -0
  584. package/lib/python3.9/turtle.py +4140 -0
  585. package/lib/python3.9/types.py +299 -0
  586. package/lib/python3.9/typing.py +2147 -0
  587. package/lib/python3.9/unittest/__init__.py +95 -0
  588. package/lib/python3.9/unittest/__main__.py +18 -0
  589. package/lib/python3.9/unittest/_log.py +69 -0
  590. package/lib/python3.9/unittest/async_case.py +160 -0
  591. package/lib/python3.9/unittest/case.py +1437 -0
  592. package/lib/python3.9/unittest/loader.py +517 -0
  593. package/lib/python3.9/unittest/main.py +275 -0
  594. package/lib/python3.9/unittest/mock.py +2891 -0
  595. package/lib/python3.9/unittest/result.py +216 -0
  596. package/lib/python3.9/unittest/runner.py +221 -0
  597. package/lib/python3.9/unittest/signals.py +71 -0
  598. package/lib/python3.9/unittest/suite.py +361 -0
  599. package/lib/python3.9/unittest/util.py +170 -0
  600. package/lib/python3.9/urllib/__init__.py +0 -0
  601. package/lib/python3.9/urllib/error.py +77 -0
  602. package/lib/python3.9/urllib/parse.py +1179 -0
  603. package/lib/python3.9/urllib/request.py +2765 -0
  604. package/lib/python3.9/urllib/response.py +84 -0
  605. package/lib/python3.9/urllib/robotparser.py +273 -0
  606. package/lib/python3.9/uu.py +206 -0
  607. package/lib/python3.9/uuid.py +728 -0
  608. package/lib/python3.9/venv/__init__.py +504 -0
  609. package/lib/python3.9/venv/__main__.py +10 -0
  610. package/lib/python3.9/venv/scripts/common/Activate.ps1 +241 -0
  611. package/lib/python3.9/venv/scripts/common/activate +66 -0
  612. package/lib/python3.9/venv/scripts/posix/activate.csh +25 -0
  613. package/lib/python3.9/venv/scripts/posix/activate.fish +64 -0
  614. package/lib/python3.9/warnings.py +549 -0
  615. package/lib/python3.9/wave.py +513 -0
  616. package/lib/python3.9/weakref.py +664 -0
  617. package/lib/python3.9/webbrowser.py +713 -0
  618. package/lib/python3.9/wsgiref/__init__.py +23 -0
  619. package/lib/python3.9/wsgiref/handlers.py +571 -0
  620. package/lib/python3.9/wsgiref/headers.py +184 -0
  621. package/lib/python3.9/wsgiref/simple_server.py +165 -0
  622. package/lib/python3.9/wsgiref/util.py +172 -0
  623. package/lib/python3.9/wsgiref/validate.py +441 -0
  624. package/lib/python3.9/xdrlib.py +241 -0
  625. package/lib/python3.9/xml/__init__.py +20 -0
  626. package/lib/python3.9/xml/dom/NodeFilter.py +27 -0
  627. package/lib/python3.9/xml/dom/__init__.py +140 -0
  628. package/lib/python3.9/xml/dom/domreg.py +99 -0
  629. package/lib/python3.9/xml/dom/expatbuilder.py +965 -0
  630. package/lib/python3.9/xml/dom/minicompat.py +109 -0
  631. package/lib/python3.9/xml/dom/minidom.py +2011 -0
  632. package/lib/python3.9/xml/dom/pulldom.py +349 -0
  633. package/lib/python3.9/xml/dom/xmlbuilder.py +387 -0
  634. package/lib/python3.9/xml/etree/ElementInclude.py +185 -0
  635. package/lib/python3.9/xml/etree/ElementPath.py +405 -0
  636. package/lib/python3.9/xml/etree/ElementTree.py +2085 -0
  637. package/lib/python3.9/xml/etree/__init__.py +33 -0
  638. package/lib/python3.9/xml/etree/cElementTree.py +3 -0
  639. package/lib/python3.9/xml/parsers/__init__.py +8 -0
  640. package/lib/python3.9/xml/parsers/expat.py +8 -0
  641. package/lib/python3.9/xml/sax/__init__.py +107 -0
  642. package/lib/python3.9/xml/sax/_exceptions.py +131 -0
  643. package/lib/python3.9/xml/sax/expatreader.py +446 -0
  644. package/lib/python3.9/xml/sax/handler.py +342 -0
  645. package/lib/python3.9/xml/sax/saxutils.py +369 -0
  646. package/lib/python3.9/xml/sax/xmlreader.py +380 -0
  647. package/lib/python3.9/xmlrpc/__init__.py +1 -0
  648. package/lib/python3.9/xmlrpc/client.py +1524 -0
  649. package/lib/python3.9/xmlrpc/server.py +993 -0
  650. package/lib/python3.9/zipapp.py +206 -0
  651. package/lib/python3.9/zipfile.py +2426 -0
  652. package/lib/python3.9/zipimport.py +792 -0
  653. package/lib/python3.9/zoneinfo/__init__.py +31 -0
  654. package/lib/python3.9/zoneinfo/_common.py +165 -0
  655. package/lib/python3.9/zoneinfo/_tzpath.py +175 -0
  656. package/lib/python3.9/zoneinfo/_zoneinfo.py +752 -0
  657. package/package.json +1 -1
  658. package/runtime.json +1 -0
  659. package/ssl/cacert.pem +3959 -0
  660. package/bin/vlink +0 -0
@@ -0,0 +1,1189 @@
1
+ """Core implementation of import.
2
+
3
+ This module is NOT meant to be directly imported! It has been designed such
4
+ that it can be bootstrapped into Python as the implementation of import. As
5
+ such it requires the injection of specific modules and attributes in order to
6
+ work. One should use importlib as the public-facing version of this module.
7
+
8
+ """
9
+ #
10
+ # IMPORTANT: Whenever making changes to this module, be sure to run a top-level
11
+ # `make regen-importlib` followed by `make` in order to get the frozen version
12
+ # of the module updated. Not doing so will result in the Makefile to fail for
13
+ # all others who don't have a ./python around to freeze the module
14
+ # in the early stages of compilation.
15
+ #
16
+
17
+ # See importlib._setup() for what is injected into the global namespace.
18
+
19
+ # When editing this code be aware that code executed at import time CANNOT
20
+ # reference any injected objects! This includes not only global code but also
21
+ # anything specified at the class level.
22
+
23
+ # Bootstrap-related code ######################################################
24
+
25
+ _bootstrap_external = None
26
+
27
+ def _wrap(new, old):
28
+ """Simple substitute for functools.update_wrapper."""
29
+ for replace in ['__module__', '__name__', '__qualname__', '__doc__']:
30
+ if hasattr(old, replace):
31
+ setattr(new, replace, getattr(old, replace))
32
+ new.__dict__.update(old.__dict__)
33
+
34
+
35
+ def _new_module(name):
36
+ return type(sys)(name)
37
+
38
+
39
+ # Module-level locking ########################################################
40
+
41
+ # A dict mapping module names to weakrefs of _ModuleLock instances
42
+ # Dictionary protected by the global import lock
43
+ _module_locks = {}
44
+ # A dict mapping thread ids to _ModuleLock instances
45
+ _blocking_on = {}
46
+
47
+
48
+ class _DeadlockError(RuntimeError):
49
+ pass
50
+
51
+
52
+ class _ModuleLock:
53
+ """A recursive lock implementation which is able to detect deadlocks
54
+ (e.g. thread 1 trying to take locks A then B, and thread 2 trying to
55
+ take locks B then A).
56
+ """
57
+
58
+ def __init__(self, name):
59
+ self.lock = _thread.allocate_lock()
60
+ self.wakeup = _thread.allocate_lock()
61
+ self.name = name
62
+ self.owner = None
63
+ self.count = 0
64
+ self.waiters = 0
65
+
66
+ def has_deadlock(self):
67
+ # Deadlock avoidance for concurrent circular imports.
68
+ me = _thread.get_ident()
69
+ tid = self.owner
70
+ seen = set()
71
+ while True:
72
+ lock = _blocking_on.get(tid)
73
+ if lock is None:
74
+ return False
75
+ tid = lock.owner
76
+ if tid == me:
77
+ return True
78
+ if tid in seen:
79
+ # bpo 38091: the chain of tid's we encounter here
80
+ # eventually leads to a fixpoint or a cycle, but
81
+ # does not reach 'me'. This means we would not
82
+ # actually deadlock. This can happen if other
83
+ # threads are at the beginning of acquire() below.
84
+ return False
85
+ seen.add(tid)
86
+
87
+ def acquire(self):
88
+ """
89
+ Acquire the module lock. If a potential deadlock is detected,
90
+ a _DeadlockError is raised.
91
+ Otherwise, the lock is always acquired and True is returned.
92
+ """
93
+ tid = _thread.get_ident()
94
+ _blocking_on[tid] = self
95
+ try:
96
+ while True:
97
+ with self.lock:
98
+ if self.count == 0 or self.owner == tid:
99
+ self.owner = tid
100
+ self.count += 1
101
+ return True
102
+ if self.has_deadlock():
103
+ raise _DeadlockError('deadlock detected by %r' % self)
104
+ if self.wakeup.acquire(False):
105
+ self.waiters += 1
106
+ # Wait for a release() call
107
+ self.wakeup.acquire()
108
+ self.wakeup.release()
109
+ finally:
110
+ del _blocking_on[tid]
111
+
112
+ def release(self):
113
+ tid = _thread.get_ident()
114
+ with self.lock:
115
+ if self.owner != tid:
116
+ raise RuntimeError('cannot release un-acquired lock')
117
+ assert self.count > 0
118
+ self.count -= 1
119
+ if self.count == 0:
120
+ self.owner = None
121
+ if self.waiters:
122
+ self.waiters -= 1
123
+ self.wakeup.release()
124
+
125
+ def __repr__(self):
126
+ return '_ModuleLock({!r}) at {}'.format(self.name, id(self))
127
+
128
+
129
+ class _DummyModuleLock:
130
+ """A simple _ModuleLock equivalent for Python builds without
131
+ multi-threading support."""
132
+
133
+ def __init__(self, name):
134
+ self.name = name
135
+ self.count = 0
136
+
137
+ def acquire(self):
138
+ self.count += 1
139
+ return True
140
+
141
+ def release(self):
142
+ if self.count == 0:
143
+ raise RuntimeError('cannot release un-acquired lock')
144
+ self.count -= 1
145
+
146
+ def __repr__(self):
147
+ return '_DummyModuleLock({!r}) at {}'.format(self.name, id(self))
148
+
149
+
150
+ class _ModuleLockManager:
151
+
152
+ def __init__(self, name):
153
+ self._name = name
154
+ self._lock = None
155
+
156
+ def __enter__(self):
157
+ self._lock = _get_module_lock(self._name)
158
+ self._lock.acquire()
159
+
160
+ def __exit__(self, *args, **kwargs):
161
+ self._lock.release()
162
+
163
+
164
+ # The following two functions are for consumption by Python/import.c.
165
+
166
+ def _get_module_lock(name):
167
+ """Get or create the module lock for a given module name.
168
+
169
+ Acquire/release internally the global import lock to protect
170
+ _module_locks."""
171
+
172
+ _imp.acquire_lock()
173
+ try:
174
+ try:
175
+ lock = _module_locks[name]()
176
+ except KeyError:
177
+ lock = None
178
+
179
+ if lock is None:
180
+ if _thread is None:
181
+ lock = _DummyModuleLock(name)
182
+ else:
183
+ lock = _ModuleLock(name)
184
+
185
+ def cb(ref, name=name):
186
+ _imp.acquire_lock()
187
+ try:
188
+ # bpo-31070: Check if another thread created a new lock
189
+ # after the previous lock was destroyed
190
+ # but before the weakref callback was called.
191
+ if _module_locks.get(name) is ref:
192
+ del _module_locks[name]
193
+ finally:
194
+ _imp.release_lock()
195
+
196
+ _module_locks[name] = _weakref.ref(lock, cb)
197
+ finally:
198
+ _imp.release_lock()
199
+
200
+ return lock
201
+
202
+
203
+ def _lock_unlock_module(name):
204
+ """Acquires then releases the module lock for a given module name.
205
+
206
+ This is used to ensure a module is completely initialized, in the
207
+ event it is being imported by another thread.
208
+ """
209
+ lock = _get_module_lock(name)
210
+ try:
211
+ lock.acquire()
212
+ except _DeadlockError:
213
+ # Concurrent circular import, we'll accept a partially initialized
214
+ # module object.
215
+ pass
216
+ else:
217
+ lock.release()
218
+
219
+ # Frame stripping magic ###############################################
220
+ def _call_with_frames_removed(f, *args, **kwds):
221
+ """remove_importlib_frames in import.c will always remove sequences
222
+ of importlib frames that end with a call to this function
223
+
224
+ Use it instead of a normal call in places where including the importlib
225
+ frames introduces unwanted noise into the traceback (e.g. when executing
226
+ module code)
227
+ """
228
+ return f(*args, **kwds)
229
+
230
+
231
+ def _verbose_message(message, *args, verbosity=1):
232
+ """Print the message to stderr if -v/PYTHONVERBOSE is turned on."""
233
+ if sys.flags.verbose >= verbosity:
234
+ if not message.startswith(('#', 'import ')):
235
+ message = '# ' + message
236
+ print(message.format(*args), file=sys.stderr)
237
+
238
+
239
+ def _requires_builtin(fxn):
240
+ """Decorator to verify the named module is built-in."""
241
+ def _requires_builtin_wrapper(self, fullname):
242
+ if fullname not in sys.builtin_module_names:
243
+ raise ImportError('{!r} is not a built-in module'.format(fullname),
244
+ name=fullname)
245
+ return fxn(self, fullname)
246
+ _wrap(_requires_builtin_wrapper, fxn)
247
+ return _requires_builtin_wrapper
248
+
249
+
250
+ def _requires_frozen(fxn):
251
+ """Decorator to verify the named module is frozen."""
252
+ def _requires_frozen_wrapper(self, fullname):
253
+ if not _imp.is_frozen(fullname):
254
+ raise ImportError('{!r} is not a frozen module'.format(fullname),
255
+ name=fullname)
256
+ return fxn(self, fullname)
257
+ _wrap(_requires_frozen_wrapper, fxn)
258
+ return _requires_frozen_wrapper
259
+
260
+
261
+ # Typically used by loader classes as a method replacement.
262
+ def _load_module_shim(self, fullname):
263
+ """Load the specified module into sys.modules and return it.
264
+
265
+ This method is deprecated. Use loader.exec_module instead.
266
+
267
+ """
268
+ spec = spec_from_loader(fullname, self)
269
+ if fullname in sys.modules:
270
+ module = sys.modules[fullname]
271
+ _exec(spec, module)
272
+ return sys.modules[fullname]
273
+ else:
274
+ return _load(spec)
275
+
276
+ # Module specifications #######################################################
277
+
278
+ def _module_repr(module):
279
+ # The implementation of ModuleType.__repr__().
280
+ loader = getattr(module, '__loader__', None)
281
+ if hasattr(loader, 'module_repr'):
282
+ # As soon as BuiltinImporter, FrozenImporter, and NamespaceLoader
283
+ # drop their implementations for module_repr. we can add a
284
+ # deprecation warning here.
285
+ try:
286
+ return loader.module_repr(module)
287
+ except Exception:
288
+ pass
289
+ try:
290
+ spec = module.__spec__
291
+ except AttributeError:
292
+ pass
293
+ else:
294
+ if spec is not None:
295
+ return _module_repr_from_spec(spec)
296
+
297
+ # We could use module.__class__.__name__ instead of 'module' in the
298
+ # various repr permutations.
299
+ try:
300
+ name = module.__name__
301
+ except AttributeError:
302
+ name = '?'
303
+ try:
304
+ filename = module.__file__
305
+ except AttributeError:
306
+ if loader is None:
307
+ return '<module {!r}>'.format(name)
308
+ else:
309
+ return '<module {!r} ({!r})>'.format(name, loader)
310
+ else:
311
+ return '<module {!r} from {!r}>'.format(name, filename)
312
+
313
+
314
+ class ModuleSpec:
315
+ """The specification for a module, used for loading.
316
+
317
+ A module's spec is the source for information about the module. For
318
+ data associated with the module, including source, use the spec's
319
+ loader.
320
+
321
+ `name` is the absolute name of the module. `loader` is the loader
322
+ to use when loading the module. `parent` is the name of the
323
+ package the module is in. The parent is derived from the name.
324
+
325
+ `is_package` determines if the module is considered a package or
326
+ not. On modules this is reflected by the `__path__` attribute.
327
+
328
+ `origin` is the specific location used by the loader from which to
329
+ load the module, if that information is available. When filename is
330
+ set, origin will match.
331
+
332
+ `has_location` indicates that a spec's "origin" reflects a location.
333
+ When this is True, `__file__` attribute of the module is set.
334
+
335
+ `cached` is the location of the cached bytecode file, if any. It
336
+ corresponds to the `__cached__` attribute.
337
+
338
+ `submodule_search_locations` is the sequence of path entries to
339
+ search when importing submodules. If set, is_package should be
340
+ True--and False otherwise.
341
+
342
+ Packages are simply modules that (may) have submodules. If a spec
343
+ has a non-None value in `submodule_search_locations`, the import
344
+ system will consider modules loaded from the spec as packages.
345
+
346
+ Only finders (see importlib.abc.MetaPathFinder and
347
+ importlib.abc.PathEntryFinder) should modify ModuleSpec instances.
348
+
349
+ """
350
+
351
+ def __init__(self, name, loader, *, origin=None, loader_state=None,
352
+ is_package=None):
353
+ self.name = name
354
+ self.loader = loader
355
+ self.origin = origin
356
+ self.loader_state = loader_state
357
+ self.submodule_search_locations = [] if is_package else None
358
+
359
+ # file-location attributes
360
+ self._set_fileattr = False
361
+ self._cached = None
362
+
363
+ def __repr__(self):
364
+ args = ['name={!r}'.format(self.name),
365
+ 'loader={!r}'.format(self.loader)]
366
+ if self.origin is not None:
367
+ args.append('origin={!r}'.format(self.origin))
368
+ if self.submodule_search_locations is not None:
369
+ args.append('submodule_search_locations={}'
370
+ .format(self.submodule_search_locations))
371
+ return '{}({})'.format(self.__class__.__name__, ', '.join(args))
372
+
373
+ def __eq__(self, other):
374
+ smsl = self.submodule_search_locations
375
+ try:
376
+ return (self.name == other.name and
377
+ self.loader == other.loader and
378
+ self.origin == other.origin and
379
+ smsl == other.submodule_search_locations and
380
+ self.cached == other.cached and
381
+ self.has_location == other.has_location)
382
+ except AttributeError:
383
+ return NotImplemented
384
+
385
+ @property
386
+ def cached(self):
387
+ if self._cached is None:
388
+ if self.origin is not None and self._set_fileattr:
389
+ if _bootstrap_external is None:
390
+ raise NotImplementedError
391
+ self._cached = _bootstrap_external._get_cached(self.origin)
392
+ return self._cached
393
+
394
+ @cached.setter
395
+ def cached(self, cached):
396
+ self._cached = cached
397
+
398
+ @property
399
+ def parent(self):
400
+ """The name of the module's parent."""
401
+ if self.submodule_search_locations is None:
402
+ return self.name.rpartition('.')[0]
403
+ else:
404
+ return self.name
405
+
406
+ @property
407
+ def has_location(self):
408
+ return self._set_fileattr
409
+
410
+ @has_location.setter
411
+ def has_location(self, value):
412
+ self._set_fileattr = bool(value)
413
+
414
+
415
+ def spec_from_loader(name, loader, *, origin=None, is_package=None):
416
+ """Return a module spec based on various loader methods."""
417
+ if hasattr(loader, 'get_filename'):
418
+ if _bootstrap_external is None:
419
+ raise NotImplementedError
420
+ spec_from_file_location = _bootstrap_external.spec_from_file_location
421
+
422
+ if is_package is None:
423
+ return spec_from_file_location(name, loader=loader)
424
+ search = [] if is_package else None
425
+ return spec_from_file_location(name, loader=loader,
426
+ submodule_search_locations=search)
427
+
428
+ if is_package is None:
429
+ if hasattr(loader, 'is_package'):
430
+ try:
431
+ is_package = loader.is_package(name)
432
+ except ImportError:
433
+ is_package = None # aka, undefined
434
+ else:
435
+ # the default
436
+ is_package = False
437
+
438
+ return ModuleSpec(name, loader, origin=origin, is_package=is_package)
439
+
440
+
441
+ def _spec_from_module(module, loader=None, origin=None):
442
+ # This function is meant for use in _setup().
443
+ try:
444
+ spec = module.__spec__
445
+ except AttributeError:
446
+ pass
447
+ else:
448
+ if spec is not None:
449
+ return spec
450
+
451
+ name = module.__name__
452
+ if loader is None:
453
+ try:
454
+ loader = module.__loader__
455
+ except AttributeError:
456
+ # loader will stay None.
457
+ pass
458
+ try:
459
+ location = module.__file__
460
+ except AttributeError:
461
+ location = None
462
+ if origin is None:
463
+ if location is None:
464
+ try:
465
+ origin = loader._ORIGIN
466
+ except AttributeError:
467
+ origin = None
468
+ else:
469
+ origin = location
470
+ try:
471
+ cached = module.__cached__
472
+ except AttributeError:
473
+ cached = None
474
+ try:
475
+ submodule_search_locations = list(module.__path__)
476
+ except AttributeError:
477
+ submodule_search_locations = None
478
+
479
+ spec = ModuleSpec(name, loader, origin=origin)
480
+ spec._set_fileattr = False if location is None else True
481
+ spec.cached = cached
482
+ spec.submodule_search_locations = submodule_search_locations
483
+ return spec
484
+
485
+
486
+ def _init_module_attrs(spec, module, *, override=False):
487
+ # The passed-in module may be not support attribute assignment,
488
+ # in which case we simply don't set the attributes.
489
+ # __name__
490
+ if (override or getattr(module, '__name__', None) is None):
491
+ try:
492
+ module.__name__ = spec.name
493
+ except AttributeError:
494
+ pass
495
+ # __loader__
496
+ if override or getattr(module, '__loader__', None) is None:
497
+ loader = spec.loader
498
+ if loader is None:
499
+ # A backward compatibility hack.
500
+ if spec.submodule_search_locations is not None:
501
+ if _bootstrap_external is None:
502
+ raise NotImplementedError
503
+ _NamespaceLoader = _bootstrap_external._NamespaceLoader
504
+
505
+ loader = _NamespaceLoader.__new__(_NamespaceLoader)
506
+ loader._path = spec.submodule_search_locations
507
+ spec.loader = loader
508
+ # While the docs say that module.__file__ is not set for
509
+ # built-in modules, and the code below will avoid setting it if
510
+ # spec.has_location is false, this is incorrect for namespace
511
+ # packages. Namespace packages have no location, but their
512
+ # __spec__.origin is None, and thus their module.__file__
513
+ # should also be None for consistency. While a bit of a hack,
514
+ # this is the best place to ensure this consistency.
515
+ #
516
+ # See # https://docs.python.org/3/library/importlib.html#importlib.abc.Loader.load_module
517
+ # and bpo-32305
518
+ module.__file__ = None
519
+ try:
520
+ module.__loader__ = loader
521
+ except AttributeError:
522
+ pass
523
+ # __package__
524
+ if override or getattr(module, '__package__', None) is None:
525
+ try:
526
+ module.__package__ = spec.parent
527
+ except AttributeError:
528
+ pass
529
+ # __spec__
530
+ try:
531
+ module.__spec__ = spec
532
+ except AttributeError:
533
+ pass
534
+ # __path__
535
+ if override or getattr(module, '__path__', None) is None:
536
+ if spec.submodule_search_locations is not None:
537
+ try:
538
+ module.__path__ = spec.submodule_search_locations
539
+ except AttributeError:
540
+ pass
541
+ # __file__/__cached__
542
+ if spec.has_location:
543
+ if override or getattr(module, '__file__', None) is None:
544
+ try:
545
+ module.__file__ = spec.origin
546
+ except AttributeError:
547
+ pass
548
+
549
+ if override or getattr(module, '__cached__', None) is None:
550
+ if spec.cached is not None:
551
+ try:
552
+ module.__cached__ = spec.cached
553
+ except AttributeError:
554
+ pass
555
+ return module
556
+
557
+
558
+ def module_from_spec(spec):
559
+ """Create a module based on the provided spec."""
560
+ # Typically loaders will not implement create_module().
561
+ module = None
562
+ if hasattr(spec.loader, 'create_module'):
563
+ # If create_module() returns `None` then it means default
564
+ # module creation should be used.
565
+ module = spec.loader.create_module(spec)
566
+ elif hasattr(spec.loader, 'exec_module'):
567
+ raise ImportError('loaders that define exec_module() '
568
+ 'must also define create_module()')
569
+ if module is None:
570
+ module = _new_module(spec.name)
571
+ _init_module_attrs(spec, module)
572
+ return module
573
+
574
+
575
+ def _module_repr_from_spec(spec):
576
+ """Return the repr to use for the module."""
577
+ # We mostly replicate _module_repr() using the spec attributes.
578
+ name = '?' if spec.name is None else spec.name
579
+ if spec.origin is None:
580
+ if spec.loader is None:
581
+ return '<module {!r}>'.format(name)
582
+ else:
583
+ return '<module {!r} ({!r})>'.format(name, spec.loader)
584
+ else:
585
+ if spec.has_location:
586
+ return '<module {!r} from {!r}>'.format(name, spec.origin)
587
+ else:
588
+ return '<module {!r} ({})>'.format(spec.name, spec.origin)
589
+
590
+
591
+ # Used by importlib.reload() and _load_module_shim().
592
+ def _exec(spec, module):
593
+ """Execute the spec's specified module in an existing module's namespace."""
594
+ name = spec.name
595
+ with _ModuleLockManager(name):
596
+ if sys.modules.get(name) is not module:
597
+ msg = 'module {!r} not in sys.modules'.format(name)
598
+ raise ImportError(msg, name=name)
599
+ try:
600
+ if spec.loader is None:
601
+ if spec.submodule_search_locations is None:
602
+ raise ImportError('missing loader', name=spec.name)
603
+ # Namespace package.
604
+ _init_module_attrs(spec, module, override=True)
605
+ else:
606
+ _init_module_attrs(spec, module, override=True)
607
+ if not hasattr(spec.loader, 'exec_module'):
608
+ # (issue19713) Once BuiltinImporter and ExtensionFileLoader
609
+ # have exec_module() implemented, we can add a deprecation
610
+ # warning here.
611
+ spec.loader.load_module(name)
612
+ else:
613
+ spec.loader.exec_module(module)
614
+ finally:
615
+ # Update the order of insertion into sys.modules for module
616
+ # clean-up at shutdown.
617
+ module = sys.modules.pop(spec.name)
618
+ sys.modules[spec.name] = module
619
+ return module
620
+
621
+
622
+ def _load_backward_compatible(spec):
623
+ # (issue19713) Once BuiltinImporter and ExtensionFileLoader
624
+ # have exec_module() implemented, we can add a deprecation
625
+ # warning here.
626
+ try:
627
+ spec.loader.load_module(spec.name)
628
+ except:
629
+ if spec.name in sys.modules:
630
+ module = sys.modules.pop(spec.name)
631
+ sys.modules[spec.name] = module
632
+ raise
633
+ # The module must be in sys.modules at this point!
634
+ # Move it to the end of sys.modules.
635
+ module = sys.modules.pop(spec.name)
636
+ sys.modules[spec.name] = module
637
+ if getattr(module, '__loader__', None) is None:
638
+ try:
639
+ module.__loader__ = spec.loader
640
+ except AttributeError:
641
+ pass
642
+ if getattr(module, '__package__', None) is None:
643
+ try:
644
+ # Since module.__path__ may not line up with
645
+ # spec.submodule_search_paths, we can't necessarily rely
646
+ # on spec.parent here.
647
+ module.__package__ = module.__name__
648
+ if not hasattr(module, '__path__'):
649
+ module.__package__ = spec.name.rpartition('.')[0]
650
+ except AttributeError:
651
+ pass
652
+ if getattr(module, '__spec__', None) is None:
653
+ try:
654
+ module.__spec__ = spec
655
+ except AttributeError:
656
+ pass
657
+ return module
658
+
659
+ def _load_unlocked(spec):
660
+ # A helper for direct use by the import system.
661
+ if spec.loader is not None:
662
+ # Not a namespace package.
663
+ if not hasattr(spec.loader, 'exec_module'):
664
+ return _load_backward_compatible(spec)
665
+
666
+ module = module_from_spec(spec)
667
+
668
+ # This must be done before putting the module in sys.modules
669
+ # (otherwise an optimization shortcut in import.c becomes
670
+ # wrong).
671
+ spec._initializing = True
672
+ try:
673
+ sys.modules[spec.name] = module
674
+ try:
675
+ if spec.loader is None:
676
+ if spec.submodule_search_locations is None:
677
+ raise ImportError('missing loader', name=spec.name)
678
+ # A namespace package so do nothing.
679
+ else:
680
+ spec.loader.exec_module(module)
681
+ except:
682
+ try:
683
+ del sys.modules[spec.name]
684
+ except KeyError:
685
+ pass
686
+ raise
687
+ # Move the module to the end of sys.modules.
688
+ # We don't ensure that the import-related module attributes get
689
+ # set in the sys.modules replacement case. Such modules are on
690
+ # their own.
691
+ module = sys.modules.pop(spec.name)
692
+ sys.modules[spec.name] = module
693
+ _verbose_message('import {!r} # {!r}', spec.name, spec.loader)
694
+ finally:
695
+ spec._initializing = False
696
+
697
+ return module
698
+
699
+ # A method used during testing of _load_unlocked() and by
700
+ # _load_module_shim().
701
+ def _load(spec):
702
+ """Return a new module object, loaded by the spec's loader.
703
+
704
+ The module is not added to its parent.
705
+
706
+ If a module is already in sys.modules, that existing module gets
707
+ clobbered.
708
+
709
+ """
710
+ with _ModuleLockManager(spec.name):
711
+ return _load_unlocked(spec)
712
+
713
+
714
+ # Loaders #####################################################################
715
+
716
+ class BuiltinImporter:
717
+
718
+ """Meta path import for built-in modules.
719
+
720
+ All methods are either class or static methods to avoid the need to
721
+ instantiate the class.
722
+
723
+ """
724
+
725
+ _ORIGIN = "built-in"
726
+
727
+ @staticmethod
728
+ def module_repr(module):
729
+ """Return repr for the module.
730
+
731
+ The method is deprecated. The import machinery does the job itself.
732
+
733
+ """
734
+ return f'<module {module.__name__!r} ({BuiltinImporter._ORIGIN})>'
735
+
736
+ @classmethod
737
+ def find_spec(cls, fullname, path=None, target=None):
738
+ if path is not None:
739
+ return None
740
+ if _imp.is_builtin(fullname):
741
+ return spec_from_loader(fullname, cls, origin=cls._ORIGIN)
742
+ else:
743
+ return None
744
+
745
+ @classmethod
746
+ def find_module(cls, fullname, path=None):
747
+ """Find the built-in module.
748
+
749
+ If 'path' is ever specified then the search is considered a failure.
750
+
751
+ This method is deprecated. Use find_spec() instead.
752
+
753
+ """
754
+ spec = cls.find_spec(fullname, path)
755
+ return spec.loader if spec is not None else None
756
+
757
+ @classmethod
758
+ def create_module(self, spec):
759
+ """Create a built-in module"""
760
+ if spec.name not in sys.builtin_module_names:
761
+ raise ImportError('{!r} is not a built-in module'.format(spec.name),
762
+ name=spec.name)
763
+ return _call_with_frames_removed(_imp.create_builtin, spec)
764
+
765
+ @classmethod
766
+ def exec_module(self, module):
767
+ """Exec a built-in module"""
768
+ _call_with_frames_removed(_imp.exec_builtin, module)
769
+
770
+ @classmethod
771
+ @_requires_builtin
772
+ def get_code(cls, fullname):
773
+ """Return None as built-in modules do not have code objects."""
774
+ return None
775
+
776
+ @classmethod
777
+ @_requires_builtin
778
+ def get_source(cls, fullname):
779
+ """Return None as built-in modules do not have source code."""
780
+ return None
781
+
782
+ @classmethod
783
+ @_requires_builtin
784
+ def is_package(cls, fullname):
785
+ """Return False as built-in modules are never packages."""
786
+ return False
787
+
788
+ load_module = classmethod(_load_module_shim)
789
+
790
+
791
+ class FrozenImporter:
792
+
793
+ """Meta path import for frozen modules.
794
+
795
+ All methods are either class or static methods to avoid the need to
796
+ instantiate the class.
797
+
798
+ """
799
+
800
+ _ORIGIN = "frozen"
801
+
802
+ @staticmethod
803
+ def module_repr(m):
804
+ """Return repr for the module.
805
+
806
+ The method is deprecated. The import machinery does the job itself.
807
+
808
+ """
809
+ return '<module {!r} ({})>'.format(m.__name__, FrozenImporter._ORIGIN)
810
+
811
+ @classmethod
812
+ def find_spec(cls, fullname, path=None, target=None):
813
+ if _imp.is_frozen(fullname):
814
+ return spec_from_loader(fullname, cls, origin=cls._ORIGIN)
815
+ else:
816
+ return None
817
+
818
+ @classmethod
819
+ def find_module(cls, fullname, path=None):
820
+ """Find a frozen module.
821
+
822
+ This method is deprecated. Use find_spec() instead.
823
+
824
+ """
825
+ return cls if _imp.is_frozen(fullname) else None
826
+
827
+ @classmethod
828
+ def create_module(cls, spec):
829
+ """Use default semantics for module creation."""
830
+
831
+ @staticmethod
832
+ def exec_module(module):
833
+ name = module.__spec__.name
834
+ if not _imp.is_frozen(name):
835
+ raise ImportError('{!r} is not a frozen module'.format(name),
836
+ name=name)
837
+ code = _call_with_frames_removed(_imp.get_frozen_object, name)
838
+ exec(code, module.__dict__)
839
+
840
+ @classmethod
841
+ def load_module(cls, fullname):
842
+ """Load a frozen module.
843
+
844
+ This method is deprecated. Use exec_module() instead.
845
+
846
+ """
847
+ return _load_module_shim(cls, fullname)
848
+
849
+ @classmethod
850
+ @_requires_frozen
851
+ def get_code(cls, fullname):
852
+ """Return the code object for the frozen module."""
853
+ return _imp.get_frozen_object(fullname)
854
+
855
+ @classmethod
856
+ @_requires_frozen
857
+ def get_source(cls, fullname):
858
+ """Return None as frozen modules do not have source code."""
859
+ return None
860
+
861
+ @classmethod
862
+ @_requires_frozen
863
+ def is_package(cls, fullname):
864
+ """Return True if the frozen module is a package."""
865
+ return _imp.is_frozen_package(fullname)
866
+
867
+
868
+ # Import itself ###############################################################
869
+
870
+ class _ImportLockContext:
871
+
872
+ """Context manager for the import lock."""
873
+
874
+ def __enter__(self):
875
+ """Acquire the import lock."""
876
+ _imp.acquire_lock()
877
+
878
+ def __exit__(self, exc_type, exc_value, exc_traceback):
879
+ """Release the import lock regardless of any raised exceptions."""
880
+ _imp.release_lock()
881
+
882
+
883
+ def _resolve_name(name, package, level):
884
+ """Resolve a relative module name to an absolute one."""
885
+ bits = package.rsplit('.', level - 1)
886
+ if len(bits) < level:
887
+ raise ImportError('attempted relative import beyond top-level package')
888
+ base = bits[0]
889
+ return '{}.{}'.format(base, name) if name else base
890
+
891
+
892
+ def _find_spec_legacy(finder, name, path):
893
+ # This would be a good place for a DeprecationWarning if
894
+ # we ended up going that route.
895
+ loader = finder.find_module(name, path)
896
+ if loader is None:
897
+ return None
898
+ return spec_from_loader(name, loader)
899
+
900
+
901
+ def _find_spec(name, path, target=None):
902
+ """Find a module's spec."""
903
+ meta_path = sys.meta_path
904
+ if meta_path is None:
905
+ # PyImport_Cleanup() is running or has been called.
906
+ raise ImportError("sys.meta_path is None, Python is likely "
907
+ "shutting down")
908
+
909
+ if not meta_path:
910
+ _warnings.warn('sys.meta_path is empty', ImportWarning)
911
+
912
+ # We check sys.modules here for the reload case. While a passed-in
913
+ # target will usually indicate a reload there is no guarantee, whereas
914
+ # sys.modules provides one.
915
+ is_reload = name in sys.modules
916
+ for finder in meta_path:
917
+ with _ImportLockContext():
918
+ try:
919
+ find_spec = finder.find_spec
920
+ except AttributeError:
921
+ spec = _find_spec_legacy(finder, name, path)
922
+ if spec is None:
923
+ continue
924
+ else:
925
+ spec = find_spec(name, path, target)
926
+ if spec is not None:
927
+ # The parent import may have already imported this module.
928
+ if not is_reload and name in sys.modules:
929
+ module = sys.modules[name]
930
+ try:
931
+ __spec__ = module.__spec__
932
+ except AttributeError:
933
+ # We use the found spec since that is the one that
934
+ # we would have used if the parent module hadn't
935
+ # beaten us to the punch.
936
+ return spec
937
+ else:
938
+ if __spec__ is None:
939
+ return spec
940
+ else:
941
+ return __spec__
942
+ else:
943
+ return spec
944
+ else:
945
+ return None
946
+
947
+
948
+ def _sanity_check(name, package, level):
949
+ """Verify arguments are "sane"."""
950
+ if not isinstance(name, str):
951
+ raise TypeError('module name must be str, not {}'.format(type(name)))
952
+ if level < 0:
953
+ raise ValueError('level must be >= 0')
954
+ if level > 0:
955
+ if not isinstance(package, str):
956
+ raise TypeError('__package__ not set to a string')
957
+ elif not package:
958
+ raise ImportError('attempted relative import with no known parent '
959
+ 'package')
960
+ if not name and level == 0:
961
+ raise ValueError('Empty module name')
962
+
963
+
964
+ _ERR_MSG_PREFIX = 'No module named '
965
+ _ERR_MSG = _ERR_MSG_PREFIX + '{!r}'
966
+
967
+ def _find_and_load_unlocked(name, import_):
968
+ path = None
969
+ parent = name.rpartition('.')[0]
970
+ if parent:
971
+ if parent not in sys.modules:
972
+ _call_with_frames_removed(import_, parent)
973
+ # Crazy side-effects!
974
+ if name in sys.modules:
975
+ return sys.modules[name]
976
+ parent_module = sys.modules[parent]
977
+ try:
978
+ path = parent_module.__path__
979
+ except AttributeError:
980
+ msg = (_ERR_MSG + '; {!r} is not a package').format(name, parent)
981
+ raise ModuleNotFoundError(msg, name=name) from None
982
+ spec = _find_spec(name, path)
983
+ if spec is None:
984
+ raise ModuleNotFoundError(_ERR_MSG.format(name), name=name)
985
+ else:
986
+ module = _load_unlocked(spec)
987
+ if parent:
988
+ # Set the module as an attribute on its parent.
989
+ parent_module = sys.modules[parent]
990
+ child = name.rpartition('.')[2]
991
+ try:
992
+ setattr(parent_module, child, module)
993
+ except AttributeError:
994
+ msg = f"Cannot set an attribute on {parent!r} for child module {child!r}"
995
+ _warnings.warn(msg, ImportWarning)
996
+ return module
997
+
998
+
999
+ _NEEDS_LOADING = object()
1000
+
1001
+
1002
+ def _find_and_load(name, import_):
1003
+ """Find and load the module."""
1004
+ with _ModuleLockManager(name):
1005
+ module = sys.modules.get(name, _NEEDS_LOADING)
1006
+ if module is _NEEDS_LOADING:
1007
+ return _find_and_load_unlocked(name, import_)
1008
+
1009
+ if module is None:
1010
+ message = ('import of {} halted; '
1011
+ 'None in sys.modules'.format(name))
1012
+ raise ModuleNotFoundError(message, name=name)
1013
+
1014
+ _lock_unlock_module(name)
1015
+ return module
1016
+
1017
+
1018
+ def _gcd_import(name, package=None, level=0):
1019
+ """Import and return the module based on its name, the package the call is
1020
+ being made from, and the level adjustment.
1021
+
1022
+ This function represents the greatest common denominator of functionality
1023
+ between import_module and __import__. This includes setting __package__ if
1024
+ the loader did not.
1025
+
1026
+ """
1027
+ _sanity_check(name, package, level)
1028
+ if level > 0:
1029
+ name = _resolve_name(name, package, level)
1030
+ return _find_and_load(name, _gcd_import)
1031
+
1032
+
1033
+ def _handle_fromlist(module, fromlist, import_, *, recursive=False):
1034
+ """Figure out what __import__ should return.
1035
+
1036
+ The import_ parameter is a callable which takes the name of module to
1037
+ import. It is required to decouple the function from assuming importlib's
1038
+ import implementation is desired.
1039
+
1040
+ """
1041
+ # The hell that is fromlist ...
1042
+ # If a package was imported, try to import stuff from fromlist.
1043
+ for x in fromlist:
1044
+ if not isinstance(x, str):
1045
+ if recursive:
1046
+ where = module.__name__ + '.__all__'
1047
+ else:
1048
+ where = "``from list''"
1049
+ raise TypeError(f"Item in {where} must be str, "
1050
+ f"not {type(x).__name__}")
1051
+ elif x == '*':
1052
+ if not recursive and hasattr(module, '__all__'):
1053
+ _handle_fromlist(module, module.__all__, import_,
1054
+ recursive=True)
1055
+ elif not hasattr(module, x):
1056
+ from_name = '{}.{}'.format(module.__name__, x)
1057
+ try:
1058
+ _call_with_frames_removed(import_, from_name)
1059
+ except ModuleNotFoundError as exc:
1060
+ # Backwards-compatibility dictates we ignore failed
1061
+ # imports triggered by fromlist for modules that don't
1062
+ # exist.
1063
+ if (exc.name == from_name and
1064
+ sys.modules.get(from_name, _NEEDS_LOADING) is not None):
1065
+ continue
1066
+ raise
1067
+ return module
1068
+
1069
+
1070
+ def _calc___package__(globals):
1071
+ """Calculate what __package__ should be.
1072
+
1073
+ __package__ is not guaranteed to be defined or could be set to None
1074
+ to represent that its proper value is unknown.
1075
+
1076
+ """
1077
+ package = globals.get('__package__')
1078
+ spec = globals.get('__spec__')
1079
+ if package is not None:
1080
+ if spec is not None and package != spec.parent:
1081
+ _warnings.warn("__package__ != __spec__.parent "
1082
+ f"({package!r} != {spec.parent!r})",
1083
+ ImportWarning, stacklevel=3)
1084
+ return package
1085
+ elif spec is not None:
1086
+ return spec.parent
1087
+ else:
1088
+ _warnings.warn("can't resolve package from __spec__ or __package__, "
1089
+ "falling back on __name__ and __path__",
1090
+ ImportWarning, stacklevel=3)
1091
+ package = globals['__name__']
1092
+ if '__path__' not in globals:
1093
+ package = package.rpartition('.')[0]
1094
+ return package
1095
+
1096
+
1097
+ def __import__(name, globals=None, locals=None, fromlist=(), level=0):
1098
+ """Import a module.
1099
+
1100
+ The 'globals' argument is used to infer where the import is occurring from
1101
+ to handle relative imports. The 'locals' argument is ignored. The
1102
+ 'fromlist' argument specifies what should exist as attributes on the module
1103
+ being imported (e.g. ``from module import <fromlist>``). The 'level'
1104
+ argument represents the package location to import from in a relative
1105
+ import (e.g. ``from ..pkg import mod`` would have a 'level' of 2).
1106
+
1107
+ """
1108
+ if level == 0:
1109
+ module = _gcd_import(name)
1110
+ else:
1111
+ globals_ = globals if globals is not None else {}
1112
+ package = _calc___package__(globals_)
1113
+ module = _gcd_import(name, package, level)
1114
+ if not fromlist:
1115
+ # Return up to the first dot in 'name'. This is complicated by the fact
1116
+ # that 'name' may be relative.
1117
+ if level == 0:
1118
+ return _gcd_import(name.partition('.')[0])
1119
+ elif not name:
1120
+ return module
1121
+ else:
1122
+ # Figure out where to slice the module's name up to the first dot
1123
+ # in 'name'.
1124
+ cut_off = len(name) - len(name.partition('.')[0])
1125
+ # Slice end needs to be positive to alleviate need to special-case
1126
+ # when ``'.' not in name``.
1127
+ return sys.modules[module.__name__[:len(module.__name__)-cut_off]]
1128
+ elif hasattr(module, '__path__'):
1129
+ return _handle_fromlist(module, fromlist, _gcd_import)
1130
+ else:
1131
+ return module
1132
+
1133
+
1134
+ def _builtin_from_name(name):
1135
+ spec = BuiltinImporter.find_spec(name)
1136
+ if spec is None:
1137
+ raise ImportError('no built-in module named ' + name)
1138
+ return _load_unlocked(spec)
1139
+
1140
+
1141
+ def _setup(sys_module, _imp_module):
1142
+ """Setup importlib by importing needed built-in modules and injecting them
1143
+ into the global namespace.
1144
+
1145
+ As sys is needed for sys.modules access and _imp is needed to load built-in
1146
+ modules, those two modules must be explicitly passed in.
1147
+
1148
+ """
1149
+ global _imp, sys
1150
+ _imp = _imp_module
1151
+ sys = sys_module
1152
+
1153
+ # Set up the spec for existing builtin/frozen modules.
1154
+ module_type = type(sys)
1155
+ for name, module in sys.modules.items():
1156
+ if isinstance(module, module_type):
1157
+ if name in sys.builtin_module_names:
1158
+ loader = BuiltinImporter
1159
+ elif _imp.is_frozen(name):
1160
+ loader = FrozenImporter
1161
+ else:
1162
+ continue
1163
+ spec = _spec_from_module(module, loader)
1164
+ _init_module_attrs(spec, module)
1165
+
1166
+ # Directly load built-in modules needed during bootstrap.
1167
+ self_module = sys.modules[__name__]
1168
+ for builtin_name in ('_thread', '_warnings', '_weakref'):
1169
+ if builtin_name not in sys.modules:
1170
+ builtin_module = _builtin_from_name(builtin_name)
1171
+ else:
1172
+ builtin_module = sys.modules[builtin_name]
1173
+ setattr(self_module, builtin_name, builtin_module)
1174
+
1175
+
1176
+ def _install(sys_module, _imp_module):
1177
+ """Install importers for builtin and frozen modules"""
1178
+ _setup(sys_module, _imp_module)
1179
+
1180
+ sys.meta_path.append(BuiltinImporter)
1181
+ sys.meta_path.append(FrozenImporter)
1182
+
1183
+
1184
+ def _install_external_importers():
1185
+ """Install importers that require external filesystem access"""
1186
+ global _bootstrap_external
1187
+ import _frozen_importlib_external
1188
+ _bootstrap_external = _frozen_importlib_external
1189
+ _frozen_importlib_external._install(sys.modules[__name__])