@rowstile/cli-linux-x64 0.1.0-alpha.2

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 (565) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +5 -0
  3. package/package.json +26 -0
  4. package/python/bin/python3.13 +0 -0
  5. package/python/bin/python3.13-config +122 -0
  6. package/python/lib/libpython3.13.so.1.0 +0 -0
  7. package/python/lib/libpython3.so +0 -0
  8. package/python/lib/python3.13/LICENSE.txt +277 -0
  9. package/python/lib/python3.13/__future__.py +147 -0
  10. package/python/lib/python3.13/__hello__.py +16 -0
  11. package/python/lib/python3.13/_aix_support.py +108 -0
  12. package/python/lib/python3.13/_android_support.py +192 -0
  13. package/python/lib/python3.13/_apple_support.py +66 -0
  14. package/python/lib/python3.13/_collections_abc.py +1187 -0
  15. package/python/lib/python3.13/_colorize.py +119 -0
  16. package/python/lib/python3.13/_compat_pickle.py +251 -0
  17. package/python/lib/python3.13/_compression.py +162 -0
  18. package/python/lib/python3.13/_ios_support.py +71 -0
  19. package/python/lib/python3.13/_markupbase.py +396 -0
  20. package/python/lib/python3.13/_opcode_metadata.py +343 -0
  21. package/python/lib/python3.13/_osx_support.py +579 -0
  22. package/python/lib/python3.13/_py_abc.py +147 -0
  23. package/python/lib/python3.13/_pydatetime.py +2640 -0
  24. package/python/lib/python3.13/_pydecimal.py +6356 -0
  25. package/python/lib/python3.13/_pyio.py +2714 -0
  26. package/python/lib/python3.13/_pylong.py +363 -0
  27. package/python/lib/python3.13/_pyrepl/__init__.py +19 -0
  28. package/python/lib/python3.13/_pyrepl/__main__.py +10 -0
  29. package/python/lib/python3.13/_pyrepl/_minimal_curses.py +68 -0
  30. package/python/lib/python3.13/_pyrepl/_threading_handler.py +74 -0
  31. package/python/lib/python3.13/_pyrepl/base_eventqueue.py +110 -0
  32. package/python/lib/python3.13/_pyrepl/commands.py +492 -0
  33. package/python/lib/python3.13/_pyrepl/completing_reader.py +295 -0
  34. package/python/lib/python3.13/_pyrepl/console.py +229 -0
  35. package/python/lib/python3.13/_pyrepl/curses.py +33 -0
  36. package/python/lib/python3.13/_pyrepl/fancy_termios.py +82 -0
  37. package/python/lib/python3.13/_pyrepl/historical_reader.py +419 -0
  38. package/python/lib/python3.13/_pyrepl/input.py +114 -0
  39. package/python/lib/python3.13/_pyrepl/keymap.py +213 -0
  40. package/python/lib/python3.13/_pyrepl/main.py +59 -0
  41. package/python/lib/python3.13/_pyrepl/mypy.ini +29 -0
  42. package/python/lib/python3.13/_pyrepl/pager.py +175 -0
  43. package/python/lib/python3.13/_pyrepl/reader.py +764 -0
  44. package/python/lib/python3.13/_pyrepl/readline.py +599 -0
  45. package/python/lib/python3.13/_pyrepl/simple_interact.py +180 -0
  46. package/python/lib/python3.13/_pyrepl/trace.py +21 -0
  47. package/python/lib/python3.13/_pyrepl/types.py +10 -0
  48. package/python/lib/python3.13/_pyrepl/unix_console.py +852 -0
  49. package/python/lib/python3.13/_pyrepl/unix_eventqueue.py +76 -0
  50. package/python/lib/python3.13/_pyrepl/utils.py +83 -0
  51. package/python/lib/python3.13/_pyrepl/windows_console.py +687 -0
  52. package/python/lib/python3.13/_pyrepl/windows_eventqueue.py +42 -0
  53. package/python/lib/python3.13/_sitebuiltins.py +91 -0
  54. package/python/lib/python3.13/_strptime.py +800 -0
  55. package/python/lib/python3.13/_sysconfigdata__linux_x86_64-linux-gnu.py +1079 -0
  56. package/python/lib/python3.13/_threading_local.py +120 -0
  57. package/python/lib/python3.13/_weakrefset.py +205 -0
  58. package/python/lib/python3.13/abc.py +188 -0
  59. package/python/lib/python3.13/antigravity.py +17 -0
  60. package/python/lib/python3.13/argparse.py +2690 -0
  61. package/python/lib/python3.13/ast.py +1865 -0
  62. package/python/lib/python3.13/asyncio/__init__.py +47 -0
  63. package/python/lib/python3.13/asyncio/__main__.py +211 -0
  64. package/python/lib/python3.13/asyncio/base_events.py +2086 -0
  65. package/python/lib/python3.13/asyncio/base_futures.py +67 -0
  66. package/python/lib/python3.13/asyncio/base_subprocess.py +312 -0
  67. package/python/lib/python3.13/asyncio/base_tasks.py +94 -0
  68. package/python/lib/python3.13/asyncio/constants.py +41 -0
  69. package/python/lib/python3.13/asyncio/coroutines.py +109 -0
  70. package/python/lib/python3.13/asyncio/events.py +885 -0
  71. package/python/lib/python3.13/asyncio/exceptions.py +62 -0
  72. package/python/lib/python3.13/asyncio/format_helpers.py +84 -0
  73. package/python/lib/python3.13/asyncio/futures.py +425 -0
  74. package/python/lib/python3.13/asyncio/locks.py +617 -0
  75. package/python/lib/python3.13/asyncio/log.py +7 -0
  76. package/python/lib/python3.13/asyncio/mixins.py +21 -0
  77. package/python/lib/python3.13/asyncio/proactor_events.py +891 -0
  78. package/python/lib/python3.13/asyncio/protocols.py +216 -0
  79. package/python/lib/python3.13/asyncio/queues.py +309 -0
  80. package/python/lib/python3.13/asyncio/runners.py +217 -0
  81. package/python/lib/python3.13/asyncio/selector_events.py +1328 -0
  82. package/python/lib/python3.13/asyncio/sslproto.py +929 -0
  83. package/python/lib/python3.13/asyncio/staggered.py +174 -0
  84. package/python/lib/python3.13/asyncio/streams.py +787 -0
  85. package/python/lib/python3.13/asyncio/subprocess.py +229 -0
  86. package/python/lib/python3.13/asyncio/taskgroups.py +278 -0
  87. package/python/lib/python3.13/asyncio/tasks.py +1121 -0
  88. package/python/lib/python3.13/asyncio/threads.py +26 -0
  89. package/python/lib/python3.13/asyncio/timeouts.py +185 -0
  90. package/python/lib/python3.13/asyncio/transports.py +337 -0
  91. package/python/lib/python3.13/asyncio/trsock.py +98 -0
  92. package/python/lib/python3.13/asyncio/unix_events.py +1550 -0
  93. package/python/lib/python3.13/asyncio/windows_events.py +906 -0
  94. package/python/lib/python3.13/asyncio/windows_utils.py +181 -0
  95. package/python/lib/python3.13/base64.py +628 -0
  96. package/python/lib/python3.13/bdb.py +973 -0
  97. package/python/lib/python3.13/bisect.py +118 -0
  98. package/python/lib/python3.13/bz2.py +352 -0
  99. package/python/lib/python3.13/cProfile.py +197 -0
  100. package/python/lib/python3.13/calendar.py +813 -0
  101. package/python/lib/python3.13/cmd.py +409 -0
  102. package/python/lib/python3.13/code.py +386 -0
  103. package/python/lib/python3.13/codecs.py +1132 -0
  104. package/python/lib/python3.13/codeop.py +155 -0
  105. package/python/lib/python3.13/collections/__init__.py +1603 -0
  106. package/python/lib/python3.13/colorsys.py +166 -0
  107. package/python/lib/python3.13/compileall.py +470 -0
  108. package/python/lib/python3.13/concurrent/__init__.py +1 -0
  109. package/python/lib/python3.13/concurrent/futures/__init__.py +54 -0
  110. package/python/lib/python3.13/concurrent/futures/_base.py +660 -0
  111. package/python/lib/python3.13/concurrent/futures/process.py +892 -0
  112. package/python/lib/python3.13/concurrent/futures/thread.py +240 -0
  113. package/python/lib/python3.13/configparser.py +1396 -0
  114. package/python/lib/python3.13/contextlib.py +814 -0
  115. package/python/lib/python3.13/contextvars.py +4 -0
  116. package/python/lib/python3.13/copy.py +306 -0
  117. package/python/lib/python3.13/copyreg.py +217 -0
  118. package/python/lib/python3.13/csv.py +527 -0
  119. package/python/lib/python3.13/ctypes/__init__.py +605 -0
  120. package/python/lib/python3.13/ctypes/_aix.py +327 -0
  121. package/python/lib/python3.13/ctypes/_endian.py +78 -0
  122. package/python/lib/python3.13/ctypes/macholib/README.ctypes +7 -0
  123. package/python/lib/python3.13/ctypes/macholib/__init__.py +9 -0
  124. package/python/lib/python3.13/ctypes/macholib/dyld.py +165 -0
  125. package/python/lib/python3.13/ctypes/macholib/dylib.py +42 -0
  126. package/python/lib/python3.13/ctypes/macholib/fetch_macholib +2 -0
  127. package/python/lib/python3.13/ctypes/macholib/fetch_macholib.bat +1 -0
  128. package/python/lib/python3.13/ctypes/macholib/framework.py +42 -0
  129. package/python/lib/python3.13/ctypes/util.py +387 -0
  130. package/python/lib/python3.13/ctypes/wintypes.py +202 -0
  131. package/python/lib/python3.13/curses/__init__.py +101 -0
  132. package/python/lib/python3.13/curses/ascii.py +99 -0
  133. package/python/lib/python3.13/curses/has_key.py +192 -0
  134. package/python/lib/python3.13/curses/panel.py +6 -0
  135. package/python/lib/python3.13/curses/textpad.py +236 -0
  136. package/python/lib/python3.13/dataclasses.py +1679 -0
  137. package/python/lib/python3.13/datetime.py +9 -0
  138. package/python/lib/python3.13/dbm/__init__.py +194 -0
  139. package/python/lib/python3.13/dbm/dumb.py +319 -0
  140. package/python/lib/python3.13/dbm/gnu.py +3 -0
  141. package/python/lib/python3.13/dbm/ndbm.py +3 -0
  142. package/python/lib/python3.13/dbm/sqlite3.py +144 -0
  143. package/python/lib/python3.13/decimal.py +109 -0
  144. package/python/lib/python3.13/difflib.py +2058 -0
  145. package/python/lib/python3.13/dis.py +1075 -0
  146. package/python/lib/python3.13/doctest.py +2919 -0
  147. package/python/lib/python3.13/email/__init__.py +61 -0
  148. package/python/lib/python3.13/email/_encoded_words.py +233 -0
  149. package/python/lib/python3.13/email/_header_value_parser.py +3153 -0
  150. package/python/lib/python3.13/email/_parseaddr.py +563 -0
  151. package/python/lib/python3.13/email/_policybase.py +382 -0
  152. package/python/lib/python3.13/email/architecture.rst +216 -0
  153. package/python/lib/python3.13/email/base64mime.py +115 -0
  154. package/python/lib/python3.13/email/charset.py +396 -0
  155. package/python/lib/python3.13/email/contentmanager.py +254 -0
  156. package/python/lib/python3.13/email/encoders.py +65 -0
  157. package/python/lib/python3.13/email/errors.py +117 -0
  158. package/python/lib/python3.13/email/feedparser.py +536 -0
  159. package/python/lib/python3.13/email/generator.py +530 -0
  160. package/python/lib/python3.13/email/header.py +582 -0
  161. package/python/lib/python3.13/email/headerregistry.py +618 -0
  162. package/python/lib/python3.13/email/iterators.py +68 -0
  163. package/python/lib/python3.13/email/message.py +1217 -0
  164. package/python/lib/python3.13/email/mime/__init__.py +0 -0
  165. package/python/lib/python3.13/email/mime/application.py +37 -0
  166. package/python/lib/python3.13/email/mime/audio.py +97 -0
  167. package/python/lib/python3.13/email/mime/base.py +29 -0
  168. package/python/lib/python3.13/email/mime/image.py +152 -0
  169. package/python/lib/python3.13/email/mime/message.py +33 -0
  170. package/python/lib/python3.13/email/mime/multipart.py +47 -0
  171. package/python/lib/python3.13/email/mime/nonmultipart.py +21 -0
  172. package/python/lib/python3.13/email/mime/text.py +40 -0
  173. package/python/lib/python3.13/email/parser.py +127 -0
  174. package/python/lib/python3.13/email/policy.py +232 -0
  175. package/python/lib/python3.13/email/quoprimime.py +300 -0
  176. package/python/lib/python3.13/email/utils.py +497 -0
  177. package/python/lib/python3.13/encodings/__init__.py +179 -0
  178. package/python/lib/python3.13/encodings/__pycache__/__init__.cpython-313.pyc +0 -0
  179. package/python/lib/python3.13/encodings/__pycache__/aliases.cpython-313.pyc +0 -0
  180. package/python/lib/python3.13/encodings/__pycache__/utf_8.cpython-313.pyc +0 -0
  181. package/python/lib/python3.13/encodings/aliases.py +560 -0
  182. package/python/lib/python3.13/encodings/ascii.py +50 -0
  183. package/python/lib/python3.13/encodings/base64_codec.py +55 -0
  184. package/python/lib/python3.13/encodings/big5.py +39 -0
  185. package/python/lib/python3.13/encodings/big5hkscs.py +39 -0
  186. package/python/lib/python3.13/encodings/bz2_codec.py +78 -0
  187. package/python/lib/python3.13/encodings/charmap.py +69 -0
  188. package/python/lib/python3.13/encodings/cp037.py +307 -0
  189. package/python/lib/python3.13/encodings/cp1006.py +307 -0
  190. package/python/lib/python3.13/encodings/cp1026.py +307 -0
  191. package/python/lib/python3.13/encodings/cp1125.py +698 -0
  192. package/python/lib/python3.13/encodings/cp1140.py +307 -0
  193. package/python/lib/python3.13/encodings/cp1250.py +307 -0
  194. package/python/lib/python3.13/encodings/cp1251.py +307 -0
  195. package/python/lib/python3.13/encodings/cp1252.py +307 -0
  196. package/python/lib/python3.13/encodings/cp1253.py +307 -0
  197. package/python/lib/python3.13/encodings/cp1254.py +307 -0
  198. package/python/lib/python3.13/encodings/cp1255.py +307 -0
  199. package/python/lib/python3.13/encodings/cp1256.py +307 -0
  200. package/python/lib/python3.13/encodings/cp1257.py +307 -0
  201. package/python/lib/python3.13/encodings/cp1258.py +307 -0
  202. package/python/lib/python3.13/encodings/cp273.py +307 -0
  203. package/python/lib/python3.13/encodings/cp424.py +307 -0
  204. package/python/lib/python3.13/encodings/cp437.py +698 -0
  205. package/python/lib/python3.13/encodings/cp500.py +307 -0
  206. package/python/lib/python3.13/encodings/cp720.py +309 -0
  207. package/python/lib/python3.13/encodings/cp737.py +698 -0
  208. package/python/lib/python3.13/encodings/cp775.py +697 -0
  209. package/python/lib/python3.13/encodings/cp850.py +698 -0
  210. package/python/lib/python3.13/encodings/cp852.py +698 -0
  211. package/python/lib/python3.13/encodings/cp855.py +698 -0
  212. package/python/lib/python3.13/encodings/cp856.py +307 -0
  213. package/python/lib/python3.13/encodings/cp857.py +694 -0
  214. package/python/lib/python3.13/encodings/cp858.py +698 -0
  215. package/python/lib/python3.13/encodings/cp860.py +698 -0
  216. package/python/lib/python3.13/encodings/cp861.py +698 -0
  217. package/python/lib/python3.13/encodings/cp862.py +698 -0
  218. package/python/lib/python3.13/encodings/cp863.py +698 -0
  219. package/python/lib/python3.13/encodings/cp864.py +690 -0
  220. package/python/lib/python3.13/encodings/cp865.py +698 -0
  221. package/python/lib/python3.13/encodings/cp866.py +698 -0
  222. package/python/lib/python3.13/encodings/cp869.py +689 -0
  223. package/python/lib/python3.13/encodings/cp874.py +307 -0
  224. package/python/lib/python3.13/encodings/cp875.py +307 -0
  225. package/python/lib/python3.13/encodings/cp932.py +39 -0
  226. package/python/lib/python3.13/encodings/cp949.py +39 -0
  227. package/python/lib/python3.13/encodings/cp950.py +39 -0
  228. package/python/lib/python3.13/encodings/euc_jis_2004.py +39 -0
  229. package/python/lib/python3.13/encodings/euc_jisx0213.py +39 -0
  230. package/python/lib/python3.13/encodings/euc_jp.py +39 -0
  231. package/python/lib/python3.13/encodings/euc_kr.py +39 -0
  232. package/python/lib/python3.13/encodings/gb18030.py +39 -0
  233. package/python/lib/python3.13/encodings/gb2312.py +39 -0
  234. package/python/lib/python3.13/encodings/gbk.py +39 -0
  235. package/python/lib/python3.13/encodings/hex_codec.py +55 -0
  236. package/python/lib/python3.13/encodings/hp_roman8.py +314 -0
  237. package/python/lib/python3.13/encodings/hz.py +39 -0
  238. package/python/lib/python3.13/encodings/idna.py +387 -0
  239. package/python/lib/python3.13/encodings/iso2022_jp.py +39 -0
  240. package/python/lib/python3.13/encodings/iso2022_jp_1.py +39 -0
  241. package/python/lib/python3.13/encodings/iso2022_jp_2.py +39 -0
  242. package/python/lib/python3.13/encodings/iso2022_jp_2004.py +39 -0
  243. package/python/lib/python3.13/encodings/iso2022_jp_3.py +39 -0
  244. package/python/lib/python3.13/encodings/iso2022_jp_ext.py +39 -0
  245. package/python/lib/python3.13/encodings/iso2022_kr.py +39 -0
  246. package/python/lib/python3.13/encodings/iso8859_1.py +307 -0
  247. package/python/lib/python3.13/encodings/iso8859_10.py +307 -0
  248. package/python/lib/python3.13/encodings/iso8859_11.py +307 -0
  249. package/python/lib/python3.13/encodings/iso8859_13.py +307 -0
  250. package/python/lib/python3.13/encodings/iso8859_14.py +307 -0
  251. package/python/lib/python3.13/encodings/iso8859_15.py +307 -0
  252. package/python/lib/python3.13/encodings/iso8859_16.py +307 -0
  253. package/python/lib/python3.13/encodings/iso8859_2.py +307 -0
  254. package/python/lib/python3.13/encodings/iso8859_3.py +307 -0
  255. package/python/lib/python3.13/encodings/iso8859_4.py +307 -0
  256. package/python/lib/python3.13/encodings/iso8859_5.py +307 -0
  257. package/python/lib/python3.13/encodings/iso8859_6.py +307 -0
  258. package/python/lib/python3.13/encodings/iso8859_7.py +307 -0
  259. package/python/lib/python3.13/encodings/iso8859_8.py +307 -0
  260. package/python/lib/python3.13/encodings/iso8859_9.py +307 -0
  261. package/python/lib/python3.13/encodings/johab.py +39 -0
  262. package/python/lib/python3.13/encodings/koi8_r.py +307 -0
  263. package/python/lib/python3.13/encodings/koi8_t.py +308 -0
  264. package/python/lib/python3.13/encodings/koi8_u.py +307 -0
  265. package/python/lib/python3.13/encodings/kz1048.py +307 -0
  266. package/python/lib/python3.13/encodings/latin_1.py +50 -0
  267. package/python/lib/python3.13/encodings/mac_arabic.py +698 -0
  268. package/python/lib/python3.13/encodings/mac_croatian.py +307 -0
  269. package/python/lib/python3.13/encodings/mac_cyrillic.py +307 -0
  270. package/python/lib/python3.13/encodings/mac_farsi.py +307 -0
  271. package/python/lib/python3.13/encodings/mac_greek.py +307 -0
  272. package/python/lib/python3.13/encodings/mac_iceland.py +307 -0
  273. package/python/lib/python3.13/encodings/mac_latin2.py +312 -0
  274. package/python/lib/python3.13/encodings/mac_roman.py +307 -0
  275. package/python/lib/python3.13/encodings/mac_romanian.py +307 -0
  276. package/python/lib/python3.13/encodings/mac_turkish.py +307 -0
  277. package/python/lib/python3.13/encodings/mbcs.py +47 -0
  278. package/python/lib/python3.13/encodings/oem.py +41 -0
  279. package/python/lib/python3.13/encodings/palmos.py +308 -0
  280. package/python/lib/python3.13/encodings/ptcp154.py +312 -0
  281. package/python/lib/python3.13/encodings/punycode.py +253 -0
  282. package/python/lib/python3.13/encodings/quopri_codec.py +56 -0
  283. package/python/lib/python3.13/encodings/raw_unicode_escape.py +46 -0
  284. package/python/lib/python3.13/encodings/rot_13.py +113 -0
  285. package/python/lib/python3.13/encodings/shift_jis.py +39 -0
  286. package/python/lib/python3.13/encodings/shift_jis_2004.py +39 -0
  287. package/python/lib/python3.13/encodings/shift_jisx0213.py +39 -0
  288. package/python/lib/python3.13/encodings/tis_620.py +307 -0
  289. package/python/lib/python3.13/encodings/undefined.py +49 -0
  290. package/python/lib/python3.13/encodings/unicode_escape.py +46 -0
  291. package/python/lib/python3.13/encodings/utf_16.py +155 -0
  292. package/python/lib/python3.13/encodings/utf_16_be.py +42 -0
  293. package/python/lib/python3.13/encodings/utf_16_le.py +42 -0
  294. package/python/lib/python3.13/encodings/utf_32.py +150 -0
  295. package/python/lib/python3.13/encodings/utf_32_be.py +37 -0
  296. package/python/lib/python3.13/encodings/utf_32_le.py +37 -0
  297. package/python/lib/python3.13/encodings/utf_7.py +38 -0
  298. package/python/lib/python3.13/encodings/utf_8.py +42 -0
  299. package/python/lib/python3.13/encodings/utf_8_sig.py +130 -0
  300. package/python/lib/python3.13/encodings/uu_codec.py +103 -0
  301. package/python/lib/python3.13/encodings/zlib_codec.py +77 -0
  302. package/python/lib/python3.13/enum.py +2183 -0
  303. package/python/lib/python3.13/filecmp.py +320 -0
  304. package/python/lib/python3.13/fileinput.py +442 -0
  305. package/python/lib/python3.13/fnmatch.py +192 -0
  306. package/python/lib/python3.13/fractions.py +1043 -0
  307. package/python/lib/python3.13/ftplib.py +975 -0
  308. package/python/lib/python3.13/functools.py +1036 -0
  309. package/python/lib/python3.13/genericpath.py +200 -0
  310. package/python/lib/python3.13/getopt.py +215 -0
  311. package/python/lib/python3.13/getpass.py +192 -0
  312. package/python/lib/python3.13/gettext.py +657 -0
  313. package/python/lib/python3.13/glob.py +572 -0
  314. package/python/lib/python3.13/graphlib.py +250 -0
  315. package/python/lib/python3.13/gzip.py +693 -0
  316. package/python/lib/python3.13/hashlib.py +255 -0
  317. package/python/lib/python3.13/heapq.py +603 -0
  318. package/python/lib/python3.13/hmac.py +220 -0
  319. package/python/lib/python3.13/html/__init__.py +132 -0
  320. package/python/lib/python3.13/html/entities.py +2513 -0
  321. package/python/lib/python3.13/html/parser.py +583 -0
  322. package/python/lib/python3.13/http/__init__.py +202 -0
  323. package/python/lib/python3.13/http/client.py +1598 -0
  324. package/python/lib/python3.13/http/cookiejar.py +2122 -0
  325. package/python/lib/python3.13/http/cookies.py +635 -0
  326. package/python/lib/python3.13/http/server.py +1355 -0
  327. package/python/lib/python3.13/imaplib.py +1769 -0
  328. package/python/lib/python3.13/importlib/__init__.py +136 -0
  329. package/python/lib/python3.13/importlib/_abc.py +39 -0
  330. package/python/lib/python3.13/importlib/_bootstrap.py +1559 -0
  331. package/python/lib/python3.13/importlib/_bootstrap_external.py +1826 -0
  332. package/python/lib/python3.13/importlib/abc.py +243 -0
  333. package/python/lib/python3.13/importlib/machinery.py +21 -0
  334. package/python/lib/python3.13/importlib/metadata/__init__.py +1093 -0
  335. package/python/lib/python3.13/importlib/metadata/_adapters.py +89 -0
  336. package/python/lib/python3.13/importlib/metadata/_collections.py +30 -0
  337. package/python/lib/python3.13/importlib/metadata/_functools.py +104 -0
  338. package/python/lib/python3.13/importlib/metadata/_itertools.py +73 -0
  339. package/python/lib/python3.13/importlib/metadata/_meta.py +67 -0
  340. package/python/lib/python3.13/importlib/metadata/_text.py +99 -0
  341. package/python/lib/python3.13/importlib/metadata/diagnose.py +21 -0
  342. package/python/lib/python3.13/importlib/readers.py +12 -0
  343. package/python/lib/python3.13/importlib/resources/__init__.py +43 -0
  344. package/python/lib/python3.13/importlib/resources/_adapters.py +168 -0
  345. package/python/lib/python3.13/importlib/resources/_common.py +211 -0
  346. package/python/lib/python3.13/importlib/resources/_functional.py +81 -0
  347. package/python/lib/python3.13/importlib/resources/_itertools.py +38 -0
  348. package/python/lib/python3.13/importlib/resources/abc.py +173 -0
  349. package/python/lib/python3.13/importlib/resources/readers.py +203 -0
  350. package/python/lib/python3.13/importlib/resources/simple.py +106 -0
  351. package/python/lib/python3.13/importlib/simple.py +14 -0
  352. package/python/lib/python3.13/importlib/util.py +274 -0
  353. package/python/lib/python3.13/inspect.py +3479 -0
  354. package/python/lib/python3.13/io.py +99 -0
  355. package/python/lib/python3.13/ipaddress.py +2440 -0
  356. package/python/lib/python3.13/json/__init__.py +365 -0
  357. package/python/lib/python3.13/json/decoder.py +364 -0
  358. package/python/lib/python3.13/json/encoder.py +446 -0
  359. package/python/lib/python3.13/json/scanner.py +73 -0
  360. package/python/lib/python3.13/json/tool.py +90 -0
  361. package/python/lib/python3.13/keyword.py +64 -0
  362. package/python/lib/python3.13/lib-dynload/.empty +0 -0
  363. package/python/lib/python3.13/lib-dynload/_dbm.cpython-313-x86_64-linux-gnu.so +0 -0
  364. package/python/lib/python3.13/linecache.py +236 -0
  365. package/python/lib/python3.13/locale.py +1987 -0
  366. package/python/lib/python3.13/logging/__init__.py +2330 -0
  367. package/python/lib/python3.13/logging/config.py +1080 -0
  368. package/python/lib/python3.13/logging/handlers.py +1629 -0
  369. package/python/lib/python3.13/lzma.py +364 -0
  370. package/python/lib/python3.13/mailbox.py +2219 -0
  371. package/python/lib/python3.13/mimetypes.py +679 -0
  372. package/python/lib/python3.13/modulefinder.py +671 -0
  373. package/python/lib/python3.13/multiprocessing/__init__.py +37 -0
  374. package/python/lib/python3.13/multiprocessing/connection.py +1216 -0
  375. package/python/lib/python3.13/multiprocessing/context.py +383 -0
  376. package/python/lib/python3.13/multiprocessing/dummy/__init__.py +126 -0
  377. package/python/lib/python3.13/multiprocessing/dummy/connection.py +75 -0
  378. package/python/lib/python3.13/multiprocessing/forkserver.py +373 -0
  379. package/python/lib/python3.13/multiprocessing/heap.py +337 -0
  380. package/python/lib/python3.13/multiprocessing/managers.py +1397 -0
  381. package/python/lib/python3.13/multiprocessing/pool.py +957 -0
  382. package/python/lib/python3.13/multiprocessing/popen_fork.py +97 -0
  383. package/python/lib/python3.13/multiprocessing/popen_forkserver.py +74 -0
  384. package/python/lib/python3.13/multiprocessing/popen_spawn_posix.py +76 -0
  385. package/python/lib/python3.13/multiprocessing/popen_spawn_win32.py +147 -0
  386. package/python/lib/python3.13/multiprocessing/process.py +436 -0
  387. package/python/lib/python3.13/multiprocessing/queues.py +399 -0
  388. package/python/lib/python3.13/multiprocessing/reduction.py +281 -0
  389. package/python/lib/python3.13/multiprocessing/resource_sharer.py +154 -0
  390. package/python/lib/python3.13/multiprocessing/resource_tracker.py +499 -0
  391. package/python/lib/python3.13/multiprocessing/shared_memory.py +544 -0
  392. package/python/lib/python3.13/multiprocessing/sharedctypes.py +240 -0
  393. package/python/lib/python3.13/multiprocessing/spawn.py +307 -0
  394. package/python/lib/python3.13/multiprocessing/synchronize.py +404 -0
  395. package/python/lib/python3.13/multiprocessing/util.py +562 -0
  396. package/python/lib/python3.13/netrc.py +199 -0
  397. package/python/lib/python3.13/ntpath.py +872 -0
  398. package/python/lib/python3.13/nturl2path.py +69 -0
  399. package/python/lib/python3.13/numbers.py +427 -0
  400. package/python/lib/python3.13/opcode.py +115 -0
  401. package/python/lib/python3.13/operator.py +467 -0
  402. package/python/lib/python3.13/optparse.py +1681 -0
  403. package/python/lib/python3.13/os.py +1184 -0
  404. package/python/lib/python3.13/pathlib/__init__.py +12 -0
  405. package/python/lib/python3.13/pathlib/_abc.py +930 -0
  406. package/python/lib/python3.13/pathlib/_local.py +861 -0
  407. package/python/lib/python3.13/pdb.py +2550 -0
  408. package/python/lib/python3.13/pickle.py +1860 -0
  409. package/python/lib/python3.13/pickletools.py +2904 -0
  410. package/python/lib/python3.13/pkgutil.py +529 -0
  411. package/python/lib/python3.13/platform.py +1454 -0
  412. package/python/lib/python3.13/plistlib.py +948 -0
  413. package/python/lib/python3.13/poplib.py +477 -0
  414. package/python/lib/python3.13/posixpath.py +578 -0
  415. package/python/lib/python3.13/pprint.py +658 -0
  416. package/python/lib/python3.13/profile.py +616 -0
  417. package/python/lib/python3.13/pstats.py +778 -0
  418. package/python/lib/python3.13/pty.py +211 -0
  419. package/python/lib/python3.13/py_compile.py +212 -0
  420. package/python/lib/python3.13/pyclbr.py +314 -0
  421. package/python/lib/python3.13/pydoc.py +2861 -0
  422. package/python/lib/python3.13/queue.py +383 -0
  423. package/python/lib/python3.13/quopri.py +237 -0
  424. package/python/lib/python3.13/random.py +1078 -0
  425. package/python/lib/python3.13/re/__init__.py +428 -0
  426. package/python/lib/python3.13/re/_casefix.py +106 -0
  427. package/python/lib/python3.13/re/_compiler.py +768 -0
  428. package/python/lib/python3.13/re/_constants.py +222 -0
  429. package/python/lib/python3.13/re/_parser.py +1081 -0
  430. package/python/lib/python3.13/reprlib.py +230 -0
  431. package/python/lib/python3.13/rlcompleter.py +222 -0
  432. package/python/lib/python3.13/runpy.py +326 -0
  433. package/python/lib/python3.13/sched.py +167 -0
  434. package/python/lib/python3.13/secrets.py +71 -0
  435. package/python/lib/python3.13/selectors.py +603 -0
  436. package/python/lib/python3.13/shelve.py +250 -0
  437. package/python/lib/python3.13/shlex.py +345 -0
  438. package/python/lib/python3.13/shutil.py +1569 -0
  439. package/python/lib/python3.13/signal.py +94 -0
  440. package/python/lib/python3.13/site.py +773 -0
  441. package/python/lib/python3.13/smtplib.py +1123 -0
  442. package/python/lib/python3.13/socket.py +988 -0
  443. package/python/lib/python3.13/socketserver.py +863 -0
  444. package/python/lib/python3.13/sqlite3/__init__.py +70 -0
  445. package/python/lib/python3.13/sqlite3/__main__.py +139 -0
  446. package/python/lib/python3.13/sqlite3/dbapi2.py +108 -0
  447. package/python/lib/python3.13/sqlite3/dump.py +118 -0
  448. package/python/lib/python3.13/sre_compile.py +7 -0
  449. package/python/lib/python3.13/sre_constants.py +7 -0
  450. package/python/lib/python3.13/sre_parse.py +7 -0
  451. package/python/lib/python3.13/ssl.py +1541 -0
  452. package/python/lib/python3.13/stat.py +212 -0
  453. package/python/lib/python3.13/statistics.py +1817 -0
  454. package/python/lib/python3.13/string.py +314 -0
  455. package/python/lib/python3.13/stringprep.py +272 -0
  456. package/python/lib/python3.13/struct.py +15 -0
  457. package/python/lib/python3.13/subprocess.py +2258 -0
  458. package/python/lib/python3.13/symtable.py +414 -0
  459. package/python/lib/python3.13/sysconfig/__init__.py +734 -0
  460. package/python/lib/python3.13/sysconfig/__main__.py +248 -0
  461. package/python/lib/python3.13/tabnanny.py +340 -0
  462. package/python/lib/python3.13/tarfile.py +3136 -0
  463. package/python/lib/python3.13/tempfile.py +958 -0
  464. package/python/lib/python3.13/textwrap.py +497 -0
  465. package/python/lib/python3.13/this.py +28 -0
  466. package/python/lib/python3.13/threading.py +1602 -0
  467. package/python/lib/python3.13/timeit.py +381 -0
  468. package/python/lib/python3.13/token.py +141 -0
  469. package/python/lib/python3.13/tokenize.py +592 -0
  470. package/python/lib/python3.13/tomllib/__init__.py +10 -0
  471. package/python/lib/python3.13/tomllib/_parser.py +703 -0
  472. package/python/lib/python3.13/tomllib/_re.py +107 -0
  473. package/python/lib/python3.13/tomllib/_types.py +10 -0
  474. package/python/lib/python3.13/tomllib/mypy.ini +15 -0
  475. package/python/lib/python3.13/trace.py +754 -0
  476. package/python/lib/python3.13/traceback.py +1639 -0
  477. package/python/lib/python3.13/tracemalloc.py +560 -0
  478. package/python/lib/python3.13/tty.py +73 -0
  479. package/python/lib/python3.13/types.py +346 -0
  480. package/python/lib/python3.13/typing.py +3846 -0
  481. package/python/lib/python3.13/unittest/__init__.py +80 -0
  482. package/python/lib/python3.13/unittest/__main__.py +18 -0
  483. package/python/lib/python3.13/unittest/_log.py +86 -0
  484. package/python/lib/python3.13/unittest/async_case.py +146 -0
  485. package/python/lib/python3.13/unittest/case.py +1478 -0
  486. package/python/lib/python3.13/unittest/loader.py +460 -0
  487. package/python/lib/python3.13/unittest/main.py +280 -0
  488. package/python/lib/python3.13/unittest/mock.py +3189 -0
  489. package/python/lib/python3.13/unittest/result.py +256 -0
  490. package/python/lib/python3.13/unittest/runner.py +292 -0
  491. package/python/lib/python3.13/unittest/signals.py +71 -0
  492. package/python/lib/python3.13/unittest/suite.py +379 -0
  493. package/python/lib/python3.13/unittest/util.py +170 -0
  494. package/python/lib/python3.13/urllib/__init__.py +0 -0
  495. package/python/lib/python3.13/urllib/error.py +74 -0
  496. package/python/lib/python3.13/urllib/parse.py +1264 -0
  497. package/python/lib/python3.13/urllib/request.py +2796 -0
  498. package/python/lib/python3.13/urllib/response.py +84 -0
  499. package/python/lib/python3.13/urllib/robotparser.py +363 -0
  500. package/python/lib/python3.13/uuid.py +784 -0
  501. package/python/lib/python3.13/warnings.py +735 -0
  502. package/python/lib/python3.13/wave.py +665 -0
  503. package/python/lib/python3.13/weakref.py +674 -0
  504. package/python/lib/python3.13/webbrowser.py +724 -0
  505. package/python/lib/python3.13/wsgiref/__init__.py +25 -0
  506. package/python/lib/python3.13/wsgiref/handlers.py +575 -0
  507. package/python/lib/python3.13/wsgiref/headers.py +192 -0
  508. package/python/lib/python3.13/wsgiref/simple_server.py +161 -0
  509. package/python/lib/python3.13/wsgiref/types.py +54 -0
  510. package/python/lib/python3.13/wsgiref/util.py +159 -0
  511. package/python/lib/python3.13/wsgiref/validate.py +438 -0
  512. package/python/lib/python3.13/xml/__init__.py +20 -0
  513. package/python/lib/python3.13/xml/dom/NodeFilter.py +27 -0
  514. package/python/lib/python3.13/xml/dom/__init__.py +140 -0
  515. package/python/lib/python3.13/xml/dom/domreg.py +99 -0
  516. package/python/lib/python3.13/xml/dom/expatbuilder.py +962 -0
  517. package/python/lib/python3.13/xml/dom/minicompat.py +109 -0
  518. package/python/lib/python3.13/xml/dom/minidom.py +2024 -0
  519. package/python/lib/python3.13/xml/dom/pulldom.py +336 -0
  520. package/python/lib/python3.13/xml/dom/xmlbuilder.py +389 -0
  521. package/python/lib/python3.13/xml/etree/ElementInclude.py +186 -0
  522. package/python/lib/python3.13/xml/etree/ElementPath.py +430 -0
  523. package/python/lib/python3.13/xml/etree/ElementTree.py +2116 -0
  524. package/python/lib/python3.13/xml/etree/__init__.py +33 -0
  525. package/python/lib/python3.13/xml/etree/cElementTree.py +3 -0
  526. package/python/lib/python3.13/xml/parsers/__init__.py +8 -0
  527. package/python/lib/python3.13/xml/parsers/expat.py +8 -0
  528. package/python/lib/python3.13/xml/sax/__init__.py +94 -0
  529. package/python/lib/python3.13/xml/sax/_exceptions.py +127 -0
  530. package/python/lib/python3.13/xml/sax/expatreader.py +454 -0
  531. package/python/lib/python3.13/xml/sax/handler.py +387 -0
  532. package/python/lib/python3.13/xml/sax/saxutils.py +369 -0
  533. package/python/lib/python3.13/xml/sax/xmlreader.py +378 -0
  534. package/python/lib/python3.13/xmlrpc/__init__.py +1 -0
  535. package/python/lib/python3.13/xmlrpc/client.py +1503 -0
  536. package/python/lib/python3.13/xmlrpc/server.py +1002 -0
  537. package/python/lib/python3.13/zipapp.py +229 -0
  538. package/python/lib/python3.13/zipfile/__init__.py +2391 -0
  539. package/python/lib/python3.13/zipfile/__main__.py +4 -0
  540. package/python/lib/python3.13/zipfile/_path/__init__.py +452 -0
  541. package/python/lib/python3.13/zipfile/_path/glob.py +113 -0
  542. package/python/lib/python3.13/zipimport.py +803 -0
  543. package/python/lib/python3.13/zoneinfo/__init__.py +34 -0
  544. package/python/lib/python3.13/zoneinfo/_common.py +172 -0
  545. package/python/lib/python3.13/zoneinfo/_tzpath.py +189 -0
  546. package/python/lib/python3.13/zoneinfo/_zoneinfo.py +779 -0
  547. package/python/licenses/LICENSE.bdb.txt +126 -0
  548. package/python/licenses/LICENSE.bzip2.txt +37 -0
  549. package/python/licenses/LICENSE.cpython.txt +771 -0
  550. package/python/licenses/LICENSE.expat.txt +21 -0
  551. package/python/licenses/LICENSE.libX11.txt +942 -0
  552. package/python/licenses/LICENSE.libXau.txt +21 -0
  553. package/python/licenses/LICENSE.libedit.txt +29 -0
  554. package/python/licenses/LICENSE.libffi.txt +21 -0
  555. package/python/licenses/LICENSE.liblzma.txt +13 -0
  556. package/python/licenses/LICENSE.libuuid.txt +27 -0
  557. package/python/licenses/LICENSE.libxcb.txt +30 -0
  558. package/python/licenses/LICENSE.mpdecimal.txt +24 -0
  559. package/python/licenses/LICENSE.ncurses.txt +29 -0
  560. package/python/licenses/LICENSE.openssl-1.1.txt +124 -0
  561. package/python/licenses/LICENSE.openssl-3.txt +177 -0
  562. package/python/licenses/LICENSE.sqlite.txt +23 -0
  563. package/python/licenses/LICENSE.tcl.txt +40 -0
  564. package/python/licenses/LICENSE.tix.txt +54 -0
  565. package/python/licenses/LICENSE.zlib.txt +21 -0
@@ -0,0 +1,852 @@
1
+ # Copyright 2000-2010 Michael Hudson-Doyle <micahel@gmail.com>
2
+ # Antonio Cuni
3
+ # Armin Rigo
4
+ #
5
+ # All Rights Reserved
6
+ #
7
+ #
8
+ # Permission to use, copy, modify, and distribute this software and
9
+ # its documentation for any purpose is hereby granted without fee,
10
+ # provided that the above copyright notice appear in all copies and
11
+ # that both that copyright notice and this permission notice appear in
12
+ # supporting documentation.
13
+ #
14
+ # THE AUTHOR MICHAEL HUDSON DISCLAIMS ALL WARRANTIES WITH REGARD TO
15
+ # THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16
+ # AND FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
17
+ # INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
18
+ # RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
19
+ # CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21
+
22
+ from __future__ import annotations
23
+
24
+ import errno
25
+ import os
26
+ import re
27
+ import select
28
+ import signal
29
+ import struct
30
+ import termios
31
+ import time
32
+ import platform
33
+ from fcntl import ioctl
34
+
35
+ from . import curses
36
+ from .console import Console, Event
37
+ from .fancy_termios import tcgetattr, tcsetattr, TermState
38
+ from .trace import trace
39
+ from .unix_eventqueue import EventQueue
40
+ from .utils import wlen
41
+
42
+
43
+ TYPE_CHECKING = False
44
+
45
+ # types
46
+ if TYPE_CHECKING:
47
+ from typing import AbstractSet, IO, Literal, overload, cast
48
+ else:
49
+ overload = lambda func: None
50
+ cast = lambda typ, val: val
51
+
52
+
53
+ class InvalidTerminal(RuntimeError):
54
+ def __init__(self, message: str) -> None:
55
+ super().__init__(errno.EIO, message)
56
+
57
+
58
+ _error = (termios.error, curses.error, InvalidTerminal)
59
+ _error_codes_to_ignore = frozenset([errno.EIO, errno.ENXIO, errno.EPERM])
60
+
61
+ SIGWINCH_EVENT = "repaint"
62
+
63
+ FIONREAD = getattr(termios, "FIONREAD", None)
64
+ TIOCGWINSZ = getattr(termios, "TIOCGWINSZ", None)
65
+
66
+ # ------------ start of baudrate definitions ------------
67
+
68
+ # Add (possibly) missing baudrates (check termios man page) to termios
69
+
70
+
71
+ def add_baudrate_if_supported(dictionary: dict[int, int], rate: int) -> None:
72
+ baudrate_name = "B%d" % rate
73
+ if hasattr(termios, baudrate_name):
74
+ dictionary[getattr(termios, baudrate_name)] = rate
75
+
76
+
77
+ # Check the termios man page (Line speed) to know where these
78
+ # values come from.
79
+ potential_baudrates = [
80
+ 0,
81
+ 110,
82
+ 115200,
83
+ 1200,
84
+ 134,
85
+ 150,
86
+ 1800,
87
+ 19200,
88
+ 200,
89
+ 230400,
90
+ 2400,
91
+ 300,
92
+ 38400,
93
+ 460800,
94
+ 4800,
95
+ 50,
96
+ 57600,
97
+ 600,
98
+ 75,
99
+ 9600,
100
+ ]
101
+
102
+ ratedict: dict[int, int] = {}
103
+ for rate in potential_baudrates:
104
+ add_baudrate_if_supported(ratedict, rate)
105
+
106
+ # Clean up variables to avoid unintended usage
107
+ del rate, add_baudrate_if_supported
108
+
109
+ # ------------ end of baudrate definitions ------------
110
+
111
+ delayprog = re.compile(b"\\$<([0-9]+)((?:/|\\*){0,2})>")
112
+
113
+ try:
114
+ poll: type[select.poll] = select.poll
115
+ except AttributeError:
116
+ # this is exactly the minumum necessary to support what we
117
+ # do with poll objects
118
+ class MinimalPoll:
119
+ def __init__(self):
120
+ pass
121
+
122
+ def register(self, fd, flag):
123
+ self.fd = fd
124
+
125
+ # note: The 'timeout' argument is received as *milliseconds*
126
+ def poll(self, timeout: float | None = None) -> list[int]:
127
+ if timeout is None:
128
+ r, w, e = select.select([self.fd], [], [])
129
+ else:
130
+ r, w, e = select.select([self.fd], [], [], timeout / 1000)
131
+ return r
132
+
133
+ poll = MinimalPoll # type: ignore[assignment]
134
+
135
+
136
+ class UnixConsole(Console):
137
+ def __init__(
138
+ self,
139
+ f_in: IO[bytes] | int = 0,
140
+ f_out: IO[bytes] | int = 1,
141
+ term: str = "",
142
+ encoding: str = "",
143
+ ):
144
+ """
145
+ Initialize the UnixConsole.
146
+
147
+ Parameters:
148
+ - f_in (int or file-like object): Input file descriptor or object.
149
+ - f_out (int or file-like object): Output file descriptor or object.
150
+ - term (str): Terminal name.
151
+ - encoding (str): Encoding to use for I/O operations.
152
+ """
153
+ super().__init__(f_in, f_out, term, encoding)
154
+
155
+ self.pollob = poll()
156
+ self.pollob.register(self.input_fd, select.POLLIN)
157
+ self.input_buffer = b""
158
+ self.input_buffer_pos = 0
159
+ curses.setupterm(term or None, self.output_fd)
160
+ self.term = term
161
+ self.is_apple_terminal = (
162
+ platform.system() == "Darwin"
163
+ and os.getenv("TERM_PROGRAM") == "Apple_Terminal"
164
+ )
165
+
166
+ try:
167
+ self.__input_fd_set(tcgetattr(self.input_fd), ignore=frozenset())
168
+ except _error as e:
169
+ raise RuntimeError(f"termios failure ({e.args[1]})")
170
+
171
+ @overload
172
+ def _my_getstr(
173
+ cap: str, optional: Literal[False] = False
174
+ ) -> bytes: ...
175
+
176
+ @overload
177
+ def _my_getstr(cap: str, optional: bool) -> bytes | None: ...
178
+
179
+ def _my_getstr(cap: str, optional: bool = False) -> bytes | None:
180
+ r = curses.tigetstr(cap)
181
+ if not optional and r is None:
182
+ raise InvalidTerminal(
183
+ f"terminal doesn't have the required {cap} capability"
184
+ )
185
+ return r
186
+
187
+ self._bel = _my_getstr("bel")
188
+ self._civis = _my_getstr("civis", optional=True)
189
+ self._clear = _my_getstr("clear")
190
+ self._cnorm = _my_getstr("cnorm", optional=True)
191
+ self._cub = _my_getstr("cub", optional=True)
192
+ self._cub1 = _my_getstr("cub1", optional=True)
193
+ self._cud = _my_getstr("cud", optional=True)
194
+ self._cud1 = _my_getstr("cud1", optional=True)
195
+ self._cuf = _my_getstr("cuf", optional=True)
196
+ self._cuf1 = _my_getstr("cuf1", optional=True)
197
+ self._cup = _my_getstr("cup")
198
+ self._cuu = _my_getstr("cuu", optional=True)
199
+ self._cuu1 = _my_getstr("cuu1", optional=True)
200
+ self._dch1 = _my_getstr("dch1", optional=True)
201
+ self._dch = _my_getstr("dch", optional=True)
202
+ self._el = _my_getstr("el")
203
+ self._hpa = _my_getstr("hpa", optional=True)
204
+ self._ich = _my_getstr("ich", optional=True)
205
+ self._ich1 = _my_getstr("ich1", optional=True)
206
+ self._ind = _my_getstr("ind", optional=True)
207
+ self._pad = _my_getstr("pad", optional=True)
208
+ self._ri = _my_getstr("ri", optional=True)
209
+ self._rmkx = _my_getstr("rmkx", optional=True)
210
+ self._smkx = _my_getstr("smkx", optional=True)
211
+
212
+ self.__setup_movement()
213
+
214
+ self.event_queue = EventQueue(self.input_fd, self.encoding)
215
+ self.cursor_visible = 1
216
+
217
+ signal.signal(signal.SIGCONT, self._sigcont_handler)
218
+
219
+ def _sigcont_handler(self, signum, frame):
220
+ self.restore()
221
+ self.prepare()
222
+
223
+ def more_in_buffer(self) -> bool:
224
+ return bool(
225
+ self.input_buffer
226
+ and self.input_buffer_pos < len(self.input_buffer)
227
+ )
228
+
229
+ def __read(self, n: int) -> bytes:
230
+ if not self.more_in_buffer():
231
+ self.input_buffer = os.read(self.input_fd, 10000)
232
+
233
+ ret = self.input_buffer[self.input_buffer_pos : self.input_buffer_pos + n]
234
+ self.input_buffer_pos += len(ret)
235
+ if self.input_buffer_pos >= len(self.input_buffer):
236
+ self.input_buffer = b""
237
+ self.input_buffer_pos = 0
238
+ return ret
239
+
240
+ def change_encoding(self, encoding: str) -> None:
241
+ """
242
+ Change the encoding used for I/O operations.
243
+
244
+ Parameters:
245
+ - encoding (str): New encoding to use.
246
+ """
247
+ self.encoding = encoding
248
+
249
+ def refresh(self, screen, c_xy):
250
+ """
251
+ Refresh the console screen.
252
+
253
+ Parameters:
254
+ - screen (list): List of strings representing the screen contents.
255
+ - c_xy (tuple): Cursor position (x, y) on the screen.
256
+ """
257
+ cx, cy = c_xy
258
+ if not self.__gone_tall:
259
+ while len(self.screen) < min(len(screen), self.height):
260
+ self.__hide_cursor()
261
+ if self.screen:
262
+ self.__move(0, len(self.screen) - 1)
263
+ self.__write("\n")
264
+ self.posxy = 0, len(self.screen)
265
+ self.screen.append("")
266
+ else:
267
+ while len(self.screen) < len(screen):
268
+ self.screen.append("")
269
+
270
+ if len(screen) > self.height:
271
+ self.__gone_tall = 1
272
+ self.__move = self.__move_tall
273
+
274
+ px, py = self.posxy
275
+ old_offset = offset = self.__offset
276
+ height = self.height
277
+
278
+ # we make sure the cursor is on the screen, and that we're
279
+ # using all of the screen if we can
280
+ if cy < offset:
281
+ offset = cy
282
+ elif cy >= offset + height:
283
+ offset = cy - height + 1
284
+ elif offset > 0 and len(screen) < offset + height:
285
+ offset = max(len(screen) - height, 0)
286
+ screen.append("")
287
+
288
+ oldscr = self.screen[old_offset : old_offset + height]
289
+ newscr = screen[offset : offset + height]
290
+
291
+ # use hardware scrolling if we have it.
292
+ if old_offset > offset and self._ri:
293
+ self.__hide_cursor()
294
+ self.__write_code(self._cup, 0, 0)
295
+ self.posxy = 0, old_offset
296
+ for i in range(old_offset - offset):
297
+ self.__write_code(self._ri)
298
+ oldscr.pop(-1)
299
+ oldscr.insert(0, "")
300
+ elif old_offset < offset and self._ind:
301
+ self.__hide_cursor()
302
+ self.__write_code(self._cup, self.height - 1, 0)
303
+ self.posxy = 0, old_offset + self.height - 1
304
+ for i in range(offset - old_offset):
305
+ self.__write_code(self._ind)
306
+ oldscr.pop(0)
307
+ oldscr.append("")
308
+
309
+ self.__offset = offset
310
+
311
+ for (
312
+ y,
313
+ oldline,
314
+ newline,
315
+ ) in zip(range(offset, offset + height), oldscr, newscr):
316
+ if oldline != newline:
317
+ self.__write_changed_line(y, oldline, newline, px)
318
+
319
+ y = len(newscr)
320
+ while y < len(oldscr):
321
+ self.__hide_cursor()
322
+ self.__move(0, y)
323
+ self.posxy = 0, y
324
+ self.__write_code(self._el)
325
+ y += 1
326
+
327
+ self.__show_cursor()
328
+
329
+ self.screen = screen.copy()
330
+ self.move_cursor(cx, cy)
331
+ self.flushoutput()
332
+
333
+ def move_cursor(self, x, y):
334
+ """
335
+ Move the cursor to the specified position on the screen.
336
+
337
+ Parameters:
338
+ - x (int): X coordinate.
339
+ - y (int): Y coordinate.
340
+ """
341
+ if y < self.__offset or y >= self.__offset + self.height:
342
+ self.event_queue.insert(Event("scroll", None))
343
+ else:
344
+ self.__move(x, y)
345
+ self.posxy = x, y
346
+ self.flushoutput()
347
+
348
+ def prepare(self):
349
+ """
350
+ Prepare the console for input/output operations.
351
+ """
352
+ self.__buffer = []
353
+
354
+ self.__svtermstate = tcgetattr(self.input_fd)
355
+ raw = self.__svtermstate.copy()
356
+ raw.iflag &= ~(termios.INPCK | termios.ISTRIP | termios.IXON)
357
+ raw.oflag &= ~(termios.OPOST)
358
+ raw.cflag &= ~(termios.CSIZE | termios.PARENB)
359
+ raw.cflag |= termios.CS8
360
+ raw.iflag |= termios.BRKINT
361
+ raw.lflag &= ~(termios.ICANON | termios.ECHO | termios.IEXTEN)
362
+ raw.lflag |= termios.ISIG
363
+ raw.cc[termios.VMIN] = 1
364
+ raw.cc[termios.VTIME] = 0
365
+ self.__input_fd_set(raw)
366
+
367
+ # In macOS terminal we need to deactivate line wrap via ANSI escape code
368
+ if self.is_apple_terminal:
369
+ os.write(self.output_fd, b"\033[?7l")
370
+
371
+ self.screen = []
372
+ self.height, self.width = self.getheightwidth()
373
+
374
+ self.posxy = 0, 0
375
+ self.__gone_tall = 0
376
+ self.__move = self.__move_short
377
+ self.__offset = 0
378
+
379
+ self.__maybe_write_code(self._smkx)
380
+
381
+ try:
382
+ self.old_sigwinch = signal.signal(signal.SIGWINCH, self.__sigwinch)
383
+ except ValueError:
384
+ pass
385
+
386
+ self.__enable_bracketed_paste()
387
+
388
+ def restore(self):
389
+ """
390
+ Restore the console to the default state
391
+ """
392
+ self.__disable_bracketed_paste()
393
+ self.__maybe_write_code(self._rmkx)
394
+ self.flushoutput()
395
+ self.__input_fd_set(self.__svtermstate)
396
+
397
+ if self.is_apple_terminal:
398
+ os.write(self.output_fd, b"\033[?7h")
399
+
400
+ if hasattr(self, "old_sigwinch"):
401
+ try:
402
+ signal.signal(signal.SIGWINCH, self.old_sigwinch)
403
+ except ValueError as e:
404
+ import threading
405
+ if threading.current_thread() is threading.main_thread():
406
+ raise e
407
+ del self.old_sigwinch
408
+
409
+ def push_char(self, char: int | bytes) -> None:
410
+ """
411
+ Push a character to the console event queue.
412
+ """
413
+ trace("push char {char!r}", char=char)
414
+ self.event_queue.push(char)
415
+
416
+ def get_event(self, block: bool = True) -> Event | None:
417
+ """
418
+ Get an event from the console event queue.
419
+
420
+ Parameters:
421
+ - block (bool): Whether to block until an event is available.
422
+
423
+ Returns:
424
+ - Event: Event object from the event queue.
425
+ """
426
+ if not block and not self.wait(timeout=0):
427
+ return None
428
+
429
+ while self.event_queue.empty():
430
+ while True:
431
+ try:
432
+ self.push_char(self.__read(1))
433
+ except OSError as err:
434
+ if err.errno == errno.EINTR:
435
+ if not self.event_queue.empty():
436
+ return self.event_queue.get()
437
+ else:
438
+ continue
439
+ elif err.errno == errno.EIO:
440
+ raise SystemExit(errno.EIO)
441
+ else:
442
+ raise
443
+ else:
444
+ break
445
+ return self.event_queue.get()
446
+
447
+ def wait(self, timeout: float | None = None) -> bool:
448
+ """
449
+ Wait for events on the console.
450
+ """
451
+ return (
452
+ not self.event_queue.empty()
453
+ or self.more_in_buffer()
454
+ or bool(self.pollob.poll(timeout))
455
+ )
456
+
457
+ def set_cursor_vis(self, visible):
458
+ """
459
+ Set the visibility of the cursor.
460
+
461
+ Parameters:
462
+ - visible (bool): Visibility flag.
463
+ """
464
+ if visible:
465
+ self.__show_cursor()
466
+ else:
467
+ self.__hide_cursor()
468
+
469
+ if TIOCGWINSZ:
470
+
471
+ def getheightwidth(self):
472
+ """
473
+ Get the height and width of the console.
474
+
475
+ Returns:
476
+ - tuple: Height and width of the console.
477
+ """
478
+ try:
479
+ return int(os.environ["LINES"]), int(os.environ["COLUMNS"])
480
+ except (KeyError, TypeError, ValueError):
481
+ try:
482
+ size = ioctl(self.input_fd, TIOCGWINSZ, b"\000" * 8)
483
+ except OSError:
484
+ return 25, 80
485
+ height, width = struct.unpack("hhhh", size)[0:2]
486
+ if not height:
487
+ return 25, 80
488
+ return height, width
489
+
490
+ else:
491
+
492
+ def getheightwidth(self):
493
+ """
494
+ Get the height and width of the console.
495
+
496
+ Returns:
497
+ - tuple: Height and width of the console.
498
+ """
499
+ try:
500
+ return int(os.environ["LINES"]), int(os.environ["COLUMNS"])
501
+ except (KeyError, TypeError, ValueError):
502
+ return 25, 80
503
+
504
+ def forgetinput(self):
505
+ """
506
+ Discard any pending input on the console.
507
+ """
508
+ termios.tcflush(self.input_fd, termios.TCIFLUSH)
509
+
510
+ def flushoutput(self):
511
+ """
512
+ Flush the output buffer.
513
+ """
514
+ for text, iscode in self.__buffer:
515
+ if iscode:
516
+ self.__tputs(text)
517
+ else:
518
+ os.write(self.output_fd, text.encode(self.encoding, "replace"))
519
+ del self.__buffer[:]
520
+
521
+ def finish(self):
522
+ """
523
+ Finish console operations and flush the output buffer.
524
+ """
525
+ y = len(self.screen) - 1
526
+ while y >= 0 and not self.screen[y]:
527
+ y -= 1
528
+ self.__move(0, min(y, self.height + self.__offset - 1))
529
+ self.__write("\n\r")
530
+ self.flushoutput()
531
+
532
+ def beep(self):
533
+ """
534
+ Emit a beep sound.
535
+ """
536
+ self.__maybe_write_code(self._bel)
537
+ self.flushoutput()
538
+
539
+ if FIONREAD:
540
+
541
+ def getpending(self):
542
+ """
543
+ Get pending events from the console event queue.
544
+
545
+ Returns:
546
+ - Event: Pending event from the event queue.
547
+ """
548
+ e = Event("key", "", b"")
549
+
550
+ while not self.event_queue.empty():
551
+ e2 = self.event_queue.get()
552
+ e.data += e2.data
553
+ e.raw += e.raw
554
+
555
+ amount = struct.unpack("i", ioctl(self.input_fd, FIONREAD, b"\0\0\0\0"))[0]
556
+ raw = self.__read(amount)
557
+ data = str(raw, self.encoding, "replace")
558
+ e.data += data
559
+ e.raw += raw
560
+ return e
561
+
562
+ else:
563
+
564
+ def getpending(self):
565
+ """
566
+ Get pending events from the console event queue.
567
+
568
+ Returns:
569
+ - Event: Pending event from the event queue.
570
+ """
571
+ e = Event("key", "", b"")
572
+
573
+ while not self.event_queue.empty():
574
+ e2 = self.event_queue.get()
575
+ e.data += e2.data
576
+ e.raw += e.raw
577
+
578
+ amount = 10000
579
+ raw = self.__read(amount)
580
+ data = str(raw, self.encoding, "replace")
581
+ e.data += data
582
+ e.raw += raw
583
+ return e
584
+
585
+ def clear(self):
586
+ """
587
+ Clear the console screen.
588
+ """
589
+ self.__write_code(self._clear)
590
+ self.__gone_tall = 1
591
+ self.__move = self.__move_tall
592
+ self.posxy = 0, 0
593
+ self.screen = []
594
+
595
+ @property
596
+ def input_hook(self):
597
+ try:
598
+ import posix
599
+ except ImportError:
600
+ return None
601
+ if posix._is_inputhook_installed():
602
+ return posix._inputhook
603
+
604
+ def __enable_bracketed_paste(self) -> None:
605
+ os.write(self.output_fd, b"\x1b[?2004h")
606
+
607
+ def __disable_bracketed_paste(self) -> None:
608
+ os.write(self.output_fd, b"\x1b[?2004l")
609
+
610
+ def __setup_movement(self):
611
+ """
612
+ Set up the movement functions based on the terminal capabilities.
613
+ """
614
+ if 0 and self._hpa: # hpa don't work in windows telnet :-(
615
+ self.__move_x = self.__move_x_hpa
616
+ elif self._cub and self._cuf:
617
+ self.__move_x = self.__move_x_cub_cuf
618
+ elif self._cub1 and self._cuf1:
619
+ self.__move_x = self.__move_x_cub1_cuf1
620
+ else:
621
+ raise RuntimeError("insufficient terminal (horizontal)")
622
+
623
+ if self._cuu and self._cud:
624
+ self.__move_y = self.__move_y_cuu_cud
625
+ elif self._cuu1 and self._cud1:
626
+ self.__move_y = self.__move_y_cuu1_cud1
627
+ else:
628
+ raise RuntimeError("insufficient terminal (vertical)")
629
+
630
+ if self._dch1:
631
+ self.dch1 = self._dch1
632
+ elif self._dch:
633
+ self.dch1 = curses.tparm(self._dch, 1)
634
+ else:
635
+ self.dch1 = None
636
+
637
+ if self._ich1:
638
+ self.ich1 = self._ich1
639
+ elif self._ich:
640
+ self.ich1 = curses.tparm(self._ich, 1)
641
+ else:
642
+ self.ich1 = None
643
+
644
+ self.__move = self.__move_short
645
+
646
+ def __write_changed_line(self, y, oldline, newline, px_coord):
647
+ # this is frustrating; there's no reason to test (say)
648
+ # self.dch1 inside the loop -- but alternative ways of
649
+ # structuring this function are equally painful (I'm trying to
650
+ # avoid writing code generators these days...)
651
+ minlen = min(wlen(oldline), wlen(newline))
652
+ x_pos = 0
653
+ x_coord = 0
654
+
655
+ px_pos = 0
656
+ j = 0
657
+ for c in oldline:
658
+ if j >= px_coord:
659
+ break
660
+ j += wlen(c)
661
+ px_pos += 1
662
+
663
+ # reuse the oldline as much as possible, but stop as soon as we
664
+ # encounter an ESCAPE, because it might be the start of an escape
665
+ # sequene
666
+ while (
667
+ x_coord < minlen
668
+ and oldline[x_pos] == newline[x_pos]
669
+ and newline[x_pos] != "\x1b"
670
+ ):
671
+ x_coord += wlen(newline[x_pos])
672
+ x_pos += 1
673
+
674
+ # if we need to insert a single character right after the first detected change
675
+ if oldline[x_pos:] == newline[x_pos + 1 :] and self.ich1:
676
+ if (
677
+ y == self.posxy[1]
678
+ and x_coord > self.posxy[0]
679
+ and oldline[px_pos:x_pos] == newline[px_pos + 1 : x_pos + 1]
680
+ ):
681
+ x_pos = px_pos
682
+ x_coord = px_coord
683
+ character_width = wlen(newline[x_pos])
684
+ self.__move(x_coord, y)
685
+ self.__write_code(self.ich1)
686
+ self.__write(newline[x_pos])
687
+ self.posxy = x_coord + character_width, y
688
+
689
+ # if it's a single character change in the middle of the line
690
+ elif (
691
+ x_coord < minlen
692
+ and oldline[x_pos + 1 :] == newline[x_pos + 1 :]
693
+ and wlen(oldline[x_pos]) == wlen(newline[x_pos])
694
+ ):
695
+ character_width = wlen(newline[x_pos])
696
+ self.__move(x_coord, y)
697
+ self.__write(newline[x_pos])
698
+ self.posxy = x_coord + character_width, y
699
+
700
+ # if this is the last character to fit in the line and we edit in the middle of the line
701
+ elif (
702
+ self.dch1
703
+ and self.ich1
704
+ and wlen(newline) == self.width
705
+ and x_coord < wlen(newline) - 2
706
+ and newline[x_pos + 1 : -1] == oldline[x_pos:-2]
707
+ ):
708
+ self.__hide_cursor()
709
+ self.__move(self.width - 2, y)
710
+ self.posxy = self.width - 2, y
711
+ self.__write_code(self.dch1)
712
+
713
+ character_width = wlen(newline[x_pos])
714
+ self.__move(x_coord, y)
715
+ self.__write_code(self.ich1)
716
+ self.__write(newline[x_pos])
717
+ self.posxy = character_width + 1, y
718
+
719
+ else:
720
+ self.__hide_cursor()
721
+ self.__move(x_coord, y)
722
+ if wlen(oldline) > wlen(newline):
723
+ self.__write_code(self._el)
724
+ self.__write(newline[x_pos:])
725
+ self.posxy = wlen(newline), y
726
+
727
+ if "\x1b" in newline:
728
+ # ANSI escape characters are present, so we can't assume
729
+ # anything about the position of the cursor. Moving the cursor
730
+ # to the left margin should work to get to a known position.
731
+ self.move_cursor(0, y)
732
+
733
+ def __write(self, text):
734
+ self.__buffer.append((text, 0))
735
+
736
+ def __write_code(self, fmt, *args):
737
+ self.__buffer.append((curses.tparm(fmt, *args), 1))
738
+
739
+ def __maybe_write_code(self, fmt, *args):
740
+ if fmt:
741
+ self.__write_code(fmt, *args)
742
+
743
+ def __move_y_cuu1_cud1(self, y):
744
+ assert self._cud1 is not None
745
+ assert self._cuu1 is not None
746
+ dy = y - self.posxy[1]
747
+ if dy > 0:
748
+ self.__write_code(dy * self._cud1)
749
+ elif dy < 0:
750
+ self.__write_code((-dy) * self._cuu1)
751
+
752
+ def __move_y_cuu_cud(self, y):
753
+ dy = y - self.posxy[1]
754
+ if dy > 0:
755
+ self.__write_code(self._cud, dy)
756
+ elif dy < 0:
757
+ self.__write_code(self._cuu, -dy)
758
+
759
+ def __move_x_hpa(self, x: int) -> None:
760
+ if x != self.posxy[0]:
761
+ self.__write_code(self._hpa, x)
762
+
763
+ def __move_x_cub1_cuf1(self, x: int) -> None:
764
+ assert self._cuf1 is not None
765
+ assert self._cub1 is not None
766
+ dx = x - self.posxy[0]
767
+ if dx > 0:
768
+ self.__write_code(self._cuf1 * dx)
769
+ elif dx < 0:
770
+ self.__write_code(self._cub1 * (-dx))
771
+
772
+ def __move_x_cub_cuf(self, x: int) -> None:
773
+ dx = x - self.posxy[0]
774
+ if dx > 0:
775
+ self.__write_code(self._cuf, dx)
776
+ elif dx < 0:
777
+ self.__write_code(self._cub, -dx)
778
+
779
+ def __move_short(self, x, y):
780
+ self.__move_x(x)
781
+ self.__move_y(y)
782
+
783
+ def __move_tall(self, x, y):
784
+ assert 0 <= y - self.__offset < self.height, y - self.__offset
785
+ self.__write_code(self._cup, y - self.__offset, x)
786
+
787
+ def __sigwinch(self, signum, frame):
788
+ self.height, self.width = self.getheightwidth()
789
+ self.event_queue.insert(Event("resize", None))
790
+
791
+ def __hide_cursor(self):
792
+ if self.cursor_visible:
793
+ self.__maybe_write_code(self._civis)
794
+ self.cursor_visible = 0
795
+
796
+ def __show_cursor(self):
797
+ if not self.cursor_visible:
798
+ self.__maybe_write_code(self._cnorm)
799
+ self.cursor_visible = 1
800
+
801
+ def repaint(self):
802
+ if not self.__gone_tall:
803
+ self.posxy = 0, self.posxy[1]
804
+ self.__write("\r")
805
+ ns = len(self.screen) * ["\000" * self.width]
806
+ self.screen = ns
807
+ else:
808
+ self.posxy = 0, self.__offset
809
+ self.__move(0, self.__offset)
810
+ ns = self.height * ["\000" * self.width]
811
+ self.screen = ns
812
+
813
+ def __tputs(self, fmt, prog=delayprog):
814
+ """A Python implementation of the curses tputs function; the
815
+ curses one can't really be wrapped in a sane manner.
816
+
817
+ I have the strong suspicion that this is complexity that
818
+ will never do anyone any good."""
819
+ # using .get() means that things will blow up
820
+ # only if the bps is actually needed (which I'm
821
+ # betting is pretty unlikely)
822
+ bps = ratedict.get(self.__svtermstate.ospeed)
823
+ while 1:
824
+ m = prog.search(fmt)
825
+ if not m:
826
+ os.write(self.output_fd, fmt)
827
+ break
828
+ x, y = m.span()
829
+ os.write(self.output_fd, fmt[:x])
830
+ fmt = fmt[y:]
831
+ delay = int(m.group(1))
832
+ if b"*" in m.group(2):
833
+ delay *= self.height
834
+ if self._pad and bps is not None:
835
+ nchars = (bps * delay) / 1000
836
+ os.write(self.output_fd, self._pad * nchars)
837
+ else:
838
+ time.sleep(float(delay) / 1000.0)
839
+
840
+ def __input_fd_set(
841
+ self,
842
+ state: TermState,
843
+ ignore: AbstractSet[int] = _error_codes_to_ignore,
844
+ ) -> bool:
845
+ try:
846
+ tcsetattr(self.input_fd, termios.TCSADRAIN, state)
847
+ except termios.error as te:
848
+ if te.args[0] not in ignore:
849
+ raise
850
+ return False
851
+ else:
852
+ return True