@ecmaos-apps/python3 0.0.0-stage → 3.14.9-ecmaos.1

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 (1128) hide show
  1. package/README.md +8 -2
  2. package/package.json +47 -4
  3. package/python3.wasm +0 -0
  4. package/runtime/usr/lib/python3.14/LICENSE.txt +277 -0
  5. package/runtime/usr/lib/python3.14/__future__.py +147 -0
  6. package/runtime/usr/lib/python3.14/__hello__.py +16 -0
  7. package/runtime/usr/lib/python3.14/__phello__/__init__.py +7 -0
  8. package/runtime/usr/lib/python3.14/__phello__/__pycache__/__init__.cpython-314.pyc +0 -0
  9. package/runtime/usr/lib/python3.14/__phello__/__pycache__/spam.cpython-314.pyc +0 -0
  10. package/runtime/usr/lib/python3.14/__phello__/spam.py +7 -0
  11. package/runtime/usr/lib/python3.14/__pycache__/__future__.cpython-314.pyc +0 -0
  12. package/runtime/usr/lib/python3.14/__pycache__/__hello__.cpython-314.pyc +0 -0
  13. package/runtime/usr/lib/python3.14/__pycache__/_aix_support.cpython-314.pyc +0 -0
  14. package/runtime/usr/lib/python3.14/__pycache__/_android_support.cpython-314.pyc +0 -0
  15. package/runtime/usr/lib/python3.14/__pycache__/_apple_support.cpython-314.pyc +0 -0
  16. package/runtime/usr/lib/python3.14/__pycache__/_ast_unparse.cpython-314.pyc +0 -0
  17. package/runtime/usr/lib/python3.14/__pycache__/_collections_abc.cpython-314.pyc +0 -0
  18. package/runtime/usr/lib/python3.14/__pycache__/_colorize.cpython-314.pyc +0 -0
  19. package/runtime/usr/lib/python3.14/__pycache__/_compat_pickle.cpython-314.pyc +0 -0
  20. package/runtime/usr/lib/python3.14/__pycache__/_ios_support.cpython-314.pyc +0 -0
  21. package/runtime/usr/lib/python3.14/__pycache__/_markupbase.cpython-314.pyc +0 -0
  22. package/runtime/usr/lib/python3.14/__pycache__/_opcode_metadata.cpython-314.pyc +0 -0
  23. package/runtime/usr/lib/python3.14/__pycache__/_osx_support.cpython-314.pyc +0 -0
  24. package/runtime/usr/lib/python3.14/__pycache__/_py_abc.cpython-314.pyc +0 -0
  25. package/runtime/usr/lib/python3.14/__pycache__/_py_warnings.cpython-314.pyc +0 -0
  26. package/runtime/usr/lib/python3.14/__pycache__/_pydatetime.cpython-314.pyc +0 -0
  27. package/runtime/usr/lib/python3.14/__pycache__/_pydecimal.cpython-314.pyc +0 -0
  28. package/runtime/usr/lib/python3.14/__pycache__/_pyio.cpython-314.pyc +0 -0
  29. package/runtime/usr/lib/python3.14/__pycache__/_pylong.cpython-314.pyc +0 -0
  30. package/runtime/usr/lib/python3.14/__pycache__/_sitebuiltins.cpython-314.pyc +0 -0
  31. package/runtime/usr/lib/python3.14/__pycache__/_strptime.cpython-314.pyc +0 -0
  32. package/runtime/usr/lib/python3.14/__pycache__/_sysconfigdata__linux_.cpython-314.pyc +0 -0
  33. package/runtime/usr/lib/python3.14/__pycache__/_threading_local.cpython-314.pyc +0 -0
  34. package/runtime/usr/lib/python3.14/__pycache__/_weakrefset.cpython-314.pyc +0 -0
  35. package/runtime/usr/lib/python3.14/__pycache__/abc.cpython-314.pyc +0 -0
  36. package/runtime/usr/lib/python3.14/__pycache__/annotationlib.cpython-314.pyc +0 -0
  37. package/runtime/usr/lib/python3.14/__pycache__/antigravity.cpython-314.pyc +0 -0
  38. package/runtime/usr/lib/python3.14/__pycache__/argparse.cpython-314.pyc +0 -0
  39. package/runtime/usr/lib/python3.14/__pycache__/ast.cpython-314.pyc +0 -0
  40. package/runtime/usr/lib/python3.14/__pycache__/base64.cpython-314.pyc +0 -0
  41. package/runtime/usr/lib/python3.14/__pycache__/bdb.cpython-314.pyc +0 -0
  42. package/runtime/usr/lib/python3.14/__pycache__/bisect.cpython-314.pyc +0 -0
  43. package/runtime/usr/lib/python3.14/__pycache__/bz2.cpython-314.pyc +0 -0
  44. package/runtime/usr/lib/python3.14/__pycache__/cProfile.cpython-314.pyc +0 -0
  45. package/runtime/usr/lib/python3.14/__pycache__/calendar.cpython-314.pyc +0 -0
  46. package/runtime/usr/lib/python3.14/__pycache__/cmd.cpython-314.pyc +0 -0
  47. package/runtime/usr/lib/python3.14/__pycache__/code.cpython-314.pyc +0 -0
  48. package/runtime/usr/lib/python3.14/__pycache__/codecs.cpython-314.pyc +0 -0
  49. package/runtime/usr/lib/python3.14/__pycache__/codeop.cpython-314.pyc +0 -0
  50. package/runtime/usr/lib/python3.14/__pycache__/colorsys.cpython-314.pyc +0 -0
  51. package/runtime/usr/lib/python3.14/__pycache__/compileall.cpython-314.pyc +0 -0
  52. package/runtime/usr/lib/python3.14/__pycache__/configparser.cpython-314.pyc +0 -0
  53. package/runtime/usr/lib/python3.14/__pycache__/contextlib.cpython-314.pyc +0 -0
  54. package/runtime/usr/lib/python3.14/__pycache__/contextvars.cpython-314.pyc +0 -0
  55. package/runtime/usr/lib/python3.14/__pycache__/copy.cpython-314.pyc +0 -0
  56. package/runtime/usr/lib/python3.14/__pycache__/copyreg.cpython-314.pyc +0 -0
  57. package/runtime/usr/lib/python3.14/__pycache__/csv.cpython-314.pyc +0 -0
  58. package/runtime/usr/lib/python3.14/__pycache__/dataclasses.cpython-314.pyc +0 -0
  59. package/runtime/usr/lib/python3.14/__pycache__/datetime.cpython-314.pyc +0 -0
  60. package/runtime/usr/lib/python3.14/__pycache__/decimal.cpython-314.pyc +0 -0
  61. package/runtime/usr/lib/python3.14/__pycache__/difflib.cpython-314.pyc +0 -0
  62. package/runtime/usr/lib/python3.14/__pycache__/dis.cpython-314.pyc +0 -0
  63. package/runtime/usr/lib/python3.14/__pycache__/doctest.cpython-314.pyc +0 -0
  64. package/runtime/usr/lib/python3.14/__pycache__/enum.cpython-314.pyc +0 -0
  65. package/runtime/usr/lib/python3.14/__pycache__/filecmp.cpython-314.pyc +0 -0
  66. package/runtime/usr/lib/python3.14/__pycache__/fileinput.cpython-314.pyc +0 -0
  67. package/runtime/usr/lib/python3.14/__pycache__/fnmatch.cpython-314.pyc +0 -0
  68. package/runtime/usr/lib/python3.14/__pycache__/fractions.cpython-314.pyc +0 -0
  69. package/runtime/usr/lib/python3.14/__pycache__/ftplib.cpython-314.pyc +0 -0
  70. package/runtime/usr/lib/python3.14/__pycache__/functools.cpython-314.pyc +0 -0
  71. package/runtime/usr/lib/python3.14/__pycache__/genericpath.cpython-314.pyc +0 -0
  72. package/runtime/usr/lib/python3.14/__pycache__/getopt.cpython-314.pyc +0 -0
  73. package/runtime/usr/lib/python3.14/__pycache__/getpass.cpython-314.pyc +0 -0
  74. package/runtime/usr/lib/python3.14/__pycache__/gettext.cpython-314.pyc +0 -0
  75. package/runtime/usr/lib/python3.14/__pycache__/glob.cpython-314.pyc +0 -0
  76. package/runtime/usr/lib/python3.14/__pycache__/graphlib.cpython-314.pyc +0 -0
  77. package/runtime/usr/lib/python3.14/__pycache__/gzip.cpython-314.pyc +0 -0
  78. package/runtime/usr/lib/python3.14/__pycache__/hashlib.cpython-314.pyc +0 -0
  79. package/runtime/usr/lib/python3.14/__pycache__/heapq.cpython-314.pyc +0 -0
  80. package/runtime/usr/lib/python3.14/__pycache__/hmac.cpython-314.pyc +0 -0
  81. package/runtime/usr/lib/python3.14/__pycache__/imaplib.cpython-314.pyc +0 -0
  82. package/runtime/usr/lib/python3.14/__pycache__/inspect.cpython-314.pyc +0 -0
  83. package/runtime/usr/lib/python3.14/__pycache__/io.cpython-314.pyc +0 -0
  84. package/runtime/usr/lib/python3.14/__pycache__/ipaddress.cpython-314.pyc +0 -0
  85. package/runtime/usr/lib/python3.14/__pycache__/keyword.cpython-314.pyc +0 -0
  86. package/runtime/usr/lib/python3.14/__pycache__/linecache.cpython-314.pyc +0 -0
  87. package/runtime/usr/lib/python3.14/__pycache__/locale.cpython-314.pyc +0 -0
  88. package/runtime/usr/lib/python3.14/__pycache__/lzma.cpython-314.pyc +0 -0
  89. package/runtime/usr/lib/python3.14/__pycache__/mailbox.cpython-314.pyc +0 -0
  90. package/runtime/usr/lib/python3.14/__pycache__/mimetypes.cpython-314.pyc +0 -0
  91. package/runtime/usr/lib/python3.14/__pycache__/modulefinder.cpython-314.pyc +0 -0
  92. package/runtime/usr/lib/python3.14/__pycache__/netrc.cpython-314.pyc +0 -0
  93. package/runtime/usr/lib/python3.14/__pycache__/ntpath.cpython-314.pyc +0 -0
  94. package/runtime/usr/lib/python3.14/__pycache__/nturl2path.cpython-314.pyc +0 -0
  95. package/runtime/usr/lib/python3.14/__pycache__/numbers.cpython-314.pyc +0 -0
  96. package/runtime/usr/lib/python3.14/__pycache__/opcode.cpython-314.pyc +0 -0
  97. package/runtime/usr/lib/python3.14/__pycache__/operator.cpython-314.pyc +0 -0
  98. package/runtime/usr/lib/python3.14/__pycache__/optparse.cpython-314.pyc +0 -0
  99. package/runtime/usr/lib/python3.14/__pycache__/os.cpython-314.pyc +0 -0
  100. package/runtime/usr/lib/python3.14/__pycache__/pdb.cpython-314.pyc +0 -0
  101. package/runtime/usr/lib/python3.14/__pycache__/pickle.cpython-314.pyc +0 -0
  102. package/runtime/usr/lib/python3.14/__pycache__/pickletools.cpython-314.pyc +0 -0
  103. package/runtime/usr/lib/python3.14/__pycache__/pkgutil.cpython-314.pyc +0 -0
  104. package/runtime/usr/lib/python3.14/__pycache__/platform.cpython-314.pyc +0 -0
  105. package/runtime/usr/lib/python3.14/__pycache__/plistlib.cpython-314.pyc +0 -0
  106. package/runtime/usr/lib/python3.14/__pycache__/poplib.cpython-314.pyc +0 -0
  107. package/runtime/usr/lib/python3.14/__pycache__/posixpath.cpython-314.pyc +0 -0
  108. package/runtime/usr/lib/python3.14/__pycache__/pprint.cpython-314.pyc +0 -0
  109. package/runtime/usr/lib/python3.14/__pycache__/profile.cpython-314.pyc +0 -0
  110. package/runtime/usr/lib/python3.14/__pycache__/pstats.cpython-314.pyc +0 -0
  111. package/runtime/usr/lib/python3.14/__pycache__/pty.cpython-314.pyc +0 -0
  112. package/runtime/usr/lib/python3.14/__pycache__/py_compile.cpython-314.pyc +0 -0
  113. package/runtime/usr/lib/python3.14/__pycache__/pyclbr.cpython-314.pyc +0 -0
  114. package/runtime/usr/lib/python3.14/__pycache__/pydoc.cpython-314.pyc +0 -0
  115. package/runtime/usr/lib/python3.14/__pycache__/queue.cpython-314.pyc +0 -0
  116. package/runtime/usr/lib/python3.14/__pycache__/quopri.cpython-314.pyc +0 -0
  117. package/runtime/usr/lib/python3.14/__pycache__/random.cpython-314.pyc +0 -0
  118. package/runtime/usr/lib/python3.14/__pycache__/reprlib.cpython-314.pyc +0 -0
  119. package/runtime/usr/lib/python3.14/__pycache__/rlcompleter.cpython-314.pyc +0 -0
  120. package/runtime/usr/lib/python3.14/__pycache__/runpy.cpython-314.pyc +0 -0
  121. package/runtime/usr/lib/python3.14/__pycache__/sched.cpython-314.pyc +0 -0
  122. package/runtime/usr/lib/python3.14/__pycache__/secrets.cpython-314.pyc +0 -0
  123. package/runtime/usr/lib/python3.14/__pycache__/selectors.cpython-314.pyc +0 -0
  124. package/runtime/usr/lib/python3.14/__pycache__/shelve.cpython-314.pyc +0 -0
  125. package/runtime/usr/lib/python3.14/__pycache__/shlex.cpython-314.pyc +0 -0
  126. package/runtime/usr/lib/python3.14/__pycache__/shutil.cpython-314.pyc +0 -0
  127. package/runtime/usr/lib/python3.14/__pycache__/signal.cpython-314.pyc +0 -0
  128. package/runtime/usr/lib/python3.14/__pycache__/site.cpython-314.pyc +0 -0
  129. package/runtime/usr/lib/python3.14/__pycache__/smtplib.cpython-314.pyc +0 -0
  130. package/runtime/usr/lib/python3.14/__pycache__/socket.cpython-314.pyc +0 -0
  131. package/runtime/usr/lib/python3.14/__pycache__/socketserver.cpython-314.pyc +0 -0
  132. package/runtime/usr/lib/python3.14/__pycache__/sre_compile.cpython-314.pyc +0 -0
  133. package/runtime/usr/lib/python3.14/__pycache__/sre_constants.cpython-314.pyc +0 -0
  134. package/runtime/usr/lib/python3.14/__pycache__/sre_parse.cpython-314.pyc +0 -0
  135. package/runtime/usr/lib/python3.14/__pycache__/ssl.cpython-314.pyc +0 -0
  136. package/runtime/usr/lib/python3.14/__pycache__/stat.cpython-314.pyc +0 -0
  137. package/runtime/usr/lib/python3.14/__pycache__/statistics.cpython-314.pyc +0 -0
  138. package/runtime/usr/lib/python3.14/__pycache__/stringprep.cpython-314.pyc +0 -0
  139. package/runtime/usr/lib/python3.14/__pycache__/struct.cpython-314.pyc +0 -0
  140. package/runtime/usr/lib/python3.14/__pycache__/subprocess.cpython-314.pyc +0 -0
  141. package/runtime/usr/lib/python3.14/__pycache__/symtable.cpython-314.pyc +0 -0
  142. package/runtime/usr/lib/python3.14/__pycache__/tabnanny.cpython-314.pyc +0 -0
  143. package/runtime/usr/lib/python3.14/__pycache__/tarfile.cpython-314.pyc +0 -0
  144. package/runtime/usr/lib/python3.14/__pycache__/tempfile.cpython-314.pyc +0 -0
  145. package/runtime/usr/lib/python3.14/__pycache__/textwrap.cpython-314.pyc +0 -0
  146. package/runtime/usr/lib/python3.14/__pycache__/this.cpython-314.pyc +0 -0
  147. package/runtime/usr/lib/python3.14/__pycache__/threading.cpython-314.pyc +0 -0
  148. package/runtime/usr/lib/python3.14/__pycache__/timeit.cpython-314.pyc +0 -0
  149. package/runtime/usr/lib/python3.14/__pycache__/token.cpython-314.pyc +0 -0
  150. package/runtime/usr/lib/python3.14/__pycache__/tokenize.cpython-314.pyc +0 -0
  151. package/runtime/usr/lib/python3.14/__pycache__/trace.cpython-314.pyc +0 -0
  152. package/runtime/usr/lib/python3.14/__pycache__/traceback.cpython-314.pyc +0 -0
  153. package/runtime/usr/lib/python3.14/__pycache__/tracemalloc.cpython-314.pyc +0 -0
  154. package/runtime/usr/lib/python3.14/__pycache__/tty.cpython-314.pyc +0 -0
  155. package/runtime/usr/lib/python3.14/__pycache__/types.cpython-314.pyc +0 -0
  156. package/runtime/usr/lib/python3.14/__pycache__/typing.cpython-314.pyc +0 -0
  157. package/runtime/usr/lib/python3.14/__pycache__/uuid.cpython-314.pyc +0 -0
  158. package/runtime/usr/lib/python3.14/__pycache__/warnings.cpython-314.pyc +0 -0
  159. package/runtime/usr/lib/python3.14/__pycache__/wave.cpython-314.pyc +0 -0
  160. package/runtime/usr/lib/python3.14/__pycache__/weakref.cpython-314.pyc +0 -0
  161. package/runtime/usr/lib/python3.14/__pycache__/webbrowser.cpython-314.pyc +0 -0
  162. package/runtime/usr/lib/python3.14/__pycache__/zipapp.cpython-314.pyc +0 -0
  163. package/runtime/usr/lib/python3.14/__pycache__/zipimport.cpython-314.pyc +0 -0
  164. package/runtime/usr/lib/python3.14/_aix_support.py +108 -0
  165. package/runtime/usr/lib/python3.14/_android_support.py +192 -0
  166. package/runtime/usr/lib/python3.14/_apple_support.py +66 -0
  167. package/runtime/usr/lib/python3.14/_ast_unparse.py +1161 -0
  168. package/runtime/usr/lib/python3.14/_collections_abc.py +1172 -0
  169. package/runtime/usr/lib/python3.14/_colorize.py +355 -0
  170. package/runtime/usr/lib/python3.14/_compat_pickle.py +251 -0
  171. package/runtime/usr/lib/python3.14/_ios_support.py +74 -0
  172. package/runtime/usr/lib/python3.14/_markupbase.py +396 -0
  173. package/runtime/usr/lib/python3.14/_opcode_metadata.py +371 -0
  174. package/runtime/usr/lib/python3.14/_osx_support.py +579 -0
  175. package/runtime/usr/lib/python3.14/_py_abc.py +152 -0
  176. package/runtime/usr/lib/python3.14/_py_warnings.py +869 -0
  177. package/runtime/usr/lib/python3.14/_pydatetime.py +2734 -0
  178. package/runtime/usr/lib/python3.14/_pydecimal.py +6407 -0
  179. package/runtime/usr/lib/python3.14/_pyio.py +2764 -0
  180. package/runtime/usr/lib/python3.14/_pylong.py +729 -0
  181. package/runtime/usr/lib/python3.14/_pyrepl/__init__.py +19 -0
  182. package/runtime/usr/lib/python3.14/_pyrepl/__main__.py +10 -0
  183. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/__init__.cpython-314.pyc +0 -0
  184. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/__main__.cpython-314.pyc +0 -0
  185. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/_module_completer.cpython-314.pyc +0 -0
  186. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/_threading_handler.cpython-314.pyc +0 -0
  187. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/base_eventqueue.cpython-314.pyc +0 -0
  188. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/commands.cpython-314.pyc +0 -0
  189. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/completing_reader.cpython-314.pyc +0 -0
  190. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/console.cpython-314.pyc +0 -0
  191. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/fancy_termios.cpython-314.pyc +0 -0
  192. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/historical_reader.cpython-314.pyc +0 -0
  193. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/input.cpython-314.pyc +0 -0
  194. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/keymap.cpython-314.pyc +0 -0
  195. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/main.cpython-314.pyc +0 -0
  196. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/pager.cpython-314.pyc +0 -0
  197. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/reader.cpython-314.pyc +0 -0
  198. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/readline.cpython-314.pyc +0 -0
  199. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/simple_interact.cpython-314.pyc +0 -0
  200. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/terminfo.cpython-314.pyc +0 -0
  201. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/trace.cpython-314.pyc +0 -0
  202. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/types.cpython-314.pyc +0 -0
  203. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/unix_console.cpython-314.pyc +0 -0
  204. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/unix_eventqueue.cpython-314.pyc +0 -0
  205. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/utils.cpython-314.pyc +0 -0
  206. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/windows_console.cpython-314.pyc +0 -0
  207. package/runtime/usr/lib/python3.14/_pyrepl/__pycache__/windows_eventqueue.cpython-314.pyc +0 -0
  208. package/runtime/usr/lib/python3.14/_pyrepl/_module_completer.py +426 -0
  209. package/runtime/usr/lib/python3.14/_pyrepl/_threading_handler.py +74 -0
  210. package/runtime/usr/lib/python3.14/_pyrepl/base_eventqueue.py +110 -0
  211. package/runtime/usr/lib/python3.14/_pyrepl/commands.py +505 -0
  212. package/runtime/usr/lib/python3.14/_pyrepl/completing_reader.py +299 -0
  213. package/runtime/usr/lib/python3.14/_pyrepl/console.py +229 -0
  214. package/runtime/usr/lib/python3.14/_pyrepl/fancy_termios.py +82 -0
  215. package/runtime/usr/lib/python3.14/_pyrepl/historical_reader.py +424 -0
  216. package/runtime/usr/lib/python3.14/_pyrepl/input.py +114 -0
  217. package/runtime/usr/lib/python3.14/_pyrepl/keymap.py +213 -0
  218. package/runtime/usr/lib/python3.14/_pyrepl/main.py +58 -0
  219. package/runtime/usr/lib/python3.14/_pyrepl/mypy.ini +25 -0
  220. package/runtime/usr/lib/python3.14/_pyrepl/pager.py +175 -0
  221. package/runtime/usr/lib/python3.14/_pyrepl/reader.py +773 -0
  222. package/runtime/usr/lib/python3.14/_pyrepl/readline.py +621 -0
  223. package/runtime/usr/lib/python3.14/_pyrepl/simple_interact.py +181 -0
  224. package/runtime/usr/lib/python3.14/_pyrepl/terminfo.py +488 -0
  225. package/runtime/usr/lib/python3.14/_pyrepl/trace.py +34 -0
  226. package/runtime/usr/lib/python3.14/_pyrepl/types.py +10 -0
  227. package/runtime/usr/lib/python3.14/_pyrepl/unix_console.py +860 -0
  228. package/runtime/usr/lib/python3.14/_pyrepl/unix_eventqueue.py +77 -0
  229. package/runtime/usr/lib/python3.14/_pyrepl/utils.py +391 -0
  230. package/runtime/usr/lib/python3.14/_pyrepl/windows_console.py +735 -0
  231. package/runtime/usr/lib/python3.14/_pyrepl/windows_eventqueue.py +42 -0
  232. package/runtime/usr/lib/python3.14/_sitebuiltins.py +91 -0
  233. package/runtime/usr/lib/python3.14/_strptime.py +822 -0
  234. package/runtime/usr/lib/python3.14/_sysconfig_vars__linux_.json +1137 -0
  235. package/runtime/usr/lib/python3.14/_sysconfigdata__linux_.py +1123 -0
  236. package/runtime/usr/lib/python3.14/_threading_local.py +120 -0
  237. package/runtime/usr/lib/python3.14/_weakrefset.py +147 -0
  238. package/runtime/usr/lib/python3.14/abc.py +188 -0
  239. package/runtime/usr/lib/python3.14/annotationlib.py +1205 -0
  240. package/runtime/usr/lib/python3.14/antigravity.py +17 -0
  241. package/runtime/usr/lib/python3.14/argparse.py +2789 -0
  242. package/runtime/usr/lib/python3.14/ast.py +680 -0
  243. package/runtime/usr/lib/python3.14/asyncio/__init__.py +74 -0
  244. package/runtime/usr/lib/python3.14/asyncio/__main__.py +248 -0
  245. package/runtime/usr/lib/python3.14/asyncio/__pycache__/__init__.cpython-314.pyc +0 -0
  246. package/runtime/usr/lib/python3.14/asyncio/__pycache__/__main__.cpython-314.pyc +0 -0
  247. package/runtime/usr/lib/python3.14/asyncio/__pycache__/base_events.cpython-314.pyc +0 -0
  248. package/runtime/usr/lib/python3.14/asyncio/__pycache__/base_futures.cpython-314.pyc +0 -0
  249. package/runtime/usr/lib/python3.14/asyncio/__pycache__/base_subprocess.cpython-314.pyc +0 -0
  250. package/runtime/usr/lib/python3.14/asyncio/__pycache__/base_tasks.cpython-314.pyc +0 -0
  251. package/runtime/usr/lib/python3.14/asyncio/__pycache__/constants.cpython-314.pyc +0 -0
  252. package/runtime/usr/lib/python3.14/asyncio/__pycache__/coroutines.cpython-314.pyc +0 -0
  253. package/runtime/usr/lib/python3.14/asyncio/__pycache__/events.cpython-314.pyc +0 -0
  254. package/runtime/usr/lib/python3.14/asyncio/__pycache__/exceptions.cpython-314.pyc +0 -0
  255. package/runtime/usr/lib/python3.14/asyncio/__pycache__/format_helpers.cpython-314.pyc +0 -0
  256. package/runtime/usr/lib/python3.14/asyncio/__pycache__/futures.cpython-314.pyc +0 -0
  257. package/runtime/usr/lib/python3.14/asyncio/__pycache__/graph.cpython-314.pyc +0 -0
  258. package/runtime/usr/lib/python3.14/asyncio/__pycache__/locks.cpython-314.pyc +0 -0
  259. package/runtime/usr/lib/python3.14/asyncio/__pycache__/log.cpython-314.pyc +0 -0
  260. package/runtime/usr/lib/python3.14/asyncio/__pycache__/mixins.cpython-314.pyc +0 -0
  261. package/runtime/usr/lib/python3.14/asyncio/__pycache__/proactor_events.cpython-314.pyc +0 -0
  262. package/runtime/usr/lib/python3.14/asyncio/__pycache__/protocols.cpython-314.pyc +0 -0
  263. package/runtime/usr/lib/python3.14/asyncio/__pycache__/queues.cpython-314.pyc +0 -0
  264. package/runtime/usr/lib/python3.14/asyncio/__pycache__/runners.cpython-314.pyc +0 -0
  265. package/runtime/usr/lib/python3.14/asyncio/__pycache__/selector_events.cpython-314.pyc +0 -0
  266. package/runtime/usr/lib/python3.14/asyncio/__pycache__/sslproto.cpython-314.pyc +0 -0
  267. package/runtime/usr/lib/python3.14/asyncio/__pycache__/staggered.cpython-314.pyc +0 -0
  268. package/runtime/usr/lib/python3.14/asyncio/__pycache__/streams.cpython-314.pyc +0 -0
  269. package/runtime/usr/lib/python3.14/asyncio/__pycache__/subprocess.cpython-314.pyc +0 -0
  270. package/runtime/usr/lib/python3.14/asyncio/__pycache__/taskgroups.cpython-314.pyc +0 -0
  271. package/runtime/usr/lib/python3.14/asyncio/__pycache__/tasks.cpython-314.pyc +0 -0
  272. package/runtime/usr/lib/python3.14/asyncio/__pycache__/threads.cpython-314.pyc +0 -0
  273. package/runtime/usr/lib/python3.14/asyncio/__pycache__/timeouts.cpython-314.pyc +0 -0
  274. package/runtime/usr/lib/python3.14/asyncio/__pycache__/tools.cpython-314.pyc +0 -0
  275. package/runtime/usr/lib/python3.14/asyncio/__pycache__/transports.cpython-314.pyc +0 -0
  276. package/runtime/usr/lib/python3.14/asyncio/__pycache__/trsock.cpython-314.pyc +0 -0
  277. package/runtime/usr/lib/python3.14/asyncio/__pycache__/unix_events.cpython-314.pyc +0 -0
  278. package/runtime/usr/lib/python3.14/asyncio/__pycache__/windows_events.cpython-314.pyc +0 -0
  279. package/runtime/usr/lib/python3.14/asyncio/__pycache__/windows_utils.cpython-314.pyc +0 -0
  280. package/runtime/usr/lib/python3.14/asyncio/base_events.py +2089 -0
  281. package/runtime/usr/lib/python3.14/asyncio/base_futures.py +67 -0
  282. package/runtime/usr/lib/python3.14/asyncio/base_subprocess.py +327 -0
  283. package/runtime/usr/lib/python3.14/asyncio/base_tasks.py +94 -0
  284. package/runtime/usr/lib/python3.14/asyncio/constants.py +41 -0
  285. package/runtime/usr/lib/python3.14/asyncio/coroutines.py +118 -0
  286. package/runtime/usr/lib/python3.14/asyncio/events.py +881 -0
  287. package/runtime/usr/lib/python3.14/asyncio/exceptions.py +62 -0
  288. package/runtime/usr/lib/python3.14/asyncio/format_helpers.py +84 -0
  289. package/runtime/usr/lib/python3.14/asyncio/futures.py +481 -0
  290. package/runtime/usr/lib/python3.14/asyncio/graph.py +279 -0
  291. package/runtime/usr/lib/python3.14/asyncio/locks.py +617 -0
  292. package/runtime/usr/lib/python3.14/asyncio/log.py +7 -0
  293. package/runtime/usr/lib/python3.14/asyncio/mixins.py +21 -0
  294. package/runtime/usr/lib/python3.14/asyncio/proactor_events.py +923 -0
  295. package/runtime/usr/lib/python3.14/asyncio/protocols.py +216 -0
  296. package/runtime/usr/lib/python3.14/asyncio/queues.py +309 -0
  297. package/runtime/usr/lib/python3.14/asyncio/runners.py +226 -0
  298. package/runtime/usr/lib/python3.14/asyncio/selector_events.py +1337 -0
  299. package/runtime/usr/lib/python3.14/asyncio/sslproto.py +929 -0
  300. package/runtime/usr/lib/python3.14/asyncio/staggered.py +179 -0
  301. package/runtime/usr/lib/python3.14/asyncio/streams.py +804 -0
  302. package/runtime/usr/lib/python3.14/asyncio/subprocess.py +229 -0
  303. package/runtime/usr/lib/python3.14/asyncio/taskgroups.py +280 -0
  304. package/runtime/usr/lib/python3.14/asyncio/tasks.py +1145 -0
  305. package/runtime/usr/lib/python3.14/asyncio/threads.py +26 -0
  306. package/runtime/usr/lib/python3.14/asyncio/timeouts.py +183 -0
  307. package/runtime/usr/lib/python3.14/asyncio/tools.py +278 -0
  308. package/runtime/usr/lib/python3.14/asyncio/transports.py +337 -0
  309. package/runtime/usr/lib/python3.14/asyncio/trsock.py +98 -0
  310. package/runtime/usr/lib/python3.14/asyncio/unix_events.py +1023 -0
  311. package/runtime/usr/lib/python3.14/asyncio/windows_events.py +906 -0
  312. package/runtime/usr/lib/python3.14/asyncio/windows_utils.py +181 -0
  313. package/runtime/usr/lib/python3.14/base64.py +625 -0
  314. package/runtime/usr/lib/python3.14/bdb.py +1214 -0
  315. package/runtime/usr/lib/python3.14/bisect.py +118 -0
  316. package/runtime/usr/lib/python3.14/build-details.json +53 -0
  317. package/runtime/usr/lib/python3.14/bz2.py +352 -0
  318. package/runtime/usr/lib/python3.14/cProfile.py +207 -0
  319. package/runtime/usr/lib/python3.14/calendar.py +926 -0
  320. package/runtime/usr/lib/python3.14/cmd.py +414 -0
  321. package/runtime/usr/lib/python3.14/code.py +396 -0
  322. package/runtime/usr/lib/python3.14/codecs.py +1125 -0
  323. package/runtime/usr/lib/python3.14/codeop.py +154 -0
  324. package/runtime/usr/lib/python3.14/collections/__init__.py +1612 -0
  325. package/runtime/usr/lib/python3.14/collections/__pycache__/__init__.cpython-314.pyc +0 -0
  326. package/runtime/usr/lib/python3.14/colorsys.py +166 -0
  327. package/runtime/usr/lib/python3.14/compileall.py +472 -0
  328. package/runtime/usr/lib/python3.14/compression/__init__.py +0 -0
  329. package/runtime/usr/lib/python3.14/compression/__pycache__/__init__.cpython-314.pyc +0 -0
  330. package/runtime/usr/lib/python3.14/compression/__pycache__/bz2.cpython-314.pyc +0 -0
  331. package/runtime/usr/lib/python3.14/compression/__pycache__/gzip.cpython-314.pyc +0 -0
  332. package/runtime/usr/lib/python3.14/compression/__pycache__/lzma.cpython-314.pyc +0 -0
  333. package/runtime/usr/lib/python3.14/compression/__pycache__/zlib.cpython-314.pyc +0 -0
  334. package/runtime/usr/lib/python3.14/compression/_common/__init__.py +0 -0
  335. package/runtime/usr/lib/python3.14/compression/_common/__pycache__/__init__.cpython-314.pyc +0 -0
  336. package/runtime/usr/lib/python3.14/compression/_common/__pycache__/_streams.cpython-314.pyc +0 -0
  337. package/runtime/usr/lib/python3.14/compression/_common/_streams.py +162 -0
  338. package/runtime/usr/lib/python3.14/compression/bz2.py +5 -0
  339. package/runtime/usr/lib/python3.14/compression/gzip.py +5 -0
  340. package/runtime/usr/lib/python3.14/compression/lzma.py +5 -0
  341. package/runtime/usr/lib/python3.14/compression/zlib.py +5 -0
  342. package/runtime/usr/lib/python3.14/compression/zstd/__init__.py +244 -0
  343. package/runtime/usr/lib/python3.14/compression/zstd/__pycache__/__init__.cpython-314.pyc +0 -0
  344. package/runtime/usr/lib/python3.14/compression/zstd/__pycache__/_zstdfile.cpython-314.pyc +0 -0
  345. package/runtime/usr/lib/python3.14/compression/zstd/_zstdfile.py +347 -0
  346. package/runtime/usr/lib/python3.14/concurrent/__init__.py +1 -0
  347. package/runtime/usr/lib/python3.14/concurrent/__pycache__/__init__.cpython-314.pyc +0 -0
  348. package/runtime/usr/lib/python3.14/concurrent/futures/__init__.py +65 -0
  349. package/runtime/usr/lib/python3.14/concurrent/futures/__pycache__/__init__.cpython-314.pyc +0 -0
  350. package/runtime/usr/lib/python3.14/concurrent/futures/__pycache__/_base.cpython-314.pyc +0 -0
  351. package/runtime/usr/lib/python3.14/concurrent/futures/__pycache__/interpreter.cpython-314.pyc +0 -0
  352. package/runtime/usr/lib/python3.14/concurrent/futures/__pycache__/process.cpython-314.pyc +0 -0
  353. package/runtime/usr/lib/python3.14/concurrent/futures/__pycache__/thread.cpython-314.pyc +0 -0
  354. package/runtime/usr/lib/python3.14/concurrent/futures/_base.py +680 -0
  355. package/runtime/usr/lib/python3.14/concurrent/futures/interpreter.py +123 -0
  356. package/runtime/usr/lib/python3.14/concurrent/futures/process.py +1047 -0
  357. package/runtime/usr/lib/python3.14/concurrent/futures/thread.py +274 -0
  358. package/runtime/usr/lib/python3.14/concurrent/interpreters/__init__.py +253 -0
  359. package/runtime/usr/lib/python3.14/concurrent/interpreters/__pycache__/__init__.cpython-314.pyc +0 -0
  360. package/runtime/usr/lib/python3.14/concurrent/interpreters/__pycache__/_crossinterp.cpython-314.pyc +0 -0
  361. package/runtime/usr/lib/python3.14/concurrent/interpreters/__pycache__/_queues.cpython-314.pyc +0 -0
  362. package/runtime/usr/lib/python3.14/concurrent/interpreters/_crossinterp.py +107 -0
  363. package/runtime/usr/lib/python3.14/concurrent/interpreters/_queues.py +290 -0
  364. package/runtime/usr/lib/python3.14/configparser.py +1426 -0
  365. package/runtime/usr/lib/python3.14/contextlib.py +814 -0
  366. package/runtime/usr/lib/python3.14/contextvars.py +8 -0
  367. package/runtime/usr/lib/python3.14/copy.py +286 -0
  368. package/runtime/usr/lib/python3.14/copyreg.py +222 -0
  369. package/runtime/usr/lib/python3.14/csv.py +527 -0
  370. package/runtime/usr/lib/python3.14/ctypes/__init__.py +686 -0
  371. package/runtime/usr/lib/python3.14/ctypes/__pycache__/__init__.cpython-314.pyc +0 -0
  372. package/runtime/usr/lib/python3.14/ctypes/__pycache__/_aix.cpython-314.pyc +0 -0
  373. package/runtime/usr/lib/python3.14/ctypes/__pycache__/_endian.cpython-314.pyc +0 -0
  374. package/runtime/usr/lib/python3.14/ctypes/__pycache__/_layout.cpython-314.pyc +0 -0
  375. package/runtime/usr/lib/python3.14/ctypes/__pycache__/util.cpython-314.pyc +0 -0
  376. package/runtime/usr/lib/python3.14/ctypes/__pycache__/wintypes.cpython-314.pyc +0 -0
  377. package/runtime/usr/lib/python3.14/ctypes/_aix.py +327 -0
  378. package/runtime/usr/lib/python3.14/ctypes/_endian.py +78 -0
  379. package/runtime/usr/lib/python3.14/ctypes/_layout.py +330 -0
  380. package/runtime/usr/lib/python3.14/ctypes/macholib/README.ctypes +7 -0
  381. package/runtime/usr/lib/python3.14/ctypes/macholib/__init__.py +9 -0
  382. package/runtime/usr/lib/python3.14/ctypes/macholib/__pycache__/__init__.cpython-314.pyc +0 -0
  383. package/runtime/usr/lib/python3.14/ctypes/macholib/__pycache__/dyld.cpython-314.pyc +0 -0
  384. package/runtime/usr/lib/python3.14/ctypes/macholib/__pycache__/dylib.cpython-314.pyc +0 -0
  385. package/runtime/usr/lib/python3.14/ctypes/macholib/__pycache__/framework.cpython-314.pyc +0 -0
  386. package/runtime/usr/lib/python3.14/ctypes/macholib/dyld.py +165 -0
  387. package/runtime/usr/lib/python3.14/ctypes/macholib/dylib.py +42 -0
  388. package/runtime/usr/lib/python3.14/ctypes/macholib/fetch_macholib +2 -0
  389. package/runtime/usr/lib/python3.14/ctypes/macholib/fetch_macholib.bat +1 -0
  390. package/runtime/usr/lib/python3.14/ctypes/macholib/framework.py +42 -0
  391. package/runtime/usr/lib/python3.14/ctypes/util.py +502 -0
  392. package/runtime/usr/lib/python3.14/ctypes/wintypes.py +210 -0
  393. package/runtime/usr/lib/python3.14/curses/__init__.py +101 -0
  394. package/runtime/usr/lib/python3.14/curses/__pycache__/__init__.cpython-314.pyc +0 -0
  395. package/runtime/usr/lib/python3.14/curses/__pycache__/ascii.cpython-314.pyc +0 -0
  396. package/runtime/usr/lib/python3.14/curses/__pycache__/has_key.cpython-314.pyc +0 -0
  397. package/runtime/usr/lib/python3.14/curses/__pycache__/panel.cpython-314.pyc +0 -0
  398. package/runtime/usr/lib/python3.14/curses/__pycache__/textpad.cpython-314.pyc +0 -0
  399. package/runtime/usr/lib/python3.14/curses/ascii.py +99 -0
  400. package/runtime/usr/lib/python3.14/curses/has_key.py +192 -0
  401. package/runtime/usr/lib/python3.14/curses/panel.py +6 -0
  402. package/runtime/usr/lib/python3.14/curses/textpad.py +236 -0
  403. package/runtime/usr/lib/python3.14/dataclasses.py +1813 -0
  404. package/runtime/usr/lib/python3.14/datetime.py +13 -0
  405. package/runtime/usr/lib/python3.14/dbm/__init__.py +194 -0
  406. package/runtime/usr/lib/python3.14/dbm/__pycache__/__init__.cpython-314.pyc +0 -0
  407. package/runtime/usr/lib/python3.14/dbm/__pycache__/dumb.cpython-314.pyc +0 -0
  408. package/runtime/usr/lib/python3.14/dbm/__pycache__/gnu.cpython-314.pyc +0 -0
  409. package/runtime/usr/lib/python3.14/dbm/__pycache__/ndbm.cpython-314.pyc +0 -0
  410. package/runtime/usr/lib/python3.14/dbm/__pycache__/sqlite3.cpython-314.pyc +0 -0
  411. package/runtime/usr/lib/python3.14/dbm/dumb.py +319 -0
  412. package/runtime/usr/lib/python3.14/dbm/gnu.py +3 -0
  413. package/runtime/usr/lib/python3.14/dbm/ndbm.py +3 -0
  414. package/runtime/usr/lib/python3.14/dbm/sqlite3.py +144 -0
  415. package/runtime/usr/lib/python3.14/decimal.py +109 -0
  416. package/runtime/usr/lib/python3.14/difflib.py +2066 -0
  417. package/runtime/usr/lib/python3.14/dis.py +1157 -0
  418. package/runtime/usr/lib/python3.14/doctest.py +2922 -0
  419. package/runtime/usr/lib/python3.14/email/__init__.py +61 -0
  420. package/runtime/usr/lib/python3.14/email/__pycache__/__init__.cpython-314.pyc +0 -0
  421. package/runtime/usr/lib/python3.14/email/__pycache__/_encoded_words.cpython-314.pyc +0 -0
  422. package/runtime/usr/lib/python3.14/email/__pycache__/_header_value_parser.cpython-314.pyc +0 -0
  423. package/runtime/usr/lib/python3.14/email/__pycache__/_parseaddr.cpython-314.pyc +0 -0
  424. package/runtime/usr/lib/python3.14/email/__pycache__/_policybase.cpython-314.pyc +0 -0
  425. package/runtime/usr/lib/python3.14/email/__pycache__/base64mime.cpython-314.pyc +0 -0
  426. package/runtime/usr/lib/python3.14/email/__pycache__/charset.cpython-314.pyc +0 -0
  427. package/runtime/usr/lib/python3.14/email/__pycache__/contentmanager.cpython-314.pyc +0 -0
  428. package/runtime/usr/lib/python3.14/email/__pycache__/encoders.cpython-314.pyc +0 -0
  429. package/runtime/usr/lib/python3.14/email/__pycache__/errors.cpython-314.pyc +0 -0
  430. package/runtime/usr/lib/python3.14/email/__pycache__/feedparser.cpython-314.pyc +0 -0
  431. package/runtime/usr/lib/python3.14/email/__pycache__/generator.cpython-314.pyc +0 -0
  432. package/runtime/usr/lib/python3.14/email/__pycache__/header.cpython-314.pyc +0 -0
  433. package/runtime/usr/lib/python3.14/email/__pycache__/headerregistry.cpython-314.pyc +0 -0
  434. package/runtime/usr/lib/python3.14/email/__pycache__/iterators.cpython-314.pyc +0 -0
  435. package/runtime/usr/lib/python3.14/email/__pycache__/message.cpython-314.pyc +0 -0
  436. package/runtime/usr/lib/python3.14/email/__pycache__/parser.cpython-314.pyc +0 -0
  437. package/runtime/usr/lib/python3.14/email/__pycache__/policy.cpython-314.pyc +0 -0
  438. package/runtime/usr/lib/python3.14/email/__pycache__/quoprimime.cpython-314.pyc +0 -0
  439. package/runtime/usr/lib/python3.14/email/__pycache__/utils.cpython-314.pyc +0 -0
  440. package/runtime/usr/lib/python3.14/email/_encoded_words.py +233 -0
  441. package/runtime/usr/lib/python3.14/email/_header_value_parser.py +3164 -0
  442. package/runtime/usr/lib/python3.14/email/_parseaddr.py +563 -0
  443. package/runtime/usr/lib/python3.14/email/_policybase.py +392 -0
  444. package/runtime/usr/lib/python3.14/email/architecture.rst +216 -0
  445. package/runtime/usr/lib/python3.14/email/base64mime.py +115 -0
  446. package/runtime/usr/lib/python3.14/email/charset.py +396 -0
  447. package/runtime/usr/lib/python3.14/email/contentmanager.py +254 -0
  448. package/runtime/usr/lib/python3.14/email/encoders.py +65 -0
  449. package/runtime/usr/lib/python3.14/email/errors.py +117 -0
  450. package/runtime/usr/lib/python3.14/email/feedparser.py +536 -0
  451. package/runtime/usr/lib/python3.14/email/generator.py +530 -0
  452. package/runtime/usr/lib/python3.14/email/header.py +582 -0
  453. package/runtime/usr/lib/python3.14/email/headerregistry.py +618 -0
  454. package/runtime/usr/lib/python3.14/email/iterators.py +68 -0
  455. package/runtime/usr/lib/python3.14/email/message.py +1217 -0
  456. package/runtime/usr/lib/python3.14/email/mime/__init__.py +0 -0
  457. package/runtime/usr/lib/python3.14/email/mime/__pycache__/__init__.cpython-314.pyc +0 -0
  458. package/runtime/usr/lib/python3.14/email/mime/__pycache__/application.cpython-314.pyc +0 -0
  459. package/runtime/usr/lib/python3.14/email/mime/__pycache__/audio.cpython-314.pyc +0 -0
  460. package/runtime/usr/lib/python3.14/email/mime/__pycache__/base.cpython-314.pyc +0 -0
  461. package/runtime/usr/lib/python3.14/email/mime/__pycache__/image.cpython-314.pyc +0 -0
  462. package/runtime/usr/lib/python3.14/email/mime/__pycache__/message.cpython-314.pyc +0 -0
  463. package/runtime/usr/lib/python3.14/email/mime/__pycache__/multipart.cpython-314.pyc +0 -0
  464. package/runtime/usr/lib/python3.14/email/mime/__pycache__/nonmultipart.cpython-314.pyc +0 -0
  465. package/runtime/usr/lib/python3.14/email/mime/__pycache__/text.cpython-314.pyc +0 -0
  466. package/runtime/usr/lib/python3.14/email/mime/application.py +37 -0
  467. package/runtime/usr/lib/python3.14/email/mime/audio.py +97 -0
  468. package/runtime/usr/lib/python3.14/email/mime/base.py +29 -0
  469. package/runtime/usr/lib/python3.14/email/mime/image.py +152 -0
  470. package/runtime/usr/lib/python3.14/email/mime/message.py +33 -0
  471. package/runtime/usr/lib/python3.14/email/mime/multipart.py +47 -0
  472. package/runtime/usr/lib/python3.14/email/mime/nonmultipart.py +21 -0
  473. package/runtime/usr/lib/python3.14/email/mime/text.py +40 -0
  474. package/runtime/usr/lib/python3.14/email/parser.py +127 -0
  475. package/runtime/usr/lib/python3.14/email/policy.py +239 -0
  476. package/runtime/usr/lib/python3.14/email/quoprimime.py +300 -0
  477. package/runtime/usr/lib/python3.14/email/utils.py +489 -0
  478. package/runtime/usr/lib/python3.14/encodings/__init__.py +182 -0
  479. package/runtime/usr/lib/python3.14/encodings/__pycache__/__init__.cpython-314.pyc +0 -0
  480. package/runtime/usr/lib/python3.14/encodings/__pycache__/_win_cp_codecs.cpython-314.pyc +0 -0
  481. package/runtime/usr/lib/python3.14/encodings/__pycache__/aliases.cpython-314.pyc +0 -0
  482. package/runtime/usr/lib/python3.14/encodings/__pycache__/ascii.cpython-314.pyc +0 -0
  483. package/runtime/usr/lib/python3.14/encodings/__pycache__/base64_codec.cpython-314.pyc +0 -0
  484. package/runtime/usr/lib/python3.14/encodings/__pycache__/big5.cpython-314.pyc +0 -0
  485. package/runtime/usr/lib/python3.14/encodings/__pycache__/big5hkscs.cpython-314.pyc +0 -0
  486. package/runtime/usr/lib/python3.14/encodings/__pycache__/bz2_codec.cpython-314.pyc +0 -0
  487. package/runtime/usr/lib/python3.14/encodings/__pycache__/charmap.cpython-314.pyc +0 -0
  488. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp037.cpython-314.pyc +0 -0
  489. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp1006.cpython-314.pyc +0 -0
  490. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp1026.cpython-314.pyc +0 -0
  491. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp1125.cpython-314.pyc +0 -0
  492. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp1140.cpython-314.pyc +0 -0
  493. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp1250.cpython-314.pyc +0 -0
  494. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp1251.cpython-314.pyc +0 -0
  495. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp1252.cpython-314.pyc +0 -0
  496. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp1253.cpython-314.pyc +0 -0
  497. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp1254.cpython-314.pyc +0 -0
  498. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp1255.cpython-314.pyc +0 -0
  499. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp1256.cpython-314.pyc +0 -0
  500. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp1257.cpython-314.pyc +0 -0
  501. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp1258.cpython-314.pyc +0 -0
  502. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp273.cpython-314.pyc +0 -0
  503. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp424.cpython-314.pyc +0 -0
  504. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp437.cpython-314.pyc +0 -0
  505. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp500.cpython-314.pyc +0 -0
  506. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp720.cpython-314.pyc +0 -0
  507. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp737.cpython-314.pyc +0 -0
  508. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp775.cpython-314.pyc +0 -0
  509. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp850.cpython-314.pyc +0 -0
  510. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp852.cpython-314.pyc +0 -0
  511. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp855.cpython-314.pyc +0 -0
  512. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp856.cpython-314.pyc +0 -0
  513. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp857.cpython-314.pyc +0 -0
  514. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp858.cpython-314.pyc +0 -0
  515. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp860.cpython-314.pyc +0 -0
  516. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp861.cpython-314.pyc +0 -0
  517. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp862.cpython-314.pyc +0 -0
  518. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp863.cpython-314.pyc +0 -0
  519. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp864.cpython-314.pyc +0 -0
  520. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp865.cpython-314.pyc +0 -0
  521. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp866.cpython-314.pyc +0 -0
  522. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp869.cpython-314.pyc +0 -0
  523. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp874.cpython-314.pyc +0 -0
  524. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp875.cpython-314.pyc +0 -0
  525. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp932.cpython-314.pyc +0 -0
  526. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp949.cpython-314.pyc +0 -0
  527. package/runtime/usr/lib/python3.14/encodings/__pycache__/cp950.cpython-314.pyc +0 -0
  528. package/runtime/usr/lib/python3.14/encodings/__pycache__/euc_jis_2004.cpython-314.pyc +0 -0
  529. package/runtime/usr/lib/python3.14/encodings/__pycache__/euc_jisx0213.cpython-314.pyc +0 -0
  530. package/runtime/usr/lib/python3.14/encodings/__pycache__/euc_jp.cpython-314.pyc +0 -0
  531. package/runtime/usr/lib/python3.14/encodings/__pycache__/euc_kr.cpython-314.pyc +0 -0
  532. package/runtime/usr/lib/python3.14/encodings/__pycache__/gb18030.cpython-314.pyc +0 -0
  533. package/runtime/usr/lib/python3.14/encodings/__pycache__/gb2312.cpython-314.pyc +0 -0
  534. package/runtime/usr/lib/python3.14/encodings/__pycache__/gbk.cpython-314.pyc +0 -0
  535. package/runtime/usr/lib/python3.14/encodings/__pycache__/hex_codec.cpython-314.pyc +0 -0
  536. package/runtime/usr/lib/python3.14/encodings/__pycache__/hp_roman8.cpython-314.pyc +0 -0
  537. package/runtime/usr/lib/python3.14/encodings/__pycache__/hz.cpython-314.pyc +0 -0
  538. package/runtime/usr/lib/python3.14/encodings/__pycache__/idna.cpython-314.pyc +0 -0
  539. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso2022_jp.cpython-314.pyc +0 -0
  540. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso2022_jp_1.cpython-314.pyc +0 -0
  541. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso2022_jp_2.cpython-314.pyc +0 -0
  542. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso2022_jp_2004.cpython-314.pyc +0 -0
  543. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso2022_jp_3.cpython-314.pyc +0 -0
  544. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso2022_jp_ext.cpython-314.pyc +0 -0
  545. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso2022_kr.cpython-314.pyc +0 -0
  546. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_1.cpython-314.pyc +0 -0
  547. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_10.cpython-314.pyc +0 -0
  548. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_11.cpython-314.pyc +0 -0
  549. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_13.cpython-314.pyc +0 -0
  550. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_14.cpython-314.pyc +0 -0
  551. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_15.cpython-314.pyc +0 -0
  552. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_16.cpython-314.pyc +0 -0
  553. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_2.cpython-314.pyc +0 -0
  554. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_3.cpython-314.pyc +0 -0
  555. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_4.cpython-314.pyc +0 -0
  556. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_5.cpython-314.pyc +0 -0
  557. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_6.cpython-314.pyc +0 -0
  558. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_7.cpython-314.pyc +0 -0
  559. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_8.cpython-314.pyc +0 -0
  560. package/runtime/usr/lib/python3.14/encodings/__pycache__/iso8859_9.cpython-314.pyc +0 -0
  561. package/runtime/usr/lib/python3.14/encodings/__pycache__/johab.cpython-314.pyc +0 -0
  562. package/runtime/usr/lib/python3.14/encodings/__pycache__/koi8_r.cpython-314.pyc +0 -0
  563. package/runtime/usr/lib/python3.14/encodings/__pycache__/koi8_t.cpython-314.pyc +0 -0
  564. package/runtime/usr/lib/python3.14/encodings/__pycache__/koi8_u.cpython-314.pyc +0 -0
  565. package/runtime/usr/lib/python3.14/encodings/__pycache__/kz1048.cpython-314.pyc +0 -0
  566. package/runtime/usr/lib/python3.14/encodings/__pycache__/latin_1.cpython-314.pyc +0 -0
  567. package/runtime/usr/lib/python3.14/encodings/__pycache__/mac_arabic.cpython-314.pyc +0 -0
  568. package/runtime/usr/lib/python3.14/encodings/__pycache__/mac_croatian.cpython-314.pyc +0 -0
  569. package/runtime/usr/lib/python3.14/encodings/__pycache__/mac_cyrillic.cpython-314.pyc +0 -0
  570. package/runtime/usr/lib/python3.14/encodings/__pycache__/mac_farsi.cpython-314.pyc +0 -0
  571. package/runtime/usr/lib/python3.14/encodings/__pycache__/mac_greek.cpython-314.pyc +0 -0
  572. package/runtime/usr/lib/python3.14/encodings/__pycache__/mac_iceland.cpython-314.pyc +0 -0
  573. package/runtime/usr/lib/python3.14/encodings/__pycache__/mac_latin2.cpython-314.pyc +0 -0
  574. package/runtime/usr/lib/python3.14/encodings/__pycache__/mac_roman.cpython-314.pyc +0 -0
  575. package/runtime/usr/lib/python3.14/encodings/__pycache__/mac_romanian.cpython-314.pyc +0 -0
  576. package/runtime/usr/lib/python3.14/encodings/__pycache__/mac_turkish.cpython-314.pyc +0 -0
  577. package/runtime/usr/lib/python3.14/encodings/__pycache__/mbcs.cpython-314.pyc +0 -0
  578. package/runtime/usr/lib/python3.14/encodings/__pycache__/oem.cpython-314.pyc +0 -0
  579. package/runtime/usr/lib/python3.14/encodings/__pycache__/palmos.cpython-314.pyc +0 -0
  580. package/runtime/usr/lib/python3.14/encodings/__pycache__/ptcp154.cpython-314.pyc +0 -0
  581. package/runtime/usr/lib/python3.14/encodings/__pycache__/punycode.cpython-314.pyc +0 -0
  582. package/runtime/usr/lib/python3.14/encodings/__pycache__/quopri_codec.cpython-314.pyc +0 -0
  583. package/runtime/usr/lib/python3.14/encodings/__pycache__/raw_unicode_escape.cpython-314.pyc +0 -0
  584. package/runtime/usr/lib/python3.14/encodings/__pycache__/rot_13.cpython-314.pyc +0 -0
  585. package/runtime/usr/lib/python3.14/encodings/__pycache__/shift_jis.cpython-314.pyc +0 -0
  586. package/runtime/usr/lib/python3.14/encodings/__pycache__/shift_jis_2004.cpython-314.pyc +0 -0
  587. package/runtime/usr/lib/python3.14/encodings/__pycache__/shift_jisx0213.cpython-314.pyc +0 -0
  588. package/runtime/usr/lib/python3.14/encodings/__pycache__/tis_620.cpython-314.pyc +0 -0
  589. package/runtime/usr/lib/python3.14/encodings/__pycache__/undefined.cpython-314.pyc +0 -0
  590. package/runtime/usr/lib/python3.14/encodings/__pycache__/unicode_escape.cpython-314.pyc +0 -0
  591. package/runtime/usr/lib/python3.14/encodings/__pycache__/utf_16.cpython-314.pyc +0 -0
  592. package/runtime/usr/lib/python3.14/encodings/__pycache__/utf_16_be.cpython-314.pyc +0 -0
  593. package/runtime/usr/lib/python3.14/encodings/__pycache__/utf_16_le.cpython-314.pyc +0 -0
  594. package/runtime/usr/lib/python3.14/encodings/__pycache__/utf_32.cpython-314.pyc +0 -0
  595. package/runtime/usr/lib/python3.14/encodings/__pycache__/utf_32_be.cpython-314.pyc +0 -0
  596. package/runtime/usr/lib/python3.14/encodings/__pycache__/utf_32_le.cpython-314.pyc +0 -0
  597. package/runtime/usr/lib/python3.14/encodings/__pycache__/utf_7.cpython-314.pyc +0 -0
  598. package/runtime/usr/lib/python3.14/encodings/__pycache__/utf_8.cpython-314.pyc +0 -0
  599. package/runtime/usr/lib/python3.14/encodings/__pycache__/utf_8_sig.cpython-314.pyc +0 -0
  600. package/runtime/usr/lib/python3.14/encodings/__pycache__/uu_codec.cpython-314.pyc +0 -0
  601. package/runtime/usr/lib/python3.14/encodings/__pycache__/zlib_codec.cpython-314.pyc +0 -0
  602. package/runtime/usr/lib/python3.14/encodings/_win_cp_codecs.py +36 -0
  603. package/runtime/usr/lib/python3.14/encodings/aliases.py +568 -0
  604. package/runtime/usr/lib/python3.14/encodings/ascii.py +50 -0
  605. package/runtime/usr/lib/python3.14/encodings/base64_codec.py +55 -0
  606. package/runtime/usr/lib/python3.14/encodings/big5.py +39 -0
  607. package/runtime/usr/lib/python3.14/encodings/big5hkscs.py +39 -0
  608. package/runtime/usr/lib/python3.14/encodings/bz2_codec.py +78 -0
  609. package/runtime/usr/lib/python3.14/encodings/charmap.py +69 -0
  610. package/runtime/usr/lib/python3.14/encodings/cp037.py +307 -0
  611. package/runtime/usr/lib/python3.14/encodings/cp1006.py +307 -0
  612. package/runtime/usr/lib/python3.14/encodings/cp1026.py +307 -0
  613. package/runtime/usr/lib/python3.14/encodings/cp1125.py +698 -0
  614. package/runtime/usr/lib/python3.14/encodings/cp1140.py +307 -0
  615. package/runtime/usr/lib/python3.14/encodings/cp1250.py +307 -0
  616. package/runtime/usr/lib/python3.14/encodings/cp1251.py +307 -0
  617. package/runtime/usr/lib/python3.14/encodings/cp1252.py +307 -0
  618. package/runtime/usr/lib/python3.14/encodings/cp1253.py +307 -0
  619. package/runtime/usr/lib/python3.14/encodings/cp1254.py +307 -0
  620. package/runtime/usr/lib/python3.14/encodings/cp1255.py +307 -0
  621. package/runtime/usr/lib/python3.14/encodings/cp1256.py +307 -0
  622. package/runtime/usr/lib/python3.14/encodings/cp1257.py +307 -0
  623. package/runtime/usr/lib/python3.14/encodings/cp1258.py +307 -0
  624. package/runtime/usr/lib/python3.14/encodings/cp273.py +307 -0
  625. package/runtime/usr/lib/python3.14/encodings/cp424.py +307 -0
  626. package/runtime/usr/lib/python3.14/encodings/cp437.py +698 -0
  627. package/runtime/usr/lib/python3.14/encodings/cp500.py +307 -0
  628. package/runtime/usr/lib/python3.14/encodings/cp720.py +309 -0
  629. package/runtime/usr/lib/python3.14/encodings/cp737.py +698 -0
  630. package/runtime/usr/lib/python3.14/encodings/cp775.py +697 -0
  631. package/runtime/usr/lib/python3.14/encodings/cp850.py +698 -0
  632. package/runtime/usr/lib/python3.14/encodings/cp852.py +698 -0
  633. package/runtime/usr/lib/python3.14/encodings/cp855.py +698 -0
  634. package/runtime/usr/lib/python3.14/encodings/cp856.py +307 -0
  635. package/runtime/usr/lib/python3.14/encodings/cp857.py +694 -0
  636. package/runtime/usr/lib/python3.14/encodings/cp858.py +698 -0
  637. package/runtime/usr/lib/python3.14/encodings/cp860.py +698 -0
  638. package/runtime/usr/lib/python3.14/encodings/cp861.py +698 -0
  639. package/runtime/usr/lib/python3.14/encodings/cp862.py +698 -0
  640. package/runtime/usr/lib/python3.14/encodings/cp863.py +698 -0
  641. package/runtime/usr/lib/python3.14/encodings/cp864.py +690 -0
  642. package/runtime/usr/lib/python3.14/encodings/cp865.py +698 -0
  643. package/runtime/usr/lib/python3.14/encodings/cp866.py +698 -0
  644. package/runtime/usr/lib/python3.14/encodings/cp869.py +689 -0
  645. package/runtime/usr/lib/python3.14/encodings/cp874.py +307 -0
  646. package/runtime/usr/lib/python3.14/encodings/cp875.py +307 -0
  647. package/runtime/usr/lib/python3.14/encodings/cp932.py +39 -0
  648. package/runtime/usr/lib/python3.14/encodings/cp949.py +39 -0
  649. package/runtime/usr/lib/python3.14/encodings/cp950.py +39 -0
  650. package/runtime/usr/lib/python3.14/encodings/euc_jis_2004.py +39 -0
  651. package/runtime/usr/lib/python3.14/encodings/euc_jisx0213.py +39 -0
  652. package/runtime/usr/lib/python3.14/encodings/euc_jp.py +39 -0
  653. package/runtime/usr/lib/python3.14/encodings/euc_kr.py +39 -0
  654. package/runtime/usr/lib/python3.14/encodings/gb18030.py +39 -0
  655. package/runtime/usr/lib/python3.14/encodings/gb2312.py +39 -0
  656. package/runtime/usr/lib/python3.14/encodings/gbk.py +39 -0
  657. package/runtime/usr/lib/python3.14/encodings/hex_codec.py +55 -0
  658. package/runtime/usr/lib/python3.14/encodings/hp_roman8.py +314 -0
  659. package/runtime/usr/lib/python3.14/encodings/hz.py +39 -0
  660. package/runtime/usr/lib/python3.14/encodings/idna.py +387 -0
  661. package/runtime/usr/lib/python3.14/encodings/iso2022_jp.py +39 -0
  662. package/runtime/usr/lib/python3.14/encodings/iso2022_jp_1.py +39 -0
  663. package/runtime/usr/lib/python3.14/encodings/iso2022_jp_2.py +39 -0
  664. package/runtime/usr/lib/python3.14/encodings/iso2022_jp_2004.py +39 -0
  665. package/runtime/usr/lib/python3.14/encodings/iso2022_jp_3.py +39 -0
  666. package/runtime/usr/lib/python3.14/encodings/iso2022_jp_ext.py +39 -0
  667. package/runtime/usr/lib/python3.14/encodings/iso2022_kr.py +39 -0
  668. package/runtime/usr/lib/python3.14/encodings/iso8859_1.py +307 -0
  669. package/runtime/usr/lib/python3.14/encodings/iso8859_10.py +307 -0
  670. package/runtime/usr/lib/python3.14/encodings/iso8859_11.py +307 -0
  671. package/runtime/usr/lib/python3.14/encodings/iso8859_13.py +307 -0
  672. package/runtime/usr/lib/python3.14/encodings/iso8859_14.py +307 -0
  673. package/runtime/usr/lib/python3.14/encodings/iso8859_15.py +307 -0
  674. package/runtime/usr/lib/python3.14/encodings/iso8859_16.py +307 -0
  675. package/runtime/usr/lib/python3.14/encodings/iso8859_2.py +307 -0
  676. package/runtime/usr/lib/python3.14/encodings/iso8859_3.py +307 -0
  677. package/runtime/usr/lib/python3.14/encodings/iso8859_4.py +307 -0
  678. package/runtime/usr/lib/python3.14/encodings/iso8859_5.py +307 -0
  679. package/runtime/usr/lib/python3.14/encodings/iso8859_6.py +307 -0
  680. package/runtime/usr/lib/python3.14/encodings/iso8859_7.py +307 -0
  681. package/runtime/usr/lib/python3.14/encodings/iso8859_8.py +307 -0
  682. package/runtime/usr/lib/python3.14/encodings/iso8859_9.py +307 -0
  683. package/runtime/usr/lib/python3.14/encodings/johab.py +39 -0
  684. package/runtime/usr/lib/python3.14/encodings/koi8_r.py +307 -0
  685. package/runtime/usr/lib/python3.14/encodings/koi8_t.py +308 -0
  686. package/runtime/usr/lib/python3.14/encodings/koi8_u.py +307 -0
  687. package/runtime/usr/lib/python3.14/encodings/kz1048.py +307 -0
  688. package/runtime/usr/lib/python3.14/encodings/latin_1.py +50 -0
  689. package/runtime/usr/lib/python3.14/encodings/mac_arabic.py +698 -0
  690. package/runtime/usr/lib/python3.14/encodings/mac_croatian.py +307 -0
  691. package/runtime/usr/lib/python3.14/encodings/mac_cyrillic.py +307 -0
  692. package/runtime/usr/lib/python3.14/encodings/mac_farsi.py +307 -0
  693. package/runtime/usr/lib/python3.14/encodings/mac_greek.py +307 -0
  694. package/runtime/usr/lib/python3.14/encodings/mac_iceland.py +307 -0
  695. package/runtime/usr/lib/python3.14/encodings/mac_latin2.py +312 -0
  696. package/runtime/usr/lib/python3.14/encodings/mac_roman.py +307 -0
  697. package/runtime/usr/lib/python3.14/encodings/mac_romanian.py +307 -0
  698. package/runtime/usr/lib/python3.14/encodings/mac_turkish.py +307 -0
  699. package/runtime/usr/lib/python3.14/encodings/mbcs.py +47 -0
  700. package/runtime/usr/lib/python3.14/encodings/oem.py +41 -0
  701. package/runtime/usr/lib/python3.14/encodings/palmos.py +308 -0
  702. package/runtime/usr/lib/python3.14/encodings/ptcp154.py +312 -0
  703. package/runtime/usr/lib/python3.14/encodings/punycode.py +253 -0
  704. package/runtime/usr/lib/python3.14/encodings/quopri_codec.py +56 -0
  705. package/runtime/usr/lib/python3.14/encodings/raw_unicode_escape.py +46 -0
  706. package/runtime/usr/lib/python3.14/encodings/rot_13.py +113 -0
  707. package/runtime/usr/lib/python3.14/encodings/shift_jis.py +39 -0
  708. package/runtime/usr/lib/python3.14/encodings/shift_jis_2004.py +39 -0
  709. package/runtime/usr/lib/python3.14/encodings/shift_jisx0213.py +39 -0
  710. package/runtime/usr/lib/python3.14/encodings/tis_620.py +307 -0
  711. package/runtime/usr/lib/python3.14/encodings/undefined.py +49 -0
  712. package/runtime/usr/lib/python3.14/encodings/unicode_escape.py +46 -0
  713. package/runtime/usr/lib/python3.14/encodings/utf_16.py +155 -0
  714. package/runtime/usr/lib/python3.14/encodings/utf_16_be.py +42 -0
  715. package/runtime/usr/lib/python3.14/encodings/utf_16_le.py +42 -0
  716. package/runtime/usr/lib/python3.14/encodings/utf_32.py +150 -0
  717. package/runtime/usr/lib/python3.14/encodings/utf_32_be.py +37 -0
  718. package/runtime/usr/lib/python3.14/encodings/utf_32_le.py +37 -0
  719. package/runtime/usr/lib/python3.14/encodings/utf_7.py +38 -0
  720. package/runtime/usr/lib/python3.14/encodings/utf_8.py +42 -0
  721. package/runtime/usr/lib/python3.14/encodings/utf_8_sig.py +130 -0
  722. package/runtime/usr/lib/python3.14/encodings/uu_codec.py +103 -0
  723. package/runtime/usr/lib/python3.14/encodings/zlib_codec.py +77 -0
  724. package/runtime/usr/lib/python3.14/enum.py +2169 -0
  725. package/runtime/usr/lib/python3.14/filecmp.py +320 -0
  726. package/runtime/usr/lib/python3.14/fileinput.py +442 -0
  727. package/runtime/usr/lib/python3.14/fnmatch.py +209 -0
  728. package/runtime/usr/lib/python3.14/fractions.py +1078 -0
  729. package/runtime/usr/lib/python3.14/ftplib.py +975 -0
  730. package/runtime/usr/lib/python3.14/functools.py +1165 -0
  731. package/runtime/usr/lib/python3.14/genericpath.py +200 -0
  732. package/runtime/usr/lib/python3.14/getopt.py +232 -0
  733. package/runtime/usr/lib/python3.14/getpass.py +256 -0
  734. package/runtime/usr/lib/python3.14/gettext.py +660 -0
  735. package/runtime/usr/lib/python3.14/glob.py +574 -0
  736. package/runtime/usr/lib/python3.14/graphlib.py +254 -0
  737. package/runtime/usr/lib/python3.14/gzip.py +724 -0
  738. package/runtime/usr/lib/python3.14/hashlib.py +255 -0
  739. package/runtime/usr/lib/python3.14/heapq.py +611 -0
  740. package/runtime/usr/lib/python3.14/hmac.py +272 -0
  741. package/runtime/usr/lib/python3.14/html/__init__.py +132 -0
  742. package/runtime/usr/lib/python3.14/html/__pycache__/__init__.cpython-314.pyc +0 -0
  743. package/runtime/usr/lib/python3.14/html/__pycache__/entities.cpython-314.pyc +0 -0
  744. package/runtime/usr/lib/python3.14/html/__pycache__/parser.cpython-314.pyc +0 -0
  745. package/runtime/usr/lib/python3.14/html/entities.py +2513 -0
  746. package/runtime/usr/lib/python3.14/html/parser.py +583 -0
  747. package/runtime/usr/lib/python3.14/http/__init__.py +213 -0
  748. package/runtime/usr/lib/python3.14/http/__pycache__/__init__.cpython-314.pyc +0 -0
  749. package/runtime/usr/lib/python3.14/http/__pycache__/client.cpython-314.pyc +0 -0
  750. package/runtime/usr/lib/python3.14/http/__pycache__/cookiejar.cpython-314.pyc +0 -0
  751. package/runtime/usr/lib/python3.14/http/__pycache__/cookies.cpython-314.pyc +0 -0
  752. package/runtime/usr/lib/python3.14/http/__pycache__/server.cpython-314.pyc +0 -0
  753. package/runtime/usr/lib/python3.14/http/client.py +1598 -0
  754. package/runtime/usr/lib/python3.14/http/cookiejar.py +2124 -0
  755. package/runtime/usr/lib/python3.14/http/cookies.py +637 -0
  756. package/runtime/usr/lib/python3.14/http/server.py +1445 -0
  757. package/runtime/usr/lib/python3.14/imaplib.py +2090 -0
  758. package/runtime/usr/lib/python3.14/importlib/__init__.py +136 -0
  759. package/runtime/usr/lib/python3.14/importlib/__pycache__/__init__.cpython-314.pyc +0 -0
  760. package/runtime/usr/lib/python3.14/importlib/__pycache__/_abc.cpython-314.pyc +0 -0
  761. package/runtime/usr/lib/python3.14/importlib/__pycache__/_bootstrap.cpython-314.pyc +0 -0
  762. package/runtime/usr/lib/python3.14/importlib/__pycache__/_bootstrap_external.cpython-314.pyc +0 -0
  763. package/runtime/usr/lib/python3.14/importlib/__pycache__/abc.cpython-314.pyc +0 -0
  764. package/runtime/usr/lib/python3.14/importlib/__pycache__/machinery.cpython-314.pyc +0 -0
  765. package/runtime/usr/lib/python3.14/importlib/__pycache__/readers.cpython-314.pyc +0 -0
  766. package/runtime/usr/lib/python3.14/importlib/__pycache__/simple.cpython-314.pyc +0 -0
  767. package/runtime/usr/lib/python3.14/importlib/__pycache__/util.cpython-314.pyc +0 -0
  768. package/runtime/usr/lib/python3.14/importlib/_abc.py +39 -0
  769. package/runtime/usr/lib/python3.14/importlib/_bootstrap.py +1570 -0
  770. package/runtime/usr/lib/python3.14/importlib/_bootstrap_external.py +1566 -0
  771. package/runtime/usr/lib/python3.14/importlib/abc.py +234 -0
  772. package/runtime/usr/lib/python3.14/importlib/machinery.py +50 -0
  773. package/runtime/usr/lib/python3.14/importlib/metadata/__init__.py +1093 -0
  774. package/runtime/usr/lib/python3.14/importlib/metadata/__pycache__/__init__.cpython-314.pyc +0 -0
  775. package/runtime/usr/lib/python3.14/importlib/metadata/__pycache__/_adapters.cpython-314.pyc +0 -0
  776. package/runtime/usr/lib/python3.14/importlib/metadata/__pycache__/_collections.cpython-314.pyc +0 -0
  777. package/runtime/usr/lib/python3.14/importlib/metadata/__pycache__/_functools.cpython-314.pyc +0 -0
  778. package/runtime/usr/lib/python3.14/importlib/metadata/__pycache__/_itertools.cpython-314.pyc +0 -0
  779. package/runtime/usr/lib/python3.14/importlib/metadata/__pycache__/_meta.cpython-314.pyc +0 -0
  780. package/runtime/usr/lib/python3.14/importlib/metadata/__pycache__/_text.cpython-314.pyc +0 -0
  781. package/runtime/usr/lib/python3.14/importlib/metadata/__pycache__/diagnose.cpython-314.pyc +0 -0
  782. package/runtime/usr/lib/python3.14/importlib/metadata/_adapters.py +89 -0
  783. package/runtime/usr/lib/python3.14/importlib/metadata/_collections.py +30 -0
  784. package/runtime/usr/lib/python3.14/importlib/metadata/_functools.py +104 -0
  785. package/runtime/usr/lib/python3.14/importlib/metadata/_itertools.py +73 -0
  786. package/runtime/usr/lib/python3.14/importlib/metadata/_meta.py +67 -0
  787. package/runtime/usr/lib/python3.14/importlib/metadata/_text.py +99 -0
  788. package/runtime/usr/lib/python3.14/importlib/metadata/diagnose.py +21 -0
  789. package/runtime/usr/lib/python3.14/importlib/readers.py +12 -0
  790. package/runtime/usr/lib/python3.14/importlib/resources/__init__.py +43 -0
  791. package/runtime/usr/lib/python3.14/importlib/resources/__pycache__/__init__.cpython-314.pyc +0 -0
  792. package/runtime/usr/lib/python3.14/importlib/resources/__pycache__/_adapters.cpython-314.pyc +0 -0
  793. package/runtime/usr/lib/python3.14/importlib/resources/__pycache__/_common.cpython-314.pyc +0 -0
  794. package/runtime/usr/lib/python3.14/importlib/resources/__pycache__/_functional.cpython-314.pyc +0 -0
  795. package/runtime/usr/lib/python3.14/importlib/resources/__pycache__/_itertools.cpython-314.pyc +0 -0
  796. package/runtime/usr/lib/python3.14/importlib/resources/__pycache__/abc.cpython-314.pyc +0 -0
  797. package/runtime/usr/lib/python3.14/importlib/resources/__pycache__/readers.cpython-314.pyc +0 -0
  798. package/runtime/usr/lib/python3.14/importlib/resources/__pycache__/simple.cpython-314.pyc +0 -0
  799. package/runtime/usr/lib/python3.14/importlib/resources/_adapters.py +168 -0
  800. package/runtime/usr/lib/python3.14/importlib/resources/_common.py +211 -0
  801. package/runtime/usr/lib/python3.14/importlib/resources/_functional.py +81 -0
  802. package/runtime/usr/lib/python3.14/importlib/resources/_itertools.py +38 -0
  803. package/runtime/usr/lib/python3.14/importlib/resources/abc.py +173 -0
  804. package/runtime/usr/lib/python3.14/importlib/resources/readers.py +203 -0
  805. package/runtime/usr/lib/python3.14/importlib/resources/simple.py +106 -0
  806. package/runtime/usr/lib/python3.14/importlib/simple.py +14 -0
  807. package/runtime/usr/lib/python3.14/importlib/util.py +279 -0
  808. package/runtime/usr/lib/python3.14/inspect.py +3425 -0
  809. package/runtime/usr/lib/python3.14/io.py +150 -0
  810. package/runtime/usr/lib/python3.14/ipaddress.py +2421 -0
  811. package/runtime/usr/lib/python3.14/json/__init__.py +365 -0
  812. package/runtime/usr/lib/python3.14/json/__main__.py +20 -0
  813. package/runtime/usr/lib/python3.14/json/__pycache__/__init__.cpython-314.pyc +0 -0
  814. package/runtime/usr/lib/python3.14/json/__pycache__/__main__.cpython-314.pyc +0 -0
  815. package/runtime/usr/lib/python3.14/json/__pycache__/decoder.cpython-314.pyc +0 -0
  816. package/runtime/usr/lib/python3.14/json/__pycache__/encoder.cpython-314.pyc +0 -0
  817. package/runtime/usr/lib/python3.14/json/__pycache__/scanner.cpython-314.pyc +0 -0
  818. package/runtime/usr/lib/python3.14/json/__pycache__/tool.cpython-314.pyc +0 -0
  819. package/runtime/usr/lib/python3.14/json/decoder.py +364 -0
  820. package/runtime/usr/lib/python3.14/json/encoder.py +461 -0
  821. package/runtime/usr/lib/python3.14/json/scanner.py +73 -0
  822. package/runtime/usr/lib/python3.14/json/tool.py +122 -0
  823. package/runtime/usr/lib/python3.14/keyword.py +64 -0
  824. package/runtime/usr/lib/python3.14/lib-dynload/.keep +0 -0
  825. package/runtime/usr/lib/python3.14/linecache.py +302 -0
  826. package/runtime/usr/lib/python3.14/locale.py +1992 -0
  827. package/runtime/usr/lib/python3.14/logging/__init__.py +2335 -0
  828. package/runtime/usr/lib/python3.14/logging/__pycache__/__init__.cpython-314.pyc +0 -0
  829. package/runtime/usr/lib/python3.14/logging/__pycache__/config.cpython-314.pyc +0 -0
  830. package/runtime/usr/lib/python3.14/logging/__pycache__/handlers.cpython-314.pyc +0 -0
  831. package/runtime/usr/lib/python3.14/logging/config.py +1093 -0
  832. package/runtime/usr/lib/python3.14/logging/handlers.py +1654 -0
  833. package/runtime/usr/lib/python3.14/lzma.py +364 -0
  834. package/runtime/usr/lib/python3.14/mailbox.py +2219 -0
  835. package/runtime/usr/lib/python3.14/mimetypes.py +755 -0
  836. package/runtime/usr/lib/python3.14/modulefinder.py +671 -0
  837. package/runtime/usr/lib/python3.14/multiprocessing/__init__.py +37 -0
  838. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/__init__.cpython-314.pyc +0 -0
  839. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/connection.cpython-314.pyc +0 -0
  840. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/context.cpython-314.pyc +0 -0
  841. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/forkserver.cpython-314.pyc +0 -0
  842. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/heap.cpython-314.pyc +0 -0
  843. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/managers.cpython-314.pyc +0 -0
  844. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/pool.cpython-314.pyc +0 -0
  845. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/popen_fork.cpython-314.pyc +0 -0
  846. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/popen_forkserver.cpython-314.pyc +0 -0
  847. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/popen_spawn_posix.cpython-314.pyc +0 -0
  848. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/popen_spawn_win32.cpython-314.pyc +0 -0
  849. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/process.cpython-314.pyc +0 -0
  850. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/queues.cpython-314.pyc +0 -0
  851. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/reduction.cpython-314.pyc +0 -0
  852. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/resource_sharer.cpython-314.pyc +0 -0
  853. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/resource_tracker.cpython-314.pyc +0 -0
  854. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/shared_memory.cpython-314.pyc +0 -0
  855. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/sharedctypes.cpython-314.pyc +0 -0
  856. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/spawn.cpython-314.pyc +0 -0
  857. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/synchronize.cpython-314.pyc +0 -0
  858. package/runtime/usr/lib/python3.14/multiprocessing/__pycache__/util.cpython-314.pyc +0 -0
  859. package/runtime/usr/lib/python3.14/multiprocessing/connection.py +1232 -0
  860. package/runtime/usr/lib/python3.14/multiprocessing/context.py +405 -0
  861. package/runtime/usr/lib/python3.14/multiprocessing/dummy/__init__.py +126 -0
  862. package/runtime/usr/lib/python3.14/multiprocessing/dummy/__pycache__/__init__.cpython-314.pyc +0 -0
  863. package/runtime/usr/lib/python3.14/multiprocessing/dummy/__pycache__/connection.cpython-314.pyc +0 -0
  864. package/runtime/usr/lib/python3.14/multiprocessing/dummy/connection.py +75 -0
  865. package/runtime/usr/lib/python3.14/multiprocessing/forkserver.py +429 -0
  866. package/runtime/usr/lib/python3.14/multiprocessing/heap.py +337 -0
  867. package/runtime/usr/lib/python3.14/multiprocessing/managers.py +1438 -0
  868. package/runtime/usr/lib/python3.14/multiprocessing/pool.py +957 -0
  869. package/runtime/usr/lib/python3.14/multiprocessing/popen_fork.py +100 -0
  870. package/runtime/usr/lib/python3.14/multiprocessing/popen_forkserver.py +74 -0
  871. package/runtime/usr/lib/python3.14/multiprocessing/popen_spawn_posix.py +76 -0
  872. package/runtime/usr/lib/python3.14/multiprocessing/popen_spawn_win32.py +147 -0
  873. package/runtime/usr/lib/python3.14/multiprocessing/process.py +443 -0
  874. package/runtime/usr/lib/python3.14/multiprocessing/queues.py +399 -0
  875. package/runtime/usr/lib/python3.14/multiprocessing/reduction.py +281 -0
  876. package/runtime/usr/lib/python3.14/multiprocessing/resource_sharer.py +154 -0
  877. package/runtime/usr/lib/python3.14/multiprocessing/resource_tracker.py +495 -0
  878. package/runtime/usr/lib/python3.14/multiprocessing/shared_memory.py +544 -0
  879. package/runtime/usr/lib/python3.14/multiprocessing/sharedctypes.py +240 -0
  880. package/runtime/usr/lib/python3.14/multiprocessing/spawn.py +307 -0
  881. package/runtime/usr/lib/python3.14/multiprocessing/synchronize.py +411 -0
  882. package/runtime/usr/lib/python3.14/multiprocessing/util.py +592 -0
  883. package/runtime/usr/lib/python3.14/netrc.py +200 -0
  884. package/runtime/usr/lib/python3.14/ntpath.py +889 -0
  885. package/runtime/usr/lib/python3.14/nturl2path.py +82 -0
  886. package/runtime/usr/lib/python3.14/numbers.py +427 -0
  887. package/runtime/usr/lib/python3.14/opcode.py +122 -0
  888. package/runtime/usr/lib/python3.14/operator.py +475 -0
  889. package/runtime/usr/lib/python3.14/optparse.py +1664 -0
  890. package/runtime/usr/lib/python3.14/os.py +1191 -0
  891. package/runtime/usr/lib/python3.14/pathlib/__init__.py +1307 -0
  892. package/runtime/usr/lib/python3.14/pathlib/__pycache__/__init__.cpython-314.pyc +0 -0
  893. package/runtime/usr/lib/python3.14/pathlib/__pycache__/_local.cpython-314.pyc +0 -0
  894. package/runtime/usr/lib/python3.14/pathlib/__pycache__/_os.cpython-314.pyc +0 -0
  895. package/runtime/usr/lib/python3.14/pathlib/__pycache__/types.cpython-314.pyc +0 -0
  896. package/runtime/usr/lib/python3.14/pathlib/_local.py +12 -0
  897. package/runtime/usr/lib/python3.14/pathlib/_os.py +530 -0
  898. package/runtime/usr/lib/python3.14/pathlib/types.py +430 -0
  899. package/runtime/usr/lib/python3.14/pdb.py +3682 -0
  900. package/runtime/usr/lib/python3.14/pickle.py +1925 -0
  901. package/runtime/usr/lib/python3.14/pickletools.py +2887 -0
  902. package/runtime/usr/lib/python3.14/pkgutil.py +474 -0
  903. package/runtime/usr/lib/python3.14/platform.py +1515 -0
  904. package/runtime/usr/lib/python3.14/plistlib.py +956 -0
  905. package/runtime/usr/lib/python3.14/poplib.py +477 -0
  906. package/runtime/usr/lib/python3.14/posixpath.py +592 -0
  907. package/runtime/usr/lib/python3.14/pprint.py +675 -0
  908. package/runtime/usr/lib/python3.14/profile.py +615 -0
  909. package/runtime/usr/lib/python3.14/pstats.py +777 -0
  910. package/runtime/usr/lib/python3.14/pty.py +182 -0
  911. package/runtime/usr/lib/python3.14/py_compile.py +212 -0
  912. package/runtime/usr/lib/python3.14/pyclbr.py +314 -0
  913. package/runtime/usr/lib/python3.14/pydoc.py +2890 -0
  914. package/runtime/usr/lib/python3.14/queue.py +385 -0
  915. package/runtime/usr/lib/python3.14/quopri.py +235 -0
  916. package/runtime/usr/lib/python3.14/random.py +1087 -0
  917. package/runtime/usr/lib/python3.14/re/__init__.py +428 -0
  918. package/runtime/usr/lib/python3.14/re/__pycache__/__init__.cpython-314.pyc +0 -0
  919. package/runtime/usr/lib/python3.14/re/__pycache__/_casefix.cpython-314.pyc +0 -0
  920. package/runtime/usr/lib/python3.14/re/__pycache__/_compiler.cpython-314.pyc +0 -0
  921. package/runtime/usr/lib/python3.14/re/__pycache__/_constants.cpython-314.pyc +0 -0
  922. package/runtime/usr/lib/python3.14/re/__pycache__/_parser.cpython-314.pyc +0 -0
  923. package/runtime/usr/lib/python3.14/re/_casefix.py +106 -0
  924. package/runtime/usr/lib/python3.14/re/_compiler.py +782 -0
  925. package/runtime/usr/lib/python3.14/re/_constants.py +224 -0
  926. package/runtime/usr/lib/python3.14/re/_parser.py +1066 -0
  927. package/runtime/usr/lib/python3.14/reprlib.py +230 -0
  928. package/runtime/usr/lib/python3.14/rlcompleter.py +222 -0
  929. package/runtime/usr/lib/python3.14/runpy.py +326 -0
  930. package/runtime/usr/lib/python3.14/sched.py +167 -0
  931. package/runtime/usr/lib/python3.14/secrets.py +71 -0
  932. package/runtime/usr/lib/python3.14/selectors.py +603 -0
  933. package/runtime/usr/lib/python3.14/shelve.py +250 -0
  934. package/runtime/usr/lib/python3.14/shlex.py +351 -0
  935. package/runtime/usr/lib/python3.14/shutil.py +1660 -0
  936. package/runtime/usr/lib/python3.14/signal.py +94 -0
  937. package/runtime/usr/lib/python3.14/site-packages/README.txt +2 -0
  938. package/runtime/usr/lib/python3.14/site.py +779 -0
  939. package/runtime/usr/lib/python3.14/smtplib.py +1121 -0
  940. package/runtime/usr/lib/python3.14/socket.py +994 -0
  941. package/runtime/usr/lib/python3.14/socketserver.py +863 -0
  942. package/runtime/usr/lib/python3.14/sqlite3/__init__.py +57 -0
  943. package/runtime/usr/lib/python3.14/sqlite3/__main__.py +139 -0
  944. package/runtime/usr/lib/python3.14/sqlite3/__pycache__/__init__.cpython-314.pyc +0 -0
  945. package/runtime/usr/lib/python3.14/sqlite3/__pycache__/__main__.cpython-314.pyc +0 -0
  946. package/runtime/usr/lib/python3.14/sqlite3/__pycache__/dbapi2.cpython-314.pyc +0 -0
  947. package/runtime/usr/lib/python3.14/sqlite3/__pycache__/dump.cpython-314.pyc +0 -0
  948. package/runtime/usr/lib/python3.14/sqlite3/dbapi2.py +96 -0
  949. package/runtime/usr/lib/python3.14/sqlite3/dump.py +118 -0
  950. package/runtime/usr/lib/python3.14/sre_compile.py +7 -0
  951. package/runtime/usr/lib/python3.14/sre_constants.py +7 -0
  952. package/runtime/usr/lib/python3.14/sre_parse.py +7 -0
  953. package/runtime/usr/lib/python3.14/ssl.py +1540 -0
  954. package/runtime/usr/lib/python3.14/stat.py +212 -0
  955. package/runtime/usr/lib/python3.14/statistics.py +1879 -0
  956. package/runtime/usr/lib/python3.14/string/__init__.py +332 -0
  957. package/runtime/usr/lib/python3.14/string/__pycache__/__init__.cpython-314.pyc +0 -0
  958. package/runtime/usr/lib/python3.14/string/__pycache__/templatelib.cpython-314.pyc +0 -0
  959. package/runtime/usr/lib/python3.14/string/templatelib.py +33 -0
  960. package/runtime/usr/lib/python3.14/stringprep.py +456 -0
  961. package/runtime/usr/lib/python3.14/struct.py +15 -0
  962. package/runtime/usr/lib/python3.14/subprocess.py +2257 -0
  963. package/runtime/usr/lib/python3.14/symtable.py +451 -0
  964. package/runtime/usr/lib/python3.14/sysconfig/__init__.py +798 -0
  965. package/runtime/usr/lib/python3.14/sysconfig/__main__.py +276 -0
  966. package/runtime/usr/lib/python3.14/sysconfig/__pycache__/__init__.cpython-314.pyc +0 -0
  967. package/runtime/usr/lib/python3.14/sysconfig/__pycache__/__main__.cpython-314.pyc +0 -0
  968. package/runtime/usr/lib/python3.14/tabnanny.py +338 -0
  969. package/runtime/usr/lib/python3.14/tarfile.py +3225 -0
  970. package/runtime/usr/lib/python3.14/tempfile.py +1057 -0
  971. package/runtime/usr/lib/python3.14/textwrap.py +475 -0
  972. package/runtime/usr/lib/python3.14/this.py +28 -0
  973. package/runtime/usr/lib/python3.14/threading.py +1642 -0
  974. package/runtime/usr/lib/python3.14/timeit.py +378 -0
  975. package/runtime/usr/lib/python3.14/token.py +144 -0
  976. package/runtime/usr/lib/python3.14/tokenize.py +598 -0
  977. package/runtime/usr/lib/python3.14/tomllib/__init__.py +10 -0
  978. package/runtime/usr/lib/python3.14/tomllib/__pycache__/__init__.cpython-314.pyc +0 -0
  979. package/runtime/usr/lib/python3.14/tomllib/__pycache__/_parser.cpython-314.pyc +0 -0
  980. package/runtime/usr/lib/python3.14/tomllib/__pycache__/_re.cpython-314.pyc +0 -0
  981. package/runtime/usr/lib/python3.14/tomllib/__pycache__/_types.cpython-314.pyc +0 -0
  982. package/runtime/usr/lib/python3.14/tomllib/_parser.py +765 -0
  983. package/runtime/usr/lib/python3.14/tomllib/_re.py +113 -0
  984. package/runtime/usr/lib/python3.14/tomllib/_types.py +10 -0
  985. package/runtime/usr/lib/python3.14/tomllib/mypy.ini +15 -0
  986. package/runtime/usr/lib/python3.14/trace.py +751 -0
  987. package/runtime/usr/lib/python3.14/traceback.py +1751 -0
  988. package/runtime/usr/lib/python3.14/tracemalloc.py +560 -0
  989. package/runtime/usr/lib/python3.14/tty.py +73 -0
  990. package/runtime/usr/lib/python3.14/types.py +345 -0
  991. package/runtime/usr/lib/python3.14/typing.py +3866 -0
  992. package/runtime/usr/lib/python3.14/unittest/__init__.py +80 -0
  993. package/runtime/usr/lib/python3.14/unittest/__main__.py +18 -0
  994. package/runtime/usr/lib/python3.14/unittest/__pycache__/__init__.cpython-314.pyc +0 -0
  995. package/runtime/usr/lib/python3.14/unittest/__pycache__/__main__.cpython-314.pyc +0 -0
  996. package/runtime/usr/lib/python3.14/unittest/__pycache__/_log.cpython-314.pyc +0 -0
  997. package/runtime/usr/lib/python3.14/unittest/__pycache__/async_case.cpython-314.pyc +0 -0
  998. package/runtime/usr/lib/python3.14/unittest/__pycache__/case.cpython-314.pyc +0 -0
  999. package/runtime/usr/lib/python3.14/unittest/__pycache__/loader.cpython-314.pyc +0 -0
  1000. package/runtime/usr/lib/python3.14/unittest/__pycache__/main.cpython-314.pyc +0 -0
  1001. package/runtime/usr/lib/python3.14/unittest/__pycache__/mock.cpython-314.pyc +0 -0
  1002. package/runtime/usr/lib/python3.14/unittest/__pycache__/result.cpython-314.pyc +0 -0
  1003. package/runtime/usr/lib/python3.14/unittest/__pycache__/runner.cpython-314.pyc +0 -0
  1004. package/runtime/usr/lib/python3.14/unittest/__pycache__/signals.cpython-314.pyc +0 -0
  1005. package/runtime/usr/lib/python3.14/unittest/__pycache__/suite.cpython-314.pyc +0 -0
  1006. package/runtime/usr/lib/python3.14/unittest/__pycache__/util.cpython-314.pyc +0 -0
  1007. package/runtime/usr/lib/python3.14/unittest/_log.py +86 -0
  1008. package/runtime/usr/lib/python3.14/unittest/async_case.py +158 -0
  1009. package/runtime/usr/lib/python3.14/unittest/case.py +1628 -0
  1010. package/runtime/usr/lib/python3.14/unittest/loader.py +491 -0
  1011. package/runtime/usr/lib/python3.14/unittest/main.py +280 -0
  1012. package/runtime/usr/lib/python3.14/unittest/mock.py +3208 -0
  1013. package/runtime/usr/lib/python3.14/unittest/result.py +259 -0
  1014. package/runtime/usr/lib/python3.14/unittest/runner.py +313 -0
  1015. package/runtime/usr/lib/python3.14/unittest/signals.py +71 -0
  1016. package/runtime/usr/lib/python3.14/unittest/suite.py +379 -0
  1017. package/runtime/usr/lib/python3.14/unittest/util.py +170 -0
  1018. package/runtime/usr/lib/python3.14/urllib/__init__.py +0 -0
  1019. package/runtime/usr/lib/python3.14/urllib/__pycache__/__init__.cpython-314.pyc +0 -0
  1020. package/runtime/usr/lib/python3.14/urllib/__pycache__/error.cpython-314.pyc +0 -0
  1021. package/runtime/usr/lib/python3.14/urllib/__pycache__/parse.cpython-314.pyc +0 -0
  1022. package/runtime/usr/lib/python3.14/urllib/__pycache__/request.cpython-314.pyc +0 -0
  1023. package/runtime/usr/lib/python3.14/urllib/__pycache__/response.cpython-314.pyc +0 -0
  1024. package/runtime/usr/lib/python3.14/urllib/__pycache__/robotparser.cpython-314.pyc +0 -0
  1025. package/runtime/usr/lib/python3.14/urllib/error.py +74 -0
  1026. package/runtime/usr/lib/python3.14/urllib/parse.py +1289 -0
  1027. package/runtime/usr/lib/python3.14/urllib/request.py +2175 -0
  1028. package/runtime/usr/lib/python3.14/urllib/response.py +84 -0
  1029. package/runtime/usr/lib/python3.14/urllib/robotparser.py +363 -0
  1030. package/runtime/usr/lib/python3.14/uuid.py +1013 -0
  1031. package/runtime/usr/lib/python3.14/venv/__init__.py +700 -0
  1032. package/runtime/usr/lib/python3.14/venv/__main__.py +10 -0
  1033. package/runtime/usr/lib/python3.14/venv/__pycache__/__init__.cpython-314.pyc +0 -0
  1034. package/runtime/usr/lib/python3.14/venv/__pycache__/__main__.cpython-314.pyc +0 -0
  1035. package/runtime/usr/lib/python3.14/venv/scripts/common/Activate.ps1 +248 -0
  1036. package/runtime/usr/lib/python3.14/venv/scripts/common/activate +76 -0
  1037. package/runtime/usr/lib/python3.14/venv/scripts/common/activate.fish +69 -0
  1038. package/runtime/usr/lib/python3.14/venv/scripts/posix/activate.csh +29 -0
  1039. package/runtime/usr/lib/python3.14/warnings.py +99 -0
  1040. package/runtime/usr/lib/python3.14/wave.py +665 -0
  1041. package/runtime/usr/lib/python3.14/weakref.py +574 -0
  1042. package/runtime/usr/lib/python3.14/webbrowser.py +763 -0
  1043. package/runtime/usr/lib/python3.14/wsgiref/__init__.py +25 -0
  1044. package/runtime/usr/lib/python3.14/wsgiref/__pycache__/__init__.cpython-314.pyc +0 -0
  1045. package/runtime/usr/lib/python3.14/wsgiref/__pycache__/handlers.cpython-314.pyc +0 -0
  1046. package/runtime/usr/lib/python3.14/wsgiref/__pycache__/headers.cpython-314.pyc +0 -0
  1047. package/runtime/usr/lib/python3.14/wsgiref/__pycache__/simple_server.cpython-314.pyc +0 -0
  1048. package/runtime/usr/lib/python3.14/wsgiref/__pycache__/types.cpython-314.pyc +0 -0
  1049. package/runtime/usr/lib/python3.14/wsgiref/__pycache__/util.cpython-314.pyc +0 -0
  1050. package/runtime/usr/lib/python3.14/wsgiref/__pycache__/validate.cpython-314.pyc +0 -0
  1051. package/runtime/usr/lib/python3.14/wsgiref/handlers.py +575 -0
  1052. package/runtime/usr/lib/python3.14/wsgiref/headers.py +192 -0
  1053. package/runtime/usr/lib/python3.14/wsgiref/simple_server.py +161 -0
  1054. package/runtime/usr/lib/python3.14/wsgiref/types.py +54 -0
  1055. package/runtime/usr/lib/python3.14/wsgiref/util.py +159 -0
  1056. package/runtime/usr/lib/python3.14/wsgiref/validate.py +438 -0
  1057. package/runtime/usr/lib/python3.14/xml/__init__.py +20 -0
  1058. package/runtime/usr/lib/python3.14/xml/__pycache__/__init__.cpython-314.pyc +0 -0
  1059. package/runtime/usr/lib/python3.14/xml/dom/NodeFilter.py +27 -0
  1060. package/runtime/usr/lib/python3.14/xml/dom/__init__.py +140 -0
  1061. package/runtime/usr/lib/python3.14/xml/dom/__pycache__/NodeFilter.cpython-314.pyc +0 -0
  1062. package/runtime/usr/lib/python3.14/xml/dom/__pycache__/__init__.cpython-314.pyc +0 -0
  1063. package/runtime/usr/lib/python3.14/xml/dom/__pycache__/domreg.cpython-314.pyc +0 -0
  1064. package/runtime/usr/lib/python3.14/xml/dom/__pycache__/expatbuilder.cpython-314.pyc +0 -0
  1065. package/runtime/usr/lib/python3.14/xml/dom/__pycache__/minicompat.cpython-314.pyc +0 -0
  1066. package/runtime/usr/lib/python3.14/xml/dom/__pycache__/minidom.cpython-314.pyc +0 -0
  1067. package/runtime/usr/lib/python3.14/xml/dom/__pycache__/pulldom.cpython-314.pyc +0 -0
  1068. package/runtime/usr/lib/python3.14/xml/dom/__pycache__/xmlbuilder.cpython-314.pyc +0 -0
  1069. package/runtime/usr/lib/python3.14/xml/dom/domreg.py +99 -0
  1070. package/runtime/usr/lib/python3.14/xml/dom/expatbuilder.py +964 -0
  1071. package/runtime/usr/lib/python3.14/xml/dom/minicompat.py +109 -0
  1072. package/runtime/usr/lib/python3.14/xml/dom/minidom.py +2027 -0
  1073. package/runtime/usr/lib/python3.14/xml/dom/pulldom.py +350 -0
  1074. package/runtime/usr/lib/python3.14/xml/dom/xmlbuilder.py +389 -0
  1075. package/runtime/usr/lib/python3.14/xml/etree/ElementInclude.py +186 -0
  1076. package/runtime/usr/lib/python3.14/xml/etree/ElementPath.py +430 -0
  1077. package/runtime/usr/lib/python3.14/xml/etree/ElementTree.py +2093 -0
  1078. package/runtime/usr/lib/python3.14/xml/etree/__init__.py +33 -0
  1079. package/runtime/usr/lib/python3.14/xml/etree/__pycache__/ElementInclude.cpython-314.pyc +0 -0
  1080. package/runtime/usr/lib/python3.14/xml/etree/__pycache__/ElementPath.cpython-314.pyc +0 -0
  1081. package/runtime/usr/lib/python3.14/xml/etree/__pycache__/ElementTree.cpython-314.pyc +0 -0
  1082. package/runtime/usr/lib/python3.14/xml/etree/__pycache__/__init__.cpython-314.pyc +0 -0
  1083. package/runtime/usr/lib/python3.14/xml/etree/__pycache__/cElementTree.cpython-314.pyc +0 -0
  1084. package/runtime/usr/lib/python3.14/xml/etree/cElementTree.py +3 -0
  1085. package/runtime/usr/lib/python3.14/xml/parsers/__init__.py +8 -0
  1086. package/runtime/usr/lib/python3.14/xml/parsers/__pycache__/__init__.cpython-314.pyc +0 -0
  1087. package/runtime/usr/lib/python3.14/xml/parsers/__pycache__/expat.cpython-314.pyc +0 -0
  1088. package/runtime/usr/lib/python3.14/xml/parsers/expat.py +8 -0
  1089. package/runtime/usr/lib/python3.14/xml/sax/__init__.py +109 -0
  1090. package/runtime/usr/lib/python3.14/xml/sax/__pycache__/__init__.cpython-314.pyc +0 -0
  1091. package/runtime/usr/lib/python3.14/xml/sax/__pycache__/_exceptions.cpython-314.pyc +0 -0
  1092. package/runtime/usr/lib/python3.14/xml/sax/__pycache__/expatreader.cpython-314.pyc +0 -0
  1093. package/runtime/usr/lib/python3.14/xml/sax/__pycache__/handler.cpython-314.pyc +0 -0
  1094. package/runtime/usr/lib/python3.14/xml/sax/__pycache__/saxutils.cpython-314.pyc +0 -0
  1095. package/runtime/usr/lib/python3.14/xml/sax/__pycache__/xmlreader.cpython-314.pyc +0 -0
  1096. package/runtime/usr/lib/python3.14/xml/sax/_exceptions.py +127 -0
  1097. package/runtime/usr/lib/python3.14/xml/sax/expatreader.py +454 -0
  1098. package/runtime/usr/lib/python3.14/xml/sax/handler.py +387 -0
  1099. package/runtime/usr/lib/python3.14/xml/sax/saxutils.py +370 -0
  1100. package/runtime/usr/lib/python3.14/xml/sax/xmlreader.py +379 -0
  1101. package/runtime/usr/lib/python3.14/xmlrpc/__init__.py +1 -0
  1102. package/runtime/usr/lib/python3.14/xmlrpc/__pycache__/__init__.cpython-314.pyc +0 -0
  1103. package/runtime/usr/lib/python3.14/xmlrpc/__pycache__/client.cpython-314.pyc +0 -0
  1104. package/runtime/usr/lib/python3.14/xmlrpc/__pycache__/server.cpython-314.pyc +0 -0
  1105. package/runtime/usr/lib/python3.14/xmlrpc/client.py +1503 -0
  1106. package/runtime/usr/lib/python3.14/xmlrpc/server.py +1003 -0
  1107. package/runtime/usr/lib/python3.14/zipapp.py +231 -0
  1108. package/runtime/usr/lib/python3.14/zipfile/__init__.py +2479 -0
  1109. package/runtime/usr/lib/python3.14/zipfile/__main__.py +4 -0
  1110. package/runtime/usr/lib/python3.14/zipfile/__pycache__/__init__.cpython-314.pyc +0 -0
  1111. package/runtime/usr/lib/python3.14/zipfile/__pycache__/__main__.cpython-314.pyc +0 -0
  1112. package/runtime/usr/lib/python3.14/zipfile/_path/__init__.py +452 -0
  1113. package/runtime/usr/lib/python3.14/zipfile/_path/__pycache__/__init__.cpython-314.pyc +0 -0
  1114. package/runtime/usr/lib/python3.14/zipfile/_path/__pycache__/glob.cpython-314.pyc +0 -0
  1115. package/runtime/usr/lib/python3.14/zipfile/_path/glob.py +113 -0
  1116. package/runtime/usr/lib/python3.14/zipimport.py +822 -0
  1117. package/runtime/usr/lib/python3.14/zoneinfo/__init__.py +34 -0
  1118. package/runtime/usr/lib/python3.14/zoneinfo/__pycache__/__init__.cpython-314.pyc +0 -0
  1119. package/runtime/usr/lib/python3.14/zoneinfo/__pycache__/_common.cpython-314.pyc +0 -0
  1120. package/runtime/usr/lib/python3.14/zoneinfo/__pycache__/_tzpath.cpython-314.pyc +0 -0
  1121. package/runtime/usr/lib/python3.14/zoneinfo/__pycache__/_zoneinfo.cpython-314.pyc +0 -0
  1122. package/runtime/usr/lib/python3.14/zoneinfo/_common.py +172 -0
  1123. package/runtime/usr/lib/python3.14/zoneinfo/_tzpath.py +189 -0
  1124. package/runtime/usr/lib/python3.14/zoneinfo/_zoneinfo.py +779 -0
  1125. package/share/applications/python3.desktop +7 -0
  1126. package/share/licenses/python3/LICENSE +277 -0
  1127. package/share/licenses/python3/openssl-LICENSE +177 -0
  1128. package/share/licenses/python3/zlib-LICENSE +22 -0
@@ -0,0 +1,2124 @@
1
+ r"""HTTP cookie handling for web clients.
2
+
3
+ This module has (now fairly distant) origins in Gisle Aas' Perl module
4
+ HTTP::Cookies, from the libwww-perl library.
5
+
6
+ Docstrings, comments and debug strings in this code refer to the
7
+ attributes of the HTTP cookie system as cookie-attributes, to distinguish
8
+ them clearly from Python attributes.
9
+
10
+ Class diagram (note that BSDDBCookieJar and the MSIE* classes are not
11
+ distributed with the Python standard library, but are available from
12
+ http://wwwsearch.sf.net/):
13
+
14
+ CookieJar____
15
+ / \ \
16
+ FileCookieJar \ \
17
+ / | \ \ \
18
+ MozillaCookieJar | LWPCookieJar \ \
19
+ | | \
20
+ | ---MSIEBase | \
21
+ | / | | \
22
+ | / MSIEDBCookieJar BSDDBCookieJar
23
+ |/
24
+ MSIECookieJar
25
+
26
+ """
27
+
28
+ __all__ = ['Cookie', 'CookieJar', 'CookiePolicy', 'DefaultCookiePolicy',
29
+ 'FileCookieJar', 'LWPCookieJar', 'LoadError', 'MozillaCookieJar']
30
+
31
+ import os
32
+ import copy
33
+ import datetime
34
+ import re
35
+ import time
36
+ import urllib.parse, urllib.request
37
+ import threading as _threading
38
+ import http.client # only for the default HTTP port
39
+ from calendar import timegm
40
+
41
+ debug = False # set to True to enable debugging via the logging module
42
+ logger = None
43
+
44
+ def _debug(*args):
45
+ if not debug:
46
+ return
47
+ global logger
48
+ if not logger:
49
+ import logging
50
+ logger = logging.getLogger("http.cookiejar")
51
+ return logger.debug(*args)
52
+
53
+ HTTPONLY_ATTR = "HTTPOnly"
54
+ HTTPONLY_PREFIX = "#HttpOnly_"
55
+ DEFAULT_HTTP_PORT = str(http.client.HTTP_PORT)
56
+ NETSCAPE_MAGIC_RGX = re.compile("#( Netscape)? HTTP Cookie File",
57
+ re.IGNORECASE | re.ASCII)
58
+ MISSING_FILENAME_TEXT = ("a filename was not supplied (nor was the CookieJar "
59
+ "instance initialised with one)")
60
+ NETSCAPE_HEADER_TEXT = """\
61
+ # Netscape HTTP Cookie File
62
+ # http://curl.haxx.se/rfc/cookie_spec.html
63
+ # This is a generated file! Do not edit.
64
+
65
+ """
66
+
67
+ def _warn_unhandled_exception():
68
+ # There are a few catch-all except: statements in this module, for
69
+ # catching input that's bad in unexpected ways. Warn if any
70
+ # exceptions are caught there.
71
+ import io, warnings, traceback
72
+ f = io.StringIO()
73
+ traceback.print_exc(None, f)
74
+ msg = f.getvalue()
75
+ warnings.warn("http.cookiejar bug!\n%s" % msg, stacklevel=2)
76
+
77
+
78
+ # Date/time conversion
79
+ # -----------------------------------------------------------------------------
80
+
81
+ EPOCH_YEAR = 1970
82
+ def _timegm(tt):
83
+ year, month, mday, hour, min, sec = tt[:6]
84
+ if ((year >= EPOCH_YEAR) and (1 <= month <= 12) and (1 <= mday <= 31) and
85
+ (0 <= hour <= 24) and (0 <= min <= 59) and (0 <= sec <= 61)):
86
+ return timegm(tt)
87
+ else:
88
+ return None
89
+
90
+ DAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
91
+ MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
92
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
93
+ MONTHS_LOWER = [month.lower() for month in MONTHS]
94
+
95
+ def time2isoz(t=None):
96
+ """Return a string representing time in seconds since epoch, t.
97
+
98
+ If the function is called without an argument, it will use the current
99
+ time.
100
+
101
+ The format of the returned string is like "YYYY-MM-DD hh:mm:ssZ",
102
+ representing Universal Time (UTC, aka GMT). An example of this format is:
103
+
104
+ 1994-11-24 08:49:37Z
105
+
106
+ """
107
+ if t is None:
108
+ dt = datetime.datetime.now(tz=datetime.UTC)
109
+ else:
110
+ dt = datetime.datetime.fromtimestamp(t, tz=datetime.UTC)
111
+ return "%04d-%02d-%02d %02d:%02d:%02dZ" % (
112
+ dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second)
113
+
114
+ def time2netscape(t=None):
115
+ """Return a string representing time in seconds since epoch, t.
116
+
117
+ If the function is called without an argument, it will use the current
118
+ time.
119
+
120
+ The format of the returned string is like this:
121
+
122
+ Wed, DD-Mon-YYYY HH:MM:SS GMT
123
+
124
+ """
125
+ if t is None:
126
+ dt = datetime.datetime.now(tz=datetime.UTC)
127
+ else:
128
+ dt = datetime.datetime.fromtimestamp(t, tz=datetime.UTC)
129
+ return "%s, %02d-%s-%04d %02d:%02d:%02d GMT" % (
130
+ DAYS[dt.weekday()], dt.day, MONTHS[dt.month-1],
131
+ dt.year, dt.hour, dt.minute, dt.second)
132
+
133
+
134
+ UTC_ZONES = {"GMT": None, "UTC": None, "UT": None, "Z": None}
135
+
136
+ TIMEZONE_RE = re.compile(r"^([-+])?(\d\d?):?(\d\d)?$", re.ASCII)
137
+ def offset_from_tz_string(tz):
138
+ offset = None
139
+ if tz in UTC_ZONES:
140
+ offset = 0
141
+ else:
142
+ m = TIMEZONE_RE.search(tz)
143
+ if m:
144
+ offset = 3600 * int(m.group(2))
145
+ if m.group(3):
146
+ offset = offset + 60 * int(m.group(3))
147
+ if m.group(1) == '-':
148
+ offset = -offset
149
+ return offset
150
+
151
+ def _str2time(day, mon, yr, hr, min, sec, tz):
152
+ yr = int(yr)
153
+ if yr > datetime.MAXYEAR:
154
+ return None
155
+
156
+ # translate month name to number
157
+ # month numbers start with 1 (January)
158
+ try:
159
+ mon = MONTHS_LOWER.index(mon.lower())+1
160
+ except ValueError:
161
+ # maybe it's already a number
162
+ try:
163
+ imon = int(mon)
164
+ except ValueError:
165
+ return None
166
+ if 1 <= imon <= 12:
167
+ mon = imon
168
+ else:
169
+ return None
170
+
171
+ # make sure clock elements are defined
172
+ if hr is None: hr = 0
173
+ if min is None: min = 0
174
+ if sec is None: sec = 0
175
+
176
+ day = int(day)
177
+ hr = int(hr)
178
+ min = int(min)
179
+ sec = int(sec)
180
+
181
+ if yr < 1000:
182
+ # find "obvious" year
183
+ cur_yr = time.localtime(time.time())[0]
184
+ m = cur_yr % 100
185
+ tmp = yr
186
+ yr = yr + cur_yr - m
187
+ m = m - tmp
188
+ if abs(m) > 50:
189
+ if m > 0: yr = yr + 100
190
+ else: yr = yr - 100
191
+
192
+ # convert UTC time tuple to seconds since epoch (not timezone-adjusted)
193
+ t = _timegm((yr, mon, day, hr, min, sec, tz))
194
+
195
+ if t is not None:
196
+ # adjust time using timezone string, to get absolute time since epoch
197
+ if tz is None:
198
+ tz = "UTC"
199
+ tz = tz.upper()
200
+ offset = offset_from_tz_string(tz)
201
+ if offset is None:
202
+ return None
203
+ t = t - offset
204
+
205
+ return t
206
+
207
+ STRICT_DATE_RE = re.compile(
208
+ r"^[SMTWF][a-z][a-z], (\d\d) ([JFMASOND][a-z][a-z]) "
209
+ r"(\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$", re.ASCII)
210
+ WEEKDAY_RE = re.compile(
211
+ r"^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)[a-z]*,?\s*", re.I | re.ASCII)
212
+ LOOSE_HTTP_DATE_RE = re.compile(
213
+ r"""^
214
+ (\d\d?) # day
215
+ (?:\s+|[-\/])
216
+ (\w+) # month
217
+ (?:\s+|[-\/])
218
+ (\d+) # year
219
+ (?:
220
+ (?:\s+|:) # separator before clock
221
+ (\d\d?):(\d\d) # hour:min
222
+ (?::(\d\d))? # optional seconds
223
+ )? # optional clock
224
+ \s*
225
+ (?:
226
+ ([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+) # timezone
227
+ \s*
228
+ )?
229
+ (?:
230
+ \(\w+\) # ASCII representation of timezone in parens.
231
+ \s*
232
+ )?$""", re.X | re.ASCII)
233
+ def http2time(text):
234
+ """Returns time in seconds since epoch of time represented by a string.
235
+
236
+ Return value is an integer.
237
+
238
+ None is returned if the format of str is unrecognized, the time is outside
239
+ the representable range, or the timezone string is not recognized. If the
240
+ string contains no timezone, UTC is assumed.
241
+
242
+ The timezone in the string may be numerical (like "-0800" or "+0100") or a
243
+ string timezone (like "UTC", "GMT", "BST" or "EST"). Currently, only the
244
+ timezone strings equivalent to UTC (zero offset) are known to the function.
245
+
246
+ The function loosely parses the following formats:
247
+
248
+ Wed, 09 Feb 1994 22:23:32 GMT -- HTTP format
249
+ Tuesday, 08-Feb-94 14:15:29 GMT -- old rfc850 HTTP format
250
+ Tuesday, 08-Feb-1994 14:15:29 GMT -- broken rfc850 HTTP format
251
+ 09 Feb 1994 22:23:32 GMT -- HTTP format (no weekday)
252
+ 08-Feb-94 14:15:29 GMT -- rfc850 format (no weekday)
253
+ 08-Feb-1994 14:15:29 GMT -- broken rfc850 format (no weekday)
254
+
255
+ The parser ignores leading and trailing whitespace. The time may be
256
+ absent.
257
+
258
+ If the year is given with only 2 digits, the function will select the
259
+ century that makes the year closest to the current date.
260
+
261
+ """
262
+ # fast exit for strictly conforming string
263
+ m = STRICT_DATE_RE.search(text)
264
+ if m:
265
+ g = m.groups()
266
+ mon = MONTHS_LOWER.index(g[1].lower()) + 1
267
+ tt = (int(g[2]), mon, int(g[0]),
268
+ int(g[3]), int(g[4]), float(g[5]))
269
+ return _timegm(tt)
270
+
271
+ # No, we need some messy parsing...
272
+
273
+ # clean up
274
+ text = text.lstrip()
275
+ text = WEEKDAY_RE.sub("", text, 1) # Useless weekday
276
+
277
+ # tz is time zone specifier string
278
+ day, mon, yr, hr, min, sec, tz = [None]*7
279
+
280
+ # loose regexp parse
281
+ m = LOOSE_HTTP_DATE_RE.search(text)
282
+ if m is not None:
283
+ day, mon, yr, hr, min, sec, tz = m.groups()
284
+ else:
285
+ return None # bad format
286
+
287
+ return _str2time(day, mon, yr, hr, min, sec, tz)
288
+
289
+ ISO_DATE_RE = re.compile(
290
+ r"""^
291
+ (\d{4}) # year
292
+ [-\/]?
293
+ (\d\d?) # numerical month
294
+ [-\/]?
295
+ (\d\d?) # day
296
+ (?:
297
+ (?:\s+|[-:Tt]) # separator before clock
298
+ (\d\d?):?(\d\d) # hour:min
299
+ (?::?(\d\d(?:\.\d*)?))? # optional seconds (and fractional)
300
+ )? # optional clock
301
+ \s*
302
+ (?:
303
+ ([-+]?\d\d?:?(:?\d\d)?
304
+ |Z|z) # timezone (Z is "zero meridian", i.e. GMT)
305
+ \s*
306
+ )?$""", re.X | re. ASCII)
307
+ def iso2time(text):
308
+ """
309
+ As for http2time, but parses the ISO 8601 formats:
310
+
311
+ 1994-02-03 14:15:29 -0100 -- ISO 8601 format
312
+ 1994-02-03 14:15:29 -- zone is optional
313
+ 1994-02-03 -- only date
314
+ 1994-02-03T14:15:29 -- Use T as separator
315
+ 19940203T141529Z -- ISO 8601 compact format
316
+ 19940203 -- only date
317
+
318
+ """
319
+ # clean up
320
+ text = text.lstrip()
321
+
322
+ # tz is time zone specifier string
323
+ day, mon, yr, hr, min, sec, tz = [None]*7
324
+
325
+ # loose regexp parse
326
+ m = ISO_DATE_RE.search(text)
327
+ if m is not None:
328
+ # XXX there's an extra bit of the timezone I'm ignoring here: is
329
+ # this the right thing to do?
330
+ yr, mon, day, hr, min, sec, tz, _ = m.groups()
331
+ else:
332
+ return None # bad format
333
+
334
+ return _str2time(day, mon, yr, hr, min, sec, tz)
335
+
336
+
337
+ # Header parsing
338
+ # -----------------------------------------------------------------------------
339
+
340
+ def unmatched(match):
341
+ """Return unmatched part of re.Match object."""
342
+ start, end = match.span(0)
343
+ return match.string[:start]+match.string[end:]
344
+
345
+ HEADER_TOKEN_RE = re.compile(r"^\s*([^=\s;,]+)")
346
+ HEADER_QUOTED_VALUE_RE = re.compile(r"^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"")
347
+ HEADER_VALUE_RE = re.compile(r"^\s*=\s*([^\s;,]*)")
348
+ HEADER_ESCAPE_RE = re.compile(r"\\(.)")
349
+ def split_header_words(header_values):
350
+ r"""Parse header values into a list of lists containing key,value pairs.
351
+
352
+ The function knows how to deal with ",", ";" and "=" as well as quoted
353
+ values after "=". A list of space separated tokens are parsed as if they
354
+ were separated by ";".
355
+
356
+ If the header_values passed as argument contains multiple values, then they
357
+ are treated as if they were a single value separated by comma ",".
358
+
359
+ This means that this function is useful for parsing header fields that
360
+ follow this syntax (BNF as from the HTTP/1.1 specification, but we relax
361
+ the requirement for tokens).
362
+
363
+ headers = #header
364
+ header = (token | parameter) *( [";"] (token | parameter))
365
+
366
+ token = 1*<any CHAR except CTLs or separators>
367
+ separators = "(" | ")" | "<" | ">" | "@"
368
+ | "," | ";" | ":" | "\" | <">
369
+ | "/" | "[" | "]" | "?" | "="
370
+ | "{" | "}" | SP | HT
371
+
372
+ quoted-string = ( <"> *(qdtext | quoted-pair ) <"> )
373
+ qdtext = <any TEXT except <">>
374
+ quoted-pair = "\" CHAR
375
+
376
+ parameter = attribute "=" value
377
+ attribute = token
378
+ value = token | quoted-string
379
+
380
+ Each header is represented by a list of key/value pairs. The value for a
381
+ simple token (not part of a parameter) is None. Syntactically incorrect
382
+ headers will not necessarily be parsed as you would want.
383
+
384
+ This is easier to describe with some examples:
385
+
386
+ >>> split_header_words(['foo="bar"; port="80,81"; discard, bar=baz'])
387
+ [[('foo', 'bar'), ('port', '80,81'), ('discard', None)], [('bar', 'baz')]]
388
+ >>> split_header_words(['text/html; charset="iso-8859-1"'])
389
+ [[('text/html', None), ('charset', 'iso-8859-1')]]
390
+ >>> split_header_words([r'Basic realm="\"foo\bar\""'])
391
+ [[('Basic', None), ('realm', '"foobar"')]]
392
+
393
+ """
394
+ assert not isinstance(header_values, str)
395
+ result = []
396
+ for text in header_values:
397
+ orig_text = text
398
+ pairs = []
399
+ while text:
400
+ m = HEADER_TOKEN_RE.search(text)
401
+ if m:
402
+ text = unmatched(m)
403
+ name = m.group(1)
404
+ m = HEADER_QUOTED_VALUE_RE.search(text)
405
+ if m: # quoted value
406
+ text = unmatched(m)
407
+ value = m.group(1)
408
+ value = HEADER_ESCAPE_RE.sub(r"\1", value)
409
+ else:
410
+ m = HEADER_VALUE_RE.search(text)
411
+ if m: # unquoted value
412
+ text = unmatched(m)
413
+ value = m.group(1)
414
+ value = value.rstrip()
415
+ else:
416
+ # no value, a lone token
417
+ value = None
418
+ pairs.append((name, value))
419
+ elif text.lstrip().startswith(","):
420
+ # concatenated headers, as per RFC 2616 section 4.2
421
+ text = text.lstrip()[1:]
422
+ if pairs: result.append(pairs)
423
+ pairs = []
424
+ else:
425
+ # skip junk
426
+ non_junk, nr_junk_chars = re.subn(r"^[=\s;]*", "", text)
427
+ assert nr_junk_chars > 0, (
428
+ "split_header_words bug: '%s', '%s', %s" %
429
+ (orig_text, text, pairs))
430
+ text = non_junk
431
+ if pairs: result.append(pairs)
432
+ return result
433
+
434
+ HEADER_JOIN_TOKEN_RE = re.compile(r"[!#$%&'*+\-.^_`|~0-9A-Za-z]+")
435
+ HEADER_JOIN_ESCAPE_RE = re.compile(r"([\"\\])")
436
+ def join_header_words(lists):
437
+ """Do the inverse (almost) of the conversion done by split_header_words.
438
+
439
+ Takes a list of lists of (key, value) pairs and produces a single header
440
+ value. Attribute values are quoted if needed.
441
+
442
+ >>> join_header_words([[("text/plain", None), ("charset", "iso-8859/1")]])
443
+ 'text/plain; charset="iso-8859/1"'
444
+ >>> join_header_words([[("text/plain", None)], [("charset", "iso-8859/1")]])
445
+ 'text/plain, charset="iso-8859/1"'
446
+
447
+ """
448
+ headers = []
449
+ for pairs in lists:
450
+ attr = []
451
+ for k, v in pairs:
452
+ if v is not None:
453
+ if not HEADER_JOIN_TOKEN_RE.fullmatch(v):
454
+ v = HEADER_JOIN_ESCAPE_RE.sub(r"\\\1", v) # escape " and \
455
+ v = '"%s"' % v
456
+ k = "%s=%s" % (k, v)
457
+ attr.append(k)
458
+ if attr: headers.append("; ".join(attr))
459
+ return ", ".join(headers)
460
+
461
+ def strip_quotes(text):
462
+ if text.startswith('"'):
463
+ text = text[1:]
464
+ if text.endswith('"'):
465
+ text = text[:-1]
466
+ return text
467
+
468
+ def parse_ns_headers(ns_headers):
469
+ """Ad-hoc parser for Netscape protocol cookie-attributes.
470
+
471
+ The old Netscape cookie format for Set-Cookie can for instance contain
472
+ an unquoted "," in the expires field, so we have to use this ad-hoc
473
+ parser instead of split_header_words.
474
+
475
+ XXX This may not make the best possible effort to parse all the crap
476
+ that Netscape Cookie headers contain. Ronald Tschalar's HTTPClient
477
+ parser is probably better, so could do worse than following that if
478
+ this ever gives any trouble.
479
+
480
+ Currently, this is also used for parsing RFC 2109 cookies.
481
+
482
+ """
483
+ known_attrs = ("expires", "domain", "path", "secure",
484
+ # RFC 2109 attrs (may turn up in Netscape cookies, too)
485
+ "version", "port", "max-age")
486
+
487
+ result = []
488
+ for ns_header in ns_headers:
489
+ pairs = []
490
+ version_set = False
491
+
492
+ # XXX: The following does not strictly adhere to RFCs in that empty
493
+ # names and values are legal (the former will only appear once and will
494
+ # be overwritten if multiple occurrences are present). This is
495
+ # mostly to deal with backwards compatibility.
496
+ for ii, param in enumerate(ns_header.split(';')):
497
+ param = param.strip()
498
+
499
+ key, sep, val = param.partition('=')
500
+ key = key.strip()
501
+
502
+ if not key:
503
+ if ii == 0:
504
+ break
505
+ else:
506
+ continue
507
+
508
+ # allow for a distinction between present and empty and missing
509
+ # altogether
510
+ val = val.strip() if sep else None
511
+
512
+ if ii != 0:
513
+ lc = key.lower()
514
+ if lc in known_attrs:
515
+ key = lc
516
+
517
+ if key == "version":
518
+ # This is an RFC 2109 cookie.
519
+ if val is not None:
520
+ val = strip_quotes(val)
521
+ version_set = True
522
+ elif key == "expires":
523
+ # convert expires date to seconds since epoch
524
+ if val is not None:
525
+ val = http2time(strip_quotes(val)) # None if invalid
526
+ pairs.append((key, val))
527
+
528
+ if pairs:
529
+ if not version_set:
530
+ pairs.append(("version", "0"))
531
+ result.append(pairs)
532
+
533
+ return result
534
+
535
+
536
+ IPV4_RE = re.compile(r"\.\d+$", re.ASCII)
537
+ def is_HDN(text):
538
+ """Return True if text is a host domain name."""
539
+ # XXX
540
+ # This may well be wrong. Which RFC is HDN defined in, if any (for
541
+ # the purposes of RFC 2965)?
542
+ # For the current implementation, what about IPv6? Remember to look
543
+ # at other uses of IPV4_RE also, if change this.
544
+ if IPV4_RE.search(text):
545
+ return False
546
+ if text == "":
547
+ return False
548
+ if text[0] == "." or text[-1] == ".":
549
+ return False
550
+ return True
551
+
552
+ def domain_match(A, B):
553
+ """Return True if domain A domain-matches domain B, according to RFC 2965.
554
+
555
+ A and B may be host domain names or IP addresses.
556
+
557
+ RFC 2965, section 1:
558
+
559
+ Host names can be specified either as an IP address or a HDN string.
560
+ Sometimes we compare one host name with another. (Such comparisons SHALL
561
+ be case-insensitive.) Host A's name domain-matches host B's if
562
+
563
+ * their host name strings string-compare equal; or
564
+
565
+ * A is a HDN string and has the form NB, where N is a non-empty
566
+ name string, B has the form .B', and B' is a HDN string. (So,
567
+ x.y.com domain-matches .Y.com but not Y.com.)
568
+
569
+ Note that domain-match is not a commutative operation: a.b.c.com
570
+ domain-matches .c.com, but not the reverse.
571
+
572
+ """
573
+ # Note that, if A or B are IP addresses, the only relevant part of the
574
+ # definition of the domain-match algorithm is the direct string-compare.
575
+ A = A.lower()
576
+ B = B.lower()
577
+ if A == B:
578
+ return True
579
+ if not is_HDN(A):
580
+ return False
581
+ i = A.rfind(B)
582
+ if i == -1 or i == 0:
583
+ # A does not have form NB, or N is the empty string
584
+ return False
585
+ if not B.startswith("."):
586
+ return False
587
+ if not is_HDN(B[1:]):
588
+ return False
589
+ return True
590
+
591
+ def liberal_is_HDN(text):
592
+ """Return True if text is a sort-of-like a host domain name.
593
+
594
+ For accepting/blocking domains.
595
+
596
+ """
597
+ if IPV4_RE.search(text):
598
+ return False
599
+ return True
600
+
601
+ def user_domain_match(A, B):
602
+ """For blocking/accepting domains.
603
+
604
+ A and B may be host domain names or IP addresses.
605
+
606
+ """
607
+ A = A.lower()
608
+ B = B.lower()
609
+ if not (liberal_is_HDN(A) and liberal_is_HDN(B)):
610
+ if A == B:
611
+ # equal IP addresses
612
+ return True
613
+ return False
614
+ initial_dot = B.startswith(".")
615
+ if initial_dot and A.endswith(B):
616
+ return True
617
+ if not initial_dot and A == B:
618
+ return True
619
+ return False
620
+
621
+ cut_port_re = re.compile(r":\d+$", re.ASCII)
622
+ def request_host(request):
623
+ """Return request-host, as defined by RFC 2965.
624
+
625
+ Variation from RFC: returned value is lowercased, for convenient
626
+ comparison.
627
+
628
+ """
629
+ url = request.get_full_url()
630
+ host = urllib.parse.urlparse(url)[1]
631
+ if host == "":
632
+ host = request.get_header("Host", "")
633
+
634
+ # remove port, if present
635
+ host = cut_port_re.sub("", host, 1)
636
+ return host.lower()
637
+
638
+ def eff_request_host(request):
639
+ """Return a tuple (request-host, effective request-host name).
640
+
641
+ As defined by RFC 2965, except both are lowercased.
642
+
643
+ """
644
+ erhn = req_host = request_host(request)
645
+ if "." not in req_host:
646
+ erhn = req_host + ".local"
647
+ return req_host, erhn
648
+
649
+ def request_path(request):
650
+ """Path component of request-URI, as defined by RFC 2965."""
651
+ url = request.get_full_url()
652
+ parts = urllib.parse.urlsplit(url)
653
+ path = escape_path(parts.path)
654
+ if not path.startswith("/"):
655
+ # fix bad RFC 2396 absoluteURI
656
+ path = "/" + path
657
+ return path
658
+
659
+ def request_port(request):
660
+ host = request.host
661
+ i = host.find(':')
662
+ if i >= 0:
663
+ port = host[i+1:]
664
+ try:
665
+ int(port)
666
+ except ValueError:
667
+ _debug("nonnumeric port: '%s'", port)
668
+ return None
669
+ else:
670
+ port = DEFAULT_HTTP_PORT
671
+ return port
672
+
673
+ # Characters in addition to A-Z, a-z, 0-9, '_', '.', and '-' that don't
674
+ # need to be escaped to form a valid HTTP URL (RFCs 2396 and 1738).
675
+ HTTP_PATH_SAFE = "%/;:@&=+$,!~*'()"
676
+ ESCAPED_CHAR_RE = re.compile(r"%([0-9a-fA-F][0-9a-fA-F])")
677
+ def uppercase_escaped_char(match):
678
+ return "%%%s" % match.group(1).upper()
679
+ def escape_path(path):
680
+ """Escape any invalid characters in HTTP URL, and uppercase all escapes."""
681
+ # There's no knowing what character encoding was used to create URLs
682
+ # containing %-escapes, but since we have to pick one to escape invalid
683
+ # path characters, we pick UTF-8, as recommended in the HTML 4.0
684
+ # specification:
685
+ # http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.2.1
686
+ # And here, kind of: draft-fielding-uri-rfc2396bis-03
687
+ # (And in draft IRI specification: draft-duerst-iri-05)
688
+ # (And here, for new URI schemes: RFC 2718)
689
+ path = urllib.parse.quote(path, HTTP_PATH_SAFE)
690
+ path = ESCAPED_CHAR_RE.sub(uppercase_escaped_char, path)
691
+ return path
692
+
693
+ def reach(h):
694
+ """Return reach of host h, as defined by RFC 2965, section 1.
695
+
696
+ The reach R of a host name H is defined as follows:
697
+
698
+ * If
699
+
700
+ - H is the host domain name of a host; and,
701
+
702
+ - H has the form A.B; and
703
+
704
+ - A has no embedded (that is, interior) dots; and
705
+
706
+ - B has at least one embedded dot, or B is the string "local".
707
+ then the reach of H is .B.
708
+
709
+ * Otherwise, the reach of H is H.
710
+
711
+ >>> reach("www.acme.com")
712
+ '.acme.com'
713
+ >>> reach("acme.com")
714
+ 'acme.com'
715
+ >>> reach("acme.local")
716
+ '.local'
717
+
718
+ """
719
+ i = h.find(".")
720
+ if i >= 0:
721
+ #a = h[:i] # this line is only here to show what a is
722
+ b = h[i+1:]
723
+ i = b.find(".")
724
+ if is_HDN(h) and (i >= 0 or b == "local"):
725
+ return "."+b
726
+ return h
727
+
728
+ def is_third_party(request):
729
+ """
730
+
731
+ RFC 2965, section 3.3.6:
732
+
733
+ An unverifiable transaction is to a third-party host if its request-
734
+ host U does not domain-match the reach R of the request-host O in the
735
+ origin transaction.
736
+
737
+ """
738
+ req_host = request_host(request)
739
+ if not domain_match(req_host, reach(request.origin_req_host)):
740
+ return True
741
+ else:
742
+ return False
743
+
744
+
745
+ class Cookie:
746
+ """HTTP Cookie.
747
+
748
+ This class represents both Netscape and RFC 2965 cookies.
749
+
750
+ This is deliberately a very simple class. It just holds attributes. It's
751
+ possible to construct Cookie instances that don't comply with the cookie
752
+ standards. CookieJar.make_cookies is the factory function for Cookie
753
+ objects -- it deals with cookie parsing, supplying defaults, and
754
+ normalising to the representation used in this class. CookiePolicy is
755
+ responsible for checking them to see whether they should be accepted from
756
+ and returned to the server.
757
+
758
+ Note that the port may be present in the headers, but unspecified ("Port"
759
+ rather than"Port=80", for example); if this is the case, port is None.
760
+
761
+ """
762
+
763
+ def __init__(self, version, name, value,
764
+ port, port_specified,
765
+ domain, domain_specified, domain_initial_dot,
766
+ path, path_specified,
767
+ secure,
768
+ expires,
769
+ discard,
770
+ comment,
771
+ comment_url,
772
+ rest,
773
+ rfc2109=False,
774
+ ):
775
+
776
+ if version is not None: version = int(version)
777
+ if expires is not None: expires = int(float(expires))
778
+ if port is None and port_specified is True:
779
+ raise ValueError("if port is None, port_specified must be false")
780
+
781
+ self.version = version
782
+ self.name = name
783
+ self.value = value
784
+ self.port = port
785
+ self.port_specified = port_specified
786
+ # normalise case, as per RFC 2965 section 3.3.3
787
+ self.domain = domain.lower()
788
+ self.domain_specified = domain_specified
789
+ # Sigh. We need to know whether the domain given in the
790
+ # cookie-attribute had an initial dot, in order to follow RFC 2965
791
+ # (as clarified in draft errata). Needed for the returned $Domain
792
+ # value.
793
+ self.domain_initial_dot = domain_initial_dot
794
+ self.path = path
795
+ self.path_specified = path_specified
796
+ self.secure = secure
797
+ self.expires = expires
798
+ self.discard = discard
799
+ self.comment = comment
800
+ self.comment_url = comment_url
801
+ self.rfc2109 = rfc2109
802
+
803
+ self._rest = copy.copy(rest)
804
+
805
+ def has_nonstandard_attr(self, name):
806
+ return name in self._rest
807
+ def get_nonstandard_attr(self, name, default=None):
808
+ return self._rest.get(name, default)
809
+ def set_nonstandard_attr(self, name, value):
810
+ self._rest[name] = value
811
+
812
+ def is_expired(self, now=None):
813
+ if now is None: now = time.time()
814
+ if (self.expires is not None) and (self.expires <= now):
815
+ return True
816
+ return False
817
+
818
+ def __str__(self):
819
+ if self.port is None: p = ""
820
+ else: p = ":"+self.port
821
+ limit = self.domain + p + self.path
822
+ if self.value is not None:
823
+ namevalue = "%s=%s" % (self.name, self.value)
824
+ else:
825
+ namevalue = self.name
826
+ return "<Cookie %s for %s>" % (namevalue, limit)
827
+
828
+ def __repr__(self):
829
+ args = []
830
+ for name in ("version", "name", "value",
831
+ "port", "port_specified",
832
+ "domain", "domain_specified", "domain_initial_dot",
833
+ "path", "path_specified",
834
+ "secure", "expires", "discard", "comment", "comment_url",
835
+ ):
836
+ attr = getattr(self, name)
837
+ args.append("%s=%s" % (name, repr(attr)))
838
+ args.append("rest=%s" % repr(self._rest))
839
+ args.append("rfc2109=%s" % repr(self.rfc2109))
840
+ return "%s(%s)" % (self.__class__.__name__, ", ".join(args))
841
+
842
+
843
+ class CookiePolicy:
844
+ """Defines which cookies get accepted from and returned to server.
845
+
846
+ May also modify cookies, though this is probably a bad idea.
847
+
848
+ The subclass DefaultCookiePolicy defines the standard rules for Netscape
849
+ and RFC 2965 cookies -- override that if you want a customized policy.
850
+
851
+ """
852
+ def set_ok(self, cookie, request):
853
+ """Return true if (and only if) cookie should be accepted from server.
854
+
855
+ Currently, pre-expired cookies never get this far -- the CookieJar
856
+ class deletes such cookies itself.
857
+
858
+ """
859
+ raise NotImplementedError()
860
+
861
+ def return_ok(self, cookie, request):
862
+ """Return true if (and only if) cookie should be returned to server."""
863
+ raise NotImplementedError()
864
+
865
+ def domain_return_ok(self, domain, request):
866
+ """Return false if cookies should not be returned, given cookie domain.
867
+ """
868
+ return True
869
+
870
+ def path_return_ok(self, path, request):
871
+ """Return false if cookies should not be returned, given cookie path.
872
+ """
873
+ return True
874
+
875
+
876
+ class DefaultCookiePolicy(CookiePolicy):
877
+ """Implements the standard rules for accepting and returning cookies."""
878
+
879
+ DomainStrictNoDots = 1
880
+ DomainStrictNonDomain = 2
881
+ DomainRFC2965Match = 4
882
+
883
+ DomainLiberal = 0
884
+ DomainStrict = DomainStrictNoDots|DomainStrictNonDomain
885
+
886
+ def __init__(self,
887
+ blocked_domains=None, allowed_domains=None,
888
+ netscape=True, rfc2965=False,
889
+ rfc2109_as_netscape=None,
890
+ hide_cookie2=False,
891
+ strict_domain=False,
892
+ strict_rfc2965_unverifiable=True,
893
+ strict_ns_unverifiable=False,
894
+ strict_ns_domain=DomainLiberal,
895
+ strict_ns_set_initial_dollar=False,
896
+ strict_ns_set_path=False,
897
+ secure_protocols=("https", "wss")
898
+ ):
899
+ """Constructor arguments should be passed as keyword arguments only."""
900
+ self.netscape = netscape
901
+ self.rfc2965 = rfc2965
902
+ self.rfc2109_as_netscape = rfc2109_as_netscape
903
+ self.hide_cookie2 = hide_cookie2
904
+ self.strict_domain = strict_domain
905
+ self.strict_rfc2965_unverifiable = strict_rfc2965_unverifiable
906
+ self.strict_ns_unverifiable = strict_ns_unverifiable
907
+ self.strict_ns_domain = strict_ns_domain
908
+ self.strict_ns_set_initial_dollar = strict_ns_set_initial_dollar
909
+ self.strict_ns_set_path = strict_ns_set_path
910
+ self.secure_protocols = secure_protocols
911
+
912
+ if blocked_domains is not None:
913
+ self._blocked_domains = tuple(blocked_domains)
914
+ else:
915
+ self._blocked_domains = ()
916
+
917
+ if allowed_domains is not None:
918
+ allowed_domains = tuple(allowed_domains)
919
+ self._allowed_domains = allowed_domains
920
+
921
+ def blocked_domains(self):
922
+ """Return the sequence of blocked domains (as a tuple)."""
923
+ return self._blocked_domains
924
+ def set_blocked_domains(self, blocked_domains):
925
+ """Set the sequence of blocked domains."""
926
+ self._blocked_domains = tuple(blocked_domains)
927
+
928
+ def is_blocked(self, domain):
929
+ for blocked_domain in self._blocked_domains:
930
+ if user_domain_match(domain, blocked_domain):
931
+ return True
932
+ return False
933
+
934
+ def allowed_domains(self):
935
+ """Return None, or the sequence of allowed domains (as a tuple)."""
936
+ return self._allowed_domains
937
+ def set_allowed_domains(self, allowed_domains):
938
+ """Set the sequence of allowed domains, or None."""
939
+ if allowed_domains is not None:
940
+ allowed_domains = tuple(allowed_domains)
941
+ self._allowed_domains = allowed_domains
942
+
943
+ def is_not_allowed(self, domain):
944
+ if self._allowed_domains is None:
945
+ return False
946
+ for allowed_domain in self._allowed_domains:
947
+ if user_domain_match(domain, allowed_domain):
948
+ return False
949
+ return True
950
+
951
+ def set_ok(self, cookie, request):
952
+ """
953
+ If you override .set_ok(), be sure to call this method. If it returns
954
+ false, so should your subclass (assuming your subclass wants to be more
955
+ strict about which cookies to accept).
956
+
957
+ """
958
+ _debug(" - checking cookie %s=%s", cookie.name, cookie.value)
959
+
960
+ assert cookie.name is not None
961
+
962
+ for n in "version", "verifiability", "name", "path", "domain", "port":
963
+ fn_name = "set_ok_"+n
964
+ fn = getattr(self, fn_name)
965
+ if not fn(cookie, request):
966
+ return False
967
+
968
+ return True
969
+
970
+ def set_ok_version(self, cookie, request):
971
+ if cookie.version is None:
972
+ # Version is always set to 0 by parse_ns_headers if it's a Netscape
973
+ # cookie, so this must be an invalid RFC 2965 cookie.
974
+ _debug(" Set-Cookie2 without version attribute (%s=%s)",
975
+ cookie.name, cookie.value)
976
+ return False
977
+ if cookie.version > 0 and not self.rfc2965:
978
+ _debug(" RFC 2965 cookies are switched off")
979
+ return False
980
+ elif cookie.version == 0 and not self.netscape:
981
+ _debug(" Netscape cookies are switched off")
982
+ return False
983
+ return True
984
+
985
+ def set_ok_verifiability(self, cookie, request):
986
+ if request.unverifiable and is_third_party(request):
987
+ if cookie.version > 0 and self.strict_rfc2965_unverifiable:
988
+ _debug(" third-party RFC 2965 cookie during "
989
+ "unverifiable transaction")
990
+ return False
991
+ elif cookie.version == 0 and self.strict_ns_unverifiable:
992
+ _debug(" third-party Netscape cookie during "
993
+ "unverifiable transaction")
994
+ return False
995
+ return True
996
+
997
+ def set_ok_name(self, cookie, request):
998
+ # Try and stop servers setting V0 cookies designed to hack other
999
+ # servers that know both V0 and V1 protocols.
1000
+ if (cookie.version == 0 and self.strict_ns_set_initial_dollar and
1001
+ cookie.name.startswith("$")):
1002
+ _debug(" illegal name (starts with '$'): '%s'", cookie.name)
1003
+ return False
1004
+ return True
1005
+
1006
+ def set_ok_path(self, cookie, request):
1007
+ if cookie.path_specified:
1008
+ req_path = request_path(request)
1009
+ if ((cookie.version > 0 or
1010
+ (cookie.version == 0 and self.strict_ns_set_path)) and
1011
+ not self.path_return_ok(cookie.path, request)):
1012
+ _debug(" path attribute %s is not a prefix of request "
1013
+ "path %s", cookie.path, req_path)
1014
+ return False
1015
+ return True
1016
+
1017
+ def set_ok_domain(self, cookie, request):
1018
+ if self.is_blocked(cookie.domain):
1019
+ _debug(" domain %s is in user block-list", cookie.domain)
1020
+ return False
1021
+ if self.is_not_allowed(cookie.domain):
1022
+ _debug(" domain %s is not in user allow-list", cookie.domain)
1023
+ return False
1024
+ if cookie.domain_specified:
1025
+ req_host, erhn = eff_request_host(request)
1026
+ domain = cookie.domain
1027
+ if self.strict_domain and (domain.count(".") >= 2):
1028
+ # XXX This should probably be compared with the Konqueror
1029
+ # (kcookiejar.cpp) and Mozilla implementations, but it's a
1030
+ # losing battle.
1031
+ i = domain.rfind(".")
1032
+ j = domain.rfind(".", 0, i)
1033
+ if j == 0: # domain like .foo.bar
1034
+ tld = domain[i+1:]
1035
+ sld = domain[j+1:i]
1036
+ if sld.lower() in ("co", "ac", "com", "edu", "org", "net",
1037
+ "gov", "mil", "int", "aero", "biz", "cat", "coop",
1038
+ "info", "jobs", "mobi", "museum", "name", "pro",
1039
+ "travel", "eu") and len(tld) == 2:
1040
+ # domain like .co.uk
1041
+ _debug(" country-code second level domain %s", domain)
1042
+ return False
1043
+ if domain.startswith("."):
1044
+ undotted_domain = domain[1:]
1045
+ else:
1046
+ undotted_domain = domain
1047
+ embedded_dots = (undotted_domain.find(".") >= 0)
1048
+ if not embedded_dots and not erhn.endswith(".local"):
1049
+ _debug(" non-local domain %s contains no embedded dot",
1050
+ domain)
1051
+ return False
1052
+ if cookie.version == 0:
1053
+ if (not (erhn.endswith(domain) or
1054
+ erhn.endswith(f"{undotted_domain}.local")) and
1055
+ (not erhn.startswith(".") and
1056
+ not ("."+erhn).endswith(domain))):
1057
+ _debug(" effective request-host %s (even with added "
1058
+ "initial dot) does not end with %s",
1059
+ erhn, domain)
1060
+ return False
1061
+ if (cookie.version > 0 or
1062
+ (self.strict_ns_domain & self.DomainRFC2965Match)):
1063
+ if not domain_match(erhn, domain):
1064
+ _debug(" effective request-host %s does not domain-match "
1065
+ "%s", erhn, domain)
1066
+ return False
1067
+ if (cookie.version > 0 or
1068
+ (self.strict_ns_domain & self.DomainStrictNoDots)):
1069
+ host_prefix = req_host[:-len(domain)]
1070
+ if (host_prefix.find(".") >= 0 and
1071
+ not IPV4_RE.search(req_host)):
1072
+ _debug(" host prefix %s for domain %s contains a dot",
1073
+ host_prefix, domain)
1074
+ return False
1075
+ return True
1076
+
1077
+ def set_ok_port(self, cookie, request):
1078
+ if cookie.port_specified:
1079
+ req_port = request_port(request)
1080
+ if req_port is None:
1081
+ req_port = "80"
1082
+ else:
1083
+ req_port = str(req_port)
1084
+ for p in cookie.port.split(","):
1085
+ try:
1086
+ int(p)
1087
+ except ValueError:
1088
+ _debug(" bad port %s (not numeric)", p)
1089
+ return False
1090
+ if p == req_port:
1091
+ break
1092
+ else:
1093
+ _debug(" request port (%s) not found in %s",
1094
+ req_port, cookie.port)
1095
+ return False
1096
+ return True
1097
+
1098
+ def return_ok(self, cookie, request):
1099
+ """
1100
+ If you override .return_ok(), be sure to call this method. If it
1101
+ returns false, so should your subclass (assuming your subclass wants to
1102
+ be more strict about which cookies to return).
1103
+
1104
+ """
1105
+ # Path has already been checked by .path_return_ok(), and domain
1106
+ # blocking done by .domain_return_ok().
1107
+ _debug(" - checking cookie %s=%s", cookie.name, cookie.value)
1108
+
1109
+ for n in "version", "verifiability", "secure", "expires", "port", "domain":
1110
+ fn_name = "return_ok_"+n
1111
+ fn = getattr(self, fn_name)
1112
+ if not fn(cookie, request):
1113
+ return False
1114
+ return True
1115
+
1116
+ def return_ok_version(self, cookie, request):
1117
+ if cookie.version > 0 and not self.rfc2965:
1118
+ _debug(" RFC 2965 cookies are switched off")
1119
+ return False
1120
+ elif cookie.version == 0 and not self.netscape:
1121
+ _debug(" Netscape cookies are switched off")
1122
+ return False
1123
+ return True
1124
+
1125
+ def return_ok_verifiability(self, cookie, request):
1126
+ if request.unverifiable and is_third_party(request):
1127
+ if cookie.version > 0 and self.strict_rfc2965_unverifiable:
1128
+ _debug(" third-party RFC 2965 cookie during unverifiable "
1129
+ "transaction")
1130
+ return False
1131
+ elif cookie.version == 0 and self.strict_ns_unverifiable:
1132
+ _debug(" third-party Netscape cookie during unverifiable "
1133
+ "transaction")
1134
+ return False
1135
+ return True
1136
+
1137
+ def return_ok_secure(self, cookie, request):
1138
+ if cookie.secure and request.type not in self.secure_protocols:
1139
+ _debug(" secure cookie with non-secure request")
1140
+ return False
1141
+ return True
1142
+
1143
+ def return_ok_expires(self, cookie, request):
1144
+ if cookie.is_expired(self._now):
1145
+ _debug(" cookie expired")
1146
+ return False
1147
+ return True
1148
+
1149
+ def return_ok_port(self, cookie, request):
1150
+ if cookie.port:
1151
+ req_port = request_port(request)
1152
+ if req_port is None:
1153
+ req_port = "80"
1154
+ for p in cookie.port.split(","):
1155
+ if p == req_port:
1156
+ break
1157
+ else:
1158
+ _debug(" request port %s does not match cookie port %s",
1159
+ req_port, cookie.port)
1160
+ return False
1161
+ return True
1162
+
1163
+ def return_ok_domain(self, cookie, request):
1164
+ req_host, erhn = eff_request_host(request)
1165
+ domain = cookie.domain
1166
+
1167
+ if domain and not domain.startswith("."):
1168
+ dotdomain = "." + domain
1169
+ else:
1170
+ dotdomain = domain
1171
+
1172
+ # strict check of non-domain cookies: Mozilla does this, MSIE5 doesn't
1173
+ if (cookie.version == 0 and
1174
+ (self.strict_ns_domain & self.DomainStrictNonDomain) and
1175
+ not cookie.domain_specified and domain != erhn):
1176
+ _debug(" cookie with unspecified domain does not string-compare "
1177
+ "equal to request domain")
1178
+ return False
1179
+
1180
+ if cookie.version > 0 and not domain_match(erhn, domain):
1181
+ _debug(" effective request-host name %s does not domain-match "
1182
+ "RFC 2965 cookie domain %s", erhn, domain)
1183
+ return False
1184
+ if cookie.version == 0 and not ("."+erhn).endswith(dotdomain):
1185
+ _debug(" request-host %s does not match Netscape cookie domain "
1186
+ "%s", req_host, domain)
1187
+ return False
1188
+ return True
1189
+
1190
+ def domain_return_ok(self, domain, request):
1191
+ # Liberal check of. This is here as an optimization to avoid
1192
+ # having to load lots of MSIE cookie files unless necessary.
1193
+ req_host, erhn = eff_request_host(request)
1194
+ if not req_host.startswith("."):
1195
+ req_host = "."+req_host
1196
+ if not erhn.startswith("."):
1197
+ erhn = "."+erhn
1198
+ if domain and not domain.startswith("."):
1199
+ dotdomain = "." + domain
1200
+ else:
1201
+ dotdomain = domain
1202
+ if not (req_host.endswith(dotdomain) or erhn.endswith(dotdomain)):
1203
+ #_debug(" request domain %s does not match cookie domain %s",
1204
+ # req_host, domain)
1205
+ return False
1206
+
1207
+ if self.is_blocked(domain):
1208
+ _debug(" domain %s is in user block-list", domain)
1209
+ return False
1210
+ if self.is_not_allowed(domain):
1211
+ _debug(" domain %s is not in user allow-list", domain)
1212
+ return False
1213
+
1214
+ return True
1215
+
1216
+ def path_return_ok(self, path, request):
1217
+ _debug("- checking cookie path=%s", path)
1218
+ req_path = request_path(request)
1219
+ pathlen = len(path)
1220
+ if req_path == path:
1221
+ return True
1222
+ elif (req_path.startswith(path) and
1223
+ (path.endswith("/") or req_path[pathlen:pathlen+1] == "/")):
1224
+ return True
1225
+
1226
+ _debug(" %s does not path-match %s", req_path, path)
1227
+ return False
1228
+
1229
+ def deepvalues(mapping):
1230
+ """Iterates over nested mapping, depth-first"""
1231
+ for obj in list(mapping.values()):
1232
+ mapping = False
1233
+ try:
1234
+ obj.items
1235
+ except AttributeError:
1236
+ pass
1237
+ else:
1238
+ mapping = True
1239
+ yield from deepvalues(obj)
1240
+ if not mapping:
1241
+ yield obj
1242
+
1243
+
1244
+ # Used as second parameter to dict.get() method, to distinguish absent
1245
+ # dict key from one with a None value.
1246
+ class Absent: pass
1247
+
1248
+ class CookieJar:
1249
+ """Collection of HTTP cookies.
1250
+
1251
+ You may not need to know about this class: try
1252
+ urllib.request.build_opener(HTTPCookieProcessor).open(url).
1253
+ """
1254
+
1255
+ non_word_re = re.compile(r"\W")
1256
+ quote_re = re.compile(r"([\"\\])")
1257
+ strict_domain_re = re.compile(r"\.?[^.]*")
1258
+ domain_re = re.compile(r"[^.]*")
1259
+ dots_re = re.compile(r"^\.+")
1260
+
1261
+ magic_re = re.compile(r"^\#LWP-Cookies-(\d+\.\d+)", re.ASCII)
1262
+
1263
+ def __init__(self, policy=None):
1264
+ if policy is None:
1265
+ policy = DefaultCookiePolicy()
1266
+ self._policy = policy
1267
+
1268
+ self._cookies_lock = _threading.RLock()
1269
+ self._cookies = {}
1270
+
1271
+ def set_policy(self, policy):
1272
+ self._policy = policy
1273
+
1274
+ def _cookies_for_domain(self, domain, request):
1275
+ cookies = []
1276
+ if not self._policy.domain_return_ok(domain, request):
1277
+ return []
1278
+ _debug("Checking %s for cookies to return", domain)
1279
+ cookies_by_path = self._cookies[domain]
1280
+ for path in cookies_by_path.keys():
1281
+ if not self._policy.path_return_ok(path, request):
1282
+ continue
1283
+ cookies_by_name = cookies_by_path[path]
1284
+ for cookie in cookies_by_name.values():
1285
+ if not self._policy.return_ok(cookie, request):
1286
+ _debug(" not returning cookie")
1287
+ continue
1288
+ _debug(" it's a match")
1289
+ cookies.append(cookie)
1290
+ return cookies
1291
+
1292
+ def _cookies_for_request(self, request):
1293
+ """Return a list of cookies to be returned to server."""
1294
+ cookies = []
1295
+ for domain in self._cookies.keys():
1296
+ cookies.extend(self._cookies_for_domain(domain, request))
1297
+ return cookies
1298
+
1299
+ def _cookie_attrs(self, cookies):
1300
+ """Return a list of cookie-attributes to be returned to server.
1301
+
1302
+ like ['foo="bar"; $Path="/"', ...]
1303
+
1304
+ The $Version attribute is also added when appropriate (currently only
1305
+ once per request).
1306
+
1307
+ """
1308
+ # add cookies in order of most specific (ie. longest) path first
1309
+ cookies.sort(key=lambda a: len(a.path), reverse=True)
1310
+
1311
+ version_set = False
1312
+
1313
+ attrs = []
1314
+ for cookie in cookies:
1315
+ # set version of Cookie header
1316
+ # XXX
1317
+ # What should it be if multiple matching Set-Cookie headers have
1318
+ # different versions themselves?
1319
+ # Answer: there is no answer; was supposed to be settled by
1320
+ # RFC 2965 errata, but that may never appear...
1321
+ version = cookie.version
1322
+ if not version_set:
1323
+ version_set = True
1324
+ if version > 0:
1325
+ attrs.append("$Version=%s" % version)
1326
+
1327
+ # quote cookie value if necessary
1328
+ # (not for Netscape protocol, which already has any quotes
1329
+ # intact, due to the poorly-specified Netscape Cookie: syntax)
1330
+ if ((cookie.value is not None) and
1331
+ self.non_word_re.search(cookie.value) and version > 0):
1332
+ value = self.quote_re.sub(r"\\\1", cookie.value)
1333
+ else:
1334
+ value = cookie.value
1335
+
1336
+ # add cookie-attributes to be returned in Cookie header
1337
+ if cookie.value is None:
1338
+ attrs.append(cookie.name)
1339
+ else:
1340
+ attrs.append("%s=%s" % (cookie.name, value))
1341
+ if version > 0:
1342
+ if cookie.path_specified:
1343
+ attrs.append('$Path="%s"' % cookie.path)
1344
+ if cookie.domain.startswith("."):
1345
+ domain = cookie.domain
1346
+ if (not cookie.domain_initial_dot and
1347
+ domain.startswith(".")):
1348
+ domain = domain[1:]
1349
+ attrs.append('$Domain="%s"' % domain)
1350
+ if cookie.port is not None:
1351
+ p = "$Port"
1352
+ if cookie.port_specified:
1353
+ p = p + ('="%s"' % cookie.port)
1354
+ attrs.append(p)
1355
+
1356
+ return attrs
1357
+
1358
+ def add_cookie_header(self, request):
1359
+ """Add correct Cookie: header to request (urllib.request.Request object).
1360
+
1361
+ The Cookie2 header is also added unless policy.hide_cookie2 is true.
1362
+
1363
+ """
1364
+ _debug("add_cookie_header")
1365
+ self._cookies_lock.acquire()
1366
+ try:
1367
+
1368
+ self._policy._now = self._now = int(time.time())
1369
+
1370
+ cookies = self._cookies_for_request(request)
1371
+
1372
+ attrs = self._cookie_attrs(cookies)
1373
+ if attrs:
1374
+ if not request.has_header("Cookie"):
1375
+ request.add_unredirected_header(
1376
+ "Cookie", "; ".join(attrs))
1377
+
1378
+ # if necessary, advertise that we know RFC 2965
1379
+ if (self._policy.rfc2965 and not self._policy.hide_cookie2 and
1380
+ not request.has_header("Cookie2")):
1381
+ for cookie in cookies:
1382
+ if cookie.version != 1:
1383
+ request.add_unredirected_header("Cookie2", '$Version="1"')
1384
+ break
1385
+
1386
+ finally:
1387
+ self._cookies_lock.release()
1388
+
1389
+ self.clear_expired_cookies()
1390
+
1391
+ def _normalized_cookie_tuples(self, attrs_set):
1392
+ """Return list of tuples containing normalised cookie information.
1393
+
1394
+ attrs_set is the list of lists of key,value pairs extracted from
1395
+ the Set-Cookie or Set-Cookie2 headers.
1396
+
1397
+ Tuples are name, value, standard, rest, where name and value are the
1398
+ cookie name and value, standard is a dictionary containing the standard
1399
+ cookie-attributes (discard, secure, version, expires or max-age,
1400
+ domain, path and port) and rest is a dictionary containing the rest of
1401
+ the cookie-attributes.
1402
+
1403
+ """
1404
+ cookie_tuples = []
1405
+
1406
+ boolean_attrs = "discard", "secure"
1407
+ value_attrs = ("version",
1408
+ "expires", "max-age",
1409
+ "domain", "path", "port",
1410
+ "comment", "commenturl")
1411
+
1412
+ for cookie_attrs in attrs_set:
1413
+ name, value = cookie_attrs[0]
1414
+
1415
+ # Build dictionary of standard cookie-attributes (standard) and
1416
+ # dictionary of other cookie-attributes (rest).
1417
+
1418
+ # Note: expiry time is normalised to seconds since epoch. V0
1419
+ # cookies should have the Expires cookie-attribute, and V1 cookies
1420
+ # should have Max-Age, but since V1 includes RFC 2109 cookies (and
1421
+ # since V0 cookies may be a mish-mash of Netscape and RFC 2109), we
1422
+ # accept either (but prefer Max-Age).
1423
+ max_age_set = False
1424
+
1425
+ bad_cookie = False
1426
+
1427
+ standard = {}
1428
+ rest = {}
1429
+ for k, v in cookie_attrs[1:]:
1430
+ lc = k.lower()
1431
+ # don't lose case distinction for unknown fields
1432
+ if lc in value_attrs or lc in boolean_attrs:
1433
+ k = lc
1434
+ if k in boolean_attrs and v is None:
1435
+ # boolean cookie-attribute is present, but has no value
1436
+ # (like "discard", rather than "port=80")
1437
+ v = True
1438
+ if k in standard:
1439
+ # only first value is significant
1440
+ continue
1441
+ if k == "domain":
1442
+ if v is None:
1443
+ _debug(" missing value for domain attribute")
1444
+ bad_cookie = True
1445
+ break
1446
+ # RFC 2965 section 3.3.3
1447
+ v = v.lower()
1448
+ if k == "expires":
1449
+ if max_age_set:
1450
+ # Prefer max-age to expires (like Mozilla)
1451
+ continue
1452
+ if v is None:
1453
+ _debug(" missing or invalid value for expires "
1454
+ "attribute: treating as session cookie")
1455
+ continue
1456
+ if k == "max-age":
1457
+ max_age_set = True
1458
+ try:
1459
+ v = int(v)
1460
+ except ValueError:
1461
+ _debug(" missing or invalid (non-numeric) value for "
1462
+ "max-age attribute")
1463
+ bad_cookie = True
1464
+ break
1465
+ # convert RFC 2965 Max-Age to seconds since epoch
1466
+ # XXX Strictly you're supposed to follow RFC 2616
1467
+ # age-calculation rules. Remember that zero Max-Age
1468
+ # is a request to discard (old and new) cookie, though.
1469
+ k = "expires"
1470
+ v = self._now + v
1471
+ if (k in value_attrs) or (k in boolean_attrs):
1472
+ if (v is None and
1473
+ k not in ("port", "comment", "commenturl")):
1474
+ _debug(" missing value for %s attribute" % k)
1475
+ bad_cookie = True
1476
+ break
1477
+ standard[k] = v
1478
+ else:
1479
+ rest[k] = v
1480
+
1481
+ if bad_cookie:
1482
+ continue
1483
+
1484
+ cookie_tuples.append((name, value, standard, rest))
1485
+
1486
+ return cookie_tuples
1487
+
1488
+ def _cookie_from_cookie_tuple(self, tup, request):
1489
+ # standard is dict of standard cookie-attributes, rest is dict of the
1490
+ # rest of them
1491
+ name, value, standard, rest = tup
1492
+
1493
+ domain = standard.get("domain", Absent)
1494
+ path = standard.get("path", Absent)
1495
+ port = standard.get("port", Absent)
1496
+ expires = standard.get("expires", Absent)
1497
+
1498
+ # set the easy defaults
1499
+ version = standard.get("version", None)
1500
+ if version is not None:
1501
+ try:
1502
+ version = int(version)
1503
+ except ValueError:
1504
+ return None # invalid version, ignore cookie
1505
+ secure = standard.get("secure", False)
1506
+ # (discard is also set if expires is Absent)
1507
+ discard = standard.get("discard", False)
1508
+ comment = standard.get("comment", None)
1509
+ comment_url = standard.get("commenturl", None)
1510
+
1511
+ # set default path
1512
+ if path is not Absent and path != "":
1513
+ path_specified = True
1514
+ path = escape_path(path)
1515
+ else:
1516
+ path_specified = False
1517
+ path = request_path(request)
1518
+ i = path.rfind("/")
1519
+ if i != -1:
1520
+ if version == 0:
1521
+ # Netscape spec parts company from reality here
1522
+ path = path[:i]
1523
+ else:
1524
+ path = path[:i+1]
1525
+ if len(path) == 0: path = "/"
1526
+
1527
+ # set default domain
1528
+ domain_specified = domain is not Absent
1529
+ # but first we have to remember whether it starts with a dot
1530
+ domain_initial_dot = False
1531
+ if domain_specified:
1532
+ domain_initial_dot = bool(domain.startswith("."))
1533
+ if domain is Absent:
1534
+ req_host, erhn = eff_request_host(request)
1535
+ domain = erhn
1536
+ elif not domain.startswith("."):
1537
+ domain = "."+domain
1538
+
1539
+ # set default port
1540
+ port_specified = False
1541
+ if port is not Absent:
1542
+ if port is None:
1543
+ # Port attr present, but has no value: default to request port.
1544
+ # Cookie should then only be sent back on that port.
1545
+ port = request_port(request)
1546
+ else:
1547
+ port_specified = True
1548
+ port = re.sub(r"\s+", "", port)
1549
+ else:
1550
+ # No port attr present. Cookie can be sent back on any port.
1551
+ port = None
1552
+
1553
+ # set default expires and discard
1554
+ if expires is Absent:
1555
+ expires = None
1556
+ discard = True
1557
+ elif expires <= self._now:
1558
+ # Expiry date in past is request to delete cookie. This can't be
1559
+ # in DefaultCookiePolicy, because can't delete cookies there.
1560
+ try:
1561
+ self.clear(domain, path, name)
1562
+ except KeyError:
1563
+ pass
1564
+ _debug("Expiring cookie, domain='%s', path='%s', name='%s'",
1565
+ domain, path, name)
1566
+ return None
1567
+
1568
+ return Cookie(version,
1569
+ name, value,
1570
+ port, port_specified,
1571
+ domain, domain_specified, domain_initial_dot,
1572
+ path, path_specified,
1573
+ secure,
1574
+ expires,
1575
+ discard,
1576
+ comment,
1577
+ comment_url,
1578
+ rest)
1579
+
1580
+ def _cookies_from_attrs_set(self, attrs_set, request):
1581
+ cookie_tuples = self._normalized_cookie_tuples(attrs_set)
1582
+
1583
+ cookies = []
1584
+ for tup in cookie_tuples:
1585
+ cookie = self._cookie_from_cookie_tuple(tup, request)
1586
+ if cookie: cookies.append(cookie)
1587
+ return cookies
1588
+
1589
+ def _process_rfc2109_cookies(self, cookies):
1590
+ rfc2109_as_ns = getattr(self._policy, 'rfc2109_as_netscape', None)
1591
+ if rfc2109_as_ns is None:
1592
+ rfc2109_as_ns = not self._policy.rfc2965
1593
+ for cookie in cookies:
1594
+ if cookie.version == 1:
1595
+ cookie.rfc2109 = True
1596
+ if rfc2109_as_ns:
1597
+ # treat 2109 cookies as Netscape cookies rather than
1598
+ # as RFC2965 cookies
1599
+ cookie.version = 0
1600
+
1601
+ def make_cookies(self, response, request):
1602
+ """Return sequence of Cookie objects extracted from response object."""
1603
+ # get cookie-attributes for RFC 2965 and Netscape protocols
1604
+ headers = response.info()
1605
+ rfc2965_hdrs = headers.get_all("Set-Cookie2", [])
1606
+ ns_hdrs = headers.get_all("Set-Cookie", [])
1607
+ self._policy._now = self._now = int(time.time())
1608
+
1609
+ rfc2965 = self._policy.rfc2965
1610
+ netscape = self._policy.netscape
1611
+
1612
+ if ((not rfc2965_hdrs and not ns_hdrs) or
1613
+ (not ns_hdrs and not rfc2965) or
1614
+ (not rfc2965_hdrs and not netscape) or
1615
+ (not netscape and not rfc2965)):
1616
+ return [] # no relevant cookie headers: quick exit
1617
+
1618
+ try:
1619
+ cookies = self._cookies_from_attrs_set(
1620
+ split_header_words(rfc2965_hdrs), request)
1621
+ except Exception:
1622
+ _warn_unhandled_exception()
1623
+ cookies = []
1624
+
1625
+ if ns_hdrs and netscape:
1626
+ try:
1627
+ # RFC 2109 and Netscape cookies
1628
+ ns_cookies = self._cookies_from_attrs_set(
1629
+ parse_ns_headers(ns_hdrs), request)
1630
+ except Exception:
1631
+ _warn_unhandled_exception()
1632
+ ns_cookies = []
1633
+ self._process_rfc2109_cookies(ns_cookies)
1634
+
1635
+ # Look for Netscape cookies (from Set-Cookie headers) that match
1636
+ # corresponding RFC 2965 cookies (from Set-Cookie2 headers).
1637
+ # For each match, keep the RFC 2965 cookie and ignore the Netscape
1638
+ # cookie (RFC 2965 section 9.1). Actually, RFC 2109 cookies are
1639
+ # bundled in with the Netscape cookies for this purpose, which is
1640
+ # reasonable behaviour.
1641
+ if rfc2965:
1642
+ lookup = {}
1643
+ for cookie in cookies:
1644
+ lookup[(cookie.domain, cookie.path, cookie.name)] = None
1645
+
1646
+ def no_matching_rfc2965(ns_cookie, lookup=lookup):
1647
+ key = ns_cookie.domain, ns_cookie.path, ns_cookie.name
1648
+ return key not in lookup
1649
+ ns_cookies = filter(no_matching_rfc2965, ns_cookies)
1650
+
1651
+ if ns_cookies:
1652
+ cookies.extend(ns_cookies)
1653
+
1654
+ return cookies
1655
+
1656
+ def set_cookie_if_ok(self, cookie, request):
1657
+ """Set a cookie if policy says it's OK to do so."""
1658
+ self._cookies_lock.acquire()
1659
+ try:
1660
+ self._policy._now = self._now = int(time.time())
1661
+
1662
+ if self._policy.set_ok(cookie, request):
1663
+ self.set_cookie(cookie)
1664
+
1665
+
1666
+ finally:
1667
+ self._cookies_lock.release()
1668
+
1669
+ def set_cookie(self, cookie):
1670
+ """Set a cookie, without checking whether or not it should be set."""
1671
+ c = self._cookies
1672
+ self._cookies_lock.acquire()
1673
+ try:
1674
+ if cookie.domain not in c: c[cookie.domain] = {}
1675
+ c2 = c[cookie.domain]
1676
+ if cookie.path not in c2: c2[cookie.path] = {}
1677
+ c3 = c2[cookie.path]
1678
+ c3[cookie.name] = cookie
1679
+ finally:
1680
+ self._cookies_lock.release()
1681
+
1682
+ def extract_cookies(self, response, request):
1683
+ """Extract cookies from response, where allowable given the request."""
1684
+ _debug("extract_cookies: %s", response.info())
1685
+ self._cookies_lock.acquire()
1686
+ try:
1687
+ for cookie in self.make_cookies(response, request):
1688
+ if self._policy.set_ok(cookie, request):
1689
+ _debug(" setting cookie: %s", cookie)
1690
+ self.set_cookie(cookie)
1691
+ finally:
1692
+ self._cookies_lock.release()
1693
+
1694
+ def clear(self, domain=None, path=None, name=None):
1695
+ """Clear some cookies.
1696
+
1697
+ Invoking this method without arguments will clear all cookies. If
1698
+ given a single argument, only cookies belonging to that domain will be
1699
+ removed. If given two arguments, cookies belonging to the specified
1700
+ path within that domain are removed. If given three arguments, then
1701
+ the cookie with the specified name, path and domain is removed.
1702
+
1703
+ Raises KeyError if no matching cookie exists.
1704
+
1705
+ """
1706
+ if name is not None:
1707
+ if (domain is None) or (path is None):
1708
+ raise ValueError(
1709
+ "domain and path must be given to remove a cookie by name")
1710
+ del self._cookies[domain][path][name]
1711
+ elif path is not None:
1712
+ if domain is None:
1713
+ raise ValueError(
1714
+ "domain must be given to remove cookies by path")
1715
+ del self._cookies[domain][path]
1716
+ elif domain is not None:
1717
+ del self._cookies[domain]
1718
+ else:
1719
+ self._cookies = {}
1720
+
1721
+ def clear_session_cookies(self):
1722
+ """Discard all session cookies.
1723
+
1724
+ Note that the .save() method won't save session cookies anyway, unless
1725
+ you ask otherwise by passing a true ignore_discard argument.
1726
+
1727
+ """
1728
+ self._cookies_lock.acquire()
1729
+ try:
1730
+ for cookie in self:
1731
+ if cookie.discard:
1732
+ self.clear(cookie.domain, cookie.path, cookie.name)
1733
+ finally:
1734
+ self._cookies_lock.release()
1735
+
1736
+ def clear_expired_cookies(self):
1737
+ """Discard all expired cookies.
1738
+
1739
+ You probably don't need to call this method: expired cookies are never
1740
+ sent back to the server (provided you're using DefaultCookiePolicy),
1741
+ this method is called by CookieJar itself every so often, and the
1742
+ .save() method won't save expired cookies anyway (unless you ask
1743
+ otherwise by passing a true ignore_expires argument).
1744
+
1745
+ """
1746
+ self._cookies_lock.acquire()
1747
+ try:
1748
+ now = time.time()
1749
+ for cookie in self:
1750
+ if cookie.is_expired(now):
1751
+ self.clear(cookie.domain, cookie.path, cookie.name)
1752
+ finally:
1753
+ self._cookies_lock.release()
1754
+
1755
+ def __iter__(self):
1756
+ return deepvalues(self._cookies)
1757
+
1758
+ def __len__(self):
1759
+ """Return number of contained cookies."""
1760
+ i = 0
1761
+ for cookie in self: i = i + 1
1762
+ return i
1763
+
1764
+ def __repr__(self):
1765
+ r = []
1766
+ for cookie in self: r.append(repr(cookie))
1767
+ return "<%s[%s]>" % (self.__class__.__name__, ", ".join(r))
1768
+
1769
+ def __str__(self):
1770
+ r = []
1771
+ for cookie in self: r.append(str(cookie))
1772
+ return "<%s[%s]>" % (self.__class__.__name__, ", ".join(r))
1773
+
1774
+
1775
+ # derives from OSError for backwards-compatibility with Python 2.4.0
1776
+ class LoadError(OSError): pass
1777
+
1778
+ class FileCookieJar(CookieJar):
1779
+ """CookieJar that can be loaded from and saved to a file."""
1780
+
1781
+ def __init__(self, filename=None, delayload=False, policy=None):
1782
+ """
1783
+ Cookies are NOT loaded from the named file until either the .load() or
1784
+ .revert() method is called.
1785
+
1786
+ """
1787
+ CookieJar.__init__(self, policy)
1788
+ if filename is not None:
1789
+ filename = os.fspath(filename)
1790
+ self.filename = filename
1791
+ self.delayload = bool(delayload)
1792
+
1793
+ def save(self, filename=None, ignore_discard=False, ignore_expires=False):
1794
+ """Save cookies to a file."""
1795
+ raise NotImplementedError()
1796
+
1797
+ def load(self, filename=None, ignore_discard=False, ignore_expires=False):
1798
+ """Load cookies from a file."""
1799
+ if filename is None:
1800
+ if self.filename is not None: filename = self.filename
1801
+ else: raise ValueError(MISSING_FILENAME_TEXT)
1802
+
1803
+ with open(filename) as f:
1804
+ self._really_load(f, filename, ignore_discard, ignore_expires)
1805
+
1806
+ def revert(self, filename=None,
1807
+ ignore_discard=False, ignore_expires=False):
1808
+ """Clear all cookies and reload cookies from a saved file.
1809
+
1810
+ Raises LoadError (or OSError) if reversion is not successful; the
1811
+ object's state will not be altered if this happens.
1812
+
1813
+ """
1814
+ if filename is None:
1815
+ if self.filename is not None: filename = self.filename
1816
+ else: raise ValueError(MISSING_FILENAME_TEXT)
1817
+
1818
+ self._cookies_lock.acquire()
1819
+ try:
1820
+
1821
+ old_state = copy.deepcopy(self._cookies)
1822
+ self._cookies = {}
1823
+ try:
1824
+ self.load(filename, ignore_discard, ignore_expires)
1825
+ except OSError:
1826
+ self._cookies = old_state
1827
+ raise
1828
+
1829
+ finally:
1830
+ self._cookies_lock.release()
1831
+
1832
+
1833
+ def lwp_cookie_str(cookie):
1834
+ """Return string representation of Cookie in the LWP cookie file format.
1835
+
1836
+ Actually, the format is extended a bit -- see module docstring.
1837
+
1838
+ """
1839
+ h = [(cookie.name, cookie.value),
1840
+ ("path", cookie.path),
1841
+ ("domain", cookie.domain)]
1842
+ if cookie.port is not None: h.append(("port", cookie.port))
1843
+ if cookie.path_specified: h.append(("path_spec", None))
1844
+ if cookie.port_specified: h.append(("port_spec", None))
1845
+ if cookie.domain_initial_dot: h.append(("domain_dot", None))
1846
+ if cookie.secure: h.append(("secure", None))
1847
+ if cookie.expires: h.append(("expires",
1848
+ time2isoz(float(cookie.expires))))
1849
+ if cookie.discard: h.append(("discard", None))
1850
+ if cookie.comment: h.append(("comment", cookie.comment))
1851
+ if cookie.comment_url: h.append(("commenturl", cookie.comment_url))
1852
+
1853
+ keys = sorted(cookie._rest.keys())
1854
+ for k in keys:
1855
+ h.append((k, str(cookie._rest[k])))
1856
+
1857
+ h.append(("version", str(cookie.version)))
1858
+
1859
+ return join_header_words([h])
1860
+
1861
+ class LWPCookieJar(FileCookieJar):
1862
+ """
1863
+ The LWPCookieJar saves a sequence of "Set-Cookie3" lines.
1864
+ "Set-Cookie3" is the format used by the libwww-perl library, not known
1865
+ to be compatible with any browser, but which is easy to read and
1866
+ doesn't lose information about RFC 2965 cookies.
1867
+
1868
+ Additional methods
1869
+
1870
+ as_lwp_str(ignore_discard=True, ignore_expired=True)
1871
+
1872
+ """
1873
+
1874
+ def as_lwp_str(self, ignore_discard=True, ignore_expires=True):
1875
+ """Return cookies as a string of "\\n"-separated "Set-Cookie3" headers.
1876
+
1877
+ ignore_discard and ignore_expires: see docstring for FileCookieJar.save
1878
+
1879
+ """
1880
+ now = time.time()
1881
+ r = []
1882
+ for cookie in self:
1883
+ if not ignore_discard and cookie.discard:
1884
+ continue
1885
+ if not ignore_expires and cookie.is_expired(now):
1886
+ continue
1887
+ r.append("Set-Cookie3: %s" % lwp_cookie_str(cookie))
1888
+ return "\n".join(r+[""])
1889
+
1890
+ def save(self, filename=None, ignore_discard=False, ignore_expires=False):
1891
+ if filename is None:
1892
+ if self.filename is not None: filename = self.filename
1893
+ else: raise ValueError(MISSING_FILENAME_TEXT)
1894
+
1895
+ with os.fdopen(
1896
+ os.open(filename, os.O_CREAT | os.O_WRONLY | os.O_TRUNC, 0o600),
1897
+ 'w',
1898
+ ) as f:
1899
+ # There really isn't an LWP Cookies 2.0 format, but this indicates
1900
+ # that there is extra information in here (domain_dot and
1901
+ # port_spec) while still being compatible with libwww-perl, I hope.
1902
+ f.write("#LWP-Cookies-2.0\n")
1903
+ f.write(self.as_lwp_str(ignore_discard, ignore_expires))
1904
+
1905
+ def _really_load(self, f, filename, ignore_discard, ignore_expires):
1906
+ magic = f.readline()
1907
+ if not self.magic_re.search(magic):
1908
+ msg = ("%r does not look like a Set-Cookie3 (LWP) format "
1909
+ "file" % filename)
1910
+ raise LoadError(msg)
1911
+
1912
+ now = time.time()
1913
+
1914
+ header = "Set-Cookie3:"
1915
+ boolean_attrs = ("port_spec", "path_spec", "domain_dot",
1916
+ "secure", "discard")
1917
+ value_attrs = ("version",
1918
+ "port", "path", "domain",
1919
+ "expires",
1920
+ "comment", "commenturl")
1921
+
1922
+ try:
1923
+ while (line := f.readline()) != "":
1924
+ if not line.startswith(header):
1925
+ continue
1926
+ line = line[len(header):].strip()
1927
+
1928
+ for data in split_header_words([line]):
1929
+ name, value = data[0]
1930
+ standard = {}
1931
+ rest = {}
1932
+ for k in boolean_attrs:
1933
+ standard[k] = False
1934
+ for k, v in data[1:]:
1935
+ if k is not None:
1936
+ lc = k.lower()
1937
+ else:
1938
+ lc = None
1939
+ # don't lose case distinction for unknown fields
1940
+ if (lc in value_attrs) or (lc in boolean_attrs):
1941
+ k = lc
1942
+ if k in boolean_attrs:
1943
+ if v is None: v = True
1944
+ standard[k] = v
1945
+ elif k in value_attrs:
1946
+ standard[k] = v
1947
+ else:
1948
+ rest[k] = v
1949
+
1950
+ h = standard.get
1951
+ expires = h("expires")
1952
+ discard = h("discard")
1953
+ if expires is not None:
1954
+ expires = iso2time(expires)
1955
+ if expires is None:
1956
+ discard = True
1957
+ domain = h("domain")
1958
+ domain_specified = domain.startswith(".")
1959
+ c = Cookie(h("version"), name, value,
1960
+ h("port"), h("port_spec"),
1961
+ domain, domain_specified, h("domain_dot"),
1962
+ h("path"), h("path_spec"),
1963
+ h("secure"),
1964
+ expires,
1965
+ discard,
1966
+ h("comment"),
1967
+ h("commenturl"),
1968
+ rest)
1969
+ if not ignore_discard and c.discard:
1970
+ continue
1971
+ if not ignore_expires and c.is_expired(now):
1972
+ continue
1973
+ self.set_cookie(c)
1974
+ except OSError:
1975
+ raise
1976
+ except Exception:
1977
+ _warn_unhandled_exception()
1978
+ raise LoadError("invalid Set-Cookie3 format file %r: %r" %
1979
+ (filename, line))
1980
+
1981
+
1982
+ class MozillaCookieJar(FileCookieJar):
1983
+ """
1984
+
1985
+ WARNING: you may want to backup your browser's cookies file if you use
1986
+ this class to save cookies. I *think* it works, but there have been
1987
+ bugs in the past!
1988
+
1989
+ This class differs from CookieJar only in the format it uses to save and
1990
+ load cookies to and from a file. This class uses the Mozilla/Netscape
1991
+ 'cookies.txt' format. curl and lynx use this file format, too.
1992
+
1993
+ Don't expect cookies saved while the browser is running to be noticed by
1994
+ the browser (in fact, Mozilla on unix will overwrite your saved cookies if
1995
+ you change them on disk while it's running; on Windows, you probably can't
1996
+ save at all while the browser is running).
1997
+
1998
+ Note that the Mozilla/Netscape format will downgrade RFC2965 cookies to
1999
+ Netscape cookies on saving.
2000
+
2001
+ In particular, the cookie version and port number information is lost,
2002
+ together with information about whether or not Path, Port and Discard were
2003
+ specified by the Set-Cookie2 (or Set-Cookie) header, and whether or not the
2004
+ domain as set in the HTTP header started with a dot (yes, I'm aware some
2005
+ domains in Netscape files start with a dot and some don't -- trust me, you
2006
+ really don't want to know any more about this).
2007
+
2008
+ Note that though Mozilla and Netscape use the same format, they use
2009
+ slightly different headers. The class saves cookies using the Netscape
2010
+ header by default (Mozilla can cope with that).
2011
+
2012
+ """
2013
+
2014
+ def _really_load(self, f, filename, ignore_discard, ignore_expires):
2015
+ now = time.time()
2016
+
2017
+ if not NETSCAPE_MAGIC_RGX.match(f.readline()):
2018
+ raise LoadError(
2019
+ "%r does not look like a Netscape format cookies file" %
2020
+ filename)
2021
+
2022
+ try:
2023
+ while (line := f.readline()) != "":
2024
+ rest = {}
2025
+
2026
+ # httponly is a cookie flag as defined in rfc6265
2027
+ # when encoded in a netscape cookie file,
2028
+ # the line is prepended with "#HttpOnly_"
2029
+ if line.startswith(HTTPONLY_PREFIX):
2030
+ rest[HTTPONLY_ATTR] = ""
2031
+ line = line[len(HTTPONLY_PREFIX):]
2032
+
2033
+ # last field may be absent, so keep any trailing tab
2034
+ if line.endswith("\n"): line = line[:-1]
2035
+
2036
+ # skip comments and blank lines XXX what is $ for?
2037
+ if (line.strip().startswith(("#", "$")) or
2038
+ line.strip() == ""):
2039
+ continue
2040
+
2041
+ domain, domain_specified, path, secure, expires, name, value = \
2042
+ line.split("\t")
2043
+ secure = (secure == "TRUE")
2044
+ domain_specified = (domain_specified == "TRUE")
2045
+ if name == "":
2046
+ # cookies.txt regards 'Set-Cookie: foo' as a cookie
2047
+ # with no name, whereas http.cookiejar regards it as a
2048
+ # cookie with no value.
2049
+ name = value
2050
+ value = None
2051
+
2052
+ initial_dot = domain.startswith(".")
2053
+ assert domain_specified == initial_dot
2054
+
2055
+ discard = False
2056
+ # curl and Wget set expires to 0 for session cookies.
2057
+ if expires == "0" or expires == "":
2058
+ expires = None
2059
+ discard = True
2060
+
2061
+ # assume path_specified is false
2062
+ c = Cookie(0, name, value,
2063
+ None, False,
2064
+ domain, domain_specified, initial_dot,
2065
+ path, False,
2066
+ secure,
2067
+ expires,
2068
+ discard,
2069
+ None,
2070
+ None,
2071
+ rest)
2072
+ if not ignore_discard and c.discard:
2073
+ continue
2074
+ if not ignore_expires and c.is_expired(now):
2075
+ continue
2076
+ self.set_cookie(c)
2077
+
2078
+ except OSError:
2079
+ raise
2080
+ except Exception:
2081
+ _warn_unhandled_exception()
2082
+ raise LoadError("invalid Netscape format cookies file %r: %r" %
2083
+ (filename, line))
2084
+
2085
+ def save(self, filename=None, ignore_discard=False, ignore_expires=False):
2086
+ if filename is None:
2087
+ if self.filename is not None: filename = self.filename
2088
+ else: raise ValueError(MISSING_FILENAME_TEXT)
2089
+
2090
+ with os.fdopen(
2091
+ os.open(filename, os.O_CREAT | os.O_WRONLY | os.O_TRUNC, 0o600),
2092
+ 'w',
2093
+ ) as f:
2094
+ f.write(NETSCAPE_HEADER_TEXT)
2095
+ now = time.time()
2096
+ for cookie in self:
2097
+ domain = cookie.domain
2098
+ if not ignore_discard and cookie.discard:
2099
+ continue
2100
+ if not ignore_expires and cookie.is_expired(now):
2101
+ continue
2102
+ if cookie.secure: secure = "TRUE"
2103
+ else: secure = "FALSE"
2104
+ if domain.startswith("."): initial_dot = "TRUE"
2105
+ else: initial_dot = "FALSE"
2106
+ if cookie.expires is not None:
2107
+ expires = str(cookie.expires)
2108
+ else:
2109
+ expires = ""
2110
+ if cookie.value is None:
2111
+ # cookies.txt regards 'Set-Cookie: foo' as a cookie
2112
+ # with no name, whereas http.cookiejar regards it as a
2113
+ # cookie with no value.
2114
+ name = ""
2115
+ value = cookie.name
2116
+ else:
2117
+ name = cookie.name
2118
+ value = cookie.value
2119
+ if cookie.has_nonstandard_attr(HTTPONLY_ATTR):
2120
+ domain = HTTPONLY_PREFIX + domain
2121
+ f.write(
2122
+ "\t".join([domain, initial_dot, cookie.path,
2123
+ secure, expires, name, value])+
2124
+ "\n")