@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,1603 @@
1
+ '''This module implements specialized container datatypes providing
2
+ alternatives to Python's general purpose built-in containers, dict,
3
+ list, set, and tuple.
4
+
5
+ * namedtuple factory function for creating tuple subclasses with named fields
6
+ * deque list-like container with fast appends and pops on either end
7
+ * ChainMap dict-like class for creating a single view of multiple mappings
8
+ * Counter dict subclass for counting hashable objects
9
+ * OrderedDict dict subclass that remembers the order entries were added
10
+ * defaultdict dict subclass that calls a factory function to supply missing values
11
+ * UserDict wrapper around dictionary objects for easier dict subclassing
12
+ * UserList wrapper around list objects for easier list subclassing
13
+ * UserString wrapper around string objects for easier string subclassing
14
+
15
+ '''
16
+
17
+ __all__ = [
18
+ 'ChainMap',
19
+ 'Counter',
20
+ 'OrderedDict',
21
+ 'UserDict',
22
+ 'UserList',
23
+ 'UserString',
24
+ 'defaultdict',
25
+ 'deque',
26
+ 'namedtuple',
27
+ ]
28
+
29
+ import _collections_abc
30
+ import sys as _sys
31
+
32
+ _sys.modules['collections.abc'] = _collections_abc
33
+ abc = _collections_abc
34
+
35
+ from itertools import chain as _chain
36
+ from itertools import repeat as _repeat
37
+ from itertools import starmap as _starmap
38
+ from keyword import iskeyword as _iskeyword
39
+ from operator import eq as _eq
40
+ from operator import itemgetter as _itemgetter
41
+ from reprlib import recursive_repr as _recursive_repr
42
+ from _weakref import proxy as _proxy
43
+
44
+ try:
45
+ from _collections import deque
46
+ except ImportError:
47
+ pass
48
+ else:
49
+ _collections_abc.MutableSequence.register(deque)
50
+
51
+ try:
52
+ from _collections import _deque_iterator
53
+ except ImportError:
54
+ pass
55
+
56
+ try:
57
+ from _collections import defaultdict
58
+ except ImportError:
59
+ pass
60
+
61
+
62
+ ################################################################################
63
+ ### OrderedDict
64
+ ################################################################################
65
+
66
+ class _OrderedDictKeysView(_collections_abc.KeysView):
67
+
68
+ def __reversed__(self):
69
+ yield from reversed(self._mapping)
70
+
71
+ class _OrderedDictItemsView(_collections_abc.ItemsView):
72
+
73
+ def __reversed__(self):
74
+ for key in reversed(self._mapping):
75
+ yield (key, self._mapping[key])
76
+
77
+ class _OrderedDictValuesView(_collections_abc.ValuesView):
78
+
79
+ def __reversed__(self):
80
+ for key in reversed(self._mapping):
81
+ yield self._mapping[key]
82
+
83
+ class _Link(object):
84
+ __slots__ = 'prev', 'next', 'key', '__weakref__'
85
+
86
+ class OrderedDict(dict):
87
+ 'Dictionary that remembers insertion order'
88
+ # An inherited dict maps keys to values.
89
+ # The inherited dict provides __getitem__, __len__, __contains__, and get.
90
+ # The remaining methods are order-aware.
91
+ # Big-O running times for all methods are the same as regular dictionaries.
92
+
93
+ # The internal self.__map dict maps keys to links in a doubly linked list.
94
+ # The circular doubly linked list starts and ends with a sentinel element.
95
+ # The sentinel element never gets deleted (this simplifies the algorithm).
96
+ # The sentinel is in self.__hardroot with a weakref proxy in self.__root.
97
+ # The prev links are weakref proxies (to prevent circular references).
98
+ # Individual links are kept alive by the hard reference in self.__map.
99
+ # Those hard references disappear when a key is deleted from an OrderedDict.
100
+
101
+ def __new__(cls, /, *args, **kwds):
102
+ "Create the ordered dict object and set up the underlying structures."
103
+ self = dict.__new__(cls)
104
+ self.__hardroot = _Link()
105
+ self.__root = root = _proxy(self.__hardroot)
106
+ root.prev = root.next = root
107
+ self.__map = {}
108
+ return self
109
+
110
+ def __init__(self, other=(), /, **kwds):
111
+ '''Initialize an ordered dictionary. The signature is the same as
112
+ regular dictionaries. Keyword argument order is preserved.
113
+ '''
114
+ self.__update(other, **kwds)
115
+
116
+ def __setitem__(self, key, value,
117
+ dict_setitem=dict.__setitem__, proxy=_proxy, Link=_Link):
118
+ 'od.__setitem__(i, y) <==> od[i]=y'
119
+ # Setting a new item creates a new link at the end of the linked list,
120
+ # and the inherited dictionary is updated with the new key/value pair.
121
+ if key not in self:
122
+ self.__map[key] = link = Link()
123
+ root = self.__root
124
+ last = root.prev
125
+ link.prev, link.next, link.key = last, root, key
126
+ last.next = link
127
+ root.prev = proxy(link)
128
+ dict_setitem(self, key, value)
129
+
130
+ def __delitem__(self, key, dict_delitem=dict.__delitem__):
131
+ 'od.__delitem__(y) <==> del od[y]'
132
+ # Deleting an existing item uses self.__map to find the link which gets
133
+ # removed by updating the links in the predecessor and successor nodes.
134
+ dict_delitem(self, key)
135
+ link = self.__map.pop(key)
136
+ link_prev = link.prev
137
+ link_next = link.next
138
+ link_prev.next = link_next
139
+ link_next.prev = link_prev
140
+ link.prev = None
141
+ link.next = None
142
+
143
+ def __iter__(self):
144
+ 'od.__iter__() <==> iter(od)'
145
+ # Traverse the linked list in order.
146
+ root = self.__root
147
+ curr = root.next
148
+ while curr is not root:
149
+ yield curr.key
150
+ curr = curr.next
151
+
152
+ def __reversed__(self):
153
+ 'od.__reversed__() <==> reversed(od)'
154
+ # Traverse the linked list in reverse order.
155
+ root = self.__root
156
+ curr = root.prev
157
+ while curr is not root:
158
+ yield curr.key
159
+ curr = curr.prev
160
+
161
+ def clear(self):
162
+ 'od.clear() -> None. Remove all items from od.'
163
+ root = self.__root
164
+ root.prev = root.next = root
165
+ self.__map.clear()
166
+ dict.clear(self)
167
+
168
+ def popitem(self, last=True):
169
+ '''Remove and return a (key, value) pair from the dictionary.
170
+
171
+ Pairs are returned in LIFO order if last is true or FIFO order if false.
172
+ '''
173
+ if not self:
174
+ raise KeyError('dictionary is empty')
175
+ root = self.__root
176
+ if last:
177
+ link = root.prev
178
+ link_prev = link.prev
179
+ link_prev.next = root
180
+ root.prev = link_prev
181
+ else:
182
+ link = root.next
183
+ link_next = link.next
184
+ root.next = link_next
185
+ link_next.prev = root
186
+ key = link.key
187
+ del self.__map[key]
188
+ value = dict.pop(self, key)
189
+ return key, value
190
+
191
+ def move_to_end(self, key, last=True):
192
+ '''Move an existing element to the end (or beginning if last is false).
193
+
194
+ Raise KeyError if the element does not exist.
195
+ '''
196
+ link = self.__map[key]
197
+ link_prev = link.prev
198
+ link_next = link.next
199
+ soft_link = link_next.prev
200
+ link_prev.next = link_next
201
+ link_next.prev = link_prev
202
+ root = self.__root
203
+ if last:
204
+ last = root.prev
205
+ link.prev = last
206
+ link.next = root
207
+ root.prev = soft_link
208
+ last.next = link
209
+ else:
210
+ first = root.next
211
+ link.prev = root
212
+ link.next = first
213
+ first.prev = soft_link
214
+ root.next = link
215
+
216
+ def __sizeof__(self):
217
+ sizeof = _sys.getsizeof
218
+ n = len(self) + 1 # number of links including root
219
+ size = sizeof(self.__dict__) # instance dictionary
220
+ size += sizeof(self.__map) * 2 # internal dict and inherited dict
221
+ size += sizeof(self.__hardroot) * n # link objects
222
+ size += sizeof(self.__root) * n # proxy objects
223
+ return size
224
+
225
+ update = __update = _collections_abc.MutableMapping.update
226
+
227
+ def keys(self):
228
+ "D.keys() -> a set-like object providing a view on D's keys"
229
+ return _OrderedDictKeysView(self)
230
+
231
+ def items(self):
232
+ "D.items() -> a set-like object providing a view on D's items"
233
+ return _OrderedDictItemsView(self)
234
+
235
+ def values(self):
236
+ "D.values() -> an object providing a view on D's values"
237
+ return _OrderedDictValuesView(self)
238
+
239
+ __ne__ = _collections_abc.MutableMapping.__ne__
240
+
241
+ __marker = object()
242
+
243
+ def pop(self, key, default=__marker):
244
+ '''od.pop(k[,d]) -> v, remove specified key and return the corresponding
245
+ value. If key is not found, d is returned if given, otherwise KeyError
246
+ is raised.
247
+
248
+ '''
249
+ marker = self.__marker
250
+ result = dict.pop(self, key, marker)
251
+ if result is not marker:
252
+ # The same as in __delitem__().
253
+ link = self.__map.pop(key)
254
+ link_prev = link.prev
255
+ link_next = link.next
256
+ link_prev.next = link_next
257
+ link_next.prev = link_prev
258
+ link.prev = None
259
+ link.next = None
260
+ return result
261
+ if default is marker:
262
+ raise KeyError(key)
263
+ return default
264
+
265
+ def setdefault(self, key, default=None):
266
+ '''Insert key with a value of default if key is not in the dictionary.
267
+
268
+ Return the value for key if key is in the dictionary, else default.
269
+ '''
270
+ if key in self:
271
+ return self[key]
272
+ self[key] = default
273
+ return default
274
+
275
+ @_recursive_repr()
276
+ def __repr__(self):
277
+ 'od.__repr__() <==> repr(od)'
278
+ if not self:
279
+ return '%s()' % (self.__class__.__name__,)
280
+ return '%s(%r)' % (self.__class__.__name__, dict(self.items()))
281
+
282
+ def __reduce__(self):
283
+ 'Return state information for pickling'
284
+ state = self.__getstate__()
285
+ if state:
286
+ if isinstance(state, tuple):
287
+ state, slots = state
288
+ else:
289
+ slots = {}
290
+ state = state.copy()
291
+ slots = slots.copy()
292
+ for k in vars(OrderedDict()):
293
+ state.pop(k, None)
294
+ slots.pop(k, None)
295
+ if slots:
296
+ state = state, slots
297
+ else:
298
+ state = state or None
299
+ return self.__class__, (), state, None, iter(self.items())
300
+
301
+ def copy(self):
302
+ 'od.copy() -> a shallow copy of od'
303
+ return self.__class__(self)
304
+
305
+ @classmethod
306
+ def fromkeys(cls, iterable, value=None):
307
+ '''Create a new ordered dictionary with keys from iterable and values set to value.
308
+ '''
309
+ self = cls()
310
+ for key in iterable:
311
+ self[key] = value
312
+ return self
313
+
314
+ def __eq__(self, other):
315
+ '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive
316
+ while comparison to a regular mapping is order-insensitive.
317
+
318
+ '''
319
+ if isinstance(other, OrderedDict):
320
+ return dict.__eq__(self, other) and all(map(_eq, self, other))
321
+ return dict.__eq__(self, other)
322
+
323
+ def __ior__(self, other):
324
+ self.update(other)
325
+ return self
326
+
327
+ def __or__(self, other):
328
+ if not isinstance(other, dict):
329
+ return NotImplemented
330
+ new = self.__class__(self)
331
+ new.update(other)
332
+ return new
333
+
334
+ def __ror__(self, other):
335
+ if not isinstance(other, dict):
336
+ return NotImplemented
337
+ new = self.__class__(other)
338
+ new.update(self)
339
+ return new
340
+
341
+
342
+ try:
343
+ from _collections import OrderedDict
344
+ except ImportError:
345
+ # Leave the pure Python version in place.
346
+ pass
347
+
348
+
349
+ ################################################################################
350
+ ### namedtuple
351
+ ################################################################################
352
+
353
+ try:
354
+ from _collections import _tuplegetter
355
+ except ImportError:
356
+ _tuplegetter = lambda index, doc: property(_itemgetter(index), doc=doc)
357
+
358
+ def namedtuple(typename, field_names, *, rename=False, defaults=None, module=None):
359
+ """Returns a new subclass of tuple with named fields.
360
+
361
+ >>> Point = namedtuple('Point', ['x', 'y'])
362
+ >>> Point.__doc__ # docstring for the new class
363
+ 'Point(x, y)'
364
+ >>> p = Point(11, y=22) # instantiate with positional args or keywords
365
+ >>> p[0] + p[1] # indexable like a plain tuple
366
+ 33
367
+ >>> x, y = p # unpack like a regular tuple
368
+ >>> x, y
369
+ (11, 22)
370
+ >>> p.x + p.y # fields also accessible by name
371
+ 33
372
+ >>> d = p._asdict() # convert to a dictionary
373
+ >>> d['x']
374
+ 11
375
+ >>> Point(**d) # convert from a dictionary
376
+ Point(x=11, y=22)
377
+ >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields
378
+ Point(x=100, y=22)
379
+
380
+ """
381
+
382
+ # Validate the field names. At the user's option, either generate an error
383
+ # message or automatically replace the field name with a valid name.
384
+ if isinstance(field_names, str):
385
+ field_names = field_names.replace(',', ' ').split()
386
+ field_names = list(map(str, field_names))
387
+ typename = _sys.intern(str(typename))
388
+
389
+ if rename:
390
+ seen = set()
391
+ for index, name in enumerate(field_names):
392
+ if (not name.isidentifier()
393
+ or _iskeyword(name)
394
+ or name.startswith('_')
395
+ or name in seen):
396
+ field_names[index] = f'_{index}'
397
+ seen.add(name)
398
+
399
+ for name in [typename] + field_names:
400
+ if type(name) is not str:
401
+ raise TypeError('Type names and field names must be strings')
402
+ if not name.isidentifier():
403
+ raise ValueError('Type names and field names must be valid '
404
+ f'identifiers: {name!r}')
405
+ if _iskeyword(name):
406
+ raise ValueError('Type names and field names cannot be a '
407
+ f'keyword: {name!r}')
408
+
409
+ seen = set()
410
+ for name in field_names:
411
+ if name.startswith('_') and not rename:
412
+ raise ValueError('Field names cannot start with an underscore: '
413
+ f'{name!r}')
414
+ if name in seen:
415
+ raise ValueError(f'Encountered duplicate field name: {name!r}')
416
+ seen.add(name)
417
+
418
+ field_defaults = {}
419
+ if defaults is not None:
420
+ defaults = tuple(defaults)
421
+ if len(defaults) > len(field_names):
422
+ raise TypeError('Got more default values than field names')
423
+ field_defaults = dict(reversed(list(zip(reversed(field_names),
424
+ reversed(defaults)))))
425
+
426
+ # Variables used in the methods and docstrings
427
+ field_names = tuple(map(_sys.intern, field_names))
428
+ num_fields = len(field_names)
429
+ arg_list = ', '.join(field_names)
430
+ if num_fields == 1:
431
+ arg_list += ','
432
+ repr_fmt = '(' + ', '.join(f'{name}=%r' for name in field_names) + ')'
433
+ tuple_new = tuple.__new__
434
+ _dict, _tuple, _len, _map, _zip = dict, tuple, len, map, zip
435
+
436
+ # Create all the named tuple methods to be added to the class namespace
437
+
438
+ namespace = {
439
+ '_tuple_new': tuple_new,
440
+ '__builtins__': {},
441
+ '__name__': f'namedtuple_{typename}',
442
+ }
443
+ code = f'lambda _cls, {arg_list}: _tuple_new(_cls, ({arg_list}))'
444
+ __new__ = eval(code, namespace)
445
+ __new__.__name__ = '__new__'
446
+ __new__.__doc__ = f'Create new instance of {typename}({arg_list})'
447
+ if defaults is not None:
448
+ __new__.__defaults__ = defaults
449
+
450
+ @classmethod
451
+ def _make(cls, iterable):
452
+ result = tuple_new(cls, iterable)
453
+ if _len(result) != num_fields:
454
+ raise TypeError(f'Expected {num_fields} arguments, got {len(result)}')
455
+ return result
456
+
457
+ _make.__func__.__doc__ = (f'Make a new {typename} object from a sequence '
458
+ 'or iterable')
459
+
460
+ def _replace(self, /, **kwds):
461
+ result = self._make(_map(kwds.pop, field_names, self))
462
+ if kwds:
463
+ raise TypeError(f'Got unexpected field names: {list(kwds)!r}')
464
+ return result
465
+
466
+ _replace.__doc__ = (f'Return a new {typename} object replacing specified '
467
+ 'fields with new values')
468
+
469
+ def __repr__(self):
470
+ 'Return a nicely formatted representation string'
471
+ return self.__class__.__name__ + repr_fmt % self
472
+
473
+ def _asdict(self):
474
+ 'Return a new dict which maps field names to their values.'
475
+ return _dict(_zip(self._fields, self))
476
+
477
+ def __getnewargs__(self):
478
+ 'Return self as a plain tuple. Used by copy and pickle.'
479
+ return _tuple(self)
480
+
481
+ # Modify function metadata to help with introspection and debugging
482
+ for method in (
483
+ __new__,
484
+ _make.__func__,
485
+ _replace,
486
+ __repr__,
487
+ _asdict,
488
+ __getnewargs__,
489
+ ):
490
+ method.__qualname__ = f'{typename}.{method.__name__}'
491
+
492
+ # Build-up the class namespace dictionary
493
+ # and use type() to build the result class
494
+ class_namespace = {
495
+ '__doc__': f'{typename}({arg_list})',
496
+ '__slots__': (),
497
+ '_fields': field_names,
498
+ '_field_defaults': field_defaults,
499
+ '__new__': __new__,
500
+ '_make': _make,
501
+ '__replace__': _replace,
502
+ '_replace': _replace,
503
+ '__repr__': __repr__,
504
+ '_asdict': _asdict,
505
+ '__getnewargs__': __getnewargs__,
506
+ '__match_args__': field_names,
507
+ }
508
+ for index, name in enumerate(field_names):
509
+ doc = _sys.intern(f'Alias for field number {index}')
510
+ class_namespace[name] = _tuplegetter(index, doc)
511
+
512
+ result = type(typename, (tuple,), class_namespace)
513
+
514
+ # For pickling to work, the __module__ variable needs to be set to the frame
515
+ # where the named tuple is created. Bypass this step in environments where
516
+ # sys._getframe is not defined (Jython for example) or sys._getframe is not
517
+ # defined for arguments greater than 0 (IronPython), or where the user has
518
+ # specified a particular module.
519
+ if module is None:
520
+ try:
521
+ module = _sys._getframemodulename(1) or '__main__'
522
+ except AttributeError:
523
+ try:
524
+ module = _sys._getframe(1).f_globals.get('__name__', '__main__')
525
+ except (AttributeError, ValueError):
526
+ pass
527
+ if module is not None:
528
+ result.__module__ = module
529
+
530
+ return result
531
+
532
+
533
+ ########################################################################
534
+ ### Counter
535
+ ########################################################################
536
+
537
+ def _count_elements(mapping, iterable):
538
+ 'Tally elements from the iterable.'
539
+ mapping_get = mapping.get
540
+ for elem in iterable:
541
+ mapping[elem] = mapping_get(elem, 0) + 1
542
+
543
+ try: # Load C helper function if available
544
+ from _collections import _count_elements
545
+ except ImportError:
546
+ pass
547
+
548
+ class Counter(dict):
549
+ '''Dict subclass for counting hashable items. Sometimes called a bag
550
+ or multiset. Elements are stored as dictionary keys and their counts
551
+ are stored as dictionary values.
552
+
553
+ When constructed from a Mapping or Counter, the original object's
554
+ values will be used as the initial counts.
555
+
556
+ >>> c = Counter('abcdeabcdabcaba') # count elements from a string
557
+
558
+ >>> c.most_common(3) # three most common elements
559
+ [('a', 5), ('b', 4), ('c', 3)]
560
+ >>> sorted(c) # list all unique elements
561
+ ['a', 'b', 'c', 'd', 'e']
562
+ >>> ''.join(sorted(c.elements())) # list elements with repetitions
563
+ 'aaaaabbbbcccdde'
564
+ >>> sum(c.values()) # total of all counts
565
+ 15
566
+
567
+ >>> c['a'] # count of letter 'a'
568
+ 5
569
+ >>> for elem in 'shazam': # update counts from an iterable
570
+ ... c[elem] += 1 # by adding 1 to each element's count
571
+ >>> c['a'] # now there are seven 'a'
572
+ 7
573
+ >>> del c['b'] # remove all 'b'
574
+ >>> c['b'] # now there are zero 'b'
575
+ 0
576
+
577
+ >>> d = Counter('simsalabim') # make another counter
578
+ >>> c.update(d) # add in the second counter
579
+ >>> c['a'] # now there are nine 'a'
580
+ 9
581
+
582
+ >>> c.clear() # empty the counter
583
+ >>> c
584
+ Counter()
585
+
586
+ Note: If a count is set to zero or reduced to zero, it will remain
587
+ in the counter until the entry is deleted or the counter is cleared:
588
+
589
+ >>> c = Counter('aaabbc')
590
+ >>> c['b'] -= 2 # reduce the count of 'b' by two
591
+ >>> c.most_common() # 'b' is still in, but its count is zero
592
+ [('a', 3), ('c', 1), ('b', 0)]
593
+
594
+ '''
595
+ # References:
596
+ # http://en.wikipedia.org/wiki/Multiset
597
+ # http://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html
598
+ # http://www.java2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.htm
599
+ # http://code.activestate.com/recipes/259174/
600
+ # Knuth, TAOCP Vol. II section 4.6.3
601
+
602
+ def __init__(self, iterable=None, /, **kwds):
603
+ '''Create a new, empty Counter object. And if given, count elements
604
+ from an input iterable. Or, initialize the count from another mapping
605
+ of elements to their counts.
606
+
607
+ >>> c = Counter() # a new, empty counter
608
+ >>> c = Counter('gallahad') # a new counter from an iterable
609
+ >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a mapping
610
+ >>> c = Counter(a=4, b=2) # a new counter from keyword args
611
+
612
+ '''
613
+ super().__init__()
614
+ self.update(iterable, **kwds)
615
+
616
+ def __missing__(self, key):
617
+ 'The count of elements not in the Counter is zero.'
618
+ # Needed so that self[missing_item] does not raise KeyError
619
+ return 0
620
+
621
+ def total(self):
622
+ 'Sum of the counts'
623
+ return sum(self.values())
624
+
625
+ def most_common(self, n=None):
626
+ '''List the n most common elements and their counts from the most
627
+ common to the least. If n is None, then list all element counts.
628
+
629
+ >>> Counter('abracadabra').most_common(3)
630
+ [('a', 5), ('b', 2), ('r', 2)]
631
+
632
+ '''
633
+ # Emulate Bag.sortedByCount from Smalltalk
634
+ if n is None:
635
+ return sorted(self.items(), key=_itemgetter(1), reverse=True)
636
+
637
+ # Lazy import to speedup Python startup time
638
+ import heapq
639
+ return heapq.nlargest(n, self.items(), key=_itemgetter(1))
640
+
641
+ def elements(self):
642
+ '''Iterator over elements repeating each as many times as its count.
643
+
644
+ >>> c = Counter('ABCABC')
645
+ >>> sorted(c.elements())
646
+ ['A', 'A', 'B', 'B', 'C', 'C']
647
+
648
+ Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1
649
+
650
+ >>> import math
651
+ >>> prime_factors = Counter({2: 2, 3: 3, 17: 1})
652
+ >>> math.prod(prime_factors.elements())
653
+ 1836
654
+
655
+ Note, if an element's count has been set to zero or is a negative
656
+ number, elements() will ignore it.
657
+
658
+ '''
659
+ # Emulate Bag.do from Smalltalk and Multiset.begin from C++.
660
+ return _chain.from_iterable(_starmap(_repeat, self.items()))
661
+
662
+ # Override dict methods where necessary
663
+
664
+ @classmethod
665
+ def fromkeys(cls, iterable, v=None):
666
+ # There is no equivalent method for counters because the semantics
667
+ # would be ambiguous in cases such as Counter.fromkeys('aaabbc', v=2).
668
+ # Initializing counters to zero values isn't necessary because zero
669
+ # is already the default value for counter lookups. Initializing
670
+ # to one is easily accomplished with Counter(set(iterable)). For
671
+ # more exotic cases, create a dictionary first using a dictionary
672
+ # comprehension or dict.fromkeys().
673
+ raise NotImplementedError(
674
+ 'Counter.fromkeys() is undefined. Use Counter(iterable) instead.')
675
+
676
+ def update(self, iterable=None, /, **kwds):
677
+ '''Like dict.update() but add counts instead of replacing them.
678
+
679
+ Source can be an iterable, a dictionary, or another Counter instance.
680
+
681
+ >>> c = Counter('which')
682
+ >>> c.update('witch') # add elements from another iterable
683
+ >>> d = Counter('watch')
684
+ >>> c.update(d) # add elements from another counter
685
+ >>> c['h'] # four 'h' in which, witch, and watch
686
+ 4
687
+
688
+ '''
689
+ # The regular dict.update() operation makes no sense here because the
690
+ # replace behavior results in some of the original untouched counts
691
+ # being mixed-in with all of the other counts for a mismash that
692
+ # doesn't have a straight-forward interpretation in most counting
693
+ # contexts. Instead, we implement straight-addition. Both the inputs
694
+ # and outputs are allowed to contain zero and negative counts.
695
+
696
+ if iterable is not None:
697
+ if isinstance(iterable, _collections_abc.Mapping):
698
+ if self:
699
+ self_get = self.get
700
+ for elem, count in iterable.items():
701
+ self[elem] = count + self_get(elem, 0)
702
+ else:
703
+ # fast path when counter is empty
704
+ super().update(iterable)
705
+ else:
706
+ _count_elements(self, iterable)
707
+ if kwds:
708
+ self.update(kwds)
709
+
710
+ def subtract(self, iterable=None, /, **kwds):
711
+ '''Like dict.update() but subtracts counts instead of replacing them.
712
+ Counts can be reduced below zero. Both the inputs and outputs are
713
+ allowed to contain zero and negative counts.
714
+
715
+ Source can be an iterable, a dictionary, or another Counter instance.
716
+
717
+ >>> c = Counter('which')
718
+ >>> c.subtract('witch') # subtract elements from another iterable
719
+ >>> c.subtract(Counter('watch')) # subtract elements from another counter
720
+ >>> c['h'] # 2 in which, minus 1 in witch, minus 1 in watch
721
+ 0
722
+ >>> c['w'] # 1 in which, minus 1 in witch, minus 1 in watch
723
+ -1
724
+
725
+ '''
726
+ if iterable is not None:
727
+ self_get = self.get
728
+ if isinstance(iterable, _collections_abc.Mapping):
729
+ for elem, count in iterable.items():
730
+ self[elem] = self_get(elem, 0) - count
731
+ else:
732
+ for elem in iterable:
733
+ self[elem] = self_get(elem, 0) - 1
734
+ if kwds:
735
+ self.subtract(kwds)
736
+
737
+ def copy(self):
738
+ 'Return a shallow copy.'
739
+ return self.__class__(self)
740
+
741
+ def __reduce__(self):
742
+ return self.__class__, (dict(self),)
743
+
744
+ def __delitem__(self, elem):
745
+ 'Like dict.__delitem__() but does not raise KeyError for missing values.'
746
+ if elem in self:
747
+ super().__delitem__(elem)
748
+
749
+ def __repr__(self):
750
+ if not self:
751
+ return f'{self.__class__.__name__}()'
752
+ try:
753
+ # dict() preserves the ordering returned by most_common()
754
+ d = dict(self.most_common())
755
+ except TypeError:
756
+ # handle case where values are not orderable
757
+ d = dict(self)
758
+ return f'{self.__class__.__name__}({d!r})'
759
+
760
+ # Multiset-style mathematical operations discussed in:
761
+ # Knuth TAOCP Volume II section 4.6.3 exercise 19
762
+ # and at http://en.wikipedia.org/wiki/Multiset
763
+ #
764
+ # Outputs guaranteed to only include positive counts.
765
+ #
766
+ # To strip negative and zero counts, add-in an empty counter:
767
+ # c += Counter()
768
+ #
769
+ # Results are ordered according to when an element is first
770
+ # encountered in the left operand and then by the order
771
+ # encountered in the right operand.
772
+ #
773
+ # When the multiplicities are all zero or one, multiset operations
774
+ # are guaranteed to be equivalent to the corresponding operations
775
+ # for regular sets.
776
+ # Given counter multisets such as:
777
+ # cp = Counter(a=1, b=0, c=1)
778
+ # cq = Counter(c=1, d=0, e=1)
779
+ # The corresponding regular sets would be:
780
+ # sp = {'a', 'c'}
781
+ # sq = {'c', 'e'}
782
+ # All of the following relations would hold:
783
+ # set(cp + cq) == sp | sq
784
+ # set(cp - cq) == sp - sq
785
+ # set(cp | cq) == sp | sq
786
+ # set(cp & cq) == sp & sq
787
+ # (cp == cq) == (sp == sq)
788
+ # (cp != cq) == (sp != sq)
789
+ # (cp <= cq) == (sp <= sq)
790
+ # (cp < cq) == (sp < sq)
791
+ # (cp >= cq) == (sp >= sq)
792
+ # (cp > cq) == (sp > sq)
793
+
794
+ def __eq__(self, other):
795
+ 'True if all counts agree. Missing counts are treated as zero.'
796
+ if not isinstance(other, Counter):
797
+ return NotImplemented
798
+ return all(self[e] == other[e] for c in (self, other) for e in c)
799
+
800
+ def __ne__(self, other):
801
+ 'True if any counts disagree. Missing counts are treated as zero.'
802
+ if not isinstance(other, Counter):
803
+ return NotImplemented
804
+ return not self == other
805
+
806
+ def __le__(self, other):
807
+ 'True if all counts in self are a subset of those in other.'
808
+ if not isinstance(other, Counter):
809
+ return NotImplemented
810
+ return all(self[e] <= other[e] for c in (self, other) for e in c)
811
+
812
+ def __lt__(self, other):
813
+ 'True if all counts in self are a proper subset of those in other.'
814
+ if not isinstance(other, Counter):
815
+ return NotImplemented
816
+ return self <= other and self != other
817
+
818
+ def __ge__(self, other):
819
+ 'True if all counts in self are a superset of those in other.'
820
+ if not isinstance(other, Counter):
821
+ return NotImplemented
822
+ return all(self[e] >= other[e] for c in (self, other) for e in c)
823
+
824
+ def __gt__(self, other):
825
+ 'True if all counts in self are a proper superset of those in other.'
826
+ if not isinstance(other, Counter):
827
+ return NotImplemented
828
+ return self >= other and self != other
829
+
830
+ def __add__(self, other):
831
+ '''Add counts from two counters.
832
+
833
+ >>> Counter('abbb') + Counter('bcc')
834
+ Counter({'b': 4, 'c': 2, 'a': 1})
835
+
836
+ '''
837
+ if not isinstance(other, Counter):
838
+ return NotImplemented
839
+ result = Counter()
840
+ for elem, count in self.items():
841
+ newcount = count + other[elem]
842
+ if newcount > 0:
843
+ result[elem] = newcount
844
+ for elem, count in other.items():
845
+ if elem not in self and count > 0:
846
+ result[elem] = count
847
+ return result
848
+
849
+ def __sub__(self, other):
850
+ ''' Subtract count, but keep only results with positive counts.
851
+
852
+ >>> Counter('abbbc') - Counter('bccd')
853
+ Counter({'b': 2, 'a': 1})
854
+
855
+ '''
856
+ if not isinstance(other, Counter):
857
+ return NotImplemented
858
+ result = Counter()
859
+ for elem, count in self.items():
860
+ newcount = count - other[elem]
861
+ if newcount > 0:
862
+ result[elem] = newcount
863
+ for elem, count in other.items():
864
+ if elem not in self and count < 0:
865
+ result[elem] = 0 - count
866
+ return result
867
+
868
+ def __or__(self, other):
869
+ '''Union is the maximum of value in either of the input counters.
870
+
871
+ >>> Counter('abbb') | Counter('bcc')
872
+ Counter({'b': 3, 'c': 2, 'a': 1})
873
+
874
+ '''
875
+ if not isinstance(other, Counter):
876
+ return NotImplemented
877
+ result = Counter()
878
+ for elem, count in self.items():
879
+ other_count = other[elem]
880
+ newcount = other_count if count < other_count else count
881
+ if newcount > 0:
882
+ result[elem] = newcount
883
+ for elem, count in other.items():
884
+ if elem not in self and count > 0:
885
+ result[elem] = count
886
+ return result
887
+
888
+ def __and__(self, other):
889
+ ''' Intersection is the minimum of corresponding counts.
890
+
891
+ >>> Counter('abbb') & Counter('bcc')
892
+ Counter({'b': 1})
893
+
894
+ '''
895
+ if not isinstance(other, Counter):
896
+ return NotImplemented
897
+ result = Counter()
898
+ for elem, count in self.items():
899
+ other_count = other[elem]
900
+ newcount = count if count < other_count else other_count
901
+ if newcount > 0:
902
+ result[elem] = newcount
903
+ return result
904
+
905
+ def __pos__(self):
906
+ 'Adds an empty counter, effectively stripping negative and zero counts'
907
+ result = Counter()
908
+ for elem, count in self.items():
909
+ if count > 0:
910
+ result[elem] = count
911
+ return result
912
+
913
+ def __neg__(self):
914
+ '''Subtracts from an empty counter. Strips positive and zero counts,
915
+ and flips the sign on negative counts.
916
+
917
+ '''
918
+ result = Counter()
919
+ for elem, count in self.items():
920
+ if count < 0:
921
+ result[elem] = 0 - count
922
+ return result
923
+
924
+ def _keep_positive(self):
925
+ '''Internal method to strip elements with a negative or zero count'''
926
+ nonpositive = [elem for elem, count in self.items() if not count > 0]
927
+ for elem in nonpositive:
928
+ del self[elem]
929
+ return self
930
+
931
+ def __iadd__(self, other):
932
+ '''Inplace add from another counter, keeping only positive counts.
933
+
934
+ >>> c = Counter('abbb')
935
+ >>> c += Counter('bcc')
936
+ >>> c
937
+ Counter({'b': 4, 'c': 2, 'a': 1})
938
+
939
+ '''
940
+ for elem, count in other.items():
941
+ self[elem] += count
942
+ return self._keep_positive()
943
+
944
+ def __isub__(self, other):
945
+ '''Inplace subtract counter, but keep only results with positive counts.
946
+
947
+ >>> c = Counter('abbbc')
948
+ >>> c -= Counter('bccd')
949
+ >>> c
950
+ Counter({'b': 2, 'a': 1})
951
+
952
+ '''
953
+ for elem, count in other.items():
954
+ self[elem] -= count
955
+ return self._keep_positive()
956
+
957
+ def __ior__(self, other):
958
+ '''Inplace union is the maximum of value from either counter.
959
+
960
+ >>> c = Counter('abbb')
961
+ >>> c |= Counter('bcc')
962
+ >>> c
963
+ Counter({'b': 3, 'c': 2, 'a': 1})
964
+
965
+ '''
966
+ for elem, other_count in other.items():
967
+ count = self[elem]
968
+ if other_count > count:
969
+ self[elem] = other_count
970
+ return self._keep_positive()
971
+
972
+ def __iand__(self, other):
973
+ '''Inplace intersection is the minimum of corresponding counts.
974
+
975
+ >>> c = Counter('abbb')
976
+ >>> c &= Counter('bcc')
977
+ >>> c
978
+ Counter({'b': 1})
979
+
980
+ '''
981
+ for elem, count in self.items():
982
+ other_count = other[elem]
983
+ if other_count < count:
984
+ self[elem] = other_count
985
+ return self._keep_positive()
986
+
987
+
988
+ ########################################################################
989
+ ### ChainMap
990
+ ########################################################################
991
+
992
+ class ChainMap(_collections_abc.MutableMapping):
993
+ ''' A ChainMap groups multiple dicts (or other mappings) together
994
+ to create a single, updateable view.
995
+
996
+ The underlying mappings are stored in a list. That list is public and can
997
+ be accessed or updated using the *maps* attribute. There is no other
998
+ state.
999
+
1000
+ Lookups search the underlying mappings successively until a key is found.
1001
+ In contrast, writes, updates, and deletions only operate on the first
1002
+ mapping.
1003
+
1004
+ '''
1005
+
1006
+ def __init__(self, *maps):
1007
+ '''Initialize a ChainMap by setting *maps* to the given mappings.
1008
+ If no mappings are provided, a single empty dictionary is used.
1009
+
1010
+ '''
1011
+ self.maps = list(maps) or [{}] # always at least one map
1012
+
1013
+ def __missing__(self, key):
1014
+ raise KeyError(key)
1015
+
1016
+ def __getitem__(self, key):
1017
+ for mapping in self.maps:
1018
+ try:
1019
+ return mapping[key] # can't use 'key in mapping' with defaultdict
1020
+ except KeyError:
1021
+ pass
1022
+ return self.__missing__(key) # support subclasses that define __missing__
1023
+
1024
+ def get(self, key, default=None):
1025
+ return self[key] if key in self else default
1026
+
1027
+ def __len__(self):
1028
+ return len(set().union(*self.maps)) # reuses stored hash values if possible
1029
+
1030
+ def __iter__(self):
1031
+ d = {}
1032
+ for mapping in map(dict.fromkeys, reversed(self.maps)):
1033
+ d |= mapping # reuses stored hash values if possible
1034
+ return iter(d)
1035
+
1036
+ def __contains__(self, key):
1037
+ return any(key in m for m in self.maps)
1038
+
1039
+ def __bool__(self):
1040
+ return any(self.maps)
1041
+
1042
+ @_recursive_repr()
1043
+ def __repr__(self):
1044
+ return f'{self.__class__.__name__}({", ".join(map(repr, self.maps))})'
1045
+
1046
+ @classmethod
1047
+ def fromkeys(cls, iterable, value=None, /):
1048
+ 'Create a new ChainMap with keys from iterable and values set to value.'
1049
+ return cls(dict.fromkeys(iterable, value))
1050
+
1051
+ def copy(self):
1052
+ 'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]'
1053
+ return self.__class__(self.maps[0].copy(), *self.maps[1:])
1054
+
1055
+ __copy__ = copy
1056
+
1057
+ def new_child(self, m=None, **kwargs): # like Django's Context.push()
1058
+ '''New ChainMap with a new map followed by all previous maps.
1059
+ If no map is provided, an empty dict is used.
1060
+ Keyword arguments update the map or new empty dict.
1061
+ '''
1062
+ if m is None:
1063
+ m = kwargs
1064
+ elif kwargs:
1065
+ m.update(kwargs)
1066
+ return self.__class__(m, *self.maps)
1067
+
1068
+ @property
1069
+ def parents(self): # like Django's Context.pop()
1070
+ 'New ChainMap from maps[1:].'
1071
+ return self.__class__(*self.maps[1:])
1072
+
1073
+ def __setitem__(self, key, value):
1074
+ self.maps[0][key] = value
1075
+
1076
+ def __delitem__(self, key):
1077
+ try:
1078
+ del self.maps[0][key]
1079
+ except KeyError:
1080
+ raise KeyError(f'Key not found in the first mapping: {key!r}')
1081
+
1082
+ def popitem(self):
1083
+ 'Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.'
1084
+ try:
1085
+ return self.maps[0].popitem()
1086
+ except KeyError:
1087
+ raise KeyError('No keys found in the first mapping.')
1088
+
1089
+ def pop(self, key, *args):
1090
+ 'Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].'
1091
+ try:
1092
+ return self.maps[0].pop(key, *args)
1093
+ except KeyError:
1094
+ raise KeyError(f'Key not found in the first mapping: {key!r}')
1095
+
1096
+ def clear(self):
1097
+ 'Clear maps[0], leaving maps[1:] intact.'
1098
+ self.maps[0].clear()
1099
+
1100
+ def __ior__(self, other):
1101
+ self.maps[0].update(other)
1102
+ return self
1103
+
1104
+ def __or__(self, other):
1105
+ if not isinstance(other, _collections_abc.Mapping):
1106
+ return NotImplemented
1107
+ m = self.copy()
1108
+ m.maps[0].update(other)
1109
+ return m
1110
+
1111
+ def __ror__(self, other):
1112
+ if not isinstance(other, _collections_abc.Mapping):
1113
+ return NotImplemented
1114
+ m = dict(other)
1115
+ for child in reversed(self.maps):
1116
+ m.update(child)
1117
+ return self.__class__(m)
1118
+
1119
+
1120
+ ################################################################################
1121
+ ### UserDict
1122
+ ################################################################################
1123
+
1124
+ class UserDict(_collections_abc.MutableMapping):
1125
+
1126
+ # Start by filling-out the abstract methods
1127
+ def __init__(self, dict=None, /, **kwargs):
1128
+ self.data = {}
1129
+ if dict is not None:
1130
+ self.update(dict)
1131
+ if kwargs:
1132
+ self.update(kwargs)
1133
+
1134
+ def __len__(self):
1135
+ return len(self.data)
1136
+
1137
+ def __getitem__(self, key):
1138
+ if key in self.data:
1139
+ return self.data[key]
1140
+ if hasattr(self.__class__, "__missing__"):
1141
+ return self.__class__.__missing__(self, key)
1142
+ raise KeyError(key)
1143
+
1144
+ def __setitem__(self, key, item):
1145
+ self.data[key] = item
1146
+
1147
+ def __delitem__(self, key):
1148
+ del self.data[key]
1149
+
1150
+ def __iter__(self):
1151
+ return iter(self.data)
1152
+
1153
+ # Modify __contains__ and get() to work like dict
1154
+ # does when __missing__ is present.
1155
+ def __contains__(self, key):
1156
+ return key in self.data
1157
+
1158
+ def get(self, key, default=None):
1159
+ if key in self:
1160
+ return self[key]
1161
+ return default
1162
+
1163
+
1164
+ # Now, add the methods in dicts but not in MutableMapping
1165
+ def __repr__(self):
1166
+ return repr(self.data)
1167
+
1168
+ def __or__(self, other):
1169
+ if isinstance(other, UserDict):
1170
+ return self.__class__(self.data | other.data)
1171
+ if isinstance(other, dict):
1172
+ return self.__class__(self.data | other)
1173
+ return NotImplemented
1174
+
1175
+ def __ror__(self, other):
1176
+ if isinstance(other, UserDict):
1177
+ return self.__class__(other.data | self.data)
1178
+ if isinstance(other, dict):
1179
+ return self.__class__(other | self.data)
1180
+ return NotImplemented
1181
+
1182
+ def __ior__(self, other):
1183
+ if isinstance(other, UserDict):
1184
+ self.data |= other.data
1185
+ else:
1186
+ self.data |= other
1187
+ return self
1188
+
1189
+ def __copy__(self):
1190
+ inst = self.__class__.__new__(self.__class__)
1191
+ inst.__dict__.update(self.__dict__)
1192
+ # Create a copy and avoid triggering descriptors
1193
+ inst.__dict__["data"] = self.__dict__["data"].copy()
1194
+ return inst
1195
+
1196
+ def copy(self):
1197
+ if self.__class__ is UserDict:
1198
+ return UserDict(self.data.copy())
1199
+ import copy
1200
+ data = self.data
1201
+ try:
1202
+ self.data = {}
1203
+ c = copy.copy(self)
1204
+ finally:
1205
+ self.data = data
1206
+ c.update(self)
1207
+ return c
1208
+
1209
+ @classmethod
1210
+ def fromkeys(cls, iterable, value=None):
1211
+ d = cls()
1212
+ for key in iterable:
1213
+ d[key] = value
1214
+ return d
1215
+
1216
+
1217
+ ################################################################################
1218
+ ### UserList
1219
+ ################################################################################
1220
+
1221
+ class UserList(_collections_abc.MutableSequence):
1222
+ """A more or less complete user-defined wrapper around list objects."""
1223
+
1224
+ def __init__(self, initlist=None):
1225
+ self.data = []
1226
+ if initlist is not None:
1227
+ # XXX should this accept an arbitrary sequence?
1228
+ if type(initlist) == type(self.data):
1229
+ self.data[:] = initlist
1230
+ elif isinstance(initlist, UserList):
1231
+ self.data[:] = initlist.data[:]
1232
+ else:
1233
+ self.data = list(initlist)
1234
+
1235
+ def __repr__(self):
1236
+ return repr(self.data)
1237
+
1238
+ def __lt__(self, other):
1239
+ return self.data < self.__cast(other)
1240
+
1241
+ def __le__(self, other):
1242
+ return self.data <= self.__cast(other)
1243
+
1244
+ def __eq__(self, other):
1245
+ return self.data == self.__cast(other)
1246
+
1247
+ def __gt__(self, other):
1248
+ return self.data > self.__cast(other)
1249
+
1250
+ def __ge__(self, other):
1251
+ return self.data >= self.__cast(other)
1252
+
1253
+ def __cast(self, other):
1254
+ return other.data if isinstance(other, UserList) else other
1255
+
1256
+ def __contains__(self, item):
1257
+ return item in self.data
1258
+
1259
+ def __len__(self):
1260
+ return len(self.data)
1261
+
1262
+ def __getitem__(self, i):
1263
+ if isinstance(i, slice):
1264
+ return self.__class__(self.data[i])
1265
+ else:
1266
+ return self.data[i]
1267
+
1268
+ def __setitem__(self, i, item):
1269
+ self.data[i] = item
1270
+
1271
+ def __delitem__(self, i):
1272
+ del self.data[i]
1273
+
1274
+ def __add__(self, other):
1275
+ if isinstance(other, UserList):
1276
+ return self.__class__(self.data + other.data)
1277
+ elif isinstance(other, type(self.data)):
1278
+ return self.__class__(self.data + other)
1279
+ return self.__class__(self.data + list(other))
1280
+
1281
+ def __radd__(self, other):
1282
+ if isinstance(other, UserList):
1283
+ return self.__class__(other.data + self.data)
1284
+ elif isinstance(other, type(self.data)):
1285
+ return self.__class__(other + self.data)
1286
+ return self.__class__(list(other) + self.data)
1287
+
1288
+ def __iadd__(self, other):
1289
+ if isinstance(other, UserList):
1290
+ self.data += other.data
1291
+ elif isinstance(other, type(self.data)):
1292
+ self.data += other
1293
+ else:
1294
+ self.data += list(other)
1295
+ return self
1296
+
1297
+ def __mul__(self, n):
1298
+ return self.__class__(self.data * n)
1299
+
1300
+ __rmul__ = __mul__
1301
+
1302
+ def __imul__(self, n):
1303
+ self.data *= n
1304
+ return self
1305
+
1306
+ def __copy__(self):
1307
+ inst = self.__class__.__new__(self.__class__)
1308
+ inst.__dict__.update(self.__dict__)
1309
+ # Create a copy and avoid triggering descriptors
1310
+ inst.__dict__["data"] = self.__dict__["data"][:]
1311
+ return inst
1312
+
1313
+ def append(self, item):
1314
+ self.data.append(item)
1315
+
1316
+ def insert(self, i, item):
1317
+ self.data.insert(i, item)
1318
+
1319
+ def pop(self, i=-1):
1320
+ return self.data.pop(i)
1321
+
1322
+ def remove(self, item):
1323
+ self.data.remove(item)
1324
+
1325
+ def clear(self):
1326
+ self.data.clear()
1327
+
1328
+ def copy(self):
1329
+ return self.__class__(self)
1330
+
1331
+ def count(self, item):
1332
+ return self.data.count(item)
1333
+
1334
+ def index(self, item, *args):
1335
+ return self.data.index(item, *args)
1336
+
1337
+ def reverse(self):
1338
+ self.data.reverse()
1339
+
1340
+ def sort(self, /, *args, **kwds):
1341
+ self.data.sort(*args, **kwds)
1342
+
1343
+ def extend(self, other):
1344
+ if isinstance(other, UserList):
1345
+ self.data.extend(other.data)
1346
+ else:
1347
+ self.data.extend(other)
1348
+
1349
+
1350
+ ################################################################################
1351
+ ### UserString
1352
+ ################################################################################
1353
+
1354
+ class UserString(_collections_abc.Sequence):
1355
+
1356
+ def __init__(self, seq):
1357
+ if isinstance(seq, str):
1358
+ self.data = seq
1359
+ elif isinstance(seq, UserString):
1360
+ self.data = seq.data[:]
1361
+ else:
1362
+ self.data = str(seq)
1363
+
1364
+ def __str__(self):
1365
+ return str(self.data)
1366
+
1367
+ def __repr__(self):
1368
+ return repr(self.data)
1369
+
1370
+ def __int__(self):
1371
+ return int(self.data)
1372
+
1373
+ def __float__(self):
1374
+ return float(self.data)
1375
+
1376
+ def __complex__(self):
1377
+ return complex(self.data)
1378
+
1379
+ def __hash__(self):
1380
+ return hash(self.data)
1381
+
1382
+ def __getnewargs__(self):
1383
+ return (self.data[:],)
1384
+
1385
+ def __eq__(self, string):
1386
+ if isinstance(string, UserString):
1387
+ return self.data == string.data
1388
+ return self.data == string
1389
+
1390
+ def __lt__(self, string):
1391
+ if isinstance(string, UserString):
1392
+ return self.data < string.data
1393
+ return self.data < string
1394
+
1395
+ def __le__(self, string):
1396
+ if isinstance(string, UserString):
1397
+ return self.data <= string.data
1398
+ return self.data <= string
1399
+
1400
+ def __gt__(self, string):
1401
+ if isinstance(string, UserString):
1402
+ return self.data > string.data
1403
+ return self.data > string
1404
+
1405
+ def __ge__(self, string):
1406
+ if isinstance(string, UserString):
1407
+ return self.data >= string.data
1408
+ return self.data >= string
1409
+
1410
+ def __contains__(self, char):
1411
+ if isinstance(char, UserString):
1412
+ char = char.data
1413
+ return char in self.data
1414
+
1415
+ def __len__(self):
1416
+ return len(self.data)
1417
+
1418
+ def __getitem__(self, index):
1419
+ return self.__class__(self.data[index])
1420
+
1421
+ def __add__(self, other):
1422
+ if isinstance(other, UserString):
1423
+ return self.__class__(self.data + other.data)
1424
+ elif isinstance(other, str):
1425
+ return self.__class__(self.data + other)
1426
+ return self.__class__(self.data + str(other))
1427
+
1428
+ def __radd__(self, other):
1429
+ if isinstance(other, str):
1430
+ return self.__class__(other + self.data)
1431
+ return self.__class__(str(other) + self.data)
1432
+
1433
+ def __mul__(self, n):
1434
+ return self.__class__(self.data * n)
1435
+
1436
+ __rmul__ = __mul__
1437
+
1438
+ def __mod__(self, args):
1439
+ return self.__class__(self.data % args)
1440
+
1441
+ def __rmod__(self, template):
1442
+ return self.__class__(str(template) % self)
1443
+
1444
+ # the following methods are defined in alphabetical order:
1445
+ def capitalize(self):
1446
+ return self.__class__(self.data.capitalize())
1447
+
1448
+ def casefold(self):
1449
+ return self.__class__(self.data.casefold())
1450
+
1451
+ def center(self, width, *args):
1452
+ return self.__class__(self.data.center(width, *args))
1453
+
1454
+ def count(self, sub, start=0, end=_sys.maxsize):
1455
+ if isinstance(sub, UserString):
1456
+ sub = sub.data
1457
+ return self.data.count(sub, start, end)
1458
+
1459
+ def removeprefix(self, prefix, /):
1460
+ if isinstance(prefix, UserString):
1461
+ prefix = prefix.data
1462
+ return self.__class__(self.data.removeprefix(prefix))
1463
+
1464
+ def removesuffix(self, suffix, /):
1465
+ if isinstance(suffix, UserString):
1466
+ suffix = suffix.data
1467
+ return self.__class__(self.data.removesuffix(suffix))
1468
+
1469
+ def encode(self, encoding='utf-8', errors='strict'):
1470
+ encoding = 'utf-8' if encoding is None else encoding
1471
+ errors = 'strict' if errors is None else errors
1472
+ return self.data.encode(encoding, errors)
1473
+
1474
+ def endswith(self, suffix, start=0, end=_sys.maxsize):
1475
+ return self.data.endswith(suffix, start, end)
1476
+
1477
+ def expandtabs(self, tabsize=8):
1478
+ return self.__class__(self.data.expandtabs(tabsize))
1479
+
1480
+ def find(self, sub, start=0, end=_sys.maxsize):
1481
+ if isinstance(sub, UserString):
1482
+ sub = sub.data
1483
+ return self.data.find(sub, start, end)
1484
+
1485
+ def format(self, /, *args, **kwds):
1486
+ return self.data.format(*args, **kwds)
1487
+
1488
+ def format_map(self, mapping):
1489
+ return self.data.format_map(mapping)
1490
+
1491
+ def index(self, sub, start=0, end=_sys.maxsize):
1492
+ if isinstance(sub, UserString):
1493
+ sub = sub.data
1494
+ return self.data.index(sub, start, end)
1495
+
1496
+ def isalpha(self):
1497
+ return self.data.isalpha()
1498
+
1499
+ def isalnum(self):
1500
+ return self.data.isalnum()
1501
+
1502
+ def isascii(self):
1503
+ return self.data.isascii()
1504
+
1505
+ def isdecimal(self):
1506
+ return self.data.isdecimal()
1507
+
1508
+ def isdigit(self):
1509
+ return self.data.isdigit()
1510
+
1511
+ def isidentifier(self):
1512
+ return self.data.isidentifier()
1513
+
1514
+ def islower(self):
1515
+ return self.data.islower()
1516
+
1517
+ def isnumeric(self):
1518
+ return self.data.isnumeric()
1519
+
1520
+ def isprintable(self):
1521
+ return self.data.isprintable()
1522
+
1523
+ def isspace(self):
1524
+ return self.data.isspace()
1525
+
1526
+ def istitle(self):
1527
+ return self.data.istitle()
1528
+
1529
+ def isupper(self):
1530
+ return self.data.isupper()
1531
+
1532
+ def join(self, seq):
1533
+ return self.data.join(seq)
1534
+
1535
+ def ljust(self, width, *args):
1536
+ return self.__class__(self.data.ljust(width, *args))
1537
+
1538
+ def lower(self):
1539
+ return self.__class__(self.data.lower())
1540
+
1541
+ def lstrip(self, chars=None):
1542
+ return self.__class__(self.data.lstrip(chars))
1543
+
1544
+ maketrans = str.maketrans
1545
+
1546
+ def partition(self, sep):
1547
+ return self.data.partition(sep)
1548
+
1549
+ def replace(self, old, new, maxsplit=-1):
1550
+ if isinstance(old, UserString):
1551
+ old = old.data
1552
+ if isinstance(new, UserString):
1553
+ new = new.data
1554
+ return self.__class__(self.data.replace(old, new, maxsplit))
1555
+
1556
+ def rfind(self, sub, start=0, end=_sys.maxsize):
1557
+ if isinstance(sub, UserString):
1558
+ sub = sub.data
1559
+ return self.data.rfind(sub, start, end)
1560
+
1561
+ def rindex(self, sub, start=0, end=_sys.maxsize):
1562
+ if isinstance(sub, UserString):
1563
+ sub = sub.data
1564
+ return self.data.rindex(sub, start, end)
1565
+
1566
+ def rjust(self, width, *args):
1567
+ return self.__class__(self.data.rjust(width, *args))
1568
+
1569
+ def rpartition(self, sep):
1570
+ return self.data.rpartition(sep)
1571
+
1572
+ def rstrip(self, chars=None):
1573
+ return self.__class__(self.data.rstrip(chars))
1574
+
1575
+ def split(self, sep=None, maxsplit=-1):
1576
+ return self.data.split(sep, maxsplit)
1577
+
1578
+ def rsplit(self, sep=None, maxsplit=-1):
1579
+ return self.data.rsplit(sep, maxsplit)
1580
+
1581
+ def splitlines(self, keepends=False):
1582
+ return self.data.splitlines(keepends)
1583
+
1584
+ def startswith(self, prefix, start=0, end=_sys.maxsize):
1585
+ return self.data.startswith(prefix, start, end)
1586
+
1587
+ def strip(self, chars=None):
1588
+ return self.__class__(self.data.strip(chars))
1589
+
1590
+ def swapcase(self):
1591
+ return self.__class__(self.data.swapcase())
1592
+
1593
+ def title(self):
1594
+ return self.__class__(self.data.title())
1595
+
1596
+ def translate(self, *args):
1597
+ return self.__class__(self.data.translate(*args))
1598
+
1599
+ def upper(self):
1600
+ return self.__class__(self.data.upper())
1601
+
1602
+ def zfill(self, width):
1603
+ return self.__class__(self.data.zfill(width))