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

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/vlink +0 -0
  2. package/package.json +1 -1
  3. package/bin/python3 +0 -0
  4. package/lib/libX11.so.6 +0 -0
  5. package/lib/libXau.so.6 +0 -0
  6. package/lib/libXdmcp.so.6 +0 -0
  7. package/lib/libcrypt.so.1 +0 -0
  8. package/lib/libcrypto.so.1.1 +0 -0
  9. package/lib/libffi.so.7 +0 -0
  10. package/lib/libfreebl3.so +0 -0
  11. package/lib/liblzma.so.5 +0 -0
  12. package/lib/libncursesw.so.6 +0 -0
  13. package/lib/libnsl.so.1 +0 -0
  14. package/lib/libpanelw.so.6 +0 -0
  15. package/lib/libpython3.9.so.1.0 +0 -0
  16. package/lib/libreadline.so.8 +0 -0
  17. package/lib/libsqlite3.so.0 +0 -0
  18. package/lib/libssl.so.1.1 +0 -0
  19. package/lib/libtcl8.6.so +0 -0
  20. package/lib/libtinfow.so.6 +0 -0
  21. package/lib/libtk8.6.so +0 -0
  22. package/lib/libxcb.so.1 +0 -0
  23. package/lib/libz.so.1 +0 -0
  24. package/lib/python3.9/LICENSE.txt +0 -279
  25. package/lib/python3.9/__future__.py +0 -147
  26. package/lib/python3.9/__phello__.foo.py +0 -1
  27. package/lib/python3.9/_aix_support.py +0 -89
  28. package/lib/python3.9/_bootlocale.py +0 -46
  29. package/lib/python3.9/_bootsubprocess.py +0 -97
  30. package/lib/python3.9/_collections_abc.py +0 -1031
  31. package/lib/python3.9/_compat_pickle.py +0 -251
  32. package/lib/python3.9/_compression.py +0 -152
  33. package/lib/python3.9/_markupbase.py +0 -395
  34. package/lib/python3.9/_osx_support.py +0 -515
  35. package/lib/python3.9/_py_abc.py +0 -147
  36. package/lib/python3.9/_pydecimal.py +0 -6410
  37. package/lib/python3.9/_pyio.py +0 -2692
  38. package/lib/python3.9/_sitebuiltins.py +0 -103
  39. package/lib/python3.9/_strptime.py +0 -579
  40. package/lib/python3.9/_sysconfigdata__linux_x86_64-linux-gnu.py +0 -969
  41. package/lib/python3.9/_sysconfigdata__linux_x86_64-linux-gnu.py.orig +0 -969
  42. package/lib/python3.9/_sysconfigdata_x86_64_conda_cos6_linux_gnu.py +0 -969
  43. package/lib/python3.9/_threading_local.py +0 -242
  44. package/lib/python3.9/_weakrefset.py +0 -202
  45. package/lib/python3.9/abc.py +0 -129
  46. package/lib/python3.9/aifc.py +0 -947
  47. package/lib/python3.9/antigravity.py +0 -17
  48. package/lib/python3.9/argparse.py +0 -2575
  49. package/lib/python3.9/ast.py +0 -1530
  50. package/lib/python3.9/asynchat.py +0 -307
  51. package/lib/python3.9/asyncio/__init__.py +0 -47
  52. package/lib/python3.9/asyncio/__main__.py +0 -125
  53. package/lib/python3.9/asyncio/base_events.py +0 -1915
  54. package/lib/python3.9/asyncio/base_futures.py +0 -61
  55. package/lib/python3.9/asyncio/base_subprocess.py +0 -285
  56. package/lib/python3.9/asyncio/base_tasks.py +0 -85
  57. package/lib/python3.9/asyncio/constants.py +0 -27
  58. package/lib/python3.9/asyncio/coroutines.py +0 -269
  59. package/lib/python3.9/asyncio/events.py +0 -795
  60. package/lib/python3.9/asyncio/exceptions.py +0 -57
  61. package/lib/python3.9/asyncio/format_helpers.py +0 -76
  62. package/lib/python3.9/asyncio/futures.py +0 -423
  63. package/lib/python3.9/asyncio/locks.py +0 -451
  64. package/lib/python3.9/asyncio/log.py +0 -7
  65. package/lib/python3.9/asyncio/proactor_events.py +0 -868
  66. package/lib/python3.9/asyncio/protocols.py +0 -220
  67. package/lib/python3.9/asyncio/queues.py +0 -252
  68. package/lib/python3.9/asyncio/runners.py +0 -74
  69. package/lib/python3.9/asyncio/selector_events.py +0 -1099
  70. package/lib/python3.9/asyncio/sslproto.py +0 -733
  71. package/lib/python3.9/asyncio/staggered.py +0 -149
  72. package/lib/python3.9/asyncio/streams.py +0 -741
  73. package/lib/python3.9/asyncio/subprocess.py +0 -241
  74. package/lib/python3.9/asyncio/tasks.py +0 -980
  75. package/lib/python3.9/asyncio/threads.py +0 -25
  76. package/lib/python3.9/asyncio/transports.py +0 -329
  77. package/lib/python3.9/asyncio/trsock.py +0 -206
  78. package/lib/python3.9/asyncio/unix_events.py +0 -1466
  79. package/lib/python3.9/asyncio/windows_events.py +0 -908
  80. package/lib/python3.9/asyncio/windows_utils.py +0 -173
  81. package/lib/python3.9/asyncore.py +0 -642
  82. package/lib/python3.9/base64.py +0 -579
  83. package/lib/python3.9/bdb.py +0 -864
  84. package/lib/python3.9/binhex.py +0 -502
  85. package/lib/python3.9/bisect.py +0 -80
  86. package/lib/python3.9/bz2.py +0 -350
  87. package/lib/python3.9/cProfile.py +0 -180
  88. package/lib/python3.9/calendar.py +0 -770
  89. package/lib/python3.9/cgi.py +0 -996
  90. package/lib/python3.9/cgitb.py +0 -321
  91. package/lib/python3.9/chunk.py +0 -169
  92. package/lib/python3.9/cmd.py +0 -401
  93. package/lib/python3.9/code.py +0 -315
  94. package/lib/python3.9/codecs.py +0 -1126
  95. package/lib/python3.9/codeop.py +0 -178
  96. package/lib/python3.9/collections/__init__.py +0 -1508
  97. package/lib/python3.9/collections/abc.py +0 -2
  98. package/lib/python3.9/colorsys.py +0 -164
  99. package/lib/python3.9/compileall.py +0 -461
  100. package/lib/python3.9/concurrent/__init__.py +0 -1
  101. package/lib/python3.9/concurrent/futures/__init__.py +0 -53
  102. package/lib/python3.9/concurrent/futures/_base.py +0 -635
  103. package/lib/python3.9/concurrent/futures/process.py +0 -751
  104. package/lib/python3.9/concurrent/futures/thread.py +0 -230
  105. package/lib/python3.9/config-3.9-x86_64-linux-gnu/Makefile +0 -2015
  106. package/lib/python3.9/config-3.9-x86_64-linux-gnu/Setup +0 -372
  107. package/lib/python3.9/config-3.9-x86_64-linux-gnu/Setup.local +0 -1
  108. package/lib/python3.9/config-3.9-x86_64-linux-gnu/config.c +0 -116
  109. package/lib/python3.9/config-3.9-x86_64-linux-gnu/config.c.in +0 -67
  110. package/lib/python3.9/config-3.9-x86_64-linux-gnu/install-sh +0 -518
  111. package/lib/python3.9/config-3.9-x86_64-linux-gnu/makesetup +0 -309
  112. package/lib/python3.9/config-3.9-x86_64-linux-gnu/python-config.py +0 -74
  113. package/lib/python3.9/config-3.9-x86_64-linux-gnu/python.o +0 -0
  114. package/lib/python3.9/configparser.py +0 -1363
  115. package/lib/python3.9/contextlib.py +0 -676
  116. package/lib/python3.9/contextvars.py +0 -4
  117. package/lib/python3.9/copy.py +0 -303
  118. package/lib/python3.9/copyreg.py +0 -209
  119. package/lib/python3.9/crypt.py +0 -120
  120. package/lib/python3.9/csv.py +0 -448
  121. package/lib/python3.9/ctypes/__init__.py +0 -571
  122. package/lib/python3.9/ctypes/_aix.py +0 -331
  123. package/lib/python3.9/ctypes/_endian.py +0 -61
  124. package/lib/python3.9/ctypes/macholib/README.ctypes +0 -7
  125. package/lib/python3.9/ctypes/macholib/__init__.py +0 -9
  126. package/lib/python3.9/ctypes/macholib/dyld.py +0 -182
  127. package/lib/python3.9/ctypes/macholib/dylib.py +0 -63
  128. package/lib/python3.9/ctypes/macholib/fetch_macholib +0 -2
  129. package/lib/python3.9/ctypes/macholib/fetch_macholib.bat +0 -1
  130. package/lib/python3.9/ctypes/macholib/framework.py +0 -65
  131. package/lib/python3.9/ctypes/util.py +0 -379
  132. package/lib/python3.9/ctypes/wintypes.py +0 -202
  133. package/lib/python3.9/curses/__init__.py +0 -101
  134. package/lib/python3.9/curses/ascii.py +0 -99
  135. package/lib/python3.9/curses/has_key.py +0 -192
  136. package/lib/python3.9/curses/panel.py +0 -6
  137. package/lib/python3.9/curses/textpad.py +0 -201
  138. package/lib/python3.9/dataclasses.py +0 -1284
  139. package/lib/python3.9/datetime.py +0 -2555
  140. package/lib/python3.9/dbm/__init__.py +0 -189
  141. package/lib/python3.9/dbm/dumb.py +0 -316
  142. package/lib/python3.9/dbm/gnu.py +0 -3
  143. package/lib/python3.9/dbm/ndbm.py +0 -3
  144. package/lib/python3.9/decimal.py +0 -11
  145. package/lib/python3.9/difflib.py +0 -2096
  146. package/lib/python3.9/dis.py +0 -553
  147. package/lib/python3.9/distutils/README +0 -11
  148. package/lib/python3.9/distutils/__init__.py +0 -13
  149. package/lib/python3.9/distutils/_msvccompiler.py +0 -546
  150. package/lib/python3.9/distutils/archive_util.py +0 -256
  151. package/lib/python3.9/distutils/bcppcompiler.py +0 -393
  152. package/lib/python3.9/distutils/ccompiler.py +0 -1116
  153. package/lib/python3.9/distutils/cmd.py +0 -403
  154. package/lib/python3.9/distutils/command/__init__.py +0 -31
  155. package/lib/python3.9/distutils/command/bdist.py +0 -143
  156. package/lib/python3.9/distutils/command/bdist_dumb.py +0 -123
  157. package/lib/python3.9/distutils/command/bdist_msi.py +0 -749
  158. package/lib/python3.9/distutils/command/bdist_rpm.py +0 -579
  159. package/lib/python3.9/distutils/command/bdist_wininst.py +0 -377
  160. package/lib/python3.9/distutils/command/build.py +0 -157
  161. package/lib/python3.9/distutils/command/build_clib.py +0 -209
  162. package/lib/python3.9/distutils/command/build_ext.py +0 -754
  163. package/lib/python3.9/distutils/command/build_py.py +0 -416
  164. package/lib/python3.9/distutils/command/build_scripts.py +0 -160
  165. package/lib/python3.9/distutils/command/check.py +0 -148
  166. package/lib/python3.9/distutils/command/clean.py +0 -76
  167. package/lib/python3.9/distutils/command/command_template +0 -33
  168. package/lib/python3.9/distutils/command/config.py +0 -344
  169. package/lib/python3.9/distutils/command/install.py +0 -657
  170. package/lib/python3.9/distutils/command/install_data.py +0 -79
  171. package/lib/python3.9/distutils/command/install_egg_info.py +0 -77
  172. package/lib/python3.9/distutils/command/install_headers.py +0 -47
  173. package/lib/python3.9/distutils/command/install_lib.py +0 -217
  174. package/lib/python3.9/distutils/command/install_scripts.py +0 -60
  175. package/lib/python3.9/distutils/command/register.py +0 -304
  176. package/lib/python3.9/distutils/command/sdist.py +0 -494
  177. package/lib/python3.9/distutils/command/upload.py +0 -214
  178. package/lib/python3.9/distutils/config.py +0 -130
  179. package/lib/python3.9/distutils/core.py +0 -234
  180. package/lib/python3.9/distutils/cygwinccompiler.py +0 -410
  181. package/lib/python3.9/distutils/debug.py +0 -5
  182. package/lib/python3.9/distutils/dep_util.py +0 -92
  183. package/lib/python3.9/distutils/dir_util.py +0 -210
  184. package/lib/python3.9/distutils/dist.py +0 -1256
  185. package/lib/python3.9/distutils/errors.py +0 -97
  186. package/lib/python3.9/distutils/extension.py +0 -240
  187. package/lib/python3.9/distutils/fancy_getopt.py +0 -457
  188. package/lib/python3.9/distutils/file_util.py +0 -238
  189. package/lib/python3.9/distutils/filelist.py +0 -327
  190. package/lib/python3.9/distutils/log.py +0 -77
  191. package/lib/python3.9/distutils/msvc9compiler.py +0 -788
  192. package/lib/python3.9/distutils/msvccompiler.py +0 -643
  193. package/lib/python3.9/distutils/spawn.py +0 -125
  194. package/lib/python3.9/distutils/sysconfig.py +0 -560
  195. package/lib/python3.9/distutils/text_file.py +0 -286
  196. package/lib/python3.9/distutils/unixccompiler.py +0 -330
  197. package/lib/python3.9/distutils/util.py +0 -559
  198. package/lib/python3.9/distutils/version.py +0 -347
  199. package/lib/python3.9/distutils/versionpredicate.py +0 -166
  200. package/lib/python3.9/doctest.py +0 -2793
  201. package/lib/python3.9/email/__init__.py +0 -62
  202. package/lib/python3.9/email/_encoded_words.py +0 -233
  203. package/lib/python3.9/email/_header_value_parser.py +0 -3003
  204. package/lib/python3.9/email/_parseaddr.py +0 -549
  205. package/lib/python3.9/email/_policybase.py +0 -374
  206. package/lib/python3.9/email/architecture.rst +0 -216
  207. package/lib/python3.9/email/base64mime.py +0 -119
  208. package/lib/python3.9/email/charset.py +0 -404
  209. package/lib/python3.9/email/contentmanager.py +0 -250
  210. package/lib/python3.9/email/encoders.py +0 -69
  211. package/lib/python3.9/email/errors.py +0 -110
  212. package/lib/python3.9/email/feedparser.py +0 -536
  213. package/lib/python3.9/email/generator.py +0 -508
  214. package/lib/python3.9/email/header.py +0 -578
  215. package/lib/python3.9/email/headerregistry.py +0 -601
  216. package/lib/python3.9/email/iterators.py +0 -71
  217. package/lib/python3.9/email/message.py +0 -1173
  218. package/lib/python3.9/email/mime/__init__.py +0 -0
  219. package/lib/python3.9/email/mime/application.py +0 -37
  220. package/lib/python3.9/email/mime/audio.py +0 -74
  221. package/lib/python3.9/email/mime/base.py +0 -30
  222. package/lib/python3.9/email/mime/image.py +0 -47
  223. package/lib/python3.9/email/mime/message.py +0 -34
  224. package/lib/python3.9/email/mime/multipart.py +0 -48
  225. package/lib/python3.9/email/mime/nonmultipart.py +0 -22
  226. package/lib/python3.9/email/mime/text.py +0 -42
  227. package/lib/python3.9/email/parser.py +0 -131
  228. package/lib/python3.9/email/policy.py +0 -224
  229. package/lib/python3.9/email/quoprimime.py +0 -299
  230. package/lib/python3.9/email/utils.py +0 -368
  231. package/lib/python3.9/encodings/__init__.py +0 -169
  232. package/lib/python3.9/encodings/aliases.py +0 -551
  233. package/lib/python3.9/encodings/ascii.py +0 -50
  234. package/lib/python3.9/encodings/base64_codec.py +0 -55
  235. package/lib/python3.9/encodings/big5.py +0 -39
  236. package/lib/python3.9/encodings/big5hkscs.py +0 -39
  237. package/lib/python3.9/encodings/bz2_codec.py +0 -78
  238. package/lib/python3.9/encodings/charmap.py +0 -69
  239. package/lib/python3.9/encodings/cp037.py +0 -307
  240. package/lib/python3.9/encodings/cp1006.py +0 -307
  241. package/lib/python3.9/encodings/cp1026.py +0 -307
  242. package/lib/python3.9/encodings/cp1125.py +0 -698
  243. package/lib/python3.9/encodings/cp1140.py +0 -307
  244. package/lib/python3.9/encodings/cp1250.py +0 -307
  245. package/lib/python3.9/encodings/cp1251.py +0 -307
  246. package/lib/python3.9/encodings/cp1252.py +0 -307
  247. package/lib/python3.9/encodings/cp1253.py +0 -307
  248. package/lib/python3.9/encodings/cp1254.py +0 -307
  249. package/lib/python3.9/encodings/cp1255.py +0 -307
  250. package/lib/python3.9/encodings/cp1256.py +0 -307
  251. package/lib/python3.9/encodings/cp1257.py +0 -307
  252. package/lib/python3.9/encodings/cp1258.py +0 -307
  253. package/lib/python3.9/encodings/cp273.py +0 -307
  254. package/lib/python3.9/encodings/cp424.py +0 -307
  255. package/lib/python3.9/encodings/cp437.py +0 -698
  256. package/lib/python3.9/encodings/cp500.py +0 -307
  257. package/lib/python3.9/encodings/cp720.py +0 -309
  258. package/lib/python3.9/encodings/cp737.py +0 -698
  259. package/lib/python3.9/encodings/cp775.py +0 -697
  260. package/lib/python3.9/encodings/cp850.py +0 -698
  261. package/lib/python3.9/encodings/cp852.py +0 -698
  262. package/lib/python3.9/encodings/cp855.py +0 -698
  263. package/lib/python3.9/encodings/cp856.py +0 -307
  264. package/lib/python3.9/encodings/cp857.py +0 -694
  265. package/lib/python3.9/encodings/cp858.py +0 -698
  266. package/lib/python3.9/encodings/cp860.py +0 -698
  267. package/lib/python3.9/encodings/cp861.py +0 -698
  268. package/lib/python3.9/encodings/cp862.py +0 -698
  269. package/lib/python3.9/encodings/cp863.py +0 -698
  270. package/lib/python3.9/encodings/cp864.py +0 -690
  271. package/lib/python3.9/encodings/cp865.py +0 -698
  272. package/lib/python3.9/encodings/cp866.py +0 -698
  273. package/lib/python3.9/encodings/cp869.py +0 -689
  274. package/lib/python3.9/encodings/cp874.py +0 -307
  275. package/lib/python3.9/encodings/cp875.py +0 -307
  276. package/lib/python3.9/encodings/cp932.py +0 -39
  277. package/lib/python3.9/encodings/cp949.py +0 -39
  278. package/lib/python3.9/encodings/cp950.py +0 -39
  279. package/lib/python3.9/encodings/euc_jis_2004.py +0 -39
  280. package/lib/python3.9/encodings/euc_jisx0213.py +0 -39
  281. package/lib/python3.9/encodings/euc_jp.py +0 -39
  282. package/lib/python3.9/encodings/euc_kr.py +0 -39
  283. package/lib/python3.9/encodings/gb18030.py +0 -39
  284. package/lib/python3.9/encodings/gb2312.py +0 -39
  285. package/lib/python3.9/encodings/gbk.py +0 -39
  286. package/lib/python3.9/encodings/hex_codec.py +0 -55
  287. package/lib/python3.9/encodings/hp_roman8.py +0 -314
  288. package/lib/python3.9/encodings/hz.py +0 -39
  289. package/lib/python3.9/encodings/idna.py +0 -309
  290. package/lib/python3.9/encodings/iso2022_jp.py +0 -39
  291. package/lib/python3.9/encodings/iso2022_jp_1.py +0 -39
  292. package/lib/python3.9/encodings/iso2022_jp_2.py +0 -39
  293. package/lib/python3.9/encodings/iso2022_jp_2004.py +0 -39
  294. package/lib/python3.9/encodings/iso2022_jp_3.py +0 -39
  295. package/lib/python3.9/encodings/iso2022_jp_ext.py +0 -39
  296. package/lib/python3.9/encodings/iso2022_kr.py +0 -39
  297. package/lib/python3.9/encodings/iso8859_1.py +0 -307
  298. package/lib/python3.9/encodings/iso8859_10.py +0 -307
  299. package/lib/python3.9/encodings/iso8859_11.py +0 -307
  300. package/lib/python3.9/encodings/iso8859_13.py +0 -307
  301. package/lib/python3.9/encodings/iso8859_14.py +0 -307
  302. package/lib/python3.9/encodings/iso8859_15.py +0 -307
  303. package/lib/python3.9/encodings/iso8859_16.py +0 -307
  304. package/lib/python3.9/encodings/iso8859_2.py +0 -307
  305. package/lib/python3.9/encodings/iso8859_3.py +0 -307
  306. package/lib/python3.9/encodings/iso8859_4.py +0 -307
  307. package/lib/python3.9/encodings/iso8859_5.py +0 -307
  308. package/lib/python3.9/encodings/iso8859_6.py +0 -307
  309. package/lib/python3.9/encodings/iso8859_7.py +0 -307
  310. package/lib/python3.9/encodings/iso8859_8.py +0 -307
  311. package/lib/python3.9/encodings/iso8859_9.py +0 -307
  312. package/lib/python3.9/encodings/johab.py +0 -39
  313. package/lib/python3.9/encodings/koi8_r.py +0 -307
  314. package/lib/python3.9/encodings/koi8_t.py +0 -308
  315. package/lib/python3.9/encodings/koi8_u.py +0 -307
  316. package/lib/python3.9/encodings/kz1048.py +0 -307
  317. package/lib/python3.9/encodings/latin_1.py +0 -50
  318. package/lib/python3.9/encodings/mac_arabic.py +0 -698
  319. package/lib/python3.9/encodings/mac_croatian.py +0 -307
  320. package/lib/python3.9/encodings/mac_cyrillic.py +0 -307
  321. package/lib/python3.9/encodings/mac_farsi.py +0 -307
  322. package/lib/python3.9/encodings/mac_greek.py +0 -307
  323. package/lib/python3.9/encodings/mac_iceland.py +0 -307
  324. package/lib/python3.9/encodings/mac_latin2.py +0 -312
  325. package/lib/python3.9/encodings/mac_roman.py +0 -307
  326. package/lib/python3.9/encodings/mac_romanian.py +0 -307
  327. package/lib/python3.9/encodings/mac_turkish.py +0 -307
  328. package/lib/python3.9/encodings/mbcs.py +0 -47
  329. package/lib/python3.9/encodings/oem.py +0 -41
  330. package/lib/python3.9/encodings/palmos.py +0 -308
  331. package/lib/python3.9/encodings/ptcp154.py +0 -312
  332. package/lib/python3.9/encodings/punycode.py +0 -237
  333. package/lib/python3.9/encodings/quopri_codec.py +0 -56
  334. package/lib/python3.9/encodings/raw_unicode_escape.py +0 -45
  335. package/lib/python3.9/encodings/rot_13.py +0 -113
  336. package/lib/python3.9/encodings/shift_jis.py +0 -39
  337. package/lib/python3.9/encodings/shift_jis_2004.py +0 -39
  338. package/lib/python3.9/encodings/shift_jisx0213.py +0 -39
  339. package/lib/python3.9/encodings/tis_620.py +0 -307
  340. package/lib/python3.9/encodings/undefined.py +0 -49
  341. package/lib/python3.9/encodings/unicode_escape.py +0 -45
  342. package/lib/python3.9/encodings/utf_16.py +0 -155
  343. package/lib/python3.9/encodings/utf_16_be.py +0 -42
  344. package/lib/python3.9/encodings/utf_16_le.py +0 -42
  345. package/lib/python3.9/encodings/utf_32.py +0 -150
  346. package/lib/python3.9/encodings/utf_32_be.py +0 -37
  347. package/lib/python3.9/encodings/utf_32_le.py +0 -37
  348. package/lib/python3.9/encodings/utf_7.py +0 -38
  349. package/lib/python3.9/encodings/utf_8.py +0 -42
  350. package/lib/python3.9/encodings/utf_8_sig.py +0 -130
  351. package/lib/python3.9/encodings/uu_codec.py +0 -103
  352. package/lib/python3.9/encodings/zlib_codec.py +0 -77
  353. package/lib/python3.9/enum.py +0 -913
  354. package/lib/python3.9/filecmp.py +0 -309
  355. package/lib/python3.9/fileinput.py +0 -432
  356. package/lib/python3.9/fnmatch.py +0 -183
  357. package/lib/python3.9/formatter.py +0 -452
  358. package/lib/python3.9/fractions.py +0 -641
  359. package/lib/python3.9/ftplib.py +0 -974
  360. package/lib/python3.9/functools.py +0 -980
  361. package/lib/python3.9/genericpath.py +0 -155
  362. package/lib/python3.9/getopt.py +0 -215
  363. package/lib/python3.9/getpass.py +0 -185
  364. package/lib/python3.9/gettext.py +0 -788
  365. package/lib/python3.9/glob.py +0 -173
  366. package/lib/python3.9/graphlib.py +0 -245
  367. package/lib/python3.9/gzip.py +0 -609
  368. package/lib/python3.9/hashlib.py +0 -262
  369. package/lib/python3.9/heapq.py +0 -601
  370. package/lib/python3.9/hmac.py +0 -203
  371. package/lib/python3.9/html/__init__.py +0 -132
  372. package/lib/python3.9/html/entities.py +0 -2509
  373. package/lib/python3.9/html/parser.py +0 -462
  374. package/lib/python3.9/http/__init__.py +0 -149
  375. package/lib/python3.9/http/client.py +0 -1495
  376. package/lib/python3.9/http/cookiejar.py +0 -2113
  377. package/lib/python3.9/http/cookies.py +0 -612
  378. package/lib/python3.9/http/server.py +0 -1299
  379. package/lib/python3.9/imaplib.py +0 -1650
  380. package/lib/python3.9/imghdr.py +0 -168
  381. package/lib/python3.9/imp.py +0 -345
  382. package/lib/python3.9/importlib/__init__.py +0 -176
  383. package/lib/python3.9/importlib/_bootstrap.py +0 -1189
  384. package/lib/python3.9/importlib/_bootstrap_external.py +0 -1637
  385. package/lib/python3.9/importlib/_common.py +0 -62
  386. package/lib/python3.9/importlib/abc.py +0 -474
  387. package/lib/python3.9/importlib/machinery.py +0 -21
  388. package/lib/python3.9/importlib/metadata.py +0 -586
  389. package/lib/python3.9/importlib/resources.py +0 -215
  390. package/lib/python3.9/importlib/util.py +0 -300
  391. package/lib/python3.9/inspect.py +0 -3180
  392. package/lib/python3.9/io.py +0 -99
  393. package/lib/python3.9/ipaddress.py +0 -2280
  394. package/lib/python3.9/json/__init__.py +0 -359
  395. package/lib/python3.9/json/decoder.py +0 -356
  396. package/lib/python3.9/json/encoder.py +0 -442
  397. package/lib/python3.9/json/scanner.py +0 -73
  398. package/lib/python3.9/json/tool.py +0 -78
  399. package/lib/python3.9/keyword.py +0 -62
  400. package/lib/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so +0 -0
  401. package/lib/python3.9/lib-dynload/_bisect.cpython-39-x86_64-linux-gnu.so +0 -0
  402. package/lib/python3.9/lib-dynload/_blake2.cpython-39-x86_64-linux-gnu.so +0 -0
  403. package/lib/python3.9/lib-dynload/_bz2.cpython-39-x86_64-linux-gnu.so +0 -0
  404. package/lib/python3.9/lib-dynload/_codecs_cn.cpython-39-x86_64-linux-gnu.so +0 -0
  405. package/lib/python3.9/lib-dynload/_codecs_hk.cpython-39-x86_64-linux-gnu.so +0 -0
  406. package/lib/python3.9/lib-dynload/_codecs_iso2022.cpython-39-x86_64-linux-gnu.so +0 -0
  407. package/lib/python3.9/lib-dynload/_codecs_jp.cpython-39-x86_64-linux-gnu.so +0 -0
  408. package/lib/python3.9/lib-dynload/_codecs_kr.cpython-39-x86_64-linux-gnu.so +0 -0
  409. package/lib/python3.9/lib-dynload/_codecs_tw.cpython-39-x86_64-linux-gnu.so +0 -0
  410. package/lib/python3.9/lib-dynload/_contextvars.cpython-39-x86_64-linux-gnu.so +0 -0
  411. package/lib/python3.9/lib-dynload/_crypt.cpython-39-x86_64-linux-gnu.so +0 -0
  412. package/lib/python3.9/lib-dynload/_csv.cpython-39-x86_64-linux-gnu.so +0 -0
  413. package/lib/python3.9/lib-dynload/_ctypes.cpython-39-x86_64-linux-gnu.so +0 -0
  414. package/lib/python3.9/lib-dynload/_ctypes_test.cpython-39-x86_64-linux-gnu.so +0 -0
  415. package/lib/python3.9/lib-dynload/_curses.cpython-39-x86_64-linux-gnu.so +0 -0
  416. package/lib/python3.9/lib-dynload/_curses_panel.cpython-39-x86_64-linux-gnu.so +0 -0
  417. package/lib/python3.9/lib-dynload/_datetime.cpython-39-x86_64-linux-gnu.so +0 -0
  418. package/lib/python3.9/lib-dynload/_decimal.cpython-39-x86_64-linux-gnu.so +0 -0
  419. package/lib/python3.9/lib-dynload/_elementtree.cpython-39-x86_64-linux-gnu.so +0 -0
  420. package/lib/python3.9/lib-dynload/_hashlib.cpython-39-x86_64-linux-gnu.so +0 -0
  421. package/lib/python3.9/lib-dynload/_heapq.cpython-39-x86_64-linux-gnu.so +0 -0
  422. package/lib/python3.9/lib-dynload/_json.cpython-39-x86_64-linux-gnu.so +0 -0
  423. package/lib/python3.9/lib-dynload/_lsprof.cpython-39-x86_64-linux-gnu.so +0 -0
  424. package/lib/python3.9/lib-dynload/_lzma.cpython-39-x86_64-linux-gnu.so +0 -0
  425. package/lib/python3.9/lib-dynload/_md5.cpython-39-x86_64-linux-gnu.so +0 -0
  426. package/lib/python3.9/lib-dynload/_multibytecodec.cpython-39-x86_64-linux-gnu.so +0 -0
  427. package/lib/python3.9/lib-dynload/_multiprocessing.cpython-39-x86_64-linux-gnu.so +0 -0
  428. package/lib/python3.9/lib-dynload/_opcode.cpython-39-x86_64-linux-gnu.so +0 -0
  429. package/lib/python3.9/lib-dynload/_pickle.cpython-39-x86_64-linux-gnu.so +0 -0
  430. package/lib/python3.9/lib-dynload/_posixshmem.cpython-39-x86_64-linux-gnu.so +0 -0
  431. package/lib/python3.9/lib-dynload/_posixsubprocess.cpython-39-x86_64-linux-gnu.so +0 -0
  432. package/lib/python3.9/lib-dynload/_queue.cpython-39-x86_64-linux-gnu.so +0 -0
  433. package/lib/python3.9/lib-dynload/_random.cpython-39-x86_64-linux-gnu.so +0 -0
  434. package/lib/python3.9/lib-dynload/_sha1.cpython-39-x86_64-linux-gnu.so +0 -0
  435. package/lib/python3.9/lib-dynload/_sha256.cpython-39-x86_64-linux-gnu.so +0 -0
  436. package/lib/python3.9/lib-dynload/_sha3.cpython-39-x86_64-linux-gnu.so +0 -0
  437. package/lib/python3.9/lib-dynload/_sha512.cpython-39-x86_64-linux-gnu.so +0 -0
  438. package/lib/python3.9/lib-dynload/_socket.cpython-39-x86_64-linux-gnu.so +0 -0
  439. package/lib/python3.9/lib-dynload/_sqlite3.cpython-39-x86_64-linux-gnu.so +0 -0
  440. package/lib/python3.9/lib-dynload/_ssl.cpython-39-x86_64-linux-gnu.so +0 -0
  441. package/lib/python3.9/lib-dynload/_statistics.cpython-39-x86_64-linux-gnu.so +0 -0
  442. package/lib/python3.9/lib-dynload/_struct.cpython-39-x86_64-linux-gnu.so +0 -0
  443. package/lib/python3.9/lib-dynload/_testbuffer.cpython-39-x86_64-linux-gnu.so +0 -0
  444. package/lib/python3.9/lib-dynload/_testcapi.cpython-39-x86_64-linux-gnu.so +0 -0
  445. package/lib/python3.9/lib-dynload/_testimportmultiple.cpython-39-x86_64-linux-gnu.so +0 -0
  446. package/lib/python3.9/lib-dynload/_testinternalcapi.cpython-39-x86_64-linux-gnu.so +0 -0
  447. package/lib/python3.9/lib-dynload/_testmultiphase.cpython-39-x86_64-linux-gnu.so +0 -0
  448. package/lib/python3.9/lib-dynload/_tkinter.cpython-39-x86_64-linux-gnu.so +0 -0
  449. package/lib/python3.9/lib-dynload/_xxsubinterpreters.cpython-39-x86_64-linux-gnu.so +0 -0
  450. package/lib/python3.9/lib-dynload/_xxtestfuzz.cpython-39-x86_64-linux-gnu.so +0 -0
  451. package/lib/python3.9/lib-dynload/_zoneinfo.cpython-39-x86_64-linux-gnu.so +0 -0
  452. package/lib/python3.9/lib-dynload/array.cpython-39-x86_64-linux-gnu.so +0 -0
  453. package/lib/python3.9/lib-dynload/audioop.cpython-39-x86_64-linux-gnu.so +0 -0
  454. package/lib/python3.9/lib-dynload/binascii.cpython-39-x86_64-linux-gnu.so +0 -0
  455. package/lib/python3.9/lib-dynload/cmath.cpython-39-x86_64-linux-gnu.so +0 -0
  456. package/lib/python3.9/lib-dynload/fcntl.cpython-39-x86_64-linux-gnu.so +0 -0
  457. package/lib/python3.9/lib-dynload/grp.cpython-39-x86_64-linux-gnu.so +0 -0
  458. package/lib/python3.9/lib-dynload/math.cpython-39-x86_64-linux-gnu.so +0 -0
  459. package/lib/python3.9/lib-dynload/mmap.cpython-39-x86_64-linux-gnu.so +0 -0
  460. package/lib/python3.9/lib-dynload/nis.cpython-39-x86_64-linux-gnu.so +0 -0
  461. package/lib/python3.9/lib-dynload/ossaudiodev.cpython-39-x86_64-linux-gnu.so +0 -0
  462. package/lib/python3.9/lib-dynload/parser.cpython-39-x86_64-linux-gnu.so +0 -0
  463. package/lib/python3.9/lib-dynload/pyexpat.cpython-39-x86_64-linux-gnu.so +0 -0
  464. package/lib/python3.9/lib-dynload/readline.cpython-39-x86_64-linux-gnu.so +0 -0
  465. package/lib/python3.9/lib-dynload/resource.cpython-39-x86_64-linux-gnu.so +0 -0
  466. package/lib/python3.9/lib-dynload/select.cpython-39-x86_64-linux-gnu.so +0 -0
  467. package/lib/python3.9/lib-dynload/spwd.cpython-39-x86_64-linux-gnu.so +0 -0
  468. package/lib/python3.9/lib-dynload/syslog.cpython-39-x86_64-linux-gnu.so +0 -0
  469. package/lib/python3.9/lib-dynload/termios.cpython-39-x86_64-linux-gnu.so +0 -0
  470. package/lib/python3.9/lib-dynload/unicodedata.cpython-39-x86_64-linux-gnu.so +0 -0
  471. package/lib/python3.9/lib-dynload/xxlimited.cpython-39-x86_64-linux-gnu.so +0 -0
  472. package/lib/python3.9/lib-dynload/zlib.cpython-39-x86_64-linux-gnu.so +0 -0
  473. package/lib/python3.9/linecache.py +0 -177
  474. package/lib/python3.9/locale.py +0 -1755
  475. package/lib/python3.9/logging/__init__.py +0 -2208
  476. package/lib/python3.9/logging/config.py +0 -945
  477. package/lib/python3.9/logging/handlers.py +0 -1543
  478. package/lib/python3.9/lzma.py +0 -347
  479. package/lib/python3.9/mailbox.py +0 -2151
  480. package/lib/python3.9/mailcap.py +0 -276
  481. package/lib/python3.9/mimetypes.py +0 -614
  482. package/lib/python3.9/modulefinder.py +0 -685
  483. package/lib/python3.9/multiprocessing/__init__.py +0 -37
  484. package/lib/python3.9/multiprocessing/connection.py +0 -978
  485. package/lib/python3.9/multiprocessing/context.py +0 -362
  486. package/lib/python3.9/multiprocessing/dummy/__init__.py +0 -126
  487. package/lib/python3.9/multiprocessing/dummy/connection.py +0 -75
  488. package/lib/python3.9/multiprocessing/forkserver.py +0 -348
  489. package/lib/python3.9/multiprocessing/heap.py +0 -337
  490. package/lib/python3.9/multiprocessing/managers.py +0 -1369
  491. package/lib/python3.9/multiprocessing/pool.py +0 -954
  492. package/lib/python3.9/multiprocessing/popen_fork.py +0 -83
  493. package/lib/python3.9/multiprocessing/popen_forkserver.py +0 -74
  494. package/lib/python3.9/multiprocessing/popen_spawn_posix.py +0 -72
  495. package/lib/python3.9/multiprocessing/popen_spawn_win32.py +0 -131
  496. package/lib/python3.9/multiprocessing/process.py +0 -432
  497. package/lib/python3.9/multiprocessing/queues.py +0 -380
  498. package/lib/python3.9/multiprocessing/reduction.py +0 -281
  499. package/lib/python3.9/multiprocessing/resource_sharer.py +0 -154
  500. package/lib/python3.9/multiprocessing/resource_tracker.py +0 -231
  501. package/lib/python3.9/multiprocessing/shared_memory.py +0 -532
  502. package/lib/python3.9/multiprocessing/sharedctypes.py +0 -240
  503. package/lib/python3.9/multiprocessing/spawn.py +0 -297
  504. package/lib/python3.9/multiprocessing/synchronize.py +0 -394
  505. package/lib/python3.9/multiprocessing/util.py +0 -489
  506. package/lib/python3.9/netrc.py +0 -139
  507. package/lib/python3.9/nntplib.py +0 -1090
  508. package/lib/python3.9/ntpath.py +0 -794
  509. package/lib/python3.9/nturl2path.py +0 -73
  510. package/lib/python3.9/numbers.py +0 -389
  511. package/lib/python3.9/opcode.py +0 -217
  512. package/lib/python3.9/operator.py +0 -460
  513. package/lib/python3.9/optparse.py +0 -1681
  514. package/lib/python3.9/os.py +0 -1116
  515. package/lib/python3.9/pathlib.py +0 -1576
  516. package/lib/python3.9/pdb.py +0 -1731
  517. package/lib/python3.9/pickle.py +0 -1817
  518. package/lib/python3.9/pickletools.py +0 -2890
  519. package/lib/python3.9/pipes.py +0 -247
  520. package/lib/python3.9/pkgutil.py +0 -707
  521. package/lib/python3.9/platform.py +0 -1259
  522. package/lib/python3.9/plistlib.py +0 -881
  523. package/lib/python3.9/poplib.py +0 -483
  524. package/lib/python3.9/posixpath.py +0 -525
  525. package/lib/python3.9/pprint.py +0 -638
  526. package/lib/python3.9/profile.py +0 -600
  527. package/lib/python3.9/pstats.py +0 -779
  528. package/lib/python3.9/pty.py +0 -172
  529. package/lib/python3.9/py_compile.py +0 -215
  530. package/lib/python3.9/pyclbr.py +0 -404
  531. package/lib/python3.9/pydoc.py +0 -2855
  532. package/lib/python3.9/pydoc_data/__init__.py +0 -0
  533. package/lib/python3.9/pydoc_data/_pydoc.css +0 -6
  534. package/lib/python3.9/pydoc_data/topics.py +0 -13968
  535. package/lib/python3.9/queue.py +0 -326
  536. package/lib/python3.9/quopri.py +0 -242
  537. package/lib/python3.9/random.py +0 -887
  538. package/lib/python3.9/re.py +0 -384
  539. package/lib/python3.9/reprlib.py +0 -161
  540. package/lib/python3.9/rlcompleter.py +0 -205
  541. package/lib/python3.9/runpy.py +0 -300
  542. package/lib/python3.9/sched.py +0 -167
  543. package/lib/python3.9/secrets.py +0 -72
  544. package/lib/python3.9/selectors.py +0 -619
  545. package/lib/python3.9/shelve.py +0 -243
  546. package/lib/python3.9/shlex.py +0 -350
  547. package/lib/python3.9/shutil.py +0 -1443
  548. package/lib/python3.9/signal.py +0 -85
  549. package/lib/python3.9/site.py +0 -643
  550. package/lib/python3.9/smtpd.py +0 -967
  551. package/lib/python3.9/smtplib.py +0 -1123
  552. package/lib/python3.9/sndhdr.py +0 -257
  553. package/lib/python3.9/socket.py +0 -958
  554. package/lib/python3.9/socketserver.py +0 -817
  555. package/lib/python3.9/sqlite3/__init__.py +0 -23
  556. package/lib/python3.9/sqlite3/dbapi2.py +0 -89
  557. package/lib/python3.9/sqlite3/dump.py +0 -70
  558. package/lib/python3.9/sre_compile.py +0 -784
  559. package/lib/python3.9/sre_constants.py +0 -259
  560. package/lib/python3.9/sre_parse.py +0 -1064
  561. package/lib/python3.9/ssl.py +0 -1489
  562. package/lib/python3.9/stat.py +0 -195
  563. package/lib/python3.9/statistics.py +0 -1120
  564. package/lib/python3.9/string.py +0 -280
  565. package/lib/python3.9/stringprep.py +0 -272
  566. package/lib/python3.9/struct.py +0 -15
  567. package/lib/python3.9/subprocess.py +0 -2074
  568. package/lib/python3.9/sunau.py +0 -526
  569. package/lib/python3.9/symbol.py +0 -122
  570. package/lib/python3.9/symtable.py +0 -243
  571. package/lib/python3.9/sysconfig.py +0 -720
  572. package/lib/python3.9/tabnanny.py +0 -333
  573. package/lib/python3.9/tarfile.py +0 -2576
  574. package/lib/python3.9/telnetlib.py +0 -677
  575. package/lib/python3.9/tempfile.py +0 -832
  576. package/lib/python3.9/textwrap.py +0 -486
  577. package/lib/python3.9/this.py +0 -28
  578. package/lib/python3.9/threading.py +0 -1502
  579. package/lib/python3.9/timeit.py +0 -375
  580. package/lib/python3.9/token.py +0 -136
  581. package/lib/python3.9/tokenize.py +0 -682
  582. package/lib/python3.9/trace.py +0 -740
  583. package/lib/python3.9/traceback.py +0 -623
  584. package/lib/python3.9/tracemalloc.py +0 -560
  585. package/lib/python3.9/tty.py +0 -36
  586. package/lib/python3.9/turtle.py +0 -4140
  587. package/lib/python3.9/types.py +0 -299
  588. package/lib/python3.9/typing.py +0 -2147
  589. package/lib/python3.9/unittest/__init__.py +0 -95
  590. package/lib/python3.9/unittest/__main__.py +0 -18
  591. package/lib/python3.9/unittest/_log.py +0 -69
  592. package/lib/python3.9/unittest/async_case.py +0 -160
  593. package/lib/python3.9/unittest/case.py +0 -1437
  594. package/lib/python3.9/unittest/loader.py +0 -517
  595. package/lib/python3.9/unittest/main.py +0 -275
  596. package/lib/python3.9/unittest/mock.py +0 -2891
  597. package/lib/python3.9/unittest/result.py +0 -216
  598. package/lib/python3.9/unittest/runner.py +0 -221
  599. package/lib/python3.9/unittest/signals.py +0 -71
  600. package/lib/python3.9/unittest/suite.py +0 -361
  601. package/lib/python3.9/unittest/util.py +0 -170
  602. package/lib/python3.9/urllib/__init__.py +0 -0
  603. package/lib/python3.9/urllib/error.py +0 -77
  604. package/lib/python3.9/urllib/parse.py +0 -1179
  605. package/lib/python3.9/urllib/request.py +0 -2765
  606. package/lib/python3.9/urllib/response.py +0 -84
  607. package/lib/python3.9/urllib/robotparser.py +0 -273
  608. package/lib/python3.9/uu.py +0 -206
  609. package/lib/python3.9/uuid.py +0 -728
  610. package/lib/python3.9/venv/__init__.py +0 -504
  611. package/lib/python3.9/venv/__main__.py +0 -10
  612. package/lib/python3.9/venv/scripts/common/Activate.ps1 +0 -241
  613. package/lib/python3.9/venv/scripts/common/activate +0 -66
  614. package/lib/python3.9/venv/scripts/posix/activate.csh +0 -25
  615. package/lib/python3.9/venv/scripts/posix/activate.fish +0 -64
  616. package/lib/python3.9/warnings.py +0 -549
  617. package/lib/python3.9/wave.py +0 -513
  618. package/lib/python3.9/weakref.py +0 -664
  619. package/lib/python3.9/webbrowser.py +0 -713
  620. package/lib/python3.9/wsgiref/__init__.py +0 -23
  621. package/lib/python3.9/wsgiref/handlers.py +0 -571
  622. package/lib/python3.9/wsgiref/headers.py +0 -184
  623. package/lib/python3.9/wsgiref/simple_server.py +0 -165
  624. package/lib/python3.9/wsgiref/util.py +0 -172
  625. package/lib/python3.9/wsgiref/validate.py +0 -441
  626. package/lib/python3.9/xdrlib.py +0 -241
  627. package/lib/python3.9/xml/__init__.py +0 -20
  628. package/lib/python3.9/xml/dom/NodeFilter.py +0 -27
  629. package/lib/python3.9/xml/dom/__init__.py +0 -140
  630. package/lib/python3.9/xml/dom/domreg.py +0 -99
  631. package/lib/python3.9/xml/dom/expatbuilder.py +0 -965
  632. package/lib/python3.9/xml/dom/minicompat.py +0 -109
  633. package/lib/python3.9/xml/dom/minidom.py +0 -2011
  634. package/lib/python3.9/xml/dom/pulldom.py +0 -349
  635. package/lib/python3.9/xml/dom/xmlbuilder.py +0 -387
  636. package/lib/python3.9/xml/etree/ElementInclude.py +0 -185
  637. package/lib/python3.9/xml/etree/ElementPath.py +0 -405
  638. package/lib/python3.9/xml/etree/ElementTree.py +0 -2085
  639. package/lib/python3.9/xml/etree/__init__.py +0 -33
  640. package/lib/python3.9/xml/etree/cElementTree.py +0 -3
  641. package/lib/python3.9/xml/parsers/__init__.py +0 -8
  642. package/lib/python3.9/xml/parsers/expat.py +0 -8
  643. package/lib/python3.9/xml/sax/__init__.py +0 -107
  644. package/lib/python3.9/xml/sax/_exceptions.py +0 -131
  645. package/lib/python3.9/xml/sax/expatreader.py +0 -446
  646. package/lib/python3.9/xml/sax/handler.py +0 -342
  647. package/lib/python3.9/xml/sax/saxutils.py +0 -369
  648. package/lib/python3.9/xml/sax/xmlreader.py +0 -380
  649. package/lib/python3.9/xmlrpc/__init__.py +0 -1
  650. package/lib/python3.9/xmlrpc/client.py +0 -1524
  651. package/lib/python3.9/xmlrpc/server.py +0 -993
  652. package/lib/python3.9/zipapp.py +0 -206
  653. package/lib/python3.9/zipfile.py +0 -2426
  654. package/lib/python3.9/zipimport.py +0 -792
  655. package/lib/python3.9/zoneinfo/__init__.py +0 -31
  656. package/lib/python3.9/zoneinfo/_common.py +0 -165
  657. package/lib/python3.9/zoneinfo/_tzpath.py +0 -175
  658. package/lib/python3.9/zoneinfo/_zoneinfo.py +0 -752
  659. package/runtime.json +0 -1
  660. package/ssl/cacert.pem +0 -3959
@@ -1,2011 +0,0 @@
1
- """Simple implementation of the Level 1 DOM.
2
-
3
- Namespaces and other minor Level 2 features are also supported.
4
-
5
- parse("foo.xml")
6
-
7
- parseString("<foo><bar/></foo>")
8
-
9
- Todo:
10
- =====
11
- * convenience methods for getting elements and text.
12
- * more testing
13
- * bring some of the writer and linearizer code into conformance with this
14
- interface
15
- * SAX 2 namespaces
16
- """
17
-
18
- import io
19
- import xml.dom
20
-
21
- from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE, domreg
22
- from xml.dom.minicompat import *
23
- from xml.dom.xmlbuilder import DOMImplementationLS, DocumentLS
24
-
25
- # This is used by the ID-cache invalidation checks; the list isn't
26
- # actually complete, since the nodes being checked will never be the
27
- # DOCUMENT_NODE or DOCUMENT_FRAGMENT_NODE. (The node being checked is
28
- # the node being added or removed, not the node being modified.)
29
- #
30
- _nodeTypes_with_children = (xml.dom.Node.ELEMENT_NODE,
31
- xml.dom.Node.ENTITY_REFERENCE_NODE)
32
-
33
-
34
- class Node(xml.dom.Node):
35
- namespaceURI = None # this is non-null only for elements and attributes
36
- parentNode = None
37
- ownerDocument = None
38
- nextSibling = None
39
- previousSibling = None
40
-
41
- prefix = EMPTY_PREFIX # non-null only for NS elements and attributes
42
-
43
- def __bool__(self):
44
- return True
45
-
46
- def toxml(self, encoding=None, standalone=None):
47
- return self.toprettyxml("", "", encoding, standalone)
48
-
49
- def toprettyxml(self, indent="\t", newl="\n", encoding=None,
50
- standalone=None):
51
- if encoding is None:
52
- writer = io.StringIO()
53
- else:
54
- writer = io.TextIOWrapper(io.BytesIO(),
55
- encoding=encoding,
56
- errors="xmlcharrefreplace",
57
- newline='\n')
58
- if self.nodeType == Node.DOCUMENT_NODE:
59
- # Can pass encoding only to document, to put it into XML header
60
- self.writexml(writer, "", indent, newl, encoding, standalone)
61
- else:
62
- self.writexml(writer, "", indent, newl)
63
- if encoding is None:
64
- return writer.getvalue()
65
- else:
66
- return writer.detach().getvalue()
67
-
68
- def hasChildNodes(self):
69
- return bool(self.childNodes)
70
-
71
- def _get_childNodes(self):
72
- return self.childNodes
73
-
74
- def _get_firstChild(self):
75
- if self.childNodes:
76
- return self.childNodes[0]
77
-
78
- def _get_lastChild(self):
79
- if self.childNodes:
80
- return self.childNodes[-1]
81
-
82
- def insertBefore(self, newChild, refChild):
83
- if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE:
84
- for c in tuple(newChild.childNodes):
85
- self.insertBefore(c, refChild)
86
- ### The DOM does not clearly specify what to return in this case
87
- return newChild
88
- if newChild.nodeType not in self._child_node_types:
89
- raise xml.dom.HierarchyRequestErr(
90
- "%s cannot be child of %s" % (repr(newChild), repr(self)))
91
- if newChild.parentNode is not None:
92
- newChild.parentNode.removeChild(newChild)
93
- if refChild is None:
94
- self.appendChild(newChild)
95
- else:
96
- try:
97
- index = self.childNodes.index(refChild)
98
- except ValueError:
99
- raise xml.dom.NotFoundErr()
100
- if newChild.nodeType in _nodeTypes_with_children:
101
- _clear_id_cache(self)
102
- self.childNodes.insert(index, newChild)
103
- newChild.nextSibling = refChild
104
- refChild.previousSibling = newChild
105
- if index:
106
- node = self.childNodes[index-1]
107
- node.nextSibling = newChild
108
- newChild.previousSibling = node
109
- else:
110
- newChild.previousSibling = None
111
- newChild.parentNode = self
112
- return newChild
113
-
114
- def appendChild(self, node):
115
- if node.nodeType == self.DOCUMENT_FRAGMENT_NODE:
116
- for c in tuple(node.childNodes):
117
- self.appendChild(c)
118
- ### The DOM does not clearly specify what to return in this case
119
- return node
120
- if node.nodeType not in self._child_node_types:
121
- raise xml.dom.HierarchyRequestErr(
122
- "%s cannot be child of %s" % (repr(node), repr(self)))
123
- elif node.nodeType in _nodeTypes_with_children:
124
- _clear_id_cache(self)
125
- if node.parentNode is not None:
126
- node.parentNode.removeChild(node)
127
- _append_child(self, node)
128
- node.nextSibling = None
129
- return node
130
-
131
- def replaceChild(self, newChild, oldChild):
132
- if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE:
133
- refChild = oldChild.nextSibling
134
- self.removeChild(oldChild)
135
- return self.insertBefore(newChild, refChild)
136
- if newChild.nodeType not in self._child_node_types:
137
- raise xml.dom.HierarchyRequestErr(
138
- "%s cannot be child of %s" % (repr(newChild), repr(self)))
139
- if newChild is oldChild:
140
- return
141
- if newChild.parentNode is not None:
142
- newChild.parentNode.removeChild(newChild)
143
- try:
144
- index = self.childNodes.index(oldChild)
145
- except ValueError:
146
- raise xml.dom.NotFoundErr()
147
- self.childNodes[index] = newChild
148
- newChild.parentNode = self
149
- oldChild.parentNode = None
150
- if (newChild.nodeType in _nodeTypes_with_children
151
- or oldChild.nodeType in _nodeTypes_with_children):
152
- _clear_id_cache(self)
153
- newChild.nextSibling = oldChild.nextSibling
154
- newChild.previousSibling = oldChild.previousSibling
155
- oldChild.nextSibling = None
156
- oldChild.previousSibling = None
157
- if newChild.previousSibling:
158
- newChild.previousSibling.nextSibling = newChild
159
- if newChild.nextSibling:
160
- newChild.nextSibling.previousSibling = newChild
161
- return oldChild
162
-
163
- def removeChild(self, oldChild):
164
- try:
165
- self.childNodes.remove(oldChild)
166
- except ValueError:
167
- raise xml.dom.NotFoundErr()
168
- if oldChild.nextSibling is not None:
169
- oldChild.nextSibling.previousSibling = oldChild.previousSibling
170
- if oldChild.previousSibling is not None:
171
- oldChild.previousSibling.nextSibling = oldChild.nextSibling
172
- oldChild.nextSibling = oldChild.previousSibling = None
173
- if oldChild.nodeType in _nodeTypes_with_children:
174
- _clear_id_cache(self)
175
-
176
- oldChild.parentNode = None
177
- return oldChild
178
-
179
- def normalize(self):
180
- L = []
181
- for child in self.childNodes:
182
- if child.nodeType == Node.TEXT_NODE:
183
- if not child.data:
184
- # empty text node; discard
185
- if L:
186
- L[-1].nextSibling = child.nextSibling
187
- if child.nextSibling:
188
- child.nextSibling.previousSibling = child.previousSibling
189
- child.unlink()
190
- elif L and L[-1].nodeType == child.nodeType:
191
- # collapse text node
192
- node = L[-1]
193
- node.data = node.data + child.data
194
- node.nextSibling = child.nextSibling
195
- if child.nextSibling:
196
- child.nextSibling.previousSibling = node
197
- child.unlink()
198
- else:
199
- L.append(child)
200
- else:
201
- L.append(child)
202
- if child.nodeType == Node.ELEMENT_NODE:
203
- child.normalize()
204
- self.childNodes[:] = L
205
-
206
- def cloneNode(self, deep):
207
- return _clone_node(self, deep, self.ownerDocument or self)
208
-
209
- def isSupported(self, feature, version):
210
- return self.ownerDocument.implementation.hasFeature(feature, version)
211
-
212
- def _get_localName(self):
213
- # Overridden in Element and Attr where localName can be Non-Null
214
- return None
215
-
216
- # Node interfaces from Level 3 (WD 9 April 2002)
217
-
218
- def isSameNode(self, other):
219
- return self is other
220
-
221
- def getInterface(self, feature):
222
- if self.isSupported(feature, None):
223
- return self
224
- else:
225
- return None
226
-
227
- # The "user data" functions use a dictionary that is only present
228
- # if some user data has been set, so be careful not to assume it
229
- # exists.
230
-
231
- def getUserData(self, key):
232
- try:
233
- return self._user_data[key][0]
234
- except (AttributeError, KeyError):
235
- return None
236
-
237
- def setUserData(self, key, data, handler):
238
- old = None
239
- try:
240
- d = self._user_data
241
- except AttributeError:
242
- d = {}
243
- self._user_data = d
244
- if key in d:
245
- old = d[key][0]
246
- if data is None:
247
- # ignore handlers passed for None
248
- handler = None
249
- if old is not None:
250
- del d[key]
251
- else:
252
- d[key] = (data, handler)
253
- return old
254
-
255
- def _call_user_data_handler(self, operation, src, dst):
256
- if hasattr(self, "_user_data"):
257
- for key, (data, handler) in list(self._user_data.items()):
258
- if handler is not None:
259
- handler.handle(operation, key, data, src, dst)
260
-
261
- # minidom-specific API:
262
-
263
- def unlink(self):
264
- self.parentNode = self.ownerDocument = None
265
- if self.childNodes:
266
- for child in self.childNodes:
267
- child.unlink()
268
- self.childNodes = NodeList()
269
- self.previousSibling = None
270
- self.nextSibling = None
271
-
272
- # A Node is its own context manager, to ensure that an unlink() call occurs.
273
- # This is similar to how a file object works.
274
- def __enter__(self):
275
- return self
276
-
277
- def __exit__(self, et, ev, tb):
278
- self.unlink()
279
-
280
- defproperty(Node, "firstChild", doc="First child node, or None.")
281
- defproperty(Node, "lastChild", doc="Last child node, or None.")
282
- defproperty(Node, "localName", doc="Namespace-local name of this node.")
283
-
284
-
285
- def _append_child(self, node):
286
- # fast path with less checks; usable by DOM builders if careful
287
- childNodes = self.childNodes
288
- if childNodes:
289
- last = childNodes[-1]
290
- node.previousSibling = last
291
- last.nextSibling = node
292
- childNodes.append(node)
293
- node.parentNode = self
294
-
295
- def _in_document(node):
296
- # return True iff node is part of a document tree
297
- while node is not None:
298
- if node.nodeType == Node.DOCUMENT_NODE:
299
- return True
300
- node = node.parentNode
301
- return False
302
-
303
- def _write_data(writer, data):
304
- "Writes datachars to writer."
305
- if data:
306
- data = data.replace("&", "&amp;").replace("<", "&lt;"). \
307
- replace("\"", "&quot;").replace(">", "&gt;")
308
- writer.write(data)
309
-
310
- def _get_elements_by_tagName_helper(parent, name, rc):
311
- for node in parent.childNodes:
312
- if node.nodeType == Node.ELEMENT_NODE and \
313
- (name == "*" or node.tagName == name):
314
- rc.append(node)
315
- _get_elements_by_tagName_helper(node, name, rc)
316
- return rc
317
-
318
- def _get_elements_by_tagName_ns_helper(parent, nsURI, localName, rc):
319
- for node in parent.childNodes:
320
- if node.nodeType == Node.ELEMENT_NODE:
321
- if ((localName == "*" or node.localName == localName) and
322
- (nsURI == "*" or node.namespaceURI == nsURI)):
323
- rc.append(node)
324
- _get_elements_by_tagName_ns_helper(node, nsURI, localName, rc)
325
- return rc
326
-
327
- class DocumentFragment(Node):
328
- nodeType = Node.DOCUMENT_FRAGMENT_NODE
329
- nodeName = "#document-fragment"
330
- nodeValue = None
331
- attributes = None
332
- parentNode = None
333
- _child_node_types = (Node.ELEMENT_NODE,
334
- Node.TEXT_NODE,
335
- Node.CDATA_SECTION_NODE,
336
- Node.ENTITY_REFERENCE_NODE,
337
- Node.PROCESSING_INSTRUCTION_NODE,
338
- Node.COMMENT_NODE,
339
- Node.NOTATION_NODE)
340
-
341
- def __init__(self):
342
- self.childNodes = NodeList()
343
-
344
-
345
- class Attr(Node):
346
- __slots__=('_name', '_value', 'namespaceURI',
347
- '_prefix', 'childNodes', '_localName', 'ownerDocument', 'ownerElement')
348
- nodeType = Node.ATTRIBUTE_NODE
349
- attributes = None
350
- specified = False
351
- _is_id = False
352
-
353
- _child_node_types = (Node.TEXT_NODE, Node.ENTITY_REFERENCE_NODE)
354
-
355
- def __init__(self, qName, namespaceURI=EMPTY_NAMESPACE, localName=None,
356
- prefix=None):
357
- self.ownerElement = None
358
- self._name = qName
359
- self.namespaceURI = namespaceURI
360
- self._prefix = prefix
361
- self.childNodes = NodeList()
362
-
363
- # Add the single child node that represents the value of the attr
364
- self.childNodes.append(Text())
365
-
366
- # nodeValue and value are set elsewhere
367
-
368
- def _get_localName(self):
369
- try:
370
- return self._localName
371
- except AttributeError:
372
- return self.nodeName.split(":", 1)[-1]
373
-
374
- def _get_specified(self):
375
- return self.specified
376
-
377
- def _get_name(self):
378
- return self._name
379
-
380
- def _set_name(self, value):
381
- self._name = value
382
- if self.ownerElement is not None:
383
- _clear_id_cache(self.ownerElement)
384
-
385
- nodeName = name = property(_get_name, _set_name)
386
-
387
- def _get_value(self):
388
- return self._value
389
-
390
- def _set_value(self, value):
391
- self._value = value
392
- self.childNodes[0].data = value
393
- if self.ownerElement is not None:
394
- _clear_id_cache(self.ownerElement)
395
- self.childNodes[0].data = value
396
-
397
- nodeValue = value = property(_get_value, _set_value)
398
-
399
- def _get_prefix(self):
400
- return self._prefix
401
-
402
- def _set_prefix(self, prefix):
403
- nsuri = self.namespaceURI
404
- if prefix == "xmlns":
405
- if nsuri and nsuri != XMLNS_NAMESPACE:
406
- raise xml.dom.NamespaceErr(
407
- "illegal use of 'xmlns' prefix for the wrong namespace")
408
- self._prefix = prefix
409
- if prefix is None:
410
- newName = self.localName
411
- else:
412
- newName = "%s:%s" % (prefix, self.localName)
413
- if self.ownerElement:
414
- _clear_id_cache(self.ownerElement)
415
- self.name = newName
416
-
417
- prefix = property(_get_prefix, _set_prefix)
418
-
419
- def unlink(self):
420
- # This implementation does not call the base implementation
421
- # since most of that is not needed, and the expense of the
422
- # method call is not warranted. We duplicate the removal of
423
- # children, but that's all we needed from the base class.
424
- elem = self.ownerElement
425
- if elem is not None:
426
- del elem._attrs[self.nodeName]
427
- del elem._attrsNS[(self.namespaceURI, self.localName)]
428
- if self._is_id:
429
- self._is_id = False
430
- elem._magic_id_nodes -= 1
431
- self.ownerDocument._magic_id_count -= 1
432
- for child in self.childNodes:
433
- child.unlink()
434
- del self.childNodes[:]
435
-
436
- def _get_isId(self):
437
- if self._is_id:
438
- return True
439
- doc = self.ownerDocument
440
- elem = self.ownerElement
441
- if doc is None or elem is None:
442
- return False
443
-
444
- info = doc._get_elem_info(elem)
445
- if info is None:
446
- return False
447
- if self.namespaceURI:
448
- return info.isIdNS(self.namespaceURI, self.localName)
449
- else:
450
- return info.isId(self.nodeName)
451
-
452
- def _get_schemaType(self):
453
- doc = self.ownerDocument
454
- elem = self.ownerElement
455
- if doc is None or elem is None:
456
- return _no_type
457
-
458
- info = doc._get_elem_info(elem)
459
- if info is None:
460
- return _no_type
461
- if self.namespaceURI:
462
- return info.getAttributeTypeNS(self.namespaceURI, self.localName)
463
- else:
464
- return info.getAttributeType(self.nodeName)
465
-
466
- defproperty(Attr, "isId", doc="True if this attribute is an ID.")
467
- defproperty(Attr, "localName", doc="Namespace-local name of this attribute.")
468
- defproperty(Attr, "schemaType", doc="Schema type for this attribute.")
469
-
470
-
471
- class NamedNodeMap(object):
472
- """The attribute list is a transient interface to the underlying
473
- dictionaries. Mutations here will change the underlying element's
474
- dictionary.
475
-
476
- Ordering is imposed artificially and does not reflect the order of
477
- attributes as found in an input document.
478
- """
479
-
480
- __slots__ = ('_attrs', '_attrsNS', '_ownerElement')
481
-
482
- def __init__(self, attrs, attrsNS, ownerElement):
483
- self._attrs = attrs
484
- self._attrsNS = attrsNS
485
- self._ownerElement = ownerElement
486
-
487
- def _get_length(self):
488
- return len(self._attrs)
489
-
490
- def item(self, index):
491
- try:
492
- return self[list(self._attrs.keys())[index]]
493
- except IndexError:
494
- return None
495
-
496
- def items(self):
497
- L = []
498
- for node in self._attrs.values():
499
- L.append((node.nodeName, node.value))
500
- return L
501
-
502
- def itemsNS(self):
503
- L = []
504
- for node in self._attrs.values():
505
- L.append(((node.namespaceURI, node.localName), node.value))
506
- return L
507
-
508
- def __contains__(self, key):
509
- if isinstance(key, str):
510
- return key in self._attrs
511
- else:
512
- return key in self._attrsNS
513
-
514
- def keys(self):
515
- return self._attrs.keys()
516
-
517
- def keysNS(self):
518
- return self._attrsNS.keys()
519
-
520
- def values(self):
521
- return self._attrs.values()
522
-
523
- def get(self, name, value=None):
524
- return self._attrs.get(name, value)
525
-
526
- __len__ = _get_length
527
-
528
- def _cmp(self, other):
529
- if self._attrs is getattr(other, "_attrs", None):
530
- return 0
531
- else:
532
- return (id(self) > id(other)) - (id(self) < id(other))
533
-
534
- def __eq__(self, other):
535
- return self._cmp(other) == 0
536
-
537
- def __ge__(self, other):
538
- return self._cmp(other) >= 0
539
-
540
- def __gt__(self, other):
541
- return self._cmp(other) > 0
542
-
543
- def __le__(self, other):
544
- return self._cmp(other) <= 0
545
-
546
- def __lt__(self, other):
547
- return self._cmp(other) < 0
548
-
549
- def __getitem__(self, attname_or_tuple):
550
- if isinstance(attname_or_tuple, tuple):
551
- return self._attrsNS[attname_or_tuple]
552
- else:
553
- return self._attrs[attname_or_tuple]
554
-
555
- # same as set
556
- def __setitem__(self, attname, value):
557
- if isinstance(value, str):
558
- try:
559
- node = self._attrs[attname]
560
- except KeyError:
561
- node = Attr(attname)
562
- node.ownerDocument = self._ownerElement.ownerDocument
563
- self.setNamedItem(node)
564
- node.value = value
565
- else:
566
- if not isinstance(value, Attr):
567
- raise TypeError("value must be a string or Attr object")
568
- node = value
569
- self.setNamedItem(node)
570
-
571
- def getNamedItem(self, name):
572
- try:
573
- return self._attrs[name]
574
- except KeyError:
575
- return None
576
-
577
- def getNamedItemNS(self, namespaceURI, localName):
578
- try:
579
- return self._attrsNS[(namespaceURI, localName)]
580
- except KeyError:
581
- return None
582
-
583
- def removeNamedItem(self, name):
584
- n = self.getNamedItem(name)
585
- if n is not None:
586
- _clear_id_cache(self._ownerElement)
587
- del self._attrs[n.nodeName]
588
- del self._attrsNS[(n.namespaceURI, n.localName)]
589
- if hasattr(n, 'ownerElement'):
590
- n.ownerElement = None
591
- return n
592
- else:
593
- raise xml.dom.NotFoundErr()
594
-
595
- def removeNamedItemNS(self, namespaceURI, localName):
596
- n = self.getNamedItemNS(namespaceURI, localName)
597
- if n is not None:
598
- _clear_id_cache(self._ownerElement)
599
- del self._attrsNS[(n.namespaceURI, n.localName)]
600
- del self._attrs[n.nodeName]
601
- if hasattr(n, 'ownerElement'):
602
- n.ownerElement = None
603
- return n
604
- else:
605
- raise xml.dom.NotFoundErr()
606
-
607
- def setNamedItem(self, node):
608
- if not isinstance(node, Attr):
609
- raise xml.dom.HierarchyRequestErr(
610
- "%s cannot be child of %s" % (repr(node), repr(self)))
611
- old = self._attrs.get(node.name)
612
- if old:
613
- old.unlink()
614
- self._attrs[node.name] = node
615
- self._attrsNS[(node.namespaceURI, node.localName)] = node
616
- node.ownerElement = self._ownerElement
617
- _clear_id_cache(node.ownerElement)
618
- return old
619
-
620
- def setNamedItemNS(self, node):
621
- return self.setNamedItem(node)
622
-
623
- def __delitem__(self, attname_or_tuple):
624
- node = self[attname_or_tuple]
625
- _clear_id_cache(node.ownerElement)
626
- node.unlink()
627
-
628
- def __getstate__(self):
629
- return self._attrs, self._attrsNS, self._ownerElement
630
-
631
- def __setstate__(self, state):
632
- self._attrs, self._attrsNS, self._ownerElement = state
633
-
634
- defproperty(NamedNodeMap, "length",
635
- doc="Number of nodes in the NamedNodeMap.")
636
-
637
- AttributeList = NamedNodeMap
638
-
639
-
640
- class TypeInfo(object):
641
- __slots__ = 'namespace', 'name'
642
-
643
- def __init__(self, namespace, name):
644
- self.namespace = namespace
645
- self.name = name
646
-
647
- def __repr__(self):
648
- if self.namespace:
649
- return "<%s %r (from %r)>" % (self.__class__.__name__, self.name,
650
- self.namespace)
651
- else:
652
- return "<%s %r>" % (self.__class__.__name__, self.name)
653
-
654
- def _get_name(self):
655
- return self.name
656
-
657
- def _get_namespace(self):
658
- return self.namespace
659
-
660
- _no_type = TypeInfo(None, None)
661
-
662
- class Element(Node):
663
- __slots__=('ownerDocument', 'parentNode', 'tagName', 'nodeName', 'prefix',
664
- 'namespaceURI', '_localName', 'childNodes', '_attrs', '_attrsNS',
665
- 'nextSibling', 'previousSibling')
666
- nodeType = Node.ELEMENT_NODE
667
- nodeValue = None
668
- schemaType = _no_type
669
-
670
- _magic_id_nodes = 0
671
-
672
- _child_node_types = (Node.ELEMENT_NODE,
673
- Node.PROCESSING_INSTRUCTION_NODE,
674
- Node.COMMENT_NODE,
675
- Node.TEXT_NODE,
676
- Node.CDATA_SECTION_NODE,
677
- Node.ENTITY_REFERENCE_NODE)
678
-
679
- def __init__(self, tagName, namespaceURI=EMPTY_NAMESPACE, prefix=None,
680
- localName=None):
681
- self.parentNode = None
682
- self.tagName = self.nodeName = tagName
683
- self.prefix = prefix
684
- self.namespaceURI = namespaceURI
685
- self.childNodes = NodeList()
686
- self.nextSibling = self.previousSibling = None
687
-
688
- # Attribute dictionaries are lazily created
689
- # attributes are double-indexed:
690
- # tagName -> Attribute
691
- # URI,localName -> Attribute
692
- # in the future: consider lazy generation
693
- # of attribute objects this is too tricky
694
- # for now because of headaches with
695
- # namespaces.
696
- self._attrs = None
697
- self._attrsNS = None
698
-
699
- def _ensure_attributes(self):
700
- if self._attrs is None:
701
- self._attrs = {}
702
- self._attrsNS = {}
703
-
704
- def _get_localName(self):
705
- try:
706
- return self._localName
707
- except AttributeError:
708
- return self.tagName.split(":", 1)[-1]
709
-
710
- def _get_tagName(self):
711
- return self.tagName
712
-
713
- def unlink(self):
714
- if self._attrs is not None:
715
- for attr in list(self._attrs.values()):
716
- attr.unlink()
717
- self._attrs = None
718
- self._attrsNS = None
719
- Node.unlink(self)
720
-
721
- def getAttribute(self, attname):
722
- """Returns the value of the specified attribute.
723
-
724
- Returns the value of the element's attribute named attname as
725
- a string. An empty string is returned if the element does not
726
- have such an attribute. Note that an empty string may also be
727
- returned as an explicitly given attribute value, use the
728
- hasAttribute method to distinguish these two cases.
729
- """
730
- if self._attrs is None:
731
- return ""
732
- try:
733
- return self._attrs[attname].value
734
- except KeyError:
735
- return ""
736
-
737
- def getAttributeNS(self, namespaceURI, localName):
738
- if self._attrsNS is None:
739
- return ""
740
- try:
741
- return self._attrsNS[(namespaceURI, localName)].value
742
- except KeyError:
743
- return ""
744
-
745
- def setAttribute(self, attname, value):
746
- attr = self.getAttributeNode(attname)
747
- if attr is None:
748
- attr = Attr(attname)
749
- attr.value = value # also sets nodeValue
750
- attr.ownerDocument = self.ownerDocument
751
- self.setAttributeNode(attr)
752
- elif value != attr.value:
753
- attr.value = value
754
- if attr.isId:
755
- _clear_id_cache(self)
756
-
757
- def setAttributeNS(self, namespaceURI, qualifiedName, value):
758
- prefix, localname = _nssplit(qualifiedName)
759
- attr = self.getAttributeNodeNS(namespaceURI, localname)
760
- if attr is None:
761
- attr = Attr(qualifiedName, namespaceURI, localname, prefix)
762
- attr.value = value
763
- attr.ownerDocument = self.ownerDocument
764
- self.setAttributeNode(attr)
765
- else:
766
- if value != attr.value:
767
- attr.value = value
768
- if attr.isId:
769
- _clear_id_cache(self)
770
- if attr.prefix != prefix:
771
- attr.prefix = prefix
772
- attr.nodeName = qualifiedName
773
-
774
- def getAttributeNode(self, attrname):
775
- if self._attrs is None:
776
- return None
777
- return self._attrs.get(attrname)
778
-
779
- def getAttributeNodeNS(self, namespaceURI, localName):
780
- if self._attrsNS is None:
781
- return None
782
- return self._attrsNS.get((namespaceURI, localName))
783
-
784
- def setAttributeNode(self, attr):
785
- if attr.ownerElement not in (None, self):
786
- raise xml.dom.InuseAttributeErr("attribute node already owned")
787
- self._ensure_attributes()
788
- old1 = self._attrs.get(attr.name, None)
789
- if old1 is not None:
790
- self.removeAttributeNode(old1)
791
- old2 = self._attrsNS.get((attr.namespaceURI, attr.localName), None)
792
- if old2 is not None and old2 is not old1:
793
- self.removeAttributeNode(old2)
794
- _set_attribute_node(self, attr)
795
-
796
- if old1 is not attr:
797
- # It might have already been part of this node, in which case
798
- # it doesn't represent a change, and should not be returned.
799
- return old1
800
- if old2 is not attr:
801
- return old2
802
-
803
- setAttributeNodeNS = setAttributeNode
804
-
805
- def removeAttribute(self, name):
806
- if self._attrsNS is None:
807
- raise xml.dom.NotFoundErr()
808
- try:
809
- attr = self._attrs[name]
810
- except KeyError:
811
- raise xml.dom.NotFoundErr()
812
- self.removeAttributeNode(attr)
813
-
814
- def removeAttributeNS(self, namespaceURI, localName):
815
- if self._attrsNS is None:
816
- raise xml.dom.NotFoundErr()
817
- try:
818
- attr = self._attrsNS[(namespaceURI, localName)]
819
- except KeyError:
820
- raise xml.dom.NotFoundErr()
821
- self.removeAttributeNode(attr)
822
-
823
- def removeAttributeNode(self, node):
824
- if node is None:
825
- raise xml.dom.NotFoundErr()
826
- try:
827
- self._attrs[node.name]
828
- except KeyError:
829
- raise xml.dom.NotFoundErr()
830
- _clear_id_cache(self)
831
- node.unlink()
832
- # Restore this since the node is still useful and otherwise
833
- # unlinked
834
- node.ownerDocument = self.ownerDocument
835
- return node
836
-
837
- removeAttributeNodeNS = removeAttributeNode
838
-
839
- def hasAttribute(self, name):
840
- """Checks whether the element has an attribute with the specified name.
841
-
842
- Returns True if the element has an attribute with the specified name.
843
- Otherwise, returns False.
844
- """
845
- if self._attrs is None:
846
- return False
847
- return name in self._attrs
848
-
849
- def hasAttributeNS(self, namespaceURI, localName):
850
- if self._attrsNS is None:
851
- return False
852
- return (namespaceURI, localName) in self._attrsNS
853
-
854
- def getElementsByTagName(self, name):
855
- """Returns all descendant elements with the given tag name.
856
-
857
- Returns the list of all descendant elements (not direct children
858
- only) with the specified tag name.
859
- """
860
- return _get_elements_by_tagName_helper(self, name, NodeList())
861
-
862
- def getElementsByTagNameNS(self, namespaceURI, localName):
863
- return _get_elements_by_tagName_ns_helper(
864
- self, namespaceURI, localName, NodeList())
865
-
866
- def __repr__(self):
867
- return "<DOM Element: %s at %#x>" % (self.tagName, id(self))
868
-
869
- def writexml(self, writer, indent="", addindent="", newl=""):
870
- """Write an XML element to a file-like object
871
-
872
- Write the element to the writer object that must provide
873
- a write method (e.g. a file or StringIO object).
874
- """
875
- # indent = current indentation
876
- # addindent = indentation to add to higher levels
877
- # newl = newline string
878
- writer.write(indent+"<" + self.tagName)
879
-
880
- attrs = self._get_attributes()
881
-
882
- for a_name in attrs.keys():
883
- writer.write(" %s=\"" % a_name)
884
- _write_data(writer, attrs[a_name].value)
885
- writer.write("\"")
886
- if self.childNodes:
887
- writer.write(">")
888
- if (len(self.childNodes) == 1 and
889
- self.childNodes[0].nodeType in (
890
- Node.TEXT_NODE, Node.CDATA_SECTION_NODE)):
891
- self.childNodes[0].writexml(writer, '', '', '')
892
- else:
893
- writer.write(newl)
894
- for node in self.childNodes:
895
- node.writexml(writer, indent+addindent, addindent, newl)
896
- writer.write(indent)
897
- writer.write("</%s>%s" % (self.tagName, newl))
898
- else:
899
- writer.write("/>%s"%(newl))
900
-
901
- def _get_attributes(self):
902
- self._ensure_attributes()
903
- return NamedNodeMap(self._attrs, self._attrsNS, self)
904
-
905
- def hasAttributes(self):
906
- if self._attrs:
907
- return True
908
- else:
909
- return False
910
-
911
- # DOM Level 3 attributes, based on the 22 Oct 2002 draft
912
-
913
- def setIdAttribute(self, name):
914
- idAttr = self.getAttributeNode(name)
915
- self.setIdAttributeNode(idAttr)
916
-
917
- def setIdAttributeNS(self, namespaceURI, localName):
918
- idAttr = self.getAttributeNodeNS(namespaceURI, localName)
919
- self.setIdAttributeNode(idAttr)
920
-
921
- def setIdAttributeNode(self, idAttr):
922
- if idAttr is None or not self.isSameNode(idAttr.ownerElement):
923
- raise xml.dom.NotFoundErr()
924
- if _get_containing_entref(self) is not None:
925
- raise xml.dom.NoModificationAllowedErr()
926
- if not idAttr._is_id:
927
- idAttr._is_id = True
928
- self._magic_id_nodes += 1
929
- self.ownerDocument._magic_id_count += 1
930
- _clear_id_cache(self)
931
-
932
- defproperty(Element, "attributes",
933
- doc="NamedNodeMap of attributes on the element.")
934
- defproperty(Element, "localName",
935
- doc="Namespace-local name of this element.")
936
-
937
-
938
- def _set_attribute_node(element, attr):
939
- _clear_id_cache(element)
940
- element._ensure_attributes()
941
- element._attrs[attr.name] = attr
942
- element._attrsNS[(attr.namespaceURI, attr.localName)] = attr
943
-
944
- # This creates a circular reference, but Element.unlink()
945
- # breaks the cycle since the references to the attribute
946
- # dictionaries are tossed.
947
- attr.ownerElement = element
948
-
949
- class Childless:
950
- """Mixin that makes childless-ness easy to implement and avoids
951
- the complexity of the Node methods that deal with children.
952
- """
953
- __slots__ = ()
954
-
955
- attributes = None
956
- childNodes = EmptyNodeList()
957
- firstChild = None
958
- lastChild = None
959
-
960
- def _get_firstChild(self):
961
- return None
962
-
963
- def _get_lastChild(self):
964
- return None
965
-
966
- def appendChild(self, node):
967
- raise xml.dom.HierarchyRequestErr(
968
- self.nodeName + " nodes cannot have children")
969
-
970
- def hasChildNodes(self):
971
- return False
972
-
973
- def insertBefore(self, newChild, refChild):
974
- raise xml.dom.HierarchyRequestErr(
975
- self.nodeName + " nodes do not have children")
976
-
977
- def removeChild(self, oldChild):
978
- raise xml.dom.NotFoundErr(
979
- self.nodeName + " nodes do not have children")
980
-
981
- def normalize(self):
982
- # For childless nodes, normalize() has nothing to do.
983
- pass
984
-
985
- def replaceChild(self, newChild, oldChild):
986
- raise xml.dom.HierarchyRequestErr(
987
- self.nodeName + " nodes do not have children")
988
-
989
-
990
- class ProcessingInstruction(Childless, Node):
991
- nodeType = Node.PROCESSING_INSTRUCTION_NODE
992
- __slots__ = ('target', 'data')
993
-
994
- def __init__(self, target, data):
995
- self.target = target
996
- self.data = data
997
-
998
- # nodeValue is an alias for data
999
- def _get_nodeValue(self):
1000
- return self.data
1001
- def _set_nodeValue(self, value):
1002
- self.data = value
1003
- nodeValue = property(_get_nodeValue, _set_nodeValue)
1004
-
1005
- # nodeName is an alias for target
1006
- def _get_nodeName(self):
1007
- return self.target
1008
- def _set_nodeName(self, value):
1009
- self.target = value
1010
- nodeName = property(_get_nodeName, _set_nodeName)
1011
-
1012
- def writexml(self, writer, indent="", addindent="", newl=""):
1013
- writer.write("%s<?%s %s?>%s" % (indent,self.target, self.data, newl))
1014
-
1015
-
1016
- class CharacterData(Childless, Node):
1017
- __slots__=('_data', 'ownerDocument','parentNode', 'previousSibling', 'nextSibling')
1018
-
1019
- def __init__(self):
1020
- self.ownerDocument = self.parentNode = None
1021
- self.previousSibling = self.nextSibling = None
1022
- self._data = ''
1023
- Node.__init__(self)
1024
-
1025
- def _get_length(self):
1026
- return len(self.data)
1027
- __len__ = _get_length
1028
-
1029
- def _get_data(self):
1030
- return self._data
1031
- def _set_data(self, data):
1032
- self._data = data
1033
-
1034
- data = nodeValue = property(_get_data, _set_data)
1035
-
1036
- def __repr__(self):
1037
- data = self.data
1038
- if len(data) > 10:
1039
- dotdotdot = "..."
1040
- else:
1041
- dotdotdot = ""
1042
- return '<DOM %s node "%r%s">' % (
1043
- self.__class__.__name__, data[0:10], dotdotdot)
1044
-
1045
- def substringData(self, offset, count):
1046
- if offset < 0:
1047
- raise xml.dom.IndexSizeErr("offset cannot be negative")
1048
- if offset >= len(self.data):
1049
- raise xml.dom.IndexSizeErr("offset cannot be beyond end of data")
1050
- if count < 0:
1051
- raise xml.dom.IndexSizeErr("count cannot be negative")
1052
- return self.data[offset:offset+count]
1053
-
1054
- def appendData(self, arg):
1055
- self.data = self.data + arg
1056
-
1057
- def insertData(self, offset, arg):
1058
- if offset < 0:
1059
- raise xml.dom.IndexSizeErr("offset cannot be negative")
1060
- if offset >= len(self.data):
1061
- raise xml.dom.IndexSizeErr("offset cannot be beyond end of data")
1062
- if arg:
1063
- self.data = "%s%s%s" % (
1064
- self.data[:offset], arg, self.data[offset:])
1065
-
1066
- def deleteData(self, offset, count):
1067
- if offset < 0:
1068
- raise xml.dom.IndexSizeErr("offset cannot be negative")
1069
- if offset >= len(self.data):
1070
- raise xml.dom.IndexSizeErr("offset cannot be beyond end of data")
1071
- if count < 0:
1072
- raise xml.dom.IndexSizeErr("count cannot be negative")
1073
- if count:
1074
- self.data = self.data[:offset] + self.data[offset+count:]
1075
-
1076
- def replaceData(self, offset, count, arg):
1077
- if offset < 0:
1078
- raise xml.dom.IndexSizeErr("offset cannot be negative")
1079
- if offset >= len(self.data):
1080
- raise xml.dom.IndexSizeErr("offset cannot be beyond end of data")
1081
- if count < 0:
1082
- raise xml.dom.IndexSizeErr("count cannot be negative")
1083
- if count:
1084
- self.data = "%s%s%s" % (
1085
- self.data[:offset], arg, self.data[offset+count:])
1086
-
1087
- defproperty(CharacterData, "length", doc="Length of the string data.")
1088
-
1089
-
1090
- class Text(CharacterData):
1091
- __slots__ = ()
1092
-
1093
- nodeType = Node.TEXT_NODE
1094
- nodeName = "#text"
1095
- attributes = None
1096
-
1097
- def splitText(self, offset):
1098
- if offset < 0 or offset > len(self.data):
1099
- raise xml.dom.IndexSizeErr("illegal offset value")
1100
- newText = self.__class__()
1101
- newText.data = self.data[offset:]
1102
- newText.ownerDocument = self.ownerDocument
1103
- next = self.nextSibling
1104
- if self.parentNode and self in self.parentNode.childNodes:
1105
- if next is None:
1106
- self.parentNode.appendChild(newText)
1107
- else:
1108
- self.parentNode.insertBefore(newText, next)
1109
- self.data = self.data[:offset]
1110
- return newText
1111
-
1112
- def writexml(self, writer, indent="", addindent="", newl=""):
1113
- _write_data(writer, "%s%s%s" % (indent, self.data, newl))
1114
-
1115
- # DOM Level 3 (WD 9 April 2002)
1116
-
1117
- def _get_wholeText(self):
1118
- L = [self.data]
1119
- n = self.previousSibling
1120
- while n is not None:
1121
- if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
1122
- L.insert(0, n.data)
1123
- n = n.previousSibling
1124
- else:
1125
- break
1126
- n = self.nextSibling
1127
- while n is not None:
1128
- if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
1129
- L.append(n.data)
1130
- n = n.nextSibling
1131
- else:
1132
- break
1133
- return ''.join(L)
1134
-
1135
- def replaceWholeText(self, content):
1136
- # XXX This needs to be seriously changed if minidom ever
1137
- # supports EntityReference nodes.
1138
- parent = self.parentNode
1139
- n = self.previousSibling
1140
- while n is not None:
1141
- if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
1142
- next = n.previousSibling
1143
- parent.removeChild(n)
1144
- n = next
1145
- else:
1146
- break
1147
- n = self.nextSibling
1148
- if not content:
1149
- parent.removeChild(self)
1150
- while n is not None:
1151
- if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
1152
- next = n.nextSibling
1153
- parent.removeChild(n)
1154
- n = next
1155
- else:
1156
- break
1157
- if content:
1158
- self.data = content
1159
- return self
1160
- else:
1161
- return None
1162
-
1163
- def _get_isWhitespaceInElementContent(self):
1164
- if self.data.strip():
1165
- return False
1166
- elem = _get_containing_element(self)
1167
- if elem is None:
1168
- return False
1169
- info = self.ownerDocument._get_elem_info(elem)
1170
- if info is None:
1171
- return False
1172
- else:
1173
- return info.isElementContent()
1174
-
1175
- defproperty(Text, "isWhitespaceInElementContent",
1176
- doc="True iff this text node contains only whitespace"
1177
- " and is in element content.")
1178
- defproperty(Text, "wholeText",
1179
- doc="The text of all logically-adjacent text nodes.")
1180
-
1181
-
1182
- def _get_containing_element(node):
1183
- c = node.parentNode
1184
- while c is not None:
1185
- if c.nodeType == Node.ELEMENT_NODE:
1186
- return c
1187
- c = c.parentNode
1188
- return None
1189
-
1190
- def _get_containing_entref(node):
1191
- c = node.parentNode
1192
- while c is not None:
1193
- if c.nodeType == Node.ENTITY_REFERENCE_NODE:
1194
- return c
1195
- c = c.parentNode
1196
- return None
1197
-
1198
-
1199
- class Comment(CharacterData):
1200
- nodeType = Node.COMMENT_NODE
1201
- nodeName = "#comment"
1202
-
1203
- def __init__(self, data):
1204
- CharacterData.__init__(self)
1205
- self._data = data
1206
-
1207
- def writexml(self, writer, indent="", addindent="", newl=""):
1208
- if "--" in self.data:
1209
- raise ValueError("'--' is not allowed in a comment node")
1210
- writer.write("%s<!--%s-->%s" % (indent, self.data, newl))
1211
-
1212
-
1213
- class CDATASection(Text):
1214
- __slots__ = ()
1215
-
1216
- nodeType = Node.CDATA_SECTION_NODE
1217
- nodeName = "#cdata-section"
1218
-
1219
- def writexml(self, writer, indent="", addindent="", newl=""):
1220
- if self.data.find("]]>") >= 0:
1221
- raise ValueError("']]>' not allowed in a CDATA section")
1222
- writer.write("<![CDATA[%s]]>" % self.data)
1223
-
1224
-
1225
- class ReadOnlySequentialNamedNodeMap(object):
1226
- __slots__ = '_seq',
1227
-
1228
- def __init__(self, seq=()):
1229
- # seq should be a list or tuple
1230
- self._seq = seq
1231
-
1232
- def __len__(self):
1233
- return len(self._seq)
1234
-
1235
- def _get_length(self):
1236
- return len(self._seq)
1237
-
1238
- def getNamedItem(self, name):
1239
- for n in self._seq:
1240
- if n.nodeName == name:
1241
- return n
1242
-
1243
- def getNamedItemNS(self, namespaceURI, localName):
1244
- for n in self._seq:
1245
- if n.namespaceURI == namespaceURI and n.localName == localName:
1246
- return n
1247
-
1248
- def __getitem__(self, name_or_tuple):
1249
- if isinstance(name_or_tuple, tuple):
1250
- node = self.getNamedItemNS(*name_or_tuple)
1251
- else:
1252
- node = self.getNamedItem(name_or_tuple)
1253
- if node is None:
1254
- raise KeyError(name_or_tuple)
1255
- return node
1256
-
1257
- def item(self, index):
1258
- if index < 0:
1259
- return None
1260
- try:
1261
- return self._seq[index]
1262
- except IndexError:
1263
- return None
1264
-
1265
- def removeNamedItem(self, name):
1266
- raise xml.dom.NoModificationAllowedErr(
1267
- "NamedNodeMap instance is read-only")
1268
-
1269
- def removeNamedItemNS(self, namespaceURI, localName):
1270
- raise xml.dom.NoModificationAllowedErr(
1271
- "NamedNodeMap instance is read-only")
1272
-
1273
- def setNamedItem(self, node):
1274
- raise xml.dom.NoModificationAllowedErr(
1275
- "NamedNodeMap instance is read-only")
1276
-
1277
- def setNamedItemNS(self, node):
1278
- raise xml.dom.NoModificationAllowedErr(
1279
- "NamedNodeMap instance is read-only")
1280
-
1281
- def __getstate__(self):
1282
- return [self._seq]
1283
-
1284
- def __setstate__(self, state):
1285
- self._seq = state[0]
1286
-
1287
- defproperty(ReadOnlySequentialNamedNodeMap, "length",
1288
- doc="Number of entries in the NamedNodeMap.")
1289
-
1290
-
1291
- class Identified:
1292
- """Mix-in class that supports the publicId and systemId attributes."""
1293
-
1294
- __slots__ = 'publicId', 'systemId'
1295
-
1296
- def _identified_mixin_init(self, publicId, systemId):
1297
- self.publicId = publicId
1298
- self.systemId = systemId
1299
-
1300
- def _get_publicId(self):
1301
- return self.publicId
1302
-
1303
- def _get_systemId(self):
1304
- return self.systemId
1305
-
1306
- class DocumentType(Identified, Childless, Node):
1307
- nodeType = Node.DOCUMENT_TYPE_NODE
1308
- nodeValue = None
1309
- name = None
1310
- publicId = None
1311
- systemId = None
1312
- internalSubset = None
1313
-
1314
- def __init__(self, qualifiedName):
1315
- self.entities = ReadOnlySequentialNamedNodeMap()
1316
- self.notations = ReadOnlySequentialNamedNodeMap()
1317
- if qualifiedName:
1318
- prefix, localname = _nssplit(qualifiedName)
1319
- self.name = localname
1320
- self.nodeName = self.name
1321
-
1322
- def _get_internalSubset(self):
1323
- return self.internalSubset
1324
-
1325
- def cloneNode(self, deep):
1326
- if self.ownerDocument is None:
1327
- # it's ok
1328
- clone = DocumentType(None)
1329
- clone.name = self.name
1330
- clone.nodeName = self.name
1331
- operation = xml.dom.UserDataHandler.NODE_CLONED
1332
- if deep:
1333
- clone.entities._seq = []
1334
- clone.notations._seq = []
1335
- for n in self.notations._seq:
1336
- notation = Notation(n.nodeName, n.publicId, n.systemId)
1337
- clone.notations._seq.append(notation)
1338
- n._call_user_data_handler(operation, n, notation)
1339
- for e in self.entities._seq:
1340
- entity = Entity(e.nodeName, e.publicId, e.systemId,
1341
- e.notationName)
1342
- entity.actualEncoding = e.actualEncoding
1343
- entity.encoding = e.encoding
1344
- entity.version = e.version
1345
- clone.entities._seq.append(entity)
1346
- e._call_user_data_handler(operation, e, entity)
1347
- self._call_user_data_handler(operation, self, clone)
1348
- return clone
1349
- else:
1350
- return None
1351
-
1352
- def writexml(self, writer, indent="", addindent="", newl=""):
1353
- writer.write("<!DOCTYPE ")
1354
- writer.write(self.name)
1355
- if self.publicId:
1356
- writer.write("%s PUBLIC '%s'%s '%s'"
1357
- % (newl, self.publicId, newl, self.systemId))
1358
- elif self.systemId:
1359
- writer.write("%s SYSTEM '%s'" % (newl, self.systemId))
1360
- if self.internalSubset is not None:
1361
- writer.write(" [")
1362
- writer.write(self.internalSubset)
1363
- writer.write("]")
1364
- writer.write(">"+newl)
1365
-
1366
- class Entity(Identified, Node):
1367
- attributes = None
1368
- nodeType = Node.ENTITY_NODE
1369
- nodeValue = None
1370
-
1371
- actualEncoding = None
1372
- encoding = None
1373
- version = None
1374
-
1375
- def __init__(self, name, publicId, systemId, notation):
1376
- self.nodeName = name
1377
- self.notationName = notation
1378
- self.childNodes = NodeList()
1379
- self._identified_mixin_init(publicId, systemId)
1380
-
1381
- def _get_actualEncoding(self):
1382
- return self.actualEncoding
1383
-
1384
- def _get_encoding(self):
1385
- return self.encoding
1386
-
1387
- def _get_version(self):
1388
- return self.version
1389
-
1390
- def appendChild(self, newChild):
1391
- raise xml.dom.HierarchyRequestErr(
1392
- "cannot append children to an entity node")
1393
-
1394
- def insertBefore(self, newChild, refChild):
1395
- raise xml.dom.HierarchyRequestErr(
1396
- "cannot insert children below an entity node")
1397
-
1398
- def removeChild(self, oldChild):
1399
- raise xml.dom.HierarchyRequestErr(
1400
- "cannot remove children from an entity node")
1401
-
1402
- def replaceChild(self, newChild, oldChild):
1403
- raise xml.dom.HierarchyRequestErr(
1404
- "cannot replace children of an entity node")
1405
-
1406
- class Notation(Identified, Childless, Node):
1407
- nodeType = Node.NOTATION_NODE
1408
- nodeValue = None
1409
-
1410
- def __init__(self, name, publicId, systemId):
1411
- self.nodeName = name
1412
- self._identified_mixin_init(publicId, systemId)
1413
-
1414
-
1415
- class DOMImplementation(DOMImplementationLS):
1416
- _features = [("core", "1.0"),
1417
- ("core", "2.0"),
1418
- ("core", None),
1419
- ("xml", "1.0"),
1420
- ("xml", "2.0"),
1421
- ("xml", None),
1422
- ("ls-load", "3.0"),
1423
- ("ls-load", None),
1424
- ]
1425
-
1426
- def hasFeature(self, feature, version):
1427
- if version == "":
1428
- version = None
1429
- return (feature.lower(), version) in self._features
1430
-
1431
- def createDocument(self, namespaceURI, qualifiedName, doctype):
1432
- if doctype and doctype.parentNode is not None:
1433
- raise xml.dom.WrongDocumentErr(
1434
- "doctype object owned by another DOM tree")
1435
- doc = self._create_document()
1436
-
1437
- add_root_element = not (namespaceURI is None
1438
- and qualifiedName is None
1439
- and doctype is None)
1440
-
1441
- if not qualifiedName and add_root_element:
1442
- # The spec is unclear what to raise here; SyntaxErr
1443
- # would be the other obvious candidate. Since Xerces raises
1444
- # InvalidCharacterErr, and since SyntaxErr is not listed
1445
- # for createDocument, that seems to be the better choice.
1446
- # XXX: need to check for illegal characters here and in
1447
- # createElement.
1448
-
1449
- # DOM Level III clears this up when talking about the return value
1450
- # of this function. If namespaceURI, qName and DocType are
1451
- # Null the document is returned without a document element
1452
- # Otherwise if doctype or namespaceURI are not None
1453
- # Then we go back to the above problem
1454
- raise xml.dom.InvalidCharacterErr("Element with no name")
1455
-
1456
- if add_root_element:
1457
- prefix, localname = _nssplit(qualifiedName)
1458
- if prefix == "xml" \
1459
- and namespaceURI != "http://www.w3.org/XML/1998/namespace":
1460
- raise xml.dom.NamespaceErr("illegal use of 'xml' prefix")
1461
- if prefix and not namespaceURI:
1462
- raise xml.dom.NamespaceErr(
1463
- "illegal use of prefix without namespaces")
1464
- element = doc.createElementNS(namespaceURI, qualifiedName)
1465
- if doctype:
1466
- doc.appendChild(doctype)
1467
- doc.appendChild(element)
1468
-
1469
- if doctype:
1470
- doctype.parentNode = doctype.ownerDocument = doc
1471
-
1472
- doc.doctype = doctype
1473
- doc.implementation = self
1474
- return doc
1475
-
1476
- def createDocumentType(self, qualifiedName, publicId, systemId):
1477
- doctype = DocumentType(qualifiedName)
1478
- doctype.publicId = publicId
1479
- doctype.systemId = systemId
1480
- return doctype
1481
-
1482
- # DOM Level 3 (WD 9 April 2002)
1483
-
1484
- def getInterface(self, feature):
1485
- if self.hasFeature(feature, None):
1486
- return self
1487
- else:
1488
- return None
1489
-
1490
- # internal
1491
- def _create_document(self):
1492
- return Document()
1493
-
1494
- class ElementInfo(object):
1495
- """Object that represents content-model information for an element.
1496
-
1497
- This implementation is not expected to be used in practice; DOM
1498
- builders should provide implementations which do the right thing
1499
- using information available to it.
1500
-
1501
- """
1502
-
1503
- __slots__ = 'tagName',
1504
-
1505
- def __init__(self, name):
1506
- self.tagName = name
1507
-
1508
- def getAttributeType(self, aname):
1509
- return _no_type
1510
-
1511
- def getAttributeTypeNS(self, namespaceURI, localName):
1512
- return _no_type
1513
-
1514
- def isElementContent(self):
1515
- return False
1516
-
1517
- def isEmpty(self):
1518
- """Returns true iff this element is declared to have an EMPTY
1519
- content model."""
1520
- return False
1521
-
1522
- def isId(self, aname):
1523
- """Returns true iff the named attribute is a DTD-style ID."""
1524
- return False
1525
-
1526
- def isIdNS(self, namespaceURI, localName):
1527
- """Returns true iff the identified attribute is a DTD-style ID."""
1528
- return False
1529
-
1530
- def __getstate__(self):
1531
- return self.tagName
1532
-
1533
- def __setstate__(self, state):
1534
- self.tagName = state
1535
-
1536
- def _clear_id_cache(node):
1537
- if node.nodeType == Node.DOCUMENT_NODE:
1538
- node._id_cache.clear()
1539
- node._id_search_stack = None
1540
- elif _in_document(node):
1541
- node.ownerDocument._id_cache.clear()
1542
- node.ownerDocument._id_search_stack= None
1543
-
1544
- class Document(Node, DocumentLS):
1545
- __slots__ = ('_elem_info', 'doctype',
1546
- '_id_search_stack', 'childNodes', '_id_cache')
1547
- _child_node_types = (Node.ELEMENT_NODE, Node.PROCESSING_INSTRUCTION_NODE,
1548
- Node.COMMENT_NODE, Node.DOCUMENT_TYPE_NODE)
1549
-
1550
- implementation = DOMImplementation()
1551
- nodeType = Node.DOCUMENT_NODE
1552
- nodeName = "#document"
1553
- nodeValue = None
1554
- attributes = None
1555
- parentNode = None
1556
- previousSibling = nextSibling = None
1557
-
1558
-
1559
- # Document attributes from Level 3 (WD 9 April 2002)
1560
-
1561
- actualEncoding = None
1562
- encoding = None
1563
- standalone = None
1564
- version = None
1565
- strictErrorChecking = False
1566
- errorHandler = None
1567
- documentURI = None
1568
-
1569
- _magic_id_count = 0
1570
-
1571
- def __init__(self):
1572
- self.doctype = None
1573
- self.childNodes = NodeList()
1574
- # mapping of (namespaceURI, localName) -> ElementInfo
1575
- # and tagName -> ElementInfo
1576
- self._elem_info = {}
1577
- self._id_cache = {}
1578
- self._id_search_stack = None
1579
-
1580
- def _get_elem_info(self, element):
1581
- if element.namespaceURI:
1582
- key = element.namespaceURI, element.localName
1583
- else:
1584
- key = element.tagName
1585
- return self._elem_info.get(key)
1586
-
1587
- def _get_actualEncoding(self):
1588
- return self.actualEncoding
1589
-
1590
- def _get_doctype(self):
1591
- return self.doctype
1592
-
1593
- def _get_documentURI(self):
1594
- return self.documentURI
1595
-
1596
- def _get_encoding(self):
1597
- return self.encoding
1598
-
1599
- def _get_errorHandler(self):
1600
- return self.errorHandler
1601
-
1602
- def _get_standalone(self):
1603
- return self.standalone
1604
-
1605
- def _get_strictErrorChecking(self):
1606
- return self.strictErrorChecking
1607
-
1608
- def _get_version(self):
1609
- return self.version
1610
-
1611
- def appendChild(self, node):
1612
- if node.nodeType not in self._child_node_types:
1613
- raise xml.dom.HierarchyRequestErr(
1614
- "%s cannot be child of %s" % (repr(node), repr(self)))
1615
- if node.parentNode is not None:
1616
- # This needs to be done before the next test since this
1617
- # may *be* the document element, in which case it should
1618
- # end up re-ordered to the end.
1619
- node.parentNode.removeChild(node)
1620
-
1621
- if node.nodeType == Node.ELEMENT_NODE \
1622
- and self._get_documentElement():
1623
- raise xml.dom.HierarchyRequestErr(
1624
- "two document elements disallowed")
1625
- return Node.appendChild(self, node)
1626
-
1627
- def removeChild(self, oldChild):
1628
- try:
1629
- self.childNodes.remove(oldChild)
1630
- except ValueError:
1631
- raise xml.dom.NotFoundErr()
1632
- oldChild.nextSibling = oldChild.previousSibling = None
1633
- oldChild.parentNode = None
1634
- if self.documentElement is oldChild:
1635
- self.documentElement = None
1636
-
1637
- return oldChild
1638
-
1639
- def _get_documentElement(self):
1640
- for node in self.childNodes:
1641
- if node.nodeType == Node.ELEMENT_NODE:
1642
- return node
1643
-
1644
- def unlink(self):
1645
- if self.doctype is not None:
1646
- self.doctype.unlink()
1647
- self.doctype = None
1648
- Node.unlink(self)
1649
-
1650
- def cloneNode(self, deep):
1651
- if not deep:
1652
- return None
1653
- clone = self.implementation.createDocument(None, None, None)
1654
- clone.encoding = self.encoding
1655
- clone.standalone = self.standalone
1656
- clone.version = self.version
1657
- for n in self.childNodes:
1658
- childclone = _clone_node(n, deep, clone)
1659
- assert childclone.ownerDocument.isSameNode(clone)
1660
- clone.childNodes.append(childclone)
1661
- if childclone.nodeType == Node.DOCUMENT_NODE:
1662
- assert clone.documentElement is None
1663
- elif childclone.nodeType == Node.DOCUMENT_TYPE_NODE:
1664
- assert clone.doctype is None
1665
- clone.doctype = childclone
1666
- childclone.parentNode = clone
1667
- self._call_user_data_handler(xml.dom.UserDataHandler.NODE_CLONED,
1668
- self, clone)
1669
- return clone
1670
-
1671
- def createDocumentFragment(self):
1672
- d = DocumentFragment()
1673
- d.ownerDocument = self
1674
- return d
1675
-
1676
- def createElement(self, tagName):
1677
- e = Element(tagName)
1678
- e.ownerDocument = self
1679
- return e
1680
-
1681
- def createTextNode(self, data):
1682
- if not isinstance(data, str):
1683
- raise TypeError("node contents must be a string")
1684
- t = Text()
1685
- t.data = data
1686
- t.ownerDocument = self
1687
- return t
1688
-
1689
- def createCDATASection(self, data):
1690
- if not isinstance(data, str):
1691
- raise TypeError("node contents must be a string")
1692
- c = CDATASection()
1693
- c.data = data
1694
- c.ownerDocument = self
1695
- return c
1696
-
1697
- def createComment(self, data):
1698
- c = Comment(data)
1699
- c.ownerDocument = self
1700
- return c
1701
-
1702
- def createProcessingInstruction(self, target, data):
1703
- p = ProcessingInstruction(target, data)
1704
- p.ownerDocument = self
1705
- return p
1706
-
1707
- def createAttribute(self, qName):
1708
- a = Attr(qName)
1709
- a.ownerDocument = self
1710
- a.value = ""
1711
- return a
1712
-
1713
- def createElementNS(self, namespaceURI, qualifiedName):
1714
- prefix, localName = _nssplit(qualifiedName)
1715
- e = Element(qualifiedName, namespaceURI, prefix)
1716
- e.ownerDocument = self
1717
- return e
1718
-
1719
- def createAttributeNS(self, namespaceURI, qualifiedName):
1720
- prefix, localName = _nssplit(qualifiedName)
1721
- a = Attr(qualifiedName, namespaceURI, localName, prefix)
1722
- a.ownerDocument = self
1723
- a.value = ""
1724
- return a
1725
-
1726
- # A couple of implementation-specific helpers to create node types
1727
- # not supported by the W3C DOM specs:
1728
-
1729
- def _create_entity(self, name, publicId, systemId, notationName):
1730
- e = Entity(name, publicId, systemId, notationName)
1731
- e.ownerDocument = self
1732
- return e
1733
-
1734
- def _create_notation(self, name, publicId, systemId):
1735
- n = Notation(name, publicId, systemId)
1736
- n.ownerDocument = self
1737
- return n
1738
-
1739
- def getElementById(self, id):
1740
- if id in self._id_cache:
1741
- return self._id_cache[id]
1742
- if not (self._elem_info or self._magic_id_count):
1743
- return None
1744
-
1745
- stack = self._id_search_stack
1746
- if stack is None:
1747
- # we never searched before, or the cache has been cleared
1748
- stack = [self.documentElement]
1749
- self._id_search_stack = stack
1750
- elif not stack:
1751
- # Previous search was completed and cache is still valid;
1752
- # no matching node.
1753
- return None
1754
-
1755
- result = None
1756
- while stack:
1757
- node = stack.pop()
1758
- # add child elements to stack for continued searching
1759
- stack.extend([child for child in node.childNodes
1760
- if child.nodeType in _nodeTypes_with_children])
1761
- # check this node
1762
- info = self._get_elem_info(node)
1763
- if info:
1764
- # We have to process all ID attributes before
1765
- # returning in order to get all the attributes set to
1766
- # be IDs using Element.setIdAttribute*().
1767
- for attr in node.attributes.values():
1768
- if attr.namespaceURI:
1769
- if info.isIdNS(attr.namespaceURI, attr.localName):
1770
- self._id_cache[attr.value] = node
1771
- if attr.value == id:
1772
- result = node
1773
- elif not node._magic_id_nodes:
1774
- break
1775
- elif info.isId(attr.name):
1776
- self._id_cache[attr.value] = node
1777
- if attr.value == id:
1778
- result = node
1779
- elif not node._magic_id_nodes:
1780
- break
1781
- elif attr._is_id:
1782
- self._id_cache[attr.value] = node
1783
- if attr.value == id:
1784
- result = node
1785
- elif node._magic_id_nodes == 1:
1786
- break
1787
- elif node._magic_id_nodes:
1788
- for attr in node.attributes.values():
1789
- if attr._is_id:
1790
- self._id_cache[attr.value] = node
1791
- if attr.value == id:
1792
- result = node
1793
- if result is not None:
1794
- break
1795
- return result
1796
-
1797
- def getElementsByTagName(self, name):
1798
- return _get_elements_by_tagName_helper(self, name, NodeList())
1799
-
1800
- def getElementsByTagNameNS(self, namespaceURI, localName):
1801
- return _get_elements_by_tagName_ns_helper(
1802
- self, namespaceURI, localName, NodeList())
1803
-
1804
- def isSupported(self, feature, version):
1805
- return self.implementation.hasFeature(feature, version)
1806
-
1807
- def importNode(self, node, deep):
1808
- if node.nodeType == Node.DOCUMENT_NODE:
1809
- raise xml.dom.NotSupportedErr("cannot import document nodes")
1810
- elif node.nodeType == Node.DOCUMENT_TYPE_NODE:
1811
- raise xml.dom.NotSupportedErr("cannot import document type nodes")
1812
- return _clone_node(node, deep, self)
1813
-
1814
- def writexml(self, writer, indent="", addindent="", newl="", encoding=None,
1815
- standalone=None):
1816
- declarations = []
1817
-
1818
- if encoding:
1819
- declarations.append(f'encoding="{encoding}"')
1820
- if standalone is not None:
1821
- declarations.append(f'standalone="{"yes" if standalone else "no"}"')
1822
-
1823
- writer.write(f'<?xml version="1.0" {" ".join(declarations)}?>{newl}')
1824
-
1825
- for node in self.childNodes:
1826
- node.writexml(writer, indent, addindent, newl)
1827
-
1828
- # DOM Level 3 (WD 9 April 2002)
1829
-
1830
- def renameNode(self, n, namespaceURI, name):
1831
- if n.ownerDocument is not self:
1832
- raise xml.dom.WrongDocumentErr(
1833
- "cannot rename nodes from other documents;\n"
1834
- "expected %s,\nfound %s" % (self, n.ownerDocument))
1835
- if n.nodeType not in (Node.ELEMENT_NODE, Node.ATTRIBUTE_NODE):
1836
- raise xml.dom.NotSupportedErr(
1837
- "renameNode() only applies to element and attribute nodes")
1838
- if namespaceURI != EMPTY_NAMESPACE:
1839
- if ':' in name:
1840
- prefix, localName = name.split(':', 1)
1841
- if ( prefix == "xmlns"
1842
- and namespaceURI != xml.dom.XMLNS_NAMESPACE):
1843
- raise xml.dom.NamespaceErr(
1844
- "illegal use of 'xmlns' prefix")
1845
- else:
1846
- if ( name == "xmlns"
1847
- and namespaceURI != xml.dom.XMLNS_NAMESPACE
1848
- and n.nodeType == Node.ATTRIBUTE_NODE):
1849
- raise xml.dom.NamespaceErr(
1850
- "illegal use of the 'xmlns' attribute")
1851
- prefix = None
1852
- localName = name
1853
- else:
1854
- prefix = None
1855
- localName = None
1856
- if n.nodeType == Node.ATTRIBUTE_NODE:
1857
- element = n.ownerElement
1858
- if element is not None:
1859
- is_id = n._is_id
1860
- element.removeAttributeNode(n)
1861
- else:
1862
- element = None
1863
- n.prefix = prefix
1864
- n._localName = localName
1865
- n.namespaceURI = namespaceURI
1866
- n.nodeName = name
1867
- if n.nodeType == Node.ELEMENT_NODE:
1868
- n.tagName = name
1869
- else:
1870
- # attribute node
1871
- n.name = name
1872
- if element is not None:
1873
- element.setAttributeNode(n)
1874
- if is_id:
1875
- element.setIdAttributeNode(n)
1876
- # It's not clear from a semantic perspective whether we should
1877
- # call the user data handlers for the NODE_RENAMED event since
1878
- # we're re-using the existing node. The draft spec has been
1879
- # interpreted as meaning "no, don't call the handler unless a
1880
- # new node is created."
1881
- return n
1882
-
1883
- defproperty(Document, "documentElement",
1884
- doc="Top-level element of this document.")
1885
-
1886
-
1887
- def _clone_node(node, deep, newOwnerDocument):
1888
- """
1889
- Clone a node and give it the new owner document.
1890
- Called by Node.cloneNode and Document.importNode
1891
- """
1892
- if node.ownerDocument.isSameNode(newOwnerDocument):
1893
- operation = xml.dom.UserDataHandler.NODE_CLONED
1894
- else:
1895
- operation = xml.dom.UserDataHandler.NODE_IMPORTED
1896
- if node.nodeType == Node.ELEMENT_NODE:
1897
- clone = newOwnerDocument.createElementNS(node.namespaceURI,
1898
- node.nodeName)
1899
- for attr in node.attributes.values():
1900
- clone.setAttributeNS(attr.namespaceURI, attr.nodeName, attr.value)
1901
- a = clone.getAttributeNodeNS(attr.namespaceURI, attr.localName)
1902
- a.specified = attr.specified
1903
-
1904
- if deep:
1905
- for child in node.childNodes:
1906
- c = _clone_node(child, deep, newOwnerDocument)
1907
- clone.appendChild(c)
1908
-
1909
- elif node.nodeType == Node.DOCUMENT_FRAGMENT_NODE:
1910
- clone = newOwnerDocument.createDocumentFragment()
1911
- if deep:
1912
- for child in node.childNodes:
1913
- c = _clone_node(child, deep, newOwnerDocument)
1914
- clone.appendChild(c)
1915
-
1916
- elif node.nodeType == Node.TEXT_NODE:
1917
- clone = newOwnerDocument.createTextNode(node.data)
1918
- elif node.nodeType == Node.CDATA_SECTION_NODE:
1919
- clone = newOwnerDocument.createCDATASection(node.data)
1920
- elif node.nodeType == Node.PROCESSING_INSTRUCTION_NODE:
1921
- clone = newOwnerDocument.createProcessingInstruction(node.target,
1922
- node.data)
1923
- elif node.nodeType == Node.COMMENT_NODE:
1924
- clone = newOwnerDocument.createComment(node.data)
1925
- elif node.nodeType == Node.ATTRIBUTE_NODE:
1926
- clone = newOwnerDocument.createAttributeNS(node.namespaceURI,
1927
- node.nodeName)
1928
- clone.specified = True
1929
- clone.value = node.value
1930
- elif node.nodeType == Node.DOCUMENT_TYPE_NODE:
1931
- assert node.ownerDocument is not newOwnerDocument
1932
- operation = xml.dom.UserDataHandler.NODE_IMPORTED
1933
- clone = newOwnerDocument.implementation.createDocumentType(
1934
- node.name, node.publicId, node.systemId)
1935
- clone.ownerDocument = newOwnerDocument
1936
- if deep:
1937
- clone.entities._seq = []
1938
- clone.notations._seq = []
1939
- for n in node.notations._seq:
1940
- notation = Notation(n.nodeName, n.publicId, n.systemId)
1941
- notation.ownerDocument = newOwnerDocument
1942
- clone.notations._seq.append(notation)
1943
- if hasattr(n, '_call_user_data_handler'):
1944
- n._call_user_data_handler(operation, n, notation)
1945
- for e in node.entities._seq:
1946
- entity = Entity(e.nodeName, e.publicId, e.systemId,
1947
- e.notationName)
1948
- entity.actualEncoding = e.actualEncoding
1949
- entity.encoding = e.encoding
1950
- entity.version = e.version
1951
- entity.ownerDocument = newOwnerDocument
1952
- clone.entities._seq.append(entity)
1953
- if hasattr(e, '_call_user_data_handler'):
1954
- e._call_user_data_handler(operation, e, entity)
1955
- else:
1956
- # Note the cloning of Document and DocumentType nodes is
1957
- # implementation specific. minidom handles those cases
1958
- # directly in the cloneNode() methods.
1959
- raise xml.dom.NotSupportedErr("Cannot clone node %s" % repr(node))
1960
-
1961
- # Check for _call_user_data_handler() since this could conceivably
1962
- # used with other DOM implementations (one of the FourThought
1963
- # DOMs, perhaps?).
1964
- if hasattr(node, '_call_user_data_handler'):
1965
- node._call_user_data_handler(operation, node, clone)
1966
- return clone
1967
-
1968
-
1969
- def _nssplit(qualifiedName):
1970
- fields = qualifiedName.split(':', 1)
1971
- if len(fields) == 2:
1972
- return fields
1973
- else:
1974
- return (None, fields[0])
1975
-
1976
-
1977
- def _do_pulldom_parse(func, args, kwargs):
1978
- events = func(*args, **kwargs)
1979
- toktype, rootNode = events.getEvent()
1980
- events.expandNode(rootNode)
1981
- events.clear()
1982
- return rootNode
1983
-
1984
- def parse(file, parser=None, bufsize=None):
1985
- """Parse a file into a DOM by filename or file object."""
1986
- if parser is None and not bufsize:
1987
- from xml.dom import expatbuilder
1988
- return expatbuilder.parse(file)
1989
- else:
1990
- from xml.dom import pulldom
1991
- return _do_pulldom_parse(pulldom.parse, (file,),
1992
- {'parser': parser, 'bufsize': bufsize})
1993
-
1994
- def parseString(string, parser=None):
1995
- """Parse a file into a DOM from a string."""
1996
- if parser is None:
1997
- from xml.dom import expatbuilder
1998
- return expatbuilder.parseString(string)
1999
- else:
2000
- from xml.dom import pulldom
2001
- return _do_pulldom_parse(pulldom.parseString, (string,),
2002
- {'parser': parser})
2003
-
2004
- def getDOMImplementation(features=None):
2005
- if features:
2006
- if isinstance(features, str):
2007
- features = domreg._parse_feature_string(features)
2008
- for f, v in features:
2009
- if not Document.implementation.hasFeature(f, v):
2010
- return None
2011
- return Document.implementation